wiki.techinc.nl/maintenance
Pppery a43f368b65 Update RfC links to bypass redirect
Per https://meta.wikimedia.org/wiki/Talk:Interwiki_map/Archives/2024#RFC

Bug: T71997
Bug: T382963
Change-Id: I2b6b63f7809e5801c78de370c828bbca5fe95e64
2025-06-03 16:37:04 -04:00
..
abstractSchemaChanges
archives In .htaccess deny files, use "Satisfy All" 2025-04-04 13:17:15 +00:00
benchmarks
includes
language
mediawiki.Title
postgres
sqlite
storage
.htaccess In .htaccess deny files, use "Satisfy All" 2025-04-04 13:17:15 +00:00
addChangeTag.php
addSite.php
attachLatest.php
blockUsers.php
categoryChangesAsRdf.php
changePassword.php
checkBadRedirects.php
checkComposerLockUpToDate.php
checkDependencies.php
checkImages.php
CheckSignatures.php
checkUsernames.php
cleanupCaps.php
cleanupEmptyCategories.php
cleanupImages.php
cleanupInvalidDbKeys.php
cleanupPageLang.php
cleanupPreferences.php
cleanupRemovedModules.php
cleanupSpam.php
cleanupTitles.php
cleanupUploadStash.php
cleanupWatchlist.php
clearInterwikiCache.php
CodeCleanerGlobalsPass.php
CommandLineInc.php
compareLanguageConverterOutput.php
compareParserCache.php
compareParsers.php
convertExtensionsMessagesToTranslationAlias.php
convertExtensionToRegistration.php
copyFileBackend.php
copyJobQueue.php
createAndPromote.php
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
eval.php
expireTemporaryAccounts.php
exportSites.php
fetchText.php
fileOpPerfTest.php
findBadBlobs.php
findClasses.php
findDeprecated.php
findMissingActors.php
findMissingFiles.php
findOrphanedFiles.php
fixAutoblockLogTitles.php
fixDoubleRedirects.php
fixInconsistentRedirects.php
fixMergeHistoryCorruption.php
fixTimestamps.php
fixUserRegistration.php
formatInstallDoc.php
generateAutoload.php
generateConfigSchema.php
generateJsonI18n.php
generateLocalAutoload.php
generateSchemaChangeSql.php
generateSchemaSql.php
generateSitemap.php
getConfiguration.php
getLagTimes.php
getReplicaServer.php
getText.php
grep.php
importDump.php
importImages.php ImportImages: Exit with non-zero code if import fails 2025-03-08 14:02:30 +00:00
importSites.php
importSiteScripts.php
importTextFiles.php
initEditCount.php initEditCount: Join from user to actor to revision 2025-03-03 15:32:50 +00:00
initSiteStats.php
initUserPreference.php
install.php
interwiki.list Update RfC links to bypass redirect 2025-06-03 16:37:04 -04:00
invalidateBotPasswords.php
invalidateUserSessions.php
jsparse.php
lag.php
Maintenance.php
Makefile
makeTestEdits.php
manageForeignResources.php
manageJobs.php
mcc.php
mctest.php
mergeMessageFileList.php
migrateBlocks.php
migrateExternallinks.php
migrateFileRepoLayout.php
migrateLinksTable.php
migrateRevisionActorTemp.php
migrateRevisionCommentTemp.php
migrateUserGroup.php
moveBatch.php
mwdoc-filter.php
mwdocgen.php
mysql.php
namespaceDupes.php
nukeNS.php
nukePage.php
pageExists.php
parse.php
patchSql.php
populateChangeTagDef.php
populateInterwiki.php
populateUserIsTemp.php
prewarmParsoidParserCache.php
protect.php
pruneFileCache.php
pruneUnusedLinkTargetRows.php
purgeChangedFiles.php
purgeChangedPages.php
purgeExpiredBlocks.php
purgeExpiredUserrights.php
purgeExpiredWatchlistItems.php
purgeList.php
purgeMessageBlobStore.php
purgeModuleDeps.php
purgeOldText.php
purgePage.php
purgeParserCache.php
purgeRecentChanges.php
README
reassignEdits.php
rebuildall.php
rebuildFileCache.php
rebuildImages.php
rebuildLocalisationCache.php
rebuildmessages.php
rebuildrecentchanges.php
rebuildtextindex.php
recountCategories.php
refreshFileHeaders.php
refreshImageMetadata.php
refreshLinks.php
removeInvalidEmails.php
removeUnusedAccounts.php
renameDbPrefix.php
renameRestrictions.php
renameUser.php
renameUsersMatchingPattern.php
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
sql.php
Sqlite.php
SqliteMaintenance.php Revert "maintenance: Use DatabaseSqlite for type-hinting instead of DBConnRef" 2025-02-20 20:35:40 +00:00
TableCleanup.php
tables-generated.sql
tables.json
tables.sql
undelete.php
update.php
updateArticleCount.php
updateCollation.php
updateCredits.php
updateExtensionJsonSchema.php
updateRestrictions.php
updateSearchIndex.php
updateSpecialPages.php
uppercaseTitlesForUnicodeTransition.php
userOptions.php
validateRegistrationFile.php
Version.php
view.php
wikiBirthday.php
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>
// @codeCoverageIgnoreStart
require_once __DIR__ . '/Maintenance.php';
// @codeCoverageIgnoreEnd
</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>
// @codeCoverageIgnoreStart
$maintClass = Frobnify::class;
require_once RUN_MAINTENANCE_IF_MAIN;
// @codeCoverageIgnoreEnd
</pre>

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