24require_once __DIR__ .
'/Maintenance.php';
40 parent::__construct();
41 $this->
addDescription(
'Send purge requests for edits in date range to squid/varnish' );
42 $this->
addOption(
'starttime',
'Starting timestamp',
true,
true );
43 $this->
addOption(
'endtime',
'Ending timestamp',
true,
true );
44 $this->
addOption(
'htcp-dest',
'HTCP announcement destination (IP:port)',
false,
true );
45 $this->
addOption(
'sleep-per-batch',
'Milliseconds to sleep between batches',
false,
true );
46 $this->
addOption(
'dry-run',
'Do not send purge requests' );
47 $this->
addOption(
'verbose',
'Show more output',
false,
false,
'v' );
55 $parts = explode(
':', $this->
getOption(
'htcp-dest' ) );
56 if ( count( $parts ) < 2 ) {
63 '' => [
'host' => $parts[0],
'port' => $parts[1] ],
66 $this->
output(
"HTCP broadcasts to {$parts[0]}:{$parts[1]}\n" );
71 $minTime =
$dbr->timestamp( $this->
getOption(
'starttime' ) );
74 if ( $maxTime < $minTime ) {
75 $this->
error(
"\nERROR: starttime after endtime\n" );
85 [
'page',
'revision' ],
92 "rev_timestamp > " .
$dbr->addQuotes( $minTime ),
93 "rev_timestamp <= " .
$dbr->addQuotes( $maxTime ),
97 "page_latest = rev_id",
100 [
'ORDER BY' =>
'rev_timestamp',
'LIMIT' => $bSize ],
102 'page' => [
'INNER JOIN',
'rev_page=page_id' ],
106 if ( !
$res->numRows() ) {
113 if ( !count(
$rows ) ) {
120 $this->
output(
"Processing changes from {$minTime} to {$lastTime}.\n" );
123 $minTime = $lastTime;
127 foreach (
$rows as $row ) {
128 $title = Title::makeTitle( $row->page_namespace, $row->page_title );
129 $urls[] = $title->getInternalURL();
143 if ( $this->
hasOption(
'sleep-per-batch' ) ) {
145 usleep( 1000 * (
int)$this->
getOption(
'sleep-per-batch' ) );
149 $this->
output(
"Done!\n" );
172 $rows = iterator_to_array(
$res,
false );
173 $count = count(
$rows );
176 } elseif ( $count < $limit ) {
179 $lastValue =
$rows[$count - 1]->$column;
180 for ( $i = $count - 1; $i >= 0; --$i ) {
181 if (
$rows[$i]->$column === $lastValue ) {
187 $lastValueLeft = count(
$rows ) ?
$rows[count(
$rows ) - 1]->$column :
null;
189 return [
$rows, $lastValueLeft ];
$wgHTCPRouting
Routing configuration for HTCP multicast purging.
Handles purging appropriate CDN URLs given a title (or titles)
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.
getBatchSize()
Returns batch size.
addDescription( $text)
Set the description text.
maybeHelp( $force=false)
Maybe show the help.
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.
setBatchSize( $s=0)
Set the batch size.
Maintenance script that sends purge requests for pages edited in a date range to squid/varnish.
execute()
Do the actual work.
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...
__construct()
Default constructor.
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 also a ContextSource after deleting those rows but within the same transaction $rows
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