From 9c1076338120a19750ae7e269548cbf8fefe75fd Mon Sep 17 00:00:00 2001 From: Jonathan Green Date: Thu, 6 Sep 2018 22:43:53 -0300 Subject: [PATCH] Add conditional checking if we are working with an empty set. --- includes/orphaned_objects.inc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/includes/orphaned_objects.inc b/includes/orphaned_objects.inc index 60ddf34d..1d90b4d7 100644 --- a/includes/orphaned_objects.inc +++ b/includes/orphaned_objects.inc @@ -159,7 +159,7 @@ WHERE { # Filter by "parent" relationships FILTER (!dead_parent_relationships) - # Exclude objects with live parents - isMemberOf, isMemberOfCollection, isPageOf. + # Exclude objects with live parents OPTIONAL { !live_parent_relationships . ?liveparent . @@ -170,7 +170,10 @@ WHERE { } ORDER BY ?object EOQ; $parent_relationships = module_invoke_all('islandora_solution_pack_child_relationships'); - + if (count($parent_relationships['predicate']) == 0) { + // No predicates to search for. Exit early. + return array(); + } $optionals = (array) module_invoke('islandora_xacml_api', 'islandora_basic_collection_get_query_optionals', 'view'); $filter_modules = array( 'islandora_xacml_api',