Skip to content

Commit 643a18b

Browse files
committed
MCP-903: Fix default connection = db setting after Magento installation
- Do not write lock/config/prefix=null to env.php;
1 parent d3745ec commit 643a18b

File tree

2 files changed

+6
-8
lines changed
  • lib/internal/Magento/Framework/Lock/Backend
  • setup/src/Magento/Setup/Model/ConfigOptionsList

2 files changed

+6
-8
lines changed

lib/internal/Magento/Framework/Lock/Backend/Database.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ private function addPrefix(string $name): string
162162
*/
163163
private function getPrefix(): string
164164
{
165-
if ($this->prefix === null || $this->prefix === '') {
165+
if ($this->prefix === null) {
166166
$this->prefix = (string)$this->deploymentConfig->get(
167167
ConfigOptionsListConstants::CONFIG_PATH_DB_CONNECTION_DEFAULT
168168
. '/'

setup/src/Magento/Setup/Model/ConfigOptionsList/Lock.php

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,6 @@ class Lock implements ConfigOptionsListInterface
134134
*/
135135
private $defaultConfigValues = [
136136
self::INPUT_KEY_LOCK_PROVIDER => LockBackendFactory::LOCK_DB,
137-
self::INPUT_KEY_LOCK_DB_PREFIX => null,
138137
self::INPUT_KEY_LOCK_ZOOKEEPER_PATH => ZookeeperLock::DEFAULT_PATH,
139138
];
140139

@@ -317,7 +316,10 @@ private function setDefaultConfiguration(
317316
string $lockProvider
318317
) {
319318
foreach ($this->mappingInputKeyToConfigPath[$lockProvider] as $input => $path) {
320-
$configData->set($path, $deploymentConfig->get($path, $this->getDefaultValue($input)));
319+
// do not set default value null for lock db prefix
320+
if ($input !== self::INPUT_KEY_LOCK_DB_PREFIX) {
321+
$configData->set($path, $deploymentConfig->get($path, $this->getDefaultValue($input)));
322+
}
321323
}
322324

323325
return $configData;
@@ -333,10 +335,6 @@ private function setDefaultConfiguration(
333335
*/
334336
private function getDefaultValue(string $inputKey)
335337
{
336-
if (isset($this->defaultConfigValues[$inputKey])) {
337-
return $this->defaultConfigValues[$inputKey];
338-
} else {
339-
return null;
340-
}
338+
return $this->defaultConfigValues[$inputKey] ?? null;
341339
}
342340
}

0 commit comments

Comments
 (0)