summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteven Wittens <steven@10.no-reply.drupal.org>2007-01-22 02:20:42 +0000
committerSteven Wittens <steven@10.no-reply.drupal.org>2007-01-22 02:20:42 +0000
commit2e25a97e9d884f736344624b85174dc3ce775074 (patch)
tree9bc7f531bed3878820c9a91ab3ee6fc58e8a1550
parent5f84319cebba89f9382a27bf2363f031ba4481ed (diff)
downloadbrdo-2e25a97e9d884f736344624b85174dc3ce775074.tar.gz
brdo-2e25a97e9d884f736344624b85174dc3ce775074.tar.bz2
#102387: index.php does not redirect to install.php if PHP does not support 'mysql'.
-rw-r--r--includes/database.mysql.inc9
1 files changed, 7 insertions, 2 deletions
diff --git a/includes/database.mysql.inc b/includes/database.mysql.inc
index 0e553e3f3..365bf22a6 100644
--- a/includes/database.mysql.inc
+++ b/includes/database.mysql.inc
@@ -53,8 +53,15 @@ function db_version() {
* (e.g. your database and web server live on different machines).
*/
function db_connect($url) {
+ $url = parse_url($url);
+
// Check if MySQL support is present in PHP
if (!function_exists('mysql_connect')) {
+ // Redirect to installer if using default DB credentials
+ if ($url['user'] == 'username' && $url['pass'] == 'password') {
+ include_once 'includes/install.inc';
+ install_goto('install.php');
+ }
drupal_maintenance_theme();
drupal_set_title('PHP MySQL support not enabled');
print theme('maintenance_page', '<p>We were unable to use the MySQL database because the MySQL extension for PHP is not installed. Check your <code>PHP.ini</code> to see how you can enable it.</p>
@@ -62,8 +69,6 @@ function db_connect($url) {
exit;
}
- $url = parse_url($url);
-
// Decode url-encoded information in the db connection string
$url['user'] = urldecode($url['user']);
// Test if database url has a password.