Sunima Library
Advertisement
File:Crystal Clear app display.png Users File:Nuvola-inspired-terminal.svg System Administrators File:Source code project 1171.svg Developers



The maintenance scripts are used to perform various administrative, import, maintenance, reporting and upgrade tasks.  The scripts are written in PHP and live in the maintenance subdirectory of MediaWiki installs.



There are dozens of scripts with varying degrees of general utility and quality - because of this, it is best to carefully read the documentation on a script before using it.  If a script is not documented, this often indicates that additional care should be taken.



Configuration[]

The $wgDBadminuser and $wgDBadminpassword configuration variables must be set in order to run some maintenance scripts. The values for these variables differ based on the database engine that is being used to power your installation of MediaWiki.



MySQL[]

Some of the maintenance scripts require database permissions that, for security reasons, the main MediaWiki database account should not have.  A separate database account with 'superuser' privileges for just the MediaWiki database should be created (if it does not already exist.)  For example, if the database that you use for MediaWiki is called wikidb, then the following SQL would create such a user who can exercise superuser privileges on localhost.:



GRANT ALL PRIVILEGES ON wikidb.* TO 'wikidbadmin'@'localhost' IDENTIFIED BY 'strong-password';



Once the account exists, the account name should be set in the $wgDBadminuser configuration variable.  Like other configuration variables, $wgDBadminuser should be set in LocalSettings.php.  A password for $wgDBadminuser must be set in the $wgDBadminpassword configuration variable.



PostgreSQL[]

PostgreSQL uses a different security model than MySQL and the same PostgreSQL server account used for day-to-day operation of the MediaWiki installation must also be used for running the maintenance scripts. This is necessary to ensure that the owner for new tables created by the maintenance scripts is set correctly.  Simply set $wgDBadminuser to $wgDBuser and  $wgDBadminpassword to $wgDBpassword.



Running the scripts[]

File:Web hosting site ip address.png

Example of IP address and FTP user name and password on the Godaddy.com hosting site.

The maintenance scripts must then be run from the command line.



Required program: PuTTY or any terminal emulator



File:Putty enter ip address.png

Under the Host Name (or IP address) enter the IP Address of your web hosting site.

  • Step 2: In PuTTy, under the Host Name (or IP address) enter the IP Address of your web hosting site (Contact your website provider if necessary) and click Open.

Template:-

File:Putty command window.png

At the login as: line enter the FTP user name.

  • Step 3: A command screen will pop up. At the login as: line enter the FTP user name.

Template:-

File:Putty command window password.png

On the FTP user name@IP Address's password line: type the FTP password.

  • Step 4: Enter the FTP password. 

Template:-

File:Putty command line.png

The putty command line.

  • Step 5: Change the current directory to the maintenance subdirectory. You can type pwd to see what folder you are currently in. The maintenance folder is in the root mediawiki folder.



$ cd maintenance



Template:-

  • Step 6: Execute the maintenance script that needs to be run:

$ php rebuildall.php

If you get an error (for example: php.exe is no valid Win32 application), try the following:

$ php-cgi rebuildall.php

In Windows, the command is;

$ C:\path\to\php\php-win.exe C:\path\to\mediawiki\maintenance\rebuildall.php



Note: If your script fails to run, and spews out a lot of error messages, the first thing to try is to set the MW_INSTALL_PATH environment variable to point to the root of your MediaWiki installation.  This will help scripts to find the necessary files, and is particularly relevant when running maintenance scripts provided by third-party extensions.



Standard command-line options[]

Almost every PHP script in /maintenance supports several standard options:

--help
Displays help message
--conf <path>
Location of LocalSettings.php, if not default (at parent directory of the script)
--dbuser <username>
Database account to use, not used for scripts that don't require a database connection or when SQLite database backend is used
--dbpass <password>
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
--memory-limit <value>
Set memory limit for the script. Accepts ordinary numbers, standard php.ini abbreviations (1024K, 20M, 1G), max for no limit (will be used by default if omitted) and default for no change. Available only since MediaWiki 1.17.
--quiet
Supress non-error output
--wiki <id>
Wiki ID for wiki farms. This may be of the form dbname or dbname-prefix. LocalSettings.php will be run with the MW_DB and MW_PREFIX constants defined accordingly.



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.



No shell access[]

On many shared hosts, you won't have shell access. The following extensions may be useful to run maintenance scripts via the web  : Extension:Maintenance and Extension:MaintenanceShell.



List of maintenance scripts[]

