From 3dad5911eb2fe1c4c1e613c81ef5d4cd361b3032 Mon Sep 17 00:00:00 2001 From: Alexandre Emsenhuber Date: Sun, 29 Jan 2012 20:35:32 +0000 Subject: [PATCH] Use the WikiPage object object instead of Title to get the page id and latest revision --- includes/OutputPage.php | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/includes/OutputPage.php b/includes/OutputPage.php index 16e158de93..2fb574439b 100644 --- a/includes/OutputPage.php +++ b/includes/OutputPage.php @@ -2829,13 +2829,20 @@ $templates public function getJSVars() { global $wgUseAjax, $wgEnableMWSuggest; + $latestRevID = 0; + $pageID = 0; + $canonicalName = false; # bug 21115 + $title = $this->getTitle(); $ns = $title->getNamespace(); $nsname = MWNamespace::exists( $ns ) ? MWNamespace::getCanonicalName( $ns ) : $title->getNsText(); + if ( $ns == NS_SPECIAL ) { list( $canonicalName, /*...*/ ) = SpecialPageFactory::resolveAlias( $title->getDBkey() ); - } else { - $canonicalName = false; # bug 21115 + } elseif ( $this->canUseWikiPage() ) { + $wikiPage = $this->getWikiPage(); + $latestRevID = $wikiPage->getLatest(); + $pageID = $wikiPage->getId(); } $lang = $title->getPageLanguage(); @@ -2860,8 +2867,8 @@ $templates 'wgNamespaceNumber' => $title->getNamespace(), 'wgPageName' => $title->getPrefixedDBKey(), 'wgTitle' => $title->getText(), - 'wgCurRevisionId' => $title->getLatestRevID(), - 'wgArticleId' => $title->getArticleId(), + 'wgCurRevisionId' => $latestRevID, + 'wgArticleId' => $pageID, 'wgIsArticle' => $this->isArticle(), 'wgAction' => Action::getActionName( $this->getContext() ), 'wgUserName' => $this->getUser()->isAnon() ? null : $this->getUser()->getName(), -- 2.20.1