From b3d607153476c13255cb1b043508f18d7a013af8 Mon Sep 17 00:00:00 2001 From: Neozlag <50456371+Neozlag@users.noreply.github.com> Date: Thu, 29 Jul 2021 14:39:14 +0200 Subject: [PATCH] Replace stop action by the reload option in reconfigureForceRestart (#2450) --- .../OPNsense/Nginx/Api/ServiceController.php | 25 +++---------------- .../service/conf/actions.d/actions_nginx.conf | 6 +++++ 2 files changed, 10 insertions(+), 21 deletions(-) diff --git a/www/nginx/src/opnsense/mvc/app/controllers/OPNsense/Nginx/Api/ServiceController.php b/www/nginx/src/opnsense/mvc/app/controllers/OPNsense/Nginx/Api/ServiceController.php index c72fa511c..b783fb05a 100644 --- a/www/nginx/src/opnsense/mvc/app/controllers/OPNsense/Nginx/Api/ServiceController.php +++ b/www/nginx/src/opnsense/mvc/app/controllers/OPNsense/Nginx/Api/ServiceController.php @@ -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; + } } diff --git a/www/nginx/src/opnsense/service/conf/actions.d/actions_nginx.conf b/www/nginx/src/opnsense/service/conf/actions.d/actions_nginx.conf index 73cda1403..8b7d4ebdc 100644 --- a/www/nginx/src/opnsense/service/conf/actions.d/actions_nginx.conf +++ b/www/nginx/src/opnsense/service/conf/actions.d/actions_nginx.conf @@ -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