Use WikiPage instead of Title to get its id, whether it exists and its latest revisio...
authorAlexandre Emsenhuber <ialex@users.mediawiki.org>
Thu, 2 Feb 2012 09:55:04 +0000 (09:55 +0000)
committerAlexandre Emsenhuber <ialex@users.mediawiki.org>
Thu, 2 Feb 2012 09:55:04 +0000 (09:55 +0000)
includes/actions/HistoryAction.php
includes/actions/RawAction.php

index c463eed..23a3f3d 100644 (file)
@@ -112,7 +112,7 @@ class HistoryAction extends FormlessAction {
                }
 
                // Fail nicely if article doesn't exist.
-               if ( !$this->getTitle()->exists() ) {
+               if ( !$this->page->exists() ) {
                        $out->addWikiMsg( 'nohistory' );
                        # show deletion/move log if there is an entry
                        LogEventsList::showLogExtract(
@@ -206,7 +206,7 @@ class HistoryAction extends FormlessAction {
                        $offsets = array();
                }
 
-               $page_id = $this->getTitle()->getArticleID();
+               $page_id = $this->page->getId();
 
                return $dbr->select( 'revision',
                        Revision::selectFields(),
@@ -343,7 +343,7 @@ class HistoryPager extends ReverseChronologicalPager {
                        'tables'  => array( 'revision', 'user' ),
                        'fields'  => array_merge( Revision::selectFields(), Revision::selectUserFields() ),
                        'conds'   => array_merge(
-                               array( 'rev_page' => $this->getTitle()->getArticleID() ),
+                               array( 'rev_page' => $this->getWikiPage()->getId() ),
                                $this->conds ),
                        'options' => array( 'USE INDEX' => array( 'revision' => 'page_timestamp' ) ),
                        'join_conds' => array(
@@ -676,7 +676,7 @@ class HistoryPager extends ReverseChronologicalPager {
                                $cur,
                                array(),
                                array(
-                                       'diff' => $this->getTitle()->getLatestRevID(),
+                                       'diff' => $this->getWikiPage()->getLatest(),
                                        'oldid' => $rev->getId()
                                )
                        );
index 2dcc387..e4c6b3e 100644 (file)
@@ -166,7 +166,7 @@ class RawAction extends FormlessAction {
                                # output previous revision, or nothing if there isn't one
                                if( !$oldid ) {
                                        # get the current revision so we can get the penultimate one
-                                       $oldid = $this->getTitle()->getLatestRevID();
+                                       $oldid = $this->page->getLatest();
                                }
                                $prev = $this->getTitle()->getPreviousRevisionId( $oldid );
                                $oldid = $prev ? $prev : -1 ;