class DeployProcessorBatch in Deploy - Content Staging 7.2
Same name and namespace in other branches
- 7.3 plugins/DeployProcessorBatch.inc \DeployProcessorBatch
Processor class using the Batch API
Hierarchy
- class \DeployProcessorMemory implements DeployProcessor
- class \DeployProcessorBatch
Expanded class hierarchy of DeployProcessorBatch
1 string reference to 'DeployProcessorBatch'
- deploy_deploy_processors in ./
deploy.deploy.inc - Implements hook_deploy_processors().
File
- plugins/
DeployProcessorBatch.inc, line 10 - Batch API plugin for deploy Processor.
View source
class DeployProcessorBatch extends DeployProcessorMemory {
/**
* Batch operations to execute.
*
* @var array
*/
public $operations = array();
/**
* {@inheritdoc}
*/
protected function processOperations(array $operations = array()) {
if (!empty($operations)) {
foreach ($this->aggregator as $entity) {
foreach ($operations as $operation) {
$this->operations[] = array(
$operation['callback'],
array(
$this->aggregator->plan->name,
$entity,
),
);
}
}
}
}
/**
* {@inheritdoc}
*/
public function deploy($deployment_key, DeployEndpoint $endpoint, $lock_name = NULL) {
deploy_log($deployment_key, DEPLOY_STATUS_PROCESSING);
foreach ($this->aggregator as $entity) {
$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;
$this->operations[] = array(
'deploy_queue_worker_deploy',
array(
$entity,
),
);
}
}
/**
* {@inheritdoc}
*/
public function publish($deployment_key, DeployEndpoint $endpoint, $lock_name = NULL) {
foreach ($this->aggregator as $entity) {
$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;
$this->operations[] = array(
'deploy_queue_worker_publish',
array(
$entity,
),
);
}
}
/**
* {@inheritdoc}
*/
public function postProcess(array $operations = array()) {
$this
->processOperations($operations);
$batch = array(
'title' => t('Deploying %plan', array(
'%plan' => $this->aggregator->plan->title,
)),
'operations' => $this->operations,
'finished' => 'deploy_batch_finished_operation',
);
batch_set($batch);
if (drupal_is_cli() && function_exists('drush_main')) {
// Drush has its own batch processor.
$batch =& batch_get();
$batch['progressive'] = FALSE;
drush_backend_batch_process();
}
else {
batch_process('admin/structure/deploy');
}
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
DeployProcessorBatch:: |
public | property | Batch operations to execute. | |
DeployProcessorBatch:: |
public | function |
Main processing method that should hand over the aggregator to the endpoint
to deploy all the entities. Overrides DeployProcessorMemory:: |
|
DeployProcessorBatch:: |
public | function |
Runs all postprocess operations. Overrides DeployProcessorMemory:: |
|
DeployProcessorBatch:: |
protected | function |
Overrides DeployProcessorMemory:: |
|
DeployProcessorBatch:: |
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:: |
|
DeployProcessorMemory:: |
public | property | The aggregator containing the entities to be processed. | |
DeployProcessorMemory:: |
public | property | Configuration options. | |
DeployProcessorMemory:: |
public | function |
Configuration form. Overrides DeployProcessor:: |
|
DeployProcessorMemory:: |
public | function |
Runs all preprocess operations. Overrides DeployProcessor:: |
|
DeployProcessorMemory:: |
public | function |
Constructor for a deploy processor. Overrides DeployProcessor:: |