summaryrefslogtreecommitdiff
path: root/includes
diff options
context:
space:
mode:
Diffstat (limited to 'includes')
-rw-r--r--includes/bootstrap.inc4
-rw-r--r--includes/database.inc5
-rw-r--r--includes/database.mysql.inc11
-rw-r--r--includes/install.inc3
4 files changed, 10 insertions, 13 deletions
diff --git a/includes/bootstrap.inc b/includes/bootstrap.inc
index 377c9711e..505c3872e 100644
--- a/includes/bootstrap.inc
+++ b/includes/bootstrap.inc
@@ -266,7 +266,9 @@ function conf_init() {
global $db_url, $db_prefix, $cookie_domain, $conf, $installed_profile;
$conf = array();
- include_once './'. conf_path() .'/settings.php';
+ if (file_exists('./'. conf_path() .'/settings.php')) {
+ include_once './'. conf_path() .'/settings.php';
+ }
if (isset($base_url)) {
// Parse fixed base URL from settings.php.
diff --git a/includes/database.inc b/includes/database.inc
index f1117b090..3e095e334 100644
--- a/includes/database.inc
+++ b/includes/database.inc
@@ -102,6 +102,11 @@ function db_set_active($name = 'default') {
global $db_url, $db_type, $active_db;
static $db_conns;
+ if (empty($db_url)) {
+ include_once 'includes/install.inc';
+ install_goto('install.php');
+ }
+
if (!isset($db_conns[$name])) {
// Initiate a new connection, using the named DB URL specified.
if (is_array($db_url)) {
diff --git a/includes/database.mysql.inc b/includes/database.mysql.inc
index 72f3a4c7a..1fab19191 100644
--- a/includes/database.mysql.inc
+++ b/includes/database.mysql.inc
@@ -57,11 +57,6 @@ function db_connect($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>
@@ -94,12 +89,6 @@ function db_connect($url) {
// (matched) rows, not the number of affected rows.
$connection = @mysql_connect($url['host'], $url['user'], $url['pass'], TRUE, 2);
if (!$connection) {
- // Redirect to installer if using default DB credentials
- if ($url['user'] == 'username' && $url['pass'] == 'password') {
- include_once 'includes/install.inc';
- install_goto('install.php');
- }
-
// Show error screen otherwise
drupal_maintenance_theme();
drupal_set_header('HTTP/1.1 503 Service Unavailable');
diff --git a/includes/install.inc b/includes/install.inc
index a5d362f5f..0159d6e2a 100644
--- a/includes/install.inc
+++ b/includes/install.inc
@@ -165,6 +165,7 @@ function drupal_detect_database_types() {
* An array of settings that need to be updated.
*/
function drupal_rewrite_settings($settings = array(), $prefix = '') {
+ $default_settings = './sites/default/default.settings.php';
$settings_file = './'. conf_path() .'/'. $prefix .'settings.php';
// Build list of setting names and insert the values into the global namespace.
@@ -176,7 +177,7 @@ function drupal_rewrite_settings($settings = array(), $prefix = '') {
$buffer = NULL;
$first = TRUE;
- if ($fp = @fopen($settings_file, 'r+')) {
+ if ($fp = fopen($default_settings, 'r')) {
// Step line by line through settings.php.
while (!feof($fp)) {
$line = fgets($fp);