Bug 8497: Strange behavior when modifying the timeout system preference

Signed-off-by: Owen Leonard <oleonard@myacpl.org>

Tested standard login, patron auto-complete, and system preferences.

Signed-off-by: Paul Poulain <paul.poulain@biblibre.com>
This commit is contained in:
Fridolyn SOMERS 2012-10-02 13:49:32 +02:00 committed by Paul Poulain
parent 624957bf21
commit bd8f01fec0
1 changed files with 12 additions and 10 deletions

View File

@ -597,6 +597,15 @@ sub _session_log {
close $fh;
}
sub _timeout_syspref {
my $timeout = C4::Context->preference('timeout') || 600;
# value in days, convert in seconds
if ($timeout =~ /(\d+)[dD]/) {
$timeout = $1 * 86400;
};
return $timeout;
}
sub checkauth {
my $query = shift;
$debug and warn "Checking Auth";
@ -607,12 +616,7 @@ sub checkauth {
$type = 'opac' unless $type;
my $dbh = C4::Context->dbh;
my $timeout = C4::Context->preference('timeout');
# days
if ($timeout =~ /(\d+)[dD]/) {
$timeout = $1 * 86400;
};
$timeout = 600 unless $timeout;
my $timeout = _timeout_syspref();
_version_check($type,$query);
# state variables
@ -1059,8 +1063,7 @@ sub check_api_auth {
my $flagsrequired = shift;
my $dbh = C4::Context->dbh;
my $timeout = C4::Context->preference('timeout');
$timeout = 600 unless $timeout;
my $timeout = _timeout_syspref();
unless (C4::Context->preference('Version')) {
# database has not been installed yet
@ -1292,8 +1295,7 @@ sub check_cookie_auth {
my $flagsrequired = shift;
my $dbh = C4::Context->dbh;
my $timeout = C4::Context->preference('timeout');
$timeout = 600 unless $timeout;
my $timeout = _timeout_syspref();
unless (C4::Context->preference('Version')) {
# database has not been installed yet