Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
During testing I wanted to reinstall Drupal. So I just removed all tables from the database to re-run the installation. Because my database settings haven't changed, I decided to leave the settings.php intact. I'd expect that I'd be redirected to install.php, but instead Drupal fires a huge (ugly) warning.
I know that removing settings.php or the database settings resolves this issue, but that's not what I expected.
Wouldn't it be a simple check to see if we can connect to the database, but that the tables don't exists? And if so, redirect?
Comment | File | Size | Author |
---|---|---|---|
#1 | 890820-redirect-to-install-on-empty-database-1.patch | 979 bytes | BarisW |
re-installing-fires-error.png | 80.95 KB | BarisW |
Comments
Comment #1
BarisW CreditAttribution: BarisW commentedSo, here is a patch. It involves bootstrap, and I'm not sure if this is the best way to do it.
But it works.
Some DB guru should have a look I guess ;)
Comment #2
BarisW CreditAttribution: BarisW commentedOn the other hand, if this is a performance hit, we might leave it like this.
Developers might just visit install.php and ignore the error warning.
Comment #3
Crell CreditAttribution: Crell commentedYes, this adds a query super-early in the bootstrap that we cannot get around. The trigger for "needs install" is actually the settings file, not the database, for that reason. Let's leave that as is.
Comment #4
Damien Tournoud CreditAttribution: Damien Tournoud commentedThis is actually a duplicate of #728702: Visiting index.php should redirect to install.php if settings.php already has database credentials but database is empty..