Manual:Maintenance scripts

The maintenance scripts are located in the maintenance subdirectory of a MediaWiki installation.

Executing the maintenance scripts
In order to run the maintenance scripts, you must first define the variables below:

to an existing administration user allowed to modify the appropriate database of your MediaWiki instance within MySQL.
 * MediaWiki 1.15 or so and later: define these in your LocalSettings.php file
 * earlier MediaWiki: rename the file AdminSettings.sample located in the root directory of your wiki to AdminSettings.php (now deprecated) and fill in the values below

The maintenance scripts must then be executed from the command line. $ ssh username@your.domain.com $ cd maintenance $ php rebuildall.php
 * Step 1: Open a command line connection to your server using a terminal emulator
 * Step 2: Change the current directory to the maintenance subdirectory:
 * Step 3: Execute the maintenance script that needs to be run:
 * If you get an error (for example: php.exe is no valid Win32 application), try the following:

$ php-cgi rebuildall.php
 * In Windows XP, the command is;

$ C:\path\to\php\php-win.exe C:\path\to\mediawiki\maintenance\rebuildall.php
 * on Ubuntu Linux 9.04 it would be:

cd /var/lib/mediawiki/maintenance ; sudo php rebuildall.php

Standard command-line options
Almost every PHP script in /maintenance supports several standard options:
 * --help : Displays help message
 * --conf : Location of LocalSettings.php, if not default (at parent directory of the script)
 * --dbuser : Database account to use, not used for scripts that don't require a database connection or when SQLite database backend is used
 * --dbpass : Database password to use, not used for scripts that don't require a database connection or when SQLite database backend is used
 * --globals : Output globals at the end of processing for debugging
 * --quiet : Whether to supress non-error output
 * --wiki : For specifying the wiki ID

MediaWiki installs that use symlinks
In cases where the MediaWiki php files are symlinked to a central installation you will need to specify to the maintenance script the path of the LocalSettings.php file. For example: php maintenance/importImages.php --conf /var/wwwdata/website.org/wiki/LocalSettings.php /tmp/wikiimages .jpg .png .svg Otherwise you will get this error: A copy of your installation's LocalSettings.php must exist and be readable in the source directory.

List of maintenance scripts
Here is the list of files included in the maintenance subdirectory located at the root of a MediaWiki installation. This list was created from the documentation located in the Documentation trunk and may not accurately reflect the contents of the maintenance subdirectory of the current release of the software.

You can contribute to this manual by keeping this list up to date, adding a description of these files' specific purpose and of how an administrator should use them (command line examples, etc.).

/maintenance/archives/
The scripts included in the archive subdirectory have been designed for updating databases from older versions of the software.
 * populateSha1.php
 * rebuildRecentchanges.inc
 * upgradeWatchlist.php

/maintenance/dtrace/

 * counts.d
 * tree.d

/maintenance/language/

 * alltrans.php
 * checkExtensions.php
 * checkLanguage.inc
 * checkLanguage.php
 * date-formats.php
 * diffLanguage.php
 * digit2html.php
 * dumpMessages.php
 * function-list.php
 * lang2po.php
 * langmemusage.php
 * languages.inc
 * messages.inc
 * messageTypes.inc
 * rebuildLanguage.php
 * splitLanguageFiles.inc
 * splitLanguageFiles.php
 * transstat.php
 * validate.php
 * writeMessagesArray.inc

/maintenance/storage/

 * checkStorage.php
 * compressOld.inc
 * compressOld.php
 * dumpRev.php
 * moveToExternal.php
 * resolveStubs.php