MediaWiki  REL1_24
Maintenance Class Reference

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

Inherited by AllTrans, AlterSharedConstraints, AttachLatest, BackupReader, BatchedQueryRunner, Benchmarker, BenchmarkParse, ChangePassword, CheckBadRedirects, CheckImages, CheckLess, CheckSyntax, CheckUsernames, CleanupAncientTables, CleanupPreferences, CleanupRemovedModules, CleanupSpam, ClearCacheStats, ClearInterwikiCache, CLIParser, CommandLineInc, CommandLineInstaller, CompareParserCache, CompressOld, ConvertLinks, ConvertUserOptions, CopyFileBackend, CopyJobQueue, CreateAndPromote, DatabaseLag, DateFormats, DeleteArchivedFiles, DeleteArchivedRevisions, DeleteBatch, DeleteDefaultMessages, DeleteEqualMessages, DeleteImageCache, DeleteOldRevisions, DeleteOrphanedRevisions, DeleteRevision, DeleteSelfExternals, Digit2Html, DumpIterator, DumpLinks, DumpMessages, DumpRenderer, DumpRev, DumpSisterSites, EditCLI, EraseArchivedFile, FakeMaintenance, FetchText, FindHooks, FindMissingFiles, FixBug20757, FixDoubleRedirects, FixSlaveDesync, FixTimestamps, FixUserRegistration, GenerateCollationData, GenerateJqueryMsgData, GenerateJsonI18n, GenerateNormalizerDataAr, GenerateNormalizerDataMl, GenerateRandomImages, GenerateSitemap, GenerateUtf8Case, GetConfiguration, GetLagTimes, GetSlaveServer, GetTextMaint, ImageBuilder, ImportSiteScripts, InitEditCount, InitSiteStats, JSParseHelper, LangMemUsage, ListVariants, LoggedUpdateMaintenance, MaintenanceFixup, MaintenanceFormatInstallDoc, McTest, MergeMessageFileList, MigrateUserGroup, MinifyScript, MoveBatch, MWDocGen, MwSql, NamespaceConflictChecker, NukeNS, NukePage, Orphans, OrphanStats, PageExists, PatchSql, PHPUnitMaintClass, PopulateBloomFilter, PopulateCategory, Protect, PruneFileCache, PurgeChangedFiles, PurgeChangedPages, PurgeList, PurgeOldText, PurgeParserCache, ReassignEdits, RebuildAll, RebuildFileCache, RebuildLocalisationCache, RebuildMessages, RebuildRecentchanges, RebuildTextIndex, RefreshFileHeaders, RefreshImageMetadata, RefreshLinks, RemoveUnusedAccounts, RenameDbPrefix, ResetUserTokens, RollbackEdits, RunJobs, ShowCacheStats, ShowJobs, ShowSiteStats, SqliteMaintenance, StorageTypeStats, SyncFileBackend, TableCleanup, TestFileOpPerformance, TidyUpBug37714, Undelete, UpdateArticleCount, UpdateCollation, UpdateDoubleWidthSearch, UpdateMediaWiki, UpdateRestrictions, UpdateSearchIndex, UpdateSpecialPages, UploadDumper, UploadStashCleanup, WaitForSlave, and WrapOldPasswords.

Collaboration diagram for Maintenance:

List of all members.

Public Member Functions

 __construct ()
 Default constructor.
 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.
 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.
 setConfig (Config $config)
 setDB (&$db)
 Sets database object to be returned by getDB().
 setup ()
 Do some sanity checking and basic setup.
 updateSearchIndex ($maxLockTime, $callback, $dbw, $results)
 Perform a search index update with locking.
 updateSearchIndexForPage ($dbw, $pageId)
 Update the searchindex table for a given pageid.

Static Public Member Functions

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 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 $fileHandle
 Used when creating separate schema files.
 $mDbPass
const DB_ADMIN = 2
const DB_NONE = 0
 Constants for DB access type.
const DB_STD = 1
const STDIN_ALL = 'all'

Protected Member Functions

 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)
 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.
 deleteOption ($name)
 Remove an option.
 error ($err, $die=0)
 Throw an error to the user.
 getArg ($argId=0, $default=null)
 Get an argument.
getDB ($db, $groups=array(), $wiki=false)
 Returns a database to be used by current maintenance script.
 getDir ()
 Get the maintenance directory.
 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 param exists.
 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.
 setBatchSize ($s=0)
 Set the batch size.
 validateParamsAndArgs ()
 Run some validation checks on the params, etc.

Protected Attributes

 $mArgList = array()
 $mArgs = array()
int $mBatchSize = null
 Batch size.
 $mDbUser
 $mDescription = ''
 $mInputLoaded = false
 $mOptions = array()
 $mParams = array()
 $mQuiet = false
 $mSelf
 $mShortParamsMap = array()

Private Member Functions

public function __construct ()
public function execute ()
 lockSearchindex (&$db)
 Lock the search index.
 relockSearchindex (&$db)
 Unlock and lock again Since the lock is low-priority, queued reads will be able to complete.
 unlockSearchindex (&$db)
 Unlock the tables.

Static Private Member Functions

static readlineEmulation ($prompt)
 Emulate readline()

Private Attributes

 $atLineStart = true
Config $config
 Accessible via getConfig()
 $lastChannel = null
DatabaseBase $mDb = null
 Used by getDD() / setDB()
 $mDependantParameters = array()
 $mGenericParameters = array()

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 <[email protected]>
Since:
1.16

Definition at line 39 of file maintenance.txt.


Constructor & Destructor Documentation

Default constructor.

Children should call this *first* if implementing their own constructors

