From 24d5e31dae916180ac77fb5a2a1a8c3b02e7ef94 Mon Sep 17 00:00:00 2001 From: Chris Cormack Date: Fri, 10 Aug 2007 10:48:53 -0500 Subject: [PATCH] Changing InstallAuth to use CGI::Session and fixing install.pl which broke with the kohastruture.sql clean up Signed-off-by: Joshua Ferraro --- installer/InstallAuth.pm | 14 +++++++------- installer/install.pl | 5 ++--- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/installer/InstallAuth.pm b/installer/InstallAuth.pm index 3cf1f3a2a0..b443a13a93 100644 --- a/installer/InstallAuth.pm +++ b/installer/InstallAuth.pm @@ -27,6 +27,7 @@ require Exporter; use C4::Context; use C4::Output; use C4::Koha; +use CGI::Session; use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS); @@ -221,14 +222,13 @@ has authenticated. sub checkauth { my $query = shift; -warn "here i am"; # $authnotrequired will be set for scripts which will run without authentication my $authnotrequired = shift; my $flagsrequired = shift; my $type = shift; $type = 'intranet' unless $type; - + my $dbh = C4::Context->dbh(); my $template_name; $template_name = "installer/auth.tmpl"; @@ -239,8 +239,8 @@ warn "here i am"; my $logout = $query->param('logout.x'); if ( $sessionID = $query->cookie("CGISESSID") ) { C4::Context->_new_userenv($sessionID); - my $session = new CGI::Session("driver:MySQL", $sessionID, {Handle=>$dbh}); - if ( my $session ) { + my $session = new CGI::Session("driver:File", $sessionID, {Directory=>'/tmp'}); + if ( $session ) { C4::Context::set_userenv( $session->param('number'), $session->param('id'), $session->param('cardnumber'), $session->param('firstname'), @@ -250,7 +250,7 @@ warn "here i am"; ); $cookie = $query->cookie(CGISESSID => $session->id); $loggedin=1; - $userid = $hash{cardnumber}; + $userid = $session->param('cardnumber'); } my ( $ip, $lasttime ); @@ -268,7 +268,7 @@ warn "here i am"; } } unless ($userid) { - my $session = new CGI::Session("driver:MySQL", undef, {Handle=>$dbh}); + my $session = new CGI::Session("driver:File", undef, {Directory=>'/tmp'}); $sessionID = $session->id; $userid = $query->param('userid'); C4::Context->_new_userenv($sessionID); @@ -368,7 +368,7 @@ warn "here i am"; ); $template->param( \%info ); $cookie = $query->cookie( - -name => 'sessionID', + -name => 'CGISESSID', -value => $sessionID, -expires => '' ); diff --git a/installer/install.pl b/installer/install.pl index e28ec61e18..a54a8c8d01 100755 --- a/installer/install.pl +++ b/installer/install.pl @@ -359,15 +359,14 @@ if ($step && $step==1){ $dbh->disconnect; } else { #Check if there are enough tables. - # Version 2_2 was 74 tables, so we check if there is more than 75 - # Maybe could be in step 2 + # Paul has cleaned up tables so reduced the count #I put it there because it implied a data import if condition was not satisfied. my $dbh= DBI->connect("DBI:$info{dbms}:$info{dbname}:$info{hostname}".($info{port}?":$info{port}":""),$info{'user'}, $info{'password'}); my $rq=$dbh->prepare("SHOW TABLES FROM ".$info{'dbname'}); $rq->execute; my $data=$rq->fetchall_arrayref({}); my $count=scalar(@$data); - if ($count < 75){ + if ($count < 70){ $template->param("count"=>$count,"proposeimport"=>1); } else { $template->param("count"=>$count,"default"=>1); -- 2.39.2