function advagg_admin_batch_rebuild in Advanced CSS/JS Aggregation 7
Same name and namespace in other branches
- 6 advagg.admin.inc \advagg_admin_batch_rebuild()
Set up batch for first and last name loading.
This is where Drupal's Batch API comes into play. It's as simple as defining $batch, and then calling batch_set($batch)
File
- includes/
admin.inc, line 612 - Admin page callbacks for the advanced CSS/JS aggregation module.
Code
function advagg_admin_batch_rebuild($form, &$form_state) {
$batch = array();
// Set up the type of batch operation we will do.
if ($form_state['clicked_button']['#post']['op'] == t('Force all counters to be increment by one')) {
$increment = TRUE;
$batch['title'] = t('Increment and rebuild aggregated files');
}
else {
$increment = FALSE;
$batch['title'] = t('Rebuilding aggregated files');
}
// Build batch operational data.
$batch += array(
'operations' => array(
array(
'advagg_admin_rebuild_bundles',
array(
$increment,
),
),
),
'finished' => 'advagg_admin_rebuild_bundles_done',
'init_message' => t('Initializing...'),
'progress_message' => t('@current of @total batch operations done.'),
'error_message' => t('Rebuilding aggregated files encountered an error.'),
'file' => drupal_get_path('module', 'advagg') . '/advagg.admin.inc',
);
// Run it
batch_set($batch);
batch_process('admin/config/advagg');
}