Add CollationFa
[lhc/web/wiklou.git] / includes / filebackend / lockmanager / LockManager.php
index 8115fd4..567a298 100644 (file)
  */
 abstract class LockManager {
        /** @var array Mapping of lock types to the type actually used */
-       protected $lockTypeMap = array(
+       protected $lockTypeMap = [
                self::LOCK_SH => self::LOCK_SH,
                self::LOCK_UW => self::LOCK_EX, // subclasses may use self::LOCK_SH
                self::LOCK_EX => self::LOCK_EX
-       );
+       ];
 
        /** @var array Map of (resource path => lock type => count) */
-       protected $locksHeld = array();
+       protected $locksHeld = [];
 
        protected $domain; // string; domain (usually wiki ID)
        protected $lockTTL; // integer; maximum time locks can be held
@@ -90,7 +90,7 @@ abstract class LockManager {
         * @return Status
         */
        final public function lock( array $paths, $type = self::LOCK_EX, $timeout = 0 ) {
-               return $this->lockByType( array( $type => $paths ), $timeout );
+               return $this->lockByType( [ $type => $paths ], $timeout );
        }
 
        /**
@@ -103,7 +103,7 @@ abstract class LockManager {
         */
        final public function lockByType( array $pathsByType, $timeout = 0 ) {
                $pathsByType = $this->normalizePathsByType( $pathsByType );
-               $msleep = array( 0, 50, 100, 300, 500 ); // retry backoff times
+               $msleep = [ 0, 50, 100, 300, 500 ]; // retry backoff times
                $start = microtime( true );
                do {
                        $status = $this->doLockByType( $pathsByType );
@@ -126,7 +126,7 @@ abstract class LockManager {
         * @return Status
         */
        final public function unlock( array $paths, $type = self::LOCK_EX ) {
-               return $this->unlockByType( array( $type => $paths ) );
+               return $this->unlockByType( [ $type => $paths ] );
        }
 
        /**
@@ -152,7 +152,7 @@ abstract class LockManager {
         * @return string
         */
        final protected function sha1Base36Absolute( $path ) {
-               return wfBaseConvert( sha1( "{$this->domain}:{$path}" ), 16, 36, 31 );
+               return Wikimedia\base_convert( sha1( "{$this->domain}:{$path}" ), 16, 36, 31 );
        }
 
        /**
@@ -176,7 +176,7 @@ abstract class LockManager {
         * @since 1.22
         */
        final protected function normalizePathsByType( array $pathsByType ) {
-               $res = array();
+               $res = [];
                foreach ( $pathsByType as $type => $paths ) {
                        $res[$this->lockTypeMap[$type]] = array_unique( $paths );
                }
@@ -192,7 +192,7 @@ abstract class LockManager {
         */
        protected function doLockByType( array $pathsByType ) {
                $status = Status::newGood();
-               $lockedByType = array(); // map of (type => paths)
+               $lockedByType = []; // map of (type => paths)
                foreach ( $pathsByType as $type => $paths ) {
                        $status->merge( $this->doLock( $paths, $type ) );
                        if ( $status->isOK() ) {