This is required to #299308: Installing Drupal by visiting index.php (rather than install.php) leads to a fatal error when PDO is not enabled.
The patch detects during the DRUPAL_BOOTSTRAP_CONFIGURATION phase if there is not a connection defined. In this case, the user is redirected to the installer, permitting to check if PDO is available before including the DB abstraction layer.
| Comment | File | Size | Author |
|---|---|---|---|
| redir-to-install-early.patch | 3.3 KB | dropcube |
Comments
Comment #1
Anonymous (not verified) commentedThe code looks nice; just need some testing. Oops, just found an issue with the _drupal_install_required function in your patch. The install_goto will not be called if it already is defined. The if condition isn't needed since PHP takes care of that naturally.
OT: I think a usability issue is one where the DB isn't available but has been installed already. Should the _drupal_install_required function check for !empty($databases) and put up a no_db.php instead?
Comment #2
dropcube commented@earnie: I created this function from
_db_need_install. Actually, the condition is needed: ifinstall_gotois defined, then we are in an install/update process, so no redirection required.Currently, this is correctly handled by the installer system. What I mean is that the
global $databasesvariable is not defined, because a the settings file is not created or whatever, no that the DB is not available, this is other issue.Comment #3
Anonymous (not verified) commentedBut since install.inc isn't normally included then install_goto will not be defined to give a clue to update versus install. Therefore the if condition will always be met except for during the install phase. Ok, I can see that the install phase will call this function as well and the condition is avoiding endless recursion. I still need to test this.
Comment #4
Anonymous (not verified) commentedThe last submitted patch failed testing.
Comment #5
Paul Natsuo Kishimoto commentedThis was linked from #14 over at the source issue; at #43 a tester reports "The patch in #42 works fine with and without PDO enabled and with and without $databases setting in settings.php." Is this issue no longer needed?
Comment #6
jbrown commentedSee also #674448: Warning when installing Drupal
Comment #7
moshe weitzman commentedno response. downgrading.
Comment #8
David_Rothstein commentedI think this patch might be needed to solve the followup issue that came up at #299308: Installing Drupal by visiting index.php (rather than install.php) leads to a fatal error when PDO is not enabled - in particular the discussion starting at http://drupal.org/node/299308#comment-2501468
The overall approach seems to make sense here. I believe we already call this function on every page request anyway, so it makes sense to consolidate it and try to call it once up front, as early as possible. I wonder a bit if this would affect scripts like update.php or authorize.php in any weird way though - maybe they're OK.
Comment #9
Crell commentedSubscribing.
Comment #10
David_Rothstein commented#299308-141: Installing Drupal by visiting index.php (rather than install.php) leads to a fatal error when PDO is not enabled was committed, which moves the check to the beginning of DRUPAL_BOOSTRAP_DATABASE and solves the PDO problem.
Therefore, marking this fixed (the patch here would have moved it all the way to DRUPAL_BOOTSTRAP_CONFIGURATION but I don't know of any reason why we need it that early - reopen if there is).