aboutsummaryrefslogtreecommitdiffstats
path: root/config/vhosts/vhosts.inc
diff options
context:
space:
mode:
Diffstat (limited to 'config/vhosts/vhosts.inc')
-rw-r--r--config/vhosts/vhosts.inc45
1 files changed, 24 insertions, 21 deletions
diff --git a/config/vhosts/vhosts.inc b/config/vhosts/vhosts.inc
index 5b3d65df..2cdc18b4 100644
--- a/config/vhosts/vhosts.inc
+++ b/config/vhosts/vhosts.inc
@@ -37,32 +37,35 @@
//error_reporting (E_ALL ^ E_NOTICE); // Report everything
error_reporting(E_ALL ^ E_NOTICE ^ E_WARNING ); //hide notices and warnings
-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];
+ }
}
-
//sort array
function sort_host($a, $b){
return strcmp($a["host"], $b["host"]);
@@ -815,4 +818,4 @@ function vhosts_deinstall_command()
config_unlock();
}
-?> \ No newline at end of file
+?>