You are here

function prepare_nodes_button_submit in GlobalLink Connect for Drupal 7.7

Nodes batch sets .

1 string reference to 'prepare_nodes_button_submit'
globallink_useful_tools in ./globallink_settings.inc
Globallink Useful Tools form.

File

./globallink_settings.inc, line 998

Code

function prepare_nodes_button_submit($form, &$form_state) {
  $batch = array(
    'operations' => array(),
    'finished' => 'globallink_settings_nodes_batch_finished',
    'title' => t('Updating Nodes'),
    'init_message' => t('Update Nodes is starting.'),
    'progress_message' => t('Processed @current out of @total.'),
    'error_message' => t('Update Nodes has encountered an error.'),
    'file' => drupal_get_path('module', 'globallink') . '/globallink_settings.inc',
  );
  $progress = 0;
  $limit = 10;
  $result = db_query("SELECT * FROM {node} WHERE language = :language", array(
    ':language' => "und",
  ))
    ->fetchAll();
  $max = count($result);
  while ($progress <= $max) {
    $batch['operations'][] = array(
      'globallink_settings_nodes_process',
      array(
        $progress,
        $limit,
        $result,
      ),
    );
    $progress = $progress + $limit;
  }
  batch_set($batch);
}