Commit 10edd51e authored by webchick's avatar webchick
Browse files

#850206 by Stevel: Fixed Converting db configuration gives wrong result when () is set.

parent 0ed10779
......@@ -560,7 +560,7 @@ function drupal_settings_initialize() {
global $base_url, $base_path, $base_root;
// Export the following settings.php variables to the global namespace
global $databases, $cookie_domain, $conf, $installed_profile, $update_free_access, $db_url, $drupal_hash_salt, $is_https, $base_secure_url, $base_insecure_url;
global $databases, $cookie_domain, $conf, $installed_profile, $update_free_access, $db_url, $db_prefix, $drupal_hash_salt, $is_https, $base_secure_url, $base_insecure_url;
$conf = array();
if (file_exists(DRUPAL_ROOT . '/' . conf_path() . '/settings.php')) {
......
......@@ -75,9 +75,9 @@ function update_prepare_d7_bootstrap() {
// still being used.
include_once DRUPAL_ROOT . '/includes/install.inc';
drupal_bootstrap(DRUPAL_BOOTSTRAP_CONFIGURATION);
global $databases, $db_url, $update_rewrite_settings;
global $databases, $db_url, $db_prefix, $update_rewrite_settings;
if (empty($databases) && !empty($db_url)) {
$databases = update_parse_db_url($db_url);
$databases = update_parse_db_url($db_url, $db_prefix);
// Record the fact that the settings.php file will need to be rewritten.
$update_rewrite_settings = TRUE;
$settings_file = conf_path() . '/settings.php';
......@@ -312,9 +312,9 @@ function update_fix_d7_requirements() {
// Rewrite the settings.php file if necessary, see
// update_prepare_d7_bootstrap().
global $update_rewrite_settings, $db_url;
global $update_rewrite_settings, $db_url, $db_prefix;
if (!empty($update_rewrite_settings)) {
$databases = update_parse_db_url($db_url);
$databases = update_parse_db_url($db_url, $db_prefix);
$salt = drupal_hash_base64(drupal_random_bytes(55));
file_put_contents(conf_path() . '/settings.php', "\n" . '$databases = ' . var_export($databases, TRUE) . ";\n\$drupal_hash_salt = '$salt';", FILE_APPEND);
}
......@@ -674,7 +674,7 @@ function update_fix_d7_install_profile() {
* @return
* Drupal 7 DBTNG compatible array of database connection information.
*/
function update_parse_db_url($db_url) {
function update_parse_db_url($db_url, $db_prefix) {
$databases = array();
if (!is_array($db_url)) {
$db_url = array('default' => $db_url);
......@@ -691,6 +691,9 @@ function update_parse_db_url($db_url) {
'host' => urldecode($url['host']),
'port' => isset($url['port']) ? urldecode($url['port']) : '',
);
if (isset($db_prefix)) {
$databases[$database]['default']['prefix'] = $db_prefix;
}
}
return $databases;
}
......
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