Added options to exclude wobjects, macros, and hourly plugins.
This commit is contained in:
parent
9bc401a619
commit
69af472ede
5 changed files with 45 additions and 37 deletions
|
|
@ -5,5 +5,7 @@ logfile = /data/webgui.log
|
|||
extras = /extras
|
||||
uploadsURL = /uploads
|
||||
uploadsPath = /data/WebGUI/www/uploads
|
||||
#skipHourly =
|
||||
#excludeMacro =
|
||||
#excludeWobject =
|
||||
#excludeHourly =
|
||||
#scripturl = /
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ use strict;
|
|||
use Tie::CPHash;
|
||||
use WebGUI::ErrorHandler;
|
||||
use WebGUI::SQL;
|
||||
use WebGUI::Utility;
|
||||
|
||||
our @ISA = qw(Exporter);
|
||||
our @EXPORT = qw(%session);
|
||||
|
|
@ -106,7 +107,7 @@ sub _getUserInfo {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
sub _loadMacros {
|
||||
my ($slash, $namespace, $cmd, @files, $file, $dir);
|
||||
my ($slash, $namespace, $cmd, @files, $file, $dir, $exclude);
|
||||
$slash = ($^O =~ /Win/i) ? "\\" : "/";
|
||||
$dir = $slash."lib".$slash."WebGUI".$slash."Macro";
|
||||
opendir (DIR,$session{config}{webguiRoot}.$dir) or WebGUI::ErrorHandler::fatalError("Can't open macro directory!");
|
||||
|
|
@ -117,7 +118,11 @@ sub _loadMacros {
|
|||
$cmd = "use WebGUI::Macro::".$1;
|
||||
eval($cmd);
|
||||
WebGUI::ErrorHandler::fatalError("Macro failed to compile: $namespace.") if($@);
|
||||
$session{macro}{$namespace} = $namespace;
|
||||
$exclude = $session{config}{excludeMacro};
|
||||
$exclude =~ s/ //g;
|
||||
unless (isIn($namespace, split(/,/,$exclude))) {
|
||||
$session{macro}{$namespace} = $namespace;
|
||||
}
|
||||
}
|
||||
}
|
||||
closedir(DIR);
|
||||
|
|
@ -125,7 +130,7 @@ sub _loadMacros {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
sub _loadWobjects {
|
||||
my ($dir, @files, $slash, $file, $cmd, $namespace);
|
||||
my ($dir, @files, $slash, $file, $cmd, $namespace, $exclude);
|
||||
$slash = ($^O =~ /Win/i) ? "\\" : "/";
|
||||
$dir = $slash."lib".$slash."WebGUI".$slash."Wobject";
|
||||
opendir (DIR,$session{config}{webguiRoot}.$dir) or WebGUI::ErrorHandler::fatalError("Can't open wobject directory!");
|
||||
|
|
@ -136,9 +141,13 @@ sub _loadWobjects {
|
|||
$cmd = "use WebGUI::Wobject::".$namespace;
|
||||
eval($cmd);
|
||||
WebGUI::ErrorHandler::fatalError("Wobject failed to compile: $namespace. ".$@) if($@);
|
||||
$cmd = "\$WebGUI::Wobject::".$namespace."::name";
|
||||
$session{wobject}{$namespace} = eval($cmd);
|
||||
WebGUI::ErrorHandler::fatalError("No name method in wobject: $namespace. ".$@) if($@);
|
||||
$exclude = $session{config}{excludeWobject};
|
||||
$exclude =~ s/ //g;
|
||||
unless (isIn($namespace, split(/,/,$exclude))) {
|
||||
$cmd = "\$WebGUI::Wobject::".$namespace."::name";
|
||||
$session{wobject}{$namespace} = eval($cmd);
|
||||
WebGUI::ErrorHandler::fatalError("No name method in wobject: $namespace. ".$@) if($@);
|
||||
}
|
||||
}
|
||||
}
|
||||
closedir(DIR);
|
||||
|
|
|
|||
|
|
@ -13,13 +13,9 @@ package WebGUI::Utility;
|
|||
use Exporter;
|
||||
use strict;
|
||||
use Tie::IxHash;
|
||||
use WebGUI::International;
|
||||
use WebGUI::Session;
|
||||
use WebGUI::SQL;
|
||||
use WebGUI::URL;
|
||||
|
||||
our @ISA = qw(Exporter);
|
||||
our @EXPORT = qw(&sortByColumn &sortHashDescending &sortHash &isIn &randint &round);
|
||||
our @EXPORT = qw(&sortHashDescending &sortHash &isIn &randint &round);
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub isIn {
|
||||
|
|
@ -56,27 +52,6 @@ sub round {
|
|||
return sprintf("%.0f", $_[0]);
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
# example: sortByColumn(columnToSort,columnLabel);
|
||||
sub sortByColumn {
|
||||
my ($output);
|
||||
$output = '<a href="'.WebGUI::URL::append($_[2],'sort='.$_[0].'&sortDirection=');
|
||||
if ($session{form}{sortDirection} eq "asc") {
|
||||
$output .= "desc";
|
||||
} else {
|
||||
$output .= "asc";
|
||||
}
|
||||
$output .= '">'.$_[1].'</a>';
|
||||
if ($session{form}{sort} eq $_[0]) {
|
||||
if ($session{form}{sortDirection} eq "desc") {
|
||||
$output .= ' <img src="'.$session{config}{extras}.'/desc.gif">';
|
||||
} else {
|
||||
$output .= ' <img src="'.$session{config}{extras}.'/asc.gif">';
|
||||
}
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub sortHash {
|
||||
my (%hash, %reversedHash, %newHash, $key);
|
||||
|
|
|
|||
|
|
@ -29,6 +29,28 @@ our @ISA = qw(WebGUI::Wobject);
|
|||
our $namespace = "DownloadManager";
|
||||
our $name = WebGUI::International::get(1,$namespace);
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
# example: sortByColumn(columnToSort,columnLabel);
|
||||
sub sortByColumn {
|
||||
my ($output);
|
||||
$output = '<a href="'.WebGUI::URL::append($_[2],'sort='.$_[0].'&sortDirection=');
|
||||
if ($session{form}{sortDirection} eq "asc") {
|
||||
$output .= "desc";
|
||||
} else {
|
||||
$output .= "asc";
|
||||
}
|
||||
$output .= '">'.$_[1].'</a>';
|
||||
if ($session{form}{sort} eq $_[0]) {
|
||||
if ($session{form}{sortDirection} eq "desc") {
|
||||
$output .= ' <img src="'.$session{setting}{lib}.'/desc.gif">';
|
||||
} else {
|
||||
$output .= ' <img src="'.$session{setting}{lib}.'/asc.gif">';
|
||||
}
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub _reorderDownloads {
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ use Data::Config;
|
|||
use WebGUI::Utility;
|
||||
|
||||
|
||||
my (@files, $cmd, $namespace, $file, $slash, $confdir, %plugins, $plugdir, $skip);
|
||||
my (@files, $cmd, $namespace, $file, $slash, $confdir, %plugins, $plugdir, $exclude);
|
||||
$slash = ($^O =~ /Win/i) ? "\\" : "/";
|
||||
$confdir = $webguiRoot.$slash."etc".$slash;
|
||||
$plugdir = $webguiRoot.$slash."sbin".$slash."Hourly".$slash;
|
||||
|
|
@ -55,9 +55,9 @@ if (opendir (CONFDIR,$confdir)) {
|
|||
print "Can't connect to ".$config->param('dsn')." with info provided. Skipping.\n";
|
||||
} else {
|
||||
foreach $namespace (keys %plugins) {
|
||||
$skip = $config->param('skipHourly');
|
||||
$skip =~ s/ //g;
|
||||
unless (isIn($namespace, split(/,/,$skip))) {
|
||||
$exclude = $config->param('excludeHourly');
|
||||
$exclude =~ s/ //g;
|
||||
unless (isIn($namespace, split(/,/,$exclude))) {
|
||||
$cmd = $plugins{$namespace};
|
||||
&$cmd($dbh);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue