}
public function execute() {
- global $wgUseFileCache, $wgReadOnly, $wgContentNamespaces, $wgRequestTime;
+ global $wgUseFileCache, $wgReadOnly, $wgRequestTime;
global $wgOut;
if ( !$wgUseFileCache ) {
$this->error( "Nothing to do -- \$wgUseFileCache is disabled.", true );
$this->output( "Building content page file cache from page {$start}!\n" );
- $dbr = $this->getDB( DB_SLAVE );
+ $dbr = $this->getDB( DB_REPLICA );
$overwrite = $this->getOption( 'overwrite', false );
$start = ( $start > 0 )
? $start
- : $dbr->selectField( 'page', 'MIN(page_id)', false, __FUNCTION__ );
+ : $dbr->selectField( 'page', 'MIN(page_id)', false, __METHOD__ );
$end = ( $end > 0 )
? $end
- : $dbr->selectField( 'page', 'MAX(page_id)', false, __FUNCTION__ );
+ : $dbr->selectField( 'page', 'MAX(page_id)', false, __METHOD__ );
if ( !$start ) {
$this->error( "Nothing to do.", true );
}
// 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' => MWNamespace::getContentNamespaces(),
+ "page_id BETWEEN $blockStart AND $blockEnd" ],
+ __METHOD__,
+ [ 'ORDER BY' => 'page_id ASC', 'USE INDEX' => 'PRIMARY' ]
);
$this->beginTransaction( $dbw, __METHOD__ ); // for any changes
// If the article is cacheable, then load it
if ( $article->isFileCacheable() ) {
- $cache = HTMLFileCache::newFromTitle( $title, 'view' );
+ $cache = new HTMLFileCache( $title, 'view' );
if ( $cache->isCacheGood() ) {
if ( $overwrite ) {
$rebuilt = true;
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