diff --git a/core/modules/simpletest/tests/system_incompatible_core_version_dependencies_test.info b/core/modules/simpletest/tests/system_incompatible_core_version_dependencies_test.info
new file mode 100644
index 0000000..9b66cf0
--- /dev/null
+++ b/core/modules/simpletest/tests/system_incompatible_core_version_dependencies_test.info
@@ -0,0 +1,7 @@
+name = "System incompatible core version dependencies test"
+description = "Support module for testing system dependencies."
+package = Testing
+version = VERSION
+core = 8.x
+hidden = TRUE
+dependencies[] = system_incompatible_core_version_test
diff --git a/core/modules/simpletest/tests/system_incompatible_core_version_dependencies_test.module b/core/modules/simpletest/tests/system_incompatible_core_version_dependencies_test.module
new file mode 100644
index 0000000..b3d9bbc
--- /dev/null
+++ b/core/modules/simpletest/tests/system_incompatible_core_version_dependencies_test.module
@@ -0,0 +1 @@
+2.0)
diff --git a/core/modules/simpletest/tests/system_incompatible_module_version_dependencies_test.module b/core/modules/simpletest/tests/system_incompatible_module_version_dependencies_test.module
new file mode 100644
index 0000000..b3d9bbc
--- /dev/null
+++ b/core/modules/simpletest/tests/system_incompatible_module_version_dependencies_test.module
@@ -0,0 +1 @@
+name == 'system_dependencies_test') {
$info['hidden'] = FALSE;
}
+ if (in_array($file->name, array(
+ 'system_incompatible_module_version_dependencies_test',
+ 'system_incompatible_core_version_dependencies_test',
+ 'system_incompatible_module_version_test',
+ 'system_incompatible_core_version_test',
+ ))) {
+ $info['hidden'] = FALSE;
+ }
if ($file->name == 'requirements1_test' || $file->name == 'requirements2_test') {
$info['hidden'] = FALSE;
}
diff --git a/core/modules/system/system.admin.inc b/core/modules/system/system.admin.inc
index a5a8885..aa2f98f 100644
--- a/core/modules/system/system.admin.inc
+++ b/core/modules/system/system.admin.inc
@@ -811,6 +811,7 @@ function system_modules($form, $form_state = array()) {
// Only display visible modules.
elseif (isset($visible_files[$requires])) {
$requires_name = $files[$requires]->info['name'];
+ // Disable this module if it is incompatible with the dependency's version.
if ($incompatible_version = drupal_check_incompatibility($v, str_replace(DRUPAL_CORE_COMPATIBILITY . '-', '', $files[$requires]->info['version']))) {
$extra['requires'][$requires] = t('@module (incompatible with version @version)', array(
'@module' => $requires_name . $incompatible_version,
@@ -818,6 +819,14 @@ function system_modules($form, $form_state = array()) {
));
$extra['disabled'] = TRUE;
}
+ // Disable this module if the dependency is incompatible with this
+ // version of Drupal core.
+ elseif ($files[$requires]->info['core'] != DRUPAL_CORE_COMPATIBILITY) {
+ $extra['requires'][$requires] = t('@module (incompatible with this version of Drupal core)', array(
+ '@module' => $requires_name,
+ ));
+ $extra['disabled'] = TRUE;
+ }
elseif ($files[$requires]->status) {
$extra['requires'][$requires] = t('@module (enabled)', array('@module' => $requires_name));
}
diff --git a/core/modules/system/system.test b/core/modules/system/system.test
index 6cf203d..e13b5d3 100644
--- a/core/modules/system/system.test
+++ b/core/modules/system/system.test
@@ -422,6 +422,35 @@ class ModuleDependencyTestCase extends ModuleTestCase {
}
/**
+ * Tests enabling a module that depends on an incompatible version of a module.
+ */
+ function testIncompatibleModuleVersionDependency() {
+ // Test that the system_incompatible_module_version_dependencies_test is
+ // marked as having an incompatible dependency.
+ $this->drupalGet('admin/modules');
+ $this->assertRaw(t('@module (incompatible with version @version)', array(
+ '@module' => 'System incompatible module version test (>2.0)',
+ '@version' => '1.0',
+ )), 'A module that depends on an incompatible version of a module is marked as such.');
+ $checkbox = $this->xpath('//input[@type="checkbox" and @disabled="disabled" and @name="modules[Testing][system_incompatible_module_version_dependencies_test][enable]"]');
+ $this->assert(count($checkbox) == 1, t('Checkbox for the module is disabled.'));
+ }
+
+ /**
+ * Tests enabling a module that depends on a module with an incompatible core version.
+ */
+ function testIncompatibleCoreVersionDependency() {
+ // Test that the system_incompatible_core_version_dependencies_test is
+ // marked as having an incompatible dependency.
+ $this->drupalGet('admin/modules');
+ $this->assertRaw(t('@module (incompatible with this version of Drupal core)', array(
+ '@module' => 'System incompatible core version test',
+ )), 'A module that depends on a module with an incompatible core version is marked as such.');
+ $checkbox = $this->xpath('//input[@type="checkbox" and @disabled="disabled" and @name="modules[Testing][system_incompatible_core_version_dependencies_test][enable]"]');
+ $this->assert(count($checkbox) == 1, t('Checkbox for the module is disabled.'));
+ }
+
+ /**
* Tests enabling a module that depends on a module which fails hook_requirements().
*/
function testEnableRequirementsFailureDependency() {