1
0
Fork 0

Issue 5769 dev mode varaible

pull/5794/head
Andrew Taylor 2016-10-17 20:29:52 +01:00
parent 66efc9af86
commit ce6a3c0dd7
2 changed files with 5 additions and 0 deletions

View File

@ -150,6 +150,8 @@ class MyClass
} }
``` ```
**Note:** During composer install / update, a `COMPOSER_DEV_MODE` php environment variable is set. If composer install / update was run with the `--no-dev option`, this variable will be set to 0, otherwise it will be set to 1. This exposes the mode in which the install / update was run, to any post-install / update commands.
## Event classes ## Event classes
When an event is fired, your PHP callback receives as first argument a When an event is fired, your PHP callback receives as first argument a

View File

@ -292,6 +292,9 @@ class Installer
} }
if ($this->runScripts) { if ($this->runScripts) {
$devMode = (int) $this->devMode;
putenv("COMPOSER_DEV_MODE=$devMode");
// dispatch post event // dispatch post event
$eventName = $this->update ? ScriptEvents::POST_UPDATE_CMD : ScriptEvents::POST_INSTALL_CMD; $eventName = $this->update ? ScriptEvents::POST_UPDATE_CMD : ScriptEvents::POST_INSTALL_CMD;
$this->eventDispatcher->dispatchScript($eventName, $this->devMode); $this->eventDispatcher->dispatchScript($eventName, $this->devMode);