From 3a0e7e34c9c39fafd935357bed0d4bf27522c42b Mon Sep 17 00:00:00 2001 From: Phil Davis Date: Sun, 28 Jun 2015 20:41:36 +0545 Subject: 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(). --- config/backup/backup.inc | 19 ++++++++++--------- pkg_config.10.xml | 2 +- pkg_config.8.xml | 2 +- pkg_config.8.xml.amd64 | 2 +- 4 files changed, 13 insertions(+), 12 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() { diff --git a/pkg_config.10.xml b/pkg_config.10.xml index aa5cf664..516ac84a 100644 --- a/pkg_config.10.xml +++ b/pkg_config.10.xml @@ -355,7 +355,7 @@ System https://packages.pfsense.org/packages/config/backup/backup.xml - 0.1.6 + 0.1.7 Beta 2.2 markjcrane@gmail.com diff --git a/pkg_config.8.xml b/pkg_config.8.xml index b7bf2019..b9038685 100644 --- a/pkg_config.8.xml +++ b/pkg_config.8.xml @@ -445,7 +445,7 @@ https://packages.pfsense.org/packages/config/backup/backup.xml https://files.pfsense.org/packages/8/All/ - 0.1.6 + 0.1.7 Beta 1.2 markjcrane@gmail.com diff --git a/pkg_config.8.xml.amd64 b/pkg_config.8.xml.amd64 index bbeb5449..af1cf24b 100644 --- a/pkg_config.8.xml.amd64 +++ b/pkg_config.8.xml.amd64 @@ -432,7 +432,7 @@ https://packages.pfsense.org/packages/config/backup/backup.xml https://files.pfsense.org/packages/amd64/8/All/ - 0.1.6 + 0.1.7 Beta 1.2 markjcrane@gmail.com -- cgit v1.2.3