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 | |
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().
-rw-r--r-- | config/backup/backup.inc | 19 | ||||
-rw-r--r-- | pkg_config.10.xml | 2 | ||||
-rw-r--r-- | pkg_config.8.xml | 2 | ||||
-rw-r--r-- | 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 @@ <category>System</category> <pkginfolink></pkginfolink> <config_file>https://packages.pfsense.org/packages/config/backup/backup.xml</config_file> - <version>0.1.6</version> + <version>0.1.7</version> <status>Beta</status> <required_version>2.2</required_version> <maintainer>markjcrane@gmail.com</maintainer> 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 @@ <pkginfolink></pkginfolink> <config_file>https://packages.pfsense.org/packages/config/backup/backup.xml</config_file> <depends_on_package_base_url>https://files.pfsense.org/packages/8/All/</depends_on_package_base_url> - <version>0.1.6</version> + <version>0.1.7</version> <status>Beta</status> <required_version>1.2</required_version> <maintainer>markjcrane@gmail.com</maintainer> 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 @@ <pkginfolink></pkginfolink> <config_file>https://packages.pfsense.org/packages/config/backup/backup.xml</config_file> <depends_on_package_base_url>https://files.pfsense.org/packages/amd64/8/All/</depends_on_package_base_url> - <version>0.1.6</version> + <version>0.1.7</version> <status>Beta</status> <required_version>1.2</required_version> <maintainer>markjcrane@gmail.com</maintainer> |