https://www.mediawiki.org/wiki/Special:Code/MediaWiki/110554

Revision: 110554
Author:   ialex
Date:     2012-02-02 09:55:04 +0000 (Thu, 02 Feb 2012)
Log Message:
-----------
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
    trunk/phase3/includes/actions/RawAction.php

Modified: trunk/phase3/includes/actions/HistoryAction.php
===================================================================
--- trunk/phase3/includes/actions/HistoryAction.php     2012-02-02 08:59:30 UTC 
(rev 110553)
+++ trunk/phase3/includes/actions/HistoryAction.php     2012-02-02 09:55:04 UTC 
(rev 110554)
@@ -112,7 +112,7 @@
                }
 
                // 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 @@
                        $offsets = array();
                }
 
-               $page_id = $this->getTitle()->getArticleID();
+               $page_id = $this->page->getId();
 
                return $dbr->select( 'revision',
                        Revision::selectFields(),
@@ -343,7 +343,7 @@
                        '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 @@
                                $cur,
                                array(),
                                array(
-                                       'diff' => 
$this->getTitle()->getLatestRevID(),
+                                       'diff' => 
$this->getWikiPage()->getLatest(),
                                        'oldid' => $rev->getId()
                                )
                        );

Modified: trunk/phase3/includes/actions/RawAction.php
===================================================================
--- trunk/phase3/includes/actions/RawAction.php 2012-02-02 08:59:30 UTC (rev 
110553)
+++ trunk/phase3/includes/actions/RawAction.php 2012-02-02 09:55:04 UTC (rev 
110554)
@@ -166,7 +166,7 @@
                                # 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 ;


_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to