X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=maintenance%2FrebuildFileCache.php;h=21cd3a1e05ab62d37d1baec208ea11cb8afe894b;hb=4dc3ac1c375b3d2eb6172dfef8fdebe71b8c5f43;hp=6ce54b9f02e726afdab95fabd4f1a7ef1004207f;hpb=b2645d82849ca74b0e6b8df6a3e28e81d0561a58;p=lhc%2Fweb%2Fwiklou.git diff --git a/maintenance/rebuildFileCache.php b/maintenance/rebuildFileCache.php index 6ce54b9f02..21cd3a1e05 100644 --- a/maintenance/rebuildFileCache.php +++ b/maintenance/rebuildFileCache.php @@ -31,7 +31,7 @@ require_once __DIR__ . '/Maintenance.php'; class RebuildFileCache extends Maintenance { public function __construct() { parent::__construct(); - $this->mDescription = "Build file cache for content pages"; + $this->addDescription( 'Build file cache for content pages' ); $this->addOption( 'start', 'Page_id to start from', false, true ); $this->addOption( 'end', 'Page_id to end on', false, true ); $this->addOption( 'overwrite', 'Refresh page cache' ); @@ -70,7 +70,7 @@ class RebuildFileCache extends Maintenance { $this->output( "Building content page file cache from page {$start}!\n" ); - $dbr = wfGetDB( DB_SLAVE ); + $dbr = $this->getDB( DB_SLAVE ); $overwrite = $this->getOption( 'overwrite', false ); $start = ( $start > 0 ) ? $start @@ -89,7 +89,7 @@ class RebuildFileCache extends Maintenance { $blockStart = $start; $blockEnd = $start + $this->mBatchSize - 1; - $dbw = wfGetDB( DB_MASTER ); + $dbw = $this->getDB( DB_MASTER ); // Go through each page and save the output while ( $blockEnd <= $end ) { // Get the pages @@ -99,7 +99,7 @@ class RebuildFileCache extends Maintenance { array( 'ORDER BY' => 'page_id ASC', 'USE INDEX' => 'PRIMARY' ) ); - $dbw->begin( __METHOD__ ); // for any changes + $this->beginTransaction( $dbw, __METHOD__ ); // for any changes foreach ( $res as $row ) { $rebuilt = false; $wgRequestTime = microtime( true ); # bug 22852 @@ -131,9 +131,9 @@ class RebuildFileCache extends Maintenance { ob_start( array( &$cache, 'saveToFileCache' ) ); // save on ob_end_clean() $wgUseFileCache = false; // hack, we don't want $article fiddling with filecache $article->view(); - wfSuppressWarnings(); // header notices + MediaWiki\suppressWarnings(); // header notices $wgOut->output(); - wfRestoreWarnings(); + MediaWiki\restoreWarnings(); $wgUseFileCache = true; ob_end_clean(); // clear buffer if ( $rebuilt ) { @@ -145,7 +145,7 @@ class RebuildFileCache extends Maintenance { $this->output( "Page {$row->page_id} not cacheable\n" ); } } - $dbw->commit( __METHOD__ ); // commit any changes (just for sanity) + $this->commitTransaction( $dbw, __METHOD__ ); // commit any changes (just for sanity) $blockStart += $this->mBatchSize; $blockEnd += $this->mBatchSize;