diff options
Diffstat (limited to 'includes')
-rw-r--r-- | includes/bootstrap.inc | 4 | ||||
-rw-r--r-- | includes/install.inc | 58 |
2 files changed, 60 insertions, 2 deletions
diff --git a/includes/bootstrap.inc b/includes/bootstrap.inc index c9cd71486..a73a969b4 100644 --- a/includes/bootstrap.inc +++ b/includes/bootstrap.inc @@ -457,7 +457,7 @@ function conf_init() { global $base_url, $base_path, $base_root; // Export the following settings.php variables to the global namespace - global $databases, $db_prefix, $cookie_domain, $conf, $installed_profile, $update_free_access; + global $databases, $db_prefix, $cookie_domain, $conf, $installed_profile, $update_free_access, $db_url; $conf = array(); if (file_exists(DRUPAL_ROOT . '/' . conf_path() . '/settings.php')) { @@ -979,7 +979,7 @@ function watchdog($type, $message, $variables = array(), $severity = WATCHDOG_NO */ function drupal_set_message($message = NULL, $type = 'status', $repeat = TRUE) { if ($message) { - if (!isset($_SESSION['messages'])) { + if (!isset($_SESSION['messages']) && function_exists('drupal_set_session')) { drupal_set_session('messages', array()); } diff --git a/includes/install.inc b/includes/install.inc index 125989679..6eaf8db2c 100644 --- a/includes/install.inc +++ b/includes/install.inc @@ -994,3 +994,61 @@ function drupal_check_module($module) { } return TRUE; } + +/** + * Check installation requirements and report any errors. + */ +function install_check_requirements($profile, $verify) { + // Check the profile requirements. + $requirements = $profile ? drupal_check_profile($profile) : array(); + + // If Drupal is not set up already, we need to create a settings file. + if (!$verify) { + $writable = FALSE; + $conf_path = './' . conf_path(FALSE, TRUE); + $settings_file = $conf_path . '/settings.php'; + $file = $conf_path; + $exists = FALSE; + // Verify that the directory exists. + if (drupal_verify_install_file($conf_path, FILE_EXIST, 'dir')) { + // Check to make sure a settings.php already exists. + $file = $settings_file; + if (drupal_verify_install_file($settings_file, FILE_EXIST)) { + $exists = TRUE; + // If it does, make sure it is writable. + $writable = drupal_verify_install_file($settings_file, FILE_READABLE|FILE_WRITABLE); + $exists = TRUE; + } + } + + if (!$exists) { + $requirements['settings file exists'] = array( + 'title' => st('Settings file'), + 'value' => st('The settings file does not exist.'), + 'severity' => REQUIREMENT_ERROR, + 'description' => st('The @drupal installer requires that you create a settings file as part of the installation process. Copy the %default_file file to %file. More details about installing Drupal are available in <a href="@install_txt">INSTALL.txt</a>.', array('@drupal' => drupal_install_profile_name(), '%file' => $file, '%default_file' => $conf_path .'/default.settings.php', '@install_txt' => base_path() .'INSTALL.txt')), + ); + } + else { + $requirements['settings file exists'] = array( + 'title' => st('Settings file'), + 'value' => st('The %file file exists.', array('%file' => $file)), + ); + if (!$writable) { + $requirements['settings file writable'] = array( + 'title' => st('Settings file'), + 'value' => st('The settings file is not writable.'), + 'severity' => REQUIREMENT_ERROR, + 'description' => st('The @drupal installer requires write permissions to %file during the installation process. If you are unsure how to grant file permissions, please consult the <a href="@handbook_url">online handbook</a>.', array('@drupal' => drupal_install_profile_name(), '%file' => $file, '@handbook_url' => 'http://drupal.org/server-permissions')), + ); + } + else { + $requirements['settings file'] = array( + 'title' => st('Settings file'), + 'value' => st('Settings file is writable.'), + ); + } + } + } + return $requirements; +} |