Reimplemented in LoggedUpdateMaintenance, SearchDump, GenerateSitemap, GenerateJqueryMsgData, CLIParser, PurgeChangedFiles, CompressOld, GenerateCollationData, FindHooks, GetConfiguration, PreprocessDump, ImageCleanup, WatchlistCleanup, MWDocGen, TableCleanup, MoveBatch, ImageBuilder, NukeNS, DumpRenderer, CompareParsers, BackupReader, MergeMessageFileList, RefreshImageMetadata, UpdateMediaWiki, UpdateCollation, BenchStrtrStrReplace, Digit2Html, RebuildTextIndex, DumpIterator, DumpLinks, CommandLineInstaller, NamespaceConflictChecker, PopulateLogSearch, Benchmarker, CapsCleanup, TitleCleanup, CopyFileBackend, DeleteBatch, Orphans, RebuildLocalisationCache, ShowSiteStats, UpdateSearchIndex, BenchmarkParse, UploadStashCleanup, GenerateUtf8Case, PurgeChangedPages, BenchUtf8TitleCheck, CheckSyntax, ConvertLinks, DeleteArchivedRevisions, FixTimestamps, ShowJobs, FixBug20757, AttachLatest, CheckUsernames, CreateAndPromote, DeleteArchivedFiles, DumpSisterSites, EraseArchivedFile, FixDoubleRedirects, GenerateJsonI18n, PopulateCategory, PopulateLogUsertext, UpdateArticleCount, UpdateRestrictions, BenchHttpHttps, BenchIfSwitch, BenchWfIsWindows, ChangePassword, CleanupRemovedModules, ConvertUserOptions, CopyJobQueue, DeleteImageCache, DeleteOrphanedRevisions, FixExtLinksProtocolRelative, FixSlaveDesync, DateFormats, LangMemUsage, PopulateParentId, PruneFileCache, PurgeParserCache, ReassignEdits, RefreshFileHeaders, ResetUserTokens, UpdateDoubleWidthSearch, CleanupAncientTables, CommandLineInc, DeleteDefaultMessages, DeleteRevision, GetTextMaint, InitSiteStats, JSParseHelper, DumpMessages, McTest, MinifyScript, NukePage, PopulateRevisionLength, PopulateRevisionSha1, RebuildRecentchanges, RemoveUnusedAccounts, RenameDbPrefix, RollbackEdits, BatchedQueryRunner, BenchWfBaseConvert, CleanupSpam, ClearCacheStats, ClearInterwikiCache, DeleteOldRevisions, DeleteSelfExternals, UploadDumper, FetchText, TestFileOpPerformance, FixUserRegistration, ImportSiteScripts, AllTrans, GenerateNormalizerDataAr, GenerateNormalizerDataMl, ListVariants, AlterSharedConstraints, PatchSql, PopulateFilearchiveSha1, PopulateRecentChangesSource, PurgeOldText, RebuildAll, ShowCacheStats, MwSql, DumpRev, OrphanStats, SyncFileBackend, UpdateSpecialPages, WaitForSlave, WrapOldPasswords, BenchmarkDeleteTruncate, BenchmarkHooks, BenchmarkPurge, CheckBadRedirects, CheckImages, CheckLess, EditCLI, MaintenanceFormatInstallDoc, GetLagTimes, GetSlaveServer, DatabaseLag, MigrateUserGroup, PopulateBacklinkNamespace, PopulateBloomFilter, PopulateImageSha1, Protect, PurgeList, RebuildFileCache, RebuildMessages, RefreshLinks, RunJobs, SqliteMaintenance, DeleteEqualMessages, PHPUnitMaintClass, CompareParserCache, InitEditCount, PageExists, Undelete, and FindMissingFiles.

Definition at line 123 of file Maintenance.php.


Member Function Documentation

public function Maintenance::__construct ( ) [inline, private]

Reimplemented in LoggedUpdateMaintenance, SearchDump, GenerateSitemap, GenerateJqueryMsgData, CLIParser, PurgeChangedFiles, CompressOld, GenerateCollationData, FindHooks, GetConfiguration, PreprocessDump, ImageCleanup, WatchlistCleanup, MWDocGen, TableCleanup, MoveBatch, ImageBuilder, NukeNS, DumpRenderer, CompareParsers, BackupReader, MergeMessageFileList, RefreshImageMetadata, UpdateMediaWiki, UpdateCollation, BenchStrtrStrReplace, Digit2Html, RebuildTextIndex, DumpIterator, DumpLinks, CommandLineInstaller, NamespaceConflictChecker, PopulateLogSearch, Benchmarker, CapsCleanup, TitleCleanup, CopyFileBackend, DeleteBatch, Orphans, RebuildLocalisationCache, ShowSiteStats, UpdateSearchIndex, BenchmarkParse, UploadStashCleanup, GenerateUtf8Case, PurgeChangedPages, BenchUtf8TitleCheck, CheckSyntax, ConvertLinks, DeleteArchivedRevisions, FixTimestamps, ShowJobs, FixBug20757, AttachLatest, CheckUsernames, CreateAndPromote, DeleteArchivedFiles, DumpSisterSites, EraseArchivedFile, FixDoubleRedirects, GenerateJsonI18n, PopulateCategory, PopulateLogUsertext, UpdateArticleCount, UpdateRestrictions, BenchHttpHttps, BenchIfSwitch, BenchWfIsWindows, ChangePassword, CleanupRemovedModules, ConvertUserOptions, CopyJobQueue, DeleteImageCache, DeleteOrphanedRevisions, FixExtLinksProtocolRelative, FixSlaveDesync, DateFormats, LangMemUsage, PopulateParentId, PruneFileCache, PurgeParserCache, ReassignEdits, RefreshFileHeaders, ResetUserTokens, UpdateDoubleWidthSearch, CleanupAncientTables, CommandLineInc, DeleteDefaultMessages, DeleteRevision, GetTextMaint, InitSiteStats, JSParseHelper, DumpMessages, McTest, MinifyScript, NukePage, PopulateRevisionLength, PopulateRevisionSha1, RebuildRecentchanges, RemoveUnusedAccounts, RenameDbPrefix, RollbackEdits, BatchedQueryRunner, BenchWfBaseConvert, CleanupSpam, ClearCacheStats, ClearInterwikiCache, DeleteOldRevisions, DeleteSelfExternals, UploadDumper, FetchText, TestFileOpPerformance, FixUserRegistration, ImportSiteScripts, AllTrans, GenerateNormalizerDataAr, GenerateNormalizerDataMl, ListVariants, AlterSharedConstraints, PatchSql, PopulateFilearchiveSha1, PopulateRecentChangesSource, PurgeOldText, RebuildAll, ShowCacheStats, MwSql, DumpRev, OrphanStats, SyncFileBackend, UpdateSpecialPages, WaitForSlave, WrapOldPasswords, BenchmarkDeleteTruncate, BenchmarkHooks, BenchmarkPurge, CheckBadRedirects, CheckImages, CheckLess, EditCLI, MaintenanceFormatInstallDoc, GetLagTimes, GetSlaveServer, DatabaseLag, MigrateUserGroup, PopulateBacklinkNamespace, PopulateBloomFilter, PopulateImageSha1, Protect, PurgeList, RebuildFileCache, RebuildMessages, RefreshLinks, RunJobs, SqliteMaintenance, DeleteEqualMessages, PHPUnitMaintClass, CompareParserCache, InitEditCount, PageExists, Undelete, and FindMissingFiles.

