diff options
author | Phil Davis <phil.davis@inf.org> | 2015-06-28 20:41:36 +0545 |
---|---|---|
committer | Phil Davis <phil.davis@inf.org> | 2015-06-28 20:41:36 +0545 |
commit | 3a0e7e34c9c39fafd935357bed0d4bf27522c42b (patch) | |
tree | 978515eeb83221eb952a852a1e993c0a3a85c4f0 /config/backup | |
parent | efcb133964c38a8e3db7e93a90205b75948c5e05 (diff) | |
download | pfsense-packages-3a0e7e34c9c39fafd935357bed0d4bf27522c42b.tar.gz pfsense-packages-3a0e7e34c9c39fafd935357bed0d4bf27522c42b.tar.bz2 pfsense-packages-3a0e7e34c9c39fafd935357bed0d4bf27522c42b.zip |
Backup pkg check if byte_convert function exists
As reported in forum https://forum.pfsense.org/index.php?topic=95790.0
When Backup and Vhosts package are both installed there can be errors
logged about Cannot redeclare byte_convert().
Diffstat (limited to 'config/backup')
-rw-r--r-- | config/backup/backup.inc | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/config/backup/backup.inc b/config/backup/backup.inc index df508775..748b7fc6 100644 --- a/config/backup/backup.inc +++ b/config/backup/backup.inc @@ -32,16 +32,17 @@ */ -function byte_convert( $bytes ) { - if ($bytes<=0) - return '0 Byte'; - - $convention=1000; //[1000->10^x|1024->2^x] - $s=array('B', 'kB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB'); - $e=floor(log($bytes,$convention)); - return round($bytes/pow($convention,$e),2).' '.$s[$e]; +if (!function_exists("byte_convert")) { + function byte_convert( $bytes ) { + if ($bytes<=0) + return '0 Byte'; + + $convention=1000; //[1000->10^x|1024->2^x] + $s=array('B', 'kB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB'); + $e=floor(log($bytes,$convention)); + return round($bytes/pow($convention,$e),2).' '.$s[$e]; + } } - function backup_sync_package_php() { |