From 9a77cafd7e400640a855f8f5112dd59c93af92a7 Mon Sep 17 00:00:00 2001 From: Ermal Date: Fri, 10 Dec 2010 12:48:58 +0000 Subject: Fix all this packages from their copy/paste legacy. Mostly protect poorly choosen function names with function_exists. --- config/phpservice/phpservice.inc | 48 +++++++++++++++++++++------------------- 1 file changed, 25 insertions(+), 23 deletions(-) (limited to 'config/phpservice') diff --git a/config/phpservice/phpservice.inc b/config/phpservice/phpservice.inc index d346713a..6236d0b6 100644 --- a/config/phpservice/phpservice.inc +++ b/config/phpservice/phpservice.inc @@ -31,32 +31,34 @@ POSSIBILITY OF SUCH DAMAGE. */ -function pkg_is_service_running($servicename) -{ - exec("/bin/ps ax | awk '{ print $5 }'", $psout); - array_shift($psout); - foreach($psout as $line) { - $ps[] = trim(array_pop(explode(' ', array_pop(explode('/', $line))))); - } - if(is_service_running($servicename, $ps) or is_process_running($servicename) ) { - return true; - } - else { - return false; - } +if (!function_exists("pkg_is_service_running")) { + function pkg_is_service_running($servicename) + { + exec("/bin/ps ax | awk '{ print $5 }'", $psout); + array_shift($psout); + foreach($psout as $line) { + $ps[] = trim(array_pop(explode(' ', array_pop(explode('/', $line))))); + } + if(is_service_running($servicename, $ps) or is_process_running($servicename) ) { + return true; + } + else { + return false; + } + } } -function byte_convert( $bytes ) { - - if ($bytes<=0) - return '0 Byte'; +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]; + $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 phpservice_sync_package_php() { @@ -223,4 +225,4 @@ function phpservice_deinstall_command() } -?> \ No newline at end of file +?> -- cgit v1.2.3