Replace stop action by the reload option in reconfigureForceRestart (#2450)

This commit is contained in:
Neozlag
2021-07-29 14:39:14 +02:00
committed by GitHub
parent 46a44dc064
commit b3d6071534
2 changed files with 10 additions and 21 deletions
@@ -57,27 +57,6 @@ class ServiceController extends ApiMutableServiceControllerBase
* @throws \Exception when configd action fails
* @throws \ReflectionException when model can't be instantiated
*/
public function reconfigureAction()
{
if ($this->request->isPost()) {
$this->sessionClose();
$model = $this->getModel();
$backend = new Backend();
if ($this->reconfigureForceRestart()) {
$backend->configdRun('nginx stop');
}
$backend->configdRun('template reload OPNsense/Nginx');
$runStatus = $this->statusAction();
if ($runStatus['status'] != 'running') {
$backend->configdRun('nginx start');
} else {
$backend->configdRun('nginx reload');
}
return array('status' => 'ok');
} else {
return array('status' => 'failed');
}
}
/**
* retrieve status of service
@@ -117,4 +96,8 @@ class ServiceController extends ApiMutableServiceControllerBase
$this->response->setStatusCode(404, "Not Found");
return array();
}
protected function reconfigureForceRestart() {
return 0;
}
}
@@ -60,3 +60,9 @@ type:script
command:/usr/local/opnsense/scripts/nginx/vts.php
parameters:
type:script_output
[reload]
command:/usr/local/etc/rc.d/nginx reload
parameters:
type:script_output
message:reloading nginx