global $wgRequestTime;
if ( !$this->enabled ) {
- $this->error( "Nothing to do -- \$wgUseFileCache is disabled.", true );
+ $this->fatalError( "Nothing to do -- \$wgUseFileCache is disabled." );
}
$start = $this->getOption( 'start', "0" );
if ( !ctype_digit( $start ) ) {
- $this->error( "Invalid value for start parameter.", true );
+ $this->fatalError( "Invalid value for start parameter." );
}
$start = intval( $start );
$end = $this->getOption( 'end', "0" );
if ( !ctype_digit( $end ) ) {
- $this->error( "Invalid value for end parameter.", true );
+ $this->fatalError( "Invalid value for end parameter." );
}
$end = intval( $end );
$this->output( "Building content page file cache from page {$start}!\n" );
$dbr = $this->getDB( DB_REPLICA );
+ $batchSize = $this->getBatchSize();
$overwrite = $this->hasOption( 'overwrite' );
$start = ( $start > 0 )
? $start
? $end
: $dbr->selectField( 'page', 'MAX(page_id)', false, __METHOD__ );
if ( !$start ) {
- $this->error( "Nothing to do.", true );
+ $this->fatalError( "Nothing to do." );
}
$_SERVER['HTTP_ACCEPT_ENCODING'] = 'bgzip'; // hack, no real client
# Do remaining chunk
- $end += $this->mBatchSize - 1;
+ $end += $batchSize - 1;
$blockStart = $start;
- $blockEnd = $start + $this->mBatchSize - 1;
+ $blockEnd = $start + $batchSize - 1;
$dbw = $this->getDB( DB_MASTER );
// Go through each page and save the output
$res = $dbr->select( 'page',
[ 'page_namespace', 'page_title', 'page_id' ],
[ 'page_namespace' => MWNamespace::getContentNamespaces(),
- "page_id BETWEEN $blockStart AND $blockEnd" ],
+ "page_id BETWEEN " . (int)$blockStart . " AND " . (int)$blockEnd ],
__METHOD__,
[ 'ORDER BY' => 'page_id ASC', 'USE INDEX' => 'PRIMARY' ]
);
}
$this->commitTransaction( $dbw, __METHOD__ ); // commit any changes (just for sanity)
- $blockStart += $this->mBatchSize;
- $blockEnd += $this->mBatchSize;
+ $blockStart += $batchSize;
+ $blockEnd += $batchSize;
}
$this->output( "Done!\n" );
}
}
-$maintClass = "RebuildFileCache";
+$maintClass = RebuildFileCache::class;
require_once RUN_MAINTENANCE_IF_MAIN;