The module register a shutdown function in hook_entiyt_delete()
, hook_entity_insert()
, and hook_entity_update()
.
/**
* @param $entity
* @param $type
*/
function hook_post_action_entity_insert($entity, $type) {
drupal_register_shutdown_function('_hook_post_action_post_save', $entity, $type, 'insert');
}
As such, the hooks invoked from that shutdown function are always invoked, except in the case the shutdown function is not called, which as the documentation for register_shutdown()
says, it can happen if the process is killed with a SIGTERM or SIGKILL signal. Since PHP doesn't have a function to removed a shutdown function, I would say the module is reliable.
As side note, hook_node_postsave()
and hook_entity_postsave()
are always invoked, whenever the entity is created, updated, or deleted.
/**
* @param $entity
* @param $type
* @param $op
*/
function _hook_post_action_post_save($entity, $type, $op) {
$entity_is_saved = FALSE;
$new_entity = NULL;
if ($op == 'insert' || $op == 'update') {
$entity_is_saved = TRUE;
}
if ($op == 'delete') {
list($id) = entity_extract_ids($type, $entity);
$new_entity = entity_load($type, array($id));
if (!$new_entity) {
$entity_is_saved = TRUE;
}
}
if ($entity_is_saved) {
module_invoke_all('entity_post' . $op, $entity, $type);
module_invoke_all('entity_postsave', $entity, $type, $op);
if ($type == 'node') {
module_invoke_all('node_post' . $op, $entity);
module_invoke_all('node_postsave', $entity, $op);
}
}
}