tell zmc and zma to stop before updating db

This commit is contained in:
Isaac Connor 2017-01-30 16:37:53 -05:00
parent fe3328a87a
commit fda115bebe
1 changed files with 14 additions and 12 deletions

View File

@ -440,6 +440,10 @@ if ( !empty($action) ) {
if ( count( $changes ) ) { if ( count( $changes ) ) {
if ( $mid ) { if ( $mid ) {
# If we change anything that changes the shared mem size, zma can complain. So let's stop first.
zmaControl( $monitor, 'stop' );
zmcControl( $monitor, 'stop' );
dbQuery( 'UPDATE Monitors SET '.implode( ", ", $changes ).' WHERE Id =?', array($mid) ); dbQuery( 'UPDATE Monitors SET '.implode( ", ", $changes ).' WHERE Id =?', array($mid) );
if ( isset($changes['Name']) ) { if ( isset($changes['Name']) ) {
$saferOldName = basename( $monitor['Name'] ); $saferOldName = basename( $monitor['Name'] );
@ -522,17 +526,15 @@ if ( !empty($action) ) {
//fixDevices(); //fixDevices();
//if ( $cookies ) //if ( $cookies )
//session_write_close(); //session_write_close();
if ( daemonCheck() ) {
zmaControl( $monitor, 'stop' );
zmcControl( $monitor, 'stop' );
zmcControl( $new_monitor, 'start' ); zmcControl( $new_monitor, 'start' );
zmaControl( $new_monitor, 'start' ); zmaControl( $new_monitor, 'start' );
}
if ( $monitor['Controllable'] ) { if ( $monitor['Controllable'] ) {
require_once( 'control_functions.php' ); require_once( 'control_functions.php' );
sendControlCommand( $mid, 'quit' ); sendControlCommand( $mid, 'quit' );
} }
// really should thump zmwatch and maybe zmtrigger too.
//daemonControl( 'restart', 'zmwatch.pl' ); //daemonControl( 'restart', 'zmwatch.pl' );
$refreshParent = true; $refreshParent = true;
} // end if restart } // end if restart
@ -567,12 +569,12 @@ if ( !empty($action) ) {
deletePath( ZM_DIR_EVENTS.'/'.basename($monitor['Name']) ); deletePath( ZM_DIR_EVENTS.'/'.basename($monitor['Name']) );
deletePath( ZM_DIR_EVENTS.'/'.$monitor['Id'] ); // I'm trusting the Id. deletePath( ZM_DIR_EVENTS.'/'.$monitor['Id'] ); // I'm trusting the Id.
} } // end if ZM_OPT_FAST_DELETE
} } // end if found the monitor in the db
} } // end if canedit this monitor
} } // end foreach monitor in MarkMid
} } // markMids is set and we aren't limited to specific monitors
} } // end if action == Delete
} }
// Device view actions // Device view actions