MediaWiki REL1_37
|
Abstract maintenance class for quickly writing and churning out maintenance scripts with minimal effort. More...
Public Member Functions | |
__construct () | |
Default constructor. | |
checkRequiredExtensions () | |
Verify that the required extensions are installed. | |
cleanupChanneled () | |
Clean up channeled output. | |
clearParamsAndArgs () | |
Clear all params and arguments. | |
execute () | |
Do the actual work. | |
finalSetup () | |
Handle some last-minute setup here. | |
getConfig () | |
getDbType () | |
Does the script need different DB access? By default, we give Maintenance scripts normal rights to the DB. | |
getName () | |
Get the script's name. | |
globals () | |
Potentially debug globals. | |
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. | |
loadSettings () | |
Generic setup for most installs. | |
loadWithArgv ( $argv) | |
Load params and arguments from a given array of command-line arguments. | |
memoryLimit () | |
Normally we disable the memory_limit when running admin scripts. | |
outputChanneled ( $msg, $channel=null) | |
Message outputter with channeled message support. | |
purgeRedundantText ( $delete=true) | |
Support function for cleaning up redundant text records. | |
runChild ( $maintClass, $classFile=null) | |
Run a child maintenance script. | |
setAgentAndTriggers () | |
This method used to be for internal use by doMaintenance.php to apply some optional global state to LBFactory for debugging purposes. | |
setConfig (Config $config) | |
setDB (IMaintainableDatabase $db) | |
Sets database object to be returned by getDB(). | |
setup () | |
Do some sanity checking and basic setup. | |
shutdown () | |
Call before shutdown to run any deferred updates. | |
validateParamsAndArgs () | |
Run some validation checks on the params, etc. | |
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). | |
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. | |
static | readconsole ( $prompt='> ') |
Prompt the console for input. | |
static | requireTestsAutoloader () |
Call this to set up the autoloader to allow classes to be used from the tests directory. | |
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) | |
Public Attributes | |
resource null | $fileHandle |
Used when creating separate schema files. | |
array | $orderedOptions = [] |
Used to read the options in the order they were passed. | |
const | DB_ADMIN = 2 |
const | DB_NONE = 0 |
Constants for DB access type. | |
const | DB_STD = 1 |
const | STDIN_ALL = -1 |
Protected Member Functions | |
activateProfiler () | |
Activate the profiler (assuming $wgProfiler is set) | |
addArg ( $arg, $description, $required=true) | |
Add some args that are needed. | |
addDefaultParams () | |
Add the default parameters to the scripts. | |
addDescription ( $text) | |
Set the description text. | |
addOption ( $name, $description, $required=false, $withArg=false, $shortName=false, $multiOccurrence=false) | |
Add a parameter to the script. | |
adjustMemoryLimit () | |
Adjusts PHP's memory limit to better suit our needs, if needed. | |
afterFinalSetup () | |
Execute a callback function at the end of initialisation. | |
beginTransaction (IDatabase $dbw, $fname) | |
Begin a transaction on a DB. | |
commitTransaction (IDatabase $dbw, $fname) | |
Commit the transaction on a DB handle and wait for replica DBs to catch up. | |
countDown ( $seconds) | |
Count down from $seconds to zero on the terminal, with a one-second pause between showing each number. | |
deleteOption ( $name) | |
Remove an option. | |
error ( $err, $die=0) | |
Throw an error to the user. | |
fatalError ( $msg, $exitCode=1) | |
Output a message and terminate the current script. | |
getArg ( $argId=0, $default=null) | |
Get an argument. | |
getBatchSize () | |
Returns batch size. | |
getDB ( $db, $groups=[], $dbDomain=false) | |
Returns a database to be used by current maintenance script. | |
getDir () | |
Get the maintenance directory. | |
getHookContainer () | |
Get a HookContainer, for running extension hooks or for hook metadata. | |
getHookRunner () | |
Get a HookRunner for running core hooks. | |
getOption ( $name, $default=null) | |
Get an option, or return the default. | |
getStdin ( $len=null) | |
Return input from stdin. | |
hasArg ( $argId=0) | |
Does a given argument exist? | |
hasOption ( $name) | |
Checks to see if a particular option was set. | |
loadSpecialVars () | |
Handle the special variables that are global to all scripts. | |
maybeHelp ( $force=false) | |
Maybe show the help. | |
output ( $out, $channel=null) | |
Throw some output to the user. | |
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). | |
requireExtension ( $name) | |
Indicate that the specified extension must be loaded before the script can run. | |
rollbackTransaction (IDatabase $dbw, $fname) | |
Rollback the transaction on a DB handle. | |
setAllowUnregisteredOptions ( $allow) | |
Sets whether to allow unregistered options, which are options passed to a script that do not match an expected parameter. | |
setBatchSize ( $s=0) | |
showHelp () | |
Definitely show the help. | |
supportsOption ( $name) | |
Checks to see if a particular option in supported. | |
validateUserOption ( $errorMsg) | |
waitForReplication () | |
Wait for replica DBs to catch up. | |
Protected Attributes | |
bool | $mAllowUnregisteredOptions = false |
Allow arbitrary options to be passed, or only specified ones? | |
array | $mArgList = [] |
Desired/allowed args. | |
array | $mArgs = [] |
This is the list of arguments that were actually passed. | |
int null | $mBatchSize = null |
Batch size. | |
$mDbPass | |
$mDbUser | |
string | $mDescription = '' |
A description of the script, children should change this via addDescription() | |
bool | $mInputLoaded = false |
Have we already loaded our user input? | |
array | $mOptions = [] |
This is the list of options that were actually passed. | |
array[] | $mParams = [] |
Array of desired/allowed params. | |
bool | $mQuiet = false |
Special vars for params that are always used. | |
string null | $mSelf |
Name of the script currently running. | |
array | $mShortParamsMap = [] |
Mapping short parameters to long ones. | |
Private Member Functions | |
formatHelpItems (array $items, $heading, $descWidth, $tab) | |
setParam (&$options, $option, $value) | |
Helper function used solely by loadParamsAndArgs to prevent code duplication. | |
Static Private Member Functions | |
static | readlineEmulation ( $prompt) |
Emulate readline() | |
Private Attributes | |
$atLineStart = true | |
Config null | $config |
Accessible via getConfig() | |
HookContainer null | $hookContainer |
HookRunner null | $hookRunner |
$lastChannel = null | |
float | $lastReplicationWait = 0.0 |
UNIX timestamp. | |
IMaintainableDatabase null | $mDb = null |
Used by getDB() / setDB() | |
array[] | $mDependentParameters = [] |
Generic options which might or not be supported by the script. | |
array[] | $mGenericParameters = [] |
Generic options added by addDefaultParams() | |
array | $requiredExtensions = [] |
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 59 of file Maintenance.php.
Maintenance::__construct | ( | ) |
Default constructor.
Children should call this first if implementing their own constructors
Reimplemented in AddChangeTag, AddRFCandPMIDInterwiki, AddSite, AttachLatest, BenchmarkCommentFormatter, BenchmarkEval, BenchmarkHooks, BenchmarkJSMinPlus, BenchmarkLruHash, BenchmarkParse, BenchmarkPurge, BenchmarkSanitizer, BenchmarkTidy, BenchmarkTitleValue, BlockUsers, CategoryChangesAsRdf, ChangePassword, CheckBadRedirects, CheckComposerLockUpToDate, CheckDependencies, CheckImages, CheckUsernames, CleanupBlocks, CleanupCaps, CleanupEmptyCategories, CleanupImages, CleanupInvalidDbKeys, CleanupPreferences, CleanupRemovedModules, CleanupRevActorPage, CleanupSpam, TitleCleanup, CleanupUploadStash, CleanupUsersWithNoId, CleanupWatchlist, ClearInterwikiCache, CommandLineInc, CompareParserCache, CompareParsers, ConvertExtensionToRegistration, CopyFileBackend, CopyJobQueue, CreateAndPromote, CreateBotPassword, DeduplicateArchiveRevId, DeleteArchivedFiles, DeleteArchivedRevisions, DeleteAutoPatrolLogs, DeleteBatch, DeleteDefaultMessages, DeleteEqualMessages, DeleteOldRevisions, DeleteOrphanedRevisions, DeleteSelfExternals, DeleteTag, DumpCategoriesAsRdf, DumpIterator, SearchDump, DumpLinks, DumpUploads, EditCLI, EmptyUserGroup, EraseArchivedFile, ExportSites, FetchText, FileOpPerfTest, FindBadBlobs, FindClasses, FindDeprecated, FindMissingActors, FindMissingFiles, FindOrphanedFiles, FixDefaultJsonContentPages, FixDoubleRedirects, FixExtLinksProtocolRelative, FixMergeHistoryCorruption, FixTimestamps, FixUserRegistration, FormatInstallDoc, GenerateJsonI18n, GenerateSchemaChangeSql, GenerateSchemaSql, GenerateSitemap, GetConfiguration, GetLagTimes, GetReplicaServer, GetTextMaint, BackupReader, ImportImages, ImportSites, ImportSiteScripts, ImportTextFiles, Benchmarker, DeleteLocalPasswords, LoggedUpdateMaintenance, MigrateActors, InitEditCount, InitSiteStats, InitUserPreference, CommandLineInstaller, InvalidateBotPasswords, InvalidateUserSessions, JSParseHelper, DatabaseLag, AllTrans, DateFormats, Digit2Html, DumpMessages, GenerateCollationData, GenerateNormalizerDataAr, GenerateNormalizerDataMl, GenerateUcfirstOverrides, GenerateUpperCharTable, LangMemUsage, ListVariants, MakeTestEdits, ManageForeignResources, ManageJobs, McTest, GeneratePhpCharToUpperMappings, MergeMessageFileList, MigrateArchiveText, MigrateComments, MigrateFileRepoLayout, MigrateImageCommentTemp, MigrateRevisionActorTemp, MigrateUserGroup, MoveBatch, MWDocGen, MysqlMaintenance, NamespaceDupes, NukeNS, NukePage, Orphans, PageExists, CLIParser, PatchSql, PopulateArchiveRevId, PopulateBacklinkNamespace, PopulateChangeTagDef, PopulateContentTables, PopulateExternallinksIndex60, PopulateFilearchiveSha1, PopulateImageSha1, PopulateInterwiki, PopulateIpChanges, PopulatePPSortKey, PopulateRecentChangesSource, PopulateRevisionLength, PopulateRevisionSha1, Protect, PruneFileCache, PurgeChangedFiles, PurgeChangedPages, PurgeExpiredBlocks, PurgeExpiredUserrights, PurgeExpiredWatchlistItems, PurgeList, PurgeModuleDeps, PurgeOldText, PurgePage, PurgeParserCache, ReassignEdits, RebuildAll, RebuildFileCache, ImageBuilder, RebuildLocalisationCache, RebuildMessages, RebuildRecentchanges, RebuildTextIndex, RecountCategories, RefreshExternallinksIndex, RefreshFileHeaders, RefreshImageMetadata, RefreshLinks, RemoveInvalidEmails, RemoveUnusedAccounts, RenameDbPrefix, RenameRestrictions, DumpRenderer, ResetAuthenticationThrottle, ResetPageRandom, ResetUserEmail, ResetUserTokens, RollbackEdits, RunBatchedQuery, RunJobs, MediaWikiShell, ShowJobs, ShowSiteStats, MwSql, SqliteMaintenance, CompressOld, DumpRev, OrphanStats, SyncFileBackend, TableCleanup, Undelete, UpdateMediaWiki, UpdateArticleCount, UpdateCollation, UpdateExtensionJsonSchema, UpdateRestrictions, UpdateSearchIndex, UpdateSpecialPages, UppercaseTitlesForUnicodeTransition, UserOptionsMaintenance, ValidateRegistrationFile, Version, ViewCLI, and WrapOldPasswords.
Definition at line 180 of file Maintenance.php.
References addDefaultParams().
|
protected |
Activate the profiler (assuming $wgProfiler is set)
Definition at line 776 of file Maintenance.php.
References $wgProfiler, $wgTrxProfilerLimits, and getOption().
Referenced by finalSetup().
|
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? |
Definition at line 300 of file Maintenance.php.
Referenced by AddSite\__construct(), BenchmarkEval\__construct(), BenchmarkParse\__construct(), BlockUsers\__construct(), CleanupSpam\__construct(), ConvertExtensionToRegistration\__construct(), CreateAndPromote\__construct(), CreateBotPassword\__construct(), DeleteBatch\__construct(), DeleteTag\__construct(), EditCLI\__construct(), EmptyUserGroup\__construct(), ExportSites\__construct(), FixTimestamps\__construct(), FormatInstallDoc\__construct(), GenerateJsonI18n\__construct(), GetTextMaint\__construct(), BackupReader\__construct(), ImportImages\__construct(), ImportSites\__construct(), ImportSiteScripts\__construct(), ImportTextFiles\__construct(), CommandLineInstaller\__construct(), JSParseHelper\__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(), ResetUserEmail\__construct(), DumpRev\__construct(), Undelete\__construct(), UpdateExtensionJsonSchema\__construct(), UserOptionsMaintenance\__construct(), ValidateRegistrationFile\__construct(), and ViewCLI\__construct().
|
protected |
Add the default parameters to the scripts.
Definition at line 556 of file Maintenance.php.
References $mParams, addOption(), and getDbType().
Referenced by __construct().
|
protected |
Set the description text.
string | $text | The text of the description |
Definition at line 329 of file Maintenance.php.
Referenced by DumpBackup\__construct(), TextPassDumper\__construct(), AddChangeTag\__construct(), AddRFCandPMIDInterwiki\__construct(), AddSite\__construct(), AttachLatest\__construct(), BenchmarkCommentFormatter\__construct(), BenchmarkHooks\__construct(), BenchmarkJSMinPlus\__construct(), BenchmarkLruHash\__construct(), BenchmarkParse\__construct(), BenchmarkPurge\__construct(), BenchmarkSanitizer\__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(), CleanupRevActorPage\__construct(), CleanupSpam\__construct(), TitleCleanup\__construct(), CleanupUploadStash\__construct(), CleanupUsersWithNoId\__construct(), CleanupWatchlist\__construct(), ClearInterwikiCache\__construct(), CompareParserCache\__construct(), CompareParsers\__construct(), ConvertExtensionToRegistration\__construct(), CopyFileBackend\__construct(), CopyJobQueue\__construct(), CreateAndPromote\__construct(), CreateBotPassword\__construct(), DeduplicateArchiveRevId\__construct(), DeleteArchivedFiles\__construct(), DeleteArchivedRevisions\__construct(), DeleteAutoPatrolLogs\__construct(), DeleteBatch\__construct(), DeleteDefaultMessages\__construct(), DeleteEqualMessages\__construct(), DeleteOldRevisions\__construct(), DeleteOrphanedRevisions\__construct(), DeleteSelfExternals\__construct(), DeleteTag\__construct(), DumpCategoriesAsRdf\__construct(), DumpIterator\__construct(), SearchDump\__construct(), DumpLinks\__construct(), DumpUploads\__construct(), EditCLI\__construct(), EmptyUserGroup\__construct(), EraseArchivedFile\__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(), GenerateJsonI18n\__construct(), GenerateSchemaChangeSql\__construct(), GenerateSchemaSql\__construct(), GenerateSitemap\__construct(), GetConfiguration\__construct(), GetLagTimes\__construct(), GetReplicaServer\__construct(), GetTextMaint\__construct(), BackupReader\__construct(), ImportImages\__construct(), ImportSites\__construct(), ImportSiteScripts\__construct(), ImportTextFiles\__construct(), DeleteLocalPasswords\__construct(), MigrateActors\__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(), McTest\__construct(), GeneratePhpCharToUpperMappings\__construct(), MergeMessageFileList\__construct(), MigrateArchiveText\__construct(), MigrateComments\__construct(), MigrateFileRepoLayout\__construct(), MigrateImageCommentTemp\__construct(), MigrateRevisionActorTemp\__construct(), MigrateUserGroup\__construct(), MoveBatch\__construct(), MWDocGen\__construct(), MysqlMaintenance\__construct(), NamespaceDupes\__construct(), NukeNS\__construct(), NukePage\__construct(), Orphans\__construct(), PageExists\__construct(), CLIParser\__construct(), PatchSql\__construct(), PopulateArchiveRevId\__construct(), PopulateBacklinkNamespace\__construct(), PopulateChangeTagDef\__construct(), PopulateContentTables\__construct(), PopulateExternallinksIndex60\__construct(), PopulateFilearchiveSha1\__construct(), PopulateImageSha1\__construct(), PopulateInterwiki\__construct(), PopulateIpChanges\__construct(), PopulatePPSortKey\__construct(), PopulateRecentChangesSource\__construct(), PopulateRevisionLength\__construct(), PopulateRevisionSha1\__construct(), Protect\__construct(), PruneFileCache\__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(), DumpRenderer\__construct(), ResetAuthenticationThrottle\__construct(), ResetPageRandom\__construct(), ResetUserEmail\__construct(), ResetUserTokens\__construct(), RollbackEdits\__construct(), RunBatchedQuery\__construct(), RunJobs\__construct(), ShowJobs\__construct(), ShowSiteStats\__construct(), MwSql\__construct(), SqliteMaintenance\__construct(), CompressOld\__construct(), OrphanStats\__construct(), SyncFileBackend\__construct(), Undelete\__construct(), UpdateMediaWiki\__construct(), UpdateArticleCount\__construct(), UpdateCollation\__construct(), UpdateExtensionJsonSchema\__construct(), UpdateRestrictions\__construct(), UpdateSearchIndex\__construct(), UppercaseTitlesForUnicodeTransition\__construct(), UserOptionsMaintenance\__construct(), Version\__construct(), ViewCLI\__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 249 of file Maintenance.php.
Referenced by DumpBackup\__construct(), BackupDumper\__construct(), TextPassDumper\__construct(), AddChangeTag\__construct(), AddSite\__construct(), AttachLatest\__construct(), BenchmarkCommentFormatter\__construct(), BenchmarkEval\__construct(), BenchmarkJSMinPlus\__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(), FileOpPerfTest\__construct(), FindBadBlobs\__construct(), FindMissingActors\__construct(), FindMissingFiles\__construct(), FindOrphanedFiles\__construct(), FixDoubleRedirects\__construct(), FixMergeHistoryCorruption\__construct(), FormatInstallDoc\__construct(), GenerateJsonI18n\__construct(), GenerateSchemaChangeSql\__construct(), GenerateSchemaSql\__construct(), GenerateSitemap\__construct(), GetConfiguration\__construct(), GetLagTimes\__construct(), GetReplicaServer\__construct(), GetTextMaint\__construct(), BackupReader\__construct(), ImportImages\__construct(), ImportSiteScripts\__construct(), ImportTextFiles\__construct(), Benchmarker\__construct(), DeleteLocalPasswords\__construct(), LoggedUpdateMaintenance\__construct(), MigrateActors\__construct(), InitEditCount\__construct(), InitSiteStats\__construct(), InitUserPreference\__construct(), CommandLineInstaller\__construct(), InvalidateBotPasswords\__construct(), InvalidateUserSessions\__construct(), DatabaseLag\__construct(), GenerateCollationData\__construct(), GenerateNormalizerDataAr\__construct(), GenerateUcfirstOverrides\__construct(), GenerateUpperCharTable\__construct(), ListVariants\__construct(), MakeTestEdits\__construct(), ManageForeignResources\__construct(), ManageJobs\__construct(), McTest\__construct(), MergeMessageFileList\__construct(), MigrateArchiveText\__construct(), MigrateFileRepoLayout\__construct(), MoveBatch\__construct(), MWDocGen\__construct(), MysqlMaintenance\__construct(), NamespaceDupes\__construct(), NukeNS\__construct(), NukePage\__construct(), Orphans\__construct(), CLIParser\__construct(), PopulateBacklinkNamespace\__construct(), PopulateChangeTagDef\__construct(), PopulateContentTables\__construct(), PopulateImageSha1\__construct(), PopulateInterwiki\__construct(), PopulateIpChanges\__construct(), Protect\__construct(), PruneFileCache\__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(), DumpRenderer\__construct(), ResetAuthenticationThrottle\__construct(), ResetPageRandom\__construct(), ResetUserEmail\__construct(), ResetUserTokens\__construct(), RollbackEdits\__construct(), RunBatchedQuery\__construct(), RunJobs\__construct(), MediaWikiShell\__construct(), ShowJobs\__construct(), MwSql\__construct(), SqliteMaintenance\__construct(), CompressOld\__construct(), SyncFileBackend\__construct(), TableCleanup\__construct(), Undelete\__construct(), UpdateMediaWiki\__construct(), UpdateArticleCount\__construct(), UpdateCollation\__construct(), UpdateSearchIndex\__construct(), UpdateSpecialPages\__construct(), UppercaseTitlesForUnicodeTransition\__construct(), UserOptionsMaintenance\__construct(), WrapOldPasswords\__construct(), addDefaultParams(), setBatchSize(), and UpdateMediaWiki\validateParamsAndArgs().
|
protected |
Adjusts PHP's memory limit to better suit our needs, if needed.
Definition at line 763 of file Maintenance.php.
References memoryLimit().
Referenced by finalSetup(), and setup().
|
protected |
Execute a callback function at the end of initialisation.
Reimplemented in UpdateMediaWiki.
Definition at line 1215 of file Maintenance.php.
Referenced by finalSetup().
|
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 1393 of file Maintenance.php.
References Wikimedia\Rdbms\IDatabase\begin().
Referenced by CleanupSpam\cleanupArticle(), CompressOld\compressWithConcat(), CleanupPreferences\deleteByWhere(), NukePage\deleteRevisions(), DeduplicateArchiveRevId\doDBUpdates(), MigrateArchiveText\doDBUpdates(), MigrateImageCommentTemp\doDBUpdates(), PopulatePPSortKey\doDBUpdates(), DeleteOldRevisions\doDelete(), PopulateRevisionLength\doLenUpdates(), ReassignEdits\doReassignEdits(), PopulateRevisionSha1\doSha1LegacyUpdates(), PopulateRevisionSha1\doSha1Updates(), CleanupRemovedModules\execute(), DeleteArchivedFiles\execute(), DeleteOrphanedRevisions\execute(), MigrateUserGroup\execute(), MoveBatch\execute(), NukeNS\execute(), NukePage\execute(), PurgeModuleDeps\execute(), RebuildFileCache\execute(), UpdateCollation\execute(), UpdateRestrictions\execute(), WrapOldPasswords\execute(), RemoveUnusedAccounts\isInactiveAccount(), NamespaceDupes\mergePage(), MigrateActors\migrateToTemp(), MigrateComments\migrateToTemp(), CleanupImages\pokeFile(), PopulateContentTables\populateContentTablesForRowBatch(), and purgeRedundantText().
Maintenance::checkRequiredExtensions | ( | ) |
Verify that the required extensions are installed.
Definition at line 632 of file Maintenance.php.
References fatalError().
Maintenance::cleanupChanneled | ( | ) |
Clean up channeled output.
Output a newline if necessary.
Definition at line 500 of file Maintenance.php.
References print.
Referenced by output(), and outputChanneled().
Maintenance::clearParamsAndArgs | ( | ) |
Clear all params and arguments.
Definition at line 804 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 1408 of file Maintenance.php.
References Wikimedia\Rdbms\IDatabase\commit(), and waitForReplication().
Referenced by CleanupSpam\cleanupArticle(), CompressOld\compressWithConcat(), CleanupPreferences\deleteByWhere(), NukePage\deleteRevisions(), DeduplicateArchiveRevId\doDBUpdates(), MigrateArchiveText\doDBUpdates(), MigrateImageCommentTemp\doDBUpdates(), PopulatePPSortKey\doDBUpdates(), DeleteOldRevisions\doDelete(), PopulateRevisionLength\doLenUpdates(), ReassignEdits\doReassignEdits(), PopulateRevisionSha1\doSha1LegacyUpdates(), PopulateRevisionSha1\doSha1Updates(), CleanupRemovedModules\execute(), DeleteArchivedFiles\execute(), DeleteOrphanedRevisions\execute(), DeleteSelfExternals\execute(), MigrateUserGroup\execute(), MoveBatch\execute(), NukeNS\execute(), NukePage\execute(), PurgeModuleDeps\execute(), RebuildFileCache\execute(), UpdateCollation\execute(), UpdateRestrictions\execute(), WrapOldPasswords\execute(), RemoveUnusedAccounts\isInactiveAccount(), NamespaceDupes\mergePage(), MigrateActors\migrateToTemp(), MigrateComments\migrateToTemp(), CleanupImages\pokeFile(), PopulateContentTables\populateContentTablesForRowBatch(), and purgeRedundantText().
|
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.
int | $seconds |
Definition at line 1452 of file Maintenance.php.
References isQuiet(), and output().
Referenced by DeleteAutoPatrolLogs\execute(), ResetUserTokens\execute(), UpdateMediaWiki\execute(), and UserOptionsMaintenance\warn().
|
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 312 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 464 of file Maintenance.php.
References fatalError(), outputChanneled(), print, and wfDeprecated().
Referenced by MigrateActors\addActorsForRows(), SqliteMaintenance\backup(), CleanupImages\buildSafeTitle(), FindOrphanedFiles\checkFiles(), SqliteMaintenance\checkSyntax(), CleanupSpam\cleanupArticle(), CompressOld\compressPage(), CompressOld\compressWithConcat(), CompareParsers\conclusions(), CopyFileBackend\copyFileBatch(), CopyFileBackend\delFileBatch(), FixExtLinksProtocolRelative\doDBUpdates(), MigrateActors\doDBUpdates(), MigrateArchiveText\doDBUpdates(), MigrateImageCommentTemp\doDBUpdates(), MigrateRevisionActorTemp\doDBUpdates(), PopulateRecentChangesSource\doDBUpdates(), RefreshExternallinksIndex\doDBUpdates(), UppercaseTitlesForUnicodeTransition\doMove(), CleanupUploadStash\doOperations(), UpdateSpecialPages\doSpecialPageCacheUpdates(), UppercaseTitlesForUnicodeTransition\doUpdate(), AddSite\execute(), BenchmarkPurge\execute(), CategoryChangesAsRdf\execute(), CreateAndPromote\execute(), DeleteArchivedFiles\execute(), DumpIterator\execute(), FixDoubleRedirects\execute(), GenerateJsonI18n\execute(), ImportSiteScripts\execute(), ImportTextFiles\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(), DumpRenderer\execute(), ResetUserEmail\execute(), RollbackEdits\execute(), SqliteMaintenance\execute(), CompressOld\execute(), UpdateSearchIndex\execute(), UppercaseTitlesForUnicodeTransition\execute(), fatalError(), DumpIterator\handleRevision(), DumpRenderer\handleRevision(), FindBadBlobs\handleStatus(), SqliteMaintenance\integrityCheck(), loadWithArgv(), MigrateActors\migrate(), MigrateActors\migrateLogSearch(), MigrateActors\migrateToTemp(), UppercaseTitlesForUnicodeTransition\mungeTitle(), CleanupImages\pokeFile(), CompareParsers\processRevision(), UppercaseTitlesForUnicodeTransition\processUsers(), PurgePage\purge(), PurgeChangedFiles\purgeFromArchiveTable(), PurgeChangedFiles\purgeFromLogType(), MergeMessageFileList\readFile(), RefreshLinks\refreshTrackingCategory(), UpdateSpecialPages\reopenAndWaitForReplicas(), CommandLineInstaller\setDbPassOption(), setParam(), CommandLineInstaller\setPassOption(), MwSql\sqlDoQuery(), SyncFileBackend\syncBackends(), SyncFileBackend\syncFileBatch(), RefreshFileHeaders\updateFileHeaders(), GetConfiguration\validateParamsAndArgs(), validateParamsAndArgs(), and CLIParser\Wikitext().
|
abstract |
Do the actual work.
All child classes will need to implement this
Reimplemented in AddChangeTag, AddSite, AttachLatest, BenchmarkCommentFormatter, BenchmarkEval, BenchmarkHooks, BenchmarkJSMinPlus, BenchmarkLruHash, BenchmarkParse, BenchmarkPurge, BenchmarkSanitizer, BenchmarkTidy, BenchmarkTitleValue, BlockUsers, CategoryChangesAsRdf, ChangePassword, CheckBadRedirects, CheckComposerLockUpToDate, CheckDependencies, CheckImages, CheckUsernames, CleanupBlocks, CleanupCaps, CleanupInvalidDbKeys, CleanupPreferences, CleanupRemovedModules, CleanupSpam, CleanupUploadStash, CleanupWatchlist, ClearInterwikiCache, CommandLineInc, CompareParserCache, ConvertExtensionToRegistration, CopyFileBackend, CopyJobQueue, CreateAndPromote, CreateBotPassword, DeleteArchivedFiles, DeleteArchivedRevisions, DeleteAutoPatrolLogs, DeleteBatch, DeleteDefaultMessages, DeleteEqualMessages, DeleteOldRevisions, DeleteOrphanedRevisions, DeleteSelfExternals, DeleteTag, DumpBackup, DumpCategoriesAsRdf, DumpIterator, DumpLinks, DumpUploads, EditCLI, EmptyUserGroup, EraseArchivedFile, ExportSites, FetchText, FileOpPerfTest, FindBadBlobs, FindClasses, FindDeprecated, FindMissingActors, FindMissingFiles, FindOrphanedFiles, FixDoubleRedirects, FixMergeHistoryCorruption, FixTimestamps, FixUserRegistration, FormatInstallDoc, GenerateJsonI18n, GenerateSchemaChangeSql, GenerateSchemaSql, GenerateSitemap, GetConfiguration, GetLagTimes, GetReplicaServer, GetTextMaint, BackupReader, ImportImages, ImportSites, ImportSiteScripts, ImportTextFiles, BackupDumper, DeleteLocalPasswords, FakeMaintenance, LoggedUpdateMaintenance, TextPassDumper, InitEditCount, InitSiteStats, InitUserPreference, CommandLineInstaller, InvalidateBotPasswords, InvalidateUserSessions, JSParseHelper, DatabaseLag, AllTrans, DateFormats, Digit2Html, DumpMessages, GenerateCollationData, GenerateNormalizerDataAr, GenerateNormalizerDataMl, GenerateUcfirstOverrides, GenerateUpperCharTable, LangMemUsage, ListVariants, MakeTestEdits, ManageForeignResources, ManageJobs, McTest, GeneratePhpCharToUpperMappings, MergeMessageFileList, MigrateFileRepoLayout, MigrateUserGroup, MoveBatch, MWDocGen, MysqlMaintenance, NamespaceDupes, NukeNS, NukePage, Orphans, PageExists, CLIParser, PatchSql, PopulateContentTables, PopulateImageSha1, PopulateInterwiki, Protect, PruneFileCache, PurgeChangedFiles, PurgeChangedPages, PurgeExpiredBlocks, PurgeExpiredUserrights, PurgeExpiredWatchlistItems, PurgeList, PurgeMessageBlobStore, PurgeModuleDeps, PurgeOldText, PurgePage, PurgeParserCache, ReassignEdits, RebuildAll, RebuildFileCache, ImageBuilder, RebuildLocalisationCache, RebuildMessages, RebuildRecentchanges, RebuildTextIndex, RecountCategories, RefreshFileHeaders, RefreshImageMetadata, RefreshLinks, RemoveInvalidEmails, RemoveUnusedAccounts, RenameDbPrefix, RenameRestrictions, DumpRenderer, ResetAuthenticationThrottle, ResetPageRandom, ResetUserEmail, ResetUserTokens, RollbackEdits, RunBatchedQuery, RunJobs, MediaWikiShell, ShowJobs, ShowSiteStats, MwSql, SqliteMaintenance, CompressOld, DumpRev, OrphanStats, StorageTypeStats, SyncFileBackend, TableCleanup, TidyUpT39714, Undelete, UpdateMediaWiki, UpdateArticleCount, UpdateCollation, UpdateExtensionJsonSchema, UpdateRestrictions, UpdateSearchIndex, UpdateSpecialPages, UppercaseTitlesForUnicodeTransition, UserOptionsMaintenance, ValidateRegistrationFile, Version, ViewCLI, and WrapOldPasswords.
|
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 489 of file Maintenance.php.
References error().
Referenced by checkRequiredExtensions(), ResetAuthenticationThrottle\clearLoginThrottle(), UpdateMediaWiki\compatChecks(), CopyFileBackend\copyFileBatch(), CopyFileBackend\delFileBatch(), PopulateImageSha1\doDBUpdates(), PopulateIpChanges\doDBUpdates(), PopulateRevisionLength\doDBUpdates(), PopulateRevisionSha1\doDBUpdates(), error(), AddChangeTag\execute(), BenchmarkCommentFormatter\execute(), BenchmarkEval\execute(), BenchmarkJSMinPlus\execute(), BenchmarkParse\execute(), BenchmarkTidy\execute(), BlockUsers\execute(), ChangePassword\execute(), CheckComposerLockUpToDate\execute(), CleanupSpam\execute(), CleanupUploadStash\execute(), ConvertExtensionToRegistration\execute(), CopyFileBackend\execute(), CopyJobQueue\execute(), CreateAndPromote\execute(), CreateBotPassword\execute(), DeleteBatch\execute(), DeleteDefaultMessages\execute(), DeleteEqualMessages\execute(), DeleteSelfExternals\execute(), DeleteTag\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(), GenerateSchemaChangeSql\execute(), GenerateSchemaSql\execute(), GenerateSitemap\execute(), GetTextMaint\execute(), BackupReader\execute(), ImportImages\execute(), ImportTextFiles\execute(), InvalidateUserSessions\execute(), JSParseHelper\execute(), GenerateCollationData\execute(), GenerateNormalizerDataAr\execute(), LangMemUsage\execute(), MakeTestEdits\execute(), ManageForeignResources\execute(), ManageJobs\execute(), McTest\execute(), GeneratePhpCharToUpperMappings\execute(), MergeMessageFileList\execute(), MigrateFileRepoLayout\execute(), MigrateUserGroup\execute(), MoveBatch\execute(), MWDocGen\execute(), MysqlMaintenance\execute(), Protect\execute(), PruneFileCache\execute(), PurgeList\execute(), PurgeParserCache\execute(), RebuildFileCache\execute(), RebuildLocalisationCache\execute(), RebuildRecentchanges\execute(), RebuildTextIndex\execute(), RecountCategories\execute(), RefreshImageMetadata\execute(), RefreshLinks\execute(), RemoveUnusedAccounts\execute(), RenameDbPrefix\execute(), DumpRenderer\execute(), ResetAuthenticationThrottle\execute(), ResetUserEmail\execute(), RollbackEdits\execute(), RunJobs\execute(), MediaWikiShell\execute(), MwSql\execute(), CompressOld\execute(), DumpRev\execute(), OrphanStats\execute(), StorageTypeStats\execute(), SyncFileBackend\execute(), Undelete\execute(), UpdateMediaWiki\execute(), UpdateExtensionJsonSchema\execute(), UpdateRestrictions\execute(), UpdateSpecialPages\execute(), UppercaseTitlesForUnicodeTransition\execute(), ValidateRegistrationFile\execute(), Version\execute(), ViewCLI\execute(), WrapOldPasswords\execute(), GenerateCollationData\generateFirstChars(), CopyFileBackend\getListingDiffRel(), FindMissingActors\getNewActorId(), BackupReader\getNsIndex(), RefreshLinks\getPossibleCategories(), FindBadBlobs\getStartTimestamp(), PopulateContentTables\getTables(), ConvertExtensionToRegistration\handleExtensionFunctions(), ConvertExtensionToRegistration\handleHooks(), FindBadBlobs\handleStatus(), BackupReader\importFromHandle(), ReassignEdits\initialiseUser(), DeleteLocalPasswords\initialize(), GenerateUcfirstOverrides\loadJson(), loadSettings(), CheckDependencies\loadThing(), TitleCleanup\moveInconsistentPage(), RefreshImageMetadata\newLocalRepo(), PopulateContentTables\populateContentTablesForRowBatch(), DumpBackup\processOptions(), BackupDumper\processOptions(), runChild(), MysqlMaintenance\runMysql(), CommandLineInstaller\setDbPassOption(), CommandLineInstaller\setPassOption(), setup(), UserOptionsMaintenance\showUsageStats(), MwSql\sqlDoQuery(), SyncFileBackend\syncBackends(), GenerateJsonI18n\transformI18nFile(), SqliteMaintenance\vacuum(), and validateUserOption().
Maintenance::finalSetup | ( | ) |
Handle some last-minute setup here.
Reimplemented in DumpIterator, GetConfiguration, TextPassDumper, MergeMessageFileList, RebuildFileCache, RebuildLocalisationCache, and RunJobs.
Definition at line 1129 of file Maintenance.php.
References $mDbPass, $mDbUser, $wgCommandLineMode, $wgDBadminpassword, $wgDBadminuser, $wgDBDefaultGroup, $wgDBpassword, $wgDBservers, $wgDBuser, $wgLBFactoryConf, $wgServer, $wgShowExceptionDetails, $wgShowHostnames, activateProfiler(), adjustMemoryLimit(), afterFinalSetup(), getDbType(), getOption(), and hasOption().
|
private |
|
protected |
Get an argument.
int | $argId | The integer value (from zero) for the arg |
mixed | null | $default | The default if it doesn't exist |
Definition at line 353 of file Maintenance.php.
References wfDeprecated().
Referenced by AddSite\execute(), BenchmarkEval\execute(), BenchmarkParse\execute(), BlockUsers\execute(), CleanupSpam\execute(), ConvertExtensionToRegistration\execute(), CreateAndPromote\execute(), CreateBotPassword\execute(), DeleteBatch\execute(), DeleteTag\execute(), EditCLI\execute(), EmptyUserGroup\execute(), ExportSites\execute(), FixTimestamps\execute(), FormatInstallDoc\execute(), GenerateJsonI18n\execute(), GetTextMaint\execute(), BackupReader\execute(), ImportImages\execute(), ImportSites\execute(), ImportSiteScripts\execute(), ImportTextFiles\execute(), CommandLineInstaller\execute(), ManageForeignResources\execute(), McTest\execute(), MigrateUserGroup\execute(), MoveBatch\execute(), NukePage\execute(), PageExists\execute(), Protect\execute(), ReassignEdits\execute(), RefreshLinks\execute(), RenameRestrictions\execute(), ResetUserEmail\execute(), MwSql\execute(), DumpRev\execute(), Undelete\execute(), UpdateExtensionJsonSchema\execute(), ValidateRegistrationFile\execute(), ViewCLI\execute(), ImportSiteScripts\fetchScriptList(), UserOptionsMaintenance\showUsageStats(), UserOptionsMaintenance\updateOptions(), and CLIParser\Wikitext().
|
protected |
Returns batch size.
Definition at line 368 of file Maintenance.php.
References $mBatchSize.
Referenced by PopulateChangeTagDef\backpopulateChangeTagPerTag(), CopyJobQueue\copyJobs(), DeduplicateArchiveRevId\doDBUpdates(), MigrateArchiveText\doDBUpdates(), MigrateImageCommentTemp\doDBUpdates(), MigrateRevisionActorTemp\doDBUpdates(), PopulateArchiveRevId\doDBUpdates(), PopulateBacklinkNamespace\doDBUpdates(), PopulateChangeTagDef\doDBUpdates(), PopulateFilearchiveSha1\doDBUpdates(), PopulateImageSha1\doDBUpdates(), PopulateIpChanges\doDBUpdates(), PopulatePPSortKey\doDBUpdates(), PopulateRecentChangesSource\doDBUpdates(), PopulateRevisionLength\doLenUpdates(), PopulateRevisionSha1\doSha1Updates(), RecountCategories\doWork(), 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(), PurgeChangedPages\execute(), PurgeExpiredWatchlistItems\execute(), PurgeModuleDeps\execute(), RebuildFileCache\execute(), RefreshFileHeaders\execute(), RefreshImageMetadata\execute(), RefreshLinks\execute(), ResetPageRandom\execute(), ResetUserTokens\execute(), UpdateRestrictions\execute(), FindMissingActors\findBadActors(), DumpCategoriesAsRdf\getCategoryIterator(), DumpCategoriesAsRdf\getCategoryLinksIterator(), DeleteAutoPatrolLogs\getRows(), DeleteAutoPatrolLogs\getRowsOld(), DeleteLocalPasswords\getUserBatches(), PopulateContentTables\loadContentMap(), MigrateComments\migrate(), MigrateComments\migrateToTemp(), PopulateContentTables\populateTable(), UppercaseTitlesForUnicodeTransition\processTable(), UppercaseTitlesForUnicodeTransition\processUsers(), PurgeChangedFiles\purgeFromLogType(), RebuildRecentchanges\rebuildRecentChangesTablePass1(), RebuildRecentchanges\rebuildRecentChangesTablePass2(), RebuildRecentchanges\rebuildRecentChangesTablePass3(), RebuildRecentchanges\rebuildRecentChangesTablePass4(), RebuildRecentchanges\rebuildRecentChangesTablePass5(), RefreshLinks\refreshCategory(), ManageJobs\repushAbandoned(), TableCleanup\runTable(), FindBadBlobs\scanRevisionsById(), FindBadBlobs\scanRevisionsByTimestamp(), SyncFileBackend\syncBackends(), and UserOptionsMaintenance\updateOptions().
Maintenance::getConfig | ( | ) |
Definition at line 598 of file Maintenance.php.
References $config.
Referenced by NamespaceDupes\checkAll(), ResetAuthenticationThrottle\clearLoginThrottle(), ResetAuthenticationThrottle\clearSignupThrottle(), AddRFCandPMIDInterwiki\doDBUpdates(), MigrateArchiveText\doDBUpdates(), PopulateImageSha1\doDBUpdates(), ReassignEdits\doReassignEdits(), CategoryChangesAsRdf\execute(), CleanupPreferences\execute(), CreateBotPassword\execute(), DumpIterator\execute(), PurgeList\execute(), Undelete\execute(), UpdateCollation\execute(), UpdateSpecialPages\execute(), RefreshLinks\getPossibleCategories(), CheckDependencies\loadThing(), output(), and CleanupWatchlist\removeWatch().
|
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().
int | $db | DB index (DB_REPLICA/DB_PRIMARY) |
string | string[] | $groups | default: empty array |
string | bool | $dbDomain | default: current wiki |
Reimplemented in OrphanStats.
Definition at line 1362 of file Maintenance.php.
References $mDb.
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 SearchDump, CommandLineInstaller, GenerateNormalizerDataAr, GenerateNormalizerDataMl, MergeMessageFileList, MWDocGen, PatchSql, RebuildAll, RebuildLocalisationCache, RebuildTextIndex, RenameDbPrefix, RunBatchedQuery, MwSql, UpdateMediaWiki, and UpdateSearchIndex.
Definition at line 549 of file Maintenance.php.
References DB_STD.
Referenced by addDefaultParams(), DumpIterator\finalSetup(), finalSetup(), and shutdown().
|
protected |
|
protected |
Get a HookContainer, for running extension hooks or for hook metadata.
Definition at line 1609 of file Maintenance.php.
References $hookContainer.
Referenced by getHookRunner().
|
protected |
Get a HookRunner for running core hooks.
Definition at line 1624 of file Maintenance.php.
References $hookRunner, and getHookContainer().
Referenced by CleanupUsersWithNoId\cleanup(), RefreshLinks\doRefreshLinks(), CleanupPreferences\execute(), and UpdateMediaWiki\validateParamsAndArgs().
Maintenance::getName | ( | ) |
Get the script's name.
Definition at line 397 of file Maintenance.php.
References $mSelf.
|
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 286 of file Maintenance.php.
References hasOption().
Referenced by activateProfiler(), PopulateChangeTagDef\backpopulateChangeTagPerTag(), Benchmarker\bench(), CompareParsers\checkOptions(), SqliteMaintenance\checkSyntax(), CleanupUsersWithNoId\doDBUpdates(), MigrateActors\doDBUpdates(), PopulateBacklinkNamespace\doDBUpdates(), PopulateChangeTagDef\doDBUpdates(), PopulateImageSha1\doDBUpdates(), PopulateIpChanges\doDBUpdates(), FileOpPerfTest\doPerfTest(), UpdateSpecialPages\doSpecialPageCacheUpdates(), AddChangeTag\execute(), AddSite\execute(), BenchmarkCommentFormatter\execute(), BenchmarkEval\execute(), BenchmarkJSMinPlus\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(), GenerateSchemaChangeSql\execute(), GenerateSchemaSql\execute(), GenerateSitemap\execute(), GetConfiguration\execute(), GetReplicaServer\execute(), GetTextMaint\execute(), BackupReader\execute(), ImportImages\execute(), ImportSiteScripts\execute(), ImportTextFiles\execute(), InitUserPreference\execute(), CommandLineInstaller\execute(), InvalidateUserSessions\execute(), GenerateCollationData\execute(), GenerateNormalizerDataAr\execute(), GenerateUcfirstOverrides\execute(), GenerateUpperCharTable\execute(), MakeTestEdits\execute(), ManageJobs\execute(), McTest\execute(), MergeMessageFileList\execute(), MigrateFileRepoLayout\execute(), MoveBatch\execute(), MysqlMaintenance\execute(), NamespaceDupes\execute(), NukeNS\execute(), PopulateContentTables\execute(), PopulateImageSha1\execute(), PopulateInterwiki\execute(), Protect\execute(), PruneFileCache\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(), DumpRenderer\execute(), ResetAuthenticationThrottle\execute(), ResetPageRandom\execute(), ResetUserTokens\execute(), RollbackEdits\execute(), RunBatchedQuery\execute(), RunJobs\execute(), ShowJobs\execute(), MwSql\execute(), SqliteMaintenance\execute(), CompressOld\execute(), SyncFileBackend\execute(), TableCleanup\execute(), Undelete\execute(), UpdateMediaWiki\execute(), UpdateCollation\execute(), UpdateSearchIndex\execute(), UpdateSpecialPages\execute(), UppercaseTitlesForUnicodeTransition\execute(), WrapOldPasswords\execute(), GetConfiguration\finalSetup(), finalSetup(), RefreshImageMetadata\getConditions(), FindMissingActors\getNewActorId(), FindBadBlobs\getRevisionIds(), DeleteAutoPatrolLogs\getRows(), DeleteAutoPatrolLogs\getRowsOld(), FindBadBlobs\getStartTimestamp(), PopulateContentTables\getTables(), CLIParser\getTitle(), BackupReader\importFromHandle(), MWDocGen\init(), DeleteLocalPasswords\initialize(), loadSpecialVars(), FindBadBlobs\markBlob(), memoryLimit(), PopulateContentTables\populateTable(), DumpBackup\processOptions(), BackupDumper\processOptions(), TextPassDumper\processOptions(), CompareParsers\processRevision(), SearchDump\processRevision(), DeleteLocalPasswords\processUsers(), UppercaseTitlesForUnicodeTransition\processUsers(), PurgePage\purge(), PurgeChangedFiles\purgeFromLogType(), RebuildRecentchanges\rebuildRecentChangesTablePass1(), CommandLineInstaller\setDbPassOption(), CommandLineInstaller\setPassOption(), MediaWikiShell\setupLegacy(), UserOptionsMaintenance\updateOptions(), GetConfiguration\validateParamsAndArgs(), and validateUserOption().
|
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 407 of file Maintenance.php.
Referenced by PurgeList\doPurge(), 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 1559 of file Maintenance.php.
References wfIsWindows().
Maintenance::globals | ( | ) |
Potentially debug globals.
Originally a feature only for refreshLinks
Definition at line 1225 of file Maintenance.php.
References hasOption().
|
protected |
Does a given argument exist?
int | $argId | The integer value (from zero) for the arg |
Definition at line 338 of file Maintenance.php.
References wfDeprecated().
Referenced by BenchmarkEval\execute(), BlockUsers\execute(), DeleteBatch\execute(), FormatInstallDoc\execute(), BackupReader\execute(), JSParseHelper\execute(), McTest\execute(), MoveBatch\execute(), ReassignEdits\execute(), MwSql\execute(), UserOptionsMaintenance\execute(), and validateParamsAndArgs().
|
protected |
Checks to see if a particular option was set.
string | $name | The name of the option |
Definition at line 271 of file Maintenance.php.
Referenced by PopulateChangeTagDef\backpopulateChangeTagPerTag(), Benchmarker\bench(), CompareParsers\checkOptions(), FindBadBlobs\checkRevision(), FindBadBlobs\checkSlot(), CleanupSpam\cleanupArticle(), CleanupInvalidDbKeys\cleanupTable(), CopyFileBackend\copyFileBatch(), CleanupPreferences\deleteByWhere(), MigrateArchiveText\doDBUpdates(), 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(), BackupReader\execute(), ImportImages\execute(), ImportTextFiles\execute(), LoggedUpdateMaintenance\execute(), InitEditCount\execute(), InitSiteStats\execute(), CommandLineInstaller\execute(), DatabaseLag\execute(), GenerateNormalizerDataAr\execute(), ListVariants\execute(), ManageForeignResources\execute(), MergeMessageFileList\execute(), MoveBatch\execute(), MysqlMaintenance\execute(), NamespaceDupes\execute(), NukeNS\execute(), NukePage\execute(), Orphans\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(), RefreshFileHeaders\execute(), RefreshImageMetadata\execute(), RefreshLinks\execute(), RemoveInvalidEmails\execute(), RemoveUnusedAccounts\execute(), DumpRenderer\execute(), ResetUserEmail\execute(), RollbackEdits\execute(), RunJobs\execute(), MediaWikiShell\execute(), ShowJobs\execute(), MwSql\execute(), SqliteMaintenance\execute(), SyncFileBackend\execute(), TableCleanup\execute(), UpdateMediaWiki\execute(), UpdateArticleCount\execute(), UpdateCollation\execute(), UpdateSearchIndex\execute(), UpdateSpecialPages\execute(), UserOptionsMaintenance\execute(), WrapOldPasswords\execute(), CopyFileBackend\filesAreSame(), GetConfiguration\finalSetup(), finalSetup(), UpdateCollation\getBatchCondition(), CommandLineInstaller\getDbType(), RebuildLocalisationCache\getDbType(), getOption(), globals(), ConvertExtensionToRegistration\handleResourceModules(), BackupReader\importFromHandle(), MWDocGen\init(), DeleteLocalPasswords\initialize(), loadSpecialVars(), FindBadBlobs\markBlob(), maybeHelp(), RunJobs\memoryLimit(), PopulateContentTables\populateTable(), DumpBackup\processOptions(), BackupDumper\processOptions(), TextPassDumper\processOptions(), PurgeChangedFiles\purgeFromLogType(), RebuildRecentchanges\rebuildRecentChangesTablePass1(), CleanupWatchlist\removeWatch(), EraseArchivedFile\scrubVersion(), PurgeList\sendPurgeRequest(), PopulateChangeTagDef\setUserDefinedTags(), MwSql\sqlPrintResult(), PopulateChangeTagDef\updateCountTag(), PopulateChangeTagDef\updateCountTagId(), UserOptionsMaintenance\updateOptions(), validateParamsAndArgs(), CommandLineInstaller\validateParamsAndArgs(), validateUserOption(), PurgeChangedFiles\verbose(), and UserOptionsMaintenance\warn().
Maintenance::isQuiet | ( | ) |
Definition at line 424 of file Maintenance.php.
References $mQuiet.
Referenced by countDown(), and SyncFileBackend\execute().
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.
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 923 of file Maintenance.php.
References $args, $self, loadSpecialVars(), and loadWithArgv().
Referenced by setup().
Maintenance::loadSettings | ( | ) |
Generic setup for most installs.
Returns the location of LocalSettings
Definition at line 1260 of file Maintenance.php.
References $IP, $wgCommandLineMode, and fatalError().
|
protected |
Handle the special variables that are global to all scripts.
Definition at line 989 of file Maintenance.php.
References getOption(), and hasOption().
Referenced by loadParamsAndArgs(), and loadWithArgv().
Maintenance::loadWithArgv | ( | $argv | ) |
Load params and arguments from a given array of command-line arguments.
array | $argv |
Definition at line 817 of file Maintenance.php.
References $args, error(), loadSpecialVars(), maybeHelp(), and setParam().
Referenced by DumpBackup\__construct(), BackupDumper\__construct(), TextPassDumper\__construct(), and loadParamsAndArgs().
|
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 1009 of file Maintenance.php.
References hasOption(), and showHelp().
Referenced by CreateAndPromote\execute(), GenerateJsonI18n\execute(), JSParseHelper\execute(), PurgeChangedFiles\execute(), PurgeChangedPages\execute(), UserOptionsMaintenance\execute(), BackupReader\importFromStdin(), loadWithArgv(), setParam(), GetConfiguration\validateParamsAndArgs(), and 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. 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)
Reimplemented in RunJobs.
Definition at line 754 of file Maintenance.php.
References getOption().
Referenced by adjustMemoryLimit().
|
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 435 of file Maintenance.php.
References cleanupChanneled(), getConfig(), outputChanneled(), and print.
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(), FindBadBlobs\checkRevision(), Orphans\checkSeparation(), FindBadBlobs\checkSlot(), SqliteMaintenance\checkSyntax(), CleanupUsersWithNoId\cleanup(), CleanupSpam\cleanupArticle(), ResetAuthenticationThrottle\clearLoginThrottle(), RebuildTextIndex\clearSearchIndex(), ResetAuthenticationThrottle\clearSignupThrottle(), CompressOld\compressOldPages(), CompressOld\compressWithConcat(), CompareParsers\conclusions(), CopyFileBackend\copyFileBatch(), countDown(), RebuildTextIndex\createMysqlTextIndex(), RunJobs\debugInternal(), ManageJobs\delete(), CleanupPreferences\deleteByWhere(), RefreshLinks\deleteLinksFromNonexistent(), CopyFileBackend\delFileBatch(), RefreshLinks\dfnCheckInterval(), CleanupRevActorPage\doDBUpdates(), DeduplicateArchiveRevId\doDBUpdates(), FixExtLinksProtocolRelative\doDBUpdates(), MigrateActors\doDBUpdates(), MigrateArchiveText\doDBUpdates(), MigrateImageCommentTemp\doDBUpdates(), MigrateRevisionActorTemp\doDBUpdates(), PopulateArchiveRevId\doDBUpdates(), PopulateBacklinkNamespace\doDBUpdates(), PopulateExternallinksIndex60\doDBUpdates(), PopulateFilearchiveSha1\doDBUpdates(), PopulateImageSha1\doDBUpdates(), PopulateIpChanges\doDBUpdates(), PopulatePPSortKey\doDBUpdates(), PopulateRecentChangesSource\doDBUpdates(), PopulateRevisionLength\doDBUpdates(), PopulateRevisionSha1\doDBUpdates(), RefreshExternallinksIndex\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(), 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(), 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(), CommandLineInstaller\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(), 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(), ResetPageRandom\execute(), ResetUserEmail\execute(), ResetUserTokens\execute(), RollbackEdits\execute(), RunBatchedQuery\execute(), RunJobs\execute(), ShowJobs\execute(), ShowSiteStats\execute(), CompressOld\execute(), DumpRev\execute(), OrphanStats\execute(), SyncFileBackend\execute(), TableCleanup\execute(), TidyUpT39714\execute(), Undelete\execute(), UpdateMediaWiki\execute(), UpdateArticleCount\execute(), UpdateCollation\execute(), UpdateExtensionJsonSchema\execute(), UpdateRestrictions\execute(), UpdateSpecialPages\execute(), ValidateRegistrationFile\execute(), Version\execute(), ViewCLI\execute(), WrapOldPasswords\execute(), DeleteEqualMessages\fetchMessageInfo(), ImportSiteScripts\fetchScriptList(), FindMissingActors\findBadActors(), formatHelpItems(), FindMissingActors\getNewActorId(), DeleteLocalPasswords\getUserBatches(), ConvertExtensionToRegistration\handleExtensionMessagesFiles(), ConvertExtensionToRegistration\handleHooks(), DumpIterator\handleRevision(), DumpRenderer\handleRevision(), FixDefaultJsonContentPages\handleRow(), MWDocGen\init(), SqliteMaintenance\integrityCheck(), CleanupImages\killRow(), UserOptionsMaintenance\listAvailableOptions(), GenerateSitemap\main(), MigrateComments\migrate(), MigrateActors\migrate(), MigrateActors\migrateLogSearch(), MigrateActors\migrateToTemp(), MigrateComments\migrateToTemp(), TitleCleanup\moveIllegalPage(), TitleCleanup\moveInconsistentPage(), CleanupCaps\movePage(), ImageBuilder\oldimageCallback(), DumpUploads\outputItem(), FindMissingActors\overwriteActorIDs(), CleanupImages\pokeFile(), RebuildTextIndex\populateSearchIndex(), DeduplicateArchiveRevId\processArRevIds(), CompareParsers\processRevision(), SearchDump\processRevision(), CleanupImages\processRow(), TitleCleanup\processRow(), CleanupWatchlist\processRow(), CleanupCaps\processRowToLowercase(), CleanupCaps\processRowToUppercase(), UppercaseTitlesForUnicodeTransition\processTable(), UppercaseTitlesForUnicodeTransition\processUsers(), ImageBuilder\progress(), TableCleanup\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(), FindBadBlobs\scanRevisionsById(), FindBadBlobs\scanRevisionsByTimestamp(), EraseArchivedFile\scrubVersion(), PurgeList\sendPurgeRequest(), PopulateChangeTagDef\setUserDefinedTags(), CreateBotPassword\showGrants(), showHelp(), PurgeParserCache\showProgressAndWait(), UpdateCollation\showSortKeySizeHistogram(), UserOptionsMaintenance\showUsageStats(), MwSql\sqlPrintResult(), Benchmarker\startBench(), SyncFileBackend\syncBackends(), SyncFileBackend\syncFileBatch(), GenerateJsonI18n\transformI18nFile(), PopulateChangeTagDef\updateCountTag(), PopulateChangeTagDef\updateCountTagId(), UserOptionsMaintenance\updateOptions(), UpdateSearchIndex\updateSearchIndexForPage(), ResetUserTokens\updateUser(), PopulateRevisionSha1\upgradeLegacyArchiveRow(), PopulateRevisionSha1\upgradeRow(), PopulateRevisionLength\upgradeRow(), SqliteMaintenance\vacuum(), PurgeChangedFiles\verbose(), Benchmarker\verboseRun(), UserOptionsMaintenance\warn(), and PopulateContentTables\writeln().
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 | $msg | The message without trailing newline |
string | null | $channel | Channel identifier or null for no channel. Channel comparison uses ===. |
Definition at line 515 of file Maintenance.php.
References cleanupChanneled(), and print.
|
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 1641 of file Maintenance.php.
Referenced by FindMissingActors\execute(), and FindBadBlobs\getRevisionIds().
|
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 1476 of file Maintenance.php.
References posix_isatty().
Referenced by FindDeprecated\execute(), MwSql\execute(), posix_isatty(), and readconsole().
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 1297 of file Maintenance.php.
References $res, beginTransaction(), commitTransaction(), DB_PRIMARY, getDB(), and output().
Referenced by DeleteOldRevisions\doDelete(), 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 1489 of file Maintenance.php.
References posix_isatty(), and readlineEmulation().
Referenced by FindMissingActors\execute(), and MwSql\execute().
|
staticprivate |
Emulate readline()
string | $prompt | What to begin the line with, like '> ' |
Definition at line 1521 of file Maintenance.php.
References $command, print, and wfIsWindows().
Referenced by readconsole().
|
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 623 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 1599 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 1438 of file Maintenance.php.
References Wikimedia\Rdbms\IDatabase\rollback().
Referenced by CleanupImages\pokeFile(), and PopulateContentTables\populateContentTablesForRowBatch().
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 673 of file Maintenance.php.
References $maintClass, and fatalError().
Referenced by NukeNS\execute(), RebuildAll\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 662 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 321 of file Maintenance.php.
Referenced by CommandLineInc\__construct().
|
protected |
int | $s | The number of operations to do in a batch |
Definition at line 375 of file Maintenance.php.
References $s, and addOption().
Referenced by CategoryChangesAsRdf\__construct(), CheckImages\__construct(), CheckUsernames\__construct(), CleanupBlocks\__construct(), CleanupInvalidDbKeys\__construct(), CleanupPreferences\__construct(), CleanupRemovedModules\__construct(), CleanupRevActorPage\__construct(), TitleCleanup\__construct(), CleanupUploadStash\__construct(), CleanupUsersWithNoId\__construct(), CopyFileBackend\__construct(), CopyJobQueue\__construct(), DeduplicateArchiveRevId\__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(), MigrateActors\__construct(), InitUserPreference\__construct(), InvalidateUserSessions\__construct(), MakeTestEdits\__construct(), ManageJobs\__construct(), MigrateComments\__construct(), MigrateFileRepoLayout\__construct(), MigrateUserGroup\__construct(), PopulateArchiveRevId\__construct(), PopulateChangeTagDef\__construct(), PopulateContentTables\__construct(), PopulateExternallinksIndex60\__construct(), PopulatePPSortKey\__construct(), PopulateRecentChangesSource\__construct(), PopulateRevisionLength\__construct(), PopulateRevisionSha1\__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(), ResetPageRandom\__construct(), ResetUserTokens\__construct(), SyncFileBackend\__construct(), TableCleanup\__construct(), UpdateRestrictions\__construct(), UppercaseTitlesForUnicodeTransition\__construct(), UserOptionsMaintenance\__construct(), WrapOldPasswords\__construct(), PopulateChangeTagDef\doDBUpdates(), CopyFileBackend\execute(), and DeleteAutoPatrolLogs\execute().
Maintenance::setConfig | ( | Config | $config | ) |
Config | $config |
Definition at line 610 of file Maintenance.php.
References $config.
Maintenance::setDB | ( | IMaintainableDatabase | $db | ) |
Sets database object to be returned by getDB().
IMaintainableDatabase | $db |
Reimplemented in BackupDumper.
Definition at line 1379 of file Maintenance.php.
Referenced by DatabaseUpdater\__construct().
|
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.
array | &$options | |
string | $option | |
mixed | $value |
Definition at line 893 of file Maintenance.php.
References error(), and maybeHelp().
Referenced by loadWithArgv().
Maintenance::setup | ( | ) |
Do some sanity checking and basic setup.
Definition at line 699 of file Maintenance.php.
References $IP, $wgCommandLineMode, adjustMemoryLimit(), fatalError(), and loadParamsAndArgs().
|
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)
Definition at line 192 of file Maintenance.php.
References $wgCommandLineMode.
|
protected |
Definitely show the help.
Does not exit.
Definition at line 1020 of file Maintenance.php.
References $mDependentParameters, $mGenericParameters, $mParams, formatHelpItems(), and output().
Referenced by maybeHelp().
Maintenance::shutdown | ( | ) |
Call before shutdown to run any deferred updates.
Definition at line 1235 of file Maintenance.php.
References getDbType(), and wfLogProfilingData().
|
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 234 of file Maintenance.php.
Referenced by validateParamsAndArgs().
Maintenance::validateParamsAndArgs | ( | ) |
Run some validation checks on the params, etc.
Reimplemented in GetConfiguration, CommandLineInstaller, and UpdateMediaWiki.
Definition at line 956 of file Maintenance.php.
References error(), hasArg(), hasOption(), maybeHelp(), and supportsOption().
|
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 1660 of file Maintenance.php.
References fatalError(), getOption(), hasOption(), User\newFromId(), and User\newFromName().
Referenced by ChangePassword\execute(), and InvalidateBotPasswords\execute().
|
protected |
Wait for replica DBs to catch up.
Definition at line 1419 of file Maintenance.php.
Referenced by commitTransaction(), FindBadBlobs\scanRevisionsByTimestamp(), and UserOptionsMaintenance\updateOptions().
|
private |
Definition at line 494 of file Maintenance.php.
|
private |
Accessible via getConfig()
Definition at line 153 of file Maintenance.php.
Referenced by PopulateImageSha1\doDBUpdates(), MediaWikiShell\execute(), getConfig(), setConfig(), and UpdateExtensionJsonSchema\updateTo2().
resource null Maintenance::$fileHandle |
Used when creating separate schema files.
Definition at line 140 of file Maintenance.php.
|
private |
Definition at line 143 of file Maintenance.php.
Referenced by getHookContainer().
|
private |
Definition at line 146 of file Maintenance.php.
Referenced by getHookRunner().
|
private |
Definition at line 495 of file Maintenance.php.
|
private |
UNIX timestamp.
Definition at line 134 of file Maintenance.php.
Referenced by UppercaseTitlesForUnicodeTransition\processTable().
|
protected |
Allow arbitrary options to be passed, or only specified ones?
Definition at line 91 of file Maintenance.php.
|
protected |
Desired/allowed args.
Definition at line 82 of file Maintenance.php.
|
protected |
This is the list of arguments that were actually passed.
Definition at line 88 of file Maintenance.php.
Referenced by CommandLineInc\execute(), and JSParseHelper\execute().
|
protected |
Batch size.
If a script supports this, they should set a default with setBatchSize()
Definition at line 112 of file Maintenance.php.
Referenced by CleanupRevActorPage\doDBUpdates(), PopulateExternallinksIndex60\doDBUpdates(), and getBatchSize().
|
private |
|
protected |
Definition at line 98 of file Maintenance.php.
Referenced by finalSetup().
|
protected |
Definition at line 98 of file Maintenance.php.
Referenced by finalSetup().
|
private |
Generic options which might or not be supported by the script.
Definition at line 125 of file Maintenance.php.
Referenced by showHelp().
|
protected |
A description of the script, children should change this via addDescription()
Definition at line 101 of file Maintenance.php.
|
private |
Generic options added by addDefaultParams()
Definition at line 119 of file Maintenance.php.
Referenced by showHelp().
|
protected |
Have we already loaded our user input?
Definition at line 104 of file Maintenance.php.
|
protected |
This is the list of options that were actually passed.
Definition at line 85 of file Maintenance.php.
Referenced by CommandLineInc\execute().
|
protected |
Array of desired/allowed params.
Definition at line 76 of file Maintenance.php.
Referenced by addDefaultParams(), and showHelp().
|
protected |
Special vars for params that are always used.
Definition at line 97 of file Maintenance.php.
Referenced by isQuiet().
|
protected |
Name of the script currently running.
Definition at line 94 of file Maintenance.php.
Referenced by getName().
|
protected |
Mapping short parameters to long ones.
Definition at line 79 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 172 of file Maintenance.php.
Referenced by BackupDumper\processOptions().
|
private |
Definition at line 159 of file Maintenance.php.
const Maintenance::DB_ADMIN = 2 |
Definition at line 66 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 64 of file Maintenance.php.
Referenced by DumpIterator\finalSetup(), SearchDump\getDbType(), CommandLineInstaller\getDbType(), GenerateNormalizerDataAr\getDbType(), GenerateNormalizerDataMl\getDbType(), MergeMessageFileList\getDbType(), MWDocGen\getDbType(), and RebuildLocalisationCache\getDbType().
const Maintenance::DB_STD = 1 |
Definition at line 65 of file Maintenance.php.
Referenced by getDbType().
const Maintenance::STDIN_ALL = -1 |
Definition at line 69 of file Maintenance.php.
Referenced by EditCLI\execute().