|
|
|
@ -2233,7 +2233,9 @@ function fedora_repository_display_schema($file) {
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* fedora repository batch reingest object |
|
|
|
|
* @param type $object |
|
|
|
|
* |
|
|
|
|
* @param array $object |
|
|
|
|
* An array defining an object to ingest. |
|
|
|
|
* @param type $context |
|
|
|
|
* @return type |
|
|
|
|
*/ |
|
|
|
@ -2249,23 +2251,22 @@ function fedora_repository_batch_reingest_object($object, &$context) {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// Does the object exist? If so, purge it. |
|
|
|
|
//dd("About to test existence of PID: $pid"); |
|
|
|
|
$item = new Fedora_Item($pid); |
|
|
|
|
if ($item->exists()) { |
|
|
|
|
//dd(' Found'); |
|
|
|
|
$item->purge(t('Remove during re-install batch job')); |
|
|
|
|
//dd(' Purged'); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$new_item = NULL; //Need to have this a couple places... (After trying from FOXML and later for individual DSs) |
|
|
|
|
$datastreams = array(); //Seems like this might be getting messed up due to scope? |
|
|
|
|
// Need to have this a couple places... |
|
|
|
|
// (After trying from FOXML and later for individual DSs) |
|
|
|
|
$new_item = NULL; |
|
|
|
|
// Seems like this might be getting messed up due to scope?. |
|
|
|
|
$datastreams = array(); |
|
|
|
|
|
|
|
|
|
// Ingest the object from the source file. |
|
|
|
|
if (!empty($object['foxml_file'])) { |
|
|
|
|
$foxml_file = $object['foxml_file']; |
|
|
|
|
$new_item = Fedora_Item::ingest_from_FOXML_file($foxml_file); |
|
|
|
|
if ($new_item->exists()) { |
|
|
|
|
// Batch operation was successful; can still add additional DSs, though |
|
|
|
|
// Batch operation was successful; can still add additional DSs, though. |
|
|
|
|
$context['message'][] = t('%pid installed.', array('%pid' => $new_item->pid)); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -2282,9 +2283,7 @@ function fedora_repository_batch_reingest_object($object, &$context) {
|
|
|
|
|
|
|
|
|
|
$label = !empty($object['label']) ? $object['label'] : ''; |
|
|
|
|
if (!isset($new_item)) { |
|
|
|
|
//dd(' Not found, creating'); |
|
|
|
|
$new_item = Fedora_Item::ingest_new_item($pid, 'A', $label); |
|
|
|
|
//dd(' Created'); |
|
|
|
|
} |
|
|
|
|
elseif (!empty($label)) { |
|
|
|
|
$new_item->modify_object($label); |
|
|
|
@ -2292,17 +2291,12 @@ function fedora_repository_batch_reingest_object($object, &$context) {
|
|
|
|
|
|
|
|
|
|
if (isset($new_item)) { |
|
|
|
|
if (!empty($object['cmodel'])) { |
|
|
|
|
//dd(' relating to cmodel'); |
|
|
|
|
$new_item->add_relationship('hasModel', $object['cmodel'], FEDORA_MODEL_URI); |
|
|
|
|
//dd(' related to cmodel'); |
|
|
|
|
} |
|
|
|
|
if (!empty($object['parent'])) { |
|
|
|
|
//dd(' adding parent'); |
|
|
|
|
$new_item->add_relationship('isMemberOfCollection', $object['parent']); |
|
|
|
|
//dd(' parent added'); |
|
|
|
|
} |
|
|
|
|
foreach ((array) $datastreams as $ds) { |
|
|
|
|
//dd("trying to add ds: {$ds['dsid']}"); |
|
|
|
|
if ($ds['dsid'] == 'DC') { |
|
|
|
|
$new_item->modify_datastream_by_value(file_get_contents($ds['datastream_file']), $ds['dsid'], $ds['label'], 'text/xml'); |
|
|
|
|
} |
|
|
|
@ -2315,7 +2309,21 @@ function fedora_repository_batch_reingest_object($object, &$context) {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Content model, collection view and collection policy datastreams may now optionally define a version |
|
|
|
|
* This function will send the postprocess solution pack hook. |
|
|
|
|
* It is referenced by the solution pack form's batch finished entry. |
|
|
|
|
* |
|
|
|
|
*/ |
|
|
|
|
function fedora_repository_solutionpack_send_postprocess($success, $results, $operations) { |
|
|
|
|
// Hook to let solution pack objects be modified. |
|
|
|
|
// Not using module_invoke so solution packs can be expanded by other modules. |
|
|
|
|
if($success) { |
|
|
|
|
module_invoke_all('postprocess_solution_pack', $_SESSION['solution_pack_module_name']); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Content model, collection view and collection policy datastreams may |
|
|
|
|
* now optionally define a version |
|
|
|
|
* number in their top-level XML element as an attribute, as in: |
|
|
|
|
* <content_model name="Collection" version="2" ... |
|
|
|
|
* |
|
|
|
|