From: Alexandre Emsenhuber Date: Sun, 29 Jan 2012 20:35:32 +0000 (+0000) Subject: Use the WikiPage object object instead of Title to get the page id and latest revision X-Git-Tag: 1.31.0-rc.0~25024 X-Git-Url: http://git.cyclocoop.org/%24href?a=commitdiff_plain;h=3dad5911eb2fe1c4c1e613c81ef5d4cd361b3032;p=lhc%2Fweb%2Fwiklou.git Use the WikiPage object object instead of Title to get the page id and latest revision --- 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(),