MediaWiki  1.34.0
Maintenance Class Reference

Abstract maintenance class for quickly writing and churning out maintenance scripts with minimal effort. More...

Inherited by AddChangeTag, AddSite, AllTrans, AttachLatest, BackupDumper, BackupReader, Benchmarker, BenchmarkParse, CategoryChangesAsRdf, ChangePassword, CheckBadRedirects, CheckComposerLockUpToDate, CheckDependencies, CheckImages, CheckLess, CheckUsernames, Cleanup, CleanupAncientTables, CleanupArchiveUserText, CleanupBlocks, CleanupInvalidDbKeys, CleanupPreferences, CleanupRemovedModules, CleanupSpam, CleanupUploadStash, ClearInterwikiCache, CLIParser, CommandLineInc, CommandLineInstaller, CompareParserCache, CompressOld, ConvertExtensionToRegistration, ConvertLinks, ConvertUserOptions, CopyFileBackend, CopyJobQueue, CountFancyCaptchas, CreateAndPromote, CreateCommonPasswordCdb, DatabaseLag, DateFormats, DeleteArchivedFiles, DeleteArchivedRevisions, DeleteAutoPatrolLogs, DeleteBatch, DeleteDefaultMessages, DeleteEqualMessages, DeleteLocalPasswords, DeleteOldFancyCaptchas, DeleteOldRevisions, DeleteOrphanedRevisions, DeleteSelfExternals, Digit2Html, DisableOATHAuthForUser, DumpCategoriesAsRdf, DumpIterator, DumpLinks, DumpMessages, DumpRenderer, DumpRev, DumpUploads, EditCLI, EmptyUserGroup, EraseArchivedFile, ExportSites, FakeMaintenance, FetchText, FileOpPerfTest, FindDeprecated, FindHooks, FindMissingFiles, FindOrphanedFiles, FixDoubleRedirects, FixTimestamps, FixUserRegistration, FormatInstallDoc, GenerateCollationData, GenerateFancyCaptchas, GenerateJsonI18n, GenerateNormalizerDataAr, GenerateNormalizerDataMl, GeneratePhpCharToUpperMappings, GenerateUcfirstOverrides, GenerateUpperCharTable, GetConfiguration, GetLagTimes, GetReplicaServer, GetTextMaint, HHVMMakeRepo, ImageBuilder, ImportImages, ImportSites, ImportSiteScripts, ImportTextFiles, InitEditCount, InitImageData, InitSiteStats, InitUserPreference, InvalidateUserSesssions, JSParseHelper, LangMemUsage, ListVariants, LoggedUpdateMaintenance, MakeTestEdits, ManageForeignResources, ManageJobs, McTest, MediaWikiShell, MergeMessageFileList, MigrateFileRepoLayout, MigrateUserGroup, MinifyScript, MoveBatch, MWDocGen, MwSql, MysqlMaintenance, NamespaceDupes, NukeNS, NukePage, Orphans, OrphanStats, PageExists, PatchSql, PopulateCategory, PopulateContentModel, PopulateContentTables, PopulateInterwiki, Protect, PruneFileCache, PurgeChangedFiles, PurgeChangedPages, PurgeExpiredUserrights, PurgeList, PurgeModuleDeps, PurgeOldText, PurgePage, PurgeParserCache, ReassignEdits, RebuildAll, RebuildFileCache, RebuildLocalisationCache, RebuildMessages, RebuildRecentchanges, RebuildTextIndex, RecountCategories, RefreshFileHeaders, RefreshImageMetadata, RefreshLinks, RemoveInvalidEmails, RemoveUnusedAccounts, RenameDbPrefix, RenameUserCleanup, ReplaceAll, ResetAuthenticationThrottle, ResetPageRandom, ResetUserEmail, ResetUserTokens, RollbackEdits, RunBatchedQuery, RunJobs, ShowJobs, ShowSiteStats, SqliteMaintenance, StorageTypeStats, SyncFileBackend, TableCleanup, TidyUpT39714, Undelete, Update, UpdateArticleCount, UpdateCollation, UpdateCSS, UpdateDatabaseValueFormat, UpdateDoubleWidthSearch, UpdateExtensionJsonSchema, UpdateLexerList, UpdateMediaWiki, UpdateRestrictions, UpdateScratchTokenFormat, UpdateSearchIndex, UpdateSpecialPages, UpdateTOTPToMultipleKeys, UppercaseTitlesForUnicodeTransition, UserOptionsMaintenance, ValidateRegistrationFile, ViewCLI, and WrapOldPasswords.

Collaboration diagram for Maintenance:

Public Member Functions

 __construct ()
 Default constructor. More...
 
 checkRequiredExtensions ()
 Verify that the required extensions are installed. More...
 
 cleanupChanneled ()
 Clean up channeled output. More...
 
 clearParamsAndArgs ()
 Clear all params and arguments. More...
 
 execute ()
 Do the actual work. More...
 
 finalSetup ()
 Handle some last-minute setup here. More...
 
 getConfig ()
 
 getDbType ()
 Does the script need different DB access? By default, we give Maintenance scripts normal rights to the DB. More...
 
 getName ()
 Get the script's name. More...
 
 globals ()
 Potentially debug globals. More...
 
 isQuiet ()
 
 loadParamsAndArgs ( $self=null, $opts=null, $args=null)
 Process command line arguments $mOptions becomes an array with keys set to the option names $mArgs becomes a zero-based array containing the non-option arguments. More...
 
 loadSettings ()
 Generic setup for most installs. More...
 
 loadWithArgv ( $argv)
 Load params and arguments from a given array of command-line arguments. More...
 
 memoryLimit ()
 Normally we disable the memory_limit when running admin scripts. More...
 
 outputChanneled ( $msg, $channel=null)
 Message outputter with channeled message support. More...
 
 purgeRedundantText ( $delete=true)
 Support function for cleaning up redundant text records. More...
 
 runChild ( $maintClass, $classFile=null)
 Run a child maintenance script. More...
 
 setAgentAndTriggers ()
 Set triggers like when to try to run deferred updates. More...
 
 setConfig (Config $config)
 
 setDB (IMaintainableDatabase $db)
 Sets database object to be returned by getDB(). More...
 
 setup ()
 Do some sanity checking and basic setup. More...
 
 updateSearchIndex ( $maxLockTime, $callback, $dbw, $results)
 Perform a search index update with locking. More...
 
 updateSearchIndexForPage ( $dbw, $pageId)
 Update the searchindex table for a given pageid. More...
 
 validateParamsAndArgs ()
 Run some validation checks on the params, etc. More...
 

Static Public Member Functions

static getTermSize ()
 Get the terminal size as a two-element array where the first element is the width (number of columns) and the second element is the height (number of rows). More...
 
static posix_isatty ( $fd)
 Wrapper for posix_isatty() We default as considering stdin a tty (for nice readline methods) but treating stout as not a tty to avoid color codes. More...
 
static readconsole ( $prompt='> ')
 Prompt the console for input. More...
 
static requireTestsAutoloader ()
 Call this to set up the autoloader to allow classes to be used from the tests directory. More...
 
static setLBFactoryTriggers (LBFactory $LBFactory, Config $config)
 
static shouldExecute ()
 Should we execute the maintenance script, or just allow it to be included as a standalone class? It checks that the call stack only includes this function and "requires" (meaning was called from the file scope) More...
 

Public Attributes

resource $fileHandle
 Used when creating separate schema files. More...
 
 $mDbPass
 
array $orderedOptions = []
 Used to read the options in the order they were passed. More...
 
const DB_ADMIN = 2
 
const DB_NONE = 0
 Constants for DB access type. More...
 
const DB_STD = 1
 
const STDIN_ALL = 'all'
 

Protected Member Functions

 activateProfiler ()
 Activate the profiler (assuming $wgProfiler is set) More...
 
 addArg ( $arg, $description, $required=true)
 Add some args that are needed. More...
 
 addDefaultParams ()
 Add the default parameters to the scripts. More...
 
 addDescription ( $text)
 Set the description text. More...
 
 addOption ( $name, $description, $required=false, $withArg=false, $shortName=false, $multiOccurrence=false)
 Add a parameter to the script. More...
 
 adjustMemoryLimit ()
 Adjusts PHP's memory limit to better suit our needs, if needed. More...
 
 afterFinalSetup ()
 Execute a callback function at the end of initialisation. More...
 
 beginTransaction (IDatabase $dbw, $fname)
 Begin a transcation on a DB. More...
 
 commitTransaction (IDatabase $dbw, $fname)
 Commit the transcation on a DB handle and wait for replica DBs to catch up. More...
 
 countDown ( $seconds)
 Count down from $seconds to zero on the terminal, with a one-second pause between showing each number. More...
 
 deleteOption ( $name)
 Remove an option. More...
 
 error ( $err, $die=0)
 Throw an error to the user. More...
 
 fatalError ( $msg, $exitCode=1)
 Output a message and terminate the current script. More...
 
 getArg ( $argId=0, $default=null)
 Get an argument. More...
 
 getBatchSize ()
 Returns batch size. More...
 
 getDB ( $db, $groups=[], $dbDomain=false)
 Returns a database to be used by current maintenance script. More...
 
 getDir ()
 Get the maintenance directory. More...
 
 getOption ( $name, $default=null)
 Get an option, or return the default. More...
 
 getStdin ( $len=null)
 Return input from stdin. More...
 
 hasArg ( $argId=0)
 Does a given argument exist? More...
 
 hasOption ( $name)
 Checks to see if a particular option exists. More...
 
 loadSpecialVars ()
 Handle the special variables that are global to all scripts. More...
 
 maybeHelp ( $force=false)
 Maybe show the help. More...
 
 output ( $out, $channel=null)
 Throw some output to the user. More...
 
 requireExtension ( $name)
 Indicate that the specified extension must be loaded before the script can run. More...
 
 rollbackTransaction (IDatabase $dbw, $fname)
 Rollback the transcation on a DB handle. More...
 
 setAllowUnregisteredOptions ( $allow)
 Sets whether to allow unregistered options, which are options passed to a script that do not match an expected parameter. More...
 
 setBatchSize ( $s=0)
 Set the batch size. More...
 
 supportsOption ( $name)
 Checks to see if a particular option in supported. More...
 

Protected Attributes

 $mAllowUnregisteredOptions = false
 
 $mArgList = []
 
 $mArgs = []
 
int $mBatchSize = null
 Batch size. More...
 
 $mDbUser
 
 $mDescription = ''
 
 $mInputLoaded = false
 
 $mOptions = []
 
array[] $mParams = []
 Array of desired/allowed params. More...
 
 $mQuiet = false
 
 $mSelf
 
 $mShortParamsMap = []
 

Private Member Functions

 lockSearchindex ( $db)
 Lock the search index. More...
 
 relockSearchindex ( $db)
 Unlock and lock again Since the lock is low-priority, queued reads will be able to complete. More...
 
 setParam (&$options, $option, $value)
 Helper function used solely by loadParamsAndArgs to prevent code duplication. More...
 
 unlockSearchindex ( $db)
 Unlock the tables. More...
 

Static Private Member Functions

static readlineEmulation ( $prompt)
 Emulate readline() More...
 

Private Attributes

 $atLineStart = true
 
Config $config
 Accessible via getConfig() More...
 
 $lastChannel = null
 
float $lastReplicationWait = 0.0
 UNIX timestamp. More...
 
IMaintainableDatabase $mDb = null
 Used by getDB() / setDB() More...
 
array[] $mDependantParameters = []
 Generic options which might or not be supported by the script. More...
 
array[] $mGenericParameters = []
 Generic options added by addDefaultParams() More...
 
array $requiredExtensions = []
 

Detailed Description

Abstract maintenance class for quickly writing and churning out maintenance scripts with minimal effort.

All that must be defined is the execute() method. See docs/maintenance.txt for more info and a quick demo of how to use it.

Terminology: params: registry of named values that may be passed to the script arg list: registry of positional values that may be passed to the script options: passed param values args: passed positional values

In the command: mwscript somescript.php –foo=bar baz foo is a param bar is the option value of the option for param foo baz is the arg value at index 0 in the arg list

Since
1.16

Definition at line 82 of file Maintenance.php.

Constructor & Destructor Documentation

◆ __construct()

Maintenance::__construct ( )

Default constructor.

Children should call this first if implementing their own constructors

