X-Git-Url: http://git.cyclocoop.org/?a=blobdiff_plain;f=maintenance%2FrebuildFileCache.php;h=b67bc36a5cc72e5d2a7113ae5722628eafd2ddda;hb=291126d92779ac2e19d4baf79d18ad48b0d61672;hp=4147491e61ee7e7620a9d34cb2c78706fb5ae6a3;hpb=d85322a862c4f17274aedf382044721dcabaac08;p=lhc%2Fweb%2Fwiklou.git diff --git a/maintenance/rebuildFileCache.php b/maintenance/rebuildFileCache.php index 4147491e61..b67bc36a5c 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,14 +89,14 @@ 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 - $res = $dbr->select( 'page', array( 'page_namespace', 'page_title', 'page_id' ), - array( 'page_namespace' => $wgContentNamespaces, - "page_id BETWEEN $blockStart AND $blockEnd" ), - array( 'ORDER BY' => 'page_id ASC', 'USE INDEX' => 'PRIMARY' ) + $res = $dbr->select( 'page', [ 'page_namespace', 'page_title', 'page_id' ], + [ 'page_namespace' => $wgContentNamespaces, + "page_id BETWEEN $blockStart AND $blockEnd" ], + [ 'ORDER BY' => 'page_id ASC', 'USE INDEX' => 'PRIMARY' ] ); $this->beginTransaction( $dbw, __METHOD__ ); // for any changes @@ -128,7 +128,7 @@ class RebuildFileCache extends Maintenance { continue; // done already! } } - ob_start( array( &$cache, 'saveToFileCache' ) ); // save on ob_end_clean() + ob_start( [ &$cache, 'saveToFileCache' ] ); // save on ob_end_clean() $wgUseFileCache = false; // hack, we don't want $article fiddling with filecache $article->view(); MediaWiki\suppressWarnings(); // header notices