[Koha-patches] [PATCH 6/6] Bug 11078 Add locking to rebuild_zebra QA Patch 4
Doug Kingston
dpk at randomnotes.org
Sun Nov 17 21:07:23 CET 2013
Address coding style issues from koha-qa.pl
---
misc/migration_tools/rebuild_zebra.pl | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/misc/migration_tools/rebuild_zebra.pl b/misc/migration_tools/rebuild_zebra.pl
index 8b77686..74976c1 100755
--- a/misc/migration_tools/rebuild_zebra.pl
+++ b/misc/migration_tools/rebuild_zebra.pl
@@ -146,7 +146,7 @@ my ($biblioitemnumbertagfield,$biblioitemnumbertagsubfield) = &GetMarcFromKohaFi
my $lockdir = C4::Context->config("lockdir");
$lockdir = "/var/lock" if $lockdir == "";
$lockdir .= ("/koha_rebuild_zebra_" . C4::Context->config("database"));
-mkpath($lockdir, 0, 0755) unless (-d $lockdir);
+mkpath($lockdir, 0, oct(755)) unless (-d $lockdir);
my $lockfile = $lockdir . "/lock";
if ( $verbose_logging ) {
@@ -173,14 +173,14 @@ my $tester = XML::LibXML->new();
# record being overwritten by a rebuild if the update is applied after the export
# by the rebuild and before the rebuild finishes (more likely to effect large
# catalogs).
-open(LockFH, ">$lockfile") or die "$lockfile: $!";
+open my $LockFH, q{>}, $lockfile or die "$lockfile: $!";
if ($daemon_mode) {
while (1) {
# For incremental updates, skip the update if the updates are locked
- if (flock(LockFH, LOCK_EX|LOCK_NB)) {
- do_one_pass() if ( zebraqueue_not_empty() );
- flock(LockFH, LOCK_UN);
- }
+ if (flock(LockFH, LOCK_EX|LOCK_NB)) {
+ do_one_pass() if ( zebraqueue_not_empty() );
+ flock(LockFH, LOCK_UN);
+ }
sleep $daemon_sleep;
}
} else {
--
1.7.9.5
More information about the Koha-patches
mailing list