Commit 6529e195 authored by anarcat's avatar anarcat Committed by anarcat

#494358 - fix site import for sites with funky characters in passwords

parent cd1558d4
......@@ -8,11 +8,11 @@ else {
}
if ($parts = @parse_url($db_url)) {
drush_set_option('db_type', $parts['scheme'], 'site');
drush_set_option('db_user', $parts['user'], 'site');
drush_set_option('db_host', $parts['host'], 'site');
drush_set_option('db_passwd', $parts['pass'], 'site');
drush_set_option('db_name', substr($parts['path'], 1), 'site');
drush_set_option('db_type', urldecode($parts['scheme']), 'site');
drush_set_option('db_user', urldecode($parts['user']), 'site');
drush_set_option('db_host', urldecode($parts['host']), 'site');
drush_set_option('db_passwd', urldecode($parts['pass']), 'site');
drush_set_option('db_name', substr(urldecode($parts['path']), 1), 'site');
drush_set_option('profile', variable_get('install_profile', 'default'), 'site');
$has_locale = db_result(db_query("SELECT status FROM {system} WHERE type='module' AND name='locale'"));
......
......@@ -8,11 +8,11 @@ else {
}
if ($parts = @parse_url($db_url)) {
drush_set_option('db_type', $parts['scheme'], 'site');
drush_set_option('db_user', $parts['user'], 'site');
drush_set_option('db_host', $parts['host'], 'site');
drush_set_option('db_passwd', $parts['pass'], 'site');
drush_set_option('db_name', substr($parts['path'], 1), 'site');
drush_set_option('db_type', urldecode($parts['scheme']), 'site');
drush_set_option('db_user', urldecode($parts['user']), 'site');
drush_set_option('db_host', urldecode($parts['host']), 'site');
drush_set_option('db_passwd', urldecode($parts['pass']), 'site');
drush_set_option('db_name', substr(urldecode($parts['path']), 1), 'site');
drush_set_option('profile', variable_get('install_profile', 'default'), 'site');
$language = language_default();
......
<?php
global $databases;
if ($db = $databases['default']['default']) {
drush_set_option('db_type', $db['driver'], 'site');
drush_set_option('db_user', $db['username'], 'site');
drush_set_option('db_host', $db['host'], 'site');
drush_set_option('db_passwd', $db['password'], 'site');
drush_set_option('db_name', $db['database'], 'site');
drush_set_option('db_type', urldecode($db['driver']), 'site');
drush_set_option('db_user', urldecode($db['username']), 'site');
drush_set_option('db_host', urldecode($db['host']), 'site');
drush_set_option('db_passwd', urldecode($db['password']), 'site');
drush_set_option('db_name', urldecode($db['database']), 'site');
drush_set_option('profile', variable_get('install_profile', 'default'), 'site');
$language = language_default();
......
......@@ -6,7 +6,7 @@
'password' => '<?php print $db_passwd; ?>',
'host' => '<?php print $db_host ?>',
);
$db_url = '<?php print "$db_type://$db_user:$db_passwd@$db_host/$db_name"; ?>';
$db_url = '<?php print strtr("%db_type://%db_user:%db_passwd@%db_host/%db_name", array('%db_type' => urlencode($db_type), '%db_user' => urlencode($db_name), '%db_passwd' => urlencode($db_passwd), '%db_host' => urlencode($db_host), '%db_name' => urlencode($db_name))); ?>';
$profile = "<?php print $profile ?>";
/**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment