diff options
author | Ermal <eri@pfsense.org> | 2010-12-10 12:48:58 +0000 |
---|---|---|
committer | Ermal <eri@pfsense.org> | 2010-12-10 12:48:58 +0000 |
commit | 9a77cafd7e400640a855f8f5112dd59c93af92a7 (patch) | |
tree | aa2ee03075b503a42890763f82aa2593a64fca8a | |
parent | 806db0240fa060b9ceb197fbc636be8bf916d95c (diff) | |
download | pfsense-packages-9a77cafd7e400640a855f8f5112dd59c93af92a7.tar.gz pfsense-packages-9a77cafd7e400640a855f8f5112dd59c93af92a7.tar.bz2 pfsense-packages-9a77cafd7e400640a855f8f5112dd59c93af92a7.zip |
Fix all this packages from their copy/paste legacy. Mostly protect poorly choosen function names with function_exists.
-rw-r--r-- | config/dnsblacklist/dnsblacklist.inc | 21 | ||||
-rw-r--r-- | config/freeswitch/freeswitch.inc | 28 | ||||
-rw-r--r-- | config/freeswitch_dev/v_config.inc | 28 | ||||
-rw-r--r-- | config/phpservice/phpservice.inc | 48 | ||||
-rw-r--r-- | config/shellcmd/shellcmd.inc | 34 | ||||
-rw-r--r-- | config/vhosts/vhosts.inc | 45 |
6 files changed, 98 insertions, 106 deletions
diff --git a/config/dnsblacklist/dnsblacklist.inc b/config/dnsblacklist/dnsblacklist.inc index 4ec8e095..d9c7f364 100644 --- a/config/dnsblacklist/dnsblacklist.inc +++ b/config/dnsblacklist/dnsblacklist.inc @@ -31,21 +31,6 @@ 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; - } -} - function byte_convert( $bytes ) { if ($bytes<=0) return '0 Byte'; @@ -102,10 +87,6 @@ function dnsblacklist_install_command() //$handle = popen("/usr/local/etc/rc.d/phpservice.sh start", "r"); //pclose($handle); - //if (pkg_is_service_running('phpservice')) { - //documentation purposes - //} - conf_mount_ro(); config_unlock(); } @@ -122,4 +103,4 @@ function dnsblacklist_deinstall_command() conf_mount_ro(); } -?>
\ No newline at end of file +?> diff --git a/config/freeswitch/freeswitch.inc b/config/freeswitch/freeswitch.inc index 147125a7..0c073487 100644 --- a/config/freeswitch/freeswitch.inc +++ b/config/freeswitch/freeswitch.inc @@ -131,19 +131,21 @@ function guid() //echo guid(); -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(pkg_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(pkg_is_service_running($servicename, $ps) or is_process_running($servicename) ) { + return true; + //} + //else { + // return false; + //} + } } diff --git a/config/freeswitch_dev/v_config.inc b/config/freeswitch_dev/v_config.inc index a508cefc..49e05642 100644 --- a/config/freeswitch_dev/v_config.inc +++ b/config/freeswitch_dev/v_config.inc @@ -186,19 +186,21 @@ function guid() //echo guid(); -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(pkg_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(pkg_is_service_running($servicename, $ps) or is_process_running($servicename) ) { + return true; + //} + //else { + // return false; + //} + } } 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 +?> diff --git a/config/shellcmd/shellcmd.inc b/config/shellcmd/shellcmd.inc index 4d9a82ca..c7f50202 100644 --- a/config/shellcmd/shellcmd.inc +++ b/config/shellcmd/shellcmd.inc @@ -31,21 +31,23 @@ POSSIBILITY OF SUCH DAMAGE. */ -require("services.inc"); - -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; - } +require_once("services.inc"); + +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 shellcmd_sync_package() @@ -118,4 +120,4 @@ function shellcmd_deinstall_command() } -?>
\ No newline at end of file +?> 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 +?> |