aboutsummaryrefslogtreecommitdiffstats
path: root/config
diff options
context:
space:
mode:
authordoktornotor <notordoktor@gmail.com>2015-09-30 12:11:10 +0200
committerdoktornotor <notordoktor@gmail.com>2015-09-30 12:11:10 +0200
commitf7dbbd45e8f68d52cd46b1ae0d552d0bac66e3d5 (patch)
tree0a0d5d2579f9d08f3ae6cf804f15269702dc7aa1 /config
parentd73dc9987b4d75f77246d4821c3704031b8fbc5a (diff)
downloadpfsense-packages-f7dbbd45e8f68d52cd46b1ae0d552d0bac66e3d5.tar.gz
pfsense-packages-f7dbbd45e8f68d52cd46b1ae0d552d0bac66e3d5.tar.bz2
pfsense-packages-f7dbbd45e8f68d52cd46b1ae0d552d0bac66e3d5.zip
Also check for level 1 subdirs in cachedir for proper cache creation
Diffstat (limited to 'config')
-rwxr-xr-xconfig/squid3/34/squid.inc11
1 files changed, 9 insertions, 2 deletions
diff --git a/config/squid3/34/squid.inc b/config/squid3/34/squid.inc
index 0faba446..7d2b08b7 100755
--- a/config/squid3/34/squid.inc
+++ b/config/squid3/34/squid.inc
@@ -130,13 +130,20 @@ function squid_dash_z($cache_action = 'none') {
$cachesettings = array();
}
$cachedir = ($cachesettings['harddisk_cache_location'] ? $cachesettings['harddisk_cache_location'] : '/var/squid/cache');
+ $numdirs = ($cachesettings['level1_subdirs'] ? $cachesettings['level1_subdirs'] : 16);
+ if (is_dir($cachedir)) {
+ $currentdirs = count(glob("{$cachedir}/*", GLOB_ONLYDIR));
+ } else {
+ $currentdirs = 0;
+ }
// If the cache system is null, there is no need to initialize the (irrelevant) cache dir.
if ($cachesettings['harddisk_cache_system'] == "null") {
return;
}
-
- if ($cache_action == "clean" || (!is_dir($cachedir))) {
+ // Re-create the cachedir if clean is forced by cronjob/manually, or
+ // 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
squid_stop_monitor();
if (is_service_running('squid')) {