r71878 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r71877‎ | r71878 | r71879 >
Date:11:16, 29 August 2010
Author:nikerabbit
Status:ok
Tags:
Comment:
Don't run language selector on command line mode.

Can save about 50-100 ms. Also moved hook registration to file level.
Modified paths:
  • /trunk/extensions/LanguageSelector/LanguageSelector.php (modified) (history)

Diff [purge]

Index: trunk/extensions/LanguageSelector/LanguageSelector.php
@@ -74,6 +74,7 @@
7575 $wgHooks['AddNewAccount'][] = 'wfLanguageSelectorAddNewAccount';
7676 $wgHooks['BeforePageDisplay'][] = 'wfLanguageSelectorBeforePageDisplay';
7777 $wgHooks['GetCacheVaryCookies'][] = 'wfLanguageSelectorGetCacheVaryCookies';
 78+$wgHooks['ParserFirstCallInit'][] = 'wfLanguageSelectorSetHook';
7879
7980 $wgExtensionFunctions[] = 'wfLanguageSelectorExtension';
8081
@@ -95,10 +96,14 @@
9697
9798 function wfLanguageSelectorExtension() {
9899 wfLoadExtensionMessages( 'LanguageSelector' );
99 - global $wgLanguageSelectorLanguages, $wgLanguageSelectorDetectLanguage, $wgLanguageSelectorRequestedLanguage, $wgLanguageSelectorLocation, $wgLanguageSelectorShowAll;
 100+ global $wgLanguageSelectorLanguages, $wgLanguageSelectorDetectLanguage,
 101+ $wgLanguageSelectorRequestedLanguage, $wgLanguageSelectorLocation,
 102+ $wgLanguageSelectorShowAll, $wgCommandLineMode;
100103 global $wgUser, $wgLang, $wgRequest, $wgCookiePrefix, $wgCookiePath, $wgHooks;
101104
102 - $wgHooks['ParserFirstCallInit'][] = 'wfLanguageSelectorSetHook';
 105+ if ( $wgCommandLineMode ) {
 106+ return true;
 107+ }
103108
104109 if ( $wgLanguageSelectorLanguages === null ) {
105110 $wgLanguageSelectorLanguages = @$GLOBALS['wgPolyglotLanguages'];

Status & tagging log