diff options
author | Colin Smith <colin@pfsense.org> | 2005-06-20 04:12:08 +0000 |
---|---|---|
committer | Colin Smith <colin@pfsense.org> | 2005-06-20 04:12:08 +0000 |
commit | f0a550fd7fc3a03893a9dd712dec3db397467c54 (patch) | |
tree | 56f93d9711566676bf6d1ea2481370cdd0e48ca1 /etc/inc | |
parent | b8a1c2a3b311a10be9476245c7869e01999e2508 (diff) | |
download | pfsense-f0a550fd7fc3a03893a9dd712dec3db397467c54.zip pfsense-f0a550fd7fc3a03893a9dd712dec3db397467c54.tar.gz |
Properly squash bytes down to a reasonable unit.
Diffstat (limited to 'etc/inc')
-rw-r--r-- | etc/inc/pkg-utils.inc | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/etc/inc/pkg-utils.inc b/etc/inc/pkg-utils.inc index 21d1cd3..3ecf4f2 100644 --- a/etc/inc/pkg-utils.inc +++ b/etc/inc/pkg-utils.inc @@ -778,7 +778,6 @@ function walk_depend($depend, $pkgdb = "", $alreadyseen = "") { continue; } } - print $size; return $size; } @@ -794,4 +793,16 @@ function get_package_install_size($pkg = 'all', $pkg_info = "") { } return $toreturn; } + +function squash_from_bytes($size) { + $conv = array(1 => "B", "K", "M", "G"); + print_r($conv); + foreach($conv as $div => $suffix) { + $sizeorig = $size; + if(($size /= 1024) < 1) { + return $sizeorig . $suffix; + } + } + return; +} ?> |