function drush_upgrade_copy_settings

4.x upgrade.drush.inc drush_upgrade_copy_settings(&$target_alias, $settings_destination)

Copy the settings.php file from the source site to the target site, and fix it up so that it will have its own database settings.

1 call to drush_upgrade_copy_settings()
drush_upgrade_site_upgrade in commands/core/upgrade.drush.inc
Main command hook for site-upgrade.

File

commands/core/upgrade.drush.inc, line 592
Refine your Drupal major version upgrade.

Code

function drush_upgrade_copy_settings(&$target_alias, $settings_destination) {
  $settings_destination_folder = dirname($settings_destination);

  // Create sites subdirectory in target if needed.
  $settings_source = conf_path() . '/settings.php';
  if (!file_exists($settings_destination_folder)) {
    if (!drush_op('mkdir', $settings_destination_folder) && !drush_get_context('DRUSH_SIMULATE')) {
      return drush_set_error('DRUSH_UPGRADE_MKDIR_FAILED', dt('Failed to create directory @settings_destination', array('@settings_destination' => $settings_destination_folder)));
    }
  }

  // Copy settings.php to target.
  if (!file_exists($settings_destination)) {
    if (!drush_op('copy', $settings_source, $settings_destination) && !drush_get_context('DRUSH_SIMULATE')) {
      return drush_set_error('DRUSH_UPGRADE_COPY_FAILED', dt('Failed to copy @source to  @dest', array('@source' => $settings_source, 'dest' => $settings_destination)));
    }
  }
  // Append new $db_url with new DB name in target's settings.php.
  return drush_upgrade_fix_db_url($target_alias, $settings_destination);
}