You are here

public function BatchQueue::claimItem in Drupal 7

Overrides SystemQueue::claimItem().

Unlike SystemQueue::claimItem(), this method provides a default lease time of 0 (no expiration) instead of 30. This allows the item to be claimed repeatedly until it is deleted.

Overrides SystemQueue::claimItem

File

includes/batch.queue.inc, line 28
Queue handlers used by the Batch API.

Class

BatchQueue
Defines a batch queue.

Code

public function claimItem($lease_time = 0) {
  $item = db_query_range('SELECT data, item_id FROM {queue} q WHERE name = :name ORDER BY item_id ASC', 0, 1, array(
    ':name' => $this->name,
  ))
    ->fetchObject();
  if ($item) {
    $item->data = unserialize($item->data);
    return $item;
  }
  return FALSE;
}