function drush_sql_sync_init

8.0.x drush_sql_sync_init($source, $destination)
6.x drush_sql_sync_init($source = NULL, $destination = NULL)
7.x drush_sql_sync_init($source, $destination)
4.x drush_sql_sync_init($source = NULL, $destination = NULL)
5.x drush_sql_sync_init($source = NULL, $destination = NULL)
master drush_sql_sync_init($source, $destination)

Sql sync init function. Bootstrap either the source or the destination site. At least one of the sites must be local for this to work; if both sites are remote, then it clearly will not be possible to bootstrap to either of them. If both are local, the source site is preferred.


commands/sql/, line 12


function drush_sql_sync_init($source = NULL, $destination = NULL) {
  // Preflight destination in case it defines the alias used by the source

  // After preflight, get source and destination settings
  $source_settings = drush_sitealias_get_record($source);
  $destination_settings = drush_sitealias_get_record($destination);

  // Insure that we have database records for the source and destination
  // alias records.  sitealias_get_databases_from_record will cache the
  // database info inside the alias records, and drush_sitealias_set_alias_context
  // will copy the database record into the 'alias' context.  We do not
  // actually use the databases record at this time.

  // Bootstrap to the source sites being sync'ed if it is local.  
  // This allows modules enabled in the site to participate in the 
  // sql-sync hook functions (e.g. to add sanitization operations, etc.).
  // If the source is remote and the destination is local, then we
  // will determine the sanitization operations after the database
  // has been copied.
  if (!drush_get_option('deferred-sanitization', FALSE) && drush_get_option(array('sanitize', 'destination-sanitize'), FALSE)) {
    $bootstrapped = drush_bootstrap_max_to_sitealias($source_settings);
    if ($bootstrapped) {
      drush_command_invoke_all('drush_sql_sync_sanitize', $source);
    else {
      drush_set_option('deferred-sanitization', TRUE);

  // By default, sql-sync will do an ordered dump.
  // Set --no-ordered-dump to override.
  if (!drush_get_option('no-ordered-dump', FALSE)) {
    drush_set_option('ordered-dump', TRUE);

  return TRUE;