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