r109140 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r109139‎ | r109140 | r109141 >
Date:12:38, 17 January 2012
Author:ialex
Status:ok
Tags:
Comment:
* Reordered code to not create a RequestContext if the title is invalid
* Use Article::newFromTitle() instead of new Article()
* Set the WikiPage in the context from the created Article object
Modified paths:
  • /trunk/phase3/maintenance/rebuildFileCache.php (modified) (history)

Diff [purge]

Index: trunk/phase3/maintenance/rebuildFileCache.php
@@ -86,16 +86,21 @@
8787 $dbw->begin(); // for any changes
8888 foreach ( $res as $row ) {
8989 $rebuilt = false;
90 - $wgRequestTime = wfTime(); # bug 22852
91 - $context = new RequestContext;
 90+ $wgRequestTime = microtime( true ); # bug 22852
 91+
9292 $wgTitle = Title::makeTitleSafe( $row->page_namespace, $row->page_title );
93 - $context->setTitle( $wgTitle );
9493 if ( null == $wgTitle ) {
9594 $this->output( "Page {$row->page_id} has bad title\n" );
9695 continue; // broken title?
9796 }
 97+
 98+ $context = new RequestContext;
 99+ $context->setTitle( $wgTitle );
 100+ $article = Article::newFromTitle( $wgTitle, $context );
 101+ $context->setWikiPage( $article->getPage() );
 102+
98103 $wgOut = $context->getOutput(); // set display title
99 - $article = new Article( $wgTitle );
 104+
100105 // If the article is cacheable, then load it
101106 if ( $article->isFileCacheable() ) {
102107 $cache = HTMLFileCache::newFromTitle( $wgTitle, 'view' );

Status & tagging log