diff options
Diffstat (limited to 'config/lightsquid')
-rw-r--r-- | config/lightsquid/lightsquid.inc | 45 | ||||
-rw-r--r-- | config/lightsquid/lightsquid.xml | 4 | ||||
-rw-r--r-- | config/lightsquid/sqstat.class.php | 4 |
3 files changed, 46 insertions, 7 deletions
diff --git a/config/lightsquid/lightsquid.inc b/config/lightsquid/lightsquid.inc index 4b31bc30..054713a1 100644 --- a/config/lightsquid/lightsquid.inc +++ b/config/lightsquid/lightsquid.inc @@ -45,8 +45,11 @@ switch ($pfs_version) { case "2.0": define('LIGHTSQUID_BASE','/usr/local'); break; - default: + case "2.1": define('LIGHTSQUID_BASE', '/usr/pbi/lightsquid-' . php_uname("m")); + break; + default: + define('LIGHTSQUID_BASE', '/usr/pbi/lightsquid-' . php_uname("m") . '/local'); } define ('CMD_PKGDELETE', 'pkg_delete lightsquid-1.7.1'); @@ -117,19 +120,38 @@ function lightsquid_install() { // create lightsquid report catalog if (!file_exists(LS_REPORTPATH)) { update_log("lightsquid_install: Create report dir " . LS_REPORTPATH); - mwexec("mkdir -p " . LS_REPORTPATH); + mwexec("/bin/mkdir -p " . LS_REPORTPATH); } // install templates $lstpl_file = "/var/tmp/lightsquid_tpl.tbz"; if (file_exists($lstpl_file)) { - mwexec("tar zxvf $lstpl_file -C " . LS_TEMPLATEPATH); + mwexec("/usr/bin/tar zxvf $lstpl_file -C " . LS_TEMPLATEPATH); update_log("lightsquid_install: Install templates from $lstpl_file"); } # check perl - if (!file_exists("/usr/bin/perl")) - mwexec("ln -s /usr/local/bin/perl /usr/bin/perl"); + $perl_path = '/usr/bin/perl'; + + /* Clean up a bad perl link. */ + ls_cleanup_bad_link($perl_path); + + if (!file_exists("/usr/bin/perl")) { + if (is_executable('/usr/local/bin/perl')) { + symlink('/usr/local/bin/perl', '/usr/bin/perl'); + } elseif (is_executable(LIGHTSQUID_BASE . '/bin/perl')) { + symlink(LIGHTSQUID_BASE . '/bin/perl', '/usr/bin/perl'); + } + } + if (!is_dir('/usr/local/lib/perl5') && is_dir(LIGHTSQUID_BASE . '/lib/perl5')) { + symlink(LIGHTSQUID_BASE . '/lib/perl5', '/usr/local/lib/perl5'); + } + if (!is_dir('/usr/local/etc/lightsquid') && is_dir(LS_CONFIGPATH)) { + symlink(LS_CONFIGPATH, '/usr/local/etc/lightsquid'); + } + if (!is_dir('/usr/local/www/lightsquid') && is_dir(LS_WWWPATH)) { + symlink(LS_WWWPATH, '/usr/local/www/lightsquid'); + } update_log("lightsquid_install: stopped"); } @@ -153,6 +175,9 @@ function lightsquid_resync() { if (!file_exists("/usr/bin/perl")) mwexec("ln -s /usr/local/bin/perl /usr/bin/perl"); + // Fixup library path so GD can find its libraries for graphs. + mwexec("/sbin/ldconfig -m " . LIGHTSQUID_BASE . "/lib/"); + // create lightsquid report catalog if (!file_exists(LS_REPORTPATH)) { update_log("lightsquid_install: Create report dir " . LS_REPORTPATH); @@ -436,4 +461,14 @@ function ls_get_real_interface_address($iface) return array($ip, long2ip(hexdec($netmask))); } +/* If a path is a symlink but the target is missing, remove the link. */ +function ls_cleanup_bad_link($link) { + if (file_exists($link) && is_link($link)) { + $target = readlink($link); + if (!file_exists($target) || !is_executable($target)) { + unlink($link); + } + } +} + ?>
\ No newline at end of file diff --git a/config/lightsquid/lightsquid.xml b/config/lightsquid/lightsquid.xml index 8b5b9ae9..63eaabe4 100644 --- a/config/lightsquid/lightsquid.xml +++ b/config/lightsquid/lightsquid.xml @@ -7,7 +7,7 @@ /* $Id$ */ /* ========================================================================== */ /* - authng.xml + lightsquid.xml part of pfSense (http://www.pfSense.com) Copyright (C) 2007 to whom it may belong All rights reserved. @@ -46,7 +46,7 @@ <requirements>Describe your package requirements here</requirements> <faq>Currently there are no FAQ items provided.</faq> <name>lightsquid</name> - <version>1.7.1</version> + <version>1.8.2 pkg v.2.35</version> <title>Services: Proxy Reports (LightSquid, SQStat) -> Settings</title> <category>Status</category> <include_file>/usr/local/pkg/lightsquid.inc</include_file> diff --git a/config/lightsquid/sqstat.class.php b/config/lightsquid/sqstat.class.php index 5707e051..88a5cfce 100644 --- a/config/lightsquid/sqstat.class.php +++ b/config/lightsquid/sqstat.class.php @@ -202,8 +202,12 @@ class squidstat{ } if ($connection) { # username field is avaible in Squid 2.6 stable + # peer changed to remote in Squid 3.2 or later + # me changed to local in Squid 3.2 or later if(substr($v,0,9) == "username ") $parsed["con"][$connection]["username"] = substr($v, 9); + if(substr($v,0,7) == "remote:") $parsed["con"][$connection]["peer"] = substr($v, 8); if(substr($v,0,5) == "peer:") $parsed["con"][$connection]["peer"] = substr($v, 6); + if(substr($v,0,6) == "local:") $parsed["con"][$connection]["me"] = substr($v, 7); if(substr($v,0,3) == "me:") $parsed["con"][$connection]["me"] = substr($v, 4); if(substr($v,0,4) == "uri ") $parsed["con"][$connection]["uri"] = substr($v, 4); if(substr($v,0,10) == "delay_pool") $parsed["con"][$connection]["delay_pool"] = substr($v, 11); |