diff --git a/includes/admin.form.inc b/includes/admin.form.inc index 69f09fd2..a1edde0b 100644 --- a/includes/admin.form.inc +++ b/includes/admin.form.inc @@ -61,6 +61,13 @@ function islandora_repository_admin(array $form, array &$form_state) { '#description' => t('HTTP caching can reduce network traffic, by allowing clients to used cached copies.'), '#default_value' => variable_get('islandora_use_datastream_cache_headers', TRUE), ), + 'islandora_defer_derivataves_on_ingest' => array( + '#type' => 'checkbox', + '#title' => t('Defer derivative generation during ingest'), + '#description' => t('Prevent derivatives from running during ingest, + useful if derivatives are to be created by an external service.'), + '#default_value' => variable_get('islandora_defer_derivataves_on_ingest', FALSE), + ), ), 'islandora_namespace' => array( '#type' => 'fieldset', diff --git a/islandora.install b/islandora.install index f37894e9..8f88dcdd 100644 --- a/islandora.install +++ b/islandora.install @@ -46,6 +46,7 @@ function islandora_uninstall() { // Add new variables to clean up. $variables = array( 'islandora_ds_replace_exclude_enforced', + 'islandora_defer_derivataves_on_ingest', ); array_walk($variables, 'variable_del'); } diff --git a/islandora.module b/islandora.module index 9c811611..4691028e 100644 --- a/islandora.module +++ b/islandora.module @@ -1962,3 +1962,14 @@ function islandora_menu_local_tasks_alter(&$data, $router_item, $root_path) { } } } + +/** + * Implements hook_islandora_object_alter(). + */ +function islandora_islandora_object_alter(AbstractObject $object, array &$context) { + // Prevent derivative creation during ingest if var is set. + if ($context['action'] == 'ingest' && variable_get('islandora_defer_derivataves_on_ingest', FALSE)) { + module_load_include('inc', 'islandora', 'includes/derivatives'); + islandora_set_defer_derivatives_flag($object); + } +}