summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
Diffstat (limited to 'modules')
-rw-r--r--modules/field/tests/field.test4
-rw-r--r--modules/simpletest/drupal_web_test_case.php8
-rw-r--r--modules/simpletest/tests/module.test22
-rw-r--r--modules/system/system.admin.inc4
-rw-r--r--modules/system/system.install6
-rw-r--r--modules/system/system.module15
-rw-r--r--modules/system/system.test2
7 files changed, 34 insertions, 27 deletions
diff --git a/modules/field/tests/field.test b/modules/field/tests/field.test
index b207bb55e..3052af9ad 100644
--- a/modules/field/tests/field.test
+++ b/modules/field/tests/field.test
@@ -2253,7 +2253,7 @@ class FieldCrudTestCase extends FieldTestCase {
$field = field_read_field($field_name);
$this->assertTrue($field_definition <= $field, t('The field was properly read.'));
- module_disable($modules);
+ module_disable($modules, FALSE);
$fields = field_read_fields(array('field_name' => $field_name), array('include_inactive' => TRUE));
$this->assertTrue(isset($fields[$field_name]) && $field_definition < $field, t('The field is properly read when explicitly fetching inactive fields.'));
@@ -2265,7 +2265,7 @@ class FieldCrudTestCase extends FieldTestCase {
$this->assertTrue(empty($field), t('%modules disabled. The field is marked inactive.', array('%modules' => implode(', ', $modules))));
$module = array_shift($modules);
- module_enable(array($module));
+ module_enable(array($module), FALSE);
}
// Check that the field is active again after all modules have been
diff --git a/modules/simpletest/drupal_web_test_case.php b/modules/simpletest/drupal_web_test_case.php
index c5d2926e9..9ba935559 100644
--- a/modules/simpletest/drupal_web_test_case.php
+++ b/modules/simpletest/drupal_web_test_case.php
@@ -1136,18 +1136,18 @@ class DrupalWebTestCase extends DrupalTestCase {
$this->preloadRegistry();
- // Include the default profile
+ // Include the default profile.
variable_set('install_profile', 'standard');
$profile_details = install_profile_info('standard', 'en');
// Install the modules specified by the default profile.
- drupal_install_modules($profile_details['dependencies'], TRUE);
+ module_enable($profile_details['dependencies'], FALSE, TRUE);
drupal_static_reset('_node_types_build');
if ($modules = func_get_args()) {
// Install modules needed for this test.
- drupal_install_modules($modules, TRUE);
+ module_enable($modules, TRUE, TRUE);
}
// Because the schema is static cached, we need to flush
@@ -1158,7 +1158,7 @@ class DrupalWebTestCase extends DrupalTestCase {
// Run default profile tasks.
$install_state = array();
- drupal_install_modules(array('standard'), TRUE);
+ module_enable(array('standard'), FALSE, TRUE);
// Rebuild caches.
node_types_rebuild();
diff --git a/modules/simpletest/tests/module.test b/modules/simpletest/tests/module.test
index 939804953..242910c7f 100644
--- a/modules/simpletest/tests/module.test
+++ b/modules/simpletest/tests/module.test
@@ -37,7 +37,7 @@ class ModuleUnitTest extends DrupalWebTestCase {
$this->assertModuleList($module_list, t('Standard profile'));
// Try to install a new module.
- drupal_install_modules(array('contact'));
+ module_enable(array('contact'));
$module_list[] = 'contact';
sort($module_list);
$this->assertModuleList($module_list, t('After adding a module'));
@@ -101,25 +101,25 @@ class ModuleUnitTest extends DrupalWebTestCase {
}
/**
- * Test drupal_install_modules() and dependency resolution.
+ * Test dependency resolution.
*/
- function testDrupalInstallModules() {
- drupal_install_modules(array('module_test'));
+ function testDependencyResolution() {
+ module_enable(array('module_test'), FALSE);
$this->assertTrue(module_exists('module_test'), t('Test module is enabled.'));
// First, create a fake missing dependency. Forum depends on poll, which
// depends on a made-up module, foo. Nothing should be installed.
variable_set('dependency_test', 'missing dependency');
- $result = drupal_install_modules(array('forum'));
- $this->assertFalse($result, t('drupal_install_modules() returns FALSE if dependencies are missing.'));
- $this->assertFalse(module_exists('forum'), t('drupal_install_modules() aborts if dependencies are missing.'));
+ $result = module_enable(array('forum'));
+ $this->assertFalse($result, t('module_enable() returns FALSE if dependencies are missing.'));
+ $this->assertFalse(module_exists('forum'), t('module_enable() aborts if dependencies are missing.'));
- // Now, fix the missing dependency. drupal_install_modules() should work.
+ // Now, fix the missing dependency. module_enable() should work.
variable_set('dependency_test', 'dependency');
- $result = drupal_install_modules(array('forum'));
- $this->assertTrue($result, t('drupal_install_modules() returns the correct value.'));
+ $result = module_enable(array('forum'));
+ $this->assertTrue($result, t('module_enable() returns the correct value.'));
// Verify that the fake dependency chain was installed.
- $this->assertTrue(module_exists('poll') && module_exists('php'), t('Dependency chain was installed by drupal_install_modules().'));
+ $this->assertTrue(module_exists('poll') && module_exists('php'), t('Dependency chain was installed by module_enable().'));
// Finally, verify that the original module was installed.
$this->assertTrue(module_exists('forum'), t('Module installation with unlisted dependencies succeeded.'));
}
diff --git a/modules/system/system.admin.inc b/modules/system/system.admin.inc
index c478e0465..fe6af7436 100644
--- a/modules/system/system.admin.inc
+++ b/modules/system/system.admin.inc
@@ -1203,7 +1203,7 @@ function system_modules_submit($form, &$form_state) {
$sort[$module] = $files[$module]->sort;
}
array_multisort($sort, $modules_to_be_enabled);
- module_enable($modules_to_be_enabled);
+ module_enable($modules_to_be_enabled, FALSE);
}
// Disable the modules that need disabling.
if (!empty($disable_modules)) {
@@ -1225,7 +1225,7 @@ function system_modules_submit($form, &$form_state) {
$sort[$module] = $files[$module]->sort;
}
array_multisort($sort, $new_modules);
- drupal_install_modules($new_modules);
+ module_enable($new_modules, FALSE);
}
$current_module_list = module_list(TRUE);
diff --git a/modules/system/system.install b/modules/system/system.install
index c7ef22fd3..b6c02d4e5 100644
--- a/modules/system/system.install
+++ b/modules/system/system.install
@@ -2082,8 +2082,7 @@ function system_update_7018() {
*/
function system_update_7020() {
$module_list = array('field_sql_storage', 'field');
- drupal_install_modules($module_list);
- module_enable($module_list);
+ module_enable($module_list, FALSE);
}
/**
@@ -2305,8 +2304,7 @@ function system_update_7027() {
->condition('type', 'module')
->condition('name', $module_list)
->execute();
- drupal_install_modules($module_list);
- module_enable($module_list);
+ module_enable($module_list, FALSE);
}
/**
diff --git a/modules/system/system.module b/modules/system/system.module
index ef5b72af0..58d135ffb 100644
--- a/modules/system/system.module
+++ b/modules/system/system.module
@@ -2203,7 +2203,18 @@ function system_rebuild_module_data() {
ksort($modules);
system_get_files_database($modules, 'module');
system_update_files_database($modules, 'module');
- // Refresh bootstrap status.
+ $modules = _module_build_dependencies($modules);
+ return $modules;
+}
+
+/**
+ * Refresh bootstrap column in the system table.
+ *
+ * This is called internally by module_enable/disable() to flag modules that
+ * implement hooks used during bootstrap, such as hook_boot(). These modules
+ * are loaded earlier to invoke the hooks.
+ */
+function _system_update_bootstrap_status() {
$bootstrap_modules = array();
foreach (bootstrap_hooks() as $hook) {
foreach (module_implements($hook) as $module) {
@@ -2219,8 +2230,6 @@ function system_rebuild_module_data() {
$query->condition('name', $bootstrap_modules, 'NOT IN');
}
$query->execute();
- $modules = _module_build_dependencies($modules);
- return $modules;
}
/**
diff --git a/modules/system/system.test b/modules/system/system.test
index 03545ce94..4e49ade61 100644
--- a/modules/system/system.test
+++ b/modules/system/system.test
@@ -208,7 +208,7 @@ class ModuleDependencyTestCase extends ModuleTestCase {
$this->assert(count($checkbox) == 1, t('Checkbox for the module is disabled.'));
// Force enable the system_dependencies_test module.
- module_enable(array('system_dependencies_test'));
+ module_enable(array('system_dependencies_test'), FALSE);
// Verify that the module is forced to be disabled when submitting
// the module page.