You are here

class DeployProcessorMemory in Deploy - Content Staging 7.3

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

Class for basic memory-based processing

Hierarchy

Expanded class hierarchy of DeployProcessorMemory

3 string references to 'DeployProcessorMemory'
deploy_deploy_processors in ./deploy.deploy.inc
Implements hook_deploy_processors().
deploy_example_deploy_plans_default in modules/deploy_example/deploy_example.deploy_plans.inc
Implements hook_deploy_plans_default().
drush_deploy_create_plan in ./deploy.drush.inc
Command callback for creating plans.

File

plugins/DeployProcessorMemory.inc, line 10
In memory plugin for deploy Processor.

View source
class DeployProcessorMemory implements DeployProcessor {

  /**
   * The aggregator containing the entities to be processed.
   *
   * @var DeployAggregator
   */
  public $aggregator = NULL;

  /**
   * Configuration options.
   *
   * @var array
   */
  public $config = array();

  /**
   * {@inheritdoc}
   */
  public function __construct(DeployAggregator $aggregator, array $config = array()) {
    $this->aggregator = $aggregator;
    $this->config += array(
      'debug' => FALSE,
    );
    $this->config = array_merge($this->config, $config);
  }

  /**
   * {@inheritdoc}
   */
  protected function processOperations(array $operations = array()) {
    if (!empty($operations)) {
      foreach ($this->aggregator as $entity) {
        foreach ($operations as $operation) {
          $operation['callback']($this->aggregator->plan->name, $entity);
        }
      }
    }
  }

  /**
   * {@inheritdoc}
   */
  public function preProcess(array $operations = array()) {
    $this
      ->processOperations($operations);
  }

  /**
   * {@inheritdoc}
   */
  public function deploy($deployment_key, DeployEndpoint $endpoint, $lock_name = NULL) {
    $endpoint
      ->deploy($deployment_key, $this->aggregator, $lock_name);
  }

  /**
   * {@inheritdoc}
   */
  public function publish($deployment_key, DeployEndpoint $endpoint, $lock_name = NULL) {
    $endpoint
      ->publish($deployment_key, $this->aggregator, $lock_name);
    drupal_set_message(t('Plan %plan has been deployed and published to %endpoint.', array(
      '%plan' => $this->aggregator->plan->title,
      '%endpoint' => $endpoint->title,
    )));
  }

  /**
   * {@inheritdoc}
   */
  public function postProcess(array $operations = array()) {
    $this
      ->processOperations($operations);
  }

  /**
   * {@inheritdoc}
   */
  public function configForm(&$form_state) {

    // We have no settings for this processor.
    return array();
  }

}

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::deploy public function Main processing method that should hand over the aggregator to the endpoint to deploy all the entities. Overrides DeployProcessor::deploy 2
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::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 DeployProcessor::publish 2
DeployProcessorMemory::__construct public function Constructor for a deploy processor. Overrides DeployProcessor::__construct