From 1228a6da6b35e06951fd9276696f0bb7b19c4f52 Mon Sep 17 00:00:00 2001 From: Alan Stanley Date: Mon, 19 Aug 2013 15:49:23 -0300 Subject: [PATCH] added constants, redefined menu path --- includes/manage_deleted_objects.inc | 27 ++++++++++++--------------- islandora.module | 3 ++- 2 files changed, 14 insertions(+), 16 deletions(-) diff --git a/includes/manage_deleted_objects.inc b/includes/manage_deleted_objects.inc index 27546f78..b2b5077c 100644 --- a/includes/manage_deleted_objects.inc +++ b/includes/manage_deleted_objects.inc @@ -214,23 +214,22 @@ function islandora_delete_form_contentmodels(array $form, array &$form_state) { * array of pids */ function islandora_get_deleted_objects($content_models) { + $tuque = islandora_get_tuque_connection(); + $repository = $tuque->repository; $qualifier = ''; $last_content_model = key(array_slice($content_models, -1, 1, TRUE)); foreach ($content_models as $content_model) { - $qualifier .= "\$subject "; + $qualifier .= "\$subject <" . FEDORA_MODEL_URI . "hasModel> "; if ($content_model != $last_content_model) { $qualifier .= ' or '; } } - $tuque = new IslandoraTuque(); - $repository = $tuque->repository; - $query = << -where ($qualifier) -and \$subject -and \$subject \$object -and \$subject \$title -STRING; + + $query = "select \$subject \$title \$object from <#ri>"; + $query .= "where ($qualifier)"; + $query .= "and \$subject <" . FEDORA_MODEL_URI . "state> <" . FEDORA_MODEL_URI . "Deleted>"; + $query .= "and \$subject<" . FEDORA_MODEL_URI . "hasModel> \$object "; + $query .= "and \$subject \$title"; $objects = $repository->ri->itqlQuery($query, 'unlimited'); $deleted_objects = array(); foreach ($objects as $object) { @@ -257,12 +256,10 @@ function islandora_get_contentmodels_with_deleted_members() { $tuque = new IslandoraTuque(); $repository = $tuque->repository; - $query = << -where \$subject -and \$subject \$object + $query = "select \$object from <#ri>"; + $query .= "where \$subject <" . FEDORA_MODEL_URI . "state> <" . FEDORA_MODEL_URI . "Deleted>"; + $query .= "and \$subject<" . FEDORA_MODEL_URI . "hasModel> \$object"; -STRING; $objects = $repository->ri->itqlQuery($query, 'unlimited'); $content_models = array(); foreach ($objects as $object) { diff --git a/islandora.module b/islandora.module index b49db9e9..ffdd32a6 100644 --- a/islandora.module +++ b/islandora.module @@ -305,7 +305,8 @@ function islandora_menu() { 'access arguments' => array('administer site configuration'), 'type' => MENU_CALLBACK, ); - $items['restore/islandora'] = array( + $items['admin/islandora/restore'] = array( + 'description' => 'Restore or permanantly remove objects with Deleted status', 'title' => 'Manage Deleted Objects', 'file' => 'includes/manage_deleted_objects.inc', 'page callback' => 'drupal_get_form',