Definition at line 41 of file maintenance.txt.

Add the default parameters to the scripts.

Definition at line 428 of file Maintenance.php.

References addOption(), and getDbType().

Maintenance::addDescription ( text) [protected]

Set the description text.

Parameters:
string$textThe text of the description

Definition at line 249 of file Maintenance.php.

Referenced by PurgeParserCache\__construct(), and CommandLineInstaller\__construct().

Maintenance::addOption ( name,
description,
required = false,
withArg = false,
shortName = 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$shortNameCharacter to use as short name

Definition at line 182 of file Maintenance.php.

Referenced by FindMissingFiles\__construct(), Undelete\__construct(), CompareParserCache\__construct(), InitEditCount\__construct(), PHPUnitMaintClass\__construct(), DeleteEqualMessages\__construct(), MaintenanceFormatInstallDoc\__construct(), Protect\__construct(), PurgeList\__construct(), GetSlaveServer\__construct(), RebuildFileCache\__construct(), RefreshLinks\__construct(), RunJobs\__construct(), SqliteMaintenance\__construct(), DatabaseLag\__construct(), EditCLI\__construct(), PopulateBacklinkNamespace\__construct(), PopulateBloomFilter\__construct(), PopulateImageSha1\__construct(), PurgeOldText\__construct(), SyncFileBackend\__construct(), ImportSiteScripts\__construct(), CleanupSpam\__construct(), MwSql\__construct(), WrapOldPasswords\__construct(), DeleteOldRevisions\__construct(), GenerateNormalizerDataAr\__construct(), UploadDumper\__construct(), ListVariants\__construct(), UpdateSpecialPages\__construct(), BenchWfBaseConvert\__construct(), TestFileOpPerformance\__construct(), GetTextMaint\__construct(), RemoveUnusedAccounts\__construct(), RenameDbPrefix\__construct(), RollbackEdits\__construct(), InitSiteStats\__construct(), McTest\__construct(), CleanupAncientTables\__construct(), MinifyScript\__construct(), CommandLineInc\__construct(), NukePage\__construct(), CopyJobQueue\__construct(), PruneFileCache\__construct(), ChangePassword\__construct(), PurgeParserCache\__construct(), CleanupRemovedModules\__construct(), ReassignEdits\__construct(), RefreshFileHeaders\__construct(), DeleteImageCache\__construct(), UpdateDoubleWidthSearch\__construct(), DeleteOrphanedRevisions\__construct(), ResetUserTokens\__construct(), AttachLatest\__construct(), FixDoubleRedirects\__construct(), CreateAndPromote\__construct(), UpdateArticleCount\__construct(), DeleteArchivedFiles\__construct(), GenerateJsonI18n\__construct(), EraseArchivedFile\__construct(), PopulateCategory\__construct(), DeleteArchivedRevisions\__construct(), FixBug20757\__construct(), CheckSyntax\__construct(), ShowJobs\__construct(), PurgeChangedPages\__construct(), GenerateUtf8Case\__construct(), Orphans\__construct(), RebuildLocalisationCache\__construct(), Benchmarker\__construct(), DeleteBatch\__construct(), UpdateSearchIndex\__construct(), CapsCleanup\__construct(), CopyFileBackend\__construct(), CommandLineInstaller\__construct(), DumpIterator\__construct(), NamespaceConflictChecker\__construct(), CompareParsers\__construct(), RefreshImageMetadata\__construct(), BackupReader\__construct(), UpdateMediaWiki\__construct(), MergeMessageFileList\__construct(), UpdateCollation\__construct(), DumpRenderer\__construct(), NukeNS\__construct(), ImageBuilder\__construct(), MoveBatch\__construct(), TableCleanup\__construct(), WatchlistCleanup\__construct(), MWDocGen\__construct(), PreprocessDump\__construct(), FindHooks\__construct(), GetConfiguration\__construct(), GenerateCollationData\__construct(), CompressOld\__construct(), PurgeChangedFiles\__construct(), CLIParser\__construct(), SearchDump\__construct(), and addDefaultParams().

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

Definition at line 586 of file Maintenance.php.

References $limit, and memoryLimit().

Referenced by finalSetup(), and setup().

Execute a callback function at the end of initialisation.

Reimplemented in UpdateMediaWiki.

Definition at line 944 of file Maintenance.php.

Referenced by finalSetup().

Clean up channeled output.

Output a newline if necessary.

Definition at line 373 of file Maintenance.php.

References print.

Clear all params and arguments.

Definition at line 599 of file Maintenance.php.

References array().

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 241 of file Maintenance.php.

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 354 of file Maintenance.php.

Referenced by SqliteMaintenance\backup(), CheckSyntax\buildFileList(), ImageCleanup\buildSafeTitle(), CompareParsers\checkOptions(), SqliteMaintenance\checkSyntax(), CleanupSpam\cleanupArticle(), UpdateMediaWiki\compatChecks(), CompressOld\compressPage(), CompressOld\compressWithConcat(), CompareParsers\conclusions(), PopulateRecentChangesSource\doDBUpdates(), PopulateRevisionLength\doDBUpdates(), PopulateRevisionSha1\doDBUpdates(), PopulateParentId\doDBUpdates(), FixExtLinksProtocolRelative\doDBUpdates(), PopulateLogSearch\doDBUpdates(), PopulateImageSha1\doDBUpdates(), UploadStashCleanup\doOperations(), UpdateSpecialPages\doSpecialPageCacheUpdates(), PageExists\execute(), Undelete\execute(), GetLagTimes\execute(), BenchmarkPurge\execute(), DumpRev\execute(), MaintenanceFormatInstallDoc\execute(), DeleteRevision\execute(), DeleteDefaultMessages\execute(), CleanupAncientTables\execute(), MigrateUserGroup\execute(), GetTextMaint\execute(), ImportSiteScripts\execute(), RemoveUnusedAccounts\execute(), BatchedQueryRunner\execute(), MwSql\execute(), LangMemUsage\execute(), PopulateBloomFilter\execute(), CheckUsernames\execute(), PruneFileCache\execute(), ShowCacheStats\execute(), UpdateSpecialPages\execute(), UpdateRestrictions\execute(), WrapOldPasswords\execute(), Protect\execute(), ChangePassword\execute(), McTest\execute(), CopyJobQueue\execute(), RenameDbPrefix\execute(), CleanupSpam\execute(), GenerateNormalizerDataAr\execute(), UploadStashCleanup\execute(), EraseArchivedFile\execute(), FixDoubleRedirects\execute(), FixTimestamps\execute(), ReassignEdits\execute(), OrphanStats\execute(), EditCLI\execute(), CapsCleanup\execute(), PatchSql\execute(), PurgeParserCache\execute(), Digit2Html\execute(), SyncFileBackend\execute(), RollbackEdits\execute(), DumpIterator\execute(), PurgeChangedPages\execute(), GenerateUtf8Case\execute(), RebuildFileCache\execute(), DeleteBatch\execute(), CreateAndPromote\execute(), GenerateJsonI18n\execute(), RebuildTextIndex\execute(), UpdateDoubleWidthSearch\execute(), DumpRenderer\execute(), RunJobs\execute(), SqliteMaintenance\execute(), MinifyScript\execute(), CopyFileBackend\execute(), MoveBatch\execute(), MergeMessageFileList\execute(), GenerateCollationData\execute(), UpdateSearchIndex\execute(), ConvertLinks\execute(), RebuildLocalisationCache\execute(), BackupReader\execute(), RefreshImageMetadata\execute(), UpdateMediaWiki\execute(), CommandLineInstaller\execute(), DeleteEqualMessages\execute(), CompressOld\execute(), MWDocGen\execute(), GenerateCollationData\generateFirstChars(), MinifyScript\getExtension(), CheckSyntax\getGitModifiedFiles(), BackupReader\getNsIndex(), DumpRenderer\handleRevision(), DumpIterator\handleRevision(), ReassignEdits\initialiseUser(), SqliteMaintenance\integrityCheck(), MinifyScript\minify(), TitleCleanup\moveInconsistentPage(), ImageCleanup\pokeFile(), PreprocessDump\processRevision(), CompareParsers\processRevision(), setup(), GenerateJsonI18n\shimOnly(), SyncFileBackend\syncBackends(), SyncFileBackend\syncFileBatch(), GenerateJsonI18n\transformI18nFile(), RefreshFileHeaders\updateFileHeaders(), SqliteMaintenance\vacuum(), GetConfiguration\validateParamsAndArgs(), validateParamsAndArgs(), and CLIParser\Wikitext().

public function Maintenance::execute ( ) [inline, private]

Reimplemented in LoggedUpdateMaintenance, FakeMaintenance, GenerateSitemap, MaintenanceFixup, GetConfiguration, MWDocGen, CompressOld, DeleteEqualMessages, CommandLineInstaller, PHPUnitMaintClass, UpdateMediaWiki, GenerateJqueryMsgData, RefreshImageMetadata, BackupReader, BenchUtf8TitleCheck, PopulateCategory, PurgeChangedFiles, CLIParser, UpdateCollation, ConvertLinks, RebuildLocalisationCache, CheckSyntax, UpdateSearchIndex, GenerateCollationData, FindHooks, ImageBuilder, MergeMessageFileList, CopyFileBackend, MoveBatch, BenchmarkParse, CommandLineInc, PopulateImageSha1, MinifyScript, SqliteMaintenance, WatchlistCleanup, NukeNS, DumpRenderer, RunJobs, TableCleanup, GenerateJsonI18n, NamespaceConflictChecker, RebuildTextIndex, UpdateDoubleWidthSearch, CreateAndPromote, DeleteBatch, GenerateUtf8Case, PurgeChangedPages, RebuildFileCache, DumpIterator, Orphans, ResetUserTokens, RollbackEdits, CleanupRemovedModules, DeleteArchivedRevisions, FetchText, SyncFileBackend, BenchStrtrStrReplace, DeleteArchivedFiles, Digit2Html, PurgeParserCache, ShowJobs, CapsCleanup, DumpLinks, EditCLI, InitSiteStats, PatchSql, FixTimestamps, ReassignEdits, RefreshLinks, ShowSiteStats, OrphanStats, AttachLatest, CleanupSpam, UploadStashCleanup, CopyJobQueue, EraseArchivedFile, TestFileOpPerformance, FixDoubleRedirects, FixSlaveDesync, GenerateNormalizerDataAr, RefreshFileHeaders, RenameDbPrefix, FixBug20757, ChangePassword, UploadDumper, McTest, Protect, PurgeList, CheckUsernames, DeleteImageCache, GenerateNormalizerDataMl, AlterSharedConstraints, PruneFileCache, RebuildAll, ShowCacheStats, UpdateArticleCount, UpdateRestrictions, UpdateSpecialPages, WrapOldPasswords, BenchWfBaseConvert, ConvertUserOptions, DeleteOrphanedRevisions, DumpSisterSites, GetTextMaint, ImportSiteScripts, InitEditCount, LangMemUsage, NukePage, PopulateBloomFilter, RemoveUnusedAccounts, BatchedQueryRunner, MwSql, BenchHttpHttps, BenchIfSwitch, BenchWfIsWindows, CleanupAncientTables, DeleteDefaultMessages, DeleteOldRevisions, JSParseHelper, DateFormats, ListVariants, MigrateUserGroup, DeleteRevision, DeleteSelfExternals, MaintenanceFormatInstallDoc, DumpMessages, PurgeOldText, RebuildRecentchanges, CheckImages, CheckLess, ClearCacheStats, ClearInterwikiCache, FixUserRegistration, GetSlaveServer, DatabaseLag, AllTrans, DumpRev, WaitForSlave, BenchmarkDeleteTruncate, BenchmarkHooks, BenchmarkPurge, CheckBadRedirects, GetLagTimes, RebuildMessages, CompareParserCache, FindMissingFiles, Undelete, CleanupPreferences, PageExists, StorageTypeStats, GenerateRandomImages, and TidyUpBug37714.

Definition at line 45 of file maintenance.txt.

Maintenance::execute ( ) [abstract]

Do the actual work.

All child classes will need to implement this

Reimplemented in LoggedUpdateMaintenance, FakeMaintenance, GenerateSitemap, MaintenanceFixup, GetConfiguration, MWDocGen, CompressOld, DeleteEqualMessages, CommandLineInstaller, PHPUnitMaintClass, UpdateMediaWiki, GenerateJqueryMsgData, RefreshImageMetadata, BackupReader, BenchUtf8TitleCheck, PopulateCategory, PurgeChangedFiles, CLIParser, UpdateCollation, ConvertLinks, RebuildLocalisationCache, CheckSyntax, UpdateSearchIndex, GenerateCollationData, FindHooks, ImageBuilder, MergeMessageFileList, CopyFileBackend, MoveBatch, BenchmarkParse, CommandLineInc, PopulateImageSha1, MinifyScript, SqliteMaintenance, WatchlistCleanup, NukeNS, DumpRenderer, RunJobs, TableCleanup, GenerateJsonI18n, NamespaceConflictChecker, RebuildTextIndex, UpdateDoubleWidthSearch, CreateAndPromote, DeleteBatch, GenerateUtf8Case, PurgeChangedPages, RebuildFileCache, DumpIterator, Orphans, ResetUserTokens, RollbackEdits, CleanupRemovedModules, DeleteArchivedRevisions, FetchText, SyncFileBackend, BenchStrtrStrReplace, DeleteArchivedFiles, Digit2Html, PurgeParserCache, ShowJobs, CapsCleanup, DumpLinks, EditCLI, InitSiteStats, PatchSql, FixTimestamps, ReassignEdits, RefreshLinks, ShowSiteStats, OrphanStats, AttachLatest, CleanupSpam, UploadStashCleanup, CopyJobQueue, EraseArchivedFile, TestFileOpPerformance, FixDoubleRedirects, FixSlaveDesync, GenerateNormalizerDataAr, RefreshFileHeaders, RenameDbPrefix, FixBug20757, ChangePassword, UploadDumper, McTest, Protect, PurgeList, CheckUsernames, DeleteImageCache, GenerateNormalizerDataMl, AlterSharedConstraints, PruneFileCache, RebuildAll, ShowCacheStats, UpdateArticleCount, UpdateRestrictions, UpdateSpecialPages, WrapOldPasswords, BenchWfBaseConvert, ConvertUserOptions, DeleteOrphanedRevisions, DumpSisterSites, GetTextMaint, ImportSiteScripts, InitEditCount, LangMemUsage, NukePage, PopulateBloomFilter, RemoveUnusedAccounts, BatchedQueryRunner, MwSql, BenchHttpHttps, BenchIfSwitch, BenchWfIsWindows, CleanupAncientTables, DeleteDefaultMessages, DeleteOldRevisions, JSParseHelper, DateFormats, ListVariants, MigrateUserGroup, DeleteRevision, DeleteSelfExternals, MaintenanceFormatInstallDoc, DumpMessages, PurgeOldText, RebuildRecentchanges, CheckImages, CheckLess, ClearCacheStats, ClearInterwikiCache, FixUserRegistration, GetSlaveServer, DatabaseLag, AllTrans, DumpRev, WaitForSlave, BenchmarkDeleteTruncate, BenchmarkHooks, BenchmarkPurge, CheckBadRedirects, GetLagTimes, RebuildMessages, CompareParserCache, FindMissingFiles, Undelete, CleanupPreferences, PageExists, StorageTypeStats, GenerateRandomImages, and TidyUpBug37714.

Since:
1.24
Returns:
Config

Definition at line 467 of file Maintenance.php.

Referenced by Undelete\execute(), and WrapOldPasswords\execute().

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 PHPUnitMaintClass, SearchDump, MwSql, MWDocGen, ConvertLinks, CheckSyntax, UpdateMediaWiki, BatchedQueryRunner, UpdateSearchIndex, FindHooks, PreprocessDump, SqliteMaintenance, RebuildTextIndex, UpdateDoubleWidthSearch, GenerateUtf8Case, PatchSql, FixSlaveDesync, GenerateNormalizerDataAr, RenameDbPrefix, GenerateNormalizerDataMl, AlterSharedConstraints, RebuildAll, ShowCacheStats, and GenerateRandomImages.

Definition at line 421 of file Maintenance.php.

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

Maintenance::getDir ( ) [protected]

Get the maintenance directory.

Returns:
string

Definition at line 1051 of file Maintenance.php.

Get the script's name.

Returns:
string

Definition at line 298 of file Maintenance.php.

Maintenance::getOption ( name,
default = null 
) [protected]

Get an option, or return the default.

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

Definition at line 212 of file Maintenance.php.

Referenced by Benchmarker\bench(), CheckSyntax\buildFileList(), PreprocessDump\checkOptions(), CompareParsers\checkOptions(), SqliteMaintenance\checkSyntax(), PopulateBacklinkNamespace\doDBUpdates(), PopulateImageSha1\doDBUpdates(), TestFileOpPerformance\doPerfTest(), PurgeList\doPurge(), UpdateSpecialPages\doSpecialPageCacheUpdates(), Undelete\execute(), FindMissingFiles\execute(), CompareParserCache\execute(), BenchmarkPurge\execute(), GetSlaveServer\execute(), MaintenanceFormatInstallDoc\execute(), ImportSiteScripts\execute(), RemoveUnusedAccounts\execute(), MwSql\execute(), BenchWfBaseConvert\execute(), NukePage\execute(), PopulateBloomFilter\execute(), UpdateSpecialPages\execute(), WrapOldPasswords\execute(), PruneFileCache\execute(), DeleteImageCache\execute(), ChangePassword\execute(), UploadDumper\execute(), McTest\execute(), Protect\execute(), PurgeList\execute(), RefreshFileHeaders\execute(), RenameDbPrefix\execute(), GenerateNormalizerDataAr\execute(), EraseArchivedFile\execute(), FixBug20757\execute(), TestFileOpPerformance\execute(), CopyJobQueue\execute(), FixDoubleRedirects\execute(), RefreshLinks\execute(), EditCLI\execute(), PurgeParserCache\execute(), SyncFileBackend\execute(), CleanupRemovedModules\execute(), ResetUserTokens\execute(), RollbackEdits\execute(), DumpIterator\execute(), GenerateUtf8Case\execute(), DeleteBatch\execute(), PurgeChangedPages\execute(), RebuildFileCache\execute(), UpdateDoubleWidthSearch\execute(), NamespaceConflictChecker\execute(), GenerateJsonI18n\execute(), DumpRenderer\execute(), RunJobs\execute(), NukeNS\execute(), SqliteMaintenance\execute(), MinifyScript\execute(), PopulateImageSha1\execute(), MoveBatch\execute(), CopyFileBackend\execute(), MergeMessageFileList\execute(), GenerateCollationData\execute(), UpdateSearchIndex\execute(), RebuildLocalisationCache\execute(), UpdateCollation\execute(), PopulateCategory\execute(), BackupReader\execute(), RefreshImageMetadata\execute(), UpdateMediaWiki\execute(), PHPUnitMaintClass\execute(), CommandLineInstaller\execute(), DeleteEqualMessages\execute(), CompressOld\execute(), GetConfiguration\execute(), GetConfiguration\finalSetup(), finalSetup(), CLIParser\getTitle(), MWDocGen\init(), loadSpecialVars(), MinifyScript\minify(), CompareParsers\processRevision(), SearchDump\processRevision(), PurgeList\sendPurgeRequest(), SyncFileBackend\syncFileBatch(), GenerateJsonI18n\transformI18nFile(), and GetConfiguration\validateParamsAndArgs().

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 308 of file Maintenance.php.

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

Potentially debug globals.

Originally a feature only for refreshLinks

Definition at line 954 of file Maintenance.php.

Maintenance::hasArg ( argId = 0) [protected]
Maintenance::hasOption ( name) [protected]

Checks to see if a particular param exists.

Parameters:
string$nameThe name of the param
Returns:
bool

Definition at line 202 of file Maintenance.php.

Referenced by CheckSyntax\buildFileList(), PreprocessDump\checkOptions(), CompareParsers\checkOptions(), CleanupSpam\cleanupArticle(), ConvertLinks\createTempTable(), PopulateImageSha1\doDBUpdates(), TestFileOpPerformance\doPerfTest(), UpdateSpecialPages\doSpecialPageCacheUpdates(), BenchmarkPurge\execute(), GetSlaveServer\execute(), DatabaseLag\execute(), MaintenanceFormatInstallDoc\execute(), PurgeOldText\execute(), DeleteOldRevisions\execute(), ListVariants\execute(), CleanupAncientTables\execute(), RemoveUnusedAccounts\execute(), GetTextMaint\execute(), InitEditCount\execute(), MwSql\execute(), DeleteOrphanedRevisions\execute(), UpdateArticleCount\execute(), UpdateSpecialPages\execute(), WrapOldPasswords\execute(), UploadDumper\execute(), ChangePassword\execute(), Protect\execute(), PurgeList\execute(), RefreshFileHeaders\execute(), CleanupSpam\execute(), GenerateNormalizerDataAr\execute(), EraseArchivedFile\execute(), AttachLatest\execute(), FixDoubleRedirects\execute(), RefreshLinks\execute(), ReassignEdits\execute(), InitSiteStats\execute(), EditCLI\execute(), CapsCleanup\execute(), DeleteArchivedFiles\execute(), ShowJobs\execute(), DeleteArchivedRevisions\execute(), SyncFileBackend\execute(), DumpIterator\execute(), RollbackEdits\execute(), Orphans\execute(), CreateAndPromote\execute(), GenerateUtf8Case\execute(), PurgeChangedPages\execute(), GenerateJsonI18n\execute(), TableCleanup\execute(), NamespaceConflictChecker\execute(), DumpRenderer\execute(), RunJobs\execute(), WatchlistCleanup\execute(), SqliteMaintenance\execute(), MinifyScript\execute(), PopulateImageSha1\execute(), CopyFileBackend\execute(), MergeMessageFileList\execute(), ImageBuilder\execute(), UpdateSearchIndex\execute(), CheckSyntax\execute(), RebuildLocalisationCache\execute(), ConvertLinks\execute(), UpdateCollation\execute(), BackupReader\execute(), RefreshImageMetadata\execute(), UpdateMediaWiki\execute(), PHPUnitMaintClass\execute(), CommandLineInstaller\execute(), DeleteEqualMessages\execute(), GetConfiguration\finalSetup(), finalSetup(), FindHooks\getHooksFromDoc(), BackupReader\importFromHandle(), MWDocGen\init(), loadSpecialVars(), RunJobs\memoryLimit(), RebuildLocalisationCache\memoryLimit(), WatchlistCleanup\removeWatch(), EraseArchivedFile\scrubVersion(), PurgeList\sendPurgeRequest(), GenerateJsonI18n\transformI18nFile(), CommandLineInstaller\validateParamsAndArgs(), and validateParamsAndArgs().

Returns:
bool

Definition at line 325 of file Maintenance.php.

Referenced by 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.

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 614 of file Maintenance.php.

Referenced by setup(), and TemplateCategoriesTest\testTemplateCategories().

Generic setup for most installs.

Returns the location of LocalSettings

Returns:
string

Definition at line 964 of file Maintenance.php.

Handle the special variables that are global to all scripts.

Definition at line 740 of file Maintenance.php.

References getOption(), and hasOption().

Maintenance::lockSearchindex ( &$  db) [private]

Lock the search index.

Parameters:
DatabaseBase&$db

Definition at line 1083 of file Maintenance.php.

Maintenance::maybeHelp ( force = false) [protected]

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 RebuildLocalisationCache, and RunJobs.

Definition at line 577 of file Maintenance.php.

Referenced by adjustMemoryLimit().

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 335 of file Maintenance.php.

Referenced by ImageBuilder\addMissingImage(), SqliteMaintenance\backup(), CheckSyntax\buildFileList(), ImageBuilder\buildTable(), CheckSyntax\checkEvilToken(), CheckSyntax\checkFileWithCli(), CheckSyntax\checkFileWithParsekit(), Orphans\checkOrphans(), CheckSyntax\checkRegex(), Orphans\checkSeparation(), SqliteMaintenance\checkSyntax(), Orphans\checkWidows(), CleanupSpam\cleanupArticle(), CompressOld\compressOldPages(), CompressOld\compressWithConcat(), CompareParsers\conclusions(), ConvertLinks\createTempTable(), RunJobs\debugInternal(), RefreshLinks\deleteLinksFromNonexistent(), PopulateRecentChangesSource\doDBUpdates(), PopulateRevisionLength\doDBUpdates(), PopulateRevisionSha1\doDBUpdates(), PopulateBacklinkNamespace\doDBUpdates(), PopulateFilearchiveSha1\doDBUpdates(), PopulateParentId\doDBUpdates(), FixExtLinksProtocolRelative\doDBUpdates(), PopulateLogUsertext\doDBUpdates(), PopulateLogSearch\doDBUpdates(), PopulateImageSha1\doDBUpdates(), DeleteOldRevisions\doDelete(), PopulateRevisionLength\doLenUpdates(), TestFileOpPerformance\doPerfTest(), PopulateCategory\doPopulateCategory(), PurgeList\doPurge(), ReassignEdits\doReassignEdits(), RebuildLocalisationCache\doRebuild(), RefreshLinks\doRefreshLinks(), PopulateRevisionSha1\doSha1LegacyUpdates(), PopulateRevisionSha1\doSha1Updates(), UpdateSpecialPages\doSpecialPageCacheUpdates(), UpdateSearchIndex\doUpdateSearchIndex(), TidyUpBug37714\execute(), CleanupPreferences\execute(), PageExists\execute(), CompareParserCache\execute(), FindMissingFiles\execute(), Undelete\execute(), RebuildMessages\execute(), BenchmarkPurge\execute(), GetLagTimes\execute(), BenchmarkHooks\execute(), CheckBadRedirects\execute(), ClearInterwikiCache\execute(), FixUserRegistration\execute(), GetSlaveServer\execute(), DatabaseLag\execute(), DumpRev\execute(), AllTrans\execute(), CheckImages\execute(), RebuildRecentchanges\execute(), DumpMessages\execute(), DeleteRevision\execute(), DeleteSelfExternals\execute(), JSParseHelper\execute(), DateFormats\execute(), DeleteDefaultMessages\execute(), MigrateUserGroup\execute(), DeleteOldRevisions\execute(), CleanupAncientTables\execute(), ConvertUserOptions\execute(), RemoveUnusedAccounts\execute(), BatchedQueryRunner\execute(), GetTextMaint\execute(), InitEditCount\execute(), ImportSiteScripts\execute(), LangMemUsage\execute(), BenchWfBaseConvert\execute(), NukePage\execute(), DeleteOrphanedRevisions\execute(), PopulateBloomFilter\execute(), DumpSisterSites\execute(), PruneFileCache\execute(), RebuildAll\execute(), UpdateSpecialPages\execute(), UpdateRestrictions\execute(), UpdateArticleCount\execute(), WrapOldPasswords\execute(), DeleteImageCache\execute(), AlterSharedConstraints\execute(), ShowCacheStats\execute(), PurgeList\execute(), ChangePassword\execute(), McTest\execute(), Protect\execute(), FixDoubleRedirects\execute(), AttachLatest\execute(), RefreshFileHeaders\execute(), CopyJobQueue\execute(), CleanupSpam\execute(), RenameDbPrefix\execute(), UploadStashCleanup\execute(), EraseArchivedFile\execute(), ReassignEdits\execute(), FixTimestamps\execute(), OrphanStats\execute(), ShowSiteStats\execute(), PatchSql\execute(), InitSiteStats\execute(), DumpLinks\execute(), EditCLI\execute(), PurgeParserCache\execute(), ShowJobs\execute(), Digit2Html\execute(), DeleteArchivedFiles\execute(), FetchText\execute(), DeleteArchivedRevisions\execute(), SyncFileBackend\execute(), CleanupRemovedModules\execute(), RollbackEdits\execute(), ResetUserTokens\execute(), PurgeChangedPages\execute(), RebuildFileCache\execute(), DeleteBatch\execute(), CreateAndPromote\execute(), GenerateJsonI18n\execute(), RebuildTextIndex\execute(), TableCleanup\execute(), NamespaceConflictChecker\execute(), UpdateDoubleWidthSearch\execute(), RunJobs\execute(), NukeNS\execute(), WatchlistCleanup\execute(), CopyFileBackend\execute(), MoveBatch\execute(), FindHooks\execute(), CheckSyntax\execute(), RebuildLocalisationCache\execute(), ConvertLinks\execute(), UpdateCollation\execute(), BackupReader\execute(), RefreshImageMetadata\execute(), UpdateMediaWiki\execute(), PHPUnitMaintClass\execute(), DeleteEqualMessages\execute(), CompressOld\execute(), MWDocGen\execute(), GetConfiguration\execute(), DeleteEqualMessages\fetchMessageInfo(), ImportSiteScripts\fetchScriptList(), GetConfiguration\formatVarDump(), DeleteArchivedFiles\handleOutput(), DeleteArchivedRevisions\handleOutput(), DumpRenderer\handleRevision(), DumpIterator\handleRevision(), MWDocGen\init(), SqliteMaintenance\integrityCheck(), ImageCleanup\killRow(), MinifyScript\minify(), TitleCleanup\moveIllegalPage(), TitleCleanup\moveInconsistentPage(), ImageBuilder\oldimageCallback(), UploadDumper\outputItem(), ImageCleanup\pokeFile(), FindHooks\printArray(), CompareParsers\processRevision(), SearchDump\processRevision(), TitleCleanup\processRow(), ImageCleanup\processRow(), WatchlistCleanup\processRow(), CapsCleanup\processRow(), TableCleanup\progress(), ImageBuilder\progress(), PruneFileCache\prune_directory(), RebuildRecentchanges\purgeFeeds(), FixDoubleRedirects\queueJobs(), RebuildRecentchanges\rebuildRecentChangesTablePass1(), RebuildRecentchanges\rebuildRecentChangesTablePass2(), RebuildRecentchanges\rebuildRecentChangesTablePass3(), RebuildRecentchanges\rebuildRecentChangesTablePass4(), WatchlistCleanup\removeWatch(), TableCleanup\runTable(), EraseArchivedFile\scrubVersion(), PurgeList\sendPurgeRequest(), GenerateJsonI18n\shimOnly(), PurgeParserCache\showProgress(), UpdateCollation\showSortKeySizeHistogram(), MwSql\sqlPrintResult(), SyncFileBackend\syncBackends(), SyncFileBackend\syncFileBatch(), GenerateJsonI18n\transformI18nFile(), ResetUserTokens\updateUser(), PopulateRevisionSha1\upgradeLegacyArchiveRow(), PopulateRevisionLength\upgradeRow(), PopulateRevisionSha1\upgradeRow(), and SqliteMaintenance\vacuum().

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 388 of file Maintenance.php.

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:
int$fdFile descriptor
Returns:
bool

Definition at line 1176 of file Maintenance.php.

Referenced by MwSql\execute().

Support function for cleaning up redundant text records.

Parameters:
bool$deleteWhether or not to actually delete the records
Author:
Rob Church <[email protected]>

Definition at line 998 of file Maintenance.php.

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

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 1189 of file Maintenance.php.

Referenced by MwSql\execute().

static Maintenance::readlineEmulation ( prompt) [static, private]

Emulate readline()

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

Definition at line 1221 of file Maintenance.php.

Maintenance::relockSearchindex ( &$  db) [private]

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

Parameters:
DatabaseBase&$db

Definition at line 1102 of file Maintenance.php.

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 490 of file Maintenance.php.

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

Since:
1.24
Parameters:
Config$config

Definition at line 479 of file Maintenance.php.

Maintenance::setDB ( &$  db)

Sets database object to be returned by getDB().

Parameters:
DatabaseBase$dbDatabase object to be used

Definition at line 1075 of file Maintenance.php.

Do some sanity checking and basic setup.

Definition at line 516 of file Maintenance.php.

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

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 141 of file Maintenance.php.

Maintenance::unlockSearchindex ( &$  db) [private]

Unlock the tables.

Parameters:
DatabaseBase&$db

Definition at line 1093 of file Maintenance.php.

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.
DatabaseBase$dbw
array$results

Definition at line 1114 of file Maintenance.php.

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

Maintenance::updateSearchIndexForPage ( dbw,
pageId 
)

Update the searchindex table for a given pageid.

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

Definition at line 1151 of file Maintenance.php.

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

Run some validation checks on the params, etc.

Reimplemented in CommandLineInstaller, and GetConfiguration.

Definition at line 715 of file Maintenance.php.

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

Referenced by setup().


Member Data Documentation

Maintenance::$atLineStart = true [private]

Definition at line 367 of file Maintenance.php.

Config Maintenance::$config [private]

Accessible via getConfig()

Definition at line 117 of file Maintenance.php.

resource Maintenance::$fileHandle

Used when creating separate schema files.

Definition at line 111 of file Maintenance.php.

Maintenance::$lastChannel = null [private]

Definition at line 368 of file Maintenance.php.

Maintenance::$mArgList = array() [protected]

Definition at line 70 of file Maintenance.php.

Maintenance::$mArgs = array() [protected]

Definition at line 76 of file Maintenance.php.

int Maintenance::$mBatchSize = null [protected]

Batch size.

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

Definition at line 96 of file Maintenance.php.

DatabaseBase Maintenance::$mDb = null [private]

Used by getDD() / setDB()

Definition at line 106 of file Maintenance.php.

Maintenance::$mDbPass

Definition at line 83 of file Maintenance.php.

Maintenance::$mDbUser [protected]

Definition at line 83 of file Maintenance.php.

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

Definition at line 101 of file Maintenance.php.

Maintenance::$mDescription = '' [protected]

Definition at line 86 of file Maintenance.php.

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

Definition at line 99 of file Maintenance.php.

Maintenance::$mInputLoaded = false [protected]

Definition at line 89 of file Maintenance.php.

Maintenance::$mOptions = array() [protected]

Definition at line 73 of file Maintenance.php.

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

Definition at line 64 of file Maintenance.php.

Maintenance::$mQuiet = false [protected]

Definition at line 82 of file Maintenance.php.

Maintenance::$mSelf [protected]

Reimplemented in FakeMaintenance.

Definition at line 79 of file Maintenance.php.

Maintenance::$mShortParamsMap = array() [protected]

Definition at line 67 of file Maintenance.php.

Definition at line 57 of file Maintenance.php.

const Maintenance::STDIN_ALL = 'all'

Definition at line 61 of file Maintenance.php.

Referenced by EditCLI\execute().


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