Browse Source

added constants, redefined menu path

pull/386/head
Alan Stanley 11 years ago
parent
commit
1228a6da6b
  1. 27
      includes/manage_deleted_objects.inc
  2. 3
      islandora.module

27
includes/manage_deleted_objects.inc

@ -214,23 +214,22 @@ function islandora_delete_form_contentmodels(array $form, array &$form_state) {
* array of pids * array of pids
*/ */
function islandora_get_deleted_objects($content_models) { function islandora_get_deleted_objects($content_models) {
$tuque = islandora_get_tuque_connection();
$repository = $tuque->repository;
$qualifier = ''; $qualifier = '';
$last_content_model = key(array_slice($content_models, -1, 1, TRUE)); $last_content_model = key(array_slice($content_models, -1, 1, TRUE));
foreach ($content_models as $content_model) { foreach ($content_models as $content_model) {
$qualifier .= "\$subject<info:fedora/fedora-system:def/model#hasModel> <info:fedora/$content_model>"; $qualifier .= "\$subject <" . FEDORA_MODEL_URI . "hasModel> <info:fedora/$content_model>";
if ($content_model != $last_content_model) { if ($content_model != $last_content_model) {
$qualifier .= ' or '; $qualifier .= ' or ';
} }
} }
$tuque = new IslandoraTuque();
$repository = $tuque->repository; $query = "select \$subject \$title \$object from <#ri>";
$query = <<<STRING $query .= "where ($qualifier)";
select \$subject \$title \$object from <#ri> $query .= "and \$subject <" . FEDORA_MODEL_URI . "state> <" . FEDORA_MODEL_URI . "Deleted>";
where ($qualifier) $query .= "and \$subject<" . FEDORA_MODEL_URI . "hasModel> \$object ";
and \$subject <info:fedora/fedora-system:def/model#state> <info:fedora/fedora-system:def/model#Deleted> $query .= "and \$subject <dc:title> \$title";
and \$subject<info:fedora/fedora-system:def/model#hasModel> \$object
and \$subject <dc:title> \$title
STRING;
$objects = $repository->ri->itqlQuery($query, 'unlimited'); $objects = $repository->ri->itqlQuery($query, 'unlimited');
$deleted_objects = array(); $deleted_objects = array();
foreach ($objects as $object) { foreach ($objects as $object) {
@ -257,12 +256,10 @@ function islandora_get_contentmodels_with_deleted_members() {
$tuque = new IslandoraTuque(); $tuque = new IslandoraTuque();
$repository = $tuque->repository; $repository = $tuque->repository;
$query = <<<STRING $query = "select \$object from <#ri>";
select \$object from <#ri> $query .= "where \$subject <" . FEDORA_MODEL_URI . "state> <" . FEDORA_MODEL_URI . "Deleted>";
where \$subject <info:fedora/fedora-system:def/model#state> <info:fedora/fedora-system:def/model#Deleted> $query .= "and \$subject<" . FEDORA_MODEL_URI . "hasModel> \$object";
and \$subject<info:fedora/fedora-system:def/model#hasModel> \$object
STRING;
$objects = $repository->ri->itqlQuery($query, 'unlimited'); $objects = $repository->ri->itqlQuery($query, 'unlimited');
$content_models = array(); $content_models = array();
foreach ($objects as $object) { foreach ($objects as $object) {

3
islandora.module

@ -305,7 +305,8 @@ function islandora_menu() {
'access arguments' => array('administer site configuration'), 'access arguments' => array('administer site configuration'),
'type' => MENU_CALLBACK, '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', 'title' => 'Manage Deleted Objects',
'file' => 'includes/manage_deleted_objects.inc', 'file' => 'includes/manage_deleted_objects.inc',
'page callback' => 'drupal_get_form', 'page callback' => 'drupal_get_form',

Loading…
Cancel
Save