Fixup Monitor->sendControlCommand. start/stop/quit should be run through zmdc.pl now instead of talking directly to zmcontrol.

This commit is contained in:
Isaac Connor 2020-04-29 16:30:59 -04:00
parent 45a445ac48
commit 82188c266e
1 changed files with 14 additions and 10 deletions

View File

@ -495,12 +495,16 @@ class Monitor extends ZM_Object {
} }
} }
if ( !count($options) ) { if ( !count($options) ) {
if ( $command == 'quit' ) {
$options['command'] = 'quit'; if ( $command == 'quit' or $command == 'start' or $command == 'stop' ) {
} else if ( $command == 'start' ) { # These are special as we now run zmcontrol as a daemon through zmdc.
$options['command'] = 'start'; $status = daemonStatus('zmcontrol.pl', array('--id', $this->{'Id'}));
} else if ( $command == 'stop' ) { Logger::Debug("Current status $status");
$options['command'] = 'stop'; if ( $status or ( (!defined('ZM_SERVER_ID')) or ( property_exists($this, 'ServerId') and (ZM_SERVER_ID==$this->{'ServerId'}) ) ) ) {
daemonControl($command, 'zmcontrol.pl', '--id '.$this->{'Id'});
return;
}
$options['command'] = $command;
} else { } else {
Warning("No commands to send to zmcontrol from $command"); Warning("No commands to send to zmcontrol from $command");
return false; return false;
@ -538,12 +542,12 @@ class Monitor extends ZM_Object {
$url = ZM_BASE_PROTOCOL . '://'.$Server->Hostname().'/zm/api/monitors/daemonControl/'.$this->{'Id'}.'/'.$command.'/zmcontrol.pl.json'; $url = ZM_BASE_PROTOCOL . '://'.$Server->Hostname().'/zm/api/monitors/daemonControl/'.$this->{'Id'}.'/'.$command.'/zmcontrol.pl.json';
if ( ZM_OPT_USE_AUTH ) { if ( ZM_OPT_USE_AUTH ) {
if ( ZM_AUTH_RELAY == 'hashed' ) { if ( ZM_AUTH_RELAY == 'hashed' ) {
$url .= '?auth='.generateAuthHash( ZM_AUTH_HASH_IPS ); $url .= '?auth='.generateAuthHash(ZM_AUTH_HASH_IPS);
} else if ( ZM_AUTH_RELAY == 'plain' ) { } else if ( ZM_AUTH_RELAY == 'plain' ) {
$url = '?user='.$_SESSION['username']; $url .= '?user='.$_SESSION['username'];
$url = '?pass='.$_SESSION['password']; $url .= '?pass='.$_SESSION['password'];
} else if ( ZM_AUTH_RELAY == 'none' ) { } else if ( ZM_AUTH_RELAY == 'none' ) {
$url = '?user='.$_SESSION['username']; $url .= '?user='.$_SESSION['username'];
} }
} }
Logger::Debug("sending command to $url"); Logger::Debug("sending command to $url");