From d222879577b670475a052f550901da0a0ff6eee5 Mon Sep 17 00:00:00 2001 From: Franco Fichtner Date: Thu, 26 Apr 2018 06:55:12 +0000 Subject: [PATCH] mvc: small audit on configdRun(), only use when needed --- .../Diagnostics/Api/ActivityController.php | 54 +++++++++---------- .../Diagnostics/Api/InterfaceController.php | 10 ++-- .../Api/SystemhealthController.php | 6 +-- 3 files changed, 34 insertions(+), 36 deletions(-) diff --git a/src/opnsense/mvc/app/controllers/OPNsense/Diagnostics/Api/ActivityController.php b/src/opnsense/mvc/app/controllers/OPNsense/Diagnostics/Api/ActivityController.php index 8239f8b22..94ce35a1d 100644 --- a/src/opnsense/mvc/app/controllers/OPNsense/Diagnostics/Api/ActivityController.php +++ b/src/opnsense/mvc/app/controllers/OPNsense/Diagnostics/Api/ActivityController.php @@ -1,32 +1,30 @@ configdpRun("system diag activity json"); + $response = $backend->configdRun('system diag activity json'); $activity = json_decode($response, true); return $activity; diff --git a/src/opnsense/mvc/app/controllers/OPNsense/Diagnostics/Api/InterfaceController.php b/src/opnsense/mvc/app/controllers/OPNsense/Diagnostics/Api/InterfaceController.php index 0e5575b28..d4edce5fc 100644 --- a/src/opnsense/mvc/app/controllers/OPNsense/Diagnostics/Api/InterfaceController.php +++ b/src/opnsense/mvc/app/controllers/OPNsense/Diagnostics/Api/InterfaceController.php @@ -70,7 +70,7 @@ class InterfaceController extends ApiControllerBase public function getArpAction() { $backend = new Backend(); - $response = $backend->configdpRun("interface list arp json"); + $response = $backend->configdRun('interface list arp json'); $arptable = json_decode($response, true); $intfmap = $this->getInterfaceNames(); @@ -96,7 +96,7 @@ class InterfaceController extends ApiControllerBase { if ($this->request->isPost()) { $backend = new Backend(); - $response = $backend->configdpRun("interface flush arp"); + $response = $backend->configdRun('interface flush arp'); return $response; } else { return array("message" => "error"); @@ -110,7 +110,7 @@ class InterfaceController extends ApiControllerBase public function getNdpAction() { $backend = new Backend(); - $response = $backend->configdpRun("interface list ndp json"); + $response = $backend->configdRun('interface list ndp json'); $ndptable = json_decode($response, true); $intfmap = $this->getInterfaceNames(); @@ -136,9 +136,9 @@ class InterfaceController extends ApiControllerBase { $backend = new Backend(); if (empty($this->request->get('resolve'))) { - $response = $backend->configdpRun("interface routes list -n json"); + $response = $backend->configdRun('interface routes list -n json'); } else { - $response = $backend->configdpRun("interface routes list json"); + $response = $backend->configdRun('interface routes list json'); } $routingtable = json_decode($response, true); diff --git a/src/opnsense/mvc/app/controllers/OPNsense/Diagnostics/Api/SystemhealthController.php b/src/opnsense/mvc/app/controllers/OPNsense/Diagnostics/Api/SystemhealthController.php index 1b93fd64d..66fe4b687 100644 --- a/src/opnsense/mvc/app/controllers/OPNsense/Diagnostics/Api/SystemhealthController.php +++ b/src/opnsense/mvc/app/controllers/OPNsense/Diagnostics/Api/SystemhealthController.php @@ -450,7 +450,7 @@ class SystemhealthController extends ApiControllerBase # Source of data: xml fields of corresponding .xml metadata $result = array(); $backend = new Backend(); - $response = $backend->configdpRun("systemhealth list"); + $response = $backend->configdRun('systemhealth list'); $healthList = json_decode($response, true); // search by topic and name, return array with filename if (is_array($healthList)) { @@ -480,7 +480,7 @@ class SystemhealthController extends ApiControllerBase # Source of data: filelisting of /var/db/rrd/*.rrd $result = array(); $backend = new Backend(); - $response = $backend->configdpRun("systemhealth list"); + $response = $backend->configdRun('systemhealth list'); $healthList = json_decode($response, true); $result['data'] = array(); @@ -530,7 +530,7 @@ class SystemhealthController extends ApiControllerBase $xml = false; if ($rrd_details['filename'] != "") { $backend = new Backend(); - $response = $backend->configdpRun("systemhealth fetch ", array($rrd_details['filename'])); + $response = $backend->configdpRun('systemhealth fetch', array($rrd_details['filename'])); if ($response != null) { $xml = @simplexml_load_string($response); }