koha-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Koha-cvs] koha/installer install.pl


From: MJR
Subject: [Koha-cvs] koha/installer install.pl
Date: Sun, 01 Jul 2007 18:43:57 +0000

CVSROOT:        /sources/koha
Module name:    koha
Changes by:     MJR <slef>      07/07/01 18:43:57

Modified files:
        installer      : install.pl 

Log message:
        Use DBI not mysql command-line to load the database tables

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/koha/installer/install.pl?cvsroot=koha&r1=1.9&r2=1.10

Patches:
Index: install.pl
===================================================================
RCS file: /sources/koha/koha/installer/install.pl,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -b -r1.9 -r1.10
--- install.pl  26 Jun 2007 14:30:22 -0000      1.9
+++ install.pl  1 Jul 2007 18:43:57 -0000       1.10
@@ -334,13 +334,14 @@
     $template->param($op=>1)
   }elsif ($op && $op eq 'importdatastructure'){
     #Import data structure and show errors if any
-    my $filename="kohastructure.sql";
-    undef $/;
-    my $strcmd="mysql ".($info{hostname}?"-h $info{hostname} 
":"").($info{port}?"-P $info{port} ":"").($info{user}?"-u $info{user} 
":"").($info{password}?"-p$info{password}":"")." $info{dbname} ";
-    my $str = qx($strcmd < $filename 2>&1);
-    $str=~s/\n|\r/<br \/>/g;
-    $template->param("error"=>$str ,
+       #Uses DBI to read the file [MJR 2007-07-01]
+    my $dbh= 
DBI->connect("DBI:$info{dbms}:$info{dbname}:$info{hostname}".($info{port}?":$info{port}":""),$info{'user'},
 $info{'password'});
+    open(INPUT,"<kohastructure.sql");
+    map { $dbh->do($_); } split(/;/,join('',<INPUT>));
+    close(INPUT);
+       $template->param("error"=>$dbh->errstr ,
                         "$op"=> 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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]