File tree Expand file tree Collapse file tree 1 file changed +15
-4
lines changed
src/MagentoHackathon/Composer/Magento Expand file tree Collapse file tree 1 file changed +15
-4
lines changed Original file line number Diff line number Diff 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)
281279AUTOLOAD ;
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}
You can’t perform that action at this time.
0 commit comments