You are here

function replication_drush_command in Replication 8.2

Same name and namespace in other branches
  1. 8 replication.drush.inc \replication_drush_command()

Implements of hook_drush_command().

File

./replication.drush.inc, line 17
Drush integration for the replication module.

Code

function replication_drush_command() {
  $items = [];
  $items['replication-start'] = [
    'bootstrap' => DRUSH_BOOTSTRAP_NONE,
    'description' => 'Start a replication.',
    'arguments' => [
      'source' => dt('Source database.'),
      'target' => dt('Target database.'),
    ],
    'required-arguments' => TRUE,
    'options' => [
      'continuous' => [
        'description' => dt('Continuous replication.'),
        'default' => FALSE,
      ],
      'replicator' => [
        'description' => dt('The used replicator.'),
      ],
    ],
    'outputformat' => [
      'default' => 'key-value',
      'pipe-format' => 'json',
      'field-labels' => [
        'ok' => 'Status',
        'no_changes' => 'No changes',
        'session_id' => 'Session ID',
        'source_last_seq' => 'Last sequence number',
        'replication_id_version' => 'Replication protocol version',
      ],
      'output-data-type' => 'format-list',
    ],
  ];
  $items['replication-stop'] = [
    'bootstrap' => DRUSH_BOOTSTRAP_NONE,
    'description' => 'Stop a replication.',
    'arguments' => [
      'source' => dt('Source database.'),
      'target' => dt('Target database.'),
    ],
    'required-arguments' => TRUE,
    'options' => [
      'continuous' => [
        'description' => dt('Continuous replication.'),
        'default' => FALSE,
      ],
      'replicator' => [
        'description' => dt('The used replicator.'),
      ],
    ],
    'outputformat' => [
      'default' => 'key-value',
      'pipe-format' => 'json',
      'field-labels' => [
        'ok' => 'Status',
        'no_changes' => 'No changes',
        'session_id' => 'Session ID',
        'source_last_seq' => 'Last sequence number',
        'replication_id_version' => 'Replication protocol version',
      ],
      'output-data-type' => 'format-list',
    ],
  ];
  $items['replication-active'] = [
    'bootstrap' => DRUSH_BOOTSTRAP_NONE,
    'description' => 'Prints information about the specific active replication between target and source databases.',
    'arguments' => [
      'source' => dt('Source database.'),
      'target' => dt('Target database.'),
    ],
    'options' => [
      'replicator' => [
        'description' => dt('The used replicator.'),
      ],
    ],
    'outputformat' => [
      'default' => 'key-value-list',
      'pipe-format' => 'json',
      'field-labels' => [
        'source' => 'Source',
        'target' => 'Target',
        'started_on' => 'Started on',
        'progress' => 'Progress',
        'docs_read' => 'Documents read',
        'docs_written' => 'Documents written',
        'revisions_checked' => 'Revisions checked',
        'doc_write_failures' => 'Write failures',
        'pid' => 'Process ID',
      ],
    ],
  ];
  return $items;
}