koha-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Koha-cvs] CVS: koha/misc installer.pl,1.17,1.18 Install.pm,1.74,1.75


From: Paul POULAIN
Subject: [Koha-cvs] CVS: koha/misc installer.pl,1.17,1.18 Install.pm,1.74,1.75
Date: Tue, 22 Jun 2004 08:32:46 -0700

Update of /cvsroot/koha/koha/misc
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25595/misc

Modified Files:
        installer.pl Install.pm 
Log Message:
adding new feature to installer :
the user can select sql-datas to add to it's DB
can be populated by any SQL
french UNIMARC sample being added really soon
- framework for monography
- framework for URL
- framework for ...
- Personal UNIMARC autority
...

Index: installer.pl
===================================================================
RCS file: /cvsroot/koha/koha/misc/installer.pl,v
retrieving revision 1.17
retrieving revision 1.18
diff -C2 -r1.17 -r1.18
*** installer.pl        22 Jun 2004 11:33:47 -0000      1.17
--- installer.pl        22 Jun 2004 15:32:43 -0000      1.18
***************
*** 110,114 ****
  getapachevhostinfo($auto_install);
  
! updateapacheconf();
  
  # basicauthentication();
--- 110,114 ----
  getapachevhostinfo($auto_install);
  
! updateapacheconf($auto_install);
  
  # basicauthentication();

Index: Install.pm
===================================================================
RCS file: /cvsroot/koha/koha/misc/Install.pm,v
retrieving revision 1.74
retrieving revision 1.75
diff -C2 -r1.74 -r1.75
*** Install.pm  22 Jun 2004 11:33:47 -0000      1.74
--- Install.pm  22 Jun 2004 15:32:43 -0000      1.75
***************
*** 1438,1445 ****
  
  sub updateapacheconf {
      my $logfiledir=$kohalogdir;
      my $httpdconf = $etcdir."/koha-httpd.conf";
     
!     showmessage(getmessage('StartUpdateApache'), 'none');
        # to be polite about it: I don't think this should touch the main 
httpd.conf
  
--- 1438,1446 ----
  
  sub updateapacheconf {
+       my ($auto_install)address@hidden;
      my $logfiledir=$kohalogdir;
      my $httpdconf = $etcdir."/koha-httpd.conf";
     
!     showmessage(getmessage('StartUpdateApache'), 'none') unless 
$auto_install->{NoPressEnter};
        # to be polite about it: I don't think this should touch the main 
httpd.conf
  
***************
*** 1629,1632 ****
--- 1630,1634 ----
  sub installfiles {
  
+       my ($auto_install) = @_;
        #MJR: preserve old files, just in case
        sub neatcopy {
***************
*** 1635,1643 ****
                my $tgt = shift;
                if (-e $tgt) {
!               print getmessage('CopyingFiles', ["old 
".$desc,$tgt.strftime("%Y%m%d%H%M",localtime())]);
                        startsysout();
                        system("mv ".$tgt." 
".$tgt.strftime("%Y%m%d%H%M",localtime()));
                }
!               print getmessage('CopyingFiles', [$desc,$tgt]);
                startsysout;
                system("cp -R ".$src." ".$tgt);
--- 1637,1645 ----
                my $tgt = shift;
                if (-e $tgt) {
!               print getmessage('CopyingFiles', ["old 
".$desc,$tgt.strftime("%Y%m%d%H%M",localtime())]) unless 
($auto_install->{NoPressEnter});
                        startsysout();
                        system("mv ".$tgt." 
".$tgt.strftime("%Y%m%d%H%M",localtime()));
                }
!               print getmessage('CopyingFiles', [$desc,$tgt]) unless 
($auto_install->{NoPressEnter});
                startsysout;
                system("cp -R ".$src." ".$tgt);
***************
*** 1645,1649 ****
  
        my ($auto_install) = @_;
!       showmessage(getmessage('InstallFiles'),'none');
  
        neatcopy("admin templates", 'intranet-html', "$intranetdir/htdocs");
--- 1647,1651 ----
  
        my ($auto_install) = @_;
!       showmessage(getmessage('InstallFiles'),'none') unless 
($auto_install->{NoPressEnter});
  
        neatcopy("admin templates", 'intranet-html', "$intranetdir/htdocs");
***************
*** 1894,1897 ****
--- 1896,1902 ----
  =cut
  
+ $messages->{'ConfirmFileUpload'}->{en} = qq|
+ Confirm loading of this file into Koha  [Y]/N: |;
+ 
  sub populatedatabase {
        my ($auto_install) = @_;
***************
*** 1958,1964 ****
        startsysout();  
        system("$mysqldir/bin/mysql -u$user $database -e \"update 
systempreferences set value='$language' where variable='opaclanguages'\"");
  }
  
- 
  =item restartapache
  
--- 1963,2007 ----
        startsysout();  
        system("$mysqldir/bin/mysql -u$user $database -e \"update 
systempreferences set value='$language' where variable='opaclanguages'\"");
+       # CHECK for any other file to append...
+       my @sql;
+       push @sql,"FINISHED";
+       if (-d "scripts/misc/sql-datas") {
+           opendir D, "scripts/misc/sql-datas";
+           foreach my $sql (readdir D) {
+                       next unless ($sql =~ /.txt$/);
+                       push @sql, $sql;
+           }
+       }
+       my $loopend=0;
+       while (not $loopend) {
+               print heading("SELECT SQL FILE");
+               print qq|
+ Select a file to append to the Koha DB.
+ enter a number. A detailled explanation of the file will be given
+ if you confirm, the file will be added to the DB
+ |;
+               for (my $i=0;$i<=$#sql;$i++) {
+                       print "$i => ".$sql[$i]."\n";
+               }
+               my $response =<STDIN>;
+               if ($response==0) {
+                       $loopend = 1;
+               } else {
+                       # show the content of the file
+                       my $FileToUpload = $sql[$response];
+                       open FILE,"scripts/misc/sql-datas/$FileToUpload";
+                       my $content = <FILE>;
+                       print heading("INSERT $FileToUpload ?")."$content\n";
+                       # ask confirmation
+                       $response=showmessage(getmessage('ConfirmFileUpload'), 
'yn', 'y');
+                       # if confirmed, upload the file in the DB
+                       unless ($response =~/^n/i) {
+                               $FileToUpload =~ s/\.txt/\.sql/;
+                               system("$mysqldir/bin/mysql -u$user $database 
<scripts/misc/sql-datas/$FileToUpload");
+                       }
+               }
+       }
  }
  
  =item restartapache
  
***************
*** 1986,1994 ****
                # Need to support other init structures here?
                if (-e "/etc/rc.d/init.d/httpd") {
!                       system('su root -c /etc/rc.d/init.d/httpd restart');
                } elsif (-e "/etc/init.d/apache") {
!                       system('su root -c /etc/init.d/apache restart');
                } elsif (-e "/etc/init.d/apache-ssl") {
!                       system('su root -c /etc/init.d/apache-ssl restart');
                }
        }
--- 2029,2037 ----
                # Need to support other init structures here?
                if (-e "/etc/rc.d/init.d/httpd") {
!                       system('su root -c "/etc/rc.d/init.d/httpd restart"');
                } elsif (-e "/etc/init.d/apache") {
!                       system('su root -c "/etc/init.d/apache restart"');
                } elsif (-e "/etc/init.d/apache-ssl") {
!                       system('su root -c "/etc/init.d/apache-ssl restart"');
                }
        }




reply via email to

[Prev in Thread] Current Thread [Next in Thread]