[BUGFIX] Respect availableLanguages from AdditionalConfiguration.php 71/50871/5
authorFlorian Mast <flo.mast@web.de>
Sat, 3 Dec 2016 12:45:23 +0000 (13:45 +0100)
committerSusanne Moog <susanne.moog@typo3.org>
Sat, 3 Dec 2016 15:40:27 +0000 (16:40 +0100)
if $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['lang']['availableLanguages']
is set in AdditionalConfiguration.php, the language module will now
respect that setting.

Resolves: #78876
Releases: master
Change-Id: Iec6a0f05db835ae949fbacdc2cdf500a0950d57c
Reviewed-on: https://review.typo3.org/50871
Reviewed-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Tested-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Reviewed-by: Susanne Moog <susanne.moog@typo3.org>
Tested-by: Susanne Moog <susanne.moog@typo3.org>
typo3/sysext/lang/Classes/Domain/Repository/LanguageRepository.php

index 9afbde8..c6b5bf9 100644 (file)
@@ -85,11 +85,10 @@ class LanguageRepository
      */
     public function __construct()
     {
-        $configurationManager = GeneralUtility::makeInstance(ConfigurationManager::class);
-        try {
-            $globalSettings = $configurationManager->getLocalConfigurationValueByPath($this->configurationPath);
-            $this->selectedLocales = (array)$globalSettings['availableLanguages'];
-        } catch (\Exception $e) {
+        if (isset($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['lang']['availableLanguages'])) {
+            $this->selectedLocales = $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['lang']['availableLanguages'];
+        } else {
+            $configurationManager = GeneralUtility::makeInstance(ConfigurationManager::class);
             $configurationManager->setLocalConfigurationValueByPath(
                 $this->configurationPath,
                 ['availableLanguages' => []]