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";
$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
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
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