From fd9bef228d6a4ef3267a2ad1eb594bed90fbc82c Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Sat, 12 Jun 2021 12:21:44 -0400 Subject: [PATCH] It is okay to call daemonControl with function==None for command == stop. All others give a warning. Fixes monitors on other servers not stopping when set to None. --- web/api/app/Model/Monitor.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/web/api/app/Model/Monitor.php b/web/api/app/Model/Monitor.php index cc4ef1375..de9a7685a 100644 --- a/web/api/app/Model/Monitor.php +++ b/web/api/app/Model/Monitor.php @@ -143,28 +143,28 @@ class Monitor extends AppModel { ); public function daemonControl($monitor, $command, $daemon=null) { - if ( $monitor['Function'] == 'None' ) { - ZM\Debug('Calling daemonControl when Function == None'); + if ($monitor['Function'] == 'None' and $command != 'stop') { + ZM\Warning("Calling daemonControl with command $command when Function == None"); return; } - if ( defined('ZM_SERVER_ID') and ($monitor['ServerId']!=ZM_SERVER_ID) ) { + if (defined('ZM_SERVER_ID') and ($monitor['ServerId']!=ZM_SERVER_ID)) { ZM\Error('Calling daemonControl for Monitor assigned to different server. Our server id '.ZM_SERVER_ID.' != '.$monitor['ServerId']); return; } $daemons = array(); - if ( ! $daemon ) { + if (!$daemon) { array_push($daemons, 'zmc'); } else { array_push($daemons, $daemon); } $status_text = ''; - foreach ( $daemons as $daemon ) { + foreach ($daemons as $daemon) { $args = ''; - if ( $daemon == 'zmc' and $monitor['Type'] == 'Local' ) { + if ($daemon == 'zmc' and $monitor['Type'] == 'Local') { $args = '-d ' . $monitor['Device']; - } else if ( $daemon == 'zmcontrol.pl' ) { + } else if ($daemon == 'zmcontrol.pl') { $args = '--id '.$monitor['Id']; } else { $args = '-m ' . $monitor['Id'];