Changeset View
Changeset View
Standalone View
Standalone View
src/applications/diffusion/engine/DiffusionCommitHookEngine.php
<?php | <?php | ||||
/** | /** | ||||
* @task config Configuring the Hook Engine | * @task config Configuring the Hook Engine | ||||
* @task hook Hook Execution | * @task hook Hook Execution | ||||
* @task git Git Hooks | * @task git Git Hooks | ||||
* @task hg Mercurial Hooks | * @task hg Mercurial Hooks | ||||
* @task svn Subversion Hooks | * @task svn Subversion Hooks | ||||
* @task internal Internals | * @task internal Internals | ||||
*/ | */ | ||||
final class DiffusionCommitHookEngine extends Phobject { | final class DiffusionCommitHookEngine extends Phobject { | ||||
const ENV_REPOSITORY = 'PHABRICATOR_REPOSITORY'; | |||||
const ENV_USER = 'PHABRICATOR_USER'; | const ENV_USER = 'PHABRICATOR_USER'; | ||||
const ENV_REMOTE_ADDRESS = 'PHABRICATOR_REMOTE_ADDRESS'; | const ENV_REMOTE_ADDRESS = 'PHABRICATOR_REMOTE_ADDRESS'; | ||||
const ENV_REMOTE_PROTOCOL = 'PHABRICATOR_REMOTE_PROTOCOL'; | const ENV_REMOTE_PROTOCOL = 'PHABRICATOR_REMOTE_PROTOCOL'; | ||||
const EMPTY_HASH = '0000000000000000000000000000000000000000'; | const EMPTY_HASH = '0000000000000000000000000000000000000000'; | ||||
private $viewer; | private $viewer; | ||||
private $repository; | private $repository; | ||||
▲ Show 20 Lines • Show All 584 Lines • ▼ Show 20 Lines | |||||
/* -( Custom )------------------------------------------------------------- */ | /* -( Custom )------------------------------------------------------------- */ | ||||
private function applyCustomHooks(array $updates) { | private function applyCustomHooks(array $updates) { | ||||
$args = $this->getOriginalArgv(); | $args = $this->getOriginalArgv(); | ||||
$stdin = $this->getStdin(); | $stdin = $this->getStdin(); | ||||
$console = PhutilConsole::getConsole(); | $console = PhutilConsole::getConsole(); | ||||
$env = array( | $env = array( | ||||
'PHABRICATOR_REPOSITORY' => $this->getRepository()->getCallsign(), | 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(); | $directories = $this->getRepository()->getHookDirectories(); | ||||
foreach ($directories as $directory) { | foreach ($directories as $directory) { | ||||
$hooks = $this->getExecutablesInDirectory($directory); | $hooks = $this->getExecutablesInDirectory($directory); | ||||
▲ Show 20 Lines • Show All 638 Lines • Show Last 20 Lines |