From 5e06fd00cef16f4d8e90d7a236f45868b1de2c9d Mon Sep 17 00:00:00 2001 From: Lucas Gass Date: Mon, 29 Apr 2024 20:39:08 +0000 Subject: [PATCH] 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 Signed-off-by: Martin Renvoize Signed-off-by: Katrin Fischer --- .../update_localuse_from_statistics.pl | 23 +++++++++++++++---- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/misc/maintenance/update_localuse_from_statistics.pl b/misc/maintenance/update_localuse_from_statistics.pl index ac8ef0d92a..7d64c645d1 100755 --- a/misc/maintenance/update_localuse_from_statistics.pl +++ b/misc/maintenance/update_localuse_from_statistics.pl @@ -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 + +=over + +=item B<-h--help> + +Prints this help message -=item B<--help> +=item B<-c|--confirm> -Prints this help + Confirm to run the script. =back -- 2.39.5