From 24cb55c7261b723f4d26de2af2311bb7c373254b Mon Sep 17 00:00:00 2001 From: Alan Stanley Date: Thu, 6 Feb 2014 16:17:23 -0400 Subject: [PATCH 1/2] wrapped command to avoid errors for uninstalled objects --- islandora.drush.inc | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/islandora.drush.inc b/islandora.drush.inc index acf3994f..4013c9a6 100644 --- a/islandora.drush.inc +++ b/islandora.drush.inc @@ -177,23 +177,25 @@ function drush_islandora_solution_pack_install_content_models() { $objects_to_add = array(); foreach ($info['objects'] as $key => $candidate) { $object = islandora_object_load($candidate); - if (in_array('fedora-system:ContentModel-3.0', $object->models)) { + if ($object && in_array('fedora-system:ContentModel-3.0', $object->models)) { $objects_to_add[] = $candidate; } } - foreach ($objects_to_add as $object_to_add) { - $old_object = islandora_object_load($object_to_add->id); - if ($old_object) { - $deleted = islandora_delete_object($old_object); - if (!$deleted) { - drush_log(dt('@object did not delete.', array('@object' => $old_object->id), 'error')); - continue; + if (count($objects_to_add) > 0) { + foreach ($objects_to_add as $object_to_add) { + $old_object = islandora_object_load($object_to_add->id); + if ($old_object) { + $deleted = islandora_delete_object($old_object); + if (!$deleted) { + drush_log(dt('@object did not delete.', array('@object' => $old_object->id), 'error')); + continue; + } + } + $new_object = islandora_add_object($object_to_add); + $verb = $deleted ? dt("Replaced") : dt("Added"); + if ($new_object) { + drush_log("$verb " . $object_to_add->id . " - " . $object_to_add->label); } - } - $new_object = islandora_add_object($object_to_add); - $verb = $deleted ? dt("Replaced") : dt("Added"); - if ($new_object) { - drush_log("$verb " . $object_to_add->id . " - " . $object_to_add->label); } } } From e2d0cf0caded58cbabc953db84fa1895e1aa3ac4 Mon Sep 17 00:00:00 2001 From: Alan Stanley Date: Mon, 10 Feb 2014 15:46:11 -0400 Subject: [PATCH 2/2] fixed how errors are displayed --- includes/utilities.inc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/utilities.inc b/includes/utilities.inc index 0710f8f3..e5d60b95 100644 --- a/includes/utilities.inc +++ b/includes/utilities.inc @@ -528,7 +528,7 @@ function islandora_display_repository_inaccessible_message() { $link = l($text, 'admin/islandora/configure', array('attributes' => array('title' => $text))); $message = t('Could not connect to the repository. Please check the settings on the !link page.', array('!link' => $link)); - drupal_set_message(check_plain($message), 'error', FALSE); + drupal_set_message(filter_xss($message), 'error', FALSE); }