Merge "DumpUploads: output local path instead of mwstore path"
[lhc/web/wiklou.git] / includes / clientpool / RedisConnectionPool.php
index 1b9f9b3..a9bc593 100644 (file)
@@ -62,12 +62,12 @@ class RedisConnectionPool implements LoggerAwareInterface {
        protected $idlePoolSize = 0;
 
        /** @var array (server name => ((connection info array),...) */
-       protected $connections = array();
+       protected $connections = [];
        /** @var array (server name => UNIX timestamp) */
-       protected $downServers = array();
+       protected $downServers = [];
 
        /** @var array (pool ID => RedisConnectionPool) */
-       protected static $instances = array();
+       protected static $instances = [];
 
        /** integer; seconds to cache servers as "down". */
        const SERVER_DOWN_TTL = 30;
@@ -171,7 +171,7 @@ class RedisConnectionPool implements LoggerAwareInterface {
         * @since 1.27
         */
        public static function destroySingletons() {
-               self::$instances = array();
+               self::$instances = [];
        }
 
        /**
@@ -196,7 +196,7 @@ class RedisConnectionPool implements LoggerAwareInterface {
                                $this->logger->debug(
                                        'Server "{redis_server}" is marked down for another ' .
                                        ( $this->downServers[$server] - $now ) . 'seconds',
-                                       array( 'redis_server' => $server )
+                                       [ 'redis_server' => $server ]
                                );
 
                                return false;
@@ -247,7 +247,7 @@ class RedisConnectionPool implements LoggerAwareInterface {
                        if ( !$result ) {
                                $this->logger->error(
                                        'Could not connect to server "{redis_server}"',
-                                       array( 'redis_server' => $server )
+                                       [ 'redis_server' => $server ]
                                );
                                // Mark server down for some time to avoid further timeouts
                                $this->downServers[$server] = time() + self::SERVER_DOWN_TTL;
@@ -258,7 +258,7 @@ class RedisConnectionPool implements LoggerAwareInterface {
                                if ( !$conn->auth( $this->password ) ) {
                                        $this->logger->error(
                                                'Authentication error connecting to "{redis_server}"',
-                                               array( 'redis_server' => $server )
+                                               [ 'redis_server' => $server ]
                                        );
                                }
                        }
@@ -266,10 +266,10 @@ class RedisConnectionPool implements LoggerAwareInterface {
                        $this->downServers[$server] = time() + self::SERVER_DOWN_TTL;
                        $this->logger->error(
                                'Redis exception connecting to "{redis_server}"',
-                               array(
+                               [
                                        'redis_server' => $server,
                                        'exception' => $e,
-                               )
+                               ]
                        );
 
                        return false;
@@ -278,7 +278,7 @@ class RedisConnectionPool implements LoggerAwareInterface {
                if ( $conn ) {
                        $conn->setOption( Redis::OPT_READ_TIMEOUT, $this->readTimeout );
                        $conn->setOption( Redis::OPT_SERIALIZER, $this->serializer );
-                       $this->connections[$server][] = array( 'conn' => $conn, 'free' => false );
+                       $this->connections[$server][] = [ 'conn' => $conn, 'free' => false ];
 
                        return new RedisConnRef( $this, $server, $conn, $this->logger );
                } else {
@@ -357,10 +357,10 @@ class RedisConnectionPool implements LoggerAwareInterface {
                $server = $cref->getServer();
                $this->logger->error(
                        'Redis exception on server "{redis_server}"',
-                       array(
+                       [
                                'redis_server' => $server,
                                'exception' => $e,
-                       )
+                       ]
                );
                foreach ( $this->connections[$server] as $key => $connection ) {
                        if ( $cref->isConnIdentical( $connection['conn'] ) ) {
@@ -392,7 +392,7 @@ class RedisConnectionPool implements LoggerAwareInterface {
                        if ( !$conn->auth( $this->password ) ) {
                                $this->logger->error(
                                        'Authentication error connecting to "{redis_server}"',
-                                       array( 'redis_server' => $server )
+                                       [ 'redis_server' => $server ]
                                );
 
                                return false;
@@ -492,14 +492,14 @@ class RedisConnRef {
 
                $conn->clearLastError();
                try {
-                       $res = call_user_func_array( array( $conn, $name ), $arguments );
+                       $res = call_user_func_array( [ $conn, $name ], $arguments );
                        if ( preg_match( '/^ERR operation not permitted\b/', $conn->getLastError() ) ) {
                                $this->pool->reauthenticateConnection( $this->server, $conn );
                                $conn->clearLastError();
-                               $res = call_user_func_array( array( $conn, $name ), $arguments );
+                               $res = call_user_func_array( [ $conn, $name ], $arguments );
                                $this->logger->info(
                                        "Used automatic re-authentication for method '$name'.",
-                                       array( 'redis_server' => $this->server )
+                                       [ 'redis_server' => $this->server ]
                                );
                        }
                } catch ( RedisException $e ) {
@@ -539,7 +539,7 @@ class RedisConnRef {
                        $res = $conn->eval( $script, $params, $numKeys );
                        $this->logger->info(
                                "Used automatic re-authentication for Lua script '$sha1'.",
-                               array( 'redis_server' => $server )
+                               [ 'redis_server' => $server ]
                        );
                }
                // If the script is not in cache, use eval() to retry and cache it
@@ -548,17 +548,17 @@ class RedisConnRef {
                        $res = $conn->eval( $script, $params, $numKeys );
                        $this->logger->info(
                                "Used eval() for Lua script '$sha1'.",
-                               array( 'redis_server' => $server )
+                               [ 'redis_server' => $server ]
                        );
                }
 
                if ( $conn->getLastError() ) { // script bug?
                        $this->logger->error(
                                'Lua script error on server "{redis_server}": {lua_error}',
-                               array(
+                               [
                                        'redis_server' => $server,
                                        'lua_error' => $conn->getLastError()
-                               )
+                               ]
                        );
                }