From 8eecf42360a42acc08fff139d688859dc7dcc033 Mon Sep 17 00:00:00 2001 From: willtp87 Date: Thu, 5 Mar 2015 14:05:12 -0400 Subject: [PATCH] Playing nice with the parents, cause @adam-vessey made me. --- includes/tuque_wrapper.inc | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/includes/tuque_wrapper.inc b/includes/tuque_wrapper.inc index f4667e43..dbb60731 100644 --- a/includes/tuque_wrapper.inc +++ b/includes/tuque_wrapper.inc @@ -56,7 +56,7 @@ function islandora_alter_datastream(AbstractObject $object, AbstractDatastream $ } /** - * Constructs a list of hooks from the given paramenters and invokes them. + * Constructs a list of hooks from the given parameters and invokes them. */ function islandora_invoke_object_hooks($hook, array $models) { module_load_include('inc', 'islandora', 'includes/utilities'); @@ -64,7 +64,7 @@ function islandora_invoke_object_hooks($hook, array $models) { } /** - * Constructs a list of hooks from the given paramenters and invokes them. + * Constructs a list of hooks from the given parameters and invokes them. */ function islandora_invoke_datastream_hooks($hook, array $models, $dsid) { module_load_include('inc', 'islandora', 'includes/utilities'); @@ -253,8 +253,8 @@ class IslandoraFedoraObject extends FedoraObject { 'delete' => FALSE, 'block' => FALSE, ); - islandora_alter_datastream($this, $this[$id], $context); try { + islandora_alter_datastream($this, $this[$id], $context); $action = $context['block'] ? 'block' : FALSE; $action = (!$action && $context['delete']) ? 'delete' : $action; $action = !$action ? 'purge' : $action; @@ -267,10 +267,7 @@ class IslandoraFedoraObject extends FedoraObject { return array(); default: - $this->repository->api->m->purgeDatastream($this->id, $id); - unset($this->datastreams[$id]); - $this->refresh(); - islandora_invoke_datastream_hooks(ISLANDORA_DATASTREAM_PURGED_HOOK, $this->models, $id, $this, $id); + parent::purgeDatastream($id); return TRUE; } } @@ -337,6 +334,16 @@ class IslandoraFedoraApiM extends FedoraApiM { return parent::modifyDatastream($pid, $dsid, $params); } + /** + * Purge a datastream from from Fedora. + * + * @see FedoraApiM::purgeDatastream + */ + public function purgeDatastream($pid, $dsid, $params = array()) { + $object = islandora_object_load($pid); + islandora_invoke_datastream_hooks(ISLANDORA_DATASTREAM_PURGED_HOOK, $object->models, $dsid, $object, $dsid); + } + /** * Update Fedora Object parameters. *