function drush_config_pull

8.0.x config.drush.inc drush_config_pull($source, $destination)
master config.drush.inc drush_config_pull($source, $destination)

Config pull command callback

Parameters

string $label: The config label which receives the transferred files.

File

commands/core/config.drush.inc, line 776
Provides Configuration Management commands.

Code

function drush_config_pull($source, $destination) {
  // @todo drush_redispatch_get_options() assumes you will execute same command. Not good.
  $global_options = drush_redispatch_get_options() + array(
    'strict' => 0,
  );

  $backend_options = array('interactive' => FALSE);
  if (drush_get_context('DRUSH_SIMULATE')) {
    $backend_options['backend-simulate'] = TRUE;
  }

  $export_options = array(
    
    // Use the standard backup directory on Destination.
    'destination' => TRUE,
  );
  drush_log(dt('Starting to export configuration on Target.'), LogLevel::OK);
  $return = drush_invoke_process($source, 'config-export', array(), $global_options + $export_options, $backend_options);
  if ($return['error_status']) {
    return drush_set_error('DRUSH_CONFIG_PULL_EXPORT_FAILED', dt('Config-export failed.'));
  }
  else {
    // Trailing slash assures that transer files and not the containing dir.
    $export_path = $return['object'] . '/';
  }

  $rsync_options = array(
    'remove-source-files' => TRUE,
    'delete' => TRUE,
  );
  $label = drush_get_option('label', 'sync');
  $runner = drush_get_runner($source, $destination);
  drush_log(dt('Starting to rsync configuration from Source to Local.'), LogLevel::OK);
  $return = drush_invoke_process($runner, 'core-rsync', array("$source:$export_path", "$destination:%config-$label"), $rsync_options, $backend_options);
  if ($return['error_status']) {
    return drush_set_error('DRUSH_CONFIG_PULL_RSYNC_FAILED', dt('Config-pull rsync failed.'));
  }

  drush_backend_set_result($return['object']);
}