Пример #1
0
 /**
  * Return status of the concept cache for the given concept as an array
  * with key 'status' ('empty': not cached, 'full': cached, 'no': not
  * cachable). If status is not 'no', the array also contains keys 'size'
  * (query size), 'depth' (query depth), 'features' (query features). If
  * status is 'full', the array also contains keys 'date' (timestamp of
  * cache), 'count' (number of results in cache).
  *
  * @since 1.8
  * @param Title|SMWWikiPageValue $concept
  *
  * @return SMW\DIConcept|null
  */
 public function getConceptCacheStatus($concept)
 {
     $db = $this->getConnection();
     $cid = $this->smwIds->getSMWPageID($concept->getDBkey(), $concept->getNamespace(), '', '', false);
     $row = $db->selectRow('smw_fpt_conc', array('concept_txt', 'concept_features', 'concept_size', 'concept_depth', 'cache_date', 'cache_count'), array('s_id' => $cid), __METHOD__);
     if ($row !== false) {
         $dataItem = new SMW\DIConcept($concept, null, $row->concept_features, $row->concept_size, $row->concept_depth);
         if ($row->cache_date) {
             $dataItem->setCacheStatus('full');
             $dataItem->setCacheDate($row->cache_date);
             $dataItem->setCacheCount($row->cache_count);
         } else {
             $dataItem->setCacheStatus('empty');
         }
         $result = $dataItem;
     } else {
         $result = null;
     }
     return $result;
 }
Пример #2
0
 /**
  * Return status of the concept cache for the given concept as an array
  * with key 'status' ('empty': not cached, 'full': cached, 'no': not
  * cachable). If status is not 'no', the array also contains keys 'size'
  * (query size), 'depth' (query depth), 'features' (query features). If
  * status is 'full', the array also contains keys 'date' (timestamp of
  * cache), 'count' (number of results in cache).
  *
  * @since 1.8
  * @param Title|SMWWikiPageValue $concept
  * @return array
  */
 public function getConceptCacheStatus($concept)
 {
     wfProfileIn('SMWSQLStore3::getConceptCacheStatus (SMW)');
     $db = wfGetDB(DB_SLAVE);
     $cid = $this->smwIds->getSMWPageID($concept->getDBkey(), $concept->getNamespace(), '', '', false);
     $row = $db->selectRow('smw_fpt_conc', array('concept_txt', 'concept_features', 'concept_size', 'concept_depth', 'cache_date', 'cache_count'), array('s_id' => $cid), 'SMWSQLStore3::getConceptCacheStatus (SMW)');
     if ($row !== false) {
         $result = array('size' => $row->concept_size, 'depth' => $row->concept_depth, 'features' => $row->concept_features);
         if ($row->cache_date) {
             $result['status'] = 'full';
             $result['date'] = $row->cache_date;
             $result['count'] = $row->cache_count;
         } else {
             $result['status'] = 'empty';
         }
     } else {
         $result = array('status' => 'no');
     }
     wfProfileOut('SMWSQLStore3::getConceptCacheStatus (SMW)');
     return $result;
 }
Пример #3
0
 /**
  * Constructor.
  *
  * @since 1.8
  * @param SMWSQLStore3 $store
  */
 public function __construct(SMWSQLStore3 $store)
 {
     $this->store = $store;
     // Yes, this is a hack, but we only use it for convenient debugging:
     self::$singleton_debug = $this;
 }
Пример #4
0
 /**
  * Constructor.
  *
  * @since 1.8
  * @param SMWSQLStore3 $store
  */
 public function __construct(SMWSQLStore3 $store)
 {
     $this->store = $store;
     // Yes, this is a hack, but we only use it for convenient debugging:
     self::$singleton_debug = $this;
     $this->dataItemByIdFinder = new DataItemByIdFinder($this->store->getConnection('mw.db'), self::tableName, ApplicationFactory::getInstance()->newCacheFactory()->newFixedInMemoryCache());
     $this->redirectInfoStore = new RedirectInfoStore($this->store->getConnection('mw.db'), ApplicationFactory::getInstance()->newCacheFactory()->newFixedInMemoryCache());
 }
 /**
  * Constructor.
  *
  * @since 1.8
  * @param SMWSQLStore3 $store
  */
 public function __construct(SMWSQLStore3 $store)
 {
     $this->store = $store;
     // Yes, this is a hack, but we only use it for convenient debugging:
     self::$singleton_debug = $this;
     $this->byIdDataItemFinder = new ByIdDataItemFinder($this->store->getConnection('mw.db'));
     $this->redirectInfoStore = new RedirectInfoStore($this->store->getConnection('mw.db'));
 }
Пример #6
0
 /**
  * Constructor.
  *
  * @since 1.8
  * @param SMWSQLStore3 $store
  */
 public function __construct(SMWSQLStore3 $store)
 {
     $this->store = $store;
     // Yes, this is a hack, but we only use it for convenient debugging:
     self::$singleton_debug = $this;
     // Either inject the class directly or an IdGeneratorFactory class instead
     $this->dataItemByIdFinder = new DataItemByIdFinder($this->store->getConnection('mw.db'), self::tableName);
     $this->redirectInfoStore = new RedirectInfoStore($this->store->getConnection('mw.db'));
 }
Пример #7
0
 /**
  * Constructor.
  *
  * @since 1.8
  * @param SMWSQLStore3 $store
  */
 public function __construct(SMWSQLStore3 $store, IdToDataItemMatchFinder $idToDataItemMatchFinder)
 {
     $this->store = $store;
     // Yes, this is a hack, but we only use it for convenient debugging:
     self::$singleton_debug = $this;
     $this->idToDataItemMatchFinder = $idToDataItemMatchFinder;
     $this->redirectInfoStore = new RedirectInfoStore($this->store->getConnection('mw.db'));
     $this->intermediaryIdCache = ApplicationFactory::getInstance()->getInMemoryPoolCache()->getPoolCacheFor(self::POOLCACHE_ID);
 }