MediaWiki  1.30.2
Maintenance Class Reference

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

Inherited by AddSite, AllTrans, AlterSharedConstraints, AttachLatest, BackupDumper, BackupReader, BatchedQueryRunner, Benchmarker, BenchmarkParse, BenchmarkTidy, ChangePassword, CheckBadRedirects, CheckComposerLockUpToDate, CheckImages, CheckLess, CheckUsernames, CleanupAncientTables, CleanupArchiveUserText, CleanupBlocks, CleanupInvalidDbKeys, CleanupPreferences, CleanupRemovedModules, CleanupSpam, ClearInterwikiCache, CLIParser, CommandLineInc, CommandLineInstaller, CompareParserCache, CompressOld, ConvertExtensionToRegistration, ConvertLinks, ConvertUserOptions, CopyFileBackend, CopyJobQueue, CountFancyCaptchas, CreateAndPromote, DatabaseLag, DateFormats, DeleteArchivedFiles, DeleteArchivedRevisions, DeleteBatch, DeleteDefaultMessages, DeleteEqualMessages, DeleteOldFancyCaptchas, DeleteOldRevisions, DeleteOrphanedRevisions, DeleteSelfExternals, Digit2Html, DumpCategoriesAsRdf, DumpIterator, DumpLinks, DumpMessages, DumpRenderer, DumpRev, EditCLI, EraseArchivedFile, ExportSites, FakeMaintenance, FetchText, FindDeprecated, FindHooks, FindMissingFiles, FindOrphanedFiles, FixDoubleRedirects, FixT22757, FixTimestamps, FixUserRegistration, GenerateCollationData, GenerateCommonPassword, GenerateFancyCaptchas, GenerateJqueryMsgData, GenerateJsonI18n, GenerateNormalizerDataAr, GenerateNormalizerDataMl, GenerateRandomImages, GetConfiguration, GetLagTimes, GetSlaveServer, GetTextMaint, HHVMMakeRepo, ImageBuilder, ImportImages, ImportSites, ImportSiteScripts, ImportTextFiles, InitEditCount, InitSiteStats, InitUserPreference, InvalidateUserSesssions, JSParseHelper, LangMemUsage, ListVariants, LoggedUpdateMaintenance, LU, MaintenanceFixup, MaintenanceFormatInstallDoc, MakeTestEdits, ManageJobs, McTest, MediaWikiShell, MergeMessageFileList, MigrateFileRepoLayout, MigrateUserGroup, MinifyScript, MoveBatch, MWDocGen, MwSql, NamespaceConflictChecker, NukeNS, NukePage, Orphans, OrphanStats, PageExists, ParserEditTests, ParserFuzzTest, ParserTestsMaintenance, PatchSql, PHPUnitMaintClass, PopulateCategory, PopulateContentModel, PopulateInterwiki, Protect, PruneFileCache, PurgeChangedFiles, PurgeChangedPages, PurgeList, PurgeModuleDeps, PurgeOldText, PurgePage, PurgeParserCache, ReassignEdits, RebuildAll, RebuildFileCache, RebuildLocalisationCache, RebuildMessages, RebuildRecentchanges, RebuildSitesCache, RebuildTextIndex, RecountCategories, RefreshFileHeaders, RefreshImageMetadata, RefreshLinks, RemoveInvalidEmails, RemoveUnusedAccounts, RenameDbPrefix, RenameUserCleanup, ResetUserEmail, ResetUserTokens, RollbackEdits, RunJobs, ShowJobs, ShowSiteStats, SqliteMaintenance, StorageTypeStats, SyncFileBackend, TableCleanup, TestFileOpPerformance, TidyUpBug37714, Undelete, UpdateArticleCount, UpdateCollation, UpdateCSS, UpdateDoubleWidthSearch, UpdateExtensionJsonSchema, UpdateMediaWiki, UpdateRestrictions, UpdateSearchIndex, UpdateSpecialPages, UploadDumper, UploadStashCleanup, ValidateRegistrationFile, ViewCLI, and WrapOldPasswords.

Collaboration diagram for Maintenance:

Public Member Functions

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

Static Public Member Functions

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

Public Attributes

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

Protected Member Functions

 activateProfiler ()
 Activate the profiler (assuming $wgProfiler is set) More...
 
 addArg ( $arg, $description, $required=true)
 Add some args that are needed. More...
 
 addDefaultParams ()
 Add the default parameters to the scripts. More...
 
 addDescription ( $text)
 Set the description text. More...
 
 addOption ( $name, $description, $required=false, $withArg=false, $shortName=false, $multiOccurrence=false)
 Add a parameter to the script. More...
 
 adjustMemoryLimit ()
 Adjusts PHP's memory limit to better suit our needs, if needed. More...
 
 afterFinalSetup ()
 Execute a callback function at the end of initialisation. More...
 
 beginTransaction (IDatabase $dbw, $fname)
 Begin a transcation on a DB. More...
 
 commitTransaction (IDatabase $dbw, $fname)
 Commit the transcation on a DB handle and wait for replica DBs to catch up. More...
 
 deleteOption ( $name)
 Remove an option. More...
 
 error ( $err, $die=0)
 Throw an error to the user. More...
 
 getArg ( $argId=0, $default=null)
 Get an argument. More...
 
 getDB ( $db, $groups=[], $wiki=false)
 Returns a database to be used by current maintenance script. More...
 
 getDir ()
 Get the maintenance directory. More...
 
 getOption ( $name, $default=null)
 Get an option, or return the default. More...
 
 getStdin ( $len=null)
 Return input from stdin. More...
 
 hasArg ( $argId=0)
 Does a given argument exist? More...
 
 hasOption ( $name)
 Checks to see if a particular param exists. More...
 
 loadSpecialVars ()
 Handle the special variables that are global to all scripts. More...
 
 maybeHelp ( $force=false)
 Maybe show the help. More...
 
 output ( $out, $channel=null)
 Throw some output to the user. More...
 
 requireExtension ( $name)
 Indicate that the specified extension must be loaded before the script can run. More...
 
 rollbackTransaction (IDatabase $dbw, $fname)
 Rollback the transcation on a DB handle. More...
 
 setBatchSize ( $s=0)
 Set the batch size. More...
 
 validateParamsAndArgs ()
 Run some validation checks on the params, etc. More...
 

Protected Attributes

 $mArgList = []
 
 $mArgs = []
 
int $mBatchSize = null
 Batch size. More...
 
 $mDbUser
 
 $mDescription = ''
 
 $mInputLoaded = false
 
 $mOptions = []
 
 $mParams = []
 
 $mQuiet = false
 
 $mSelf
 
 $mShortParamsMap = []
 

Private Member Functions

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

Static Private Member Functions

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

Private Attributes

 $atLineStart = true
 
Config $config
 Accessible via getConfig() More...
 
 $lastChannel = null
 
float $lastReplicationWait = 0.0
 UNIX timestamp. More...
 
IMaintainableDatabase $mDb = null
 Used by getDB() / setDB() More...
 
 $mDependantParameters = []
 
 $mGenericParameters = []
 
array $requiredExtensions = []
 

Detailed Description

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

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

Author
Chad Horohoe chad@.nosp@m.anyo.nosp@m.necan.nosp@m.edit.nosp@m..org
Since
1.16

Definition at line 39 of file maintenance.txt.

Constructor & Destructor Documentation

◆ __construct()

Maintenance::__construct ( )

Default constructor.

Children should call this first if implementing their own constructors

