MediaWiki
master
|
Abstract maintenance class for quickly writing and churning out maintenance scripts with minimal effort. More...
Public Member Functions | |
__construct () | |
Default constructor. More... | |
canExecuteWithoutLocalSettings () | |
Whether this script can run without LocalSettings.php. 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 (SettingsBuilder $settingsBuilder=null) | |
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... | |
getParameters () | |
getServiceContainer () | |
Returns the main service container. More... | |
globals () | |
Potentially debug globals. More... | |
isQuiet () | |
loadParamsAndArgs ( $self=null, $opts=null, $args=null) | |
Process command line arguments when running as a child script. More... | |
loadSettings () | |
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 () | |
This method used to be for internal use by doMaintenance.php to apply some optional global state to LBFactory for debugging purposes. More... | |
setArg ( $argId, $value) | |
Programmatically set the value of the given argument. More... | |
setConfig (Config $config) | |
setDB (IMaintainableDatabase $db) | |
Sets database object to be returned by getDB(). More... | |
setName (string $name) | |
setOption (string $name, $value) | |
Programmatically set the value of the given option. More... | |
setup () | |
Provides subclasses with an opportunity to perform initial checks. More... | |
shutdown () | |
Call before exiting CLI process for the last DB commit, and flush any remaining buffers and other deferred work. More... | |
validateParamsAndArgs () | |
Run some validation checks on the params, etc @stable to override. 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 | shouldExecute () |
Public Attributes | |
resource null | $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 | GENERIC_MAINTENANCE_PARAMETERS = 'Script runner options' |
const | SCRIPT_DEPENDENT_PARAMETERS = 'Common options' |
const | STDIN_ALL = -1 |
Protected Member Functions | |
addArg ( $arg, $description, $required=true, $multi=false) | |
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 () | |
Override to perform any required operation at the end of initialisation. More... | |
beginTransaction (IDatabase $dbw, $fname) | |
Begin a transaction on a DB. More... | |
commitTransaction (IDatabase $dbw, $fname) | |
Commit the transaction 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... | |
getArgs ( $offset=0) | |
Get arguments. 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... | |
getHookContainer () | |
Get a HookContainer, for running extension hooks or for hook metadata. More... | |
getHookRunner () | |
Get a HookRunner for running core hooks. 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 was set. More... | |
loadSpecialVars () | |
Handle the special variables that are global to all scripts @stable to override. More... | |
maybeHelp ( $force=false) | |
Maybe show the help. More... | |
output ( $out, $channel=null) | |
Throw some output to the user. More... | |
parseIntList ( $text) | |
Utility function to parse a string (perhaps from a command line option) into a list of integers (perhaps some kind of numeric IDs). More... | |
requireExtension ( $name) | |
Indicate that the specified extension must be loaded before the script can run. More... | |
rollbackTransaction (IDatabase $dbw, $fname) | |
Rollback the transaction 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) | |
showHelp () | |
Definitely show the help. More... | |
supportsOption ( $name) | |
Checks to see if a particular option in supported. More... | |
validateUserOption ( $errorMsg) | |
waitForReplication () | |
Wait for replica DBs to catch up. More... | |
Protected Attributes | |
array | $mArgList = [] |
Empty. More... | |
array | $mArgs = [] |
This is the list of arguments that were actually passed. More... | |
int null | $mBatchSize = null |
Batch size. More... | |
$mDbUser | |
string | $mDescription = '' |
A description of the script, children should change this via addDescription() More... | |
bool | $mInputLoaded = false |
Have we already loaded our user input? More... | |
array | $mOptions = [] |
This is the list of options that were actually passed. More... | |
array[] | $mParams = [] |
Empty. More... | |
bool | $mQuiet = false |
Special vars for params that are always used. More... | |
string null | $mSelf |
Name of the script currently running. More... | |
MaintenanceParameters | $parameters |
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
WARNING: the constructor, shouldExecute(), setup(), finalSetup(), getName() and loadSettings() are called before Setup.php is complete, which means most of the common infrastructure, like logging or autoloading, is not available. Be careful when changing these methods or the ones called from them. Likewise, be careful with the constructor when subclassing. MediaWikiServices instance is not yet available at this point.
Definition at line 66 of file Maintenance.php.
Maintenance::__construct | ( | ) |
Default constructor.
Children should call this first if implementing their own constructors
Reimplemented in WrapOldPasswords, WikiBirthday, ViewCLI, Version, ValidateRegistrationFile, UserOptionsMaintenance, UppercaseTitlesForUnicodeTransition, UpdateSpecialPages, UpdateSearchIndex, UpdateRestrictions, UpdateExtensionJsonSchema, UpdateCollation, UpdateArticleCount, UpdateMediaWiki, Undelete, TableCleanup, ResolveStubs, OrphanStats, MoveToExternal, DumpRev, CompressOld, SqliteMaintenance, MwSql, ShowSiteStats, ShowJobs, MediaWikiShell, RunJobs, RunBatchedQuery, RollbackEdits, ResetUserEmail, ResetPageRandom, ResetAuthenticationThrottle, DumpRenderer, RenameUsersMatchingPattern, RenameUser, RenameRestrictions, RenameDbPrefix, RemoveUnusedAccounts, RemoveInvalidEmails, RefreshLinks, RefreshImageMetadata, RefreshFileHeaders, RefreshExternallinksIndex, RecountCategories, RebuildTextIndex, RebuildRecentchanges, RebuildMessages, RebuildLocalisationCache, ImageBuilder, RebuildFileCache, RebuildAll, ReassignEdits, PurgeParserCache, PurgePage, PurgeOldText, PurgeModuleDeps, PurgeList, PurgeExpiredWatchlistItems, PurgeExpiredUserrights, PurgeExpiredBlocks, PurgeChangedPages, PurgeChangedFiles, PruneUnusedLinkTargetRows, PruneFileCache, Protect, PopulateRevisionSha1, PopulateRevisionLength, PopulateRecentChangesSource, PopulatePPSortKey, PopulateIpChanges, PopulateInterwiki, PopulateImageSha1, PopulateFilearchiveSha1, PopulateChangeTagDef, PopulateBacklinkNamespace, PatchSql, CLIParser, PageExists, NukePage, NukeNS, NamespaceDupes, MysqlMaintenance, MWDocGen, MoveBatch, MigrateUserGroup, MigrateRevisionCommentTemp, MigrateRevisionActorTemp, MigrateLinksTable, MigrateFileRepoLayout, MigrateExternallinks, MergeMessageFileList, GeneratePhpCharToUpperMappings, McTest, Mcc, ManageJobs, ManageForeignResources, MakeTestEdits, ListVariants, LangMemUsage, ImportExtensionMessages, GenerateUpperCharTable, GenerateUcfirstOverrides, GenerateNormalizerDataMl, GenerateNormalizerDataAr, GenerateCollationData, DumpMessages, Digit2Html, DateFormats, AllTrans, DatabaseLag, JSParseHelper, InvalidateUserSessions, InvalidateBotPasswords, CommandLineInstaller, InitUserPreference, InitSiteStats, InitEditCount, SchemaMaintenance, LoggedUpdateMaintenance, DeleteLocalPasswords, Benchmarker, ImportTextFiles, ImportSiteScripts, ImportSites, ImportImages, BackupReader, GrepPages, GetTextMaint, GetReplicaServer, GetLagTimes, GetConfiguration, GenerateSitemap, GenerateSchemaSql, GenerateSchemaChangeSql, GenerateJsonI18n, GenerateConfigSchema, FormatInstallDoc, FixUserRegistration, FixTimestamps, FixMergeHistoryCorruption, FixExtLinksProtocolRelative, FixDoubleRedirects, FixDefaultJsonContentPages, FindOrphanedFiles, FindMissingFiles, FindMissingActors, FindDeprecated, FindClasses, FindBadBlobs, FileOpPerfTest, FetchText, ExportSites, MWEval, EraseArchivedFile, EmptyUserGroup, EditCLI, DumpUploads, DumpLinks, SearchDump, DumpIterator, DumpCategoriesAsRdf, DeleteUserEmail, DeleteTag, DeleteSelfExternals, DeleteOrphanedRevisions, DeleteOldRevisions, DeleteEqualMessages, DeleteDefaultMessages, DeleteBatch, DeleteAutoPatrolLogs, DeleteArchivedRevisions, DeleteArchivedFiles, CreateBotPassword, CreateAndPromote, CopyJobQueue, CopyFileBackend, ConvertExtensionToRegistration, CompareParsers, CompareParserCache, CompareLanguageConverterOutput, CommandLineInc, ClearInterwikiCache, CleanupWatchlist, CleanupUsersWithNoId, CleanupUploadStash, TitleCleanup, CleanupSpam, CleanupRemovedModules, CleanupPreferences, CleanupInvalidDbKeys, CleanupImages, CleanupEmptyCategories, CleanupCaps, CleanupBlocks, CheckUsernames, CheckImages, CheckDependencies, CheckComposerLockUpToDate, CheckBadRedirects, ChangePassword, CategoryChangesAsRdf, BlockUsers, BenchmarkTitleValue, BenchmarkTidy, BenchmarkSettings, BenchmarkSanitizer, BenchmarkPurge, BenchmarkParse, BenchmarkLruHash, BenchmarkJsonCodec, BenchmarkJSMinPlus, BenchmarkHooks, BenchmarkEval, BenchmarkCommentFormatter, AttachLatest, AddSite, AddRFCandPMIDInterwiki, and AddChangeTag.
Definition at line 195 of file Maintenance.php.
References addDefaultParams().
|
protected |
Add some args that are needed.
string | $arg | Name of the arg, like 'start' |
string | $description | Short description of the arg |
bool | $required | Is this required? |
bool | $multi | Does it allow multiple values? (Last arg only) |
Definition at line 315 of file Maintenance.php.
Referenced by AddSite\__construct(), BenchmarkEval\__construct(), BenchmarkParse\__construct(), BlockUsers\__construct(), CleanupSpam\__construct(), CompareLanguageConverterOutput\__construct(), ConvertExtensionToRegistration\__construct(), CreateAndPromote\__construct(), CreateBotPassword\__construct(), DeleteBatch\__construct(), DeleteTag\__construct(), DeleteUserEmail\__construct(), EditCLI\__construct(), EmptyUserGroup\__construct(), ExportSites\__construct(), FixTimestamps\__construct(), FormatInstallDoc\__construct(), GenerateJsonI18n\__construct(), GetTextMaint\__construct(), GrepPages\__construct(), BackupReader\__construct(), ImportImages\__construct(), ImportSites\__construct(), ImportSiteScripts\__construct(), ImportTextFiles\__construct(), CommandLineInstaller\__construct(), JSParseHelper\__construct(), ImportExtensionMessages\__construct(), ManageForeignResources\__construct(), McTest\__construct(), MigrateUserGroup\__construct(), MoveBatch\__construct(), MysqlMaintenance\__construct(), NukePage\__construct(), PageExists\__construct(), CLIParser\__construct(), PatchSql\__construct(), Protect\__construct(), ReassignEdits\__construct(), RefreshLinks\__construct(), RenameRestrictions\__construct(), RenameUser\__construct(), ResetUserEmail\__construct(), DumpRev\__construct(), MoveToExternal\__construct(), Undelete\__construct(), UpdateExtensionJsonSchema\__construct(), UserOptionsMaintenance\__construct(), ValidateRegistrationFile\__construct(), and ViewCLI\__construct().
|
protected |
Add the default parameters to the scripts.
Definition at line 605 of file Maintenance.php.
Referenced by __construct().
|
protected |
Set the description text.
string | $text | The text of the description |
Definition at line 340 of file Maintenance.php.
Referenced by DumpBackup\__construct(), TextPassDumper\__construct(), AddChangeTag\__construct(), AddRFCandPMIDInterwiki\__construct(), AddSite\__construct(), AttachLatest\__construct(), BenchmarkCommentFormatter\__construct(), BenchmarkHooks\__construct(), BenchmarkJSMinPlus\__construct(), BenchmarkJsonCodec\__construct(), BenchmarkLruHash\__construct(), BenchmarkParse\__construct(), BenchmarkPurge\__construct(), BenchmarkSanitizer\__construct(), BenchmarkSettings\__construct(), BenchmarkTitleValue\__construct(), BlockUsers\__construct(), CategoryChangesAsRdf\__construct(), ChangePassword\__construct(), CheckBadRedirects\__construct(), CheckComposerLockUpToDate\__construct(), CheckDependencies\__construct(), CheckImages\__construct(), CheckUsernames\__construct(), CleanupBlocks\__construct(), CleanupCaps\__construct(), CleanupEmptyCategories\__construct(), CleanupImages\__construct(), CleanupInvalidDbKeys\__construct(), CleanupPreferences\__construct(), CleanupRemovedModules\__construct(), CleanupSpam\__construct(), TitleCleanup\__construct(), CleanupUploadStash\__construct(), CleanupUsersWithNoId\__construct(), CleanupWatchlist\__construct(), ClearInterwikiCache\__construct(), CompareLanguageConverterOutput\__construct(), CompareParserCache\__construct(), CompareParsers\__construct(), ConvertExtensionToRegistration\__construct(), CopyFileBackend\__construct(), CopyJobQueue\__construct(), CreateAndPromote\__construct(), CreateBotPassword\__construct(), DeleteArchivedFiles\__construct(), DeleteArchivedRevisions\__construct(), DeleteAutoPatrolLogs\__construct(), DeleteBatch\__construct(), DeleteDefaultMessages\__construct(), DeleteEqualMessages\__construct(), DeleteOldRevisions\__construct(), DeleteOrphanedRevisions\__construct(), DeleteSelfExternals\__construct(), DeleteTag\__construct(), DeleteUserEmail\__construct(), DumpCategoriesAsRdf\__construct(), DumpIterator\__construct(), SearchDump\__construct(), DumpLinks\__construct(), DumpUploads\__construct(), EditCLI\__construct(), EmptyUserGroup\__construct(), EraseArchivedFile\__construct(), MWEval\__construct(), ExportSites\__construct(), FetchText\__construct(), FileOpPerfTest\__construct(), FindBadBlobs\__construct(), FindClasses\__construct(), FindDeprecated\__construct(), FindMissingActors\__construct(), FindMissingFiles\__construct(), FindOrphanedFiles\__construct(), FixDefaultJsonContentPages\__construct(), FixDoubleRedirects\__construct(), FixExtLinksProtocolRelative\__construct(), FixMergeHistoryCorruption\__construct(), FixTimestamps\__construct(), FixUserRegistration\__construct(), GenerateConfigSchema\__construct(), GenerateJsonI18n\__construct(), GenerateSchemaChangeSql\__construct(), GenerateSchemaSql\__construct(), GenerateSitemap\__construct(), GetConfiguration\__construct(), GetLagTimes\__construct(), GetReplicaServer\__construct(), GetTextMaint\__construct(), GrepPages\__construct(), BackupReader\__construct(), ImportImages\__construct(), ImportSites\__construct(), ImportSiteScripts\__construct(), ImportTextFiles\__construct(), DeleteLocalPasswords\__construct(), InitEditCount\__construct(), InitSiteStats\__construct(), CommandLineInstaller\__construct(), InvalidateBotPasswords\__construct(), InvalidateUserSessions\__construct(), JSParseHelper\__construct(), DatabaseLag\__construct(), AllTrans\__construct(), DateFormats\__construct(), Digit2Html\__construct(), DumpMessages\__construct(), GenerateNormalizerDataAr\__construct(), GenerateNormalizerDataMl\__construct(), GenerateUcfirstOverrides\__construct(), GenerateUpperCharTable\__construct(), LangMemUsage\__construct(), ListVariants\__construct(), MakeTestEdits\__construct(), ManageForeignResources\__construct(), ManageJobs\__construct(), Mcc\__construct(), McTest\__construct(), GeneratePhpCharToUpperMappings\__construct(), MergeMessageFileList\__construct(), MigrateExternallinks\__construct(), MigrateFileRepoLayout\__construct(), MigrateLinksTable\__construct(), MigrateRevisionActorTemp\__construct(), MigrateRevisionCommentTemp\__construct(), MigrateUserGroup\__construct(), MoveBatch\__construct(), MWDocGen\__construct(), MysqlMaintenance\__construct(), NamespaceDupes\__construct(), NukeNS\__construct(), NukePage\__construct(), PageExists\__construct(), CLIParser\__construct(), PatchSql\__construct(), PopulateBacklinkNamespace\__construct(), PopulateChangeTagDef\__construct(), PopulateFilearchiveSha1\__construct(), PopulateImageSha1\__construct(), PopulateInterwiki\__construct(), PopulateIpChanges\__construct(), PopulatePPSortKey\__construct(), PopulateRecentChangesSource\__construct(), PopulateRevisionLength\__construct(), PopulateRevisionSha1\__construct(), Protect\__construct(), PruneFileCache\__construct(), PruneUnusedLinkTargetRows\__construct(), PurgeChangedFiles\__construct(), PurgeChangedPages\__construct(), PurgeExpiredBlocks\__construct(), PurgeExpiredUserrights\__construct(), PurgeExpiredWatchlistItems\__construct(), PurgeList\__construct(), PurgeModuleDeps\__construct(), PurgeOldText\__construct(), PurgePage\__construct(), PurgeParserCache\__construct(), ReassignEdits\__construct(), RebuildAll\__construct(), RebuildFileCache\__construct(), ImageBuilder\__construct(), RebuildLocalisationCache\__construct(), RebuildMessages\__construct(), RebuildRecentchanges\__construct(), RebuildTextIndex\__construct(), RecountCategories\__construct(), RefreshExternallinksIndex\__construct(), RefreshFileHeaders\__construct(), RefreshImageMetadata\__construct(), RefreshLinks\__construct(), RenameRestrictions\__construct(), RenameUser\__construct(), RenameUsersMatchingPattern\__construct(), DumpRenderer\__construct(), ResetAuthenticationThrottle\__construct(), ResetPageRandom\__construct(), ResetUserEmail\__construct(), RollbackEdits\__construct(), RunBatchedQuery\__construct(), RunJobs\__construct(), ShowJobs\__construct(), ShowSiteStats\__construct(), MwSql\__construct(), SqliteMaintenance\__construct(), CompressOld\__construct(), OrphanStats\__construct(), Undelete\__construct(), UpdateMediaWiki\__construct(), UpdateArticleCount\__construct(), UpdateCollation\__construct(), UpdateExtensionJsonSchema\__construct(), UpdateRestrictions\__construct(), UpdateSearchIndex\__construct(), UppercaseTitlesForUnicodeTransition\__construct(), UserOptionsMaintenance\__construct(), Version\__construct(), ViewCLI\__construct(), WikiBirthday\__construct(), and WrapOldPasswords\__construct().
|
protected |
Add a parameter to the script.
Will be displayed on –help with the associated description
string | $name | The name of the param (help, version, etc) |
string | $description | The description of the param to show on –help |
bool | $required | Is the param required? |
bool | $withArg | Is an argument required with this option? |
string | bool | $shortName | Character to use as short name |
bool | $multiOccurrence | Can this option be passed multiple times? |
Definition at line 270 of file Maintenance.php.
Referenced by DumpBackup\__construct(), BackupDumper\__construct(), TextPassDumper\__construct(), AddChangeTag\__construct(), AddSite\__construct(), AttachLatest\__construct(), BenchmarkCommentFormatter\__construct(), BenchmarkEval\__construct(), BenchmarkJSMinPlus\__construct(), BenchmarkJsonCodec\__construct(), BenchmarkLruHash\__construct(), BenchmarkParse\__construct(), BenchmarkSanitizer\__construct(), BenchmarkTidy\__construct(), BlockUsers\__construct(), CategoryChangesAsRdf\__construct(), ChangePassword\__construct(), CheckDependencies\__construct(), CleanupCaps\__construct(), CleanupInvalidDbKeys\__construct(), CleanupPreferences\__construct(), CleanupSpam\__construct(), CleanupUsersWithNoId\__construct(), CleanupWatchlist\__construct(), CommandLineInc\__construct(), CompareParserCache\__construct(), CompareParsers\__construct(), ConvertExtensionToRegistration\__construct(), CopyFileBackend\__construct(), CopyJobQueue\__construct(), CreateAndPromote\__construct(), CreateBotPassword\__construct(), DeleteArchivedFiles\__construct(), DeleteArchivedRevisions\__construct(), DeleteAutoPatrolLogs\__construct(), DeleteBatch\__construct(), DeleteDefaultMessages\__construct(), DeleteEqualMessages\__construct(), DeleteOldRevisions\__construct(), DeleteOrphanedRevisions\__construct(), DumpCategoriesAsRdf\__construct(), DumpIterator\__construct(), SearchDump\__construct(), DumpUploads\__construct(), EditCLI\__construct(), EraseArchivedFile\__construct(), MWEval\__construct(), FileOpPerfTest\__construct(), FindBadBlobs\__construct(), FindMissingActors\__construct(), FindMissingFiles\__construct(), FindOrphanedFiles\__construct(), FixDoubleRedirects\__construct(), FixMergeHistoryCorruption\__construct(), FormatInstallDoc\__construct(), GenerateConfigSchema\__construct(), GenerateJsonI18n\__construct(), GenerateSitemap\__construct(), GetConfiguration\__construct(), GetLagTimes\__construct(), GetReplicaServer\__construct(), GetTextMaint\__construct(), GrepPages\__construct(), BackupReader\__construct(), ImportImages\__construct(), ImportSiteScripts\__construct(), ImportTextFiles\__construct(), Benchmarker\__construct(), DeleteLocalPasswords\__construct(), LoggedUpdateMaintenance\__construct(), SchemaMaintenance\__construct(), InitEditCount\__construct(), InitSiteStats\__construct(), InitUserPreference\__construct(), CommandLineInstaller\__construct(), InvalidateBotPasswords\__construct(), InvalidateUserSessions\__construct(), DatabaseLag\__construct(), GenerateCollationData\__construct(), GenerateNormalizerDataAr\__construct(), GenerateUcfirstOverrides\__construct(), GenerateUpperCharTable\__construct(), ImportExtensionMessages\__construct(), ListVariants\__construct(), MakeTestEdits\__construct(), ManageForeignResources\__construct(), ManageJobs\__construct(), Mcc\__construct(), McTest\__construct(), MergeMessageFileList\__construct(), MigrateExternallinks\__construct(), MigrateFileRepoLayout\__construct(), MigrateLinksTable\__construct(), MigrateRevisionActorTemp\__construct(), MigrateRevisionCommentTemp\__construct(), MoveBatch\__construct(), MWDocGen\__construct(), MysqlMaintenance\__construct(), NamespaceDupes\__construct(), NukeNS\__construct(), NukePage\__construct(), CLIParser\__construct(), PopulateBacklinkNamespace\__construct(), PopulateChangeTagDef\__construct(), PopulateImageSha1\__construct(), PopulateInterwiki\__construct(), PopulateIpChanges\__construct(), Protect\__construct(), PruneFileCache\__construct(), PruneUnusedLinkTargetRows\__construct(), PurgeChangedFiles\__construct(), PurgeChangedPages\__construct(), PurgeList\__construct(), PurgeOldText\__construct(), PurgePage\__construct(), PurgeParserCache\__construct(), ReassignEdits\__construct(), RebuildFileCache\__construct(), ImageBuilder\__construct(), RebuildLocalisationCache\__construct(), RebuildRecentchanges\__construct(), RecountCategories\__construct(), RefreshFileHeaders\__construct(), RefreshImageMetadata\__construct(), RefreshLinks\__construct(), RemoveInvalidEmails\__construct(), RemoveUnusedAccounts\__construct(), RenameDbPrefix\__construct(), RenameUser\__construct(), RenameUsersMatchingPattern\__construct(), DumpRenderer\__construct(), ResetAuthenticationThrottle\__construct(), ResetPageRandom\__construct(), ResetUserEmail\__construct(), RollbackEdits\__construct(), RunBatchedQuery\__construct(), RunJobs\__construct(), MediaWikiShell\__construct(), ShowJobs\__construct(), MwSql\__construct(), SqliteMaintenance\__construct(), CompressOld\__construct(), MoveToExternal\__construct(), ResolveStubs\__construct(), TableCleanup\__construct(), Undelete\__construct(), UpdateMediaWiki\__construct(), UpdateArticleCount\__construct(), UpdateCollation\__construct(), UpdateSearchIndex\__construct(), UpdateSpecialPages\__construct(), UppercaseTitlesForUnicodeTransition\__construct(), UserOptionsMaintenance\__construct(), WrapOldPasswords\__construct(), BackupDumper\finalSetup(), and UpdateMediaWiki\validateParamsAndArgs().
|
protected |
Adjusts PHP's memory limit to better suit our needs, if needed.
Definition at line 774 of file Maintenance.php.
References wfDeprecated().
|
protected |
Override to perform any required operation at the end of initialisation.
Reimplemented in UpdateMediaWiki.
Definition at line 1023 of file Maintenance.php.
|
protected |
Begin a transaction on a DB.
This method makes it clear that begin() is called from a maintenance script, which has outermost scope. This is safe, unlike $dbw->begin() called in other places.
IDatabase | $dbw | |
string | $fname | Caller name |
Definition at line 1190 of file Maintenance.php.
References Wikimedia\Rdbms\IDatabase\begin().
Referenced by NukePage\deleteRevisions(), PopulatePPSortKey\doDBUpdates(), PopulateRevisionLength\doLenUpdates(), PopulateRevisionSha1\doSha1Updates(), CleanupRemovedModules\execute(), DeleteArchivedFiles\execute(), DeleteOrphanedRevisions\execute(), MigrateUserGroup\execute(), MoveBatch\execute(), NukeNS\execute(), NukePage\execute(), PurgeModuleDeps\execute(), RebuildFileCache\execute(), UpdateRestrictions\execute(), and WrapOldPasswords\execute().
Maintenance::canExecuteWithoutLocalSettings | ( | ) |
Whether this script can run without LocalSettings.php.
Scripts that need to be able to run when MediaWiki has not been installed should override this to return true. Scripts that return true from this method must be able to function without a storage backend. When no LocalSettings.php file is present, any attempt to access the database will fail with a fatal error.
Reimplemented in Version, CommandLineInstaller, GenerateAutoload, and MWEval.
Definition at line 245 of file Maintenance.php.
Maintenance::checkRequiredExtensions | ( | ) |
Verify that the required extensions are installed.
Definition at line 682 of file Maintenance.php.
References ExtensionRegistry\getInstance().
Maintenance::cleanupChanneled | ( | ) |
Clean up channeled output.
Output a newline if necessary.
Definition at line 543 of file Maintenance.php.
Maintenance::clearParamsAndArgs | ( | ) |
Clear all params and arguments.
Definition at line 795 of file Maintenance.php.
|
protected |
Commit the transaction 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.
IDatabase | $dbw | |
string | $fname | Caller name |
Definition at line 1205 of file Maintenance.php.
References Wikimedia\Rdbms\IDatabase\commit().
Referenced by NukePage\deleteRevisions(), PopulatePPSortKey\doDBUpdates(), PopulateRevisionLength\doLenUpdates(), PopulateRevisionSha1\doSha1Updates(), CleanupRemovedModules\execute(), DeleteArchivedFiles\execute(), DeleteOrphanedRevisions\execute(), DeleteSelfExternals\execute(), MigrateUserGroup\execute(), MoveBatch\execute(), NukeNS\execute(), NukePage\execute(), PurgeModuleDeps\execute(), RebuildFileCache\execute(), UpdateRestrictions\execute(), and WrapOldPasswords\execute().
|
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.
@codeCoverageIgnore
int | $seconds |
Definition at line 1259 of file Maintenance.php.
Referenced by DeleteAutoPatrolLogs\execute(), and UpdateMediaWiki\execute().
|
protected |
Remove an option.
Useful for removing options that won't be used in your script.
string | $name | The option to remove. |
Definition at line 323 of file Maintenance.php.
|
protected |
Throw an error to the user.
Doesn't respect –quiet, so don't use this for non-error output
string | $err | The error to display |
int | $die | Deprecated since 1.31, use Maintenance::fatalError() instead |
Definition at line 507 of file Maintenance.php.
References wfDeprecated().
Referenced by FindOrphanedFiles\checkFiles(), CompareParsers\conclusions(), CopyFileBackend\copyFileBatch(), CopyFileBackend\delFileBatch(), FixExtLinksProtocolRelative\doDBUpdates(), MigrateRevisionActorTemp\doDBUpdates(), PopulateRecentChangesSource\doDBUpdates(), RefreshExternallinksIndex\doDBUpdates(), CleanupUploadStash\doOperations(), UpdateSpecialPages\doSpecialPageCacheUpdates(), AddSite\execute(), BenchmarkPurge\execute(), CategoryChangesAsRdf\execute(), CheckComposerLockUpToDate\execute(), CreateAndPromote\execute(), DeleteArchivedFiles\execute(), DumpIterator\execute(), FixDoubleRedirects\execute(), GenerateJsonI18n\execute(), GrepPages\execute(), ImportSiteScripts\execute(), ImportTextFiles\execute(), SchemaMaintenance\execute(), Digit2Html\execute(), GenerateNormalizerDataAr\execute(), ManageForeignResources\execute(), MergeMessageFileList\execute(), MigrateFileRepoLayout\execute(), MoveBatch\execute(), PatchSql\execute(), PopulateInterwiki\execute(), PurgeChangedFiles\execute(), PurgeChangedPages\execute(), PurgeExpiredWatchlistItems\execute(), ReassignEdits\execute(), RenameUsersMatchingPattern\execute(), DumpRenderer\execute(), ResetUserEmail\execute(), RollbackEdits\execute(), SqliteMaintenance\execute(), CompressOld\execute(), UpdateSearchIndex\execute(), UppercaseTitlesForUnicodeTransition\execute(), DumpIterator\handleRevision(), DumpRenderer\handleRevision(), CompareParsers\processRevision(), PurgeChangedFiles\purgeFromArchiveTable(), PurgeChangedFiles\purgeFromLogType(), MwSql\sqlDoQuery(), RefreshFileHeaders\updateFileHeaders(), GetConfiguration\validateParamsAndArgs(), and CLIParser\Wikitext().
|
abstract |
Do the actual work.
All child classes will need to implement this
Reimplemented in WrapOldPasswords, WikiBirthday, ViewCLI, Version, ValidateRegistrationFile, UserOptionsMaintenance, UppercaseTitlesForUnicodeTransition, UpdateSpecialPages, UpdateSearchIndex, UpdateRestrictions, UpdateExtensionJsonSchema, UpdateCollation, UpdateArticleCount, UpdateMediaWiki, Undelete, TableCleanup, StorageTypeStats, ResolveStubs, OrphanStats, MoveToExternal, DumpRev, CompressOld, SqliteMaintenance, MwSql, ShowSiteStats, ShowJobs, MediaWikiShell, RunJobs, RunBatchedQuery, RollbackEdits, ResetUserEmail, ResetPageRandom, ResetAuthenticationThrottle, DumpRenderer, RenameUsersMatchingPattern, RenameUser, RenameRestrictions, RenameDbPrefix, RemoveUnusedAccounts, RemoveInvalidEmails, RefreshLinks, RefreshImageMetadata, RefreshFileHeaders, RecountCategories, RebuildTextIndex, RebuildRecentchanges, RebuildMessages, RebuildLocalisationCache, ImageBuilder, RebuildFileCache, RebuildAll, ReassignEdits, PurgeParserCache, PurgePage, PurgeOldText, PurgeModuleDeps, PurgeMessageBlobStore, PurgeList, PurgeExpiredWatchlistItems, PurgeExpiredUserrights, PurgeExpiredBlocks, PurgeChangedPages, PurgeChangedFiles, PruneUnusedLinkTargetRows, PruneFileCache, Protect, PopulateInterwiki, PopulateImageSha1, PatchSql, CLIParser, PageExists, NukePage, NukeNS, NamespaceDupes, MysqlMaintenance, MWDocGen, MoveBatch, MigrateUserGroup, MigrateFileRepoLayout, MergeMessageFileList, GeneratePhpCharToUpperMappings, McTest, Mcc, ManageJobs, ManageForeignResources, MakeTestEdits, ListVariants, LangMemUsage, ImportExtensionMessages, GenerateUpperCharTable, GenerateUcfirstOverrides, GenerateNormalizerDataMl, GenerateNormalizerDataAr, GenerateCollationData, DumpMessages, Digit2Html, DateFormats, AllTrans, DatabaseLag, JSParseHelper, InvalidateUserSessions, InvalidateBotPasswords, CommandLineInstaller, InitUserPreference, InitSiteStats, InitEditCount, TextPassDumper, SchemaMaintenance, LoggedUpdateMaintenance, FakeMaintenance, DeleteLocalPasswords, BackupDumper, ImportTextFiles, ImportSiteScripts, ImportSites, ImportImages, BackupReader, GrepPages, GetTextMaint, GetReplicaServer, GetLagTimes, GetConfiguration, GenerateSitemap, GenerateJsonI18n, GenerateConfigSchema, GenerateAutoload, FormatInstallDoc, FixUserRegistration, FixTimestamps, FixMergeHistoryCorruption, FixDoubleRedirects, FindOrphanedFiles, FindMissingFiles, FindMissingActors, FindDeprecated, FindClasses, FindBadBlobs, FileOpPerfTest, FetchText, ExportSites, MWEval, EraseArchivedFile, EmptyUserGroup, EditCLI, DumpUploads, DumpLinks, DumpIterator, DumpCategoriesAsRdf, DumpBackup, DeleteUserEmail, DeleteTag, DeleteSelfExternals, DeleteOrphanedRevisions, DeleteOldRevisions, DeleteEqualMessages, DeleteDefaultMessages, DeleteBatch, DeleteAutoPatrolLogs, DeleteArchivedRevisions, DeleteArchivedFiles, CreateBotPassword, CreateAndPromote, CopyJobQueue, CopyFileBackend, ConvertExtensionToRegistration, CompareParserCache, CompareLanguageConverterOutput, CommandLineInc, ClearInterwikiCache, CleanupWatchlist, CleanupUploadStash, CleanupSpam, CleanupRemovedModules, CleanupPreferences, CleanupInvalidDbKeys, CleanupCaps, CleanupBlocks, CheckUsernames, CheckImages, CheckDependencies, CheckComposerLockUpToDate, CheckBadRedirects, ChangePassword, CategoryChangesAsRdf, BlockUsers, BenchmarkTruncate, BenchmarkTitleValue, BenchmarkTidy, BenchmarkSettings, BenchmarkSanitizer, BenchmarkPurge, BenchmarkParse, BenchmarkLruHash, BenchmarkJsonCodec, BenchmarkJSMinPlus, BenchmarkHooks, BenchmarkEval, BenchmarkCommentFormatter, AttachLatest, AddSite, and AddChangeTag.
|
protected |
Output a message and terminate the current script.
string | $msg | Error message |
int | $exitCode | PHP exit status. Should be in range 1-254. |
Definition at line 532 of file Maintenance.php.
Referenced by ResetAuthenticationThrottle\clearLoginThrottle(), CopyFileBackend\copyFileBatch(), CopyFileBackend\delFileBatch(), PopulateImageSha1\doDBUpdates(), PopulateIpChanges\doDBUpdates(), PopulateRevisionLength\doDBUpdates(), PopulateRevisionSha1\doDBUpdates(), AddChangeTag\execute(), BenchmarkCommentFormatter\execute(), BenchmarkEval\execute(), BenchmarkJSMinPlus\execute(), BenchmarkParse\execute(), BenchmarkTidy\execute(), BlockUsers\execute(), ChangePassword\execute(), CheckComposerLockUpToDate\execute(), CleanupSpam\execute(), CleanupUploadStash\execute(), CompareLanguageConverterOutput\execute(), ConvertExtensionToRegistration\execute(), CopyFileBackend\execute(), CopyJobQueue\execute(), CreateAndPromote\execute(), CreateBotPassword\execute(), DeleteBatch\execute(), DeleteDefaultMessages\execute(), DeleteEqualMessages\execute(), DeleteSelfExternals\execute(), DeleteTag\execute(), DeleteUserEmail\execute(), DumpBackup\execute(), DumpIterator\execute(), EditCLI\execute(), EraseArchivedFile\execute(), ExportSites\execute(), FindBadBlobs\execute(), FindMissingActors\execute(), FindOrphanedFiles\execute(), FixDoubleRedirects\execute(), FixMergeHistoryCorruption\execute(), FixTimestamps\execute(), FormatInstallDoc\execute(), GenerateJsonI18n\execute(), GenerateSitemap\execute(), GetConfiguration\execute(), GetReplicaServer\execute(), GetTextMaint\execute(), BackupReader\execute(), ImportImages\execute(), ImportTextFiles\execute(), SchemaMaintenance\execute(), InvalidateUserSessions\execute(), JSParseHelper\execute(), GenerateCollationData\execute(), GenerateNormalizerDataAr\execute(), ImportExtensionMessages\execute(), LangMemUsage\execute(), MakeTestEdits\execute(), ManageForeignResources\execute(), ManageJobs\execute(), Mcc\execute(), McTest\execute(), GeneratePhpCharToUpperMappings\execute(), MergeMessageFileList\execute(), MigrateFileRepoLayout\execute(), MigrateUserGroup\execute(), MoveBatch\execute(), MWDocGen\execute(), MysqlMaintenance\execute(), Protect\execute(), PruneFileCache\execute(), PurgeParserCache\execute(), RebuildFileCache\execute(), RebuildLocalisationCache\execute(), RebuildRecentchanges\execute(), RebuildTextIndex\execute(), RecountCategories\execute(), RefreshImageMetadata\execute(), RefreshLinks\execute(), RemoveUnusedAccounts\execute(), RenameDbPrefix\execute(), RenameUser\execute(), DumpRenderer\execute(), ResetAuthenticationThrottle\execute(), ResetUserEmail\execute(), RollbackEdits\execute(), RunJobs\execute(), MediaWikiShell\execute(), MwSql\execute(), CompressOld\execute(), DumpRev\execute(), MoveToExternal\execute(), OrphanStats\execute(), StorageTypeStats\execute(), Undelete\execute(), UpdateMediaWiki\execute(), UpdateExtensionJsonSchema\execute(), UpdateRestrictions\execute(), UpdateSpecialPages\execute(), UppercaseTitlesForUnicodeTransition\execute(), ValidateRegistrationFile\execute(), ViewCLI\execute(), WrapOldPasswords\execute(), CopyFileBackend\getListingDiffRel(), ConvertExtensionToRegistration\handleExtensionFunctions(), ConvertExtensionToRegistration\handleHooks(), DeleteLocalPasswords\initialize(), TitleCleanup\moveInconsistentPage(), DumpBackup\processOptions(), BackupDumper\processOptions(), TableCleanup\runTable(), MwSql\sqlDoQuery(), and GenerateJsonI18n\transformI18nFile().
Maintenance::finalSetup | ( | SettingsBuilder | $settingsBuilder = null | ) |
Handle some last-minute setup here.
@stable to override
SettingsBuilder | null | $settingsBuilder |
Reimplemented in RunJobs, RebuildLocalisationCache, RebuildFileCache, MergeMessageFileList, CommandLineInstaller, TextPassDumper, BackupDumper, FetchText, and DumpIterator.
Definition at line 930 of file Maintenance.php.
|
protected |
Get an argument.
int | string | $argId | The index (from zero) of the argument, or the name declared for the argument by addArg(). |
mixed | null | $default | The default if it doesn't exist |
Definition at line 362 of file Maintenance.php.
Referenced by AddSite\execute(), BenchmarkEval\execute(), BenchmarkParse\execute(), BlockUsers\execute(), CleanupSpam\execute(), CompareLanguageConverterOutput\execute(), ConvertExtensionToRegistration\execute(), CreateAndPromote\execute(), CreateBotPassword\execute(), DeleteBatch\execute(), DeleteTag\execute(), DeleteUserEmail\execute(), EditCLI\execute(), EmptyUserGroup\execute(), ExportSites\execute(), FixTimestamps\execute(), FormatInstallDoc\execute(), GenerateJsonI18n\execute(), GetTextMaint\execute(), GrepPages\execute(), BackupReader\execute(), ImportImages\execute(), ImportSites\execute(), ImportSiteScripts\execute(), ImportTextFiles\execute(), ImportExtensionMessages\execute(), ManageForeignResources\execute(), McTest\execute(), MigrateUserGroup\execute(), MoveBatch\execute(), NukePage\execute(), PageExists\execute(), Protect\execute(), ReassignEdits\execute(), RefreshLinks\execute(), RenameRestrictions\execute(), RenameUser\execute(), ResetUserEmail\execute(), MwSql\execute(), DumpRev\execute(), MoveToExternal\execute(), Undelete\execute(), UpdateExtensionJsonSchema\execute(), ValidateRegistrationFile\execute(), ViewCLI\execute(), ImportSiteScripts\fetchScriptList(), and CLIParser\Wikitext().
|
protected |
Get arguments.
int | string | $offset | The index (from zero) of the first argument, or the name declared for the argument by addArg(). |
Definition at line 374 of file Maintenance.php.
Referenced by DeleteOldRevisions\execute(), JSParseHelper\execute(), and PatchSql\execute().
|
protected |
Returns batch size.
Definition at line 411 of file Maintenance.php.
Referenced by CleanupInvalidDbKeys\cleanupTable(), CopyJobQueue\copyJobs(), MigrateExternallinks\doDBUpdates(), MigrateLinksTable\doDBUpdates(), MigrateRevisionActorTemp\doDBUpdates(), MigrateRevisionCommentTemp\doDBUpdates(), PopulateBacklinkNamespace\doDBUpdates(), PopulateChangeTagDef\doDBUpdates(), PopulateFilearchiveSha1\doDBUpdates(), PopulateImageSha1\doDBUpdates(), PopulateIpChanges\doDBUpdates(), PopulatePPSortKey\doDBUpdates(), PopulateRecentChangesSource\doDBUpdates(), PopulateRevisionLength\doLenUpdates(), PopulateRevisionSha1\doSha1Updates(), RecountCategories\doWork(), CheckImages\execute(), CheckUsernames\execute(), CleanupBlocks\execute(), CleanupRemovedModules\execute(), CleanupUploadStash\execute(), CopyFileBackend\execute(), DeleteAutoPatrolLogs\execute(), DeleteTag\execute(), EmptyUserGroup\execute(), FindMissingFiles\execute(), FindOrphanedFiles\execute(), InitUserPreference\execute(), InvalidateUserSessions\execute(), MakeTestEdits\execute(), MigrateFileRepoLayout\execute(), MigrateUserGroup\execute(), PruneUnusedLinkTargetRows\execute(), PurgeChangedPages\execute(), PurgeExpiredWatchlistItems\execute(), PurgeModuleDeps\execute(), RebuildFileCache\execute(), RefreshFileHeaders\execute(), RefreshImageMetadata\execute(), RefreshLinks\execute(), RenameUsersMatchingPattern\execute(), ResetPageRandom\execute(), MwSql\execute(), ResolveStubs\execute(), UpdateCollation\execute(), UpdateRestrictions\execute(), DumpCategoriesAsRdf\getCategoryIterator(), DumpCategoriesAsRdf\getCategoryLinksIterator(), DeleteLocalPasswords\getUserBatches(), PurgeChangedFiles\purgeFromLogType(), and TableCleanup\runTable().
Maintenance::getConfig | ( | ) |
Definition at line 638 of file Maintenance.php.
Referenced by DumpCategoriesAsRdf\addDumpHeader(), ResetAuthenticationThrottle\clearLoginThrottle(), ResetAuthenticationThrottle\clearSignupThrottle(), AddRFCandPMIDInterwiki\doDBUpdates(), PopulateImageSha1\doDBUpdates(), UpdateSpecialPages\doSpecialPageCacheUpdates(), CategoryChangesAsRdf\execute(), CleanupPreferences\execute(), CleanupUploadStash\execute(), CreateBotPassword\execute(), DeleteSelfExternals\execute(), ImportImages\execute(), Mcc\execute(), McTest\execute(), MergeMessageFileList\execute(), PurgeParserCache\execute(), RebuildLocalisationCache\execute(), RenameDbPrefix\execute(), MoveToExternal\execute(), and UpdateSpecialPages\execute().
|
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().
@stable to override
int | $db | DB index (DB_REPLICA/DB_PRIMARY) |
string | string[] | $groups | default: empty array |
string | bool | $dbDomain | default: current wiki |
Definition at line 1159 of file Maintenance.php.
Referenced by CleanupUsersWithNoId\cleanup(), CleanupInvalidDbKeys\cleanupTable(), NukePage\deleteRevisions(), AddRFCandPMIDInterwiki\doDBUpdates(), FixDefaultJsonContentPages\doDBUpdates(), FixExtLinksProtocolRelative\doDBUpdates(), MigrateExternallinks\doDBUpdates(), MigrateLinksTable\doDBUpdates(), MigrateRevisionActorTemp\doDBUpdates(), MigrateRevisionCommentTemp\doDBUpdates(), PopulateBacklinkNamespace\doDBUpdates(), PopulateFilearchiveSha1\doDBUpdates(), PopulateImageSha1\doDBUpdates(), PopulateIpChanges\doDBUpdates(), PopulatePPSortKey\doDBUpdates(), PopulateRecentChangesSource\doDBUpdates(), PopulateRevisionLength\doDBUpdates(), PopulateRevisionSha1\doDBUpdates(), RefreshExternallinksIndex\doDBUpdates(), PopulateRevisionLength\doLenUpdates(), PopulateInterwiki\doPopulate(), PopulateRevisionSha1\doSha1Updates(), RecountCategories\doWork(), AttachLatest\execute(), BenchmarkTruncate\execute(), CategoryChangesAsRdf\execute(), CheckBadRedirects\execute(), CheckImages\execute(), CheckUsernames\execute(), CleanupBlocks\execute(), CleanupPreferences\execute(), CleanupRemovedModules\execute(), CleanupSpam\execute(), ClearInterwikiCache\execute(), CompareParserCache\execute(), DeleteArchivedFiles\execute(), DeleteArchivedRevisions\execute(), DeleteDefaultMessages\execute(), DeleteEqualMessages\execute(), DeleteOrphanedRevisions\execute(), DeleteSelfExternals\execute(), DeleteTag\execute(), DumpCategoriesAsRdf\execute(), DumpLinks\execute(), EraseArchivedFile\execute(), FixDoubleRedirects\execute(), FixMergeHistoryCorruption\execute(), FixTimestamps\execute(), FixUserRegistration\execute(), GenerateSitemap\execute(), LoggedUpdateMaintenance\execute(), InitEditCount\execute(), InitSiteStats\execute(), InitUserPreference\execute(), MigrateUserGroup\execute(), MoveBatch\execute(), NukeNS\execute(), NukePage\execute(), PatchSql\execute(), PruneUnusedLinkTargetRows\execute(), PurgeChangedFiles\execute(), PurgeChangedPages\execute(), PurgeModuleDeps\execute(), RebuildAll\execute(), RebuildFileCache\execute(), ImageBuilder\execute(), RebuildTextIndex\execute(), RefreshFileHeaders\execute(), RefreshImageMetadata\execute(), RemoveInvalidEmails\execute(), RemoveUnusedAccounts\execute(), RenameDbPrefix\execute(), RenameUsersMatchingPattern\execute(), ResetPageRandom\execute(), RunBatchedQuery\execute(), ShowSiteStats\execute(), MoveToExternal\execute(), OrphanStats\execute(), ResolveStubs\execute(), StorageTypeStats\execute(), UpdateMediaWiki\execute(), UpdateArticleCount\execute(), UpdateRestrictions\execute(), UpdateSpecialPages\execute(), UppercaseTitlesForUnicodeTransition\execute(), WikiBirthday\execute(), WrapOldPasswords\execute(), DeleteEqualMessages\fetchMessageInfo(), TitleCleanup\fileExists(), GrepPages\findPages(), DeleteLocalPasswords\getUserBatches(), DeleteLocalPasswords\getUserDB(), FixDefaultJsonContentPages\handleRow(), BackupDumper\initProgress(), TitleCleanup\moveIllegalPage(), TitleCleanup\moveInconsistentPage(), RebuildTextIndex\populateSearchIndex(), PurgeChangedFiles\purgeFromLogType(), ResolveStubs\resolveStub(), TableCleanup\runTable(), EraseArchivedFile\scrubAllVersions(), MediaWikiShell\setupLegacy(), MediaWikiShell\setupLogging(), PopulateRevisionSha1\upgradeRow(), and PopulateRevisionLength\upgradeRow().
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
Reimplemented in UpdateSearchIndex, UpdateMediaWiki, MwSql, RunBatchedQuery, RenameDbPrefix, RebuildTextIndex, RebuildLocalisationCache, RebuildAll, PatchSql, MWDocGen, MergeMessageFileList, GenerateNormalizerDataMl, GenerateNormalizerDataAr, CommandLineInstaller, GenerateConfigSchema, and SearchDump.
Definition at line 598 of file Maintenance.php.
Referenced by DumpIterator\finalSetup().
|
protected |
|
protected |
Get a HookContainer, for running extension hooks or for hook metadata.
Definition at line 1417 of file Maintenance.php.
Referenced by BenchmarkHooks\execute(), BenchmarkParse\execute(), and MediaWikiShell\execute().
|
protected |
Get a HookRunner for running core hooks.
Definition at line 1432 of file Maintenance.php.
Referenced by CleanupUsersWithNoId\cleanup(), CleanupPreferences\execute(), and UpdateMediaWiki\validateParamsAndArgs().
Maintenance::getName | ( | ) |
|
protected |
Get an option, or return the default.
If the option was added to support multiple occurrences, this will return an array.
string | $name | The name of the param |
mixed | null | $default | Anything you want, default null |
Definition at line 304 of file Maintenance.php.
Referenced by Benchmarker\bench(), CompareParsers\checkOptions(), CleanupUsersWithNoId\doDBUpdates(), MigrateLinksTable\doDBUpdates(), MigrateRevisionActorTemp\doDBUpdates(), MigrateRevisionCommentTemp\doDBUpdates(), PopulateBacklinkNamespace\doDBUpdates(), PopulateChangeTagDef\doDBUpdates(), PopulateImageSha1\doDBUpdates(), PopulateIpChanges\doDBUpdates(), FileOpPerfTest\doPerfTest(), UpdateSpecialPages\doSpecialPageCacheUpdates(), AddChangeTag\execute(), AddSite\execute(), BenchmarkCommentFormatter\execute(), BenchmarkEval\execute(), BenchmarkJSMinPlus\execute(), BenchmarkJsonCodec\execute(), BenchmarkLruHash\execute(), BenchmarkParse\execute(), BenchmarkPurge\execute(), BenchmarkSanitizer\execute(), BenchmarkTidy\execute(), BlockUsers\execute(), CategoryChangesAsRdf\execute(), ChangePassword\execute(), CheckDependencies\execute(), CleanupCaps\execute(), CleanupInvalidDbKeys\execute(), CompareParserCache\execute(), ConvertExtensionToRegistration\execute(), CopyFileBackend\execute(), CopyJobQueue\execute(), CreateAndPromote\execute(), CreateBotPassword\execute(), DeleteAutoPatrolLogs\execute(), DeleteBatch\execute(), DeleteEqualMessages\execute(), DumpCategoriesAsRdf\execute(), DumpIterator\execute(), DumpUploads\execute(), EditCLI\execute(), EraseArchivedFile\execute(), FileOpPerfTest\execute(), FindBadBlobs\execute(), FindMissingActors\execute(), FindMissingFiles\execute(), FindOrphanedFiles\execute(), FixDoubleRedirects\execute(), FixMergeHistoryCorruption\execute(), FormatInstallDoc\execute(), GenerateJsonI18n\execute(), GenerateSitemap\execute(), GetConfiguration\execute(), GetReplicaServer\execute(), GetTextMaint\execute(), GrepPages\execute(), BackupReader\execute(), ImportImages\execute(), ImportSiteScripts\execute(), ImportTextFiles\execute(), SchemaMaintenance\execute(), InitUserPreference\execute(), InvalidateUserSessions\execute(), GenerateCollationData\execute(), GenerateNormalizerDataAr\execute(), GenerateUcfirstOverrides\execute(), GenerateUpperCharTable\execute(), ImportExtensionMessages\execute(), MakeTestEdits\execute(), ManageForeignResources\execute(), ManageJobs\execute(), Mcc\execute(), McTest\execute(), MergeMessageFileList\execute(), MigrateFileRepoLayout\execute(), MoveBatch\execute(), MysqlMaintenance\execute(), NamespaceDupes\execute(), NukeNS\execute(), PopulateImageSha1\execute(), PopulateInterwiki\execute(), Protect\execute(), PruneFileCache\execute(), PruneUnusedLinkTargetRows\execute(), PurgeChangedFiles\execute(), PurgeChangedPages\execute(), PurgeList\execute(), PurgeParserCache\execute(), RebuildFileCache\execute(), RebuildLocalisationCache\execute(), RecountCategories\execute(), RefreshFileHeaders\execute(), RefreshImageMetadata\execute(), RefreshLinks\execute(), RemoveUnusedAccounts\execute(), RenameDbPrefix\execute(), RenameUser\execute(), RenameUsersMatchingPattern\execute(), DumpRenderer\execute(), ResetAuthenticationThrottle\execute(), ResetPageRandom\execute(), RollbackEdits\execute(), RunBatchedQuery\execute(), RunJobs\execute(), ShowJobs\execute(), MwSql\execute(), SqliteMaintenance\execute(), CompressOld\execute(), MoveToExternal\execute(), ResolveStubs\execute(), TableCleanup\execute(), Undelete\execute(), UpdateMediaWiki\execute(), UpdateCollation\execute(), UpdateSearchIndex\execute(), UpdateSpecialPages\execute(), UppercaseTitlesForUnicodeTransition\execute(), WrapOldPasswords\execute(), CLIParser\getTitle(), MigrateLinksTable\getUpdateKey(), MWDocGen\init(), DeleteLocalPasswords\initialize(), DumpBackup\processOptions(), BackupDumper\processOptions(), TextPassDumper\processOptions(), CompareParsers\processRevision(), SearchDump\processRevision(), DeleteLocalPasswords\processUsers(), PurgeChangedFiles\purgeFromLogType(), MediaWikiShell\setupLegacy(), MediaWikiShell\setupLogging(), and GetConfiguration\validateParamsAndArgs().
Maintenance::getParameters | ( | ) |
Definition at line 207 of file Maintenance.php.
References $parameters.
Maintenance::getServiceContainer | ( | ) |
Returns the main service container.
Definition at line 652 of file Maintenance.php.
|
protected |
Return input from stdin.
int | null | $len | The number of bytes to read. If null, just return the handle. Maintenance::STDIN_ALL returns the full content |
Definition at line 450 of file Maintenance.php.
Referenced by BlockUsers\execute(), DeleteBatch\execute(), DumpIterator\execute(), EditCLI\execute(), FetchText\execute(), MoveBatch\execute(), PurgePage\execute(), and DumpRenderer\execute().
|
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).
Definition at line 1365 of file Maintenance.php.
References wfIsWindows().
Maintenance::globals | ( | ) |
Potentially debug globals.
Originally a feature only for refreshLinks
Definition at line 1031 of file Maintenance.php.
References wfDeprecated().
|
protected |
Does a given argument exist?
int | string | $argId | The index (from zero) of the argument, or the name declared for the argument by addArg(). |
Definition at line 350 of file Maintenance.php.
Referenced by BenchmarkEval\execute(), BlockUsers\execute(), DeleteBatch\execute(), FormatInstallDoc\execute(), BackupReader\execute(), MoveBatch\execute(), ReassignEdits\execute(), MwSql\execute(), and UserOptionsMaintenance\execute().
|
protected |
Checks to see if a particular option was set.
string | $name | The name of the option |
Definition at line 289 of file Maintenance.php.
Referenced by Benchmarker\bench(), CompareParsers\checkOptions(), CleanupInvalidDbKeys\cleanupTable(), CopyFileBackend\copyFileBatch(), PopulateChangeTagDef\doDBUpdates(), PopulateImageSha1\doDBUpdates(), FileOpPerfTest\doPerfTest(), UpdateSpecialPages\doSpecialPageCacheUpdates(), AttachLatest\execute(), BenchmarkEval\execute(), BenchmarkParse\execute(), BenchmarkPurge\execute(), BlockUsers\execute(), CheckDependencies\execute(), CleanupCaps\execute(), CleanupInvalidDbKeys\execute(), CleanupPreferences\execute(), CleanupSpam\execute(), CleanupWatchlist\execute(), ConvertExtensionToRegistration\execute(), CopyFileBackend\execute(), CreateAndPromote\execute(), CreateBotPassword\execute(), DeleteArchivedFiles\execute(), DeleteArchivedRevisions\execute(), DeleteAutoPatrolLogs\execute(), DeleteDefaultMessages\execute(), DeleteEqualMessages\execute(), DeleteOldRevisions\execute(), DeleteOrphanedRevisions\execute(), DumpBackup\execute(), DumpIterator\execute(), DumpUploads\execute(), EditCLI\execute(), EraseArchivedFile\execute(), FindBadBlobs\execute(), FindOrphanedFiles\execute(), FixDoubleRedirects\execute(), FixMergeHistoryCorruption\execute(), FormatInstallDoc\execute(), GenerateJsonI18n\execute(), GenerateSitemap\execute(), GetLagTimes\execute(), GetReplicaServer\execute(), GetTextMaint\execute(), GrepPages\execute(), BackupReader\execute(), ImportImages\execute(), ImportTextFiles\execute(), LoggedUpdateMaintenance\execute(), SchemaMaintenance\execute(), InitEditCount\execute(), InitSiteStats\execute(), DatabaseLag\execute(), GenerateNormalizerDataAr\execute(), ListVariants\execute(), ManageForeignResources\execute(), Mcc\execute(), MergeMessageFileList\execute(), MoveBatch\execute(), MysqlMaintenance\execute(), NamespaceDupes\execute(), NukeNS\execute(), NukePage\execute(), PopulateImageSha1\execute(), PopulateInterwiki\execute(), Protect\execute(), PurgeChangedFiles\execute(), PurgeChangedPages\execute(), PurgeList\execute(), PurgeOldText\execute(), PurgeParserCache\execute(), ReassignEdits\execute(), RebuildFileCache\execute(), ImageBuilder\execute(), RebuildLocalisationCache\execute(), RebuildRecentchanges\execute(), RecountCategories\execute(), RefreshFileHeaders\execute(), RefreshImageMetadata\execute(), RefreshLinks\execute(), RemoveInvalidEmails\execute(), RemoveUnusedAccounts\execute(), DumpRenderer\execute(), ResetUserEmail\execute(), RollbackEdits\execute(), RunJobs\execute(), ShowJobs\execute(), MwSql\execute(), SqliteMaintenance\execute(), TableCleanup\execute(), UpdateMediaWiki\execute(), UpdateArticleCount\execute(), UpdateCollation\execute(), UpdateSearchIndex\execute(), UpdateSpecialPages\execute(), UserOptionsMaintenance\execute(), WrapOldPasswords\execute(), CopyFileBackend\filesAreSame(), RebuildLocalisationCache\getDbType(), ConvertExtensionToRegistration\handleResourceModules(), MWDocGen\init(), DeleteLocalPasswords\initialize(), RunJobs\memoryLimit(), DumpBackup\processOptions(), BackupDumper\processOptions(), TextPassDumper\processOptions(), PurgeChangedFiles\purgeFromLogType(), EraseArchivedFile\scrubVersion(), MediaWikiShell\setupLogging(), MwSql\sqlPrintResult(), GetConfiguration\validateParamsAndArgs(), and PurgeChangedFiles\verbose().
Maintenance::isQuiet | ( | ) |
Definition at line 467 of file Maintenance.php.
Maintenance::loadParamsAndArgs | ( | $self = null , |
|
$opts = null , |
|||
$args = null |
|||
) |
Process command line arguments when running as a child script.
string | null | $self | The name of the script, if any |
array | null | $opts | An array of options, in form of key=>value |
array | null | $args | An array of command line arguments |
Definition at line 841 of file Maintenance.php.
References $self.
Maintenance::loadSettings | ( | ) |
Does nothing. Unused.
Definition at line 1084 of file Maintenance.php.
|
protected |
Handle the special variables that are global to all scripts @stable to override.
Definition at line 880 of file Maintenance.php.
Maintenance::loadWithArgv | ( | $argv | ) |
Load params and arguments from a given array of command-line arguments.
array | $argv | The argument array, not including the script itself. |
Definition at line 817 of file Maintenance.php.
Referenced by DumpBackup\__construct(), BackupDumper\__construct(), and TextPassDumper\__construct().
|
protected |
Maybe show the help.
If the help is shown, exit.
bool | $force | Whether to force the help to show, default false |
Reimplemented in CommandLineInc.
Definition at line 900 of file Maintenance.php.
Referenced by CreateAndPromote\execute(), GenerateJsonI18n\execute(), PurgeChangedFiles\execute(), PurgeChangedPages\execute(), UserOptionsMaintenance\execute(), and GetConfiguration\validateParamsAndArgs().
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.
Reimplemented in RunJobs.
Definition at line 766 of file Maintenance.php.
|
protected |
Throw some output to the user.
Scripts can call this with no fears, as we handle all –quiet stuff here
string | $out | The text to show to the user |
mixed | null | $channel | Unique identifier for the channel. See function outputChanneled. |
Definition at line 478 of file Maintenance.php.
References MediaWiki\emitBufferedStatsdData().
Referenced by DumpBackup\__construct(), TextPassDumper\__construct(), Benchmarker\addResult(), FindOrphanedFiles\checkFiles(), CleanupUsersWithNoId\cleanup(), ResetAuthenticationThrottle\clearLoginThrottle(), ResetAuthenticationThrottle\clearSignupThrottle(), CompareParsers\conclusions(), CopyFileBackend\copyFileBatch(), RunJobs\debugInternal(), CopyFileBackend\delFileBatch(), FixExtLinksProtocolRelative\doDBUpdates(), MigrateExternallinks\doDBUpdates(), MigrateLinksTable\doDBUpdates(), MigrateRevisionActorTemp\doDBUpdates(), MigrateRevisionCommentTemp\doDBUpdates(), PopulateBacklinkNamespace\doDBUpdates(), PopulateFilearchiveSha1\doDBUpdates(), PopulateImageSha1\doDBUpdates(), PopulateIpChanges\doDBUpdates(), PopulatePPSortKey\doDBUpdates(), PopulateRecentChangesSource\doDBUpdates(), PopulateRevisionLength\doDBUpdates(), PopulateRevisionSha1\doDBUpdates(), RefreshExternallinksIndex\doDBUpdates(), PopulateRevisionLength\doLenUpdates(), FileOpPerfTest\doPerfTest(), PopulateInterwiki\doPopulate(), PopulateRevisionSha1\doSha1Updates(), UpdateSpecialPages\doSpecialPageCacheUpdates(), RecountCategories\doWork(), AddChangeTag\execute(), AddSite\execute(), AttachLatest\execute(), BenchmarkPurge\execute(), BlockUsers\execute(), ChangePassword\execute(), CheckBadRedirects\execute(), CheckComposerLockUpToDate\execute(), CheckDependencies\execute(), CheckImages\execute(), CheckUsernames\execute(), CleanupBlocks\execute(), CleanupCaps\execute(), CleanupPreferences\execute(), CleanupRemovedModules\execute(), CleanupSpam\execute(), CleanupUploadStash\execute(), CleanupWatchlist\execute(), ClearInterwikiCache\execute(), CompareParserCache\execute(), ConvertExtensionToRegistration\execute(), CopyFileBackend\execute(), CopyJobQueue\execute(), CreateAndPromote\execute(), CreateBotPassword\execute(), DeleteArchivedFiles\execute(), DeleteArchivedRevisions\execute(), DeleteAutoPatrolLogs\execute(), DeleteBatch\execute(), DeleteDefaultMessages\execute(), DeleteEqualMessages\execute(), DeleteOldRevisions\execute(), DeleteOrphanedRevisions\execute(), DeleteSelfExternals\execute(), DeleteTag\execute(), DeleteUserEmail\execute(), DumpLinks\execute(), EditCLI\execute(), EmptyUserGroup\execute(), EraseArchivedFile\execute(), ExportSites\execute(), FetchText\execute(), FindBadBlobs\execute(), FindMissingActors\execute(), FindMissingFiles\execute(), FindOrphanedFiles\execute(), FixDoubleRedirects\execute(), FixMergeHistoryCorruption\execute(), FixTimestamps\execute(), FixUserRegistration\execute(), GenerateJsonI18n\execute(), GetConfiguration\execute(), GetLagTimes\execute(), GetReplicaServer\execute(), GetTextMaint\execute(), BackupReader\execute(), ImportImages\execute(), ImportSites\execute(), ImportSiteScripts\execute(), ImportTextFiles\execute(), DeleteLocalPasswords\execute(), LoggedUpdateMaintenance\execute(), InitEditCount\execute(), InitSiteStats\execute(), InitUserPreference\execute(), InvalidateBotPasswords\execute(), InvalidateUserSessions\execute(), JSParseHelper\execute(), DatabaseLag\execute(), AllTrans\execute(), DateFormats\execute(), Digit2Html\execute(), DumpMessages\execute(), LangMemUsage\execute(), MakeTestEdits\execute(), ManageForeignResources\execute(), McTest\execute(), GeneratePhpCharToUpperMappings\execute(), MigrateFileRepoLayout\execute(), MigrateUserGroup\execute(), MoveBatch\execute(), MWDocGen\execute(), NamespaceDupes\execute(), NukeNS\execute(), NukePage\execute(), PageExists\execute(), PatchSql\execute(), Protect\execute(), PruneFileCache\execute(), PruneUnusedLinkTargetRows\execute(), PurgeChangedPages\execute(), PurgeExpiredBlocks\execute(), PurgeExpiredUserrights\execute(), PurgeExpiredWatchlistItems\execute(), PurgeList\execute(), PurgeModuleDeps\execute(), PurgeParserCache\execute(), ReassignEdits\execute(), RebuildAll\execute(), RebuildFileCache\execute(), RebuildLocalisationCache\execute(), RebuildMessages\execute(), RebuildRecentchanges\execute(), RebuildTextIndex\execute(), RecountCategories\execute(), RefreshFileHeaders\execute(), RefreshImageMetadata\execute(), RemoveInvalidEmails\execute(), RemoveUnusedAccounts\execute(), RenameDbPrefix\execute(), RenameUser\execute(), RenameUsersMatchingPattern\execute(), ResetPageRandom\execute(), ResetUserEmail\execute(), RollbackEdits\execute(), RunBatchedQuery\execute(), RunJobs\execute(), ShowJobs\execute(), ShowSiteStats\execute(), CompressOld\execute(), DumpRev\execute(), MoveToExternal\execute(), OrphanStats\execute(), ResolveStubs\execute(), TableCleanup\execute(), Undelete\execute(), UpdateMediaWiki\execute(), UpdateArticleCount\execute(), UpdateCollation\execute(), UpdateExtensionJsonSchema\execute(), UpdateRestrictions\execute(), UpdateSpecialPages\execute(), ValidateRegistrationFile\execute(), ViewCLI\execute(), WikiBirthday\execute(), WrapOldPasswords\execute(), DeleteEqualMessages\fetchMessageInfo(), ImportSiteScripts\fetchScriptList(), DeleteLocalPasswords\getUserBatches(), ConvertExtensionToRegistration\handleExtensionMessagesFiles(), ConvertExtensionToRegistration\handleHooks(), DumpIterator\handleRevision(), DumpRenderer\handleRevision(), FixDefaultJsonContentPages\handleRow(), MWDocGen\init(), GenerateSitemap\main(), TitleCleanup\moveIllegalPage(), TitleCleanup\moveInconsistentPage(), RebuildTextIndex\populateSearchIndex(), CompareParsers\processRevision(), SearchDump\processRevision(), CleanupImages\processRow(), TitleCleanup\processRow(), CleanupWatchlist\processRow(), CleanupCaps\processRowToLowercase(), CleanupCaps\processRowToUppercase(), TableCleanup\progress(), PruneFileCache\prune_directory(), PurgeChangedFiles\purgeFromArchiveTable(), FixDoubleRedirects\queueJobs(), ImportSites\reportException(), ResolveStubs\resolveStub(), MigrateFileRepoLayout\runBatch(), TableCleanup\runTable(), EraseArchivedFile\scrubVersion(), CreateBotPassword\showGrants(), Mcc\showHelp(), PurgeParserCache\showProgressAndWait(), MwSql\sqlPrintResult(), Benchmarker\startBench(), GenerateJsonI18n\transformI18nFile(), PopulateRevisionSha1\upgradeRow(), PopulateRevisionLength\upgradeRow(), PurgeChangedFiles\verbose(), and Benchmarker\verboseRun().
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.
string | false | $msg | The message without trailing newline |
string | null | $channel | Channel identifier or null for no channel. Channel comparison uses ===. |
Definition at line 558 of file Maintenance.php.
|
protected |
Utility function to parse a string (perhaps from a command line option) into a list of integers (perhaps some kind of numeric IDs).
string | $text |
Definition at line 1449 of file Maintenance.php.
Referenced by FindMissingActors\execute().
|
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.
mixed | $fd | File descriptor |
Definition at line 1283 of file Maintenance.php.
Referenced by MWEval\execute(), FindDeprecated\execute(), and MwSql\execute().
Maintenance::purgeRedundantText | ( | $delete = true | ) |
Support function for cleaning up redundant text records.
bool | $delete | Whether or not to actually delete the records |
Definition at line 1094 of file Maintenance.php.
References $res, DB_PRIMARY, and getDB().
Referenced by DeleteArchivedRevisions\execute(), DeleteOrphanedRevisions\execute(), NukeNS\execute(), NukePage\execute(), and PurgeOldText\execute().
|
static |
Prompt the console for input.
string | $prompt | What to begin the line with, like '> ' |
Definition at line 1296 of file Maintenance.php.
Referenced by MWEval\execute(), FindMissingActors\execute(), Mcc\execute(), and MwSql\execute().
|
protected |
Indicate that the specified extension must be loaded before the script can run.
This must be called in the constructor.
string | $name |
Definition at line 673 of file Maintenance.php.
|
static |
Call this to set up the autoloader to allow classes to be used from the tests directory.
Definition at line 1407 of file Maintenance.php.
|
protected |
Rollback the transaction 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.
IDatabase | $dbw | |
string | $fname | Caller name |
Definition at line 1245 of file Maintenance.php.
References Wikimedia\Rdbms\IDatabase\rollback().
Maintenance::runChild | ( | $maintClass, | |
$classFile = null |
|||
) |
Run a child maintenance script.
Pass all of the current arguments to it.
string | $maintClass | A name of a child maintenance class |
string | null | $classFile | Full path of where the child is |
Definition at line 724 of file Maintenance.php.
References $maintClass.
Referenced by NukeNS\execute(), RebuildAll\execute(), RecountCategories\execute(), and UpdateMediaWiki\execute().
Maintenance::setAgentAndTriggers | ( | ) |
This method used to be for internal use by doMaintenance.php to apply some optional global state to LBFactory for debugging purposes.
This is now handled lazily by ServiceWiring.
Definition at line 712 of file Maintenance.php.
References wfDeprecated().
|
protected |
Sets whether to allow unregistered options, which are options passed to a script that do not match an expected parameter.
bool | $allow | Should we allow? |
Definition at line 332 of file Maintenance.php.
Referenced by CommandLineInc\__construct().
Maintenance::setArg | ( | $argId, | |
$value | |||
) |
Programmatically set the value of the given argument.
Useful for setting up child scripts, see runChild().
string | int | $argId | Arg index or name |
mixed | null | $value |
Definition at line 400 of file Maintenance.php.
|
protected |
int | $s | The number of operations to do in a batch |
Definition at line 418 of file Maintenance.php.
Referenced by CategoryChangesAsRdf\__construct(), CheckImages\__construct(), CheckUsernames\__construct(), CleanupBlocks\__construct(), CleanupInvalidDbKeys\__construct(), CleanupPreferences\__construct(), CleanupRemovedModules\__construct(), TitleCleanup\__construct(), CleanupUploadStash\__construct(), CleanupUsersWithNoId\__construct(), CopyFileBackend\__construct(), CopyJobQueue\__construct(), DeleteAutoPatrolLogs\__construct(), DeleteSelfExternals\__construct(), DeleteTag\__construct(), DumpCategoriesAsRdf\__construct(), EmptyUserGroup\__construct(), FindBadBlobs\__construct(), FindMissingActors\__construct(), FindMissingFiles\__construct(), FindOrphanedFiles\__construct(), FixDefaultJsonContentPages\__construct(), FixUserRegistration\__construct(), DeleteLocalPasswords\__construct(), LoggedUpdateMaintenance\__construct(), InitUserPreference\__construct(), InvalidateUserSessions\__construct(), MakeTestEdits\__construct(), ManageJobs\__construct(), MigrateExternallinks\__construct(), MigrateFileRepoLayout\__construct(), MigrateLinksTable\__construct(), MigrateUserGroup\__construct(), PopulateChangeTagDef\__construct(), PopulatePPSortKey\__construct(), PopulateRecentChangesSource\__construct(), PopulateRevisionLength\__construct(), PopulateRevisionSha1\__construct(), PruneUnusedLinkTargetRows\__construct(), PurgeChangedFiles\__construct(), PurgeChangedPages\__construct(), PurgeExpiredWatchlistItems\__construct(), PurgeList\__construct(), PurgeModuleDeps\__construct(), RebuildFileCache\__construct(), RebuildRecentchanges\__construct(), RecountCategories\__construct(), RefreshExternallinksIndex\__construct(), RefreshFileHeaders\__construct(), RefreshImageMetadata\__construct(), RefreshLinks\__construct(), RemoveInvalidEmails\__construct(), RenameUsersMatchingPattern\__construct(), ResetPageRandom\__construct(), MwSql\__construct(), MoveToExternal\__construct(), ResolveStubs\__construct(), TableCleanup\__construct(), UpdateCollation\__construct(), UpdateRestrictions\__construct(), UppercaseTitlesForUnicodeTransition\__construct(), UserOptionsMaintenance\__construct(), WrapOldPasswords\__construct(), PopulateChangeTagDef\doDBUpdates(), CopyFileBackend\execute(), and DeleteAutoPatrolLogs\execute().
Maintenance::setConfig | ( | Config | $config | ) |
Maintenance::setDB | ( | IMaintainableDatabase | $db | ) |
Sets database object to be returned by getDB().
@stable to override
IMaintainableDatabase | $db |
Reimplemented in BackupDumper.
Definition at line 1176 of file Maintenance.php.
Referenced by DatabaseUpdater\__construct().
Maintenance::setName | ( | string | $name | ) |
Maintenance::setOption | ( | string | $name, |
$value | |||
) |
Programmatically set the value of the given option.
Useful for setting up child scripts, see runChild().
string | $name | |
mixed | null | $value |
Definition at line 387 of file Maintenance.php.
Maintenance::setup | ( | ) |
Provides subclasses with an opportunity to perform initial checks.
Definition at line 755 of file Maintenance.php.
|
static |
Definition at line 215 of file Maintenance.php.
|
protected |
Definitely show the help.
Does not exit.
Reimplemented in Mcc.
Definition at line 917 of file Maintenance.php.
Maintenance::shutdown | ( | ) |
Call before exiting CLI process for the last DB commit, and flush any remaining buffers and other deferred work.
Equivalent to MediaWiki::restInPeace which handles shutdown for web requests, and should perform the same operations and in the same order.
Definition at line 1047 of file Maintenance.php.
References DeferredUpdates\doUpdates(), MediaWiki\emitBufferedStatsdData(), and Profiler\instance().
|
protected |
Checks to see if a particular option in supported.
Normally this means it has been registered by the script via addOption.
string | $name | The name of the option |
Definition at line 255 of file Maintenance.php.
Maintenance::validateParamsAndArgs | ( | ) |
Run some validation checks on the params, etc @stable to override.
Reimplemented in UpdateMediaWiki, CommandLineInstaller, and GetConfiguration.
Definition at line 870 of file Maintenance.php.
|
protected |
string | $errorMsg | Error message to be displayed if the passed –user or –userid does not result in a valid existing user object. |
Definition at line 1468 of file Maintenance.php.
References User\newFromId(), and User\newFromName().
Referenced by ChangePassword\execute(), and InvalidateBotPasswords\execute().
|
protected |
Wait for replica DBs to catch up.
Definition at line 1218 of file Maintenance.php.
Referenced by CleanupUsersWithNoId\cleanup(), CleanupInvalidDbKeys\cleanupTable(), FixExtLinksProtocolRelative\doDBUpdates(), MigrateRevisionActorTemp\doDBUpdates(), MigrateRevisionCommentTemp\doDBUpdates(), PopulateBacklinkNamespace\doDBUpdates(), PopulateFilearchiveSha1\doDBUpdates(), PopulateImageSha1\doDBUpdates(), PopulateIpChanges\doDBUpdates(), PopulateRecentChangesSource\doDBUpdates(), RefreshExternallinksIndex\doDBUpdates(), RecountCategories\doWork(), AttachLatest\execute(), CleanupUploadStash\execute(), DeleteBatch\execute(), DeleteDefaultMessages\execute(), DeleteEqualMessages\execute(), EmptyUserGroup\execute(), FixUserRegistration\execute(), ImportImages\execute(), InitEditCount\execute(), InvalidateUserSessions\execute(), MakeTestEdits\execute(), PruneUnusedLinkTargetRows\execute(), RefreshImageMetadata\execute(), RemoveInvalidEmails\execute(), RenameUsersMatchingPattern\execute(), ResetPageRandom\execute(), RunBatchedQuery\execute(), MwSql\execute(), WrapOldPasswords\execute(), FixDefaultJsonContentPages\handleRow(), and DeleteLocalPasswords\processUsers().
resource null Maintenance::$fileHandle |
Used when creating separate schema files.
Definition at line 154 of file Maintenance.php.
|
protected |
Empty.
Desired/allowed args
Definition at line 100 of file Maintenance.php.
|
protected |
This is the list of arguments that were actually passed.
Definition at line 112 of file Maintenance.php.
|
protected |
Batch size.
If a script supports this, they should set a default with setBatchSize()
Definition at line 139 of file Maintenance.php.
Maintenance::$mDbPass |
Definition at line 119 of file Maintenance.php.
|
protected |
Definition at line 119 of file Maintenance.php.
|
protected |
A description of the script, children should change this via addDescription()
Definition at line 125 of file Maintenance.php.
|
protected |
Have we already loaded our user input?
Definition at line 131 of file Maintenance.php.
|
protected |
This is the list of options that were actually passed.
Definition at line 106 of file Maintenance.php.
|
protected |
Empty.
Definition at line 93 of file Maintenance.php.
|
protected |
Special vars for params that are always used.
Definition at line 118 of file Maintenance.php.
|
protected |
Name of the script currently running.
Definition at line 115 of file Maintenance.php.
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 187 of file Maintenance.php.
Referenced by BackupDumper\processOptions().
|
protected |
Definition at line 85 of file Maintenance.php.
Referenced by getParameters().
const Maintenance::DB_ADMIN = 2 |
Definition at line 73 of file Maintenance.php.
Referenced by PatchSql\getDbType(), RebuildAll\getDbType(), RebuildTextIndex\getDbType(), RenameDbPrefix\getDbType(), RunBatchedQuery\getDbType(), MwSql\getDbType(), UpdateMediaWiki\getDbType(), and UpdateSearchIndex\getDbType().
const Maintenance::DB_NONE = 0 |
Constants for DB access type.
Definition at line 71 of file Maintenance.php.
Referenced by DumpIterator\finalSetup(), SearchDump\getDbType(), GenerateConfigSchema\getDbType(), CommandLineInstaller\getDbType(), GenerateNormalizerDataAr\getDbType(), GenerateNormalizerDataMl\getDbType(), MergeMessageFileList\getDbType(), MWDocGen\getDbType(), and RebuildLocalisationCache\getDbType().
const Maintenance::DB_STD = 1 |
Definition at line 72 of file Maintenance.php.
const Maintenance::GENERIC_MAINTENANCE_PARAMETERS = 'Script runner options' |
Definition at line 80 of file Maintenance.php.
Referenced by MediaWiki\Maintenance\MaintenanceRunner\addDefaultParams().
const Maintenance::SCRIPT_DEPENDENT_PARAMETERS = 'Common options' |
Definition at line 79 of file Maintenance.php.
const Maintenance::STDIN_ALL = -1 |
Definition at line 76 of file Maintenance.php.
Referenced by EditCLI\execute().