From b745c05156b24c278c97f3c4a56b7c0c131463c4 Mon Sep 17 00:00:00 2001 From: Fridolin Somers Date: Thu, 25 Sep 2014 15:29:35 +0200 Subject: [PATCH] [SIGNED-OFF] Bug 12995 - script update_totalissues.pl stops on corrupted record When running update_totalissues.pl cronjob, it will stop on a corrupted record. This patch adds eval around record modification method call, alerts if error and process next record. Test plan : - Create a dabase with a few biblios and some issues - Modify first biblio record (use direct sql update) : set a wrong value in biblioitems.marcxml - Lauch script : misc/cronjobs/update_totalissues.pl --use-stats --commit=1000 -v => Without patch : the script stops at first record => With patch : the script prints error for first record and processes all records Signed-off-by: Cindy Murdock Ames --- misc/cronjobs/update_totalissues.pl | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/misc/cronjobs/update_totalissues.pl b/misc/cronjobs/update_totalissues.pl index 71da3aa..168efc4 100755 --- a/misc/cronjobs/update_totalissues.pl +++ b/misc/cronjobs/update_totalissues.pl @@ -169,12 +169,16 @@ sub process_query { print "Processing bib $biblionumber ($totalissues issues)\n" if $verbose; if ( not $test_only ) { - if ( $incremental && $totalissues > 0 ) { - UpdateTotalIssues( $biblionumber, $totalissues ); - } - else { - UpdateTotalIssues( $biblionumber, 0, $totalissues ); - } + eval { + if ( $incremental && $totalissues > 0 ) + { + UpdateTotalIssues( $biblionumber, $totalissues ); + } + else { + UpdateTotalIssues( $biblionumber, 0, $totalissues ); + } + }; + print "Unable to edit bib $biblionumber : $@\n" if ( $verbose && $@ ); } if ( not $test_only and ( $num_bibs_processed % $commit ) == 0 ) { print_progress_and_commit($num_bibs_processed); -- 1.7.10.4