Use DB domain in JobQueueGroup and make WikiMap domain ID methods stricter
[lhc/web/wiklou.git] / includes / jobqueue / JobQueueRedis.php
index 7dad014..b868128 100644 (file)
@@ -93,7 +93,7 @@ class JobQueueRedis extends JobQueue {
                parent::__construct( $params );
                $params['redisConfig']['serializer'] = 'none'; // make it easy to use Lua
                $this->server = $params['redisServer'];
-               $this->compression = isset( $params['compression'] ) ? $params['compression'] : 'none';
+               $this->compression = $params['compression'] ?? 'none';
                $this->redisPool = RedisConnectionPool::singleton( $params['redisConfig'] );
                if ( empty( $params['daemonized'] ) ) {
                        throw new InvalidArgumentException(
@@ -776,7 +776,7 @@ LUA;
         * @return string JSON
         */
        private function encodeQueueName() {
-               return json_encode( [ $this->type, $this->wiki ] );
+               return json_encode( [ $this->type, $this->domain ] );
        }
 
        /**
@@ -809,8 +809,9 @@ LUA;
         */
        private function getQueueKey( $prop, $type = null ) {
                $type = is_string( $type ) ? $type : $this->type;
-               list( $db, $prefix ) = wfSplitWikiID( $this->wiki );
-               $keyspace = $prefix ? "$db-$prefix" : $db;
+
+               // Use wiki ID for b/c
+               $keyspace = WikiMap::getWikiIdFromDomain( $this->domain );
 
                $parts = [ $keyspace, 'jobqueue', $type, $prop ];