Example #1
0
 public function loadDetails()
 {
     $db = Loader::db();
     $row = $db->GetRow('select cID from gaPage where gaiID = ?', array($this->getGatheringItemID()));
     $this->setPropertiesFromArray($row);
     $this->page = Page::getByID($row['cID'], 'ACTIVE');
 }
Example #2
0
 public static function add(GatheringDataSourceConfiguration $configuration, Page $c)
 {
     $gathering = $configuration->getGatheringObject();
     try {
         // we wrap this in a try because it MIGHT fail if it's a duplicate
         $item = parent::create($gathering, $configuration->getGatheringDataSourceObject(), $c->getCollectionDatePublic(), $c->getCollectionName(), $c->getCollectionID());
     } catch (Exception $e) {
     }
     if (is_object($item)) {
         $db = Database::connection();
         $db->executeQuery('insert into gaPage (gaiID, cID) values (?, ?)', array($item->getGatheringItemID(), $c->getCollectionID()));
         $item->assignFeatureAssignments($c);
         $item->setAutomaticGatheringItemTemplate();
         return $item;
     }
 }
Example #3
0
 public function reindex($index = false, $actuallyDoReindex = true)
 {
     if ($this->isAlias() && !$this->isExternalLink()) {
         return false;
     }
     if ($actuallyDoReindex || Config::get('concrete.page.search.always_reindex') == true) {
         $db = Loader::db();
         $attribs = CollectionAttributeKey::getAttributes($this->getCollectionID(), $this->getVersionID(), 'getSearchIndexValue');
         $db->Execute('delete from CollectionSearchIndexAttributes where cID = ?', array($this->getCollectionID()));
         $searchableAttributes = array('cID' => $this->getCollectionID());
         $key = new Key();
         $key->reindex('CollectionSearchIndexAttributes', $searchableAttributes, $attribs);
         if ($index == false) {
             $index = new IndexedSearch();
         }
         $index->reindexPage($this);
         $db->Replace('PageSearchIndex', array('cID' => $this->getCollectionID(), 'cRequiresReindex' => 0), array('cID'), false);
         $cache = PageCache::getLibrary();
         $cache->purge($this);
         // we check to see if this page is referenced in any gatherings
         $c = Page::getByID($this->getCollectionID(), $this->getVersionID());
         $items = PageGatheringItem::getListByItem($c);
         foreach ($items as $it) {
             $it->deleteFeatureAssignments();
             $it->assignFeatureAssignments($c);
         }
     } else {
         $db = Loader::db();
         Config::save('concrete.misc.do_page_reindex_check', true);
         $db->Replace('PageSearchIndex', array('cID' => $this->getCollectionID(), 'cRequiresReindex' => 1), array('cID'), false);
     }
 }
Example #4
0
 public function reindex($index = false, $actuallyDoReindex = true)
 {
     if ($this->isAlias() && !$this->isExternalLink()) {
         return false;
     }
     if ($actuallyDoReindex || Config::get('concrete.page.search.always_reindex') == true) {
         // Retrieve the attribute values for the current page
         $category = \Core::make('Concrete\\Core\\Attribute\\Category\\PageCategory');
         $indexer = $category->getSearchIndexer();
         $values = $category->getAttributeValues($this);
         foreach ($values as $value) {
             $indexer->indexEntry($category, $value, $this);
         }
         if ($index == false) {
             $index = new IndexedSearch();
         }
         $index->reindexPage($this);
         $db = \Database::connection();
         $db->Replace('PageSearchIndex', array('cID' => $this->getCollectionID(), 'cRequiresReindex' => 0), array('cID'), false);
         $cache = PageCache::getLibrary();
         $cache->purge($this);
         // we check to see if this page is referenced in any gatherings
         $c = Page::getByID($this->getCollectionID(), $this->getVersionID());
         $items = PageGatheringItem::getListByItem($c);
         foreach ($items as $it) {
             $it->deleteFeatureAssignments();
             $it->assignFeatureAssignments($c);
         }
     } else {
         $db = Loader::db();
         Config::save('concrete.misc.do_page_reindex_check', true);
         $db->Replace('PageSearchIndex', array('cID' => $this->getCollectionID(), 'cRequiresReindex' => 1), array('cID'), false);
     }
 }