r110554 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r110553‎ | r110554 | r110555 >
Date:09:55, 2 February 2012
Author:ialex
Status:ok
Tags:core 
Comment:
Use WikiPage instead of Title to get its id, whether it exists and its latest revision's id
Modified paths:
  • /trunk/phase3/includes/actions/HistoryAction.php (modified) (history)
  • /trunk/phase3/includes/actions/RawAction.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/actions/HistoryAction.php
@@ -112,7 +112,7 @@
113113 }
114114
115115 // Fail nicely if article doesn't exist.
116 - if ( !$this->getTitle()->exists() ) {
 116+ if ( !$this->page->exists() ) {
117117 $out->addWikiMsg( 'nohistory' );
118118 # show deletion/move log if there is an entry
119119 LogEventsList::showLogExtract(
@@ -206,7 +206,7 @@
207207 $offsets = array();
208208 }
209209
210 - $page_id = $this->getTitle()->getArticleID();
 210+ $page_id = $this->page->getId();
211211
212212 return $dbr->select( 'revision',
213213 Revision::selectFields(),
@@ -343,7 +343,7 @@
344344 'tables' => array( 'revision', 'user' ),
345345 'fields' => array_merge( Revision::selectFields(), Revision::selectUserFields() ),
346346 'conds' => array_merge(
347 - array( 'rev_page' => $this->getTitle()->getArticleID() ),
 347+ array( 'rev_page' => $this->getWikiPage()->getId() ),
348348 $this->conds ),
349349 'options' => array( 'USE INDEX' => array( 'revision' => 'page_timestamp' ) ),
350350 'join_conds' => array(
@@ -676,7 +676,7 @@
677677 $cur,
678678 array(),
679679 array(
680 - 'diff' => $this->getTitle()->getLatestRevID(),
 680+ 'diff' => $this->getWikiPage()->getLatest(),
681681 'oldid' => $rev->getId()
682682 )
683683 );
Index: trunk/phase3/includes/actions/RawAction.php
@@ -166,7 +166,7 @@
167167 # output previous revision, or nothing if there isn't one
168168 if( !$oldid ) {
169169 # get the current revision so we can get the penultimate one
170 - $oldid = $this->getTitle()->getLatestRevID();
 170+ $oldid = $this->page->getLatest();
171171 }
172172 $prev = $this->getTitle()->getPreviousRevisionId( $oldid );
173173 $oldid = $prev ? $prev : -1 ;

Status & tagging log