Bugzilla – Attachment 188440 Details for
Bug 41062
Expand cronjob erm_run_harvester.pl with parameter for providers
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 41062: Add an option to erm_run_harvester.pl to specify provider IDs
Bug-41062-Add-an-option-to-ermrunharvesterpl-to-sp.patch (text/plain), 4.39 KB, created by
Jan Kissig
on 2025-10-25 18:12:43 UTC
(
hide
)
Description:
Bug 41062: Add an option to erm_run_harvester.pl to specify provider IDs
Filename:
MIME Type:
Creator:
Jan Kissig
Created:
2025-10-25 18:12:43 UTC
Size:
4.39 KB
patch
obsolete
>From 5e953ff00a5670100863bf155a44a49be1562824 Mon Sep 17 00:00:00 2001 >From: Raphael Straub <raphael.straub@kit.edu> >Date: Mon, 20 Oct 2025 13:49:15 +0000 >Subject: [PATCH] Bug 41062: Add an option to erm_run_harvester.pl to specify > provider IDs > >This patch adds a new option to define the providers in cronjob erm_run_harvester.pl >that are used to run the SUSHI harvesting for COUNTER Reports in the ERM module. >Use parameter --provider-id or -p >The parameter provider_id is repeatable. >If the parameter for provider_id is not used all active providers will be harvested (as before). >The script will check if these providers are active (as before). > >Script to run on ktd: perl misc/cronjobs/erm_run_harvester.pl --begin-date 2025-09-01 --end-date 2025-09-30 > >To test: >- Run the script and make sure that all active providers are harvested. >- Apply patch. >- Run the script with only one provider-id. >- Run the script with two provider-ids by using -p 1 -p 2 >- Run the script without the parameter. >- Make sure that in all cases only active providers are harvested. >- Sign off :-). > >Sponsored-by: Karlsruhe Institute of Technology (KIT) >Signed-off-by: Jan Kissig <bibliothek@th-wildau.de> >--- > misc/cronjobs/erm_run_harvester.pl | 41 ++++++++++++++++++++---------- > 1 file changed, 27 insertions(+), 14 deletions(-) > >diff --git a/misc/cronjobs/erm_run_harvester.pl b/misc/cronjobs/erm_run_harvester.pl >index f426b81869b..8f28e59547d 100755 >--- a/misc/cronjobs/erm_run_harvester.pl >+++ b/misc/cronjobs/erm_run_harvester.pl >@@ -38,7 +38,7 @@ erm_run_harvester.pl This script will run the SUSHI harvesting for usage data pr > > erm_run_harvester.pl > --begin-date <YYYY-MM-DD> >- [ --dry-run ][ --debug ][ --end-date <YYYY-MM-DD> ] >+ [ --dry-run ][ --debug ][ --end-date <YYYY-MM-DD> ][ -p|--provider-id <id> ... ] > > Options: > --help brief help message >@@ -47,6 +47,7 @@ erm_run_harvester.pl > --dry-run test run only, do not harvest data > --begin-date <YYYY-MM-DD> date to harvest from > --end-date <YYYY-MM-DD> date to harvest until, defaults to today if not set >+ -p|--provider-id <id> ... harvest only given providers > > =head1 OPTIONS > >@@ -72,6 +73,10 @@ Date from which to harvest, previously harvested data will be ignored > > Date to harvest until, defaults to today if not set > >+=item B<-p|--provider-id ...> >+ >+Provider IDs that should be harvested; harvest all active providers if not set >+ > =item B<--dry-run> > > Test run only, do not harvest >@@ -95,6 +100,8 @@ C<erm_run_harvester.pl --begin-date 2000-01-01> - Harvest from the given date un > > C<erm_run_harvester.pl --begin-date 2000-01-01 --end-date 2024-01-01> - Harvest from the given date until the end date > >+C<erm_run_harvester.pl --begin-date 2000-01-01 --provider-id 1 --provider-id 3> - Harvest from the given date until today, but only the given providers >+ > C<erm_run_harvester.pl --begin-date 2000-01-01 --end-date 2024-01-01 --debug --dry-run> - Dry run, with debuig information > > =cut >@@ -103,26 +110,32 @@ my $command_line_options = join( " ", @ARGV ); > cronlogaction( { info => $command_line_options } ); > > # Command line option values >-my $help = 0; >-my $man = 0; >-my $begin_date = 0; >-my $end_date = 0; >-my $dry_run = 0; >-my $debug = 0; >+my $help = 0; >+my $man = 0; >+my $begin_date = 0; >+my $end_date = 0; >+my @provider_ids = (); >+my $dry_run = 0; >+my $debug = 0; > > my $options = GetOptions( >- 'h|help' => \$help, >- 'm|man' => \$man, >- 'begin-date=s' => \$begin_date, >- 'end-date=s' => \$end_date, >- 'dry-run' => \$dry_run, >- 'debug' => \$debug >+ 'h|help' => \$help, >+ 'm|man' => \$man, >+ 'begin-date=s' => \$begin_date, >+ 'end-date=s' => \$end_date, >+ 'p|provider-id:s' => \@provider_ids, >+ 'dry-run' => \$dry_run, >+ 'debug' => \$debug > ); > > pod2usage(1) if $help; > pod2usage( -verbose => 2 ) if $man; > >-my $udproviders = Koha::ERM::EUsage::UsageDataProviders->search( { active => 1 } ); >+my %search_condition = ( active => 1 ); >+if ( scalar @provider_ids ) { >+ $search_condition{erm_usage_data_provider_id} = { -in => \@provider_ids }; >+} >+my $udproviders = Koha::ERM::EUsage::UsageDataProviders->search( \%search_condition ); > unless ( scalar @{ $udproviders->as_list() } ) { > die "ERROR: No usage data providers found."; > } >-- >2.39.5
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 41062
:
188268
| 188440