Reimplemented in LoggedUpdateMaintenance, SearchDump, FindDeprecated, GenerateJqueryMsgData, CLIParser, PurgeChangedFiles, CompressOld, ConvertExtensionToRegistration, CleanupInvalidDbKeys, FindHooks, GenerateCollationData, NamespaceConflictChecker, GetConfiguration, BenchmarkParse, ImageBuilder, MediaWikiShell, PreprocessDump, WatchlistCleanup, MWDocGen, RefreshImageMetadata, MoveBatch, RebuildTextIndex, CapsCleanup, TableCleanup, NukeNS, BackupReader, DumpRenderer, ShowJobs, ImageCleanup, CompareParsers, UpdateCollation, BenchStrtrStrReplace, DumpCategoriesAsRdf, Digit2Html, Orphans, CopyFileBackend, DumpIterator, DumpLinks, PopulateLogSearch, Benchmarker, DeleteBatch, RebuildLocalisationCache, RebuildRecentchanges, ShowSiteStats, UpdateSearchIndex, GenerateCommonPassword, ImportImages, CommandLineInstaller, MergeMessageFileList, PopulateIpChanges, PurgeChangedPages, PurgeParserCache, RecountCategories, RefreshLinks, GenerateFancyCaptchas, CleanupRemovedModules, TitleCleanup, UploadStashCleanup, CommandLineInc, ConvertUserOptions, PopulateContentModel, UpdateMediaWiki, CountFancyCaptchas, DeleteOldFancyCaptchas, BenchmarkDeleteTruncate, ConvertLinks, DeleteOrphanedRevisions, FixTimestamps, InvalidateUserSesssions, MwSql, FixT22757, AttachLatest, CheckUsernames, CreateAndPromote, FixDoubleRedirects, GenerateJsonI18n, PopulateCategory, PopulateInterwiki, PopulateLogUsertext, ResetUserTokens, BatchedQueryRunner, UpdateArticleCount, UpdateRestrictions, WrapOldPasswords, BenchHttpHttps, BenchIfSwitch, BenchWfIsWindows, BenchWikimediaBaseConvert, ChangePassword, CopyJobQueue, DeleteArchivedRevisions, EraseArchivedFile, FetchText, FixExtLinksProtocolRelative, ImportTextFiles, DateFormats, LangMemUsage, MigrateComments, AlterSharedConstraints, PopulateParentId, PopulateRecentChangesSource, PruneFileCache, PurgeModuleDeps, ReassignEdits, UpdateDoubleWidthSearch, BenchmarkHooks, CleanupAncientTables, CleanupBlocks, CleanupEmptyCategories, DeleteArchivedFiles, DeleteDefaultMessages, GetLagTimes, GetTextMaint, InitSiteStats, JSParseHelper, DumpMessages, GenerateNormalizerDataAr, GenerateNormalizerDataMl, McTest, MigrateFileRepoLayout, MinifyScript, NukePage, PopulateRevisionLength, PopulateRevisionSha1, RebuildFileCache, RefreshFileHeaders, RemoveUnusedAccounts, RenameDbPrefix, RollbackEdits, RunJobs, ParserTestsMaintenance, RenameUserCleanup, UpdateCSS, BenchmarkJSMinPlus, CleanupSpam, ClearInterwikiCache, DeleteOldRevisions, DeleteSelfExternals, UploadDumper, TestFileOpPerformance, FixDefaultJsonContentPages, FixUserRegistration, ImportSiteScripts, AllTrans, ListVariants, PatchSql, PopulateFilearchiveSha1, PopulatePPSortKey, PurgeOldText, RebuildAll, ResetUserEmail, DumpRev, OrphanStats, SyncFileBackend, UpdateSpecialPages, AddRFCAndPMIDInterwiki, BenchmarkLruHash, BenchmarkPurge, CheckBadRedirects, CheckImages, EditCLI, MaintenanceFormatInstallDoc, GetSlaveServer, DatabaseLag, ManageJobs, MigrateUserGroup, PopulateBacklinkNamespace, PopulateImageSha1, Protect, PurgeList, PurgePage, RebuildMessages, RebuildSitesCache, SqliteMaintenance, ViewCLI, BenchmarkCSSMin, CheckLess, DeleteEqualMessages, MakeTestEdits, CompareParserCache, PHPUnitMaintClass, InitEditCount, PageExists, Undelete, FindMissingFiles, FindOrphanedFiles, ParserEditTests, AddSite, RemoveInvalidEmails, InitUserPreference, ExportSites, ImportSites, ParserFuzzTest, CleanupArchiveUserText, CheckComposerLockUpToDate, LU, UpdateExtensionJsonSchema, BenchmarkTidy, HHVMMakeRepo, and ValidateRegistrationFile.

Definition at line 155 of file Maintenance.php.

References $IP, addDefaultParams(), and global.

Member Function Documentation

◆ __construct()

public function Maintenance::__construct ( )
inlineprivate

Definition at line 41 of file maintenance.txt.

◆ activateProfiler()

Maintenance::activateProfiler ( )
protected

Activate the profiler (assuming $wgProfiler is set)

Definition at line 722 of file Maintenance.php.

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

Referenced by finalSetup().

◆ addArg()

◆ addDefaultParams()

Maintenance::addDefaultParams ( )
protected

Add the default parameters to the scripts.

Definition at line 466 of file Maintenance.php.

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

Referenced by __construct().

◆ addDescription()

Maintenance::addDescription (   $text)
protected

Set the description text.

Parameters
string$textThe text of the description

Definition at line 287 of file Maintenance.php.

Referenced by HHVMMakeRepo\__construct(), UpdateExtensionJsonSchema\__construct(), CheckComposerLockUpToDate\__construct(), ParserFuzzTest\__construct(), ImportSites\__construct(), ExportSites\__construct(), AddSite\__construct(), FindOrphanedFiles\__construct(), FindMissingFiles\__construct(), Undelete\__construct(), InitEditCount\__construct(), PageExists\__construct(), CompareParserCache\__construct(), CheckLess\__construct(), DeleteEqualMessages\__construct(), MakeTestEdits\__construct(), DumpBackup\__construct(), BenchmarkCSSMin\__construct(), Protect\__construct(), PurgeList\__construct(), PurgePage\__construct(), CheckBadRedirects\__construct(), RebuildMessages\__construct(), RebuildSitesCache\__construct(), BenchmarkPurge\__construct(), GetSlaveServer\__construct(), SqliteMaintenance\__construct(), CheckImages\__construct(), ViewCLI\__construct(), AddRFCAndPMIDInterwiki\__construct(), DatabaseLag\__construct(), ManageJobs\__construct(), MigrateUserGroup\__construct(), PopulateBacklinkNamespace\__construct(), BenchmarkLruHash\__construct(), PopulateImageSha1\__construct(), EditCLI\__construct(), ClearInterwikiCache\__construct(), TestFileOpPerformance\__construct(), PurgeOldText\__construct(), FixDefaultJsonContentPages\__construct(), RebuildAll\__construct(), FixUserRegistration\__construct(), ResetUserEmail\__construct(), OrphanStats\__construct(), ImportSiteScripts\__construct(), AllTrans\__construct(), UpdateCSS\__construct(), ListVariants\__construct(), SyncFileBackend\__construct(), DeleteOldRevisions\__construct(), DeleteSelfExternals\__construct(), UploadDumper\__construct(), PatchSql\__construct(), BenchmarkJSMinPlus\__construct(), PopulateFilearchiveSha1\__construct(), CleanupSpam\__construct(), PopulatePPSortKey\__construct(), PopulateRevisionLength\__construct(), PopulateRevisionSha1\__construct(), RebuildFileCache\__construct(), RunJobs\__construct(), RefreshFileHeaders\__construct(), GetLagTimes\__construct(), RollbackEdits\__construct(), GetTextMaint\__construct(), InitSiteStats\__construct(), ParserTestsMaintenance\__construct(), JSParseHelper\__construct(), DeleteArchivedFiles\__construct(), DumpMessages\__construct(), GenerateNormalizerDataAr\__construct(), GenerateNormalizerDataMl\__construct(), DeleteDefaultMessages\__construct(), CleanupAncientTables\__construct(), CleanupBlocks\__construct(), McTest\__construct(), MigrateFileRepoLayout\__construct(), BenchmarkHooks\__construct(), MinifyScript\__construct(), CleanupEmptyCategories\__construct(), NukePage\__construct(), PopulateRecentChangesSource\__construct(), PruneFileCache\__construct(), CopyJobQueue\__construct(), PurgeModuleDeps\__construct(), BenchIfSwitch\__construct(), FixExtLinksProtocolRelative\__construct(), ReassignEdits\__construct(), ChangePassword\__construct(), ImportTextFiles\__construct(), BenchWfIsWindows\__construct(), UpdateDoubleWidthSearch\__construct(), BenchWikimediaBaseConvert\__construct(), DateFormats\__construct(), DeleteArchivedRevisions\__construct(), LangMemUsage\__construct(), MigrateComments\__construct(), FetchText\__construct(), AlterSharedConstraints\__construct(), BenchHttpHttps\__construct(), PopulateParentId\__construct(), EraseArchivedFile\__construct(), ResetUserTokens\__construct(), UpdateRestrictions\__construct(), GenerateJsonI18n\__construct(), BatchedQueryRunner\__construct(), WrapOldPasswords\__construct(), AttachLatest\__construct(), UpdateArticleCount\__construct(), CreateAndPromote\__construct(), CheckUsernames\__construct(), FixDoubleRedirects\__construct(), PopulateCategory\__construct(), PopulateInterwiki\__construct(), PopulateLogUsertext\__construct(), ConvertLinks\__construct(), MwSql\__construct(), FixT22757\__construct(), InvalidateUserSesssions\__construct(), BenchmarkDeleteTruncate\__construct(), FixTimestamps\__construct(), DeleteOrphanedRevisions\__construct(), TitleCleanup\__construct(), UpdateMediaWiki\__construct(), PopulateContentModel\__construct(), ConvertUserOptions\__construct(), UploadStashCleanup\__construct(), CleanupRemovedModules\__construct(), GenerateCommonPassword\__construct(), CommandLineInstaller\__construct(), RecountCategories\__construct(), RefreshLinks\__construct(), PurgeChangedPages\__construct(), MergeMessageFileList\__construct(), PurgeParserCache\__construct(), PopulateIpChanges\__construct(), ImportImages\__construct(), DeleteBatch\__construct(), RebuildLocalisationCache\__construct(), RebuildRecentchanges\__construct(), ShowSiteStats\__construct(), UpdateSearchIndex\__construct(), CopyFileBackend\__construct(), DumpIterator\__construct(), DumpLinks\__construct(), PopulateLogSearch\__construct(), BenchStrtrStrReplace\__construct(), Digit2Html\__construct(), Orphans\__construct(), DumpCategoriesAsRdf\__construct(), CompareParsers\__construct(), ImageCleanup\__construct(), UpdateCollation\__construct(), DumpRenderer\__construct(), ShowJobs\__construct(), BackupReader\__construct(), NukeNS\__construct(), CapsCleanup\__construct(), RebuildTextIndex\__construct(), MoveBatch\__construct(), WatchlistCleanup\__construct(), MWDocGen\__construct(), RefreshImageMetadata\__construct(), ImageBuilder\__construct(), BenchmarkParse\__construct(), GetConfiguration\__construct(), NamespaceConflictChecker\__construct(), FindHooks\__construct(), CleanupInvalidDbKeys\__construct(), ConvertExtensionToRegistration\__construct(), PurgeChangedFiles\__construct(), CLIParser\__construct(), CompressOld\__construct(), TextPassDumper\__construct(), FindDeprecated\__construct(), and SearchDump\__construct().

