Skip to content

Commit

Permalink
Don't check default locale if Magento is not installed
Browse files Browse the repository at this point in the history
  • Loading branch information
Bartlomiejsz committed Mar 14, 2019
1 parent 28b047e commit b92ffa2
Showing 1 changed file with 25 additions and 1 deletion.
26 changes: 25 additions & 1 deletion lib/internal/Magento/Framework/Locale/Resolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
namespace Magento\Framework\Locale;

use Magento\Framework\App\Config\ScopeConfigInterface;
use Magento\Framework\App\DeploymentConfig;
use Magento\Framework\App\ObjectManager;

class Resolver implements ResolverInterface
{
Expand Down Expand Up @@ -52,6 +54,11 @@ class Resolver implements ResolverInterface
*/
private $defaultLocalePath;

/**
* @var DeploymentConfig
*/
private $deploymentConfig;

/**
* @param ScopeConfigInterface $scopeConfig
* @param string $defaultLocalePath
Expand Down Expand Up @@ -93,7 +100,10 @@ public function setDefaultLocale($locale)
public function getDefaultLocale()
{
if (!$this->defaultLocale) {
$locale = $this->scopeConfig->getValue($this->getDefaultLocalePath(), $this->scopeType);
$locale = false;
if ($this->getDeploymentConfig()->isAvailable() && $this->getDeploymentConfig()->isDbAvailable()) {
$locale = $this->scopeConfig->getValue($this->getDefaultLocalePath(), $this->scopeType);
}
if (!$locale) {
$locale = self::DEFAULT_LOCALE;
}
Expand Down Expand Up @@ -159,4 +169,18 @@ public function revert()
}
return $result;
}

/**
* Retrieve Deployment Config
*
* @return DeploymentConfig
*/
private function getDeploymentConfig()
{
if (!$this->deploymentConfig) {
$this->deploymentConfig = ObjectManager::getInstance()->get(DeploymentConfig::class);
}

return $this->deploymentConfig;
}
}

0 comments on commit b92ffa2

Please sign in to comment.