X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Flibs%2Flockmanager%2FFSLockManager.php;h=c00b041b33ecc04ac2b2155c091a8f0d2fcf8eaa;hb=04d1aa3033f40a38d721f7f0e88b5bac440d2869;hp=f2624e721a783b474429a58af2c6bdf185c19aab;hpb=e81a7da6c000384b97319c269ffd1e67afcb8ea8;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/libs/lockmanager/FSLockManager.php b/includes/libs/lockmanager/FSLockManager.php index f2624e721a..c00b041b33 100644 --- a/includes/libs/lockmanager/FSLockManager.php +++ b/includes/libs/lockmanager/FSLockManager.php @@ -124,9 +124,13 @@ class FSLockManager extends LockManager { } else { Wikimedia\suppressWarnings(); $handle = fopen( $this->getLockPath( $path ), 'a+' ); - if ( !$handle ) { // lock dir missing? - mkdir( $this->lockDir, 0777, true ); - $handle = fopen( $this->getLockPath( $path ), 'a+' ); // try again + if ( !$handle && !is_dir( $this->lockDir ) ) { + // Create the lock directory in case it is missing + if ( mkdir( $this->lockDir, 0777, true ) ) { + $handle = fopen( $this->getLockPath( $path ), 'a+' ); // try again + } else { + $this->logger->error( "Cannot create directory '{$this->lockDir}'." ); + } } Wikimedia\restoreWarnings(); } @@ -169,7 +173,7 @@ class FSLockManager extends LockManager { if ( $this->locksHeld[$path][$type] <= 0 ) { unset( $this->locksHeld[$path][$type] ); } - if ( !count( $this->locksHeld[$path] ) ) { + if ( $this->locksHeld[$path] === [] ) { unset( $this->locksHeld[$path] ); // no locks on this path if ( isset( $this->handles[$path] ) ) { $handlesToClose[] = $this->handles[$path];