Bug 12368: Die if the --table value is not allowed.
If the table given in parameter is not in the white list, the script should die rathen than correct to a default value. Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
parent
2d9c221abc
commit
e8055c7ef6
|
|
@ -136,6 +136,13 @@ if (not $biblios and not $authorities) {
|
|||
die $msg;
|
||||
}
|
||||
|
||||
our @tables_allowed_for_select = ( 'biblioitems', 'items', 'biblio' );
|
||||
unless ( grep { /^$table$/ } @tables_allowed_for_select ) {
|
||||
die "Cannot specify -t|--table with value '$table'. Only "
|
||||
. ( join ', ', @tables_allowed_for_select )
|
||||
. " are allowed.";
|
||||
}
|
||||
|
||||
|
||||
# -v is for verbose, which seems backwards here because of how logging is set
|
||||
# on the CLI of zebraidx. It works this way. The default is to not log much
|
||||
|
|
@ -445,8 +452,7 @@ sub select_all_authorities {
|
|||
|
||||
sub select_all_biblios {
|
||||
$table = 'biblioitems'
|
||||
if $table ne 'items'
|
||||
and $table ne 'biblio';
|
||||
if grep { /^$table$/ } @tables_allowed_for_select;
|
||||
my $strsth = qq{ SELECT biblionumber FROM $table };
|
||||
$strsth.=qq{ WHERE $where } if ($where);
|
||||
$strsth.=qq{ LIMIT $length } if ($length && !$offset);
|
||||
|
|
|
|||
Loading…
Reference in New Issue