You are here

public function ComputingQueue::createItem in Drupal Computing 7.2

Add a queue item and store it directly to the queue.

Parameters

$data: Arbitrary data to be associated with the new task in the queue.

Return value

TRUE if the item was successfully created and was (best effort) added to the queue, otherwise FALSE. We don't guarantee the item was committed to disk etc, but as far as we know, the item is now in the queue.

Overrides DrupalQueueInterface::createItem

File

./computing.queue.inc, line 34

Class

ComputingQueue
This file provides Queue support, an extra layer to handle computing records. The only benefit here is to provide an interface for Queue, perhaps people don't need it.

Code

public function createItem($data) {
  if (is_object($data)) {
    $data = (array) $data;
  }
  $options = array_diff_key($data, array_flip(array(
    'application',
    'command',
    'label',
    'input',
  )));
  return (bool) computing_create($data['application'], $data['command'], $data['label'], $data['input'], $options);
}