From 38636a39cf2dca001156d209deccef7fde19d91a Mon Sep 17 00:00:00 2001 From: epriestley Date: Mon, 23 Feb 2015 18:46:24 -0800 Subject: [PATCH] Allow modern `phd stop` to stop old daemons cleanly Summary: Ref T7352. Make sure modern `phd stop` can still read the old PID file format and stop the daemons, at least for now. Without this, `stop` still detects them and tells you to `stop --force`, which works, but this makes things a good deal cleaner. Test Plan: Ran `phd stop` from master, then `phd stop` from this revision. Saw old daemons stop cleanly. Reviewers: btrahan Reviewed By: btrahan Subscribers: epriestley Maniphest Tasks: T7352 Differential Revision: https://secure.phabricator.com/D11873 --- .../daemon/control/PhabricatorDaemonReference.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/infrastructure/daemon/control/PhabricatorDaemonReference.php b/src/infrastructure/daemon/control/PhabricatorDaemonReference.php index 4b6fe1182f..bb09082ad9 100644 --- a/src/infrastructure/daemon/control/PhabricatorDaemonReference.php +++ b/src/infrastructure/daemon/control/PhabricatorDaemonReference.php @@ -40,6 +40,20 @@ final class PhabricatorDaemonReference { $logs = mpull($logs, null, 'getDaemonID'); } + // Support PID files that use the old daemon format, where each overseer + // had exactly one daemon. We can eventually remove this; they will still + // be stopped by `phd stop --force` even if we don't identify them here. + if (!$daemons && idx($dict, 'name')) { + $daemons = array( + array( + 'config' => array( + 'class' => idx($dict, 'name'), + 'argv' => idx($dict, 'argv', array()), + ), + ), + ); + } + foreach ($daemons as $daemon) { $ref = new PhabricatorDaemonReference();