Reimplemented in LoggedUpdateMaintenance, SearchDump, FindDeprecated, CategoryChangesAsRdf, ImageBuilder, MWDocGen, UppercaseTitlesForUnicodeTransition, CLIParser, PurgeChangedFiles, ReplaceAll, BenchmarkTitleValue, PopulateContentTables, BackupReader, ConvertExtensionToRegistration, CompareParsers, FindHooks, GenerateCollationData, CompressOld, CleanupInvalidDbKeys, NamespaceDupes, PreprocessDump, DeleteLocalPasswords, GetConfiguration, BenchmarkParse, CleanupWatchlist, MediaWikiShell, CleanupImages, MoveBatch, CleanupCaps, RefreshImageMetadata, DumpRenderer, TableCleanup, NukeNS, RecountCategories, Benchmarker, RebuildLocalisationCache, ShowJobs, UpdateCollation, Orphans, DeleteBatch, DumpCategoriesAsRdf, DumpIterator, Digit2Html, RebuildRecentchanges, CopyFileBackend, DumpLinks, ImportImages, GenerateNormalizerDataAr, PopulateLogSearch, RefreshLinks, CommandLineInc, PopulateArchiveRevId, RebuildTextIndex, RunJobs, ShowSiteStats, UpdateSearchIndex, CleanupUsersWithNoId, ConvertLinks, CreateCommonPasswordCdb, CommandLineInstaller, GenerateUcfirstOverrides, MergeMessageFileList, PopulateIpChanges, PurgeChangedPages, PurgeParserCache, GenerateFancyCaptchas, UpdateDatabaseValueFormat, UpdateScratchTokenFormat, UpdateTOTPToMultipleKeys, AttachLatest, CleanupRemovedModules, TitleCleanup, CleanupUploadStash, ConvertUserOptions, DumpUploads, FetchText, MigrateActors, PopulateContentModel, PopulateInterwiki, ResetAuthenticationThrottle, MwSql, UpdateMediaWiki, CountFancyCaptchas, DeleteOldFancyCaptchas, BenchmarkDeleteTruncate, BenchHttpHttps, DeleteOrphanedRevisions, EraseArchivedFile, FixTimestamps, InvalidateUserSesssions, GeneratePhpCharToUpperMappings, PopulateRevisionLength, CheckUsernames, CleanupBlocks, CreateAndPromote, FixDoubleRedirects, GenerateJsonI18n, GetTextMaint, GenerateNormalizerDataMl, PopulateCategory, PopulateLogUsertext, PopulateRevisionSha1, RebuildFileCache, ResetUserTokens, RunBatchedQuery, SqliteMaintenance, DumpRev, UpdateArticleCount, UpdateRestrictions, WrapOldPasswords, AddChangeTag, BenchIfSwitch, BenchWfIsWindows, BenchWikimediaBaseConvert, ChangePassword, CleanupPreferences, CleanupSpam, CopyJobQueue, DeleteArchivedRevisions, FixDefaultJsonContentPages, FixExtLinksProtocolRelative, ImportSiteScripts, ImportTextFiles, DateFormats, LangMemUsage, MigrateArchiveText, MigrateComments, MinifyScript, MysqlMaintenance, PopulateImageSha1, PopulateParentId, PopulateRecentChangesSource, PruneFileCache, ReassignEdits, OrphanStats, UpdateDoubleWidthSearch, UpdateSpecialPages, BenchmarkHooks, CheckDependencies, CleanupAncientTables, CleanupEmptyCategories, DeleteArchivedFiles, DeleteDefaultMessages, EditCLI, FormatInstallDoc, GetLagTimes, GetReplicaServer, InitSiteStats, JSParseHelper, DatabaseLag, DumpMessages, McTest, MigrateFileRepoLayout, NukePage, PopulateExternallinksIndex60, RefreshExternallinksIndex, RefreshFileHeaders, RemoveUnusedAccounts, RenameDbPrefix, RollbackEdits, UserOptionsMaintenance, ViewCLI, RenameUserCleanup, UpdateCSS, UpdateLexerList, BenchmarkStringReplacement, ClearInterwikiCache, DeleteEqualMessages, DeleteOldRevisions, DeleteSelfExternals, FileOpPerfTest, FixUserRegistration, AllTrans, ListVariants, MigrateImageCommentTemp, PatchSql, PopulateFilearchiveSha1, PurgeOldText, RebuildAll, ResetUserEmail, SyncFileBackend, AddRFCandPMIDInterwiki, BenchmarkJavaScriptMinifier, BenchmarkJSMinPlus, BenchmarkLruHash, BenchmarkPurge, CheckBadRedirects, CheckImages, ManageJobs, MigrateUserGroup, PopulateBacklinkNamespace, Protect, PurgeExpiredUserrights, PurgeList, PurgeModuleDeps, PurgePage, RebuildMessages, ResetPageRandom, CheckLess, MakeTestEdits, ManageForeignResources, PopulatePPSortKey, BenchmarkCSSMin, BenchmarkSanitizer, CompareParserCache, EmptyUserGroup, InitEditCount, GenerateUpperCharTable, PopulateChangeTagDef, DeleteAutoPatrolLogs, PageExists, Undelete, FindMissingFiles, FindOrphanedFiles, DeduplicateArchiveRevId, AddSite, RemoveInvalidEmails, InitUserPreference, ExportSites, ImportSites, InitImageData, Cleanup, DisableOATHAuthForUser, CleanupArchiveUserText, CleanupRevActorPage, CheckComposerLockUpToDate, Update, BenchmarkTidy, HHVMMakeRepo, UpdateExtensionJsonSchema, and ValidateRegistrationFile.

Definition at line 195 of file Maintenance.php.

References $IP, and addDefaultParams().

Member Function Documentation

◆ activateProfiler()

Maintenance::activateProfiler ( )
protected

Activate the profiler (assuming $wgProfiler is set)

Definition at line 832 of file Maintenance.php.

References $output, $wgProfileLimit, $wgProfiler, $wgTrxProfilerLimits, getOption(), Profiler\instance(), and Profiler\replaceStubInstance().

Referenced by finalSetup().

◆ addArg()

Maintenance::addArg (   $arg,
  $description,
  $required = true 
)
protected

Add some args that are needed.

Parameters
string$argName of the arg, like 'start'
string$descriptionShort description of the arg
bool$requiredIs this required?

Definition at line 319 of file Maintenance.php.

Referenced by ValidateRegistrationFile\__construct(), UpdateExtensionJsonSchema\__construct(), DisableOATHAuthForUser\__construct(), ImportSites\__construct(), ExportSites\__construct(), AddSite\__construct(), Undelete\__construct(), PageExists\__construct(), EmptyUserGroup\__construct(), ManageForeignResources\__construct(), Protect\__construct(), MigrateUserGroup\__construct(), PatchSql\__construct(), ResetUserEmail\__construct(), EditCLI\__construct(), UserOptionsMaintenance\__construct(), ViewCLI\__construct(), JSParseHelper\__construct(), McTest\__construct(), FormatInstallDoc\__construct(), NukePage\__construct(), ReassignEdits\__construct(), CleanupSpam\__construct(), ImportSiteScripts\__construct(), MysqlMaintenance\__construct(), ImportTextFiles\__construct(), MinifyScript\__construct(), GenerateJsonI18n\__construct(), DumpRev\__construct(), CreateAndPromote\__construct(), GetTextMaint\__construct(), FixTimestamps\__construct(), CreateCommonPasswordCdb\__construct(), CommandLineInstaller\__construct(), ConvertLinks\__construct(), ImportImages\__construct(), RefreshLinks\__construct(), DeleteBatch\__construct(), MoveBatch\__construct(), BenchmarkParse\__construct(), ConvertExtensionToRegistration\__construct(), BackupReader\__construct(), ReplaceAll\__construct(), and CLIParser\__construct().

◆ addDefaultParams()

Maintenance::addDefaultParams ( )
protected

Add the default parameters to the scripts.

Definition at line 570 of file Maintenance.php.

References $mParams, addOption(), and getDbType().

Referenced by __construct().

◆ addDescription()

Maintenance::addDescription (   $text)
protected

Set the description text.

Parameters
string$textThe text of the description

Definition at line 348 of file Maintenance.php.

Referenced by UpdateExtensionJsonSchema\__construct(), HHVMMakeRepo\__construct(), Update\__construct(), CheckComposerLockUpToDate\__construct(), CleanupArchiveUserText\__construct(), CleanupRevActorPage\__construct(), DisableOATHAuthForUser\__construct(), InitImageData\__construct(), ExportSites\__construct(), ImportSites\__construct(), AddSite\__construct(), DeduplicateArchiveRevId\__construct(), FindMissingFiles\__construct(), FindOrphanedFiles\__construct(), Undelete\__construct(), DeleteAutoPatrolLogs\__construct(), PageExists\__construct(), BenchmarkSanitizer\__construct(), PopulateChangeTagDef\__construct(), EmptyUserGroup\__construct(), BenchmarkCSSMin\__construct(), CompareParserCache\__construct(), InitEditCount\__construct(), GenerateUpperCharTable\__construct(), MakeTestEdits\__construct(), ManageForeignResources\__construct(), PopulatePPSortKey\__construct(), CheckLess\__construct(), ManageJobs\__construct(), MigrateUserGroup\__construct(), CheckBadRedirects\__construct(), PopulateBacklinkNamespace\__construct(), AddRFCandPMIDInterwiki\__construct(), DumpBackup\__construct(), CheckImages\__construct(), Protect\__construct(), PurgeExpiredUserrights\__construct(), PurgeList\__construct(), PurgeModuleDeps\__construct(), PurgePage\__construct(), RebuildMessages\__construct(), ResetPageRandom\__construct(), BenchmarkJavaScriptMinifier\__construct(), BenchmarkJSMinPlus\__construct(), BenchmarkLruHash\__construct(), BenchmarkPurge\__construct(), BenchmarkStringReplacement\__construct(), MigrateImageCommentTemp\__construct(), DeleteEqualMessages\__construct(), PatchSql\__construct(), DeleteOldRevisions\__construct(), DeleteSelfExternals\__construct(), PopulateFilearchiveSha1\__construct(), PurgeOldText\__construct(), FileOpPerfTest\__construct(), RebuildAll\__construct(), FixUserRegistration\__construct(), ResetUserEmail\__construct(), SyncFileBackend\__construct(), RenameUserCleanup\__construct(), ClearInterwikiCache\__construct(), UpdateCSS\__construct(), AllTrans\__construct(), UpdateLexerList\__construct(), ListVariants\__construct(), McTest\__construct(), MigrateFileRepoLayout\__construct(), DeleteArchivedFiles\__construct(), NukePage\__construct(), DeleteDefaultMessages\__construct(), CheckDependencies\__construct(), PopulateExternallinksIndex60\__construct(), EditCLI\__construct(), CleanupAncientTables\__construct(), CleanupEmptyCategories\__construct(), RefreshExternallinksIndex\__construct(), RefreshFileHeaders\__construct(), RollbackEdits\__construct(), GetLagTimes\__construct(), GetReplicaServer\__construct(), UserOptionsMaintenance\__construct(), ViewCLI\__construct(), BenchmarkHooks\__construct(), InitSiteStats\__construct(), JSParseHelper\__construct(), DatabaseLag\__construct(), DumpMessages\__construct(), CopyJobQueue\__construct(), AddChangeTag\__construct(), MigrateArchiveText\__construct(), MigrateComments\__construct(), DeleteArchivedRevisions\__construct(), MinifyScript\__construct(), MysqlMaintenance\__construct(), ImportSiteScripts\__construct(), ChangePassword\__construct(), FixDefaultJsonContentPages\__construct(), PopulateImageSha1\__construct(), PopulateParentId\__construct(), OrphanStats\__construct(), PopulateRecentChangesSource\__construct(), PruneFileCache\__construct(), ReassignEdits\__construct(), BenchWfIsWindows\__construct(), BenchIfSwitch\__construct(), FixExtLinksProtocolRelative\__construct(), CleanupPreferences\__construct(), CleanupSpam\__construct(), BenchWikimediaBaseConvert\__construct(), UpdateDoubleWidthSearch\__construct(), ImportTextFiles\__construct(), DateFormats\__construct(), LangMemUsage\__construct(), UpdateArticleCount\__construct(), CreateAndPromote\__construct(), GetTextMaint\__construct(), PopulateLogUsertext\__construct(), PopulateRevisionSha1\__construct(), CheckUsernames\__construct(), CleanupBlocks\__construct(), RebuildFileCache\__construct(), FixDoubleRedirects\__construct(), ResetUserTokens\__construct(), GenerateJsonI18n\__construct(), SqliteMaintenance\__construct(), PopulateCategory\__construct(), UpdateRestrictions\__construct(), WrapOldPasswords\__construct(), RunBatchedQuery\__construct(), GenerateNormalizerDataMl\__construct(), GeneratePhpCharToUpperMappings\__construct(), DeleteOldFancyCaptchas\__construct(), PopulateRevisionLength\__construct(), BenchmarkDeleteTruncate\__construct(), DeleteOrphanedRevisions\__construct(), BenchHttpHttps\__construct(), EraseArchivedFile\__construct(), CountFancyCaptchas\__construct(), FixTimestamps\__construct(), InvalidateUserSesssions\__construct(), UpdateScratchTokenFormat\__construct(), AttachLatest\__construct(), UpdateTOTPToMultipleKeys\__construct(), MwSql\__construct(), PopulateContentModel\__construct(), UpdateMediaWiki\__construct(), FetchText\__construct(), CleanupRemovedModules\__construct(), DumpUploads\__construct(), CleanupUploadStash\__construct(), ResetAuthenticationThrottle\__construct(), PopulateInterwiki\__construct(), TitleCleanup\__construct(), MigrateActors\__construct(), UpdateDatabaseValueFormat\__construct(), GenerateFancyCaptchas\__construct(), ConvertUserOptions\__construct(), CreateCommonPasswordCdb\__construct(), PurgeParserCache\__construct(), MergeMessageFileList\__construct(), PurgeChangedPages\__construct(), GenerateUcfirstOverrides\__construct(), PopulateIpChanges\__construct(), CommandLineInstaller\__construct(), CleanupUsersWithNoId\__construct(), ConvertLinks\__construct(), ShowSiteStats\__construct(), RebuildTextIndex\__construct(), RunJobs\__construct(), PopulateArchiveRevId\__construct(), UpdateSearchIndex\__construct(), RefreshLinks\__construct(), PopulateLogSearch\__construct(), DumpLinks\__construct(), ImportImages\__construct(), GenerateNormalizerDataAr\__construct(), CopyFileBackend\__construct(), Digit2Html\__construct(), DeleteBatch\__construct(), DumpCategoriesAsRdf\__construct(), RebuildRecentchanges\__construct(), DumpIterator\__construct(), Orphans\__construct(), RebuildLocalisationCache\__construct(), ShowJobs\__construct(), UpdateCollation\__construct(), RecountCategories\__construct(), NukeNS\__construct(), DumpRenderer\__construct(), CleanupCaps\__construct(), RefreshImageMetadata\__construct(), MoveBatch\__construct(), CleanupImages\__construct(), CleanupWatchlist\__construct(), BenchmarkParse\__construct(), GetConfiguration\__construct(), DeleteLocalPasswords\__construct(), NamespaceDupes\__construct(), CleanupInvalidDbKeys\__construct(), CompressOld\__construct(), FindHooks\__construct(), CompareParsers\__construct(), ConvertExtensionToRegistration\__construct(), BackupReader\__construct(), ReplaceAll\__construct(), PopulateContentTables\__construct(), BenchmarkTitleValue\__construct(), PurgeChangedFiles\__construct(), CLIParser\__construct(), UppercaseTitlesForUnicodeTransition\__construct(), MWDocGen\__construct(), ImageBuilder\__construct(), CategoryChangesAsRdf\__construct(), TextPassDumper\__construct(), FindDeprecated\__construct(), and SearchDump\__construct().

