Bugzilla – Attachment 172206 Details for
Bug 35659
OAI harvester
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 35659: (more QA follow-ups)
Bug-35659-more-QA-follow-ups.patch (text/plain), 35.33 KB, created by
Victor Grousset/tuxayo
on 2024-09-30 02:16:24 UTC
(
hide
)
Description:
Bug 35659: (more QA follow-ups)
Filename:
MIME Type:
Creator:
Victor Grousset/tuxayo
Created:
2024-09-30 02:16:24 UTC
Size:
35.33 KB
patch
obsolete
>From f2d0a17b00119c97625aa3328d1d2bbfb0583e30 Mon Sep 17 00:00:00 2001 >From: Matthias Meusburger <matthias.meusburger@biblibre.com> >Date: Wed, 22 May 2024 10:06:17 +0000 >Subject: [PATCH] Bug 35659: (more QA follow-ups) > >Rename Oaipmh to OAI >Rename oaiservers to oai_servers >Rename OaiServer to OAIServer >Rename oai_servers.id to oai_servers.oai_server_id >Rename ServerSearch to server_search >Use a callback function for logs >Use context for string "Set" >Split translation string > >Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net> >Signed-off-by: David Cook <dcook@prosentient.com.au> >--- > Koha/Import/{Oaipmh => OAI}/Authorities.pm | 10 +++--- > Koha/Import/{Oaipmh => OAI}/Authority.pm | 6 ++-- > Koha/Import/{Oaipmh => OAI}/Biblio.pm | 6 ++-- > Koha/Import/{Oaipmh => OAI}/Biblios.pm | 10 +++--- > Koha/OAI/Client/Harvester.pm | 33 +++++++++---------- > Koha/{OaiServer.pm => OAIServer.pm} | 6 ++-- > Koha/{OaiServers.pm => OAIServers.pm} | 10 +++--- > admin/{oaiservers.pl => oai_servers.pl} | 22 ++++++------- > .../data/mysql/atomicupdate/Bug-35659.pl | 20 +++++------ > installer/data/mysql/kohastructure.sql | 22 ++++++------- > .../prog/en/includes/admin-menu.inc | 2 +- > .../prog/en/includes/oai-admin-search.inc | 2 +- > .../prog/en/modules/admin/admin-home.tt | 2 +- > .../admin/{oaiservers.tt => oai_servers.tt} | 24 +++++++------- > misc/cronjobs/harvest_oai.pl | 15 ++++++--- > t/db_dependent/Koha/OAIHarvester.t | 10 +++--- > t/db_dependent/Koha/OAIServers.t | 18 +++++----- > 17 files changed, 112 insertions(+), 106 deletions(-) > rename Koha/Import/{Oaipmh => OAI}/Authorities.pm (81%) > rename Koha/Import/{Oaipmh => OAI}/Authority.pm (87%) > rename Koha/Import/{Oaipmh => OAI}/Biblio.pm (88%) > rename Koha/Import/{Oaipmh => OAI}/Biblios.pm (82%) > rename Koha/{OaiServer.pm => OAIServer.pm} (89%) > rename Koha/{OaiServers.pm => OAIServers.pm} (85%) > rename admin/{oaiservers.pl => oai_servers.pl} (85%) > rename koha-tmpl/intranet-tmpl/prog/en/modules/admin/{oaiservers.tt => oai_servers.tt} (87%) > >diff --git a/Koha/Import/Oaipmh/Authorities.pm b/Koha/Import/OAI/Authorities.pm >similarity index 81% >rename from Koha/Import/Oaipmh/Authorities.pm >rename to Koha/Import/OAI/Authorities.pm >index 90372a8609..c66daa6816 100644 >--- a/Koha/Import/Oaipmh/Authorities.pm >+++ b/Koha/Import/OAI/Authorities.pm >@@ -1,4 +1,4 @@ >-package Koha::Import::Oaipmh::Authorities; >+package Koha::Import::OAI::Authorities; > > # This file is part of Koha. > # >@@ -16,13 +16,13 @@ package Koha::Import::Oaipmh::Authorities; > > use Modern::Perl; > >-use Koha::Import::Oaipmh::Authority; >+use Koha::Import::OAI::Authority; > > use base qw(Koha::Objects); > > =head1 NAME > >-Koha::Import::Oaipmh::Authorities >+Koha::Import::OAI::Authorities > > This object represents a collection of OAI-PMH records being imported as authorities > >@@ -36,7 +36,7 @@ This object represents a collection of OAI-PMH records being imported as authori > =cut > > sub _type { >- return 'ImportOaipmhAuthority'; >+ return 'ImportOAIAuthority'; > } > > =head3 object_class >@@ -46,6 +46,6 @@ Koha::Object class > =cut > > sub object_class { >- return 'Koha::Import::Oaipmh::Authority'; >+ return 'Koha::Import::OAI::Authority'; > } > 1; >diff --git a/Koha/Import/Oaipmh/Authority.pm b/Koha/Import/OAI/Authority.pm >similarity index 87% >rename from Koha/Import/Oaipmh/Authority.pm >rename to Koha/Import/OAI/Authority.pm >index fe90c432a2..8f44b235f4 100644 >--- a/Koha/Import/Oaipmh/Authority.pm >+++ b/Koha/Import/OAI/Authority.pm >@@ -1,4 +1,4 @@ >-package Koha::Import::Oaipmh::Authority; >+package Koha::Import::OAI::Authority; > > # This file is part of Koha. > # >@@ -20,7 +20,7 @@ use base qw(Koha::Object); > > =head1 NAME > >-Koha::Import::Oaipmh::Authority >+Koha::Import::OAI::Authority > > This object represents an OAI-PMH record being imported as an authority > >@@ -35,7 +35,7 @@ This object represents an OAI-PMH record being imported as an authority > =cut > > sub _type { >- return 'ImportOaipmhAuthority'; >+ return 'ImportOAIAuthority'; > } > > 1; >diff --git a/Koha/Import/Oaipmh/Biblio.pm b/Koha/Import/OAI/Biblio.pm >similarity index 88% >rename from Koha/Import/Oaipmh/Biblio.pm >rename to Koha/Import/OAI/Biblio.pm >index d59e5a6449..42ad046e72 100644 >--- a/Koha/Import/Oaipmh/Biblio.pm >+++ b/Koha/Import/OAI/Biblio.pm >@@ -1,4 +1,4 @@ >-package Koha::Import::Oaipmh::Biblio; >+package Koha::Import::OAI::Biblio; > > # This file is part of Koha. > # >@@ -20,7 +20,7 @@ use base qw(Koha::Object); > > =head1 NAME > >-Koha::Import::Oaipmh::Biblio >+Koha::Import::OAI::Biblio > > This object represents an OAI-PMH record being imported as a bibliographic record > >@@ -34,7 +34,7 @@ This object represents an OAI-PMH record being imported as a bibliographic recor > =cut > > sub _type { >- return 'ImportOaipmhBiblio'; >+ return 'ImportOaiBiblio'; > } > > 1; >diff --git a/Koha/Import/Oaipmh/Biblios.pm b/Koha/Import/OAI/Biblios.pm >similarity index 82% >rename from Koha/Import/Oaipmh/Biblios.pm >rename to Koha/Import/OAI/Biblios.pm >index 9ae111e96b..59ceba9cd3 100644 >--- a/Koha/Import/Oaipmh/Biblios.pm >+++ b/Koha/Import/OAI/Biblios.pm >@@ -1,4 +1,4 @@ >-package Koha::Import::Oaipmh::Biblios; >+package Koha::Import::OAI::Biblios; > > # This file is part of Koha. > # >@@ -16,13 +16,13 @@ package Koha::Import::Oaipmh::Biblios; > > use Modern::Perl; > >-use Koha::Import::Oaipmh::Biblio; >+use Koha::Import::OAI::Biblio; > > use base qw(Koha::Objects); > > =head1 NAME > >-Koha::Import::Oaipmh::Biblios >+Koha::Import::OAI::Biblios > > This object represents a collection of OAI-PMH records being imported as bibliographic records > >@@ -36,7 +36,7 @@ This object represents a collection of OAI-PMH records being imported as bibliog > =cut > > sub _type { >- return 'ImportOaipmhBiblio'; >+ return 'ImportOaiBiblio'; > } > > =head3 object_class >@@ -46,6 +46,6 @@ Koha::Object class > =cut > > sub object_class { >- return 'Koha::Import::Oaipmh::Biblio'; >+ return 'Koha::Import::OAI::Biblio'; > } > 1; >diff --git a/Koha/OAI/Client/Harvester.pm b/Koha/OAI/Client/Harvester.pm >index bcb0106952..462f56e06f 100644 >--- a/Koha/OAI/Client/Harvester.pm >+++ b/Koha/OAI/Client/Harvester.pm >@@ -36,11 +36,11 @@ use C4::Log qw( cronlogaction ); > use HTTP::OAI; > use HTTP::OAI::Metadata::OAI_DC; > use Koha::DateUtils qw( dt_from_string ); >-use Koha::OaiServers; >-use Koha::Import::Oaipmh::Biblio; >-use Koha::Import::Oaipmh::Biblios; >-use Koha::Import::Oaipmh::Authority; >-use Koha::Import::Oaipmh::Authorities; >+use Koha::OAIServers; >+use Koha::Import::OAI::Biblio; >+use Koha::Import::OAI::Biblios; >+use Koha::Import::OAI::Authority; >+use Koha::Import::OAI::Authorities; > use Koha::XSLT::Base; > use MARC::File::XML; > use MARC::Record; >@@ -61,19 +61,18 @@ my $strp = DateTime::Format::Strptime->new( > our $xslt_engine = Koha::XSLT::Base->new; > > =head2 new >- >-$harvester = Koha::OAI::Client::Harvester->new( { server => $server, verbose => $verbose, days => $days, force => $force } ); >+$harvester = Koha::OAI::Client::Harvester->new( { server => $server, days => $days, force => $force, logger => \&logger } ); > > New instance of Koha::OAI::Client::Harvester > >-C<$server> An OAI repository (Koha::OaiServer) >- >-C<$verbose> print log messages to stdout when enabled >+C<$server> An OAI repository (Koha::OAIServer) > > C<$days> number of days to harvest from (optional) > > C<$force> force harvesting (ignore records datestamps) > >+C<$logger> a callback function to handle logs (optional) >+ > =cut > > sub new { >@@ -250,7 +249,7 @@ sub processRecord { > } > my $imported_record; > if ( $server->recordtype eq "biblio" ) { >- $imported_record = Koha::Import::Oaipmh::Biblios->find( >+ $imported_record = Koha::Import::OAI::Biblios->find( > { > repository => $server->endpoint, > identifier => $oai_record->identifier, >@@ -258,7 +257,7 @@ sub processRecord { > } > ); > } else { >- $imported_record = Koha::Import::Oaipmh::Authorities->find( >+ $imported_record = Koha::Import::OAI::Authorities->find( > { > repository => $server->endpoint, > identifier => $oai_record->identifier, >@@ -318,7 +317,7 @@ sub processRecord { > if ( $server->recordtype eq "biblio" ) { > my ( $biblionumber, $biblioitemnumber ) = AddBiblio($marcrecord); > $self->printlog( $oai_record->identifier . " added, biblionumber: $biblionumber" ); >- Koha::Import::Oaipmh::Biblio->new( >+ Koha::Import::OAI::Biblio->new( > { > repository => $server->endpoint, > identifier => $oai_record->identifier, >@@ -330,7 +329,7 @@ sub processRecord { > } else { > my $authid = AddAuthority( $marcrecord, "", GuessAuthTypeCode($marcrecord) ); > $self->printlog( $oai_record->identifier . " added, authid: $authid" ); >- Koha::Import::Oaipmh::Authority->new( >+ Koha::Import::OAI::Authority->new( > { > repository => $server->endpoint, > identifier => $oai_record->identifier, >@@ -350,15 +349,15 @@ sub processRecord { > > =head2 $self->printlog > >-This method adds a cronlog and prints to stdout if verbose is enabled >+This method gives the caller an opportunity to handle log messages > > =cut > > sub printlog { > my ( $self, $message ) = @_; >+ return unless $self->{logger}; > $message = $self->{server}->servername . ": " . $message; >- print $message . "\n" if ( $self->{verbose} ); >- cronlogaction( { info => $message } ); >+ $self->{logger}->($message); > } > > 1; >diff --git a/Koha/OaiServer.pm b/Koha/OAIServer.pm >similarity index 89% >rename from Koha/OaiServer.pm >rename to Koha/OAIServer.pm >index fa97c1f0b7..2261aa3707 100644 >--- a/Koha/OaiServer.pm >+++ b/Koha/OAIServer.pm >@@ -1,4 +1,4 @@ >-package Koha::OaiServer; >+package Koha::OAIServer; > > # This file is part of Koha. > # >@@ -24,7 +24,7 @@ use base qw(Koha::Object); > > =head1 NAME > >-Koha::OaiServer - Koha OaiServer Object class >+Koha::OAIServer - Koha OAIServer Object class > > =head1 API > >@@ -39,7 +39,7 @@ Return type of Object relating to Schema ResultSet > =cut > > sub _type { >- return 'Oaiserver'; >+ return 'OaiServer'; > } > > 1; >diff --git a/Koha/OaiServers.pm b/Koha/OAIServers.pm >similarity index 85% >rename from Koha/OaiServers.pm >rename to Koha/OAIServers.pm >index b752419c5d..9e822e49cd 100644 >--- a/Koha/OaiServers.pm >+++ b/Koha/OAIServers.pm >@@ -1,4 +1,4 @@ >-package Koha::OaiServers; >+package Koha::OAIServers; > > # This file is part of Koha. > # >@@ -20,13 +20,13 @@ use Modern::Perl; > > use Koha::Database; > >-use Koha::OaiServer; >+use Koha::OAIServer; > > use base qw(Koha::Objects); > > =head1 NAME > >-Koha::OaiServers - Koha OaiServer Object set class >+Koha::OAIServers - Koha OAIServer Object set class > > =head1 API > >@@ -41,7 +41,7 @@ Return type of object, relating to Schema ResultSet > =cut > > sub _type { >- return 'Oaiserver'; >+ return 'OaiServer'; > } > > =head3 object_class >@@ -51,7 +51,7 @@ Return object class > =cut > > sub object_class { >- return 'Koha::OaiServer'; >+ return 'Koha::OAIServer'; > } > > 1; >diff --git a/admin/oaiservers.pl b/admin/oai_servers.pl >similarity index 85% >rename from admin/oaiservers.pl >rename to admin/oai_servers.pl >index b9dc686b7c..af35b14110 100755 >--- a/admin/oaiservers.pl >+++ b/admin/oai_servers.pl >@@ -26,7 +26,7 @@ use C4::Context; > use C4::Auth qw( get_template_and_user ); > use C4::Output qw( output_html_with_http_headers ); > use Koha::Database; >-use Koha::OaiServers; >+use Koha::OAIServers; > > # Initialize CGI, template, database > >@@ -38,13 +38,13 @@ my $searchfield = ''; > > my ( $template, $loggedinuser, $cookie ) = get_template_and_user( > { >- template_name => "admin/oaiservers.tt", >+ template_name => "admin/oai_servers.tt", > query => $input, > type => "intranet", > flagsrequired => { parameters => 'manage_search_targets' }, > } > ); >-my $script_name = "/cgi-bin/koha/admin/oaiservers.pl"; >+my $script_name = "/cgi-bin/koha/admin/oai_servers.pl"; > my $path = C4::Context->config('intrahtdocs') . "/prog/"; > > $template->param( script_name => $script_name, xslt_path => $path ); >@@ -55,7 +55,7 @@ my $schema = Koha::Database->new()->schema(); > # First process a confirmed delete, or save a validated record > > if ( $op eq 'cud-delete_confirmed' && $id ) { >- my $server = Koha::OaiServers->find($id); >+ my $server = Koha::OAIServers->find($id); > if ($server) { > $server->delete; > $template->param( msg_deleted => 1, msg_add => $server->servername ); >@@ -69,7 +69,7 @@ if ( $op eq 'cud-delete_confirmed' && $id ) { > add_xslt/; > my $formdata = _form_data_hashref( $input, \@fields ); > if ($id) { >- my $server = Koha::OaiServers->find($id); >+ my $server = Koha::OAIServers->find($id); > if ($server) { > $server->set($formdata)->store; > $template->param( msg_updated => 1, msg_add => $formdata->{servername} ); >@@ -78,7 +78,7 @@ if ( $op eq 'cud-delete_confirmed' && $id ) { > } > $id = 0; > } else { >- Koha::OaiServer->new($formdata)->store; >+ Koha::OAIServer->new($formdata)->store; > $template->param( msg_added => 1, msg_add => $formdata->{servername} ); > } > } elsif ( $op eq 'search' ) { >@@ -91,14 +91,14 @@ if ( $op eq 'cud-delete_confirmed' && $id ) { > > my $data = []; > if ( $op eq 'add' || $op eq 'edit' ) { >- $data = ServerSearch( $schema, $id, $searchfield ) if $searchfield || $id; >- delete $data->[0]->{id} if @$data && $op eq 'add'; #cloning record >+ $data = server_search( $schema, $id, $searchfield ) if $searchfield || $id; >+ delete $data->[0]->{id} if @$data && $op eq 'add'; #cloning record > $template->param( > add_form => 1, server => @$data ? $data->[0] : undef, > op => $op, type => $op eq 'add' ? lc $type : '' > ); > } else { >- $data = ServerSearch( $schema, $id, $searchfield ); >+ $data = server_search( $schema, $id, $searchfield ); > $template->param( > loop => \@$data, searchfield => $searchfield, id => $id, > op => 'list' >@@ -108,10 +108,10 @@ output_html_with_http_headers $input, $cookie, $template->output; > > # End of main code > >-sub ServerSearch { #find server(s) by id or name >+sub server_search { #find server(s) by id or name > my ( $schema, $id, $searchstring ) = @_; > >- return Koha::OaiServers->search( >+ return Koha::OAIServers->search( > $id ? { id => $id } : { servername => { like => $searchstring . '%' } }, > )->unblessed; > } >diff --git a/installer/data/mysql/atomicupdate/Bug-35659.pl b/installer/data/mysql/atomicupdate/Bug-35659.pl >index 96721d3291..c637027d45 100755 >--- a/installer/data/mysql/atomicupdate/Bug-35659.pl >+++ b/installer/data/mysql/atomicupdate/Bug-35659.pl >@@ -8,8 +8,8 @@ return { > my ( $dbh, $out ) = @$args{qw(dbh out)}; > $dbh->do( > q{ >- CREATE TABLE IF NOT EXISTS `oaiservers` ( >- `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique identifier assigned by Koha', >+ CREATE TABLE IF NOT EXISTS `oai_servers` ( >+ `oai_server_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique identifier assigned by Koha', > `endpoint` varchar(255) NOT NULL COMMENT 'OAI endpoint (host + port + path)', > `oai_set` varchar(255) DEFAULT NULL COMMENT 'OAI set to harvest', > `servername` longtext NOT NULL COMMENT 'name given to the target by the library', >@@ -20,12 +20,12 @@ return { > ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; > } > ); >- say $out "Added new table 'oaiservers'"; >+ say $out "Added new table 'oai_servers'"; > > $dbh->do( > q{ >- CREATE TABLE IF NOT EXISTS `import_oaipmh_biblios` ( >- `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique identifier assigned by Koha', >+ CREATE TABLE IF NOT EXISTS `import_oai_biblios` ( >+ `import_oai_biblio_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique identifier assigned by Koha', > `biblionumber` int(11) NOT NULL COMMENT 'unique identifier assigned to each koha record', > `identifier` varchar(255) NOT NULL COMMENT 'OAI record identifier', > `repository` varchar(255) NOT NULL COMMENT 'OAI repository', >@@ -34,15 +34,15 @@ return { > `last_modified` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, > PRIMARY KEY (id), > KEY biblionumber (biblionumber), >- CONSTRAINT FK_import_oaipmh_biblios_1 FOREIGN KEY (biblionumber) REFERENCES biblio (biblionumber) ON DELETE CASCADE ON UPDATE NO ACTION >+ CONSTRAINT FK_import_oai_biblios_1 FOREIGN KEY (biblionumber) REFERENCES biblio (biblionumber) ON DELETE CASCADE ON UPDATE NO ACTION > ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; > } > ); > > $dbh->do( > q{ >- CREATE TABLE IF NOT EXISTS `import_oaipmh_authorities` ( >- `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique identifier assigned by Koha', >+ CREATE TABLE IF NOT EXISTS `import_oai_authorities` ( >+ `import_oai_authority_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique identifier assigned by Koha', > `authid` bigint(20) unsigned NOT NULL COMMENT 'unique identifier assigned to each koha record', > `identifier` varchar(255) NOT NULL COMMENT 'OAI record identifier', > `repository` varchar(255) NOT NULL COMMENT 'OAI repository', >@@ -51,11 +51,11 @@ return { > `last_modified` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, > PRIMARY KEY (id), > KEY authid (authid), >- CONSTRAINT FK_import_oaipmh_authorities_1 FOREIGN KEY (authid) REFERENCES auth_header (authid) ON DELETE CASCADE ON UPDATE NO ACTION >+ CONSTRAINT FK_import_oai_authorities_1 FOREIGN KEY (authid) REFERENCES auth_header (authid) ON DELETE CASCADE ON UPDATE NO ACTION > ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; > } > ); >- say $out "Added new tables 'import_oaipmh_biblios' and import_oaipmh_authorities"; >+ say $out "Added new tables 'import_oai_biblios' and import_oai_authorities"; > > $dbh->do( > q{ >diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql >index 21a589e8c0..e583980be0 100644 >--- a/installer/data/mysql/kohastructure.sql >+++ b/installer/data/mysql/kohastructure.sql >@@ -4857,13 +4857,13 @@ CREATE TABLE `oai_sets_mappings` ( > /*!40101 SET character_set_client = @saved_cs_client */; > > -- >--- Table structure for table `oaiservers` >+-- Table structure for table `oai_servers` > -- > >-DROP TABLE IF EXISTS `oaiservers`; >+DROP TABLE IF EXISTS `oai_servers`; > /*!40101 SET @saved_cs_client = @@character_set_client */; > /*!40101 SET character_set_client = utf8 */; >-CREATE TABLE `oaiservers` ( >+CREATE TABLE `oai_servers` ( > `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique identifier assigned by Koha', > `endpoint` varchar(255) NOT NULL COMMENT 'OAI endpoint (host + port + path)', > `oai_set` varchar(255) DEFAULT NULL COMMENT 'OAI set to harvest', >@@ -4875,13 +4875,13 @@ CREATE TABLE `oaiservers` ( > ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; > > -- >--- Table structure for table `import_oaipmh_biblios` >+-- Table structure for table `import_oai_biblios` > -- > >-DROP TABLE IF EXISTS `import_oaipmh_biblios`; >+DROP TABLE IF EXISTS `import_oai_biblios`; > /*!40101 SET @saved_cs_client = @@character_set_client */; > /*!40101 SET character_set_client = utf8 */; >-CREATE TABLE `import_oaipmh_biblios` ( >+CREATE TABLE `import_oai_biblios` ( > `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique identifier assigned by Koha', > `biblionumber` int(11) NOT NULL COMMENT 'unique identifier assigned to each koha record', > `identifier` varchar(255) NOT NULL COMMENT 'OAI record identifier', >@@ -4891,17 +4891,17 @@ CREATE TABLE `import_oaipmh_biblios` ( > `last_modified` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, > PRIMARY KEY (id), > KEY biblionumber (biblionumber), >- CONSTRAINT FK_import_oaipmh_biblios_1 FOREIGN KEY (biblionumber) REFERENCES biblio (biblionumber) ON DELETE CASCADE ON UPDATE NO ACTION >+ CONSTRAINT FK_import_oai_biblios_1 FOREIGN KEY (biblionumber) REFERENCES biblio (biblionumber) ON DELETE CASCADE ON UPDATE NO ACTION > ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; > > -- >--- Table structure for table `import_oaipmh_authorities` >+-- Table structure for table `import_oai_authorities` > -- > >-DROP TABLE IF EXISTS `import_oaipmh_authorities`; >+DROP TABLE IF EXISTS `import_oai_authorities`; > /*!40101 SET @saved_cs_client = @@character_set_client */; > /*!40101 SET character_set_client = utf8 */; >-CREATE TABLE `import_oaipmh_authorities` ( >+CREATE TABLE `import_oai_authorities` ( > `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique identifier assigned by Koha', > `authid` bigint(20) unsigned NOT NULL COMMENT 'unique identifier assigned to each koha record', > `identifier` varchar(255) NOT NULL COMMENT 'OAI record identifier', >@@ -4911,7 +4911,7 @@ CREATE TABLE `import_oaipmh_authorities` ( > `last_modified` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, > PRIMARY KEY (id), > KEY authid (authid), >- CONSTRAINT FK_import_oaipmh_authorities_1 FOREIGN KEY (authid) REFERENCES auth_header (authid) ON DELETE CASCADE ON UPDATE NO ACTION >+ CONSTRAINT FK_import_oai_authorities_1 FOREIGN KEY (authid) REFERENCES auth_header (authid) ON DELETE CASCADE ON UPDATE NO ACTION > ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; > > -- >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/admin-menu.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/admin-menu.inc >index 5f5e089d1c..e3b6e520d0 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/admin-menu.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/admin-menu.inc >@@ -152,7 +152,7 @@ > [% END %] > [% IF ( CAN_user_parameters_manage_search_targets ) %] > <li><a href="/cgi-bin/koha/admin/z3950servers.pl">Z39.50/SRU servers</a></li> >- <li><a href="/cgi-bin/koha/admin/oaiservers.pl">OAI repositories</a></li> >+ <li><a href="/cgi-bin/koha/admin/oai_servers.pl">OAI repositories</a></li> > [% END %] > [% IF ( CAN_user_parameters_manage_smtp_servers ) %] > <li><a href="/cgi-bin/koha/admin/smtp_servers.pl">SMTP servers</a></li> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/oai-admin-search.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/oai-admin-search.inc >index 5f7a97c71f..1da8c440cc 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/oai-admin-search.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/oai-admin-search.inc >@@ -3,7 +3,7 @@ > <div id="header_search" role="tablist"> > <div class="tab-content"> > <div id="oai_search" role="tabpanel" class="tab-pane active"> >- <form action="/cgi-bin/koha/admin/oaiservers.pl" method="get"> >+ <form action="/cgi-bin/koha/admin/oai_servers.pl" method="get"> > <div class="form-title"> > <label class="control-label" for="searchfield">Search OAI repositories</label> > </div> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/admin-home.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/admin-home.tt >index 735122e2d0..0a190f96a1 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/admin-home.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/admin-home.tt >@@ -261,7 +261,7 @@ > [% IF ( CAN_user_parameters_manage_search_targets ) %] > <dt><a href="/cgi-bin/koha/admin/z3950servers.pl">Z39.50/SRU servers</a></dt> > <dd>Define which external servers to query for MARC data</dd> >- <dt><a href="/cgi-bin/koha/admin/oaiservers.pl">OAI repositories</a></dt> >+ <dt><a href="/cgi-bin/koha/admin/oai_servers.pl">OAI repositories</a></dt> > <dd>Define which OAI repositories to harvest data from</dd> > [% END %] > [% IF ( CAN_user_parameters_manage_smtp_servers ) %] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/oaiservers.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/oai_servers.tt >similarity index 87% >rename from koha-tmpl/intranet-tmpl/prog/en/modules/admin/oaiservers.tt >rename to koha-tmpl/intranet-tmpl/prog/en/modules/admin/oai_servers.tt >index eee0c85d80..07751b636e 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/oaiservers.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/oai_servers.tt >@@ -15,7 +15,7 @@ > [% INCLUDE 'doc-head-close.inc' %] > </head> > >-<body id="admin_oaiservers" class="admin"> >+<body id="admin_oai_servers" class="admin"> > [% WRAPPER 'header.inc' %] > [% INCLUDE 'oai-admin-search.inc' %] > [% END %] >@@ -28,7 +28,7 @@ > > [% IF op == 'edit' || op == 'add' %] > [% WRAPPER breadcrumb_item %] >- <a href="/cgi-bin/koha/admin/oaiservers.pl">OAI repositories</a> >+ <a href="/cgi-bin/koha/admin/oai_servers.pl">OAI repositories</a> > [% END %] > [% END %] > >@@ -89,7 +89,7 @@ > > <li><label for="endpoint" class="required">Endpoint: </label> <input type="text" name="endpoint" id="endpoint" size="30" value="[% server.endpoint | html %]" required="required" /> <span class="required">Required</span> > </li> >- <li><label for="oai_set">Set: </label> <input type="text" name="oai_set" id="oai_set" value="[% server.oai_set | html %]" /> >+ <li><label for="oai_set">[% I18N.tp('OAI', 'Set:') | html %] </label> <input type="text" name="oai_set" id="oai_set" value="[% server.oai_set | html %]" /> > </li> > <li> > <label for="dataformat">Data format: </label> >@@ -115,31 +115,31 @@ > </ol> > </fieldset> > >- <fieldset class="action"><input type="submit" class="btn btn-primary" value="Save" /> <a class="cancel" href="/cgi-bin/koha/admin/oaiservers.pl">Cancel</a></fieldset> >+ <fieldset class="action"><input type="submit" class="btn btn-primary" value="Save" /> <a class="cancel" href="/cgi-bin/koha/admin/oai_servers.pl">Cancel</a></fieldset> > </form> > [% END %] > > [% IF op == 'list' %] > <div id="toolbar" class="btn-toolbar"> >- <a id="newserver" class="btn btn-default" href="/cgi-bin/koha/admin/oaiservers.pl?op=add"><i class="fa fa-plus"></i> New OAI repository</a> >+ <a id="newserver" class="btn btn-default" href="/cgi-bin/koha/admin/oai_servers.pl?op=add"><i class="fa fa-plus"></i> New OAI repository</a> > </div> > <h1>OAI repositories administration</h1> > [% IF id %] >- You searched for record [% id | html %] >+ <span>You searched for record [% id | html %]</span> > [% ELSIF searchfield %] >- You searched for [% searchfield | html %] >+ </span>You searched for [% searchfield | html %]<span> > [% END %] > > <div class="page-section"> > <table id="serverst"> > >- <thead><tr><th>Id</th><th>Repository name</th><th>Endpoint</th><th>Set</th><th>Data format</th><th>Record type</th><th class="noExport">Actions</th> >+ <thead><tr><th>Id</th><th>Repository name</th><th>Endpoint</th><th>[% tp('OAI', 'Set') | html %]</th><th>Data format</th><th>Record type</th><th class="noExport">Actions</th> > </tr></thead> > <tbody> > [% FOREACH loo IN loop %] > <tr> > <td>[% loo.id | html %]</td> >- <td><a href="/cgi-bin/koha/admin/oaiservers.pl?op=edit&id=[% loo.id | uri %]">[% loo.servername | html %]</a></td><td>[% loo.endpoint | html %]</td><td>[% loo.oai_set | html %]</td> >+ <td><a href="/cgi-bin/koha/admin/oai_servers.pl?op=edit&id=[% loo.id | uri %]">[% loo.servername | html %]</a></td><td>[% loo.endpoint | html %]</td><td>[% loo.oai_set | html %]</td> > <td>[% loo.dataformat | html %]</td> > <td>[% IF ( loo.recordtype == 'biblio' ) %] > <span>Bibliographic</span> >@@ -153,11 +153,11 @@ > Actions <b class="caret"></b> > </a> > <ul class="dropdown-menu pull-right" role="menu" aria-labelledby="reportactions[% savedreport.id | html %]"> >- <li><a href="/cgi-bin/koha/admin/oaiservers.pl?op=edit&id=[% loo.id | uri %]"><i class="fa-solid fa-pencil" aria-hidden="true"></i> Edit</a></li> >- <li><a href="/cgi-bin/koha/admin/oaiservers.pl?op=add&id=[% loo.id | uri %]"><i class="fa fa-copy"></i> Copy</a></li> >+ <li><a href="/cgi-bin/koha/admin/oai_servers.pl?op=edit&id=[% loo.id | uri %]"><i class="fa-solid fa-pencil" aria-hidden="true"></i> Edit</a></li> >+ <li><a href="/cgi-bin/koha/admin/oai_servers.pl?op=add&id=[% loo.id | uri %]"><i class="fa fa-copy"></i> Copy</a></li> > <li> > <a href="#" class="delete" data-formid="server_row_[% loo.id | uri %]" data-servername="[% loo.servername | html %]"><i class="fa fa-trash-can"></i> Delete</a> >- <form id="server_row_[% loo.id | uri %]" action="/cgi-bin/koha/admin/oaiservers.pl" method="post"> >+ <form id="server_row_[% loo.id | uri %]" action="/cgi-bin/koha/admin/oai_servers.pl" method="post"> > [% INCLUDE 'csrf-token.inc' %] > <input type="hidden" name="op" value="cud-delete_confirmed"> > <input type="hidden" name="id" value="[% loo.id | uri %]"> >diff --git a/misc/cronjobs/harvest_oai.pl b/misc/cronjobs/harvest_oai.pl >index 5471cbe164..3148e89347 100755 >--- a/misc/cronjobs/harvest_oai.pl >+++ b/misc/cronjobs/harvest_oai.pl >@@ -24,7 +24,7 @@ use utf8; > use Getopt::Long qw( GetOptions ); > use Koha::Script -cron; > use Koha::OAI::Client::Harvester; >-use Koha::OaiServers; >+use Koha::OAIServers; > use C4::Log qw( cronlogaction ); > use Try::Tiny qw( catch try ); > >@@ -60,7 +60,7 @@ if ($help) { > } > > if ($list) { >- my $servers = Koha::OaiServers->search( {}, { order_by => { -asc => 'id' } } )->unblessed; >+ my $servers = Koha::OAIServers->search( {}, { order_by => { -asc => 'id' } } )->unblessed; > print "The following repositories are available: \n\n"; > foreach my $server (@$servers) { > print $server->{'id'} . ": " >@@ -81,7 +81,7 @@ if ( !$id ) { > print $usage . "\n"; > } > >-my $server = Koha::OaiServers->find($id); >+my $server = Koha::OAIServers->find($id); > > unless ($server) { > print "OAI Server $id unknown\n"; >@@ -103,8 +103,15 @@ cronlogaction( { action => 'Start', info => "Starting OAI Harvest" } ); > cronlogaction( { info => "Command line: $command_line_options" } ); > > my $harvester = >- Koha::OAI::Client::Harvester->new( { server => $server, verbose => $verbose, days => $days, force => $force } ); >+ Koha::OAI::Client::Harvester->new( { server => $server, days => $days, force => $force, logger => \&logFunction } ); > $harvester->init(); > > cronlogaction( { action => 'End', info => "Ending OAI Harvest" } ); >+ >+sub logFunction { >+ my $message = shift; >+ print $message . "\n" if ($verbose); >+ cronlogaction( { info => $message } ); >+} >+ > exit(0); >diff --git a/t/db_dependent/Koha/OAIHarvester.t b/t/db_dependent/Koha/OAIHarvester.t >index db973bd268..57c1d30be5 100755 >--- a/t/db_dependent/Koha/OAIHarvester.t >+++ b/t/db_dependent/Koha/OAIHarvester.t >@@ -27,8 +27,8 @@ use HTTP::OAI::Metadata::OAI_DC; > use HTTP::OAI::Record; > use HTTP::OAI::Encapsulation; > use Koha::Database; >-use Koha::OaiServer; >-use Koha::OaiServers; >+use Koha::OAIServer; >+use Koha::OAIServers; > use Koha::OAI::Client::Harvester; > > my $schema = Koha::Database->new->schema; >@@ -36,7 +36,7 @@ my $builder = t::lib::TestBuilder->new; > > $schema->storage->txn_begin; > >-my $new_oai_1 = Koha::OaiServer->new( >+my $new_oai_1 = Koha::OAIServer->new( > { > endpoint => 'my_host1.org', > oai_set => 'set1', >@@ -85,11 +85,11 @@ $r->header->datestamp('2018-05-10T09:18:13Z'); > $status = $harvester->processRecord($r); > is( $status, 'updated', 'When force is not used, record is updated if newer' ); > >-my $imported_record = Koha::Import::Oaipmh::Biblios->find( { identifier => 'oai:myarchive.org:oid-234' } ); >+my $imported_record = Koha::Import::OAI::Biblios->find( { identifier => 'oai:myarchive.org:oid-234' } ); > my $added_datestamp = $imported_record->datestamp; > $r->header->datestamp(undef); > $status = $harvester->processRecord($r); >-$imported_record = Koha::Import::Oaipmh::Biblios->find( { identifier => 'oai:myarchive.org:oid-234' } ); >+$imported_record = Koha::Import::OAI::Biblios->find( { identifier => 'oai:myarchive.org:oid-234' } ); > my $updated_datestamp = $imported_record->datestamp; > isnt( > $added_datestamp, $updated_datestamp, >diff --git a/t/db_dependent/Koha/OAIServers.t b/t/db_dependent/Koha/OAIServers.t >index 9f135b77db..22d9cab649 100755 >--- a/t/db_dependent/Koha/OAIServers.t >+++ b/t/db_dependent/Koha/OAIServers.t >@@ -23,8 +23,8 @@ use Test::Exception; > > use t::lib::TestBuilder; > use Koha::Database; >-use Koha::OaiServer; >-use Koha::OaiServers; >+use Koha::OAIServer; >+use Koha::OAIServers; > > my $schema = Koha::Database->new->schema; > my $builder = t::lib::TestBuilder->new; >@@ -32,8 +32,8 @@ my $builder = t::lib::TestBuilder->new; > subtest 'new, find and delete tests' => sub { > plan tests => 4; > $schema->storage->txn_begin; >- my $nb_of_oais = Koha::OaiServers->search->count; >- my $new_oai_1 = Koha::OaiServer->new( >+ my $nb_of_oais = Koha::OAIServers->search->count; >+ my $new_oai_1 = Koha::OAIServer->new( > { > endpoint => 'my_host1.org', > oai_set => 'set1', >@@ -42,7 +42,7 @@ subtest 'new, find and delete tests' => sub { > recordtype => 'biblio', > } > )->store; >- my $new_oai_2 = Koha::OaiServer->new( >+ my $new_oai_2 = Koha::OAIServer->new( > { > endpoint => 'my_host2.org', > oai_set => 'set2', >@@ -53,16 +53,16 @@ subtest 'new, find and delete tests' => sub { > )->store; > > like( $new_oai_1->id, qr|^\d+$|, 'Adding a new oai server should have set the id' ); >- is( Koha::OaiServers->search->count, $nb_of_oais + 2, 'The 2 oai servers should have been added' ); >+ is( Koha::OAIServers->search->count, $nb_of_oais + 2, 'The 2 oai servers should have been added' ); > >- my $retrieved_oai_1 = Koha::OaiServers->find( $new_oai_1->id ); >+ my $retrieved_oai_1 = Koha::OAIServers->find( $new_oai_1->id ); > is( > $retrieved_oai_1->servername, $new_oai_1->servername, > 'Find a oai server by id should return the correct oai server' > ); > > $retrieved_oai_1->delete; >- is( Koha::OaiServers->search->count, $nb_of_oais + 1, 'Delete should have deleted the oai server' ); >+ is( Koha::OAIServers->search->count, $nb_of_oais + 1, 'Delete should have deleted the oai server' ); > > $schema->storage->txn_rollback; > }; >@@ -72,7 +72,7 @@ subtest 'Check NOT NULL without default values' => sub { > $schema->storage->txn_begin; > local $SIG{__WARN__} = sub { }; # TODO Needed it for suppressing DBIx warns > >- my $server = Koha::OaiServer->new( >+ my $server = Koha::OAIServer->new( > { > oai_set => 'set3', > dataformat => 'marcxml', >-- >2.46.2
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 35659
:
160356
|
160357
|
160744
|
161813
|
161960
|
162004
|
162005
|
162006
|
162007
|
162008
|
162009
|
162010
|
162011
|
162527
|
162528
|
162692
|
162693
|
162694
|
163527
|
164586
|
164590
|
164602
|
164603
|
164604
|
164605
|
164606
|
164618
|
164619
|
164620
|
164621
|
164622
|
165199
|
165594
|
165595
|
165596
|
165597
|
165598
|
167106
|
167107
|
167171
|
167172
|
167173
|
167174
|
167175
|
167176
|
168982
|
168983
|
169941
|
171255
|
171258
|
171260
|
171264
|
171265
|
171267
|
171675
|
171676
|
171678
|
171679
|
172072
|
172073
|
172074
|
172075
|
172076
|
172077
|
172078
|
172079
|
172080
|
172081
|
172082
|
172083
|
172202
|
172203
|
172204
|
172205
|
172206
|
172207
|
172208
|
172209
|
172210
|
172211
|
172212
|
172213
|
173088
|
173089
|
173090
|
173091
|
173092
|
173093
|
173094
|
173095
|
173096
|
173097
|
173098
|
173099
|
173100
|
173101
|
173561
|
173599
|
173600
|
173601
|
173614
|
174790