From fd1760bc33514c9d40fe18d5257ac01ae2c86e76 Mon Sep 17 00:00:00 2001 From: doktornotor Date: Sat, 10 Oct 2015 11:29:05 +0200 Subject: Remove 'Clear Cache on Log Rotate' misfeature from local cache settings This has only been a source of complaints, breakage and confusion, plus was breaking Save on the General tab for people. --- config/squid3/34/squid_cache.xml | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/config/squid3/34/squid_cache.xml b/config/squid3/34/squid_cache.xml index 20f62376..ef477bb4 100755 --- a/config/squid3/34/squid_cache.xml +++ b/config/squid3/34/squid_cache.xml @@ -42,7 +42,7 @@ ]]> squidcache - 0.3.5 + 0.3.9.2 Proxy Server: Cache management /usr/local/pkg/squid.inc @@ -216,17 +216,6 @@ - - Clear Cache on Log Rotate - clear_cache - - - Note: This action will be executed automatically if the swap.state file is taking up more than 75% of available space, or the filesystem is 90% full. - ]]> - - checkbox - Level 1 Directories level1_subdirs -- cgit v1.2.3 From f15eb1c05d8c5f3bd0c3040ea9dc65d778f8f670 Mon Sep 17 00:00:00 2001 From: doktornotor Date: Sat, 10 Oct 2015 11:40:59 +0200 Subject: Adjust script for removal of 'Clear Cache on Log Rotate' misfeature --- config/squid3/34/swapstate_check.php | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/config/squid3/34/swapstate_check.php b/config/squid3/34/swapstate_check.php index b144f6d8..22c45f11 100644 --- a/config/squid3/34/swapstate_check.php +++ b/config/squid3/34/swapstate_check.php @@ -44,8 +44,7 @@ if (isset($settings['harddisk_cache_system']) && $settings['harddisk_cache_syste return; } if (substr($cachedir, 0, 11) !== "/var/squid/") { - log_error("swapstate_check.php will NOT manage Squid cache dir '{$cachedir}' since it is not located under /var/squid."); - log_error("Disable 'Clear Cache on Log Rotate' on the 'Local Cache' tab or relocate your cache dir under /var/squid."); + log_error("[squid] swapstate_check.php will NOT manage Squid cache dir '{$cachedir}' since it is not located under /var/squid."); return; } @@ -67,15 +66,12 @@ if (isset($settings['harddisk_cache_system']) && $settings['harddisk_cache_syste if ($swapstate_size > 1024*1024*1024) { $rotate_reason .= "$cachedir/swap.state is larger than 1GB. "; } - if ($settings['clear_cache'] == 'on') { - $rotate_reason .= "'Clear Cache on Log Rotate' is enabled in 'Local Cache' settings. "; - } if ($argv[1] == "clean") { - $rotate_reason .= "Clear cache forced by cronjob. "; + $rotate_reason .= "Clear cache forced by running swapstate_check.php manually with {$argv[1]} argument. "; } if (($swapstate_pct > 75) || (($diskusedpct > 90) && ($swapstate_size > 1024*1024*1024)) || $argv[1] == "clean") { squid_dash_z('clean'); - log_error(gettext(sprintf("$rotate_reason Removing and rotating. File was %d bytes, %d%% of total disk space.", $swapstate_size, $swapstate_pct))); + log_error(gettext(sprintf("[squid] $rotate_reason Removing and rotating. File was %d bytes, %d%% of total disk space.", $swapstate_size, $swapstate_pct))); } } ?> -- cgit v1.2.3 From eb1b3299ae63a7f7933487bee8e9ae3454a11680 Mon Sep 17 00:00:00 2001 From: doktornotor Date: Sat, 10 Oct 2015 11:56:55 +0200 Subject: Remove 'Clear Cache on Log Rotate' misfeature from local cache settings This has only been a source of complaints, breakage and confusion, plus was breaking Save on the General tab for people. --- config/squid3/34/squid.inc | 28 +++++++--------------------- 1 file changed, 7 insertions(+), 21 deletions(-) diff --git a/config/squid3/34/squid.inc b/config/squid3/34/squid.inc index 15854317..cbb24a04 100755 --- a/config/squid3/34/squid.inc +++ b/config/squid3/34/squid.inc @@ -260,7 +260,7 @@ function squid_dash_z($cache_action = 'none') { return; } - // Re-create the cachedir if clean is forced by cronjob/manually, + // Re-create the cachedir if clean is forced by manually, // or if the cachedir changed, or level1_subdirs don't exist or the number of level1_subdirs changed if ($cache_action == "clean" || !is_dir($cachedir) || !is_dir($cachedir . '/00') || $numdirs != $currentdirs) { // cannot nuke disk cache while Squid is running @@ -319,32 +319,15 @@ function squid_create_cachedir() { /* Handle cronjob install/uninstall */ function squid_install_cron($should_install) { - global $config; - if (platform_booting()) { return; } - parse_config(true); - if (is_array($config['installedpackages']['squidcache'])) { - $settings = $config['installedpackages']['squidcache']['config'][0]; - } else { - $settings = array(); - } - - $cron_cmd = ($settings['clear_cache'] == 'on' ? "/usr/local/pkg/swapstate_check.php clean; " : ""); - $cron_cmd .= SQUID_BASE . "/sbin/squid -k rotate -f " . SQUID_CONFFILE; - install_cron_job("{$cron_cmd}", $should_install, "0", "0", "*", "*", "*", "root"); - - $swapstate_cmd = "/usr/local/pkg/swapstate_check.php clean; "; + $cron_cmd = SQUID_BASE . "/sbin/squid -k rotate -f " . SQUID_CONFFILE; if (($should_install) && (squid_enabled())) { - if ($settings['clear_cache'] == 'on' ) { - install_cron_job("{$swapstate_cmd}", true, "*/360"); - } else { - install_cron_job("{$swapstate_cmd}", false); - } + install_cron_job("{$cron_cmd}", $should_install, "0", "0", "*", "*", "*", "root"); } else { - install_cron_job("{$swapstate_cmd}", false); + install_cron_job("{$cron_cmd}", false); } } @@ -507,6 +490,9 @@ function squid_install_command() { // remove unwanted PBI rc script unlink_if_exists("/usr/local/etc/rc.d/squid"); + // remove broken cronjob possibly left over after 'Clear Cache on Log Rotate' misfeature + install_cron_job("/usr/local/pkg/swapstate_check.php clean;", false); + } function squid_deinstall_command() { -- cgit v1.2.3 From 8bc1e775e91439d3abbe30f1da53e11d9e390403 Mon Sep 17 00:00:00 2001 From: doktornotor Date: Sat, 10 Oct 2015 12:06:00 +0200 Subject: Fix freshclam cronjob frequency handling Reported by itsol at https://forum.pfsense.org/index.php?topic=100167.msg561126#msg561126 --- config/squid3/34/squid_antivirus.xml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/config/squid3/34/squid_antivirus.xml b/config/squid3/34/squid_antivirus.xml index e7d046f0..8bcb1652 100755 --- a/config/squid3/34/squid_antivirus.xml +++ b/config/squid3/34/squid_antivirus.xml @@ -42,7 +42,7 @@ ]]> squidantivirus - 0.3.9 + 0.3.9.2 Proxy server: Antivirus /usr/local/pkg/squid.inc @@ -179,13 +179,13 @@ select 0 - + - - + + -- cgit v1.2.3 From 50e1a6c0146b3ca4a6958cf26206e8f2691648a8 Mon Sep 17 00:00:00 2001 From: doktornotor Date: Sat, 10 Oct 2015 12:10:30 +0200 Subject: Fix freshclam cronjob frequency handling Reported by itsol at https://forum.pfsense.org/index.php?topic=100167.msg561126#msg561126 --- config/squid3/34/squid_antivirus.inc | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/config/squid3/34/squid_antivirus.inc b/config/squid3/34/squid_antivirus.inc index a57cb288..03b9e129 100644 --- a/config/squid3/34/squid_antivirus.inc +++ b/config/squid3/34/squid_antivirus.inc @@ -73,15 +73,14 @@ function squid_install_freshclam_cron($should_install) { return; } - if (is_array($config['installedpackages']['squidantivirus'])) { - $antivirus_config = $config['installedpackages']['squidantivirus']['config'][0]; - } else { - $antivirus_config = array(); - } - $freshclam_cmd = (SQUID_BASE . "/bin/freshclam --config-file=" . SQUID_BASE . "/etc/freshclam.conf"); if (($should_install) && (squid_enabled())) { - if ($antivirus_config['clamav_update'] != "0") { + if (is_array($config['installedpackages']['squidantivirus'])) { + $antivirus_config = $config['installedpackages']['squidantivirus']['config'][0]; + } else { + $antivirus_config = array(); + } + if ($antivirus_config['clamav_update'] != "") { log_error("[squid] Adding freshclam cronjob."); $minutes = ($antivirus_config['clamav_update'] * 60); install_cron_job("{$freshclam_cmd}", true, "*/{$minutes}", "*", "*", "*", "*", "clamav"); -- cgit v1.2.3 From d2d55881b7bd9ed59baae9d7323f6e135f138a0e Mon Sep 17 00:00:00 2001 From: doktornotor Date: Sat, 10 Oct 2015 12:14:16 +0200 Subject: Bump squid3 package version --- pkg_config.10.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg_config.10.xml b/pkg_config.10.xml index 6c8c23e3..d4beb247 100644 --- a/pkg_config.10.xml +++ b/pkg_config.10.xml @@ -1052,7 +1052,7 @@ https://forum.pfsense.org/index.php/topic,48347.0.html http://www.squid-cache.org/ Network - 0.3.9.1 + 0.3.9.2 beta 2.2 marcellocoutinho@gmail.com fernando@netfilter.com.br seth.mos@dds.nl mfuchs77@googlemail.com jimp@pfsense.org -- cgit v1.2.3