function book_copy_process_copy in Book Copy 7.2
Execute a batch process.
3 calls to book_copy_process_copy()
- book_copy_book_process_book_copy in ./
book_copy.module - Callback for book_copy ajax call from outline designer.
- book_copy_copy_confirm_submit in ./
book_copy.module - Submit handler to start a batch process
- drush_book_copy_copy_book in ./
book_copy.drush.inc - Drush command callback for copying a book or part of a book
File
- ./
book_copy.module, line 148 - Book copy, copy book outlines
Code
function book_copy_process_copy($nid, $title, $new_title, $progressive = TRUE, $redirect = NULL) {
$queue_id = rand(1, 9999);
$queue = DrupalQueue::get($queue_id);
$queue
->createQueue();
$batch = array(
'title' => t('Copying book %title', array(
'%title' => $title,
)),
'operations' => array(
array(
'book_copy_copy',
array(
$nid,
$new_title,
$queue_id,
),
),
array(
'book_copy_update_internal_links',
array(
$queue_id,
),
),
),
'finished' => '_book_copy_copy_finished',
'init_message' => t('Outline Copy is starting.'),
'progress_message' => t('We are now copying your outline please be patient...'),
'error_message' => t('The process has encountered an error.'),
);
batch_set($batch);
// there is a core glitch in D6/7 that requires progressive be defined this way
// http://drupal.org/node/638712#comment-2289138
$batch =& batch_get();
// set if this should be done in the background or not, if FALSE, redirect is ignored
$batch['progressive'] = $progressive;
batch_process($redirect);
}