From fb0c86db643ac13ae15f4592a9ccd01dc888fdce Mon Sep 17 00:00:00 2001 From: Krinkle Date: Tue, 14 Jun 2011 23:29:45 +0000 Subject: [PATCH] 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. --- includes/OutputPage.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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 ) ); -- 2.20.1