|
|
@ -204,7 +204,7 @@ function islandora_get_orphaned_objects() { |
|
|
|
$orphaned_objects[] = $result; |
|
|
|
$orphaned_objects[] = $result; |
|
|
|
} |
|
|
|
} |
|
|
|
elseif (!in_array($collection, $already_checked)) { |
|
|
|
elseif (!in_array($collection, $already_checked)) { |
|
|
|
$test = islandora_object_load($collection); |
|
|
|
$test = islandora_identify_dead_parents($collection); |
|
|
|
if (!$test) { |
|
|
|
if (!$test) { |
|
|
|
$orphaned_objects[] = $result; |
|
|
|
$orphaned_objects[] = $result; |
|
|
|
$dead_parents[] = $collection; |
|
|
|
$dead_parents[] = $collection; |
|
|
@ -220,6 +220,7 @@ function islandora_get_orphaned_objects() { |
|
|
|
} |
|
|
|
} |
|
|
|
elseif (!in_array($membership, $already_checked)) { |
|
|
|
elseif (!in_array($membership, $already_checked)) { |
|
|
|
$test=islandora_object_load($membership); |
|
|
|
$test=islandora_object_load($membership); |
|
|
|
|
|
|
|
$test = islandora_identify_dead_parents($membership); |
|
|
|
if (!$test) { |
|
|
|
if (!$test) { |
|
|
|
$orphaned_objects[] = $result; |
|
|
|
$orphaned_objects[] = $result; |
|
|
|
$dead_parents[] = $membership; |
|
|
|
$dead_parents[] = $membership; |
|
|
@ -292,6 +293,7 @@ EOQ; |
|
|
|
)); |
|
|
|
)); |
|
|
|
$results = $connection->repository->ri->sparqlQuery($sparql_query_objects); |
|
|
|
$results = $connection->repository->ri->sparqlQuery($sparql_query_objects); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
dd($results); |
|
|
|
return $results; |
|
|
|
return $results; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -320,6 +322,30 @@ function islandora_delete_orphaned_objects_create_batch(array $pids) { |
|
|
|
return $batch; |
|
|
|
return $batch; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* Solr query to check for deceased parents. |
|
|
|
|
|
|
|
* |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
function islandora_identify_dead_parents($parent) { |
|
|
|
|
|
|
|
$parent_params = "PID"; |
|
|
|
|
|
|
|
$parent_test = substr($parent, strpos($parent, '/') +1); |
|
|
|
|
|
|
|
$parent_query = 'PID:"' . $parent_test . '"'; |
|
|
|
|
|
|
|
$qp = new islandoraSolrQueryProcessor(); |
|
|
|
|
|
|
|
$qp->buildQuery($parent_query); |
|
|
|
|
|
|
|
$qp->solrParams['fl'] = $parent_params; |
|
|
|
|
|
|
|
$qp->solrLimit = 1000000000; |
|
|
|
|
|
|
|
$qp->executeQuery(FALSE); |
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
$parent_results = $qp->islandoraSolrResult['response']['objects']; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
catch (Exception $e) { |
|
|
|
|
|
|
|
watchdog_exception('Islandora', $e, 'Got an exception searching for parent objects .', array(), WATCHDOG_ERROR); |
|
|
|
|
|
|
|
$parent_results = array(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return($parent_results); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Constructs and performs the deleting batch operation. |
|
|
|
* Constructs and performs the deleting batch operation. |
|
|
|
* |
|
|
|
* |
|
|
|