◆ addOption()

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

Add a parameter to the script.

Will be displayed on –help with the associated description

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

Reimplemented in PHPUnitMaintClass, and MaintenanceFixup.

Definition at line 215 of file Maintenance.php.

References $name.

Referenced by BenchmarkTidy\__construct(), HHVMMakeRepo\__construct(), LU\__construct(), ParserFuzzTest\__construct(), InitUserPreference\__construct(), RemoveInvalidEmails\__construct(), AddSite\__construct(), ParserEditTests\__construct(), FindOrphanedFiles\__construct(), FindMissingFiles\__construct(), Undelete\__construct(), InitEditCount\__construct(), CompareParserCache\__construct(), BenchmarkCSSMin\__construct(), DeleteEqualMessages\__construct(), DumpBackup\__construct(), MakeTestEdits\__construct(), DatabaseLag\__construct(), ManageJobs\__construct(), EditCLI\__construct(), PopulateBacklinkNamespace\__construct(), PopulateImageSha1\__construct(), Protect\__construct(), PurgeList\__construct(), BenchmarkLruHash\__construct(), PurgePage\__construct(), MaintenanceFormatInstallDoc\__construct(), RebuildSitesCache\__construct(), GetSlaveServer\__construct(), SqliteMaintenance\__construct(), ListVariants\__construct(), DeleteOldRevisions\__construct(), CleanupSpam\__construct(), UploadDumper\__construct(), RenameUserCleanup\__construct(), TestFileOpPerformance\__construct(), UpdateSpecialPages\__construct(), PurgeOldText\__construct(), BenchmarkJSMinPlus\__construct(), ResetUserEmail\__construct(), ImportSiteScripts\__construct(), SyncFileBackend\__construct(), CleanupAncientTables\__construct(), GenerateNormalizerDataAr\__construct(), ParserTestsMaintenance\__construct(), DeleteDefaultMessages\__construct(), McTest\__construct(), MigrateFileRepoLayout\__construct(), MinifyScript\__construct(), NukePage\__construct(), RebuildFileCache\__construct(), RefreshFileHeaders\__construct(), GetLagTimes\__construct(), RemoveUnusedAccounts\__construct(), RenameDbPrefix\__construct(), GetTextMaint\__construct(), RollbackEdits\__construct(), RunJobs\__construct(), DeleteArchivedFiles\__construct(), InitSiteStats\__construct(), DeleteArchivedRevisions\__construct(), UpdateDoubleWidthSearch\__construct(), ChangePassword\__construct(), BenchWikimediaBaseConvert\__construct(), CopyJobQueue\__construct(), EraseArchivedFile\__construct(), PruneFileCache\__construct(), ReassignEdits\__construct(), ImportTextFiles\__construct(), UpdateArticleCount\__construct(), WrapOldPasswords\__construct(), BatchedQueryRunner\__construct(), ResetUserTokens\__construct(), PopulateInterwiki\__construct(), FixDoubleRedirects\__construct(), GenerateJsonI18n\__construct(), CreateAndPromote\__construct(), AttachLatest\__construct(), InvalidateUserSesssions\__construct(), MwSql\__construct(), DeleteOrphanedRevisions\__construct(), FixT22757\__construct(), DeleteOldFancyCaptchas\__construct(), CommandLineInc\__construct(), UpdateMediaWiki\__construct(), GenerateFancyCaptchas\__construct(), PopulateContentModel\__construct(), CommandLineInstaller\__construct(), PopulateIpChanges\__construct(), MergeMessageFileList\__construct(), ImportImages\__construct(), PurgeParserCache\__construct(), RecountCategories\__construct(), PurgeChangedPages\__construct(), RefreshLinks\__construct(), GenerateCommonPassword\__construct(), UpdateSearchIndex\__construct(), Benchmarker\__construct(), RebuildRecentchanges\__construct(), DeleteBatch\__construct(), RebuildLocalisationCache\__construct(), DumpIterator\__construct(), CopyFileBackend\__construct(), Orphans\__construct(), DumpCategoriesAsRdf\__construct(), CompareParsers\__construct(), UpdateCollation\__construct(), DumpRenderer\__construct(), ShowJobs\__construct(), BackupReader\__construct(), CapsCleanup\__construct(), NukeNS\__construct(), TableCleanup\__construct(), MoveBatch\__construct(), MWDocGen\__construct(), WatchlistCleanup\__construct(), RefreshImageMetadata\__construct(), PreprocessDump\__construct(), MediaWikiShell\__construct(), BenchmarkParse\__construct(), ImageBuilder\__construct(), GetConfiguration\__construct(), NamespaceConflictChecker\__construct(), GenerateCollationData\__construct(), CleanupInvalidDbKeys\__construct(), FindHooks\__construct(), ConvertExtensionToRegistration\__construct(), PurgeChangedFiles\__construct(), CLIParser\__construct(), CompressOld\__construct(), BackupDumper\__construct(), TextPassDumper\__construct(), SearchDump\__construct(), LoggedUpdateMaintenance\__construct(), addDefaultParams(), and setBatchSize().

◆ adjustMemoryLimit()

Maintenance::adjustMemoryLimit ( )
protected

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

Definition at line 709 of file Maintenance.php.

References memoryLimit().

Referenced by finalSetup(), and setup().

◆ afterFinalSetup()

Maintenance::afterFinalSetup ( )
protected

Execute a callback function at the end of initialisation.

Reimplemented in UpdateMediaWiki.

Definition at line 1129 of file Maintenance.php.

Referenced by finalSetup().

◆ beginTransaction()

◆ checkRequiredExtensions()

Maintenance::checkRequiredExtensions ( )

Verify that the required extensions are installed.

Since
1.28

Definition at line 538 of file Maintenance.php.

References $name, as, error(), and ExtensionRegistry\getInstance().

◆ cleanupChanneled()

Maintenance::cleanupChanneled ( )

Clean up channeled output.

Output a newline if necessary.

Definition at line 411 of file Maintenance.php.

Referenced by output(), and outputChanneled().

◆ clearParamsAndArgs()

Maintenance::clearParamsAndArgs ( )

Clear all params and arguments.

Definition at line 750 of file Maintenance.php.

◆ commitTransaction()

◆ deleteOption()

Maintenance::deleteOption (   $name)
protected

Remove an option.

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

Parameters
string$nameThe option to remove.

Definition at line 279 of file Maintenance.php.

References $name.

◆ error()

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

Throw an error to the user.

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

Parameters
string$errThe error to display
int$dieIf > 0, go ahead and die out using this int as the code

Definition at line 392 of file Maintenance.php.

References outputChanneled().

