@@ -591,7 +591,6 @@
}
$output = array();
-
// Get current time before we start fetching. Fetching shouldnt take
// long, but in theory there could be a really small window in which
// a record could be created in and not fetched, and man that would
@@ -618,9 +617,10 @@
// Get the last fetch date, if we cant get the earliest date stamp
// and if we cant do that, die.
$from = variable_get('oai_pmh_'. $repo .'_last_fetch',
- variable_get('oai_pmh_'. $repo .'_earliest_datestamp', FALSE));
+ variable_get('oai_pmh_'. $repo .'_earliest_datestamp',FALSE));
+ if(!isset($from) || $from=="")
+ $from = variable_get('oai_pmh_'. $repo .'_earliest_datestamp',FALSE);
}
-
// Define the request limit.
$day_span_to_harvest = 60; // TODO: Remove hardcoded option
$until = date($date_format, strtotime($from) + ($day_span_to_harvest * 3600 * 24));
@@ -652,13 +652,12 @@
}
}
else {*/
-
$output[] = t('Processing @repository, dates @start - @end', array('@repository' => $repo, '@start' => $from, '@end' => $until));
$request = '?verb=ListRecords&from='. _oai_pmh_clean_url($from) .
'&until=' . _oai_pmh_clean_url($until) .
'&metadataPrefix=oai_dc';
#$request = "?verb=ListRecords&from=2010-01-01T19%3A20%3A30Z&until=2010-01-11T13%3A01%3A30Z&metadataPrefix=oai_dc";
- $result = oai_pmh_do_work($repo, $request, $record_store['store']);
+ $result = oai_pmh_do_work($repo, $request, $record_store['store']);
$output[] = theme('item_list', array($result['output']));
if ((bool)$result['error']) {
$error = true;
@@ -716,7 +715,6 @@
}
else {
$s = simplexml_load_string($xml);
-
if (!$s) {
die('SimpleXML load string error: '. $xml);
}
@@ -788,9 +786,9 @@
$update = false;
$records_new++;
}
-
$dc_node = $item->metadata->children('http://www.openarchives.org/OAI/2.0/oai_dc/')->children('http://purl.org/dc/elements/1.1/');
-
+ //Save headers
+ $dc_node_header = $item->header->children();
$node->type = variable_get('oai_pmh_'. $repo .'_node_type','');
$node->title = (string)$dc_node->title;
$node->uid = 0;
@@ -814,10 +812,10 @@
if ((isset($dc_node->subject)) && ($vid != '-1')) {
foreach ($dc_node->subject as $term) {
// Remove all numbers
- $numbers = array("1", "2", "3", "4", "5", "6", "7", "8", "9", "0");
- $term = str_replace($numbers, '', $term);
+ //$numbers = array("1", "2", "3", "4", "5", "6", "7", "8", "9", "0");
+ //$term = str_replace($numbers, '', $term);
// Escape quotes
- $term = str_replace('"', '\\"', $term);
+ /*$term = str_replace('"', '\\"', $term);
//Here strip all the tags that the user would like to remove
$term = str_replace($strip_tags, '', $term);
@@ -836,7 +834,8 @@
$term = str_replace('::', '","', $term);
$term = str_replace('--', '","', $term);
$term = str_replace('-', '","', $term);
- $term = str_replace(':', '","', $term);
+ $term = str_replace(':', '","', $term);*/
+ $term = str_replace('DoajSubjectTerm: ', '', $term);
$term = trim($term);
if ($term != "") {
$term = '"'. $term . '"';
@@ -866,8 +865,8 @@
$vid = variable_get('oai_pmh_'. $repo .'_creator','');
$term="";
$tags_this_vid="";
- if ((isset($dc_node->creator))&&($vid!='-1')) {
- foreach ($dc_node->creator as $term) {
+ if ((isset($dc_node->publisher))&&($vid!='-1')) {
+ foreach ($dc_node->publisher as $term) {
//Here strip all the tags that the user would like to remove
for ($i = 0, $size = sizeof($strip_tags); $i < $size; ++$i) {
$term = str_replace($strip_tags[$i], '', $term);
@@ -898,14 +897,15 @@
$vid = variable_get('oai_pmh_'. $repo .'_date','');
$term = "";
$tags_this_vid = "";
- $last_item_date = str_replace(array('', ''), '', $dc_node->date->asXML());
+ //Save the datestamp of the header of the request
+ $last_item_date = str_replace(array('', ''), '', $dc_node_header->datestamp->asXML());
if ((isset($dc_node->date))&&($vid!='-1')) {
foreach ($dc_node->date as $term) {
//Here strip all the tags that the user would like to remove
for ($i = 0, $size = sizeof($strip_tags); $i < $size; ++$i) {
$term = str_replace($strip_tags[$i], '', $term);
}
- $term = oai_pmh_extract_date($term);
+ //$term = oai_pmh_extract_date($term);
$term = '"'. $term. '"';
$tags_this_vid = $tags_this_vid . ($tags_this_vid ? "," : "") . $term;