[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Koha-cvs] CVS: koha/z3950 processz3950queue,1.3,1.4 z3950-daemon-launch
From: |
Paul POULAIN |
Subject: |
[Koha-cvs] CVS: koha/z3950 processz3950queue,1.3,1.4 z3950-daemon-launch.sh,1.1,1.2 z3950-daemon-shell.sh,1.1,1.2 |
Date: |
Tue, 29 Apr 2003 09:49:01 -0700 |
Update of /cvsroot/koha/koha/z3950
In directory sc8-pr-cvs1:/tmp/cvs-serv3884/z3950
Modified Files:
processz3950queue z3950-daemon-launch.sh z3950-daemon-shell.sh
Log Message:
really proud of this commit :-)
z3950 search and import seems to works fine.
Let me explain how :
* a "search z3950" button is added in the addbiblio template.
* when clicked, a popup appears and z3950/search.pl is called
* z3950/search.pl calls addz3950search in the DB
* the z3950 daemon retrieve the records and stores them in z3950results AND in
marc_breeding table.
* as long as there as searches pending, the popup auto refresh every 2 seconds,
and says how many searches are pending.
* when the user clicks on a z3950 result => the parent popup is called with the
requested biblio, and auto-filled
Note :
* character encoding support : (It's a nightmare...) In the z3950servers table,
a "encoding" column has been added. You can put "UNIMARC" or "USMARC" in this
column. Depending on this, the char_decode in C4::Biblio.pm replaces
marc-char-encode by an iso 8859-1 encoding. Note that in the breeding import
this value has been added too, for a better support.
* the marc_breeding and z3950* tables have been modified : they have an
encoding column and the random z3950 number is stored too for convenience =>
it's the key I use to list only requested biblios in the popup.
Index: processz3950queue
===================================================================
RCS file: /cvsroot/koha/koha/z3950/processz3950queue,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -r1.3 -r1.4
*** processz3950queue 29 Apr 2003 08:09:42 -0000 1.3
--- processz3950queue 29 Apr 2003 16:48:25 -0000 1.4
***************
*** 51,59 ****
if ((time-$lastrun)>5) {
print "starting loop\n";
if ($checkqueue) { # everytime a SIG{HUP} is recieved
$checkqueue=0;
! my $sth=$dbh->prepare("select id,term,type,servers from
z3950queue order by id");
$sth->execute;
! while (my ($id, $term, $type, $servers) =
$sth->fetchrow) {
if ($forkcounter<12) {
my $now=time();
--- 51,60 ----
if ((time-$lastrun)>5) {
print "starting loop\n";
+ $checkqueue = 1; # FIXME during testing, this line forces the
loop. REMOVE it to use SIG{HUP} when "daemonized" !
if ($checkqueue) { # everytime a SIG{HUP} is recieved
$checkqueue=0;
! my $sth=$dbh->prepare("select
id,term,type,servers,identifier from z3950queue order by id");
$sth->execute;
! while (my ($id, $term, $type, $servers,$random) =
$sth->fetchrow) {
if ($forkcounter<12) {
my $now=time();
***************
*** 94,97 ****
--- 95,100 ----
my $stillprocessing=0;
my $globalname;
+ my $globalsyntax;
+ my $globalencoding;
foreach $serverinfo (split(/\s+/,
$servers)) {
(next) if
($serverdone{$serverinfo} == 1);
***************
*** 101,110 ****
} else {
my $dbi =
C4::Context->dbh;
! my ($name, $server,
$database, $user, $password) = split(/\//, $serverinfo, 5);
$globalname=$name;
$server=~/(.*)\:(\d+)/;
my $servername=$1;
my $port=$2;
! print "Processing
$type=$term at $name $server $database (".($forkcounter+1)." forks)\n";
$now=time();
my
$q_serverinfo=$dbi->quote($serverinfo);
--- 104,114 ----
} else {
my $dbi =
C4::Context->dbh;
! my ($name, $server,
$database, $user, $password,$syntax) = split(/\//, $serverinfo, 6);
$globalname=$name;
+ $globalsyntax = $syntax;
$server=~/(.*)\:(\d+)/;
my $servername=$1;
my $port=$2;
! print "Processing
$type=$term at $name $server $database $syntax (".($forkcounter+1)." forks)\n";
$now=time();
my
$q_serverinfo=$dbi->quote($serverinfo);
***************
*** 150,161 ****
warn "no
connection at $globalname ";
} else {
! eval {
$conn->option(preferredRecordSyntax => Net::Z3950::RecordSyntax::USMARC);};
if ($@) {
print
"$globalname ERROR: address@hidden";
} else {
! print
"Q: $query\n";
my
$rs=$conn->search($query);
pe();
my
$numresults=$rs->size();
pe();
my $i;
--- 154,172 ----
warn "no
connection at $globalname ";
} else {
! warn
"$globalname ==> $globalsyntax";
! eval {
$conn->option(preferredRecordSyntax => Net::Z3950::RecordSyntax::USMARC);} if
($globalsyntax eq "USMARC");
! eval {
$conn->option(preferredRecordSyntax => Net::Z3950::RecordSyntax::UNIMARC);} if
($globalsyntax eq "UNIMARC");
if ($@) {
print
"$globalname ERROR: address@hidden";
} else {
! # print
"Q: $query\n";
my
$rs=$conn->search($query);
pe();
my
$numresults=$rs->size();
+ if
($numresults eq 0) {
+
warn "$globalname ==> answered : no records found";
+ } else {
+
warn "$globalname ==> answered : $numresults found";
+ }
pe();
my $i;
***************
*** 164,173 ****
for
($i=1; $i<=(($numresults<80) ? ($numresults) : (80)); $i++) {
my $rec=$rs->record($i);
!
my $marcdata=$rec->render();
!
my $marcrecord = MARC::File::USMARC::decode($rec->render());
!
warn "$globalname ==> ".$marcrecord->as_formatted();
!
$result.=$marcdata;
!
my ($notmarcrecord,$alreadyindb,$alreadyinfarm,$imported) =
ImportBreeding($marcdata,1,"Z3950-$globalname");
}
my
$scantimerend=time();
my
$numrecords;
--- 175,194 ----
for
($i=1; $i<=(($numresults<80) ? ($numresults) : (80)); $i++) {
my $rec=$rs->record($i);
!
my $marcdata;
!
# use render() or rawdata() depending on the type of the returned record
!
my $marcrecord;
!
if (ref($rec) eq "Net::Z3950::Record::USMARC") {
!
$marcdata = $rec->rawdata();
!
$marcrecord = MARC::File::USMARC::decode($rec->rawdata())
!
}
!
if (ref($rec) eq "Net::Z3950::Record::UNIMARC") {
!
$marcdata = $rec->render();
!
$marcrecord = MARC::File::USMARC::decode($rec->render())
!
}
!
$globalencoding = ref($rec);
!
$result.=$marcdata;
}
+ my
@x=split /::/,$globalencoding;
+ my
($notmarcrecord,$alreadyindb,$alreadyinfarm,$imported) =
ImportBreeding($result,-1,"Z3950-$globalname",$x[3],$random);
my
$scantimerend=time();
my
$numrecords;
***************
*** 231,235 ****
exit;
sub pe {
! # return 0;
my $code=$conn->errcode();
my $msg=$conn->errmsg();
--- 252,256 ----
exit;
sub pe {
! return 0;
my $code=$conn->errcode();
my $msg=$conn->errmsg();
Index: z3950-daemon-launch.sh
===================================================================
RCS file: /cvsroot/koha/koha/z3950/z3950-daemon-launch.sh,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** z3950-daemon-launch.sh 22 Nov 2002 10:15:22 -0000 1.1
--- z3950-daemon-launch.sh 29 Apr 2003 16:48:25 -0000 1.2
***************
*** 18,22 ****
RunAsUser=apache
! KohaZ3950Dir=/usr/local/www/koha/htdocs/cgi-bin/koha/acqui.simple
export KohaZ3950Dir
--- 18,22 ----
RunAsUser=apache
! KohaZ3950Dir=/home/paul/koha.dev/koha/z3950
export KohaZ3950Dir
***************
*** 42,45 ****
--- 42,60 ----
#--------------
# $Log$
+ # Revision 1.2 2003/04/29 16:48:25 tipaul
+ # really proud of this commit :-)
+ # z3950 search and import seems to works fine.
+ # Let me explain how :
+ # * a "search z3950" button is added in the addbiblio template.
+ # * when clicked, a popup appears and z3950/search.pl is called
+ # * z3950/search.pl calls addz3950search in the DB
+ # * the z3950 daemon retrieve the records and stores them in z3950results AND
in marc_breeding table.
+ # * as long as there as searches pending, the popup auto refresh every 2
seconds, and says how many searches are pending.
+ # * when the user clicks on a z3950 result => the parent popup is called with
the requested biblio, and auto-filled
+ #
+ # Note :
+ # * character encoding support : (It's a nightmare...) In the z3950servers
table, a "encoding" column has been added. You can put "UNIMARC" or "USMARC" in
this column. Depending on this, the char_decode in C4::Biblio.pm replaces
marc-char-encode by an iso 8859-1 encoding. Note that in the breeding import
this value has been added too, for a better support.
+ # * the marc_breeding and z3950* tables have been modified : they have an
encoding column and the random z3950 number is stored too for convenience =>
it's the key I use to list only requested biblios in the popup.
+ #
# Revision 1.1 2002/11/22 10:15:22 tipaul
# moving z3950 related scripts to specific dir
Index: z3950-daemon-shell.sh
===================================================================
RCS file: /cvsroot/koha/koha/z3950/z3950-daemon-shell.sh,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** z3950-daemon-shell.sh 22 Nov 2002 10:15:22 -0000 1.1
--- z3950-daemon-shell.sh 29 Apr 2003 16:48:25 -0000 1.2
***************
*** 14,20 ****
#----------------------------
! KohaZ3950Dir=/usr/local/www/koha/htdocs/cgi-bin/koha/acqui.simple
! KohaModuleDir=/usr/local/koha/modules
! LogDir=/var/log/koha
#----------------------------
--- 14,20 ----
#----------------------------
! KohaZ3950Dir=/home/paul/koha.dev/koha/z3950
! KohaModuleDir=/home/paul/koha.dev/koha
! LogDir=/tmp
#----------------------------
***************
*** 42,45 ****
--- 42,60 ----
#-------------------
# $Log$
+ # Revision 1.2 2003/04/29 16:48:25 tipaul
+ # really proud of this commit :-)
+ # z3950 search and import seems to works fine.
+ # Let me explain how :
+ # * a "search z3950" button is added in the addbiblio template.
+ # * when clicked, a popup appears and z3950/search.pl is called
+ # * z3950/search.pl calls addz3950search in the DB
+ # * the z3950 daemon retrieve the records and stores them in z3950results AND
in marc_breeding table.
+ # * as long as there as searches pending, the popup auto refresh every 2
seconds, and says how many searches are pending.
+ # * when the user clicks on a z3950 result => the parent popup is called with
the requested biblio, and auto-filled
+ #
+ # Note :
+ # * character encoding support : (It's a nightmare...) In the z3950servers
table, a "encoding" column has been added. You can put "UNIMARC" or "USMARC" in
this column. Depending on this, the char_decode in C4::Biblio.pm replaces
marc-char-encode by an iso 8859-1 encoding. Note that in the breeding import
this value has been added too, for a better support.
+ # * the marc_breeding and z3950* tables have been modified : they have an
encoding column and the random z3950 number is stored too for convenience =>
it's the key I use to list only requested biblios in the popup.
+ #
# Revision 1.1 2002/11/22 10:15:22 tipaul
# moving z3950 related scripts to specific dir
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Koha-cvs] CVS: koha/z3950 processz3950queue,1.3,1.4 z3950-daemon-launch.sh,1.1,1.2 z3950-daemon-shell.sh,1.1,1.2,
Paul POULAIN <=
- Prev by Date:
[Koha-cvs] CVS: koha/acqui.simple addbiblio.pl,1.24,1.25 marcimport.pl,1.32,1.33
- Next by Date:
[Koha-cvs] CVS: koha/koha-tmpl/intranet-tmpl/default/en/parameters z3950servers.tmpl,1.8,1.9
- Previous by thread:
[Koha-cvs] CVS: koha/acqui.simple addbiblio.pl,1.24,1.25 marcimport.pl,1.32,1.33
- Next by thread:
[Koha-cvs] CVS: koha/koha-tmpl/intranet-tmpl/default/en/parameters z3950servers.tmpl,1.8,1.9
- Index(es):