Skip to content

Commit fe1345b

Browse files
ACPT-1599: Fixing DeploymentConfig resets & reloads every time new key that wasn't previously set
Fixing problem ACP2E-2198. ``` [Progress: 861 / 864] Disabling Maintenance Mode: In ResourceConnection.php line 162: [DomainException] Connection "default" is not defined ``` The root cause of problem is that the `Disabling Maintenance Mode` part of the install uses the first created DeploymentConfig object created in the process, which doesn't get updated, while before that runs, different part of the install that writes to the config is using the second DeploymentConfig object that was created by Laminas ServiceManager. This commit causes Laminas' ServiceManager to use the same DeploymentConfig object as the first Magento ObjectManager used in the process, which resolves the issue seen in setup:install.
1 parent 6309064 commit fe1345b

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

setup/src/Magento/Setup/Console/CommandList.php

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66

77
namespace Magento\Setup\Console;
88

9+
use Magento\Framework\App\DeploymentConfig;
10+
use Magento\Framework\App\ObjectManager;
911
use Magento\Setup\Console\Command\TablesWhitelistGenerateCommand;
1012
use Laminas\ServiceManager\ServiceManager;
1113

@@ -16,21 +18,20 @@
1618
*/
1719
class CommandList
1820
{
19-
/**
20-
* Service Manager
21-
*
22-
* @var ServiceManager
23-
*/
24-
private $serviceManager;
25-
2621
/**
2722
* Constructor
2823
*
2924
* @param ServiceManager $serviceManager
25+
* @param DeploymentConfig|null $deploymentConfig
3026
*/
31-
public function __construct(ServiceManager $serviceManager)
32-
{
33-
$this->serviceManager = $serviceManager;
27+
public function __construct(
28+
private ServiceManager $serviceManager,
29+
?DeploymentConfig $deploymentConfig = null
30+
) {
31+
$deploymentConfig ??= ObjectManager::getInstance()->get(DeploymentConfig::class);
32+
/* Note: We must use same DeploymentConfig object in objects created by Laminas' ServiceManager, because
33+
* some commands alter deployment configuration. */
34+
$this->serviceManager->setService(DeploymentConfig::class, $deploymentConfig);
3435
}
3536

3637
/**

0 commit comments

Comments
 (0)