summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwebchick <webchick@24967.no-reply.drupal.org>2011-11-14 02:28:16 -0500
committerwebchick <webchick@24967.no-reply.drupal.org>2011-11-14 02:28:16 -0500
commit44ef94767fa882ba0d4b832501b72654d2c432ad (patch)
tree21eddfb7fe8d342824b5038d338903b8dd3d3875
parentcfc35a0b3e05245e27516631724c668e11ff955d (diff)
downloadbrdo-44ef94767fa882ba0d4b832501b72654d2c432ad.tar.gz
brdo-44ef94767fa882ba0d4b832501b72654d2c432ad.tar.bz2
Issue #1002258 by tstoeckler, xjm: Fixed D6 modules satisfy D7 module dependencies.
-rw-r--r--modules/simpletest/tests/system_test.module8
-rw-r--r--modules/system/system.admin.inc9
-rw-r--r--modules/system/system.test29
3 files changed, 46 insertions, 0 deletions
diff --git a/modules/simpletest/tests/system_test.module b/modules/simpletest/tests/system_test.module
index 9516c9183..8cb0e837f 100644
--- a/modules/simpletest/tests/system_test.module
+++ b/modules/simpletest/tests/system_test.module
@@ -264,6 +264,14 @@ function system_test_system_info_alter(&$info, $file, $type) {
if ($file->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/modules/system/system.admin.inc b/modules/system/system.admin.inc
index e250bf171..636859062 100644
--- a/modules/system/system.admin.inc
+++ b/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 (<span class="admin-missing">incompatible with</span> 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 (<span class="admin-missing">incompatible with</span> this version of Drupal core)', array(
+ '@module' => $requires_name,
+ ));
+ $extra['disabled'] = TRUE;
+ }
elseif ($files[$requires]->status) {
$extra['requires'][$requires] = t('@module (<span class="admin-enabled">enabled</span>)', array('@module' => $requires_name));
}
diff --git a/modules/system/system.test b/modules/system/system.test
index e95e8c0d5..8b305bc6d 100644
--- a/modules/system/system.test
+++ b/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 (<span class="admin-missing">incompatible with</span> 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 (<span class="admin-missing">incompatible with</span> 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() {