|
|
@ -97,13 +97,12 @@ function islandora_regenerate_object_derivatives_form_submit(array $form, array |
|
|
|
function islandora_regenerate_object_derivatives_batch(AbstractObject $object) { |
|
|
|
function islandora_regenerate_object_derivatives_batch(AbstractObject $object) { |
|
|
|
return array( |
|
|
|
return array( |
|
|
|
'title' => t('Regenerating all derivatives for @label', array('@label' => $object->label)), |
|
|
|
'title' => t('Regenerating all derivatives for @label', array('@label' => $object->label)), |
|
|
|
'operations' => array( |
|
|
|
'operations' => islandora_do_batch_derivatives($object, array('force' => TRUE)), |
|
|
|
array('islandora_regenerate_object_derivatives_batch_operation', array($object)), |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
'init_message' => t('Preparing to regenerate derivatives...'), |
|
|
|
'init_message' => t('Preparing to regenerate derivatives...'), |
|
|
|
'progress_message' => t('Time elapsed: @elapsed <br/>Estimated time remaning @estimate.'), |
|
|
|
'progress_message' => t('Time elapsed: @elapsed <br/>Estimated time remaning @estimate.'), |
|
|
|
'error_message' => t('An error has occurred.'), |
|
|
|
'error_message' => t('An error has occurred.'), |
|
|
|
'file' => drupal_get_path('module', 'islandora') . '/includes/regenerate_derivatives.form.inc', |
|
|
|
'file' => drupal_get_path('module', 'islandora') . '/includes/regenerate_derivatives.form.inc', |
|
|
|
|
|
|
|
'finished' => 'islandora_regenerate_derivative_batch_finished', |
|
|
|
); |
|
|
|
); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -135,13 +134,15 @@ function islandora_regenerate_object_derivatives_batch_operation(AbstractObject |
|
|
|
function islandora_regenerate_datastream_derivative_batch(AbstractDatastream $datastream) { |
|
|
|
function islandora_regenerate_datastream_derivative_batch(AbstractDatastream $datastream) { |
|
|
|
return array( |
|
|
|
return array( |
|
|
|
'title' => t('Regenerating derivatives for the @dsid datastream', array('@dsid' => $datastream->id)), |
|
|
|
'title' => t('Regenerating derivatives for the @dsid datastream', array('@dsid' => $datastream->id)), |
|
|
|
'operations' => array( |
|
|
|
'operations' => islandora_do_batch_derivatives($datastream->parent, array( |
|
|
|
array('islandora_regenerate_datastream_derivative_batch_operation', array($datastream)), |
|
|
|
'force' => TRUE, |
|
|
|
), |
|
|
|
'destination_dsid' => $datastream->id, |
|
|
|
|
|
|
|
)), |
|
|
|
'init_message' => t('Preparing to regenerate derivatives...'), |
|
|
|
'init_message' => t('Preparing to regenerate derivatives...'), |
|
|
|
'progress_message' => t('Time elapsed: @elapsed <br/>Estimated time remaning @estimate.'), |
|
|
|
'progress_message' => t('Time elapsed: @elapsed <br/>Estimated time remaning @estimate.'), |
|
|
|
'error_message' => t('An error has occurred.'), |
|
|
|
'error_message' => t('An error has occurred.'), |
|
|
|
'file' => drupal_get_path('module', 'islandora') . '/includes/regenerate_derivatives.form.inc', |
|
|
|
'file' => drupal_get_path('module', 'islandora') . '/includes/regenerate_derivatives.form.inc', |
|
|
|
|
|
|
|
'finished' => 'islandora_regenerate_derivative_batch_finished', |
|
|
|
); |
|
|
|
); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -161,3 +162,49 @@ function islandora_regenerate_datastream_derivative_batch_operation(AbstractData |
|
|
|
)); |
|
|
|
)); |
|
|
|
islandora_derivative_logging($logging_results); |
|
|
|
islandora_derivative_logging($logging_results); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* Wrapper to call out to batch operations. |
|
|
|
|
|
|
|
* |
|
|
|
|
|
|
|
* @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 |
|
|
|
|
|
|
|
* @param string $pid |
|
|
|
|
|
|
|
* The pid of the object we are performing. |
|
|
|
|
|
|
|
* @param bool $force |
|
|
|
|
|
|
|
* Whether we are forcing derivative regeneration or not. |
|
|
|
|
|
|
|
* @param array $context |
|
|
|
|
|
|
|
* The context of the current batch operation. |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
function islandora_derivative_perform_batch_operation($function, $file, $pid, $force, &$context) { |
|
|
|
|
|
|
|
if ($file) { |
|
|
|
|
|
|
|
require_once $file; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (function_exists($function)) { |
|
|
|
|
|
|
|
$logging = call_user_func($function, islandora_object_load($pid), $force); |
|
|
|
|
|
|
|
if (!empty($logging)) { |
|
|
|
|
|
|
|
$context['results']['logging'][] = $logging; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else { |
|
|
|
|
|
|
|
watchdog('islandora', 'Unable to call derivative function @function as it was not found!', array('@function' => $function), WATCHDOG_ERROR); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* Finished function for derivative batch regeneration. |
|
|
|
|
|
|
|
* |
|
|
|
|
|
|
|
* @param array $success |
|
|
|
|
|
|
|
* An array of success passed from the batch. |
|
|
|
|
|
|
|
* @param array $results |
|
|
|
|
|
|
|
* An array of results passed from the batch. |
|
|
|
|
|
|
|
* @param array $operations |
|
|
|
|
|
|
|
* An array of operations passed from the batch. |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
function islandora_regenerate_derivative_batch_finished($success, $results, $operations) { |
|
|
|
|
|
|
|
module_load_include('inc', 'islandora', 'includes/derivatives'); |
|
|
|
|
|
|
|
if (!empty($results['logging'])) { |
|
|
|
|
|
|
|
islandora_derivative_logging($results['logging']); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|