◆ addOption()

Maintenance::addOption (   $name,
  $description,
  $required = false,
  $withArg = false,
  $shortName = false,
  $multiOccurrence = false 
)
protected

Add a parameter to the script.

Will be displayed on –help with the associated description

Parameters
string$nameThe name of the param (help, version, etc)
string$descriptionThe description of the param to show on –help
bool$requiredIs the param required?
bool$withArgIs an argument required with this option?
string | bool$shortNameCharacter to use as short name
bool$multiOccurrenceCan this option be passed multiple times?

Definition at line 267 of file Maintenance.php.

Referenced by BenchmarkTidy\__construct(), HHVMMakeRepo\__construct(), Update\__construct(), Cleanup\__construct(), InitImageData\__construct(), InitUserPreference\__construct(), RemoveInvalidEmails\__construct(), AddSite\__construct(), FindMissingFiles\__construct(), FindOrphanedFiles\__construct(), Undelete\__construct(), DeleteAutoPatrolLogs\__construct(), CompareParserCache\__construct(), InitEditCount\__construct(), GenerateUpperCharTable\__construct(), BenchmarkSanitizer\__construct(), PopulateChangeTagDef\__construct(), BenchmarkCSSMin\__construct(), MakeTestEdits\__construct(), ManageForeignResources\__construct(), BenchmarkJavaScriptMinifier\__construct(), BenchmarkJSMinPlus\__construct(), ResetPageRandom\__construct(), BenchmarkLruHash\__construct(), ManageJobs\__construct(), DumpBackup\__construct(), PopulateBacklinkNamespace\__construct(), Protect\__construct(), PurgeList\__construct(), PurgePage\__construct(), ResetUserEmail\__construct(), SyncFileBackend\__construct(), ListVariants\__construct(), DeleteEqualMessages\__construct(), DeleteOldRevisions\__construct(), FileOpPerfTest\__construct(), RenameUserCleanup\__construct(), PurgeOldText\__construct(), RefreshFileHeaders\__construct(), GetReplicaServer\__construct(), GetLagTimes\__construct(), RemoveUnusedAccounts\__construct(), RollbackEdits\__construct(), RenameDbPrefix\__construct(), InitSiteStats\__construct(), UserOptionsMaintenance\__construct(), DeleteArchivedFiles\__construct(), DatabaseLag\__construct(), McTest\__construct(), DeleteDefaultMessages\__construct(), CheckDependencies\__construct(), CleanupAncientTables\__construct(), MigrateFileRepoLayout\__construct(), NukePage\__construct(), EditCLI\__construct(), FormatInstallDoc\__construct(), ImportSiteScripts\__construct(), ImportTextFiles\__construct(), UpdateDoubleWidthSearch\__construct(), UpdateSpecialPages\__construct(), CopyJobQueue\__construct(), DeleteArchivedRevisions\__construct(), AddChangeTag\__construct(), ChangePassword\__construct(), MigrateArchiveText\__construct(), MinifyScript\__construct(), MysqlMaintenance\__construct(), BenchWikimediaBaseConvert\__construct(), PopulateImageSha1\__construct(), CleanupPreferences\__construct(), PruneFileCache\__construct(), CleanupSpam\__construct(), ReassignEdits\__construct(), GetTextMaint\__construct(), RunBatchedQuery\__construct(), SqliteMaintenance\__construct(), UpdateArticleCount\__construct(), WrapOldPasswords\__construct(), CreateAndPromote\__construct(), ResetUserTokens\__construct(), FixDoubleRedirects\__construct(), RebuildFileCache\__construct(), GenerateJsonI18n\__construct(), InvalidateUserSesssions\__construct(), EraseArchivedFile\__construct(), DeleteOrphanedRevisions\__construct(), DeleteOldFancyCaptchas\__construct(), ResetAuthenticationThrottle\__construct(), GenerateFancyCaptchas\__construct(), MwSql\__construct(), UpdateMediaWiki\__construct(), PopulateInterwiki\__construct(), AttachLatest\__construct(), DumpUploads\__construct(), PopulateContentModel\__construct(), MigrateActors\__construct(), CleanupUsersWithNoId\__construct(), CommandLineInstaller\__construct(), CreateCommonPasswordCdb\__construct(), GenerateUcfirstOverrides\__construct(), MergeMessageFileList\__construct(), PopulateIpChanges\__construct(), PurgeChangedPages\__construct(), PurgeParserCache\__construct(), CommandLineInc\__construct(), RunJobs\__construct(), UpdateSearchIndex\__construct(), RefreshLinks\__construct(), ImportImages\__construct(), GenerateNormalizerDataAr\__construct(), CopyFileBackend\__construct(), DeleteBatch\__construct(), DumpCategoriesAsRdf\__construct(), DumpIterator\__construct(), RebuildRecentchanges\__construct(), Orphans\__construct(), UpdateCollation\__construct(), RebuildLocalisationCache\__construct(), ShowJobs\__construct(), Benchmarker\__construct(), RecountCategories\__construct(), TableCleanup\__construct(), NukeNS\__construct(), DumpRenderer\__construct(), RefreshImageMetadata\__construct(), CleanupCaps\__construct(), MoveBatch\__construct(), CleanupWatchlist\__construct(), BenchmarkParse\__construct(), MediaWikiShell\__construct(), GetConfiguration\__construct(), DeleteLocalPasswords\__construct(), CleanupInvalidDbKeys\__construct(), PreprocessDump\__construct(), NamespaceDupes\__construct(), CompressOld\__construct(), FindHooks\__construct(), GenerateCollationData\__construct(), CompareParsers\__construct(), ConvertExtensionToRegistration\__construct(), BackupReader\__construct(), PopulateContentTables\__construct(), ReplaceAll\__construct(), PurgeChangedFiles\__construct(), CLIParser\__construct(), UppercaseTitlesForUnicodeTransition\__construct(), MWDocGen\__construct(), ImageBuilder\__construct(), CategoryChangesAsRdf\__construct(), TextPassDumper\__construct(), BackupDumper\__construct(), SearchDump\__construct(), LoggedUpdateMaintenance\__construct(), addDefaultParams(), setBatchSize(), and UpdateMediaWiki\validateParamsAndArgs().

◆ adjustMemoryLimit()

Maintenance::adjustMemoryLimit ( )
protected

Adjusts PHP's memory limit to better suit our needs, if needed.

Definition at line 819 of file Maintenance.php.

References memoryLimit().

Referenced by finalSetup(), and setup().

◆ afterFinalSetup()

Maintenance::afterFinalSetup ( )
protected

Execute a callback function at the end of initialisation.

Reimplemented in UpdateMediaWiki.

Definition at line 1250 of file Maintenance.php.

Referenced by finalSetup().

◆ beginTransaction()

Maintenance::beginTransaction ( IDatabase  $dbw,
  $fname 
)
protected

◆ checkRequiredExtensions()

Maintenance::checkRequiredExtensions ( )

Verify that the required extensions are installed.

Since
1.28

Definition at line 647 of file Maintenance.php.

References fatalError(), and ExtensionRegistry\getInstance().

◆ cleanupChanneled()

Maintenance::cleanupChanneled ( )

Clean up channeled output.

Output a newline if necessary.

Definition at line 515 of file Maintenance.php.

Referenced by output(), and outputChanneled().

◆ clearParamsAndArgs()

Maintenance::clearParamsAndArgs ( )

Clear all params and arguments.

Definition at line 860 of file Maintenance.php.

◆ commitTransaction()

Maintenance::commitTransaction ( IDatabase  $dbw,
  $fname 
)
protected

Commit the transcation on a DB handle and wait for replica DBs to catch up.

This method makes it clear that commit() is called from a maintenance script, which has outermost scope. This is safe, unlike $dbw->commit() called in other places.

Parameters
IDatabase$dbw
string$fnameCaller name
Returns
bool Whether the replica DB wait succeeded
Since
1.27

Definition at line 1441 of file Maintenance.php.

References Wikimedia\Rdbms\IDatabase\commit().

Referenced by CleanupSpam\cleanupArticle(), CompressOld\compressWithConcat(), CleanupPreferences\deleteByWhere(), NukePage\deleteRevisions(), DeduplicateArchiveRevId\doDBUpdates(), PopulatePPSortKey\doDBUpdates(), PopulateLogUsertext\doDBUpdates(), MigrateImageCommentTemp\doDBUpdates(), MigrateArchiveText\doDBUpdates(), DeleteOldRevisions\doDelete(), PopulateRevisionLength\doLenUpdates(), ReassignEdits\doReassignEdits(), PopulateRevisionSha1\doSha1LegacyUpdates(), PopulateRevisionSha1\doSha1Updates(), DeleteSelfExternals\execute(), PurgeModuleDeps\execute(), MigrateUserGroup\execute(), NukePage\execute(), DeleteArchivedFiles\execute(), DeleteOrphanedRevisions\execute(), WrapOldPasswords\execute(), CleanupRemovedModules\execute(), NukeNS\execute(), MoveBatch\execute(), RebuildFileCache\execute(), UpdateCollation\execute(), RemoveUnusedAccounts\isInactiveAccount(), NamespaceDupes\mergePage(), MigrateComments\migrateToTemp(), MigrateActors\migrateToTemp(), CleanupImages\pokeFile(), PopulateContentTables\populateContentTablesForRowBatch(), purgeRedundantText(), and RenameUserCleanup\updateTable().

◆ countDown()

Maintenance::countDown (   $seconds)
protected

Count down from $seconds to zero on the terminal, with a one-second pause between showing each number.

If the maintenance script is in quiet mode, this function does nothing.

Since
1.31

@codeCoverageIgnore

Parameters
int$seconds

Definition at line 1572 of file Maintenance.php.

References isQuiet(), and output().

Referenced by ResetUserTokens\execute(), DeleteAutoPatrolLogs\execute(), and UpdateMediaWiki\execute().

◆ deleteOption()

Maintenance::deleteOption (   $name)
protected

Remove an option.

Useful for removing options that won't be used in your script.

Parameters
string$nameThe option to remove.

Definition at line 331 of file Maintenance.php.

◆ error()

Maintenance::error (   $err,
  $die = 0 
)
protected

Throw an error to the user.

Doesn't respect –quiet, so don't use this for non-error output

Parameters
string$errThe error to display
int$dieDeprecated since 1.31, use Maintenance::fatalError() instead

Definition at line 481 of file Maintenance.php.

References fatalError(), outputChanneled(), and wfDeprecated().

