exit(3); } } } $from = $ts; $until = $OPTS->until; if (null !== $until) { $ts = strtotime($until); if (false === $ts) { fwrite(STDERR, "unrecognized date format: `{$until}`\n"); exit(3); } $until = $ts; } $params = array(); $harvester = OpenSKOS_Oai_Pmh_Harvester::factory($collection)->setFrom($from)->setUntil($until); foreach (array('set', 'q', 'row') as $opt) { if (null !== $OPTS->{$opt}) { $harvester->setOption($opt, $OPTS->{$opt}); } } $data = array('tenant' => $collection->tenant, 'collection' => $collection->id); try { foreach ($harvester as $page => $records) { if (null !== $OPTS->verbose) { fwrite(STDOUT, sprintf("fetching page %d (%d records):\n", $page + 1, count($harvester))); } foreach ($records as $r => $record) { if (null !== $OPTS->verbose) { fwrite(STDOUT, " processing record {$record->identifier}: "); }
$info .= '<span class="errors">' . _('Tried to import the fallowing already existing concept schemes:') . '"' . implode('", "', $duplicateConceptSchemes) . '"</span><br /><br />'; } if (!empty($notImportedNotations)) { // If there are thousands of not imported notations - show only first 100 if (count($notImportedNotations) > 100) { $notImportedNotations = array_slice($notImportedNotations, 0, 100); $notImportedNotations[] = '...'; } $info .= _('The documents with the fallowing notations were not imported because already exist:') . '"' . implode('", "', $notImportedNotations) . '"'; } $job->setInfo($info); $job->finish()->save(); break; case OpenSKOS_Db_Table_Row_Job::JOB_TASK_HARVEST: $job->start()->save(); $harvester = OpenSKOS_Oai_Pmh_Harvester::factory($collection)->setFrom($job->getParam('from'))->setUntil($job->getParam('until'))->setOption('set', $job->getParam('set')); try { foreach ($harvester as $page => $records) { echo "page " . ($page + 1) . ":\n"; foreach ($records as $r => $record) { echo " record " . ($r + 1) . ": {$record->identifier}\n"; } } $job->finish()->save(); } catch (OpenSKOS_Oai_Pmh_Harvester_Exception $e) { fwrite(STDERR, $job->id . ': ' . $e->getMessage() . "\n"); $job->error($e->getMessage())->finish()->save(); } break; case OpenSKOS_Db_Table_Row_Job::JOB_TASK_EXPORT: $job->start()->save();