Changeset View
Changeset View
Standalone View
Standalone View
src/applications/diffusion/engine/DiffusionCommitHookEngine.php
Show First 20 Lines • Show All 604 Lines • ▼ Show 20 Lines | private function applyCustomHooks(array $updates) { | ||||
$env = array( | $env = array( | ||||
self::ENV_REPOSITORY => $this->getRepository()->getPHID(), | self::ENV_REPOSITORY => $this->getRepository()->getPHID(), | ||||
self::ENV_USER => $this->getViewer()->getUsername(), | self::ENV_USER => $this->getViewer()->getUsername(), | ||||
self::ENV_REMOTE_PROTOCOL => $this->getRemoteProtocol(), | self::ENV_REMOTE_PROTOCOL => $this->getRemoteProtocol(), | ||||
self::ENV_REMOTE_ADDRESS => $this->getRemoteAddress(), | self::ENV_REMOTE_ADDRESS => $this->getRemoteAddress(), | ||||
); | ); | ||||
$directories = $this->getRepository()->getHookDirectories(); | $repository = $this->getRepository(); | ||||
$env += $repository->getPassthroughEnvironmentalVariables(); | |||||
$directories = $repository->getHookDirectories(); | |||||
foreach ($directories as $directory) { | foreach ($directories as $directory) { | ||||
$hooks = $this->getExecutablesInDirectory($directory); | $hooks = $this->getExecutablesInDirectory($directory); | ||||
sort($hooks); | sort($hooks); | ||||
foreach ($hooks as $hook) { | foreach ($hooks as $hook) { | ||||
// NOTE: We're explicitly running the hooks in sequential order to | // NOTE: We're explicitly running the hooks in sequential order to | ||||
// make this more predictable. | // make this more predictable. | ||||
$future = id(new ExecFuture('%s %Ls', $hook, $args)) | $future = id(new ExecFuture('%s %Ls', $hook, $args)) | ||||
->setEnv($env, $wipe_process_env = false) | ->setEnv($env, $wipe_process_env = false) | ||||
▲ Show 20 Lines • Show All 639 Lines • Show Last 20 Lines |