Support rock-format caches

This commit is contained in:
Jamie Cameron
2018-03-31 21:36:34 -07:00
parent 71eb845147
commit 303a7bd04d
2 changed files with 6 additions and 3 deletions

View File

@ -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;

View File

@ -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;