MediaWiki
master
|
Maintenance script that generates a sitemap for the site. More...
Public Member Functions | |
__construct () | |
Default constructor. More... | |
execute () | |
Execute. More... | |
main () | |
Main loop. More... | |
![]() | |
canExecuteWithoutLocalSettings () | |
Whether this script can run without LocalSettings.php. More... | |
checkRequiredExtensions () | |
Verify that the required extensions are installed. More... | |
cleanupChanneled () | |
Clean up channeled output. More... | |
clearParamsAndArgs () | |
Clear all params and arguments. More... | |
finalSetup (SettingsBuilder $settingsBuilder=null) | |
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... | |
getParameters () | |
isQuiet () | |
loadParamsAndArgs ( $self=null, $opts=null, $args=null) | |
Process command line arguments when running as a child script. 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... | |
setArg ( $argId, $value) | |
Programmatically set the value of the given argument. More... | |
setConfig (Config $config) | |
setDB (IMaintainableDatabase $db) | |
Sets database object to be returned by getDB(). More... | |
setName (string $name) | |
setOption (string $name, $value) | |
Programmatically set the value of the given option. More... | |
setup () | |
Provides subclasses with an opportunity to perform initial checks. More... | |
validateParamsAndArgs () | |
Run some validation checks on the params, etc @stable to override. More... | |
Public Attributes | |
bool | $compress |
Whether or not to use compression. More... | |
IDatabase | $dbr |
A database replica DB object. More... | |
resource false | $file |
A resource pointing to a sitemap file. More... | |
resource | $findex |
A resource pointing to the sitemap index file. More... | |
string | $fspath |
The path to prepend to the filename. More... | |
array | $limit = [] |
The number of entries to save in each sitemap file. More... | |
array | $namespaces = [] |
A one-dimensional array of namespaces in the wiki. More... | |
array | $priorities = [] |
Key => value entries of namespaces and their priorities. More... | |
int | $size_limit |
The maximum size of a sitemap file. More... | |
bool | $skipRedirects |
Whether or not to include redirection pages. More... | |
string | $timestamp |
When this sitemap batch was generated. More... | |
int | $url_limit |
The maximum amount of urls in a sitemap file. More... | |
string | $urlpath |
The URL path to prepend to filenames in the index; should resolve to the same directory as $fspath. More... | |
![]() | |
resource null | $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 | GENERIC_MAINTENANCE_PARAMETERS = 'Script runner options' |
const | SCRIPT_DEPENDENT_PARAMETERS = 'Common options' |
const | STDIN_ALL = -1 |
Additional Inherited Members | |
![]() | |
static | getTermSize () |
Get the terminal size as a two-element array where the first element is the width (number of columns) and the second element is the height (number of rows). More... | |
static | posix_isatty ( $fd) |
Wrapper for posix_isatty() We default as considering stdin a tty (for nice readline methods) but treating stout as not a tty to avoid color codes. More... | |
static | readconsole ( $prompt='> ') |
Prompt the console for input. More... | |
static | requireTestsAutoloader () |
Call this to set up the autoloader to allow classes to be used from the tests directory. More... | |
![]() | |
addArg ( $arg, $description, $required=true, $multi=false) | |
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... | |
afterFinalSetup () | |
Override to perform any required operation at the end of initialisation. More... | |
beginTransaction (IDatabase $dbw, $fname) | |
Begin a transaction on a DB. More... | |
commitTransaction (IDatabase $dbw, $fname) | |
Commit the transaction on a DB handle and wait for replica DBs to catch up. More... | |
countDown ( $seconds) | |
Count down from $seconds to zero on the terminal, with a one-second pause between showing each number. More... | |
deleteOption ( $name) | |
Remove an option. More... | |
error ( $err, $die=0) | |
Throw an error to the user. More... | |
fatalError ( $msg, $exitCode=1) | |
Output a message and terminate the current script. More... | |
getArg ( $argId=0, $default=null) | |
Get an argument. More... | |
getArgs ( $offset=0) | |
Get arguments. More... | |
getBatchSize () | |
Returns batch size. More... | |
getDB ( $db, $groups=[], $dbDomain=false) | |
Returns a database to be used by current maintenance script. More... | |
getDir () | |
Get the maintenance directory. More... | |
getHookContainer () | |
Get a HookContainer, for running extension hooks or for hook metadata. More... | |
getHookRunner () | |
Get a HookRunner for running core hooks. More... | |
getOption ( $name, $default=null) | |
Get an option, or return the default. More... | |
getServiceContainer () | |
Returns the main service container. 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 option was set. More... | |
loadSpecialVars () | |
Handle the special variables that are global to all scripts @stable to override. More... | |
maybeHelp ( $force=false) | |
Maybe show the help. More... | |
output ( $out, $channel=null) | |
Throw some output to the user. More... | |
parseIntList ( $text) | |
Utility function to parse a string (perhaps from a command line option) into a list of integers (perhaps some kind of numeric IDs). More... | |
requireExtension ( $name) | |
Indicate that the specified extension must be loaded before the script can run. More... | |
rollbackTransaction (IDatabase $dbw, $fname) | |
Rollback the transaction on a DB handle. More... | |
setAllowUnregisteredOptions ( $allow) | |
Sets whether to allow unregistered options, which are options passed to a script that do not match an expected parameter. More... | |
setBatchSize ( $s=0) | |
showHelp () | |
Definitely show the help. More... | |
supportsOption ( $name) | |
Checks to see if a particular option in supported. More... | |
validateUserOption ( $errorMsg) | |
waitForReplication () | |
Wait for replica DBs to catch up. More... | |
![]() | |
array | $mArgs = [] |
This is the list of arguments that were actually passed. More... | |
int null | $mBatchSize = null |
Batch size. More... | |
$mDbUser | |
string | $mDescription = '' |
A description of the script, children should change this via addDescription() More... | |
bool | $mInputLoaded = false |
Have we already loaded our user input? More... | |
array | $mOptions = [] |
This is the list of options that were actually passed. More... | |
array[] | $mParams = [] |
Empty. More... | |
bool | $mQuiet = false |
Special vars for params that are always used. More... | |
string null | $mSelf |
Name of the script currently running. More... | |
MaintenanceParameters | $parameters |
Maintenance script that generates a sitemap for the site.
Definition at line 42 of file generateSitemap.php.
GenerateSitemap::__construct | ( | ) |
Default constructor.
Children should call this first if implementing their own constructors
Reimplemented from Maintenance.
Definition at line 149 of file generateSitemap.php.
References Maintenance\addDescription(), and Maintenance\addOption().
GenerateSitemap::execute | ( | ) |
Execute.
Reimplemented from Maintenance.
Definition at line 183 of file generateSitemap.php.
References $fspath, DB_REPLICA, Maintenance\fatalError(), Maintenance\getDB(), Maintenance\getOption(), Maintenance\hasOption(), main(), wfMkdirParents(), wfTimestamp(), and wfTimestampNow().
GenerateSitemap::main | ( | ) |
Main loop.
Definition at line 319 of file generateSitemap.php.
References Maintenance\getServiceContainer(), Maintenance\output(), and wfTimestamp().
Referenced by execute().
bool GenerateSitemap::$compress |
Whether or not to use compression.
Definition at line 84 of file generateSitemap.php.
IDatabase GenerateSitemap::$dbr |
A database replica DB object.
Definition at line 126 of file generateSitemap.php.
resource false GenerateSitemap::$file |
A resource pointing to a sitemap file.
Definition at line 140 of file generateSitemap.php.
resource GenerateSitemap::$findex |
A resource pointing to the sitemap index file.
Definition at line 133 of file generateSitemap.php.
string GenerateSitemap::$fspath |
The path to prepend to the filename.
Definition at line 69 of file generateSitemap.php.
Referenced by execute().
array GenerateSitemap::$limit = [] |
The number of entries to save in each sitemap file.
Definition at line 98 of file generateSitemap.php.
array GenerateSitemap::$namespaces = [] |
A one-dimensional array of namespaces in the wiki.
Definition at line 112 of file generateSitemap.php.
array GenerateSitemap::$priorities = [] |
Key => value entries of namespaces and their priorities.
Definition at line 105 of file generateSitemap.php.
int GenerateSitemap::$size_limit |
The maximum size of a sitemap file.
http://www.sitemaps.org/faq.php#faq_sitemap_size
Definition at line 62 of file generateSitemap.php.
bool GenerateSitemap::$skipRedirects |
Whether or not to include redirection pages.
Definition at line 91 of file generateSitemap.php.
string GenerateSitemap::$timestamp |
When this sitemap batch was generated.
Definition at line 119 of file generateSitemap.php.
int GenerateSitemap::$url_limit |
The maximum amount of urls in a sitemap file.
http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd
Definition at line 53 of file generateSitemap.php.
string GenerateSitemap::$urlpath |
The URL path to prepend to filenames in the index; should resolve to the same directory as $fspath.
Definition at line 77 of file generateSitemap.php.