From c025d708eb604876a0bd88a28f7551f3f8cab773 Mon Sep 17 00:00:00 2001 From: Alexandre Emsenhuber Date: Thu, 2 Feb 2012 09:55:04 +0000 Subject: [PATCH] Use WikiPage instead of Title to get its id, whether it exists and its latest revision's id --- includes/actions/HistoryAction.php | 8 ++++---- includes/actions/RawAction.php | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/includes/actions/HistoryAction.php b/includes/actions/HistoryAction.php index c463eed248..23a3f3d7ac 100644 --- a/includes/actions/HistoryAction.php +++ b/includes/actions/HistoryAction.php @@ -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() ) ); diff --git a/includes/actions/RawAction.php b/includes/actions/RawAction.php index 2dcc3875a3..e4c6b3e067 100644 --- a/includes/actions/RawAction.php +++ b/includes/actions/RawAction.php @@ -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 ; -- 2.20.1