Merge "rdbms: add IDatabase::lockForUpdate() convenience method"
[lhc/web/wiklou.git] / includes / libs / lockmanager / LockManager.php
index bee34dc..e310768 100644 (file)
@@ -26,7 +26,6 @@ use Wikimedia\WaitConditionLoop;
  *
  * @file
  * @ingroup LockManager
- * @author Aaron Schulz
  */
 
 /**
@@ -34,7 +33,7 @@ use Wikimedia\WaitConditionLoop;
  *
  * Locks on resource keys can either be shared or exclusive.
  *
- * Implementations must keep track of what is locked by this proccess
+ * Implementations must keep track of what is locked by this process
  * in-memory and support nested locking calls (using reference counting).
  * At least LOCK_UW and LOCK_EX must be implemented. LOCK_SH can be a no-op.
  * Locks should either be non-blocking or have low wait timeouts.
@@ -81,10 +80,10 @@ abstract class LockManager {
         *               This only applies if locks are not tied to a connection/process.
         */
        public function __construct( array $config ) {
-               $this->domain = isset( $config['domain'] ) ? $config['domain'] : 'global';
+               $this->domain = $config['domain'] ?? 'global';
                if ( isset( $config['lockTTL'] ) ) {
                        $this->lockTTL = max( 5, $config['lockTTL'] );
-               } elseif ( PHP_SAPI === 'cli' ) {
+               } elseif ( PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg' ) {
                        $this->lockTTL = 3600;
                } else {
                        $met = ini_get( 'max_execution_time' ); // this is 0 in CLI mode
@@ -102,7 +101,7 @@ abstract class LockManager {
                }
                $this->session = md5( implode( '-', $random ) );
 
-               $this->logger = isset( $config['logger'] ) ? $config['logger'] : new \Psr\Log\NullLogger();
+               $this->logger = $config['logger'] ?? new \Psr\Log\NullLogger();
        }
 
        /**
@@ -170,7 +169,7 @@ abstract class LockManager {
        /**
         * Get the base 36 SHA-1 of a string, padded to 31 digits.
         * Before hashing, the path will be prefixed with the domain ID.
-        * This should be used interally for lock key or file names.
+        * This should be used internally for lock key or file names.
         *
         * @param string $path
         * @return string
@@ -182,7 +181,7 @@ abstract class LockManager {
        /**
         * Get the base 16 SHA-1 of a string, padded to 31 digits.
         * Before hashing, the path will be prefixed with the domain ID.
-        * This should be used interally for lock key or file names.
+        * This should be used internally for lock key or file names.
         *
         * @param string $path
         * @return string