25require_once __DIR__ .
'/Maintenance.php';
36 parent::__construct();
37 $this->
addOption(
'list',
'List special page names' );
38 $this->
addOption(
'only',
'Only update "page"; case sensitive, ' .
39 'check correct case by calling this script with --list. ' .
40 'Ex: --only=BrokenRedirects',
false,
true );
41 $this->
addOption(
'override',
'Also update pages that have updates disabled' );
52 list( , $special ) = $page;
53 $limit = $page[2] ??
null;
55 # --list : just show the name of pages
57 $this->
output(
"$special [QueryPage]\n" );
64 $this->
output(
sprintf(
"%-30s [QueryPage] disabled\n", $special ) );
68 $specialObj = MediaWikiServices::getInstance()->getSpecialPageFactory()->
71 $this->
output(
"No such special page: $special\n" );
78 $this->
fatalError(
"$class is not an instance of QueryPage.\n" );
82 if ( !$this->
hasOption(
'only' ) || $this->
getOption(
'only' ) == $queryPage->getName() ) {
84 if ( $queryPage->isExpensive() ) {
89 if ( $num ===
false ) {
90 $this->
output(
"FAILED: database error\n" );
92 $this->
output(
"got $num rows in " );
95 $hours =
intval( $elapsed / 3600 );
96 $minutes =
intval( $elapsed % 3600 / 60 );
97 $seconds = $elapsed - $hours * 3600 - $minutes * 60;
99 $this->
output( $hours .
'h ' );
102 $this->
output( $minutes .
'm ' );
106 # Reopen any connections that have closed
109 $this->
output(
"cheap, skipped\n" );
125 $lbFactory = MediaWikiServices::getInstance()->getDBLoadBalancerFactory();
126 $lb = $lbFactory->getMainLB();
127 if ( !$lb->pingAll() ) {
130 $this->
error(
"Connection failed, reconnecting in 10 seconds..." );
132 }
while ( !$lb->pingAll() );
133 $this->
output(
"Reconnected\n\n" );
136 $lbFactory->waitForReplication();
143 # --list : just show the name of pages
145 $this->
output(
"$special [callback]\n" );
151 $this->
error(
"Uncallable function $call!" );
159 $this->
output(
"completed in " );
160 $elapsed = $t2 -
$t1;
161 $hours =
intval( $elapsed / 3600 );
162 $minutes =
intval( $elapsed % 3600 / 60 );
163 $seconds = $elapsed - $hours * 3600 - $minutes * 60;
165 $this->
output( $hours .
'h ' );
168 $this->
output( $minutes .
'm ' );
171 # Wait for the replica DB to catch up
and that you know you can do these things To protect your we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights These restrictions translate to certain responsibilities for you if you distribute copies of the or if you modify it For if you distribute copies of such a whether gratis or for a you must give the recipients all the rights that you have You must make sure that receive or can get the source code And you must show them these terms so they know their rights We protect your rights with two and(2) offer you this license which gives you legal permission to copy
$wgDisableQueryPageUpdate
Set this to an array of special page names to prevent maintenance/updateSpecialPages....
$wgQueryCacheLimit
Number of rows to cache in 'querycache' table when miser mode is on.
$wgSpecialPageCacheUpdates
Additional functions to be performed with updateSpecialPages.
Abstract maintenance class for quickly writing and churning out maintenance scripts with minimal effo...
output( $out, $channel=null)
Throw some output to the user.
getDB( $db, $groups=[], $wiki=false)
Returns a database to be used by current maintenance script.
hasOption( $name)
Checks to see if a particular option exists.
addOption( $name, $description, $required=false, $withArg=false, $shortName=false, $multiOccurrence=false)
Add a parameter to the script.
getOption( $name, $default=null)
Get an option, or return the default.
fatalError( $msg, $exitCode=1)
Output a message and terminate the current script.
This is a class for doing query pages; since they're almost all the same, we factor out some of the f...
static getPages()
Get a list of query page classes and their associated special pages, for periodic updates.
Maintenance script to update cached special pages.
doSpecialPageCacheUpdates( $dbw)
__construct()
Default constructor.
reopenAndWaitForReplicas()
Re-open any closed db connection, and wait for replicas.
execute()
Do the actual work.
deferred txt A few of the database updates required by various functions here can be deferred until after the result page is displayed to the user For updating the view updating the linked to tables after a etc PHP does not yet have any way to tell the server to actually return and disconnect while still running these but it might have such a feature in the future We handle these by creating a deferred update object and putting those objects on a global list
do that in ParserLimitReportFormat instead use this to modify the parameters of the image all existing parser cache entries will be invalid To avoid you ll need to handle that somehow(e.g. with the RejectParserCacheValue hook) because MediaWiki won 't do it for you. & $defaults error
require_once RUN_MAINTENANCE_IF_MAIN