Install.php does not correctly check the database settings

justinrandell - August 25, 2008 - 12:25
Project:Drupal
Version:7.x-dev
Component:database system
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed
Description

the following docs from default.settings.php don't seem to match the behaviour of the installer:

<?php
* For a single database configuration, the following is sufficient:
*
*
$databases = array(
*  
'driver' => 'mysql',
*  
'database' => 'databasename',
*  
'username' => 'username',
*  
'password' => 'password',
*  
'host' => 'localhost',
* );
*
*
That is equivalent to:
*
*
$databases['default']['default'] = array(
*  
'driver' => 'mysql',
*  
'database' => 'databasename',
*  
'username' => 'username',
*  
'password' => 'password',
*  
'host' => 'localhost',
* );
?>

when i use the following in settings.php for a fresh install of HEAD:

<?php
$databases
= array(
 
'driver' => 'mysql',
 
'database' => 'databasename',
 
'username' => 'username',
 
'password' => 'password',
 
'host' => 'localhost',
);
?>

i get the following error:

In your ./sites/default/settings.php file you have configured Drupal to use a  server, however your PHP installation currently does not support this database type.

so, is the code wrong or is the doco wrong?

#1

justinrandell - August 25, 2008 - 13:22
Status:active» duplicate

closing this, as it seems to be a duplicate of Select MySQL as default database driver, and fix a E_ALL warning during install.

sorry for the noise.

#2

Damien Tournoud - August 25, 2008 - 13:42
Status:duplicate» active

This has nothing to do with the other one.

#3

Crell - August 28, 2008 - 09:44
Status:active» postponed (maintainer needs more info)

That looks like a bug in the code, because that fallback logic is supposed to work.

I have actually been pondering removing the fancy-schmancy fallback nesting. It just burns cycles on bootstrap, and with the installer 95% of users will never write their own settings.php file anyway.

Would anyone object greatly if we just got rid of the crazy fallback stuff? I don't think it serves any purpose now that we have an automated installer.

#4

Damien Tournoud - August 28, 2008 - 09:48

Crell: the fallback logic does not work in the installer, there is a:

<?php
$database
= $databases['default']['default'];
?>

in install_verify_settings()...

#5

justinrandell - September 5, 2008 - 12:15

i had a look at this, its not a trivial fix. i'm totally fine with removing/simplifying the fallback code.

EDIT: and i'd be happy to supply a doc fix patch if that's the way we decide to go.

#6

oadaeh - September 15, 2008 - 15:18
Title:docs in default.settings.php out of sync with code» Install.php does not correctly check the database settings
Assigned to:justinrandell» Anonymous
Status:postponed (maintainer needs more info)» needs review

I think this problem can be fixed with a simple if/then conditional.

(I'm tempted to mark this as critical, because I wasted over an hour on it when attempting to do a "quick" 15 minute patch review and update.)

AttachmentSize
install.php_.patch 748 bytes

#7

oadaeh - September 15, 2008 - 15:29
Assigned to:Anonymous» oadaeh
Status:needs review» needs work

Okay, that wasn't enough. I'll see if I can find where else this needs to be corrected and upload a new patch.

#8

oadaeh - September 15, 2008 - 16:41

The patch I provided (in #6) fixes the install problem, but doesn't fix the bootstrap problem that happens after Drupal is successfully installed. I've spent quite a bit of time following threads and have not yet been able to locate where it strays. I will have to come back to this later, as I need to leave for out appointments, unless the consensus is to just remove it.

#9

oadaeh - September 29, 2008 - 03:43

I finally got back to this. (I actually forgot about it.) After rereading this thread and reliving my experiences, I agree with Crell on this issue.

#10

oadaeh - September 29, 2008 - 05:45
Assigned to:oadaeh» Anonymous
Status:needs work» active

#11

smk-ka - September 30, 2008 - 21:39
Status:active» needs review

Let's get rid of it. The reason has been named before: manual editing isn't required anymore, which means this feature will be hardly ever used.

AttachmentSize
databases.patch 3.88 KB

#12

Dries - October 1, 2008 - 13:40

+1 for removing and optimizing the hell out of the bootstrap process.

#13

Crell - October 6, 2008 - 02:13
Status:needs review» reviewed & tested by the community

Oh that is so much prettier! I just ran the Connection tests and clicked around a bit and everything runs fine. #11 is RTBC. Thanks, smk-ka!

#14

Dries - October 6, 2008 - 10:54
Status:reviewed & tested by the community» fixed

Committed to CVS HEAD. Thanks for the review, Crell.

#15

Anonymous (not verified) - October 20, 2008 - 11:02
Status:fixed» closed

Automatically closed -- issue fixed for two weeks with no activity.

 
 

Drupal is a registered trademark of Dries Buytaert.