MediaWiki powered by Websoft9((LAMP | CentOS7.4))
Jun 28, 2024
'' );
This line forces the PHP interpreter to read the extension file, and
thereby make it accessible to MediaWiki.
Some extensions can conflict with maintenance scripts, for example if
they directly access $_SERVER (not recommended).
In this case they can be wrapped in the conditional so maintenance
scripts can still run.
//for mw.v 1.24.x or less
if (!$wgCommandLineMode) {
require_once "$IP/extensions/extension_name/extension_name.php";
}
//for mw.v 1.25.x or above
if (!$wgCommandLineMode) {
wfLoadExtension ( '''' );
}
The maintenance script importDump.php
(https://www.mediawiki.org/wiki/Special:MyLanguage/Manual:ImportDump.php) will
fail for any extension which requires customized namespaces which
is included inside the conditional above such as Extension:Semantic
MediaWiki
(https://www.mediawiki.org/wiki/Special:MyLanguage/Extension:Semantic_MediaWiki), Ext
Forms
(https://www.mediawiki.org/wiki/Special:MyLanguage/Extension:Semantic_Forms).Note:
Ensure that required permissions are set for extensions!
While this installation procedure is sufficient for most extensions, some
require a different installation procedure. Check your extension’s
documentation for details.
If you want to alter configuration variables in LocalSettings.php, you have
to do this typically after including the extension. Otherwise defaults
defined in the extension will overwrite your settings.
While extension declaration can be placed in other places within the
LocalSettings.php file, never place extensions before the require_once
“includes/DefaultSettings.php”; line for MediaWiki versions below 1.17 . Doing
so will blank the extension setup function arrays, causing no extensions to
be installed, and probably will make your wiki inaccessible until you fix it!
Upgrading an extension
Some extensions require to be updated whenever you update MediaWiki,
while others work with multiple versions. To upgrade to a new version of an
extension:
1. Download the new version of the extension
2. Replace all the extension files in
the extension/ExtensionName directory with the new files. Do not
remove the extension configuration present in LocalSettings.php
3. Depending on the extension, you may have to run the Update.php
(https://www.mediawiki.org/wiki/Manual:Update.php) maintenance
script. Most extensions will mention if this script needs to be run or
not. (Running the update.php script when its unnecessary will not
hurt anything, so if you’re unsure don’t be afraid to run it). If you don’t
have command line access, you can also use the web updater
(https://www.mediawiki.org/wiki/Special:MyLanguage/Manual:Upgrading#Web_upda
4. That’s all you need to do. In most cases any extension configuration
you have in LocalSettings.php will also work with the newer version of
the extension.
Note:These instructions cover 99% of extensions. If the specific extension
you are upgrading has instructions that differ from these, you should
probably follow the specific extension’s instructions Uninstalling an extension
Extensions are added by adding a line to LocalSettings.php, which basically
looks like this:
// mw.v 1.24.x or less
require_once ''extensions/extension_name/extension_name.php'';
// mw.v 1.25.x or above
wfLoadExtension( '''' );
Depending on the extension you want to uninstall additionally other stuff
might be done on installation, which you want to undo now. For details see
the section on installing an extension.
1. Remove this line and the extension is uninstalled. If you want to, you
can (and if you do not want to use this extension in the future you
should) remove the files of this extension inside the folder
“extensions/”.
2. Maybe you also have some other lines in LocalSettings.php, which
have to do with the extension you want to remove. Most likely this will
be lines, which give certain users the right to access pages, which are
provided by the extension. These lines contain the variable
“$wgGroupPermissions” and make some settings there. As far as they
have to do with rights, which come from the removed extension, you
can remove these lines as well.
3. Maybe your extension also has added columns to your database. The
updater maintenance/update.php removes them, when you run it,
after you have uninstalled the extension.
Backup
It is important to make regular backups of the data in your wiki. This page
provides an overview of the backup process for a typical MediaWiki wiki;
you will probably want to devise your own backup scripts or schedule to
suit the size of your wiki and your individual needs.
Manual:Backing up a wiki
(https://www.mediawiki.org/wiki/Manual:Backing_up_a_wiki)Manual:Restoring a wiki from backup
(https://www.mediawiki.org/wiki/Manual:Restoring_a_wiki_from_backup)
Upgrade
Run upgrading,follow these steps:
1. Check the requirements
2. Read the release notes
3. Back up existing files and the database
4. Unpack the new files
5. Upgrade extensions
6. Run the update script to check the database
7. Test the updat
Read more:https://www.mediawiki.org/wiki/Manual:Upgrading
(https://www.mediawiki.org/wiki/Manual:Upgrading)
How to modify the LocalSettings.php?
If you have installed MediaWiki,the installer has generated
a LocalSettings.php file. It contains all your configuration.
You will need to download it and put it in the base of your wiki installation
(the same directory as index.php). The download should have started
automatically.
LocalSettings.php is a part of configuration of Mediawiki,you can see
includes/DefaultSettings.php for all configurable settings.But if you
make changes for DefaultSettings.php, they will be lost on next upgrade of
MediaWiki!How to modify the allowed limit for
upload?
Modify the /usr/local/php/etc/php.ini file to increase the allowed size for
uploads:
; Maximum size of POST data that PHP will accept.
post_max_size = 16M
; Maximum allowed size for uploaded files.
upload_max_filesize = 16M
then,restart the apache
# service httpd restart
How to create and edit a page?
How to create a page?
There are several ways to create a new page:
Create a link to the page on another page, then click on the red link
which appears
Browse to the intended location of the page,
e.g. http://www.example.com/index.php?title=New_page and click on the
“Edit“, “Create” or “Create source” link.
On some wikis, a failed search for a page will contain a link which allows
you to edit that page.
See also: Help:Starting a new page
(https://www.mediawiki.org/wiki/Special:MyLanguage/Help:Starting_a_new_page)
There have another effective method for creating new page.You may enter
the name of a new page directly in the search field, and click the “Search”
button and can choose Create this page of the results page. The new page
will be named after your query.
How to edit a page?
It’s very easy to edit the contents of a wiki:
1. Click the “Edit” page tab at the top of the page.
2. Make changes to the text.
3. Click the “Save page” button.
How to Re-installation?
Visit the URL http://youdomin.com/mediawiki/mw-config/index.php?
page=Restart&lastPage=Install
Enter the Restart Installation below:
When remaind you that you need the UpgradeKey ,you can find
$wgUpgradeKey in then “LocalSettings.php” file
How do I change the logo?The logo that appears in the top left of each page is determined by
the $wgLogo
(https://www.mediawiki.org/wiki/Manual:$wgLogo) configuration line in
the LocalSettings.php
(https://www.mediawiki.org/wiki/Manual:LocalSettings.php) file.
There are two ways to change the logo:
1. Upload a picture to your wiki using the normal file uploading
interface. This allows the logo to be replaced easily, so you may want
to protect the page if you use this method.
Then add the $wgLogo line to LocalSettings.php, for example:
$wgLogo = "{$wgUploadPath}/6/62/mylogo.png";
2. Upload an image to your server by other means (such as FTP).
Add the $wgLogo line to LocalSettings.php, for example:
$wgLogo = "{$wgScriptPath}/mylogo.jpg";
(In this example, the image is in the same folder as the
LocalSettings.php file.)
If you want to change the logo in only specific pages, override #p-logo css’s
background-image property or use third party extension
like Extension:LogoFunctions
(https://www.mediawiki.org/wiki/Extension:LogoFunctions).
Caution: Do not simply overwrite the default logo installed with MediaWiki
(/skins/common/images/wiki.png); this file will be overwritten when you
upgrade.
How do I edit the wiki''s CSS?
You shouldn’t edit the CSS files (such as common.less) directly, because it
will make upgrading harder if you need to apply your customizations each
time you upgrade the software. Instead you need to edit a wiki page
called MediaWiki:Common.css
(https://www.mediawiki.org/wiki/MediaWiki:Common.css) if you want to
apply your CSS changes for all skins, or a wiki pagecalled MediaWiki:Vector.css
(https://www.mediawiki.org/wiki/MediaWiki:Vector.css) if you want to apply
the customizations only for the Vector skin.
The content of the MediaWiki:Common.css and MediaWiki:Vector.css pages
always overrides the default CSS styles specified in the skin files.
How do I change which page is the main
page?
By default, MediaWiki looks for a page with the title Main Page and serves
this as the default page. This can be changed by altering the contents
of MediaWiki:Mainpage
(https://www.mediawiki.org/wiki/Creating_a_MediaWiki_page) to point
to a different title. If this does not change the ‘Main Page’ link included on
the sidebar at install time, edit MediaWiki:Sidebar
(https://www.mediawiki.org/wiki/Creating_a_MediaWiki_page).
How do I change the interface language?
To change the default interface language, alter the value of $wgLanguageCode
(https://www.mediawiki.org/wiki/Manual:$wgLanguageCode) in LocalSettings.php ,
for example
$wgLanguageCode = "fr";
You may also need to bypass your browser’s cache
(https://en.wikipedia.org/wiki/Wikipedia:Bypass_your_cache) to see the
changes.
The new default interface language will be applied to all users who haven’t
ever customised it.
If you want to provide users the possibility to create and choose pages and
interface elements in languages other than the default one of the wiki, you
need the Translate extension(https://www.mediawiki.org/wiki/Extension:Translate), which can make your
wiki multilingual.
If you want to change the language settings for all existing users, use
the userOptions.php
(https://www.mediawiki.org/wiki/Manual:UserOptions.php) maintenance
script (https://www.mediawiki.org/wiki/Manual:Maintenance_scripts). For
instance, to have all users with English set use French instead, run:
php userOptions.php language --old en --new fr
How to enable file upload?
MediaWiki supports uploading and integration of media files. Uploads can
be enabled via a configuration setting, although it is recommended that
you check certain prerequisites first.
Make sure uploads are enabled in PHP
The following needs to be set in php.ini
(https://www.mediawiki.org/wiki/Special:MyLanguage/Manual:Php.ini):
file_uploads = On
If this is not set, PHP scripts cannot use the upload functions, and
MediaWiki’s uploads will not be enabled.
If the open_basedir directive is set, it must include both the destination
upload folder in your MediaWiki installation (“{$IP}/images”) and the
‘upload_tmp_dir’ folder (default system folder if not set). The addition of the
‘upload_tmp_dir’ can avoid messages like “Could not find file
“/var/tmp/php31aWnF” (where in this example the ‘upload_tmp_dir’ is
‘/var/tmp’). Read more about PHP file uploads at File upload basics
(http://www.php.net/features.file-upload) and in
particular move_uploaded_file() (http://php.net/move_uploaded_file).
Note: The formal value for the variable is a boolean
(https://en.wikipedia.org/wiki/Boolean_algebra_(logic)) expression. PHP
treats each string not recognized as a False value as true, hence the often
used “on” value yields the same result.Check directory security
The upload directory needs to be configured so that it is not possible for
an end user
(https://www.mediawiki.org/wiki/Talk:Configuring_file_uploads#End_User) to
upload and execute other scripts, which could then exploit access to your
web directory and damage your wiki or web site.
Set the /images folder (or the /uploads folder in previous versions) to have
permission “755”:
User can read, write and execute;
Group can read and execute;
World can read and execute.
If using safe_mode (https://www.mediawiki.org/wiki/Safe_mode), make
sure the directory is owned by the user used for running the php script
(that is, the apache user or, in case of suphp, the script owner).
sudo chown -R www-data:www-data images/
If using CentOS 6 or Mageia the owner:group in the chown command
should be “apache:apache” instead of “www-data:www-data”.
If using SELinux (https://www.mediawiki.org/wiki/SELinux), make sure to
adjust the ACLs accordingly (see there).
If using suphp (https://www.mediawiki.org/w/index.php?
title=Suphp&action=edit&redlink=1), make sure the umask is set to 0022 (or
less) in /etc/suphp.conf.
Restrict directory listing on images folder
If you don’t want a public user to list your images folder, an option is to set
this up in your apache configuration:
Options -Indexes
Setting uploads on/off
In MediaWiki version 1.5 and later, the attribute to be set resides
in LocalSettings.php
(https://www.mediawiki.org/wiki/LocalSettings.php) and $wgEnableUploads(https://www.mediawiki.org/wiki/Special:MyLanguage/Manual:$wgEnableUploads) is
set as follows:
$wgEnableUploads = true; # Enable uploads
This enables uploads, as one might expect. To disable them, set the
attribute to false:
$wgEnableUploads = false; # Disable uploads
Upload permissions
Per default, all registered users can upload files. To restrict this, you have to
change $wgGroupPermissions
(https://www.mediawiki.org/wiki/Manual:$wgGroupPermissions):
To prevent normal users from uploading files:
$wgGroupPermissions[''user''][''upload''] = false;
To create a special group called “uploadaccess”, and allow members of
that group to upload files:
$wgGroupPermissions[''uploadaccess''][''upload''] = true;
To allow “autoconfirmed” (non-newbie) users to upload files:
$wgGroupPermissions[''autoconfirmed''][''upload''] = true;
The right to replace existing files is handled by an extra permission,
called reupload :
To prevent normal users from overriding existing files:
$wgGroupPermissions[''user''][''reupload''] = false;
To allow “autoconfirmed” (non-newbie) users to replace existing files:
$wgGroupPermissions[''autoconfirmed''][''reupload''] = true;
If a ForeignFileRepo is set, the right to replace those files locally is handled
by an special permission, called reupload-shared :
To prevent normal users from overriding filerepo files locally:
$wgGroupPermissions[''user''][''reupload-shared''] = false;
To allow “autoconfirmed” (non-newbie) users to replace filerepo files
locally:
$wgGroupPermissions[''autoconfirmed''][''reupload-shared''] = true;See Manual:User rights
(https://www.mediawiki.org/wiki/Manual:User_rights) for details on user
rights, and Manual:Preventing access
(https://www.mediawiki.org/wiki/Manual:Preventing_access) for more
information about restricting access.
Mediawiki Link
Links
MediaWiki homepage (https://www.mediawiki.org)
Websoft9">