From 303a7bd04de24c5bd2092c4d60669aaff98d23a7 Mon Sep 17 00:00:00 2001 From: Jamie Cameron Date: Sat, 31 Mar 2018 21:36:34 -0700 Subject: [PATCH] Support rock-format caches --- squid/init_cache.cgi | 3 ++- squid/squid-lib.pl | 6 ++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/squid/init_cache.cgi b/squid/init_cache.cgi index 79e217db8..e72508458 100755 --- a/squid/init_cache.cgi +++ b/squid/init_cache.cgi @@ -39,7 +39,8 @@ if (!$in{'nouser'}) { # valid directives) my @cachestruct = &find_config("cache_dir", $conf, 2); if ($squid_version >= 2.3) { - @cachestruct = grep { $_->{'values'}->[1] =~ /^\// } @cachestruct; + @cachestruct = grep { $_->{'values'}->[1] =~ /^\// && + -d $_->{'values'}->[1] } @cachestruct; } else { @cachestruct = grep { $_->{'values'}->[0] } @cachestruct; diff --git a/squid/squid-lib.pl b/squid/squid-lib.pl index 14e296d9d..889c25db7 100755 --- a/squid/squid-lib.pl +++ b/squid/squid-lib.pl @@ -528,7 +528,9 @@ my (@caches, $coss); my @cachestruct = &find_config("cache_dir", $conf); my $disabled = 0; if ($distoo && !@cachestruct) { + # Check disabled cache directives, but exclude ones that don't exist @cachestruct = &find_config("cache_dir", $conf, 1); + @cachestruct = grep { -e $_->{'values'}->[1] } @cachestruct; $disabled = 1 if (@cachestruct); } if (@cachestruct) { @@ -548,13 +550,13 @@ if (!@caches) { if ($coss) { # Allow COSS files too foreach my $c (@caches) { - return 0 if (!-f $c && (!-d $c || !-d "$c/00")); + return 0 if (!-f $c && (!-d $c || (!-d "$c/00" && !-r "$c/rock"))); } } else { # Check for dirs only foreach my $c (@caches) { - return 0 if (!-d $c || !-d "$c/00"); + return 0 if (!-d $c || (!-d "$c/00" && !-r "$c/rock")); } } return 1;