Bug 21865: add confirm to remove_unused_authorities.pl script

Like in most scripts in misc, add confirm argument
to ensure script is not run without knowing what it does.

Test plan:
1) Run misc/migration_tools/remove_unused_authorities.pl -h
2) You see help line for confirm
3) Run misc/migration_tools/remove_unused_authorities.pl
4) You see help and script does nothing
5) Run misc/migration_tools/remove_unused_authorities.pl -c
6) Script runs like wanted

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
This commit is contained in:
Fridolin Somers 2018-11-19 15:45:49 +01:00 committed by Martin Renvoize
parent fc4cffe1f0
commit e788ac4e58
No known key found for this signature in database
GPG Key ID: 422B469130441A0F
1 changed files with 7 additions and 4 deletions

View File

@ -30,15 +30,15 @@ use Getopt::Long;
use Koha::SearchEngine::Search;
my @authtypes;
my $want_help = 0;
my $test = 0;
my ($confirm, $test, $want_help);
GetOptions(
'aut|authtypecode:s' => \@authtypes,
'c|confirm' => \$confirm,
't|test' => \$test,
'h|help' => \$want_help
'h|help' => \$want_help,
);
if ($want_help) {
if ( $want_help || !$confirm ) {
print_usage();
exit 0;
}
@ -129,11 +129,14 @@ particular type will be checked for usage. --aut can be repeated.
If --aut is not supplied, all authority records will be checked.
Use --confirm Confirms you want to really run this script, otherwise prints this help.
Use --test to perform a test run. This script does not ask the
operator to confirm the deletion of each authority record.
parameters
--aut|authtypecode TYPE the list of authtypes to check
--confirm or -c confirm running of script
--test or -t test mode, don't delete really, just count
--help or -h show this message.