Skip to content

Commit b92ffa2

Browse files
committed
Don't check default locale if Magento is not installed
1 parent 28b047e commit b92ffa2

File tree

1 file changed

+25
-1
lines changed

1 file changed

+25
-1
lines changed

lib/internal/Magento/Framework/Locale/Resolver.php

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
namespace Magento\Framework\Locale;
77

88
use Magento\Framework\App\Config\ScopeConfigInterface;
9+
use Magento\Framework\App\DeploymentConfig;
10+
use Magento\Framework\App\ObjectManager;
911

1012
class Resolver implements ResolverInterface
1113
{
@@ -52,6 +54,11 @@ class Resolver implements ResolverInterface
5254
*/
5355
private $defaultLocalePath;
5456

57+
/**
58+
* @var DeploymentConfig
59+
*/
60+
private $deploymentConfig;
61+
5562
/**
5663
* @param ScopeConfigInterface $scopeConfig
5764
* @param string $defaultLocalePath
@@ -93,7 +100,10 @@ public function setDefaultLocale($locale)
93100
public function getDefaultLocale()
94101
{
95102
if (!$this->defaultLocale) {
96-
$locale = $this->scopeConfig->getValue($this->getDefaultLocalePath(), $this->scopeType);
103+
$locale = false;
104+
if ($this->getDeploymentConfig()->isAvailable() && $this->getDeploymentConfig()->isDbAvailable()) {
105+
$locale = $this->scopeConfig->getValue($this->getDefaultLocalePath(), $this->scopeType);
106+
}
97107
if (!$locale) {
98108
$locale = self::DEFAULT_LOCALE;
99109
}
@@ -159,4 +169,18 @@ public function revert()
159169
}
160170
return $result;
161171
}
172+
173+
/**
174+
* Retrieve Deployment Config
175+
*
176+
* @return DeploymentConfig
177+
*/
178+
private function getDeploymentConfig()
179+
{
180+
if (!$this->deploymentConfig) {
181+
$this->deploymentConfig = ObjectManager::getInstance()->get(DeploymentConfig::class);
182+
}
183+
184+
return $this->deploymentConfig;
185+
}
162186
}

0 commit comments

Comments
 (0)