public function getDocAtom($r) { $r->checkCache(); $url = 'http://quickdraw.laits.utexas.edu/dase1/media/keanepj/text/000598739.txt'; //$url = 'http://harpo.laits.utexas.edu:5984/test/1c919eeb2a40d850ec57b47334ba4f5c/study_set.atom'; //$url = 'http://harpo.laits.utexas.edu:1978/one'; $r->renderResponse(Dase_Http::get($url, 'xxxx', 'xxx')); }
public function isManager($collection_ascii_id) { $url = $this->config->getAppSetting('remote_url') . '/manager/' . $collection_ascii_id . '/' . $this->eid . '.json'; $res = Dase_Http::get($url); if ('200' == $res[0]) { $data = Dase_Json::toPhp($res[1]); if (isset($data['auth_level'])) { return $data['auth_level']; } } return false; }
public function getCollections($r) { $user = $r->getUser(); //if no collections, redirect to archive admin screen //will force login screen for non-superusers if no collections $c = new Dase_DBO_Collection($this->db); if (!$c->findCount() && $user && $user->is_superuser) { $r->renderRedirect('admin'); } $tpl = new Dase_Template($r); //$feed = Dase_Atom_Feed::retrieve($r->app_root.'/collections.atom'); //$tpl->assign('collections',$feed); $res = Dase_Http::get($r->app_root . '/collections.json'); $collections = Dase_Json::toPhp($res[1]); $tpl->assign('collections', $collections); $r->renderResponse($tpl->fetch('collection/list.tpl')); }
function scrubIndex($collection_ascii_id, $config, $db, $display = true) { $solr_version = '2.2'; $solr_base_url = $config->getSearch('solr_base_url'); $solr_update_url = $solr_base_url . '/update'; $j = 0; for ($i = 0; $i < 999999; $i++) { if (0 === $i % 100) { $solr_search_url = $solr_base_url . '/select/?q=c:' . $collection_ascii_id . '&version=' . $solr_version . '&rows=100&start=' . $i; list($http_code, $res) = Dase_Http::get($solr_search_url, null, null); $sx = simplexml_load_string($res); $num = 0; foreach ($sx->result as $result) { if (count($result->doc)) { foreach ($result->doc as $doc) { foreach ($doc->str as $str) { if ('_id' == $str['name']) { $j++; if ($display) { print "START {$i} ({$j}) "; } $unique = (string) $str; if (Dase_DBO_Item::getByUnique($db, $unique)) { if ($display) { print "FOUND {$unique}\n"; } } else { $num++; $delete_doc = '<delete><id>' . $unique . '</id></delete>'; $resp = Dase_Http::post($solr_update_url, $delete_doc, null, null, 'text/xml'); if ($display) { print "SCRUBBED {$unique}\n"; } } } } } } else { Dase_Http::post($solr_update_url, '<commit/>', null, null, 'text/xml'); return "scrubbed {$num} records"; } } } } }
public function postToSolr($item, $commit = true) { $start_check = Dase_Util::getTime(); $start_get_doc = Dase_Util::getTime(); $check_elapsed = round($start_get_doc - $start_check, 4); Dase_Log::debug(LOG_FILE, 'post to SOLR: ' . $this->solr_update_url . ' item ' . $item->getUnique()); $solr_doc = $this->buildItemSolrDoc($item); //return $solr_doc; $start_index = Dase_Util::getTime(); $get_doc_elapsed = round($start_index - $start_get_doc, 4); $resp = Dase_Http::post($this->solr_update_url, $solr_doc, null, null, 'text/xml'); if ($commit) { Dase_Http::post($this->solr_update_url, '<commit/>', null, null, 'text/xml'); } $end = Dase_Util::getTime(); $index_elapsed = round($end - $start_index, 4); return $resp . ' check: ' . $check_elapsed . ' get_doc: ' . $get_doc_elapsed . ' index: ' . $index_elapsed; }
<?php include 'config.php'; $source = 'asian_studies'; $target = 'pkeane'; $c = Dase_DBO_Collection::get($db, $source); foreach ($c->getItems() as $item) { $json_doc = $item->buildJson('http://dase.laits.utexas.edu'); //print_r(json_decode($json_doc)); $target_url = 'https://daseupload.laits.utexas.edu/collection/' . $target . '/ingester'; print $target_url . "\n"; $res = Dase_Http::post($target_url, $json_doc, 'pkeane', 'dupload', 'application/json'); print_r($res); }
public function get() { $url = $this->getUrl(); $res = Dase_Http::get($url); return Dase_Json::toPhp($res[1]); }
public function getExerciseEdit($r) { $t = new Dase_Template($r); $ex = new Dase_DBO_Exercise($this->db); if (!$ex->load($r->get('id'))) { $r->renderRedirect('home'); } if ($this->user->eid != $ex->creator_eid) { $r->renderError(401, 'unauthorized'); } // media $media_url = "https://dase.laits.utexas.edu/search.json?q=&collection_ascii_id=hdportal&max=999"; $resp = Dase_Http::get($media_url); $data = Dase_Json::toPhp($resp[1]); $t->assign('feed', $data); // all categories $cset = array(); $ex->getCreator(); $ex->getLines(); $ex->getSet(); $t->assign('exercise', $ex); $t->assign('exercise_sets', Dase_DBO_ExerciseSet::getAll($this->db)); $r->renderResponse($t->fetch('exercise_edit.tpl')); }