You are here

function cms_content_sync_drush_command in CMS Content Sync 2.1.x

Same name and namespace in other branches
  1. 8 cms_content_sync.drush.inc \cms_content_sync_drush_command()
  2. 2.0.x cms_content_sync.drush.inc \cms_content_sync_drush_command()

Implements hook_drush_command().

File

./cms_content_sync.drush.inc, line 13
Contains Drush commands for Content Sync.

Code

function cms_content_sync_drush_command() {
  $items['content-sync-configuration-export'] = [
    'description' => dt('Export configuration to the Sync Core.'),
    'aliases' => [
      'cse',
      'csce',
    ],
    'options' => [
      'force' => 'Whether to ignore that another site is already using the same site ID. Useful if you change the URL of a site.',
    ],
  ];
  $items['content-sync-sync-core-login'] = [
    'description' => dt('Trigger a login for this specific site at the sync core.'),
    'aliases' => [
      'csscl',
    ],
  ];
  $items['content-sync-pull'] = [
    'description' => dt('   * Kindly ask the Sync Core to pull all entities for a specific flow, or to force pull one specific entity.'),
    'aliases' => [
      'cs-pull',
    ],
    'required-arguments' => TRUE,
    'arguments' => [
      'flow_id' => 'The flow the entities should be pulled from.',
    ],
    'options' => [
      'force' => 'Also update entities which have already been pulled.',
      'entity_type' => 'The type of the entity that should be pulled, e.g. "node".',
      'entity_uuid' => 'The uuid of the entity that should be pulled.',
    ],
    'examples' => [
      'drush cs-pull example_flow' => 'Pull all entities from the "example_flow".',
      'drush cs-pull example_flow --force' => 'Pull all entities from the "example_flow" and force entities which already have been pulled to be updated as well.',
      'drush cs-pull example_flow --entity_type="node" --entity_uuid="3a150294-90eb-48c2-911d-672043a45683"' => 'Force pull the node having the uuid 3a150294-90eb-48c2-911d-672043a45683 from the example flow.',
    ],
  ];
  $items['content-sync-push'] = [
    'description' => dt('Push entities to the Sync Core.'),
    'aliases' => [
      'cs-push',
      'content-sync-push-entities',
    ],
    'required-arguments' => TRUE,
    'arguments' => [
      'flow_id' => 'The id of the flow the entities should be pushed for.',
    ],
    'options' => [
      'push_mode' => 'Allowed values: automatic_manual or automatic_manual_force',
    ],
    'examples' => [
      'drush cs-push example_flow' => 'Push all entities from the "example_flow" which have export configured as "automatically".',
      'drush cs-push example_flow --push_mode="automatic_manual"' => 'Push all entities from the "example_flow" which have push configured as "automatically" or "manually". Only pushes manually pushed entities which have not been pushed before.',
      'drush cs-push example_flow --push_mode="automatic_manual_force"' => 'Push all entities from the "example_flow" which have push configured as "automatically" or "manually". Also pushes entities which have not been pushed before by the manual push.',
    ],
  ];

  // @deprecated Function is deprecated and is going to be removed in 2.0, use pull() instead.
  $items['content-sync-pull-entities'] = [
    'description' => dt('Pull entities from Sync Core.'),
    'aliases' => [
      'cspe',
    ],
    'required-arguments' => TRUE,
    'arguments' => [
      'flow_id' => 'The flow the entities should be pulled from.',
    ],
    'options' => [
      'force' => 'Also update entities which have already been pulled.',
    ],
    'examples' => [
      'drush cspe example_flow' => 'Pull all entities from the "example_flow".',
      'drush cspe example_flow --force' => 'Pull all entities from the "example_flow" and force entities which already have been pulled to be updated as well.',
    ],
  ];

  // @deprecated Function is deprecated and is going to be removed in 2.0, use pull() instead.
  $items['content-sync-force-pull-entity'] = [
    'description' => dt('Kindly ask the Sync Core to force pull one specific entity.'),
    'required-arguments' => TRUE,
    'arguments' => [
      'flow_id' => 'The flow the entity should be pulled from.',
      'entity_type' => 'The type of the entity that should be pulled.',
      'entity_uuid' => 'The uuid of the entity that should be pulled.',
    ],
    'examples' => [
      'drush content-sync-force-pull-entity example_flow node 3a150294-90eb-48c2-911d-672043a45683' => 'Force pull the node having the uuid 3a150294-90eb-48c2-911d-672043a45683 which has been imported from the example flow.',
    ],
  ];
  $items['content-sync-reset-status-entities'] = [
    'description' => dt('Reset the status entities for a specific or all pool/s.'),
    'aliases' => [
      'csrse',
    ],
    'options' => [
      'pool_id' => 'The machine name of the pool the status entities should be reset for.',
    ],
    'examples' => [
      'drush csrse' => 'Reset all status entities for all pools',
      'drush csrse --pool_id="example_pool"' => 'Reset all status entities for the "example_pool".',
    ],
  ];
  $items['content-sync-check-entity-flags'] = [
    'description' => dt('Check the flags for an entity.'),
    'aliases' => [
      'cscef',
    ],
    'required-arguments' => TRUE,
    'arguments' => [
      'entity_uuid' => 'The related entities uuid.',
    ],
    'options' => [
      'flag' => 'The flag to check for, allowed values are: FLAG_IS_SOURCE_ENTITY, FLAG_PUSH_ENABLED, FLAG_DEPENDENCY_PUSH_ENABLED, FLAG_EDIT_OVERRIDE, FLAG_USER_ENABLED_PUSH, FLAG_DELETED',
    ],
    'examples' => [
      'drush cscef 16cc0d54-d93d-45b8-adf2-071de9d2d32b' => 'Get all flags for the entity having the uuid = "16cc0d54-d93d-45b8-adf2-071de9d2d32b".',
      'drush cscef 16cc0d54-d93d-45b8-adf2-071de9d2d32b --flag="FLAG_EDIT_OVERRIDE"' => 'Check if the entity having the uuid = "16cc0d54-d93d-45b8-adf2-071de9d2d32b" is overridden locally.',
    ],
  ];
  return $items;
}