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)
129
129
$ deployStrategy = $ this ->installer ->getDeployStrategy ($ package );
130
130
$ deployStrategy ->rmdirRecursive ($ packageInstallationPath . $ ds . $ libPath );
131
131
$ deployStrategy ->rmdirRecursive ($ packageInstallationPath . $ ds . $ magentoPackagePath );
132
+ $ this ->requestRegeneration ();
132
133
}
133
134
134
135
/**
@@ -155,10 +156,7 @@ public function onNewCodeEvent(\Composer\Script\Event $event)
155
156
$ this ->deployManager ->doDeploy ();
156
157
$ this ->deployLibraries ();
157
158
$ 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 ();
162
160
}
163
161
164
162
@@ -281,4 +279,17 @@ private function saveVendorDirPath(Composer $composer)
281
279
AUTOLOAD ;
282
280
file_put_contents ($ vendorPathFile , $ content );
283
281
}
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
+ }
284
295
}
You can’t perform that action at this time.
0 commit comments