Permalink
Browse files

Changing InstallAuth to use CGI::Session and fixing install.pl which …

…broke

with the kohastruture.sql clean up

Signed-off-by: Joshua Ferraro <jmf@liblime.com>
  • Loading branch information...
1 parent 8494eff commit 24d5e31dae916180ac77fb5a2a1a8c3b02e7ef94 Chris Cormack committed with Joshua Ferraro Aug 10, 2007
Showing with 9 additions and 10 deletions.
  1. +7 −7 installer/InstallAuth.pm
  2. +2 −3 installer/install.pl
@@ -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 => ''
);
@@ -359,15 +359,14 @@
$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);

0 comments on commit 24d5e31

Please sign in to comment.