#281446 by xqus, dropcube, and catch: Improve the requirements check for the installer. Awesome.
parent
99d5d3d67e
commit
4c976d51e6
|
|
@ -14,6 +14,7 @@ Drupal 7.0, xxxx-xx-xx (development version)
|
||||||
* Implemented a pluggable password hashing API supporting alternative
|
* Implemented a pluggable password hashing API supporting alternative
|
||||||
hashing and authentication schemes.
|
hashing and authentication schemes.
|
||||||
- Usability:
|
- Usability:
|
||||||
|
* Improved installer requirements check.
|
||||||
* Improved support for integration of WYSIWYG editors.
|
* Improved support for integration of WYSIWYG editors.
|
||||||
* Implemented drag-and-drop positioning for input format listings.
|
* Implemented drag-and-drop positioning for input format listings.
|
||||||
* Implemented drag-and-drop positioning for language listing.
|
* Implemented drag-and-drop positioning for language listing.
|
||||||
|
|
|
||||||
|
|
@ -414,6 +414,25 @@ function drupal_get_install_files($module_list = array()) {
|
||||||
return $installs;
|
return $installs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get a list of modules required by an installation profile.
|
||||||
|
*
|
||||||
|
* @param profile
|
||||||
|
* Name of profile.
|
||||||
|
* @param locale
|
||||||
|
* Name of locale used (if any).
|
||||||
|
* @return
|
||||||
|
* The list of modules to install.
|
||||||
|
*/
|
||||||
|
function drupal_get_profile_modules($profile, $locale = 'en') {
|
||||||
|
$profile_file = "./profiles/$profile/$profile.profile";
|
||||||
|
require_once($profile_file);
|
||||||
|
|
||||||
|
// Get a list of modules required by this profile.
|
||||||
|
$function = $profile . '_profile_modules';
|
||||||
|
return array_merge(drupal_required_modules(), $function(), ($locale != 'en' ? array('locale') : array()));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Verify an install profile for installation.
|
* Verify an install profile for installation.
|
||||||
*
|
*
|
||||||
|
|
@ -434,11 +453,7 @@ function drupal_verify_profile($profile, $locale) {
|
||||||
install_no_profile_error();
|
install_no_profile_error();
|
||||||
}
|
}
|
||||||
|
|
||||||
require_once $profile_file;
|
$module_list = drupal_get_profile_modules($profile, $locale);
|
||||||
|
|
||||||
// Get a list of modules required by this profile.
|
|
||||||
$function = $profile . '_profile_modules';
|
|
||||||
$module_list = array_merge(drupal_required_modules(), $function(), ($locale != 'en' ? array('locale') : array()));
|
|
||||||
|
|
||||||
// Get a list of modules that exist in Drupal's assorted subdirectories.
|
// Get a list of modules that exist in Drupal's assorted subdirectories.
|
||||||
$present_modules = array();
|
$present_modules = array();
|
||||||
|
|
@ -448,14 +463,22 @@ function drupal_verify_profile($profile, $locale) {
|
||||||
|
|
||||||
// Verify that all of the profile's required modules are present.
|
// Verify that all of the profile's required modules are present.
|
||||||
$missing_modules = array_diff($module_list, $present_modules);
|
$missing_modules = array_diff($module_list, $present_modules);
|
||||||
|
|
||||||
|
$requirements = array();
|
||||||
|
|
||||||
if (count($missing_modules)) {
|
if (count($missing_modules)) {
|
||||||
|
$modules = array();
|
||||||
foreach ($missing_modules as $module) {
|
foreach ($missing_modules as $module) {
|
||||||
drupal_set_message(st('The %module module is required but was not found. Please move it into the <em>modules</em> subdirectory.', array('%module' => $module)), 'error');
|
$modules[] = '<span class="admin-missing">' . drupal_ucfirst($module) . '</span>';
|
||||||
}
|
}
|
||||||
|
$requirements['required_modules'] = array(
|
||||||
|
'title' => st('Required modules'),
|
||||||
|
'value' => st('Required modules not found.'),
|
||||||
|
'severity' => REQUIREMENT_ERROR,
|
||||||
|
'description' => st('The following modules are required but were not found. Please move them into the appropriate modules subdirectory, such as <em>sites/all/modules</em>. Missing modules: !modules', array('!modules' => implode(', ', $modules))),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
else {
|
return $requirements;
|
||||||
return $module_list;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -66,6 +66,7 @@ function _drupal_maintenance_theme() {
|
||||||
drupal_add_css(drupal_get_path('module', 'system') . '/system.css', 'module');
|
drupal_add_css(drupal_get_path('module', 'system') . '/system.css', 'module');
|
||||||
drupal_add_css(drupal_get_path('module', 'system') . '/system-menus.css', 'module');
|
drupal_add_css(drupal_get_path('module', 'system') . '/system-menus.css', 'module');
|
||||||
drupal_add_css(drupal_get_path('module', 'system') . '/maintenance.css', 'module');
|
drupal_add_css(drupal_get_path('module', 'system') . '/maintenance.css', 'module');
|
||||||
|
drupal_add_css(drupal_get_path('module', 'system') . '/admin.css', 'module');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
83
install.php
83
install.php
|
|
@ -122,17 +122,20 @@ function install_main() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check the installation requirements for Drupal and this profile.
|
// Check the installation requirements for Drupal and this profile.
|
||||||
install_check_requirements($profile, $verify);
|
$requirements = install_check_requirements($profile, $verify);
|
||||||
|
|
||||||
// Verify existence of all required modules.
|
// Verify existence of all required modules.
|
||||||
$modules = drupal_verify_profile($profile, $install_locale);
|
$requirements += drupal_verify_profile($profile, $install_locale);
|
||||||
|
|
||||||
// If any error messages are set now, it means a requirement problem.
|
// Check the severity of the requirements reported.
|
||||||
$messages = drupal_set_message();
|
$severity = drupal_requirements_severity($requirements);
|
||||||
if (!empty($messages['error'])) {
|
|
||||||
|
if ($severity == REQUIREMENT_ERROR) {
|
||||||
install_task_list('requirements');
|
install_task_list('requirements');
|
||||||
drupal_set_title(st('Requirements problem'));
|
drupal_set_title(st('Requirements problem'));
|
||||||
print theme('install_page', '');
|
$status_report = theme('status_report', $requirements);
|
||||||
|
$status_report .= st('Please check the error messages and <a href="!url">try again</a>.', array('!url' => request_uri()));
|
||||||
|
print theme('install_page', $status_report);
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -147,6 +150,7 @@ function install_main() {
|
||||||
// Save the list of other modules to install for the 'profile-install'
|
// Save the list of other modules to install for the 'profile-install'
|
||||||
// task. variable_set() can be used now that system.module is installed
|
// task. variable_set() can be used now that system.module is installed
|
||||||
// and drupal is bootstrapped.
|
// and drupal is bootstrapped.
|
||||||
|
$modules = drupal_get_profile_modules($profile, $install_locale);
|
||||||
variable_set('install_profile_modules', array_diff($modules, array('system')));
|
variable_set('install_profile_modules', array_diff($modules, array('system')));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -890,6 +894,8 @@ function install_reserved_tasks() {
|
||||||
* Check installation requirements and report any errors.
|
* Check installation requirements and report any errors.
|
||||||
*/
|
*/
|
||||||
function install_check_requirements($profile, $verify) {
|
function install_check_requirements($profile, $verify) {
|
||||||
|
// Check the profile requirements.
|
||||||
|
$requirements = drupal_check_profile($profile);
|
||||||
|
|
||||||
// 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.
|
||||||
if (!$verify) {
|
if (!$verify) {
|
||||||
|
|
@ -909,48 +915,37 @@ function install_check_requirements($profile, $verify) {
|
||||||
$exists = TRUE;
|
$exists = TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$exists) {
|
if (!$exists) {
|
||||||
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(
|
||||||
<ol>
|
'title' => st('Settings file'),
|
||||||
<li>Copy the %default_file file to %file.</li>
|
'value' => st('The settings file does not exist.'),
|
||||||
<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,
|
||||||
</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')),
|
||||||
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) {
|
elseif ($exists) {
|
||||||
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(
|
||||||
}
|
'title' => st('Settings file'),
|
||||||
}
|
'value' => st('The %file file exists.', array('%file' => $file)),
|
||||||
|
);
|
||||||
// Check the other requirements.
|
}
|
||||||
$requirements = drupal_check_profile($profile);
|
if (!$writable) {
|
||||||
$severity = drupal_requirements_severity($requirements);
|
$requirements['settings file writable'] = array(
|
||||||
|
'title' => st('Settings file'),
|
||||||
// If there are issues, report them.
|
'value' => st('The settings file is not writable.'),
|
||||||
if ($severity == REQUIREMENT_ERROR) {
|
'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')),
|
||||||
foreach ($requirements as $requirement) {
|
);
|
||||||
if (isset($requirement['severity']) && $requirement['severity'] == REQUIREMENT_ERROR) {
|
}
|
||||||
$message = $requirement['description'];
|
elseif ($writable) {
|
||||||
if (isset($requirement['value']) && $requirement['value']) {
|
$requirements['settings file'] = array(
|
||||||
$message .= ' (' . st('Currently using !item !version', array('!item' => $requirement['title'], '!version' => $requirement['value'])) . ')';
|
'title' => st('Settings file'),
|
||||||
}
|
'value' => st('Settings file is writable.'),
|
||||||
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');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return $requirements;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -691,7 +691,7 @@ class DrupalWebTestCase {
|
||||||
|
|
||||||
// Add the specified modules to the list of modules in the default profile.
|
// Add the specified modules to the list of modules in the default profile.
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
$modules = array_unique(array_merge(drupal_verify_profile('default', 'en'), $args));
|
$modules = array_unique(array_merge(drupal_get_profile_modules('default', 'en'), $args));
|
||||||
drupal_install_modules($modules);
|
drupal_install_modules($modules);
|
||||||
|
|
||||||
// Because the schema is static cached, we need to flush
|
// Because the schema is static cached, we need to flush
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue