Big oops - merged to wrong branch.
[lhc/web/wiklou.git] / includes / filerepo / backend / lockmanager / FSLockManager.php
index 4f3b959..2b727a8 100644 (file)
@@ -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 );
+                       }
                }
        }
 }