Skip to content

Commit a12b957

Browse files
author
Oleksii Korshenko
authored
Merge pull request #11 from magento-ogre/MAGETWO-54205-cache-disable-issue
MAGETWO-54205: After Disable/Enable Magento modules via CLI all cache types become disabled
2 parents 29df8c8 + b55ddcb commit a12b957

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

src/MagentoHackathon/Composer/Magento/Plugin.php

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ public function onPackageUnistall(\Composer\Installer\PackageEvent $event)
129129
$deployStrategy = $this->installer->getDeployStrategy($package);
130130
$deployStrategy->rmdirRecursive($packageInstallationPath . $ds . $libPath);
131131
$deployStrategy->rmdirRecursive($packageInstallationPath . $ds . $magentoPackagePath);
132+
$this->requestRegeneration();
132133
}
133134

134135
/**
@@ -155,10 +156,7 @@ public function onNewCodeEvent(\Composer\Script\Event $event)
155156
$this->deployManager->doDeploy();
156157
$this->deployLibraries();
157158
$this->saveVendorDirPath($event->getComposer());
158-
if (file_exists($this->installer->getTargetDir() . $this->varFolder)) {
159-
$filename = $this->installer->getTargetDir() . $this->varFolder . $this->regenerate;
160-
touch($filename);
161-
}
159+
$this->requestRegeneration();
162160
}
163161

164162

@@ -281,4 +279,17 @@ private function saveVendorDirPath(Composer $composer)
281279
AUTOLOAD;
282280
file_put_contents($vendorPathFile, $content);
283281
}
282+
283+
/**
284+
* Force regeneration of var/di, var/cache, var/generation on next object manager invocation
285+
*
286+
* @return void
287+
*/
288+
private function requestRegeneration()
289+
{
290+
if (is_writable($this->installer->getTargetDir() . $this->varFolder)) {
291+
$filename = $this->installer->getTargetDir() . $this->varFolder . $this->regenerate;
292+
touch($filename);
293+
}
294+
}
284295
}

0 commit comments

Comments
 (0)