MediaWiki
1.28.0
|
Abstract maintenance class for quickly writing and churning out maintenance scripts with minimal effort. More...
Inherited by AllTrans, AlterSharedConstraints, AttachLatest, BackupDumper, BackupReader, BatchedQueryRunner, Benchmarker, BenchmarkParse, ChangePassword, CheckBadRedirects, CheckComposerLockUpToDate, CheckImages, CheckLess, CheckSyntax, CheckUsernames, CleanupAncientTables, CleanupBlocks, CleanupPreferences, CleanupRemovedModules, CleanupSpam, ClearInterwikiCache, CLIParser, CommandLineInc, CommandLineInstaller, CompareParserCache, CompressOld, ConvertExtensionToRegistration, ConvertLinks, ConvertUserOptions, CopyFileBackend, CopyJobQueue, CreateAndPromote, DatabaseLag, DateFormats, DeleteArchivedFiles, DeleteArchivedRevisions, DeleteBatch, DeleteDefaultMessages, DeleteEqualMessages, DeleteOldRevisions, DeleteOrphanedRevisions, DeleteRevision, DeleteSelfExternals, Digit2Html, DumpIterator, DumpLinks, DumpMessages, DumpRenderer, DumpRev, EditCLI, EraseArchivedFile, ExportSites, FakeMaintenance, FetchText, FindDeprecated, FindHooks, FindMissingFiles, FindOrphanedFiles, FixBug20757, FixDoubleRedirects, FixTimestamps, FixUserRegistration, GenerateCollationData, GenerateCommonPassword, GenerateJqueryMsgData, GenerateJsonI18n, GenerateNormalizerDataAr, GenerateNormalizerDataMl, GenerateRandomImages, GenerateSitemap, GetConfiguration, GetLagTimes, GetSlaveServer, GetTextMaint, HHVMMakeRepo, ImageBuilder, ImportSites, ImportSiteScripts, ImportTextFiles, InitEditCount, InitSiteStats, InvalidateUserSesssions, JSParseHelper, LangMemUsage, ListVariants, LoggedUpdateMaintenance, MaintenanceFixup, MaintenanceFormatInstallDoc, MakeTestEdits, McTest, MergeMessageFileList, MigrateFileRepoLayout, MigrateUserGroup, MinifyScript, MoveBatch, MWDocGen, MwSql, NamespaceConflictChecker, NukeNS, NukePage, Orphans, OrphanStats, PageExists, ParserFuzzTest, ParserTestsMaintenance, PatchSql, PHPUnitMaintClass, PopulateCategory, PopulateContentModel, Protect, PruneFileCache, PurgeChangedFiles, PurgeChangedPages, PurgeList, PurgeOldText, PurgeParserCache, ReassignEdits, RebuildAll, RebuildFileCache, RebuildLocalisationCache, RebuildMessages, RebuildRecentchanges, RebuildSitesCache, RebuildTextIndex, RefreshFileHeaders, RefreshImageMetadata, RefreshLinks, RemoveInvalidEmails, RemoveUnusedAccounts, RenameDbPrefix, ResetUserEmail, ResetUserTokens, RollbackEdits, RunJobs, ShowJobs, ShowSiteStats, SqliteMaintenance, StorageTypeStats, SyncFileBackend, TableCleanup, TestFileOpPerformance, TidyUpBug37714, Undelete, UpdateArticleCount, UpdateCollation, UpdateDoubleWidthSearch, UpdateMediaWiki, UpdateRestrictions, UpdateSearchIndex, UpdateSpecialPages, UploadDumper, UploadStashCleanup, ValidateRegistrationFile, and WrapOldPasswords.
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 | 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... | |
Database | $mDb = null |
Used by getDB() / setDB() More... | |
$mDependantParameters = [] | |
$mGenericParameters = [] | |
array | $requiredExtensions = [] |
Abstract maintenance class for quickly writing and churning out maintenance scripts with minimal effort.
All that must be defined is the execute() method. See docs/maintenance.txt for more info and a quick demo of how to use it.
Definition at line 39 of file maintenance.txt.
Maintenance::__construct | ( | ) |
Default constructor.
Children should call this first if implementing their own constructors
Definition at line 150 of file Maintenance.php.
References $IP, addDefaultParams(), and global.
|
inlineprivate |
Definition at line 41 of file maintenance.txt.
|
protected |
Activate the profiler (assuming $wgProfiler is set)
Definition at line 719 of file Maintenance.php.
References $output, $wgProfiler, getOption(), global, Profiler\instance(), and Profiler\replaceStubInstance().
Referenced by finalSetup().
|
protected |
Add some args that are needed.
string | $arg | Name of the arg, like 'start' |
string | $description | Short description of the arg |
bool | $required | Is this required? |
Definition at line 262 of file Maintenance.php.
Referenced by ValidateRegistrationFile\__construct(), ExportSites\__construct(), ImportSites\__construct(), Undelete\__construct(), PageExists\__construct(), EditCLI\__construct(), MaintenanceFormatInstallDoc\__construct(), MigrateUserGroup\__construct(), Protect\__construct(), ImportSiteScripts\__construct(), CleanupSpam\__construct(), ImportTextFiles\__construct(), PatchSql\__construct(), ResetUserEmail\__construct(), DumpRev\__construct(), GetTextMaint\__construct(), JSParseHelper\__construct(), McTest\__construct(), NukePage\__construct(), RefreshLinks\__construct(), ReassignEdits\__construct(), CreateAndPromote\__construct(), GenerateJsonI18n\__construct(), ConvertLinks\__construct(), GenerateCommonPassword\__construct(), FixTimestamps\__construct(), CommandLineInstaller\__construct(), DeleteBatch\__construct(), BackupReader\__construct(), MoveBatch\__construct(), BenchmarkParse\__construct(), ConvertExtensionToRegistration\__construct(), and CLIParser\__construct().
|
protected |
Add the default parameters to the scripts.
Definition at line 461 of file Maintenance.php.
References $mParams, addOption(), and getDbType().
Referenced by __construct().
|
protected |
Set the description text.
string | $text | The text of the description |
Definition at line 282 of file Maintenance.php.
Referenced by HHVMMakeRepo\__construct(), CheckComposerLockUpToDate\__construct(), ParserFuzzTest\__construct(), ImportSites\__construct(), ExportSites\__construct(), FindMissingFiles\__construct(), FindOrphanedFiles\__construct(), Undelete\__construct(), InitEditCount\__construct(), PageExists\__construct(), CompareParserCache\__construct(), CheckLess\__construct(), DeleteEqualMessages\__construct(), MakeTestEdits\__construct(), DumpBackup\__construct(), PopulateContentModel\__construct(), CheckImages\__construct(), RebuildMessages\__construct(), RebuildSitesCache\__construct(), GetLagTimes\__construct(), GetSlaveServer\__construct(), SqliteMaintenance\__construct(), BenchmarkHooks\__construct(), DatabaseLag\__construct(), BenchmarkPurge\__construct(), MigrateUserGroup\__construct(), EditCLI\__construct(), PopulateBacklinkNamespace\__construct(), AddRFCAndPMIDInterwiki\__construct(), PopulateImageSha1\__construct(), Protect\__construct(), CheckBadRedirects\__construct(), PurgeList\__construct(), BenchmarkDeleteTruncate\__construct(), RebuildAll\__construct(), FixDefaultJsonContentPages\__construct(), FixUserRegistration\__construct(), ResetUserEmail\__construct(), MwSql\__construct(), SyncFileBackend\__construct(), OrphanStats\__construct(), ImportSiteScripts\__construct(), ImportTextFiles\__construct(), WrapOldPasswords\__construct(), AllTrans\__construct(), DeleteOldRevisions\__construct(), ListVariants\__construct(), DeleteSelfExternals\__construct(), AlterSharedConstraints\__construct(), PatchSql\__construct(), CleanupSpam\__construct(), UploadDumper\__construct(), PopulateFilearchiveSha1\__construct(), FetchText\__construct(), TestFileOpPerformance\__construct(), PopulateRecentChangesSource\__construct(), ClearInterwikiCache\__construct(), PurgeOldText\__construct(), RebuildFileCache\__construct(), RollbackEdits\__construct(), BatchedQueryRunner\__construct(), RunJobs\__construct(), GetTextMaint\__construct(), PopulateRevisionLength\__construct(), ParserTestsMaintenance\__construct(), InitSiteStats\__construct(), CleanupBlocks\__construct(), DeleteDefaultMessages\__construct(), JSParseHelper\__construct(), CleanupAncientTables\__construct(), DumpMessages\__construct(), CleanupEmptyCategories\__construct(), GenerateNormalizerDataAr\__construct(), GenerateNormalizerDataMl\__construct(), DeleteRevision\__construct(), McTest\__construct(), MigrateFileRepoLayout\__construct(), MinifyScript\__construct(), NukePage\__construct(), PopulateRevisionSha1\__construct(), ReassignEdits\__construct(), FixExtLinksProtocolRelative\__construct(), BenchWfIsWindows\__construct(), RefreshFileHeaders\__construct(), RefreshLinks\__construct(), ConvertUserOptions\__construct(), CopyJobQueue\__construct(), BenchIfSwitch\__construct(), BenchWikimediaBaseConvert\__construct(), BenchHttpHttps\__construct(), DateFormats\__construct(), DeleteOrphanedRevisions\__construct(), LangMemUsage\__construct(), DeleteArchivedFiles\__construct(), CleanupRemovedModules\__construct(), ChangePassword\__construct(), UpdateDoubleWidthSearch\__construct(), BenchUtf8TitleCheck\__construct(), PopulateParentId\__construct(), PruneFileCache\__construct(), PurgeParserCache\__construct(), AttachLatest\__construct(), ResetUserTokens\__construct(), FixDoubleRedirects\__construct(), UpdateArticleCount\__construct(), DeleteArchivedRevisions\__construct(), CheckUsernames\__construct(), EraseArchivedFile\__construct(), CreateAndPromote\__construct(), GenerateJsonI18n\__construct(), TitleCleanup\__construct(), PopulateLogUsertext\__construct(), PopulateCategory\__construct(), UpdateMediaWiki\__construct(), UpdateRestrictions\__construct(), CheckSyntax\__construct(), GenerateCommonPassword\__construct(), FixBug20757\__construct(), FixTimestamps\__construct(), InvalidateUserSesssions\__construct(), ConvertLinks\__construct(), PurgeChangedPages\__construct(), UploadStashCleanup\__construct(), CommandLineInstaller\__construct(), RebuildRecentchanges\__construct(), ShowSiteStats\__construct(), UpdateSearchIndex\__construct(), DeleteBatch\__construct(), Orphans\__construct(), RebuildLocalisationCache\__construct(), UpdateCollation\__construct(), PopulateLogSearch\__construct(), DumpLinks\__construct(), CopyFileBackend\__construct(), DumpIterator\__construct(), Digit2Html\__construct(), BenchStrtrStrReplace\__construct(), CompareParsers\__construct(), RebuildTextIndex\__construct(), ImageCleanup\__construct(), BackupReader\__construct(), MergeMessageFileList\__construct(), ShowJobs\__construct(), RefreshImageMetadata\__construct(), DumpRenderer\__construct(), NukeNS\__construct(), CapsCleanup\__construct(), MoveBatch\__construct(), ImageBuilder\__construct(), WatchlistCleanup\__construct(), MWDocGen\__construct(), BenchmarkParse\__construct(), NamespaceConflictChecker\__construct(), GetConfiguration\__construct(), FindHooks\__construct(), ConvertExtensionToRegistration\__construct(), CLIParser\__construct(), PurgeChangedFiles\__construct(), CompressOld\__construct(), TextPassDumper\__construct(), FindDeprecated\__construct(), GenerateSitemap\__construct(), and SearchDump\__construct().
|
protected |
Add a parameter to the script.
Will be displayed on –help with the associated description
string | $name | The name of the param (help, version, etc) |
string | $description | The description of the param to show on –help |
bool | $required | Is the param required? |
bool | $withArg | Is an argument required with this option? |
string | $shortName | Character to use as short name |
bool | $multiOccurrence | Can this option be passed multiple times? |
Definition at line 210 of file Maintenance.php.
References $name.
Referenced by HHVMMakeRepo\__construct(), ParserFuzzTest\__construct(), RemoveInvalidEmails\__construct(), FindMissingFiles\__construct(), FindOrphanedFiles\__construct(), Undelete\__construct(), CompareParserCache\__construct(), InitEditCount\__construct(), PHPUnitMaintClass\__construct(), PopulateContentModel\__construct(), DeleteEqualMessages\__construct(), DumpBackup\__construct(), MakeTestEdits\__construct(), EditCLI\__construct(), PopulateBacklinkNamespace\__construct(), PopulateImageSha1\__construct(), Protect\__construct(), PurgeList\__construct(), RebuildSitesCache\__construct(), MaintenanceFormatInstallDoc\__construct(), GetSlaveServer\__construct(), SqliteMaintenance\__construct(), DatabaseLag\__construct(), MwSql\__construct(), TestFileOpPerformance\__construct(), UploadDumper\__construct(), WrapOldPasswords\__construct(), PurgeOldText\__construct(), ImportTextFiles\__construct(), ResetUserEmail\__construct(), CleanupSpam\__construct(), ImportSiteScripts\__construct(), SyncFileBackend\__construct(), DeleteOldRevisions\__construct(), ListVariants\__construct(), UpdateSpecialPages\__construct(), MigrateFileRepoLayout\__construct(), MinifyScript\__construct(), CleanupAncientTables\__construct(), NukePage\__construct(), RenameDbPrefix\__construct(), RebuildFileCache\__construct(), GetTextMaint\__construct(), InitSiteStats\__construct(), RemoveUnusedAccounts\__construct(), RollbackEdits\__construct(), RunJobs\__construct(), GenerateNormalizerDataAr\__construct(), ParserTestsMaintenance\__construct(), McTest\__construct(), CopyJobQueue\__construct(), ChangePassword\__construct(), PruneFileCache\__construct(), BenchWikimediaBaseConvert\__construct(), PurgeParserCache\__construct(), ReassignEdits\__construct(), DeleteArchivedFiles\__construct(), CleanupRemovedModules\__construct(), RefreshLinks\__construct(), RefreshFileHeaders\__construct(), DeleteOrphanedRevisions\__construct(), UpdateDoubleWidthSearch\__construct(), ResetUserTokens\__construct(), GenerateJsonI18n\__construct(), EraseArchivedFile\__construct(), UpdateArticleCount\__construct(), FixDoubleRedirects\__construct(), CreateAndPromote\__construct(), DeleteArchivedRevisions\__construct(), AttachLatest\__construct(), UpdateMediaWiki\__construct(), PurgeChangedPages\__construct(), GenerateCommonPassword\__construct(), FixBug20757\__construct(), InvalidateUserSesssions\__construct(), CheckSyntax\__construct(), CommandLineInc\__construct(), Benchmarker\__construct(), RebuildRecentchanges\__construct(), CommandLineInstaller\__construct(), UpdateSearchIndex\__construct(), RebuildLocalisationCache\__construct(), DeleteBatch\__construct(), Orphans\__construct(), CopyFileBackend\__construct(), UpdateCollation\__construct(), DumpIterator\__construct(), BackupReader\__construct(), CompareParsers\__construct(), ShowJobs\__construct(), MergeMessageFileList\__construct(), DumpRenderer\__construct(), RefreshImageMetadata\__construct(), NukeNS\__construct(), CapsCleanup\__construct(), TableCleanup\__construct(), MoveBatch\__construct(), ImageBuilder\__construct(), WatchlistCleanup\__construct(), MWDocGen\__construct(), PreprocessDump\__construct(), BenchmarkParse\__construct(), NamespaceConflictChecker\__construct(), GetConfiguration\__construct(), GenerateCollationData\__construct(), FindHooks\__construct(), ConvertExtensionToRegistration\__construct(), PurgeChangedFiles\__construct(), CLIParser\__construct(), CompressOld\__construct(), BackupDumper\__construct(), TextPassDumper\__construct(), GenerateSitemap\__construct(), SearchDump\__construct(), LoggedUpdateMaintenance\__construct(), addDefaultParams(), and setBatchSize().
|
protected |
Adjusts PHP's memory limit to better suit our needs, if needed.
Definition at line 706 of file Maintenance.php.
References $limit, and memoryLimit().
Referenced by finalSetup(), and setup().
|
protected |
Execute a callback function at the end of initialisation.
Definition at line 1126 of file Maintenance.php.
Referenced by finalSetup().
|
protected |
Begin a transcation on a DB.
This method makes it clear that begin() is called from a maintenance script, which has outermost scope. This is safe, unlike $dbw->begin() called in other places.
IDatabase | $dbw | |
string | $fname | Caller name |
Definition at line 1275 of file Maintenance.php.
References $fname, and IDatabase\begin().
Referenced by CleanupSpam\cleanupArticle(), CompressOld\compressWithConcat(), NukePage\deleteRevisions(), PopulateLogUsertext\doDBUpdates(), DeleteOldRevisions\doDelete(), PopulateRevisionLength\doLenUpdates(), ReassignEdits\doReassignEdits(), PopulateRevisionSha1\doSha1LegacyUpdates(), PopulateRevisionSha1\doSha1Updates(), CleanupPreferences\execute(), MigrateUserGroup\execute(), NukePage\execute(), WrapOldPasswords\execute(), DeleteArchivedFiles\execute(), DeleteOrphanedRevisions\execute(), FixBug20757\execute(), NukeNS\execute(), MoveBatch\execute(), RebuildFileCache\execute(), UpdateCollation\execute(), RemoveUnusedAccounts\isInactiveAccount(), NamespaceConflictChecker\mergePage(), ImageCleanup\pokeFile(), and purgeRedundantText().
Maintenance::checkRequiredExtensions | ( | ) |
Verify that the required extensions are installed.
Definition at line 534 of file Maintenance.php.
References $name, as, error(), and ExtensionRegistry\getInstance().
Maintenance::cleanupChanneled | ( | ) |
Clean up channeled output.
Output a newline if necessary.
Definition at line 406 of file Maintenance.php.
References print.
Referenced by output(), and outputChanneled().
Maintenance::clearParamsAndArgs | ( | ) |
Clear all params and arguments.
Definition at line 747 of file Maintenance.php.
|
protected |
Commit the transcation on a DB handle and wait for replica DBs to catch up.
This method makes it clear that commit() is called from a maintenance script, which has outermost scope. This is safe, unlike $dbw->commit() called in other places.
IDatabase | $dbw | |
string | $fname | Caller name |
Definition at line 1290 of file Maintenance.php.
References $e, $fname, $lbFactory, and IDatabase\commit().
Referenced by CleanupSpam\cleanupArticle(), CompressOld\compressWithConcat(), NukePage\deleteRevisions(), PopulateLogUsertext\doDBUpdates(), DeleteOldRevisions\doDelete(), PopulateRevisionLength\doLenUpdates(), ReassignEdits\doReassignEdits(), PopulateRevisionSha1\doSha1LegacyUpdates(), PopulateRevisionSha1\doSha1Updates(), CleanupPreferences\execute(), DeleteSelfExternals\execute(), MigrateUserGroup\execute(), NukePage\execute(), DeleteArchivedFiles\execute(), WrapOldPasswords\execute(), DeleteOrphanedRevisions\execute(), FixBug20757\execute(), NukeNS\execute(), MoveBatch\execute(), RebuildFileCache\execute(), UpdateCollation\execute(), RemoveUnusedAccounts\isInactiveAccount(), NamespaceConflictChecker\mergePage(), ImageCleanup\pokeFile(), and purgeRedundantText().
|
protected |
Remove an option.
Useful for removing options that won't be used in your script.
string | $name | The option to remove. |
Definition at line 274 of file Maintenance.php.
References $name.
|
protected |
Throw an error to the user.
Doesn't respect –quiet, so don't use this for non-error output
string | $err | The error to display |
int | $die | If > 0, go ahead and die out using this int as the code |
Definition at line 387 of file Maintenance.php.
References outputChanneled(), and print.
Referenced by SqliteMaintenance\backup(), CheckSyntax\buildFileList(), ImageCleanup\buildSafeTitle(), FindOrphanedFiles\checkFiles(), CompareParsers\checkOptions(), checkRequiredExtensions(), SqliteMaintenance\checkSyntax(), 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(), UploadStashCleanup\doOperations(), UpdateSpecialPages\doSpecialPageCacheUpdates(), ValidateRegistrationFile\execute(), CheckComposerLockUpToDate\execute(), ExportSites\execute(), HHVMMakeRepo\execute(), PageExists\execute(), Undelete\execute(), FindOrphanedFiles\execute(), BenchmarkPurge\execute(), GetLagTimes\execute(), DumpRev\execute(), DeleteRevision\execute(), PopulateContentModel\execute(), MaintenanceFormatInstallDoc\execute(), DeleteDefaultMessages\execute(), CleanupAncientTables\execute(), MakeTestEdits\execute(), MigrateUserGroup\execute(), LangMemUsage\execute(), GetTextMaint\execute(), ImportSiteScripts\execute(), RemoveUnusedAccounts\execute(), BatchedQueryRunner\execute(), UpdateRestrictions\execute(), UpdateSpecialPages\execute(), WrapOldPasswords\execute(), PruneFileCache\execute(), DeleteArchivedFiles\execute(), McTest\execute(), MigrateFileRepoLayout\execute(), ChangePassword\execute(), Protect\execute(), ResetUserEmail\execute(), EraseArchivedFile\execute(), CleanupSpam\execute(), FixDoubleRedirects\execute(), CopyJobQueue\execute(), RenameDbPrefix\execute(), UploadStashCleanup\execute(), GenerateNormalizerDataAr\execute(), OrphanStats\execute(), FixTimestamps\execute(), ReassignEdits\execute(), EditCLI\execute(), PatchSql\execute(), MwSql\execute(), InvalidateUserSesssions\execute(), PurgeParserCache\execute(), Digit2Html\execute(), GenerateJsonI18n\execute(), SyncFileBackend\execute(), DumpIterator\execute(), RollbackEdits\execute(), MinifyScript\execute(), PurgeChangedPages\execute(), ImportTextFiles\execute(), GenerateCommonPassword\execute(), DeleteBatch\execute(), UpdateDoubleWidthSearch\execute(), RebuildTextIndex\execute(), DumpRenderer\execute(), SqliteMaintenance\execute(), RunJobs\execute(), MoveBatch\execute(), CopyFileBackend\execute(), CreateAndPromote\execute(), RebuildFileCache\execute(), RebuildRecentchanges\execute(), MergeMessageFileList\execute(), RebuildLocalisationCache\execute(), GenerateCollationData\execute(), UpdateSearchIndex\execute(), FindHooks\execute(), ConvertLinks\execute(), BenchmarkParse\execute(), ConvertExtensionToRegistration\execute(), DumpBackup\execute(), PurgeChangedFiles\execute(), BackupReader\execute(), UpdateMediaWiki\execute(), CommandLineInstaller\execute(), RefreshImageMetadata\execute(), DeleteEqualMessages\execute(), CompressOld\execute(), MWDocGen\execute(), GenerateSitemap\execute(), BackupDumper\fatalError(), GenerateCollationData\generateFirstChars(), RebuildSitesCache\getCacheFile(), MinifyScript\getExtension(), CheckSyntax\getGitModifiedFiles(), CopyFileBackend\getListingDiffRel(), BackupReader\getNsIndex(), 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(), PurgeChangedFiles\purgeFromArchiveTable(), PurgeChangedFiles\purgeFromLogType(), MergeMessageFileList\readFile(), runChild(), setParam(), setup(), RefreshImageMetadata\setupParameters(), MwSql\sqlDoQuery(), SyncFileBackend\syncBackends(), SyncFileBackend\syncFileBatch(), GenerateJsonI18n\transformI18nFile(), RefreshFileHeaders\updateFileHeaders(), SqliteMaintenance\vacuum(), GetConfiguration\validateParamsAndArgs(), validateParamsAndArgs(), and CLIParser\Wikitext().
|
inlineprivate |
Definition at line 45 of file maintenance.txt.
|
abstract |
Do the actual work.
All child classes will need to implement this
Maintenance::finalSetup | ( | ) |
Handle some last-minute setup here.
Definition at line 1064 of file Maintenance.php.
References $mDbPass, $mDbUser, $wgCommandLineMode, $wgDBadminpassword, $wgDBadminuser, $wgDBpassword, $wgDBservers, $wgDBuser, $wgLBFactoryConf, $wgServer, activateProfiler(), adjustMemoryLimit(), afterFinalSetup(), as, getDbType(), getOption(), global, and hasOption().
|
protected |
Get an argument.
int | $argId | The integer value (from zero) for the arg |
mixed | $default | The default if it doesn't exist |
Definition at line 301 of file Maintenance.php.
References hasArg().
Referenced by ValidateRegistrationFile\execute(), ExportSites\execute(), ImportSites\execute(), PageExists\execute(), Undelete\execute(), DumpRev\execute(), MaintenanceFormatInstallDoc\execute(), MigrateUserGroup\execute(), ImportSiteScripts\execute(), NukePage\execute(), GetTextMaint\execute(), BatchedQueryRunner\execute(), ResetUserEmail\execute(), McTest\execute(), Protect\execute(), CleanupSpam\execute(), FixTimestamps\execute(), ReassignEdits\execute(), EditCLI\execute(), MwSql\execute(), GenerateJsonI18n\execute(), ImportTextFiles\execute(), MinifyScript\execute(), RefreshLinks\execute(), DeleteBatch\execute(), GenerateCommonPassword\execute(), MoveBatch\execute(), CreateAndPromote\execute(), BenchmarkParse\execute(), ConvertLinks\execute(), ConvertExtensionToRegistration\execute(), BackupReader\execute(), CommandLineInstaller\execute(), ImportSiteScripts\fetchScriptList(), and CLIParser\Wikitext().
Maintenance::getConfig | ( | ) |
Definition at line 500 of file Maintenance.php.
References $config, and ConfigFactory\getDefaultInstance().
Referenced by FixDefaultJsonContentPages\doDBUpdates(), AddRFCAndPMIDInterwiki\doDBUpdates(), Undelete\execute(), WrapOldPasswords\execute(), DumpIterator\execute(), DumpRenderer\execute(), RebuildSitesCache\getCacheFile(), and BackupReader\importFromHandle().
|
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()
integer | $db | DB index (DB_REPLICA/DB_MASTER) |
array | $groups,; | default: empty array |
string | bool | $wiki,; | default: current wiki |
Definition at line 1248 of file Maintenance.php.
References $mDb, and wfGetDB().
Referenced by ImageBuilder\buildTable(), Orphans\checkOrphans(), Orphans\checkSeparation(), Orphans\checkWidows(), CleanupSpam\cleanupArticle(), CompressOld\compressOldPages(), CompressOld\compressPage(), CompressOld\compressWithConcat(), ConvertLinks\createTempTable(), RefreshLinks\deleteLinksFromNonexistent(), NukePage\deleteRevisions(), RefreshLinks\dfnCheckInterval(), PopulateRecentChangesSource\doDBUpdates(), FixDefaultJsonContentPages\doDBUpdates(), PopulateRevisionLength\doDBUpdates(), PopulateRevisionSha1\doDBUpdates(), AddRFCAndPMIDInterwiki\doDBUpdates(), PopulateFilearchiveSha1\doDBUpdates(), PopulateBacklinkNamespace\doDBUpdates(), PopulateParentId\doDBUpdates(), FixExtLinksProtocolRelative\doDBUpdates(), PopulateLogUsertext\doDBUpdates(), PopulateLogSearch\doDBUpdates(), PopulateImageSha1\doDBUpdates(), DeleteOldRevisions\doDelete(), PopulateRevisionLength\doLenUpdates(), ReassignEdits\doReassignEdits(), RefreshLinks\doRefreshLinks(), PopulateRevisionSha1\doSha1LegacyUpdates(), PopulateRevisionSha1\doSha1Updates(), UpdateSearchIndex\doUpdateSearchIndex(), TidyUpBug37714\execute(), RemoveInvalidEmails\execute(), StorageTypeStats\execute(), CleanupPreferences\execute(), CompareParserCache\execute(), CheckBadRedirects\execute(), BenchmarkDeleteTruncate\execute(), ClearInterwikiCache\execute(), GetSlaveServer\execute(), CheckImages\execute(), DumpRev\execute(), DeleteSelfExternals\execute(), PopulateContentModel\execute(), DeleteRevision\execute(), FixUserRegistration\execute(), CleanupAncientTables\execute(), CleanupBlocks\execute(), InitEditCount\execute(), MigrateUserGroup\execute(), DeleteDefaultMessages\execute(), ConvertUserOptions\execute(), RemoveUnusedAccounts\execute(), BatchedQueryRunner\execute(), NukePage\execute(), DeleteOrphanedRevisions\execute(), RebuildAll\execute(), InitSiteStats\execute(), WrapOldPasswords\execute(), DeleteArchivedFiles\execute(), CleanupRemovedModules\execute(), UpdateRestrictions\execute(), CheckUsernames\execute(), AlterSharedConstraints\execute(), UpdateSpecialPages\execute(), DeleteArchivedRevisions\execute(), UpdateArticleCount\execute(), EraseArchivedFile\execute(), AttachLatest\execute(), FixDoubleRedirects\execute(), CleanupSpam\execute(), RefreshFileHeaders\execute(), RenameDbPrefix\execute(), FixBug20757\execute(), ShowSiteStats\execute(), FixTimestamps\execute(), PatchSql\execute(), DumpLinks\execute(), PurgeChangedPages\execute(), DeleteBatch\execute(), UpdateDoubleWidthSearch\execute(), FetchText\execute(), RebuildTextIndex\execute(), ResetUserTokens\execute(), NukeNS\execute(), SqliteMaintenance\execute(), MoveBatch\execute(), RebuildFileCache\execute(), ImageBuilder\execute(), ConvertLinks\execute(), UpdateCollation\execute(), PopulateCategory\execute(), NamespaceConflictChecker\execute(), PurgeChangedFiles\execute(), UpdateMediaWiki\execute(), RefreshImageMetadata\execute(), DeleteEqualMessages\execute(), GenerateSitemap\execute(), LoggedUpdateMaintenance\execute(), UploadDumper\fetchLocal(), UploadDumper\fetchUsed(), TitleCleanup\fileExists(), RefreshLinks\fixRedirect(), BenchmarkParse\getRevIdForTime(), FixBug20757\getRevTextMap(), RollbackEdits\getRollbackTitles(), FixDefaultJsonContentPages\handleRow(), BackupReader\handleUpload(), RemoveUnusedAccounts\isInactiveAccount(), ImageCleanup\killRow(), TitleCleanup\moveIllegalPage(), TitleCleanup\moveInconsistentPage(), ImageCleanup\pokeFile(), PurgeChangedFiles\purgeFromLogType(), PurgeList\purgeNamespace(), purgeRedundantText(), RebuildRecentchanges\rebuildRecentChangesTablePass1(), RebuildRecentchanges\rebuildRecentChangesTablePass2(), RebuildRecentchanges\rebuildRecentChangesTablePass3(), RebuildRecentchanges\rebuildRecentChangesTablePass4(), WatchlistCleanup\removeWatch(), TableCleanup\runTable(), EraseArchivedFile\scrubAllVersions(), PopulateRevisionSha1\upgradeLegacyArchiveRow(), PopulateRevisionLength\upgradeRow(), and PopulateRevisionSha1\upgradeRow().
Maintenance::getDbType | ( | ) |
Does the script need different DB access? By default, we give Maintenance scripts normal rights to the DB.
Sometimes, a script needs admin rights access for a reason and sometimes they want no access. Subclasses should override and return one of the following values, as needed: Maintenance::DB_NONE - For no DB access at all Maintenance::DB_STD - For normal DB access, default Maintenance::DB_ADMIN - For admin DB access
Definition at line 454 of file Maintenance.php.
References DB_STD.
Referenced by addDefaultParams(), DumpIterator\finalSetup(), and finalSetup().
|
protected |
Maintenance::getName | ( | ) |
Get the script's name.
Definition at line 331 of file Maintenance.php.
References $mSelf.
|
protected |
Get an option, or return the default.
If the option was added to support multiple occurrences, this will return an array.
string | $name | The name of the param |
mixed | $default | Anything you want, default null |
Definition at line 245 of file Maintenance.php.
References $name, and hasOption().
Referenced by activateProfiler(), Benchmarker\bench(), CheckSyntax\buildFileList(), PreprocessDump\checkOptions(), CompareParsers\checkOptions(), SqliteMaintenance\checkSyntax(), PopulateBacklinkNamespace\doDBUpdates(), PopulateImageSha1\doDBUpdates(), TestFileOpPerformance\doPerfTest(), PurgeList\doPurge(), UpdateSpecialPages\doSpecialPageCacheUpdates(), HHVMMakeRepo\execute(), ParserFuzzTest\execute(), CompareParserCache\execute(), Undelete\execute(), FindOrphanedFiles\execute(), FindMissingFiles\execute(), BenchmarkPurge\execute(), GetSlaveServer\execute(), PopulateContentModel\execute(), MaintenanceFormatInstallDoc\execute(), MakeTestEdits\execute(), ImportSiteScripts\execute(), RemoveUnusedAccounts\execute(), NukePage\execute(), WrapOldPasswords\execute(), PruneFileCache\execute(), CleanupRemovedModules\execute(), UpdateSpecialPages\execute(), Protect\execute(), PurgeList\execute(), McTest\execute(), UploadDumper\execute(), ChangePassword\execute(), MigrateFileRepoLayout\execute(), BenchWikimediaBaseConvert\execute(), RefreshFileHeaders\execute(), RenameDbPrefix\execute(), FixBug20757\execute(), EraseArchivedFile\execute(), TestFileOpPerformance\execute(), CopyJobQueue\execute(), FixDoubleRedirects\execute(), GenerateNormalizerDataAr\execute(), MwSql\execute(), EditCLI\execute(), PurgeParserCache\execute(), InvalidateUserSesssions\execute(), GenerateJsonI18n\execute(), SyncFileBackend\execute(), PurgeChangedPages\execute(), DumpIterator\execute(), ImportTextFiles\execute(), RollbackEdits\execute(), MinifyScript\execute(), GenerateCommonPassword\execute(), DeleteBatch\execute(), RefreshLinks\execute(), UpdateDoubleWidthSearch\execute(), ResetUserTokens\execute(), DumpRenderer\execute(), NukeNS\execute(), SqliteMaintenance\execute(), ShowJobs\execute(), PopulateImageSha1\execute(), RunJobs\execute(), MoveBatch\execute(), CopyFileBackend\execute(), RebuildFileCache\execute(), CreateAndPromote\execute(), MergeMessageFileList\execute(), RebuildLocalisationCache\execute(), GenerateCollationData\execute(), UpdateSearchIndex\execute(), PHPUnitMaintClass\execute(), BenchmarkParse\execute(), UpdateCollation\execute(), NamespaceConflictChecker\execute(), PopulateCategory\execute(), ConvertExtensionToRegistration\execute(), PurgeChangedFiles\execute(), ParserTestsMaintenance\execute(), BackupReader\execute(), UpdateMediaWiki\execute(), CommandLineInstaller\execute(), RefreshImageMetadata\execute(), DeleteEqualMessages\execute(), CompressOld\execute(), GetConfiguration\execute(), GenerateSitemap\execute(), GetConfiguration\finalSetup(), finalSetup(), RebuildSitesCache\getCacheFile(), RefreshImageMetadata\getConditions(), CLIParser\getTitle(), BackupReader\importFromHandle(), MWDocGen\init(), loadSpecialVars(), memoryLimit(), DumpBackup\processOptions(), TextPassDumper\processOptions(), BackupDumper\processOptions(), CompareParsers\processRevision(), SearchDump\processRevision(), PurgeChangedFiles\purgeFromLogType(), RebuildRecentchanges\rebuildRecentChangesTablePass1(), PurgeList\sendPurgeRequest(), SyncFileBackend\syncFileBatch(), and GetConfiguration\validateParamsAndArgs().
|
protected |
Return input from stdin.
int | $len | The number of bytes to read. If null, just return the handle. Maintenance::STDIN_ALL returns the full length |
Definition at line 341 of file Maintenance.php.
References STDIN_ALL.
Referenced by PurgeList\doPurge(), EditCLI\execute(), DumpIterator\execute(), DeleteBatch\execute(), FetchText\execute(), DumpRenderer\execute(), and MoveBatch\execute().
Maintenance::globals | ( | ) |
Potentially debug globals.
Originally a feature only for refreshLinks
Definition at line 1136 of file Maintenance.php.
References $GLOBALS, and hasOption().
|
protected |
Does a given argument exist?
int | $argId | The integer value (from zero) for the arg |
Definition at line 291 of file Maintenance.php.
Referenced by MaintenanceFormatInstallDoc\execute(), JSParseHelper\execute(), BatchedQueryRunner\execute(), McTest\execute(), ReassignEdits\execute(), MwSql\execute(), DeleteBatch\execute(), MoveBatch\execute(), BackupReader\execute(), getArg(), and validateParamsAndArgs().
|
protected |
Checks to see if a particular param exists.
string | $name | The name of the param |
Definition at line 231 of file Maintenance.php.
References $name.
Referenced by CheckSyntax\buildFileList(), PreprocessDump\checkOptions(), CompareParsers\checkOptions(), CleanupSpam\cleanupArticle(), CopyFileBackend\copyFileBatch(), ConvertLinks\createTempTable(), PopulateImageSha1\doDBUpdates(), TestFileOpPerformance\doPerfTest(), UpdateSpecialPages\doSpecialPageCacheUpdates(), RemoveInvalidEmails\execute(), FindOrphanedFiles\execute(), BenchmarkPurge\execute(), GetSlaveServer\execute(), DatabaseLag\execute(), PurgeOldText\execute(), MaintenanceFormatInstallDoc\execute(), CleanupAncientTables\execute(), InitEditCount\execute(), DeleteOldRevisions\execute(), ListVariants\execute(), GetTextMaint\execute(), RemoveUnusedAccounts\execute(), InitSiteStats\execute(), DeleteArchivedFiles\execute(), UpdateSpecialPages\execute(), WrapOldPasswords\execute(), DeleteOrphanedRevisions\execute(), UploadDumper\execute(), Protect\execute(), ChangePassword\execute(), PurgeList\execute(), ResetUserEmail\execute(), DeleteArchivedRevisions\execute(), UpdateArticleCount\execute(), EraseArchivedFile\execute(), FixDoubleRedirects\execute(), CleanupSpam\execute(), RefreshFileHeaders\execute(), AttachLatest\execute(), ReassignEdits\execute(), GenerateNormalizerDataAr\execute(), EditCLI\execute(), MwSql\execute(), SyncFileBackend\execute(), GenerateJsonI18n\execute(), MinifyScript\execute(), PurgeChangedPages\execute(), RollbackEdits\execute(), ImportTextFiles\execute(), DumpIterator\execute(), Orphans\execute(), TableCleanup\execute(), RefreshLinks\execute(), CapsCleanup\execute(), DumpRenderer\execute(), WatchlistCleanup\execute(), SqliteMaintenance\execute(), ShowJobs\execute(), PopulateImageSha1\execute(), RunJobs\execute(), CopyFileBackend\execute(), RebuildRecentchanges\execute(), CreateAndPromote\execute(), MergeMessageFileList\execute(), RebuildLocalisationCache\execute(), ImageBuilder\execute(), UpdateSearchIndex\execute(), PHPUnitMaintClass\execute(), CheckSyntax\execute(), ConvertLinks\execute(), BenchmarkParse\execute(), UpdateCollation\execute(), NamespaceConflictChecker\execute(), ConvertExtensionToRegistration\execute(), DumpBackup\execute(), PurgeChangedFiles\execute(), ParserTestsMaintenance\execute(), BackupReader\execute(), UpdateMediaWiki\execute(), CommandLineInstaller\execute(), RefreshImageMetadata\execute(), DeleteEqualMessages\execute(), LoggedUpdateMaintenance\execute(), CopyFileBackend\filesAreSame(), GetConfiguration\finalSetup(), finalSetup(), UpdateCollation\getBatchCondition(), RebuildSitesCache\getCacheFile(), 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().
Maintenance::isQuiet | ( | ) |
Definition at line 358 of file Maintenance.php.
References $mQuiet.
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.
string | $self | The name of the script, if any |
array | $opts | An array of options, in form of key=>value |
array | $args | An array of command line arguments |
Definition at line 873 of file Maintenance.php.
References $args, $self, global, loadSpecialVars(), and loadWithArgv().
Referenced by CategoryMembershipChangeJobTest\runJobs(), setup(), WikiPageTest\testDoDeleteArticle(), WikiPageTest\testDoDeleteUpdates(), and TemplateCategoriesTest\testTemplateCategories().
Maintenance::loadSettings | ( | ) |
Generic setup for most installs.
Returns the location of LocalSettings
Definition at line 1146 of file Maintenance.php.
References $IP, $wgCommandLineMode, error(), and global.
|
protected |
Handle the special variables that are global to all scripts.
Definition at line 930 of file Maintenance.php.
References getOption(), and hasOption().
Referenced by loadParamsAndArgs(), and loadWithArgv().
Maintenance::loadWithArgv | ( | $argv | ) |
Load params and arguments from a given array of command-line arguments.
array | $argv |
Definition at line 760 of file Maintenance.php.
References $args, $options, error(), loadSpecialVars(), maybeHelp(), and setParam().
Referenced by DumpBackup\__construct(), BackupDumper\__construct(), TextPassDumper\__construct(), and loadParamsAndArgs().
|
private |
Lock the search index.
Database | &$db |
Definition at line 1323 of file Maintenance.php.
Referenced by relockSearchindex(), and updateSearchIndex().
|
protected |
Maybe show the help.
bool | $force | Whether to force the help to show, default false |
Definition at line 949 of file Maintenance.php.
References $mDependantParameters, $output, as, hasOption(), output(), and the.
Referenced by JSParseHelper\execute(), GenerateJsonI18n\execute(), PurgeChangedPages\execute(), CreateAndPromote\execute(), PurgeChangedFiles\execute(), BackupReader\importFromStdin(), loadWithArgv(), setParam(), setup(), GetConfiguration\validateParamsAndArgs(), and validateParamsAndArgs().
Maintenance::memoryLimit | ( | ) |
Normally we disable the memory_limit when running admin scripts.
Some scripts may wish to actually set a limit, however, to avoid blowing up unexpectedly. We also support a –memory-limit option, to allow sysadmins to explicitly set one if they'd prefer to override defaults (or for people using Suhosin which yells at you for trying to disable the limits)
Definition at line 697 of file Maintenance.php.
References $limit, and getOption().
Referenced by adjustMemoryLimit(), and ParserFuzzTest\fuzzTest().
|
protected |
Throw some output to the user.
Scripts can call this with no fears, as we handle all –quiet stuff here
string | $out | The text to show to the user |
mixed | $channel | Unique identifier for the channel. See function outputChanneled. |
Definition at line 368 of file Maintenance.php.
References $out, cleanupChanneled(), outputChanneled(), and print.
Referenced by DumpBackup\__construct(), TextPassDumper\__construct(), ImageBuilder\addMissingImage(), SqliteMaintenance\backup(), CheckSyntax\buildFileList(), ImageBuilder\buildTable(), NamespaceConflictChecker\checkAll(), CheckSyntax\checkEvilToken(), FindOrphanedFiles\checkFiles(), CheckSyntax\checkFileWithCli(), NamespaceConflictChecker\checkLinkTable(), NamespaceConflictChecker\checkNamespace(), Orphans\checkOrphans(), NamespaceConflictChecker\checkPrefix(), CheckSyntax\checkRegex(), Orphans\checkSeparation(), SqliteMaintenance\checkSyntax(), Orphans\checkWidows(), CleanupSpam\cleanupArticle(), RebuildTextIndex\clearSearchIndex(), CompressOld\compressOldPages(), CompressOld\compressWithConcat(), CompareParsers\conclusions(), CopyFileBackend\copyFileBatch(), RebuildTextIndex\createMysqlTextIndex(), ConvertLinks\createTempTable(), RunJobs\debugInternal(), RefreshLinks\deleteLinksFromNonexistent(), CopyFileBackend\delFileBatch(), RefreshLinks\dfnCheckInterval(), PopulateRecentChangesSource\doDBUpdates(), PopulateRevisionLength\doDBUpdates(), PopulateRevisionSha1\doDBUpdates(), FixDefaultJsonContentPages\doDBUpdates(), PopulateBacklinkNamespace\doDBUpdates(), PopulateFilearchiveSha1\doDBUpdates(), PopulateParentId\doDBUpdates(), FixExtLinksProtocolRelative\doDBUpdates(), PopulateLogUsertext\doDBUpdates(), PopulateLogSearch\doDBUpdates(), PopulateImageSha1\doDBUpdates(), DeleteOldRevisions\doDelete(), PopulateRevisionLength\doLenUpdates(), TestFileOpPerformance\doPerfTest(), PurgeList\doPurge(), ReassignEdits\doReassignEdits(), RebuildLocalisationCache\doRebuild(), RefreshLinks\doRefreshLinks(), PopulateRevisionSha1\doSha1LegacyUpdates(), PopulateRevisionSha1\doSha1Updates(), UpdateSpecialPages\doSpecialPageCacheUpdates(), UpdateSearchIndex\doUpdateSearchIndex(), RebuildTextIndex\dropMysqlTextIndex(), TidyUpBug37714\execute(), ValidateRegistrationFile\execute(), CheckComposerLockUpToDate\execute(), RemoveInvalidEmails\execute(), ExportSites\execute(), ImportSites\execute(), PageExists\execute(), CleanupPreferences\execute(), CompareParserCache\execute(), FindMissingFiles\execute(), FindOrphanedFiles\execute(), Undelete\execute(), RebuildMessages\execute(), BenchmarkPurge\execute(), GetLagTimes\execute(), BenchmarkHooks\execute(), CheckBadRedirects\execute(), CheckImages\execute(), ClearInterwikiCache\execute(), GetSlaveServer\execute(), DatabaseLag\execute(), AllTrans\execute(), DumpRev\execute(), DeleteSelfExternals\execute(), FixUserRegistration\execute(), DumpMessages\execute(), DeleteRevision\execute(), CleanupBlocks\execute(), MakeTestEdits\execute(), InitEditCount\execute(), DateFormats\execute(), JSParseHelper\execute(), DeleteDefaultMessages\execute(), CleanupAncientTables\execute(), DeleteOldRevisions\execute(), MigrateUserGroup\execute(), NukePage\execute(), ConvertUserOptions\execute(), GetTextMaint\execute(), ImportSiteScripts\execute(), RemoveUnusedAccounts\execute(), BatchedQueryRunner\execute(), LangMemUsage\execute(), AlterSharedConstraints\execute(), CheckUsernames\execute(), CleanupRemovedModules\execute(), PruneFileCache\execute(), RebuildAll\execute(), InitSiteStats\execute(), DeleteArchivedFiles\execute(), UpdateRestrictions\execute(), UpdateSpecialPages\execute(), WrapOldPasswords\execute(), DeleteOrphanedRevisions\execute(), Protect\execute(), ChangePassword\execute(), PurgeList\execute(), BenchWikimediaBaseConvert\execute(), DeleteArchivedRevisions\execute(), UpdateArticleCount\execute(), McTest\execute(), MigrateFileRepoLayout\execute(), AttachLatest\execute(), UploadStashCleanup\execute(), EraseArchivedFile\execute(), RenameDbPrefix\execute(), FixDoubleRedirects\execute(), RefreshFileHeaders\execute(), CopyJobQueue\execute(), CleanupSpam\execute(), ReassignEdits\execute(), FixTimestamps\execute(), ShowSiteStats\execute(), OrphanStats\execute(), DumpLinks\execute(), PatchSql\execute(), EditCLI\execute(), PurgeParserCache\execute(), Digit2Html\execute(), InvalidateUserSesssions\execute(), GenerateJsonI18n\execute(), SyncFileBackend\execute(), PurgeChangedPages\execute(), RollbackEdits\execute(), ImportTextFiles\execute(), DeleteBatch\execute(), GenerateCommonPassword\execute(), TableCleanup\execute(), UpdateDoubleWidthSearch\execute(), FetchText\execute(), CapsCleanup\execute(), RebuildTextIndex\execute(), ResetUserTokens\execute(), NukeNS\execute(), WatchlistCleanup\execute(), ShowJobs\execute(), RunJobs\execute(), MoveBatch\execute(), CopyFileBackend\execute(), RebuildRecentchanges\execute(), RebuildFileCache\execute(), CreateAndPromote\execute(), RebuildLocalisationCache\execute(), FindHooks\execute(), CheckSyntax\execute(), ConvertLinks\execute(), UpdateCollation\execute(), PopulateCategory\execute(), NamespaceConflictChecker\execute(), ConvertExtensionToRegistration\execute(), BackupReader\execute(), UpdateMediaWiki\execute(), RefreshImageMetadata\execute(), DeleteEqualMessages\execute(), CompressOld\execute(), MWDocGen\execute(), GetConfiguration\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(), GenerateSitemap\main(), maybeHelp(), 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(), RebuildRecentchanges\purgeFeeds(), PurgeChangedFiles\purgeFromArchiveTable(), purgeRedundantText(), FixDoubleRedirects\queueJobs(), RebuildRecentchanges\rebuildRecentChangesTablePass1(), RebuildRecentchanges\rebuildRecentChangesTablePass2(), RebuildRecentchanges\rebuildRecentChangesTablePass3(), RebuildRecentchanges\rebuildRecentChangesTablePass4(), RebuildRecentchanges\rebuildRecentChangesTablePass5(), WatchlistCleanup\removeWatch(), ImportSites\reportException(), MigrateFileRepoLayout\runBatch(), TableCleanup\runTable(), EraseArchivedFile\scrubVersion(), PurgeList\sendPurgeRequest(), PurgeParserCache\showProgress(), UpdateCollation\showSortKeySizeHistogram(), MwSql\sqlPrintResult(), SyncFileBackend\syncBackends(), SyncFileBackend\syncFileBatch(), GenerateJsonI18n\transformI18nFile(), PopulateContentModel\updatePageRows(), PopulateContentModel\updateRevisionOrArchiveRows(), updateSearchIndex(), updateSearchIndexForPage(), ResetUserTokens\updateUser(), PopulateRevisionSha1\upgradeLegacyArchiveRow(), PopulateRevisionLength\upgradeRow(), PopulateRevisionSha1\upgradeRow(), SqliteMaintenance\vacuum(), and PurgeChangedFiles\verbose().
Maintenance::outputChanneled | ( | $msg, | |
$channel = null |
|||
) |
Message outputter with channeled message support.
Messages on the same channel are concatenated, but any intervening messages in another channel start a new line.
string | $msg | The message without trailing newline |
string | $channel | Channel identifier or null for no channel. Channel comparison uses ===. |
Definition at line 421 of file Maintenance.php.
References cleanupChanneled(), and print.
|
static |
Wrapper for posix_isatty() We default as considering stdin a tty (for nice readline methods) but treating stout as not a tty to avoid color codes.
mixed | $fd | File descriptor |
Definition at line 1424 of file Maintenance.php.
Referenced by MwSql\execute(), ParserTestsMaintenance\execute(), and FindDeprecated\execute().
Maintenance::purgeRedundantText | ( | $delete = true | ) |
Support function for cleaning up redundant text records.
bool | $delete | Whether or not to actually delete the records |
Definition at line 1180 of file Maintenance.php.
References $count, $res, as, beginTransaction(), commitTransaction(), DB_MASTER, getDB(), and output().
Referenced by DeleteOldRevisions\doDelete(), PurgeOldText\execute(), NukePage\execute(), DeleteOrphanedRevisions\execute(), DeleteArchivedRevisions\execute(), and NukeNS\execute().
|
static |
Prompt the console for input.
string | $prompt | What to begin the line with, like '> ' |
Definition at line 1437 of file Maintenance.php.
Referenced by MwSql\execute().
|
staticprivate |
Emulate readline()
string | $prompt | What to begin the line with, like '> ' |
Definition at line 1475 of file Maintenance.php.
References $command, $line, $retval, Installer\locateExecutableInDefaultPaths(), print, wfEscapeShellArg(), wfIsWindows(), and wfShellExec().
|
private |
Unlock and lock again Since the lock is low-priority, queued reads will be able to complete.
Database | &$db |
Definition at line 1350 of file Maintenance.php.
References lockSearchindex(), and unlockSearchindex().
Referenced by updateSearchIndex().
|
protected |
Indicate that the specified extension must be loaded before the script can run.
This must be called in the constructor.
string | $name |
Definition at line 525 of file Maintenance.php.
References $name.
|
static |
Call this to set up the autoloader to allow classes to be used from the tests directory.
Definition at line 1509 of file Maintenance.php.
|
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.
IDatabase | $dbw | |
string | $fname | Caller name |
Definition at line 1315 of file Maintenance.php.
References $fname, and IDatabase\rollback().
Referenced by ImageCleanup\pokeFile().
Maintenance::runChild | ( | $maintClass, | |
$classFile = null |
|||
) |
Run a child maintenance script.
Pass all of the current arguments to it.
string | $maintClass | A name of a child maintenance class |
string | $classFile | Full path of where the child is |
Definition at line 610 of file Maintenance.php.
References $maintClass, and error().
Referenced by RebuildAll\execute(), NukeNS\execute(), and UpdateMediaWiki\execute().
Maintenance::setAgentAndTriggers | ( | ) |
Set triggers like when to try to run deferred updates.
Definition at line 556 of file Maintenance.php.
References $lbFactory, and wfHostname().
|
protected |
Set the batch size.
int | $s | The number of operations to do in a batch |
Definition at line 309 of file Maintenance.php.
References $s, and addOption().
Referenced by RemoveInvalidEmails\__construct(), FindOrphanedFiles\__construct(), FindMissingFiles\__construct(), PopulateContentModel\__construct(), MakeTestEdits\__construct(), CheckImages\__construct(), MigrateUserGroup\__construct(), PurgeList\__construct(), SyncFileBackend\__construct(), WrapOldPasswords\__construct(), FixDefaultJsonContentPages\__construct(), PopulateRecentChangesSource\__construct(), FixUserRegistration\__construct(), PopulateRevisionLength\__construct(), PopulateRevisionSha1\__construct(), RebuildFileCache\__construct(), CleanupBlocks\__construct(), MigrateFileRepoLayout\__construct(), RefreshFileHeaders\__construct(), RefreshLinks\__construct(), ConvertUserOptions\__construct(), CopyJobQueue\__construct(), UpdateRestrictions\__construct(), ResetUserTokens\__construct(), CheckUsernames\__construct(), PopulateLogUsertext\__construct(), PurgeChangedPages\__construct(), InvalidateUserSesssions\__construct(), UploadStashCleanup\__construct(), RebuildRecentchanges\__construct(), PopulateLogSearch\__construct(), CopyFileBackend\__construct(), RefreshImageMetadata\__construct(), PurgeChangedFiles\__construct(), and LoggedUpdateMaintenance\__construct().
Maintenance::setConfig | ( | Config | $config | ) |
Config | $config |
Definition at line 512 of file Maintenance.php.
References $config.
Maintenance::setDB | ( | IDatabase | $db | ) |
Sets database object to be returned by getDB().
Definition at line 1261 of file Maintenance.php.
Referenced by DatabaseUpdater\__construct().
|
static |
LBFactory | $LBFactory |
Definition at line 576 of file Maintenance.php.
References $lbFactory, $wgCommandLineMode, global, and DeferredUpdates\tryOpportunisticExecute().
Referenced by MediaWikiTestCase\setUp().
|
private |
Helper function used solely by loadParamsAndArgs to prevent code duplication.
This sets the param in the options array based on whether or not it can be specified multiple times.
array | $options | |
string | $option | |
mixed | $value |
Definition at line 843 of file Maintenance.php.
References $options, $value, error(), and maybeHelp().
Referenced by loadWithArgv().
Maintenance::setup | ( | ) |
Do some sanity checking and basic setup.
Definition at line 636 of file Maintenance.php.
References $IP, $wgCommandLineMode, $wgRequestTime, adjustMemoryLimit(), error(), global, loadParamsAndArgs(), maybeHelp(), and validateParamsAndArgs().
|
static |
Should we execute the maintenance script, or just allow it to be included as a standalone class? It checks that the call stack only includes this function and "requires" (meaning was called from the file scope)
Definition at line 168 of file Maintenance.php.
References $count, $wgCommandLineMode, and global.
|
private |
Unlock the tables.
Database | &$db |
Definition at line 1341 of file Maintenance.php.
Referenced by relockSearchindex(), and updateSearchIndex().
Maintenance::updateSearchIndex | ( | $maxLockTime, | |
$callback, | |||
$dbw, | |||
$results | |||
) |
Perform a search index update with locking.
int | $maxLockTime | The maximum time to keep the search index locked. |
string | $callback | The function that will update the function. |
Database | $dbw | |
array | $results |
Definition at line 1362 of file Maintenance.php.
References as, lockSearchindex(), output(), relockSearchindex(), and unlockSearchindex().
Referenced by UpdateSearchIndex\doUpdateSearchIndex(), and UpdateDoubleWidthSearch\execute().
Maintenance::updateSearchIndexForPage | ( | $dbw, | |
$pageId | |||
) |
Update the searchindex table for a given pageid.
Database | $dbw | A database write handle |
int | $pageId | The page ID to update. |
Definition at line 1399 of file Maintenance.php.
References $rev, $title, SearchUpdate\doUpdate(), Revision\loadFromPageId(), and output().
Referenced by UpdateDoubleWidthSearch\searchIndexUpdateCallback(), and UpdateSearchIndex\searchIndexUpdateCallback().
|
protected |
Run some validation checks on the params, etc.
Definition at line 905 of file Maintenance.php.
References as, error(), hasArg(), hasOption(), and maybeHelp().
Referenced by setup().
|
private |
Definition at line 400 of file Maintenance.php.
|
private |
Accessible via getConfig()
Definition at line 125 of file Maintenance.php.
Referenced by getConfig(), and setConfig().
resource Maintenance::$fileHandle |
Used when creating separate schema files.
Definition at line 118 of file Maintenance.php.
|
private |
Definition at line 401 of file Maintenance.php.
|
private |
UNIX timestamp.
Definition at line 112 of file Maintenance.php.
|
protected |
Definition at line 71 of file Maintenance.php.
|
protected |
Definition at line 77 of file Maintenance.php.
Referenced by JSParseHelper\execute(), and CommandLineInc\execute().
|
protected |
Batch size.
If a script supports this, they should set a default with setBatchSize()
Definition at line 98 of file Maintenance.php.
Referenced by PopulateRecentChangesSource\doDBUpdates(), FixDefaultJsonContentPages\doDBUpdates(), PopulateFilearchiveSha1\doDBUpdates(), PopulateParentId\doDBUpdates(), PopulateLogUsertext\doDBUpdates(), PopulateLogSearch\doDBUpdates(), PopulateRevisionLength\doLenUpdates(), PopulateRevisionSha1\doSha1Updates(), RemoveInvalidEmails\execute(), FindMissingFiles\execute(), CheckImages\execute(), FixUserRegistration\execute(), MigrateUserGroup\execute(), CleanupBlocks\execute(), ConvertUserOptions\execute(), WrapOldPasswords\execute(), UploadStashCleanup\execute(), PurgeChangedPages\execute(), ResetUserTokens\execute(), RebuildFileCache\execute(), RefreshImageMetadata\execute(), PopulateContentModel\populatePage(), PopulateContentModel\populateRevisionOrArchive(), and PurgeList\purgeNamespace().
|
private |
Maintenance::$mDbPass |
Definition at line 84 of file Maintenance.php.
Referenced by finalSetup().
|
protected |
Definition at line 84 of file Maintenance.php.
Referenced by finalSetup().
|
private |
Definition at line 103 of file Maintenance.php.
Referenced by maybeHelp().
|
protected |
Definition at line 87 of file Maintenance.php.
|
private |
Definition at line 101 of file Maintenance.php.
|
protected |
Definition at line 90 of file Maintenance.php.
|
protected |
Definition at line 74 of file Maintenance.php.
Referenced by CommandLineInc\execute().
|
protected |
Definition at line 65 of file Maintenance.php.
Referenced by addDefaultParams().
|
protected |
Definition at line 83 of file Maintenance.php.
Referenced by isQuiet().
|
protected |
Definition at line 80 of file Maintenance.php.
Referenced by getName().
|
protected |
Definition at line 68 of file Maintenance.php.
array Maintenance::$orderedOptions = [] |
Used to read the options in the order they were passed.
Useful for option chaining (Ex. dumpBackup.php). It will be an empty array if the options are passed in through loadParamsAndArgs( $self, $opts, $args ).
This is an array of arrays where 0 => the option and 1 => parameter value.
Definition at line 144 of file Maintenance.php.
Referenced by BackupDumper\processOptions().
|
private |
Definition at line 131 of file Maintenance.php.
const Maintenance::DB_ADMIN = 2 |
Definition at line 59 of file Maintenance.php.
Referenced by AlterSharedConstraints\getDbType(), RebuildAll\getDbType(), RenameDbPrefix\getDbType(), PatchSql\getDbType(), UpdateDoubleWidthSearch\getDbType(), RebuildTextIndex\getDbType(), UpdateMediaWiki\getDbType(), BatchedQueryRunner\getDbType(), UpdateSearchIndex\getDbType(), ConvertLinks\getDbType(), PHPUnitMaintClass\getDbType(), and MwSql\getDbType().
const Maintenance::DB_NONE = 0 |
Constants for DB access type.
Definition at line 57 of file Maintenance.php.
Referenced by DumpIterator\finalSetup(), GenerateRandomImages\getDbType(), GenerateNormalizerDataMl\getDbType(), GenerateNormalizerDataAr\getDbType(), SqliteMaintenance\getDbType(), PreprocessDump\getDbType(), FindHooks\getDbType(), CheckSyntax\getDbType(), MWDocGen\getDbType(), and SearchDump\getDbType().
const Maintenance::DB_STD = 1 |
Definition at line 58 of file Maintenance.php.
Referenced by getDbType().
const Maintenance::STDIN_ALL = 'all' |
Definition at line 62 of file Maintenance.php.
Referenced by EditCLI\execute(), and getStdin().