From aa8f7da7e20edcae7554ad4b4c221d559eeaa111 Mon Sep 17 00:00:00 2001 From: Pliable Pixels Date: Mon, 8 Jun 2015 14:35:45 +0000 Subject: [PATCH] Fixed daemonStatus API to return string returned by ZMC in addition to true/false so we can handle pending status of a monitor --- web/api/app/Controller/MonitorsController.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/web/api/app/Controller/MonitorsController.php b/web/api/app/Controller/MonitorsController.php index 45306f302..0588a8cc2 100644 --- a/web/api/app/Controller/MonitorsController.php +++ b/web/api/app/Controller/MonitorsController.php @@ -158,11 +158,16 @@ class MonitorsController extends AppController { $status = exec( $command ); // If 'not' is present, the daemon is not running, so return false + // https://github.com/ZoneMinder/ZoneMinder/issues/799#issuecomment-108996075 + // Also sending back the status text so we can check if the monitor is in pending + // state which means there may be an error + $statustext = $status; $status = (strpos($status, 'not')) ? false : true; $this->set(array( 'status' => $status, - '_serialize' => array('status') + 'statustext' => $statustext, + '_serialize' => array('status','statustext'), )); }