Browse Source

updated purge_datastream to iterate backwards through the rels elements instead of forward so it can correctly remove all of them

pull/140/head
Jason MacWilliams 13 years ago
parent
commit
845c33964a
  1. 4
      api/fedora_item.inc

4
api/fedora_item.inc

@ -347,7 +347,9 @@ RDF;
$modified = FALSE; $modified = FALSE;
$rels = $relsextxml->getElementsByTagNameNS($namespaceURI, $relationship); $rels = $relsextxml->getElementsByTagNameNS($namespaceURI, $relationship);
if (!empty($rels)) { if (!empty($rels)) {
foreach ($rels as $rel) { for ($i = $rels->length; $i>0; $i--) {
$rel = $rels->item($i-1);
// foreach ($rels as $rel) {
if ( //If either no object is specified, or the object matches (in either the literal or URI case), remove this node from it's parent, and mark as changed. if ( //If either no object is specified, or the object matches (in either the literal or URI case), remove this node from it's parent, and mark as changed.
empty($object) || empty($object) ||
(($literal_value == RELS_TYPE_URI) && $rel->getAttributeNS('http://www.w3.org/1999/02/22-rdf-syntax-ns#', 'resource') == $object) || (($literal_value == RELS_TYPE_URI) && $rel->getAttributeNS('http://www.w3.org/1999/02/22-rdf-syntax-ns#', 'resource') == $object) ||

Loading…
Cancel
Save