| 1 |
<?php |
<?php |
| 2 |
// $Id: install.php,v 1.132 2008/09/20 03:49:23 webchick Exp $ |
// $Id: install.php,v 1.133 2008/09/20 20:22:23 webchick Exp $ |
| 3 |
|
|
| 4 |
/** |
/** |
| 5 |
* Root directory of Drupal installation. |
* Root directory of Drupal installation. |
| 122 |
} |
} |
| 123 |
|
|
| 124 |
// Check the installation requirements for Drupal and this profile. |
// Check the installation requirements for Drupal and this profile. |
| 125 |
install_check_requirements($profile, $verify); |
$requirements = install_check_requirements($profile, $verify); |
| 126 |
|
|
| 127 |
// Verify existence of all required modules. |
// Verify existence of all required modules. |
| 128 |
$modules = drupal_verify_profile($profile, $install_locale); |
$requirements += drupal_verify_profile($profile, $install_locale); |
| 129 |
|
|
| 130 |
// If any error messages are set now, it means a requirement problem. |
// Check the severity of the requirements reported. |
| 131 |
$messages = drupal_set_message(); |
$severity = drupal_requirements_severity($requirements); |
| 132 |
if (!empty($messages['error'])) { |
|
| 133 |
|
if ($severity == REQUIREMENT_ERROR) { |
| 134 |
install_task_list('requirements'); |
install_task_list('requirements'); |
| 135 |
drupal_set_title(st('Requirements problem')); |
drupal_set_title(st('Requirements problem')); |
| 136 |
print theme('install_page', ''); |
$status_report = theme('status_report', $requirements); |
| 137 |
|
$status_report .= st('Please check the error messages and <a href="!url">try again</a>.', array('!url' => request_uri())); |
| 138 |
|
print theme('install_page', $status_report); |
| 139 |
exit; |
exit; |
| 140 |
} |
} |
| 141 |
|
|
| 150 |
// Save the list of other modules to install for the 'profile-install' |
// Save the list of other modules to install for the 'profile-install' |
| 151 |
// task. variable_set() can be used now that system.module is installed |
// task. variable_set() can be used now that system.module is installed |
| 152 |
// and drupal is bootstrapped. |
// and drupal is bootstrapped. |
| 153 |
|
$modules = drupal_get_profile_modules($profile, $install_locale); |
| 154 |
variable_set('install_profile_modules', array_diff($modules, array('system'))); |
variable_set('install_profile_modules', array_diff($modules, array('system'))); |
| 155 |
} |
} |
| 156 |
|
|
| 894 |
* Check installation requirements and report any errors. |
* Check installation requirements and report any errors. |
| 895 |
*/ |
*/ |
| 896 |
function install_check_requirements($profile, $verify) { |
function install_check_requirements($profile, $verify) { |
| 897 |
|
// Check the profile requirements. |
| 898 |
|
$requirements = drupal_check_profile($profile); |
| 899 |
|
|
| 900 |
// If Drupal is not set up already, we need to create a settings file. |
// If Drupal is not set up already, we need to create a settings file. |
| 901 |
if (!$verify) { |
if (!$verify) { |
| 915 |
$exists = TRUE; |
$exists = TRUE; |
| 916 |
} |
} |
| 917 |
} |
} |
| 918 |
|
|
| 919 |
if (!$exists) { |
if (!$exists) { |
| 920 |
drupal_set_message(st('The @drupal installer requires that you create a settings file as part of the installation process. |
$requirements['settings file exists'] = array( |
| 921 |
<ol> |
'title' => st('Settings file'), |
| 922 |
<li>Copy the %default_file file to %file.</li> |
'value' => st('The settings file does not exist.'), |
| 923 |
<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> |
'severity' => REQUIREMENT_ERROR, |
| 924 |
</ol> |
'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 INSTALL.txt.', array('@drupal' => drupal_install_profile_name(), '%file' => $file, '%default_file' => $conf_path .'/default.settings.php')), |
| 925 |
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'); |
); |
| 926 |
} |
} |
| 927 |
elseif (!$writable) { |
elseif ($exists) { |
| 928 |
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">online handbook</a>.', array('@drupal' => drupal_install_profile_name(), '%file' => $file, '@handbook_url' => 'http://drupal.org/server-permissions')), 'error'); |
$requirements['settings file exists'] = array( |
| 929 |
|
'title' => st('Settings file'), |
| 930 |
|
'value' => st('The %file file exists.', array('%file' => $file)), |
| 931 |
|
); |
| 932 |
} |
} |
| 933 |
} |
if (!$writable) { |
| 934 |
|
$requirements['settings file writable'] = array( |
| 935 |
// Check the other requirements. |
'title' => st('Settings file'), |
| 936 |
$requirements = drupal_check_profile($profile); |
'value' => st('The settings file is not writable.'), |
| 937 |
$severity = drupal_requirements_severity($requirements); |
'severity' => REQUIREMENT_ERROR, |
| 938 |
|
'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')), |
| 939 |
// 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'); |
|
|
} |
|
| 940 |
} |
} |
| 941 |
} |
elseif ($writable) { |
| 942 |
if ($severity == REQUIREMENT_WARNING) { |
$requirements['settings file'] = array( |
| 943 |
|
'title' => st('Settings file'), |
| 944 |
foreach ($requirements as $requirement) { |
'value' => st('Settings file is writable.'), |
| 945 |
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'); |
|
|
} |
|
| 946 |
} |
} |
| 947 |
} |
} |
| 948 |
|
return $requirements; |
| 949 |
} |
} |
| 950 |
|
|
| 951 |
/** |
/** |