Referenced by SqliteMaintenance\backup(), ImageCleanup\buildSafeTitle(), FindOrphanedFiles\checkFiles(), CompareParsers\checkOptions(), checkRequiredExtensions(), SqliteMaintenance\checkSyntax(), RenameUserCleanup\checkUserExistence(), CleanupSpam\cleanupArticle(), UpdateMediaWiki\compatChecks(), CompressOld\compressPage(), CompressOld\compressWithConcat(), CompareParsers\conclusions(), CopyFileBackend\copyFileBatch(), CopyFileBackend\delFileBatch(), PopulateRecentChangesSource\doDBUpdates(), PopulateRevisionLength\doDBUpdates(), PopulateRevisionSha1\doDBUpdates(), PopulateParentId\doDBUpdates(), FixExtLinksProtocolRelative\doDBUpdates(), PopulateLogSearch\doDBUpdates(), PopulateImageSha1\doDBUpdates(), PopulateIpChanges\doDBUpdates(), UploadStashCleanup\doOperations(), UpdateSpecialPages\doSpecialPageCacheUpdates(), ValidateRegistrationFile\execute(), UpdateExtensionJsonSchema\execute(), BenchmarkTidy\execute(), CheckComposerLockUpToDate\execute(), LU\execute(), ExportSites\execute(), HHVMMakeRepo\execute(), PageExists\execute(), FindOrphanedFiles\execute(), Undelete\execute(), BenchmarkPurge\execute(), DumpRev\execute(), ViewCLI\execute(), BenchmarkJSMinPlus\execute(), ManageJobs\execute(), MaintenanceFormatInstallDoc\execute(), CleanupAncientTables\execute(), MakeTestEdits\execute(), MigrateUserGroup\execute(), ImportSiteScripts\execute(), RemoveUnusedAccounts\execute(), LangMemUsage\execute(), DeleteArchivedFiles\execute(), DeleteDefaultMessages\execute(), GetTextMaint\execute(), UpdateRestrictions\execute(), UpdateSpecialPages\execute(), PruneFileCache\execute(), ResetUserEmail\execute(), CountFancyCaptchas\execute(), McTest\execute(), MigrateFileRepoLayout\execute(), EraseArchivedFile\execute(), Protect\execute(), ChangePassword\execute(), RenameDbPrefix\execute(), CopyJobQueue\execute(), CleanupSpam\execute(), UploadStashCleanup\execute(), FixDoubleRedirects\execute(), WrapOldPasswords\execute(), GenerateNormalizerDataAr\execute(), OrphanStats\execute(), FixTimestamps\execute(), ReassignEdits\execute(), EditCLI\execute(), PatchSql\execute(), PopulateContentModel\execute(), InvalidateUserSesssions\execute(), Digit2Html\execute(), SyncFileBackend\execute(), GenerateJsonI18n\execute(), DeleteOldFancyCaptchas\execute(), RollbackEdits\execute(), DumpIterator\execute(), MinifyScript\execute(), MwSql\execute(), DeleteBatch\execute(), ImportTextFiles\execute(), UpdateDoubleWidthSearch\execute(), PurgeChangedPages\execute(), GenerateCommonPassword\execute(), DumpRenderer\execute(), PurgeParserCache\execute(), SqliteMaintenance\execute(), MergeMessageFileList\execute(), RunJobs\execute(), RebuildTextIndex\execute(), MoveBatch\execute(), RefreshLinks\execute(), CopyFileBackend\execute(), PopulateInterwiki\execute(), CreateAndPromote\execute(), MediaWikiShell\execute(), RebuildFileCache\execute(), RebuildRecentchanges\execute(), RebuildLocalisationCache\execute(), GenerateFancyCaptchas\execute(), GenerateCollationData\execute(), FindHooks\execute(), UpdateSearchIndex\execute(), BenchmarkParse\execute(), ConvertLinks\execute(), ConvertExtensionToRegistration\execute(), DumpBackup\execute(), RecountCategories\execute(), PurgeChangedFiles\execute(), BackupReader\execute(), UpdateMediaWiki\execute(), RefreshImageMetadata\execute(), DeleteEqualMessages\execute(), CompressOld\execute(), MWDocGen\execute(), ImportImages\execute(), BackupDumper\fatalError(), GenerateCollationData\generateFirstChars(), RebuildSitesCache\getCacheFile(), MinifyScript\getExtension(), CopyFileBackend\getListingDiffRel(), BackupReader\getNsIndex(), RefreshLinks\getPossibleCategories(), ConvertExtensionToRegistration\handleExtensionFunctions(), ConvertExtensionToRegistration\handleHooks(), DumpRenderer\handleRevision(), DumpIterator\handleRevision(), BackupReader\importFromHandle(), ReassignEdits\initialiseUser(), SqliteMaintenance\integrityCheck(), loadSettings(), loadWithArgv(), MinifyScript\minify(), TitleCleanup\moveInconsistentPage(), ImageCleanup\pokeFile(), PopulateContentModel\populateRevisionOrArchive(), PreprocessDump\processRevision(), CompareParsers\processRevision(), PurgePage\purge(), PurgeChangedFiles\purgeFromArchiveTable(), PurgeChangedFiles\purgeFromLogType(), MergeMessageFileList\readFile(), RefreshLinks\refreshTrackingCategory(), runChild(), CommandLineInstaller\setDbPassOption(), setParam(), CommandLineInstaller\setPassOption(), setup(), RefreshImageMetadata\setupParameters(), MwSql\sqlDoQuery(), SyncFileBackend\syncBackends(), SyncFileBackend\syncFileBatch(), GenerateJsonI18n\transformI18nFile(), RefreshFileHeaders\updateFileHeaders(), RenameUserCleanup\updateTable(), SqliteMaintenance\vacuum(), GetConfiguration\validateParamsAndArgs(), validateParamsAndArgs(), and CLIParser\Wikitext().

◆ execute() [1/2]

public function Maintenance::execute ( )
inlineprivate

Definition at line 45 of file maintenance.txt.

◆ execute() [2/2]

Maintenance::execute ( )
abstract

Do the actual work.

All child classes will need to implement this

Reimplemented in LoggedUpdateMaintenance, FakeMaintenance, BackupDumper, FindDeprecated, TextPassDumper, MaintenanceFixup, ImportImages, GetConfiguration, MWDocGen, DumpCategoriesAsRdf, CompressOld, CommandLineInstaller, DeleteEqualMessages, RefreshImageMetadata, GenerateJqueryMsgData, UpdateMediaWiki, BackupReader, ParserTestsMaintenance, CleanupInvalidDbKeys, PurgeChangedFiles, CLIParser, RecountCategories, DumpBackup, NamespaceConflictChecker, ConvertExtensionToRegistration, PopulateCategory, UpdateCollation, BenchmarkParse, ConvertLinks, PHPUnitMaintClass, FindHooks, UpdateSearchIndex, CommandLineInc, GenerateCollationData, ImageBuilder, GenerateFancyCaptchas, RebuildLocalisationCache, RebuildFileCache, RebuildRecentchanges, MediaWikiShell, CreateAndPromote, PopulateInterwiki, CopyFileBackend, MoveBatch, RefreshLinks, PopulateImageSha1, RebuildTextIndex, RunJobs, MergeMessageFileList, ShowJobs, SqliteMaintenance, WatchlistCleanup, FetchText, NukeNS, PurgeParserCache, DumpRenderer, GenerateCommonPassword, Orphans, ResetUserTokens, CapsCleanup, ImportTextFiles, PurgeChangedPages, UpdateDoubleWidthSearch, TableCleanup, DeleteBatch, MwSql, DeleteOldFancyCaptchas, DumpIterator, MinifyScript, RollbackEdits, BatchedQueryRunner, GenerateJsonI18n, SyncFileBackend, BenchStrtrStrReplace, InvalidateUserSesssions, Digit2Html, DumpLinks, EditCLI, PatchSql, PopulateContentModel, CleanupRemovedModules, FixTimestamps, GenerateNormalizerDataAr, ReassignEdits, ShowSiteStats, OrphanStats, WrapOldPasswords, AttachLatest, CleanupSpam, UploadStashCleanup, ConvertUserOptions, CopyJobQueue, DeleteOrphanedRevisions, TestFileOpPerformance, FixDoubleRedirects, AlterSharedConstraints, RenameDbPrefix, FixT22757, CountFancyCaptchas, RenameUserCleanup, BenchWikimediaBaseConvert, ChangePassword, UploadDumper, EraseArchivedFile, GenerateNormalizerDataMl, McTest, MigrateFileRepoLayout, Protect, PurgeList, RefreshFileHeaders, ResetUserEmail, UpdateArticleCount, BenchmarkDeleteTruncate, CheckUsernames, DeleteArchivedRevisions, InitSiteStats, PruneFileCache, PurgeModuleDeps, RebuildAll, UpdateRestrictions, UpdateSpecialPages, DeleteArchivedFiles, DeleteDefaultMessages, GetTextMaint, ImportSiteScripts, LangMemUsage, NukePage, RemoveUnusedAccounts, AddSite, BenchHttpHttps, BenchIfSwitch, BenchWfIsWindows, CleanupAncientTables, CleanupBlocks, DeleteOldRevisions, GetLagTimes, InitEditCount, JSParseHelper, DateFormats, ListVariants, MakeTestEdits, MigrateUserGroup, BenchmarkHooks, BenchmarkJSMinPlus, BenchmarkLruHash, DeleteSelfExternals, FixUserRegistration, MaintenanceFormatInstallDoc, DumpMessages, ManageJobs, PurgeOldText, RebuildSitesCache, UpdateCSS, BenchmarkCSSMin, CheckImages, ClearInterwikiCache, GetSlaveServer, DatabaseLag, AllTrans, PurgePage, DumpRev, ViewCLI, BenchmarkPurge, CheckBadRedirects, CheckLess, CompareParserCache, InitUserPreference, RebuildMessages, Undelete, CleanupPreferences, FindMissingFiles, FindOrphanedFiles, PageExists, ParserEditTests, HHVMMakeRepo, ParserFuzzTest, ExportSites, ImportSites, StorageTypeStats, RemoveInvalidEmails, LU, CleanupArchiveUserText, CheckComposerLockUpToDate, GenerateRandomImages, BenchmarkTidy, UpdateExtensionJsonSchema, ValidateRegistrationFile, and TidyUpBug37714.

◆ finalSetup()

◆ getArg()

◆ getConfig()

◆ getDB()

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

Returns a database to be used by current maintenance script.

It can be set by setDB(). If not set, wfGetDB() will be used. This function has the same parameters as wfGetDB()

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

Reimplemented in OrphanStats.

Definition at line 1251 of file Maintenance.php.

References $mDb, and wfGetDB().