Referenced by MigrateActors\addActorsForRows(), SqliteMaintenance\backup(), CleanupImages\buildSafeTitle(), FindOrphanedFiles\checkFiles(), SqliteMaintenance\checkSyntax(), RenameUserCleanup\checkUserExistence(), CleanupSpam\cleanupArticle(), CompressOld\compressPage(), CompressOld\compressWithConcat(), CompareParsers\conclusions(), CopyFileBackend\copyFileBatch(), CopyFileBackend\delFileBatch(), PopulateRecentChangesSource\doDBUpdates(), PopulateParentId\doDBUpdates(), FixExtLinksProtocolRelative\doDBUpdates(), RefreshExternallinksIndex\doDBUpdates(), MigrateImageCommentTemp\doDBUpdates(), MigrateActors\doDBUpdates(), PopulateLogSearch\doDBUpdates(), MigrateArchiveText\doDBUpdates(), UppercaseTitlesForUnicodeTransition\doMove(), CleanupUploadStash\doOperations(), UpdateSpecialPages\doSpecialPageCacheUpdates(), UppercaseTitlesForUnicodeTransition\doUpdate(), DisableOATHAuthForUser\execute(), Update\execute(), BenchmarkPurge\execute(), DeleteSelfExternals\execute(), CleanupAncientTables\execute(), DeleteArchivedFiles\execute(), CountFancyCaptchas\execute(), ImportSiteScripts\execute(), MigrateFileRepoLayout\execute(), UpdateScratchTokenFormat\execute(), FixDoubleRedirects\execute(), UpdateTOTPToMultipleKeys\execute(), ReassignEdits\execute(), PatchSql\execute(), UpdateDatabaseValueFormat\execute(), Digit2Html\execute(), GenerateJsonI18n\execute(), DeleteOldFancyCaptchas\execute(), RollbackEdits\execute(), DumpIterator\execute(), MysqlMaintenance\execute(), PurgeChangedPages\execute(), ImportTextFiles\execute(), CreateCommonPasswordCdb\execute(), GenerateNormalizerDataAr\execute(), MergeMessageFileList\execute(), DumpRenderer\execute(), SqliteMaintenance\execute(), CreateAndPromote\execute(), MoveBatch\execute(), PopulateInterwiki\execute(), GenerateFancyCaptchas\execute(), UpdateSearchIndex\execute(), BenchmarkParse\execute(), ConvertLinks\execute(), PurgeChangedFiles\execute(), UpdateMediaWiki\execute(), CompressOld\execute(), UppercaseTitlesForUnicodeTransition\execute(), CategoryChangesAsRdf\execute(), ReplaceAll\execute(), fatalError(), ReplaceAll\getReplacement(), ReplaceAll\getTarget(), ReplaceAll\getUser(), DumpRenderer\handleRevision(), DumpIterator\handleRevision(), SqliteMaintenance\integrityCheck(), loadWithArgv(), Update\logError(), MigrateActors\migrate(), MigrateActors\migrateLogSearch(), MigrateActors\migrateToTemp(), UppercaseTitlesForUnicodeTransition\mungeTitle(), CleanupImages\pokeFile(), PopulateContentModel\populateRevisionOrArchive(), PreprocessDump\processRevision(), CompareParsers\processRevision(), UppercaseTitlesForUnicodeTransition\processUsers(), PurgePage\purge(), PurgeChangedFiles\purgeFromArchiveTable(), PurgeChangedFiles\purgeFromLogType(), MergeMessageFileList\readFile(), RefreshLinks\refreshTrackingCategory(), UpdateSpecialPages\reopenAndWaitForReplicas(), ReplaceAll\replaceTitles(), runChild(), MysqlMaintenance\runMysql(), CommandLineInstaller\setDbPassOption(), setParam(), CommandLineInstaller\setPassOption(), MwSql\sqlDoQuery(), SyncFileBackend\syncBackends(), SyncFileBackend\syncFileBatch(), RefreshFileHeaders\updateFileHeaders(), RenameUserCleanup\updateTable(), GetConfiguration\validateParamsAndArgs(), validateParamsAndArgs(), and CLIParser\Wikitext().

◆ execute()

Maintenance::execute ( )
abstract

Do the actual work.

All child classes will need to implement this

Returns
bool|null|void True for success, false for failure. Not returning a value, or returning null, is also interpreted as success. Returning false for failure will cause doMaintenance.php to exit the process with a non-zero exit status.

Reimplemented in LoggedUpdateMaintenance, FakeMaintenance, ReplaceAll, BackupDumper, TextPassDumper, FindDeprecated, MWDocGen, DumpCategoriesAsRdf, ImportImages, CategoryChangesAsRdf, GetConfiguration, CommandLineInstaller, BackupReader, UppercaseTitlesForUnicodeTransition, DeleteEqualMessages, RefreshImageMetadata, DeleteLocalPasswords, CompressOld, PopulateContentTables, UpdateMediaWiki, ImageBuilder, RecountCategories, CleanupInvalidDbKeys, CLIParser, DumpBackup, PurgeChangedFiles, NamespaceDupes, ConvertExtensionToRegistration, UpdateCollation, PopulateCategory, ConvertLinks, BenchmarkParse, CommandLineInc, FetchText, FindHooks, BenchmarkTitleValue, GenerateCollationData, RebuildLocalisationCache, UpdateSearchIndex, CleanupPreferences, ManageForeignResources, RebuildFileCache, RebuildRecentchanges, RunJobs, GenerateFancyCaptchas, PopulateInterwiki, MediaWikiShell, CreateAndPromote, MoveBatch, PopulateImageSha1, RefreshLinks, SqliteMaintenance, CopyFileBackend, DeleteAutoPatrolLogs, CleanupWatchlist, DumpRenderer, MergeMessageFileList, ShowJobs, MwSql, CleanupCaps, MinifyScript, NukeNS, Orphans, PurgeParserCache, CreateCommonPasswordCdb, DeleteBatch, GenerateNormalizerDataAr, RefreshFileHeaders, ResetUserTokens, UserOptionsMaintenance, ImportTextFiles, MysqlMaintenance, PurgeChangedPages, ResetAuthenticationThrottle, UpdateDoubleWidthSearch, TableCleanup, DumpIterator, EditCLI, DeleteOldFancyCaptchas, RebuildTextIndex, RollbackEdits, RunBatchedQuery, DumpUploads, GenerateJsonI18n, GenerateUcfirstOverrides, ResetPageRandom, OrphanStats, SyncFileBackend, UpdateDatabaseValueFormat, InvalidateUserSesssions, Digit2Html, McTest, AttachLatest, CleanupSpam, DumpLinks, PatchSql, PopulateContentModel, RenameUserCleanup, CleanupRemovedModules, EraseArchivedFile, FixTimestamps, GenerateNormalizerDataMl, ReassignEdits, ShowSiteStats, WrapOldPasswords, UpdateScratchTokenFormat, UpdateTOTPToMultipleKeys, CleanupUploadStash, ConvertUserOptions, CopyJobQueue, DeleteOrphanedRevisions, FileOpPerfTest, FixDoubleRedirects, RenameDbPrefix, UpdateSpecialPages, CountFancyCaptchas, AddChangeTag, BenchWikimediaBaseConvert, ChangePassword, CheckDependencies, GetTextMaint, ImportSiteScripts, MigrateFileRepoLayout, Protect, PurgeList, ResetUserEmail, UpdateArticleCount, BenchmarkDeleteTruncate, BenchHttpHttps, CheckUsernames, CleanupBlocks, DeleteArchivedRevisions, InitEditCount, InitSiteStats, GeneratePhpCharToUpperMappings, PruneFileCache, RebuildAll, UpdateRestrictions, DeleteArchivedFiles, DeleteDefaultMessages, FormatInstallDoc, LangMemUsage, NukePage, RemoveUnusedAccounts, DumpRev, UpdateCSS, UpdateLexerList, AddSite, BenchIfSwitch, BenchWfIsWindows, CleanupAncientTables, DeleteOldRevisions, GetLagTimes, GetReplicaServer, JSParseHelper, DatabaseLag, DateFormats, ListVariants, MakeTestEdits, MigrateUserGroup, ViewCLI, BenchmarkHooks, DeleteSelfExternals, FixUserRegistration, DumpMessages, ManageJobs, PurgeModuleDeps, PurgeOldText, InitImageData, BenchmarkJavaScriptMinifier, BenchmarkJSMinPlus, BenchmarkLruHash, BenchmarkSanitizer, BenchmarkStringReplacement, CheckImages, ClearInterwikiCache, AllTrans, PurgePage, BenchmarkCSSMin, BenchmarkPurge, CheckBadRedirects, CheckLess, CompareParserCache, InitUserPreference, PurgeExpiredUserrights, RebuildMessages, EmptyUserGroup, GenerateUpperCharTable, Undelete, FindMissingFiles, FindOrphanedFiles, PageExists, HHVMMakeRepo, ExportSites, ImportSites, RemoveInvalidEmails, StorageTypeStats, Update, DisableOATHAuthForUser, CleanupArchiveUserText, Cleanup, CheckComposerLockUpToDate, BenchmarkTidy, ValidateRegistrationFile, UpdateExtensionJsonSchema, and TidyUpT39714.

◆ fatalError()

Maintenance::fatalError (   $msg,
  $exitCode = 1 
)
protected

Output a message and terminate the current script.

Parameters
string$msgError message
int$exitCodePHP exit status. Should be in range 1-254.
Since
1.31

Definition at line 504 of file Maintenance.php.

References error().

Referenced by CompareParsers\checkOptions(), checkRequiredExtensions(), ResetAuthenticationThrottle\clearLoginThrottle(), UpdateMediaWiki\compatChecks(), CopyFileBackend\copyFileBatch(), CopyFileBackend\delFileBatch(), PopulateRevisionSha1\doDBUpdates(), PopulateRevisionLength\doDBUpdates(), PopulateIpChanges\doDBUpdates(), PopulateImageSha1\doDBUpdates(), error(), UpdateExtensionJsonSchema\execute(), ValidateRegistrationFile\execute(), BenchmarkTidy\execute(), CheckComposerLockUpToDate\execute(), Cleanup\execute(), ExportSites\execute(), HHVMMakeRepo\execute(), FindOrphanedFiles\execute(), Undelete\execute(), BenchmarkJavaScriptMinifier\execute(), BenchmarkJSMinPlus\execute(), ManageJobs\execute(), MigrateUserGroup\execute(), ViewCLI\execute(), MakeTestEdits\execute(), FormatInstallDoc\execute(), RemoveUnusedAccounts\execute(), DumpRev\execute(), DeleteDefaultMessages\execute(), LangMemUsage\execute(), GeneratePhpCharToUpperMappings\execute(), PruneFileCache\execute(), UpdateRestrictions\execute(), MigrateFileRepoLayout\execute(), ChangePassword\execute(), AddChangeTag\execute(), Protect\execute(), GetTextMaint\execute(), ResetUserEmail\execute(), FixDoubleRedirects\execute(), CopyJobQueue\execute(), RenameDbPrefix\execute(), CleanupUploadStash\execute(), UpdateSpecialPages\execute(), EraseArchivedFile\execute(), FixTimestamps\execute(), WrapOldPasswords\execute(), PopulateContentModel\execute(), CleanupSpam\execute(), McTest\execute(), InvalidateUserSesssions\execute(), GenerateJsonI18n\execute(), OrphanStats\execute(), SyncFileBackend\execute(), RebuildTextIndex\execute(), RollbackEdits\execute(), EditCLI\execute(), DumpIterator\execute(), UpdateDoubleWidthSearch\execute(), ImportTextFiles\execute(), ResetAuthenticationThrottle\execute(), CreateCommonPasswordCdb\execute(), DeleteBatch\execute(), GenerateNormalizerDataAr\execute(), PurgeParserCache\execute(), MergeMessageFileList\execute(), MwSql\execute(), CopyFileBackend\execute(), MoveBatch\execute(), CreateAndPromote\execute(), RefreshLinks\execute(), MediaWikiShell\execute(), RebuildFileCache\execute(), RebuildRecentchanges\execute(), RunJobs\execute(), GenerateCollationData\execute(), RebuildLocalisationCache\execute(), FindHooks\execute(), BenchmarkParse\execute(), ConvertExtensionToRegistration\execute(), DumpBackup\execute(), RecountCategories\execute(), UpdateMediaWiki\execute(), CompressOld\execute(), RefreshImageMetadata\execute(), DeleteEqualMessages\execute(), UppercaseTitlesForUnicodeTransition\execute(), BackupReader\execute(), ImportImages\execute(), MWDocGen\execute(), GenerateCollationData\generateFirstChars(), MinifyScript\getExtension(), CopyFileBackend\getListingDiffRel(), BackupReader\getNsIndex(), RefreshLinks\getPossibleCategories(), PopulateContentTables\getTables(), ConvertExtensionToRegistration\handleExtensionFunctions(), ConvertExtensionToRegistration\handleHooks(), BackupReader\importFromHandle(), ReassignEdits\initialiseUser(), DeleteLocalPasswords\initialize(), GenerateUcfirstOverrides\loadJson(), loadSettings(), MinifyScript\minify(), TitleCleanup\moveInconsistentPage(), PopulateContentTables\populateContentTablesForRowBatch(), DumpBackup\processOptions(), BackupDumper\processOptions(), MinifyScript\readFile(), CommandLineInstaller\setDbPassOption(), CommandLineInstaller\setPassOption(), setup(), RefreshImageMetadata\setupParameters(), UserOptionsMaintenance\showUsageStats(), MwSql\sqlDoQuery(), SyncFileBackend\syncBackends(), GenerateJsonI18n\transformI18nFile(), and SqliteMaintenance\vacuum().

◆ finalSetup()

◆ getArg()

◆ getBatchSize()

Maintenance::getBatchSize ( )
protected

Returns batch size.

Since
1.31
Returns
int|null

Definition at line 386 of file Maintenance.php.

References $mBatchSize.

