wiki.techinc.nl/maintenance
2024-01-13 23:49:46 +00:00
..
abstractSchemaChanges Use year in temporary user names and restart index each year 2024-01-05 17:14:19 +00:00
archives Add the new block and block_target tables 2024-01-08 14:29:59 +11:00
benchmarks ResourceLoader: Switch validateScriptFile() from JSMinPlus to Peast 2024-01-06 22:33:46 +00:00
includes Make Maintenance::finalSetup require a SettingsBuilder 2024-01-08 09:40:18 -05:00
language Use namespaced classes 2023-12-11 16:07:18 +01:00
mediawiki.Title maintenance: Begin using Maintenance::getServiceContainer() 2023-09-04 10:39:58 +00:00
postgres Add the new block and block_target tables 2024-01-08 14:29:59 +11:00
sqlite Add the new block and block_target tables 2024-01-08 14:29:59 +11:00
storage Migrate remaining Database::insert calls to InsertQueryBuilder 2023-12-22 14:53:17 +01:00
.htaccess
addChangeTag.php Namespace User under \MediaWiki\User 2023-09-19 19:18:16 +00:00
addRFCandPMIDInterwiki.php Migrate remaining Database::insert calls to InsertQueryBuilder 2023-12-22 14:53:17 +01:00
addSite.php Namespace remaining files in includes/site 2023-12-14 14:57:34 -05:00
attachLatest.php maintenance: Add missing parenthesis to SQL in attachLatest.php 2023-12-12 22:16:32 +01:00
blockUsers.php Namespace User under \MediaWiki\User 2023-09-19 19:18:16 +00:00
categoryChangesAsRdf.php Remove redundant empty() constructs (3) 2023-09-08 23:37:23 +02:00
changePassword.php
checkBadRedirects.php maintenance: Begin using Maintenance::getServiceContainer() 2023-09-04 10:39:58 +00:00
checkComposerLockUpToDate.php Refactor checkComposerLockUpToDate.php logic out to reuseable class 2024-01-13 18:35:07 +00:00
checkDependencies.php
checkImages.php maintenance: Begin using Maintenance::getServiceContainer() 2023-09-04 10:39:58 +00:00
checkUsernames.php maintenance: Begin using Maintenance::getServiceContainer() 2023-09-04 10:39:58 +00:00
cleanupBlocks.php maintenance: Migrate to DeleteQueryBuilder 2024-01-02 13:13:49 +01:00
cleanupCaps.php Namespace User under \MediaWiki\User 2023-09-19 19:18:16 +00:00
cleanupEmptyCategories.php maintenance: Migrate another batch to SelectQueryBuilder 2023-09-21 14:15:42 +02:00
cleanupImages.php Namespace Sanitizer under \MediaWiki\Parser 2023-09-21 05:39:23 +00:00
cleanupInvalidDbKeys.php maintenance: Migrate to DeleteQueryBuilder 2024-01-02 13:13:49 +01:00
cleanupPageLang.php Add new maintenance script cleanupPageLang.php 2023-08-05 13:12:42 +00:00
cleanupPreferences.php Add support for conditional user defaults 2024-01-09 02:33:17 +00:00
cleanupRemovedModules.php maintenance: Begin using Maintenance::getServiceContainer() 2023-09-04 10:39:58 +00:00
cleanupSpam.php Namespace User under \MediaWiki\User 2023-09-19 19:18:16 +00:00
cleanupTitles.php maintenance: Begin using Maintenance::getServiceContainer() 2023-09-04 10:39:58 +00:00
cleanupUploadStash.php CleanupUploadStash: change fatalError to output and continue temp file cleanup if temp directory isn't located in local-temp 2024-01-02 19:55:36 -08:00
cleanupWatchlist.php maintenance: Begin using Maintenance::getServiceContainer() 2023-09-04 10:39:58 +00:00
clearInterwikiCache.php maintenance: Begin using Maintenance::getServiceContainer() 2023-09-04 10:39:58 +00:00
CodeCleanerGlobalsPass.php
CommandLineInc.php
compareLanguageConverterOutput.php Namespace ParserOutput 2023-12-14 14:57:34 -05:00
compareParserCache.php maintenance: Begin using Maintenance::getServiceContainer() 2023-09-04 10:39:58 +00:00
compareParsers.php Namespace User under \MediaWiki\User 2023-09-19 19:18:16 +00:00
convertExtensionToRegistration.php Replace substr with cleaner string methods 2023-05-20 15:40:21 +02:00
copyFileBackend.php maintenance: Begin using Maintenance::getServiceContainer() 2023-09-04 10:39:58 +00:00
copyJobQueue.php maintenance: Begin using Maintenance::getServiceContainer() 2023-09-04 10:39:58 +00:00
createAndPromote.php Namespace remaining files under includes/deferred 2023-11-22 10:08:53 -05:00
createBotPassword.php Namespace remaining User-related classes under \MediaWiki\User 2023-09-20 09:12:08 +01:00
deleteArchivedFiles.php maintenance: Migrate to DeleteQueryBuilder 2024-01-02 13:13:49 +01:00
deleteArchivedRevisions.php maintenance: Migrate to DeleteQueryBuilder 2024-01-02 13:13:49 +01:00
deleteAutoPatrolLogs.php maintenance: Migrate to DeleteQueryBuilder 2024-01-02 13:13:49 +01:00
deleteBatch.php Namespace User under \MediaWiki\User 2023-09-19 19:18:16 +00:00
deleteDefaultMessages.php Namespace User under \MediaWiki\User 2023-09-19 19:18:16 +00:00
deleteEqualMessages.php Fix typo in maintenance script 2023-12-13 10:32:17 +02:00
deleteLocalPasswords.php
deleteOldRevisions.php maintenance: Migrate to DeleteQueryBuilder 2024-01-02 13:13:49 +01:00
deleteOrphanedRevisions.php maintenance: Migrate to DeleteQueryBuilder 2024-01-02 13:13:49 +01:00
deleteSelfExternals.php Replace deprecated wfParseUrl with UrlUtils::parse 2024-01-07 10:24:37 +00:00
deleteTag.php maintenance: Migrate to DeleteQueryBuilder 2024-01-02 13:13:49 +01:00
deleteUserEmail.php maintenance: Begin using Maintenance::getServiceContainer() 2023-09-04 10:39:58 +00:00
doMaintenance.php
Doxyfile build: Ignore param-taint and return-taint in Doxyfile 2023-11-08 14:54:24 +00:00
dumpBackup.php
dumpCategoriesAsRdf.php maintenance: Begin using Maintenance::getServiceContainer() 2023-09-04 10:39:58 +00:00
dumpIterator.php Make Maintenance::finalSetup require a SettingsBuilder 2024-01-08 09:40:18 -05:00
dumpLinks.php Use getServiceContainer() in maintenance 2023-10-13 13:01:19 +00:00
dumpTextPass.php
dumpUploads.php maintenance: Begin using Maintenance::getServiceContainer() 2023-09-04 10:39:58 +00:00
edit.php Namespace User under \MediaWiki\User 2023-09-19 19:18:16 +00:00
emptyUserGroup.php Namespace User under \MediaWiki\User 2023-09-19 19:18:16 +00:00
eraseArchivedFile.php maintenance: Begin using Maintenance::getServiceContainer() 2023-09-04 10:39:58 +00:00
eval.php maintenance: Begin using Maintenance::getServiceContainer() 2023-09-04 10:39:58 +00:00
expireTemporaryAccounts.php expireTemporaryAccounts: Only process temporary accounts 2023-11-16 17:12:39 +01:00
exportSites.php Namespace remaining files in includes/site 2023-12-14 14:57:34 -05:00
fetchText.php Make Maintenance::finalSetup require a SettingsBuilder 2024-01-08 09:40:18 -05:00
fileOpPerfTest.php maintenance: Begin using Maintenance::getServiceContainer() 2023-09-04 10:39:58 +00:00
findBadBlobs.php Introduce ArchiveSelectQueryBuilder 2023-09-07 17:03:22 +02:00
findClasses.php
findDeprecated.php
findMissingActors.php Support new block schema 2023-11-29 13:31:42 +11:00
findMissingFiles.php maintenance: Begin using Maintenance::getServiceContainer() 2023-09-04 10:39:58 +00:00
findOrphanedFiles.php Migrate away from $db->makeList in favor of expression builder 2023-11-02 16:40:48 +00:00
fixDefaultJsonContentPages.php maintenance: Migrate $db->buildLike() to expression builder 2023-11-06 14:27:03 +01:00
fixDoubleRedirects.php Use assoc array for column alias in select queries 2024-01-08 21:47:45 +01:00
fixInconsistentRedirects.php installer: Add database updater for 2008/2011 redirect schema changes 2023-09-21 20:28:13 -07:00
fixMergeHistoryCorruption.php maintenance: Migrate to DeleteQueryBuilder 2024-01-02 13:13:49 +01:00
fixTimestamps.php
fixUserRegistration.php Maintenance: use getServiceContainer() method 2023-10-13 10:19:26 +02:00
formatInstallDoc.php maintenance: Begin using Maintenance::getServiceContainer() 2023-09-04 10:39:58 +00:00
generateAutoload.php generateConfigSchema.php: Enable canExecuteWithoutLocalSettings() 2023-07-24 20:25:52 +01:00
generateConfigSchema.php Update references to config-vars.php 2023-09-23 03:37:44 +00:00
generateJsonI18n.php
generateLocalAutoload.php generateLocalAutoload.php: Fix typo 2023-06-26 23:15:19 +01:00
generateSchemaChangeSql.php db: Allow describing table creation via abstract schema change 2023-10-10 20:06:53 -07:00
generateSchemaSql.php db: Allow describing table creation via abstract schema change 2023-10-10 20:06:53 -07:00
generateSitemap.php generateSitemap: Fix the variant query param 2023-09-27 00:17:04 +08:00
getConfiguration.php
getLagTimes.php maintenance: Begin using Maintenance::getServiceContainer() 2023-09-04 10:39:58 +00:00
getReplicaServer.php maintenance: Begin using Maintenance::getServiceContainer() 2023-09-04 10:39:58 +00:00
getText.php maintenance: Begin using Maintenance::getServiceContainer() 2023-09-04 10:39:58 +00:00
grep.php maintenance: Migrate $db->buildLike() to expression builder 2023-11-06 14:27:03 +01:00
importDump.php WikiImporter: Pass Authority for permissions instead of global context 2023-12-11 19:15:11 +01:00
importImages.php Namespace User under \MediaWiki\User 2023-09-19 19:18:16 +00:00
importSites.php Namespace remaining files in includes/site 2023-12-14 14:57:34 -05:00
importSiteScripts.php Namespace User under \MediaWiki\User 2023-09-19 19:18:16 +00:00
importTextFiles.php Namespace User under \MediaWiki\User 2023-09-19 19:18:16 +00:00
initEditCount.php Convert numerous DB queries to use QueryBuilders 2023-10-09 19:06:53 +02:00
initSiteStats.php Namespace remaining files under includes/deferred 2023-11-22 10:08:53 -05:00
initUserPreference.php In query builders, use insertInto() and deleteFrom() instead of insert() and delete() 2023-09-08 10:16:08 +10:00
install.php Make Maintenance::finalSetup require a SettingsBuilder 2024-01-08 09:40:18 -05:00
interwiki.list
invalidateBotPasswords.php Namespace remaining User-related classes under \MediaWiki\User 2023-09-20 09:12:08 +01:00
invalidateUserSessions.php Namespace User under \MediaWiki\User 2023-09-19 19:18:16 +00:00
jsparse.php ResourceLoader: Switch validateScriptFile() from JSMinPlus to Peast 2024-01-06 22:33:46 +00:00
lag.php maintenance: Begin using Maintenance::getServiceContainer() 2023-09-04 10:39:58 +00:00
Maintenance.php
Makefile
makeTestEdits.php Namespace User under \MediaWiki\User 2023-09-19 19:18:16 +00:00
manageForeignResources.php Add ForeignResourceDirs extension/skin attribute 2023-04-25 09:27:35 -04:00
manageJobs.php maintenance: Begin using Maintenance::getServiceContainer() 2023-09-04 10:39:58 +00:00
mcc.php
mctest.php
mergeMessageFileList.php Make Maintenance::finalSetup require a SettingsBuilder 2024-01-08 09:40:18 -05:00
migrateBlocks.php MigrateBlocks: maintenance script for migrating to multiblocks schema 2024-01-11 14:45:29 +11:00
migrateExternallinks.php
migrateFileRepoLayout.php maintenance: Migrate another batch to SelectQueryBuilder 2023-09-21 14:15:42 +02:00
migrateLinksTable.php Namespace TitleValue under \MediaWiki\Title 2023-09-18 18:24:39 +01:00
migrateRevisionActorTemp.php
migrateRevisionCommentTemp.php Replace single-value $db->buildComparison() with $db->expr() 2023-10-22 01:05:47 +02:00
migrateUserGroup.php maintenance: Migrate to DeleteQueryBuilder 2024-01-02 13:13:49 +01:00
moveBatch.php Namespace User under \MediaWiki\User 2023-09-19 19:18:16 +00:00
mwdoc-filter.php
mwdocgen.php
mwjsduck-gen
mysql.php Update references to renamed DatabaseMySQL class 2023-11-01 11:30:29 -04:00
namespaceDupes.php Merge "rdbms: Change docs for IDatabase::affectedRows on UPDATE IGNORE" 2023-12-04 20:40:40 +00:00
nukeNS.php maintenance: Migrate to DeleteQueryBuilder 2024-01-02 13:13:49 +01:00
nukePage.php maintenance: Migrate to DeleteQueryBuilder 2024-01-02 13:13:49 +01:00
pageExists.php
parse.php Namespace ParserOutput 2023-12-14 14:57:34 -05:00
patchSql.php
populateBacklinkNamespace.php maintenance: Switch simple calls of Database::select to SQB 2023-07-19 17:42:23 +02:00
populateChangeTagDef.php Remove redundant empty() constructs (3) 2023-09-08 23:37:23 +02:00
populateFilearchiveSha1.php maintenance: Migrate another batch to SelectQueryBuilder 2023-09-21 14:15:42 +02:00
populateImageSha1.php maintenance: Migrate another batch to SelectQueryBuilder 2023-09-21 14:15:42 +02:00
populateInterwiki.php Migrate remaining Database::insert calls to InsertQueryBuilder 2023-12-22 14:53:17 +01:00
populateIpChanges.php Migrate remaining Database::insert calls to InsertQueryBuilder 2023-12-22 14:53:17 +01:00
populatePPSortKey.php maintenance: Migrate another batch to SelectQueryBuilder 2023-09-21 14:15:42 +02:00
populateRecentChangesSource.php maintenance: Migrate another batch to SelectQueryBuilder 2023-09-21 14:15:42 +02:00
populateRevisionLength.php Migrate away from $db->makeList in favor of expression builder 2023-11-02 16:40:48 +00:00
populateRevisionSha1.php Convert numerous DB queries to use QueryBuilders 2023-10-09 19:06:53 +02:00
prewarmParsoidParserCache.php Make ParsoidOutputAccess a wrapper over ParserOutputAccess 2023-10-13 15:03:03 -05:00
protect.php Namespace User under \MediaWiki\User 2023-09-19 19:18:16 +00:00
pruneFileCache.php
pruneUnusedLinkTargetRows.php maintenance: Migrate to DeleteQueryBuilder 2024-01-02 13:13:49 +01:00
purgeChangedFiles.php Replace single-value $db->buildComparison() with $db->expr() 2023-10-22 01:05:47 +02:00
purgeChangedPages.php maintenance: Begin using Maintenance::getServiceContainer() 2023-09-04 10:39:58 +00:00
purgeExpiredBlocks.php maintenance: Begin using Maintenance::getServiceContainer() 2023-09-04 10:39:58 +00:00
purgeExpiredUserrights.php maintenance: Begin using Maintenance::getServiceContainer() 2023-09-04 10:39:58 +00:00
purgeExpiredWatchlistItems.php maintenance: Begin using Maintenance::getServiceContainer() 2023-09-04 10:39:58 +00:00
purgeList.php maintenance: Begin using Maintenance::getServiceContainer() 2023-09-04 10:39:58 +00:00
purgeMessageBlobStore.php maintenance: Begin using Maintenance::getServiceContainer() 2023-09-04 10:39:58 +00:00
purgeModuleDeps.php maintenance: Migrate another batch to SelectQueryBuilder 2023-09-21 14:15:42 +02:00
purgeOldText.php
purgePage.php maintenance: Begin using Maintenance::getServiceContainer() 2023-09-04 10:39:58 +00:00
purgeParserCache.php maintenance: Begin using Maintenance::getServiceContainer() 2023-09-04 10:39:58 +00:00
README
reassignEdits.php Convert numerous DB queries to use QueryBuilders 2023-10-09 19:06:53 +02:00
rebuildall.php
rebuildFileCache.php Make Maintenance::finalSetup require a SettingsBuilder 2024-01-08 09:40:18 -05:00
rebuildImages.php Merge "maintenance: Migrate another batch to SelectQueryBuilder" 2023-09-21 14:03:35 +00:00
rebuildLocalisationCache.php Make Maintenance::finalSetup require a SettingsBuilder 2024-01-08 09:40:18 -05:00
rebuildmessages.php maintenance: Begin using Maintenance::getServiceContainer() 2023-09-04 10:39:58 +00:00
rebuildrecentchanges.php Migrate remaining Database::insert calls to InsertQueryBuilder 2023-12-22 14:53:17 +01:00
rebuildtextindex.php Use assoc array for column alias in select queries 2024-01-08 21:47:45 +01:00
recountCategories.php Migrate more calls of Database::select* to SelectQueryBuilder 2023-07-26 13:01:28 +02:00
refreshFileHeaders.php maintenance: Begin using Maintenance::getServiceContainer() 2023-09-04 10:39:58 +00:00
refreshImageMetadata.php maintenance: Begin using Maintenance::getServiceContainer() 2023-09-04 10:39:58 +00:00
refreshLinks.php maintenance: Migrate to DeleteQueryBuilder 2024-01-02 13:13:49 +01:00
removeInvalidEmails.php Namespace Sanitizer under \MediaWiki\Parser 2023-09-21 05:39:23 +00:00
removeUnusedAccounts.php maintenance: Migrate to DeleteQueryBuilder 2024-01-02 13:13:49 +01:00
renameDbPrefix.php
renameRestrictions.php
renameUser.php Namespace remaining User-related classes under \MediaWiki\User 2023-09-20 09:12:08 +01:00
renameUsersMatchingPattern.php TempUser\Pattern: Use SQL expression builder instead of buildLike() 2023-12-06 18:20:39 +00:00
renderDump.php WikiImporter: Pass Authority for permissions instead of global context 2023-12-11 19:15:11 +01:00
resetAuthenticationThrottle.php maintenance: Begin using Maintenance::getServiceContainer() 2023-09-04 10:39:58 +00:00
resetPageRandom.php Migrate several subqueries to use SQB 2023-10-31 15:54:55 +01:00
resetUserEmail.php Maintenance: use getServiceContainer() method 2023-10-13 10:19:26 +02:00
rollbackEdits.php Convert numerous DB queries to use QueryBuilders 2023-10-09 19:06:53 +02:00
run
run.php
runBatchedQuery.php Convert numerous DB queries to use QueryBuilders 2023-10-09 19:06:53 +02:00
runJobs.php Make Maintenance::finalSetup require a SettingsBuilder 2024-01-08 09:40:18 -05:00
runScript.php
shell.php maintenance: Begin using Maintenance::getServiceContainer() 2023-09-04 10:39:58 +00:00
showJobs.php maintenance: Begin using Maintenance::getServiceContainer() 2023-09-04 10:39:58 +00:00
showSiteStats.php maintenance: Switch simple calls of Database::select to SQB 2023-07-19 17:42:23 +02:00
sql.php maintenance: Begin using Maintenance::getServiceContainer() 2023-09-04 10:39:58 +00:00
Sqlite.php Replace more usages of deprecated MWException 2023-06-08 21:37:07 +00:00
SqliteMaintenance.php maintenance: Begin using Maintenance::getServiceContainer() 2023-09-04 10:39:58 +00:00
TableCleanup.php maintenance: Switch simple calls of Database::select to SQB 2023-07-19 17:42:23 +02:00
tables-generated.sql Add the new block and block_target tables 2024-01-08 14:29:59 +11:00
tables.json Add the new block and block_target tables 2024-01-08 14:29:59 +11:00
tables.sql
undelete.php Namespace User under \MediaWiki\User 2023-09-19 19:18:16 +00:00
update-keys.sql
update.php Ensure that installer i18n is loaded by update.php 2023-09-21 15:12:19 -04:00
updateArticleCount.php Reorg: Move SiteStats*.php to SiteStats/ 2023-04-27 01:16:29 +02:00
updateCollation.php Migrate remaining Database::insert calls to InsertQueryBuilder 2023-12-22 14:53:17 +01:00
updateCredits.php Replace substr with cleaner string methods 2023-05-20 15:40:21 +02:00
updateExtensionJsonSchema.php
updateRestrictions.php Migrate remaining Database::insert calls to InsertQueryBuilder 2023-12-22 14:53:17 +01:00
updateSearchIndex.php Namespace remaining files under includes/deferred 2023-11-22 10:08:53 -05:00
updateSpecialPages.php updateSpecialPages: Call ::waitForReplication() if a host isn't reachable 2023-10-09 12:31:38 +02:00
uppercaseTitlesForUnicodeTransition.php maintenance: Migrate $db->buildLike() to expression builder 2023-11-06 14:27:03 +01:00
userOptions.php userOptions: Support --old being the option's default value 2024-01-12 14:51:09 +01:00
validateRegistrationFile.php
Version.php maintenance/version: Namespace and rename 2023-12-21 11:50:44 +00:00
view.php maintenance: Begin using Maintenance::getServiceContainer() 2023-09-04 10:39:58 +00:00
wikiBirthday.php maintenance: Begin using Maintenance::getServiceContainer() 2023-09-04 10:39:58 +00:00
wrapOldPasswords.php maintenance: Migrate $db->buildLike() to expression builder 2023-11-06 14:27:03 +01:00

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.