mirror of
https://github.com/netbirdio/plugins.git
synced 2026-05-22 18:44:07 -07:00
Replace stop action by the reload option in reconfigureForceRestart (#2450)
This commit is contained in:
+4
-21
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user