Merge "Add backward compatibility for fetchLanguageNames"
This commit is contained in:
@@ -33,9 +33,15 @@ class ResourceLoaderULSModule extends ResourceLoaderModule {
|
|||||||
*/
|
*/
|
||||||
protected function getData() {
|
protected function getData() {
|
||||||
$vars = array();
|
$vars = array();
|
||||||
|
if ( method_exists( 'Language', 'fetchLanguageNames' ) ) {
|
||||||
|
// since 1.20
|
||||||
$vars['wgULSLanguages'] = Language::fetchLanguageNames(
|
$vars['wgULSLanguages'] = Language::fetchLanguageNames(
|
||||||
$this->language->getCode(), 'mwfile'
|
$this->language->getCode(), 'mwfile'
|
||||||
);
|
);
|
||||||
|
} else {
|
||||||
|
$vars['wgULSLanguages'] = Language::getLanguageNames( false );
|
||||||
|
}
|
||||||
|
|
||||||
return $vars;
|
return $vars;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -105,7 +105,11 @@ class UniversalLanguageSelectorHooks {
|
|||||||
|
|
||||||
protected static function isSupportedLanguage( $language ) {
|
protected static function isSupportedLanguage( $language ) {
|
||||||
wfProfileIn( __METHOD__ );
|
wfProfileIn( __METHOD__ );
|
||||||
$supported = Language::fetchLanguageNames( null, 'mwfile' );
|
if ( method_exists( 'Language', 'fetchLanguageNames' ) ) {
|
||||||
|
$supported = Language::fetchLanguageNames( null, 'mwfile' ); // since 1.20
|
||||||
|
} else {
|
||||||
|
$supported = Language::getLanguageNames( false );
|
||||||
|
}
|
||||||
wfProfileOut( __METHOD__ );
|
wfProfileOut( __METHOD__ );
|
||||||
|
|
||||||
return isset( $supported[$language] );
|
return isset( $supported[$language] );
|
||||||
@@ -117,7 +121,11 @@ class UniversalLanguageSelectorHooks {
|
|||||||
*/
|
*/
|
||||||
protected static function getDefaultLanguage( array $preferred ) {
|
protected static function getDefaultLanguage( array $preferred ) {
|
||||||
wfProfileIn( __METHOD__ );
|
wfProfileIn( __METHOD__ );
|
||||||
$supported = Language::fetchLanguageNames( null, 'mwfile' );
|
if ( method_exists( 'Language', 'fetchLanguageNames' ) ) {
|
||||||
|
$supported = Language::fetchLanguageNames( null, 'mwfile' ); // since 1.20
|
||||||
|
} else {
|
||||||
|
$supported = Language::getLanguageNames( false );
|
||||||
|
}
|
||||||
// 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 ) {
|
||||||
|
|||||||
@@ -33,7 +33,12 @@ class LanguageNameIndexer extends Maintenance {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function execute() {
|
public function execute() {
|
||||||
$languages = Language::fetchLanguageNames( null, 'all' );
|
if ( method_exists( 'Language', 'fetchLanguageNames' ) ) {
|
||||||
|
$languages = Language::fetchLanguageNames( null, 'all' ); // since 1.20
|
||||||
|
} else {
|
||||||
|
$languages = Language::getLanguageNames( false );
|
||||||
|
}
|
||||||
|
|
||||||
$all = array();
|
$all = array();
|
||||||
$buckets = array();
|
$buckets = array();
|
||||||
foreach ( $languages as $code => $name ) {
|
foreach ( $languages as $code => $name ) {
|
||||||
|
|||||||
Reference in New Issue
Block a user