X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;ds=sidebyside;f=maintenance%2FrebuildFileCache.php;h=1f89426e7aebcf600dec94d3b189ce59934d4482;hb=71653df1c365ec4092ca3390f1857d5e8e435b6e;hp=ecdec29a9585cb18da281c55b8a2de5a69c6f109;hpb=a6abe2ad7a1ed2c8dd29f35a9f6c40f85e12b7ab;p=lhc%2Fweb%2Fwiklou.git diff --git a/maintenance/rebuildFileCache.php b/maintenance/rebuildFileCache.php index ecdec29a95..1f89426e7a 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." ); } @@ -90,7 +88,8 @@ class RebuildFileCache extends Maintenance { $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; @@ -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 ) {