Commit 984522a7 authored by Ad Schellevis's avatar Ad Schellevis

update squid reconfigure action

parent 231f818c
...@@ -98,22 +98,30 @@ class ServiceController extends ApiControllerBase ...@@ -98,22 +98,30 @@ class ServiceController extends ApiControllerBase
*/ */
public function reconfigureAction() public function reconfigureAction()
{ {
// close session for long running action
session_write_close();
$mdlGeneral = new General(); $mdlGeneral = new General();
$backend = new Backend(); $backend = new Backend();
$backend->sendEvent("template reload OPNsense.Proxy");
$runStatus = $this->statusAction(); $runStatus = $this->statusAction();
if ($runStatus['status'] == "running") { // stop squid when disabled
if ($mdlGeneral->enabled->__toString() == 1) { if ($runStatus['status'] == "running" && $mdlGeneral->enabled->__toString() == 0) {
$backend->sendEvent("service reconfigure proxy");
} else {
$this->stopAction(); $this->stopAction();
} }
} elseif ($mdlGeneral->enabled->__toString() == 1) { // generate template
$backend->sendEvent("template reload OPNsense.Proxy");
// (res)start daemon
if ($mdlGeneral->enabled->__toString() == 1) {
if ($runStatus['status'] == "running") {
$backend->sendEvent("service reconfigure proxy");
} else {
$this->startAction(); $this->startAction();
} }
}
return array("status" => "ok"); return array("status" => "ok");
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment