From 598e68980e66f95d2a659e3aa64df876c776ccfc Mon Sep 17 00:00:00 2001 From: Adam Vessey Date: Mon, 26 Jan 2015 14:58:23 -0400 Subject: [PATCH 1/3] Allow "islandora_object" entities to be loaded. Should allow objects to be loaded in Rules, by specifying the "id" as a property. (trying to load by "id" directly is not possibly, since Rules assumes that IDs are numeric) --- includes/object.entity_controller.inc | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/includes/object.entity_controller.inc b/includes/object.entity_controller.inc index 87b5e4de..dfd2d2fd 100644 --- a/includes/object.entity_controller.inc +++ b/includes/object.entity_controller.inc @@ -29,9 +29,13 @@ class IslandoraObjectEntityController implements DrupalEntityControllerInterface * An array of loaded objects. */ public function load($ids = array(), $conditions = array()) { - if (!empty($conditions)) { - // TODO: Allow loading by specifying IDs in the condition. - throw new Exception('Conditions not implemented.'); + if (isset($conditions['id'])) { + // Allow loading by specifying the ID as a property as a work-around, + // since some components dealing with entities expect IDs to be numeric. + $ids = array_merge($ids, (array) $conditions['id']); + } + elseif (!empty($conditions)) { + throw new Exception('Conditions other than "id" not implemented.'); } $loaded = array(); From 8641c469e38c994b5880600161df17c4c18c8744 Mon Sep 17 00:00:00 2001 From: Adam Vessey Date: Mon, 26 Jan 2015 15:00:58 -0400 Subject: [PATCH 2/3] Avoid watchdogging "Cache rebuild lock hit: event_islandora_*" stuff. --- includes/utilities.inc | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/includes/utilities.inc b/includes/utilities.inc index 1459b0a5..4786e362 100644 --- a/includes/utilities.inc +++ b/includes/utilities.inc @@ -197,11 +197,14 @@ function islandora_invoke_hook_list($hook, array $refinements, array $args) { $return = array_merge_recursive($return, $result); array_shift($args); } - if (module_exists('rules') && $event = rules_get_cache("event_$hook")) { - $parameters = $event->parameterInfo(); - $rule_args = array_slice($args, 0, count($parameters)); - array_unshift($rule_args, $hook); - $result = call_user_func_array('rules_invoke_event', $rule_args); + if (module_exists('rules')) { + $event_info = rules_get_event_info($hook); + if (isset($event_info['module'])) { + $parameters = $event_info['variables']; + $rule_args = array_slice($args, 0, count($parameters)); + array_unshift($rule_args, $hook); + $result = call_user_func_array('rules_invoke_event', $rule_args); + } } return $return; } From 88304774a9692d3d8bf59cd7f95ee88edd31a74c Mon Sep 17 00:00:00 2001 From: Adam Vessey Date: Mon, 26 Jan 2015 17:20:34 -0400 Subject: [PATCH 3/3] Revert "Allow "islandora_object" entities to be loaded." This reverts commit 598e68980e66f95d2a659e3aa64df876c776ccfc. --- includes/object.entity_controller.inc | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/includes/object.entity_controller.inc b/includes/object.entity_controller.inc index dfd2d2fd..87b5e4de 100644 --- a/includes/object.entity_controller.inc +++ b/includes/object.entity_controller.inc @@ -29,13 +29,9 @@ class IslandoraObjectEntityController implements DrupalEntityControllerInterface * An array of loaded objects. */ public function load($ids = array(), $conditions = array()) { - if (isset($conditions['id'])) { - // Allow loading by specifying the ID as a property as a work-around, - // since some components dealing with entities expect IDs to be numeric. - $ids = array_merge($ids, (array) $conditions['id']); - } - elseif (!empty($conditions)) { - throw new Exception('Conditions other than "id" not implemented.'); + if (!empty($conditions)) { + // TODO: Allow loading by specifying IDs in the condition. + throw new Exception('Conditions not implemented.'); } $loaded = array();