Skip to content

Commit c196bce

Browse files
committed
MAGETWO-44635: Running module:enable --all via CLI before installation prevents running further commands
- Checking if deployment config is present based on install/date key
1 parent f920640 commit c196bce

File tree

3 files changed

+11
-12
lines changed

3 files changed

+11
-12
lines changed

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

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

77
namespace Magento\Framework\App;
88

9+
use Magento\Framework\Config\ConfigOptionsListConstants;
10+
911
/**
1012
* Application deployment configuration
1113
*/
@@ -39,13 +41,6 @@ class DeploymentConfig
3941
*/
4042
private $overrideData;
4143

42-
/**
43-
* Availability of deployment config file
44-
*
45-
* @var bool
46-
*/
47-
private $isAvailable;
48-
4944
/**
5045
* Constructor
5146
*
@@ -85,7 +80,7 @@ public function isAvailable()
8580
{
8681
$this->data = null;
8782
$this->load();
88-
return $this->isAvailable;
83+
return isset($this->flatData[ConfigOptionsListConstants::CONFIG_PATH_INSTALL_DATE]);
8984
}
9085

9186
/**
@@ -128,7 +123,6 @@ private function load()
128123
{
129124
if (null === $this->data) {
130125
$this->data = $this->reader->load();
131-
$this->isAvailable = !empty($this->data);
132126
if ($this->overrideData) {
133127
$this->data = array_replace($this->data, $this->overrideData);
134128
}

lib/internal/Magento/Framework/App/Test/Unit/DeploymentConfigTest.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
namespace Magento\Framework\App\Test\Unit;
88

99
use \Magento\Framework\App\DeploymentConfig;
10+
use \Magento\Framework\Config\ConfigOptionsListConstants;
1011

1112
class DeploymentConfigTest extends \PHPUnit_Framework_TestCase
1213
{
@@ -88,7 +89,9 @@ public function testGetters()
8889

8990
public function testIsAvailable()
9091
{
91-
$this->reader->expects($this->once())->method('load')->willReturn(['a' => 1]);
92+
$this->reader->expects($this->once())->method('load')->willReturn([
93+
ConfigOptionsListConstants::CONFIG_PATH_INSTALL_DATE => 1
94+
]);
9295
$object = new DeploymentConfig($this->reader);
9396
$this->assertTrue($object->isAvailable());
9497
}
@@ -103,7 +106,9 @@ public function testNotAvailable()
103106
public function testNotAvailableThenAvailable()
104107
{
105108
$this->reader->expects($this->at(0))->method('load')->willReturn([]);
106-
$this->reader->expects($this->at(1))->method('load')->willReturn(['a' => 1]);
109+
$this->reader->expects($this->at(1))->method('load')->willReturn([
110+
ConfigOptionsListConstants::CONFIG_PATH_INSTALL_DATE => 1
111+
]);
107112
$object = new DeploymentConfig($this->reader);
108113
$this->assertFalse($object->isAvailable());
109114
$this->assertTrue($object->isAvailable());

lib/internal/Magento/Framework/Module/ModuleList.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ public function isModuleInfoAvailable()
139139
*/
140140
private function loadConfigData()
141141
{
142-
if (null === $this->configData && ($this->config->isAvailable())) {
142+
if (null === $this->configData && null !== $this->config->get(ConfigOptionsListConstants::KEY_MODULES)) {
143143
$this->configData = $this->config->get(ConfigOptionsListConstants::KEY_MODULES);
144144
}
145145
}

0 commit comments

Comments
 (0)