wiki.techinc.nl/maintenance
2023-08-25 19:25:25 +00:00
..
abstractSchemaChanges Schema: Add pl_target_id column to pagelinks 2023-07-25 21:03:45 +02:00
archives Schema: Add pl_target_id column to pagelinks 2023-07-25 21:03:45 +02:00
benchmarks Migrate more calls of Database::select* to SelectQueryBuilder 2023-07-26 13:01:28 +02:00
dev
includes Merge "content,maintenance: Use class-string<ClassName> in doc blocks" 2023-07-31 22:40:35 +00:00
jsduck ResourceLoader: Document the clientPrefs system and make Skin option 2023-08-18 13:32:01 -07:00
language
mediawiki.Title
postgres Schema: Add pl_target_id column to pagelinks 2023-07-25 21:03:45 +02:00
sqlite Schema: Add pl_target_id column to pagelinks 2023-07-25 21:03:45 +02:00
storage compressOld: Do not assume the latest revision has the greatest ID 2023-08-05 13:44:07 +08:00
.htaccess
addChangeTag.php
addRFCandPMIDInterwiki.php
addSite.php
attachLatest.php
blockUsers.php Ensure that soft blocks block temporary users 2023-08-15 14:26:44 +01:00
categoryChangesAsRdf.php Reorg: Move MWTimestamp to MediaWiki\Utils 2023-08-19 05:53:40 +02:00
changePassword.php
checkBadRedirects.php
checkComposerLockUpToDate.php
checkDependencies.php
checkImages.php Introduce FileSelectQueryBuilder 2023-08-07 19:05:34 +02:00
checkUsernames.php
cleanupBlocks.php
cleanupCaps.php
cleanupEmptyCategories.php
cleanupImages.php
cleanupInvalidDbKeys.php Fix space after comma in single-line array declaration 2023-07-24 19:04:59 +02:00
cleanupPreferences.php
cleanupRemovedModules.php
cleanupSpam.php
cleanupTitles.php
cleanupUploadStash.php Reorg: Move Status to MediaWiki\Status\ 2023-08-25 15:44:17 +02:00
cleanupUsersWithNoId.php
cleanupWatchlist.php
clearInterwikiCache.php
CodeCleanerGlobalsPass.php
CommandLineInc.php
compareLanguageConverterOutput.php
compareParserCache.php maintenance: Switch simple calls of Database::select to SQB 2023-07-19 17:42:23 +02:00
compareParsers.php
convertExtensionToRegistration.php
copyFileBackend.php Reorg: Move Status to MediaWiki\Status\ 2023-08-25 15:44:17 +02:00
copyJobQueue.php
createAndPromote.php maintenance: Remove UserRightsProxy from CreateAndPromote::addLogEntry 2023-07-26 20:06:14 +02:00
createBotPassword.php
deleteArchivedFiles.php
deleteArchivedRevisions.php
deleteAutoPatrolLogs.php
deleteBatch.php
deleteDefaultMessages.php
deleteEqualMessages.php
deleteLocalPasswords.php
deleteOldRevisions.php
deleteOrphanedRevisions.php
deleteSelfExternals.php
deleteTag.php
deleteUserEmail.php
doMaintenance.php
Doxyfile
dumpBackup.php
dumpCategoriesAsRdf.php
dumpIterator.php
dumpLinks.php
dumpTextPass.php
dumpUploads.php
edit.php
emptyUserGroup.php
eraseArchivedFile.php Reorg: Move Status to MediaWiki\Status\ 2023-08-25 15:44:17 +02:00
eval.php
exportSites.php
fetchText.php
fileOpPerfTest.php
findBadBlobs.php Reorg: Move Status to MediaWiki\Status\ 2023-08-25 15:44:17 +02:00
findClasses.php
findDeprecated.php
findMissingActors.php
findMissingFiles.php Migrate more calls of Database::select* to SelectQueryBuilder 2023-07-26 13:01:28 +02:00
findOrphanedFiles.php
fixDefaultJsonContentPages.php maintenance: Switch simple calls of Database::select to SQB 2023-07-19 17:42:23 +02:00
fixDoubleRedirects.php
fixExtLinksProtocolRelative.php maintenance: Switch simple calls of Database::select to SQB 2023-07-19 17:42:23 +02:00
fixMergeHistoryCorruption.php maintenance: Switch simple calls of Database::select to SQB 2023-07-19 17:42:23 +02:00
fixTimestamps.php
fixUserRegistration.php Simplify WHERE conditions with field IS NULL 2023-07-24 19:22:36 +02:00
formatInstallDoc.php
generateAutoload.php generateConfigSchema.php: Enable canExecuteWithoutLocalSettings() 2023-07-24 20:25:52 +01:00
generateConfigSchema.php generateConfigSchema.php: Enable canExecuteWithoutLocalSettings() 2023-07-24 20:25:52 +01:00
generateJsonI18n.php
generateLocalAutoload.php
generateSchemaChangeSql.php
generateSchemaSql.php
generateSitemap.php Title: Remove deprecated query2 parameters to get*URL methods 2023-08-16 12:07:39 +08:00
getConfiguration.php
getLagTimes.php
getReplicaServer.php
getText.php
grep.php
importDump.php
importImages.php
importSites.php
importSiteScripts.php
importTextFiles.php
initEditCount.php maintenance: Switch simple calls of Database::select to SQB 2023-07-19 17:42:23 +02:00
initSiteStats.php
initUserPreference.php
install.php
interwiki.list
invalidateBotPasswords.php
invalidateUserSessions.php
jsparse.php
lag.php
Maintenance.php
Makefile
makeTestEdits.php
manageForeignResources.php
manageJobs.php
mcc.php
mctest.php
mergeMessageFileList.php
migrateExternallinks.php
migrateFileRepoLayout.php
migrateLinksTable.php
migrateRevisionActorTemp.php
migrateRevisionCommentTemp.php
migrateUserGroup.php
moveBatch.php
mwdoc-filter.php
mwdocgen.php
mwjsduck-gen
mysql.php rdbms: Merge DatabaseMysqli into DatabaseMysqlBase 2023-08-07 20:37:09 +02:00
namespaceDupes.php
nukeNS.php
nukePage.php
pageExists.php
parse.php
patchSql.php
populateBacklinkNamespace.php maintenance: Switch simple calls of Database::select to SQB 2023-07-19 17:42:23 +02:00
populateChangeTagDef.php maintenance: Switch simple calls of Database::select to SQB 2023-07-19 17:42:23 +02:00
populateFilearchiveSha1.php
populateImageSha1.php
populateInterwiki.php
populateIpChanges.php maintenance: Switch simple calls of Database::select to SQB 2023-07-19 17:42:23 +02:00
populatePPSortKey.php Simplify WHERE conditions with field IS NULL 2023-07-24 19:22:36 +02:00
populateRecentChangesSource.php
populateRevisionLength.php Simplify WHERE conditions with field IS NULL 2023-07-24 19:22:36 +02:00
populateRevisionSha1.php maintenance: Switch simple calls of Database::select to SQB 2023-07-19 17:42:23 +02:00
prewarmParsoidParserCache.php
protect.php
pruneFileCache.php
pruneUnusedLinkTargetRows.php
purgeChangedFiles.php maintenance: Switch simple calls of Database::select to SQB 2023-07-19 17:42:23 +02:00
purgeChangedPages.php Migrate more calls of Database::select* to SelectQueryBuilder 2023-07-26 13:01:28 +02:00
purgeExpiredBlocks.php
purgeExpiredUserrights.php
purgeExpiredWatchlistItems.php
purgeList.php maintenance: Switch simple calls of Database::select to SQB 2023-07-19 17:42:23 +02:00
purgeMessageBlobStore.php
purgeModuleDeps.php
purgeOldText.php
purgePage.php
purgeParserCache.php
README
reassignEdits.php
rebuildall.php
rebuildFileCache.php maintenance: Switch simple calls of Database::select to SQB 2023-07-19 17:42:23 +02:00
rebuildImages.php
rebuildLocalisationCache.php
rebuildmessages.php
rebuildrecentchanges.php maintenance: Switch simple calls of Database::select to SQB 2023-07-19 17:42:23 +02:00
rebuildtextindex.php
recountCategories.php Migrate more calls of Database::select* to SelectQueryBuilder 2023-07-26 13:01:28 +02:00
refreshExternallinksIndex.php
refreshFileHeaders.php Introduce FileSelectQueryBuilder 2023-08-07 19:05:34 +02:00
refreshImageMetadata.php Introduce FileSelectQueryBuilder 2023-08-07 19:05:34 +02:00
refreshLinks.php refreshLinks: Use join instead of subquery for dfnCheckInterval() 2023-08-25 22:22:35 +08:00
removeInvalidEmails.php Simplify WHERE conditions with field IS NULL 2023-07-24 19:22:36 +02:00
removeUnusedAccounts.php maintenance: Switch simple calls of Database::select to SQB 2023-07-19 17:42:23 +02:00
renameDbPrefix.php
renameRestrictions.php
renameUser.php
renameUsersMatchingPattern.php Reorg: Move Status to MediaWiki\Status\ 2023-08-25 15:44:17 +02:00
renderDump.php
resetAuthenticationThrottle.php
resetPageRandom.php
resetUserEmail.php
rollbackEdits.php
run
run.php
runBatchedQuery.php
runJobs.php
runScript.php
shell.php
showJobs.php
showSiteStats.php maintenance: Switch simple calls of Database::select to SQB 2023-07-19 17:42:23 +02:00
sql.php
Sqlite.php
SqliteMaintenance.php
TableCleanup.php maintenance: Switch simple calls of Database::select to SQB 2023-07-19 17:42:23 +02:00
tables-generated.sql Schema: Add pl_target_id column to pagelinks 2023-07-25 21:03:45 +02:00
tables.json Ensure that soft blocks block temporary users 2023-08-15 14:26:44 +01:00
tables.sql
undelete.php
update-keys.sql
update.php installer: Check MariaDB version in updater/installer 2023-07-22 23:02:09 +02:00
updateArticleCount.php
updateCollation.php
updateCredits.php
updateExtensionJsonSchema.php
updateRestrictions.php
updateSearchIndex.php
updateSpecialPages.php
uppercaseTitlesForUnicodeTransition.php
userOptions.php maintenance: Switch simple calls of Database::select to SQB 2023-07-19 17:42:23 +02:00
validateRegistrationFile.php
version.php Reorg: Move GitInfo to utils/ 2023-08-21 18:35:32 +02:00
view.php
wikiBirthday.php Reorg: Move MWTimestamp to MediaWiki\Utils 2023-08-19 05:53:40 +02:00
wrapOldPasswords.php

