[Koha-cvs] koha C4/Auth.pm installer/install.pl

paul poulain paul at koha-fr.org
Tue Jul 3 15:50:21 CEST 2007


CVSROOT:	/sources/koha
Module name:	koha
Changes by:	paul poulain <tipaul>	07/07/03 13:50:21

Modified files:
	C4             : Auth.pm 
	installer      : install.pl 

Log message:
	improving installer : now the database Version is compared to the Koha version (defined by <kohaversion>XXX</kohaversion> in koha.xml file. If the Version systempref does not exist or is lower than kohaversion, you're redirected to installer. If there is no Version, you're redirected to the 1st step of the installer (full install). If Version < kohaversion, you're redirected to step 3 (updatedatabase). check that you have <kohaversion> in you koha.xml, otherwise, you'l loop forever to the installer...

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/koha/C4/Auth.pm?cvsroot=koha&r1=1.65&r2=1.66
http://cvs.savannah.gnu.org/viewcvs/koha/installer/install.pl?cvsroot=koha&r1=1.10&r2=1.11

Patches:
Index: C4/Auth.pm
===================================================================
RCS file: /sources/koha/koha/C4/Auth.pm,v
retrieving revision 1.65
retrieving revision 1.66
diff -u -b -r1.65 -r1.66
--- C4/Auth.pm	3 Jul 2007 04:39:03 -0000	1.65
+++ C4/Auth.pm	3 Jul 2007 13:50:20 -0000	1.66
@@ -36,7 +36,7 @@
 use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
 
 # set the version for version checking
-$VERSION = do { my @v = '$Revision: 1.65 $' =~ /\d+/g;
+$VERSION = do { my @v = '$Revision: 1.66 $' =~ /\d+/g;
     shift(@v) . "." . join( "_", map { sprintf "%03d", $_ } @v );
 };
 
@@ -338,11 +338,17 @@
     $type = 'opac' unless $type;
 
     my $dbh     = C4::Context->dbh;
+    # check that database and koha version are the same
     unless (C4::Context->preference('Version')){
-      warn "No Version string in sysprefs, redirecting to Installer";
+      warn "Install required, redirecting to Installer";
       print $query->redirect("/cgi-bin/koha/installer/install.pl");
       exit;
     }
+    if (C4::Context->preference('Version') < C4::Context->config("kohaversion")){
+      warn "Database update needed, redirecting to Installer. Database is ".C4::Context->preference('Version')." and Koha is : ".C4::Context->config("kohaversion");
+      print $query->redirect("/cgi-bin/koha/installer/install.pl?step=3");
+      exit;
+    }
     my $timeout = C4::Context->preference('timeout');
     $timeout = 600 unless $timeout;
 

Index: installer/install.pl
===================================================================
RCS file: /sources/koha/koha/installer/install.pl,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -b -r1.10 -r1.11
--- installer/install.pl	1 Jul 2007 18:43:57 -0000	1.10
+++ installer/install.pl	3 Jul 2007 13:50:21 -0000	1.11
@@ -203,6 +203,15 @@
 } elsif ($step && $step==3){
   my $op=$query->param('op');
   if ($op && $op eq 'finish'){
+    if (C4::Context->preference('Version')) {
+        warn "UPDATE Version";
+      my $finish=$dbh->prepare("UPDATE systempreferences SET value=? WHERE variable='Version'");
+      $finish->execute(C4::Context->config("kohaversion"));
+    } else {
+        warn "INSERT Version";
+      my $finish=$dbh->prepare("INSERT into systempreferences (variable,value,explanation) values ('Version',?,'The Koha database version. Don t change this value manually, it s holded by the webinstaller')");
+      $finish->execute(C4::Context->config("kohaversion"));
+    }
     # Installation is finished.
     # We just deny anybody acess to install
     # And we redirect people to mainpage.





More information about the Koha-cvs mailing list