Skip to content

Commit

Permalink
MAGETWO-54205: After Disable/Enable Magento modules via CLI all cache…
Browse files Browse the repository at this point in the history
… types become disabled

- minor update based on review
  • Loading branch information
ark99 committed Jun 14, 2016
1 parent 2d928d3 commit b55ddcb
Showing 1 changed file with 15 additions and 12 deletions.
27 changes: 15 additions & 12 deletions src/MagentoHackathon/Composer/Magento/Plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -129,12 +129,7 @@ public function onPackageUnistall(\Composer\Installer\PackageEvent $event)
$deployStrategy = $this->installer->getDeployStrategy($package);
$deployStrategy->rmdirRecursive($packageInstallationPath . $ds . $libPath);
$deployStrategy->rmdirRecursive($packageInstallationPath . $ds . $magentoPackagePath);

// Force regeneration of var/di, var/cache, var/generation on next object manager invocation
if (file_exists($this->installer->getTargetDir() . $this->varFolder)) {
$filename = $this->installer->getTargetDir() . $this->varFolder . $this->regenerate;
touch($filename);
}
$this->requestRegeneration();
}

/**
Expand All @@ -161,12 +156,7 @@ public function onNewCodeEvent(\Composer\Script\Event $event)
$this->deployManager->doDeploy();
$this->deployLibraries();
$this->saveVendorDirPath($event->getComposer());

// Force regeneration of var/di, var/cache, var/generation on next object manager invocation
if (file_exists($this->installer->getTargetDir() . $this->varFolder)) {
$filename = $this->installer->getTargetDir() . $this->varFolder . $this->regenerate;
touch($filename);
}
$this->requestRegeneration();
}


Expand Down Expand Up @@ -289,4 +279,17 @@ private function saveVendorDirPath(Composer $composer)
AUTOLOAD;
file_put_contents($vendorPathFile, $content);
}

/**
* Force regeneration of var/di, var/cache, var/generation on next object manager invocation
*
* @return void
*/
private function requestRegeneration()
{
if (is_writable($this->installer->getTargetDir() . $this->varFolder)) {
$filename = $this->installer->getTargetDir() . $this->varFolder . $this->regenerate;
touch($filename);
}
}
}

0 comments on commit b55ddcb

Please sign in to comment.