Go to the documentation of this file.
25 require_once __DIR__ .
'/Maintenance.php';
39 parent::__construct();
40 $this->mDescription =
'Send purge requests for edits in date range to squid/varnish';
41 $this->
addOption(
'starttime',
'Starting timestamp',
true,
true );
42 $this->
addOption(
'endtime',
'Ending timestamp',
true,
true );
43 $this->
addOption(
'htcp-dest',
'HTCP announcement destination (IP:port)',
false,
true );
44 $this->
addOption(
'sleep-per-batch',
'Milliseconds to sleep between batches',
false,
true );
45 $this->
addOption(
'dry-run',
'Do not send purge requests' );
46 $this->
addOption(
'verbose',
'Show more output',
false,
false,
'v' );
54 $parts = explode(
':', $this->
getOption(
'htcp-dest' ) );
55 if ( count( $parts ) < 2 ) {
61 $wgHTCPRouting =
array(
62 '' =>
array(
'host' => $parts[0],
'port' => $parts[1] ),
65 $this->
output(
"HTCP broadcasts to {$parts[0]}:{$parts[1]}\n" );
70 $minTime =
$dbr->timestamp( $this->
getOption(
'starttime' ) );
73 if ( $maxTime < $minTime ) {
74 $this->
error(
"\nERROR: starttime after endtime\n" );
84 array(
'page',
'revision' ),
91 "rev_timestamp > " .
$dbr->addQuotes( $minTime ),
92 "rev_timestamp <= " .
$dbr->addQuotes( $maxTime ),
96 "page_latest = rev_id",
99 array(
'ORDER BY' =>
'rev_timestamp',
'LIMIT' => $bSize ),
101 'page' =>
array(
'INNER JOIN',
'rev_page=page_id' ),
105 if ( !
$res->numRows() ) {
112 if ( !count( $rows ) ) {
119 $this->
output(
"Processing changes from {$minTime} to {$lastTime}.\n" );
122 $minTime = $lastTime;
126 foreach ( $rows
as $row ) {
128 $urls[] =
$title->getInternalURL();
132 $this->
output( implode(
"\n", $urls ) .
"\n" );
142 if ( $this->
hasOption(
'sleep-per-batch' ) ) {
144 usleep( 1000 * (
int)$this->
getOption(
'sleep-per-batch' ) );
148 $this->
output(
"Done!\n" );
170 $rows = iterator_to_array(
$res,
false );
177 $lastValue = $rows[
$count - 1]->$column;
178 for ( $i =
$count - 1; $i >= 0; --$i ) {
179 if ( $rows[$i]->$column === $lastValue ) {
185 $lastValueLeft = count( $rows ) ? $rows[count( $rows ) - 1]->$column :
null;
186 return array( $rows, $lastValueLeft );
int $mBatchSize
Batch size.
static & makeTitle( $ns, $title, $fragment='', $interwiki='')
Create a new Title from a namespace index and a DB key.
skin txt MediaWiki includes four core it has been set as the default in MediaWiki since the replacing Monobook it had been been the default skin since before being replaced by Vector largely rewritten in while keeping its appearance Several legacy skins were removed in the as the burden of supporting them became too heavy to bear Those in etc for skin dependent CSS etc for skin dependent JavaScript These can also be customised on a per user by etc This feature has led to a wide variety of user styles becoming that gallery is a good place to ending in php
maybeHelp( $force=false)
Maybe show the help.
pageableSortedRows(ResultWrapper $res, $column, $limit)
Remove all the rows in a result set with the highest value for column $column unless the number of ro...
addOption( $name, $description, $required=false, $withArg=false, $shortName=false)
Add a parameter to the script.
execute()
Do the actual work.
__construct()
Default constructor.
require_once RUN_MAINTENANCE_IF_MAIN
Abstract maintenance class for quickly writing and churning out maintenance scripts with minimal effo...
Maintenance script that sends purge requests for pages edited in a date range to squid/varnish.
& getDB( $db, $groups=array(), $wiki=false)
Returns a database to be used by current maintenance script.
the array() calling protocol came about after MediaWiki 1.4rc1.
List of Api Query prop modules.
when a variable name is used in a it is silently declared as a new masking the global
Handles purging appropriate Squid URLs given a title (or titles)
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
presenting them properly to the user as errors is done by the caller $title
getOption( $name, $default=null)
Get an option, or return the default.
This document is intended to provide useful advice for parties seeking to redistribute MediaWiki to end users It s targeted particularly at maintainers for Linux since it s been observed that distribution packages of MediaWiki often break We ve consistently had to recommend that users seeking support use official tarballs instead of their distribution s and this often solves whatever problem the user is having It would be nice if this could such as
error( $err, $die=0)
Throw an error to the user.
output( $out, $channel=null)
Throw some output to the user.
hasOption( $name)
Checks to see if a particular param exists.
Result wrapper for grabbing data queried by someone else.
setBatchSize( $s=0)
Set the batch size.