function cacheflush_ui_mass_update in CacheFlush 7.3
Make mass update of presets.
Make mass update of presets, changing all presets in the $entity array to update them with the field values in $updates.
IMPORTANT NOTE: This function is intended to work when called from a form submission handler. Calling it outside of the form submission process may not work correctly.
Parameters
array $entitys: Array of presets ids to update.
array $updates: Array of key/value pairs with preset field names and the value to update that field to.
1 string reference to 'cacheflush_ui_mass_update'
- cacheflush_ui_cacheflush_ui_operations in modules/
cacheflush_ui/ cacheflush_ui.module - Implements hook_cacheflush_ui_operations().
File
- modules/
cacheflush_ui/ includes/ cacheflush_ui.class.inc, line 297 - Contains the CacheflushUIController class.
Code
function cacheflush_ui_mass_update(array $entitys, array $updates) {
// We use batch processing to prevent timeout when updating a large number
// of presets.
if (count($entitys) > 10) {
$batch = array(
'operations' => array(
array(
'_cacheflush_ui_mass_update_batch_process',
array(
$entitys,
$updates,
),
),
),
'finished' => '_cacheflush_ui_mass_update_batch_finished',
'title' => t('Processing'),
// We use a single multi-pass operation, so the default
// 'Remaining x of y operations' message will be confusing here.
'progress_message' => '',
'error_message' => t('The update has encountered an error.'),
// The operations do not live in the .module file, so we need to
// tell the batch engine which file to load before calling them.
'file' => drupal_get_path('module', 'cacheflush_ui') . '/includes/cacheflush_ui.class.inc',
);
batch_set($batch);
}
else {
foreach ($entitys as $id) {
_cacheflush_ui_mass_update_helper($id, $updates);
}
drupal_set_message(t('The update has been performed.'));
}
}