When trying to create a custom installation profile that requires a second database to be set up and used, the extra database is never available during the installation tasks. This is due to _install_settings_form_validate()
overriding the global $db_url (D6) or $databases (D7). This means only the default connection is available once the profile tasks are run.
Steps to reproduce:
1. Create a second database connection in settings.php:
Drupal 6:
$db_url = array('default' => 'mysql://username:password@localhost/databasename', 'debug' => 'mysql://username:password@localhost/databasename');
Drupal 7:
$databases['default']['default'] = array(
'driver' => 'mysql',
'database' => 'databasename',
'username' => 'username',
'password' => 'password',
'host' => 'localhost',
);
$databases['debug']['default'] = array(
'driver' => 'mysql',
'database' => 'databasename',
'username' => 'username',
'password' => 'password',
'host' => 'localhost',
);
2. Install using a profile that uses (or at least checks) the extra database connection. I've attached profiles for Drupal 6 and 7 to check this.
Result: the second database connection ('debug') is not available during the installation of the profile.
Expected: the second database connection can be used.
Attached installation profile instructions:
1a) For Drupal 6: create directory 'profiles/debugd6' within the Drupal installation, place the drupald6.profile.gz file there and gunzip it
1b) For Drupal 7: create directory 'profiles/debugd7' within the Drupal installation, place the drupald7.profile.gz file there and gunzip it
2) Clear or create a new database to install Drupal into
3) Set up a 'debug' database connection in the appropriate settings.php file
4) Run install.php
5) Check if the debug connection was found (if you've applied the patch) or not during installation
Patches to resolve this are attached for Drupal 6 (CVS branch) and Drupal 7 (head), as are the two installation profiles to test this (gz files). Once applied, the given profiles show that the debug connection is available.
Comment | File | Size | Author |
---|---|---|---|
debugd6.profile.gz | 624 bytes | haffmans | |
debugd7.profile.gz | 702 bytes | haffmans | |
drupal-install-enable-multiple-dbs-D6.patch | 2.02 KB | haffmans | |
drupal-install-enable-multiple-dbs.patch | 638 bytes | haffmans | |
Comments
Comment #1
moshe weitzman CreditAttribution: moshe weitzman commentedThats utterly harmless. RTBC. Thanks.
Comment #2
webchickHoly cow. And the award for best bug report ever goes to...! Thanks SO much! :D
Committed to HEAD. Moving back to 6.x for consideration. That looks like a much bigger patch, so setting "needs review" again.
Comment #3
multiplextor CreditAttribution: multiplextor commentedClosed. The reason: expired.