You are here

function deploy_queue_worker_publish in Deploy - Content Staging 7.2

Same name and namespace in other branches
  1. 7.3 deploy.module \deploy_queue_worker_publish()

Processes a single queued item for publishing.

2 string references to 'deploy_queue_worker_publish'
DeployProcessorBatch::publish in plugins/DeployProcessorBatch.inc
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.
deploy_cron_queue_info in ./deploy.module
Implements hook_cron_queue_info().

File

./deploy.module, line 368
Deploy module functions.

Code

function deploy_queue_worker_publish($entity, &$context = NULL) {
  $endpoint = deploy_endpoint_load($entity->__metadata['endpoint_name']);
  $plan = deploy_plan_load($entity->__metadata['plan_name']);
  if ($plan && $endpoint) {
    $entities = array(
      array(
        'type' => $entity->__metadata['type'],
        'id' => $entity->__metadata['id'],
      ),
    );
    $iterator = deploy_iterator($entities, $plan);
    $endpoint
      ->publish($entity->__metadata['deployment_key'], $iterator, $entity->__metadata['lock_name']);
    $context['results'][$entity->__metadata['endpoint_name']] = $entity->__metadata['plan_name'];
  }
}