}
public function execute() {
- global $wgRequestTime;
-
if ( !$this->enabled ) {
$this->fatalError( "Nothing to do -- \$wgUseFileCache is disabled." );
}
$this->fatalError( "Nothing to do." );
}
- $_SERVER['HTTP_ACCEPT_ENCODING'] = 'bgzip'; // hack, no real client
+ // Mock request (hack, no real client)
+ $_SERVER['HTTP_ACCEPT_ENCODING'] = 'bgzip';
# Do remaining chunk
$end += $batchSize - 1;
$rebuilt = false;
$title = Title::makeTitleSafe( $row->page_namespace, $row->page_title );
- if ( null == $title ) {
+ if ( $title === null ) {
$this->output( "Page {$row->page_id} has bad title\n" );
continue; // broken title?
}
}
Wikimedia\suppressWarnings(); // header notices
- // Cache ?action=view
- $wgRequestTime = microtime( true ); # T24852
+
+ // 1. Cache ?action=view
+ // Be sure to reset the mocked request time (T24852)
+ $_SERVER['REQUEST_TIME_FLOAT'] = microtime( true );
ob_start();
$article->view();
$context->getOutput()->output();
$context->getOutput()->clearHTML();
$viewHtml = ob_get_clean();
$viewCache->saveToFileCache( $viewHtml );
- // Cache ?action=history
- $wgRequestTime = microtime( true ); # T24852
+
+ // 2. Cache ?action=history
+ // Be sure to reset the mocked request time (T24852)
+ $_SERVER['REQUEST_TIME_FLOAT'] = microtime( true );
ob_start();
Action::factory( 'history', $article, $context )->show();
$context->getOutput()->output();
$context->getOutput()->clearHTML();
$historyHtml = ob_get_clean();
$historyCache->saveToFileCache( $historyHtml );
+
Wikimedia\restoreWarnings();
if ( $rebuilt ) {