public function createGatheringItems(GatheringDataSourceConfiguration $configuration) { $pl = new PageList(); $pl->ignoreAliases(); $pl->ignorePermissions(); $gathering = $configuration->getGatheringObject(); if ($gathering->getGatheringDateLastUpdated()) { $pl->filterByPublicDate($gathering->getGatheringDateLastUpdated(), '>'); } $ptID = $configuration->getPageTypeID(); if ($ptID > 0) { $pl->filterByPageTypeID($ptID); } $pages = $pl->get(); $items = array(); foreach ($pages as $c) { $item = PageGatheringItem::add($configuration, $c); if (is_object($item)) { $items[] = $item; } } return $items; }
public function getPages() { // returns an array of pages of this type. Does not check permissions // since this can get pretty long it actually returns a limited amount of data; $pl = new PageList(); $pl->filterByCollectionTypeID($this->getCollectionTypeID()); $pl->ignorePermissions(); $pl->ignoreAliases(); $pages = $pl->get(); return $pages; }
/** * Reindexes the search engine. */ public function reindexAll($fullReindex = false) { Cache::disableLocalCache(); $db = Loader::db(); Loader::model('collection_attributes'); if ($fullReindex) { $db->Execute("truncate table PageSearchIndex"); } $pl = new PageList(); $pl->ignoreAliases(); $pl->ignorePermissions(); $pl->sortByCollectionIDAscending(); $pl->filter(false, '(c.cDateModified > psi.cDateLastIndexed or UNIX_TIMESTAMP(NOW()) - UNIX_TIMESTAMP(psi.cDateLastIndexed) > ' . $this->searchReindexTimeout . ' or psi.cID is null or psi.cDateLastIndexed is null)'); $pl->filter(false, '(ak_exclude_search_index is null or ak_exclude_search_index = 0)'); $pages = $pl->get($this->searchBatchSize); $num = 0; foreach ($pages as $c) { // make sure something is approved $cv = $c->getVersionObject(); if (!$cv->cvIsApproved) { continue; } $c->reindex($this, true); $num++; unset($c); } $pnum = Collection::reindexPendingPages(); $num = $num + $pnum; Cache::enableLocalCache(); $result = new stdClass(); $result->count = $num; return $result; }
public function exportPages($xml = null, PageList $pl = null) { if (!$xml) { $this->x = $this->getXMLRoot(); } $node = $this->x->addChild("pages"); if (!$pl) { $pl = new PageList(); } $pl->ignorePermissions(); $pl->ignoreAliases(); $pl->filter(false, 'cFilename is null or cFilename = \'\''); $pages = $pl->get(); foreach ($pages as $pc) { $pc->export($node); } }