You are here

function gallery_assist_mass_updates in Gallery Assist 6

1 string reference to 'gallery_assist_mass_updates'
gallery_assist_node_operations in ./gallery_assist.module
Implementation of hook_node_operations().

File

./gallery_assist.module, line 5622
Drupal content type with gallery functionality.

Code

function gallery_assist_mass_updates($nodes, $updates) {

  // We use batch processing to prevent timeout when updating a large number
  // of nodes.
  if (count($nodes) > 5) {
    $batch = array(
      'operations' => array(
        array(
          '_gallery_assist_mass_updates_batch_process',
          array(
            $nodes,
            $updates,
          ),
        ),
      ),
      'finished' => '_gallery_assist_mass_updates_batch_finished',
      'title' => t('GA Processing test'),
      // 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.'),
    );
    batch_set($batch);
  }
  else {
    foreach ($nodes as $nid) {
      _gallery_assist_mass_updates_helper($nid, $updates);
    }
    drupal_set_message(t('The update has been performed.'));
  }
}