You are here

protected function AcquiaLiftAgent::queueItems in Acquia Lift Connector 7

Adds items to the queue and sets a message to inform the user.

Parameters

$items: An array of items to add to the queue.

5 calls to AcquiaLiftAgent::queueItems()
AcquiaLiftAgent::postSave in plugins/agent_types/AcquiaLiftAgent.inc
Implements PersonalizeAgentInterface::postSave().
AcquiaLiftAgent::syncAgentStatus in plugins/agent_types/AcquiaLiftAgent.inc
Implements AcquiaLiftAgentInterface::syncAgentStatus().
AcquiaLiftAgent::syncDecisions in plugins/agent_types/AcquiaLiftAgent.inc
Implements AcquiaLiftAgentInterface::syncDecisions().
AcquiaLiftAgent::syncFixedTargeting in plugins/agent_types/AcquiaLiftAgent.inc
Implements AcquiaLiftAgentInterface::syncFixedTargeting().
AcquiaLiftAgent::syncGoals in plugins/agent_types/AcquiaLiftAgent.inc
Implements AcquiaLiftAgentInterface::syncGoals().

File

plugins/agent_types/AcquiaLiftAgent.inc, line 1102
Provides an agent type for Acquia Lift

Class

AcquiaLiftAgent

Code

protected function queueItems($items) {
  if (!empty($items)) {
    foreach ($items as $item) {

      // Create a hash of the item. This will prevent duplicate items from
      // being added to the queue.
      $hash = md5(serialize($item));
      $item['hash'] = $hash;

      // We add the agent machine name to the queue item so that if it fails
      // the agent in question can be paused.
      $item['agent'] = $this->machineName;
      $this
        ->getQueue()
        ->createItem($item);
    }

    // Make sure the queue gets triggered on the next request.
    $_SESSION['acquia_lift_queue_trigger'] = 1;
  }
}