Issue #2501685 by Dave Reid: Batch::claimItem() contains wrong class in documentation
parent
996325b04d
commit
02d1a4d67b
|
@ -23,11 +23,11 @@ namespace Drupal\Core\Queue;
|
|||
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 @@ class Batch extends DatabaseQueue {
|
|||
* 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 @@ namespace Drupal\Core\Queue;
|
|||
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 @@ class BatchMemory extends Memory {
|
|||
* 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 @@ class DatabaseQueue implements ReliableQueueInterface {
|
|||
}
|
||||
|
||||
/**
|
||||
* Implements Drupal\Core\Queue\QueueInterface::createItem().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function createItem($data) {
|
||||
$query = $this->connection->insert('queue')
|
||||
|
@ -63,14 +63,14 @@ class DatabaseQueue implements ReliableQueueInterface {
|
|||
}
|
||||
|
||||
/**
|
||||
* 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 @@ class DatabaseQueue implements ReliableQueueInterface {
|
|||
}
|
||||
|
||||
/**
|
||||
* Implements Drupal\Core\Queue\QueueInterface::releaseItem().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function releaseItem($item) {
|
||||
$update = $this->connection->update('queue')
|
||||
|
@ -118,7 +118,7 @@ class DatabaseQueue implements ReliableQueueInterface {
|
|||
}
|
||||
|
||||
/**
|
||||
* Implements Drupal\Core\Queue\QueueInterface::deleteItem().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function deleteItem($item) {
|
||||
$this->connection->delete('queue')
|
||||
|
@ -127,7 +127,7 @@ class DatabaseQueue implements ReliableQueueInterface {
|
|||
}
|
||||
|
||||
/**
|
||||
* 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 @@ class DatabaseQueue implements ReliableQueueInterface {
|
|||
}
|
||||
|
||||
/**
|
||||
* Implements Drupal\Core\Queue\QueueInterface::deleteQueue().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function deleteQueue() {
|
||||
$this->connection->delete('queue')
|
||||
|
|
|
@ -43,7 +43,7 @@ class Memory implements QueueInterface {
|
|||
}
|
||||
|
||||
/**
|
||||
* Implements Drupal\Core\Queue\QueueInterface::createItem().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function createItem($data) {
|
||||
$item = new \stdClass();
|
||||
|
@ -56,14 +56,14 @@ class Memory implements QueueInterface {
|
|||
}
|
||||
|
||||
/**
|
||||
* 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 @@ class Memory implements QueueInterface {
|
|||
}
|
||||
|
||||
/**
|
||||
* 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 @@ class Memory implements QueueInterface {
|
|||
}
|
||||
|
||||
/**
|
||||
* 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 @@ interface QueueInterface {
|
|||
* 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 @@ interface QueueInterface {
|
|||
* 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.
|
||||
|
|
Loading…
Reference in New Issue