firmware: rework previous, status action on POST is sync

This commit is contained in:
Franco Fichtner 2021-03-29 12:10:10 +02:00
parent 9541c1f963
commit 63af98ed5b

View File

@ -65,14 +65,14 @@ class FirmwareController extends ApiControllerBase
* Run check for updates
* @return array
*/
public function checkAction($sync)
public function checkAction()
{
$this->sessionClose(); // long running action, close session
$response = [];
if ($this->request->isPost()) {
$backend = new Backend();
$response['msg_uuid'] = trim($backend->configdRun('firmware check', empty($sync) ? true : false));
$response['msg_uuid'] = trim($backend->configdRun('firmware check', true));
$response['status'] = 'ok';
} else {
$response['status'] = 'failure';
@ -94,6 +94,12 @@ class FirmwareController extends ApiControllerBase
$backend = new Backend();
$target = null;
$this->sessionClose(); // long running action, close session
if ($this->request->isPost()) {
$backend->configdRun('firmware check');
}
$response = json_decode(trim($backend->configdRun('firmware product')), true);
if ($response != null && $response['product_check'] != null) {
$response = $response['product_check'];