You are here

function drush_ip_backlog_nodes in IP address manager 7.2

Drush command: ip backlog comments.

File

./ip.drush.inc, line 145

Code

function drush_ip_backlog_nodes() {
  $batch_size = drush_get_option('size', 500);
  $list = _drush_ip_backlog_nodes_list();
  $chunks = array_chunk($list, $batch_size);
  $total = count($list);
  $progress = 0;
  $operations = array();
  foreach ($chunks as $chunk) {
    $progress += count($chunk);
    $operations[] = array(
      '_drush_ip_backlog_nodes_process_batch',
      array(
        $chunk,
        dt('@percent% (Processing @progress of @total)', array(
          '@percent' => round(100 * $progress / $total),
          '@progress' => $progress,
          '@total' => $total,
        )),
      ),
    );
  }
  $batch = array(
    'operations' => $operations,
    'title' => dt('IP backlog nodes process batch'),
    'finished' => '_drush_ip_backlog_nodes_process_batch_finished',
    'progress_message' => dt('@current entities of @total were processed.'),
  );

  // Get the batch process all ready!
  batch_set($batch);

  // Start processing the batch operations.
  drush_backend_batch_process();
}