X-Git-Url: https://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=blobdiff_plain;f=includes%2Fcache%2Flocalisation%2FLocalisationCache.php;h=d0381cf04d794ec737e6866971d16c225753b446;hp=9e2a2fd2ca814730c1352c07764c1efc0c5ee8b4;hb=1dee28cb5f1efd6d9e14d6cc1d0c73c3f69269b4;hpb=e143c40fee88922eb393a88f94e60afc439d1f49 diff --git a/includes/cache/localisation/LocalisationCache.php b/includes/cache/localisation/LocalisationCache.php index 9e2a2fd2ca..d0381cf04d 100644 --- a/includes/cache/localisation/LocalisationCache.php +++ b/includes/cache/localisation/LocalisationCache.php @@ -203,6 +203,7 @@ class LocalisationCache { break; case 'db': $storeClass = LCStoreDB::class; + $storeConf['server'] = $conf['storeServer'] ?? []; break; case 'array': $storeClass = LCStoreStaticArray::class; @@ -215,6 +216,7 @@ class LocalisationCache { $storeClass = LCStoreCDB::class; } else { $storeClass = LCStoreDB::class; + $storeConf['server'] = $conf['storeServer'] ?? []; } break; default: @@ -798,7 +800,7 @@ class LocalisationCache { return [ 'core' => "$IP/languages/i18n", 'api' => "$IP/includes/api/i18n", - 'oojs-ui' => "$IP/resources/lib/oojs-ui/i18n", + 'oojs-ui' => "$IP/resources/lib/ooui/i18n", ] + $messagesDirs; } @@ -836,17 +838,23 @@ class LocalisationCache { } # Fill in the fallback if it's not there already - if ( is_null( $coreData['fallback'] ) ) { - $coreData['fallback'] = $code === 'en' ? false : 'en'; - } - if ( $coreData['fallback'] === false ) { - $coreData['fallbackSequence'] = []; + if ( ( is_null( $coreData['fallback'] ) || $coreData['fallback'] === false ) && $code === 'en' ) { + $coreData['fallback'] = false; + $coreData['originalFallbackSequence'] = $coreData['fallbackSequence'] = []; } else { - $coreData['fallbackSequence'] = array_map( 'trim', explode( ',', $coreData['fallback'] ) ); + if ( !is_null( $coreData['fallback'] ) ) { + $coreData['fallbackSequence'] = array_map( 'trim', explode( ',', $coreData['fallback'] ) ); + } else { + $coreData['fallbackSequence'] = []; + } $len = count( $coreData['fallbackSequence'] ); - # Ensure that the sequence ends at en - if ( $coreData['fallbackSequence'][$len - 1] !== 'en' ) { + # Before we add the 'en' fallback for messages, keep a copy of + # the original fallback sequence + $coreData['originalFallbackSequence'] = $coreData['fallbackSequence']; + + # Ensure that the sequence ends at 'en' for messages + if ( !$len || $coreData['fallbackSequence'][$len - 1] !== 'en' ) { $coreData['fallbackSequence'][] = 'en'; } }