You are here

function _views_bulk_operations_execute_queue in Views Bulk Operations (VBO) 6

Helper function to handle Drupal Queue operations.

1 string reference to '_views_bulk_operations_execute_queue'
views_bulk_operations_cron_queue_info in ./views_bulk_operations.module
Implementation of hook_cron_queue_info().

File

./views_bulk_operations.module, line 1548
Allows operations to be performed on items selected in a view.

Code

function _views_bulk_operations_execute_queue($data) {
  module_load_include('inc', 'node', 'node.admin');
  list($oid, $row, $operation, $params, $uid, $display_result, $object_info) = $data['arguments'];
  $object = call_user_func($object_info['load'], $oid);
  if (!$object) {
    watchdog('vbo', 'Skipped %operation on @type id %oid because it was not found.', array(
      '%operation' => $operation['label'],
      '@type' => t($operation['type']),
      '%oid' => $oid,
    ), WATCHDOG_ALERT);
    return;
  }
  $account = user_load(array(
    'uid' => $uid,
  ));
  if (!_views_bulk_operations_object_permission($operation, $object, $object_info, $account)) {
    watchdog('vbo', 'Skipped %operation on @type %title due to insufficient permissions.', array(
      '%operation' => $operation['label'],
      '@type' => t($object_info['type']),
      '%title' => $object->{$object_info['title']},
    ), WATCHDOG_ALERT);
    return;
  }
  _views_bulk_operations_action_do($operation, $oid, $object, $row, $params, $object_info, $account);
  if ($display_result) {
    watchdog('vbo', 'Performed %operation on @type %title.', array(
      '%operation' => $operation['label'],
      '@type' => t($object_info['type']),
      '%title' => $object->{$object_info['title']},
    ), WATCHDOG_INFO);
  }
}