From 6a1d902de7f3b11be995c0e78531a6b209be12e8 Mon Sep 17 00:00:00 2001 From: Jordan Dukart Date: Thu, 23 Jan 2014 20:17:13 +0000 Subject: [PATCH] Force re-load an object when purging so we don't try to access things that no longer exist in Fedora. --- includes/tuque_wrapper.inc | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/includes/tuque_wrapper.inc b/includes/tuque_wrapper.inc index 98e9c62c..d30af147 100644 --- a/includes/tuque_wrapper.inc +++ b/includes/tuque_wrapper.inc @@ -298,7 +298,14 @@ class IslandoraFedoraApiM extends FedoraApiM { default: $ret = parent::purgeDatastream($pid, $dsid, $params); - islandora_invoke_datastream_hooks(ISLANDORA_DATASTREAM_PURGED_HOOK, $object->models, $dsid, $object, $dsid); + // We need to remove this object from the cache and reload it as + // Tuque may not have an updated copy. That is the datastream could + // still be present within the object even though it's purged out of + // Fedora. + $tuque = islandora_get_tuque_connection(); + $tuque->cache->delete($pid); + $non_cached_object = islandora_object_load($pid); + islandora_invoke_datastream_hooks(ISLANDORA_DATASTREAM_PURGED_HOOK, $non_cached_object->models, $dsid, $non_cached_object, $dsid); return $ret; } }