r90099 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r90098‎ | r90099 | r90100 >
Date:23:29, 14 June 2011
Author:krinkle
Status:resolved (Comments)
Tags:
Comment:
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.
Modified paths:
  • /trunk/phase3/includes/OutputPage.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/OutputPage.php
@@ -2678,7 +2678,6 @@
26792679 'wgUserGroups' => $this->getUser()->getEffectiveGroups(),
26802680 'wgCategories' => $this->getCategories(),
26812681 'wgBreakFrames' => $this->getFrameOptions() == 'DENY',
2682 - 'wgIsMainPage' => $title->isMainPage(),
26832682 );
26842683 if ( $wgContLang->hasVariants() ) {
26852684 $vars['wgUserVariant'] = $wgContLang->getPreferredVariant();
@@ -2689,6 +2688,9 @@
26902689 if ( $wgUseAjax && $wgEnableMWSuggest && !$this->getUser()->getOption( 'disablesuggest', false ) ) {
26912690 $vars['wgSearchNamespaces'] = SearchEngine::userNamespaces( $this->getUser() );
26922691 }
 2692+ if ( $title->isMainPage() ) {
 2693+ $vars['wgIsMainPage'] = $title->isMainPage();
 2694+ }
26932695
26942696 // Allow extensions to add their custom variables to the global JS variables
26952697 wfRunHooks( 'MakeGlobalVariablesScript', array( &$vars ) );

Follow-up revisions

RevisionCommit summaryAuthorDate
r90102Using true instead of calling isMainPage() again....krinkle01:11, 15 June 2011
r92348MFT to REL1_18:...hashar08:57, 16 July 2011

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r87212Added wgIsMainPage (Title->isMainPage) to mw.config...krinkle19:46, 1 May 2011

Comments

#Comment by Brion VIBBER (talk | contribs)   23:32, 14 June 2011

Maybe can just set it to true. :)

Status & tagging log