/**
  * @see SearchTableUpdateJob::run
  *
  * @since 2.5
  *
  * @param array|boolan $parameters
  */
 public function pushUpdatesFromJobParameters($parameters)
 {
     if (!$this->searchTableUpdater->isEnabled() || !isset($parameters['slot:id']) || $parameters['slot:id'] === false) {
         return;
     }
     $start = microtime(true);
     $tableChangeOps = $this->transitionalDiffStore->newTableChangeOpsFrom($parameters['slot:id']);
     foreach ($tableChangeOps as $tableChangeOp) {
         $this->doUpdateFromTableChangeOp($tableChangeOp);
     }
     wfDebugLog('smw', __METHOD__ . ' procTime (sec): ' . round(microtime(true) - $start, 5));
 }
 private function registerCallbackHandlersByConstructedInstance($callbackLoader)
 {
     /**
      * @var BlobStore
      */
     $callbackLoader->registerCallback('BlobStore', function ($namespace, $cacheType = null, $ttl = 0) use($callbackLoader) {
         $callbackLoader->registerExpectedReturnType('BlobStore', '\\Onoi\\BlobStore\\BlobStore');
         $cacheFactory = $callbackLoader->load('CacheFactory');
         $blobStore = new BlobStore($namespace, $cacheFactory->newMediaWikiCompositeCache($cacheType));
         $blobStore->setNamespacePrefix($cacheFactory->getCachePrefix());
         $blobStore->setExpiryInSeconds($ttl);
         $blobStore->setUsageState($cacheType !== CACHE_NONE && $cacheType !== false);
         return $blobStore;
     });
     /**
      * @var CachedQueryResultPrefetcher
      */
     $callbackLoader->registerCallback('CachedQueryResultPrefetcher', function ($cacheType = null) use($callbackLoader) {
         $callbackLoader->registerExpectedReturnType('CachedQueryResultPrefetcher', '\\SMW\\CachedQueryResultPrefetcher');
         $settings = $callbackLoader->load('Settings');
         $cacheType = $cacheType === null ? $settings->get('smwgQueryResultCacheType') : $cacheType;
         $cachedQueryResultPrefetcher = new CachedQueryResultPrefetcher($callbackLoader->load('Store'), $callbackLoader->singleton('QueryFactory'), $callbackLoader->create('BlobStore', CachedQueryResultPrefetcher::CACHE_NAMESPACE, $cacheType, $settings->get('smwgQueryResultCacheLifetime')), $callbackLoader->singleton('TransientStatsdCollector', CachedQueryResultPrefetcher::STATSD_ID));
         $cachedQueryResultPrefetcher->setLogger($callbackLoader->singleton('MediaWikiLogger'));
         $cachedQueryResultPrefetcher->setNonEmbeddedCacheLifetime($settings->get('smwgQueryResultNonEmbeddedCacheLifetime'));
         return $cachedQueryResultPrefetcher;
     });
     /**
      * @var CachedPropertyValuesPrefetcher
      */
     $callbackLoader->registerCallback('CachedPropertyValuesPrefetcher', function ($cacheType = null, $ttl = 604800) use($callbackLoader) {
         $callbackLoader->registerExpectedReturnType('CachedPropertyValuesPrefetcher', '\\SMW\\CachedPropertyValuesPrefetcher');
         $cachedPropertyValuesPrefetcher = new CachedPropertyValuesPrefetcher($callbackLoader->load('Store'), $callbackLoader->load('BlobStore', CachedPropertyValuesPrefetcher::CACHE_NAMESPACE, $cacheType, $ttl));
         return $cachedPropertyValuesPrefetcher;
     });
     /**
      * @var TransientStatsdCollector
      */
     $callbackLoader->registerCallback('TransientStatsdCollector', function ($id) use($callbackLoader) {
         $callbackLoader->registerExpectedReturnType('TransientStatsdCollector', '\\SMW\\TransientStatsdCollector');
         // Explicitly use the DB to access a SqlBagOstuff instance
         $cacheType = CACHE_DB;
         $ttl = 0;
         $transientStatsdCollector = new TransientStatsdCollector($callbackLoader->create('BlobStore', TransientStatsdCollector::CACHE_NAMESPACE, $cacheType, $ttl), $id);
         return $transientStatsdCollector;
     });
     /**
      * @var PropertySpecificationLookup
      */
     $callbackLoader->registerCallback('PropertySpecificationLookup', function () use($callbackLoader) {
         $callbackLoader->registerExpectedReturnType('PropertySpecificationLookup', '\\SMW\\PropertySpecificationLookup');
         $propertySpecificationLookup = new PropertySpecificationLookup($callbackLoader->singleton('CachedPropertyValuesPrefetcher'), $callbackLoader->singleton('InMemoryPoolCache')->getPoolCacheById(PropertySpecificationLookup::POOLCACHE_ID));
         // Uses the language object selected in user preferences. It is one
         // of two global language objects
         $propertySpecificationLookup->setLanguageCode(Localizer::getInstance()->getUserLanguage()->getCode());
         return $propertySpecificationLookup;
     });
     /**
      * @var PropertyHierarchyLookup
      */
     $callbackLoader->registerCallback('PropertyHierarchyLookup', function () use($callbackLoader) {
         $callbackLoader->registerExpectedReturnType('PropertyHierarchyLookup', '\\SMW\\PropertyHierarchyLookup');
         $propertyHierarchyLookup = new PropertyHierarchyLookup($callbackLoader->load('Store'), $callbackLoader->singleton('InMemoryPoolCache')->getPoolCacheById(PropertyHierarchyLookup::POOLCACHE_ID));
         $propertyHierarchyLookup->setSubcategoryDepth($callbackLoader->load('Settings')->get('smwgQSubcategoryDepth'));
         $propertyHierarchyLookup->setSubpropertyDepth($callbackLoader->load('Settings')->get('smwgQSubpropertyDepth'));
         return $propertyHierarchyLookup;
     });
     /**
      * @var PropertyLabelFinder
      */
     $callbackLoader->registerCallback('PropertyLabelFinder', function () use($callbackLoader) {
         $callbackLoader->registerExpectedReturnType('PropertyLabelFinder', '\\SMW\\PropertyLabelFinder');
         $extraneousLanguage = Localizer::getInstance()->getExtraneousLanguage();
         $propertyLabelFinder = new PropertyLabelFinder($callbackLoader->load('Store'), $extraneousLanguage->getPropertyLabels(), $extraneousLanguage->getCanonicalPropertyLabels());
         return $propertyLabelFinder;
     });
     /**
      * @var TransitionalDiffStore
      */
     $callbackLoader->registerCallback('TransitionalDiffStore', function () use($callbackLoader) {
         $callbackLoader->registerExpectedReturnType('TransitionalDiffStore', '\\SMW\\SQLStore\\TransitionalDiffStore');
         $cacheFactory = $callbackLoader->load('CacheFactory');
         $cacheType = null;
         $transitionalDiffStore = new TransitionalDiffStore($cacheFactory->newMediaWikiCompositeCache($cacheType), $cacheFactory->getCachePrefix());
         $transitionalDiffStore->setLogger($callbackLoader->singleton('MediaWikiLogger'));
         return $transitionalDiffStore;
     });
 }
 public function testNewTableChangeOpsFromUnknownSlot()
 {
     $this->cache->expects($this->once())->method('fetch');
     $instance = new TransitionalDiffStore($this->cache);
     $this->assertEmpty($instance->newTableChangeOpsFrom('Foo:bar'));
 }