Added option to skip hourly modules on a per site basis.
This commit is contained in:
parent
f445a03a23
commit
9bc401a619
3 changed files with 15 additions and 9 deletions
|
|
@ -5,4 +5,5 @@ logfile = /data/webgui.log
|
||||||
extras = /extras
|
extras = /extras
|
||||||
uploadsURL = /uploads
|
uploadsURL = /uploads
|
||||||
uploadsPath = /data/WebGUI/www/uploads
|
uploadsPath = /data/WebGUI/www/uploads
|
||||||
|
#skipHourly =
|
||||||
#scripturl = /
|
#scripturl = /
|
||||||
|
|
|
||||||
|
|
@ -486,8 +486,8 @@ sub param {
|
||||||
|
|
||||||
## get the value of the desired parameters
|
## get the value of the desired parameters
|
||||||
for my $arg (@{$args->{'get'}}) {
|
for my $arg (@{$args->{'get'}}) {
|
||||||
carp("[$CLASS] Parameter '$arg' does not exist ") and next
|
#carp("[$CLASS] Parameter '$arg' does not exist ") and
|
||||||
if not exists $self->{'param'}{_case_($self, $arg)};
|
next if not exists $self->{'param'}{_case_($self, $arg)};
|
||||||
|
|
||||||
push @retlist, $self->{'param'}{_case_($self, $arg)}
|
push @retlist, $self->{'param'}{_case_($self, $arg)}
|
||||||
}
|
}
|
||||||
|
|
@ -582,8 +582,8 @@ sub delete {
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
|
|
||||||
for my $param (@_) {
|
for my $param (@_) {
|
||||||
carp("[$CLASS] Parameter '$param' does not exist ") and next
|
#carp("[$CLASS] Parameter '$param' does not exist ") and
|
||||||
if not exists $self->{'param'}{_case_($self, $param)};
|
next if not exists $self->{'param'}{_case_($self, $param)};
|
||||||
delete $self->{'param'}{_case_($self, $param)}
|
delete $self->{'param'}{_case_($self, $param)}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -19,9 +19,10 @@ BEGIN {
|
||||||
use DBI;
|
use DBI;
|
||||||
use strict qw(subs vars);
|
use strict qw(subs vars);
|
||||||
use Data::Config;
|
use Data::Config;
|
||||||
|
use WebGUI::Utility;
|
||||||
|
|
||||||
|
|
||||||
my (@files, $cmd, $namespace, $i, $file, $slash, $confdir, @plugins, $plugin, $plugdir);
|
my (@files, $cmd, $namespace, $file, $slash, $confdir, %plugins, $plugdir, $skip);
|
||||||
$slash = ($^O =~ /Win/i) ? "\\" : "/";
|
$slash = ($^O =~ /Win/i) ? "\\" : "/";
|
||||||
$confdir = $webguiRoot.$slash."etc".$slash;
|
$confdir = $webguiRoot.$slash."etc".$slash;
|
||||||
$plugdir = $webguiRoot.$slash."sbin".$slash."Hourly".$slash;
|
$plugdir = $webguiRoot.$slash."sbin".$slash."Hourly".$slash;
|
||||||
|
|
@ -33,8 +34,7 @@ if (opendir (PLUGDIR,$plugdir)) {
|
||||||
$namespace = $1;
|
$namespace = $1;
|
||||||
$cmd = "use Hourly::".$namespace;
|
$cmd = "use Hourly::".$namespace;
|
||||||
eval($cmd);
|
eval($cmd);
|
||||||
$plugins[$i] = "Hourly::".$namespace."::process";
|
$plugins{$namespace} = "Hourly::".$namespace."::process";
|
||||||
$i++;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
closedir(PLUGDIR);
|
closedir(PLUGDIR);
|
||||||
|
|
@ -54,8 +54,13 @@ if (opendir (CONFDIR,$confdir)) {
|
||||||
unless (eval {$dbh = DBI->connect($config->param('dsn'),$config->param('dbuser'),$config->param('dbpass'))}) {
|
unless (eval {$dbh = DBI->connect($config->param('dsn'),$config->param('dbuser'),$config->param('dbpass'))}) {
|
||||||
print "Can't connect to ".$config->param('dsn')." with info provided. Skipping.\n";
|
print "Can't connect to ".$config->param('dsn')." with info provided. Skipping.\n";
|
||||||
} else {
|
} else {
|
||||||
foreach $plugin (@plugins) {
|
foreach $namespace (keys %plugins) {
|
||||||
&$plugin($dbh);
|
$skip = $config->param('skipHourly');
|
||||||
|
$skip =~ s/ //g;
|
||||||
|
unless (isIn($namespace, split(/,/,$skip))) {
|
||||||
|
$cmd = $plugins{$namespace};
|
||||||
|
&$cmd($dbh);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
$dbh->disconnect();
|
$dbh->disconnect();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue