remove debug code from User.pm and fix slave handling in Session
This commit is contained in:
parent
62f3a9b045
commit
7d5e6ae526
2 changed files with 11 additions and 8 deletions
|
|
@ -182,6 +182,7 @@ Returns a random slave database handler, if one is defined, otherwise it returns
|
|||
|
||||
sub dbSlave {
|
||||
my $self = shift;
|
||||
return $self->db if $self->var->isAdminOn;
|
||||
unless (exists $self->{_slave}) {
|
||||
my @slaves = ();
|
||||
foreach (1..3) {
|
||||
|
|
@ -190,14 +191,17 @@ sub dbSlave {
|
|||
push (@slaves, $slave);
|
||||
}
|
||||
}
|
||||
my $slave = $slaves[rand @slaves];
|
||||
$self->{_slave} = WebGUI::SQL->connect($self, $slave->{dsn},$slave->{user},$slave->{pass});
|
||||
}
|
||||
if ($self->var("adminOn") || !exists $self->{_slave}) {
|
||||
return $self->db;
|
||||
} else {
|
||||
return $self->{_slave};
|
||||
if (scalar @slaves > 0) {
|
||||
my $slave = $slaves[rand @slaves];
|
||||
$self->{_slave} = WebGUI::SQL->connect($self, $slave->{dsn},$slave->{user},$slave->{pass});
|
||||
}
|
||||
}
|
||||
if (!exists $self->{_slave}) {
|
||||
return $self->db;
|
||||
}
|
||||
else {
|
||||
return $self->{_slave};
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -383,7 +383,6 @@ sub new {
|
|||
my $cache = WebGUI::Cache->new($session,["user",$userId]);
|
||||
my $userData = $cache->get;
|
||||
unless ($userData->{_userId} && $userData->{_user}{username}) {
|
||||
$session->errorHandler->warn('Cache invalid');
|
||||
my %user;
|
||||
tie %user, 'Tie::CPHash';
|
||||
%user = $session->db->quickHash("select * from users where userId=?",[$userId]);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue