diff -u includes/module.inc includes/module.inc --- includes/module.inc 25 Feb 2010 05:05:27 -0000 +++ includes/module.inc 26 Feb 2010 05:31:30 -0000 @@ -336,6 +336,9 @@ $module_list = array_keys($module_list); } + // Required for module installation checks. + include_once DRUPAL_ROOT . '/includes/install.inc'; + $modules_installed = array(); $modules_enabled = array(); foreach ($module_list as $module) { @@ -381,15 +384,8 @@ // Enable the module. module_invoke($module, 'enable'); - // Check if node_access table needs rebuilding. - // We check for the existence of node_access_needs_rebuild() since - // at install time, module_enable() could be called while node.module - // is not enabled yet. - if (function_exists('node_access_needs_rebuild') && !node_access_needs_rebuild() && module_hook($module, 'node_grants')) { - node_access_needs_rebuild(TRUE); - } - // Record the fact that the module was enabled. + // Record the fact that it was enabled. $modules_enabled[] = $module; watchdog('system', '%module module enabled.', array('%module' => $module), WATCHDOG_INFO); } diff -u modules/simpletest/tests/module.test modules/simpletest/tests/module.test --- modules/simpletest/tests/module.test 25 Feb 2010 05:05:28 -0000 +++ modules/simpletest/tests/module.test 26 Feb 2010 05:31:30 -0000 @@ -143,13 +143,19 @@ /** * Test that calls to drupal_write_record() work during module installation. + * + * This is a useful function to test because modules often use it to insert + * initial data in their database tables when they are being installed or + * enabled. Furthermore, drupal_write_record() relies on the module schema + * information being available, so this also checks that the data from one of + * the module's hook implementations, in particular hook_schema(), is + * properly available during this time. Therefore, this test helps ensure + * that modules are fully functional while Drupal is installing and enabling + * them. */ function testDrupalWriteRecord() { // Check for data that was inserted using drupal_write_record() while the - // 'module_test' module was being installed and enabled. Since - // drupal_write_record() relies on the module schema information being - // available, this also checks that the data from hook_schema() is properly - // available during hook_install() and hook_enable(). + // 'module_test' module was being installed and enabled. $data = db_query("SELECT data FROM {module_test}")->fetchCol(); $this->assertTrue(in_array('Data inserted in hook_install()', $data), t('Data inserted using drupal_write_record() in hook_install() is correctly saved.')); $this->assertTrue(in_array('Data inserted in hook_enable()', $data), t('Data inserted using drupal_write_record() in hook_enable() is correctly saved.')); diff -u modules/system/system.module modules/system/system.module --- modules/system/system.module 25 Feb 2010 05:05:28 -0000 +++ modules/system/system.module 26 Feb 2010 05:31:30 -0000 @@ -2220,14 +2220,14 @@ $query->condition('name', $bootstrap_modules, 'NOT IN'); } $query->execute(); - // Reset the cached list of bootstrap modules. - system_list_reset(); } /** $query->condition('name', $bootstrap_modules, 'NOT IN'); } $query->execute(); + // Reset the cached list of bootstrap modules. + system_list_reset(); } /** only in patch2: unchanged: --- modules/node/node.module 25 Feb 2010 20:12:27 -0000 1.1235 +++ modules/node/node.module 26 Feb 2010 05:31:30 -0000 @@ -3519,6 +3519,17 @@ function node_requirements($phase) { } /** + * Implements hook_modules_enabled(). + */ +function node_modules_enabled($modules) { + // Check if any of the newly enabled modules require the node_access table to + // be rebuilt. + if (!node_access_needs_rebuild() && array_intersect($modules, module_implements('node_grants'))) { + node_access_needs_rebuild(TRUE); + } +} + +/** * Controller class for nodes. * * This extends the DrupalDefaultEntityController class, adding required