From 33ceeef3997083d149760ec93072a5241136a9cf Mon Sep 17 00:00:00 2001 From: Franco Fichtner Date: Wed, 10 Jun 2015 09:52:15 +0200 Subject: [PATCH] widgets: tweak the firmware bits of the system widget --- .../widgets/system_information.widget.php | 31 +++++++------------ 1 file changed, 12 insertions(+), 19 deletions(-) diff --git a/src/www/widgets/widgets/system_information.widget.php b/src/www/widgets/widgets/system_information.widget.php index bb1565d7c..4f4fa8f22 100644 --- a/src/www/widgets/widgets/system_information.widget.php +++ b/src/www/widgets/widgets/system_information.widget.php @@ -35,40 +35,35 @@ require_once('notices.inc'); include_once("includes/functions.inc.php"); require_once("script/load_phalcon.php"); -$file_pkg_status="/tmp/pkg_status.json"; if ($_POST['action'] == 'pkg_update') { - /* Setup Shell variables */ - $shell_output = array(); - $shell = new OPNsense\Core\Shell(); - // execute shell command and collect (only valid) info into named array - $shell->exec('/usr/local/opnsense/scripts/pkg_updatecheck.sh', false, $shell_output); + configd_run('firmware pkgstatus'); } +$file_pkg_status="/tmp/pkg_status.json"; if (file_exists($file_pkg_status)) { - $json = file_get_contents($file_pkg_status); - $pkg_status = json_decode($json, true); + $json = file_get_contents($file_pkg_status); + $pkg_status = json_decode($json, true); + unlink($file_pkg_status); } if ($_REQUEST['getupdatestatus']) { - if (file_exists($file_pkg_status)) { + if (isset((:$pkg_status)) { if ($pkg_status["connection"]=="error") { - echo "".gettext("Connection Error")."
".gettext("Click to retry now").""; + echo "".gettext("Connection Error")."
".gettext("Click to retry").""; } elseif ($pkg_status["repository"]=="error") { - echo "".gettext("Repository Problem")."
".gettext("Click to retry now").""; + echo "".gettext("Repository Problem")."
".gettext("Click to retry").""; } elseif ($pkg_status["updates"]=="0") { - echo "".gettext("At")." ".$pkg_status["last_check"]."".gettext(" no updates found.")."
Click to check now"; + echo "".gettext("At")." ".$pkg_status["last_check"]."".gettext(" no updates found.")."
Click to check for updates"; } else { - echo "".gettext("A total of ").$pkg_status["updates"].gettext(" update(s) are available.")."
(When last checked at: ".$pkg_status["last_check"]." )"."

".gettext("Click to upgrade")." | Re-check now"; + echo "".gettext("There are ").$pkg_status["updates"].gettext(" update(s) available.")."
(When last checked at: ".$pkg_status["last_check"]." )"."

".gettext("Click to upgrade")." | Re-check now"; } } else { - echo "".gettext("Unknown")."
".gettext("Click to check now").""; + echo "

".gettext("Click to check for updates").""; } exit; } -$curcfg = $config['system']['firmware']; - $filesystems = get_mounted_filesystems(); ?> @@ -306,15 +301,13 @@ endforeach; ?>