Referenced by ImageBuilder\buildTable(), Orphans\checkOrphans(), Orphans\checkSeparation(), Orphans\checkWidows(), CleanupSpam\cleanupArticle(), CleanupInvalidDbKeys\cleanupTable(), CompressOld\compressOldPages(), CompressOld\compressPage(), CompressOld\compressWithConcat(), ConvertLinks\createTempTable(), RefreshLinks\deleteLinksFromNonexistent(), NukePage\deleteRevisions(), RefreshLinks\dfnCheckInterval(), PopulatePPSortKey\doDBUpdates(), PopulateRecentChangesSource\doDBUpdates(), FixDefaultJsonContentPages\doDBUpdates(), PopulateRevisionLength\doDBUpdates(), PopulateRevisionSha1\doDBUpdates(), AddRFCAndPMIDInterwiki\doDBUpdates(), PopulateBacklinkNamespace\doDBUpdates(), PopulateFilearchiveSha1\doDBUpdates(), PopulateParentId\doDBUpdates(), FixExtLinksProtocolRelative\doDBUpdates(), PopulateLogUsertext\doDBUpdates(), PopulateLogSearch\doDBUpdates(), PopulateImageSha1\doDBUpdates(), PopulateIpChanges\doDBUpdates(), DeleteOldRevisions\doDelete(), PopulateRevisionLength\doLenUpdates(), ReassignEdits\doReassignEdits(), RefreshLinks\doRefreshLinks(), PopulateRevisionSha1\doSha1LegacyUpdates(), PopulateRevisionSha1\doSha1Updates(), UpdateSearchIndex\doUpdateSearchIndex(), RecountCategories\doWork(), TidyUpBug37714\execute(), RemoveInvalidEmails\execute(), StorageTypeStats\execute(), CleanupPreferences\execute(), CompareParserCache\execute(), CheckBadRedirects\execute(), InitUserPreference\execute(), ClearInterwikiCache\execute(), GetSlaveServer\execute(), CheckImages\execute(), DumpRev\execute(), DeleteSelfExternals\execute(), FixUserRegistration\execute(), CleanupAncientTables\execute(), CleanupBlocks\execute(), InitEditCount\execute(), MigrateUserGroup\execute(), DeleteDefaultMessages\execute(), DeleteArchivedFiles\execute(), RemoveUnusedAccounts\execute(), NukePage\execute(), BenchmarkDeleteTruncate\execute(), UpdateRestrictions\execute(), UpdateSpecialPages\execute(), CheckUsernames\execute(), InitSiteStats\execute(), PurgeModuleDeps\execute(), RebuildAll\execute(), DeleteArchivedRevisions\execute(), UpdateArticleCount\execute(), EraseArchivedFile\execute(), RefreshFileHeaders\execute(), DeleteOrphanedRevisions\execute(), CleanupSpam\execute(), AlterSharedConstraints\execute(), AttachLatest\execute(), FixDoubleRedirects\execute(), ConvertUserOptions\execute(), RenameDbPrefix\execute(), FixT22757\execute(), WrapOldPasswords\execute(), FixTimestamps\execute(), CleanupRemovedModules\execute(), ShowSiteStats\execute(), PatchSql\execute(), PopulateContentModel\execute(), DumpLinks\execute(), BatchedQueryRunner\execute(), DeleteBatch\execute(), UpdateDoubleWidthSearch\execute(), PurgeChangedPages\execute(), ResetUserTokens\execute(), NukeNS\execute(), FetchText\execute(), SqliteMaintenance\execute(), RebuildTextIndex\execute(), MoveBatch\execute(), RebuildFileCache\execute(), ImageBuilder\execute(), ConvertLinks\execute(), PopulateCategory\execute(), UpdateCollation\execute(), NamespaceConflictChecker\execute(), PurgeChangedFiles\execute(), UpdateMediaWiki\execute(), RefreshImageMetadata\execute(), DeleteEqualMessages\execute(), DumpCategoriesAsRdf\execute(), LoggedUpdateMaintenance\execute(), UploadDumper\fetchLocal(), UploadDumper\fetchUsed(), TitleCleanup\fileExists(), RefreshLinks\fixRedirect(), BenchmarkParse\getRevIdForTime(), FixT22757\getRevTextMap(), RollbackEdits\getRollbackTitles(), FixDefaultJsonContentPages\handleRow(), BackupReader\handleUpload(), RemoveUnusedAccounts\isInactiveAccount(), ImageCleanup\killRow(), MigrateComments\migrate(), MigrateComments\migrateToTemp(), TitleCleanup\moveIllegalPage(), TitleCleanup\moveInconsistentPage(), ImageCleanup\pokeFile(), PurgeChangedFiles\purgeFromLogType(), PurgeList\purgeNamespace(), purgeRedundantText(), RebuildRecentchanges\rebuildRecentChangesTablePass1(), RebuildRecentchanges\rebuildRecentChangesTablePass2(), RebuildRecentchanges\rebuildRecentChangesTablePass3(), RebuildRecentchanges\rebuildRecentChangesTablePass4(), RefreshLinks\refreshCategory(), WatchlistCleanup\removeWatch(), TableCleanup\runTable(), EraseArchivedFile\scrubAllVersions(), PopulateRevisionSha1\upgradeLegacyArchiveRow(), PopulateRevisionLength\upgradeRow(), and PopulateRevisionSha1\upgradeRow().

◆ getDbType()

Maintenance::getDbType ( )

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

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

Returns
int

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

Definition at line 459 of file Maintenance.php.

References DB_STD.

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

◆ getDir()

Maintenance::getDir ( )
protected

Get the maintenance directory.

Returns
string

Definition at line 1237 of file Maintenance.php.

◆ getName()

Maintenance::getName ( )

Get the script's name.

Returns
string

Definition at line 336 of file Maintenance.php.

References $mSelf.

◆ getOption()

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

Get an option, or return the default.

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

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

Reimplemented in MaintenanceFixup.

Definition at line 250 of file Maintenance.php.

References $name, and hasOption().

Referenced by activateProfiler(), Benchmarker\bench(), PreprocessDump\checkOptions(), CompareParsers\checkOptions(), SqliteMaintenance\checkSyntax(), RenameUserCleanup\checkUserExistence(), PopulateBacklinkNamespace\doDBUpdates(), PopulateImageSha1\doDBUpdates(), PopulateIpChanges\doDBUpdates(), TestFileOpPerformance\doPerfTest(), PurgeList\doPurge(), UpdateSpecialPages\doSpecialPageCacheUpdates(), BenchmarkTidy\execute(), LU\execute(), ParserFuzzTest\execute(), HHVMMakeRepo\execute(), FindMissingFiles\execute(), FindOrphanedFiles\execute(), ParserEditTests\execute(), Undelete\execute(), CompareParserCache\execute(), InitUserPreference\execute(), BenchmarkPurge\execute(), BenchmarkCSSMin\execute(), GetSlaveServer\execute(), ManageJobs\execute(), MaintenanceFormatInstallDoc\execute(), BenchmarkJSMinPlus\execute(), MakeTestEdits\execute(), AddSite\execute(), RemoveUnusedAccounts\execute(), ImportSiteScripts\execute(), UpdateSpecialPages\execute(), PruneFileCache\execute(), ChangePassword\execute(), McTest\execute(), UploadDumper\execute(), MigrateFileRepoLayout\execute(), EraseArchivedFile\execute(), BenchWikimediaBaseConvert\execute(), Protect\execute(), PurgeList\execute(), RenameUserCleanup\execute(), RefreshFileHeaders\execute(), TestFileOpPerformance\execute(), FixDoubleRedirects\execute(), CopyJobQueue\execute(), RenameDbPrefix\execute(), FixT22757\execute(), GenerateNormalizerDataAr\execute(), WrapOldPasswords\execute(), EditCLI\execute(), PopulateContentModel\execute(), InvalidateUserSesssions\execute(), GenerateJsonI18n\execute(), SyncFileBackend\execute(), MinifyScript\execute(), DumpIterator\execute(), DeleteOldFancyCaptchas\execute(), BatchedQueryRunner\execute(), RollbackEdits\execute(), DeleteBatch\execute(), MwSql\execute(), CapsCleanup\execute(), PurgeChangedPages\execute(), ImportTextFiles\execute(), UpdateDoubleWidthSearch\execute(), ResetUserTokens\execute(), GenerateCommonPassword\execute(), NukeNS\execute(), DumpRenderer\execute(), PurgeParserCache\execute(), MergeMessageFileList\execute(), ShowJobs\execute(), SqliteMaintenance\execute(), PopulateImageSha1\execute(), RunJobs\execute(), MoveBatch\execute(), RefreshLinks\execute(), CopyFileBackend\execute(), PopulateInterwiki\execute(), CreateAndPromote\execute(), RebuildFileCache\execute(), GenerateFancyCaptchas\execute(), RebuildLocalisationCache\execute(), GenerateCollationData\execute(), UpdateSearchIndex\execute(), PHPUnitMaintClass\execute(), BenchmarkParse\execute(), PopulateCategory\execute(), UpdateCollation\execute(), ConvertExtensionToRegistration\execute(), NamespaceConflictChecker\execute(), RecountCategories\execute(), PurgeChangedFiles\execute(), CleanupInvalidDbKeys\execute(), ParserTestsMaintenance\execute(), BackupReader\execute(), UpdateMediaWiki\execute(), RefreshImageMetadata\execute(), DeleteEqualMessages\execute(), CommandLineInstaller\execute(), CompressOld\execute(), DumpCategoriesAsRdf\execute(), GetConfiguration\execute(), ImportImages\execute(), GetConfiguration\finalSetup(), finalSetup(), RebuildSitesCache\getCacheFile(), RefreshImageMetadata\getConditions(), CLIParser\getTitle(), BackupReader\importFromHandle(), MWDocGen\init(), loadSpecialVars(), memoryLimit(), CLIParser\parse(), DumpBackup\processOptions(), TextPassDumper\processOptions(), BackupDumper\processOptions(), CompareParsers\processRevision(), SearchDump\processRevision(), PurgePage\purge(), PurgeChangedFiles\purgeFromLogType(), RebuildRecentchanges\rebuildRecentChangesTablePass1(), PurgeList\sendPurgeRequest(), CommandLineInstaller\setDbPassOption(), CommandLineInstaller\setPassOption(), MediaWikiShell\setupLegacy(), SyncFileBackend\syncFileBatch(), and GetConfiguration\validateParamsAndArgs().

