You are here

class DeployProcessorQueue in Deploy - Content Staging 7.3

Same name and namespace in other branches
  1. 7.2 plugins/DeployProcessorQueue.inc \DeployProcessorQueue

Processor class using the Queue API

Hierarchy

Expanded class hierarchy of DeployProcessorQueue

2 string references to 'DeployProcessorQueue'
DeployQueuedDeploymentTestCase::testDeployment in ./deploy.test
deploy_deploy_processors in ./deploy.deploy.inc
Implements hook_deploy_processors().

File

plugins/DeployProcessorQueue.inc, line 10
Queue API plugin for deploy Processor.

View source
class DeployProcessorQueue extends DeployProcessorMemory {

  /**
   * {@inheritdoc}
   */
  public function deploy($deployment_key, DeployEndpoint $endpoint, $lock_name = NULL) {
    deploy_log($deployment_key, DEPLOY_STATUS_PROCESSING);
    $queue = DrupalQueue::get('deploy_deploy');
    foreach ($this->aggregator as $entity) {

      // We don't want entities that has a cause, i.e. not dependencies, because
      // those'll be taken care of when the service iterates over the queue.
      if (empty($entity->__metadata['cause'])) {
        $entity_info = entity_get_info($entity->__metadata['type']);
        $id_key = $entity_info['entity keys']['id'];
        $entity->__metadata['id'] = $entity->{$id_key};
        $entity->__metadata['deployment_key'] = $deployment_key;
        $entity->__metadata['plan_name'] = $this->aggregator->plan->name;
        $entity->__metadata['endpoint_name'] = $endpoint->name;
        $entity->__metadata['lock_name'] = $lock_name;
        $queue
          ->createItem($entity);
      }
    }
  }

  /**
   * {@inheritdoc}
   */
  public function publish($deployment_key, DeployEndpoint $endpoint, $lock_name = NULL) {
    $queue = DrupalQueue::get('deploy_publish');
    foreach ($this->aggregator as $entity) {

      // We don't want entities that has a cause, i.e. not dependencies, because
      // those'll be taken care of when the service iterates over the queue.
      if (empty($entity->__metadata['cause'])) {
        $entity_info = entity_get_info($entity->__metadata['type']);
        $id_key = $entity_info['entity keys']['id'];
        $entity->__metadata['id'] = $entity->{$id_key};
        $entity->__metadata['deployment_key'] = $deployment_key;
        $entity->__metadata['plan_name'] = $this->aggregator->plan->name;
        $entity->__metadata['endpoint_name'] = $endpoint->name;
        $entity->__metadata['lock_name'] = $lock_name;
        $queue
          ->createItem($entity);
      }
    }
  }

}

Members

Namesort descending Modifiers Type Description Overrides
DeployProcessorMemory::$aggregator public property The aggregator containing the entities to be processed.
DeployProcessorMemory::$config public property Configuration options.
DeployProcessorMemory::configForm public function Configuration form. Overrides DeployProcessor::configForm
DeployProcessorMemory::postProcess public function Runs all postprocess operations. Overrides DeployProcessor::postProcess 1
DeployProcessorMemory::preProcess public function Runs all preprocess operations. Overrides DeployProcessor::preProcess
DeployProcessorMemory::processOperations protected function 1
DeployProcessorMemory::__construct public function Constructor for a deploy processor. Overrides DeployProcessor::__construct
DeployProcessorQueue::deploy public function Main processing method that should hand over the aggregator to the endpoint to deploy all the entities. Overrides DeployProcessorMemory::deploy
DeployProcessorQueue::publish public function Processing method that should hand over the aggregator to the endpoint to publish all deployed entities. This method will only be called after successful deployments. Overrides DeployProcessorMemory::publish