Remove wfForeignMemcKey() usage from JobQueueRedis::getQueueKey()
authorAaron Schulz <aschulz@wikimedia.org>
Thu, 10 Dec 2015 19:29:31 +0000 (11:29 -0800)
committerAaron Schulz <aschulz@wikimedia.org>
Fri, 11 Dec 2015 01:34:22 +0000 (17:34 -0800)
This class should manage the escaping it uses, rather than use some
random BagOStuff that has nothing to do with the job queue.

Change-Id: Ie716dc4a3429754a99c5f0670555e5e049b61aa1

includes/jobqueue/JobQueueRedis.php

index 3e7bdcc..67420f0 100644 (file)
@@ -797,13 +797,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 );
+               $keyspace = $prefix ? "$db-$prefix" : $db;
 
-               return wfForeignMemcKey( $db, $prefix, 'jobqueue', $type, $prop );
+               $parts = array( $keyspace, 'jobqueue', $type, $prop );
+
+               // Parts are typically ASCII, but encode for sanity to escape ":"
+               return implode( ':', array_map( 'rawurlencode', $parts ) );
        }
 }