From: Krinkle Date: Tue, 14 Jun 2011 23:29:45 +0000 (+0000) Subject: Only define 'isMainPage' if we are on the main page, the new mw.config library is... X-Git-Tag: 1.31.0-rc.0~29526 X-Git-Url: http://git.cyclocoop.org/%24action?a=commitdiff_plain;h=fb0c86db643ac13ae15f4592a9ccd01dc888fdce;p=lhc%2Fweb%2Fwiklou.git Only define 'isMainPage' if we are on the main page, the new mw.config library is specifically built for this efficient way of exporting variables as it will prevent any TypeError exceptions and simply return null (it's not a real global anymore). This is a follow-up on Brion's CR at r87212. --- diff --git a/includes/OutputPage.php b/includes/OutputPage.php index a9e17bb16b..cc7a8a6301 100644 --- a/includes/OutputPage.php +++ b/includes/OutputPage.php @@ -2678,7 +2678,6 @@ class OutputPage { 'wgUserGroups' => $this->getUser()->getEffectiveGroups(), 'wgCategories' => $this->getCategories(), 'wgBreakFrames' => $this->getFrameOptions() == 'DENY', - 'wgIsMainPage' => $title->isMainPage(), ); if ( $wgContLang->hasVariants() ) { $vars['wgUserVariant'] = $wgContLang->getPreferredVariant(); @@ -2689,6 +2688,9 @@ class OutputPage { if ( $wgUseAjax && $wgEnableMWSuggest && !$this->getUser()->getOption( 'disablesuggest', false ) ) { $vars['wgSearchNamespaces'] = SearchEngine::userNamespaces( $this->getUser() ); } + if ( $title->isMainPage() ) { + $vars['wgIsMainPage'] = $title->isMainPage(); + } // Allow extensions to add their custom variables to the global JS variables wfRunHooks( 'MakeGlobalVariablesScript', array( &$vars ) );