You are here

function autotag_mass_update in Taxonomy Autotagger 6.2

Callback for node_operation to re-autotag nodes.

1 call to autotag_mass_update()
autotag_tag_content_type_submit in ./autotag.settings.inc

File

./autotag.settings.inc, line 76

Code

function autotag_mass_update($nodes) {

  // Following ripped off from nodes module.
  // We use batch processing to prevent timeout when updating a large number
  // of nodes.
  if (count($nodes) > 10) {
    $batch = array(
      'operations' => array(
        array(
          '_autotag_mass_update_batch_process',
          array(
            $nodes,
          ),
        ),
      ),
      'finished' => '_autotag_mass_update_batch_finished',
      'title' => t('Processing'),
      // We use a single multi-pass operation, so the default
      // 'Remaining x of y operations' message will be confusing here.
      'progress_message' => '',
      'error_message' => t('The update has encountered an error.'),
      'file' => drupal_get_path('module', 'autotag') . '/autotag.settings.inc',
    );
    batch_set($batch);
  }
  else {
    foreach ($nodes as $nid) {
      _autotag_mass_update_helper($nid);
    }
    drupal_set_message(t('The update has been performed.'));
  }
}