Skip to content

Commit dc8c445

Browse files
committed
AC-13231: Magento option --magento-init-params never used when running cli?
Update cli to use MAGE_MODE
1 parent fedf859 commit dc8c445

File tree

2 files changed

+15
-5
lines changed

2 files changed

+15
-5
lines changed

lib/internal/Magento/Framework/App/Bootstrap.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22
/**
3-
* Copyright © Magento, Inc. All rights reserved.
4-
* See COPYING.txt for license details.
3+
* Copyright 2014 Adobe
4+
* All rights reserved.
55
*/
66
declare(strict_types=1);
77

@@ -68,6 +68,11 @@ class Bootstrap
6868
*/
6969
const INIT_PARAM_FILESYSTEM_DRIVERS = 'MAGE_FILESYSTEM_DRIVERS';
7070

71+
/**
72+
* Initialization parameter for magento mode
73+
*/
74+
const INIT_PARAM_MAGE_MODE = 'MAGE_MODE';
75+
7176
/**
7277
* The initialization parameters (normally come from the $_SERVER)
7378
*

lib/internal/Magento/Framework/Console/Cli.php

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -177,10 +177,15 @@ private function initObjectManager()
177177
$params = (new ComplexParameter(self::INPUT_KEY_BOOTSTRAP))->mergeFromArgv($_SERVER, $_SERVER);
178178
$params[Bootstrap::PARAM_REQUIRE_MAINTENANCE] = null;
179179
$requestParams = $this->serviceManager->get('magento-init-params');
180+
$appBootstrapKeys = [
181+
Bootstrap::INIT_PARAM_FILESYSTEM_DIR_PATHS,
182+
Bootstrap::INIT_PARAM_MAGE_MODE,
183+
];
180184

181-
// Merge ALL magento-init-params, not just filesystem paths
182-
if (!empty($requestParams) && is_array($requestParams)) {
183-
$params = array_replace_recursive($params, $requestParams);
185+
foreach ($appBootstrapKeys as $appBootstrapKey) {
186+
if (isset($requestParams[$appBootstrapKey]) && !isset($params[$appBootstrapKey])) {
187+
$params[$appBootstrapKey] = $requestParams[$appBootstrapKey];
188+
}
184189
}
185190

186191
$this->objectManager = Bootstrap::create(BP, $params)->getObjectManager();

0 commit comments

Comments
 (0)