From a6c278f8e0b214ec31428394c1e0cdc4b58cdfc0 Mon Sep 17 00:00:00 2001 From: Tomas Cohen Arazi Date: Sun, 24 Aug 2014 13:09:33 -0300 Subject: [PATCH] Bug 12720: (QA followup) use API instead of plain SQL Signed-off-by: Tomas Cohen Arazi --- misc/migration_tools/bulkmarcimport.pl | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/misc/migration_tools/bulkmarcimport.pl b/misc/migration_tools/bulkmarcimport.pl index fc5ab848ed..61ece6c1a3 100755 --- a/misc/migration_tools/bulkmarcimport.pl +++ b/misc/migration_tools/bulkmarcimport.pl @@ -121,16 +121,18 @@ if ((not defined $sourcesubfield) && (not defined $sourcetag)){ $sourcesubfield="a"; } -#Disable the syspref cache or else the following UPDATE statements will have no effect -C4::Context->disable_syspref_cache(); -# save the CataloguingLog and AuthoritiesLog properties : we don't want to log a bulkmarcimport. It will slow the import & -# will create problems in the action_logs table, that can't handle more than 1 entry per second per user. -my $CataloguingLog = C4::Context->preference('CataloguingLog'); -$dbh->do("UPDATE systempreferences SET value=0 WHERE variable='CataloguingLog'"); +# Disable logging for the biblios and authorities import operation. It would unnecesarily +# slow the import -my $AuthoritiesLog = C4::Context->preference('AuthoritiesLog'); -$dbh->do("UPDATE systempreferences SET value=0 WHERE variable='AuthoritiesLog'"); +# Disable the syspref cache so we can change logging settings +C4::Context->disable_syspref_cache(); +# Save current CataloguingLog and AuthoritiesLog sysprefs values +my $CataloguingLog = C4::Context->preference( 'CataloguingLog' ); +my $AuthoritiesLog = C4::Context->preference( 'AuthoritiesLog' ); +# Disable logging for both +C4::Context->set_preference( 'CataloguingLog', 0 ); +C4::Context->set_preference( 'AuthoritiesLog', 0 ); if ($fk_off) { $dbh->do("SET FOREIGN_KEY_CHECKS = 0"); @@ -500,10 +502,10 @@ if ($fk_off) { $dbh->do("SET FOREIGN_KEY_CHECKS = 1"); } -# restore CataloguingLog -$dbh->do("UPDATE systempreferences SET value=$CataloguingLog WHERE variable='CataloguingLog'"); -# restore AuthoritiesLog -$dbh->do("UPDATE systempreferences SET value=$AuthoritiesLog WHERE variable='AuthoritiesLog'"); +# Restore CataloguingLog +C4::Context->set_preference( 'CataloguingLog', $CataloguingLog ); +# Restore AuthoritiesLog +C4::Context->set_preference( 'AuthoritiesLog', $AuthoritiesLog ); my $timeneeded = gettimeofday - $starttime; print "\n$i MARC records done in $timeneeded seconds\n"; -- 2.39.5