Commit 02d1a4d6 authored by alexpott's avatar alexpott

Issue #2501685 by Dave Reid: Batch::claimItem() contains wrong class in documentation

parent 996325b0
......@@ -23,11 +23,11 @@
class Batch extends DatabaseQueue {
/**
* Overrides Drupal\Core\Queue\System::claimItem().
* Overrides \Drupal\Core\Queue\DatabaseQueue::claimItem().
*
* Unlike Drupal\Core\Queue\System::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.
* Unlike \Drupal\Core\Queue\DatabaseQueue::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.
*/
public function claimItem($lease_time = 0) {
$item = $this->connection->queryRange('SELECT data, item_id FROM {queue} q WHERE name = :name ORDER BY item_id ASC', 0, 1, array(':name' => $this->name))->fetchObject();
......@@ -42,7 +42,7 @@ public function claimItem($lease_time = 0) {
* Retrieves all remaining items in the queue.
*
* This is specific to Batch API and is not part of the
* Drupal\Core\Queue\QueueInterface.
* \Drupal\Core\Queue\QueueInterface.
*
* @return array
* An array of queue items.
......
......@@ -21,9 +21,9 @@
class BatchMemory extends Memory {
/**
* Overrides Drupal\Core\Queue\Memory::claimItem().
* Overrides \Drupal\Core\Queue\Memory::claimItem().
*
* Unlike Drupal\Core\Queue\Memory::claimItem(), this method provides a
* Unlike \Drupal\Core\Queue\Memory::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.
*/
......@@ -39,7 +39,7 @@ public function claimItem($lease_time = 0) {
* Retrieves all remaining items in the queue.
*
* This is specific to Batch API and is not part of the
* Drupal\Core\Queue\QueueInterface.
* \Drupal\Core\Queue\QueueInterface.
*
* @return array
* An array of queue items.
......
......@@ -47,7 +47,7 @@ function __construct($name, Connection $connection) {
}
/**
* Implements Drupal\Core\Queue\QueueInterface::createItem().
* {@inheritdoc}
*/
public function createItem($data) {
$query = $this->connection->insert('queue')
......@@ -63,14 +63,14 @@ public function createItem($data) {
}
/**
* Implements Drupal\Core\Queue\QueueInterface::numberOfItems().
* {@inheritdoc}
*/
public function numberOfItems() {
return $this->connection->query('SELECT COUNT(item_id) FROM {queue} WHERE name = :name', array(':name' => $this->name))->fetchField();
}
/**
* Implements Drupal\Core\Queue\QueueInterface::claimItem().
* {@inheritdoc}
*/
public function claimItem($lease_time = 30) {
// Claim an item by updating its expire fields. If claim is not successful
......@@ -106,7 +106,7 @@ public function claimItem($lease_time = 30) {
}
/**
* Implements Drupal\Core\Queue\QueueInterface::releaseItem().
* {@inheritdoc}
*/
public function releaseItem($item) {
$update = $this->connection->update('queue')
......@@ -118,7 +118,7 @@ public function releaseItem($item) {
}
/**
* Implements Drupal\Core\Queue\QueueInterface::deleteItem().
* {@inheritdoc}
*/
public function deleteItem($item) {
$this->connection->delete('queue')
......@@ -127,7 +127,7 @@ public function deleteItem($item) {
}
/**
* Implements Drupal\Core\Queue\QueueInterface::createQueue().
* {@inheritdoc}
*/
public function createQueue() {
// All tasks are stored in a single database table (which is created when
......@@ -136,7 +136,7 @@ public function createQueue() {
}
/**
* Implements Drupal\Core\Queue\QueueInterface::deleteQueue().
* {@inheritdoc}
*/
public function deleteQueue() {
$this->connection->delete('queue')
......
......@@ -43,7 +43,7 @@ public function __construct($name) {
}
/**
* Implements Drupal\Core\Queue\QueueInterface::createItem().
* {@inheritdoc}
*/
public function createItem($data) {
$item = new \stdClass();
......@@ -56,14 +56,14 @@ public function createItem($data) {
}
/**
* Implements Drupal\Core\Queue\QueueInterface::numberOfItems().
* {@inheritdoc}
*/
public function numberOfItems() {
return count($this->queue);
}
/**
* Implements Drupal\Core\Queue\QueueInterface::claimItem().
* {@inheritdoc}
*/
public function claimItem($lease_time = 30) {
foreach ($this->queue as $key => $item) {
......@@ -77,14 +77,14 @@ public function claimItem($lease_time = 30) {
}
/**
* Implements Drupal\Core\Queue\QueueInterface::deleteItem().
* {@inheritdoc}
*/
public function deleteItem($item) {
unset($this->queue[$item->item_id]);
}
/**
* Implements Drupal\Core\Queue\QueueInterface::releaseItem().
* {@inheritdoc}
*/
public function releaseItem($item) {
if (isset($this->queue[$item->item_id]) && $this->queue[$item->item_id]->expire != 0) {
......@@ -95,14 +95,14 @@ public function releaseItem($item) {
}
/**
* Implements Drupal\Core\Queue\QueueInterface::createQueue().
* {@inheritdoc}
*/
public function createQueue() {
// Nothing needed here.
}
/**
* Implements Drupal\Core\Queue\QueueInterface::deleteQueue().
* {@inheritdoc}
*/
public function deleteQueue() {
$this->queue = array();
......
......@@ -77,7 +77,7 @@ public function claimItem($lease_time = 3600);
* Deletes a finished item from the queue.
*
* @param $item
* The item returned by Drupal\Core\Queue\QueueInterface::claimItem().
* The item returned by \Drupal\Core\Queue\QueueInterface::claimItem().
*/
public function deleteItem($item);
......@@ -87,7 +87,7 @@ public function deleteItem($item);
* Another worker can come in and process it before the timeout expires.
*
* @param $item
* The item returned by Drupal\Core\Queue\QueueInterface::claimItem().
* The item returned by \Drupal\Core\Queue\QueueInterface::claimItem().
*
* @return boolean
* TRUE if the item has been released, FALSE otherwise.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment