From 08e2b2389dd192eaacc637fbbb97aa287de8ad0f Mon Sep 17 00:00:00 2001 From: Marcello Coutinho Date: Thu, 3 May 2012 19:15:00 -0300 Subject: sarg - reduce boot process and include startup check --- config/sarg/sarg.inc | 20 ++++++++++++++++++-- pkg_config.8.xml | 2 +- pkg_config.8.xml.amd64 | 2 +- 3 files changed, 20 insertions(+), 4 deletions(-) diff --git a/config/sarg/sarg.inc b/config/sarg/sarg.inc index e762d9b8..48f79917 100644 --- a/config/sarg/sarg.inc +++ b/config/sarg/sarg.inc @@ -32,6 +32,10 @@ */ /* ========================================================================== */ +$uname=posix_uname(); +if ($uname['machine']=='amd64') + ini_set('memory_limit', '250M'); + // STATIC VARS $sarg_proxy=array( 'squid_rc'=>'/usr/local/etc/rc.d/squid.sh', 'squid_config'=>'/var/squid/logs/access.log', @@ -99,8 +103,13 @@ function run_sarg($id=-1) { if ($action =="both" || $action=="rotate"){ log_error('executing squidguard log rotate after sarg.'); log_rotate($sarg_proxy['squidguard_block_log']); + log_error('executing squid log rotate after sarg.'); + file_put_contents($sarg_proxy['squidguard_block_log'],"",LOCK_EX); + chown($sarg_proxy['squidguard_block_log'],'proxy'); + chgrp($sarg_proxy['squidguard_block_log'],'proxy'); + mwexec('squid -k reconfigure'); } - #Leve this case without break to include squid log file on squidguard option + break; case "squid": if ($action =="both" || $action=="rotate"){ log_error('executing squid log rotate after sarg.'); @@ -125,6 +134,13 @@ function run_sarg($id=-1) { function sync_package_sarg() { global $config, $g,$sarg_proxy; + + # detect boot process + if (is_array($_POST)){ + if (!preg_match("/\w+/",$_POST['__csrf_magic'])) + return; + } + $update_conf=0; #mount filesystem writeable conf_mount_rw(); @@ -168,7 +184,7 @@ function sync_package_sarg() { $access_log = $config['installedpackages']['squid']['config'][0]['log_dir']. '/access.log'; break; } - if (!file_exists($access_log)){ + if (!file_exists($access_log) && $access_log !=""){ $error="Sarg config error: ".$sarg['proxy_server']." log file ($access_log) does not exists"; log_error($error); file_notice("Sarg", $error, "Sarg Settings", ""); diff --git a/pkg_config.8.xml b/pkg_config.8.xml index 3254829b..26d07320 100644 --- a/pkg_config.8.xml +++ b/pkg_config.8.xml @@ -552,7 +552,7 @@ http://forum.pfsense.org/index.php/topic,47765.0.html http://e-sac.siteseguro.ws/packages/8/All/ sarg-2.3.2.tbz - 2.3.2 pkg v.0.4.1 + 2.3.2 pkg v.0.4.2 beta 2.0 sarg.xml diff --git a/pkg_config.8.xml.amd64 b/pkg_config.8.xml.amd64 index 01d6bdac..17456ae1 100644 --- a/pkg_config.8.xml.amd64 +++ b/pkg_config.8.xml.amd64 @@ -638,7 +638,7 @@ http://forum.pfsense.org/index.php/topic,47765.0.html http://e-sac.siteseguro.ws/packages/amd64/8/All/ sarg-2.3.2.tbz - 2.3.2 pkg v.0.4.1 + 2.3.2 pkg v.0.4.2 beta 2.0 sarg.xml -- cgit v1.2.3