COSS cache format support
authorJamie Cameron <jcameron@webmin.com>
Fri, 18 Jun 2010 01:09:17 +0000 (18:09 -0700)
committerJamie Cameron <jcameron@webmin.com>
Fri, 18 Jun 2010 01:09:17 +0000 (18:09 -0700)
squid/CHANGELOG
squid/edit_cache.cgi
squid/lang/en
squid/save_cache.cgi
squid/squid-lib.pl

index a17ecc0..a0f27e0 100644 (file)
@@ -30,3 +30,5 @@ Added a page for editing cache manager passwords and the actions that they apply
 Comments at the end of lines are now preserved when Webmin changes directives in squid.conf.
 ---- Changes since 1.420 ----
 Fixed the Calamaris page for newer versions.
+---- Changes since 1.510 ----
+Improved support for COSS format (single file) Squid caches.
index 4ad2f43..eada6cc 100755 (executable)
@@ -46,6 +46,8 @@ for($i=0; $i<=@dirs; $i++) {
                        $dv[0] eq 'diskd' ? 'selected' : '';
                printf "<option value=aufs %s>$text{'ec_ua'}\n",
                        $dv[0] eq 'aufs' ? 'selected' : '';
+               printf "<option value=coss %s>$text{'ec_coss'}\n",
+                       $dv[0] eq 'coss' ? 'selected' : '';
                print "</select></td>\n";
                print "<td><input name=cache_size_$i size=8 ",
                      "value=\"$dv[2]\"></td>\n";
index 8642f95..691612c 100644 (file)
@@ -244,6 +244,7 @@ ec_2dirs=2nd level dirs
 ec_u=UFS
 ec_ua=Async UFS
 ec_diskd=DISKD
+ec_coss=COSS
 ec_1dirs1=First level directories
 ec_2dirs2=Second level directories
 ec_aos=Average object size
index 7156380..a62e1f4 100755 (executable)
@@ -20,7 +20,9 @@ else {
                        $type = $in{"cache_type_$i"};
                        $opts = $in{"cache_opts_$i"};
                        next if (!$dir && !$lv1 && !$lv2 && !$size);
-                       &check_error(\&check_dir, $dir);
+                       if ($type ne "coss") {
+                               &check_error(\&check_dir, $dir);
+                               }
                        &check_error(\&check_dirsize, $size);
                        &check_error(\&check_dircount, $lv1);
                        &check_error(\&check_dircount, $lv2);
index 6a0c241..1ffbb23 100755 (executable)
@@ -491,7 +491,7 @@ return $rv;
 # caches list
 sub check_cache
 {
-local (@cachestruct, @caches, $c);
+local (@cachestruct, @caches, $c, $coss);
 if (@cachestruct = &find_config("cache_dir", $_[0])) {
        if ($squid_version >= 2.3) {
                @caches = map { $_->{'values'}->[1] } @cachestruct;
@@ -499,13 +499,23 @@ if (@cachestruct = &find_config("cache_dir", $_[0])) {
        else {
                @caches = map { $_->{'values'}->[0] } @cachestruct;
                }
+       ($coss) = grep { $_->{'values'}->[0] eq "coss" } @cachestruct;
        }
 else {
        @caches = ( $config{'cache_dir'} );
        }
 @{$_[1]} = @caches;
-foreach $c (@caches) {
-       return 0 if (!-d $c || !-d "$c/00");
+if ($coss) {
+       # Allow COSS files too
+       foreach $c (@caches) {
+               return 0 if (!-f $c && (!-d $c || !-d "$c/00"));
+               }
+       }
+else {
+       # Check for dirs only
+       foreach $c (@caches) {
+               return 0 if (!-d $c || !-d "$c/00");
+               }
        }
 return 1;
 }