Add profiling.

Change-Id: I965ae08f801dfd24cd7fd5cc69087da7949f8a51
This commit is contained in:
Siebrand Mazeland
2012-09-28 01:11:33 -07:00
parent e7cfb6efcb
commit 126bf95079

View File

@@ -72,7 +72,9 @@ class UniversalLanguageSelectorHooks {
}
protected static function isSupportedLanguage( $language ) {
wfProfileIn( __METHOD__ );
$supported = Language::fetchLanguageNames( null, 'mwfile' );
wfProfileOut( __METHOD__ );
return isset( $supported[$language] );
}
@@ -81,11 +83,13 @@ class UniversalLanguageSelectorHooks {
* @return string
*/
protected static function getDefaultLanguage( array $preferred ) {
wfProfileIn( __METHOD__ );
$supported = Language::fetchLanguageNames( null, 'mwfile' );
// look for a language that is acceptable to the client
// and known to the wiki.
foreach ( $preferred as $code => $weight ) {
if ( isset( $supported[$code] ) ) {
wfProfileOut( __METHOD__ );
return $code;
}
}
@@ -96,10 +100,12 @@ class UniversalLanguageSelectorHooks {
$parts = explode( '-', $code, 2 );
$code = $parts[0];
if ( isset( $supported[$code] ) ) {
wfProfileOut( __METHOD__ );
return $code;
}
}
wfProfileOut( __METHOD__ );
return "";
}