diff --git a/www/c-icap/src/opnsense/mvc/app/controllers/OPNsense/CICAP/Api/AntivirusController.php b/www/c-icap/src/opnsense/mvc/app/controllers/OPNsense/CICAP/Api/AntivirusController.php index b8f5831f1..679f46b73 100644 --- a/www/c-icap/src/opnsense/mvc/app/controllers/OPNsense/CICAP/Api/AntivirusController.php +++ b/www/c-icap/src/opnsense/mvc/app/controllers/OPNsense/CICAP/Api/AntivirusController.php @@ -1,40 +1,37 @@ configdRun("firmware plugin clamav"); return $response; } - - /** - * start cicap service (in background) - * @return array - */ - public function startAction() - { - if ($this->request->isPost()) { - // close session for long running action - $this->sessionClose(); - - $backend = new Backend(); - $response = $backend->configdRun("cicap start"); - return array("response" => $response); - } else { - return array("response" => array()); - } - } - - /** - * stop cicap service - * @return array - */ - public function stopAction() - { - if ($this->request->isPost()) { - // close session for long running action - $this->sessionClose(); - - $backend = new Backend(); - $response = $backend->configdRun("cicap stop"); - return array("response" => $response); - } else { - return array("response" => array()); - } - } - - /** - * restart cicap service - * @return array - */ - public function restartAction() - { - if ($this->request->isPost()) { - // close session for long running action - $this->sessionClose(); - - $backend = new Backend(); - $response = $backend->configdRun("cicap restart"); - return array("response" => $response); - } else { - return array("response" => array()); - } - } - - /** - * retrieve status of cicap - * @return array - * @throws \Exception - */ - public function statusAction() - { - $backend = new Backend(); - $mdlGeneral = new General(); - $response = $backend->configdRun("cicap status"); - - if (strpos($response, "not running") > 0) { - if ($mdlGeneral->enabled->__toString() == 1) { - $status = "stopped"; - } else { - $status = "disabled"; - } - } elseif (strpos($response, "is running") > 0) { - $status = "running"; - } elseif ($mdlGeneral->enabled->__toString() == 0) { - $status = "disabled"; - } else { - $status = "unkown"; - } - - return array("status" => $status); - } - - /** - * reconfigure cicap, generate config and reload - */ - public function reconfigureAction() - { - if ($this->request->isPost()) { - // close session for long running action - $this->sessionClose(); - - $mdlGeneral = new General(); - $backend = new Backend(); - - $runStatus = $this->statusAction(); - - // stop cicap if it is running or not - $this->stopAction(); - - // generate template - $backend->configdRun('template reload OPNsense/CICAP'); - - // (res)start daemon - if ($mdlGeneral->enabled->__toString() == 1) { - $this->startAction(); - } - - return array("status" => "ok"); - } else { - return array("status" => "failed"); - } - } }