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