[Koha-cvs] CVS: koha/misc Install.pm,1.59,1.60

MJ Ray slef at users.sourceforge.net
Mon Oct 27 18:36:19 CET 2003


Update of /cvsroot/koha/koha/misc
In directory sc8-pr-cvs1:/tmp/cvs-serv8869/misc

Modified Files:
	Install.pm 
Log Message:
Added getmysqldir function

Index: Install.pm
===================================================================
RCS file: /cvsroot/koha/koha/misc/Install.pm,v
retrieving revision 1.59
retrieving revision 1.60
diff -C2 -r1.59 -r1.60
*** Install.pm	27 Oct 2003 17:13:06 -0000	1.59
--- Install.pm	27 Oct 2003 17:36:17 -0000	1.60
***************
*** 959,963 ****
--- 959,994 ----
  }
  
+ =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
***************
*** 1628,1658 ****
      $mysqluser = 'root';
      $mysqlpass = '';
  
-     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 = <STDIN>);
- 	    last if -f "$mysqldir/bin/mysqladmin";
- 	print <<EOP;
- 
- I can't find it there either. 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
- provide here.
- 
- EOP
- #'
- 	}
-     }
      # we must not put the mysql root password on the command line
  	$mysqlpass=	showmessage(getmessage('MysqlRootPassword'),'silentfree');
--- 1659,1664 ----
      $mysqluser = 'root';
      $mysqlpass = '';
+ 	my $mysqldir = getmysqldir();
  
      # we must not put the mysql root password on the command line
  	$mysqlpass=	showmessage(getmessage('MysqlRootPassword'),'silentfree');
***************
*** 1829,1841 ****
  wants so.
  
- FIXME: If the installer does not know how to restart the Apache
- server (e.g., if the user is not actually using Apache), it still
- asks the question.
- 
  =cut
  
  $messages->{'RestartApache'}->{en} = heading('RESTART APACHE') . qq|
! Apache needs to be restarted to load the new configuration for Koha.
! This requires the root password.
  
  Would you like to try to restart Apache now?  [Y]/N: |;
--- 1835,1843 ----
  wants so.
  
  =cut
  
  $messages->{'RestartApache'}->{en} = heading('RESTART APACHE') . qq|
! 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: |;
***************
*** 1845,1850 ****
      my $response=showmessage(getmessage('RestartApache'), 'yn', 'y');
  
- 
- 
      unless ($response=~/^n/i) {
  	startsysout();
--- 1847,1850 ----
***************
*** 1869,1883 ****
  =cut
  
  #FIXME: rewrite to use Install.pm
  sub backupkoha {
! my $backupdir=($ENV{prefix}||'/usr/local/koha').'/backups';
! print "Please specify a backup directory [$backupdir]: ";
! 
! $answer = <STDIN>;
! chomp $answer;
  
! if ($answer) {
! 	$backupdir=$answer;
! }
  
  if (! -e $backupdir) {
--- 1869,1897 ----
  =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'}.'/backups';
  
! $answer = showmessage(getmessage('BackupDir',[$backupdir]),'free',$backupdir);
  
  if (! -e $backupdir) {
***************
*** 1900,1934 ****
  #
  #
! 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 = <STDIN>);
! 		last if -f "$mysqldir/bin/mysqladmin";
! 	print <<EOP;
! 
! I can't find it there either. 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
! provide here.
! 
! EOP
! #'
! 	}
! } else {
! print "Doing backup\n";
! }
  
  my ($sec, $min, $hr, $day, $month, $year) = (localtime(time))[0,1,2,3,4,5];
--- 1914,1918 ----
  #
  #
! my $mysqldir = getmysqldir();
  
  my ($sec, $min, $hr, $day, $month, $year) = (localtime(time))[0,1,2,3,4,5];
***************
*** 1959,1981 ****
  my $filels=`ls -hl $backupdir/Koha.backup_$date`;
  chomp $filels;
! printf qq|
! 
! Backed up:
! 
! %6d biblio entries
! %6d biblioitems entries
! %6d items entries
! %6d borrowers
! 
! File Listing
! ---------------------------------------------------------------------
! $filels
! ---------------------------------------------------------------------
! 
! Does this look right? ([Y]/N):
! |, $bibliocounter, $biblioitemcounter, $itemcounter, $membercounter;
! 
! $answer = <STDIN>;
! chomp $answer;
  
  if ($answer=~/^n/i) {
--- 1943,1947 ----
  my $filels=`ls -hl $backupdir/Koha.backup_$date`;
  chomp $filels;
! $answer = showmessage(getmessage('BackupSummary',[$bibliocounter, $biblioitemcounter, $itemcounter, $membercounter, $filels]),'yn');
  
  if ($answer=~/^n/i) {





More information about the Koha-cvs mailing list