diff --git a/src/Composer/Installer.php b/src/Composer/Installer.php index 0970b75f4..af1540cef 100644 --- a/src/Composer/Installer.php +++ b/src/Composer/Installer.php @@ -173,6 +173,12 @@ class Installer unset($devRepo, $package); // end BC + if ($this->runScripts) { + // dispatch pre event + $eventName = $this->update ? ScriptEvents::PRE_UPDATE_CMD : ScriptEvents::PRE_INSTALL_CMD; + $this->eventDispatcher->dispatchCommandEvent($eventName, $this->devMode); + } + $this->downloadManager->setPreferSource($this->preferSource); $this->downloadManager->setPreferDist($this->preferDist); @@ -199,12 +205,6 @@ class Installer $aliases = $this->getRootAliases(); $this->aliasPlatformPackages($platformRepo, $aliases); - if ($this->runScripts) { - // dispatch pre event - $eventName = $this->update ? ScriptEvents::PRE_UPDATE_CMD : ScriptEvents::PRE_INSTALL_CMD; - $this->eventDispatcher->dispatchCommandEvent($eventName, $this->devMode); - } - try { $this->suggestedPackages = array(); $res = $this->doInstall($localRepo, $installedRepo, $platformRepo, $aliases, $this->devMode);