◆ getStdin()

Maintenance::getStdin (   $len = null)
protected

Return input from stdin.

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

Reimplemented in SemiMockedFetchText.

Definition at line 346 of file Maintenance.php.

References $input.

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

◆ getTermSize()

static Maintenance::getTermSize ( )
static

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

Returns
array

Definition at line 1515 of file Maintenance.php.

References $retval, wfIsWindows(), and wfShellExec().

Referenced by ParserEditTests\execute().

◆ globals()

Maintenance::globals ( )

Potentially debug globals.

Originally a feature only for refreshLinks

Definition at line 1139 of file Maintenance.php.

References $GLOBALS, and hasOption().

◆ hasArg()

Maintenance::hasArg (   $argId = 0)
protected

Does a given argument exist?

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

Definition at line 296 of file Maintenance.php.

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

◆ hasOption()

Maintenance::hasOption (   $name)
protected

Checks to see if a particular param exists.

Parameters
string$nameThe name of the param
Returns
bool

Definition at line 236 of file Maintenance.php.

References $name.

Referenced by Benchmarker\bench(), PreprocessDump\checkOptions(), CompareParsers\checkOptions(), CleanupSpam\cleanupArticle(), CleanupInvalidDbKeys\cleanupTable(), CopyFileBackend\copyFileBatch(), ConvertLinks\createTempTable(), PopulateImageSha1\doDBUpdates(), TestFileOpPerformance\doPerfTest(), UpdateSpecialPages\doSpecialPageCacheUpdates(), BenchmarkTidy\execute(), RemoveInvalidEmails\execute(), FindOrphanedFiles\execute(), ParserEditTests\execute(), BenchmarkPurge\execute(), GetSlaveServer\execute(), BenchmarkCSSMin\execute(), DatabaseLag\execute(), PurgeOldText\execute(), MaintenanceFormatInstallDoc\execute(), BenchmarkLruHash\execute(), DeleteOldRevisions\execute(), ListVariants\execute(), CleanupAncientTables\execute(), GetLagTimes\execute(), InitEditCount\execute(), DeleteDefaultMessages\execute(), NukePage\execute(), RemoveUnusedAccounts\execute(), GetTextMaint\execute(), DeleteArchivedFiles\execute(), UpdateSpecialPages\execute(), InitSiteStats\execute(), DeleteArchivedRevisions\execute(), UploadDumper\execute(), EraseArchivedFile\execute(), Protect\execute(), ChangePassword\execute(), PurgeList\execute(), RefreshFileHeaders\execute(), ResetUserEmail\execute(), UpdateArticleCount\execute(), AttachLatest\execute(), CleanupSpam\execute(), DeleteOrphanedRevisions\execute(), FixDoubleRedirects\execute(), GenerateNormalizerDataAr\execute(), WrapOldPasswords\execute(), ReassignEdits\execute(), EditCLI\execute(), GenerateJsonI18n\execute(), SyncFileBackend\execute(), MinifyScript\execute(), DumpIterator\execute(), RollbackEdits\execute(), TableCleanup\execute(), MwSql\execute(), PurgeChangedPages\execute(), CapsCleanup\execute(), ImportTextFiles\execute(), Orphans\execute(), WatchlistCleanup\execute(), NukeNS\execute(), DumpRenderer\execute(), MergeMessageFileList\execute(), ShowJobs\execute(), SqliteMaintenance\execute(), PopulateImageSha1\execute(), RunJobs\execute(), MoveBatch\execute(), RefreshLinks\execute(), CopyFileBackend\execute(), PopulateInterwiki\execute(), CreateAndPromote\execute(), RebuildRecentchanges\execute(), RebuildFileCache\execute(), MediaWikiShell\execute(), RebuildLocalisationCache\execute(), GenerateFancyCaptchas\execute(), ImageBuilder\execute(), UpdateSearchIndex\execute(), PHPUnitMaintClass\execute(), BenchmarkParse\execute(), ConvertLinks\execute(), PopulateCategory\execute(), UpdateCollation\execute(), ConvertExtensionToRegistration\execute(), DumpBackup\execute(), NamespaceConflictChecker\execute(), PurgeChangedFiles\execute(), CleanupInvalidDbKeys\execute(), ParserTestsMaintenance\execute(), BackupReader\execute(), UpdateMediaWiki\execute(), RefreshImageMetadata\execute(), DeleteEqualMessages\execute(), CommandLineInstaller\execute(), ImportImages\execute(), LoggedUpdateMaintenance\execute(), CopyFileBackend\filesAreSame(), GetConfiguration\finalSetup(), finalSetup(), UpdateCollation\getBatchCondition(), RebuildSitesCache\getCacheFile(), CommandLineInstaller\getDbType(), FindHooks\getHooksFromDoc(), getOption(), globals(), ConvertExtensionToRegistration\handleResourceModules(), BackupReader\importFromHandle(), MWDocGen\init(), loadSpecialVars(), maybeHelp(), RunJobs\memoryLimit(), DumpBackup\processOptions(), TextPassDumper\processOptions(), BackupDumper\processOptions(), PurgeChangedFiles\purgeFromLogType(), RebuildRecentchanges\rebuildRecentChangesTablePass1(), WatchlistCleanup\removeWatch(), EraseArchivedFile\scrubVersion(), PurgeList\sendPurgeRequest(), CommandLineInstaller\validateParamsAndArgs(), validateParamsAndArgs(), and PurgeChangedFiles\verbose().

◆ isQuiet()

Maintenance::isQuiet ( )
Returns
bool

Definition at line 363 of file Maintenance.php.

References $mQuiet.

Referenced by SyncFileBackend\execute().

◆ loadParamsAndArgs()

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

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

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

Definition at line 876 of file Maintenance.php.

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

Referenced by CategoryMembershipChangeJobTest\runJobs(), setup(), WikiPageTest\testDoDeleteArticle(), WikiPageTest\testDoDeleteUpdates(), and TemplateCategoriesTest\testTemplateCategories().

◆ loadSettings()

Maintenance::loadSettings ( )

Generic setup for most installs.

Returns the location of LocalSettings

Returns
string

Definition at line 1149 of file Maintenance.php.

References $IP, $wgCommandLineMode, captcha-old\count, error(), and global.

◆ loadSpecialVars()

Maintenance::loadSpecialVars ( )
protected

Handle the special variables that are global to all scripts.

Definition at line 933 of file Maintenance.php.

References getOption(), and hasOption().

Referenced by loadParamsAndArgs(), and loadWithArgv().

◆ loadWithArgv()

Maintenance::loadWithArgv (   $argv)

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

Since
1.27
Parameters
array$argv

Definition at line 763 of file Maintenance.php.

References $args, $argv, $options, captcha-old\count, error(), loadSpecialVars(), maybeHelp(), and setParam().

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

◆ lockSearchindex()

Maintenance::lockSearchindex (   $db)
private

Lock the search index.

Parameters
IMaintainableDatabase&$db

Definition at line 1326 of file Maintenance.php.

Referenced by relockSearchindex(), and updateSearchIndex().

◆ maybeHelp()

Maintenance::maybeHelp (   $force = false)
protected

◆ memoryLimit()

Maintenance::memoryLimit ( )

Normally we disable the memory_limit when running admin scripts.

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

Returns
string

Reimplemented in RunJobs.

Definition at line 700 of file Maintenance.php.

References getOption().

Referenced by adjustMemoryLimit(), and ParserFuzzTest\fuzzTest().

◆ output()

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

Throw some output to the user.

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

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

Reimplemented in MaintenanceFixup.

Definition at line 373 of file Maintenance.php.

References $out, cleanupChanneled(), and outputChanneled().

