r110258 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r110257‎ | r110258 | r110259 >
Date:20:35, 29 January 2012
Author:ialex
Status:ok
Tags:core 
Comment:
Use the WikiPage object object instead of Title to get the page id and latest revision
Modified paths:
  • /trunk/phase3/includes/OutputPage.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/OutputPage.php
@@ -2829,13 +2829,20 @@
28302830 public function getJSVars() {
28312831 global $wgUseAjax, $wgEnableMWSuggest;
28322832
 2833+ $latestRevID = 0;
 2834+ $pageID = 0;
 2835+ $canonicalName = false; # bug 21115
 2836+
28332837 $title = $this->getTitle();
28342838 $ns = $title->getNamespace();
28352839 $nsname = MWNamespace::exists( $ns ) ? MWNamespace::getCanonicalName( $ns ) : $title->getNsText();
 2840+
28362841 if ( $ns == NS_SPECIAL ) {
28372842 list( $canonicalName, /*...*/ ) = SpecialPageFactory::resolveAlias( $title->getDBkey() );
2838 - } else {
2839 - $canonicalName = false; # bug 21115
 2843+ } elseif ( $this->canUseWikiPage() ) {
 2844+ $wikiPage = $this->getWikiPage();
 2845+ $latestRevID = $wikiPage->getLatest();
 2846+ $pageID = $wikiPage->getId();
28402847 }
28412848
28422849 $lang = $title->getPageLanguage();
@@ -2860,8 +2867,8 @@
28612868 'wgNamespaceNumber' => $title->getNamespace(),
28622869 'wgPageName' => $title->getPrefixedDBKey(),
28632870 'wgTitle' => $title->getText(),
2864 - 'wgCurRevisionId' => $title->getLatestRevID(),
2865 - 'wgArticleId' => $title->getArticleId(),
 2871+ 'wgCurRevisionId' => $latestRevID,
 2872+ 'wgArticleId' => $pageID,
28662873 'wgIsArticle' => $this->isArticle(),
28672874 'wgAction' => Action::getActionName( $this->getContext() ),
28682875 'wgUserName' => $this->getUser()->isAnon() ? null : $this->getUser()->getName(),

Status & tagging log