Referenced by PopulateChangeTagDef\backpopulateChangeTagPerTag(), CleanupInvalidDbKeys\cleanupTable(), CopyJobQueue\copyJobs(), DeduplicateArchiveRevId\doDBUpdates(), PopulatePPSortKey\doDBUpdates(), PopulateRecentChangesSource\doDBUpdates(), PopulateChangeTagDef\doDBUpdates(), PopulateBacklinkNamespace\doDBUpdates(), FixDefaultJsonContentPages\doDBUpdates(), PopulateFilearchiveSha1\doDBUpdates(), PopulateParentId\doDBUpdates(), PopulateLogUsertext\doDBUpdates(), MigrateImageCommentTemp\doDBUpdates(), PopulateLogSearch\doDBUpdates(), MigrateArchiveText\doDBUpdates(), PopulateArchiveRevId\doDBUpdates(), PopulateIpChanges\doDBUpdates(), PopulateImageSha1\doDBUpdates(), PopulateRevisionLength\doLenUpdates(), PopulateRevisionSha1\doSha1Updates(), RecountCategories\doWork(), RemoveInvalidEmails\execute(), FindOrphanedFiles\execute(), FindMissingFiles\execute(), InitUserPreference\execute(), CheckImages\execute(), FixUserRegistration\execute(), PurgeModuleDeps\execute(), MakeTestEdits\execute(), MigrateUserGroup\execute(), CheckUsernames\execute(), UpdateRestrictions\execute(), CleanupBlocks\execute(), MigrateFileRepoLayout\execute(), ConvertUserOptions\execute(), CleanupUploadStash\execute(), WrapOldPasswords\execute(), CleanupRemovedModules\execute(), InvalidateUserSesssions\execute(), ResetPageRandom\execute(), PurgeChangedPages\execute(), ResetUserTokens\execute(), RefreshFileHeaders\execute(), CopyFileBackend\execute(), DeleteAutoPatrolLogs\execute(), RefreshLinks\execute(), RebuildFileCache\execute(), RefreshImageMetadata\execute(), DumpCategoriesAsRdf\getCategoryIterator(), DumpCategoriesAsRdf\getCategoryLinksIterator(), DeleteAutoPatrolLogs\getRows(), DeleteAutoPatrolLogs\getRowsOld(), DeleteLocalPasswords\getUserBatches(), PopulateContentTables\loadContentMap(), MigrateComments\migrate(), MigrateComments\migrateToTemp(), PopulateContentModel\populatePage(), PopulateContentModel\populateRevisionOrArchive(), PopulateContentTables\populateTable(), UppercaseTitlesForUnicodeTransition\processTable(), UppercaseTitlesForUnicodeTransition\processUsers(), PurgeChangedFiles\purgeFromLogType(), PurgeList\purgeNamespace(), RebuildRecentchanges\rebuildRecentChangesTablePass1(), RebuildRecentchanges\rebuildRecentChangesTablePass2(), RebuildRecentchanges\rebuildRecentChangesTablePass3(), RebuildRecentchanges\rebuildRecentChangesTablePass4(), RebuildRecentchanges\rebuildRecentChangesTablePass5(), RefreshLinks\refreshCategory(), ManageJobs\repushAbandoned(), and SyncFileBackend\syncBackends().

◆ getConfig()

◆ getDB()

Maintenance::getDB (   $db,
  $groups = [],
  $dbDomain = false 
)
protected

Returns a database to be used by current maintenance script.

This uses the main LBFactory instance by default unless overriden via setDB().

This function has the same parameters as LoadBalancer::getConnection().

Parameters
int$dbDB index (DB_REPLICA/DB_MASTER)
string | string[]$groupsdefault: empty array
string | bool$dbDomaindefault: current wiki
Returns
IMaintainableDatabase

Reimplemented in OrphanStats.

Definition at line 1396 of file Maintenance.php.

References $mDb.

Referenced by ImageBuilder\buildTable(), NamespaceDupes\checkLinkTable(), Orphans\checkOrphans(), Orphans\checkSeparation(), CleanupUsersWithNoId\cleanup(), CleanupSpam\cleanupArticle(), CleanupInvalidDbKeys\cleanupTable(), RebuildTextIndex\clearSearchIndex(), CompressOld\compressOldPages(), CompressOld\compressPage(), CompressOld\compressWithConcat(), RebuildTextIndex\createMysqlTextIndex(), ConvertLinks\createTempTable(), RefreshLinks\deleteLinksFromNonexistent(), NukePage\deleteRevisions(), RefreshLinks\dfnCheckInterval(), CleanupRevActorPage\doDBUpdates(), DeduplicateArchiveRevId\doDBUpdates(), PopulatePPSortKey\doDBUpdates(), PopulateRecentChangesSource\doDBUpdates(), AddRFCandPMIDInterwiki\doDBUpdates(), PopulateBacklinkNamespace\doDBUpdates(), FixDefaultJsonContentPages\doDBUpdates(), PopulateFilearchiveSha1\doDBUpdates(), PopulateRevisionSha1\doDBUpdates(), PopulateRevisionLength\doDBUpdates(), PopulateParentId\doDBUpdates(), PopulateExternallinksIndex60\doDBUpdates(), FixExtLinksProtocolRelative\doDBUpdates(), PopulateLogUsertext\doDBUpdates(), RefreshExternallinksIndex\doDBUpdates(), MigrateImageCommentTemp\doDBUpdates(), MigrateActors\doDBUpdates(), PopulateLogSearch\doDBUpdates(), MigrateArchiveText\doDBUpdates(), PopulateArchiveRevId\doDBUpdates(), PopulateIpChanges\doDBUpdates(), PopulateImageSha1\doDBUpdates(), DeleteOldRevisions\doDelete(), PopulateRevisionLength\doLenUpdates(), ReassignEdits\doReassignEdits(), RefreshLinks\doRefreshLinks(), PopulateRevisionSha1\doSha1LegacyUpdates(), PopulateRevisionSha1\doSha1Updates(), UpdateSearchIndex\doUpdateSearchIndex(), RecountCategories\doWork(), RebuildTextIndex\dropMysqlTextIndex(), TidyUpT39714\execute(), RemoveInvalidEmails\execute(), StorageTypeStats\execute(), CompareParserCache\execute(), CheckBadRedirects\execute(), InitUserPreference\execute(), CheckImages\execute(), ClearInterwikiCache\execute(), DeleteSelfExternals\execute(), FixUserRegistration\execute(), PurgeModuleDeps\execute(), MigrateUserGroup\execute(), CleanupAncientTables\execute(), GetReplicaServer\execute(), DeleteArchivedFiles\execute(), RemoveUnusedAccounts\execute(), DeleteDefaultMessages\execute(), NukePage\execute(), BenchmarkDeleteTruncate\execute(), DeleteArchivedRevisions\execute(), UpdateRestrictions\execute(), CheckUsernames\execute(), CleanupBlocks\execute(), RebuildAll\execute(), InitEditCount\execute(), InitSiteStats\execute(), UpdateArticleCount\execute(), RenameDbPrefix\execute(), DeleteOrphanedRevisions\execute(), UpdateSpecialPages\execute(), FixDoubleRedirects\execute(), ConvertUserOptions\execute(), CleanupRemovedModules\execute(), ShowSiteStats\execute(), EraseArchivedFile\execute(), FixTimestamps\execute(), WrapOldPasswords\execute(), CleanupSpam\execute(), PatchSql\execute(), PopulateContentModel\execute(), DumpLinks\execute(), AttachLatest\execute(), ResetPageRandom\execute(), RunBatchedQuery\execute(), RebuildTextIndex\execute(), UpdateDoubleWidthSearch\execute(), PurgeChangedPages\execute(), ResetUserTokens\execute(), RefreshFileHeaders\execute(), NukeNS\execute(), MoveBatch\execute(), RebuildFileCache\execute(), CleanupPreferences\execute(), ConvertLinks\execute(), PopulateCategory\execute(), UpdateCollation\execute(), PurgeChangedFiles\execute(), ImageBuilder\execute(), UpdateMediaWiki\execute(), RefreshImageMetadata\execute(), DeleteEqualMessages\execute(), UppercaseTitlesForUnicodeTransition\execute(), CategoryChangesAsRdf\execute(), DumpCategoriesAsRdf\execute(), LoggedUpdateMaintenance\execute(), DumpUploads\fetchLocal(), DumpUploads\fetchUsed(), TitleCleanup\fileExists(), RefreshLinks\fixRedirect(), BenchmarkParse\getRevIdForTime(), RollbackEdits\getRollbackTitles(), NamespaceDupes\getTargetList(), DeleteLocalPasswords\getUserBatches(), DeleteLocalPasswords\getUserDB(), FixDefaultJsonContentPages\handleRow(), BackupReader\handleUpload(), BackupDumper\initProgress(), PopulateContentTables\initServices(), RemoveUnusedAccounts\isInactiveAccount(), CleanupImages\killRow(), PopulateContentTables\loadContentMap(), NamespaceDupes\mergePage(), MigrateComments\migrate(), MigrateActors\migrate(), MigrateActors\migrateLogSearch(), MigrateComments\migrateToTemp(), MigrateActors\migrateToTemp(), TitleCleanup\moveIllegalPage(), TitleCleanup\moveInconsistentPage(), NamespaceDupes\movePage(), CleanupImages\pokeFile(), RebuildTextIndex\populateSearchIndex(), PurgeChangedFiles\purgeFromLogType(), PurgeList\purgeNamespace(), purgeRedundantText(), RebuildRecentchanges\rebuildRecentChangesTablePass1(), RebuildRecentchanges\rebuildRecentChangesTablePass2(), RebuildRecentchanges\rebuildRecentChangesTablePass3(), RebuildRecentchanges\rebuildRecentChangesTablePass4(), RefreshLinks\refreshCategory(), CleanupWatchlist\removeWatch(), TableCleanup\runTable(), EraseArchivedFile\scrubAllVersions(), MediaWikiShell\setupLegacy(), PopulateRevisionSha1\upgradeLegacyArchiveRow(), PopulateRevisionLength\upgradeRow(), and PopulateRevisionSha1\upgradeRow().

◆ getDbType()

Maintenance::getDbType ( )

Does the script need different DB access? By default, we give Maintenance scripts normal rights to the DB.

Sometimes, a script needs admin rights access for a reason and sometimes they want no access. Subclasses should override and return one of the following values, as needed: Maintenance::DB_NONE - For no DB access at all Maintenance::DB_STD - For normal DB access, default Maintenance::DB_ADMIN - For admin DB access

Returns
int

Reimplemented in MwSql, SearchDump, RunBatchedQuery, CommandLineInstaller, MWDocGen, ConvertLinks, CleanupArchiveUserText, FindHooks, UpdateMediaWiki, PreprocessDump, UpdateSearchIndex, SqliteMaintenance, GenerateNormalizerDataAr, UpdateDoubleWidthSearch, RebuildTextIndex, PatchSql, GenerateNormalizerDataMl, RenameDbPrefix, and RebuildAll.

Definition at line 563 of file Maintenance.php.

References DB_STD.

Referenced by addDefaultParams(), DumpIterator\finalSetup(), and finalSetup().

◆ getDir()

Maintenance::getDir ( )
protected

Get the maintenance directory.

Returns
string

Definition at line 1380 of file Maintenance.php.

◆ getName()

Maintenance::getName ( )

Get the script's name.

Returns
string

Definition at line 416 of file Maintenance.php.

References $mSelf.

◆ getOption()

Maintenance::getOption (   $name,
  $default = null 
)
protected

Get an option, or return the default.

If the option was added to support multiple occurrences, this will return an array.

Parameters
string$nameThe name of the param
mixed | null$defaultAnything you want, default null
Returns
mixed

Definition at line 302 of file Maintenance.php.

References hasOption().

