From 897f959bda9e55ad525c551a3ab18cb6abdfacfb Mon Sep 17 00:00:00 2001 From: tipaul Date: Tue, 22 Jun 2004 15:32:43 +0000 Subject: [PATCH] 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 ... --- misc/Install.pm | 59 ++++++++++++++++--- misc/installer.pl | 2 +- .../french_unimarc_standard_systemprefs.sql | 22 +++++++ .../french_unimarc_standard_systemprefs.txt | 1 + 4 files changed, 75 insertions(+), 9 deletions(-) create mode 100644 misc/sql-datas/french_unimarc_standard_systemprefs.sql create mode 100644 misc/sql-datas/french_unimarc_standard_systemprefs.txt diff --git a/misc/Install.pm b/misc/Install.pm index 9ecf660104..477b3933f4 100644 --- a/misc/Install.pm +++ b/misc/Install.pm @@ -1437,10 +1437,11 @@ configuration. Press to continue: |; sub updateapacheconf { + my ($auto_install)=@_; my $logfiledir=$kohalogdir; my $httpdconf = $etcdir."/koha-httpd.conf"; - showmessage(getmessage('StartUpdateApache'), 'none'); + showmessage(getmessage('StartUpdateApache'), 'none') unless $auto_install->{NoPressEnter}; # to be polite about it: I don't think this should touch the main httpd.conf # QUESTION: Should we warn for includes_module too? @@ -1628,23 +1629,24 @@ $messages->{'CopyingFiles'}->{en}="Copying %s to %s.\n"; sub installfiles { + my ($auto_install) = @_; #MJR: preserve old files, just in case sub neatcopy { my $desc = shift; my $src = shift; my $tgt = shift; if (-e $tgt) { - print getmessage('CopyingFiles', ["old ".$desc,$tgt.strftime("%Y%m%d%H%M",localtime())]); + 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]); + print getmessage('CopyingFiles', [$desc,$tgt]) unless ($auto_install->{NoPressEnter}); startsysout; system("cp -R ".$src." ".$tgt); } my ($auto_install) = @_; - showmessage(getmessage('InstallFiles'),'none'); + showmessage(getmessage('InstallFiles'),'none') unless ($auto_install->{NoPressEnter}); neatcopy("admin templates", 'intranet-html', "$intranetdir/htdocs"); neatcopy("admin interface", 'intranet-cgi', "$intranetdir/cgi-bin"); @@ -1893,6 +1895,9 @@ sample data, install them. =cut +$messages->{'ConfirmFileUpload'}->{en} = qq| +Confirm loading of this file into Koha [Y]/N: |; + sub populatedatabase { my ($auto_install) = @_; my $input; @@ -1957,9 +1962,47 @@ sub populatedatabase { } 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 =; + 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 = ; + 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 Bienvenue dans Koha', 'Library name as shown on main opac page', NULL, ''); +INSERT INTO systempreferences (variable, value, explanation, options, type) VALUES ('ldapserver', '', 'your ldap server', NULL, 'free'); +INSERT INTO systempreferences (variable, value, explanation, options, type) VALUES ('ldapinfos', '', 'ldap info. The ldap will be used in dn : uid=xxx, ', NULL, 'free'); \ No newline at end of file diff --git a/misc/sql-datas/french_unimarc_standard_systemprefs.txt b/misc/sql-datas/french_unimarc_standard_systemprefs.txt new file mode 100644 index 0000000000..853a4f24b1 --- /dev/null +++ b/misc/sql-datas/french_unimarc_standard_systemprefs.txt @@ -0,0 +1 @@ +This file contains systemprefs for french UNIMARC standard setup \ No newline at end of file -- 2.39.2