removing first parameter from WebGUI::Session->open and other cleanups
This commit is contained in:
parent
29df110409
commit
a141de0ebf
39 changed files with 150 additions and 291 deletions
|
|
@ -1,62 +1,24 @@
|
|||
use strict;
|
||||
|
||||
my $webguiRoot = '/data/WebGUI';
|
||||
use WebGUI::Paths -preload;
|
||||
|
||||
@INC = grep { $_ ne q{.} } @INC;
|
||||
use Log::Log4perl;
|
||||
Log::Log4perl->init( WebGUI::Paths->logConfig );
|
||||
|
||||
unshift @INC, "$webguiRoot/lib";
|
||||
use DBI;
|
||||
DBI->install_driver("mysql");
|
||||
|
||||
# add custom lib directories to library search path
|
||||
unshift @INC, grep {
|
||||
if (!-d $_) {
|
||||
warn "WARNING: Not adding lib directory '$_' from $webguiRoot/sbin/preload.custom: Directory does not exist.\n";
|
||||
0;
|
||||
}
|
||||
else {
|
||||
1;
|
||||
}
|
||||
} readLines($webguiRoot."/sbin/preload.custom");
|
||||
|
||||
#----------------------------------------
|
||||
# Logger
|
||||
#----------------------------------------
|
||||
require Log::Log4perl;
|
||||
Log::Log4perl->init( $webguiRoot."/etc/log.conf" );
|
||||
|
||||
#----------------------------------------
|
||||
# Database connectivity.
|
||||
#----------------------------------------
|
||||
#require Apache::DBI; # Uncomment if you want to enable connection pooling. Not recommended on servers with many sites, or those using db slaves.
|
||||
require DBI;
|
||||
DBI->install_driver("mysql"); # Change to match your database driver.
|
||||
|
||||
#----------------------------------------
|
||||
# WebGUI modules.
|
||||
#----------------------------------------
|
||||
require WebGUI;
|
||||
require WebGUI::Config;
|
||||
require WebGUI::Pluggable;
|
||||
|
||||
# these modules should always be skipped
|
||||
my @excludes;
|
||||
push @excludes, readLines($webguiRoot."/sbin/preload.exclude");
|
||||
|
||||
WebGUI::Pluggable::findAndLoad( "WebGUI",
|
||||
{
|
||||
exclude => \@excludes,
|
||||
onLoadFail => sub { warn sprintf 'Error loading %s: %s', @_ },
|
||||
}
|
||||
);
|
||||
|
||||
require APR::Request::Apache2;
|
||||
require Apache2::Cookie;
|
||||
require Apache2::ServerUtil;
|
||||
use WebGUI;
|
||||
use WebGUI::Config;
|
||||
use APR::Request::Apache2;
|
||||
use Apache2::Cookie;
|
||||
use Apache2::ServerUtil;
|
||||
|
||||
if ( $ENV{MOD_PERL} ) {
|
||||
# Add WebGUI to Apache version tokens
|
||||
my $server = Apache2::ServerUtil->server;
|
||||
$server->push_handlers(PerlPostConfigHandler => sub {
|
||||
$server->add_version_component("WebGUI/".$WebGUI::VERSION);
|
||||
$server->add_version_component('WebGUI/' . $WebGUI::VERSION);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -64,28 +26,7 @@ $| = 1;
|
|||
|
||||
print "\nStarting WebGUI ".$WebGUI::VERSION."\n";
|
||||
|
||||
#----------------------------------------
|
||||
# Preload all site configs.
|
||||
#----------------------------------------
|
||||
WebGUI::Config->loadAllConfigs($webguiRoot);
|
||||
|
||||
|
||||
# reads lines from a file into an array, trimming white space and ignoring commented lines
|
||||
sub readLines {
|
||||
my $file = shift;
|
||||
my @lines;
|
||||
if (open(my $fh, '<', $file)) {
|
||||
while (my $line = <$fh>) {
|
||||
$line =~ s/#.*//;
|
||||
$line =~ s/^\s+//;
|
||||
$line =~ s/\s+$//;
|
||||
next if !$line;
|
||||
push @lines, $line;
|
||||
}
|
||||
close $fh;
|
||||
}
|
||||
return @lines;
|
||||
}
|
||||
WebGUI::Config->loadAllConfigs;
|
||||
|
||||
1;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue