Fix a bug that affected the 'emailreports' module, sending the emails without any graph

This commit is contained in:
Jordi Sanfeliu 2014-05-06 09:56:24 +02:00
parent d3bd501728
commit 85adefe2bf
1 changed files with 12 additions and 7 deletions

View File

@ -457,19 +457,24 @@ $cgi{silent} = $silent;
if($mode eq "localhost") {
foreach (split(',', $config{graph_name})) {
my $g = trim($_);
if(lc($config{graph_enable}->{$g}) eq "y") {
my $cgi = $g . "_cgi";
my $gn = trim($_);
my $g = "";
if($graph ne "all") {
($g) = ($graph =~ m/^_*($gn)\d*$/);
next unless $g;
}
if(lc($config{graph_enable}->{$gn}) eq "y") {
my $cgi = $gn . "_cgi";
eval "use $g qw(" . $cgi . ")";
eval "use $gn qw(" . $cgi . ")";
if($@) {
print(STDERR "WARNING: unable to load module '$g. $@'\n");
print(STDERR "WARNING: unable to load module '$gn. $@'\n");
next;
}
if($graph eq "all" || $graph =~ m/^_$g\d+/) {
if($graph eq "all" || $gn eq $g) {
no strict "refs";
&$cgi($g, \%config, \%cgi);
&$cgi($gn, \%config, \%cgi);
}
}
}