<?php include 'config.php'; //this script rebuilds search indexes $coll_ascii_id = 'what_jane_saw'; $coll_ascii_id = 'cola_images'; $coll = new Dase_DBO_Collection($db); $coll->orderBy('item_count ASC'); if ($coll_ascii_id) { $coll->ascii_id = $coll_ascii_id; } foreach ($coll->find() as $c) { $start = Dase_Util::getTime(); print "working on " . $c->collection_name . "(" . $c->item_count . " items)\n"; $c->buildSearchIndex(''); $end = Dase_Util::getTime(); $total = $end - $start; print $total . " seconds\n"; }
<?php include 'config.php'; $solr_url = 'quickdraw.laits.utexas.edu:8080/solr/update'; $limit = 0; //$limit = 15; if ($limit) { print "\nCurrently set to index most recent {$limit} items\n"; } $cs = new Dase_DBO_Collection($db); $cs->orderBy('id DESC'); foreach ($cs->find() as $c) { $c = clone $c; $colls[] = $c->ascii_id; } //can enter collections on command line if (isset($argv[1])) { array_shift($argv); $colls = $argv; } $engine = new Dase_Solr($db, $config); $i = 0; foreach ($colls as $coll) { $c = Dase_DBO_Collection::get($db, $coll); if ($c) { foreach ($c->getItems($limit) as $item) { $i++; $item = clone $item; print $c->collection_name . ':' . $item->serial_number . ':' . $item->buildSearchIndex(false, false); print " {$i}\n"; print " memory: " . memory_get_usage() . "\n";
public function getTools($r) { $tpl = new Dase_Template($r); $colls = new Dase_DBO_Collection($this->db); $colls->orderBy('collection_name'); $tpl->assign('collections', $colls->find()); $r->renderResponse($tpl->fetch('admin/tools.tpl')); }
static function listAsAtom($db, $app_root, $public_only = false) { $c = new Dase_DBO_Collection($db); $c->orderBy('collection_name'); if ($public_only) { $c->is_public = 1; } $cs = $c->find(); $feed = new Dase_Atom_Feed(); $feed->setTitle('DASe Collections'); $feed->setId($app_root); $feed->setFeedType('collection_list'); $feed->setUpdated(date(DATE_ATOM)); $feed->addAuthor('DASe (Digital Archive Services)', 'http://daseproject.org'); $feed->addLink($app_root . '/collections.atom', 'self'); $feed->addCategory($app_root, "http://daseproject.org/category/base_url"); foreach ($cs as $coll) { $coll->injectAtomEntryData($feed->addEntry(), $app_root); } return $feed->asXml(); }
public function getCollections($app_root) { $cm = new Dase_DBO_CollectionManager($this->db); $cm->dase_user_eid = $this->eid; $special_colls = array(); $user_colls = array(); foreach ($cm->find() as $managed) { $special_colls[$managed->collection_ascii_id] = $managed->auth_level; } $coll = new Dase_DBO_Collection($this->db); $coll->orderBy('collection_name'); foreach ($coll->find() as $c) { if (!$c->item_count) { $c->item_count = 0; } if (1 == $c->is_public || in_array($c->ascii_id, array_keys($special_colls))) { if (isset($special_colls[$c->ascii_id])) { $auth_level = $special_colls[$c->ascii_id]; } else { $auth_level = ''; } $user_colls[$c->ascii_id] = array('id' => $c->getUrl($app_root), 'collection_name' => $c->collection_name, 'ascii_id' => $c->ascii_id, 'is_public' => $c->is_public, 'item_count' => $c->item_count, 'auth_level' => $auth_level, 'links' => array('self' => $c->getUrl($app_root), 'media' => $c->getMediaUrl($app_root))); } } return $user_colls; }