From 56c2afc39c74b3a842cb9f657be419fc3526b73e Mon Sep 17 00:00:00 2001 From: Brandon Weigel Date: Wed, 6 Dec 2017 21:05:51 +0000 Subject: [PATCH 01/85] Add orphaned objects capability to core --- includes/orphaned_objects.inc | 268 ++++++++++++++++++++++++++++++++++ islandora.module | 9 +- 2 files changed, 276 insertions(+), 1 deletion(-) create mode 100644 includes/orphaned_objects.inc diff --git a/includes/orphaned_objects.inc b/includes/orphaned_objects.inc new file mode 100644 index 000000000..e4bd05366 --- /dev/null +++ b/includes/orphaned_objects.inc @@ -0,0 +1,268 @@ + array( + 'title' => t('Manage orphaned objects'), + 'description' => t('View a list of orphaned objects.'), + ), + ); +} + +/** + * Builds the management form for the Orphaned Objects module. + * + * @param array $form + * An array representing a form within Drupal. + * @param array $form_state + * An array containing the Drupal form state. + * + * @return array + * An array containing the form to be rendered. + */ +function islandora_orphaned_objects_manage_form($form, $form_state) { + if (isset($form_state['show_confirm'])) { + $form['confirm_message'] = array( + '#type' => 'item', + '#markup' => format_plural(count($form_state['pids_to_delete']), + 'Are you sure you want to delete the 1 object?', + 'Are you sure you want to delete the @count objects?'), + ); + $form['confirm_submit'] = array( + '#type' => 'submit', + '#value' => t('Confirm'), + '#weight' => 2, + '#submit' => array('islandora_orphaned_objects_manage_confirm_submit'), + ); + $form['cancel_submit'] = array( + '#type' => 'submit', + '#value' => t('Cancel'), + '#weight' => 3, + ); + } + else { + $orphaned_objects = islandora_orphaned_objects_get_orphaned_objects(); + $rows = array(); + foreach ($orphaned_objects as $orphaned_object) { + $pid = $orphaned_object['object']['value']; + if (islandora_namespace_accessible($pid)) { + $rows[$pid] = array(l($orphaned_object['title']['value'] . " (" . $pid . ")", "islandora/object/$pid")); + } + } + ksort($rows); + $form['management_table'] = array( + '#type' => 'tableselect', + '#header' => array(t('Object')), + '#options' => $rows, + '#attributes' => array(), + '#empty' => t('No orphaned objects were found.'), + ); + if (!empty($rows)) { + $form['submit_selected'] = array( + '#type' => 'submit', + '#name' => 'islandora-orphaned-objects-submit-selected', + '#validate' => array('islandora_orphaned_objects_manage_delete_selected_validate'), + '#submit' => array('islandora_orphaned_objects_manage_delete_submit'), + '#value' => t('Delete Selected'), + ); + $form['submit_all'] = array( + '#type' => 'submit', + '#name' => 'islandora-orphaned-objects-submit-all', + '#submit' => array('islandora_orphaned_objects_manage_delete_submit'), + '#value' => t('Delete All'), + ); + } + } + return $form; +} +/** + * Validation for the Islandora Orphaned Objects management form. + * + * @param array $form + * An array representing a form within Drupal. + * @param array $form_state + * An array containing the Drupal form state. + */ +function islandora_orphaned_objects_manage_delete_selected_validate($form, $form_state) { + $selected = array_filter($form_state['values']['management_table']); + if (empty($selected)) { + form_error($form['management_table'], t('At least one object must be selected to delete!')); + } +} +/** + * Submit handler for the delete buttons in the workflow management form. + * + * @param array $form + * An array representing a form within Drupal. + * @param array $form_state + * An array containing the Drupal form state. + */ +function islandora_orphaned_objects_manage_delete_submit(&$form, &$form_state) { + if ($form_state['triggering_element']['#name'] == 'islandora-orphaned-objects-submit-selected') { + $selected = array_keys(array_filter($form_state['values']['management_table'])); + } + else { + $selected = array_keys($form_state['values']['management_table']); + } + $form_state['pids_to_delete'] = $selected; + // Rebuild to show the confirm form. + $form_state['rebuild'] = TRUE; + $form_state['show_confirm'] = TRUE; +} +/** + * Submit handler for the workflow management confirm form. + * + * @param array $form + * An array representing a form within Drupal. + * @param array $form_state + * An array containing the Drupal form state. + */ +function islandora_orphaned_objects_manage_confirm_submit($form, &$form_state) { + $batch = islandora_orphaned_objects_delete_create_batch($form_state['pids_to_delete']); + batch_set($batch); +} + +/** + * Query for orphaned objects. + * + * @return array + * An array containing the results of the orphaned objects queries. + */ +function islandora_orphaned_objects_get_orphaned_objects() { + $connection = islandora_get_tuque_connection(); + // First query: get standard objects. + $object_query = << ; + ?collection . + ?object ?title; + OPTIONAL { + ?collection ?model . + } + FILTER(!bound(?model)) +} +EOQ; + // Second query: get paged objects. + $paged_query = << ; + ?book . + ?object ?title; + OPTIONAL { + ?book ?model . + } + FILTER(!bound(?model)) + } +EOQ; + $optionals = (array) module_invoke('islandora_xacml_api', 'islandora_basic_collection_get_query_optionals', 'view'); + $filter_modules = array( + 'islandora_xacml_api', + 'islandora', + ); + $filters = array(); + foreach ($filter_modules as $module) { + $filters = array_merge_recursive($filters, (array) module_invoke($module, 'islandora_basic_collection_get_query_filters', 'view')); + } + $filter_map = function ($filter) { + return "FILTER($filter)"; + }; + // Use separate queries for different object types. + $sparql_query_objects = format_string($object_query, array( + '!optionals' => !empty($optionals) ? ('OPTIONAL {{' . implode('} UNION {', $optionals) . '}}') : '', + '!filters' => !empty($filters) ? implode(' ', array_map($filter_map, $filters)) : '', + )); + $sparql_query_paged = format_string($paged_query, array( + '!optionals' => !empty($optionals) ? ('OPTIONAL {{' . implode('} UNION {', $optionals) . '}}') : '', + '!filters' => !empty($filters) ? implode(' ', array_map($filter_map, $filters)) : '', + )); + $object_results = $connection->repository->ri->sparqlQuery($sparql_query_objects); + $paged_results = $connection->repository->ri->sparqlQuery($sparql_query_paged); + // Merge results of both queries into a single variable and return. + $results = array_merge($object_results, $paged_results); + return $results; +} + +/** + * Constructs the batch that will go out and delete objects. + * + * @param array $pids + * The array of pids to be deleted. + * + * @return array + * An array detailing the batch that is about to be run. + */ +function islandora_orphaned_objects_delete_create_batch($pids) { + // Set up a batch operation. + $batch = array( + 'operations' => array( + array('islandora_orphaned_objects_delete_batch_operation', array($pids)), + ), + 'title' => t('Deleting the selected objects...'), + 'init_message' => t('Preparing to delete objects.'), + 'progress_message' => t('Time elapsed: @elapsed
Estimated time remaining @estimate.'), + 'error_message' => t('An error has occurred.'), + 'finished' => 'islandora_orphaned_objects_delete_batch_finished', + 'file' => drupal_get_path('module', 'islandora_orphaned_objects') . '/includes/batch.inc', + ); + return $batch; +} +/** + * Constructs and performs the deleting batch operation. + * + * @param array $pids + * An array of pids to be deleted. + * @param array $context + * The context of the Drupal batch. + */ +function islandora_orphaned_objects_delete_batch_operation($pids, &$context) { + if (empty($context['sandbox'])) { + $context['sandbox'] = array(); + $context['sandbox']['progress'] = 0; + $context['sandbox']['pids'] = $pids; + $context['sandbox']['total'] = count($pids); + $context['results']['success'] = array(); + } + if (!empty($context['sandbox']['pids'])) { + $target_pid = array_pop($context['sandbox']['pids']); + $target_object = islandora_object_load($target_pid); + $context['message'] = t('Deleting @label (@pid) (@current of @total)...', array( + '@label' => $target_object->label, + '@pid' => $target_object->pid, + '@current' => $context['sandbox']['progress'], + '@total' => $context['sandbox']['total'], + )); + islandora_delete_object($target_object); + $context['results']['success'][] = $target_pid; + $context['sandbox']['progress']++; + } + $context['finished'] = ($context['sandbox']['total'] == 0) ? 1 : ($context['sandbox']['progress'] / $context['sandbox']['total']); +} +/** + * Finished function for the orphaned objects delete batch. + * + * @param bool $success + * Whether the batch was successful or not. + * @param array $results + * An array containing the results of the batch operations. + * @param array $operations + * The operations array that was used in the batch. + */ +function islandora_orphaned_objects_delete_batch_finished($success, $results, $operations) { + if ($success) { + $message = format_plural(count($results['success']), 'One object deleted.', '@count objects deleted.'); + } + else { + $message = t('Finished with an error.'); + } + drupal_set_message($message); +} diff --git a/islandora.module b/islandora.module index 0efc7cc4f..4be85067f 100644 --- a/islandora.module +++ b/islandora.module @@ -397,7 +397,14 @@ function islandora_menu() { 'type' => MENU_NORMAL_ITEM, 'access arguments' => array(ISLANDORA_MANAGE_DELETED_OBJECTS), ); - + $items['admin/reports/orphaned_objects/list'] = array( + 'title' => 'Orphaned objects', + 'description' => 'List of orphaned objects.', + 'page callback' => 'drupal_get_form', + 'page arguments' => array('islandora_orphaned_objects_manage_form'), + 'access arguments' => array('manage orphaned objects'), + 'file' => 'includes/orphaned_objects.inc', + ); $items['admin/islandora/restore/manage'] = array( 'description' => 'Restore or permanantly remove objects with Deleted status', 'title' => 'Manage Deleted Objects', From 2e17b7d98fce67ab2e48cfbdab1915636258779f Mon Sep 17 00:00:00 2001 From: Brandon Weigel Date: Tue, 12 Dec 2017 14:44:51 +0000 Subject: [PATCH 02/85] Add Islandora to various descriptions and titles --- includes/orphaned_objects.inc | 4 ++-- islandora.module | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/includes/orphaned_objects.inc b/includes/orphaned_objects.inc index e4bd05366..c28162153 100644 --- a/includes/orphaned_objects.inc +++ b/includes/orphaned_objects.inc @@ -11,8 +11,8 @@ function islandora_orphaned_objects_permission() { return array( 'manage orphaned objects' => array( - 'title' => t('Manage orphaned objects'), - 'description' => t('View a list of orphaned objects.'), + 'title' => t('Manage orphaned Islandora objects'), + 'description' => t('View a list of orphaned Islandora objects.'), ), ); } diff --git a/islandora.module b/islandora.module index 4be85067f..89808a9e6 100644 --- a/islandora.module +++ b/islandora.module @@ -398,8 +398,8 @@ function islandora_menu() { 'access arguments' => array(ISLANDORA_MANAGE_DELETED_OBJECTS), ); $items['admin/reports/orphaned_objects/list'] = array( - 'title' => 'Orphaned objects', - 'description' => 'List of orphaned objects.', + 'title' => 'Orphaned Islandora objects', + 'description' => 'List of orphaned Islandora objects.', 'page callback' => 'drupal_get_form', 'page arguments' => array('islandora_orphaned_objects_manage_form'), 'access arguments' => array('manage orphaned objects'), From 962782c5f615648919b8c9370d812ef3fe4a67e1 Mon Sep 17 00:00:00 2001 From: Brandon Weigel Date: Wed, 17 Jan 2018 20:10:20 +0000 Subject: [PATCH 03/85] Simplify and make a single query --- includes/orphaned_objects.inc | 37 +++++++++-------------------------- 1 file changed, 9 insertions(+), 28 deletions(-) diff --git a/includes/orphaned_objects.inc b/includes/orphaned_objects.inc index c28162153..8e598911e 100644 --- a/includes/orphaned_objects.inc +++ b/includes/orphaned_objects.inc @@ -140,29 +140,17 @@ function islandora_orphaned_objects_get_orphaned_objects() { $connection = islandora_get_tuque_connection(); // First query: get standard objects. $object_query = << ; - ?collection . - ?object ?title; - OPTIONAL { - ?collection ?model . - } - FILTER(!bound(?model)) -} -EOQ; - // Second query: get paged objects. - $paged_query = << ; - ?book . - ?object ?title; - OPTIONAL { - ?book ?model . - } + ?p ?otherobject . + ?object ?title; + FILTER( regex( str(?p), "/fedora-system:def/relations-external#")) + OPTIONAL { + ?otherobject ?model . + } FILTER(!bound(?model)) - } +} EOQ; $optionals = (array) module_invoke('islandora_xacml_api', 'islandora_basic_collection_get_query_optionals', 'view'); $filter_modules = array( @@ -181,14 +169,7 @@ EOQ; '!optionals' => !empty($optionals) ? ('OPTIONAL {{' . implode('} UNION {', $optionals) . '}}') : '', '!filters' => !empty($filters) ? implode(' ', array_map($filter_map, $filters)) : '', )); - $sparql_query_paged = format_string($paged_query, array( - '!optionals' => !empty($optionals) ? ('OPTIONAL {{' . implode('} UNION {', $optionals) . '}}') : '', - '!filters' => !empty($filters) ? implode(' ', array_map($filter_map, $filters)) : '', - )); - $object_results = $connection->repository->ri->sparqlQuery($sparql_query_objects); - $paged_results = $connection->repository->ri->sparqlQuery($sparql_query_paged); - // Merge results of both queries into a single variable and return. - $results = array_merge($object_results, $paged_results); + $results = $connection->repository->ri->sparqlQuery($sparql_query_objects); return $results; } From 4dba1b26ca031f2f3df39cf6bbbff68e4600c76a Mon Sep 17 00:00:00 2001 From: Diego Pino Navarro Date: Sat, 3 Feb 2018 12:04:10 -0500 Subject: [PATCH 04/85] ISLANDORA-2153: Allow datastreams with no MIME type restrictions to be replaced with any file type (#1) * Return empty if no restriction set, enforce this on the form --- includes/datastream.version.inc | 8 +++++++- includes/mimetype.utils.inc | 4 ++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/includes/datastream.version.inc b/includes/datastream.version.inc index b79b5a808..ea27cc65c 100644 --- a/includes/datastream.version.inc +++ b/includes/datastream.version.inc @@ -283,7 +283,13 @@ function islandora_datastream_version_replace_form($form, &$form_state, Abstract $form_state['object'] = $object; $extensions = islandora_get_extensions_for_datastream($object, $datastream->id); - $valid_extensions = implode(' ', $extensions); + if (empty($extensions)) { + // In case no extensions are returned, don't limit. + $valid_extensions = NULL; + } + else { + $valid_extensions = implode(' ', $extensions); + } $upload_size = min((int) ini_get('post_max_size'), (int) ini_get('upload_max_filesize')); return array( 'dsid_fieldset' => array( diff --git a/includes/mimetype.utils.inc b/includes/mimetype.utils.inc index 4dfb5b69f..a091ccc6e 100644 --- a/includes/mimetype.utils.inc +++ b/includes/mimetype.utils.inc @@ -76,6 +76,10 @@ function islandora_get_extensions_for_datastream(AbstractObject $object, $dsid) module_load_include('inc', 'islandora', 'includes/utilities'); $datastream_mime_map = islandora_get_datastreams_requirements_from_models($object->models); $mimes = isset($datastream_mime_map[$dsid]) ? $datastream_mime_map[$dsid]['mime'] : array(); + // If no restriction set via DS-COMPOSITE-MODEL return an empty array. + if (empty($mimes)) { + return array(); + } if (isset($object[$dsid])) { $current_mime = $object[$dsid]->mimetype; if (!in_array($current_mime, $mimes)) { From bb19d996171944ba6fb6c7616aeab25cf648d8a3 Mon Sep 17 00:00:00 2001 From: Brandon Weigel Date: Mon, 26 Feb 2018 15:31:17 +0000 Subject: [PATCH 05/85] Amend SPARQL query to exclude objects with any living parent. --- includes/orphaned_objects.inc | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/includes/orphaned_objects.inc b/includes/orphaned_objects.inc index 8e598911e..c41401705 100644 --- a/includes/orphaned_objects.inc +++ b/includes/orphaned_objects.inc @@ -138,20 +138,33 @@ function islandora_orphaned_objects_manage_confirm_submit($form, &$form_state) { */ function islandora_orphaned_objects_get_orphaned_objects() { $connection = islandora_get_tuque_connection(); - // First query: get standard objects. + // SPARQL: get orphaned objects, exclude any with a living parent. $object_query = << +SELECT ?object ?p ?otherobject ?title WHERE { ?object ; ?p ?otherobject . ?object ?title; - FILTER( regex( str(?p), "/fedora-system:def/relations-external#")) - OPTIONAL { - ?otherobject ?model . - } - FILTER(!bound(?model)) + OPTIONAL { + ?otherobject ?model . + } . + FILTER (!bound(?model)) + + # Filter by "parent" relationships - isMemberOf, isMemberOfCollection, isPageOf. + FILTER (?p = || ?p = || ?p = ) + +# Exclude objects with live parents - isMemberOf, isMemberOfCollection, isPageOf. + OPTIONAL { + {?object ?liveparent } + UNION {?object ?liveparent } + UNION { ?object ?liveparent } . + ?liveparent . + } + FILTER (!bound(?liveparent)) } EOQ; + $optionals = (array) module_invoke('islandora_xacml_api', 'islandora_basic_collection_get_query_optionals', 'view'); $filter_modules = array( 'islandora_xacml_api', From 3a25a1fa5e8f3035d4aec7206b46c5385458852d Mon Sep 17 00:00:00 2001 From: Brandon Weigel Date: Mon, 26 Feb 2018 18:16:01 +0000 Subject: [PATCH 06/85] Make permissions work --- includes/orphaned_objects.inc | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/includes/orphaned_objects.inc b/includes/orphaned_objects.inc index c41401705..545fafc1a 100644 --- a/includes/orphaned_objects.inc +++ b/includes/orphaned_objects.inc @@ -5,18 +5,6 @@ * A list of orphaned Islandora objects. */ -/** - * Implements hook_permission(). - */ -function islandora_orphaned_objects_permission() { - return array( - 'manage orphaned objects' => array( - 'title' => t('Manage orphaned Islandora objects'), - 'description' => t('View a list of orphaned Islandora objects.'), - ), - ); -} - /** * Builds the management form for the Orphaned Objects module. * From 5894477687a4cc684e315558ca9d6f4e8b3b4362 Mon Sep 17 00:00:00 2001 From: Brandon Weigel Date: Mon, 26 Feb 2018 18:48:05 +0000 Subject: [PATCH 07/85] XACML OK --- includes/orphaned_objects.inc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/includes/orphaned_objects.inc b/includes/orphaned_objects.inc index 545fafc1a..9eb7b806c 100644 --- a/includes/orphaned_objects.inc +++ b/includes/orphaned_objects.inc @@ -149,8 +149,10 @@ WHERE { UNION { ?object ?liveparent } . ?liveparent . } + !optionals + !filters FILTER (!bound(?liveparent)) -} +} ORDER BY ?object EOQ; $optionals = (array) module_invoke('islandora_xacml_api', 'islandora_basic_collection_get_query_optionals', 'view'); From 92a9096f1250735ebfe6f7c088d367b8aa88acf2 Mon Sep 17 00:00:00 2001 From: Brandon Weigel Date: Mon, 26 Feb 2018 19:01:23 +0000 Subject: [PATCH 08/85] Permissions --- islandora.module | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/islandora.module b/islandora.module index 89808a9e6..0cde906ed 100644 --- a/islandora.module +++ b/islandora.module @@ -631,6 +631,10 @@ function islandora_permission() { 'title' => t('Replace datastreams'), 'description' => t('Add new datastream content as latest version.'), ), + 'manage orphaned objects' => array( + 'title' => t('Manage orphaned Islandora objects'), + 'description' => t('View a list of orphaned Islandora objects.'), + ), ); if (variable_get('islandora_deny_inactive_and_deleted', FALSE)) { $permissions[ISLANDORA_ACCESS_INACTIVE_AND_DELETED_OBJECTS] = array( From ecca2654e58bceaf4d8d3057dab30222ee6368e8 Mon Sep 17 00:00:00 2001 From: Brandon Weigel Date: Mon, 26 Feb 2018 20:05:51 +0000 Subject: [PATCH 09/85] Change query to SELECT DISTINCT, remove ?p ?otherobject --- includes/orphaned_objects.inc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/orphaned_objects.inc b/includes/orphaned_objects.inc index 9eb7b806c..8f61a8a1b 100644 --- a/includes/orphaned_objects.inc +++ b/includes/orphaned_objects.inc @@ -129,7 +129,7 @@ function islandora_orphaned_objects_get_orphaned_objects() { // SPARQL: get orphaned objects, exclude any with a living parent. $object_query = << -SELECT ?object ?p ?otherobject ?title +SELECT DISTINCT ?object ?title WHERE { ?object ; ?p ?otherobject . From bc2918c86365861e1172c3b8b7dfbc1456ea8926 Mon Sep 17 00:00:00 2001 From: Brandon Weigel Date: Tue, 27 Feb 2018 14:27:29 +0000 Subject: [PATCH 10/85] Function names and delete path --- includes/orphaned_objects.inc | 8 ++++---- islandora.module | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/includes/orphaned_objects.inc b/includes/orphaned_objects.inc index 8f61a8a1b..e4a861cdc 100644 --- a/includes/orphaned_objects.inc +++ b/includes/orphaned_objects.inc @@ -6,7 +6,7 @@ */ /** - * Builds the management form for the Orphaned Objects module. + * Builds the Orphaned Islandora Objects management form. * * @param array $form * An array representing a form within Drupal. @@ -37,7 +37,7 @@ function islandora_orphaned_objects_manage_form($form, $form_state) { ); } else { - $orphaned_objects = islandora_orphaned_objects_get_orphaned_objects(); + $orphaned_objects = islandora_get_orphaned_objects(); $rows = array(); foreach ($orphaned_objects as $orphaned_object) { $pid = $orphaned_object['object']['value']; @@ -124,7 +124,7 @@ function islandora_orphaned_objects_manage_confirm_submit($form, &$form_state) { * @return array * An array containing the results of the orphaned objects queries. */ -function islandora_orphaned_objects_get_orphaned_objects() { +function islandora_get_orphaned_objects() { $connection = islandora_get_tuque_connection(); // SPARQL: get orphaned objects, exclude any with a living parent. $object_query = << t('Time elapsed: @elapsed
Estimated time remaining @estimate.'), 'error_message' => t('An error has occurred.'), 'finished' => 'islandora_orphaned_objects_delete_batch_finished', - 'file' => drupal_get_path('module', 'islandora_orphaned_objects') . '/includes/batch.inc', + 'file' => drupal_get_path('module', 'islandora') . '/includes/orphaned_objects.inc', ); return $batch; } diff --git a/islandora.module b/islandora.module index 0cde906ed..ee2cc6b29 100644 --- a/islandora.module +++ b/islandora.module @@ -402,7 +402,7 @@ function islandora_menu() { 'description' => 'List of orphaned Islandora objects.', 'page callback' => 'drupal_get_form', 'page arguments' => array('islandora_orphaned_objects_manage_form'), - 'access arguments' => array('manage orphaned objects'), + 'access arguments' => array('ISLANDORA_MANAGE_ORPHANED_OBJECTS'), 'file' => 'includes/orphaned_objects.inc', ); $items['admin/islandora/restore/manage'] = array( @@ -631,7 +631,7 @@ function islandora_permission() { 'title' => t('Replace datastreams'), 'description' => t('Add new datastream content as latest version.'), ), - 'manage orphaned objects' => array( + 'ISLANDORA_MANAGE_ORPHANED_OBJECTS' => array( 'title' => t('Manage orphaned Islandora objects'), 'description' => t('View a list of orphaned Islandora objects.'), ), From 7b5a601128e297b24964ee5587f13dedbc6791b8 Mon Sep 17 00:00:00 2001 From: Brandon Weigel Date: Tue, 27 Feb 2018 15:04:06 +0000 Subject: [PATCH 11/85] Show list of objects to confirmation page --- includes/orphaned_objects.inc | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/includes/orphaned_objects.inc b/includes/orphaned_objects.inc index e4a861cdc..6ac54115b 100644 --- a/includes/orphaned_objects.inc +++ b/includes/orphaned_objects.inc @@ -18,11 +18,23 @@ */ function islandora_orphaned_objects_manage_form($form, $form_state) { if (isset($form_state['show_confirm'])) { + $pids = $form_state['pids_to_delete']; + if (count($form_state['pids_to_delete']) == 1) { + $pid_paths = '' . $pids[0] . ''; + } + elseif (count($form_state['pids_to_delete']) <= 10) { + $pid_paths = '
    '; + foreach($pids as $pid) { + $pid_paths = $pid_paths . '
  • ' . $pid . '
  • '; + $pid_links[] = '' . $pid . ''; + } + $pid_paths = $pid_paths . '
'; + } $form['confirm_message'] = array( '#type' => 'item', '#markup' => format_plural(count($form_state['pids_to_delete']), - 'Are you sure you want to delete the 1 object?', - 'Are you sure you want to delete the @count objects?'), + 'Are you sure you want to delete the object ' . $pid_paths . '? This action cannot be reversed.', + 'Are you sure you want to delete these @count objects? This action cannot be reversed.' . $pid_paths), ); $form['confirm_submit'] = array( '#type' => 'submit', From 34ff60a0a8880faa0c756e2b712d71f51d7cb0ee Mon Sep 17 00:00:00 2001 From: Brandon Weigel Date: Tue, 27 Feb 2018 15:11:13 +0000 Subject: [PATCH 12/85] Add warning to report page --- includes/orphaned_objects.inc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/includes/orphaned_objects.inc b/includes/orphaned_objects.inc index 6ac54115b..829b48113 100644 --- a/includes/orphaned_objects.inc +++ b/includes/orphaned_objects.inc @@ -49,6 +49,8 @@ function islandora_orphaned_objects_manage_form($form, $form_state) { ); } else { + drupal_set_message(t('Some objects may intentionally have no parents. If deleting objects, please be + absolutely sure that these objects are no longer required.'), 'warning'); $orphaned_objects = islandora_get_orphaned_objects(); $rows = array(); foreach ($orphaned_objects as $orphaned_object) { From 31a5e877389f5c921fce6d1c1ef7d933738dc3f1 Mon Sep 17 00:00:00 2001 From: Brandon Weigel Date: Tue, 27 Feb 2018 15:33:48 +0000 Subject: [PATCH 13/85] Rename functions and define permissions constant --- includes/orphaned_objects.inc | 28 ++++++++++++++-------------- islandora.module | 3 ++- 2 files changed, 16 insertions(+), 15 deletions(-) diff --git a/includes/orphaned_objects.inc b/includes/orphaned_objects.inc index 829b48113..f7100acf5 100644 --- a/includes/orphaned_objects.inc +++ b/includes/orphaned_objects.inc @@ -16,7 +16,7 @@ * @return array * An array containing the form to be rendered. */ -function islandora_orphaned_objects_manage_form($form, $form_state) { +function islandora_manage_orphaned_objects_form($form, $form_state) { if (isset($form_state['show_confirm'])) { $pids = $form_state['pids_to_delete']; if (count($form_state['pids_to_delete']) == 1) { @@ -40,7 +40,7 @@ function islandora_orphaned_objects_manage_form($form, $form_state) { '#type' => 'submit', '#value' => t('Confirm'), '#weight' => 2, - '#submit' => array('islandora_orphaned_objects_manage_confirm_submit'), + '#submit' => array('islandora_manage_orphaned_objects_confirm_submit'), ); $form['cancel_submit'] = array( '#type' => 'submit', @@ -71,14 +71,14 @@ function islandora_orphaned_objects_manage_form($form, $form_state) { $form['submit_selected'] = array( '#type' => 'submit', '#name' => 'islandora-orphaned-objects-submit-selected', - '#validate' => array('islandora_orphaned_objects_manage_delete_selected_validate'), - '#submit' => array('islandora_orphaned_objects_manage_delete_submit'), + '#validate' => array('islandora_delete_selected_orphaned_objects_validate'), + '#submit' => array('islandora_delete_orphaned_objects_submit'), '#value' => t('Delete Selected'), ); $form['submit_all'] = array( '#type' => 'submit', '#name' => 'islandora-orphaned-objects-submit-all', - '#submit' => array('islandora_orphaned_objects_manage_delete_submit'), + '#submit' => array('islandora_delete_orphaned_objects_submit'), '#value' => t('Delete All'), ); } @@ -93,7 +93,7 @@ function islandora_orphaned_objects_manage_form($form, $form_state) { * @param array $form_state * An array containing the Drupal form state. */ -function islandora_orphaned_objects_manage_delete_selected_validate($form, $form_state) { +function islandora_delete_selected_orphaned_objects_validate($form, $form_state) { $selected = array_filter($form_state['values']['management_table']); if (empty($selected)) { form_error($form['management_table'], t('At least one object must be selected to delete!')); @@ -107,7 +107,7 @@ function islandora_orphaned_objects_manage_delete_selected_validate($form, $form * @param array $form_state * An array containing the Drupal form state. */ -function islandora_orphaned_objects_manage_delete_submit(&$form, &$form_state) { +function islandora_delete_orphaned_objects_submit(&$form, &$form_state) { if ($form_state['triggering_element']['#name'] == 'islandora-orphaned-objects-submit-selected') { $selected = array_keys(array_filter($form_state['values']['management_table'])); } @@ -127,8 +127,8 @@ function islandora_orphaned_objects_manage_delete_submit(&$form, &$form_state) { * @param array $form_state * An array containing the Drupal form state. */ -function islandora_orphaned_objects_manage_confirm_submit($form, &$form_state) { - $batch = islandora_orphaned_objects_delete_create_batch($form_state['pids_to_delete']); +function islandora_manage_orphaned_objects_confirm_submit($form, &$form_state) { + $batch = islandora_delete_orphaned_objects_create_batch($form_state['pids_to_delete']); batch_set($batch); } @@ -199,17 +199,17 @@ EOQ; * @return array * An array detailing the batch that is about to be run. */ -function islandora_orphaned_objects_delete_create_batch($pids) { +function islandora_delete_orphaned_objects_create_batch($pids) { // Set up a batch operation. $batch = array( 'operations' => array( - array('islandora_orphaned_objects_delete_batch_operation', array($pids)), + array('islandora_delete_orphaned_objects_batch_operation', array($pids)), ), 'title' => t('Deleting the selected objects...'), 'init_message' => t('Preparing to delete objects.'), 'progress_message' => t('Time elapsed: @elapsed
Estimated time remaining @estimate.'), 'error_message' => t('An error has occurred.'), - 'finished' => 'islandora_orphaned_objects_delete_batch_finished', + 'finished' => 'islandora_delete_orphaned_objects_batch_finished', 'file' => drupal_get_path('module', 'islandora') . '/includes/orphaned_objects.inc', ); return $batch; @@ -222,7 +222,7 @@ function islandora_orphaned_objects_delete_create_batch($pids) { * @param array $context * The context of the Drupal batch. */ -function islandora_orphaned_objects_delete_batch_operation($pids, &$context) { +function islandora_delete_orphaned_objects_batch_operation($pids, &$context) { if (empty($context['sandbox'])) { $context['sandbox'] = array(); $context['sandbox']['progress'] = 0; @@ -255,7 +255,7 @@ function islandora_orphaned_objects_delete_batch_operation($pids, &$context) { * @param array $operations * The operations array that was used in the batch. */ -function islandora_orphaned_objects_delete_batch_finished($success, $results, $operations) { +function islandora_delete_orphaned_objects_batch_finished($success, $results, $operations) { if ($success) { $message = format_plural(count($results['success']), 'One object deleted.', '@count objects deleted.'); } diff --git a/islandora.module b/islandora.module index ee2cc6b29..38d4c4d48 100644 --- a/islandora.module +++ b/islandora.module @@ -39,6 +39,7 @@ define('ISLANDORA_MANAGE_DELETED_OBJECTS', 'manage deleted objects'); define('ISLANDORA_REVERT_DATASTREAM', 'revert to old datastream'); define('ISLANDORA_REGENERATE_DERIVATIVES', 'regenerate derivatives for an object'); define('ISLANDORA_REPLACE_DATASTREAM_CONTENT', 'replace a datastream with new content, preserving version history'); +define('ISLANDORA_MANAGE_ORPHANED_OBJECTS', 'view and delete a list of orphaned objects'); // Hooks. define('ISLANDORA_VIEW_HOOK', 'islandora_view_object'); @@ -401,7 +402,7 @@ function islandora_menu() { 'title' => 'Orphaned Islandora objects', 'description' => 'List of orphaned Islandora objects.', 'page callback' => 'drupal_get_form', - 'page arguments' => array('islandora_orphaned_objects_manage_form'), + 'page arguments' => array('islandora_manage_orphaned_objects_form'), 'access arguments' => array('ISLANDORA_MANAGE_ORPHANED_OBJECTS'), 'file' => 'includes/orphaned_objects.inc', ); From 5ecc9aab0aca7c0ade982d69ea93ebed7fda619e Mon Sep 17 00:00:00 2001 From: Brandon Weigel Date: Tue, 27 Feb 2018 15:37:31 +0000 Subject: [PATCH 14/85] Remove quotes from permissions --- islandora.module | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/islandora.module b/islandora.module index 38d4c4d48..dee7ce79b 100644 --- a/islandora.module +++ b/islandora.module @@ -632,7 +632,7 @@ function islandora_permission() { 'title' => t('Replace datastreams'), 'description' => t('Add new datastream content as latest version.'), ), - 'ISLANDORA_MANAGE_ORPHANED_OBJECTS' => array( + ISLANDORA_MANAGE_ORPHANED_OBJECTS => array( 'title' => t('Manage orphaned Islandora objects'), 'description' => t('View a list of orphaned Islandora objects.'), ), From f62b91e121738666c25d66a38270cfb625f217a8 Mon Sep 17 00:00:00 2001 From: Brandon Weigel Date: Tue, 27 Feb 2018 15:55:46 +0000 Subject: [PATCH 15/85] Coding standards --- includes/orphaned_objects.inc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/includes/orphaned_objects.inc b/includes/orphaned_objects.inc index f7100acf5..fe6b62e3d 100644 --- a/includes/orphaned_objects.inc +++ b/includes/orphaned_objects.inc @@ -21,10 +21,10 @@ function islandora_manage_orphaned_objects_form($form, $form_state) { $pids = $form_state['pids_to_delete']; if (count($form_state['pids_to_delete']) == 1) { $pid_paths = '' . $pids[0] . ''; - } - elseif (count($form_state['pids_to_delete']) <= 10) { + } + elseif (count($form_state['pids_to_delete']) <= 10) { $pid_paths = '
    '; - foreach($pids as $pid) { + foreach ($pids as $pid) { $pid_paths = $pid_paths . '
  • ' . $pid . '
  • '; $pid_links[] = '' . $pid . ''; } From 898c5534f6343b7ed36b26a29559f3e1ba7a0ef4 Mon Sep 17 00:00:00 2001 From: Brandon Weigel Date: Tue, 27 Feb 2018 16:05:48 +0000 Subject: [PATCH 16/85] Coding standards, and remove unneeded variable. --- includes/orphaned_objects.inc | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/includes/orphaned_objects.inc b/includes/orphaned_objects.inc index fe6b62e3d..460fc3c0e 100644 --- a/includes/orphaned_objects.inc +++ b/includes/orphaned_objects.inc @@ -19,22 +19,18 @@ function islandora_manage_orphaned_objects_form($form, $form_state) { if (isset($form_state['show_confirm'])) { $pids = $form_state['pids_to_delete']; - if (count($form_state['pids_to_delete']) == 1) { - $pid_paths = '' . $pids[0] . ''; - } - elseif (count($form_state['pids_to_delete']) <= 10) { + if (count($form_state['pids_to_delete']) <= 10) { $pid_paths = '
      '; foreach ($pids as $pid) { $pid_paths = $pid_paths . '
    • ' . $pid . '
    • '; - $pid_links[] = '' . $pid . ''; } $pid_paths = $pid_paths . '
    '; } $form['confirm_message'] = array( '#type' => 'item', '#markup' => format_plural(count($form_state['pids_to_delete']), - 'Are you sure you want to delete the object ' . $pid_paths . '? This action cannot be reversed.', - 'Are you sure you want to delete these @count objects? This action cannot be reversed.' . $pid_paths), + 'Are you sure you want to delete this object? This action cannot be reversed.', + 'Are you sure you want to delete these @count objects? This action cannot be reversed.') . $pid_paths, ); $form['confirm_submit'] = array( '#type' => 'submit', From d443a7c3e88c3ae5c2b6f8eaec2ff088a15a1ec7 Mon Sep 17 00:00:00 2001 From: Brandon Weigel Date: Mon, 5 Mar 2018 18:28:52 +0000 Subject: [PATCH 17/85] Turn list of pids_to_delete into an array, and correct warning text --- includes/orphaned_objects.inc | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/includes/orphaned_objects.inc b/includes/orphaned_objects.inc index 460fc3c0e..f651f4f21 100644 --- a/includes/orphaned_objects.inc +++ b/includes/orphaned_objects.inc @@ -20,18 +20,28 @@ function islandora_manage_orphaned_objects_form($form, $form_state) { if (isset($form_state['show_confirm'])) { $pids = $form_state['pids_to_delete']; if (count($form_state['pids_to_delete']) <= 10) { - $pid_paths = '
      '; + $pid_paths = array(); foreach ($pids as $pid) { - $pid_paths = $pid_paths . '
    • ' . $pid . '
    • '; + $pid_paths[] = l($pid, '/islandora/object/' . $pid); } - $pid_paths = $pid_paths . '
    '; } $form['confirm_message'] = array( '#type' => 'item', '#markup' => format_plural(count($form_state['pids_to_delete']), 'Are you sure you want to delete this object? This action cannot be reversed.', - 'Are you sure you want to delete these @count objects? This action cannot be reversed.') . $pid_paths, + 'Are you sure you want to delete these @count objects? This action cannot be reversed.'), ); + if (count($pids) <= 10) { + $form['pids_to_delete'] = array( + '#type' => 'markup', + '#theme' => 'item_list', + '#list_type' => 'ol', + ); + $options = array('attributes' => array('target' => '_blank')); + foreach ($pids as $pid) { + $form['pids_to_delete']['#items'][] = l($pid, "/islandora/object/{$pid}", $options); + } + } $form['confirm_submit'] = array( '#type' => 'submit', '#value' => t('Confirm'), @@ -45,8 +55,10 @@ function islandora_manage_orphaned_objects_form($form, $form_state) { ); } else { - drupal_set_message(t('Some objects may intentionally have no parents. If deleting objects, please be - absolutely sure that these objects are no longer required.'), 'warning'); + drupal_set_message(t('This page lists objects that have at least one parent, according to their RELS-EXT, that does not + exist in the Fedora repository. These orphans might exist due to a failed batch ingest, their parents being deleted, + or a variety of other reasons. Some of these orphans may exist intentionally. + Please be cautious when deleting, as this action is irreversible.'), 'warning'); $orphaned_objects = islandora_get_orphaned_objects(); $rows = array(); foreach ($orphaned_objects as $orphaned_object) { @@ -81,6 +93,7 @@ function islandora_manage_orphaned_objects_form($form, $form_state) { } return $form; } + /** * Validation for the Islandora Orphaned Objects management form. * From 3c2cc26ab75d0179a05b6f52715be50bf2f9e2ed Mon Sep 17 00:00:00 2001 From: Brandon Weigel Date: Mon, 5 Mar 2018 18:31:41 +0000 Subject: [PATCH 18/85] Remove unnecessary code --- includes/orphaned_objects.inc | 6 ------ 1 file changed, 6 deletions(-) diff --git a/includes/orphaned_objects.inc b/includes/orphaned_objects.inc index f651f4f21..40964f8b5 100644 --- a/includes/orphaned_objects.inc +++ b/includes/orphaned_objects.inc @@ -19,12 +19,6 @@ function islandora_manage_orphaned_objects_form($form, $form_state) { if (isset($form_state['show_confirm'])) { $pids = $form_state['pids_to_delete']; - if (count($form_state['pids_to_delete']) <= 10) { - $pid_paths = array(); - foreach ($pids as $pid) { - $pid_paths[] = l($pid, '/islandora/object/' . $pid); - } - } $form['confirm_message'] = array( '#type' => 'item', '#markup' => format_plural(count($form_state['pids_to_delete']), From f299fb7486d662d3957bef1ddd9f63e3f00efc1d Mon Sep 17 00:00:00 2001 From: Brandon Weigel Date: Wed, 7 Mar 2018 14:02:19 +0000 Subject: [PATCH 19/85] Remove quotes from access arguments --- islandora.module | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/islandora.module b/islandora.module index dee7ce79b..b5959db68 100644 --- a/islandora.module +++ b/islandora.module @@ -403,7 +403,7 @@ function islandora_menu() { 'description' => 'List of orphaned Islandora objects.', 'page callback' => 'drupal_get_form', 'page arguments' => array('islandora_manage_orphaned_objects_form'), - 'access arguments' => array('ISLANDORA_MANAGE_ORPHANED_OBJECTS'), + 'access arguments' => array(ISLANDORA_MANAGE_ORPHANED_OBJECTS), 'file' => 'includes/orphaned_objects.inc', ); $items['admin/islandora/restore/manage'] = array( From 1f22788b7089df8f1af1e53e093b19e0bfb4f7bf Mon Sep 17 00:00:00 2001 From: Rosemary Le Faive Date: Wed, 7 Mar 2018 18:25:05 -0400 Subject: [PATCH 20/85] ISLANDORA-2073 Don't allow datastreams if object is forbidden. (#698) * ISLANDORA-2073 Don't allow datastreams if object is forbidden. * Move object check to be more explicit for datastreams. --- islandora.module | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/islandora.module b/islandora.module index 0efc7cc4f..924c8d84f 100644 --- a/islandora.module +++ b/islandora.module @@ -1725,11 +1725,6 @@ function islandora_datastream_access($op, $datastream, $user = NULL) { // Populate the cache on a miss. if (!isset($cache[$op][$datastream->parent->id][$datastream->id][$user->uid])) { module_load_include('inc', 'islandora', 'includes/utilities'); - $object_results = islandora_invoke_hook_list('islandora_object_access', $datastream->parent->models, array( - $op, - $datastream->parent, - $user, - )); $datastream_results = islandora_invoke_hook_list('islandora_datastream_access', $datastream->parent->models, array( $op, @@ -1737,11 +1732,9 @@ function islandora_datastream_access($op, $datastream, $user = NULL) { $user, )); - // The datastream check returned FALSE, and one in the object or datastream - // checks returned TRUE. + // The datastream check returned no FALSE, and at least one TRUE. $cache[$op][$datastream->parent->id][$datastream->id][$user->uid] = ( - !in_array(FALSE, $datastream_results, TRUE) && - (in_array(TRUE, $object_results, TRUE) || in_array(TRUE, $datastream_results, TRUE)) + !in_array(FALSE, $datastream_results, TRUE) && in_array(TRUE, $datastream_results, TRUE) ); } @@ -1968,7 +1961,7 @@ function islandora_islandora_metadata_display_info() { */ function islandora_islandora_datastream_access($op, AbstractDatastream $datastream, $user) { module_load_include('inc', 'islandora', 'includes/utilities'); - $result = islandora_namespace_accessible($datastream->parent->id) && user_access($op, $user); + $result = islandora_object_access($op, $datastream->parent, $user); if ($result && $op == ISLANDORA_REGENERATE_DERIVATIVES) { module_load_include('inc', 'islandora', 'includes/derivatives'); From 124b39959f52153ff9dd952bace0fa4e04944c56 Mon Sep 17 00:00:00 2001 From: Jordan Dukart Date: Thu, 8 Mar 2018 14:41:06 -0400 Subject: [PATCH 21/85] Ensure object/ds are accessible before verifying token. (#701) --- islandora.module | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/islandora.module b/islandora.module index 924c8d84f..3349902c0 100644 --- a/islandora.module +++ b/islandora.module @@ -881,13 +881,17 @@ function islandora_object_access_callback($perm, $object = NULL) { function islandora_object_datastream_tokened_access_callback($perm, $object = NULL, $datastream = NULL) { module_load_include('inc', 'islandora', 'includes/utilities'); + // Token validation requires a valid object and PID in order to make a + // potential match in the db. $token_account = NULL; - $token = filter_input(INPUT_GET, 'token', FILTER_SANITIZE_STRING); + if (is_object($object) && is_object($datastream)) { + $token = filter_input(INPUT_GET, 'token', FILTER_SANITIZE_STRING); - if ($token) { - $user = islandora_validate_object_token($object->id, $datastream->id, $token); - if ($user) { - $token_account = user_load($user->uid); + if ($token) { + $user = islandora_validate_object_token($object->id, $datastream->id, $token); + if ($user) { + $token_account = user_load($user->uid); + } } } From deca1766cc30af3b3689013dfc80f1274cf4b547 Mon Sep 17 00:00:00 2001 From: Brandon Weigel Date: Mon, 12 Mar 2018 19:08:00 +0000 Subject: [PATCH 22/85] Fix pid undefined constant --- includes/orphaned_objects.inc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/orphaned_objects.inc b/includes/orphaned_objects.inc index 40964f8b5..1e063ffb4 100644 --- a/includes/orphaned_objects.inc +++ b/includes/orphaned_objects.inc @@ -238,7 +238,7 @@ function islandora_delete_orphaned_objects_batch_operation($pids, &$context) { $target_object = islandora_object_load($target_pid); $context['message'] = t('Deleting @label (@pid) (@current of @total)...', array( '@label' => $target_object->label, - '@pid' => $target_object->pid, + '@pid' => $target_pid, '@current' => $context['sandbox']['progress'], '@total' => $context['sandbox']['total'], )); From 9eb5a0a874792539c2ebbb0b91998d8759a9c523 Mon Sep 17 00:00:00 2001 From: dannylamb Date: Fri, 16 Mar 2018 10:07:25 -0300 Subject: [PATCH 23/85] Removing jenkins and doxygen stuff (#700) * Removing jenkins and doxygen stuff * Replacing ant command with straight bash * Looking for islandora * islandora where art thou? * Consolidating common checks into a single bash script to be called by all the other modules. * Wrapping up the test run call so we only have to change it in one place if we deviate * making 'em executable * Naming typo. Missed a hardcoded islandora path. --- .travis.yml | 8 +- build.xml | 105 -- build/Doxyfile | 1627 ------------------------------- tests/scripts/run_tests.sh | 5 + tests/scripts/travis_scripts.sh | 15 + 5 files changed, 22 insertions(+), 1738 deletions(-) delete mode 100644 build.xml delete mode 100644 build/Doxyfile create mode 100755 tests/scripts/run_tests.sh create mode 100755 tests/scripts/travis_scripts.sh diff --git a/.travis.yml b/.travis.yml index 2c31704e3..7fd668120 100644 --- a/.travis.yml +++ b/.travis.yml @@ -43,13 +43,9 @@ before_install: before_script: # Mysql might time out for long tests, increase the wait timeout. - mysql -e 'SET @@GLOBAL.wait_timeout=1200' - script: - - ant -buildfile sites/all/modules/islandora/build.xml lint - - $ISLANDORA_DIR/tests/scripts/line_endings.sh sites/all/modules/islandora - - drush coder-review --reviews=production,security,style,i18n,potx,sniffer islandora - - phpcpd --names *.module,*.inc,*.test sites/all/modules/islandora - - php scripts/run-tests.sh --php `phpenv which php` --url http://localhost:8081 --verbose "Islandora" + - $ISLANDORA_DIR/tests/scripts/travis_scripts.sh + - $ISLANDORA_DIR/tests/scripts/run_tests.sh "Islandora" after_failure: - $ISLANDORA_DIR/tests/scripts/travis_after_failure.sh notifications: diff --git a/build.xml b/build.xml deleted file mode 100644 index 9c52ceb8f..000000000 --- a/build.xml +++ /dev/null @@ -1,105 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/build/Doxyfile b/build/Doxyfile deleted file mode 100644 index f41dc2858..000000000 --- a/build/Doxyfile +++ /dev/null @@ -1,1627 +0,0 @@ -# Doxyfile 1.7.1 - -# This file describes the settings to be used by the documentation system -# doxygen (www.doxygen.org) for a project -# -# All text after a hash (#) is considered a comment and will be ignored -# The format is: -# TAG = value [value, ...] -# For lists items can also be appended using: -# TAG += value [value, ...] -# Values that contain spaces should be placed between quotes (" ") - -#--------------------------------------------------------------------------- -# Project related configuration options -#--------------------------------------------------------------------------- - -# This tag specifies the encoding used for all characters in the config file -# that follow. The default is UTF-8 which is also the encoding used for all -# text before the first occurrence of this tag. Doxygen uses libiconv (or the -# iconv built into libc) for the transcoding. See -# http://www.gnu.org/software/libiconv for the list of possible encodings. - -DOXYFILE_ENCODING = UTF-8 - -# The PROJECT_NAME tag is a single word (or a sequence of words surrounded -# by quotes) that should identify the project. - -PROJECT_NAME = Islandora 7.x - -# Put the git hash here using sed before generating the documentation. -PROJECT_NUMBER = - -# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) -# base path where the generated documentation will be put. -# If a relative path is entered, it will be relative to the location -# where doxygen was started. If left blank the current directory will be used. - -OUTPUT_DIRECTORY = build/api - -# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create -# 4096 sub-directories (in 2 levels) under the output directory of each output -# format and will distribute the generated files over these directories. -# Enabling this option can be useful when feeding doxygen a huge amount of -# source files, where putting all generated files in the same directory would -# otherwise cause performance problems for the file system. - -CREATE_SUBDIRS = NO - -# The OUTPUT_LANGUAGE tag is used to specify the language in which all -# documentation generated by doxygen is written. Doxygen will use this -# information to generate all constant output in the proper language. -# The default language is English, other supported languages are: -# Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional, -# Croatian, Czech, Danish, Dutch, Esperanto, Farsi, Finnish, French, German, -# Greek, Hungarian, Italian, Japanese, Japanese-en (Japanese with English -# messages), Korean, Korean-en, Lithuanian, Norwegian, Macedonian, Persian, -# Polish, Portuguese, Romanian, Russian, Serbian, Serbian-Cyrilic, Slovak, -# Slovene, Spanish, Swedish, Ukrainian, and Vietnamese. - -OUTPUT_LANGUAGE = English - -# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will -# include brief member descriptions after the members that are listed in -# the file and class documentation (similar to JavaDoc). -# Set to NO to disable this. - -BRIEF_MEMBER_DESC = YES - -# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend -# the brief description of a member or function before the detailed description. -# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the -# brief descriptions will be completely suppressed. - -REPEAT_BRIEF = YES - -# This tag implements a quasi-intelligent brief description abbreviator -# that is used to form the text in various listings. Each string -# in this list, if found as the leading text of the brief description, will be -# stripped from the text and the result after processing the whole list, is -# used as the annotated text. Otherwise, the brief description is used as-is. -# If left blank, the following values are used ("$name" is automatically -# replaced with the name of the entity): "The $name class" "The $name widget" -# "The $name file" "is" "provides" "specifies" "contains" -# "represents" "a" "an" "the" - -ABBREVIATE_BRIEF = - -# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then -# Doxygen will generate a detailed section even if there is only a brief -# description. - -ALWAYS_DETAILED_SEC = NO - -# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all -# inherited members of a class in the documentation of that class as if those -# members were ordinary class members. Constructors, destructors and assignment -# operators of the base classes will not be shown. - -INLINE_INHERITED_MEMB = NO - -# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full -# path before files name in the file list and in the header files. If set -# to NO the shortest path that makes the file name unique will be used. - -FULL_PATH_NAMES = YES - -# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag -# can be used to strip a user-defined part of the path. Stripping is -# only done if one of the specified strings matches the left-hand part of -# the path. The tag can be used to show relative paths in the file list. -# If left blank the directory from which doxygen is run is used as the -# path to strip. - -STRIP_FROM_PATH = - -# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of -# the path mentioned in the documentation of a class, which tells -# the reader which header file to include in order to use a class. -# If left blank only the name of the header file containing the class -# definition is used. Otherwise one should specify the include paths that -# are normally passed to the compiler using the -I flag. - -STRIP_FROM_INC_PATH = - -# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter -# (but less readable) file names. This can be useful is your file systems -# doesn't support long names like on DOS, Mac, or CD-ROM. - -SHORT_NAMES = NO - -# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen -# will interpret the first line (until the first dot) of a JavaDoc-style -# comment as the brief description. If set to NO, the JavaDoc -# comments will behave just like regular Qt-style comments -# (thus requiring an explicit @brief command for a brief description.) - -JAVADOC_AUTOBRIEF = YES - -# If the QT_AUTOBRIEF tag is set to YES then Doxygen will -# interpret the first line (until the first dot) of a Qt-style -# comment as the brief description. If set to NO, the comments -# will behave just like regular Qt-style comments (thus requiring -# an explicit \brief command for a brief description.) - -QT_AUTOBRIEF = NO - -# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen -# treat a multi-line C++ special comment block (i.e. a block of //! or /// -# comments) as a brief description. This used to be the default behaviour. -# The new default is to treat a multi-line C++ comment block as a detailed -# description. Set this tag to YES if you prefer the old behaviour instead. - -MULTILINE_CPP_IS_BRIEF = NO - -# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented -# member inherits the documentation from any documented member that it -# re-implements. - -INHERIT_DOCS = YES - -# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce -# a new page for each member. If set to NO, the documentation of a member will -# be part of the file/class/namespace that contains it. - -SEPARATE_MEMBER_PAGES = NO - -# The TAB_SIZE tag can be used to set the number of spaces in a tab. -# Doxygen uses this value to replace tabs by spaces in code fragments. - -TAB_SIZE = 8 - -# This tag can be used to specify a number of aliases that acts -# as commands in the documentation. An alias has the form "name=value". -# For example adding "sideeffect=\par Side Effects:\n" will allow you to -# put the command \sideeffect (or @sideeffect) in the documentation, which -# will result in a user-defined paragraph with heading "Side Effects:". -# You can put \n's in the value part of an alias to insert newlines. - -ALIASES = - -# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C -# sources only. Doxygen will then generate output that is more tailored for C. -# For instance, some of the names that are used will be different. The list -# of all members will be omitted, etc. - -OPTIMIZE_OUTPUT_FOR_C = NO - -# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java -# sources only. Doxygen will then generate output that is more tailored for -# Java. For instance, namespaces will be presented as packages, qualified -# scopes will look different, etc. - -OPTIMIZE_OUTPUT_JAVA = NO - -# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran -# sources only. Doxygen will then generate output that is more tailored for -# Fortran. - -OPTIMIZE_FOR_FORTRAN = NO - -# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL -# sources. Doxygen will then generate output that is tailored for -# VHDL. - -OPTIMIZE_OUTPUT_VHDL = NO - -# Doxygen selects the parser to use depending on the extension of the files it -# parses. With this tag you can assign which parser to use for a given extension. -# Doxygen has a built-in mapping, but you can override or extend it using this -# tag. The format is ext=language, where ext is a file extension, and language -# is one of the parsers supported by doxygen: IDL, Java, Javascript, CSharp, C, -# C++, D, PHP, Objective-C, Python, Fortran, VHDL, C, C++. For instance to make -# doxygen treat .inc files as Fortran files (default is PHP), and .f files as C -# (default is Fortran), use: inc=Fortran f=C. Note that for custom extensions -# you also need to set FILE_PATTERNS otherwise the files are not read by doxygen. - -EXTENSION_MAPPING = module=php - -# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want -# to include (a tag file for) the STL sources as input, then you should -# set this tag to YES in order to let doxygen match functions declarations and -# definitions whose arguments contain STL classes (e.g. func(std::string); v.s. -# func(std::string) {}). This also make the inheritance and collaboration -# diagrams that involve STL classes more complete and accurate. - -BUILTIN_STL_SUPPORT = NO - -# If you use Microsoft's C++/CLI language, you should set this option to YES to -# enable parsing support. - -CPP_CLI_SUPPORT = NO - -# Set the SIP_SUPPORT tag to YES if your project consists of sip sources only. -# Doxygen will parse them like normal C++ but will assume all classes use public -# instead of private inheritance when no explicit protection keyword is present. - -SIP_SUPPORT = NO - -# For Microsoft's IDL there are propget and propput attributes to indicate getter -# and setter methods for a property. Setting this option to YES (the default) -# will make doxygen to replace the get and set methods by a property in the -# documentation. This will only work if the methods are indeed getting or -# setting a simple type. If this is not the case, or you want to show the -# methods anyway, you should set this option to NO. - -IDL_PROPERTY_SUPPORT = YES - -# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC -# tag is set to YES, then doxygen will reuse the documentation of the first -# member in the group (if any) for the other members of the group. By default -# all members of a group must be documented explicitly. - -DISTRIBUTE_GROUP_DOC = NO - -# Set the SUBGROUPING tag to YES (the default) to allow class member groups of -# the same type (for instance a group of public functions) to be put as a -# subgroup of that type (e.g. under the Public Functions section). Set it to -# NO to prevent subgrouping. Alternatively, this can be done per class using -# the \nosubgrouping command. - -SUBGROUPING = YES - -# When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct, union, or enum -# is documented as struct, union, or enum with the name of the typedef. So -# typedef struct TypeS {} TypeT, will appear in the documentation as a struct -# with name TypeT. When disabled the typedef will appear as a member of a file, -# namespace, or class. And the struct will be named TypeS. This can typically -# be useful for C code in case the coding convention dictates that all compound -# types are typedef'ed and only the typedef is referenced, never the tag name. - -TYPEDEF_HIDES_STRUCT = NO - -# The SYMBOL_CACHE_SIZE determines the size of the internal cache use to -# determine which symbols to keep in memory and which to flush to disk. -# When the cache is full, less often used symbols will be written to disk. -# For small to medium size projects (<1000 input files) the default value is -# probably good enough. For larger projects a too small cache size can cause -# doxygen to be busy swapping symbols to and from disk most of the time -# causing a significant performance penality. -# If the system has enough physical memory increasing the cache will improve the -# performance by keeping more symbols in memory. Note that the value works on -# a logarithmic scale so increasing the size by one will rougly double the -# memory usage. The cache size is given by this formula: -# 2^(16+SYMBOL_CACHE_SIZE). The valid range is 0..9, the default is 0, -# corresponding to a cache size of 2^16 = 65536 symbols - -SYMBOL_CACHE_SIZE = 0 - -#--------------------------------------------------------------------------- -# Build related configuration options -#--------------------------------------------------------------------------- - -# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in -# documentation are documented, even if no documentation was available. -# Private class members and static file members will be hidden unless -# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES - -EXTRACT_ALL = NO - -# If the EXTRACT_PRIVATE tag is set to YES all private members of a class -# will be included in the documentation. - -EXTRACT_PRIVATE = NO - -# If the EXTRACT_STATIC tag is set to YES all static members of a file -# will be included in the documentation. - -EXTRACT_STATIC = YES - -# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) -# defined locally in source files will be included in the documentation. -# If set to NO only classes defined in header files are included. - -EXTRACT_LOCAL_CLASSES = YES - -# This flag is only useful for Objective-C code. When set to YES local -# methods, which are defined in the implementation section but not in -# the interface are included in the documentation. -# If set to NO (the default) only methods in the interface are included. - -EXTRACT_LOCAL_METHODS = NO - -# If this flag is set to YES, the members of anonymous namespaces will be -# extracted and appear in the documentation as a namespace called -# 'anonymous_namespace{file}', where file will be replaced with the base -# name of the file that contains the anonymous namespace. By default -# anonymous namespace are hidden. - -EXTRACT_ANON_NSPACES = NO - -# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all -# undocumented members of documented classes, files or namespaces. -# If set to NO (the default) these members will be included in the -# various overviews, but no documentation section is generated. -# This option has no effect if EXTRACT_ALL is enabled. - -HIDE_UNDOC_MEMBERS = NO - -# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all -# undocumented classes that are normally visible in the class hierarchy. -# If set to NO (the default) these classes will be included in the various -# overviews. This option has no effect if EXTRACT_ALL is enabled. - -HIDE_UNDOC_CLASSES = NO - -# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all -# friend (class|struct|union) declarations. -# If set to NO (the default) these declarations will be included in the -# documentation. - -HIDE_FRIEND_COMPOUNDS = NO - -# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any -# documentation blocks found inside the body of a function. -# If set to NO (the default) these blocks will be appended to the -# function's detailed documentation block. - -HIDE_IN_BODY_DOCS = NO - -# The INTERNAL_DOCS tag determines if documentation -# that is typed after a \internal command is included. If the tag is set -# to NO (the default) then the documentation will be excluded. -# Set it to YES to include the internal documentation. - -INTERNAL_DOCS = NO - -# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate -# file names in lower-case letters. If set to YES upper-case letters are also -# allowed. This is useful if you have classes or files whose names only differ -# in case and if your file system supports case sensitive file names. Windows -# and Mac users are advised to set this option to NO. - -CASE_SENSE_NAMES = YES - -# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen -# will show members with their full class and namespace scopes in the -# documentation. If set to YES the scope will be hidden. - -HIDE_SCOPE_NAMES = NO - -# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen -# will put a list of the files that are included by a file in the documentation -# of that file. - -SHOW_INCLUDE_FILES = YES - -# If the FORCE_LOCAL_INCLUDES tag is set to YES then Doxygen -# will list include files with double quotes in the documentation -# rather than with sharp brackets. - -FORCE_LOCAL_INCLUDES = NO - -# If the INLINE_INFO tag is set to YES (the default) then a tag [inline] -# is inserted in the documentation for inline members. - -INLINE_INFO = YES - -# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen -# will sort the (detailed) documentation of file and class members -# alphabetically by member name. If set to NO the members will appear in -# declaration order. - -SORT_MEMBER_DOCS = YES - -# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the -# brief documentation of file, namespace and class members alphabetically -# by member name. If set to NO (the default) the members will appear in -# declaration order. - -SORT_BRIEF_DOCS = NO - -# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen -# will sort the (brief and detailed) documentation of class members so that -# constructors and destructors are listed first. If set to NO (the default) -# the constructors will appear in the respective orders defined by -# SORT_MEMBER_DOCS and SORT_BRIEF_DOCS. -# This tag will be ignored for brief docs if SORT_BRIEF_DOCS is set to NO -# and ignored for detailed docs if SORT_MEMBER_DOCS is set to NO. - -SORT_MEMBERS_CTORS_1ST = NO - -# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the -# hierarchy of group names into alphabetical order. If set to NO (the default) -# the group names will appear in their defined order. - -SORT_GROUP_NAMES = NO - -# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be -# sorted by fully-qualified names, including namespaces. If set to -# NO (the default), the class list will be sorted only by class name, -# not including the namespace part. -# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. -# Note: This option applies only to the class list, not to the -# alphabetical list. - -SORT_BY_SCOPE_NAME = NO - -# The GENERATE_TODOLIST tag can be used to enable (YES) or -# disable (NO) the todo list. This list is created by putting \todo -# commands in the documentation. - -GENERATE_TODOLIST = YES - -# The GENERATE_TESTLIST tag can be used to enable (YES) or -# disable (NO) the test list. This list is created by putting \test -# commands in the documentation. - -GENERATE_TESTLIST = YES - -# The GENERATE_BUGLIST tag can be used to enable (YES) or -# disable (NO) the bug list. This list is created by putting \bug -# commands in the documentation. - -GENERATE_BUGLIST = YES - -# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or -# disable (NO) the deprecated list. This list is created by putting -# \deprecated commands in the documentation. - -GENERATE_DEPRECATEDLIST= YES - -# The ENABLED_SECTIONS tag can be used to enable conditional -# documentation sections, marked by \if sectionname ... \endif. - -ENABLED_SECTIONS = - -# The MAX_INITIALIZER_LINES tag determines the maximum number of lines -# the initial value of a variable or define consists of for it to appear in -# the documentation. If the initializer consists of more lines than specified -# here it will be hidden. Use a value of 0 to hide initializers completely. -# The appearance of the initializer of individual variables and defines in the -# documentation can be controlled using \showinitializer or \hideinitializer -# command in the documentation regardless of this setting. - -MAX_INITIALIZER_LINES = 30 - -# Set the SHOW_USED_FILES tag to NO to disable the list of files generated -# at the bottom of the documentation of classes and structs. If set to YES the -# list will mention the files that were used to generate the documentation. - -SHOW_USED_FILES = YES - -# If the sources in your project are distributed over multiple directories -# then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy -# in the documentation. The default is NO. - -SHOW_DIRECTORIES = NO - -# Set the SHOW_FILES tag to NO to disable the generation of the Files page. -# This will remove the Files entry from the Quick Index and from the -# Folder Tree View (if specified). The default is YES. - -SHOW_FILES = YES - -# Set the SHOW_NAMESPACES tag to NO to disable the generation of the -# Namespaces page. -# This will remove the Namespaces entry from the Quick Index -# and from the Folder Tree View (if specified). The default is YES. - -SHOW_NAMESPACES = YES - -# The FILE_VERSION_FILTER tag can be used to specify a program or script that -# doxygen should invoke to get the current version for each file (typically from -# the version control system). Doxygen will invoke the program by executing (via -# popen()) the command , where is the value of -# the FILE_VERSION_FILTER tag, and is the name of an input file -# provided by doxygen. Whatever the program writes to standard output -# is used as the file version. See the manual for examples. - -FILE_VERSION_FILTER = - -# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed -# by doxygen. The layout file controls the global structure of the generated -# output files in an output format independent way. The create the layout file -# that represents doxygen's defaults, run doxygen with the -l option. -# You can optionally specify a file name after the option, if omitted -# DoxygenLayout.xml will be used as the name of the layout file. - -LAYOUT_FILE = - -#--------------------------------------------------------------------------- -# configuration options related to warning and progress messages -#--------------------------------------------------------------------------- - -# The QUIET tag can be used to turn on/off the messages that are generated -# by doxygen. Possible values are YES and NO. If left blank NO is used. - -QUIET = NO - -# The WARNINGS tag can be used to turn on/off the warning messages that are -# generated by doxygen. Possible values are YES and NO. If left blank -# NO is used. - -WARNINGS = YES - -# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings -# for undocumented members. If EXTRACT_ALL is set to YES then this flag will -# automatically be disabled. - -WARN_IF_UNDOCUMENTED = YES - -# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for -# potential errors in the documentation, such as not documenting some -# parameters in a documented function, or documenting parameters that -# don't exist or using markup commands wrongly. - -WARN_IF_DOC_ERROR = YES - -# This WARN_NO_PARAMDOC option can be abled to get warnings for -# functions that are documented, but have no documentation for their parameters -# or return value. If set to NO (the default) doxygen will only warn about -# wrong or incomplete parameter documentation, but not about the absence of -# documentation. - -WARN_NO_PARAMDOC = NO - -# The WARN_FORMAT tag determines the format of the warning messages that -# doxygen can produce. The string should contain the $file, $line, and $text -# tags, which will be replaced by the file and line number from which the -# warning originated and the warning text. Optionally the format may contain -# $version, which will be replaced by the version of the file (if it could -# be obtained via FILE_VERSION_FILTER) - -WARN_FORMAT = "$file:$line: $text" - -# The WARN_LOGFILE tag can be used to specify a file to which warning -# and error messages should be written. If left blank the output is written -# to stderr. - -WARN_LOGFILE = - -#--------------------------------------------------------------------------- -# configuration options related to the input files -#--------------------------------------------------------------------------- - -# The INPUT tag can be used to specify the files and/or directories that contain -# documented source files. You may enter file names like "myfile.cpp" or -# directories like "/usr/src/myproject". Separate the files or directories -# with spaces. - -INPUT = - -# This tag can be used to specify the character encoding of the source files -# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is -# also the default input encoding. Doxygen uses libiconv (or the iconv built -# into libc) for the transcoding. See http://www.gnu.org/software/libiconv for -# the list of possible encodings. - -INPUT_ENCODING = UTF-8 - -# If the value of the INPUT tag contains directories, you can use the -# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp -# and *.h) to filter out the source-files in the directories. If left -# blank the following patterns are tested: -# *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx -# *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.py *.f90 - -FILE_PATTERNS = *.module *.inc *.php - -# The RECURSIVE tag can be used to turn specify whether or not subdirectories -# should be searched for input files as well. Possible values are YES and NO. -# If left blank NO is used. - -RECURSIVE = YES - -# The EXCLUDE tag can be used to specify files and/or directories that should -# excluded from the INPUT source files. This way you can easily exclude a -# subdirectory from a directory tree whose root is specified with the INPUT tag. - -EXCLUDE = tests build - -# The EXCLUDE_SYMLINKS tag can be used select whether or not files or -# directories that are symbolic links (a Unix filesystem feature) are excluded -# from the input. - -EXCLUDE_SYMLINKS = NO - -# If the value of the INPUT tag contains directories, you can use the -# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude -# certain files from those directories. Note that the wildcards are matched -# against the file with absolute path, so to exclude all test directories -# for example use the pattern */test/* - -EXCLUDE_PATTERNS = - -# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names -# (namespaces, classes, functions, etc.) that should be excluded from the -# output. The symbol name can be a fully qualified name, a word, or if the -# wildcard * is used, a substring. Examples: ANamespace, AClass, -# AClass::ANamespace, ANamespace::*Test - -EXCLUDE_SYMBOLS = - -# The EXAMPLE_PATH tag can be used to specify one or more files or -# directories that contain example code fragments that are included (see -# the \include command). - -EXAMPLE_PATH = - -# If the value of the EXAMPLE_PATH tag contains directories, you can use the -# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp -# and *.h) to filter out the source-files in the directories. If left -# blank all files are included. - -EXAMPLE_PATTERNS = - -# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be -# searched for input files to be used with the \include or \dontinclude -# commands irrespective of the value of the RECURSIVE tag. -# Possible values are YES and NO. If left blank NO is used. - -EXAMPLE_RECURSIVE = NO - -# The IMAGE_PATH tag can be used to specify one or more files or -# directories that contain image that are included in the documentation (see -# the \image command). - -IMAGE_PATH = - -# The INPUT_FILTER tag can be used to specify a program that doxygen should -# invoke to filter for each input file. Doxygen will invoke the filter program -# by executing (via popen()) the command , where -# is the value of the INPUT_FILTER tag, and is the name of an -# input file. Doxygen will then use the output that the filter program writes -# to standard output. -# If FILTER_PATTERNS is specified, this tag will be -# ignored. - -INPUT_FILTER = - -# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern -# basis. -# Doxygen will compare the file name with each pattern and apply the -# filter if there is a match. -# The filters are a list of the form: -# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further -# info on how filters are used. If FILTER_PATTERNS is empty, INPUT_FILTER -# is applied to all files. - -FILTER_PATTERNS = - -# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using -# INPUT_FILTER) will be used to filter the input files when producing source -# files to browse (i.e. when SOURCE_BROWSER is set to YES). - -FILTER_SOURCE_FILES = NO - -#--------------------------------------------------------------------------- -# configuration options related to source browsing -#--------------------------------------------------------------------------- - -# If the SOURCE_BROWSER tag is set to YES then a list of source files will -# be generated. Documented entities will be cross-referenced with these sources. -# Note: To get rid of all source code in the generated output, make sure also -# VERBATIM_HEADERS is set to NO. - -SOURCE_BROWSER = NO - -# Setting the INLINE_SOURCES tag to YES will include the body -# of functions and classes directly in the documentation. - -INLINE_SOURCES = NO - -# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct -# doxygen to hide any special comment blocks from generated source code -# fragments. Normal C and C++ comments will always remain visible. - -STRIP_CODE_COMMENTS = YES - -# If the REFERENCED_BY_RELATION tag is set to YES -# then for each documented function all documented -# functions referencing it will be listed. - -REFERENCED_BY_RELATION = NO - -# If the REFERENCES_RELATION tag is set to YES -# then for each documented function all documented entities -# called/used by that function will be listed. - -REFERENCES_RELATION = NO - -# If the REFERENCES_LINK_SOURCE tag is set to YES (the default) -# and SOURCE_BROWSER tag is set to YES, then the hyperlinks from -# functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will -# link to the source code. -# Otherwise they will link to the documentation. - -REFERENCES_LINK_SOURCE = YES - -# If the USE_HTAGS tag is set to YES then the references to source code -# will point to the HTML generated by the htags(1) tool instead of doxygen -# built-in source browser. The htags tool is part of GNU's global source -# tagging system (see http://www.gnu.org/software/global/global.html). You -# will need version 4.8.6 or higher. - -USE_HTAGS = NO - -# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen -# will generate a verbatim copy of the header file for each class for -# which an include is specified. Set to NO to disable this. - -VERBATIM_HEADERS = YES - -#--------------------------------------------------------------------------- -# configuration options related to the alphabetical class index -#--------------------------------------------------------------------------- - -# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index -# of all compounds will be generated. Enable this if the project -# contains a lot of classes, structs, unions or interfaces. - -ALPHABETICAL_INDEX = YES - -# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then -# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns -# in which this list will be split (can be a number in the range [1..20]) - -COLS_IN_ALPHA_INDEX = 5 - -# In case all classes in a project start with a common prefix, all -# classes will be put under the same header in the alphabetical index. -# The IGNORE_PREFIX tag can be used to specify one or more prefixes that -# should be ignored while generating the index headers. - -IGNORE_PREFIX = - -#--------------------------------------------------------------------------- -# configuration options related to the HTML output -#--------------------------------------------------------------------------- - -# If the GENERATE_HTML tag is set to YES (the default) Doxygen will -# generate HTML output. - -GENERATE_HTML = YES - -# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `html' will be used as the default path. - -HTML_OUTPUT = html - -# The HTML_FILE_EXTENSION tag can be used to specify the file extension for -# each generated HTML page (for example: .htm,.php,.asp). If it is left blank -# doxygen will generate files with .html extension. - -HTML_FILE_EXTENSION = .html - -# The HTML_HEADER tag can be used to specify a personal HTML header for -# each generated HTML page. If it is left blank doxygen will generate a -# standard header. - -HTML_HEADER = - -# The HTML_FOOTER tag can be used to specify a personal HTML footer for -# each generated HTML page. If it is left blank doxygen will generate a -# standard footer. - -HTML_FOOTER = - -# The HTML_STYLESHEET tag can be used to specify a user-defined cascading -# style sheet that is used by each HTML page. It can be used to -# fine-tune the look of the HTML output. If the tag is left blank doxygen -# will generate a default style sheet. Note that doxygen will try to copy -# the style sheet file to the HTML output directory, so don't put your own -# stylesheet in the HTML output directory as well, or it will be erased! - -HTML_STYLESHEET = - -# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. -# Doxygen will adjust the colors in the stylesheet and background images -# according to this color. Hue is specified as an angle on a colorwheel, -# see http://en.wikipedia.org/wiki/Hue for more information. -# For instance the value 0 represents red, 60 is yellow, 120 is green, -# 180 is cyan, 240 is blue, 300 purple, and 360 is red again. -# The allowed range is 0 to 359. - -HTML_COLORSTYLE_HUE = 220 - -# The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of -# the colors in the HTML output. For a value of 0 the output will use -# grayscales only. A value of 255 will produce the most vivid colors. - -HTML_COLORSTYLE_SAT = 100 - -# The HTML_COLORSTYLE_GAMMA tag controls the gamma correction applied to -# the luminance component of the colors in the HTML output. Values below -# 100 gradually make the output lighter, whereas values above 100 make -# the output darker. The value divided by 100 is the actual gamma applied, -# so 80 represents a gamma of 0.8, The value 220 represents a gamma of 2.2, -# and 100 does not change the gamma. - -HTML_COLORSTYLE_GAMMA = 80 - -# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML -# page will contain the date and time when the page was generated. Setting -# this to NO can help when comparing the output of multiple runs. - -HTML_TIMESTAMP = YES - -# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes, -# files or namespaces will be aligned in HTML using tables. If set to -# NO a bullet list will be used. - -HTML_ALIGN_MEMBERS = YES - -# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML -# documentation will contain sections that can be hidden and shown after the -# page has loaded. For this to work a browser that supports -# JavaScript and DHTML is required (for instance Mozilla 1.0+, Firefox -# Netscape 6.0+, Internet explorer 5.0+, Konqueror, or Safari). - -HTML_DYNAMIC_SECTIONS = NO - -# If the GENERATE_DOCSET tag is set to YES, additional index files -# will be generated that can be used as input for Apple's Xcode 3 -# integrated development environment, introduced with OSX 10.5 (Leopard). -# To create a documentation set, doxygen will generate a Makefile in the -# HTML output directory. Running make will produce the docset in that -# directory and running "make install" will install the docset in -# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find -# it at startup. -# See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html -# for more information. - -GENERATE_DOCSET = NO - -# When GENERATE_DOCSET tag is set to YES, this tag determines the name of the -# feed. A documentation feed provides an umbrella under which multiple -# documentation sets from a single provider (such as a company or product suite) -# can be grouped. - -DOCSET_FEEDNAME = "Doxygen generated docs" - -# When GENERATE_DOCSET tag is set to YES, this tag specifies a string that -# should uniquely identify the documentation set bundle. This should be a -# reverse domain-name style string, e.g. com.mycompany.MyDocSet. Doxygen -# will append .docset to the name. - -DOCSET_BUNDLE_ID = org.doxygen.Project - -# When GENERATE_PUBLISHER_ID tag specifies a string that should uniquely identify -# the documentation publisher. This should be a reverse domain-name style -# string, e.g. com.mycompany.MyDocSet.documentation. - -DOCSET_PUBLISHER_ID = org.doxygen.Publisher - -# The GENERATE_PUBLISHER_NAME tag identifies the documentation publisher. - -DOCSET_PUBLISHER_NAME = Publisher - -# If the GENERATE_HTMLHELP tag is set to YES, additional index files -# will be generated that can be used as input for tools like the -# Microsoft HTML help workshop to generate a compiled HTML help file (.chm) -# of the generated HTML documentation. - -GENERATE_HTMLHELP = NO - -# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can -# be used to specify the file name of the resulting .chm file. You -# can add a path in front of the file if the result should not be -# written to the html output directory. - -CHM_FILE = - -# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can -# be used to specify the location (absolute path including file name) of -# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run -# the HTML help compiler on the generated index.hhp. - -HHC_LOCATION = - -# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag -# controls if a separate .chi index file is generated (YES) or that -# it should be included in the master .chm file (NO). - -GENERATE_CHI = NO - -# If the GENERATE_HTMLHELP tag is set to YES, the CHM_INDEX_ENCODING -# is used to encode HtmlHelp index (hhk), content (hhc) and project file -# content. - -CHM_INDEX_ENCODING = - -# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag -# controls whether a binary table of contents is generated (YES) or a -# normal table of contents (NO) in the .chm file. - -BINARY_TOC = NO - -# The TOC_EXPAND flag can be set to YES to add extra items for group members -# to the contents of the HTML help documentation and to the tree view. - -TOC_EXPAND = NO - -# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and -# QHP_VIRTUAL_FOLDER are set, an additional index file will be generated -# that can be used as input for Qt's qhelpgenerator to generate a -# Qt Compressed Help (.qch) of the generated HTML documentation. - -GENERATE_QHP = NO - -# If the QHG_LOCATION tag is specified, the QCH_FILE tag can -# be used to specify the file name of the resulting .qch file. -# The path specified is relative to the HTML output folder. - -QCH_FILE = - -# The QHP_NAMESPACE tag specifies the namespace to use when generating -# Qt Help Project output. For more information please see -# http://doc.trolltech.com/qthelpproject.html#namespace - -QHP_NAMESPACE = org.doxygen.Project - -# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating -# Qt Help Project output. For more information please see -# http://doc.trolltech.com/qthelpproject.html#virtual-folders - -QHP_VIRTUAL_FOLDER = doc - -# If QHP_CUST_FILTER_NAME is set, it specifies the name of a custom filter to -# add. For more information please see -# http://doc.trolltech.com/qthelpproject.html#custom-filters - -QHP_CUST_FILTER_NAME = - -# The QHP_CUST_FILT_ATTRS tag specifies the list of the attributes of the -# custom filter to add. For more information please see -# -# Qt Help Project / Custom Filters. - -QHP_CUST_FILTER_ATTRS = - -# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this -# project's -# filter section matches. -# -# Qt Help Project / Filter Attributes. - -QHP_SECT_FILTER_ATTRS = - -# If the GENERATE_QHP tag is set to YES, the QHG_LOCATION tag can -# be used to specify the location of Qt's qhelpgenerator. -# If non-empty doxygen will try to run qhelpgenerator on the generated -# .qhp file. - -QHG_LOCATION = - -# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files -# will be generated, which together with the HTML files, form an Eclipse help -# plugin. To install this plugin and make it available under the help contents -# menu in Eclipse, the contents of the directory containing the HTML and XML -# files needs to be copied into the plugins directory of eclipse. The name of -# the directory within the plugins directory should be the same as -# the ECLIPSE_DOC_ID value. After copying Eclipse needs to be restarted before -# the help appears. - -GENERATE_ECLIPSEHELP = NO - -# A unique identifier for the eclipse help plugin. When installing the plugin -# the directory name containing the HTML and XML files should also have -# this name. - -ECLIPSE_DOC_ID = org.doxygen.Project - -# The DISABLE_INDEX tag can be used to turn on/off the condensed index at -# top of each HTML page. The value NO (the default) enables the index and -# the value YES disables it. - -DISABLE_INDEX = NO - -# This tag can be used to set the number of enum values (range [1..20]) -# that doxygen will group on one line in the generated HTML documentation. - -ENUM_VALUES_PER_LINE = 4 - -# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index -# structure should be generated to display hierarchical information. -# If the tag value is set to YES, a side panel will be generated -# containing a tree-like index structure (just like the one that -# is generated for HTML Help). For this to work a browser that supports -# JavaScript, DHTML, CSS and frames is required (i.e. any modern browser). -# Windows users are probably better off using the HTML help feature. - -GENERATE_TREEVIEW = NO - -# By enabling USE_INLINE_TREES, doxygen will generate the Groups, Directories, -# and Class Hierarchy pages using a tree view instead of an ordered list. - -USE_INLINE_TREES = NO - -# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be -# used to set the initial width (in pixels) of the frame in which the tree -# is shown. - -TREEVIEW_WIDTH = 250 - -# When the EXT_LINKS_IN_WINDOW option is set to YES doxygen will open -# links to external symbols imported via tag files in a separate window. - -EXT_LINKS_IN_WINDOW = NO - -# Use this tag to change the font size of Latex formulas included -# as images in the HTML documentation. The default is 10. Note that -# when you change the font size after a successful doxygen run you need -# to manually remove any form_*.png images from the HTML output directory -# to force them to be regenerated. - -FORMULA_FONTSIZE = 10 - -# Use the FORMULA_TRANPARENT tag to determine whether or not the images -# generated for formulas are transparent PNGs. Transparent PNGs are -# not supported properly for IE 6.0, but are supported on all modern browsers. -# Note that when changing this option you need to delete any form_*.png files -# in the HTML output before the changes have effect. - -FORMULA_TRANSPARENT = YES - -# When the SEARCHENGINE tag is enabled doxygen will generate a search box -# for the HTML output. The underlying search engine uses javascript -# and DHTML and should work on any modern browser. Note that when using -# HTML help (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets -# (GENERATE_DOCSET) there is already a search function so this one should -# typically be disabled. For large projects the javascript based search engine -# can be slow, then enabling SERVER_BASED_SEARCH may provide a better solution. - -SEARCHENGINE = YES - -# When the SERVER_BASED_SEARCH tag is enabled the search engine will be -# implemented using a PHP enabled web server instead of at the web client -# using Javascript. Doxygen will generate the search PHP script and index -# file to put on the web server. The advantage of the server -# based approach is that it scales better to large projects and allows -# full text search. The disadvances is that it is more difficult to setup -# and does not have live searching capabilities. - -SERVER_BASED_SEARCH = NO - -#--------------------------------------------------------------------------- -# configuration options related to the LaTeX output -#--------------------------------------------------------------------------- - -# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will -# generate Latex output. - -GENERATE_LATEX = YES - -# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `latex' will be used as the default path. - -LATEX_OUTPUT = latex - -# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be -# invoked. If left blank `latex' will be used as the default command name. -# Note that when enabling USE_PDFLATEX this option is only used for -# generating bitmaps for formulas in the HTML output, but not in the -# Makefile that is written to the output directory. - -LATEX_CMD_NAME = latex - -# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to -# generate index for LaTeX. If left blank `makeindex' will be used as the -# default command name. - -MAKEINDEX_CMD_NAME = makeindex - -# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact -# LaTeX documents. This may be useful for small projects and may help to -# save some trees in general. - -COMPACT_LATEX = NO - -# The PAPER_TYPE tag can be used to set the paper type that is used -# by the printer. Possible values are: a4, a4wide, letter, legal and -# executive. If left blank a4wide will be used. - -PAPER_TYPE = a4wide - -# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX -# packages that should be included in the LaTeX output. - -EXTRA_PACKAGES = - -# The LATEX_HEADER tag can be used to specify a personal LaTeX header for -# the generated latex document. The header should contain everything until -# the first chapter. If it is left blank doxygen will generate a -# standard header. Notice: only use this tag if you know what you are doing! - -LATEX_HEADER = - -# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated -# is prepared for conversion to pdf (using ps2pdf). The pdf file will -# contain links (just like the HTML output) instead of page references -# This makes the output suitable for online browsing using a pdf viewer. - -PDF_HYPERLINKS = YES - -# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of -# plain latex in the generated Makefile. Set this option to YES to get a -# higher quality PDF documentation. - -USE_PDFLATEX = YES - -# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode. -# command to the generated LaTeX files. This will instruct LaTeX to keep -# running if errors occur, instead of asking the user for help. -# This option is also used when generating formulas in HTML. - -LATEX_BATCHMODE = NO - -# If LATEX_HIDE_INDICES is set to YES then doxygen will not -# include the index chapters (such as File Index, Compound Index, etc.) -# in the output. - -LATEX_HIDE_INDICES = NO - -# If LATEX_SOURCE_CODE is set to YES then doxygen will include -# source code with syntax highlighting in the LaTeX output. -# Note that which sources are shown also depends on other settings -# such as SOURCE_BROWSER. - -LATEX_SOURCE_CODE = NO - -#--------------------------------------------------------------------------- -# configuration options related to the RTF output -#--------------------------------------------------------------------------- - -# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output -# The RTF output is optimized for Word 97 and may not look very pretty with -# other RTF readers or editors. - -GENERATE_RTF = NO - -# The RTF_OUTPUT tag is used to specify where the RTF docs will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `rtf' will be used as the default path. - -RTF_OUTPUT = rtf - -# If the COMPACT_RTF tag is set to YES Doxygen generates more compact -# RTF documents. This may be useful for small projects and may help to -# save some trees in general. - -COMPACT_RTF = NO - -# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated -# will contain hyperlink fields. The RTF file will -# contain links (just like the HTML output) instead of page references. -# This makes the output suitable for online browsing using WORD or other -# programs which support those fields. -# Note: wordpad (write) and others do not support links. - -RTF_HYPERLINKS = NO - -# Load stylesheet definitions from file. Syntax is similar to doxygen's -# config file, i.e. a series of assignments. You only have to provide -# replacements, missing definitions are set to their default value. - -RTF_STYLESHEET_FILE = - -# Set optional variables used in the generation of an rtf document. -# Syntax is similar to doxygen's config file. - -RTF_EXTENSIONS_FILE = - -#--------------------------------------------------------------------------- -# configuration options related to the man page output -#--------------------------------------------------------------------------- - -# If the GENERATE_MAN tag is set to YES (the default) Doxygen will -# generate man pages - -GENERATE_MAN = NO - -# The MAN_OUTPUT tag is used to specify where the man pages will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `man' will be used as the default path. - -MAN_OUTPUT = man - -# The MAN_EXTENSION tag determines the extension that is added to -# the generated man pages (default is the subroutine's section .3) - -MAN_EXTENSION = .3 - -# If the MAN_LINKS tag is set to YES and Doxygen generates man output, -# then it will generate one additional man file for each entity -# documented in the real man page(s). These additional files -# only source the real man page, but without them the man command -# would be unable to find the correct page. The default is NO. - -MAN_LINKS = NO - -#--------------------------------------------------------------------------- -# configuration options related to the XML output -#--------------------------------------------------------------------------- - -# If the GENERATE_XML tag is set to YES Doxygen will -# generate an XML file that captures the structure of -# the code including all documentation. - -GENERATE_XML = NO - -# The XML_OUTPUT tag is used to specify where the XML pages will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `xml' will be used as the default path. - -XML_OUTPUT = xml - -# The XML_SCHEMA tag can be used to specify an XML schema, -# which can be used by a validating XML parser to check the -# syntax of the XML files. - -XML_SCHEMA = - -# The XML_DTD tag can be used to specify an XML DTD, -# which can be used by a validating XML parser to check the -# syntax of the XML files. - -XML_DTD = - -# If the XML_PROGRAMLISTING tag is set to YES Doxygen will -# dump the program listings (including syntax highlighting -# and cross-referencing information) to the XML output. Note that -# enabling this will significantly increase the size of the XML output. - -XML_PROGRAMLISTING = YES - -#--------------------------------------------------------------------------- -# configuration options for the AutoGen Definitions output -#--------------------------------------------------------------------------- - -# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will -# generate an AutoGen Definitions (see autogen.sf.net) file -# that captures the structure of the code including all -# documentation. Note that this feature is still experimental -# and incomplete at the moment. - -GENERATE_AUTOGEN_DEF = NO - -#--------------------------------------------------------------------------- -# configuration options related to the Perl module output -#--------------------------------------------------------------------------- - -# If the GENERATE_PERLMOD tag is set to YES Doxygen will -# generate a Perl module file that captures the structure of -# the code including all documentation. Note that this -# feature is still experimental and incomplete at the -# moment. - -GENERATE_PERLMOD = NO - -# If the PERLMOD_LATEX tag is set to YES Doxygen will generate -# the necessary Makefile rules, Perl scripts and LaTeX code to be able -# to generate PDF and DVI output from the Perl module output. - -PERLMOD_LATEX = NO - -# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be -# nicely formatted so it can be parsed by a human reader. -# This is useful -# if you want to understand what is going on. -# On the other hand, if this -# tag is set to NO the size of the Perl module output will be much smaller -# and Perl will parse it just the same. - -PERLMOD_PRETTY = YES - -# The names of the make variables in the generated doxyrules.make file -# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. -# This is useful so different doxyrules.make files included by the same -# Makefile don't overwrite each other's variables. - -PERLMOD_MAKEVAR_PREFIX = - -#--------------------------------------------------------------------------- -# Configuration options related to the preprocessor -#--------------------------------------------------------------------------- - -# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will -# evaluate all C-preprocessor directives found in the sources and include -# files. - -ENABLE_PREPROCESSING = YES - -# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro -# names in the source code. If set to NO (the default) only conditional -# compilation will be performed. Macro expansion can be done in a controlled -# way by setting EXPAND_ONLY_PREDEF to YES. - -MACRO_EXPANSION = NO - -# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES -# then the macro expansion is limited to the macros specified with the -# PREDEFINED and EXPAND_AS_DEFINED tags. - -EXPAND_ONLY_PREDEF = NO - -# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files -# in the INCLUDE_PATH (see below) will be search if a #include is found. - -SEARCH_INCLUDES = YES - -# The INCLUDE_PATH tag can be used to specify one or more directories that -# contain include files that are not input files but should be processed by -# the preprocessor. - -INCLUDE_PATH = - -# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard -# patterns (like *.h and *.hpp) to filter out the header-files in the -# directories. If left blank, the patterns specified with FILE_PATTERNS will -# be used. - -INCLUDE_FILE_PATTERNS = - -# The PREDEFINED tag can be used to specify one or more macro names that -# are defined before the preprocessor is started (similar to the -D option of -# gcc). The argument of the tag is a list of macros of the form: name -# or name=definition (no spaces). If the definition and the = are -# omitted =1 is assumed. To prevent a macro definition from being -# undefined via #undef or recursively expanded use the := operator -# instead of the = operator. - -PREDEFINED = - -# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then -# this tag can be used to specify a list of macro names that should be expanded. -# The macro definition that is found in the sources will be used. -# Use the PREDEFINED tag if you want to use a different macro definition. - -EXPAND_AS_DEFINED = - -# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then -# doxygen's preprocessor will remove all function-like macros that are alone -# on a line, have an all uppercase name, and do not end with a semicolon. Such -# function macros are typically used for boiler-plate code, and will confuse -# the parser if not removed. - -SKIP_FUNCTION_MACROS = YES - -#--------------------------------------------------------------------------- -# Configuration::additions related to external references -#--------------------------------------------------------------------------- - -# The TAGFILES option can be used to specify one or more tagfiles. -# Optionally an initial location of the external documentation -# can be added for each tagfile. The format of a tag file without -# this location is as follows: -# -# TAGFILES = file1 file2 ... -# Adding location for the tag files is done as follows: -# -# TAGFILES = file1=loc1 "file2 = loc2" ... -# where "loc1" and "loc2" can be relative or absolute paths or -# URLs. If a location is present for each tag, the installdox tool -# does not have to be run to correct the links. -# Note that each tag file must have a unique name -# (where the name does NOT include the path) -# If a tag file is not located in the directory in which doxygen -# is run, you must also specify the path to the tagfile here. - -TAGFILES = - -# When a file name is specified after GENERATE_TAGFILE, doxygen will create -# a tag file that is based on the input files it reads. - -GENERATE_TAGFILE = - -# If the ALLEXTERNALS tag is set to YES all external classes will be listed -# in the class index. If set to NO only the inherited external classes -# will be listed. - -ALLEXTERNALS = NO - -# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed -# in the modules index. If set to NO, only the current project's groups will -# be listed. - -EXTERNAL_GROUPS = YES - -# The PERL_PATH should be the absolute path and name of the perl script -# interpreter (i.e. the result of `which perl'). - -PERL_PATH = /usr/bin/perl - -#--------------------------------------------------------------------------- -# Configuration options related to the dot tool -#--------------------------------------------------------------------------- - -# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will -# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base -# or super classes. Setting the tag to NO turns the diagrams off. Note that -# this option is superseded by the HAVE_DOT option below. This is only a -# fallback. It is recommended to install and use dot, since it yields more -# powerful graphs. - -CLASS_DIAGRAMS = YES - -# You can define message sequence charts within doxygen comments using the \msc -# command. Doxygen will then run the mscgen tool (see -# http://www.mcternan.me.uk/mscgen/) to produce the chart and insert it in the -# documentation. The MSCGEN_PATH tag allows you to specify the directory where -# the mscgen tool resides. If left empty the tool is assumed to be found in the -# default search path. - -MSCGEN_PATH = - -# If set to YES, the inheritance and collaboration graphs will hide -# inheritance and usage relations if the target is undocumented -# or is not a class. - -HIDE_UNDOC_RELATIONS = YES - -# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is -# available from the path. This tool is part of Graphviz, a graph visualization -# toolkit from AT&T and Lucent Bell Labs. The other options in this section -# have no effect if this option is set to NO (the default) - -HAVE_DOT = NO - -# The DOT_NUM_THREADS specifies the number of dot invocations doxygen is -# allowed to run in parallel. When set to 0 (the default) doxygen will -# base this on the number of processors available in the system. You can set it -# explicitly to a value larger than 0 to get control over the balance -# between CPU load and processing speed. - -DOT_NUM_THREADS = 0 - -# By default doxygen will write a font called FreeSans.ttf to the output -# directory and reference it in all dot files that doxygen generates. This -# font does not include all possible unicode characters however, so when you need -# these (or just want a differently looking font) you can specify the font name -# using DOT_FONTNAME. You need need to make sure dot is able to find the font, -# which can be done by putting it in a standard location or by setting the -# DOTFONTPATH environment variable or by setting DOT_FONTPATH to the directory -# containing the font. - -DOT_FONTNAME = FreeSans.ttf - -# The DOT_FONTSIZE tag can be used to set the size of the font of dot graphs. -# The default size is 10pt. - -DOT_FONTSIZE = 10 - -# By default doxygen will tell dot to use the output directory to look for the -# FreeSans.ttf font (which doxygen will put there itself). If you specify a -# different font using DOT_FONTNAME you can set the path where dot -# can find it using this tag. - -DOT_FONTPATH = - -# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen -# will generate a graph for each documented class showing the direct and -# indirect inheritance relations. Setting this tag to YES will force the -# the CLASS_DIAGRAMS tag to NO. - -CLASS_GRAPH = YES - -# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen -# will generate a graph for each documented class showing the direct and -# indirect implementation dependencies (inheritance, containment, and -# class references variables) of the class with other documented classes. - -COLLABORATION_GRAPH = YES - -# If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen -# will generate a graph for groups, showing the direct groups dependencies - -GROUP_GRAPHS = YES - -# If the UML_LOOK tag is set to YES doxygen will generate inheritance and -# collaboration diagrams in a style similar to the OMG's Unified Modeling -# Language. - -UML_LOOK = NO - -# If set to YES, the inheritance and collaboration graphs will show the -# relations between templates and their instances. - -TEMPLATE_RELATIONS = NO - -# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT -# tags are set to YES then doxygen will generate a graph for each documented -# file showing the direct and indirect include dependencies of the file with -# other documented files. - -INCLUDE_GRAPH = YES - -# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and -# HAVE_DOT tags are set to YES then doxygen will generate a graph for each -# documented header file showing the documented files that directly or -# indirectly include this file. - -INCLUDED_BY_GRAPH = YES - -# If the CALL_GRAPH and HAVE_DOT options are set to YES then -# doxygen will generate a call dependency graph for every global function -# or class method. Note that enabling this option will significantly increase -# the time of a run. So in most cases it will be better to enable call graphs -# for selected functions only using the \callgraph command. - -CALL_GRAPH = NO - -# If the CALLER_GRAPH and HAVE_DOT tags are set to YES then -# doxygen will generate a caller dependency graph for every global function -# or class method. Note that enabling this option will significantly increase -# the time of a run. So in most cases it will be better to enable caller -# graphs for selected functions only using the \callergraph command. - -CALLER_GRAPH = NO - -# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen -# will graphical hierarchy of all classes instead of a textual one. - -GRAPHICAL_HIERARCHY = YES - -# If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES -# then doxygen will show the dependencies a directory has on other directories -# in a graphical way. The dependency relations are determined by the #include -# relations between the files in the directories. - -DIRECTORY_GRAPH = YES - -# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images -# generated by dot. Possible values are png, jpg, or gif -# If left blank png will be used. - -DOT_IMAGE_FORMAT = png - -# The tag DOT_PATH can be used to specify the path where the dot tool can be -# found. If left blank, it is assumed the dot tool can be found in the path. - -DOT_PATH = - -# The DOTFILE_DIRS tag can be used to specify one or more directories that -# contain dot files that are included in the documentation (see the -# \dotfile command). - -DOTFILE_DIRS = - -# The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of -# nodes that will be shown in the graph. If the number of nodes in a graph -# becomes larger than this value, doxygen will truncate the graph, which is -# visualized by representing a node as a red box. Note that doxygen if the -# number of direct children of the root node in a graph is already larger than -# DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note -# that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH. - -DOT_GRAPH_MAX_NODES = 50 - -# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the -# graphs generated by dot. A depth value of 3 means that only nodes reachable -# from the root by following a path via at most 3 edges will be shown. Nodes -# that lay further from the root node will be omitted. Note that setting this -# option to 1 or 2 may greatly reduce the computation time needed for large -# code bases. Also note that the size of a graph can be further restricted by -# DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction. - -MAX_DOT_GRAPH_DEPTH = 0 - -# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent -# background. This is disabled by default, because dot on Windows does not -# seem to support this out of the box. Warning: Depending on the platform used, -# enabling this option may lead to badly anti-aliased labels on the edges of -# a graph (i.e. they become hard to read). - -DOT_TRANSPARENT = NO - -# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output -# files in one run (i.e. multiple -o and -T options on the command line). This -# makes dot run faster, but since only newer versions of dot (>1.8.10) -# support this, this feature is disabled by default. - -DOT_MULTI_TARGETS = YES - -# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will -# generate a legend page explaining the meaning of the various boxes and -# arrows in the dot generated graphs. - -GENERATE_LEGEND = YES - -# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will -# remove the intermediate dot files that are used to generate -# the various graphs. - -DOT_CLEANUP = YES diff --git a/tests/scripts/run_tests.sh b/tests/scripts/run_tests.sh new file mode 100755 index 000000000..dd8dda79f --- /dev/null +++ b/tests/scripts/run_tests.sh @@ -0,0 +1,5 @@ +#!/bin/bash + +# Wrapper for the test executing function so we only have to change it in one place. +# The module name gets passed in as a command line arg. +php scripts/run-tests.sh --php `phpenv which php` --url http://localhost:8081 --verbose $1 diff --git a/tests/scripts/travis_scripts.sh b/tests/scripts/travis_scripts.sh new file mode 100755 index 000000000..5b6fa4e27 --- /dev/null +++ b/tests/scripts/travis_scripts.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +# Common checks to get run during the 'script' section in Travis. + +# Lint +find $TRAVIS_BUILD_DIR -type f \( -name '*.php' -o -name '*.inc' -o -name '*.module' -o -name '*.install' -o -name '*.test' \) -exec php -l {} \; + +# Check line endings +$ISLANDORA_DIR/tests/scripts/line_endings.sh $TRAVIS_BUILD_DIR + +# Coding standards +drush coder-review --reviews=production,security,style,i18n,potx,sniffer $TRAVIS_BUILD_DIR + +# Copy/paste detection +phpcpd --names *.module,*.inc,*.test $TRAVIS_BUILD_DIR From 62048f599793d36d8507c767eeec31a072b0aa6e Mon Sep 17 00:00:00 2001 From: bencomp Date: Mon, 19 Mar 2018 22:57:41 +0100 Subject: [PATCH 24/85] Update module maintainer in README, use HTTPS for GitHub (#702) Changed maintainer to Diego Pino and changed the scheme in a GitHub URL to HTTPS. --- README.md | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index aca2b8b9d..4895012c3 100644 --- a/README.md +++ b/README.md @@ -43,11 +43,11 @@ The `islandora_drupal_filter` passes the username of 'anonymous' through to Fedo Drupal's cron can be run to remove expired authentication tokens. **Breadcrumb Generation** on the configuration page, allows you to choose the default breadcrumb generation - or a custom method (if implemented). + or a custom method (if implemented). ### Customization -[Customize ingest forms](http://github.com/Islandora/islandora/wiki/Multi-paged-Ingest-Forms) +[Customize ingest forms](https://github.com/Islandora/islandora/wiki/Multi-paged-Ingest-Forms) ## Documentation @@ -55,7 +55,7 @@ Further documentation for this module is available at [our wiki](https://wiki.du ## Troubleshooting/Issues -NOTE: There has been a function signature change for the `ingestDatastream` function within Tuque which will be deprecated after the 7.x-1.10 release. To read about it in detail please see the [JIRA ticket](https://jira.duraspace.org/browse/ISLANDORA-1995). For the time being there is a warning stating that this will become deprecated and that code that utilizes this specific behavior should be updated. Once this code is updated the `islandora_deprecation_return_false_when_datastream_exists` variable may be set to FALSE so the warning no longer displays. An example for doing this with drush: `drush vset islandora_deprecation_return_false_when_datastream_exists FALSE`. +NOTE: There has been a function signature change for the `ingestDatastream` function within Tuque which will be deprecated after the 7.x-1.10 release. To read about it in detail please see the [JIRA ticket](https://jira.duraspace.org/browse/ISLANDORA-1995). For the time being there is a warning stating that this will become deprecated and that code that utilizes this specific behavior should be updated. Once this code is updated the `islandora_deprecation_return_false_when_datastream_exists` variable may be set to FALSE so the warning no longer displays. An example for doing this with drush: `drush vset islandora_deprecation_return_false_when_datastream_exists FALSE`. Having problems or solved a problem? Check out the Islandora google groups for a solution. @@ -66,7 +66,7 @@ Having problems or solved a problem? Check out the Islandora google groups for a Current maintainers: -* [William Panting](https://github.com/willtp87) +* [Diego Pino](https://github.com/DiegoPino) ## Development @@ -75,4 +75,3 @@ If you would like to contribute to this module, please check out [CONTRIBUTING.m ## License [GPLv3](http://www.gnu.org/licenses/gpl-3.0.txt) - From 482c9e6999e1eabf0e01d67cbf59305089d9bc21 Mon Sep 17 00:00:00 2001 From: Brandon Weigel Date: Tue, 20 Mar 2018 18:45:11 +0000 Subject: [PATCH 25/85] Add error message for delete failure --- includes/orphaned_objects.inc | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/includes/orphaned_objects.inc b/includes/orphaned_objects.inc index 1e063ffb4..502177f9f 100644 --- a/includes/orphaned_objects.inc +++ b/includes/orphaned_objects.inc @@ -243,7 +243,13 @@ function islandora_delete_orphaned_objects_batch_operation($pids, &$context) { '@total' => $context['sandbox']['total'], )); islandora_delete_object($target_object); - $context['results']['success'][] = $target_pid; + $object_check = islandora_object_load($target_pid); + if ($object_check) { + drupal_set_message(t('Could not delete ' . $target_pid . '. You may not have permission to manage this object.'), 'error'); + } + else { + $context['results']['success'][] = $target_pid; + } $context['sandbox']['progress']++; } $context['finished'] = ($context['sandbox']['total'] == 0) ? 1 : ($context['sandbox']['progress'] / $context['sandbox']['total']); From dfaa6ed1825113c81e696385f8e871f227916793 Mon Sep 17 00:00:00 2001 From: Jared Whiklo Date: Fri, 23 Mar 2018 09:15:40 -0500 Subject: [PATCH 26/85] Respect namespace restrictions in manage deleted objects. --- .travis.yml | 2 +- includes/manage_deleted_objects.inc | 72 +++++++++++++++++++++++------ includes/orphaned_objects.inc | 5 +- 3 files changed, 63 insertions(+), 16 deletions(-) diff --git a/.travis.yml b/.travis.yml index 7fd668120..6b9fa84bf 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,7 +4,7 @@ language: php matrix: include: - #5.3.3 Ubuntu Precise exceptions + #5.3.3 Ubuntu Precise exceptions - php: 5.3.3 dist: precise env: FEDORA_VERSION="3.5" diff --git a/includes/manage_deleted_objects.inc b/includes/manage_deleted_objects.inc index a6b5e96e1..885f3885a 100644 --- a/includes/manage_deleted_objects.inc +++ b/includes/manage_deleted_objects.inc @@ -12,11 +12,13 @@ * The Drupal form definition. * @param array $form_state * The Drupal form state. + * @param string $serialized_chosen + * A serialized array of chosen content models. * * @return array * The Drupal form definition. */ -function islandora_deleted_objects_prep_form($form, $form_state, $serialized_chosen = NULL) { +function islandora_deleted_objects_prep_form(array $form, array $form_state, $serialized_chosen = NULL) { module_load_include('inc', 'islandora', 'includes/utilities'); $chosen_contentmodels = array(); if ($serialized_chosen) { @@ -67,9 +69,9 @@ function islandora_deleted_objects_prep_form($form, $form_state, $serialized_cho * @param array $form_state * The form state. */ -function islandora_deleted_objects_prep_form_submit($form, $form_state) { +function islandora_deleted_objects_prep_form_submit(array $form, array $form_state) { $content_models = $form_state['values']['contentmodels']; - $chosen = function($element) { + $chosen = function ($element) { return $element; }; $serialized_contentmodels = serialize(array_filter($content_models, $chosen)); @@ -83,11 +85,13 @@ function islandora_deleted_objects_prep_form_submit($form, $form_state) { * The Drupal form definition. * @param array $form_state * The Drupal form state. + * @param string $serialized_chosen + * A serialized array of chosen content models. * * @return array * The Drupal form definition. */ -function islandora_deleted_objects_manage_form($form, $form_state, $serialized_chosen = NULL) { +function islandora_deleted_objects_manage_form(array $form, array $form_state, $serialized_chosen = NULL) { $form['previous'] = array( '#type' => 'submit', '#value' => t('Previous'), @@ -186,7 +190,7 @@ function islandora_deleted_objects_manage_form($form, $form_state, $serialized_c * @param array $form_state * The form state. */ -function islandora_deleted_objects_manage_form_submit($form, $form_state) { +function islandora_deleted_objects_manage_form_submit(array $form, array $form_state) { module_load_include('inc', 'islandora', 'includes/utilities'); $serialized_chosen = isset($form_state['values']['serialized_chosen']) ? $form_state['values']['serialized_chosen'] : NULL; @@ -202,6 +206,7 @@ function islandora_deleted_objects_manage_form_submit($form, $form_state) { $action = 'islandora_purge_object_by_pid'; } $objects_to_process = array_filter($form_state['values']['objects_to_process']); + $pids_to_restore = $objects_to_process; if ($form_state['values']['propogate']) { foreach ($objects_to_process as $pid) { @@ -231,10 +236,17 @@ function islandora_deleted_objects_manage_form_submit($form, $form_state) { /** * Gets PIDS of all deleted objects. * + * @param array $content_models + * Get deleted object with one of these content models. + * @param int $limit + * Max to get at one time. + * @param int $offset + * Where to start for paging. + * * @return array * PIDS of deleted objects */ -function islandora_get_deleted_objects($content_models, $limit, $offset) { +function islandora_get_deleted_objects(array $content_models, $limit, $offset) { $tuque = islandora_get_tuque_connection(); $repository = $tuque->repository; $query = islandora_get_deleted_query($content_models, $offset); @@ -246,7 +258,8 @@ function islandora_get_deleted_objects($content_models, $limit, $offset) { $cm_pid = $object['object']['value']; $title = $object['label']['value']; $deleted_objects[$pid] = array( - 'title' => $title, 'pid' => $pid, + 'title' => $title, + 'pid' => $pid, 'content_model' => $content_models[$cm_pid], ); } @@ -258,16 +271,18 @@ function islandora_get_deleted_objects($content_models, $limit, $offset) { * Gets PIDS of all content models associated with deleted objects. * * @return array - * array of content model pids + * array of content model pids. */ function islandora_get_contentmodels_with_deleted_members() { $tuque = new IslandoraTuque(); $repository = $tuque->repository; + $filter = _islandora_get_manage_deleted_query_filter(); $query = "PREFIX fm: SELECT DISTINCT ?object ?label FROM <#ri> WHERE { {?subject fm:state fm:Deleted; fm:hasModel ?object; + $filter } OPTIONAL{ ?object fm:label ?label @@ -288,7 +303,7 @@ function islandora_get_contentmodels_with_deleted_members() { * Restores deleted object. * * @param string $pid - * PID of object to be restored + * PID of object to be restored. */ function islandora_restore_object_by_pid($pid) { $fedora_object = islandora_object_load($pid); @@ -299,7 +314,7 @@ function islandora_restore_object_by_pid($pid) { * Purges deleted object. * * @param string $pid - * PID of object to be restored + * PID of object to be restored. */ function islandora_purge_object_by_pid($pid) { $fedora_object = islandora_object_load($pid); @@ -310,14 +325,14 @@ function islandora_purge_object_by_pid($pid) { * Get query to find all deleted objects by content type. * * @param array $content_models - * Content models to restrict search + * Content models to restrict search. * @param int $offset - * offset to be added to search + * Offset to be added to search. * * @return string * Sparql query */ -function islandora_get_deleted_query($content_models, $offset = 0) { +function islandora_get_deleted_query(array $content_models, $offset = 0) { $candidates = array_keys($content_models); $first_contentmodel = array_shift($candidates); $prefix = "PREFIX fm: <" . FEDORA_MODEL_URI . "> "; @@ -336,5 +351,34 @@ function islandora_get_deleted_query($content_models, $offset = 0) { "; } $optional = "OPTIONAL{?subject fm:label ?label}"; - return "$prefix $select $where_clause $unions $optional $suffix"; + $filter = _islandora_get_manage_deleted_query_filter(); + return "$prefix $select $where_clause $unions $optional $filter $suffix"; +} + +/** + * Reuse namespace restriction filters for basic collection. + * + * This reuses the hook implementation function to make a local + * namespace filter for managing deleted objects. + * + * @return string + * The Sparql filter statement. + */ +function _islandora_get_manage_deleted_query_filter() { + // Reusing the basic collection query filter. + $filter_modules = array( + 'islandora_xacml_api', + 'islandora', + ); + $filters = array(); + foreach ($filter_modules as $module) { + $filters = array_merge_recursive($filters, (array) module_invoke($module, 'islandora_basic_collection_get_query_filters', 'view')); + } + $filter_map = function ($filter) { + return "FILTER($filter)"; + }; + $filter = implode(' ', array_map($filter_map, $filters)); + // Hook filters ?object we need to filter ?subject. + $filter = str_replace('?object', '?subject', $filter); + return $filter; } diff --git a/includes/orphaned_objects.inc b/includes/orphaned_objects.inc index 502177f9f..606a988d7 100644 --- a/includes/orphaned_objects.inc +++ b/includes/orphaned_objects.inc @@ -245,7 +245,10 @@ function islandora_delete_orphaned_objects_batch_operation($pids, &$context) { islandora_delete_object($target_object); $object_check = islandora_object_load($target_pid); if ($object_check) { - drupal_set_message(t('Could not delete ' . $target_pid . '. You may not have permission to manage this object.'), 'error'); + drupal_set_message(t('Could not delete %pid. You may not have permission to manage this object.', + array( + '%pid' => $target_pid, + )), 'error'); } else { $context['results']['success'][] = $target_pid; From 42fa70c3036a42400be626a38b2eec94b19de1e8 Mon Sep 17 00:00:00 2001 From: Jonathan Green Date: Wed, 11 Apr 2018 11:37:29 -0300 Subject: [PATCH 27/85] Prevent Warning Error: Call to a member function getTimestamp() on boolean in islandora_view_datastream_cache_check() --- includes/datastream.inc | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/includes/datastream.inc b/includes/datastream.inc index e7547780e..ee0f8cc7d 100644 --- a/includes/datastream.inc +++ b/includes/datastream.inc @@ -161,12 +161,14 @@ function islandora_view_datastream_cache_check(AbstractDatastream $datastream) { if (isset($_SERVER['HTTP_IF_MODIFIED_SINCE'])) { $modified_since = DateTime::createFromFormat('D, d M Y H:i:s e', $_SERVER['HTTP_IF_MODIFIED_SINCE']); - if ($datastream->createdDate->getTimestamp() - $modified_since->getTimestamp() > 0) { - // Changed! - return $return; - } - else { - $return = 304; + if ($modified_since !== FALSE) { + if ($datastream->createdDate->getTimestamp() - $modified_since->getTimestamp() > 0) { + // Changed! + return $return; + } + else { + $return = 304; + } } } if ($return === 200 && isset($_SERVER['HTTP_IF_UNMODIFIED_SINCE'])) { From 7d9cdc220b85f91d80a02db626046a488c1acde4 Mon Sep 17 00:00:00 2001 From: Jonathan Green Date: Fri, 13 Apr 2018 15:19:51 -0300 Subject: [PATCH 28/85] Code review feedback Return the current value of $return if we have a bad value. --- includes/datastream.inc | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/includes/datastream.inc b/includes/datastream.inc index ee0f8cc7d..8584e53e7 100644 --- a/includes/datastream.inc +++ b/includes/datastream.inc @@ -161,7 +161,10 @@ function islandora_view_datastream_cache_check(AbstractDatastream $datastream) { if (isset($_SERVER['HTTP_IF_MODIFIED_SINCE'])) { $modified_since = DateTime::createFromFormat('D, d M Y H:i:s e', $_SERVER['HTTP_IF_MODIFIED_SINCE']); - if ($modified_since !== FALSE) { + if ($modified_since === FALSE) { + return $return; + } + else { if ($datastream->createdDate->getTimestamp() - $modified_since->getTimestamp() > 0) { // Changed! return $return; @@ -173,12 +176,17 @@ function islandora_view_datastream_cache_check(AbstractDatastream $datastream) { } if ($return === 200 && isset($_SERVER['HTTP_IF_UNMODIFIED_SINCE'])) { $unmodified_since = DateTime::createFromFormat('D, d M Y H:i:s e', $_SERVER['HTTP_IF_UNMODIFIED_SINCE']); - if ($datastream->createdDate->getTimestamp() !== $unmodified_since->getTimestamp()) { - // Changed! - $return = 412; + if ($unmodified_since === FALSE) { + return $return; } else { - return $return; + if ($datastream->createdDate->getTimestamp() !== $unmodified_since->getTimestamp()) { + // Changed! + $return = 412; + } + else { + return $return; + } } } From d05707fec4c9de3a3d23292cc0ac84bb9b57e3ef Mon Sep 17 00:00:00 2001 From: Rosie Le Faive Date: Mon, 21 May 2018 15:21:29 -0300 Subject: [PATCH 29/85] Documentation of new permission and add screenshot to README. --- README.md | 36 +++++++++++++++++++++++++----------- includes/admin.form.inc | 2 +- 2 files changed, 26 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 4895012c3..562f32d1f 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ ## Introduction -Islandora Fedora Repository Module +This module includes the core functionality for interacting with Fedora Repository objects through the Drupal interface. For installation and customization instructions please see the [documentation and the DuraSpace Wiki](https://wiki.duraspace.org/display/ISLANDORA/Islandora). @@ -24,34 +24,48 @@ More detailed requirements are outlined in the [Installing the Islandora Essenti ### Optional Requirements -If you want to support languages other than English download and enable [String Translation](https://drupal.org/project/i18n), and follow our [guide](https://github.com/Islandora/islandora/wiki/Multilingual-Support) for setting up additional languges. +If you want to support languages other than English, download and enable [String Translation](https://drupal.org/project/i18n), and follow our [guide](https://github.com/Islandora/islandora/wiki/Multilingual-Support) for setting up additional languages. ## Installation -Before installing Islandora the XACML policies located [here](https://github.com/Islandora/islandora-xacml-policies) should be copied into the Fedora global XACML policies folder. This will allow "authenticated users" in Drupal to access Fedora API-M functions. It is to be noted that the `permit-upload-to-anonymous-user.xml` and `permit-apim-to-anonymous-user.xml` files do not need to be present unless requirements for anonymous ingesting are present. +This is one Drupal module in a suite of modules (and stack of related software) which are required for Islandora to function correctly. For full installation instructions please see the [documentation in the DuraSpace Wiki](https://wiki.duraspace.org/display/ISLANDORA/Islandora). -You will also have to remove some default policies if you want full functionality as well. +### Global Fedora XACML policies +Before installing Islandora, the XACML policies located [here](https://github.com/Islandora/islandora-xacml-policies) should be copied into the Fedora global XACML policies folder. This will allow "authenticated users" in Drupal to access Fedora API-M functions (create, edit, and delete objects in Fedora). -Remove `deny-purge-datastream-if-active-or-inactive.xml` to allow for purging of datastream versions. +Notes: +* The `permit-upload-to-anonymous-user.xml` and `permit-apim-to-anonymous-user.xml` policies allow anonymous (unauthenticated) +users to create objects and datastreams. They do not need to be present if this is not required. +* The policy `deny-purge-datastream-if-active-or-inactive.xml` must be deleted to allow users to purge (permanently remove) datastream versions. More detailed information can be found in the 'Set XACML Policies' in the [Installing Fedora](https://wiki.duraspace.org/display/ISLANDORA/milestone+1+-+Installing+Fedora) chapter of the documentation. +### Protecting the 'anonymous' username +The `islandora_drupal_filter` passes the username of 'anonymous' through to Fedora for unauthenticated Drupal Users. A user with the name of 'anonymous' may have XACML policies applied to them that are meant to be applied to Drupal users that are not logged in or vice-versa. This is a potential security issue that can be plugged by creating a user named 'anonymous' and restricting access to the account. If this is done after installing Islandora, Drupal's cron can be run to remove expired authentication tokens. + + ## Configuration -The `islandora_drupal_filter` passes the username of 'anonymous' through to Fedora for unauthenticated Drupal Users. A user with the name of 'anonymous' may have XACML policies applied to them that are meant to be applied to Drupal users that are not logged in or vice-versa. This is a potential security issue that can be plugged by creating a user named 'anonymous' and restricting access to the account. +Configuration that applies to all solution packs, including the location of the Fedora Repository, the namespaces accessible by this instance of Islandora, and whether to generate derivatives on ingest, are available at `admin/islandora/configure`. + +![Configuration](https://user-images.githubusercontent.com/1943338/40320855-724afcba-5d03-11e8-9109-0b8413349839.png) -Drupal's cron can be run to remove expired authentication tokens. +### Breadcrumb Generation -**Breadcrumb Generation** on the configuration page, allows you to choose the default breadcrumb generation - or a custom method (if implemented). +Whether Drupal breadcrumbs (showing an object's parent hierarchy) should be displayed, and how they are generated, can be set on the configuration page. Other modules (such as [Islandora Solr](https://github.com/Islandora/islandora_solr_search)) may provide alternatives that perform better at large scales than the built-in Resource Index query. + +### Inactive and Deleted Objects + +By default, objects with the [Fedora state](https://wiki.duraspace.org/display/FEDORA38/Fedora+Digital+Object+Model) of "Inactive" or "Deleted" are accessible to all users with the Drupal permission "View repository objects". It is possible to use a separate permission to control access to these non-"Active" objects, but this permission must first be enabled at `admin/islandora/configure`, then the permssion can be granted to desired roles at `admin/people/permissions`. ### Customization -[Customize ingest forms](https://github.com/Islandora/islandora/wiki/Multi-paged-Ingest-Forms) +Hooks provided by Islandora are documented in `islandora.api.php`. A [detailed tutorial](https://github.com/Islandora/islandora/wiki/Multi-paged-Ingest-Forms) on extending the multi-page ingest forms is available on the Github (developers') Wiki. + ## Documentation -Further documentation for this module is available at [our wiki](https://wiki.duraspace.org/display/ISLANDORA/Islandora+Core+Module). +Further documentation for this module is available at [our documentation wiki](https://wiki.duraspace.org/display/ISLANDORA/Islandora+Core+Module). ## Troubleshooting/Issues diff --git a/includes/admin.form.inc b/includes/admin.form.inc index 4259c9569..37bc9aa86 100644 --- a/includes/admin.form.inc +++ b/includes/admin.form.inc @@ -141,7 +141,7 @@ function islandora_repository_admin(array $form, array &$form_state) { 'islandora_deny_inactive_and_deleted' => array( '#type' => 'checkbox', '#title' => t('Lock down inactive and deleted objects.'), - '#description' => t('Deny access to inactive or deleted objects using a separate permission than for active objects.'), + '#description' => t('Require a separate permission to access inactive and deleted objects.'), '#default_value' => variable_get('islandora_deny_inactive_and_deleted', FALSE), ), ), From 3144ada36aa38655edc3b00b1181b48635575e62 Mon Sep 17 00:00:00 2001 From: Rosemary Le Faive Date: Sat, 26 May 2018 21:43:23 -0300 Subject: [PATCH 30/85] Update README.md for style. --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 562f32d1f..196c5d66f 100644 --- a/README.md +++ b/README.md @@ -34,9 +34,8 @@ This is one Drupal module in a suite of modules (and stack of related software) Before installing Islandora, the XACML policies located [here](https://github.com/Islandora/islandora-xacml-policies) should be copied into the Fedora global XACML policies folder. This will allow "authenticated users" in Drupal to access Fedora API-M functions (create, edit, and delete objects in Fedora). Notes: -* The `permit-upload-to-anonymous-user.xml` and `permit-apim-to-anonymous-user.xml` policies allow anonymous (unauthenticated) -users to create objects and datastreams. They do not need to be present if this is not required. -* The policy `deny-purge-datastream-if-active-or-inactive.xml` must be deleted to allow users to purge (permanently remove) datastream versions. +* Delete the `permit-upload-to-anonymous-user.xml` and `permit-apim-to-anonymous-user.xml` policies unless you want to allow anonymous (unauthenticated) users to create Islandora objects (not recommended). +* Delete the `deny-purge-datastream-if-active-or-inactive.xml` to allow users to purge (permanently remove) datastream versions. More detailed information can be found in the 'Set XACML Policies' in the [Installing Fedora](https://wiki.duraspace.org/display/ISLANDORA/milestone+1+-+Installing+Fedora) chapter of the documentation. @@ -60,7 +59,8 @@ By default, objects with the [Fedora state](https://wiki.duraspace.org/display/F ### Customization -Hooks provided by Islandora are documented in `islandora.api.php`. A [detailed tutorial](https://github.com/Islandora/islandora/wiki/Multi-paged-Ingest-Forms) on extending the multi-page ingest forms is available on the Github (developers') Wiki. +* Hooks provided by Islandora are documented in `islandora.api.php`. +* A [detailed tutorial](https://github.com/Islandora/islandora/wiki/Multi-paged-Ingest-Forms) on extending the multi-page ingest forms is available on the Github (developers') Wiki. ## Documentation From d8b8b4f6dc11a16b8dc4fc512e96d58c006f50f4 Mon Sep 17 00:00:00 2001 From: Pat Dunlavey Date: Sun, 27 May 2018 08:53:14 -0400 Subject: [PATCH 31/85] ISLANDORA-1748 -- add hook_islandora_datastream_filename_alter(). (#706) * ISLANDORA-1748 -- add hook_datastream_filename_alter(). Co-authored-by: Diego Pino Navarro --- includes/datastream.inc | 4 ++++ islandora.api.php | 21 +++++++++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/includes/datastream.inc b/includes/datastream.inc index 8584e53e7..414323337 100644 --- a/includes/datastream.inc +++ b/includes/datastream.inc @@ -63,6 +63,10 @@ function islandora_view_datastream(AbstractDatastream $datastream, $download = F if ($duplicate_extension_position === FALSE) { $filename .= $extension; } + + // Allow other modules to modify or replace the filename. + drupal_alter('islandora_datastream_filename', $filename, $datastream); + header("Content-Disposition: attachment; filename=\"$filename\""); } diff --git a/islandora.api.php b/islandora.api.php index e553a894b..c5de95e15 100644 --- a/islandora.api.php +++ b/islandora.api.php @@ -945,3 +945,24 @@ function callback_islandora_breadcrumbs_backends(AbstractObject $object) { // Do something to get an array of breadcrumb links for $object, root first. return array($root_link, $collection_link, $object_link); } + +/** + * Permit modules to alter the filename of a downloaded datastream. + * + * @param string $filename + * The filename being created. + * + * @param AbstractDatastream $datastream + * The datastream object being downloaded. + */ +function hook_islandora_datastream_filename_alter(&$filename, AbstractDatastream $datastream) { + + // Example taken from islandora_datastream_filenamer. + $pattern = variable_get('islandora_ds_download_filename_pattern', FALSE); + if ($pattern) { + $filename = token_replace($pattern, + array('datastream' => $datastream), + array('clear' => TRUE) + ); + } +} From 7f3d7819df4a9d010754e931ac4a318e0b3d81fb Mon Sep 17 00:00:00 2001 From: Alan Stanley Date: Thu, 6 Sep 2018 13:21:54 -0300 Subject: [PATCH 32/85] made logging messages more accurate (#709) * made logging messages more accurate * toggled message type * removed annoying blank line * a little more cleanup * filtered variable * filtered another variable * the filtering was getting out of hand --- includes/derivatives.inc | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/includes/derivatives.inc b/includes/derivatives.inc index 9b44b9af9..aca79bea5 100644 --- a/includes/derivatives.inc +++ b/includes/derivatives.inc @@ -127,8 +127,14 @@ function islandora_do_derivatives(AbstractObject $object, array $options) { * watchdog if not defined. */ function islandora_derivative_logging(array $logging_results) { + $result_messages = array( + 'success' => l(t('Derivatives successfully created'), 'islandora/event-status'), + 'incomplete' => l(t('Not all derivatives successfully created. Please check log messages'), 'islandora/event-status'), + ); foreach ($logging_results as $result) { foreach ($result['messages'] as $message) { + $result_message = $result_messages['success']; + $message_status = 'status'; if ($message['type'] === 'dsm') { if (isset($message['severity']) && $message['severity'] != 'status') { drupal_set_message(filter_xss(format_string($message['message'], isset($message['message_sub']) ? $message['message_sub'] : array())), $message['severity']); @@ -141,7 +147,6 @@ function islandora_derivative_logging(array $logging_results) { 'message' => filter_xss(format_string($message['message'], isset($message['message_sub']) ? $message['message_sub'] : array())), 'severity' => 'status', ); - drupal_set_message(l(t('Derivatives successfully created.'), 'islandora/event-status'), 'status', FALSE); } } else { @@ -150,6 +155,13 @@ function islandora_derivative_logging(array $logging_results) { // call_user_func until such time as the @ignore changes // are merged into the standard release for Coder. call_user_func('watchdog', 'islandora_derivatives', $message['message'], isset($message['message_sub']) ? $message['message_sub'] : array(), isset($message['severity']) ? $message['severity'] : WATCHDOG_NOTICE); + $result_message = $result_messages['incomplete']; + $message_status = 'warning'; + } + drupal_set_message(filter_xss($result_message), filter_xss($message_status), FALSE); + + if (isset($_SESSION['messages']['warning']) && isset($_SESSION['messages']['status'])) { + unset($_SESSION['messages']['status']); } } } From 6ada7c45d8b3132d4a8047ba3448a856ea21ce8f Mon Sep 17 00:00:00 2001 From: "Bryan J. Brown" Date: Tue, 2 Oct 2018 08:57:54 -0400 Subject: [PATCH 33/85] Adds Jon Green to README maintainer list --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 196c5d66f..4cb3cf4f8 100644 --- a/README.md +++ b/README.md @@ -81,6 +81,7 @@ Having problems or solved a problem? Check out the Islandora google groups for a Current maintainers: * [Diego Pino](https://github.com/DiegoPino) +* [Jonathan Green](https://github.com/jonathangreen) ## Development From f3b3ffc472e11bc0f875ed6225f7a44b9400987e Mon Sep 17 00:00:00 2001 From: Jonathan Green Date: Mon, 8 Oct 2018 22:23:34 -0300 Subject: [PATCH 34/85] Allow orphaned object report to find orphaned compound objects. (#710) * Allow orphaned object report to find orphaned compound objects. * Add hook for child relationships * Add conditional checking if we are working with an empty set. * Add way to filter hook on content model. * Sacrifical commit for coding standards gods. * Less python in example. * More uniqueness --- includes/orphaned_objects.inc | 30 ++++++++++++++++++++---------- islandora.api.php | 27 +++++++++++++++++++++++++++ islandora.module | 9 +++++++++ 3 files changed, 56 insertions(+), 10 deletions(-) diff --git a/includes/orphaned_objects.inc b/includes/orphaned_objects.inc index 606a988d7..4941bab58 100644 --- a/includes/orphaned_objects.inc +++ b/includes/orphaned_objects.inc @@ -145,7 +145,7 @@ function islandora_get_orphaned_objects() { $connection = islandora_get_tuque_connection(); // SPARQL: get orphaned objects, exclude any with a living parent. $object_query = << +!prefix SELECT DISTINCT ?object ?title WHERE { ?object ; @@ -156,22 +156,26 @@ WHERE { } . FILTER (!bound(?model)) - # Filter by "parent" relationships - isMemberOf, isMemberOfCollection, isPageOf. - FILTER (?p = || ?p = || ?p = ) + # Filter by "parent" relationships + FILTER (!dead_parent_relationships) -# Exclude objects with live parents - isMemberOf, isMemberOfCollection, isPageOf. - OPTIONAL { - {?object ?liveparent } - UNION {?object ?liveparent } - UNION { ?object ?liveparent } . - ?liveparent . + # Exclude objects with live parents + OPTIONAL { + !live_parent_relationships . + ?liveparent . } !optionals !filters FILTER (!bound(?liveparent)) } ORDER BY ?object EOQ; - + $parent_relationships = module_invoke_all('islandora_solution_pack_child_relationships', 'all'); + $parent_relationships['prefix'] = array_unique($parent_relationships['prefix']); + $parent_relationships['predicate'] = array_unique($parent_relationships['predicate']); + 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', @@ -184,10 +188,16 @@ EOQ; $filter_map = function ($filter) { return "FILTER($filter)"; }; + $parent_map = function ($parent) { + return "?object $parent ?liveparent"; + }; // Use separate queries for different object types. $sparql_query_objects = format_string($object_query, array( '!optionals' => !empty($optionals) ? ('OPTIONAL {{' . implode('} UNION {', $optionals) . '}}') : '', '!filters' => !empty($filters) ? implode(' ', array_map($filter_map, $filters)) : '', + '!dead_parent_relationships' => '?p = ' . implode(' || ?p = ', $parent_relationships['predicate']), + '!live_parent_relationships' => '{' . implode(' } UNION { ', array_map($parent_map, $parent_relationships['predicate'])) . '}', + '!prefix' => implode("\n", $parent_relationships['prefix']), )); $results = $connection->repository->ri->sparqlQuery($sparql_query_objects); return $results; diff --git a/islandora.api.php b/islandora.api.php index c5de95e15..1cdb92051 100644 --- a/islandora.api.php +++ b/islandora.api.php @@ -966,3 +966,30 @@ function hook_islandora_datastream_filename_alter(&$filename, AbstractDatastream ); } } + +/** + * Allow solution packs to register relationships used for children. + * + * @param string|array $cmodels + * This takes either: + * - string: the string 'all'. Function returns all child relationships. + * - array: an array of cmodel PIDs to return the relationships for. + * + * @return array + * - prefix (array): This is is a valid snip-it of SPARQL to register + * prefixes used in the predicates array. + * - predicate (array): This array contains predicates used by the solution + * pack for child objects. + */ +function hook_islandora_solution_pack_child_relationships($cmodels) { + if ($cmodels === 'all' || in_array('my:cmodel_pid', $cmodels)) { + return array( + 'prefix' => array('PREFIX islandora: '), + 'predicate' => array( + '', + '', + '', + ), + ); + } +} diff --git a/islandora.module b/islandora.module index f92764040..337212e8e 100644 --- a/islandora.module +++ b/islandora.module @@ -2215,3 +2215,12 @@ function islandora_islandora_breadcrumbs_backends() { ), ); } + +/** + * Implements hook_islandora_solution_pack_child_relationships + */ +function islandora_islandora_solution_pack_child_relationships($cmodels) { + // Return empty arrays from core implementation so that these keys always + // exist when the hook is called, even if no module responds. + return array('predicate' => array(), 'prefix' => array()); +} From 7a319ce51b70eb05e53d7c465837b179d2a4f046 Mon Sep 17 00:00:00 2001 From: Melissa Anez Date: Thu, 29 Nov 2018 16:02:30 -0400 Subject: [PATCH 35/85] Update PULL_REQUEST_TEMPLATE.md --- .github/PULL_REQUEST_TEMPLATE.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 095254a50..98545dbb2 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -1,3 +1,7 @@ +:zap::zap::zap: *The text below is a template to give us the information we need to act on your pull request. Please delete or mark N/A on any questions that do not apply to your pull request. Please DO NOT leave the default text OR this text in place when you submit your pull request!* :zap::zap::zap: + +----------------------------------------------------------------- + **JIRA Ticket**: (link) * Other Relevant Links (Google Groups discussion, related pull requests, Release pull requests, etc.) @@ -27,7 +31,7 @@ A description of what steps someone could take to: Any additional information that you think would be helpful when reviewing this PR. Example: -* Does this change require documentation to be updated? +* Does this change the interface, add a new feature, or otherwise change behaviours that would require updating documentation? * Does this change add any new dependencies? * Does this change require any other modifications to be made to the repository (ie. Regeneration activity, etc.)? * Could this change impact execution of existing code? From 25199549590a3406d43384782402183b5eac32b0 Mon Sep 17 00:00:00 2001 From: Melissa Anez Date: Thu, 29 Nov 2018 16:13:33 -0400 Subject: [PATCH 36/85] Update PULL_REQUEST_TEMPLATE.md --- .github/PULL_REQUEST_TEMPLATE.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 98545dbb2..fdb1229ee 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -1,6 +1,5 @@ -:zap::zap::zap: *The text below is a template to give us the information we need to act on your pull request. Please delete or mark N/A on any questions that do not apply to your pull request. Please DO NOT leave the default text OR this text in place when you submit your pull request!* :zap::zap::zap: +!!!!!! PLEASE NOTE: The text below is a template to give us the information we need to act on your pull request. Please delete or mark N/A on any questions that do not apply to your pull request. Please DO NOT leave the default text OR this text in place when you submit your pull request!!!!!! ------------------------------------------------------------------ **JIRA Ticket**: (link) From d6679cbfb8d34c670bae63dbfada8ff2d3b1afaa Mon Sep 17 00:00:00 2001 From: Jordan Dukart Date: Mon, 17 Dec 2018 15:33:13 -0400 Subject: [PATCH 37/85] Form_load_include the file. --- includes/datastream.version.inc | 1 + 1 file changed, 1 insertion(+) diff --git a/includes/datastream.version.inc b/includes/datastream.version.inc index ea27cc65c..57ccfa409 100644 --- a/includes/datastream.version.inc +++ b/includes/datastream.version.inc @@ -276,6 +276,7 @@ function islandora_datastream_version_replace_form($form, &$form_state, Abstract module_load_include('inc', 'islandora', 'includes/content_model'); module_load_include('inc', 'islandora', 'includes/utilities'); module_load_include('inc', 'islandora', 'includes/mimetype.utils'); + form_load_include($form_state, 'inc', 'islandora', 'includes/datastream.version'); $object = islandora_object_load($datastream->parent->id); $form_state['object_id'] = $object->id; From a46936cf7b5fae9002b34c81f180509ce5af8744 Mon Sep 17 00:00:00 2001 From: Jared Whiklo Date: Tue, 12 Feb 2019 07:13:27 -0600 Subject: [PATCH 38/85] Install drush with composer (#714) - Install Drush with composer and update to use latest phpcs sniffs. - Update codebase to to be compliant with new sniffs --- includes/add_datastream.form.inc | 2 +- includes/admin.form.inc | 13 +- includes/authtokens.inc | 10 +- includes/content_model.autocomplete.inc | 3 +- includes/datastream.inc | 30 ++--- includes/datastream.version.inc | 31 ++--- includes/delete_datastream.form.inc | 17 +-- includes/derivatives.inc | 7 +- includes/dublin_core.inc | 8 +- includes/ingest.form.inc | 29 +++-- includes/metadata.inc | 7 +- includes/mime_detect.inc | 96 +++++++++------ includes/mime_type.autocomplete.inc | 1 + includes/mimetype.utils.inc | 2 +- includes/object.entity_controller.inc | 11 +- includes/object_properties.form.inc | 13 +- includes/orphaned_objects.inc | 26 ++-- includes/regenerate_derivatives.form.inc | 10 +- includes/solution_packs.inc | 73 +++++------ includes/tuque.inc | 11 +- includes/tuque_wrapper.inc | 115 ++++++++++++------ includes/utilities.inc | 28 +++-- islandora.api.php | 88 +++++++------- islandora.module | 67 +++++----- islandora.rules.inc | 11 +- tests/authtokens.test | 11 +- tests/datastream_cache.test | 6 +- tests/datastream_validator_tests.test | 9 +- tests/datastream_versions.test | 6 +- tests/derivatives.test | 30 +++-- tests/hooked_access.test | 18 +-- tests/hooks.test | 4 + tests/includes/datastream_validators.inc | 52 ++++---- tests/includes/islandora_unit_test_case.inc | 8 +- tests/includes/islandora_web_test_case.inc | 23 ++-- tests/includes/test_utility_abstraction.inc | 2 + tests/includes/utilities.inc | 10 +- tests/ingest.test | 3 + tests/islandora_derivatives_test.module | 6 +- tests/islandora_hooked_access_test.module | 2 +- tests/islandora_hooks_test.module | 8 +- tests/islandora_ingest_test.module | 2 +- tests/islandora_manage_permissions.test | 4 + tests/islandora_manage_temp_file.test | 4 + tests/scripts/travis_scripts.sh | 32 ++++- tests/scripts/travis_setup.sh | 66 +++++++--- .../islandora-dublin-core-description.tpl.php | 1 + theme/islandora-dublin-core-display.tpl.php | 29 ++--- theme/islandora-object-edit.tpl.php | 4 +- theme/islandora-object-print.tpl.php | 1 - theme/islandora-object.tpl.php | 15 ++- theme/islandora-objects.tpl.php | 8 +- theme/theme.inc | 16 +-- 53 files changed, 652 insertions(+), 437 deletions(-) diff --git a/includes/add_datastream.form.inc b/includes/add_datastream.form.inc index 3ad5a965b..037fd14fe 100644 --- a/includes/add_datastream.form.inc +++ b/includes/add_datastream.form.inc @@ -227,7 +227,7 @@ function islandora_add_datastream_form_autocomplete_callback(AbstractObject $obj $dsids = array_combine($dsids, $dsids); $query = trim($query); if (!empty($query)) { - $filter = function($id) use($query) { + $filter = function ($id) use ($query) { return stripos($id, $query) !== FALSE; }; $dsids = array_filter($dsids, $filter); diff --git a/includes/admin.form.inc b/includes/admin.form.inc index 37bc9aa86..7324f6c66 100644 --- a/includes/admin.form.inc +++ b/includes/admin.form.inc @@ -48,7 +48,8 @@ function islandora_repository_admin(array $form, array &$form_state) { '#title' => t('Fedora base URL'), '#default_value' => variable_get('islandora_base_url', 'http://localhost:8080/fedora'), '#description' => t('The URL to use for REST connections
    !confirmation_message', array( - '!confirmation_message' => $confirmation_message)), + '!confirmation_message' => $confirmation_message, + )), '#required' => TRUE, '#ajax' => array( 'callback' => 'islandora_update_url_div', @@ -225,17 +226,21 @@ function islandora_admin_settings_form_repository_access_message($url) { if ($info && $dc) { $confirmation_message = theme_image(array('path' => 'misc/watchdog-ok.png', 'attributes' => array())); $confirmation_message .= t('Successfully connected to Fedora Server (Version !version).', array( - '!version' => $info['repositoryVersion'])); + '!version' => $info['repositoryVersion'], + )); } elseif ($info) { $confirmation_message = theme_image(array('path' => 'misc/watchdog-warning.png', 'attributes' => array())); $confirmation_message .= t('Unable to authenticate when connecting to to Fedora Server (Version !version). Please configure the !filter.', array( - '!version' => $info['repositoryVersion'], '!filter' => 'Drupal Filter')); + '!version' => $info['repositoryVersion'], + '!filter' => 'Drupal Filter', + )); } else { $confirmation_message = theme_image(array('path' => 'misc/watchdog-error.png', 'attributes' => array())); $confirmation_message .= t('Unable to connect to Fedora server at !islandora_url', array( - '!islandora_url' => $url)); + '!islandora_url' => $url, + )); } return $confirmation_message; } diff --git a/includes/authtokens.inc b/includes/authtokens.inc index d5d981179..055e6464d 100644 --- a/includes/authtokens.inc +++ b/includes/authtokens.inc @@ -104,11 +104,11 @@ function islandora_validate_object_token($pid, $dsid, $token) { // Decrement authentication token uses. else { db_update("islandora_authtokens") - ->fields(array('remaining_uses' => $remaining_uses)) - ->condition('token', $token, '=') - ->condition('pid', $pid, '=') - ->condition('dsid', $dsid, '=') - ->execute(); + ->fields(array('remaining_uses' => $remaining_uses)) + ->condition('token', $token, '=') + ->condition('pid', $pid, '=') + ->condition('dsid', $dsid, '=') + ->execute(); } unset($result[0]->remaining_uses); $accounts[$pid][$dsid][$token] = $result[0]; diff --git a/includes/content_model.autocomplete.inc b/includes/content_model.autocomplete.inc index 67923e9e2..466cb71fe 100644 --- a/includes/content_model.autocomplete.inc +++ b/includes/content_model.autocomplete.inc @@ -1,4 +1,5 @@ $version, - '%s' => $datastream_id, - '%o' => $object->label, - '%e' => $e->getMessage())), 'error'); + '%v' => $version, + '%s' => $datastream_id, + '%o' => $object->label, + '%e' => $e->getMessage(), + )), 'error'); } drupal_set_message(t('%d datastream version successfully deleted from Islandora object %o', array( - '%d' => $datastream_id, - '%o' => $object->label))); + '%d' => $datastream_id, + '%o' => $object->label, + ))); $form_state['redirect'] = "islandora/object/{$object->id}/datastream/{$datastream->id}/version"; } @@ -224,9 +226,10 @@ function islandora_revert_datastream_version_form_submit(array $form, array &$fo } drupal_set_message(t('%d datastream successfully reverted to version %v for Islandora object %o', array( - '%d' => $datastream_to_revert->id, - '%v' => $version, - '%o' => $islandora_object->label))); + '%d' => $datastream_to_revert->id, + '%v' => $version, + '%o' => $islandora_object->label, + ))); $form_state['redirect'] = "islandora/object/{$islandora_object->id}/datastream/{$datastream_to_revert->id}/version"; } @@ -235,9 +238,9 @@ function islandora_revert_datastream_version_form_submit(array $form, array &$fo * Process available dsids, mime and extensions for a given object. * * @param AbstractObject $object - * The FedoraObject to process available extensions + * The FedoraObject to process available extensions. * - * @return array() + * @return array * An associative array, merged from calls to * islandora_get_datastreams_requirements_from_content_models() * and an objects dsid's. @@ -272,7 +275,7 @@ function islandora_get_object_extensions(AbstractObject $object) { * @return array * The drupal form definition. */ -function islandora_datastream_version_replace_form($form, &$form_state, AbstractDatastream $datastream) { +function islandora_datastream_version_replace_form(array $form, array &$form_state, AbstractDatastream $datastream) { module_load_include('inc', 'islandora', 'includes/content_model'); module_load_include('inc', 'islandora', 'includes/utilities'); module_load_include('inc', 'islandora', 'includes/mimetype.utils'); @@ -337,7 +340,7 @@ function islandora_datastream_version_replace_form($form, &$form_state, Abstract * @param array $form_state * The Drupal form state. */ -function islandora_datastream_version_replace_form_submit($form, &$form_state) { +function islandora_datastream_version_replace_form_submit(array $form, array &$form_state) { $object = islandora_object_load($form_state['object_id']); $form_state['redirect'] = "islandora/object/{$object->id}"; $file = file_load($form_state['values']['file']); @@ -370,7 +373,7 @@ function islandora_datastream_version_replace_form_submit($form, &$form_state) { * Gets Audit datastream values from foxml. * * @param string $pid - * PID of parent object + * PID of parent object. * * @return array * Array of audit values diff --git a/includes/delete_datastream.form.inc b/includes/delete_datastream.form.inc index 6d67c8dd7..ad24eba77 100644 --- a/includes/delete_datastream.form.inc +++ b/includes/delete_datastream.form.inc @@ -127,19 +127,22 @@ function islandora_delete_datastream_form_submit(array $form, array &$form_state } catch (Exception $e) { drupal_set_message(t('Error deleting %s datastream from object %o %e', array( - '%s' => $datastream_id, - '%o' => $object->label, - '%e' => $e->getMessage())), 'error'); + '%s' => $datastream_id, + '%o' => $object->label, + '%e' => $e->getMessage(), + )), 'error'); } if ($deleted) { drupal_set_message(t('%d datastream sucessfully deleted from Islandora object %o', array( - '%d' => $datastream_id, - '%o' => $object->label))); + '%d' => $datastream_id, + '%o' => $object->label, + ))); } else { drupal_set_message(t('Error deleting %s datastream from object %o', array( - '%s' => $datastream_id, - '%o' => $object->label)), 'error'); + '%s' => $datastream_id, + '%o' => $object->label, + )), 'error'); } $form_state['redirect'] = "islandora/object/{$object->id}"; } diff --git a/includes/derivatives.inc b/includes/derivatives.inc index aca79bea5..edaf99133 100644 --- a/includes/derivatives.inc +++ b/includes/derivatives.inc @@ -1,4 +1,5 @@ dc = self::importFromXMLString($dc_xml); + $this->dc = self::importFromXmlString($dc_xml); } } @@ -81,7 +81,7 @@ class DublinCore { * @return string * The serialized XML. */ - public function asXML() { + public function asXml() { $dc_xml = new DomDocument(); $oai_dc = $dc_xml->createElementNS('http://www.openarchives.org/OAI/2.0/oai_dc/', 'oai_dc:dc'); $oai_dc->setAttribute('xmlns:dc', 'http://purl.org/dc/elements/1.1/'); @@ -152,7 +152,7 @@ class DublinCore { * @return DublinCore * The instantiated object. */ - public static function importFromXMLString($dc_xml) { + public static function importFromXmlString($dc_xml) { $dc_doc = new DomDocument(); if (!empty($dc_xml) && $dc_doc->loadXML($dc_xml)) { $oai_dc = $dc_doc->getElementsByTagNameNS('http://purl.org/dc/elements/1.1/', '*'); diff --git a/includes/ingest.form.inc b/includes/ingest.form.inc index d4d7e8957..5b6e49aa0 100644 --- a/includes/ingest.form.inc +++ b/includes/ingest.form.inc @@ -64,8 +64,11 @@ function islandora_ingest_form(array $form, array &$form_state, array $configura WATCHDOG_ERROR ); drupal_set_message($e->getMessage(), 'error'); - return array(array( - '#markup' => l(t('Back'), 'javascript:window.history.back();', array('external' => TRUE)))); + return array( + array( + '#markup' => l(t('Back'), 'javascript:window.history.back();', array('external' => TRUE)), + ), + ); } } @@ -285,7 +288,7 @@ function islandora_ingest_form_increment_step(array &$form_state) { * The Drupal form state. */ function islandora_ingest_form_decrement_step(array &$form_state) { - $previous_step_id = islandora_ingest_form_get_previous_step_id($form_state); + $previous_step_id = islandora_ingest_form_get_previous_step_id($form_state); // Don't decrement passed the first step. if (isset($previous_step_id)) { islandora_ingest_form_stash_info($form_state); @@ -496,7 +499,7 @@ function islandora_ingest_form_stepify(array $form, array &$form_state, array $s */ function islandora_ingest_form_add_step_context(array &$form, array $form_state) { $items = array(); - $get_label = function(AbstractObject $collection = NULL, AbstractObject $fedora_cmodel) { + $get_label = function (AbstractObject $collection = NULL, AbstractObject $fedora_cmodel) { if (isset($collection['COLLECTION_POLICY'])) { $policy = new CollectionPolicy($collection['COLLECTION_POLICY']->content); $policy_content_models = $policy->getContentModels(); @@ -876,18 +879,18 @@ function &islandora_ingest_form_get_objects(array &$form_state) { /** * Gets a single object from the stored NewFedoraObject's. * - * @note In our current use case we are only dealing with a single object - * ingest, this makes it convenient to access it. Ideally the steps - * implementations will be abstracted to be indifferent to what object it's - * currently working on. This will act as a placeholder for such - * functionality. - * * @param array $form_state * The Drupal form state. * * @return NewFedoraObject * Returns the 'current' object in the array of NewFedoraObjects, generally * this is only used when there is one object in the list of objects. + * + * @note In our current use case we are only dealing with a single object + * ingest, this makes it convenient to access it. Ideally the steps + * implementations will be abstracted to be indifferent to what object it's + * currently working on. This will act as a placeholder for such + * functionality. */ function islandora_ingest_form_get_object(array &$form_state) { $objects = &islandora_ingest_form_get_objects($form_state); @@ -899,7 +902,7 @@ function islandora_ingest_form_get_object(array &$form_state) { * * @param array $form_state * The Drupal form state. - * @param array $step_id + * @param string $step_id * The ID of the step. * * @return array @@ -1004,7 +1007,7 @@ function islandora_ingest_form_get_steps(array &$form_state) { */ function islandora_ingest_form_get_form_steps(array &$form_state) { $steps = islandora_ingest_form_get_steps($form_state); - $form_step_filter = function($o) { + $form_step_filter = function ($o) { return $o['type'] == 'form'; }; return array_filter($steps, $form_step_filter); @@ -1022,7 +1025,7 @@ function islandora_ingest_form_get_form_steps(array &$form_state) { */ function islandora_ingest_form_get_callback_steps(array &$form_state) { $steps = islandora_ingest_form_get_steps($form_state); - $callback_step_filter = function($o) { + $callback_step_filter = function ($o) { return $o['type'] == 'callback'; }; return array_filter($steps, $callback_step_filter); diff --git a/includes/metadata.inc b/includes/metadata.inc index 90c30f9cb..5e298127f 100644 --- a/includes/metadata.inc +++ b/includes/metadata.inc @@ -1,4 +1,5 @@ 'item', - '#markup' => (isset($profile['configuration']) AND $profile['configuration'] != '') ? l(t('configure'), $profile['configuration']) : '', + '#markup' => (isset($profile['configuration']) && $profile['configuration'] != '') ? l(t('configure'), $profile['configuration']) : '', ); } $form['viewers']['default'] = array( @@ -135,7 +136,7 @@ function islandora_metadata_display_form($form, $form_state) { * @param array $form_state * An array containing the Drupal form state. */ -function islandora_metadata_display_form_submit($form, $form_state) { +function islandora_metadata_display_form_submit(array $form, array $form_state) { variable_set('islandora_metadata_display', $form_state['values']['viewers']['default']); drupal_set_message(t('The configuration options have been saved.')); } diff --git a/includes/mime_detect.inc b/includes/mime_detect.inc index 9b1145ebf..818e150be 100644 --- a/includes/mime_detect.inc +++ b/includes/mime_detect.inc @@ -21,54 +21,71 @@ * http://api.drupal.org/api/function/file_default_mimetype_mapping/7 */ +/** + * Class for mime-type detection. + */ class MimeDetect { - protected $protectedMimeTypes = array( - /* - * This is a shortlist of mimetypes which should catch most - * mimetype<-->extension lookups in the context of Islandora collections. - * - * It has been cut from a much longer list. - * - * Two types of mimetypes should be put in this list: - * 1) Special emerging formats which may not yet be expressed in the system - * mime.types file. - * 2) Heavily used mimetypes of particular importance to the Islandora - * project, as lookups against this list will be quicker and less - * resource intensive than other methods. - * - * Lookups are first checked against this short list. If no results are - * found, then the lookup function may move on to check other sources, - * namely the system's mime.types file. - * - * In most cases though, this short list should suffice. - * - * If modifying this list, please note that for promiscuous mimetypes - * (those which map to multiple extensions, such as text/plain) - * The function get_extension will always return the *LAST* extension in - * this list, so you should put your preferred extension *LAST*. - * - * e.g... - * "jpeg" => "image/jpeg", - * "jpe" => "image/jpeg", - * "jpg" => "image/jpeg", - * - * $this->get_extension('image/jpeg') will always return 'jpg'. - * - */ - ); + /** + * Shortlist of mimetypes which catch most mimetype to extension lookups. + * + * @var array + * + * It has been cut from a much longer list. + * + * Two types of mimetypes should be put in this list: + * 1) Special emerging formats which may not yet be expressed in the system + * mime.types file. + * 2) Heavily used mimetypes of particular importance to the Islandora + * project, as lookups against this list will be quicker and less + * resource intensive than other methods. + * + * Lookups are first checked against this short list. If no results are + * found, then the lookup function may move on to check other sources, + * namely the system's mime.types file. + * + * In most cases though, this short list should suffice. + * + * If modifying this list, please note that for promiscuous mimetypes + * (those which map to multiple extensions, such as text/plain) + * The function get_extension will always return the *LAST* extension in + * this list, so you should put your preferred extension *LAST*. + * + * e.g... + * "jpeg" => "image/jpeg", + * "jpe" => "image/jpeg", + * "jpg" => "image/jpeg", + * + * $this->get_extension('image/jpeg') will always return 'jpg'. + */ + protected $protectedMimeTypes = array(); protected $protectedFileExtensions; protected $extensionExceptions = array( // XXX: Deprecated... Only here due to old 'tif' => 'image/tif' mapping... // The correct MIMEtype is 'image/tiff'. 'image/tif' => 'tif', ); + /** + * Array of mimetypes from the system. + * + * @var array + */ protected $systemTypes; + /** + * Array of extensions from the system. + * + * @var array + */ protected $systemExts; + /** + * Location of the system mime.types file. + * + * @var string + */ protected $etcMimeTypes = '/etc/mime.types'; /** - * Construtor. + * Constructor. */ public function __construct() { module_load_include('inc', 'islandora', 'includes/mimetype.utils'); @@ -87,7 +104,7 @@ class MimeDetect { * Gets MIME type associated with the give file's extension. * * @param string $filename - * The filename + * The filename. * @param bool $debug * Returns a debug array. * @@ -171,7 +188,8 @@ class MimeDetect { /** * Gets an associative array of MIME type and extension associations. * - * Users the system mime.types file, or a local mime.types if one is found + * Users the system mime.types file, or a local mime.types if one is found. + * * @see MIMEDetect::__constuctor() * * @return array @@ -206,7 +224,8 @@ class MimeDetect { /** * Gets a associative array of extensions and MIME types. * - * Users the system mime.types file, or a local mime.types if one is found + * Users the system mime.types file, or a local mime.types if one is found. + * * @see MIMEDetect::__constuctor() * * @return array @@ -262,4 +281,5 @@ class MimeDetect { }; return array_keys(array_filter($this->protectedMimeTypes, $filter)); } + } diff --git a/includes/mime_type.autocomplete.inc b/includes/mime_type.autocomplete.inc index f24e41938..a5b249c18 100644 --- a/includes/mime_type.autocomplete.inc +++ b/includes/mime_type.autocomplete.inc @@ -1,4 +1,5 @@ "application/warc", "json" => "application/json", - // JSON-LD + // JSON-LD. "jsonld" => "application/ld+json", ); } diff --git a/includes/object.entity_controller.inc b/includes/object.entity_controller.inc index 87b5e4de7..70b6c4bd4 100644 --- a/includes/object.entity_controller.inc +++ b/includes/object.entity_controller.inc @@ -5,6 +5,9 @@ * Very basic entity controller. */ +/** + * Special loader for Islandora objects. + */ class IslandoraObjectEntityController implements DrupalEntityControllerInterface { /** @@ -20,13 +23,16 @@ class IslandoraObjectEntityController implements DrupalEntityControllerInterface /** * Load all the entities. * - * @param array $ids + * @param mixed $ids * The ID's of the entities. - * @param array $conditions + * @param mixed $conditions * The conditions to apply. * * @return array * An array of loaded objects. + * + * @throws \Exception + * If no conditions are provided. */ public function load($ids = array(), $conditions = array()) { if (!empty($conditions)) { @@ -54,4 +60,5 @@ class IslandoraObjectEntityController implements DrupalEntityControllerInterface public function resetCache(array $ids = NULL) { // no-op. } + } diff --git a/includes/object_properties.form.inc b/includes/object_properties.form.inc index 85a983423..33016d865 100644 --- a/includes/object_properties.form.inc +++ b/includes/object_properties.form.inc @@ -90,7 +90,8 @@ function islandora_object_properties_form(array $form, array &$form_state, Abstr '#type' => 'submit', '#access' => islandora_object_access(ISLANDORA_PURGE, $object), '#value' => t("Permanently remove '@label' from repository", array( - '@label' => truncate_utf8($object->label, 32, TRUE, TRUE)) + '@label' => truncate_utf8($object->label, 32, TRUE, TRUE), + ) ), '#submit' => array('islandora_object_properties_form_delete'), '#limit_validation_errors' => array(array('pid')), @@ -200,15 +201,15 @@ function islandora_object_properties_form_delete(array $form, array &$form_state * Updates object state. * * @param string $pid - * PID of object to be updated + * PID of object to be updated. * @param bool $update_states - * If TRUE, update object state + * If TRUE, update object state. * @param string $state - * Desired object state + * Desired object state. * @param bool $update_owners - * If TRUE, update Owner + * If TRUE, update Owner. * @param string $owner - * New Owner + * New Owner. */ function islandora_update_object_properties($pid, $update_states, $state, $update_owners, $owner) { $fedora_object = islandora_object_load($pid); diff --git a/includes/orphaned_objects.inc b/includes/orphaned_objects.inc index 4941bab58..f17f41859 100644 --- a/includes/orphaned_objects.inc +++ b/includes/orphaned_objects.inc @@ -16,7 +16,7 @@ * @return array * An array containing the form to be rendered. */ -function islandora_manage_orphaned_objects_form($form, $form_state) { +function islandora_manage_orphaned_objects_form(array $form, array $form_state) { if (isset($form_state['show_confirm'])) { $pids = $form_state['pids_to_delete']; $form['confirm_message'] = array( @@ -96,12 +96,13 @@ function islandora_manage_orphaned_objects_form($form, $form_state) { * @param array $form_state * An array containing the Drupal form state. */ -function islandora_delete_selected_orphaned_objects_validate($form, $form_state) { +function islandora_delete_selected_orphaned_objects_validate(array $form, array $form_state) { $selected = array_filter($form_state['values']['management_table']); if (empty($selected)) { form_error($form['management_table'], t('At least one object must be selected to delete!')); } } + /** * Submit handler for the delete buttons in the workflow management form. * @@ -110,7 +111,7 @@ function islandora_delete_selected_orphaned_objects_validate($form, $form_state) * @param array $form_state * An array containing the Drupal form state. */ -function islandora_delete_orphaned_objects_submit(&$form, &$form_state) { +function islandora_delete_orphaned_objects_submit(array &$form, array &$form_state) { if ($form_state['triggering_element']['#name'] == 'islandora-orphaned-objects-submit-selected') { $selected = array_keys(array_filter($form_state['values']['management_table'])); } @@ -122,6 +123,7 @@ function islandora_delete_orphaned_objects_submit(&$form, &$form_state) { $form_state['rebuild'] = TRUE; $form_state['show_confirm'] = TRUE; } + /** * Submit handler for the workflow management confirm form. * @@ -130,7 +132,7 @@ function islandora_delete_orphaned_objects_submit(&$form, &$form_state) { * @param array $form_state * An array containing the Drupal form state. */ -function islandora_manage_orphaned_objects_confirm_submit($form, &$form_state) { +function islandora_manage_orphaned_objects_confirm_submit(array $form, array &$form_state) { $batch = islandora_delete_orphaned_objects_create_batch($form_state['pids_to_delete']); batch_set($batch); } @@ -212,7 +214,7 @@ EOQ; * @return array * An array detailing the batch that is about to be run. */ -function islandora_delete_orphaned_objects_create_batch($pids) { +function islandora_delete_orphaned_objects_create_batch(array $pids) { // Set up a batch operation. $batch = array( 'operations' => array( @@ -227,6 +229,7 @@ function islandora_delete_orphaned_objects_create_batch($pids) { ); return $batch; } + /** * Constructs and performs the deleting batch operation. * @@ -235,7 +238,7 @@ function islandora_delete_orphaned_objects_create_batch($pids) { * @param array $context * The context of the Drupal batch. */ -function islandora_delete_orphaned_objects_batch_operation($pids, &$context) { +function islandora_delete_orphaned_objects_batch_operation(array $pids, array &$context) { if (empty($context['sandbox'])) { $context['sandbox'] = array(); $context['sandbox']['progress'] = 0; @@ -247,10 +250,10 @@ function islandora_delete_orphaned_objects_batch_operation($pids, &$context) { $target_pid = array_pop($context['sandbox']['pids']); $target_object = islandora_object_load($target_pid); $context['message'] = t('Deleting @label (@pid) (@current of @total)...', array( - '@label' => $target_object->label, - '@pid' => $target_pid, - '@current' => $context['sandbox']['progress'], - '@total' => $context['sandbox']['total'], + '@label' => $target_object->label, + '@pid' => $target_pid, + '@current' => $context['sandbox']['progress'], + '@total' => $context['sandbox']['total'], )); islandora_delete_object($target_object); $object_check = islandora_object_load($target_pid); @@ -267,6 +270,7 @@ function islandora_delete_orphaned_objects_batch_operation($pids, &$context) { } $context['finished'] = ($context['sandbox']['total'] == 0) ? 1 : ($context['sandbox']['progress'] / $context['sandbox']['total']); } + /** * Finished function for the orphaned objects delete batch. * @@ -277,7 +281,7 @@ function islandora_delete_orphaned_objects_batch_operation($pids, &$context) { * @param array $operations * The operations array that was used in the batch. */ -function islandora_delete_orphaned_objects_batch_finished($success, $results, $operations) { +function islandora_delete_orphaned_objects_batch_finished($success, array $results, array $operations) { if ($success) { $message = format_plural(count($results['success']), 'One object deleted.', '@count objects deleted.'); } diff --git a/includes/regenerate_derivatives.form.inc b/includes/regenerate_derivatives.form.inc index 1312bec3c..321781c44 100644 --- a/includes/regenerate_derivatives.form.inc +++ b/includes/regenerate_derivatives.form.inc @@ -122,8 +122,8 @@ function islandora_regenerate_datastream_derivative_batch(AbstractDatastream $da return array( 'title' => t('Regenerating derivatives for the @dsid datastream', array('@dsid' => $datastream->id)), 'operations' => islandora_do_batch_derivatives($datastream->parent, array( - 'force' => TRUE, - 'destination_dsid' => $datastream->id, + 'force' => TRUE, + 'destination_dsid' => $datastream->id, )), 'init_message' => t('Preparing to regenerate derivatives...'), 'progress_message' => t('Time elapsed: @elapsed
    Estimated time remaining @estimate.'), @@ -139,7 +139,7 @@ function islandora_regenerate_datastream_derivative_batch(AbstractDatastream $da * @param string $function * The name of the function we are calling for derivatives. * @param bool|string $file - * FALSE if there is no file to load, the path to require otherwise + * FALSE if there is no file to load, the path to require otherwise. * @param string $pid * The pid of the object we are performing. * @param bool $force @@ -149,7 +149,7 @@ function islandora_regenerate_datastream_derivative_batch(AbstractDatastream $da * @param array $context * The context of the current batch operation. */ -function islandora_derivative_perform_batch_operation($function, $file, $pid, $force, $hook, &$context) { +function islandora_derivative_perform_batch_operation($function, $file, $pid, $force, array $hook, array &$context) { if ($file) { require_once $file; } @@ -174,7 +174,7 @@ function islandora_derivative_perform_batch_operation($function, $file, $pid, $f * @param array $operations * An array of operations passed from the batch. */ -function islandora_regenerate_derivative_batch_finished($success, $results, $operations) { +function islandora_regenerate_derivative_batch_finished(array $success, array $results, array $operations) { module_load_include('inc', 'islandora', 'includes/derivatives'); if (!empty($results['logging'])) { islandora_derivative_logging($results['logging']); diff --git a/includes/solution_packs.inc b/includes/solution_packs.inc index c5856e385..d813e0672 100644 --- a/includes/solution_packs.inc +++ b/includes/solution_packs.inc @@ -105,7 +105,7 @@ function islandora_solution_packs_admin() { * @return array * The Drupal form definition. */ -function islandora_solution_pack_form(array $form, array &$form_state, $solution_pack_module, $solution_pack_name, $objects = array()) { +function islandora_solution_pack_form(array $form, array &$form_state, $solution_pack_module, $solution_pack_name, array $objects = array()) { // The order is important in terms of severity of the status, where higher // index indicates the status is more serious, this will be used to determine // what messages get displayed to the user. @@ -145,7 +145,8 @@ function islandora_solution_pack_form(array $form, array &$form_state, $solution $header = array( 'label' => t('Label'), 'pid' => t('PID'), - 'status' => t('Status')); + 'status' => t('Status'), + ); $object_info = array(); foreach ($objects as $object) { @@ -161,7 +162,8 @@ function islandora_solution_pack_form(array $form, array &$form_state, $solution $object_info[] = array( 'label' => $label, 'pid' => $object->id, - 'status' => $status_msg); + 'status' => $status_msg, + ); } $solution_pack_status = $status_severities[$solution_pack_status_severity]; $solution_pack_status_info = $status_info[$solution_pack_status]; @@ -260,7 +262,7 @@ function islandora_solution_pack_form_submit(array $form, array &$form_state) { * @return array * An array defining a batch which can be passed on to batch_set(). */ -function islandora_solution_pack_get_batch($module, $not_checked = array()) { +function islandora_solution_pack_get_batch($module, array $not_checked = array()) { $batch = array( 'title' => t('Installing / Updating solution pack objects'), 'file' => drupal_get_path('module', 'islandora') . '/includes/solution_packs.inc', @@ -299,8 +301,8 @@ function islandora_solution_pack_batch_operation_reingest_object(AbstractObject if (!$deleted) { $object_link = l($existing_object->label, "islandora/object/{$existing_object->id}"); drupal_set_message(filter_xss(t('Failed to purge existing object !object_link.', array( - '!object_link' => $object_link, - ))), 'error'); + '!object_link' => $object_link, + ))), 'error'); // Failed to purge don't attempt to ingest. return; } @@ -405,8 +407,8 @@ function islandora_install_solution_pack($module, $op = 'install', $force = FALS $object_status = islandora_check_object_status($object); $here_params = array( '!summary' => $t("@module: Did not install !object_link.", array( - '!object_link' => $object_link, - ) + $t_params), + '!object_link' => $object_link, + ) + $t_params), '!description' => $status_messages[$object_status['status']], ); drupal_set_message(filter_xss(format_string('!summary !description', $here_params)), 'warning'); @@ -422,25 +424,25 @@ function islandora_install_solution_pack($module, $op = 'install', $force = FALS if ($object) { if ($deleted) { drupal_set_message(filter_xss($t('@module: Successfully reinstalled. !object_link.', array( - '!object_link' => $object_link, - ) + $t_params)), 'status'); + '!object_link' => $object_link, + ) + $t_params)), 'status'); } else { drupal_set_message(filter_xss($t('@module: Successfully installed. !object_link.', array( - '!object_link' => $object_link, - ) + $t_params)), 'status'); + '!object_link' => $object_link, + ) + $t_params)), 'status'); } } else { drupal_set_message($t('@module: Failed to install. @label.', array( - '@label' => $label, - ) + $t_params), 'warning'); + '@label' => $label, + ) + $t_params), 'warning'); } } else { drupal_set_message($t('@module: "@label" already exists and failed to be deleted.', array( - '@label' => $label, - ) + $t_params), 'warning'); + '@label' => $label, + ) + $t_params), 'warning'); } } } @@ -535,7 +537,7 @@ function islandora_check_object_status(AbstractObject $object_definition) { ); } - $is_xml_datastream = function($ds) { + $is_xml_datastream = function ($ds) { return $ds->mimetype == 'text/xml'; }; $xml_datastreams = array_filter(iterator_to_array($object_definition), $is_xml_datastream); @@ -627,11 +629,11 @@ function islandora_check_object_status(AbstractObject $object_definition) { * that supports either the give $mimetype or $model will be listed. * * @param string $variable_id - * The ID of the Drupal variable to save the viewer settings in + * The ID of the Drupal variable to save the viewer settings in. * @param string $mimetype - * The table will be populated with viewers supporting this mimetype + * The table will be populated with viewers supporting this mimetype. * @param string $model - * The table will be populated with viewers supporting this content model + * The table will be populated with viewers supporting this content model. * * @return array * A form api array which defines a themed table to select a viewer. @@ -680,7 +682,7 @@ function islandora_viewers_form($variable_id = NULL, $mimetype = NULL, $model = ); $form['viewers'][$variable_id]['configuration'][$name] = array( '#type' => 'item', - '#markup' => (isset($profile['configuration']) AND $profile['configuration'] != '') ? l(t('configure'), $profile['configuration']) : '', + '#markup' => (isset($profile['configuration']) and $profile['configuration'] != '') ? l(t('configure'), $profile['configuration']) : '', ); } $form['viewers'][$variable_id]['default'] = array( @@ -717,7 +719,7 @@ function islandora_viewers_form($variable_id = NULL, $mimetype = NULL, $model = * @return array * Viewer definitions, or FALSE if none are found. */ -function islandora_get_viewers($mimetype = array(), $content_model = NULL) { +function islandora_get_viewers(array $mimetype = array(), $content_model = NULL) { $viewers = array(); $defined_viewers = module_invoke_all('islandora_viewer_info'); @@ -729,7 +731,7 @@ function islandora_get_viewers($mimetype = array(), $content_model = NULL) { foreach ($defined_viewers as $key => $value) { $value['mimetype'] = isset($value['mimetype']) ? $value['mimetype'] : array(); $value['model'] = isset($value['model']) ? $value['model'] : array(); - if (array_intersect($mimetype, $value['mimetype']) OR in_array($content_model, $value['model'])) { + if (array_intersect($mimetype, $value['mimetype']) or in_array($content_model, $value['model'])) { $viewers[$key] = $value; } } @@ -763,10 +765,10 @@ function theme_islandora_viewers_table($variables) { $output = ''; $output .= theme('table', array( - 'header' => $header, - 'rows' => $rows, - 'attributes' => array('id' => 'islandora-viewers-table'), - )); + 'header' => $header, + 'rows' => $rows, + 'attributes' => array('id' => 'islandora-viewers-table'), + )); $output .= drupal_render_children($form); return $output; } @@ -774,22 +776,22 @@ function theme_islandora_viewers_table($variables) { /** * Gather information and return a rendered viewer. * - * @param array/string $params - * Array or string with data the module needs in order to render a full viewer + * @param array|string $params + * Array or string of data the module needs in order to render a full viewer. * @param string $variable_id - * The id of the Drupal variable the viewer settings are saved in + * The id of the Drupal variable the viewer settings are saved in. * @param AbstractObject $fedora_object - * The tuque object representing the fedora object being displayed + * The tuque object representing the fedora object being displayed. * * @return string * The callback to the viewer module. Returns a rendered viewer. Returns FALSE * if no viewer is set. */ -function islandora_get_viewer($params = NULL, $variable_id = NULL, $fedora_object = NULL) { +function islandora_get_viewer($params = NULL, $variable_id = NULL, AbstractObject $fedora_object = NULL) { $settings = variable_get($variable_id, array()); - if (!empty($settings) AND $settings['default'] !== 'none') { + if (!empty($settings) && $settings['default'] !== 'none') { $viewer_id = islandora_get_viewer_id($variable_id); - if ($viewer_id AND $params !== NULL) { + if ($viewer_id && $params !== NULL) { $callback = islandora_get_viewer_callback($viewer_id); if (function_exists($callback)) { return $callback($params, $fedora_object); @@ -803,7 +805,7 @@ function islandora_get_viewer($params = NULL, $variable_id = NULL, $fedora_objec * Get id of the enabled viewer. * * @param string $variable_id - * The ID of the Drupal variable the viewer settings are saved in + * The ID of the Drupal variable the viewer settings are saved in. * * @return string * The enabled viewer id. Returns FALSE if no viewer config is set. @@ -834,6 +836,7 @@ function islandora_get_viewer_callback($viewer_id = NULL) { } return FALSE; } + /** * @} End of "defgroup viewer-functions". */ diff --git a/includes/tuque.inc b/includes/tuque.inc index 7aed25561..0c91714ba 100644 --- a/includes/tuque.inc +++ b/includes/tuque.inc @@ -27,18 +27,20 @@ $islandora_module_path = drupal_get_path('module', 'islandora'); @include_once "$islandora_module_path/libraries/tuque/RepositoryException.php"; @include_once "$islandora_module_path/libraries/tuque/Repository.php"; @include_once "$islandora_module_path/libraries/tuque/FedoraRelationships.php"; - +/** + * The Tuque class built from various supporting classes. + */ class IslandoraTuque { /** - * Connection to the repository + * Connection to the repository. * * @var RepositoryConnection */ public $connection = NULL; /** - * The Fedora API we are using + * The Fedora API we are using. * * @var FedoraAPI */ @@ -61,7 +63,7 @@ class IslandoraTuque { /** * Constructor. * - * @param array $user + * @param object $user * A Drupal user. * @param string $url * The url to the fedora instance. @@ -113,4 +115,5 @@ class IslandoraTuque { $message = t('Islandora requires the !tuque_url. Please install in /sites/all/libraries/tuque before continuing. See the !islandora_url.', array('!tuque_url' => $tuque_link, '!islandora_url' => $islandora_doc_link)); drupal_set_message(filter_xss($message), 'error', FALSE); } + } diff --git a/includes/tuque_wrapper.inc b/includes/tuque_wrapper.inc index 19b73b0fa..5295de83a 100644 --- a/includes/tuque_wrapper.inc +++ b/includes/tuque_wrapper.inc @@ -2,8 +2,9 @@ /** * @file - * Wrapper around the tuque library, allows for autoloading of Islandora Tuque - * Objects. + * Wrapper around the tuque library. + * + * Allows for autoloading of Islandora Tuque Objects. * * @todo Overload functions and apply pre/post hooks. */ @@ -75,6 +76,9 @@ function islandora_invoke_datastream_hooks($hook, array $models, $dsid) { return islandora_invoke_hook_list($hook, $refinements, array_slice(func_get_args(), 3)); } +/** + * Implementation of the FedoraRepository class. + */ class IslandoraFedoraRepository extends FedoraRepository { protected $queryClass = 'IslandoraRepositoryQuery'; protected $newObjectClass = 'IslandoraNewFedoraObject'; @@ -119,9 +123,10 @@ class IslandoraFedoraRepository extends FedoraRepository { } catch (Exception $e) { watchdog('islandora', 'Failed to ingest object: @pid
    code: @code
    message: @msg', array( - '@pid' => $object->id, - '@code' => $e->getCode(), - '@msg' => $e->getMessage()), WATCHDOG_ERROR); + '@pid' => $object->id, + '@code' => $e->getCode(), + '@msg' => $e->getMessage(), + ), WATCHDOG_ERROR); throw $e; } } @@ -134,7 +139,7 @@ class IslandoraFedoraRepository extends FedoraRepository { public function constructObject($id = NULL, $create_uuid = NULL) { // Enforces UUID when set, but allows to override if called // with $create_uuid set to bool. - return parent::constructObject($id, static::useUUIDs($create_uuid)); + return parent::constructObject($id, static::useUuids($create_uuid)); } /** @@ -145,13 +150,13 @@ class IslandoraFedoraRepository extends FedoraRepository { public function getNextIdentifier($namespace = NULL, $create_uuid = NULL, $count = 1) { // Enforces UUID when set, but allows to override if called // with $create_uuid set to bool. - return parent::getNextIdentifier($namespace, static::useUUIDs($create_uuid), $count); + return parent::getNextIdentifier($namespace, static::useUuids($create_uuid), $count); } /** * Helper for three-valued logic with UUIDs. * - * @param bool|NULL $to_create + * @param bool|null $to_create * The variable to test. * * @return bool @@ -159,21 +164,29 @@ class IslandoraFedoraRepository extends FedoraRepository { * 'islandora_basic_collection_generate_uuid' Drupal variable; otherwise, * the value of $to_create itself. */ - protected static function useUUIDs($to_create) { + protected static function useUuids($to_create) { return is_null($to_create) ? variable_get('islandora_basic_collection_generate_uuid', FALSE) : $to_create; } -} +} +/** + * Implementation of RepositoryQuery class. + */ class IslandoraRepositoryQuery extends RepositoryQuery {} - +/** + * Implementation of NewFedoraObject class. + */ class IslandoraNewFedoraObject extends NewFedoraObject { protected $newFedoraDatastreamClass = 'IslandoraNewFedoraDatastream'; protected $fedoraDatastreamClass = 'IslandoraFedoraDatastream'; protected $fedoraRelsExtClass = 'IslandoraFedoraRelsExt'; -} +} +/** + * Implementation, magic functions for a FedoraObject class. + */ class IslandoraFedoraObject extends FedoraObject { protected $newFedoraDatastreamClass = 'IslandoraNewFedoraDatastream'; protected $fedoraDatastreamClass = 'IslandoraFedoraDatastream'; @@ -275,9 +288,10 @@ class IslandoraFedoraObject extends FedoraObject { } catch (Exception $e) { watchdog('islandora', 'Failed to modify object: @pid
    code: @code
    message: @msg', array( - '@pid' => $this->id, - '@code' => $e->getCode(), - '@msg' => $e->getMessage()), WATCHDOG_ERROR); + '@pid' => $this->id, + '@code' => $e->getCode(), + '@msg' => $e->getMessage(), + ), WATCHDOG_ERROR); throw $e; } } @@ -322,16 +336,21 @@ class IslandoraFedoraObject extends FedoraObject { } catch (Exception $e) { watchdog('islandora', 'Failed to purge datastream @dsid from @pid
    code: @code
    message: @msg', array( - '@pid' => $this->id, - '@dsid' => $id, - '@code' => $e->getCode(), - '@msg' => $e->getMessage()), WATCHDOG_ERROR); + '@pid' => $this->id, + '@dsid' => $id, + '@code' => $e->getCode(), + '@msg' => $e->getMessage(), + ), WATCHDOG_ERROR); throw $e; } } -} +} +/** + * Implementation of a RepositoryConnection class. + */ class IslandoraRepositoryConnection extends RepositoryConnection { + /** * Constructor. * @@ -345,8 +364,11 @@ class IslandoraRepositoryConnection extends RepositoryConnection { parent::__construct($url, $username, $password); drupal_alter('islandora_repository_connection_construction', $this); } -} +} +/** + * Implementation of a FedoraApi class. + */ class IslandoraFedoraApi extends FedoraApi { /** @@ -362,8 +384,11 @@ class IslandoraFedoraApi extends FedoraApi { $this->m = new IslandoraFedoraApiM($connection, $serializer); $this->connection = $connection; } -} +} +/** + * Implementation of FedoraApiM class. + */ class IslandoraFedoraApiM extends FedoraApiM { /** @@ -452,9 +477,10 @@ class IslandoraFedoraApiM extends FedoraApiM { } catch (Exception $e) { watchdog('islandora', 'Failed to purge object @pid
    code: @code
    message: @msg', array( - '@pid' => $pid, - '@code' => $e->getCode(), - '@msg' => $e->getMessage()), WATCHDOG_ERROR); + '@pid' => $pid, + '@code' => $e->getCode(), + '@msg' => $e->getMessage(), + ), WATCHDOG_ERROR); throw $e; } } @@ -505,7 +531,7 @@ class IslandoraFedoraApiM extends FedoraApiM { * * All extra arguments are passed along to the callback. * - * @param callable $callback + * @param string $callback * The method we are wrapping. * @param string $pid * The PID to create a semaphore for. @@ -540,15 +566,23 @@ class IslandoraFedoraApiM extends FedoraApiM { return call_user_func_array(array($this, "parent::$callback"), $args); } } -} +} +/** + * Implementation of SimpleCache class. + */ class IslandoraSimpleCache extends SimpleCache {} - +/** + * Implementation of NewFedoraDatastream class. + */ class IslandoraNewFedoraDatastream extends NewFedoraDatastream { protected $fedoraRelsIntClass = 'IslandoraFedoraRelsInt'; protected $fedoraDatastreamVersionClass = 'IslandoraFedoraDatastreamVersion'; -} +} +/** + * Implementation and magic functions for FedoraDatastream class. + */ class IslandoraFedoraDatastream extends FedoraDatastream { protected $fedoraRelsIntClass = 'IslandoraFedoraRelsInt'; protected $fedoraDatastreamVersionClass = 'IslandoraFedoraDatastreamVersion'; @@ -610,20 +644,29 @@ class IslandoraFedoraDatastream extends FedoraDatastream { } catch (Exception $e) { watchdog('islandora', 'Failed to modify datastream @dsid from @pid
    code: @code
    message: @msg', array( - '@pid' => $this->parent->id, - '@dsid' => $this->id, - '@code' => $e->getCode(), - '@msg' => $e->getMessage()), WATCHDOG_ERROR); + '@pid' => $this->parent->id, + '@dsid' => $this->id, + '@code' => $e->getCode(), + '@msg' => $e->getMessage(), + ), WATCHDOG_ERROR); throw $e; } } -} +} +/** + * Implementation of FedoraDatastreamVersion class. + */ class IslandoraFedoraDatastreamVersion extends FedoraDatastreamVersion { protected $fedoraRelsIntClass = 'IslandoraFedoraRelsInt'; protected $fedoraDatastreamVersionClass = 'IslandoraFedoraDatastreamVersion'; -} +} +/** + * Implementation of FedoraRelsExt class. + */ class IslandoraFedoraRelsExt extends FedoraRelsExt {} - +/** + * Implementation of FedoraRelsInt class. + */ class IslandoraFedoraRelsInt extends FedoraRelsInt {} diff --git a/includes/utilities.inc b/includes/utilities.inc index dcbaab021..b14053304 100644 --- a/includes/utilities.inc +++ b/includes/utilities.inc @@ -13,7 +13,7 @@ * XXX: Shouldn't Drupal's format_size() be preferred? * * @param int $bytes - * Size in bytes to convert + * Size in bytes to convert. * @param int $precision * The amount of decimal precision to show. * @@ -175,8 +175,6 @@ function islandora_describe_repository($url = NULL) { * as MODULE_REFINEMENT_HOOK. Any additional arguments passed to this function * will be passed as arguments to module_invoke_all(). * - * @see islandora_build_hook_list() - * * @param string $hook * A hook to call. * @param array $refinements @@ -188,6 +186,8 @@ function islandora_describe_repository($url = NULL) { * * @return array * The merged results from all the hooks. + * + * @see islandora_build_hook_list() */ function islandora_invoke_hook_list($hook, array $refinements, array $args) { $return = array(); @@ -229,7 +229,7 @@ function islandora_invoke_hook_list($hook, array $refinements, array $args) { * An array with each refinement escaped and concatenated with the base hook * name, in addition to the base hook name. */ -function islandora_build_hook_list($hook, $refinements = array()) { +function islandora_build_hook_list($hook, array $refinements = array()) { $refinements = array_unique($refinements); $hooks = array($hook); foreach ($refinements as $refinement) { @@ -333,7 +333,7 @@ function islandora_get_parents_from_rels_ext(AbstractObject $object) { // @todo some logging would be nice, not sure what this throws. return array(); } - $map = function($o) { + $map = function ($o) { return islandora_object_load($o['object']['value']); }; $collections = array_map($map, $collections); @@ -484,7 +484,11 @@ function islandora_get_datastreams_requirements_from_content_model(AbstractObjec * @return NewFedoraObject * An ingestable NewFedoraObject. */ -function islandora_prepare_new_object($name_source = NULL, $label = NULL, $datastreams = array(), $content_models = array(), $relationships = array()) { +function islandora_prepare_new_object($name_source = NULL, + $label = NULL, + array $datastreams = array(), + array $content_models = array(), + array $relationships = array()) { global $user; $tuque = islandora_get_tuque_connection(); $object = isset($name_source) ? $tuque->repository->constructObject($name_source) : new IslandoraNewFedoraObject(NULL, $tuque->repository); @@ -500,7 +504,7 @@ function islandora_prepare_new_object($name_source = NULL, $label = NULL, $datas $dsid = $ds['dsid']; $label = isset($ds['label']) ? $ds['label'] : ''; $mimetype = isset($ds['mimetype']) ? $ds['mimetype'] : 'text/xml'; - // Default 'Managed' + // Default 'Managed'. $control_group = 'M'; $groups = array('X', 'M', 'R', 'E'); if (isset($ds['control_group']) && in_array($ds['control_group'], $groups)) { @@ -733,16 +737,16 @@ function islandora_get_content_models($ignore_system_namespace = TRUE) { * Returns Drupal tableselect element allowing selection of Content Models. * * @param string $drupal_variable - * the name of the Drupal variable holding selected content models + * The name of the Drupal variable holding selected content models * Content models held in this variable will appear at the top of - * the displayed list + * the displayed list. * @param array $default_values_array - * default values to display if $drupal_variable is unset + * Default values to display if $drupal_variable is unset. * * @return array * Drupal form element allowing content model selection */ -function islandora_content_model_select_table_form_element($drupal_variable, $default_values_array = array('')) { +function islandora_content_model_select_table_form_element($drupal_variable, array $default_values_array = array('')) { $defaults = array(); $rows = array(); $content_models = array(); @@ -835,7 +839,7 @@ function islandora_deprecated($release, $solution = NULL) { * of strings, which we transform to renderable markup elements (by * reference). */ -function islandora_as_renderable_array(&$markup_array) { +function islandora_as_renderable_array(array &$markup_array) { foreach ($markup_array as &$value) { if (!is_array($value)) { // Not a renderable array, just a string. Let's convert it to a diff --git a/islandora.api.php b/islandora.api.php index 1cdb92051..35c2eaf3c 100644 --- a/islandora.api.php +++ b/islandora.api.php @@ -1,4 +1,5 @@ models)) { $resource_url = url("islandora/object/{$object->id}/datastream/OBJ/view"); @@ -30,7 +31,8 @@ function hook_islandora_view_object($object, $user, $page_number, $page_size) { // Theme the image seperatly. $variables['islandora_img'] = theme('image', $params); $output = theme('islandora_default_print', array( - 'islandora_content' => $variables['islandora_img'])); + 'islandora_content' => $variables['islandora_img'], + )); } return $output; } @@ -52,13 +54,15 @@ function hook_islandora_view_print_object($object) { * create the hook name. * * @param AbstractObject $object - * A Tuque FedoraObject + * A Tuque FedoraObject. * * @return array * An array whose values are markup. */ -function hook_cmodel_pid_islandora_view_object($object) { - +function hook_cmodel_pid_islandora_view_object(AbstractObject $object) { + $output = array(); + // See hook_islandora_view_object(). + return $output; } /** @@ -69,21 +73,21 @@ function hook_cmodel_pid_islandora_view_object($object) { * @param array $rendered * The array of rendered views. */ -function hook_islandora_view_object_alter(&$object, &$rendered) { +function hook_islandora_view_object_alter(AbstractObject &$object, array &$rendered) { } /** * Alter display output if the object has the given model. * - * @see hook_islandora_view_object_alter() - * * @param AbstractObject $object * A Tuque AbstractObject being operated on. * @param array $rendered * The array of rendered views. + * + * @see hook_islandora_view_object_alter() */ -function hook_cmodel_pid_islandora_view_object_alter(&$object, &$rendered) { +function hook_cmodel_pid_islandora_view_object_alter(AbstractObject &$object, array &$rendered) { } @@ -91,13 +95,15 @@ function hook_cmodel_pid_islandora_view_object_alter(&$object, &$rendered) { * Generate an object's datastreams management display. * * @param AbstractObject $object - * A Tuque FedoraObject + * A Tuque FedoraObject. * * @return array * An array whose values are markup. */ -function hook_islandora_edit_object($object) { - +function hook_islandora_edit_object(AbstractObject $object) { + $output = array(); + // Not sure if there is an implementation of this hook. + return $output; } /** @@ -107,24 +113,27 @@ function hook_islandora_edit_object($object) { * create the hook name. * * @param AbstractObject $object - * A Tuque FedoraObject + * A Tuque FedoraObject. * * @return array * An array whose values are markup. + * + * @see hook_islandora_edit_object() */ -function hook_cmodel_pid_islandora_edit_object($object) { - +function hook_cmodel_pid_islandora_edit_object(AbstractObject $object) { + $output = array(); + return $output; } /** * Allow datastreams management display output to be altered. * * @param AbstractObject $object - * A Tuque FedoraObject + * A Tuque FedoraObject. * @param array $rendered - * an arr of rendered views + * An array of rendered views. */ -function hook_islandora_edit_object_alter(&$object, &$rendered) { +function hook_islandora_edit_object_alter(AbstractObject &$object, array &$rendered) { } @@ -227,12 +236,12 @@ function hook_cmodel_pid_dsid_islandora_datastream_alter(AbstractObject $object, * This hook is called after an object has been successfully ingested via a * FedoraRepository object. * + * @param AbstractObject $object + * The object that was ingested. + * * @note * If ingested directly via the FedoraApiM object this will not be called as we * don't have access to the ingested object at that time. - * - * @param AbstractObject $object - * The object that was ingested. */ function hook_islandora_object_ingested(AbstractObject $object) { @@ -301,14 +310,14 @@ function hook_cmodel_pid_islandora_object_purged($pid) { * * This hook is called after the datastream has been successfully ingested. * - * @note - * If ingested directly via the FedoraApiM object this will not be called as we - * don't have access to the ingested datastream at that time. - * * @param AbstractObject $object * The object the datastream belongs to. * @param AbstractDatastream $datastream * The ingested datastream. + * + * @note + * If ingested directly via the FedoraApiM object this will not be called as we + * don't have access to the ingested datastream at that time. */ function hook_islandora_datastream_ingested(AbstractObject $object, AbstractDatastream $datastream) { @@ -394,7 +403,7 @@ function hook_cmodel_pid_dsid_islandora_datastream_purged(AbstractObject $object * - name: A string containg a human-readable name for the entry. * - url: A string containing the URL to which to the user will be routed. */ -function hook_islandora_edit_datastream_registry($object, $dsid) { +function hook_islandora_edit_datastream_registry(AbstractObject $object, $dsid) { $routes = array(); $routes[] = array( 'name' => t('My Awesome Edit Route'), @@ -451,7 +460,7 @@ function hook_islandora_undeletable_datastreams(array $models) { * * @param array $form_state * An array containing the form_state, on which infomation from step storage - * might be extracted. Note that the + * might be extracted. * * @return array * An associative array of associative arrays which define each step in the @@ -511,7 +520,6 @@ function hook_islandora_ingest_steps(array $form_state) { * * @param array $steps * An array of steps as generated by hook_islandora_ingest_steps(). - * * @param array $form_state * An array containing the Drupal form_state. */ @@ -538,7 +546,6 @@ function hook_cmodel_pid_islandora_ingest_steps(array $form_state) { * * @param array $steps * An array of steps as generated by hook_islandora_ingest_steps(). - * * @param array $form_state * An array containing the Drupal form_state. */ @@ -557,13 +564,13 @@ function hook_cmodel_pid_islandora_ingest_steps_alter(array &$steps, array &$for * @param object $user * A loaded user object, as the global $user variable might contain. * - * @return bool|NULL|array + * @return bool|null|array * Either boolean TRUE or FALSE to explicitly allow or deny the operation on * the given object, or NULL to indicate that we are making no assertion * about the outcome. Can also be an array containing multiple * TRUE/FALSE/NULLs, due to how hooks work. */ -function hook_islandora_object_access($op, $object, $user) { +function hook_islandora_object_access($op, AbstractObject $object, $user) { switch ($op) { case 'create stuff': return TRUE; @@ -596,13 +603,13 @@ function hook_cmodel_pid_islandora_object_access($op, $object, $user) { * @param object $user * A loaded user object, as the global $user variable might contain. * - * @return bool|NULL|array + * @return bool|null|array * Either boolean TRUE or FALSE to explicitly allow or deny the operation on * the given object, or NULL to indicate that we are making no assertion * about the outcome. Can also be an array containing multiple * TRUE/FALSE/NULLs, due to how hooks work. */ -function hook_islandora_datastream_access($op, $object, $user) { +function hook_islandora_datastream_access($op, AbstractDatastream $object, $user) { switch ($op) { case 'create stuff': return TRUE; @@ -664,7 +671,7 @@ function hook_cmodel_pid_islandora_overview_object_alter(AbstractObject &$object * hierarchy. * * @param AbstractObject $object - * Optional object to which derivatives will be added + * Optional object to which derivatives will be added. * @param array $ds_modified_params * An array that will contain the properties changed on the datastream if * derivatives were triggered from a datastream_modified hook, as well as a @@ -703,7 +710,7 @@ function hook_cmodel_pid_islandora_overview_object_alter(AbstractObject &$object * - file: A string denoting the path to the file where the function * is being called from. */ -function hook_islandora_derivative(AbstractObject $object = NULL, $ds_modified_params = array()) { +function hook_islandora_derivative(AbstractObject $object = NULL, array $ds_modified_params = array()) { $derivatives[] = array( 'source_dsid' => 'OBJ', 'destination_dsid' => 'DERIV', @@ -777,7 +784,7 @@ function hook_cmodel_pid_islandora_derivative_alter() { * Retrieves PIDS of related objects for property updating. * * @param AbstractObject $object - * AbstractObject representing deleted object + * AbstractObject representing deleted object. */ function hook_islandora_update_related_objects_properties(AbstractObject $object) { $related_objects = get_all_children_siblings_and_friends($object); @@ -796,9 +803,9 @@ function hook_islandora_update_related_objects_properties(AbstractObject $object * @param string $context * Where the alter is originating from for distinguishing. * @param AbstractObject $object - * (Optional) AbstractObject representing object providing breadcrumb path + * (Optional) AbstractObject representing object providing breadcrumb path. */ -function hook_islandora_breadcrumbs_alter(&$breadcrumbs, $context, $object = NULL) { +function hook_islandora_breadcrumbs_alter(array &$breadcrumbs, $context, AbstractObject $object = NULL) { } @@ -883,7 +890,7 @@ function hook_islandora_get_breadcrumb_query_predicates() { * - original_edit_registry: The original edit_registry prior to any * modifications. */ -function hook_islandora_edit_datastream_registry_alter(&$edit_registry, $context) { +function hook_islandora_edit_datastream_registry_alter(array &$edit_registry, array $context) { // Example: Remove xml form builder edit registry. if (isset($edit_registry['xml_form_builder_edit_form_registry'])) { unset($edit_registry['xml_form_builder_edit_form_registry']); @@ -951,7 +958,6 @@ function callback_islandora_breadcrumbs_backends(AbstractObject $object) { * * @param string $filename * The filename being created. - * * @param AbstractDatastream $datastream * The datastream object being downloaded. */ diff --git a/islandora.module b/islandora.module index 337212e8e..a72f4fb7c 100644 --- a/islandora.module +++ b/islandora.module @@ -4,7 +4,7 @@ * @file * Defines all the hooks this module implements. * - * islandora.module: defines paths (drupal menu items) as entry points and acts + * Islandora.module: defines paths (drupal menu items) as entry points and acts * as a hub for dispatching tasks to other modules. * * This file is part of Islandora. @@ -76,7 +76,7 @@ const ISLANDORA_BREADCRUMB_LEGACY_BACKEND = 'islandora_breadcrumbs_legacy_sparql * Implements hook_menu(). * * We need some standard entry points so we can have consistent urls for - * different Object actions + * different Object actions. */ function islandora_menu() { $items = array(); @@ -190,7 +190,8 @@ function islandora_menu() { ISLANDORA_ADD_DS, ISLANDORA_PURGE, ISLANDORA_INGEST, - ), 2), + ), 2, + ), ); $items['islandora/object/%islandora_object/manage/overview'] = array( 'title' => 'Overview', @@ -208,7 +209,8 @@ function islandora_menu() { ISLANDORA_METADATA_EDIT, ISLANDORA_ADD_DS, ISLANDORA_PURGE, - ), 2), + ), 2, + ), 'weight' => -10, ); $items['islandora/object/%islandora_object/manage/properties'] = array( @@ -437,7 +439,7 @@ function islandora_admin_paths() { * The theme entries 'islandora_objects' and 'islandora_objects_subset' * utilize the same template file. When theming, be sure to utilize the theme * name, and not the template file names. Similar situation found here: - * @link https://jira.duraspace.org/browse/ISLANDORA-934. @endlink + * @link https://jira.duraspace.org/browse/ISLANDORA-934. @endlink. */ function islandora_theme() { return array( @@ -722,7 +724,7 @@ function islandora_print_object(AbstractObject $object) { * FALSE if 'islandora_show_print_option' is not selected in islandora * configuraton. */ -function islandora_print_object_access($op, $object) { +function islandora_print_object_access($op, AbstractObject $object) { if (!variable_get('islandora_show_print_option', FALSE)) { return FALSE; } @@ -750,8 +752,6 @@ function islandora_forms($form_id) { * Will check the given user or the user repersented by the GET token parameter, * failing that it will use the global user. * - * @global $user - * * @param mixed $object_or_datastream * The AbstractObject or AbstractDatastream to test for accessibility, if NULL * is given the object is assumed to not exist or be inaccessible. @@ -768,11 +768,13 @@ function islandora_forms($form_id) { * a token to restore the user. If no GET parameter is present use currently * logged in user. * + * @global $user + * * @return bool * TRUE if the user is allowed to access this object/datastream, FALSE * otherwise. */ -function islandora_user_access($object_or_datastream, array $permissions, $content_models = array(), $access_any = TRUE, $user = NULL) { +function islandora_user_access($object_or_datastream, array $permissions, array $content_models = array(), $access_any = TRUE, $user = NULL) { module_load_include('inc', 'islandora', 'includes/utilities'); $is_repository_accessible = &drupal_static(__FUNCTION__); @@ -860,11 +862,11 @@ function islandora_user_access($object_or_datastream, array $permissions, $conte * Checks whether the user can access the given object. * * Checks for object existance, accessiblitly, namespace permissions, - * and user permissions + * and user permissions. * * @param string $perm * User permission to test for. - * @param AbstractObject $object + * @param AbstractObject|string $object * The object to test, if NULL given the object doesn't exist or is * inaccessible. * @@ -914,7 +916,7 @@ function islandora_object_datastream_tokened_access_callback($perm, $object = NU * Checks whether the user can access the given object's manage tab. * * Checks for object existance, accessiblitly, namespace permissions, - * and user permissions + * and user permissions. * * @param array $perms * Array of user permission to test for. @@ -925,7 +927,7 @@ function islandora_object_datastream_tokened_access_callback($perm, $object = NU * @return bool * TRUE if the user is allowed to access this object, FALSE otherwise. */ -function islandora_object_manage_access_callback($perms, $object = NULL) { +function islandora_object_manage_access_callback(array $perms, AbstractObject $object = NULL) { module_load_include('inc', 'islandora', 'includes/utilities'); if (!$object && !islandora_describe_repository()) { @@ -1140,7 +1142,7 @@ function islandora_drupal_title(AbstractObject $object) { * @return array * The default rendering of the object view page, indexed at 'Default output'. */ -function islandora_default_islandora_view_object($object) { +function islandora_default_islandora_view_object(AbstractObject $object) { $output = theme('islandora_default', array('islandora_object' => $object)); return array('Default output' => array('#markup' => $output)); } @@ -1156,7 +1158,7 @@ function islandora_default_islandora_view_object($object) { * @return array * A renderable array */ -function islandora_default_islandora_printer_object($object, $alter) { +function islandora_default_islandora_printer_object(AbstractObject $object, $alter) { module_load_include('inc', 'islandora', 'includes/utilities'); module_load_include('inc', 'islandora', 'includes/datastream'); module_load_include('inc', 'islandora', 'includes/metadata'); @@ -1165,11 +1167,10 @@ function islandora_default_islandora_printer_object($object, $alter) { drupal_add_css($path . '/css/islandora.print.css'); $islandora_object = islandora_object_load($object->id); - $repository = $islandora_object->repository; try { $dc = $islandora_object['DC']->content; - $dc_object = DublinCore::importFromXMLString($dc); + $dc_object = DublinCore::importFromXmlString($dc); } catch (Exception $e) { drupal_set_message(t('Error retrieving object %s %t', array('%s' => $islandora_object->id, '%t' => $e->getMessage())), 'error', FALSE); @@ -1180,7 +1181,8 @@ function islandora_default_islandora_printer_object($object, $alter) { 'object' => $object, 'dc_array' => $variables, 'metadata' => $metadata, - 'islandora_content' => $alter)); + 'islandora_content' => $alter, + )); return array('Default output' => array('#markup' => $output)); } @@ -1277,7 +1279,7 @@ function islandora_object_load($object_id) { * @return FedoraObject * A token authenticated object. @see islandora_object_load */ -function islandora_tokened_object_load($object_id, $map) { +function islandora_tokened_object_load($object_id, array $map) { if (array_key_exists('token', $_GET)) { $token = filter_input(INPUT_GET, 'token', FILTER_SANITIZE_STRING); if ($token) { @@ -1304,7 +1306,7 @@ function islandora_tokened_object_load($object_id, $map) { * islandora_tokened_datastream_load(DSID, DSID, PID) * * @param mixed $datastream_id - * %islandora_tokened_datastream @see islandora_datastream_load + * Load datastream from %islandora_tokened_datastream. * @param array $map * Used to extract the Fedora object's PID at $map[2]. * @@ -1313,7 +1315,7 @@ function islandora_tokened_object_load($object_id, $map) { * * @see islandora_datastream_load */ -function islandora_tokened_datastream_load($datastream_id, $map) { +function islandora_tokened_datastream_load($datastream_id, array $map) { return islandora_datastream_load($datastream_id, $map[2]); } @@ -1329,8 +1331,7 @@ function islandora_tokened_datastream_load($datastream_id, $map) { * @param string $datastream_id * The DSID of the datastream specified as '%islandora_datastream' to fetch * from the given object in the menu path identified by '%islandora_object'. - * - * @param mixed $object_id + * @param AbstractObject|string $object_id * The object to load the datastream from. This can be a Fedora PID or * an instantiated IslandoraAbstractObject as it implements __toString() * returning the PID. @@ -1365,7 +1366,7 @@ function islandora_datastream_load($datastream_id, $object_id) { * @return int * The datastreams version if found, NULL otherwise. */ -function islandora_get_islandora_datastream_version($object = NULL, $dsid = NULL, $datastream_file = NULL) { +function islandora_get_islandora_datastream_version(AbstractObject $object = NULL, $dsid = NULL, $datastream_file = NULL) { $return = NULL; // @TODO, need better check for $object if ($object && $object[$dsid]) { @@ -1500,15 +1501,15 @@ function islandora_delete_object(AbstractObject &$object) { /** * Delete's or purges the given datastream. * - * @throws Exception - * Which types are undefined, but more than likely because of the hooks - * there will be several kinds. - * * @param AbstractDatastream $datastream * The datastream to delete. * * @return bool * TRUE if successful, FALSE otherwise. + * + * @throws Exception + * Which types are undefined, but more than likely because of the hooks + * there will be several kinds. */ function islandora_delete_datastream(AbstractDatastream &$datastream) { $object = $datastream->parent; @@ -1641,7 +1642,7 @@ function islandora_entity_property_info() { * Implements hook_file_mimetype_mapping_alter(). * * Grab custom Islandora mime type list - * and add any missing ext/mimes to the Drupal mapping + * and add any missing ext/mimes to the Drupal mapping. */ function islandora_file_mimetype_mapping_alter(&$mapping) { module_load_include('inc', 'islandora', 'includes/mimetype.utils'); @@ -1668,7 +1669,7 @@ function islandora_file_mimetype_mapping_alter(&$mapping) { * @param string $op * String identifying an operation to check. Should correspond to a * permission declared via hook_permission(). - * @param AbstractObject $object + * @param AbstractObject|string $object * An object to check for permissions. * @param object $user * An optional loaded user object. Defaults to the global $user. @@ -1712,7 +1713,7 @@ function islandora_object_access($op, $object, $user = NULL) { * Denies according to PID namespace restrictions, then passes or denies * according to core Drupal permissions according to user_access(). */ -function islandora_islandora_object_access($op, $object, $user) { +function islandora_islandora_object_access($op, AbstractObject $object, $user) { module_load_include('inc', 'islandora', 'includes/utilities'); $access = (islandora_namespace_accessible($object->id) && user_access($op, $user)); if (($object->state != 'A') && variable_get('islandora_deny_inactive_and_deleted', FALSE)) { @@ -2003,7 +2004,7 @@ function islandora_islandora_datastream_access($op, AbstractDatastream $datastre * Access for submenu items. * * @param string $package_name - * Name of the package + * Name of the package. * * @return bool * Access granted @@ -2217,7 +2218,7 @@ function islandora_islandora_breadcrumbs_backends() { } /** - * Implements hook_islandora_solution_pack_child_relationships + * Implements hook_islandora_solution_pack_child_relationships(). */ function islandora_islandora_solution_pack_child_relationships($cmodels) { // Return empty arrays from core implementation so that these keys always diff --git a/islandora.rules.inc b/islandora.rules.inc index 2ebaa5191..569efff43 100644 --- a/islandora.rules.inc +++ b/islandora.rules.inc @@ -2,7 +2,7 @@ /** * @file - * Does rule type stuff, + * Does rule type stuff,. */ /** @@ -158,7 +158,6 @@ function islandora_rules_base_xpath_parameters() { ); } - /** * Implements hook_rules_condition_info(). */ @@ -397,7 +396,7 @@ function islandora_rules_datastream_load_domxpath($string) { * A loaded Drupal taxonomy vocabulary object, in which terms are understood * to be namespace prefixes and descriptions are the namespace URIs. */ -function islandora_rules_datastream_load_namespace_vocab($xpath, $xpath_vocab) { +function islandora_rules_datastream_load_namespace_vocab(DOMXPath $xpath, $xpath_vocab) { foreach (taxonomy_get_tree($xpath_vocab->vid, 0, 1, FALSE) as $term) { $xpath->registerNamespace($term->name, $term->description); } @@ -499,7 +498,7 @@ function islandora_rules_data_info() { * The object on which to set the property, described by $info['property']. * @param array $options * An array of options... Not sure how it's used? Not touched by us, in any - * case. :P + * case. :P. * @param string $name * The name of the property to set, as used by Rules. * @param string $type @@ -510,7 +509,7 @@ function islandora_rules_data_info() { * - property: A string indicate the actual property on the $data we wish to * set. */ -function islandora_rules_property_get($data, array $options, $name, $type, $info) { +function islandora_rules_property_get($data, array $options, $name, $type, array $info) { return $data->$info['property']; } @@ -536,7 +535,7 @@ function islandora_rules_property_get($data, array $options, $name, $type, $info * - property: A string indicate the actual property on the $data we wish to * set. */ -function islandora_rules_property_set(&$data, $name, $value, $langcode, $type, $info) { +function islandora_rules_property_set(&$data, $name, $value, $langcode, $type, array $info) { $data->$info['property'] = $value; } diff --git a/tests/authtokens.test b/tests/authtokens.test index 352689e2e..4f52c1ec4 100644 --- a/tests/authtokens.test +++ b/tests/authtokens.test @@ -5,6 +5,9 @@ * Test Authentication Tokens. */ +/** + * Auth token tests. + */ class IslandoraAuthtokensTestCase extends IslandoraWebTestCase { /** @@ -18,13 +21,6 @@ class IslandoraAuthtokensTestCase extends IslandoraWebTestCase { ); } - /** - * Set up data for the tests. - */ - public function setUp() { - parent::setUp(); - } - /** * Test redeeming invalid tokens. */ @@ -107,4 +103,5 @@ class IslandoraAuthtokensTestCase extends IslandoraWebTestCase { public function testTokenedViewDatastreamWithXacml() { // We need to add this test. } + } diff --git a/tests/datastream_cache.test b/tests/datastream_cache.test index 8118c08a2..42c37e880 100644 --- a/tests/datastream_cache.test +++ b/tests/datastream_cache.test @@ -5,6 +5,9 @@ * Tests to verify the cache headers we provide. */ +/** + * Datastream caching tests. + */ class IslandoraDatastreamCacheTestCase extends IslandoraWebTestCase { /** @@ -134,7 +137,7 @@ class IslandoraDatastreamCacheTestCase extends IslandoraWebTestCase { )); $this->assertResponse(200); - // Test combination of If-None-Match and If-Modified-Since + // Test combination of If-None-Match and If-Modified-Since. $result = $this->drupalGet("islandora/object/{$object->id}/datastream/{$datastream->id}/view", array(), array( 'If-Modified-Since: ' . $datastream->createdDate->format('D, d M Y H:i:s \G\M\T'), format_string('If-None-Match: "!checksum"', array( @@ -157,4 +160,5 @@ class IslandoraDatastreamCacheTestCase extends IslandoraWebTestCase { )); $this->assertResponse(200); } + } diff --git a/tests/datastream_validator_tests.test b/tests/datastream_validator_tests.test index 40615ae4f..d0176485d 100644 --- a/tests/datastream_validator_tests.test +++ b/tests/datastream_validator_tests.test @@ -1,4 +1,5 @@ addResult(FALSE, 'boo you failed', $this->getAssertionCall()); } + } /** @@ -109,8 +111,8 @@ class DatastreamValidatorResultTestCase extends IslandoraWebTestCase { $this->assertTrue(substr($first_caller['file'], -48) === substr($second_caller['file'], -48), "Fail caller file matches the pass caller file.", 'Islandora'); $this->assertTrue($first_caller['function'] === 'TestDatastreamValidator->assertSomethingSuccessfully()', "Correct pass caller function returned (actual: {$first_caller['function']}; expected: TestDatastreamValidator->assertSomethingSuccessfully()).", 'Islandora'); $this->assertTrue($second_caller['function'] === 'TestDatastreamValidator->assertSomethingFailed()', "Correct fail caller function returned (actual: {$second_caller['function']}; expected: TestDatastreamValidator->assertSomethingFailed()).", 'Islandora'); - $this->assertTrue($first_caller['line'] === 16, "Correct pass line number returned (actual: {$first_caller['line']}; expected: 16).", 'Islandora'); - $this->assertTrue($second_caller['line'] === 23, "Correct fail line number returned (actual: {$second_caller['line']}; expected: 23).", 'Islandora'); + $this->assertTrue($first_caller['line'] === 17, "Correct pass line number returned (actual: {$first_caller['line']}; expected: 17).", 'Islandora'); + $this->assertTrue($second_caller['line'] === 24, "Correct fail line number returned (actual: {$second_caller['line']}; expected: 24).", 'Islandora'); } } @@ -222,7 +224,7 @@ class PrefixDatastreamValidatorTestCase extends IslandoraWebTestCase { 'dsid' => $prefix, 'path' => $this->path . $filename, 'control_group' => 'M', - ), + ), ); $object = $this->ingestConstructedObject(array(), $datastreams); return $object; @@ -273,4 +275,5 @@ class PrefixDatastreamValidatorTestCase extends IslandoraWebTestCase { } } } + } diff --git a/tests/datastream_versions.test b/tests/datastream_versions.test index 6b22bd95e..6d5ffb59a 100644 --- a/tests/datastream_versions.test +++ b/tests/datastream_versions.test @@ -2,9 +2,12 @@ /** * @file - * Tests that datastream versions code works as intended + * Tests that datastream versions code works as intended. */ +/** + * Datastream version tests. + */ class IslandoraDatastreamVersionTestCase extends IslandoraWebTestCase { /** @@ -195,4 +198,5 @@ class IslandoraDatastreamVersionTestCase extends IslandoraWebTestCase { $this->drupalGet("islandora/object/{$this->pid}/datastream/DC/version/0/delete"); $this->assertResponse(404); } + } diff --git a/tests/derivatives.test b/tests/derivatives.test index 95377a758..bba83b2f0 100644 --- a/tests/derivatives.test +++ b/tests/derivatives.test @@ -11,6 +11,9 @@ * To make sense of these tests reference islandora_derivatives_test.module. */ +/** + * Derivative hook tests. + */ class IslandoraDerivativesTestCase extends IslandoraWebTestCase { /** @@ -93,8 +96,8 @@ class IslandoraDerivativesTestCase extends IslandoraWebTestCase { global $_islandora_derivative_test_ingest_method; $_islandora_derivative_test_ingest_method = 'ingestDatastream'; $object = $this->constructBaseObject(); - $object = $this->constructDERIVDatastream($object); - $this->constructNOSOURCEDatastream($object); + $object = $this->constructDerivDatastream($object); + $this->constructNoSourceDatastream($object); $islandora_object = islandora_object_load($this->pid); islandora_do_derivatives($islandora_object, array( 'force' => TRUE, @@ -125,7 +128,7 @@ class IslandoraDerivativesTestCase extends IslandoraWebTestCase { global $_islandora_derivative_test_ingest_method; $_islandora_derivative_test_ingest_method = 'ingestDatastream'; $object = $this->constructBaseObject(); - $this->constructDERIVDatastream($object); + $this->constructDerivDatastream($object); // Need to do this as Tuque caches. $connection = islandora_get_tuque_connection(); $connection->cache->resetCache(); @@ -156,11 +159,11 @@ class IslandoraDerivativesTestCase extends IslandoraWebTestCase { /** * Tests derivative hook filtering based upon source_dsid. */ - public function testDerivativeFilteringOnSourceDSID() { + public function testDerivativeFilteringOnSourceDsid() { global $_islandora_derivative_test_derivative_functions; $_islandora_derivative_test_derivative_functions = array(); $object = $this->constructBaseObject(); - $this->constructSOMEWEIRDDATASTREAMDatastream($object); + $this->constructSomeWeirdDatastream($object); $object = islandora_object_load($this->pid); islandora_do_derivatives($object, array( 'source_dsid' => 'OBJ', @@ -182,7 +185,7 @@ class IslandoraDerivativesTestCase extends IslandoraWebTestCase { /** * Tests that only functions were the source_dsid is NULL are fired. */ - public function testNULLSourceDSID() { + public function testNullSourceDsid() { global $_islandora_derivative_test_derivative_functions; $_islandora_derivative_test_derivative_functions = array(); $this->constructBaseObject(); @@ -205,11 +208,11 @@ class IslandoraDerivativesTestCase extends IslandoraWebTestCase { /** * Tests that when no source_dsid all derivative functions are called. */ - public function testNoSourceDSIDNoForce() { + public function testNoSourceDsidNoForce() { global $_islandora_derivative_test_derivative_functions; $_islandora_derivative_test_derivative_functions = array(); $object = $this->constructBaseObject(); - $object = $this->constructSOMEWEIRDDATASTREAMDatastream($object); + $object = $this->constructSomeWeirdDatastream($object); $object = islandora_object_load($this->pid); islandora_do_derivatives($object, array()); $this->assertDatastreams($object, array( @@ -227,11 +230,11 @@ class IslandoraDerivativesTestCase extends IslandoraWebTestCase { /** * Tests that when no source_dsid all derivative functions are called. */ - public function testNoSourceDSIDForce() { + public function testNoSourceDsidForce() { global $_islandora_derivative_test_derivative_functions; $_islandora_derivative_test_derivative_functions = array(); $object = $this->constructBaseObject(); - $this->constructSOMEWEIRDDATASTREAMDatastream($object); + $this->constructSomeWeirdDatastream($object); $object = islandora_object_load($this->pid); islandora_do_derivatives($object, array( 'force' => TRUE, @@ -290,7 +293,7 @@ class IslandoraDerivativesTestCase extends IslandoraWebTestCase { * @return AbstractObject * The modified AbstractObject. */ - public function constructDERIVDatastream(AbstractObject $object) { + public function constructDerivDatastream(AbstractObject $object) { $dsid = 'DERIV'; $ds = $object->constructDatastream($dsid); $ds->label = 'Test'; @@ -308,7 +311,7 @@ class IslandoraDerivativesTestCase extends IslandoraWebTestCase { * @return AbstractObject * The modified AbstractObject. */ - public function constructNOSOURCEDatastream(AbstractObject $object) { + public function constructNoSourceDatastream(AbstractObject $object) { $dsid = 'NOSOURCE'; $ds = $object->constructDatastream($dsid); $ds->label = 'Test'; @@ -326,7 +329,7 @@ class IslandoraDerivativesTestCase extends IslandoraWebTestCase { * @return AbstractObject * The modified AbstractObject. */ - public function constructSOMEWEIRDDATASTREAMDatastream(AbstractObject $object) { + public function constructSomeWeirdDatastream(AbstractObject $object) { $dsid = 'SOMEWEIRDDATASTREAM'; $ds = $object->constructDatastream($dsid); $ds->label = 'Test'; @@ -334,4 +337,5 @@ class IslandoraDerivativesTestCase extends IslandoraWebTestCase { $object->ingestDatastream($ds); return $object; } + } diff --git a/tests/hooked_access.test b/tests/hooked_access.test index 894eee803..f2a90a9ae 100644 --- a/tests/hooked_access.test +++ b/tests/hooked_access.test @@ -11,6 +11,9 @@ * To make sense of these tests reference islandora_hooked_access_test.module. */ +/** + * Access hook tests. + */ class IslandoraHookedAccessTestCase extends IslandoraWebTestCase { /** @@ -91,20 +94,6 @@ class IslandoraHookedAccessTestCase extends IslandoraWebTestCase { } } - /** - * Deny an object permission check without an object. - */ - public function testDenyBadObject() { - $this->assertFalse(islandora_object_access($this->op, 'this is not an object'), 'Deny bad objects.'); - } - - /** - * Deny a datastream permission check without a datastream. - */ - public function testDenyBadDatastream() { - $this->assertFalse(islandora_datastream_access($this->op, 'this is not a datastream'), 'Deny bad datastreams.'); - } - /** * Allow operation on object. */ @@ -146,4 +135,5 @@ class IslandoraHookedAccessTestCase extends IslandoraWebTestCase { public function testDenyDatastreamExplicit() { $this->assertFalse(islandora_datastream_access($this->denied_op, $this->object['asdf']), 'Explicit denial of datastream access.'); } + } diff --git a/tests/hooks.test b/tests/hooks.test index 073d03491..1e35b9626 100644 --- a/tests/hooks.test +++ b/tests/hooks.test @@ -11,6 +11,9 @@ * To make sense of these tests reference islandora_hooks_test.module. */ +/** + * Islandora hooks tests. + */ class IslandoraHooksTestCase extends IslandoraWebTestCase { /** @@ -256,4 +259,5 @@ class IslandoraHooksTestCase extends IslandoraWebTestCase { $this->assert($_SESSION['islandora_hooks']['hook'][ISLANDORA_DATASTREAM_INGESTED_HOOK], 'Called ISLANDORA_DATASTREAM_INGESTED_HOOK when ingesting via FedoraObject::ingestDatastream.'); $this->repository->purgeObject($object->id); } + } diff --git a/tests/includes/datastream_validators.inc b/tests/includes/datastream_validators.inc index b8ff785e6..0f29bbb9c 100644 --- a/tests/includes/datastream_validators.inc +++ b/tests/includes/datastream_validators.inc @@ -1,4 +1,5 @@ addResult(TRUE, "{$this->datastream} datastream asserts that it is a valid Intel-byte-orderded TIF/TIFF file."); } elseif ($datastream_header_hex == "4d4d002a") { @@ -248,7 +249,7 @@ class TIFFDatastreamValidator extends DatastreamValidator { * @return string * The ... thing I just wrote up there. */ - protected function getTIFFHeaderHex() { + protected function getTiffHeaderHex() { return substr(bin2hex($this->datastreamContent), 0, 8); } @@ -265,7 +266,7 @@ class JP2DatastreamValidator extends DatastreamValidator { * JP2 files begin with an offset header at the second 32-bit integer, * 0x6A502020. This header is in all .jp2s, and we check for it here. */ - protected function assertJP2Header() { + protected function assertJp2Header() { $assertion = substr(bin2hex($this->datastreamContent), 8, 8) == '6a502020'; $pass = "Datastream {$this->datastream} contains the appropriate JP2 header."; $fail = "Datastream {$this->datastream} does not contain the appropriate JP2 header."; @@ -279,13 +280,14 @@ class JP2DatastreamValidator extends DatastreamValidator { * JP2 files have their codestream capped with a marker, 0xFFD9. We're just * checking for it here to see if the .jp2 encoder finished okay. */ - protected function assertJP2Marker() { + protected function assertJp2Marker() { $assertion = substr(bin2hex($this->datastreamContent), strlen(bin2hex($this->datastreamContent)) - 4, 4) == 'ffd9'; $pass = "Datastream {$this->datastream} contains the appropriate JP2 ending marker."; $fail = "Datastream {$this->datastream} does not contain the appropriate JP2 ending marker. If this is the only JP2 validator that failed, it is likely that derivative generation was interrupted."; $message = $assertion ? $pass : $fail; $this->addResult($assertion, $message); } + } /** @@ -296,7 +298,7 @@ class PDFDatastreamValidator extends DatastreamValidator { /** * Validates the PDF signature. */ - protected function assertPDFSignature() { + protected function assertPdfSignature() { $assertion = substr($this->datastreamContent, 0, 5) == '%PDF-'; $pdf_version = substr($this->datastreamContent, 5, 3); $pass = "{$this->datastream} datastream asserts that it is a valid PDF file using PDF version {$pdf_version}"; @@ -308,7 +310,7 @@ class PDFDatastreamValidator extends DatastreamValidator { /** * Counts the number of signatures in this PDF file and asserts there are any. */ - protected function assertPDFStreamCount() { + protected function assertPdfStreamCount() { $pdf_stream_count = substr_count(bin2hex($this->datastreamContent), '0a73747265616d0a'); $assertion = $pdf_stream_count !== 0; $pass = "{$this->datastream} datastream reports the existence of {$pdf_stream_count} PDF streams. Note that an extremely low number could still indicate corruption."; @@ -319,17 +321,15 @@ class PDFDatastreamValidator extends DatastreamValidator { /** * Validates the PDF closing tag. - * - * @return bool - * TRUE if it was present; FALSE otherwise. */ - protected function assertPDFClosingTag() { + protected function assertPdfClosingTag() { $assertion = strpos(bin2hex($this->datastreamContent), '0a2525454f460a') == TRUE; $pass = "{$this->datastream} datastream reports the existence of the closing 'EOF' tag required at the end of PDFs"; $fail = "{$this->datastream} datastream does not contain the closing 'EOF' tag. If this is the only PDF validation that failed, it is likely that derivative generation was interrupted."; $message = $assertion ? $pass : $fail; $this->addResult($assertion, $message); } + } /** @@ -340,6 +340,7 @@ class PDFDatastreamValidator extends DatastreamValidator { * integer representing the number of times it should appear in the datastream. */ class TextDatastreamValidator extends DatastreamValidator { + /** * Constructor override; blow up if we don't have our two values. */ @@ -369,6 +370,7 @@ class TextDatastreamValidator extends DatastreamValidator { protected function getTextStringCount() { return substr_count($this->datastreamContent, $this->params[0]); } + } /** @@ -401,7 +403,7 @@ class WAVDatastreamValidator extends DatastreamValidator { /** * Asserts that the datastream contains a valid WAV signature. */ - protected function assertWAVSignature() { + protected function assertWavSignature() { $signatures = str_split(substr($this->datastreamContent, 0, 24), 8); $assertion = $signatures[0] == '52494646' && $signatures[2] == '57415645'; $pass = "Header of the {$this->datastream} datastream contains a valid file signature."; @@ -413,7 +415,7 @@ class WAVDatastreamValidator extends DatastreamValidator { /** * Asserts that the chunksize in the header is correct. */ - protected function assertWAVChunkSize() { + protected function assertWavChunkSize() { $assertion = islandora_hex2int(substr($this->datastreamContent, 8, 8)) === 36 + self::getDataSubChunkSize(); $pass = "{$this->datastream} datastream chunksize in WAV header is correct"; $fail = "{$this->datastream} datastream chunksize in WAV header does not match actual chunksize."; @@ -424,7 +426,7 @@ class WAVDatastreamValidator extends DatastreamValidator { /** * Asserts that the datastream contains a 'fmt' subchunk. */ - protected function assertWAVFmtSubChunk() { + protected function assertWavFmtSubChunk() { $assertion = substr($this->datastreamContent, 24, 8) === '666d7420'; $pass = "{$this->datastream} datastream contains a 'fmt' subchunk."; $fail = "{$this->datastream} datastream is missing the required 'fmt' subchunk."; @@ -435,7 +437,7 @@ class WAVDatastreamValidator extends DatastreamValidator { /** * Asserts that the byterate reported by the WAV header is valid. */ - protected function assertWAVByteRate() { + protected function assertWavByteRate() { $wav_samplerate = islandora_hex2int(substr($this->datastreamContent, 48, 8)); $assertion = islandora_hex2int(substr($this->datastreamContent, 56, 8)) === $wav_samplerate * self::getNumChannels() * self::getBytesPerSample(); $pass = "{$this->datastream} datastream byterate in the WAV header is correct."; @@ -447,7 +449,7 @@ class WAVDatastreamValidator extends DatastreamValidator { /** * Asserts that the block alignment is correct. */ - protected function assertWAVBlockAlignment() { + protected function assertWavBlockAlignment() { $assertion = islandora_hex2int(substr($this->datastreamContent, 64, 4)) === self::getNumChannels() * self::getBytesPerSample(); $pass = "{$this->datastream} datastream block alignment is set correctly."; $fail = "{$this->datastream} datastream block alignment is off."; @@ -460,7 +462,7 @@ class WAVDatastreamValidator extends DatastreamValidator { * * Also asserts that the subchunk size is correct. */ - protected function assertWAVDataSubChunk() { + protected function assertWavDataSubChunk() { if (substr($this->datastreamContent, 72, 8) !== '64617461') { $this->addResult(FALSE, "{$this->datastream} datastream is missing the 'data' subchunk."); return; @@ -505,6 +507,7 @@ class WAVDatastreamValidator extends DatastreamValidator { protected function getDataSubChunkSize() { return islandora_hex2int(substr($this->datastreamContent, 80, 8)); } + } /** @@ -526,7 +529,7 @@ class MP3DatastreamValidator extends DatastreamValidator { * breaking my own rules here and using a single assert function so that I * can handle the weird logic. */ - protected function assertValidMP3() { + protected function assertValidMp3() { $this->datastreamContent = bin2hex($this->datastreamContent); // If it's not a VBR MP3, we don't have to check much, so let's get that @@ -612,7 +615,7 @@ class MP4DatastreamValidator extends DatastreamValidator { /** * Asserts that the datastream is ISO-formatted video. */ - protected function assertISOVideo() { + protected function assertIsoVideo() { $mp4_ftyp = substr(strpos($this->datastreamContent, 'ftyp'), 4, 4); $assertion = strpos($this->datastreamContent, 'ftyp') !== 0; $pass = "{$this->datastream} datastream asserts that it is a valid ISO-formatted video file using ftyp {$mp4_ftyp}"; @@ -620,6 +623,7 @@ class MP4DatastreamValidator extends DatastreamValidator { $message = $assertion ? $pass : $fail; $this->addResult($assertion, $message); } + } /** @@ -636,7 +640,7 @@ class OGGDatastreamValidator extends DatastreamValidator { /** * Asserts that the datastream contains ogg pages. */ - protected function assertOGGPages() { + protected function assertOggPages() { $ogg_pages = substr_count($this->datastreamContent, 'OggS'); $assertion = $ogg_pages !== 0; $pass = "{$this->datastream} datastream asserts that it contains {$ogg_pages} Ogg pages (even a very small file should contain several)."; @@ -666,6 +670,7 @@ class OGGDatastreamValidator extends DatastreamValidator { $message = $assertion ? $pass : $fail; $this->addResult($assertion, $message); } + } /** @@ -683,7 +688,7 @@ class MKVDatastreamValidator extends DatastreamValidator { /** * Asserts that the datastream is an EBML-format file. */ - protected function assertEBMLFormat() { + protected function assertEbmlFormat() { $assertion = substr(bin2hex($this->datastreamContent), 0, 8) == '1a45dfa3'; $pass = "{$this->datastream} datastream asserts that it is an EBML-formatted file"; $fail = "{$this->datastream} datastream is not an EBML-formatted file."; @@ -701,4 +706,5 @@ class MKVDatastreamValidator extends DatastreamValidator { $message = $assertion ? $pass : $fail; $this->addResult($assertion, $message); } + } diff --git a/tests/includes/islandora_unit_test_case.inc b/tests/includes/islandora_unit_test_case.inc index da0a8a71f..0f06b8ae5 100644 --- a/tests/includes/islandora_unit_test_case.inc +++ b/tests/includes/islandora_unit_test_case.inc @@ -1,9 +1,13 @@ FALSE); $utilities = new IslandoraTestUtilities($this->configuration, $params); @@ -40,7 +44,7 @@ class IslandoraUnitTestCase extends DrupalUnitTestCase { * @param IslandoraTestUtilities $utility * An instance of IslandoraTestUtilities with populated results. */ - public function parseUtilityResults($utility) { + public function parseUtilityResults(IslandoraTestUtilities $utility) { foreach ($utility->getResults() as $result) { $this->assert($result->getType(), $result->getMessage(), 'Islandora', $result->getCaller()); } diff --git a/tests/includes/islandora_web_test_case.inc b/tests/includes/islandora_web_test_case.inc index 5e4224188..57b0995a7 100644 --- a/tests/includes/islandora_web_test_case.inc +++ b/tests/includes/islandora_web_test_case.inc @@ -5,6 +5,9 @@ * Defines the class IslandoraWebTestCase, which allows tests to access Fedora. */ +/** + * Islandora specific state for WebTestCase. + */ class IslandoraWebTestCase extends DrupalWebTestCase { /** @@ -43,7 +46,7 @@ class IslandoraWebTestCase extends DrupalWebTestCase { * @return bool * TRUE if the result was a pass, or FALSE otherwise. */ - public function __call($method, $args) { + public function __call($method, array $args) { module_load_include('inc', 'islandora', 'tests/includes/utilities'); $params = array( 'logged_in_user' => $this->loggedInUser, @@ -65,7 +68,7 @@ class IslandoraWebTestCase extends DrupalWebTestCase { * @param IslandoraTestUtilities $utility * An instance of IslandoraTestUtilities with populated results. */ - public function parseUtilityResults($utility) { + public function parseUtilityResults(IslandoraTestUtilities $utility) { foreach ($utility->getResults() as $result) { $this->assert($result->getType(), $result->getMessage(), 'Islandora', $result->getCaller()); } @@ -253,9 +256,9 @@ class IslandoraWebTestCase extends DrupalWebTestCase { * Deletes an object using the PID. This does the deletion using the UI. * * @param string $pid - * The PID of the collection to be deleted + * The PID of the collection to be deleted. * @param string $button - * The label of the first 'Delete' button + * The label of the first 'Delete' button. * @param bool $safety * If TRUE, this will only delete objects owned by users in $this->users. * @@ -284,7 +287,7 @@ class IslandoraWebTestCase extends DrupalWebTestCase { } } - /** + /* * These are a few quick helper functions to fill in a gap in the standard * DrupalWebTestCase where no function exists to test for the simple existence * or non-existence of an error. @@ -373,8 +376,6 @@ class IslandoraWebTestCase extends DrupalWebTestCase { * button labels that don't have the ID we want, so that the only one left * with the correct label is the one with the right ID. * - * @see DrupalWebTestCase::drupalPost() - * * @param string $path * Location of the post form. * @param array $edit @@ -388,15 +389,17 @@ class IslandoraWebTestCase extends DrupalWebTestCase { * @param array $headers * An array containing additional HTTP request headers, each formatted as * "name: value". - * @param null $form_html_id + * @param string $form_html_id * (optional) HTML ID of the form to be submitted. - * @param null $extra_post + * @param string $extra_post * (optional) A string of additional data to append to the POST submission. * * @return bool|string * The content from the POST request's curlExec, or FALSE on fail. + * + * @see DrupalWebTestCase::drupalPost() */ - public function drupalPostByID($path, $edit, $submit, $id, array $options = array(), array $headers = array(), $form_html_id = NULL, $extra_post = NULL) { + public function drupalPostById($path, array $edit, $submit, $id, array $options = array(), array $headers = array(), $form_html_id = NULL, $extra_post = NULL) { $buttons = $this->xpath("//input[@type=\"submit\" and @value=\"{$submit}\"]"); if (empty($buttons)) { $this->fail("No buttons found on the page with value '$submit'"); diff --git a/tests/includes/test_utility_abstraction.inc b/tests/includes/test_utility_abstraction.inc index aa09004b3..dad96d921 100644 --- a/tests/includes/test_utility_abstraction.inc +++ b/tests/includes/test_utility_abstraction.inc @@ -1,4 +1,5 @@ type; } + } /** diff --git a/tests/includes/utilities.inc b/tests/includes/utilities.inc index eefae4cc0..2549d21b5 100644 --- a/tests/includes/utilities.inc +++ b/tests/includes/utilities.inc @@ -1,4 +1,5 @@ configuration = $configuration; $this->params = $params; $connection = new RepositoryConnection($this->configuration['fedora_url'], $this->configuration['admin_user'], $this->configuration['admin_pass']); @@ -111,7 +115,7 @@ class IslandoraTestUtilities extends IslandoraTestUtilityClass { * @return bool * TRUE on success, FALSE on fail. */ - public function assertDatastreams($object, array $datastreams) { + public function assertDatastreams(AbstractObject $object, array $datastreams) { if (!self::assertFedoraObject($object)) { $this->addResult(FALSE, "Failed. Object passed in is invalid.", 'Islandora'); } @@ -136,7 +140,7 @@ class IslandoraTestUtilities extends IslandoraTestUtilityClass { * @param array $datastreams * An array of datastreams to confirm not present. */ - public function assertNoDatastreams($object, array $datastreams) { + public function assertNoDatastreams(AbstractObject $object, array $datastreams) { if (!self::assertFedoraObject($object)) { $this->addResult(FALSE, "Failed. Object passed in is invalid.", 'Islandora'); return; diff --git a/tests/ingest.test b/tests/ingest.test index 173b926f9..7cc7069d1 100644 --- a/tests/ingest.test +++ b/tests/ingest.test @@ -11,6 +11,9 @@ * To make sense of these tests reference islandora_hooks_test.module. */ +/** + * Ingest tests. + */ class IslandoraIngestsTestCase extends IslandoraWebTestCase { /** diff --git a/tests/islandora_derivatives_test.module b/tests/islandora_derivatives_test.module index 91ef8fefa..a703b82f4 100644 --- a/tests/islandora_derivatives_test.module +++ b/tests/islandora_derivatives_test.module @@ -71,6 +71,7 @@ function islandora_derivatives_test_some_cmodel_islandora_derivative_alter(&$der * An AbstractObject representing a Fedora object. * @param bool $force * Whether or not derivative generation is to be forced. + * * @return array * An array detailing the success of the operation. * @@ -131,6 +132,7 @@ function islandora_derivatives_test_create_stanley_datastream(AbstractObject $ob * An AbstractObject representing a Fedora object. * @param bool $force * Whether or not derivative generation is to be forced. + * * @return array * An array detailing the success of the operation. * @@ -226,13 +228,13 @@ function islandora_derivatives_test_add_datastream(AbstractObject $object, $dsid /** * Returns a message if we failed to add a derivative. * - * @see hook_islandora_derivative() - * * @param string $message * The error message to be returned back. * * @return array * An array describing the outcome of our failure. + * + * @see hook_islandora_derivative() */ function islandora_derivatives_test_failed_adding($message) { return array( diff --git a/tests/islandora_hooked_access_test.module b/tests/islandora_hooked_access_test.module index 6f5861f72..efbc29e62 100644 --- a/tests/islandora_hooked_access_test.module +++ b/tests/islandora_hooked_access_test.module @@ -2,7 +2,7 @@ /** * @file - * Hook implementations tested in hooked_access.test + * Hook implementations tested in hooked_access.test. */ /** diff --git a/tests/islandora_hooks_test.module b/tests/islandora_hooks_test.module index d602cbfd2..47ec396d4 100644 --- a/tests/islandora_hooks_test.module +++ b/tests/islandora_hooks_test.module @@ -2,7 +2,7 @@ /** * @file - * Implements hooks that get tested by islandora_hooks.test + * Implements hooks that get tested by islandora_hooks.test. */ /** @@ -112,7 +112,8 @@ function islandora_hooks_test_islandora_object_ingested(AbstractObject $object) function islandora_hooks_test_islandora_object_modified(AbstractObject $object) { if ($object->id == 'test:testModifiedObjectHook') { $_SESSION['islandora_hooks']['hook'][ISLANDORA_OBJECT_MODIFIED_HOOK] = TRUE; - if ($_SESSION['islandora_hooks']['iteration'][ISLANDORA_OBJECT_MODIFIED_HOOK]++ < 3) { + while ($_SESSION['islandora_hooks']['iteration'][ISLANDORA_OBJECT_MODIFIED_HOOK] < 3) { + $_SESSION['islandora_hooks']['iteration'][ISLANDORA_OBJECT_MODIFIED_HOOK] += 1; $new_label = 'New Label! + ' . $_SESSION['islandora_hooks']['iteration'][ISLANDORA_OBJECT_MODIFIED_HOOK]; $object->label = $new_label; } @@ -143,7 +144,8 @@ function islandora_hooks_test_islandora_datastream_ingested(AbstractObject $obje function islandora_hooks_test_islandora_datastream_modified(AbstractObject $object, AbstractDatastream $datastream, array $params) { if ($object->id == 'test:testModifiedDatastreamHook' && $datastream->id == "TEST") { $_SESSION['islandora_hooks']['hook'][ISLANDORA_DATASTREAM_MODIFIED_HOOK] = TRUE; - if ($_SESSION['islandora_hooks']['iteration'][ISLANDORA_DATASTREAM_MODIFIED_HOOK]++ < 3) { + while ($_SESSION['islandora_hooks']['iteration'][ISLANDORA_DATASTREAM_MODIFIED_HOOK] < 3) { + $_SESSION['islandora_hooks']['iteration'][ISLANDORA_DATASTREAM_MODIFIED_HOOK] += 1; $new_label = 'New Label! + ' . $_SESSION['islandora_hooks']['iteration'][ISLANDORA_DATASTREAM_MODIFIED_HOOK]; $datastream->label = $new_label; } diff --git a/tests/islandora_ingest_test.module b/tests/islandora_ingest_test.module index 8a6771d92..862818611 100644 --- a/tests/islandora_ingest_test.module +++ b/tests/islandora_ingest_test.module @@ -2,7 +2,7 @@ /** * @file - * Implements hooks that get tested by islandora_hooks.test + * Implements hooks that get tested by islandora_hooks.test. */ /** diff --git a/tests/islandora_manage_permissions.test b/tests/islandora_manage_permissions.test index e17d1501f..8d2832d60 100644 --- a/tests/islandora_manage_permissions.test +++ b/tests/islandora_manage_permissions.test @@ -5,6 +5,9 @@ * Tests islandora permissions, and permission related funcitons. */ +/** + * Permission management tests. + */ class IslandoraPermissionsTestCase extends IslandoraWebTestCase { /** @@ -133,4 +136,5 @@ class IslandoraPermissionsTestCase extends IslandoraWebTestCase { $ret = islandora_user_access($object['DC'], array(ISLANDORA_VIEW_OBJECTS), array(), TRUE, $user); $this->assertTrue($ret, 'User access granted for matching permissions, with a datastream given instead of an object.'); } + } diff --git a/tests/islandora_manage_temp_file.test b/tests/islandora_manage_temp_file.test index 65003ed88..c2f35eae8 100644 --- a/tests/islandora_manage_temp_file.test +++ b/tests/islandora_manage_temp_file.test @@ -5,6 +5,9 @@ * Tests for our islandora_temp_file_entry() function. */ +/** + * Temporary file management tests. + */ class IslandoraManageTempfileTestCase extends IslandoraWebTestCase { /** @@ -80,4 +83,5 @@ class IslandoraManageTempfileTestCase extends IslandoraWebTestCase { $this->baseFileHelper($this->tempUri); $this->baseFileHelper($this->publicUri); } + } diff --git a/tests/scripts/travis_scripts.sh b/tests/scripts/travis_scripts.sh index 5b6fa4e27..6ed1487d9 100755 --- a/tests/scripts/travis_scripts.sh +++ b/tests/scripts/travis_scripts.sh @@ -1,15 +1,43 @@ #!/bin/bash # Common checks to get run during the 'script' section in Travis. +OUTPUT=0 + +# Make OUTPUT equal return code if return code is not 0 +function checkReturn { + if [ $1 -ne 0 ]; then + OUTPUT=$1 + fi +} # Lint -find $TRAVIS_BUILD_DIR -type f \( -name '*.php' -o -name '*.inc' -o -name '*.module' -o -name '*.install' -o -name '*.test' \) -exec php -l {} \; +find $TRAVIS_BUILD_DIR -type f \( -name '*.php' -o -name '*.inc' -o -name '*.module' -o -name '*.install' -o -name '*.test' \) -print0 | xargs -0 -n1 php -l +checkReturn $? # Check line endings $ISLANDORA_DIR/tests/scripts/line_endings.sh $TRAVIS_BUILD_DIR +checkReturn $? # Coding standards -drush coder-review --reviews=production,security,style,i18n,potx,sniffer $TRAVIS_BUILD_DIR +drush coder-review --reviews=production,security,style,i18n,potx $TRAVIS_BUILD_DIR +checkReturn $? + +# Skip code sniffer for PHP 5.3.3 +if [ "$(phpenv version-name)" != "5.3.3" ]; then + # Code sniffer + if [ -d "$HOME/.composer/vendor/drupal/coder/coder_sniffer/Drupal" ]; then + DRUPAL_SNIFFS=$HOME/.composer/vendor/drupal/coder/coder_sniffer/Drupal + elif [ -d "$HOME/.config/composer/vendor/drupal/coder/coder_sniffer/Drupal" ]; then + DRUPAL_SNIFFS=$HOME/.config/composer/vendor/drupal/coder/coder_sniffer/Drupal + else + DRUPAL_SNIFFS="Drupal" + fi + /usr/bin/phpcs --standard=$DRUPAL_SNIFFS --extensions="php,module,inc,install,test" --ignore="vendor,*.info,*.txt,*.md" $TRAVIS_BUILD_DIR + checkReturn $? +fi # Copy/paste detection phpcpd --names *.module,*.inc,*.test $TRAVIS_BUILD_DIR +checkReturn $? + +exit $OUTPUT diff --git a/tests/scripts/travis_setup.sh b/tests/scripts/travis_setup.sh index db50a52dc..5e8e45432 100755 --- a/tests/scripts/travis_setup.sh +++ b/tests/scripts/travis_setup.sh @@ -25,37 +25,69 @@ export CATALINA_HOME='.' export JAVA_OPTS="-Xms1024m -Xmx1024m -XX:MaxPermSize=512m -XX:+CMSClassUnloadingEnabled -Djavax.net.ssl.trustStore=$CATALINA_HOME/fedora/server/truststore -Djavax.net.ssl.trustStorePassword=tomcat" # TODO: roll a Fedora 3.8.1 islandora_tomcat that doesn't require a rebuild. if [ $FEDORA_VERSION = "3.8.1" ]; then - export FEDORA_HOME=fedora + export FEDORA_HOME=$HOME/islandora_tomcat/fedora ./fedora/server/bin/fedora-rebuild.sh -r org.fcrepo.server.utilities.rebuild.SQLRebuilder fi ./bin/startup.sh -# Drush installation. cd $HOME -pear channel-discover pear.drush.org -pear upgrade --force Console_Getopt -pear upgrade --force pear -pear channel-discover pear.drush.org -wget http://alpha.library.yorku.ca/drush-6.3.tar.gz -tar xf drush-6.3.tar.gz -sudo mv drush-6.3 /opt/ -sudo ln -s /opt/drush-6.3/drush /usr/bin/drush -# PHPCS installation. -wget http://alpha.library.yorku.ca/PHP_CodeSniffer-1.5.6.tgz -pear install PHP_CodeSniffer-1.5.6.tgz +# Drush and PHPCS installation. +if [ "$(phpenv version-name)" == "5.3.3" ]; then + # No mod_openssl in Travis 5.3.3 boxes + composer config -g disable-tls true + composer config -g secure-http false + composer self-update + composer global require drush/drush:6.* + composer global require drupal/coder:7.* +else + composer global require drush/drush:7.* + composer global require drupal/coder +fi + +# Symlink the things +if [ -f "$HOME/.config/composer/vendor/bin/drush" ]; then + sudo ln -s $HOME/.config/composer/vendor/bin/drush /usr/bin/drush +elif [ -f "$HOME/.composer/vendor/bin/drush" ]; then + sudo ln -s $HOME/.composer/vendor/bin/drush /usr/bin/drush +else + echo "Could not find drush" + exit 1 +fi +/usr/bin/drush version + +if [ -f "$HOME/.config/composer/vendor/bin/phpcs" ]; then + sudo ln -s $HOME/.config/composer/vendor/bin/phpcs /usr/bin/phpcs +elif [ -f "$HOME/.composer/vendor/bin/phpcs" ]; then + sudo ln -s $HOME/.composer/vendor/bin/phpcs /usr/bin/phpcs +else + echo "Did not find phpcs" + exit 1 +fi +/usr/bin/phpcs --version # PHP Copy-Paste Detection installation. -wget http://alpha.library.yorku.ca/phpcpd.phar -sudo mv phpcpd.phar /usr/local/bin/phpcpd -sudo chmod +x /usr/local/bin/phpcpd +composer global require --dev sebastian/phpcpd +if [ -f "$HOME/.config/composer/vendor/bin/phpcpd" ]; then + sudo ln -s $HOME/.config/composer/vendor/bin/phpcpd /usr/local/bin/phpcpd +elif [ -f "$HOME/.composer/vendor/bin/phpcpd" ]; then + sudo ln -s $HOME/.composer/vendor/bin/phpcpd /usr/local/bin/phpcpd +else + echo "Did not find phpcpd" + exit 1 +fi +/usr/local/bin/phpcpd --version # Drupal installation. phpenv rehash drush dl --yes drupal cd drupal-* drush si minimal --db-url=mysql://drupal:drupal@localhost/drupal --yes -drush runserver --php-cgi=$HOME/.phpenv/shims/php-cgi localhost:8081 &>/tmp/drush_webserver.log & +if [ "$(phpenv version-name)" == "5.3.3" ]; then + drush runserver --php-cgi=$HOME/.phpenv/shims/php-cgi localhost:8081 &>/tmp/drush_webserver.log & +else + drush runserver localhost:8081 &>/tmp/drush_webserver.log & +fi # Add Islandora to the list of symlinked modules. ln -s $ISLANDORA_DIR sites/all/modules/islandora # Use our custom Travis test config for Simpletest. diff --git a/theme/islandora-dublin-core-description.tpl.php b/theme/islandora-dublin-core-description.tpl.php index 2ff54cdc0..3150b7e73 100644 --- a/theme/islandora-dublin-core-description.tpl.php +++ b/theme/islandora-dublin-core-description.tpl.php @@ -1,4 +1,5 @@ -
    > +
    >