View | Details | Raw Unified | Return to bug 41062
Collapse All | Expand All

(-)a/misc/cronjobs/erm_run_harvester.pl (-15 / +27 lines)
Lines 38-44 erm_run_harvester.pl This script will run the SUSHI harvesting for usage data pr Link Here
38
38
39
erm_run_harvester.pl
39
erm_run_harvester.pl
40
  --begin-date <YYYY-MM-DD>
40
  --begin-date <YYYY-MM-DD>
41
  [ --dry-run ][ --debug ][ --end-date <YYYY-MM-DD> ]
41
  [ --dry-run ][ --debug ][ --end-date <YYYY-MM-DD> ][ -p|--provider-id <id> ... ]
42
42
43
 Options:
43
 Options:
44
   --help                         brief help message
44
   --help                         brief help message
Lines 47-52 erm_run_harvester.pl Link Here
47
   --dry-run                      test run only, do not harvest data
47
   --dry-run                      test run only, do not harvest data
48
   --begin-date <YYYY-MM-DD>      date to harvest from
48
   --begin-date <YYYY-MM-DD>      date to harvest from
49
   --end-date <YYYY-MM-DD>        date to harvest until, defaults to today if not set
49
   --end-date <YYYY-MM-DD>        date to harvest until, defaults to today if not set
50
   -p|--provider-id <id> ...      harvest only given providers
50
51
51
=head1 OPTIONS
52
=head1 OPTIONS
52
53
Lines 72-77 Date from which to harvest, previously harvested data will be ignored Link Here
72
73
73
Date to harvest until, defaults to today if not set
74
Date to harvest until, defaults to today if not set
74
75
76
=item B<-p|--provider-id ...>
77
78
Provider IDs that should be harvested; harvest all active providers if not set
79
75
=item B<--dry-run>
80
=item B<--dry-run>
76
81
77
Test run only, do not harvest
82
Test run only, do not harvest
Lines 95-100 C<erm_run_harvester.pl --begin-date 2000-01-01> - Harvest from the given date un Link Here
95
100
96
C<erm_run_harvester.pl --begin-date 2000-01-01 --end-date 2024-01-01> - Harvest from the given date until the end date
101
C<erm_run_harvester.pl --begin-date 2000-01-01 --end-date 2024-01-01> - Harvest from the given date until the end date
97
102
103
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
104
98
C<erm_run_harvester.pl --begin-date 2000-01-01 --end-date 2024-01-01 --debug --dry-run> - Dry run, with debuig information
105
C<erm_run_harvester.pl --begin-date 2000-01-01 --end-date 2024-01-01 --debug --dry-run> - Dry run, with debuig information
99
106
100
=cut
107
=cut
Lines 103-128 my $command_line_options = join( " ", @ARGV ); Link Here
103
cronlogaction( { info => $command_line_options } );
110
cronlogaction( { info => $command_line_options } );
104
111
105
# Command line option values
112
# Command line option values
106
my $help       = 0;
113
my $help         = 0;
107
my $man        = 0;
114
my $man          = 0;
108
my $begin_date = 0;
115
my $begin_date   = 0;
109
my $end_date   = 0;
116
my $end_date     = 0;
110
my $dry_run    = 0;
117
my @provider_ids = ();
111
my $debug      = 0;
118
my $dry_run      = 0;
119
my $debug        = 0;
112
120
113
my $options = GetOptions(
121
my $options = GetOptions(
114
    'h|help'       => \$help,
122
    'h|help'          => \$help,
115
    'm|man'        => \$man,
123
    'm|man'           => \$man,
116
    'begin-date=s' => \$begin_date,
124
    'begin-date=s'    => \$begin_date,
117
    'end-date=s'   => \$end_date,
125
    'end-date=s'      => \$end_date,
118
    'dry-run'      => \$dry_run,
126
    'p|provider-id:s' => \@provider_ids,
119
    'debug'        => \$debug
127
    'dry-run'         => \$dry_run,
128
    'debug'           => \$debug
120
);
129
);
121
130
122
pod2usage(1)               if $help;
131
pod2usage(1)               if $help;
123
pod2usage( -verbose => 2 ) if $man;
132
pod2usage( -verbose => 2 ) if $man;
124
133
125
my $udproviders = Koha::ERM::EUsage::UsageDataProviders->search( { active => 1 } );
134
my %search_condition = ( active => 1 );
135
if ( scalar @provider_ids ) {
136
    $search_condition{erm_usage_data_provider_id} = { -in => \@provider_ids };
137
}
138
my $udproviders = Koha::ERM::EUsage::UsageDataProviders->search( \%search_condition );
126
unless ( scalar @{ $udproviders->as_list() } ) {
139
unless ( scalar @{ $udproviders->as_list() } ) {
127
    die "ERROR: No usage data providers found.";
140
    die "ERROR: No usage data providers found.";
128
}
141
}
129
- 

Return to bug 41062