Commit f11db319 authored by Dries's avatar Dries

- Patch #228860 by tstoeckler, Mike Wacker, flickerfly, randallknutson,...

- Patch #228860 by tstoeckler, Mike Wacker, flickerfly, randallknutson, gordon: upgrading a module with a newly added dependencies breaks things badly.
parent 589ec7b7
......@@ -914,7 +914,7 @@ function system_modules($form, $form_state = array()) {
foreach ($module->required_by as $required_by => $v) {
// Hidden modules are unset already.
if (isset($visible_files[$required_by])) {
if ($files[$required_by]->status == 1) {
if ($files[$required_by]->status == 1 && $module->status == 1) {
$extra['required_by'][] = t('@module (<span class="admin-enabled">enabled</span>)', array('@module' => $files[$required_by]->info['name']));
$extra['disabled'] = TRUE;
}
......
......@@ -358,6 +358,62 @@ function system_requirements($phase) {
$requirements['update access']['title'] = $t('Access to update.php');
}
// Display an error if a newly introduced dependency in a module is not resolved.
if ($phase == 'update') {
$files = system_rebuild_module_data();
foreach ($files as $module => $file) {
// Ignore disabled modules.
if (!$file->status) {
continue;
}
// Check the module's PHP version.
$name = $file->info['name'];
$php = $file->info['php'];
if (version_compare($php, PHP_VERSION, '>')) {
$requirements['php']['description'] .= $t('@name requires at least PHP @version.', array('@name' => $name, '@version' => $php));
$requirements['php']['severity'] = REQUIREMENT_ERROR;
}
// Check the module's required modules.
foreach ($file->requires as $requirement) {
$required_module = $requirement['name'];
// Check if the module exists.
if (!isset($files[$required_module])) {
$requirements["$module-$required_module"] = array(
'title' => $t('Unresolved dependency'),
'description' => $t('@name requires this module.', array('@name' => $name)),
'value' => t('@required_name (Missing)', array('@required_name' => $required_module)),
'severity' => REQUIREMENT_ERROR,
);
continue;
}
// Check for an incompatible version.
$required_file = $files[$required_module];
$required_name = $required_file->info['name'];
$version = str_replace(DRUPAL_CORE_COMPATIBILITY . '-', '', $required_file->info['version']);
$compatibility = drupal_check_incompatibility($requirement, $version);
if ($compatibility) {
$compatibility = rtrim(substr($compatibility, 2), ')');
$requirements["$module-$required_module"] = array(
'title' => $t('Unresolved dependency'),
'description' => $t('@name requires this module and version. Currently using @required_name version @version', array('@name' => $name, '@required_name' => $required_name, '@version' => $version)),
'value' => t('@required_name (Version @compatibility required)', array('@required_name' => $required_name, '@compatibility' => $compatibility)),
'severity' => REQUIREMENT_ERROR,
);
continue;
}
// Check for a disabled dependency.
if (!$required_file->status) {
$requirements["$module-$required_module"] = array(
'title' => $t('Unresolved dependency'),
'description' => $t('@name requires this module.', array('@name' => $name)),
'value' => $t('@required_name (Disabled)', array('@required_name' => $required_name)),
'severity' => REQUIREMENT_ERROR,
);
}
}
}
}
// Test Unicode library
include_once DRUPAL_ROOT . '/includes/unicode.inc';
$requirements = array_merge($requirements, unicode_requirements());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment