X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=maintenance%2FrebuildFileCache.php;h=cf398ff6078d97f50a949347e7c58eaf48b12724;hb=db67de7fad899de33d4c8e3b6ee8189f8570d826;hp=ae6a75e5bcb3c0fe732e92feab499f6acb25968c;hpb=e81a7da6c000384b97319c269ffd1e67afcb8ea8;p=lhc%2Fweb%2Fwiklou.git diff --git a/maintenance/rebuildFileCache.php b/maintenance/rebuildFileCache.php index ae6a75e5bc..cf398ff607 100644 --- a/maintenance/rebuildFileCache.php +++ b/maintenance/rebuildFileCache.php @@ -57,8 +57,6 @@ class RebuildFileCache extends Maintenance { } public function execute() { - global $wgRequestTime; - if ( !$this->enabled ) { $this->fatalError( "Nothing to do -- \$wgUseFileCache is disabled." ); } @@ -82,15 +80,16 @@ class RebuildFileCache extends Maintenance { $overwrite = $this->hasOption( 'overwrite' ); $start = ( $start > 0 ) ? $start - : $dbr->selectField( 'page', 'MIN(page_id)', false, __METHOD__ ); + : $dbr->selectField( 'page', 'MIN(page_id)', '', __METHOD__ ); $end = ( $end > 0 ) ? $end - : $dbr->selectField( 'page', 'MAX(page_id)', false, __METHOD__ ); + : $dbr->selectField( 'page', 'MAX(page_id)', '', __METHOD__ ); if ( !$start ) { $this->fatalError( "Nothing to do." ); } - $_SERVER['HTTP_ACCEPT_ENCODING'] = 'bgzip'; // hack, no real client + // Mock request (hack, no real client) + $_SERVER['HTTP_ACCEPT_ENCODING'] = 'bgzip'; # Do remaining chunk $end += $batchSize - 1; @@ -114,7 +113,7 @@ class RebuildFileCache extends Maintenance { $rebuilt = false; $title = Title::makeTitleSafe( $row->page_namespace, $row->page_title ); - if ( null == $title ) { + if ( $title === null ) { $this->output( "Page {$row->page_id} has bad title\n" ); continue; // broken title? } @@ -141,22 +140,27 @@ class RebuildFileCache extends Maintenance { } Wikimedia\suppressWarnings(); // header notices - // Cache ?action=view - $wgRequestTime = microtime( true ); # T24852 + + // 1. Cache ?action=view + // Be sure to reset the mocked request time (T24852) + $_SERVER['REQUEST_TIME_FLOAT'] = microtime( true ); ob_start(); $article->view(); $context->getOutput()->output(); $context->getOutput()->clearHTML(); $viewHtml = ob_get_clean(); $viewCache->saveToFileCache( $viewHtml ); - // Cache ?action=history - $wgRequestTime = microtime( true ); # T24852 + + // 2. Cache ?action=history + // Be sure to reset the mocked request time (T24852) + $_SERVER['REQUEST_TIME_FLOAT'] = microtime( true ); ob_start(); Action::factory( 'history', $article, $context )->show(); $context->getOutput()->output(); $context->getOutput()->clearHTML(); $historyHtml = ob_get_clean(); $historyCache->saveToFileCache( $historyHtml ); + Wikimedia\restoreWarnings(); if ( $rebuilt ) {