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>
This commit is contained in:
Chris Cormack 2007-08-10 10:48:53 -05:00 committed by Joshua Ferraro
parent 8494eff8bc
commit 24d5e31dae
2 changed files with 9 additions and 10 deletions

View file

@ -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 => ''
);

View file

@ -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);