spacing
This commit is contained in:
parent
aa83239069
commit
381f526d66
|
@ -735,29 +735,29 @@ function buildControlCommand( $monitor ) {
|
||||||
return( $ctrlCommand );
|
return( $ctrlCommand );
|
||||||
}
|
}
|
||||||
|
|
||||||
function sendControlCommand($mid,$command) {
|
function sendControlCommand($mid, $command) {
|
||||||
// Either connects to running zmcontrol.pl or runs zmcontrol.pl to send the command.
|
// Either connects to running zmcontrol.pl or runs zmcontrol.pl to send the command.
|
||||||
$socket = socket_create( AF_UNIX, SOCK_STREAM, 0 );
|
$socket = socket_create(AF_UNIX, SOCK_STREAM, 0);
|
||||||
if ( $socket < 0 ) {
|
if ( $socket < 0 ) {
|
||||||
Fatal( 'socket_create() failed: '.socket_strerror($socket) );
|
Fatal('socket_create() failed: '.socket_strerror($socket));
|
||||||
}
|
}
|
||||||
$sockFile = ZM_PATH_SOCKS.'/zmcontrol-'.$mid.'.sock';
|
$sockFile = ZM_PATH_SOCKS.'/zmcontrol-'.$mid.'.sock';
|
||||||
if ( @socket_connect( $socket, $sockFile ) ) {
|
if ( @socket_connect($socket, $sockFile) ) {
|
||||||
$options = array();
|
$options = array();
|
||||||
foreach ( explode( ' ', $command ) as $option ) {
|
foreach ( explode(' ', $command) as $option ) {
|
||||||
if ( preg_match( '/--([^=]+)(?:=(.+))?/', $option, $matches ) ) {
|
if ( preg_match('/--([^=]+)(?:=(.+))?/', $option, $matches) ) {
|
||||||
$options[$matches[1]] = $matches[2]?$matches[2]:1;
|
$options[$matches[1]] = $matches[2]?$matches[2]:1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$optionString = jsonEncode( $options );
|
$optionString = jsonEncode($options);
|
||||||
if ( !socket_write( $socket, $optionString ) ) {
|
if ( !socket_write($socket, $optionString) ) {
|
||||||
Fatal( "Can't write to control socket: ".socket_strerror(socket_last_error($socket)) );
|
Fatal("Can't write to control socket: ".socket_strerror(socket_last_error($socket)));
|
||||||
}
|
}
|
||||||
socket_close( $socket );
|
socket_close($socket);
|
||||||
} else if ( $command != 'quit' ) {
|
} else if ( $command != 'quit' ) {
|
||||||
$command .= ' --id='.$mid;
|
$command .= ' --id='.$mid;
|
||||||
|
|
||||||
// Can't connect so use script
|
// Can't connect so use script
|
||||||
$ctrlOutput = exec( escapeshellcmd( $command ) );
|
$ctrlOutput = exec(escapeshellcmd($command));
|
||||||
}
|
}
|
||||||
} // end function sendControlCommand( $mid, $command )
|
} // end function sendControlCommand($mid, $command)
|
||||||
|
|
Loading…
Reference in New Issue