MediaWiki REL1_27
|
Abstract maintenance class for quickly writing and churning out maintenance scripts with minimal effort. More...
Inherited by AllTrans, AlterSharedConstraints, AttachLatest, BackupDumper, BackupReader, BatchedQueryRunner, BenchmarkParse, Benchmarker, CLIParser, ChangePassword, CheckBadRedirects, CheckComposerLockUpToDate, CheckImages, CheckLess, CheckSyntax, CheckUsernames, CleanupAncientTables, CleanupBlocks, CleanupPreferences, CleanupRemovedModules, CleanupSpam, ClearInterwikiCache, 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, ImageBuilder, ImportSiteScripts, ImportSites, ImportTextFiles, InitEditCount, InitSiteStats, JSParseHelper, LangMemUsage, ListVariants, LoggedUpdateMaintenance, MWDocGen, MaintenanceFixup, MaintenanceFormatInstallDoc, MakeTestEdits, McTest, MergeMessageFileList, MigrateFileRepoLayout, MigrateUserGroup, MinifyScript, MoveBatch, MwSql, NamespaceConflictChecker, NukeNS, NukePage, OrphanStats, Orphans, PHPUnitMaintClass, PageExists, PatchSql, 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 | |
function | __construct () |
__construct () | |
Default constructor. | |
cleanupChanneled () | |
Clean up channeled output. | |
clearParamsAndArgs () | |
Clear all params and arguments. | |
function | execute () |
execute () | |
Do the actual work. | |
finalSetup () | |
Handle some last-minute setup here. | |
getConfig () | |
getDbType () | |
Does the script need different DB access? By default, we give Maintenance scripts normal rights to the DB. | |
getName () | |
Get the script's name. | |
globals () | |
Potentially debug globals. | |
isQuiet () | |
loadParamsAndArgs ( $self=null, $opts=null, $args=null) | |
Process command line arguments $mOptions becomes an array with keys set to the option names $mArgs becomes a zero-based array containing the non-option arguments. | |
loadSettings () | |
Generic setup for most installs. | |
loadWithArgv ( $argv) | |
Load params and arguments from a given array of command-line arguments. | |
memoryLimit () | |
Normally we disable the memory_limit when running admin scripts. | |
outputChanneled ( $msg, $channel=null) | |
Message outputter with channeled message support. | |
purgeRedundantText ( $delete=true) | |
Support function for cleaning up redundant text records. | |
runChild ( $maintClass, $classFile=null) | |
Run a child maintenance script. | |
setConfig (Config $config) | |
setDB (IDatabase $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. | |
array | $orderedOptions = [] |
Used to read the options in the order they were passed. | |
const | DB_ADMIN = 2 |
const | DB_NONE = 0 |
Constants for DB access type. | |
const | DB_STD = 1 |
const | STDIN_ALL = 'all' |
Protected Member Functions | |
activateProfiler () | |
Activate the profiler (assuming $wgProfiler is set) | |
addArg ( $arg, $description, $required=true) | |
Add some args that are needed. | |
addDefaultParams () | |
Add the default parameters to the scripts. | |
addDescription ( $text) | |
Set the description text. | |
addOption ( $name, $description, $required=false, $withArg=false, $shortName=false, $multiOccurrence=false) | |
Add a parameter to the script. | |
adjustMemoryLimit () | |
Adjusts PHP's memory limit to better suit our needs, if needed. | |
afterFinalSetup () | |
Execute a callback function at the end of initialisation. | |
beginTransaction (IDatabase $dbw, $fname) | |
Begin a transcation on a DB. | |
commitTransaction (IDatabase $dbw, $fname) | |
Commit the transcation on a DB handle and wait for slaves to catch up. | |
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=[], $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. | |
rollbackTransaction (IDatabase $dbw, $fname) | |
Rollback the transcation on a DB handle. | |
setBatchSize ( $s=0) | |
Set the batch size. | |
validateParamsAndArgs () | |
Run some validation checks on the params, etc. | |
Protected Attributes | |
$mArgList = [] | |
$mArgs = [] | |
int | $mBatchSize = null |
Batch size. | |
$mDbPass | |
$mDbUser | |
$mDescription = '' | |
$mInputLoaded = false | |
$mOptions = [] | |
$mParams = [] | |
$mQuiet = false | |
$mSelf | |
$mShortParamsMap = [] | |
Private Member Functions | |
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. | |
setParam (&$options, $option, $value) | |
Helper function used solely by loadParamsAndArgs to prevent code duplication. | |
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 | |
float | $lastSlaveWait = 0.0 |
UNIX timestamp. | |
IDatabase | $mDb = null |
Used by getDB() / setDB() | |
$mDependantParameters = [] | |
$mGenericParameters = [] | |
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
Reimplemented in AttachLatest, BenchmarkDeleteTruncate, BenchHttpHttps, BenchIfSwitch, BenchStrtrStrReplace, BenchUtf8TitleCheck, BenchWfIsWindows, BenchWikimediaBaseConvert, Benchmarker, BenchmarkHooks, BenchmarkParse, BenchmarkPurge, ChangePassword, CheckBadRedirects, CheckComposerLockUpToDate, CheckImages, CheckLess, CheckSyntax, CheckUsernames, CleanupAncientTables, CleanupBlocks, CapsCleanup, ImageCleanup, CleanupRemovedModules, CleanupSpam, TableCleanup, TitleCleanup, UploadStashCleanup, WatchlistCleanup, ClearInterwikiCache, CommandLineInc, CompareParserCache, CompareParsers, ConvertExtensionToRegistration, ConvertLinks, ConvertUserOptions, CopyFileBackend, CopyJobQueue, CreateAndPromote, GenerateCommonPassword, DeleteArchivedFiles, DeleteArchivedRevisions, DeleteBatch, DeleteDefaultMessages, DeleteEqualMessages, DeleteOldRevisions, DeleteOrphanedRevisions, DeleteRevision, DeleteSelfExternals, DumpIterator, SearchDump, DumpLinks, UploadDumper, EditCLI, EraseArchivedFile, ExportSites, FetchText, TestFileOpPerformance, FindDeprecated, FindHooks, FindMissingFiles, FindOrphanedFiles, FixDefaultJsonContentPages, FixDoubleRedirects, FixExtLinksProtocolRelative, FixTimestamps, FixUserRegistration, MaintenanceFormatInstallDoc, GenerateJsonI18n, GenerateSitemap, GetConfiguration, GetLagTimes, GetSlaveServer, GetTextMaint, BackupReader, ImportSites, ImportSiteScripts, ImportTextFiles, InitEditCount, InitSiteStats, CommandLineInstaller, JSParseHelper, DatabaseLag, AllTrans, DateFormats, Digit2Html, DumpMessages, GenerateCollationData, GenerateNormalizerDataAr, GenerateNormalizerDataMl, LangMemUsage, ListVariants, LoggedUpdateMaintenance, MakeTestEdits, McTest, MergeMessageFileList, MigrateFileRepoLayout, MigrateUserGroup, MinifyScript, MoveBatch, MWDocGen, NamespaceConflictChecker, NukeNS, NukePage, AlterSharedConstraints, Orphans, PageExists, CLIParser, PatchSql, PopulateBacklinkNamespace, PopulateCategory, PopulateContentModel, PopulateFilearchiveSha1, PopulateImageSha1, PopulateLogSearch, PopulateLogUsertext, PopulateParentId, PopulateRecentChangesSource, PopulateRevisionLength, PopulateRevisionSha1, PreprocessDump, Protect, PruneFileCache, PurgeChangedFiles, PurgeChangedPages, PurgeList, PurgeOldText, PurgeParserCache, ReassignEdits, RebuildAll, RebuildFileCache, ImageBuilder, RebuildLocalisationCache, RebuildMessages, RebuildRecentchanges, RebuildSitesCache, RebuildTextIndex, RefreshFileHeaders, RefreshImageMetadata, RefreshLinks, RemoveInvalidEmails, RemoveUnusedAccounts, RenameDbPrefix, DumpRenderer, ResetUserEmail, ResetUserTokens, RollbackEdits, BatchedQueryRunner, RunJobs, ShowJobs, ShowSiteStats, MwSql, SqliteMaintenance, CompressOld, DumpRev, FixBug20757, OrphanStats, SyncFileBackend, Undelete, UpdateMediaWiki, UpdateArticleCount, UpdateCollation, UpdateDoubleWidthSearch, UpdateRestrictions, UpdateSearchIndex, UpdateSpecialPages, ValidateRegistrationFile, WrapOldPasswords, PHPUnitMaintClass, and GenerateJqueryMsgData.
Definition at line 145 of file Maintenance.php.
References $IP, addDefaultParams(), and global.
|
inline |
Definition at line 41 of file maintenance.txt.
|
protected |
Activate the profiler (assuming $wgProfiler is set)
Definition at line 627 of file Maintenance.php.
References $output, $wgProfileLimit, $wgProfiler, $wgTrxProfilerLimits, 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 257 of file Maintenance.php.
Referenced by BenchmarkParse\__construct(), CleanupSpam\__construct(), ConvertExtensionToRegistration\__construct(), ConvertLinks\__construct(), CreateAndPromote\__construct(), GenerateCommonPassword\__construct(), DeleteBatch\__construct(), EditCLI\__construct(), ExportSites\__construct(), FixTimestamps\__construct(), MaintenanceFormatInstallDoc\__construct(), GenerateJsonI18n\__construct(), GetTextMaint\__construct(), BackupReader\__construct(), ImportSites\__construct(), ImportSiteScripts\__construct(), ImportTextFiles\__construct(), CommandLineInstaller\__construct(), JSParseHelper\__construct(), McTest\__construct(), MigrateUserGroup\__construct(), MoveBatch\__construct(), NukePage\__construct(), PageExists\__construct(), CLIParser\__construct(), PatchSql\__construct(), Protect\__construct(), ReassignEdits\__construct(), RefreshLinks\__construct(), ResetUserEmail\__construct(), DumpRev\__construct(), Undelete\__construct(), and ValidateRegistrationFile\__construct().
|
protected |
Add the default parameters to the scripts.
Definition at line 456 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 277 of file Maintenance.php.
Referenced by DumpBackup\__construct(), TextPassDumper\__construct(), AttachLatest\__construct(), BenchmarkDeleteTruncate\__construct(), BenchHttpHttps\__construct(), BenchIfSwitch\__construct(), BenchStrtrStrReplace\__construct(), BenchUtf8TitleCheck\__construct(), BenchWfIsWindows\__construct(), BenchWikimediaBaseConvert\__construct(), BenchmarkHooks\__construct(), BenchmarkParse\__construct(), BenchmarkPurge\__construct(), ChangePassword\__construct(), CheckBadRedirects\__construct(), CheckComposerLockUpToDate\__construct(), CheckImages\__construct(), CheckLess\__construct(), CheckSyntax\__construct(), CheckUsernames\__construct(), CleanupAncientTables\__construct(), CleanupBlocks\__construct(), CapsCleanup\__construct(), ImageCleanup\__construct(), CleanupRemovedModules\__construct(), CleanupSpam\__construct(), TitleCleanup\__construct(), UploadStashCleanup\__construct(), WatchlistCleanup\__construct(), ClearInterwikiCache\__construct(), CompareParserCache\__construct(), CompareParsers\__construct(), ConvertExtensionToRegistration\__construct(), ConvertLinks\__construct(), ConvertUserOptions\__construct(), CopyFileBackend\__construct(), CopyJobQueue\__construct(), CreateAndPromote\__construct(), GenerateCommonPassword\__construct(), DeleteArchivedFiles\__construct(), DeleteArchivedRevisions\__construct(), DeleteBatch\__construct(), DeleteDefaultMessages\__construct(), DeleteEqualMessages\__construct(), DeleteOldRevisions\__construct(), DeleteOrphanedRevisions\__construct(), DeleteRevision\__construct(), DeleteSelfExternals\__construct(), DumpIterator\__construct(), SearchDump\__construct(), DumpLinks\__construct(), UploadDumper\__construct(), EditCLI\__construct(), EraseArchivedFile\__construct(), ExportSites\__construct(), FetchText\__construct(), TestFileOpPerformance\__construct(), FindDeprecated\__construct(), FindHooks\__construct(), FindMissingFiles\__construct(), FindOrphanedFiles\__construct(), FixDefaultJsonContentPages\__construct(), FixDoubleRedirects\__construct(), FixExtLinksProtocolRelative\__construct(), FixTimestamps\__construct(), FixUserRegistration\__construct(), GenerateJsonI18n\__construct(), GenerateSitemap\__construct(), GetConfiguration\__construct(), GetLagTimes\__construct(), GetSlaveServer\__construct(), GetTextMaint\__construct(), BackupReader\__construct(), ImportSites\__construct(), ImportSiteScripts\__construct(), ImportTextFiles\__construct(), InitEditCount\__construct(), InitSiteStats\__construct(), CommandLineInstaller\__construct(), JSParseHelper\__construct(), DatabaseLag\__construct(), AllTrans\__construct(), DateFormats\__construct(), Digit2Html\__construct(), DumpMessages\__construct(), GenerateNormalizerDataAr\__construct(), GenerateNormalizerDataMl\__construct(), LangMemUsage\__construct(), ListVariants\__construct(), MakeTestEdits\__construct(), McTest\__construct(), MergeMessageFileList\__construct(), MigrateFileRepoLayout\__construct(), MigrateUserGroup\__construct(), MinifyScript\__construct(), MoveBatch\__construct(), MWDocGen\__construct(), NamespaceConflictChecker\__construct(), NukeNS\__construct(), NukePage\__construct(), AlterSharedConstraints\__construct(), Orphans\__construct(), PageExists\__construct(), CLIParser\__construct(), PatchSql\__construct(), PopulateBacklinkNamespace\__construct(), PopulateCategory\__construct(), PopulateContentModel\__construct(), PopulateFilearchiveSha1\__construct(), PopulateImageSha1\__construct(), PopulateLogSearch\__construct(), PopulateLogUsertext\__construct(), PopulateParentId\__construct(), PopulateRecentChangesSource\__construct(), PopulateRevisionLength\__construct(), PopulateRevisionSha1\__construct(), Protect\__construct(), PruneFileCache\__construct(), PurgeChangedFiles\__construct(), PurgeChangedPages\__construct(), PurgeList\__construct(), PurgeOldText\__construct(), PurgeParserCache\__construct(), ReassignEdits\__construct(), RebuildAll\__construct(), RebuildFileCache\__construct(), ImageBuilder\__construct(), RebuildLocalisationCache\__construct(), RebuildMessages\__construct(), RebuildRecentchanges\__construct(), RebuildSitesCache\__construct(), RebuildTextIndex\__construct(), RefreshFileHeaders\__construct(), RefreshImageMetadata\__construct(), RefreshLinks\__construct(), DumpRenderer\__construct(), ResetUserEmail\__construct(), ResetUserTokens\__construct(), RollbackEdits\__construct(), BatchedQueryRunner\__construct(), RunJobs\__construct(), ShowJobs\__construct(), ShowSiteStats\__construct(), MwSql\__construct(), SqliteMaintenance\__construct(), CompressOld\__construct(), FixBug20757\__construct(), OrphanStats\__construct(), SyncFileBackend\__construct(), Undelete\__construct(), UpdateMediaWiki\__construct(), UpdateArticleCount\__construct(), UpdateCollation\__construct(), UpdateDoubleWidthSearch\__construct(), UpdateRestrictions\__construct(), UpdateSearchIndex\__construct(), and WrapOldPasswords\__construct().
|
protected |
Add a parameter to the script.
Will be displayed on –help with the associated description
string | $name | The name of the param (help, version, etc) |
string | $description | The description of the param to show on –help |
bool | $required | Is the param required? |
bool | $withArg | Is an argument required with this option? |
string | $shortName | Character to use as short name |
bool | $multiOccurrence | Can this option be passed multiple times? |
Reimplemented in MaintenanceFixup.
Definition at line 205 of file Maintenance.php.
References $name.
Referenced by BackupDumper\__construct(), DumpBackup\__construct(), TextPassDumper\__construct(), AttachLatest\__construct(), BenchWikimediaBaseConvert\__construct(), Benchmarker\__construct(), BenchmarkParse\__construct(), ChangePassword\__construct(), CheckSyntax\__construct(), CleanupAncientTables\__construct(), CapsCleanup\__construct(), CleanupRemovedModules\__construct(), CleanupSpam\__construct(), TableCleanup\__construct(), WatchlistCleanup\__construct(), CommandLineInc\__construct(), CompareParserCache\__construct(), CompareParsers\__construct(), ConvertExtensionToRegistration\__construct(), CopyFileBackend\__construct(), CopyJobQueue\__construct(), CreateAndPromote\__construct(), GenerateCommonPassword\__construct(), DeleteArchivedFiles\__construct(), DeleteArchivedRevisions\__construct(), DeleteBatch\__construct(), DeleteEqualMessages\__construct(), DeleteOldRevisions\__construct(), DeleteOrphanedRevisions\__construct(), DumpIterator\__construct(), SearchDump\__construct(), UploadDumper\__construct(), EditCLI\__construct(), EraseArchivedFile\__construct(), TestFileOpPerformance\__construct(), FindHooks\__construct(), FindMissingFiles\__construct(), FindOrphanedFiles\__construct(), FixDoubleRedirects\__construct(), MaintenanceFormatInstallDoc\__construct(), GenerateJsonI18n\__construct(), GenerateSitemap\__construct(), GetConfiguration\__construct(), GetSlaveServer\__construct(), GetTextMaint\__construct(), BackupReader\__construct(), ImportSiteScripts\__construct(), ImportTextFiles\__construct(), InitEditCount\__construct(), InitSiteStats\__construct(), CommandLineInstaller\__construct(), DatabaseLag\__construct(), GenerateCollationData\__construct(), GenerateNormalizerDataAr\__construct(), ListVariants\__construct(), LoggedUpdateMaintenance\__construct(), MakeTestEdits\__construct(), McTest\__construct(), MergeMessageFileList\__construct(), MigrateFileRepoLayout\__construct(), MinifyScript\__construct(), MoveBatch\__construct(), MWDocGen\__construct(), NamespaceConflictChecker\__construct(), NukeNS\__construct(), NukePage\__construct(), Orphans\__construct(), CLIParser\__construct(), PopulateBacklinkNamespace\__construct(), PopulateContentModel\__construct(), PopulateImageSha1\__construct(), PreprocessDump\__construct(), Protect\__construct(), PruneFileCache\__construct(), PurgeChangedFiles\__construct(), PurgeChangedPages\__construct(), PurgeList\__construct(), PurgeOldText\__construct(), PurgeParserCache\__construct(), ReassignEdits\__construct(), RebuildFileCache\__construct(), ImageBuilder\__construct(), RebuildLocalisationCache\__construct(), RebuildRecentchanges\__construct(), RebuildSitesCache\__construct(), RefreshFileHeaders\__construct(), RefreshImageMetadata\__construct(), RefreshLinks\__construct(), RemoveInvalidEmails\__construct(), RemoveUnusedAccounts\__construct(), RenameDbPrefix\__construct(), DumpRenderer\__construct(), ResetUserEmail\__construct(), ResetUserTokens\__construct(), RollbackEdits\__construct(), RunJobs\__construct(), ShowJobs\__construct(), MwSql\__construct(), SqliteMaintenance\__construct(), CompressOld\__construct(), FixBug20757\__construct(), SyncFileBackend\__construct(), Undelete\__construct(), UpdateMediaWiki\__construct(), UpdateArticleCount\__construct(), UpdateCollation\__construct(), UpdateDoubleWidthSearch\__construct(), UpdateSearchIndex\__construct(), UpdateSpecialPages\__construct(), WrapOldPasswords\__construct(), PHPUnitMaintClass\__construct(), addDefaultParams(), and setBatchSize().
|
protected |
Adjusts PHP's memory limit to better suit our needs, if needed.
Definition at line 614 of file Maintenance.php.
References $limit, and memoryLimit().
Referenced by finalSetup(), and setup().
|
protected |
Execute a callback function at the end of initialisation.
Reimplemented in UpdateMediaWiki.
Definition at line 1033 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 1181 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(), DeleteArchivedFiles\execute(), DeleteOrphanedRevisions\execute(), MigrateUserGroup\execute(), MoveBatch\execute(), NukeNS\execute(), NukePage\execute(), RebuildFileCache\execute(), FixBug20757\execute(), UpdateCollation\execute(), WrapOldPasswords\execute(), RemoveUnusedAccounts\isInactiveAccount(), NamespaceConflictChecker\mergePage(), ImageCleanup\pokeFile(), and purgeRedundantText().
Maintenance::cleanupChanneled | ( | ) |
Clean up channeled output.
Output a newline if necessary.
Definition at line 401 of file Maintenance.php.
References print.
Referenced by output(), and outputChanneled().
Maintenance::clearParamsAndArgs | ( | ) |
Clear all params and arguments.
Definition at line 654 of file Maintenance.php.
|
protected |
Commit the transcation on a DB handle and wait for slaves 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 1196 of file Maintenance.php.
References $fname, IDatabase\commit(), and wfWaitForSlaves().
Referenced by CleanupSpam\cleanupArticle(), CompressOld\compressWithConcat(), NukePage\deleteRevisions(), PopulateLogUsertext\doDBUpdates(), DeleteOldRevisions\doDelete(), PopulateRevisionLength\doLenUpdates(), ReassignEdits\doReassignEdits(), PopulateRevisionSha1\doSha1LegacyUpdates(), PopulateRevisionSha1\doSha1Updates(), CleanupPreferences\execute(), DeleteArchivedFiles\execute(), DeleteOrphanedRevisions\execute(), DeleteSelfExternals\execute(), MigrateUserGroup\execute(), MoveBatch\execute(), NukeNS\execute(), NukePage\execute(), RebuildFileCache\execute(), FixBug20757\execute(), UpdateCollation\execute(), WrapOldPasswords\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 269 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 382 of file Maintenance.php.
References outputChanneled(), and print.
Referenced by SqliteMaintenance\backup(), CheckSyntax\buildFileList(), ImageCleanup\buildSafeTitle(), FindOrphanedFiles\checkFiles(), CompareParsers\checkOptions(), SqliteMaintenance\checkSyntax(), CleanupSpam\cleanupArticle(), UpdateMediaWiki\compatChecks(), CompressOld\compressPage(), CompressOld\compressWithConcat(), CompareParsers\conclusions(), CopyFileBackend\copyFileBatch(), CopyFileBackend\delFileBatch(), FixExtLinksProtocolRelative\doDBUpdates(), PopulateImageSha1\doDBUpdates(), PopulateLogSearch\doDBUpdates(), PopulateParentId\doDBUpdates(), PopulateRecentChangesSource\doDBUpdates(), PopulateRevisionLength\doDBUpdates(), PopulateRevisionSha1\doDBUpdates(), UploadStashCleanup\doOperations(), UpdateSpecialPages\doSpecialPageCacheUpdates(), BenchmarkParse\execute(), BenchmarkPurge\execute(), ChangePassword\execute(), CheckComposerLockUpToDate\execute(), CleanupAncientTables\execute(), CapsCleanup\execute(), CleanupSpam\execute(), UploadStashCleanup\execute(), ConvertExtensionToRegistration\execute(), ConvertLinks\execute(), CopyFileBackend\execute(), CopyJobQueue\execute(), CreateAndPromote\execute(), GenerateCommonPassword\execute(), DeleteBatch\execute(), DeleteDefaultMessages\execute(), DeleteEqualMessages\execute(), DeleteRevision\execute(), DumpBackup\execute(), DumpIterator\execute(), EditCLI\execute(), EraseArchivedFile\execute(), ExportSites\execute(), FindHooks\execute(), FindOrphanedFiles\execute(), FixDoubleRedirects\execute(), FixTimestamps\execute(), MaintenanceFormatInstallDoc\execute(), GenerateJsonI18n\execute(), GenerateSitemap\execute(), GetLagTimes\execute(), GetTextMaint\execute(), BackupReader\execute(), ImportSiteScripts\execute(), ImportTextFiles\execute(), CommandLineInstaller\execute(), Digit2Html\execute(), GenerateCollationData\execute(), GenerateNormalizerDataAr\execute(), LangMemUsage\execute(), MakeTestEdits\execute(), McTest\execute(), MergeMessageFileList\execute(), MigrateFileRepoLayout\execute(), MigrateUserGroup\execute(), MinifyScript\execute(), MoveBatch\execute(), MWDocGen\execute(), PageExists\execute(), PatchSql\execute(), PopulateContentModel\execute(), Protect\execute(), PruneFileCache\execute(), PurgeChangedFiles\execute(), PurgeChangedPages\execute(), PurgeParserCache\execute(), ReassignEdits\execute(), RebuildFileCache\execute(), RebuildLocalisationCache\execute(), RebuildRecentchanges\execute(), RebuildTextIndex\execute(), RefreshImageMetadata\execute(), RemoveUnusedAccounts\execute(), RenameDbPrefix\execute(), DumpRenderer\execute(), ResetUserEmail\execute(), RollbackEdits\execute(), BatchedQueryRunner\execute(), RunJobs\execute(), MwSql\execute(), SqliteMaintenance\execute(), CompressOld\execute(), DumpRev\execute(), OrphanStats\execute(), SyncFileBackend\execute(), Undelete\execute(), UpdateMediaWiki\execute(), UpdateDoubleWidthSearch\execute(), UpdateRestrictions\execute(), UpdateSearchIndex\execute(), UpdateSpecialPages\execute(), ValidateRegistrationFile\execute(), WrapOldPasswords\execute(), BackupDumper\fatalError(), GenerateCollationData\generateFirstChars(), RebuildSitesCache\getCacheFile(), MinifyScript\getExtension(), CheckSyntax\getGitModifiedFiles(), CopyFileBackend\getListingDiffRel(), BackupReader\getNsIndex(), ConvertExtensionToRegistration\handleExtensionFunctions(), ConvertExtensionToRegistration\handleHooks(), DumpIterator\handleRevision(), DumpRenderer\handleRevision(), BackupReader\importFromHandle(), ReassignEdits\initialiseUser(), SqliteMaintenance\integrityCheck(), loadSettings(), loadWithArgv(), MinifyScript\minify(), TitleCleanup\moveInconsistentPage(), ImageCleanup\pokeFile(), PopulateContentModel\populateRevisionOrArchive(), CompareParsers\processRevision(), PreprocessDump\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().
|
inline |
Definition at line 45 of file maintenance.txt.
|
abstract |
Do the actual work.
All child classes will need to implement this
Reimplemented in AttachLatest, BackupDumper, BenchmarkDeleteTruncate, BenchHttpHttps, BenchIfSwitch, BenchStrtrStrReplace, BenchUtf8TitleCheck, BenchWfIsWindows, BenchWikimediaBaseConvert, BenchmarkHooks, BenchmarkParse, BenchmarkPurge, ChangePassword, CheckBadRedirects, CheckComposerLockUpToDate, CheckImages, CheckLess, CheckSyntax, CheckUsernames, CleanupAncientTables, CleanupBlocks, CapsCleanup, CleanupPreferences, CleanupRemovedModules, CleanupSpam, TableCleanup, UploadStashCleanup, WatchlistCleanup, ClearInterwikiCache, CommandLineInc, CompareParserCache, ConvertExtensionToRegistration, ConvertLinks, ConvertUserOptions, CopyFileBackend, CopyJobQueue, CreateAndPromote, GenerateCommonPassword, DeleteArchivedFiles, DeleteArchivedRevisions, DeleteBatch, DeleteDefaultMessages, DeleteEqualMessages, DeleteOldRevisions, DeleteOrphanedRevisions, DeleteRevision, DeleteSelfExternals, DumpBackup, DumpIterator, DumpLinks, TextPassDumper, UploadDumper, EditCLI, EraseArchivedFile, ExportSites, FetchText, TestFileOpPerformance, FindDeprecated, FindHooks, FindMissingFiles, FindOrphanedFiles, FixDoubleRedirects, FixTimestamps, FixUserRegistration, MaintenanceFormatInstallDoc, GenerateJsonI18n, GenerateSitemap, GetConfiguration, GetLagTimes, GetSlaveServer, GetTextMaint, BackupReader, ImportSites, ImportSiteScripts, ImportTextFiles, InitEditCount, InitSiteStats, CommandLineInstaller, JSParseHelper, DatabaseLag, AllTrans, DateFormats, Digit2Html, DumpMessages, GenerateCollationData, GenerateNormalizerDataAr, GenerateNormalizerDataMl, LangMemUsage, ListVariants, FakeMaintenance, LoggedUpdateMaintenance, MakeTestEdits, McTest, MergeMessageFileList, MigrateFileRepoLayout, MigrateUserGroup, MinifyScript, MoveBatch, MWDocGen, NamespaceConflictChecker, NukeNS, NukePage, AlterSharedConstraints, Orphans, PageExists, CLIParser, PatchSql, PopulateCategory, PopulateContentModel, PopulateImageSha1, Protect, PruneFileCache, PurgeChangedFiles, PurgeChangedPages, PurgeList, PurgeOldText, PurgeParserCache, ReassignEdits, RebuildAll, RebuildFileCache, ImageBuilder, RebuildLocalisationCache, RebuildMessages, RebuildRecentchanges, RebuildSitesCache, RebuildTextIndex, RefreshFileHeaders, RefreshImageMetadata, RefreshLinks, RemoveInvalidEmails, RemoveUnusedAccounts, RenameDbPrefix, DumpRenderer, ResetUserEmail, ResetUserTokens, RollbackEdits, BatchedQueryRunner, RunJobs, ShowJobs, ShowSiteStats, MwSql, SqliteMaintenance, CompressOld, DumpRev, FixBug20757, OrphanStats, StorageTypeStats, SyncFileBackend, TidyUpBug37714, Undelete, UpdateMediaWiki, UpdateArticleCount, UpdateCollation, UpdateDoubleWidthSearch, UpdateRestrictions, UpdateSearchIndex, UpdateSpecialPages, ValidateRegistrationFile, WrapOldPasswords, GenerateRandomImages, MaintenanceFixup, PHPUnitMaintClass, and GenerateJqueryMsgData.
Maintenance::finalSetup | ( | ) |
Handle some last-minute setup here.
Reimplemented in DumpIterator, GetConfiguration, RebuildFileCache, RebuildLocalisationCache, and PHPUnitMaintClass.
Definition at line 971 of file Maintenance.php.
References $i, $mDbPass, $mDbUser, $wgCommandLineMode, $wgDBadminpassword, $wgDBadminuser, $wgDBpassword, $wgDBservers, $wgDBuser, $wgLBFactoryConf, $wgServer, $wgShowSQLErrors, activateProfiler(), adjustMemoryLimit(), afterFinalSetup(), as, LBFactory\destroyInstance(), 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 296 of file Maintenance.php.
References hasArg().
Referenced by BenchmarkParse\execute(), CleanupSpam\execute(), ConvertExtensionToRegistration\execute(), ConvertLinks\execute(), CreateAndPromote\execute(), GenerateCommonPassword\execute(), DeleteBatch\execute(), EditCLI\execute(), ExportSites\execute(), FixTimestamps\execute(), MaintenanceFormatInstallDoc\execute(), GenerateJsonI18n\execute(), GetTextMaint\execute(), BackupReader\execute(), ImportSites\execute(), ImportSiteScripts\execute(), ImportTextFiles\execute(), CommandLineInstaller\execute(), McTest\execute(), MigrateUserGroup\execute(), MinifyScript\execute(), MoveBatch\execute(), NukePage\execute(), PageExists\execute(), Protect\execute(), ReassignEdits\execute(), RefreshLinks\execute(), ResetUserEmail\execute(), BatchedQueryRunner\execute(), MwSql\execute(), DumpRev\execute(), Undelete\execute(), ValidateRegistrationFile\execute(), ImportSiteScripts\fetchScriptList(), and CLIParser\Wikitext().
Maintenance::getConfig | ( | ) |
Definition at line 495 of file Maintenance.php.
References $config.
Referenced by FixDefaultJsonContentPages\doDBUpdates(), DumpIterator\execute(), DumpRenderer\execute(), Undelete\execute(), WrapOldPasswords\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_SLAVE/DB_MASTER) |
array | $groups,; | default: empty array |
string | bool | $wiki,; | default: current wiki |
Reimplemented in OrphanStats.
Definition at line 1154 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(), FixDefaultJsonContentPages\doDBUpdates(), FixExtLinksProtocolRelative\doDBUpdates(), PopulateBacklinkNamespace\doDBUpdates(), PopulateFilearchiveSha1\doDBUpdates(), PopulateImageSha1\doDBUpdates(), PopulateLogSearch\doDBUpdates(), PopulateLogUsertext\doDBUpdates(), PopulateParentId\doDBUpdates(), PopulateRecentChangesSource\doDBUpdates(), PopulateRevisionLength\doDBUpdates(), PopulateRevisionSha1\doDBUpdates(), DeleteOldRevisions\doDelete(), PopulateRevisionLength\doLenUpdates(), ReassignEdits\doReassignEdits(), RefreshLinks\doRefreshLinks(), PopulateRevisionSha1\doSha1LegacyUpdates(), PopulateRevisionSha1\doSha1Updates(), UpdateSearchIndex\doUpdateSearchIndex(), AttachLatest\execute(), BenchmarkDeleteTruncate\execute(), CheckBadRedirects\execute(), CheckImages\execute(), CheckUsernames\execute(), CleanupAncientTables\execute(), CleanupBlocks\execute(), CleanupPreferences\execute(), CleanupRemovedModules\execute(), CleanupSpam\execute(), ClearInterwikiCache\execute(), CompareParserCache\execute(), ConvertLinks\execute(), ConvertUserOptions\execute(), DeleteArchivedFiles\execute(), DeleteArchivedRevisions\execute(), DeleteBatch\execute(), DeleteDefaultMessages\execute(), DeleteEqualMessages\execute(), DeleteOrphanedRevisions\execute(), DeleteRevision\execute(), DeleteSelfExternals\execute(), DumpLinks\execute(), EraseArchivedFile\execute(), FetchText\execute(), FixDoubleRedirects\execute(), FixTimestamps\execute(), FixUserRegistration\execute(), GenerateSitemap\execute(), GetSlaveServer\execute(), InitEditCount\execute(), InitSiteStats\execute(), LoggedUpdateMaintenance\execute(), MigrateUserGroup\execute(), MoveBatch\execute(), NamespaceConflictChecker\execute(), NukeNS\execute(), NukePage\execute(), AlterSharedConstraints\execute(), PatchSql\execute(), PopulateCategory\execute(), PopulateContentModel\execute(), PurgeChangedFiles\execute(), PurgeChangedPages\execute(), RebuildAll\execute(), RebuildFileCache\execute(), ImageBuilder\execute(), RebuildTextIndex\execute(), RefreshFileHeaders\execute(), RefreshImageMetadata\execute(), RemoveInvalidEmails\execute(), RemoveUnusedAccounts\execute(), RenameDbPrefix\execute(), ResetUserTokens\execute(), BatchedQueryRunner\execute(), ShowSiteStats\execute(), SqliteMaintenance\execute(), DumpRev\execute(), FixBug20757\execute(), StorageTypeStats\execute(), TidyUpBug37714\execute(), UpdateMediaWiki\execute(), UpdateArticleCount\execute(), UpdateCollation\execute(), UpdateDoubleWidthSearch\execute(), UpdateRestrictions\execute(), UpdateSpecialPages\execute(), WrapOldPasswords\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
Reimplemented in CheckSyntax, ConvertLinks, SearchDump, FindHooks, GenerateNormalizerDataAr, GenerateNormalizerDataMl, MWDocGen, AlterSharedConstraints, PatchSql, PreprocessDump, RebuildAll, RebuildTextIndex, RenameDbPrefix, BatchedQueryRunner, MwSql, SqliteMaintenance, UpdateMediaWiki, UpdateDoubleWidthSearch, UpdateSearchIndex, GenerateRandomImages, and PHPUnitMaintClass.
Definition at line 449 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 326 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 |
Reimplemented in MaintenanceFixup.
Definition at line 240 of file Maintenance.php.
References $name, and hasOption().
Referenced by activateProfiler(), Benchmarker\bench(), CheckSyntax\buildFileList(), CompareParsers\checkOptions(), PreprocessDump\checkOptions(), SqliteMaintenance\checkSyntax(), PopulateBacklinkNamespace\doDBUpdates(), PopulateImageSha1\doDBUpdates(), TestFileOpPerformance\doPerfTest(), PurgeList\doPurge(), UpdateSpecialPages\doSpecialPageCacheUpdates(), BenchWikimediaBaseConvert\execute(), BenchmarkParse\execute(), BenchmarkPurge\execute(), ChangePassword\execute(), CapsCleanup\execute(), CleanupRemovedModules\execute(), CompareParserCache\execute(), CopyFileBackend\execute(), CopyJobQueue\execute(), CreateAndPromote\execute(), GenerateCommonPassword\execute(), DeleteBatch\execute(), DeleteEqualMessages\execute(), DumpIterator\execute(), UploadDumper\execute(), EditCLI\execute(), EraseArchivedFile\execute(), TestFileOpPerformance\execute(), FindMissingFiles\execute(), FindOrphanedFiles\execute(), FixDoubleRedirects\execute(), MaintenanceFormatInstallDoc\execute(), GenerateJsonI18n\execute(), GenerateSitemap\execute(), GetConfiguration\execute(), GetSlaveServer\execute(), BackupReader\execute(), ImportSiteScripts\execute(), ImportTextFiles\execute(), CommandLineInstaller\execute(), GenerateCollationData\execute(), GenerateNormalizerDataAr\execute(), MakeTestEdits\execute(), McTest\execute(), MergeMessageFileList\execute(), MigrateFileRepoLayout\execute(), MinifyScript\execute(), MoveBatch\execute(), NamespaceConflictChecker\execute(), NukeNS\execute(), NukePage\execute(), PopulateCategory\execute(), PopulateContentModel\execute(), PopulateImageSha1\execute(), Protect\execute(), PruneFileCache\execute(), PurgeChangedFiles\execute(), PurgeChangedPages\execute(), PurgeList\execute(), PurgeParserCache\execute(), RebuildFileCache\execute(), RebuildLocalisationCache\execute(), RefreshFileHeaders\execute(), RefreshImageMetadata\execute(), RefreshLinks\execute(), RemoveUnusedAccounts\execute(), RenameDbPrefix\execute(), DumpRenderer\execute(), ResetUserTokens\execute(), RollbackEdits\execute(), RunJobs\execute(), ShowJobs\execute(), MwSql\execute(), SqliteMaintenance\execute(), CompressOld\execute(), FixBug20757\execute(), SyncFileBackend\execute(), Undelete\execute(), UpdateMediaWiki\execute(), UpdateCollation\execute(), UpdateDoubleWidthSearch\execute(), UpdateSearchIndex\execute(), UpdateSpecialPages\execute(), WrapOldPasswords\execute(), PHPUnitMaintClass\execute(), GetConfiguration\finalSetup(), finalSetup(), RebuildSitesCache\getCacheFile(), RefreshImageMetadata\getConditions(), CLIParser\getTitle(), BackupReader\importFromHandle(), MWDocGen\init(), loadSpecialVars(), memoryLimit(), BackupDumper\processOptions(), DumpBackup\processOptions(), TextPassDumper\processOptions(), CompareParsers\processRevision(), SearchDump\processRevision(), PurgeChangedFiles\purgeFromLogType(), RebuildRecentchanges\rebuildRecentChangesTablePass1(), PurgeList\sendPurgeRequest(), 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 |
Reimplemented in SemiMockedFetchText.
Definition at line 336 of file Maintenance.php.
References STDIN_ALL.
Referenced by PurgeList\doPurge(), DeleteBatch\execute(), DumpIterator\execute(), EditCLI\execute(), FetchText\execute(), MoveBatch\execute(), and DumpRenderer\execute().
Maintenance::globals | ( | ) |
Potentially debug globals.
Originally a feature only for refreshLinks
Definition at line 1043 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 286 of file Maintenance.php.
Referenced by DeleteBatch\execute(), MaintenanceFormatInstallDoc\execute(), BackupReader\execute(), JSParseHelper\execute(), McTest\execute(), MoveBatch\execute(), ReassignEdits\execute(), BatchedQueryRunner\execute(), MwSql\execute(), getArg(), and validateParamsAndArgs().
|
protected |
Checks to see if a particular param exists.
string | $name | The name of the param |
Definition at line 226 of file Maintenance.php.
References $name.
Referenced by CheckSyntax\buildFileList(), CompareParsers\checkOptions(), PreprocessDump\checkOptions(), CleanupSpam\cleanupArticle(), CopyFileBackend\copyFileBatch(), ConvertLinks\createTempTable(), PopulateImageSha1\doDBUpdates(), TestFileOpPerformance\doPerfTest(), UpdateSpecialPages\doSpecialPageCacheUpdates(), AttachLatest\execute(), BenchmarkParse\execute(), BenchmarkPurge\execute(), ChangePassword\execute(), CheckSyntax\execute(), CleanupAncientTables\execute(), CapsCleanup\execute(), CleanupSpam\execute(), TableCleanup\execute(), WatchlistCleanup\execute(), ConvertExtensionToRegistration\execute(), ConvertLinks\execute(), CopyFileBackend\execute(), CreateAndPromote\execute(), DeleteArchivedFiles\execute(), DeleteArchivedRevisions\execute(), DeleteEqualMessages\execute(), DeleteOldRevisions\execute(), DeleteOrphanedRevisions\execute(), DumpBackup\execute(), DumpIterator\execute(), UploadDumper\execute(), EditCLI\execute(), EraseArchivedFile\execute(), FindOrphanedFiles\execute(), FixDoubleRedirects\execute(), MaintenanceFormatInstallDoc\execute(), GenerateJsonI18n\execute(), GetSlaveServer\execute(), GetTextMaint\execute(), BackupReader\execute(), ImportTextFiles\execute(), InitEditCount\execute(), InitSiteStats\execute(), CommandLineInstaller\execute(), DatabaseLag\execute(), GenerateNormalizerDataAr\execute(), ListVariants\execute(), LoggedUpdateMaintenance\execute(), MergeMessageFileList\execute(), MinifyScript\execute(), NamespaceConflictChecker\execute(), Orphans\execute(), PopulateImageSha1\execute(), Protect\execute(), PurgeChangedFiles\execute(), PurgeChangedPages\execute(), PurgeList\execute(), PurgeOldText\execute(), ReassignEdits\execute(), ImageBuilder\execute(), RebuildLocalisationCache\execute(), RebuildRecentchanges\execute(), RefreshFileHeaders\execute(), RefreshImageMetadata\execute(), RefreshLinks\execute(), RemoveInvalidEmails\execute(), RemoveUnusedAccounts\execute(), DumpRenderer\execute(), ResetUserEmail\execute(), RollbackEdits\execute(), RunJobs\execute(), ShowJobs\execute(), MwSql\execute(), SqliteMaintenance\execute(), SyncFileBackend\execute(), UpdateMediaWiki\execute(), UpdateArticleCount\execute(), UpdateCollation\execute(), UpdateSearchIndex\execute(), UpdateSpecialPages\execute(), WrapOldPasswords\execute(), PHPUnitMaintClass\execute(), CopyFileBackend\filesAreSame(), GetConfiguration\finalSetup(), finalSetup(), UpdateCollation\getBatchCondition(), RebuildSitesCache\getCacheFile(), FindHooks\getHooksFromDoc(), getOption(), globals(), ConvertExtensionToRegistration\handleResourceModules(), BackupReader\importFromHandle(), MWDocGen\init(), loadSpecialVars(), maybeHelp(), RunJobs\memoryLimit(), BackupDumper\processOptions(), DumpBackup\processOptions(), TextPassDumper\processOptions(), PurgeChangedFiles\purgeFromLogType(), RebuildRecentchanges\rebuildRecentChangesTablePass1(), WatchlistCleanup\removeWatch(), EraseArchivedFile\scrubVersion(), PurgeList\sendPurgeRequest(), CommandLineInstaller\validateParamsAndArgs(), validateParamsAndArgs(), and PurgeChangedFiles\verbose().
Maintenance::isQuiet | ( | ) |
Definition at line 353 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 780 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 1053 of file Maintenance.php.
References $IP, $wgCommandLineMode, error(), and global.
|
protected |
Handle the special variables that are global to all scripts.
Definition at line 837 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 667 of file Maintenance.php.
References $args, $options, error(), loadSpecialVars(), maybeHelp(), and setParam().
Referenced by BackupDumper\__construct(), DumpBackup\__construct(), TextPassDumper\__construct(), and loadParamsAndArgs().
|
private |
Lock the search index.
DatabaseBase | &$db |
Definition at line 1223 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 |
Reimplemented in CommandLineInc.
Definition at line 856 of file Maintenance.php.
References $mDependantParameters, $mGenericParameters, $mParams, $output, as, hasOption(), and output().
Referenced by CreateAndPromote\execute(), GenerateJsonI18n\execute(), JSParseHelper\execute(), PurgeChangedFiles\execute(), PurgeChangedPages\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)
Reimplemented in RunJobs.
Definition at line 605 of file Maintenance.php.
References $limit, and getOption().
Referenced by adjustMemoryLimit().
|
protected |
Throw some output to the user.
Scripts can call this with no fears, as we handle all –quiet stuff here
string | $out | The text to show to the user |
mixed | $channel | Unique identifier for the channel. See function outputChanneled. |
Reimplemented in MaintenanceFixup.
Definition at line 363 of file Maintenance.php.
References $out, cleanupChanneled(), outputChanneled(), and print.
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 ===. |
Reimplemented in MaintenanceFixup.
Definition at line 416 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 1324 of file Maintenance.php.
References posix_isatty().
Referenced by ParserTest\__construct(), FindDeprecated\execute(), MwSql\execute(), posix_isatty(), and readconsole().
Maintenance::purgeRedundantText | ( | $delete = true | ) |
Support function for cleaning up redundant text records.
bool | $delete | Whether or not to actually delete the records |
Definition at line 1087 of file Maintenance.php.
References $count, $res, as, beginTransaction(), commitTransaction(), DB_MASTER, getDB(), and output().
Referenced by DeleteOldRevisions\doDelete(), DeleteArchivedRevisions\execute(), DeleteOrphanedRevisions\execute(), NukeNS\execute(), NukePage\execute(), and PurgeOldText\execute().
|
static |
Prompt the console for input.
string | $prompt | What to begin the line with, like '> ' |
Definition at line 1337 of file Maintenance.php.
References posix_isatty(), and readlineEmulation().
Referenced by MwSql\execute().
|
staticprivate |
Emulate readline()
string | $prompt | What to begin the line with, like '> ' |
Definition at line 1375 of file Maintenance.php.
References $command, $line, $retval, Installer\locateExecutableInDefaultPaths(), print, wfEscapeShellArg(), wfIsWindows(), and wfShellExec().
Referenced by readconsole().
|
private |
Unlock and lock again Since the lock is low-priority, queued reads will be able to complete.
DatabaseBase | &$db |
Definition at line 1250 of file Maintenance.php.
References lockSearchindex(), and unlockSearchindex().
Referenced by updateSearchIndex().
|
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 1215 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 518 of file Maintenance.php.
References $maintClass, and error().
Referenced by NukeNS\execute(), RebuildAll\execute(), and UpdateMediaWiki\execute().
|
protected |
Set the batch size.
int | $s | The number of operations to do in a batch |
Definition at line 304 of file Maintenance.php.
References $s, and addOption().
Referenced by CheckImages\__construct(), CheckUsernames\__construct(), CleanupBlocks\__construct(), UploadStashCleanup\__construct(), ConvertUserOptions\__construct(), CopyFileBackend\__construct(), CopyJobQueue\__construct(), FindMissingFiles\__construct(), FindOrphanedFiles\__construct(), FixDefaultJsonContentPages\__construct(), FixUserRegistration\__construct(), LoggedUpdateMaintenance\__construct(), MakeTestEdits\__construct(), MigrateFileRepoLayout\__construct(), MigrateUserGroup\__construct(), PopulateContentModel\__construct(), PopulateLogSearch\__construct(), PopulateLogUsertext\__construct(), PopulateRecentChangesSource\__construct(), PopulateRevisionLength\__construct(), PopulateRevisionSha1\__construct(), PurgeChangedFiles\__construct(), PurgeChangedPages\__construct(), PurgeList\__construct(), RebuildFileCache\__construct(), RebuildRecentchanges\__construct(), RefreshFileHeaders\__construct(), RefreshImageMetadata\__construct(), RefreshLinks\__construct(), RemoveInvalidEmails\__construct(), ResetUserTokens\__construct(), SyncFileBackend\__construct(), UpdateRestrictions\__construct(), and WrapOldPasswords\__construct().
Maintenance::setConfig | ( | Config | $config | ) |
Config | $config |
Definition at line 507 of file Maintenance.php.
References $config.
Maintenance::setDB | ( | IDatabase | $db | ) |
Sets database object to be returned by getDB().
Reimplemented in BackupDumper.
Definition at line 1167 of file Maintenance.php.
Referenced by DatabaseUpdater\__construct().
|
private |
Helper function used solely by loadParamsAndArgs to prevent code duplication.
This sets the param in the options array based on whether or not it can be specified multiple times.
array | $options | |
string | $option | |
mixed | $value |
Definition at line 750 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 544 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 163 of file Maintenance.php.
References $count, $i, $wgCommandLineMode, and global.
|
private |
Unlock the tables.
DatabaseBase | &$db |
Definition at line 1241 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. |
DatabaseBase | $dbw | |
array | $results |
Definition at line 1262 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.
DatabaseBase | $dbw | A database write handle |
int | $pageId | The page ID to update. |
Definition at line 1299 of file Maintenance.php.
References $rev, $title, Revision\loadFromPageId(), and output().
Referenced by UpdateDoubleWidthSearch\searchIndexUpdateCallback(), and UpdateSearchIndex\searchIndexUpdateCallback().
|
protected |
Run some validation checks on the params, etc.
Reimplemented in GetConfiguration, and CommandLineInstaller.
Definition at line 812 of file Maintenance.php.
References as, error(), hasArg(), hasOption(), and maybeHelp().
Referenced by setup().
|
private |
Definition at line 395 of file Maintenance.php.
|
private |
Accessible via getConfig()
Definition at line 126 of file Maintenance.php.
Referenced by getConfig(), and setConfig().
resource Maintenance::$fileHandle |
Used when creating separate schema files.
Definition at line 119 of file Maintenance.php.
|
private |
Definition at line 396 of file Maintenance.php.
|
private |
UNIX timestamp.
Definition at line 113 of file Maintenance.php.
|
protected |
Definition at line 72 of file Maintenance.php.
|
protected |
Definition at line 78 of file Maintenance.php.
Referenced by SqliteMaintenance\checkSyntax(), CommandLineInc\execute(), and JSParseHelper\execute().
|
protected |
Batch size.
If a script supports this, they should set a default with setBatchSize()
Definition at line 99 of file Maintenance.php.
Referenced by PopulateFilearchiveSha1\doDBUpdates(), PopulateLogSearch\doDBUpdates(), PopulateLogUsertext\doDBUpdates(), PopulateParentId\doDBUpdates(), PopulateRecentChangesSource\doDBUpdates(), PopulateRevisionLength\doLenUpdates(), PopulateRevisionSha1\doSha1Updates(), CleanupBlocks\execute(), MigrateUserGroup\execute(), PurgeChangedPages\execute(), RebuildFileCache\execute(), RefreshImageMetadata\execute(), and ResetUserTokens\execute().
|
private |
|
protected |
Definition at line 85 of file Maintenance.php.
Referenced by finalSetup().
|
protected |
Definition at line 85 of file Maintenance.php.
Referenced by finalSetup().
|
private |
Definition at line 104 of file Maintenance.php.
Referenced by maybeHelp().
|
protected |
Definition at line 88 of file Maintenance.php.
|
private |
Definition at line 102 of file Maintenance.php.
Referenced by maybeHelp().
|
protected |
Definition at line 91 of file Maintenance.php.
|
protected |
Definition at line 75 of file Maintenance.php.
Referenced by CommandLineInc\execute().
|
protected |
Definition at line 66 of file Maintenance.php.
Referenced by addDefaultParams(), and maybeHelp().
|
protected |
Definition at line 84 of file Maintenance.php.
Referenced by isQuiet().
|
protected |
Definition at line 81 of file Maintenance.php.
Referenced by getName().
|
protected |
Definition at line 69 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 139 of file Maintenance.php.
Referenced by BackupDumper\processOptions().
const Maintenance::DB_ADMIN = 2 |
Definition at line 60 of file Maintenance.php.
Referenced by ConvertLinks\getDbType(), AlterSharedConstraints\getDbType(), PatchSql\getDbType(), RebuildAll\getDbType(), RebuildTextIndex\getDbType(), RenameDbPrefix\getDbType(), BatchedQueryRunner\getDbType(), MwSql\getDbType(), UpdateMediaWiki\getDbType(), UpdateDoubleWidthSearch\getDbType(), UpdateSearchIndex\getDbType(), and PHPUnitMaintClass\getDbType().
const Maintenance::DB_NONE = 0 |
Constants for DB access type.
Definition at line 58 of file Maintenance.php.
Referenced by DumpIterator\finalSetup(), CheckSyntax\getDbType(), SearchDump\getDbType(), FindHooks\getDbType(), GenerateNormalizerDataAr\getDbType(), GenerateNormalizerDataMl\getDbType(), MWDocGen\getDbType(), PreprocessDump\getDbType(), SqliteMaintenance\getDbType(), and GenerateRandomImages\getDbType().
const Maintenance::DB_STD = 1 |
Definition at line 59 of file Maintenance.php.
Referenced by getDbType().
const Maintenance::STDIN_ALL = 'all' |
Definition at line 63 of file Maintenance.php.
Referenced by EditCLI\execute(), and getStdin().