Old files warning and MARC upgrade fix
authorslef <slef>
Mon, 27 Oct 2003 17:13:06 +0000 (17:13 +0000)
committerslef <slef>
Mon, 27 Oct 2003 17:13:06 +0000 (17:13 +0000)
misc/Install.pm
misc/koha.upgrade

index 41bfb4a..6825098 100644 (file)
@@ -77,7 +77,7 @@ $VERSION = 0.01;
                &restoremycnf
                );
 
-use vars qw( $kohaversion );                   # set in installer.pl
+use vars qw( $kohaversion $newversion );                       # set in loadconfigfile and installer.pl
 use vars qw( $language );                      # set in installer.pl
 use vars qw( $domainname );                    # set in installer.pl
 
@@ -90,8 +90,6 @@ use vars qw( $database $mysqluser );
 use vars qw( $mysqlpass );                     # normally should not be used
 use vars qw( $dbname $hostname $user $pass );  # virtual hosting
 
-use vars qw( $newversion );                    # XXX this seems to be unused
-
 =item heading
 
     $messages->{'WelcomeToKohaInstaller'
@@ -380,7 +378,7 @@ Sets the Koha version as known by the installer.
 =cut
 
 sub setkohaversion ($) {
-    ($kohaversion) = @_;
+    ($newversion) = @_;
 }
 
 =item getservername
@@ -1471,6 +1469,16 @@ Copying files to installation directories:
 
 |;
 
+$messages->{'OldFiles'}->{en} = heading('OLD FILES') . qq|
+Any files from the previous edition of Koha have been
+copied to a dated backup directory alongside the new
+installation. You should move any custom files that you
+want to keep (such as your site templates) into the new
+directories and then move the backup off of the live
+server.
+
+Press ENTER to continue:|;
+
 
 $messages->{'CopyingFiles'}->{en}="Copying %s to %s.\n";
 
@@ -1526,7 +1534,7 @@ includes=$opacdir/htdocs/includes
 intranetdir=$intranetdir
 opacdir=$opacdir
 kohalogdir=$kohalogdir
-kohaversion=$kohaversion
+kohaversion=$newversion
 httpduser=$httpduser
 intrahtdocs=$intranetdir/htdocs/intranet-tmpl
 opachtdocs=$opacdir/htdocs/opac-tmpl
@@ -1551,6 +1559,8 @@ opachtdocs=$opacdir/htdocs/opac-tmpl
        chown(0, (getpwnam($httpduser)) [3], "$intranetdir/scripts/z3950daemon/z3950-daemon-shell.sh") or warn "can't chown $intranetdir/scripts/z3950daemon/z3950-daemon-shell.sh: $!";
        chown(0, (getpwnam($httpduser)) [3], "$intranetdir/scripts/z3950daemon/processz3950queue") or warn "can't chown $intranetdir/scripts/z3950daemon/processz3950queue: $!";
        } #MJR: FIXME: Should report that we haven't chown()d.
+
+    showmessage(getmessage('OldFiles'),'PressEnter');
 }
 
 
@@ -1729,18 +1739,19 @@ sub updatedatabase {
                exit;
        }
 
-       #FIXME: do not ask if we are upgrading from a MARC-ready system
-       my $response=showmessage(getmessage('UpdateMarcTables'), 'restrictchar 12N', '1');
+       if ($kohaversion =~ /^1\.[012]\./) {
+               my $response=showmessage(getmessage('UpdateMarcTables'), 'restrictchar 12N', '1');
 
-       startsysout();
-       if ($response eq '1') {
-               system("cat scripts/misc/marc_datas/marc21_en/structure_def.sql | $mysqldir/bin/mysql -u$user $dbname");
-       }
-       if ($response eq '2') {
-               system("cat scripts/misc/marc_datas/unimarc_fr/structure_def.sql | $mysqldir/bin/mysql -u$user $dbname");
-               system("cat scripts/misc/lang-datas/fr/stopwords.sql | $mysqldir/bin/mysql -u$user $dbname");
+               startsysout();
+               if ($response eq '1') {
+                       system("cat scripts/misc/marc_datas/marc21_en/structure_def.sql | $mysqldir/bin/mysql -u$user $dbname");
+               }
+               if ($response eq '2') {
+                       system("cat scripts/misc/marc_datas/unimarc_fr/structure_def.sql | $mysqldir/bin/mysql -u$user $dbname");
+                       system("cat scripts/misc/lang-datas/fr/stopwords.sql | $mysqldir/bin/mysql -u$user $dbname");
+               }
+               delete($ENV{"KOHA_CONF"});
        }
-       delete($ENV{"KOHA_CONF"});
 
        print RESET."\n\nFinished updating of database. Press <ENTER> to continue...";
        <STDIN>;
index a52ed8c..e9cf8cb 100644 (file)
@@ -31,36 +31,12 @@ unless ($answer =~/y/i) {
        print "Great! continuing upgrade... \n";
 };
 
+setkohaversion($::newversion);
 checkperlmodules();
 backupkoha();
 getapacheinfo();
 installfiles();
-
-#FIXME: Copy custom templates and reports back in, or warn
-
-#opendir D, "$backupdir/kohafiles-$date/intranet/htdocs/";
-#my @dirlist=readdir D;
-#foreach (@dirlist) {
-#    (next) if (/^\./);
-#    (next) if ($_ eq 'default');
-#    (next) if ($_ eq 'doc');
-#    (next) if ($_=~/^koha-/);
-#    (next) if (-e "$::intranetdir/htdocs/$_");
-#    print "Restoring custom intranet templates $_...\n";
-#    system("cp -a $backupdir/kohafiles-$date/intranet/htdocs/$_ $::intranetdir/htdocs/");
-#}
-#
-#opendir D, "$backupdir/kohafiles-$date/opac/htdocs/";
-#@dirlist=readdir D;
-#foreach (@dirlist) {
-#    (next) if (/^\./);
-#    (next) if ($_ eq 'default');
-#    (next) if ($_ eq 'doc');
-#    (next) if ($_=~/^koha-/);
-#    (next) if (-e "$::opacdir/htdocs/$_");
-#    print "Restoring custom opac template $_...\n";
-#    system("cp -a $backupdir/kohafiles-$date/opac/htdocs/$_ $::opacdir/htdocs/");
-#}
+# custom templates warning added to installfiles();
 updatedatabase();
 finalizeconfigfile();