Referenced by activateProfiler(), PopulateChangeTagDef\backpopulateChangeTagPerTag(), Benchmarker\bench(), PreprocessDump\checkOptions(), CompareParsers\checkOptions(), SqliteMaintenance\checkSyntax(), RenameUserCleanup\checkUserExistence(), PopulateChangeTagDef\doDBUpdates(), PopulateBacklinkNamespace\doDBUpdates(), CleanupUsersWithNoId\doDBUpdates(), MigrateActors\doDBUpdates(), PopulateIpChanges\doDBUpdates(), PopulateImageSha1\doDBUpdates(), FileOpPerfTest\doPerfTest(), PurgeList\doPurge(), UpdateSpecialPages\doSpecialPageCacheUpdates(), BenchmarkTidy\execute(), Update\execute(), HHVMMakeRepo\execute(), FindMissingFiles\execute(), FindOrphanedFiles\execute(), Undelete\execute(), GenerateUpperCharTable\execute(), CompareParserCache\execute(), InitUserPreference\execute(), BenchmarkCSSMin\execute(), BenchmarkPurge\execute(), InitImageData\execute(), BenchmarkJavaScriptMinifier\execute(), BenchmarkJSMinPlus\execute(), BenchmarkLruHash\execute(), BenchmarkSanitizer\execute(), ManageJobs\execute(), GetReplicaServer\execute(), AddSite\execute(), MakeTestEdits\execute(), RemoveUnusedAccounts\execute(), FormatInstallDoc\execute(), PruneFileCache\execute(), AddChangeTag\execute(), ImportSiteScripts\execute(), BenchWikimediaBaseConvert\execute(), MigrateFileRepoLayout\execute(), ChangePassword\execute(), Protect\execute(), CheckDependencies\execute(), PurgeList\execute(), RenameDbPrefix\execute(), UpdateSpecialPages\execute(), CopyJobQueue\execute(), FileOpPerfTest\execute(), FixDoubleRedirects\execute(), WrapOldPasswords\execute(), EraseArchivedFile\execute(), RenameUserCleanup\execute(), PopulateContentModel\execute(), InvalidateUserSesssions\execute(), McTest\execute(), ResetPageRandom\execute(), SyncFileBackend\execute(), GenerateUcfirstOverrides\execute(), DumpUploads\execute(), GenerateJsonI18n\execute(), RollbackEdits\execute(), RunBatchedQuery\execute(), DeleteOldFancyCaptchas\execute(), DumpIterator\execute(), EditCLI\execute(), ResetAuthenticationThrottle\execute(), PurgeChangedPages\execute(), UpdateDoubleWidthSearch\execute(), ImportTextFiles\execute(), MysqlMaintenance\execute(), RefreshFileHeaders\execute(), ResetUserTokens\execute(), CreateCommonPasswordCdb\execute(), GenerateNormalizerDataAr\execute(), DeleteBatch\execute(), MinifyScript\execute(), NukeNS\execute(), CleanupCaps\execute(), PurgeParserCache\execute(), MwSql\execute(), ShowJobs\execute(), MergeMessageFileList\execute(), DumpRenderer\execute(), DeleteAutoPatrolLogs\execute(), CopyFileBackend\execute(), RefreshLinks\execute(), CreateAndPromote\execute(), MoveBatch\execute(), SqliteMaintenance\execute(), PopulateImageSha1\execute(), GenerateFancyCaptchas\execute(), PopulateInterwiki\execute(), RunJobs\execute(), RebuildFileCache\execute(), UpdateSearchIndex\execute(), GenerateCollationData\execute(), RebuildLocalisationCache\execute(), BenchmarkParse\execute(), PopulateCategory\execute(), UpdateCollation\execute(), ConvertExtensionToRegistration\execute(), NamespaceDupes\execute(), PurgeChangedFiles\execute(), CleanupInvalidDbKeys\execute(), RecountCategories\execute(), UpdateMediaWiki\execute(), PopulateContentTables\execute(), CompressOld\execute(), RefreshImageMetadata\execute(), DeleteEqualMessages\execute(), UppercaseTitlesForUnicodeTransition\execute(), BackupReader\execute(), CommandLineInstaller\execute(), GetConfiguration\execute(), CategoryChangesAsRdf\execute(), ImportImages\execute(), DumpCategoriesAsRdf\execute(), ReplaceAll\execute(), GetConfiguration\finalSetup(), finalSetup(), RefreshImageMetadata\getConditions(), ReplaceAll\getNamespaces(), ReplaceAll\getReplacements(), DeleteAutoPatrolLogs\getRows(), DeleteAutoPatrolLogs\getRowsOld(), ReplaceAll\getSummary(), PopulateContentTables\getTables(), CLIParser\getTitle(), ReplaceAll\getUser(), BackupReader\importFromHandle(), MWDocGen\init(), DeleteLocalPasswords\initialize(), loadSpecialVars(), ReplaceAll\localSetup(), memoryLimit(), MinifyScript\minify(), CLIParser\parse(), PopulateContentTables\populateTable(), DumpBackup\processOptions(), TextPassDumper\processOptions(), BackupDumper\processOptions(), CompareParsers\processRevision(), SearchDump\processRevision(), DeleteLocalPasswords\processUsers(), UppercaseTitlesForUnicodeTransition\processUsers(), PurgePage\purge(), PurgeChangedFiles\purgeFromLogType(), RebuildRecentchanges\rebuildRecentChangesTablePass1(), PurgeList\sendPurgeRequest(), CommandLineInstaller\setDbPassOption(), CommandLineInstaller\setPassOption(), MediaWikiShell\setupLegacy(), ReplaceAll\shouldContinueByDefault(), SyncFileBackend\syncFileBatch(), UserOptionsMaintenance\updateOptions(), ReplaceAll\useRegex(), and GetConfiguration\validateParamsAndArgs().

◆ getStdin()

Maintenance::getStdin (   $len = null)
protected

Return input from stdin.

Parameters
int | null$lenThe number of bytes to read. If null, just return the handle. Maintenance::STDIN_ALL returns the full length
Returns
mixed

Definition at line 426 of file Maintenance.php.

Referenced by PurgeList\doPurge(), PurgePage\execute(), DumpIterator\execute(), EditCLI\execute(), DeleteBatch\execute(), DumpRenderer\execute(), MoveBatch\execute(), FetchText\execute(), and MinifyScript\readFile().

◆ getTermSize()

static Maintenance::getTermSize ( )
static

Get the terminal size as a two-element array where the first element is the width (number of columns) and the second element is the height (number of rows).

Returns
array

Definition at line 1678 of file Maintenance.php.

References wfIsWindows().

◆ globals()

Maintenance::globals ( )

Potentially debug globals.

Originally a feature only for refreshLinks

Definition at line 1261 of file Maintenance.php.

References $GLOBALS, and hasOption().

◆ hasArg()

Maintenance::hasArg (   $argId = 0)
protected

Does a given argument exist?

Parameters
int$argIdThe integer value (from zero) for the arg
Returns
bool

Definition at line 357 of file Maintenance.php.

References wfDeprecated().

Referenced by JSParseHelper\execute(), FormatInstallDoc\execute(), ReassignEdits\execute(), McTest\execute(), DeleteBatch\execute(), UserOptionsMaintenance\execute(), MwSql\execute(), MoveBatch\execute(), BackupReader\execute(), and validateParamsAndArgs().

◆ hasOption()

Maintenance::hasOption (   $name)
protected

Checks to see if a particular option exists.

Parameters
string$nameThe name of the option
Returns
bool

Definition at line 288 of file Maintenance.php.

Referenced by PopulateChangeTagDef\backpopulateChangeTagPerTag(), Benchmarker\bench(), PreprocessDump\checkOptions(), CompareParsers\checkOptions(), CleanupSpam\cleanupArticle(), CleanupInvalidDbKeys\cleanupTable(), CopyFileBackend\copyFileBatch(), ConvertLinks\createTempTable(), CleanupPreferences\deleteByWhere(), PopulateChangeTagDef\doDBUpdates(), MigrateArchiveText\doDBUpdates(), PopulateImageSha1\doDBUpdates(), FileOpPerfTest\doPerfTest(), UpdateSpecialPages\doSpecialPageCacheUpdates(), BenchmarkTidy\execute(), Cleanup\execute(), RemoveInvalidEmails\execute(), FindOrphanedFiles\execute(), BenchmarkPurge\execute(), BenchmarkCSSMin\execute(), InitImageData\execute(), PurgeOldText\execute(), DatabaseLag\execute(), ListVariants\execute(), DeleteOldRevisions\execute(), GetLagTimes\execute(), GetReplicaServer\execute(), CleanupAncientTables\execute(), DeleteArchivedFiles\execute(), DeleteDefaultMessages\execute(), NukePage\execute(), FormatInstallDoc\execute(), RemoveUnusedAccounts\execute(), InitEditCount\execute(), InitSiteStats\execute(), DeleteArchivedRevisions\execute(), UpdateArticleCount\execute(), ChangePassword\execute(), Protect\execute(), PurgeList\execute(), CheckDependencies\execute(), GetTextMaint\execute(), ResetUserEmail\execute(), UpdateSpecialPages\execute(), DeleteOrphanedRevisions\execute(), FixDoubleRedirects\execute(), WrapOldPasswords\execute(), EraseArchivedFile\execute(), ReassignEdits\execute(), CleanupSpam\execute(), AttachLatest\execute(), SyncFileBackend\execute(), DumpUploads\execute(), GenerateJsonI18n\execute(), RollbackEdits\execute(), DumpIterator\execute(), TableCleanup\execute(), EditCLI\execute(), MysqlMaintenance\execute(), PurgeChangedPages\execute(), ImportTextFiles\execute(), UserOptionsMaintenance\execute(), GenerateNormalizerDataAr\execute(), RefreshFileHeaders\execute(), NukeNS\execute(), Orphans\execute(), CleanupCaps\execute(), MergeMessageFileList\execute(), ShowJobs\execute(), MwSql\execute(), CleanupWatchlist\execute(), DumpRenderer\execute(), DeleteAutoPatrolLogs\execute(), CopyFileBackend\execute(), CreateAndPromote\execute(), RefreshLinks\execute(), MoveBatch\execute(), PopulateImageSha1\execute(), SqliteMaintenance\execute(), MediaWikiShell\execute(), PopulateInterwiki\execute(), GenerateFancyCaptchas\execute(), RunJobs\execute(), CleanupPreferences\execute(), RebuildFileCache\execute(), RebuildRecentchanges\execute(), UpdateSearchIndex\execute(), RebuildLocalisationCache\execute(), BenchmarkParse\execute(), ConvertLinks\execute(), PopulateCategory\execute(), ConvertExtensionToRegistration\execute(), UpdateCollation\execute(), NamespaceDupes\execute(), DumpBackup\execute(), PurgeChangedFiles\execute(), CleanupInvalidDbKeys\execute(), ImageBuilder\execute(), UpdateMediaWiki\execute(), RefreshImageMetadata\execute(), DeleteEqualMessages\execute(), BackupReader\execute(), CommandLineInstaller\execute(), ImportImages\execute(), LoggedUpdateMaintenance\execute(), CopyFileBackend\filesAreSame(), GetConfiguration\finalSetup(), finalSetup(), UpdateCollation\getBatchCondition(), CommandLineInstaller\getDbType(), FindHooks\getHooksFromDoc(), getOption(), ReplaceAll\getRename(), globals(), ConvertExtensionToRegistration\handleResourceModules(), BackupReader\importFromHandle(), MWDocGen\init(), DeleteLocalPasswords\initialize(), loadSpecialVars(), maybeHelp(), RunJobs\memoryLimit(), PopulateContentTables\populateTable(), DumpBackup\processOptions(), TextPassDumper\processOptions(), BackupDumper\processOptions(), PurgeChangedFiles\purgeFromLogType(), RebuildRecentchanges\rebuildRecentChangesTablePass1(), CleanupWatchlist\removeWatch(), EraseArchivedFile\scrubVersion(), PurgeList\sendPurgeRequest(), PopulateChangeTagDef\setUserDefinedTags(), MwSql\sqlPrintResult(), PopulateChangeTagDef\updateCountTag(), PopulateChangeTagDef\updateCountTagId(), UserOptionsMaintenance\updateOptions(), CommandLineInstaller\validateParamsAndArgs(), validateParamsAndArgs(), PurgeChangedFiles\verbose(), and UserOptionsMaintenance\warn().

◆ isQuiet()

Maintenance::isQuiet ( )
Returns
bool

Definition at line 443 of file Maintenance.php.

References $mQuiet.

Referenced by countDown(), and SyncFileBackend\execute().

◆ loadParamsAndArgs()

Maintenance::loadParamsAndArgs (   $self = null,
  $opts = null,
  $args = null 
)

Process command line arguments $mOptions becomes an array with keys set to the option names $mArgs becomes a zero-based array containing the non-option arguments.

Parameters
string | null$selfThe name of the script, if any
array | null$optsAn array of options, in form of key=>value
array | null$argsAn array of command line arguments

Definition at line 979 of file Maintenance.php.

References $args, $self, loadSpecialVars(), and loadWithArgv().

Referenced by setup().

◆ loadSettings()

Maintenance::loadSettings ( )

Generic setup for most installs.

Returns the location of LocalSettings

Returns
string

Definition at line 1271 of file Maintenance.php.

References $IP, $wgCommandLineMode, and fatalError().

◆ loadSpecialVars()

Maintenance::loadSpecialVars ( )
protected

Handle the special variables that are global to all scripts.

Definition at line 1043 of file Maintenance.php.

References getOption(), and hasOption().

Referenced by loadParamsAndArgs(), and loadWithArgv().

◆ loadWithArgv()

Maintenance::loadWithArgv (   $argv)

Load params and arguments from a given array of command-line arguments.

Since
1.27
Parameters
array$argv

Definition at line 873 of file Maintenance.php.

References $args, error(), loadSpecialVars(), maybeHelp(), and setParam().

Referenced by DumpBackup\__construct(), TextPassDumper\__construct(), BackupDumper\__construct(), and loadParamsAndArgs().

◆ lockSearchindex()

Maintenance::lockSearchindex (   $db)
private

Lock the search index.

Parameters
IMaintainableDatabase&$db

Definition at line 1469 of file Maintenance.php.

Referenced by relockSearchindex(), and updateSearchIndex().

◆ maybeHelp()

Maintenance::maybeHelp (   $force = false)
protected

◆ memoryLimit()

Maintenance::memoryLimit ( )

Normally we disable the memory_limit when running admin scripts.

Some scripts may wish to actually set a limit, however, to avoid blowing up unexpectedly. We also support a –memory-limit option, to allow sysadmins to explicitly set one if they'd prefer to override defaults (or for people using Suhosin which yells at you for trying to disable the limits)

Returns
string

Reimplemented in RunJobs.

Definition at line 810 of file Maintenance.php.

References getOption().

Referenced by adjustMemoryLimit().

◆ output()

Maintenance::output (   $out,
  $channel = null 
)
protected

Throw some output to the user.

Scripts can call this with no fears, as we handle all –quiet stuff here

Parameters
string$outThe text to show to the user
mixed | null$channelUnique identifier for the channel. See function outputChanneled.

Definition at line 453 of file Maintenance.php.

References cleanupChanneled(), MediaWiki\emitBufferedStatsdData(), getConfig(), and outputChanneled().

