From 2f06a9931a42daddaccba5970c3acb1ca62456b4 Mon Sep 17 00:00:00 2001 From: Aaron Schulz Date: Sat, 2 Jun 2012 15:13:31 -0700 Subject: [PATCH] Fixed destructor in FSLockManager to clear all the locks. Change-Id: I019d24c19f317eb649b5a0415618b453e1ea171b --- .../filerepo/backend/lockmanager/FSLockManager.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/includes/filerepo/backend/lockmanager/FSLockManager.php b/includes/filerepo/backend/lockmanager/FSLockManager.php index 4f3b9596ec..2b727a8fd3 100644 --- a/includes/filerepo/backend/lockmanager/FSLockManager.php +++ b/includes/filerepo/backend/lockmanager/FSLockManager.php @@ -239,11 +239,15 @@ class FSLockManager extends LockManager { return "{$this->lockDir}/{$hash}.lock"; } + /** + * Make sure remaining locks get cleared for sanity + */ function __destruct() { - // Make sure remaining locks get cleared for sanity - foreach ( $this->locksHeld as $path => $locks ) { - $this->doSingleUnlock( $path, self::LOCK_EX ); - $this->doSingleUnlock( $path, self::LOCK_SH ); + while ( count( $this->locksHeld ) ) { + foreach ( $this->locksHeld as $path => $locks ) { + $this->doSingleUnlock( $path, self::LOCK_EX ); + $this->doSingleUnlock( $path, self::LOCK_SH ); + } } } } -- 2.20.1