Example:
$batch = array(‘operations’ => array(),
‘finished’ => ‘my_finished_callback’,
‘title’ => t(‘Processing’),
‘init_message’ => t(‘Starting…’),
‘progress_message’ => t(‘Finished @current out of @total’),
‘error_message’ => t(‘An error occurred and some or all of the exports have failed.’),
);
//batch process and an array of callback arguments
$batch['operations'][] = array(‘batch_1′, array($node));
$batch['operations'][] = array(‘batch_2′, array($node));
$batch['operations'][] = array(‘batch_3′, array($node));
batch_set($batch);
batch_process(‘my_home/’);
function batch_1(&$node, &$context) {
while(1)
{
$result = db_result(db_query(…));
if($result) break;
sleep(1);
}
$context['message'] = “Pre translating…”;
$context['finished'] = 1;
}


