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