Skip to content

Commit f2d9176

Browse files
committed
MAGETWO-54205: After Disable/Enable Magento modules via CLI all cache types become disabled
1 parent a67daa3 commit f2d9176

File tree

1 file changed

+15
-13
lines changed

1 file changed

+15
-13
lines changed

lib/internal/Magento/Framework/Code/GeneratedFiles.php

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -156,23 +156,25 @@ private function getEnvPath()
156156
private function disableAllCacheTypes()
157157
{
158158
$envPath = $this->getEnvPath();
159-
$envData = include $envPath;
159+
if ($this->write->isWritable($this->write->getRelativePath($envPath))) {
160+
$envData = include $envPath;
160161

161-
if (isset($envData['cache_types'])) {
162-
$cacheTypes = array_keys($envData['cache_types']);
162+
if (isset($envData['cache_types'])) {
163+
$cacheTypes = array_keys($envData['cache_types']);
163164

164-
foreach ($cacheTypes as $cacheType) {
165-
$envData['cache_types'][$cacheType] = 0;
166-
}
165+
foreach ($cacheTypes as $cacheType) {
166+
$envData['cache_types'][$cacheType] = 0;
167+
}
167168

168-
$formatter = new PhpFormatter();
169-
$contents = $formatter->format($envData);
169+
$formatter = new PhpFormatter();
170+
$contents = $formatter->format($envData);
170171

171-
$this->write->writeFile($this->write->getRelativePath($envPath), $contents);
172-
if (function_exists('opcache_invalidate')) {
173-
opcache_invalidate(
174-
$this->write->getAbsolutePath($envPath)
175-
);
172+
$this->write->writeFile($this->write->getRelativePath($envPath), $contents);
173+
if (function_exists('opcache_invalidate')) {
174+
opcache_invalidate(
175+
$this->write->getAbsolutePath($envPath)
176+
);
177+
}
176178
}
177179
}
178180
}

0 commit comments

Comments
 (0)