X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fjobqueue%2FJobQueueGroup.php;h=4609d2d37e96dbc0949c450479cf293821565d2e;hb=6ae9367cddf8565c948f4d9458b07bb688f2ddc2;hp=5bd1cc94a858b843af4a8c82b70de10014f380cd;hpb=e19a52f2f5376b08c303d31bdcfec56da560f2b0;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/jobqueue/JobQueueGroup.php b/includes/jobqueue/JobQueueGroup.php index 5bd1cc94a8..4609d2d37e 100644 --- a/includes/jobqueue/JobQueueGroup.php +++ b/includes/jobqueue/JobQueueGroup.php @@ -286,18 +286,17 @@ class JobQueueGroup { * @since 1.23 */ public function queuesHaveJobs( $type = self::TYPE_ANY ) { - global $wgMemc; - $key = wfMemcKey( 'jobqueue', 'queueshavejobs', $type ); + $cache = ObjectCache::getLocalClusterInstance(); - $value = $wgMemc->get( $key ); + $value = $cache->get( $key ); if ( $value === false ) { $queues = $this->getQueuesWithJobs(); if ( $type == self::TYPE_DEFAULT ) { $queues = array_intersect( $queues, $this->getDefaultQueueTypes() ); } $value = count( $queues ) ? 'true' : 'false'; - $wgMemc->add( $key, $value, 15 ); + $cache->add( $key, $value, 15 ); } return ( $value === 'true' ); @@ -382,19 +381,24 @@ class JobQueueGroup { * @return mixed */ private function getCachedConfigVar( $name ) { - global $wgConf, $wgMemc; + global $wgConf; if ( $this->wiki === wfWikiID() ) { return $GLOBALS[$name]; // common case } else { + $cache = ObjectCache::getLocalClusterInstance(); list( $db, $prefix ) = wfSplitWikiID( $this->wiki ); $key = wfForeignMemcKey( $db, $prefix, 'configvalue', $name ); - $value = $wgMemc->get( $key ); // ('v' => ...) or false + $value = $cache->get( $key ); // ('v' => ...) or false if ( is_array( $value ) ) { return $value['v']; } else { $value = $wgConf->getConfig( $this->wiki, $name ); - $wgMemc->set( $key, array( 'v' => $value ), 86400 + mt_rand( 0, 86400 ) ); + $cache->set( + $key, + array( 'v' => $value ), + $cache::TTL_DAY + mt_rand( 0, $cache::TTL_DAY ) + ); return $value; }