Restore api behaviour. Add zmu output to response

This commit is contained in:
Isaac Connor 2021-05-28 12:28:35 -04:00
parent 195f9fc403
commit 8511d814df
1 changed files with 17 additions and 15 deletions

View File

@ -291,16 +291,18 @@ class MonitorsController extends AppController {
$shellcmd = escapeshellcmd(ZM_PATH_BIN."/zmu $verbose -m$id $q $auth");
$status = exec($shellcmd, $output, $rc);
if ($status) {
if ($rc) {
$this->set(array(
'status'=>$rc,
'error'=>$output,
'_serialize' => array('status','error'),
'status'=>'false',
'code' => $rc,
'error'=> implode(PHP_EOL, $output),
'_serialize' => array('status','code','error'),
));
} else {
$this->set(array(
'status' => 'Ok',
'_serialize' => array('status'),
'status' => $status,
'output' => implode(PHP_EOL, $output),
'_serialize' => array('status','output'),
));
}
}