use Object methods to restart zmc and zma. restart them on save of existing Monitor

pull/2077/head
Isaac Connor 2018-01-18 12:40:10 -08:00
parent d1dbf4cc31
commit 773ed11742
1 changed files with 6 additions and 4 deletions

View File

@ -530,6 +530,7 @@ if ( canEdit( 'Monitors' ) ) {
}
}
}
$restart = true;
} elseif ( ! $user['MonitorIds'] ) { // Can only create new monitors if we are not restricted to specific monitors
# FIXME This is actually a race condition. Should lock the table.
$maxSeq = dbFetchOne( 'SELECT max(Sequence) AS MaxSequence FROM Monitors', 'MaxSequence' );
@ -570,15 +571,16 @@ if ( canEdit( 'Monitors' ) ) {
}
if ( $restart ) {
$new_monitor = dbFetchOne( 'SELECT * FROM Monitors WHERE Id = ?', NULL, array($mid) );
$new_monitor = new Monitor($mid);
//fixDevices();
//if ( $cookies )
//session_write_close();
zmcControl( $new_monitor, 'start' );
zmaControl( $new_monitor, 'start' );
$new_monitor->zmcControl('start');
$new_monitor->zmaControl('start');
if ( $new_monitor['Controllable'] ) {
if ( $new_monitor->Controllable() ) {
require_once( 'control_functions.php' );
sendControlCommand( $mid, 'quit' );
}