From 71c7ca3000bcf2334b5dde3443e0bad2b49bd78d Mon Sep 17 00:00:00 2001 From: Jos Schellevis Date: Tue, 13 Jan 2015 15:18:28 +0000 Subject: [PATCH] Fix bug in previous commit for pkg --- src/www/system_firmware_check.php | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/src/www/system_firmware_check.php b/src/www/system_firmware_check.php index 84992ac06..cc39eb77b 100644 --- a/src/www/system_firmware_check.php +++ b/src/www/system_firmware_check.php @@ -36,8 +36,6 @@ require_once("script/load_phalcon.php"); $file_pkg_status="/tmp/pkg_status.json"; $file_upgrade_progress="/tmp/pkg_upgrade.progress"; -$pkgonly=false; - $pkg_status = array(); if($_POST['action'] == 'pkg_update') { @@ -48,16 +46,12 @@ if($_POST['action'] == 'pkg_update') { $shell->exec("/usr/local/opnsense/scripts/pkg_updatecheck.sh",false,false,$shell_output); } -if($_POST['action'] == 'pkg_upgrade') { +if($_POST['action'] == 'pkg_upgrade' ) { /* Setup Shell variables */ $shell_output = array(); $shell = new OPNsense\Core\Shell(); // execute shell command and collect (only valid) info into named array - if ( $pkgonly == true ) { - $shell->exec("/usr/local/opnsense/scripts/pkg_upgrade.sh pkg > /dev/null 2 > /dev/null < /dev/null &",false,false,$shell_output); - } else { - $shell->exec("/usr/local/opnsense/scripts/pkg_upgrade.sh all > /dev/null 2 > /dev/null < /dev/null &",false,false,$shell_output); - } + $shell->exec("/usr/local/opnsense/scripts/pkg_upgrade.sh ".$_POST['packages']." > /dev/null 2 > /dev/null < /dev/null &",false,false,$shell_output); } if($_POST['action'] == 'update_status' ) { @@ -83,15 +77,14 @@ if($_REQUEST['getupdatestatus']) { echo "".gettext("Repository Problem")."
".gettext("Click to retry now").""; } elseif ($pkg_status["updates"]=="0") { echo "".gettext("At")." ".$pkg_status["last_check"]."".gettext(" no updates found.")."
".gettext("Click to check now").""; - } elseif ( $pkg_status["updates"] == 1 && $pkg_status["upgrade_packages"][0]["name"] == "pkg" ) { + } elseif ( $pkg_status["updates"] == "1" && $pkg_status["upgrade_packages"][0]["name"] == "pkg" ) { echo "".gettext("There is a mandatory update for the package manager."). "(When last checked at: ".$pkg_status["last_check"]." )
". "".gettext("Upgrade pkg and recheck, there maybe other updates available."). - "
".gettext("Upgrade Now"). + "
".gettext("Upgrade Now"). " ".gettext("Re-Check Now").""; - $pkgonly=true; } else { - echo "".gettext("A total of ").$pkg_status["updates"].gettext(" update(s) are available.")."(When last checked at: ".$pkg_status["last_check"]." )"."
".gettext("Upgrade Now")." ".gettext("Re-Check Now").""; + echo "".gettext("A total of ").$pkg_status["updates"].gettext(" update(s) are available.")."(When last checked at: ".$pkg_status["last_check"]." )"."
".gettext("Upgrade Now")." ".gettext("Re-Check Now").""; } } else { echo "".gettext("Current status is unknown")."
".gettext("Click to check now").""; @@ -232,13 +225,13 @@ include("head.inc"); }); } - function upgradenow() { + function upgradenow(data) { jQuery('#updatestatus').html('Starting Upgrade.. Please do not leave this page while upgrade is in progress.'); jQuery('#output').show(); jQuery.ajax({ type: "POST", url: '/system_firmware_check.php', - data:{action:'pkg_upgrade'}, + data:{action: 'pkg_upgrade', packages: data.getAttribute("pkgs") }, success:function(html) { setTimeout(function() { updatestatus(); }, 100); }