2 # Functions that have been moved out of mod_proxy in apache 2.0
4 sub mod_cache_directives
7 $rv = [ [ 'CacheDefaultExpire', 0, 13.1, 'virtual', 2.0 ],
8 [ 'CacheEnable CacheDisable', 1, 13.1, 'virtual', 2.0 ],
9 # [ 'CacheIgnoreCacheControl', 0, 13.1, 'virtual', 2.0 ],
10 # [ 'CacheIgnoreNoLastMod', 0, 13.1, 'virtual', 2.0 ],
11 [ 'CacheLastModifiedFactor', 0, 13.1, 'virtual', 2.0 ],
12 [ 'CacheMaxExpire', 0, 13.1, 'virtual', 2.0 ] ];
13 return &make_directives($rv, $_[0], "mod_cache");
18 sub edit_CacheEnable_CacheDisable
20 local $rv = "<table border>\n".
21 "<tr $tb> <td><b>$text{'cache_enable'}</b></td>\n".
22 "<td><b>$text{'cache_type'}</b></td>\n".
23 "<td><b>$text{'cache_url'}</b></td> </tr>\n";
25 foreach $c (@{$_[0]}, @{$_[1]}, { }) {
27 $rv .= "<td><select name=CacheEnable_e_$i>\n";
28 $rv .= sprintf "<option value=0 %s> \n",
30 $rv .= sprintf "<option value=1 %s>%s\n",
31 $c->{'name'} eq 'CacheEnable' ? 'selected' : '',
33 $rv .= sprintf "<option value=2 %s>%s\n",
34 $c->{'name'} eq 'CacheDisable' ? 'selected' : '',
36 $rv .= "</select></td> <td><select name=CacheEnable_t_$i>\n";
37 $rv .= sprintf "<option value=disk %s> %s\n",
38 $c->{'words'}->[0] eq 'disk' ? 'selected' : '',
40 $rv .= sprintf "<option value=mem %s> %s\n",
41 $c->{'words'}->[0] eq 'mem' ? 'selected' : '',
43 $rv .= "</select></td>\n";
44 $rv .= sprintf "<td><input name=CacheEnable_u_$i size=20 value='%s'></td>\n", $c->{'name'} eq 'CacheEnable' ? $c->{'words'}->[1] : $c->{'words'}->[0];
49 return (2, $text{'cache_endis'}, $rv);
51 sub save_CacheEnable_CacheDisable
53 local ($i, @en, @dis);
54 for($i=0; defined($in{"CacheEnable_e_$i"}); $i++) {
55 next if (!$in{"CacheEnable_e_$i"});
56 $in{"CacheEnable_u_$i"} =~ /^\S+$/ || &error($text{'cache_eurl'});
57 if ($in{"CacheEnable_e_$i"} == 1) {
58 push(@en, $in{"CacheEnable_t_$i"}." ".$in{"CacheEnable_u_$i"});
61 push(@dis, $in{"CacheEnable_u_$i"});
64 return ( \@en, \@dis );
67 sub edit_CacheIgnoreCacheControl
69 return (1, $text{'cache_control'},
70 &choice_input($_[0]->{'value'}, "CacheIgnoreCacheControl", "off",
71 "$text{'yes'},on", "$text{'no'},off"));
73 sub save_CacheIgnoreCacheControl
75 return &parse_choice("CacheIgnoreCacheControl", "off");
78 sub edit_CacheIgnoreNoLastMod
80 return (1, $text{'cache_lastmod'},
81 &choice_input($_[0]->{'value'}, "CacheIgnoreNoLastMod", "off",
82 "$text{'yes'},on", "$text{'no'},off"));
84 sub save_CacheIgnoreNoLastMod
86 return &parse_choice("CacheIgnoreNoLastMod", "off");