Skip to content

Commit d536cc5

Browse files
author
Ivan Gavryshko
committed
MAGETWO-35748: Default Values are Set Every Time for Some Config Settings
- fixed test
1 parent 4e397a9 commit d536cc5

File tree

2 files changed

+13
-9
lines changed

2 files changed

+13
-9
lines changed

lib/internal/Magento/Framework/Config/ConfigGenerator.php

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ public function createInstallConfig()
6565
{
6666
$configData = new ConfigData(ConfigFilePool::APP_CONFIG);
6767

68-
if (!$this->deploymentConfig->get(ConfigOptionsList::CONFIG_PATH_INSTALL_DATE)) {
68+
if ($this->deploymentConfig->get(ConfigOptionsList::CONFIG_PATH_INSTALL_DATE) === null) {
6969
$configData->set(ConfigOptionsList::CONFIG_PATH_INSTALL_DATE, date('r'));
7070
}
7171
return $configData;
@@ -82,7 +82,7 @@ public function createCryptConfig(array $data)
8282

8383
$configData = new ConfigData(ConfigFilePool::APP_CONFIG);
8484
if (isset($data[ConfigOptionsList::INPUT_KEY_ENCRYPTION_KEY])) {
85-
if ($currentKey) {
85+
if ($currentKey !== null) {
8686
$key = $currentKey . "\n" . $data[ConfigOptionsList::INPUT_KEY_ENCRYPTION_KEY];
8787
} else {
8888
$key = $data[ConfigOptionsList::INPUT_KEY_ENCRYPTION_KEY];
@@ -170,10 +170,11 @@ public function createDbConfig(array $data)
170170
}
171171
}
172172

173-
if ($this->deploymentConfig->get(
174-
ConfigOptionsList::CONFIG_PATH_DB_CONNECTION_DEFAULT . ConfigOptionsList::KEY_ACTIVE
175-
) === null
176-
) {
173+
$currentStatus = $this->deploymentConfig->get(
174+
ConfigOptionsList::CONFIG_PATH_DB_CONNECTION_DEFAULT . ConfigOptionsList::KEY_ACTIVE
175+
);
176+
177+
if ($currentStatus === null) {
177178
$configData->set(ConfigOptionsList::CONFIG_PATH_DB_CONNECTION_DEFAULT . ConfigOptionsList::KEY_ACTIVE, '1');
178179
}
179180

@@ -189,7 +190,7 @@ public function createResourceConfig()
189190
{
190191
$configData = new ConfigData(ConfigFilePool::APP_CONFIG);
191192

192-
if (!$this->deploymentConfig->get(ConfigOptionsList::CONFIG_PATH_RESOURCE_DEFAULT_SETUP)) {
193+
if ($this->deploymentConfig->get(ConfigOptionsList::CONFIG_PATH_RESOURCE_DEFAULT_SETUP) === null) {
193194
$configData->set(ConfigOptionsList::CONFIG_PATH_RESOURCE_DEFAULT_SETUP, 'default');
194195
}
195196

setup/src/Magento/Setup/Model/Installer.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -435,8 +435,7 @@ public function installDeploymentConfig($data)
435435
// reset object manager now that there is a deployment config
436436
$this->objectManagerProvider->reset();
437437
}
438-
439-
438+
440439
/**
441440
* Sets defaults if user input is missing
442441
*
@@ -457,8 +456,12 @@ private function setDefaultValues(array $userData)
457456
if (!isset($userData[ConfigOptionsList::INPUT_KEY_DB_INIT_STATEMENTS])) {
458457
$userData[ConfigOptionsList::INPUT_KEY_DB_INIT_STATEMENTS] = 'SET NAMES utf8;';
459458
}
459+
if (!isset($userData[ConfigOptionsList::INPUT_KEY_DB_PREFIX])) {
460+
$userData[ConfigOptionsList::INPUT_KEY_DB_PREFIX] = '';
461+
}
460462
return $userData;
461463
}
464+
462465
/**
463466
* Set up setup_module table to register modules' versions, skip this process if it already exists
464467
*

0 commit comments

Comments
 (0)