aboutsummaryrefslogtreecommitdiffstats
path: root/includes/filerepo/backend
diff options
context:
space:
mode:
authorAaron Schulz <aschulz@wikimedia.org>2012-06-05 22:06:56 -0700
committerAaron Schulz <aschulz@wikimedia.org>2012-06-05 22:07:09 -0700
commit47de3d2aec5c054ece96bb82fb358336b432232f (patch)
treeb7e2d73d92727c5260c6db0d6aa5e8fe7c66b4cb /includes/filerepo/backend
parentc29fd59775f597847a57f598a76de48c63952243 (diff)
downloadmediawikicore-47de3d2aec5c054ece96bb82fb358336b432232f.tar.gz
mediawikicore-47de3d2aec5c054ece96bb82fb358336b432232f.zip
Fixed infinite loop in tests with FSLockManager.
* If PHPUnit converts warnings to exceptions, any I/O warnings can throw exceptions which leave locksHeld in an inconsistent state, breaking the __destruct() function. This commits reorders the variable update slightly. Change-Id: I5deac811e7b4d0bc71f3d4096b8d72711904a444
Diffstat (limited to 'includes/filerepo/backend')
-rw-r--r--includes/filerepo/backend/lockmanager/FSLockManager.php6
1 files changed, 4 insertions, 2 deletions
diff --git a/includes/filerepo/backend/lockmanager/FSLockManager.php b/includes/filerepo/backend/lockmanager/FSLockManager.php
index 2b727a8fd3ea..53f3e9f974e8 100644
--- a/includes/filerepo/backend/lockmanager/FSLockManager.php
+++ b/includes/filerepo/backend/lockmanager/FSLockManager.php
@@ -176,6 +176,9 @@ class FSLockManager extends LockManager {
unset( $this->handles[$path][$type] );
}
}
+ if ( !count( $this->locksHeld[$path] ) ) {
+ unset( $this->locksHeld[$path] ); // no locks on this path
+ }
// Unlock handles to release locks and delete
// any lock files that end up with no locks on them...
if ( wfIsWindows() ) {
@@ -218,12 +221,11 @@ class FSLockManager extends LockManager {
*/
private function pruneKeyLockFiles( $path ) {
$status = Status::newGood();
- if ( !count( $this->locksHeld[$path] ) ) {
+ if ( !isset( $this->locksHeld[$path] ) ) {
# No locks are held for the lock file anymore
if ( !unlink( $this->getLockPath( $path ) ) ) {
$status->warning( 'lockmanager-fail-deletelock', $path );
}
- unset( $this->locksHeld[$path] );
unset( $this->handles[$path] );
}
return $status;