Browse Source

RDF sync works on edit from either Drupal or Fedora.

7.x-2.x
Daniel Lamb 10 years ago
parent
commit
35b2f68af8
  1. 25
      islandora_collection/islandora_collection.module

25
islandora_collection/islandora_collection.module

@ -86,4 +86,29 @@ function islandora_collection_node_postupdate($node) {
if (isset($_SERVER['HTTP_IGNORE_HOOKS']) && strcmp(strtolower($_SERVER['HTTP_IGNORE_HOOKS']), "true") == 0) {
return;
}
// Exit early if it's not a collection.
if (strcmp($node->type, ISLANDORA_COLLECTION_CONTENT_TYPE) != 0) {
return;
}
// Unfortunately, there's no way to tell if the db transaction got rolled back in this hook,
// so we'll default to doing it anyway so as not to miss any updates.
// Open to suggestions on this one. But we gotta do post_action hooks otherwise
// things can get crazy if the db transaction hasn't closed.
$nodes = entity_uuid_load('node', array($node->uuid));
// Exit early if something has gone wrong and there's no node info.
if (empty($nodes)) {
return;
}
$node = array_pop($nodes);
$uuid = $node->uuid;
httprl_request("http://localhost:8080/islandora-services/rest/collection/$uuid",
array(
'method' => 'PUT',
'data' => json_encode($node),
));
$response = httprl_send_request();
}

Loading…
Cancel
Save