|
|
@ -236,7 +236,7 @@ function islandora_purge_object($object_id) { |
|
|
|
$restConnection = new RestConnection($user); |
|
|
|
$restConnection = new RestConnection($user); |
|
|
|
$fedora_object = new FedoraObject($object_id, $restConnection->repository); |
|
|
|
$fedora_object = new FedoraObject($object_id, $restConnection->repository); |
|
|
|
} catch (Exception $e) { |
|
|
|
} catch (Exception $e) { |
|
|
|
drupal_set_message(t('Error getting Islandora object %s', array('%s' => $object_id)), 'error'); |
|
|
|
drupal_set_message(t('Error getting Islandora object %s %e', array('%s' => $object_id, '%e' => $e)), 'error'); |
|
|
|
return ""; |
|
|
|
return ""; |
|
|
|
} |
|
|
|
} |
|
|
|
if (!isset($fedora_object)) { |
|
|
|
if (!isset($fedora_object)) { |
|
|
@ -249,7 +249,7 @@ function islandora_purge_object($object_id) { |
|
|
|
try { |
|
|
|
try { |
|
|
|
$fedora_object->delete(); |
|
|
|
$fedora_object->delete(); |
|
|
|
} catch (Exception $e) { |
|
|
|
} catch (Exception $e) { |
|
|
|
drupal_set_message(t('Error deleting Islandora object %s', array('%s' => $object_id)), 'error'); |
|
|
|
drupal_set_message(t('Error deleting Islandora object %s %e', array('%s' => $object_id, '%e' => $e)), 'error'); |
|
|
|
return ""; |
|
|
|
return ""; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -257,11 +257,12 @@ function islandora_purge_object($object_id) { |
|
|
|
try { |
|
|
|
try { |
|
|
|
$restConnection->repository->purgeObject($object_id); |
|
|
|
$restConnection->repository->purgeObject($object_id); |
|
|
|
} catch (Exception $e) { |
|
|
|
} catch (Exception $e) { |
|
|
|
drupal_set_message(t('Error purging Islandora object %s', array('%s' => $object_id)), 'error'); |
|
|
|
drupal_set_message(t('Error purging Islandora object %s %e', array('%s' => $object_id, '%e' => $e)), 'error'); |
|
|
|
return ""; |
|
|
|
return ""; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
module_invoke_all('islandora_post_purge_object', $object_id, $content_models); //notify modules post deletion |
|
|
|
module_invoke_all('islandora_post_purge_object', $object_id, $content_models); //notify modules post deletion |
|
|
|
|
|
|
|
drupal_goto('islandora'); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
@ -340,7 +341,7 @@ function islandora_purge_datastream($object_id, $datastream_id) { |
|
|
|
$restConnection = new RestConnection($user); |
|
|
|
$restConnection = new RestConnection($user); |
|
|
|
$fedora_object = new FedoraObject($object_id, $restConnection->repository); |
|
|
|
$fedora_object = new FedoraObject($object_id, $restConnection->repository); |
|
|
|
} catch (Exception $e) { |
|
|
|
} catch (Exception $e) { |
|
|
|
drupal_set_message(t('Error getting Islandora object %s', array('%s' => $object_id)), 'error'); |
|
|
|
drupal_set_message(t('Error getting Islandora object %s %e', array('%s' => $object_id, '%e' => $e)), 'error'); |
|
|
|
return ""; |
|
|
|
return ""; |
|
|
|
} |
|
|
|
} |
|
|
|
if (!isset($fedora_object)) { |
|
|
|
if (!isset($fedora_object)) { |
|
|
@ -361,7 +362,7 @@ function islandora_purge_datastream($object_id, $datastream_id) { |
|
|
|
$datastream = new FedoraDatastream($datastream_id, $fedora_object, $restConnection->repository); |
|
|
|
$datastream = new FedoraDatastream($datastream_id, $fedora_object, $restConnection->repository); |
|
|
|
$datastream->state = 'D'; |
|
|
|
$datastream->state = 'D'; |
|
|
|
} catch (Exception $e) { |
|
|
|
} catch (Exception $e) { |
|
|
|
drupal_set_message(t('Error deleting %s datastream from Islandora object %o', array('%s' => $datastream_id, '%o' => $object_id)), 'error'); |
|
|
|
drupal_set_message(t('Error deleting %s datastream from Islandora object %o %e', array('%s' => $datastream_id, '%o' => $object_id, '%e' => $e)), 'error'); |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -369,11 +370,13 @@ function islandora_purge_datastream($object_id, $datastream_id) { |
|
|
|
try { |
|
|
|
try { |
|
|
|
$fedora_object->purgeDatastream($datastream_id); |
|
|
|
$fedora_object->purgeDatastream($datastream_id); |
|
|
|
} catch (Exception $e) { |
|
|
|
} catch (Exception $e) { |
|
|
|
drupal_set_message(t('Error purging %s datastream from Islandora object %o', array('%s' => $datastream_id, '%o' => $object_id)), 'error'); |
|
|
|
drupal_set_message(t('Error purging %s datastream from Islandora object %o %e', array('%s' => $datastream_id, '%o' => $object_id, '%e' => $e)), 'error'); |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
module_invoke_all('islandora_post_purge_datastream', $fedora_object, $datastream_id); //notify modules post deletion |
|
|
|
module_invoke_all('islandora_post_purge_datastream', $fedora_object, $datastream_id); //notify modules post deletion |
|
|
|
|
|
|
|
drupal_set_message(t('%d datastream sucessfully purged from Islandora object %o', array('%d' => $datastream_id, '%o' => $object_id))); |
|
|
|
|
|
|
|
drupal_goto('islandora/object/' . $object_id); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|