/**
  * From the provided source information, instantiate the appropriate migrations
  * in the active configuration.
  *
  * @throws \Exception
  */
 public function configure()
 {
     $db_url = drush_get_option('legacy-db-url');
     $db_spec = drush_convert_db_from_db_url($db_url);
     $db_prefix = drush_get_option('legacy-db-prefix');
     $db_spec['prefix'] = $db_prefix;
     $this->migrationList = $this->createMigrations($db_spec, drush_get_option('legacy-root'));
 }
Example #2
0
 public function get_db_spec()
 {
     $db_spec = NULL;
     if ($url = isset($GLOBALS['db_url']) ? $GLOBALS['db_url'] : drush_get_option('db-url', NULL)) {
         $database = drush_get_option('database', 'default');
         $url = is_array($url) ? $url[$database] : $url;
         $db_spec = drush_convert_db_from_db_url($url);
         $db_spec['db_prefix'] = isset($GLOBALS['db_prefix']) ? $GLOBALS['db_prefix'] : drush_get_option('db-prefix', NULL);
     }
     return $db_spec;
 }
Example #3
0
 public function get_db_spec()
 {
     $db_spec = NULL;
     if ($url = isset($GLOBALS['db_url']) ? $GLOBALS['db_url'] : drush_get_option('db-url', NULL)) {
         $database = drush_get_option('database', 'default');
         $url = is_array($url) ? $url[$database] : $url;
         $db_spec = drush_convert_db_from_db_url($url);
         $db_spec['db_prefix'] = isset($GLOBALS['db_prefix']) ? $GLOBALS['db_prefix'] : drush_get_option('db-prefix', NULL);
         // For uniformity with code designed for Drupal 7/8 db_specs, copy the 'db_prefix' to 'prefix'.
         $db_spec['prefix'] = $db_spec['db_prefix'];
     }
     return $db_spec;
 }
Example #4
0
 /**
  * Execute the BackdropBoot::BOOTSTRAP_CONFIGURATION phase.
  *
  * Load in the settings.php file an initialize the database information,
  * config directories, and $settings variable.
  */
 function bootstrap_backdrop_configuration()
 {
     backdrop_bootstrap(BACKDROP_BOOTSTRAP_CONFIGURATION);
     // Set the Drush option for "databases" to work with existing SQL commands
     // as though a --db-url or --databases option were passed in.
     // In the future it should be possible for bootstrap classes like this one
     // to provide the database string directly.
     // See https://github.com/drush-ops/drush/issues/1750.
     $database = drush_get_option('database', 'default');
     $target = drush_get_option('target', 'default');
     $db_url = $url = drush_get_option('db-url');
     $databases = drush_get_option('databases');
     if (!$databases) {
         if ($db_url) {
             $db_spec = drush_convert_db_from_db_url($url);
             $db_spec['db_prefix'] = drush_get_option('db-prefix');
             drush_set_option('databases', array($database => array($target => $db_spec)));
         } else {
             drush_set_option('databases', $GLOBALS['databases']);
         }
     }
     // Unset Backdrop error handler and restore drush's one.
     restore_error_handler();
 }
Example #5
0
 /**
  * Setup the legacy database connection to migrate from.
  */
 protected function setupLegacyDb()
 {
     $db_url = drush_get_option('legacy-db-url');
     $db_spec = drush_convert_db_from_db_url($db_url);
     Database::addConnectionInfo('migrate', 'default', $db_spec);
 }