Referenced by DumpBackup\__construct(), TextPassDumper\__construct(), ImageBuilder\addMissingImage(), Benchmarker\addResult(), PopulateChangeTagDef\backpopulateChangeTagPerTag(), SqliteMaintenance\backup(), McTest\benchmarkMultiKeyOpsDeferredBlocking(), McTest\benchmarkMultiKeyOpsImmediateBlocking(), McTest\benchmarkSingleKeyOps(), ImageBuilder\buildTable(), NamespaceDupes\checkAll(), FindOrphanedFiles\checkFiles(), NamespaceDupes\checkLinkTable(), NamespaceDupes\checkNamespace(), Orphans\checkOrphans(), NamespaceDupes\checkPrefix(), RenameUserCleanup\checkRenameLog(), Orphans\checkSeparation(), SqliteMaintenance\checkSyntax(), RenameUserCleanup\checkUserExistence(), CleanupUsersWithNoId\cleanup(), Cleanup\cleanupArticle(), CleanupSpam\cleanupArticle(), ResetAuthenticationThrottle\clearLoginThrottle(), RebuildTextIndex\clearSearchIndex(), ResetAuthenticationThrottle\clearSignupThrottle(), CompressOld\compressOldPages(), CompressOld\compressWithConcat(), CompareParsers\conclusions(), CopyFileBackend\copyFileBatch(), countDown(), RebuildTextIndex\createMysqlTextIndex(), ConvertLinks\createTempTable(), RunJobs\debugInternal(), ManageJobs\delete(), CleanupPreferences\deleteByWhere(), RefreshLinks\deleteLinksFromNonexistent(), CopyFileBackend\delFileBatch(), RefreshLinks\dfnCheckInterval(), CleanupRevActorPage\doDBUpdates(), DeduplicateArchiveRevId\doDBUpdates(), PopulatePPSortKey\doDBUpdates(), PopulateRecentChangesSource\doDBUpdates(), PopulateBacklinkNamespace\doDBUpdates(), PopulateFilearchiveSha1\doDBUpdates(), FixDefaultJsonContentPages\doDBUpdates(), PopulateRevisionSha1\doDBUpdates(), PopulateRevisionLength\doDBUpdates(), PopulateParentId\doDBUpdates(), PopulateExternallinksIndex60\doDBUpdates(), FixExtLinksProtocolRelative\doDBUpdates(), PopulateLogUsertext\doDBUpdates(), RefreshExternallinksIndex\doDBUpdates(), MigrateImageCommentTemp\doDBUpdates(), MigrateActors\doDBUpdates(), PopulateLogSearch\doDBUpdates(), MigrateArchiveText\doDBUpdates(), PopulateArchiveRevId\doDBUpdates(), PopulateIpChanges\doDBUpdates(), PopulateImageSha1\doDBUpdates(), DeleteOldRevisions\doDelete(), PopulateRevisionLength\doLenUpdates(), UppercaseTitlesForUnicodeTransition\doMove(), FileOpPerfTest\doPerfTest(), PopulateInterwiki\doPopulate(), PurgeList\doPurge(), ReassignEdits\doReassignEdits(), RebuildLocalisationCache\doRebuild(), RefreshLinks\doRefreshLinks(), PopulateRevisionSha1\doSha1LegacyUpdates(), PopulateRevisionSha1\doSha1Updates(), UpdateSpecialPages\doSpecialPageCacheUpdates(), UppercaseTitlesForUnicodeTransition\doUpdate(), UpdateSearchIndex\doUpdateSearchIndex(), RecountCategories\doWork(), RebuildTextIndex\dropMysqlTextIndex(), TidyUpT39714\execute(), UpdateExtensionJsonSchema\execute(), ValidateRegistrationFile\execute(), CheckComposerLockUpToDate\execute(), Cleanup\execute(), DisableOATHAuthForUser\execute(), CleanupArchiveUserText\execute(), Update\execute(), RemoveInvalidEmails\execute(), ExportSites\execute(), ImportSites\execute(), PageExists\execute(), FindOrphanedFiles\execute(), FindMissingFiles\execute(), Undelete\execute(), EmptyUserGroup\execute(), InitUserPreference\execute(), PurgeExpiredUserrights\execute(), BenchmarkPurge\execute(), RebuildMessages\execute(), CompareParserCache\execute(), CheckBadRedirects\execute(), CheckImages\execute(), AllTrans\execute(), InitImageData\execute(), ClearInterwikiCache\execute(), DumpMessages\execute(), DeleteSelfExternals\execute(), FixUserRegistration\execute(), PurgeModuleDeps\execute(), CleanupAncientTables\execute(), DatabaseLag\execute(), JSParseHelper\execute(), DateFormats\execute(), MakeTestEdits\execute(), ViewCLI\execute(), MigrateUserGroup\execute(), UpdateCSS\execute(), DeleteOldRevisions\execute(), UpdateLexerList\execute(), GetLagTimes\execute(), GetReplicaServer\execute(), RemoveUnusedAccounts\execute(), DumpRev\execute(), LangMemUsage\execute(), DeleteArchivedFiles\execute(), DeleteDefaultMessages\execute(), NukePage\execute(), InitEditCount\execute(), InitSiteStats\execute(), CheckUsernames\execute(), CleanupBlocks\execute(), UpdateRestrictions\execute(), GeneratePhpCharToUpperMappings\execute(), DeleteArchivedRevisions\execute(), PruneFileCache\execute(), RebuildAll\execute(), CheckDependencies\execute(), ResetUserEmail\execute(), UpdateArticleCount\execute(), MigrateFileRepoLayout\execute(), CountFancyCaptchas\execute(), AddChangeTag\execute(), Protect\execute(), PurgeList\execute(), ChangePassword\execute(), GetTextMaint\execute(), ImportSiteScripts\execute(), RenameDbPrefix\execute(), UpdateScratchTokenFormat\execute(), UpdateSpecialPages\execute(), ConvertUserOptions\execute(), DeleteOrphanedRevisions\execute(), UpdateTOTPToMultipleKeys\execute(), CopyJobQueue\execute(), FixDoubleRedirects\execute(), CleanupUploadStash\execute(), ShowSiteStats\execute(), WrapOldPasswords\execute(), CleanupRemovedModules\execute(), EraseArchivedFile\execute(), ReassignEdits\execute(), FixTimestamps\execute(), RenameUserCleanup\execute(), PatchSql\execute(), DumpLinks\execute(), AttachLatest\execute(), CleanupSpam\execute(), InvalidateUserSesssions\execute(), UpdateDatabaseValueFormat\execute(), McTest\execute(), Digit2Html\execute(), ResetPageRandom\execute(), SyncFileBackend\execute(), OrphanStats\execute(), GenerateJsonI18n\execute(), DeleteOldFancyCaptchas\execute(), RollbackEdits\execute(), RunBatchedQuery\execute(), RebuildTextIndex\execute(), EditCLI\execute(), TableCleanup\execute(), UpdateDoubleWidthSearch\execute(), PurgeChangedPages\execute(), ImportTextFiles\execute(), ResetUserTokens\execute(), DeleteBatch\execute(), RefreshFileHeaders\execute(), CreateCommonPasswordCdb\execute(), CleanupCaps\execute(), MinifyScript\execute(), NukeNS\execute(), PurgeParserCache\execute(), ShowJobs\execute(), CleanupWatchlist\execute(), DeleteAutoPatrolLogs\execute(), CopyFileBackend\execute(), CreateAndPromote\execute(), MoveBatch\execute(), GenerateFancyCaptchas\execute(), RebuildRecentchanges\execute(), ManageForeignResources\execute(), CleanupPreferences\execute(), RunJobs\execute(), RebuildFileCache\execute(), RebuildLocalisationCache\execute(), FetchText\execute(), FindHooks\execute(), ConvertLinks\execute(), PopulateCategory\execute(), ConvertExtensionToRegistration\execute(), UpdateCollation\execute(), NamespaceDupes\execute(), RecountCategories\execute(), UpdateMediaWiki\execute(), CompressOld\execute(), DeleteLocalPasswords\execute(), RefreshImageMetadata\execute(), DeleteEqualMessages\execute(), BackupReader\execute(), CommandLineInstaller\execute(), GetConfiguration\execute(), ImportImages\execute(), MWDocGen\execute(), LoggedUpdateMaintenance\execute(), DeleteEqualMessages\fetchMessageInfo(), ImportSiteScripts\fetchScriptList(), GetConfiguration\formatVarDump(), DeleteLocalPasswords\getUserBatches(), ConvertExtensionToRegistration\handleExtensionMessagesFiles(), ConvertExtensionToRegistration\handleHooks(), DumpRenderer\handleRevision(), DumpIterator\handleRevision(), FixDefaultJsonContentPages\handleRow(), MWDocGen\init(), SqliteMaintenance\integrityCheck(), CleanupImages\killRow(), UserOptionsMaintenance\listAvailableOptions(), ReplaceAll\listTitles(), Update\logInfo(), maybeHelp(), MigrateComments\migrate(), MigrateActors\migrate(), MigrateActors\migrateLogSearch(), MigrateComments\migrateToTemp(), MigrateActors\migrateToTemp(), TitleCleanup\moveIllegalPage(), TitleCleanup\moveInconsistentPage(), CleanupCaps\movePage(), ImageBuilder\oldimageCallback(), DumpUploads\outputItem(), CleanupImages\pokeFile(), PopulateContentModel\populatePage(), PopulateContentModel\populateRevisionOrArchive(), RebuildTextIndex\populateSearchIndex(), FindHooks\printArray(), DeduplicateArchiveRevId\processArRevIds(), CompareParsers\processRevision(), SearchDump\processRevision(), TitleCleanup\processRow(), CleanupImages\processRow(), CleanupWatchlist\processRow(), CleanupCaps\processRowToLowercase(), CleanupCaps\processRowToUppercase(), UppercaseTitlesForUnicodeTransition\processTable(), UppercaseTitlesForUnicodeTransition\processUsers(), TableCleanup\progress(), ImageBuilder\progress(), PruneFileCache\prune_directory(), PurgePage\purge(), RebuildRecentchanges\purgeFeeds(), PurgeChangedFiles\purgeFromArchiveTable(), purgeRedundantText(), FixDoubleRedirects\queueJobs(), RebuildRecentchanges\rebuildRecentChangesTablePass1(), RebuildRecentchanges\rebuildRecentChangesTablePass2(), RebuildRecentchanges\rebuildRecentChangesTablePass3(), RebuildRecentchanges\rebuildRecentChangesTablePass4(), RebuildRecentchanges\rebuildRecentChangesTablePass5(), RefreshLinks\refreshCategory(), CleanupWatchlist\removeWatch(), UpdateSpecialPages\reopenAndWaitForReplicas(), ImportSites\reportException(), ManageJobs\repushAbandoned(), MigrateFileRepoLayout\runBatch(), TableCleanup\runTable(), EraseArchivedFile\scrubVersion(), PurgeList\sendPurgeRequest(), PopulateChangeTagDef\setUserDefinedTags(), PurgeParserCache\showProgressAndWait(), UpdateCollation\showSortKeySizeHistogram(), UserOptionsMaintenance\showUsageStats(), MwSql\sqlPrintResult(), Benchmarker\startBench(), SyncFileBackend\syncBackends(), SyncFileBackend\syncFileBatch(), GenerateJsonI18n\transformI18nFile(), PopulateChangeTagDef\updateCountTag(), PopulateChangeTagDef\updateCountTagId(), UserOptionsMaintenance\updateOptions(), PopulateContentModel\updatePageRows(), PopulateContentModel\updateRevisionOrArchiveRows(), updateSearchIndex(), updateSearchIndexForPage(), RenameUserCleanup\updateTable(), ResetUserTokens\updateUser(), PopulateRevisionSha1\upgradeLegacyArchiveRow(), PopulateRevisionLength\upgradeRow(), PopulateRevisionSha1\upgradeRow(), SqliteMaintenance\vacuum(), PurgeChangedFiles\verbose(), Benchmarker\verboseRun(), InitImageData\waitForMaxPressure(), UserOptionsMaintenance\warn(), and PopulateContentTables\writeln().

◆ outputChanneled()

Maintenance::outputChanneled (   $msg,
  $channel = null 
)

Message outputter with channeled message support.

Messages on the same channel are concatenated, but any intervening messages in another channel start a new line.

Parameters
string$msgThe message without trailing newline
string | null$channelChannel identifier or null for no channel. Channel comparison uses ===.

Definition at line 530 of file Maintenance.php.

References cleanupChanneled().

Referenced by error(), and output().

◆ posix_isatty()

static Maintenance::posix_isatty (   $fd)
static

Wrapper for posix_isatty() We default as considering stdin a tty (for nice readline methods) but treating stout as not a tty to avoid color codes.

Parameters
mixed$fdFile descriptor
Returns
bool

Definition at line 1596 of file Maintenance.php.

Referenced by MwSql\execute(), FindDeprecated\execute(), and readconsole().

◆ purgeRedundantText()

Maintenance::purgeRedundantText (   $delete = true)

Support function for cleaning up redundant text records.

Parameters
bool$deleteWhether or not to actually delete the records
Author
Rob Church robch.nosp@m.ur@g.nosp@m.mail..nosp@m.com

Definition at line 1308 of file Maintenance.php.

References $res, $wgMultiContentRevisionSchemaMigrationStage, beginTransaction(), commitTransaction(), DB_MASTER, getDB(), output(), and SCHEMA_COMPAT_READ_OLD.

Referenced by DeleteOldRevisions\doDelete(), PurgeOldText\execute(), NukePage\execute(), DeleteArchivedRevisions\execute(), DeleteOrphanedRevisions\execute(), and NukeNS\execute().

◆ readconsole()

static Maintenance::readconsole (   $prompt = ',
 
)
static

Prompt the console for input.

Parameters
string$promptWhat to begin the line with, like '> '
Returns
string Response

Definition at line 1609 of file Maintenance.php.

References posix_isatty(), and readlineEmulation().

Referenced by MwSql\execute(), and ReplaceAll\getReply().

◆ readlineEmulation()

static Maintenance::readlineEmulation (   $prompt)
staticprivate

Emulate readline()

Parameters
string$promptWhat to begin the line with, like '> '
Returns
string

Definition at line 1641 of file Maintenance.php.

References $command, $line, ExecutableFinder\findInDefaultPaths(), and wfIsWindows().