Referenced by DumpBackup\__construct(), TextPassDumper\__construct(), ImageBuilder\addMissingImage(), Benchmarker\addResult(), SqliteMaintenance\backup(), ImageBuilder\buildTable(), NamespaceConflictChecker\checkAll(), FindOrphanedFiles\checkFiles(), NamespaceConflictChecker\checkLinkTable(), NamespaceConflictChecker\checkNamespace(), Orphans\checkOrphans(), NamespaceConflictChecker\checkPrefix(), RenameUserCleanup\checkRenameLog(), Orphans\checkSeparation(), SqliteMaintenance\checkSyntax(), RenameUserCleanup\checkUserExistence(), Orphans\checkWidows(), CleanupSpam\cleanupArticle(), RebuildTextIndex\clearSearchIndex(), CompressOld\compressOldPages(), CompressOld\compressWithConcat(), CompareParsers\conclusions(), CopyFileBackend\copyFileBatch(), RebuildTextIndex\createMysqlTextIndex(), ConvertLinks\createTempTable(), RunJobs\debugInternal(), ManageJobs\delete(), RefreshLinks\deleteLinksFromNonexistent(), CopyFileBackend\delFileBatch(), RefreshLinks\dfnCheckInterval(), PopulatePPSortKey\doDBUpdates(), PopulateRecentChangesSource\doDBUpdates(), PopulateRevisionLength\doDBUpdates(), PopulateRevisionSha1\doDBUpdates(), FixDefaultJsonContentPages\doDBUpdates(), PopulateBacklinkNamespace\doDBUpdates(), PopulateFilearchiveSha1\doDBUpdates(), PopulateParentId\doDBUpdates(), MigrateComments\doDBUpdates(), FixExtLinksProtocolRelative\doDBUpdates(), PopulateLogUsertext\doDBUpdates(), PopulateLogSearch\doDBUpdates(), PopulateImageSha1\doDBUpdates(), PopulateIpChanges\doDBUpdates(), DeleteOldRevisions\doDelete(), PopulateRevisionLength\doLenUpdates(), TestFileOpPerformance\doPerfTest(), PopulateInterwiki\doPopulate(), PurgeList\doPurge(), ReassignEdits\doReassignEdits(), RebuildLocalisationCache\doRebuild(), RefreshLinks\doRefreshLinks(), PopulateRevisionSha1\doSha1LegacyUpdates(), PopulateRevisionSha1\doSha1Updates(), UpdateSpecialPages\doSpecialPageCacheUpdates(), UpdateSearchIndex\doUpdateSearchIndex(), RecountCategories\doWork(), RebuildTextIndex\dropMysqlTextIndex(), TidyUpBug37714\execute(), ValidateRegistrationFile\execute(), UpdateExtensionJsonSchema\execute(), CheckComposerLockUpToDate\execute(), CleanupArchiveUserText\execute(), LU\execute(), RemoveInvalidEmails\execute(), ExportSites\execute(), ImportSites\execute(), PageExists\execute(), FindMissingFiles\execute(), FindOrphanedFiles\execute(), CleanupPreferences\execute(), Undelete\execute(), BenchmarkPurge\execute(), CheckBadRedirects\execute(), CompareParserCache\execute(), RebuildMessages\execute(), InitUserPreference\execute(), ViewCLI\execute(), CheckImages\execute(), UpdateCSS\execute(), ClearInterwikiCache\execute(), GetSlaveServer\execute(), DatabaseLag\execute(), AllTrans\execute(), DumpRev\execute(), DeleteSelfExternals\execute(), FixUserRegistration\execute(), DumpMessages\execute(), DeleteOldRevisions\execute(), MigrateUserGroup\execute(), CleanupAncientTables\execute(), CleanupBlocks\execute(), GetLagTimes\execute(), InitEditCount\execute(), JSParseHelper\execute(), DateFormats\execute(), MakeTestEdits\execute(), DeleteDefaultMessages\execute(), NukePage\execute(), GetTextMaint\execute(), ImportSiteScripts\execute(), RemoveUnusedAccounts\execute(), LangMemUsage\execute(), DeleteArchivedFiles\execute(), UpdateRestrictions\execute(), CheckUsernames\execute(), PruneFileCache\execute(), PurgeModuleDeps\execute(), RebuildAll\execute(), UpdateSpecialPages\execute(), InitSiteStats\execute(), DeleteArchivedRevisions\execute(), McTest\execute(), MigrateFileRepoLayout\execute(), ChangePassword\execute(), CountFancyCaptchas\execute(), EraseArchivedFile\execute(), Protect\execute(), PurgeList\execute(), RefreshFileHeaders\execute(), RenameUserCleanup\execute(), UpdateArticleCount\execute(), CleanupSpam\execute(), DeleteOrphanedRevisions\execute(), AlterSharedConstraints\execute(), RenameDbPrefix\execute(), UploadStashCleanup\execute(), AttachLatest\execute(), FixDoubleRedirects\execute(), ConvertUserOptions\execute(), CopyJobQueue\execute(), CleanupRemovedModules\execute(), WrapOldPasswords\execute(), FixTimestamps\execute(), ReassignEdits\execute(), ShowSiteStats\execute(), OrphanStats\execute(), DumpLinks\execute(), EditCLI\execute(), PatchSql\execute(), InvalidateUserSesssions\execute(), Digit2Html\execute(), GenerateJsonI18n\execute(), SyncFileBackend\execute(), BatchedQueryRunner\execute(), RollbackEdits\execute(), DeleteOldFancyCaptchas\execute(), TableCleanup\execute(), DeleteBatch\execute(), PurgeChangedPages\execute(), CapsCleanup\execute(), ImportTextFiles\execute(), UpdateDoubleWidthSearch\execute(), ResetUserTokens\execute(), GenerateCommonPassword\execute(), PurgeParserCache\execute(), NukeNS\execute(), FetchText\execute(), WatchlistCleanup\execute(), ShowJobs\execute(), RunJobs\execute(), RebuildTextIndex\execute(), MoveBatch\execute(), CopyFileBackend\execute(), CreateAndPromote\execute(), RebuildRecentchanges\execute(), RebuildFileCache\execute(), RebuildLocalisationCache\execute(), GenerateFancyCaptchas\execute(), FindHooks\execute(), ConvertLinks\execute(), UpdateCollation\execute(), PopulateCategory\execute(), ConvertExtensionToRegistration\execute(), NamespaceConflictChecker\execute(), RecountCategories\execute(), BackupReader\execute(), UpdateMediaWiki\execute(), RefreshImageMetadata\execute(), DeleteEqualMessages\execute(), CompressOld\execute(), MWDocGen\execute(), GetConfiguration\execute(), ImportImages\execute(), LoggedUpdateMaintenance\execute(), DeleteEqualMessages\fetchMessageInfo(), ImportSiteScripts\fetchScriptList(), GetConfiguration\formatVarDump(), ConvertExtensionToRegistration\handleExtensionMessagesFiles(), ConvertExtensionToRegistration\handleHooks(), DumpRenderer\handleRevision(), DumpIterator\handleRevision(), FixDefaultJsonContentPages\handleRow(), MWDocGen\init(), SqliteMaintenance\integrityCheck(), ImageCleanup\killRow(), maybeHelp(), MigrateComments\migrate(), MigrateComments\migrateToTemp(), MinifyScript\minify(), TitleCleanup\moveIllegalPage(), TitleCleanup\moveInconsistentPage(), CapsCleanup\movePage(), ImageBuilder\oldimageCallback(), UploadDumper\outputItem(), ImageCleanup\pokeFile(), PopulateContentModel\populatePage(), PopulateContentModel\populateRevisionOrArchive(), RebuildTextIndex\populateSearchIndex(), FindHooks\printArray(), CompareParsers\processRevision(), SearchDump\processRevision(), TitleCleanup\processRow(), ImageCleanup\processRow(), WatchlistCleanup\processRow(), CapsCleanup\processRowToLowercase(), CapsCleanup\processRowToUppercase(), TableCleanup\progress(), ImageBuilder\progress(), PruneFileCache\prune_directory(), PurgePage\purge(), RebuildRecentchanges\purgeFeeds(), PurgeChangedFiles\purgeFromArchiveTable(), purgeRedundantText(), FixDoubleRedirects\queueJobs(), RebuildRecentchanges\rebuildRecentChangesTablePass1(), RebuildRecentchanges\rebuildRecentChangesTablePass2(), RebuildRecentchanges\rebuildRecentChangesTablePass3(), RebuildRecentchanges\rebuildRecentChangesTablePass4(), RebuildRecentchanges\rebuildRecentChangesTablePass5(), RefreshLinks\refreshCategory(), WatchlistCleanup\removeWatch(), ImportSites\reportException(), ManageJobs\repushAbandoned(), MigrateFileRepoLayout\runBatch(), TableCleanup\runTable(), EraseArchivedFile\scrubVersion(), PurgeList\sendPurgeRequest(), PurgeParserCache\showProgressAndWait(), UpdateCollation\showSortKeySizeHistogram(), MwSql\sqlPrintResult(), Benchmarker\startBench(), SyncFileBackend\syncBackends(), SyncFileBackend\syncFileBatch(), GenerateJsonI18n\transformI18nFile(), PopulateContentModel\updatePageRows(), PopulateContentModel\updateRevisionOrArchiveRows(), updateSearchIndex(), updateSearchIndexForPage(), RenameUserCleanup\updateTable(), ResetUserTokens\updateUser(), PopulateRevisionSha1\upgradeLegacyArchiveRow(), PopulateRevisionLength\upgradeRow(), PopulateRevisionSha1\upgradeRow(), SqliteMaintenance\vacuum(), PurgeChangedFiles\verbose(), and Benchmarker\verboseRun().

◆ outputChanneled()

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

Message outputter with channeled message support.

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

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

Reimplemented in MaintenanceFixup.

Definition at line 426 of file Maintenance.php.

References cleanupChanneled().

Referenced by error(), and output().

◆ posix_isatty()

static Maintenance::posix_isatty (   $fd)
static

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

Parameters
mixed$fdFile descriptor
Returns
bool

Definition at line 1427 of file Maintenance.php.

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

◆ purgeRedundantText()

Maintenance::purgeRedundantText (   $delete = true)

Support function for cleaning up redundant text records.

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

Definition at line 1183 of file Maintenance.php.

References $res, as, beginTransaction(), commitTransaction(), captcha-old\count, DB_MASTER, getDB(), and output().

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

◆ readconsole()

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

Prompt the console for input.

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

Definition at line 1440 of file Maintenance.php.

References posix_isatty(), and readlineEmulation().

Referenced by MwSql\execute(), and ParserEditTests\handleFailure().

◆ readlineEmulation()

static Maintenance::readlineEmulation (   $prompt)
staticprivate

Emulate readline()

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

Definition at line 1478 of file Maintenance.php.

References $command, $line, $retval, Installer\locateExecutableInDefaultPaths(), wfEscapeShellArg(), wfIsWindows(), and wfShellExec().

