Changeset View
Changeset View
Standalone View
Standalone View
src/applications/daemon/event/PhabricatorDaemonEventListener.php
Show All 31 Lines | public function handleEvent(PhutilEvent $event) { | ||||
} | } | ||||
} | } | ||||
private function handleLaunchEvent(PhutilEvent $event) { | private function handleLaunchEvent(PhutilEvent $event) { | ||||
$id = $event->getValue('id'); | $id = $event->getValue('id'); | ||||
$current_user = posix_getpwuid(posix_geteuid()); | $current_user = posix_getpwuid(posix_geteuid()); | ||||
$daemon = id(new PhabricatorDaemonLog()) | $daemon = id(new PhabricatorDaemonLog()) | ||||
->setDaemonID($id) | |||||
->setDaemon($event->getValue('daemonClass')) | ->setDaemon($event->getValue('daemonClass')) | ||||
->setHost(php_uname('n')) | ->setHost(php_uname('n')) | ||||
->setPID(getmypid()) | ->setPID(getmypid()) | ||||
->setRunningAsUser($current_user['name']) | ->setRunningAsUser($current_user['name']) | ||||
->setEnvHash(PhabricatorEnv::calculateEnvironmentHash()) | ->setEnvHash(PhabricatorEnv::calculateEnvironmentHash()) | ||||
->setEnvInfo(PhabricatorEnv::calculateEnvironmentInfo()) | ->setEnvInfo(PhabricatorEnv::calculateEnvironmentInfo()) | ||||
->setStatus(PhabricatorDaemonLog::STATUS_RUNNING) | ->setStatus(PhabricatorDaemonLog::STATUS_RUNNING) | ||||
->setArgv($event->getValue('argv')) | ->setArgv($event->getValue('argv')) | ||||
▲ Show 20 Lines • Show All 61 Lines • ▼ Show 20 Lines | private function handleExitEvent(PhutilEvent $event) { | ||||
unset($this->daemons[$id]); | unset($this->daemons[$id]); | ||||
} | } | ||||
private function getDaemon($id) { | private function getDaemon($id) { | ||||
if (isset($this->daemons[$id])) { | if (isset($this->daemons[$id])) { | ||||
return $this->daemons[$id]; | return $this->daemons[$id]; | ||||
} | } | ||||
throw new Exception("No such daemon '{$id}'!"); | throw new Exception(pht('No such daemon "%s"!', $id)); | ||||
} | } | ||||
} | } |