X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=maintenance%2FpurgeChangedPages.php;h=58a46400bfeb635b557bb4273f675c5ccdbd943b;hb=9b95e76c6c45e263baf29486eca615000d440418;hp=56e22c4040f6089697301890dc0d7d8e17d6c8b3;hpb=4d78d40d821227a9368e87306f447ffd3be5db88;p=lhc%2Fweb%2Fwiklou.git diff --git a/maintenance/purgeChangedPages.php b/maintenance/purgeChangedPages.php index 56e22c4040..58a46400bf 100644 --- a/maintenance/purgeChangedPages.php +++ b/maintenance/purgeChangedPages.php @@ -36,7 +36,7 @@ class PurgeChangedPages extends Maintenance { public function __construct() { parent::__construct(); - $this->mDescription = 'Send purge requests for edits in date range to squid/varnish'; + $this->addDescription( 'Send purge requests for edits in date range to squid/varnish' ); $this->addOption( 'starttime', 'Starting timestamp', true, true ); $this->addOption( 'endtime', 'Ending timestamp', true, true ); $this->addOption( 'htcp-dest', 'HTCP announcement destination (IP:port)', false, true ); @@ -57,9 +57,9 @@ class PurgeChangedPages extends Maintenance { } // Route all HTCP messages to provided host:port - $wgHTCPRouting = array( - '' => array( 'host' => $parts[0], 'port' => $parts[1] ), - ); + $wgHTCPRouting = [ + '' => [ 'host' => $parts[0], 'port' => $parts[1] ], + ]; if ( $this->hasOption( 'verbose' ) ) { $this->output( "HTCP broadcasts to {$parts[0]}:{$parts[1]}\n" ); } @@ -80,25 +80,25 @@ class PurgeChangedPages extends Maintenance { $bSize = $this->mBatchSize + ( $stuckCount * $this->mBatchSize ); $res = $dbr->select( - array( 'page', 'revision' ), - array( + [ 'page', 'revision' ], + [ 'rev_timestamp', 'page_namespace', 'page_title', - ), - array( + ], + [ "rev_timestamp > " . $dbr->addQuotes( $minTime ), "rev_timestamp <= " . $dbr->addQuotes( $maxTime ), // Only get rows where the revision is the latest for the page. // Other revisions would be duplicate and we don't need to purge if // there has been an edit after the interesting time window. "page_latest = rev_id", - ), + ], __METHOD__, - array( 'ORDER BY' => 'rev_timestamp', 'LIMIT' => $bSize ), - array( - 'page' => array( 'INNER JOIN', 'rev_page=page_id' ), - ) + [ 'ORDER BY' => 'rev_timestamp', 'LIMIT' => $bSize ], + [ + 'page' => [ 'INNER JOIN', 'rev_page=page_id' ], + ] ); if ( !$res->numRows() ) { @@ -121,7 +121,7 @@ class PurgeChangedPages extends Maintenance { $minTime = $lastTime; // Create list of URLs from page_namespace + page_title - $urls = array(); + $urls = []; foreach ( $rows as $row ) { $title = Title::makeTitle( $row->page_namespace, $row->page_title ); $urls[] = $title->getInternalURL(); @@ -135,7 +135,7 @@ class PurgeChangedPages extends Maintenance { } // Send batch of purge requests out to squids - $squid = new SquidUpdate( $urls, count( $urls ) ); + $squid = new CdnCacheUpdate( $urls, count( $urls ) ); $squid->doUpdate(); if ( $this->hasOption( 'sleep-per-batch' ) ) { @@ -170,9 +170,9 @@ class PurgeChangedPages extends Maintenance { $rows = iterator_to_array( $res, false ); $count = count( $rows ); if ( !$count ) { - return array( array(), null ); // nothing to do + return [ [], null ]; // nothing to do } elseif ( $count < $limit ) { - return array( $rows, $rows[$count - 1]->$column ); // no more rows left + return [ $rows, $rows[$count - 1]->$column ]; // no more rows left } $lastValue = $rows[$count - 1]->$column; // should be the highest for ( $i = $count - 1; $i >= 0; --$i ) { @@ -184,7 +184,7 @@ class PurgeChangedPages extends Maintenance { } $lastValueLeft = count( $rows ) ? $rows[count( $rows ) - 1]->$column : null; - return array( $rows, $lastValueLeft ); + return [ $rows, $lastValueLeft ]; } }