Here is the list of files included in the maintenance subdirectory located at the root of a MediaWiki installation. 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/[]

  • 7zip.inc
  • Maintenance.php
  • attachLatest.php
  • backup.inc
  • backupPrefetch.inc
  • backupTextPass.inc
  • cbd.php
  • changePassword.php
  • checkBadRedirects.php
  • checkImages.php
  • checkLess.php
  • checkUsernames.php
  • cleanupAncientTables.php
  • cleanupCaps.php
  • cleanupImages.php
  • cleanupPreferences.php
  • cleanupRemovedModules.php
  • cleanupSpam.php
  • cleanupTable.inc
  • cleanupTitles.php
  • cleanupUploadStash
  • cleanupWatchlist.php
  • clearCacheStats.php
  • clearInterwikiCache.php
  • commandLine.inc
  • compareParsers.php
  • convertLinks.php
  • convertUserOptions.php
  • copyFileBackend.php
  • copyJobQueue.php
  • deleteArchivedFiles.inc
  • deleteArchivedFiles.php
  • deleteArchivedRevisions.inc
  • deleteArchivedRevisions.php
  • deleteBatch.php
  • deleteDefaultMessages.php
  • deleteEqualMessages.php
  • deleteImageMemcached.php
  • deleteOldRevisions.php
  • deleteOrphanedRevisions.php
  • deleteRevision.php
  • deleteSelfExternals.php
  • doMaintenance.php
  • dumpBackup.php
  • dumpIterator.php
  • dumpLinks.php
  • dumpSisterSites.php
  • dumpTextPass.php
  • dumpUploads.php
  • edit.php
  • eraseArchivedFile.php
  • eval.php
  • fetchText.php
  • fileOpPerfTest.php
  • findhooks.php --badname
  • fixDoubleRedirects.php
  • fixExtLinksProtocolRelative.php
  • fixSlaveDesync.php
  • fixTimestamps.php
  • fixUserRegistration.php
  • formatInstallDoc.php
  • generateJSONi18n.php
  • generateSitemap.php
  • getConfiguration.php
  • getLagTimes.php
  • getSlaveServer.php
  • getText.php
  • importDump.php
  • importImages.inc
  • importImages.php
  • importSiteScripts.php
  • importTextFile.php
  • initEditCount.php
  • initStats.php
  • install.php
  • interwiki.list
  • interwiki.sql
  • jsparse.php
  • lag.php
  • mcc.php
  • mctest.php
  • mergeMessageFileList.php
  • migrateUserGroups.php
  • minify.php
  • moveBatch.php
  • mwdoc-filter.php
  • namespaceDupes.php
  • nextJobDB.php
  • nukeNS.php
  • nukePage.php
  • orphans.php
  • parse.php
  • patchSql.php
  • populateCategory.php
  • populateFileArchiveSha1.php
  • populateImageSha1.php
  • populateLogSearch.php
  • populateLogUsertext.php
  • populateParentId.php
  • populateRecentChangesSource.php
  • populateRevisionLength.php
  • populateRevisionSha1.php
  • preprocessDump.php
  • preprocessorFuxxTest.php
  • protect.php
  • pruneFileCache.php
  • purgeChangedFiles.php
  • purgeChangedPages.php
  • purgeList.php
  • purgeOldText.inc
  • purgeOldText.php
  • purgeParserCache.php
  • reassignEdits.php
  • rebuildall.php
  • rebuildFileCache.php
  • rebuildImages.php
  • rebuildLocalisationCache.php
  • rebuildmessages.php
  • rebuildrecentchanges.php
  • rebuildtextindex.php
  • refreshFileHeaders.php
  • refreshImageMetadata.php
  • refreshLinks.php
  • removeUnusedAccounts.php
  • renameDbPrefix.php
  • renderDump.php
  • resetUserTokens.php
  • rollbackEdits.php
  • runBatchedQuery.php
  • runJobs.php
  • runScript.php
  • showCacheStats
  • showJobs.php
  • showSiteStats.php
  • sql.php
  • sqlite.inc
  • sqlite.php
  • syncFileBackend.php
  • undelete.php
  • update.php
  • updateCollation.php
  • updateDoubleWidthSearch.php
  • updateRestrictions.php
  • updateSearchIndex.php
  • updateSpecialPages.php
  • userDupes.inc
  • userOptions.inc
  • userOptions.php
  • waitForSlave.php



maintenance/archives[]

  • upgradeLogging.php



maintenance/benchmarks[]

  • Benchmarker.php
  • bench_HTTP_HTTPS.php
  • bench_delete_truncate.php
  • bench_if_switch.php
  • bench_strtr_str_replace.php
  • bench_utf8_title_check.php
  • bench_wfBaseConvert.php
  • bench_wfIsWindows.php
  • benchmarkHooks.php
  • benchmarkPurge.php



maintenance/language[]

  • StatOutputs.php
  • alltrans.php
  • checkDupeMessages.php
  • checkExtensions.php
  • checkLanguage.inc
  • checkLanguage.php
  • countMessages.php
  • date-formats.php
  • digit2html.php
  • dumpMessages.php
  • generateCollationData.php
  • generateNormalizer.php
  • langmemusage.php
  • languages.inc
  • messageTypes.inc
  • messages.inc
  • rebuildLanguage.php
  • transsat.php
  • validate.php
  • writeMessagesArray.inc



maintenance/locking[]

  • LockServerDaemon.php



maintenance/orcale[]

  • alterSharedConstraints.php



maintenance/storage[]

  • checkStorage.php
  • compressOld.php
  • dumpRev.php
  • moveToExternal.php
  • orphanStats.php
  • ecompressTracked.php
  • resolveStubs.php
  • storageTypeStats.php
  • testCompression.php
  • trackBlobs.php



maintenance/term[]

  • MWTerm.php



See also[]

  • Manual:Writing maintenance scripts
  • Manual:System administration
  • Manual:Upgrading
  • Category:Site management extensions



Language: English

 

Advertisement