r101634 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r101633‎ | r101634 | r101635 >
Date:16:36, 2 November 2011
Author:ialex
Status:ok
Tags:
Comment:
* Use WikiPage instance of Article
* Changed to call to directly create a Revision instead of going through WikiPage or Article
Modified paths:
  • /trunk/phase3/includes/Title.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/Title.php
@@ -387,8 +387,8 @@
388388 $titles = array( $title );
389389 while ( --$recurse > 0 ) {
390390 if ( $title->isRedirect() ) {
391 - $article = new Article( $title, 0 );
392 - $newtitle = $article->getRedirectTarget();
 391+ $page = WikiPage::factory( $title );
 392+ $newtitle = $page->getRedirectTarget();
393393 } else {
394394 break;
395395 }
@@ -3281,13 +3281,13 @@
32823282 if ( $this->getArticleID() === 0 ) {
32833283 MessageCache::singleton()->replace( $this->getDBkey(), false );
32843284 } else {
3285 - $oldarticle = new Article( $this );
3286 - MessageCache::singleton()->replace( $this->getDBkey(), $oldarticle->getContent() );
 3285+ $rev = Revision::newFromTitle( $this );
 3286+ MessageCache::singleton()->replace( $this->getDBkey(), $rev->getText() );
32873287 }
32883288 }
32893289 if ( $nt->getNamespace() == NS_MEDIAWIKI ) {
3290 - $newarticle = new Article( $nt );
3291 - MessageCache::singleton()->replace( $nt->getDBkey(), $newarticle->getContent() );
 3290+ $rev = Revision::newFromTitle( $nt );
 3291+ MessageCache::singleton()->replace( $nt->getDBkey(), $rev->getText() );
32923292 }
32933293
32943294 wfRunHooks( 'TitleMoveComplete', array( &$this, &$nt, &$wgUser, $pageid, $redirid ) );
@@ -3395,7 +3395,7 @@
33963396 );
33973397 $nt->resetArticleID( $oldid );
33983398
3399 - $article = new Article( $nt );
 3399+ $article = WikiPage::factory( $nt );
34003400 wfRunHooks( 'NewRevisionFromEditComplete',
34013401 array( $article, $nullRevision, $latest, $wgUser ) );
34023402 $article->setCachedLastEditTime( $now );
@@ -3404,7 +3404,7 @@
34053405 if ( $createRedirect || !$wgUser->isAllowed( 'suppressredirect' ) ) {
34063406 $mwRedir = MagicWord::get( 'redirect' );
34073407 $redirectText = $mwRedir->getSynonym( 0 ) . ' [[' . $nt->getPrefixedText() . "]]\n";
3408 - $redirectArticle = new Article( $this );
 3408+ $redirectArticle = WikiPage::factory( $this );
34093409 $newid = $redirectArticle->insertOn( $dbw );
34103410 if ( $newid ) { // sanity
34113411 $redirectRevision = new Revision( array(

Status & tagging log