From: Aaron Schulz Date: Wed, 3 Jul 2019 10:38:48 +0000 (-0700) Subject: lockmanager: tweak FSLockManager permission handling in doSingleLock() X-Git-Tag: 1.34.0-rc.0~1128^2 X-Git-Url: http://git.cyclocoop.org/data/Luca_Pacioli_%28Gemaelde%29.jpeg?a=commitdiff_plain;h=0b64fdaf75f69a1abdaf79694bc96b83a7419e1e;p=lhc%2Fweb%2Fwiklou.git lockmanager: tweak FSLockManager permission handling in doSingleLock() Change-Id: Ia0070cc727ca622e127456ddb0e39d007e19f169 --- diff --git a/includes/libs/lockmanager/FSLockManager.php b/includes/libs/lockmanager/FSLockManager.php index 019029c480..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(); }