Koha-clms/misc/koha.upgrade

73 lines
1.9 KiB
Perl

#!/usr/bin/perl -w
#use diagnostics;
use strict; # please develop with the strict pragma
use Install;
$::language='en';
###############################################
# SET THE etcdir ENVIRONMENT VAR INSTEAD #
###############################################
Install::setetcdir($ENV{etcdir}||'/etc');
my $input;
loadconfigfile();
($::kohaversion) || ($::kohaversion='unknown version');
$::newversion=`cat koha.version`;
chomp $::newversion;
if ($::newversion =~ /RC/) {
releasecandidatewarning();
}
#FIXME: need kohaversion number
showmessage(getmessage('WelcomeToUpgrader',[$::kohaversion,$::newversion]),'yn');
unless ($answer =~/y/i) {
showmessage(getmessage('AbortingInstall'),'PressEnter');
exit;
} else {
print "Great! continuing upgrade... \n";
};
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/");
#}
updatedatabase();
finalizeconfigfile();
showmessage(getmessage('UpgradeCompleted'),'PressEnter');
my $reply=showmessage('Would you like to complete a survey about your library?', 'yn', 'y');
if ($reply=~/y/i) {
system("perl kohareporter");
}