Add Triggers to Monitors field to quiet error
parent
cdfa565579
commit
04eef58883
|
@ -18,6 +18,7 @@ private $defaults = array(
|
|||
'AnalysisFPS' => null,
|
||||
'CaptureFPS' => null,
|
||||
'ZoneCount' => 0,
|
||||
'Triggers' => null,
|
||||
);
|
||||
private $control_fields = array(
|
||||
'Name' => '',
|
||||
|
@ -126,7 +127,7 @@ private $control_fields = array(
|
|||
if ( is_integer( $IdOrRow ) or is_numeric( $IdOrRow ) ) {
|
||||
$row = dbFetchOne( 'SELECT * FROM Monitors WHERE Id=?', NULL, array( $IdOrRow ) );
|
||||
if ( ! $row ) {
|
||||
Error("Unable to load Server record for Id=" . $IdOrRow );
|
||||
Error("Unable to load Monitor record for Id=" . $IdOrRow );
|
||||
}
|
||||
} elseif ( is_array( $IdOrRow ) ) {
|
||||
$row = $IdOrRow;
|
||||
|
@ -324,8 +325,9 @@ private $control_fields = array(
|
|||
if ( $mode == 'restart' ) {
|
||||
daemonControl( 'stop', 'zmc', $zmcArgs );
|
||||
}
|
||||
if ( $this->{'Function'} != 'None' )
|
||||
if ( $this->{'Function'} != 'None' ) {
|
||||
daemonControl( 'start', 'zmc', $zmcArgs );
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$Server = $this->Server();
|
||||
|
@ -341,6 +343,7 @@ private $control_fields = array(
|
|||
$url = '&user='.$_SESSION['username'];
|
||||
}
|
||||
}
|
||||
Logger::Debug("sending command to $url");
|
||||
$data = array('Monitor[Function]' => $this->{'Function'} );
|
||||
|
||||
// use key 'http' even if you send the request to https://...
|
||||
|
@ -352,10 +355,17 @@ private $control_fields = array(
|
|||
)
|
||||
);
|
||||
$context = stream_context_create($options);
|
||||
$result = file_get_contents($url, false, $context);
|
||||
if ($result === FALSE) { /* Handle error */ }
|
||||
try {
|
||||
$result = file_get_contents($url, false, $context);
|
||||
if ($result === FALSE) { /* Handle error */
|
||||
Error("Error restarting zmc using $url");
|
||||
}
|
||||
} catch ( Exception $e ) {
|
||||
Error("Except $e thrown trying to restart zmc");
|
||||
}
|
||||
}
|
||||
} // end function zmcControl
|
||||
|
||||
function zmaControl( $mode=false ) {
|
||||
if ( (!defined('ZM_SERVER_ID')) or ( ZM_SERVER_ID==$this->{'ServerId'} ) ) {
|
||||
if ( $this->{'Function'} == 'None' || $this->{'Function'} == 'Monitor' || $mode == 'stop' ) {
|
||||
|
|
Loading…
Reference in New Issue