From fb0a6e739df714b8fdd356aa936fc1df311edf4d Mon Sep 17 00:00:00 2001 From: slef Date: Mon, 27 Oct 2003 17:36:17 +0000 Subject: [PATCH] Added getmysqldir function --- misc/Install.pm | 150 +++++++++++++++++++----------------------------- 1 file changed, 58 insertions(+), 92 deletions(-) diff --git a/misc/Install.pm b/misc/Install.pm index 6825098b91..3f84aeecb3 100644 --- a/misc/Install.pm +++ b/misc/Install.pm @@ -958,7 +958,38 @@ You must specify different directories for the OPAC and INTRANET files! } } +=item getmysqldir + getmysqldir; + +Get the MySQL database server installation directory, automatically if possible. + +=cut + +$messages->{'WhereIsMySQL'}->{en} = heading('MYSQL LOCATION').qq| +Koha can't find MySQL. If you compiled mysql yourself, +please give the value of --prefix when you ran configure. +The file mysqladmin should be in bin/mysqladmin under the directory that you give here. + +MySQL installation directory: |; + +sub getmysqldir { + foreach my $mysql (qw(/usr/local/mysql + /opt/mysql + /usr + )) { + if ( -d $mysql && -f "$mysql/bin/mysqladmin") { + $mysqldir=$mysql; + } + } + if (!$mysqldir){ + for (;;) { + $mysqldir = showmessage(getmessage('WhereisMySQL'),'free'); + last if -f "$mysqldir/bin/mysqladmin"; + } + } + return($mysqldir); +} =item getdatabaseinfo @@ -1627,33 +1658,8 @@ $messages->{'PrinterName'}->{en}="Printer Name [%s]: "; sub databasesetup { $mysqluser = 'root'; $mysqlpass = ''; + my $mysqldir = getmysqldir(); - foreach my $mysql (qw(/usr/local/mysql - /opt/mysql - /usr - )) { - if ( -d $mysql && -f "$mysql/bin/mysqladmin") { - $mysqldir=$mysql; - } - } - if (!$mysqldir){ - print "I don't see mysql in the usual places.\n"; - for (;;) { - print "Where have you installed mysql? "; - chomp($mysqldir = ); - last if -f "$mysqldir/bin/mysqladmin"; - print <{'RestartApache'}->{en} = heading('RESTART APACHE') . qq| -Apache needs to be restarted to load the new configuration for Koha. -This requires the root password. +The web server daemon needs to be restarted to load the new configuration for Koha. +The installer can do this if you are using Apache and give the root password. Would you like to try to restart Apache now? [Y]/N: |; @@ -1844,8 +1846,6 @@ sub restartapache { my $response=showmessage(getmessage('RestartApache'), 'yn', 'y'); - - unless ($response=~/^n/i) { startsysout(); # Need to support other init structures here? @@ -1868,17 +1868,31 @@ This function attempts to back up all koha's details. =cut +$messages->{'BackupDir'}->{en} = heading('BACKUP STORAGE').qq| +The upgrader will now try to backup your old files. + +Please specify a directory to store the backup in [%s]: |; + +$messages->{'BackupSummary'}->{en} = heading('BACKUP SUMMARY').qq| +Backed up: + +%6d biblio entries +%6d biblioitems entries +%6d items entries +%6d borrowers + +File Listing +--------------------------------------------------------------------- +%s +--------------------------------------------------------------------- + +Does this look right? ([Y]/N): |; + #FIXME: rewrite to use Install.pm sub backupkoha { -my $backupdir=($ENV{prefix}||'/usr/local/koha').'/backups'; -print "Please specify a backup directory [$backupdir]: "; - -$answer = ; -chomp $answer; +my $backupdir=$ENV{'prefix'}.'/backups'; -if ($answer) { - $backupdir=$answer; -} +$answer = showmessage(getmessage('BackupDir',[$backupdir]),'free',$backupdir); if (! -e $backupdir) { my $result=mkdir ($backupdir, oct(770)); @@ -1899,37 +1913,7 @@ chmod 0770, $backupdir; # Backup MySql database # # -my $mysql; -my $mysqldir; - -foreach my $mysql (qw(/usr/local/mysql - /opt/mysql - /usr - )) { - if ( -d $mysql && -f "$mysql/bin/mysqladmin") { - $mysqldir=$mysql; - } -} -if (!$mysqldir){ - print "I don't see mysql in the usual places.\n"; - for (;;) { - print "Where have you installed mysql? "; - chomp($mysqldir = ); - last if -f "$mysqldir/bin/mysqladmin"; - print <; -chomp $answer; +$answer = showmessage(getmessage('BackupSummary',[$bibliocounter, $biblioitemcounter, $itemcounter, $membercounter, $filels]),'yn'); if ($answer=~/^n/i) { print qq| -- 2.39.2