Changeset View
Changeset View
Standalone View
Standalone View
src/infrastructure/daemon/control/PhabricatorDaemonReference.php
| Show All 21 Lines | public static function newFromFile($path) { | ||||
| $ref = self::newFromDictionary($dict); | $ref = self::newFromDictionary($dict); | ||||
| $ref->pidFile = $path; | $ref->pidFile = $path; | ||||
| return $ref; | return $ref; | ||||
| } | } | ||||
| public static function newFromDictionary(array $dict) { | public static function newFromDictionary(array $dict) { | ||||
| $ref = new PhabricatorDaemonReference(); | $ref = new PhabricatorDaemonReference(); | ||||
| // TODO: This is a little rough during the transition from one-to-one | |||||
| // overseers to one-to-many. | |||||
| $config = idx($dict, 'config', array()); | |||||
| $daemon_list = null; | |||||
| if ($config) { | |||||
| $daemon_list = idx($config, 'daemons'); | |||||
| } | |||||
| if ($daemon_list) { | |||||
| $ref->name = pht('Overseer Daemon Group'); | |||||
| $ref->argv = array(); | |||||
| } else { | |||||
| $ref->name = idx($dict, 'name', 'Unknown'); | $ref->name = idx($dict, 'name', 'Unknown'); | ||||
| $ref->argv = idx($dict, 'argv', array()); | $ref->argv = idx($dict, 'argv', array()); | ||||
| } | |||||
| $ref->pid = idx($dict, 'pid'); | $ref->pid = idx($dict, 'pid'); | ||||
| $ref->start = idx($dict, 'start'); | $ref->start = idx($dict, 'start'); | ||||
| try { | try { | ||||
| $ref->daemonLog = id(new PhabricatorDaemonLog())->loadOneWhere( | $ref->daemonLog = id(new PhabricatorDaemonLog())->loadOneWhere( | ||||
| 'daemon = %s AND pid = %d AND dateCreated = %d', | 'daemon = %s AND pid = %d AND dateCreated = %d', | ||||
| $ref->name, | $ref->name, | ||||
| $ref->pid, | $ref->pid, | ||||
| ▲ Show 20 Lines • Show All 118 Lines • Show Last 20 Lines | |||||