Referenced by readconsole().

◆ relockSearchindex()

Maintenance::relockSearchindex (   $db)
private

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

Parameters
IMaintainableDatabase&$db

Definition at line 1353 of file Maintenance.php.

References lockSearchindex(), and unlockSearchindex().

Referenced by updateSearchIndex().

◆ requireExtension()

Maintenance::requireExtension (   $name)
protected

Indicate that the specified extension must be loaded before the script can run.

This must be called in the constructor.

Since
1.28
Parameters
string$name

Definition at line 529 of file Maintenance.php.

References $name.

Referenced by CountFancyCaptchas\__construct(), DeleteOldFancyCaptchas\__construct(), and GenerateFancyCaptchas\__construct().

◆ requireTestsAutoloader()

static Maintenance::requireTestsAutoloader ( )
static

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

Definition at line 1542 of file Maintenance.php.

Referenced by CheckLess\execute(), ParserFuzzTest\finalSetup(), ParserEditTests\finalSetup(), PHPUnitMaintClass\finalSetup(), and ParserTestsMaintenance\finalSetup().

◆ rollbackTransaction()

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

Rollback the transcation on a DB handle.

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

Parameters
IDatabase$dbw
string$fnameCaller name
Since
1.27

Definition at line 1318 of file Maintenance.php.

References $fname, and Wikimedia\Rdbms\IDatabase\rollback().

Referenced by ImageCleanup\pokeFile(), and RenameUserCleanup\updateTable().

◆ runChild()

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

Run a child maintenance script.

Pass all of the current arguments to it.

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

Definition at line 613 of file Maintenance.php.

References $maintClass, and error().

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

◆ setAgentAndTriggers()

Maintenance::setAgentAndTriggers ( )

Set triggers like when to try to run deferred updates.

Since
1.28

Definition at line 559 of file Maintenance.php.

References setLBFactoryTriggers(), and wfHostname().

◆ setBatchSize()

Maintenance::setBatchSize (   $s = 0)
protected

Set the batch size.

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

Definition at line 314 of file Maintenance.php.

References $s, and addOption().

Referenced by InitUserPreference\__construct(), RemoveInvalidEmails\__construct(), FindMissingFiles\__construct(), FindOrphanedFiles\__construct(), MakeTestEdits\__construct(), CheckImages\__construct(), MigrateUserGroup\__construct(), PurgeList\__construct(), SyncFileBackend\__construct(), FixDefaultJsonContentPages\__construct(), PopulatePPSortKey\__construct(), FixUserRegistration\__construct(), RebuildFileCache\__construct(), RefreshFileHeaders\__construct(), MigrateFileRepoLayout\__construct(), CleanupBlocks\__construct(), PopulateRevisionLength\__construct(), PopulateRevisionSha1\__construct(), PurgeModuleDeps\__construct(), MigrateComments\__construct(), CopyJobQueue\__construct(), PopulateRecentChangesSource\__construct(), WrapOldPasswords\__construct(), UpdateRestrictions\__construct(), CheckUsernames\__construct(), PopulateLogUsertext\__construct(), ResetUserTokens\__construct(), InvalidateUserSesssions\__construct(), PopulateContentModel\__construct(), CleanupRemovedModules\__construct(), UploadStashCleanup\__construct(), ConvertUserOptions\__construct(), RecountCategories\__construct(), PurgeChangedPages\__construct(), RefreshLinks\__construct(), RebuildRecentchanges\__construct(), PopulateLogSearch\__construct(), CopyFileBackend\__construct(), DumpCategoriesAsRdf\__construct(), RefreshImageMetadata\__construct(), CleanupInvalidDbKeys\__construct(), PurgeChangedFiles\__construct(), and LoggedUpdateMaintenance\__construct().

◆ setConfig()

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

Definition at line 516 of file Maintenance.php.

References $config.

◆ setDB()

Maintenance::setDB ( IDatabase  $db)

Sets database object to be returned by getDB().

Parameters
IDatabase$db

Reimplemented in BackupDumper.

Definition at line 1264 of file Maintenance.php.

Referenced by DatabaseUpdater\__construct().

◆ setLBFactoryTriggers()

static Maintenance::setLBFactoryTriggers ( LBFactory  $LBFactory)
static
Parameters
LBFactory$LBFactory
Since
1.28

Definition at line 579 of file Maintenance.php.

References $wgCommandLineMode, global, and DeferredUpdates\tryOpportunisticExecute().

Referenced by setAgentAndTriggers(), and MediaWikiTestCase\setUp().

◆ setParam()

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

Helper function used solely by loadParamsAndArgs to prevent code duplication.

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

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

Definition at line 846 of file Maintenance.php.

References $options, $value, error(), and maybeHelp().

Referenced by loadWithArgv().

◆ setup()

Maintenance::setup ( )

Do some sanity checking and basic setup.

Definition at line 639 of file Maintenance.php.

References $IP, $wgCommandLineMode, $wgRequestTime, adjustMemoryLimit(), error(), global, loadParamsAndArgs(), maybeHelp(), and validateParamsAndArgs().

◆ shouldExecute()

static Maintenance::shouldExecute ( )
static

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

Returns
bool

Definition at line 173 of file Maintenance.php.

References $wgCommandLineMode, captcha-old\count, and global.

◆ unlockSearchindex()

Maintenance::unlockSearchindex (   $db)
private

Unlock the tables.

Parameters
IMaintainableDatabase&$db

Definition at line 1344 of file Maintenance.php.

Referenced by relockSearchindex(), and updateSearchIndex().

◆ updateSearchIndex()

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

Perform a search index update with locking.

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

Definition at line 1365 of file Maintenance.php.

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

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

◆ updateSearchIndexForPage()

Maintenance::updateSearchIndexForPage (   $dbw,
  $pageId 
)

Update the searchindex table for a given pageid.

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

Definition at line 1402 of file Maintenance.php.

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

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

◆ validateParamsAndArgs()

Maintenance::validateParamsAndArgs ( )
protected

Run some validation checks on the params, etc.

Reimplemented in CommandLineInstaller, and GetConfiguration.

Definition at line 908 of file Maintenance.php.

References $opt, as, error(), hasArg(), hasOption(), and maybeHelp().

Referenced by setup().

Member Data Documentation

◆ $atLineStart

Maintenance::$atLineStart = true
private

Definition at line 405 of file Maintenance.php.

◆ $config

Config Maintenance::$config
private

◆ $fileHandle

resource Maintenance::$fileHandle

Used when creating separate schema files.

Definition at line 123 of file Maintenance.php.

◆ $lastChannel

Maintenance::$lastChannel = null
private

Definition at line 406 of file Maintenance.php.

◆ $lastReplicationWait

float Maintenance::$lastReplicationWait = 0.0
private

UNIX timestamp.

Definition at line 117 of file Maintenance.php.

◆ $mArgList

Maintenance::$mArgList = []
protected

Definition at line 76 of file Maintenance.php.

◆ $mArgs

Maintenance::$mArgs = []
protected

Definition at line 82 of file Maintenance.php.

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

◆ $mBatchSize

◆ $mDb

IMaintainableDatabase Maintenance::$mDb = null
private

Used by getDB() / setDB()

Definition at line 114 of file Maintenance.php.

Referenced by getDB().

◆ $mDbPass

Maintenance::$mDbPass

Definition at line 89 of file Maintenance.php.

Referenced by finalSetup().

◆ $mDbUser

Maintenance::$mDbUser
protected

Definition at line 89 of file Maintenance.php.

Referenced by finalSetup().

◆ $mDependantParameters

Maintenance::$mDependantParameters = []
private

Definition at line 108 of file Maintenance.php.

Referenced by maybeHelp().

◆ $mDescription

Maintenance::$mDescription = ''
protected

Definition at line 92 of file Maintenance.php.

◆ $mGenericParameters

Maintenance::$mGenericParameters = []
private

Definition at line 106 of file Maintenance.php.

◆ $mInputLoaded

Maintenance::$mInputLoaded = false
protected

Definition at line 95 of file Maintenance.php.

◆ $mOptions

Maintenance::$mOptions = []
protected

Definition at line 79 of file Maintenance.php.

Referenced by CommandLineInc\execute().

◆ $mParams

Maintenance::$mParams = []
protected

Definition at line 70 of file Maintenance.php.

Referenced by addDefaultParams().

◆ $mQuiet

Maintenance::$mQuiet = false
protected

Definition at line 88 of file Maintenance.php.

Referenced by isQuiet().

◆ $mSelf

Maintenance::$mSelf
protected

Definition at line 85 of file Maintenance.php.

Referenced by getName().

◆ $mShortParamsMap

Maintenance::$mShortParamsMap = []
protected

Definition at line 73 of file Maintenance.php.

◆ $orderedOptions

array Maintenance::$orderedOptions = []

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

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

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

Definition at line 149 of file Maintenance.php.

Referenced by BackupDumper\processOptions().

◆ $requiredExtensions

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

Definition at line 136 of file Maintenance.php.

◆ DB_ADMIN

◆ DB_NONE

◆ DB_STD

const Maintenance::DB_STD = 1

Definition at line 63 of file Maintenance.php.

Referenced by getDbType().

◆ STDIN_ALL

const Maintenance::STDIN_ALL = 'all'

Definition at line 67 of file Maintenance.php.

Referenced by EditCLI\execute().


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