r81909 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r81908‎ | r81909 | r81910 >
Date:18:15, 10 February 2011
Author:platonides
Status:ok
Tags:
Comment:
Move LanguageGetMagic hook to its own function
Modified paths:
  • /trunk/phase3/languages/Language.php (modified) (history)

Diff [purge]

Index: trunk/phase3/languages/Language.php
@@ -2095,14 +2095,20 @@
20962096 return self::$dataCache->getItem( $this->mCode, 'magicWords' );
20972097 }
20982098
 2099+ protected function doMagicHook() {
 2100+ if ( $this->mMagicHookDone ) {
 2101+ return;
 2102+ }
 2103+ $this->mMagicHookDone = true;
 2104+ wfProfileIn( 'LanguageGetMagic' );
 2105+ wfRunHooks( 'LanguageGetMagic', array( &$this->mMagicExtensions, $this->getCode() ) );
 2106+ wfProfileOut( 'LanguageGetMagic' );
 2107+ }
 2108+
20992109 # Fill a MagicWord object with data from here
21002110 function getMagic( $mw ) {
2101 - if ( !$this->mMagicHookDone ) {
2102 - $this->mMagicHookDone = true;
2103 - wfProfileIn( 'LanguageGetMagic' );
2104 - wfRunHooks( 'LanguageGetMagic', array( &$this->mMagicExtensions, $this->getCode() ) );
2105 - wfProfileOut( 'LanguageGetMagic' );
2106 - }
 2111+ $this->doMagicHook();
 2112+
21072113 if ( isset( $this->mMagicExtensions[$mw->mId] ) ) {
21082114 $rawEntry = $this->mMagicExtensions[$mw->mId];
21092115 } else {

Status & tagging log