diff options
author | Phil Davis <phil.davis@world.inf.org> | 2012-08-02 13:46:49 +0545 |
---|---|---|
committer | Phil Davis <phil.davis@world.inf.org> | 2012-08-02 13:46:49 +0545 |
commit | 2a315bee5d853c47864a774bfd80e057f49082db (patch) | |
tree | 64c702bc4c515641d250d44a601a6053b62966bd | |
parent | f7c8f633b608ff30e63ff202567a93e15abb72f0 (diff) | |
download | pfsense-2a315bee5d853c47864a774bfd80e057f49082db.zip pfsense-2a315bee5d853c47864a774bfd80e057f49082db.tar.gz |
Tidy up percentage logging to console
When on the console, the code only intended to update the percentage downloaded every 10%. Due to string-and-int type differences, the test was not working, all percentages were being logged. This is fixed.
Also, add a newline after 100% - then whatever outputs next gets a clean start on a new line of output.
Tidies up the console output during a post-firmware-upgrade package install.
-rw-r--r-- | etc/inc/pfsense-utils.inc | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/etc/inc/pfsense-utils.inc b/etc/inc/pfsense-utils.inc index e871cbc..e736710 100644 --- a/etc/inc/pfsense-utils.inc +++ b/etc/inc/pfsense-utils.inc @@ -1674,8 +1674,11 @@ function read_body($ch, $string) { if($lastseen <> $downloadProgress and $downloadProgress < 101) { if($sendto == "status") { if($pkg_interface == "console") { - if(substr($downloadProgress,2,1) == "0" || count($downloadProgress) < 2) { + if(($downloadProgress % 10) == 0 || $downloadProgress < 10) { $tostatus = $static_status . $downloadProgress . "%"; + if ($downloadProgress == 100) { + $tostatus = $tostatus . "\n"; + } update_status($tostatus); } } else { @@ -1684,8 +1687,11 @@ function read_body($ch, $string) { } } else { if($pkg_interface == "console") { - if(substr($downloadProgress,2,1) == "0" || count($downloadProgress) < 2) { + if(($downloadProgress % 10) == 0 || $downloadProgress < 10) { $tooutput = $static_output . $downloadProgress . "%"; + if ($downloadProgress == 100) { + $tostatus = $tostatus . "\n"; + } update_output_window($tooutput); } } else { |