databases/redis: service handling consolidation

This commit is contained in:
Franco Fichtner 2017-12-25 10:41:21 +01:00
parent b3f9954d8e
commit 5480dbc3b9
2 changed files with 30 additions and 29 deletions

View File

@ -1,7 +1,7 @@
<?php
/**
/*
* Copyright (C) 2017 Fabian Franz
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -24,7 +24,6 @@
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*/
namespace OPNsense\Redis\Api;
@ -35,7 +34,6 @@ use \OPNsense\Redis\Redis;
class ServiceController extends ApiControllerBase
{
/**
* restart redis service
* @return array
@ -43,6 +41,8 @@ class ServiceController extends ApiControllerBase
public function restartAction()
{
if ($this->request->isPost()) {
// close session for long running action
$this->sessionClose();
$backend = new Backend();
$response = $backend->configdRun('redis restart');
return array('response' => $response);
@ -115,6 +115,8 @@ class ServiceController extends ApiControllerBase
public function stopAction()
{
if ($this->request->isPost()) {
// close session for long running action
$this->sessionClose();
$backend = new Backend();
$response = $backend->configdRun('redis stop');
return array('response' => $response);
@ -129,6 +131,8 @@ class ServiceController extends ApiControllerBase
public function startAction()
{
if ($this->request->isPost()) {
// close session for long running action
$this->sessionClose();
$backend = new Backend();
$response = $backend->configdRun('redis start');
return array('response' => $response);

View File

@ -77,12 +77,9 @@
draggable: true
});
} else {
// request service status after successful save and update status box (wait a few seconds before update)
setTimeout(function(){
ajaxCall(url="/api/redis/service/status", sendData={}, callback=function(data,status) {
updateServiceStatusUI(data['status']);
});
},3000);
}
});
});