You are here

function drush_entity_share_client_pull in Entity Share 8.2

Same name and namespace in other branches
  1. 8 modules/entity_share_client/entity_share_client.drush.inc \drush_entity_share_client_pull()

Command callback.

Pull the content of a channel of a remote website.

Parameters

string $remote_id: The remote website id to import from.

string $channel_id: The remote channel id to import.

Return value

bool Return Drush error if an error has occurred.

File

modules/entity_share_client/entity_share_client.drush.inc, line 49

Code

function drush_entity_share_client_pull($remote_id = '', $channel_id = '') {
  $args = func_get_args();
  if (count($args) < 2) {
    return drush_set_error('DRUSH_ARGUMENTS_ERROR', dt('Usage: drush entity-share-client-pull <remote_id> <channel_id>'));
  }
  try {

    // Make the magic happen.
    $update = drush_get_option('update');
    if ($update) {
      \Drupal::service('entity_share_client.cli')
        ->ioPullUpdates($remote_id, $channel_id, new Drush8Io(), 'dt');
    }
    else {
      \Drupal::service('entity_share_client.cli')
        ->ioPull($remote_id, $channel_id, new Drush8Io(), 'dt');
    }
  } catch (Exception $e) {
    return drush_set_error('DRUSH_EXECUTION_ERROR', $e
      ->getMessage());
  }
}