Merge "jquery.accessKeyLabel: make modifier info public"
[lhc/web/wiklou.git] / includes / jobqueue / JobQueueRedis.php
index b1efa5b..546093f 100644 (file)
@@ -749,7 +749,8 @@ LUA;
        protected function getConnection() {
                $conn = $this->redisPool->getConnection( $this->server );
                if ( !$conn ) {
-                       throw new JobQueueConnectionError( "Unable to connect to redis server." );
+                       throw new JobQueueConnectionError(
+                               "Unable to connect to redis server {$this->server}." );
                }
 
                return $conn;
@@ -786,10 +787,6 @@ LUA;
         */
        private function getGlobalKey( $name ) {
                $parts = array( 'global', 'jobqueue', $name );
-               if ( strlen( $this->key ) ) { // namespaced queue (for testing)
-                       $parts[] = $this->key;
-               }
-
                foreach ( $parts as $part ) {
                    if ( !preg_match( '/[a-zA-Z0-9_-]+/', $part ) ) {
                        throw new InvalidArgumentException( "Key part characters are out of range." );
@@ -801,24 +798,17 @@ LUA;
 
        /**
         * @param string $prop
-        * @param string|null $type
+        * @param string|null $type Override this for sibling queues
         * @return string
         */
        private function getQueueKey( $prop, $type = null ) {
                $type = is_string( $type ) ? $type : $this->type;
                list( $db, $prefix ) = wfSplitWikiID( $this->wiki );
-               if ( strlen( $this->key ) ) { // namespaced queue (for testing)
-                       return wfForeignMemcKey( $db, $prefix, 'jobqueue', $type, $this->key, $prop );
-               } else {
-                       return wfForeignMemcKey( $db, $prefix, 'jobqueue', $type, $prop );
-               }
-       }
+               $keyspace = $prefix ? "$db-$prefix" : $db;
 
-       /**
-        * @param string $key
-        * @return void
-        */
-       public function setTestingPrefix( $key ) {
-               $this->key = $key;
+               $parts = array( $keyspace, 'jobqueue', $type, $prop );
+
+               // Parts are typically ASCII, but encode for sanity to escape ":"
+               return implode( ':', array_map( 'rawurlencode', $parts ) );
        }
 }