function queue_ui_batch_test in Queue UI 6
Same name and namespace in other branches
- 7.2 queue_ui.module \queue_ui_batch_test()
- 7 queue_ui.module \queue_ui_batch_test()
1 string reference to 'queue_ui_batch_test'
File
- ./
queue_ui.module, line 151 - queue_ui.module
Code
function queue_ui_batch_test($queue, &$context) {
if (empty($context['sandbox'])) {
$context['sandbox']['progress'] = 0;
$context['sandbox']['current'] = 0;
$context['sandbox']['max'] = $queue
->numberOfItems();
}
for ($i = 0; $i < 20 && $context['sandbox']['current'] < $context['sandbox']['max']; $i++) {
$item = $queue
->claimItem(20);
// Lease time.
if ($item) {
// We would do some processing, if this were REAL.
$queue
->deleteItem($item);
}
$context['sandbox']['progress']++;
$context['sandbox']['current']++;
}
if ($context['sandbox']['progress'] != $context['sandbox']['max']) {
$context['finished'] = $context['sandbox']['progress'] / $context['sandbox']['max'];
}
}