mirror of
https://github.com/webmin/webmin.git
synced 2025-08-16 14:51:18 +00:00
strict conversion
This commit is contained in:
@ -1,19 +1,22 @@
|
||||
#!/usr/local/bin/perl
|
||||
# Delete several refresh rules at once
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
our (%text, %in, %access, $squid_version, %config);
|
||||
require './squid-lib.pl';
|
||||
&error_setup($text{'drefresh_err'});
|
||||
$access{'refresh'} || &error($text{'refresh_ecannot'});
|
||||
&ReadParse();
|
||||
@d = split(/\0/, $in{'d'});
|
||||
my @d = split(/\0/, $in{'d'});
|
||||
@d || &error($text{'drefesh_enone'});
|
||||
|
||||
# Do the delete
|
||||
&lock_file($config{'squid_conf'});
|
||||
$conf = &get_config();
|
||||
@refresh = &find_config("refresh_pattern", $conf);
|
||||
foreach $d (sort { $b <=> $a } @d) {
|
||||
$h = $conf->[$d];
|
||||
my $conf = &get_config();
|
||||
my @refresh = &find_config("refresh_pattern", $conf);
|
||||
foreach my $d (sort { $b <=> $a } @d) {
|
||||
my $h = $conf->[$d];
|
||||
splice(@refresh, &indexof($h, @refresh), 1);
|
||||
}
|
||||
|
||||
|
@ -1,14 +1,18 @@
|
||||
#!/usr/local/bin/perl
|
||||
# Save or delete a refresh pattern
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
our (%text, %in, %access, $squid_version, %config);
|
||||
require './squid-lib.pl';
|
||||
$access{'refresh'} || &error($text{'refresh_ecannot'});
|
||||
&ReadParse();
|
||||
&lock_file($config{'squid_conf'});
|
||||
$conf = &get_config();
|
||||
my $conf = &get_config();
|
||||
&error_setup($text{'refresh_err'});
|
||||
|
||||
@refresh = &find_config("refresh_pattern", $conf);
|
||||
my @refresh = &find_config("refresh_pattern", $conf);
|
||||
my $h;
|
||||
if (defined($in{'index'})) {
|
||||
$h = $conf->[$in{'index'}];
|
||||
}
|
||||
@ -23,12 +27,13 @@ else {
|
||||
$in{'max'} =~ /^\d+$/ || &error($text{'refresh_emax'});
|
||||
$in{'pc'} =~ /^\d+$/ && $in{'pc'} >= 0 && $in{'pc'} <= 100 ||
|
||||
&error($text{'refresh_epc'});
|
||||
my @vals;
|
||||
push(@vals, "-i") if ($in{'caseless'});
|
||||
push(@vals, $in{'re'}, $in{'min'}, $in{'pc'}.'%', $in{'max'});
|
||||
push(@vals, split(/\0/, $in{'options'}));
|
||||
$newr = { 'name' => 'refresh_pattern',
|
||||
'values' => \@vals };
|
||||
$idx = &indexof($h, @refresh);
|
||||
my $newr = { 'name' => 'refresh_pattern',
|
||||
'values' => \@vals };
|
||||
my $idx = &indexof($h, @refresh);
|
||||
if ($h) { splice(@refresh, &indexof($h, @refresh), 1, $newr); }
|
||||
else { push(@refresh, $newr); }
|
||||
}
|
||||
|
Reference in New Issue
Block a user