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
|
|
@ -264,9 +264,7 @@ sub exportAsHtml {
|
|||
|
||||
# now, create a new session as the user doing the exports. this is so that
|
||||
# the exported assets are taken from that user's perspective.
|
||||
my $exportSession = WebGUI::Session->open(
|
||||
$session->config->getFilename,
|
||||
);
|
||||
my $exportSession = WebGUI::Session->open($session->config);
|
||||
my $esGuard = Scope::Guard->new(sub {
|
||||
$exportSession->var->end;
|
||||
$exportSession->close;
|
||||
|
|
@ -497,9 +495,7 @@ sub exportGetDescendants {
|
|||
# open a temporary session as the user doing the exporting so we don't get
|
||||
# assets that they can't see
|
||||
if ( ref $user && $user->isa('WebGUI::User') ) {
|
||||
$session = WebGUI::Session->open(
|
||||
$session->config->getFilename,
|
||||
);
|
||||
$session = WebGUI::Session->open($session->config);
|
||||
$session->user( { userId => $user->userId } );
|
||||
$sGuard = Scope::Guard->new(sub {
|
||||
$session->var->end;
|
||||
|
|
|
|||
|
|
@ -36,9 +36,9 @@ This package parses the WebGUI config file.
|
|||
|
||||
WebGUI::Config->loadAllConfigs($webguiRoot);
|
||||
|
||||
my $configs = WebGUI::Config->readAllConfigs($webguiRoot);
|
||||
my $configs = WebGUI::Config->readAllConfigs;
|
||||
|
||||
my $config = WebGUI::Config->new($webguiRoot, $configFileName);
|
||||
my $config = WebGUI::Config->new($configFileName);
|
||||
|
||||
my $value = $config->get($param);
|
||||
$config->set($param,$value);
|
||||
|
|
@ -123,8 +123,7 @@ The path to the WebGUI installation.
|
|||
|
||||
sub loadAllConfigs {
|
||||
my $class = shift;
|
||||
my $webguiPath = shift;
|
||||
my $configs = $class->readAllConfigs($webguiPath);
|
||||
my $configs = $class->readAllConfigs;
|
||||
foreach my $filename (keys %{$configs}) {
|
||||
unless ($filename =~ /^demo\d/) {
|
||||
print "\tLoading ".$filename."\n";
|
||||
|
|
|
|||
|
|
@ -15,6 +15,9 @@ package WebGUI::Paths;
|
|||
=cut
|
||||
|
||||
our $VERSION = '0.0.1';
|
||||
use 5.010;
|
||||
use strict;
|
||||
use warnings;
|
||||
use Carp qw(croak);
|
||||
use Cwd qw(realpath);
|
||||
use File::Spec::Functions qw(catdir splitpath catpath splitpath updir catfile);
|
||||
|
|
@ -59,6 +62,21 @@ BEGIN {
|
|||
}
|
||||
}
|
||||
|
||||
sub import {
|
||||
my $class = shift;
|
||||
given (\@_) {
|
||||
when ('-inc') {
|
||||
$class->includePreloads;
|
||||
}
|
||||
when ('-preload') {
|
||||
$class->preloadAll;
|
||||
}
|
||||
default {
|
||||
warn "Invalid option $_";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sub siteConfigs {
|
||||
my $class = shift;
|
||||
opendir my $dh, $class->configBase;
|
||||
|
|
@ -83,7 +101,7 @@ sub preloadPaths {
|
|||
try {
|
||||
@paths = grep {
|
||||
(-d) ? 1 : do {
|
||||
warn "WARNING: Not adding lib directory '$path' from @{[$class->preloadCustom]}: Directory does not exist.\n";
|
||||
warn "WARNING: Not adding lib directory '$_' from @{[$class->preloadCustom]}: Directory does not exist.\n";
|
||||
0;
|
||||
}
|
||||
} _readTextLines($class->preloadCustom);
|
||||
|
|
@ -104,6 +122,8 @@ sub preloadExclude {
|
|||
|
||||
sub preloadAll {
|
||||
my $class = shift;
|
||||
$class->includePreloads;
|
||||
|
||||
require WebGUI::Pluggable;
|
||||
|
||||
WebGUI::Pluggable::findAndLoad( 'WebGUI', {
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ B<NOTE:> It is important to distinguish the difference between a WebGUI session
|
|||
|
||||
use WebGUI::Session;
|
||||
|
||||
$session = WebGUI::Session->open($webguiRoot, $configFile);
|
||||
$session = WebGUI::Session->open($configFile);
|
||||
$sessionId = $session->getId;
|
||||
($form, $db, $user) = $session->quick("form", "db", "user");
|
||||
$session->close;
|
||||
|
|
@ -455,11 +455,16 @@ Uses simple session vars. See WebGUI::Session::Var::new() for more details.
|
|||
|
||||
sub open {
|
||||
my $class = shift;
|
||||
my $webguiRoot = shift;
|
||||
my $configFile = shift;
|
||||
my $request = shift;
|
||||
my $server = shift;
|
||||
my $config = WebGUI::Config->new($configFile);
|
||||
my $config;
|
||||
if (try { $configFile->isa('WebGUI::Config' }) {
|
||||
$config = $configFile;
|
||||
}
|
||||
else {
|
||||
$config = WebGUI::Config->new($configFile);
|
||||
}
|
||||
my $self = {_config=>$config, _server=>$server};
|
||||
bless $self , $class;
|
||||
$self->{_request} = $request if (defined $request);
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ sub handler {
|
|||
my $session = $request->pnotes('wgSession');
|
||||
WEBGUI_FATAL: {
|
||||
unless (defined $session) {
|
||||
$session = WebGUI::Session->open($server->dir_config('WebguiRoot'), $config->getFilename, $request, $server);
|
||||
$session = WebGUI::Session->open($config, $request, $server);
|
||||
return Apache2::Const::OK if ! defined $session;
|
||||
}
|
||||
foreach my $handler (@{$config->get("contentHandlers")}) {
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ sub handler {
|
|||
unless ($privs[1] eq "7" || $privs[1] eq "1") {
|
||||
my $session = $request->pnotes('wgSession');
|
||||
unless (defined $session) {
|
||||
$session = WebGUI::Session->open($server->dir_config('WebguiRoot'), $config->getFilename, $request, $server);
|
||||
$session = WebGUI::Session->open($config->getFilename, $request, $server);
|
||||
}
|
||||
my $hasPrivs = ($session->var->get("userId") eq $privs[0] || $session->user->isInGroup($privs[1]) || $session->user->isInGroup($privs[2]));
|
||||
$session->close();
|
||||
|
|
|
|||
|
|
@ -87,7 +87,7 @@ sub execute {
|
|||
$self->session->errorHandler->warn("More than 1 old userLoginLog rows found, removing offending rows");
|
||||
$self->session->db->write("delete from userLoginLog where lastPageViewed = timeStamp and sessionId = ? ", [$sessionId] );
|
||||
}
|
||||
my $session = WebGUI::Session->open($self->session->config->getFilename, undef, undef, $sessionId, 1);
|
||||
my $session = WebGUI::Session->open($self->session->config, undef, undef, $sessionId, 1);
|
||||
if (defined $session) {
|
||||
$session->var->end;
|
||||
$session->close;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue