X-Git-Url: http://git.heureux-cyclage.org/?a=blobdiff_plain;f=maintenance%2FpurgeList.php;h=540d2750ecb9e9b5949750dd5fd3a793c5caeb31;hb=824ecd9b75bcbcbda0d9330656ea0f06ce288c3a;hp=5ca7918ea9164bb7cce7ef61f4ec2f2acbf3f7f7;hpb=7e350ba150404509d764c96a5ea4dbc9aa51d3ac;p=lhc%2Fweb%2Fwiklou.git diff --git a/maintenance/purgeList.php b/maintenance/purgeList.php index 5ca7918ea9..540d2750ec 100644 --- a/maintenance/purgeList.php +++ b/maintenance/purgeList.php @@ -1,6 +1,6 @@ addDescription( 'Send purge requests for listed pages to squid' ); + $this->addDescription( 'Send purge requests for listed pages to CDN' ); $this->addOption( 'purge', 'Whether to update page_touched.', false, false ); $this->addOption( 'namespace', 'Namespace number', false, true ); $this->addOption( 'all', 'Purge all pages', false, false ); @@ -65,9 +65,14 @@ class PurgeList extends Maintenance { } elseif ( $page !== '' ) { $title = Title::newFromText( $page ); if ( $title ) { - $url = $title->getInternalURL(); - $this->output( "$url\n" ); - $urls[] = $url; + $newUrls = $title->getCdnUrls(); + + foreach ( $newUrls as $url ) { + $this->output( "$url\n" ); + } + + $urls = array_merge( $urls, $newUrls ); + if ( $this->getOption( 'purge' ) ) { $title->invalidateCache(); } @@ -99,7 +104,7 @@ class PurgeList extends Maintenance { $conds + [ 'page_id > ' . $dbr->addQuotes( $startId ) ], __METHOD__, [ - 'LIMIT' => $this->mBatchSize, + 'LIMIT' => $this->getBatchSize(), 'ORDER BY' => 'page_id' ] @@ -110,8 +115,7 @@ class PurgeList extends Maintenance { $urls = []; foreach ( $res as $row ) { $title = Title::makeTitle( $row->page_namespace, $row->page_title ); - $url = $title->getInternalURL(); - $urls[] = $url; + $urls = array_merge( $urls, $title->getCdnUrls() ); $startId = $row->page_id; } $this->sendPurgeRequest( $urls ); @@ -120,7 +124,7 @@ class PurgeList extends Maintenance { /** * Helper to purge an array of $urls - * @param array $urls List of URLS to purge from squids + * @param array $urls List of URLS to purge from CDNs */ private function sendPurgeRequest( $urls ) { if ( $this->hasOption( 'delay' ) ) { @@ -143,5 +147,5 @@ class PurgeList extends Maintenance { } } -$maintClass = "PurgeList"; +$maintClass = PurgeList::class; require_once RUN_MAINTENANCE_IF_MAIN;