Referenced by readconsole().

◆ relockSearchindex()

Maintenance::relockSearchindex (   $db)
private

Unlock and lock again Since the lock is low-priority, queued reads will be able to complete.

Parameters
IMaintainableDatabase&$db

Definition at line 1496 of file Maintenance.php.

References lockSearchindex(), and unlockSearchindex().

Referenced by updateSearchIndex().

◆ requireExtension()

◆ requireTestsAutoloader()

static Maintenance::requireTestsAutoloader ( )
static

Call this to set up the autoloader to allow classes to be used from the tests directory.

Definition at line 1708 of file Maintenance.php.

Referenced by CheckLess\execute().

◆ rollbackTransaction()

Maintenance::rollbackTransaction ( IDatabase  $dbw,
  $fname 
)
protected

Rollback the transcation on a DB handle.

This method makes it clear that rollback() is called from a maintenance script, which has outermost scope. This is safe, unlike $dbw->rollback() called in other places.

Parameters
IDatabase$dbw
string$fnameCaller name
Since
1.27

Definition at line 1461 of file Maintenance.php.

References Wikimedia\Rdbms\IDatabase\rollback().

Referenced by CleanupImages\pokeFile(), PopulateContentTables\populateContentTablesForRowBatch(), and RenameUserCleanup\updateTable().

◆ runChild()

Maintenance::runChild (   $maintClass,
  $classFile = null 
)

Run a child maintenance script.

Pass all of the current arguments to it.

Parameters
string$maintClassA name of a child maintenance class
string | null$classFileFull path of where the child is
Returns
Maintenance

Definition at line 727 of file Maintenance.php.

References $maintClass, and error().

Referenced by RebuildAll\execute(), NukeNS\execute(), and UpdateMediaWiki\execute().

◆ setAgentAndTriggers()

Maintenance::setAgentAndTriggers ( )

Set triggers like when to try to run deferred updates.

Since
1.28

Definition at line 668 of file Maintenance.php.

References getConfig(), setLBFactoryTriggers(), and wfHostname().

◆ setAllowUnregisteredOptions()

Maintenance::setAllowUnregisteredOptions (   $allow)
protected

Sets whether to allow unregistered options, which are options passed to a script that do not match an expected parameter.

Parameters
bool$allowShould we allow?

Definition at line 340 of file Maintenance.php.

Referenced by CommandLineInc\__construct().

◆ setBatchSize()

Maintenance::setBatchSize (   $s = 0)
protected

Set the batch size.

Parameters
int$sThe number of operations to do in a batch

Definition at line 394 of file Maintenance.php.

References $s, and addOption().

Referenced by CleanupRevActorPage\__construct(), InitImageData\__construct(), InitUserPreference\__construct(), RemoveInvalidEmails\__construct(), DeduplicateArchiveRevId\__construct(), FindMissingFiles\__construct(), FindOrphanedFiles\__construct(), DeleteAutoPatrolLogs\__construct(), PopulateChangeTagDef\__construct(), PopulatePPSortKey\__construct(), MakeTestEdits\__construct(), MigrateUserGroup\__construct(), CheckImages\__construct(), PurgeList\__construct(), PurgeModuleDeps\__construct(), ResetPageRandom\__construct(), RenameUserCleanup\__construct(), DeleteSelfExternals\__construct(), FixUserRegistration\__construct(), SyncFileBackend\__construct(), MigrateFileRepoLayout\__construct(), PopulateExternallinksIndex60\__construct(), RefreshExternallinksIndex\__construct(), RefreshFileHeaders\__construct(), MigrateComments\__construct(), CopyJobQueue\__construct(), CleanupPreferences\__construct(), PopulateRecentChangesSource\__construct(), FixDefaultJsonContentPages\__construct(), WrapOldPasswords\__construct(), CheckUsernames\__construct(), PopulateLogUsertext\__construct(), ResetUserTokens\__construct(), CleanupBlocks\__construct(), RebuildFileCache\__construct(), PopulateRevisionSha1\__construct(), UpdateRestrictions\__construct(), PopulateRevisionLength\__construct(), InvalidateUserSesssions\__construct(), CleanupUploadStash\__construct(), CleanupRemovedModules\__construct(), PopulateContentModel\__construct(), ConvertUserOptions\__construct(), MigrateActors\__construct(), CleanupUsersWithNoId\__construct(), PurgeChangedPages\__construct(), PopulateArchiveRevId\__construct(), PopulateLogSearch\__construct(), RefreshLinks\__construct(), CopyFileBackend\__construct(), DumpCategoriesAsRdf\__construct(), RebuildRecentchanges\__construct(), RecountCategories\__construct(), RefreshImageMetadata\__construct(), DeleteLocalPasswords\__construct(), CleanupInvalidDbKeys\__construct(), PopulateContentTables\__construct(), PurgeChangedFiles\__construct(), UppercaseTitlesForUnicodeTransition\__construct(), CategoryChangesAsRdf\__construct(), LoggedUpdateMaintenance\__construct(), PopulateChangeTagDef\doDBUpdates(), CopyFileBackend\execute(), and DeleteAutoPatrolLogs\execute().

◆ setConfig()

Maintenance::setConfig ( Config  $config)
Since
1.24
Parameters
Config$config

Definition at line 625 of file Maintenance.php.

References $config.

◆ setDB()

Maintenance::setDB ( IMaintainableDatabase  $db)

Sets database object to be returned by getDB().

Parameters
IMaintainableDatabase$db

Reimplemented in BackupDumper.

Definition at line 1412 of file Maintenance.php.

Referenced by DatabaseUpdater\__construct().

◆ setLBFactoryTriggers()

static Maintenance::setLBFactoryTriggers ( LBFactory  $LBFactory,
Config  $config 
)
static
Parameters
LBFactory$LBFactory
Config$config
Since
1.28

Definition at line 689 of file Maintenance.php.

References $config, MediaWiki\emitBufferedStatsdData(), Config\get(), and DeferredUpdates\tryOpportunisticExecute().

Referenced by setAgentAndTriggers().

◆ setParam()

Maintenance::setParam ( $options,
  $option,
  $value 
)
private

Helper function used solely by loadParamsAndArgs to prevent code duplication.

This sets the param in the options array based on whether or not it can be specified multiple times.

Since
1.27
Parameters
array$options
string$option
mixed$value

Definition at line 949 of file Maintenance.php.

References error(), and maybeHelp().

Referenced by loadWithArgv().

◆ setup()

Maintenance::setup ( )

Do some sanity checking and basic setup.

Definition at line 753 of file Maintenance.php.

References $IP, $wgCommandLineMode, adjustMemoryLimit(), fatalError(), and loadParamsAndArgs().

◆ shouldExecute()

static Maintenance::shouldExecute ( )
static

Should we execute the maintenance script, or just allow it to be included as a standalone class? It checks that the call stack only includes this function and "requires" (meaning was called from the file scope)

Returns
bool

Definition at line 210 of file Maintenance.php.

References $wgCommandLineMode.

◆ supportsOption()

Maintenance::supportsOption (   $name)
protected

Checks to see if a particular option in supported.

Normally this means it has been registered by the script via addOption.

Parameters
string$nameThe name of the option
Returns
bool true if the option exists, false otherwise

Definition at line 252 of file Maintenance.php.

Referenced by validateParamsAndArgs().

◆ unlockSearchindex()

Maintenance::unlockSearchindex (   $db)
private

Unlock the tables.

Parameters
IMaintainableDatabase&$db

Definition at line 1487 of file Maintenance.php.

Referenced by relockSearchindex(), and updateSearchIndex().

◆ updateSearchIndex()

Maintenance::updateSearchIndex (   $maxLockTime,
  $callback,
  $dbw,
  $results 
)

Perform a search index update with locking.

Parameters
int$maxLockTimeThe maximum time to keep the search index locked.
callable$callbackThe function that will update the function.
IMaintainableDatabase$dbw
array | IResultWrapper$results

Definition at line 1508 of file Maintenance.php.

References lockSearchindex(), output(), relockSearchindex(), and unlockSearchindex().

Referenced by UpdateSearchIndex\doUpdateSearchIndex(), and UpdateDoubleWidthSearch\execute().

◆ updateSearchIndexForPage()

Maintenance::updateSearchIndexForPage (   $dbw,
  $pageId 
)

Update the searchindex table for a given pageid.

Parameters
IDatabase$dbwA database write handle
int$pageIdThe page ID to update.
Returns
null|string

Definition at line 1545 of file Maintenance.php.

References $title, Revision\loadFromPageId(), and output().

Referenced by UpdateDoubleWidthSearch\searchIndexUpdateCallback(), and UpdateSearchIndex\searchIndexUpdateCallback().

◆ validateParamsAndArgs()

Maintenance::validateParamsAndArgs ( )

Run some validation checks on the params, etc.

Reimplemented in UpdateMediaWiki, CommandLineInstaller, and GetConfiguration.

Definition at line 1011 of file Maintenance.php.

References error(), hasArg(), hasOption(), maybeHelp(), and supportsOption().

Member Data Documentation

◆ $atLineStart

Maintenance::$atLineStart = true
private

Definition at line 509 of file Maintenance.php.

◆ $config

◆ $fileHandle

resource Maintenance::$fileHandle

Used when creating separate schema files.

Definition at line 163 of file Maintenance.php.

◆ $lastChannel

Maintenance::$lastChannel = null
private

Definition at line 510 of file Maintenance.php.

◆ $lastReplicationWait

float Maintenance::$lastReplicationWait = 0.0
private

UNIX timestamp.

Definition at line 157 of file Maintenance.php.

Referenced by UppercaseTitlesForUnicodeTransition\processTable().

◆ $mAllowUnregisteredOptions

Maintenance::$mAllowUnregisteredOptions = false
protected

Definition at line 114 of file Maintenance.php.

◆ $mArgList

Maintenance::$mArgList = []
protected

Definition at line 105 of file Maintenance.php.

◆ $mArgs

Maintenance::$mArgs = []
protected

Definition at line 111 of file Maintenance.php.

Referenced by JSParseHelper\execute(), and CommandLineInc\execute().

◆ $mBatchSize

int Maintenance::$mBatchSize = null
protected

Batch size.

If a script supports this, they should set a default with setBatchSize()

Definition at line 135 of file Maintenance.php.

Referenced by CleanupRevActorPage\doDBUpdates(), PopulateExternallinksIndex60\doDBUpdates(), and getBatchSize().

◆ $mDb

IMaintainableDatabase Maintenance::$mDb = null
private

Used by getDB() / setDB()

Definition at line 154 of file Maintenance.php.

Referenced by getDB().

◆ $mDbPass

Maintenance::$mDbPass

Definition at line 121 of file Maintenance.php.

Referenced by finalSetup().

◆ $mDbUser

Maintenance::$mDbUser
protected

Definition at line 121 of file Maintenance.php.

Referenced by finalSetup().

◆ $mDependantParameters

array [] Maintenance::$mDependantParameters = []
private

Generic options which might or not be supported by the script.

-var array<string,array{desc:string,require:bool,withArg:string,shortName:string,multiOccurrence:bool}>

Definition at line 148 of file Maintenance.php.

Referenced by maybeHelp().

◆ $mDescription

Maintenance::$mDescription = ''
protected

Definition at line 124 of file Maintenance.php.

◆ $mGenericParameters

array [] Maintenance::$mGenericParameters = []
private

Generic options added by addDefaultParams()

-var array<string,array{desc:string,require:bool,withArg:string,shortName:string,multiOccurrence:bool}>

Definition at line 142 of file Maintenance.php.

◆ $mInputLoaded

Maintenance::$mInputLoaded = false
protected

Definition at line 127 of file Maintenance.php.

◆ $mOptions

Maintenance::$mOptions = []
protected

Definition at line 108 of file Maintenance.php.

Referenced by CommandLineInc\execute().

◆ $mParams

array [] Maintenance::$mParams = []
protected

Array of desired/allowed params.

-var array<string,array{desc:string,require:bool,withArg:string,shortName:string,multiOccurrence:bool}>

Definition at line 99 of file Maintenance.php.

Referenced by addDefaultParams().

◆ $mQuiet

Maintenance::$mQuiet = false
protected

Definition at line 120 of file Maintenance.php.

Referenced by isQuiet().

◆ $mSelf

Maintenance::$mSelf
protected

Definition at line 117 of file Maintenance.php.

Referenced by getName().

◆ $mShortParamsMap

Maintenance::$mShortParamsMap = []
protected

Definition at line 102 of file Maintenance.php.

◆ $orderedOptions

array Maintenance::$orderedOptions = []

Used to read the options in the order they were passed.

Useful for option chaining (Ex. dumpBackup.php). It will be an empty array if the options are passed in through loadParamsAndArgs( $self, $opts, $args ).

This is an array of arrays where 0 => the option and 1 => parameter value.

Definition at line 189 of file Maintenance.php.

Referenced by BackupDumper\processOptions().

◆ $requiredExtensions

array Maintenance::$requiredExtensions = []
private
See also
Maintenance::requireExtension

Definition at line 176 of file Maintenance.php.

◆ DB_ADMIN

◆ DB_NONE

◆ DB_STD

const Maintenance::DB_STD = 1

Definition at line 88 of file Maintenance.php.

Referenced by getDbType().

◆ STDIN_ALL

const Maintenance::STDIN_ALL = 'all'

Definition at line 92 of file Maintenance.php.

Referenced by EditCLI\execute().


The documentation for this class was generated from the following file: