You are here

function install_check_requirements in Drupal 6

Same name and namespace in other branches
  1. 8 core/includes/install.core.inc \install_check_requirements()
  2. 5 install.php \install_check_requirements()
  3. 7 includes/install.core.inc \install_check_requirements()
  4. 9 core/includes/install.core.inc \install_check_requirements()
  5. 10 core/includes/install.core.inc \install_check_requirements()

Check installation requirements and report any errors.

1 call to install_check_requirements()
install_main in ./install.php
The Drupal installation happens in a series of steps. We begin by verifying that the current environment meets our minimum requirements. We then go on to verify that settings.php is properly configured. From there we connect to the configured database…

File

./install.php, line 902

Code

function install_check_requirements($profile, $verify) {

  // 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);
      }
    }
    if (!$exists) {
      drupal_set_message(st('The @drupal installer requires that you create a settings file as part of the installation process.
<ol>
<li>Copy the %default_file file to %file.</li>
<li>Change file permissions so that it is writable by the web server. If you are unsure how to grant file permissions, please consult the <a href="@handbook_url">on-line handbook</a>.</li>
</ol>
More details about installing Drupal are available in INSTALL.txt.', array(
        '@drupal' => drupal_install_profile_name(),
        '%file' => $file,
        '%default_file' => $conf_path . '/default.settings.php',
        '@handbook_url' => 'http://drupal.org/server-permissions',
      )), 'error');
    }
    elseif (!$writable) {
      drupal_set_message(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">on-line handbook</a>.', array(
        '@drupal' => drupal_install_profile_name(),
        '%file' => $file,
        '@handbook_url' => 'http://drupal.org/server-permissions',
      )), 'error');
    }
  }

  // Check the other requirements.
  $requirements = drupal_check_profile($profile);
  $severity = drupal_requirements_severity($requirements);

  // If there are issues, report them.
  if ($severity == REQUIREMENT_ERROR) {
    foreach ($requirements as $requirement) {
      if (isset($requirement['severity']) && $requirement['severity'] == REQUIREMENT_ERROR) {
        $message = $requirement['description'];
        if (isset($requirement['value']) && $requirement['value']) {
          $message .= ' (' . st('Currently using !item !version', array(
            '!item' => $requirement['title'],
            '!version' => $requirement['value'],
          )) . ')';
        }
        drupal_set_message($message, 'error');
      }
    }
  }
  if ($severity == REQUIREMENT_WARNING) {
    foreach ($requirements as $requirement) {
      if (isset($requirement['severity']) && $requirement['severity'] == REQUIREMENT_WARNING) {
        $message = $requirement['description'];
        if (isset($requirement['value']) && $requirement['value']) {
          $message .= ' (' . st('Currently using !item !version', array(
            '!item' => $requirement['title'],
            '!version' => $requirement['value'],
          )) . ')';
        }
        drupal_set_message($message, 'warning');
      }
    }
  }
}