X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=maintenance%2FrebuildFileCache.php;h=04ac9678d9c2196c21ccdc7c601c7c708dcc6b75;hb=883b54eb5238ab9b0dbb8da44b31072a12cb448c;hp=da8a6bc36d3bd6b148eb34873646ea81a32673d2;hpb=3a2853e218acb586a00f2e59638de4176aee287f;p=lhc%2Fweb%2Fwiklou.git diff --git a/maintenance/rebuildFileCache.php b/maintenance/rebuildFileCache.php index da8a6bc36d..04ac9678d9 100644 --- a/maintenance/rebuildFileCache.php +++ b/maintenance/rebuildFileCache.php @@ -41,7 +41,7 @@ class RebuildFileCache extends Maintenance { } public function finalSetup() { - global $wgDebugToolbar, $wgUseFileCache, $wgReadOnly; + global $wgDebugToolbar, $wgUseFileCache; $this->enabled = $wgUseFileCache; // Script will handle capturing output and saving it itself @@ -50,7 +50,8 @@ class RebuildFileCache extends Maintenance { // Has to be done before Setup.php initialize MWDebug $wgDebugToolbar = false; // Avoid DB writes (like enotif/counters) - $wgReadOnly = 'Building cache'; // avoid DB writes (like enotif/counters) + MediaWiki\MediaWikiServices::getInstance()->getReadOnlyMode() + ->setReason( 'Building cache' ); parent::finalSetup(); } @@ -122,6 +123,9 @@ class RebuildFileCache extends Maintenance { $article = Article::newFromTitle( $title, $context ); $context->setWikiPage( $article->getPage() ); + // Some extensions like FlaggedRevs while error out if this is unset + RequestContext::getMain()->setTitle( $title ); + // If the article is cacheable, then load it if ( $article->isFileCacheable( HTMLFileCache::MODE_REBUILD ) ) { $viewCache = new HTMLFileCache( $title, 'view' ); @@ -137,7 +141,7 @@ class RebuildFileCache extends Maintenance { MediaWiki\suppressWarnings(); // header notices // Cache ?action=view - $wgRequestTime = microtime( true ); # bug 22852 + $wgRequestTime = microtime( true ); # T24852 ob_start(); $article->view(); $context->getOutput()->output(); @@ -145,7 +149,7 @@ class RebuildFileCache extends Maintenance { $viewHtml = ob_get_clean(); $viewCache->saveToFileCache( $viewHtml ); // Cache ?action=history - $wgRequestTime = microtime( true ); # bug 22852 + $wgRequestTime = microtime( true ); # T24852 ob_start(); Action::factory( 'history', $article, $context )->show(); $context->getOutput()->output();