MediaWiki's maintenance scripts are PHP scripts that perform maintenance tasks,
and are designed to be run from the command line.

See also: https://www.mediawiki.org/wiki/Manual:Maintenance_scripts

== Running Maintenance Scripts ==

Maintenance scripts are generally executed using the maintenance runner, calling
''php maintenance/run.php'' followed by the script's name. On most systems, the
shorthand ''maintenance/run'' can also be used. For instance, to run the script
that displays the MediaWiki version, use ''maintenance/run version''.

Maintenance scripts can be called by their simple name, class name, or path.

The simple name corresponds to a file in the maintenance directory:
* ''maintenance/run version'' runs the file ''maintenance/version.php''.

For the class name:
* ''maintenance/run Version'' runs the Version class (using auto-loading from
''./maintenance/version.php'').

For the path:
* ''maintenance/run ./maintenance/version.php'' runs the file
''./maintenance/version.php''.

Note that relative file paths must start with "./". Using this form allows for
the use of tab-completion.

Maintenance scripts defined by extensions may also be called by giving their
full class name or full relative path, such as:
* ''maintenance/run ./extension/AbuseFilter/maintenance/SearchFilters.php''
* ''maintenance/run MediaWiki.Extension.AbuseFilter.Maintenance.SearchFilters''

Note how the dot (".") can be used as a namespace separator instead of the
backslash ("\").

If the extension follows the MediaWiki coding conventions for the location and
namespacing of maintenance scripts, they can be invoked using the name of the
extension, followed by a colon (":") and the name of the script file or class:
* ''maintenance/run AbuseFilter:SearchFilters''

For more details on using the script runner, call ''maintenance/run --help''.

For about an individual script, call ''maintenance/run <script> --help ''.

=== Running Maintenance Scripts before MW 1.40 ===

The maintenance runner described above was introduced in MediaWiki 1.40. In
MediaWiki version 1.39 and earlier, maintenance scripts had to be run as
standalone PHP scripts, by passing the path the the script to the php interpreter.
For instance:

* ''php maintenance/version.php''

This is still possible for most scripts in 1.40, but it will show a deprecation
warning.

== Creating Maintenance Scripts ==

To create a maintenance script, add a PHP file to the maintenance directory that
contains a class that extends the ''Maintenance'' base class and implement
the ''execute()'' method. At the end of the file, add a return statement that
returns the name of the class.

For example, if your class is called ''Frobnify'', place it in a file called
''maintenance/Frobnify.php'' and at the end of the file, put the following
statement:
<pre>
return Frobnify::class;
</pre>

You can now run your script by calling ''maintenance/run Frobnify''.

With this, it will however not be possible to run Frobnify.php as a PHP command
line script. ''php maintenance/Frobnify.php'' will fail with an error.

=== Supporting direct execution of maintenance scripts ===
Since MediaWiki version 1.40, invoking maintenance scripts directly is now
deprecated, and will show a warning even for scripts that support it.

If you need to support direct invocation for your script, this can be
achieved as follows:

At the top of the script file, place the statement:
<pre>
require_once __DIR__ . '/Maintenance.php';
</pre>.

For maintenance scripts defined in extensions, this is slightly more complex:
<pre>
require_once getenv( 'MW_INSTALL_PATH' ) !== false
	? getenv( 'MW_INSTALL_PATH' ) . '/maintenance/Maintenance.php'
	: __DIR__ . '/../../../maintenance/Maintenance.php';
</pre>

Then, at the bottom of the file, replace the return statement with the
following lines:
<pre>
$maintClass = Frobnify::class;
require_once RUN_MAINTENANCE_IF_MAIN;
</pre>

This will allow your script to be executed directly on the PHP command line.
Note however that it will show a warning.