From 8e62cda68e1c6827a989e0a9b480529c087b51f3 Mon Sep 17 00:00:00 2001 From: "Barry vd. Heuvel" Date: Wed, 23 Mar 2016 11:15:08 +0100 Subject: [PATCH] Add Bootstrap Composer scripts --- src/Illuminate/Bootstrap/Composer.php | 42 +++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 src/Illuminate/Bootstrap/Composer.php diff --git a/src/Illuminate/Bootstrap/Composer.php b/src/Illuminate/Bootstrap/Composer.php new file mode 100644 index 000000000000..fba8f3d25c13 --- /dev/null +++ b/src/Illuminate/Bootstrap/Composer.php @@ -0,0 +1,42 @@ +getComposer()->getConfig()->get('vendor-dir'); + require $vendorDir . '/autoload.php'; + + static::clearCompiled(); + } + + public static function postUpdate(Event $event) + { + $vendorDir = $event->getComposer()->getConfig()->get('vendor-dir'); + require $vendorDir . '/autoload.php'; + + static::clearCompiled(); + } + + private static function clearCompiled() + { + $baseDir = getcwd(); + $laravel = new Application($baseDir); + + $compiledPath = $laravel->getCachedCompilePath(); + $servicesPath = $laravel->getCachedServicesPath(); + + if (file_exists($compiledPath)) { + @unlink($compiledPath); + } + + if (file_exists($servicesPath)) { + @unlink($servicesPath); + } + } +}