Bug 36709: Add confirm flag to update_localuse_from_statistics.pl script

To test:
1. APPLY PATCH and restart all
2. Run the update_localuse_from_statistics.pl script without a confirm flag, nothing happens.
3. Run the script and add the --confirm flag, stuff happens.

Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
This commit is contained in:
Lucas Gass 2024-04-29 20:39:08 +00:00 committed by Katrin Fischer
parent 67b3cbd438
commit 5e06fd00ce
No known key found for this signature in database
GPG Key ID: 0EF6E2C03357A834
1 changed files with 18 additions and 5 deletions

View File

@ -27,7 +27,11 @@ use Koha::Statistics;
use Getopt::Long qw( GetOptions );
use Pod::Usage qw( pod2usage );
sub usage {
my ($params);
GetOptions(
'confirm' => \$params->{confirm}, 'help' => \$params->{help}, 'age:i' => \$params->{age},
);
if ( $params->{help} ) {
pod2usage( -verbose => 2 );
exit;
}
@ -57,7 +61,9 @@ my $result = GetOptions(
usage() if $help;
update_localuse();
if ( $params->{confirm} ) {
update_localuse();
}
=head1 NAME
@ -67,16 +73,23 @@ update_local_use_from_statistics.pl
update_localuse_from_statistics.pl
update_localuse_from_statistics.pl --help
update_localuse_from_statistics.pl --confirm
=head1 DESCRIPTION
This script updates the items.localuse column with data from the statistics table to make sure the two tables are congruent.
=over 8
=head1 OPTIONS
=item B<--help>
=over
Prints this help
=item B<-h--help>
Prints this help message
=item B<-c|--confirm>
Confirm to run the script.
=back