diff --git a/core/includes/module.inc b/core/includes/module.inc index 83a3ba6..c6e1f68 100644 --- a/core/includes/module.inc +++ b/core/includes/module.inc @@ -337,7 +337,7 @@ function module_enable($module_list, $enable_dependencies = TRUE) { // below. $module_handler->setModuleList($module_filenames); $module_handler->load($module); - module_load_install($module); + $module_handler->loadInclude($module, 'install'); // Reset the the hook implementations cache. $module_handler->resetImplementations(); diff --git a/core/includes/schema.inc b/core/includes/schema.inc index e599923..abadbab 100644 --- a/core/includes/schema.inc +++ b/core/includes/schema.inc @@ -77,11 +77,12 @@ function drupal_get_complete_schema($rebuild = FALSE) { else { $schema = array(); // Load the .install files to get hook_schema. - drupal_container()->get('module_handler')->loadAllIncludes('install'); + $module_handler = drupal_container()->get('module_handler'); + $module_handler->loadAllIncludes('install'); require_once DRUPAL_ROOT . '/core/includes/common.inc'; // Invoke hook_schema for all modules. - foreach (module_implements('schema') as $module) { + foreach ($module_handler->getImplementations('schema') as $module) { // Cast the result of hook_schema() to an array, as a NULL return value // would cause array_merge() to set the $schema variable to NULL as well. // That would break modules which use $schema further down the line. @@ -271,7 +272,8 @@ function drupal_uninstall_schema($module) { */ function drupal_get_schema_unprocessed($module, $table = NULL) { // Load the .install file to get hook_schema. - module_load_install($module); + $module_handler = drupal_container()->get('module_handler'); + $module_handler->loadInclude($module, 'install'); $schema = module_invoke($module, 'schema'); if (isset($table)) { @@ -299,7 +301,7 @@ function drupal_get_schema_unprocessed($module, $table = NULL) { * and fields to improve performance of serialize() and unserialize(). * Defaults to TRUE. */ -function _drupal_schema_initialize(&$schema, $module, $remove_descriptions = TRUE) { +function _drupal_schema_initialize(array &$schema, $module, $remove_descriptions = TRUE) { // Set the name and module key for all tables. foreach ($schema as $name => &$table) { if (empty($table['module'])) { diff --git a/core/lib/Drupal/Core/Extension/ModuleHandler.php b/core/lib/Drupal/Core/Extension/ModuleHandler.php index 8e1cdb6..1ec7c6d 100644 --- a/core/lib/Drupal/Core/Extension/ModuleHandler.php +++ b/core/lib/Drupal/Core/Extension/ModuleHandler.php @@ -210,14 +210,14 @@ public function loadInclude($module, $type, $name = NULL) { // Make sure the installation API is available include_once DRUPAL_ROOT . '/core/includes/install.inc'; } - - $name = $name ?: $module; + if (!isset($name)) { + $name = $module; + } $file = DRUPAL_ROOT . '/' . dirname($this->moduleList[$module]) . "/$name.$type"; if (is_file($file)) { - require_once $file; + include_once $file; return $file; } - return FALSE; } @@ -242,6 +242,9 @@ public function resetImplementations() { * Implements \Drupal\Core\Extension\ModuleHandlerInterface::implementsHook(). */ public function implementsHook($module, $hook) { + if (!isset($this->moduleList[$module])) { + return FALSE; + } $function = $module . '_' . $hook; if (function_exists($function)) { return TRUE; diff --git a/core/modules/block/lib/Drupal/block/Tests/BlockStorageUnitTest.php b/core/modules/block/lib/Drupal/block/Tests/BlockStorageUnitTest.php index 596b88b..67be119 100644 --- a/core/modules/block/lib/Drupal/block/Tests/BlockStorageUnitTest.php +++ b/core/modules/block/lib/Drupal/block/Tests/BlockStorageUnitTest.php @@ -26,7 +26,7 @@ class BlockStorageUnitTest extends DrupalUnitTestBase { * * @var array */ - public static $modules = array('block_test'); + public static $modules = array('system', 'block_test'); /** * The block storage controller. diff --git a/core/modules/node/node.module b/core/modules/node/node.module index eb56876..a7e340c 100644 --- a/core/modules/node/node.module +++ b/core/modules/node/node.module @@ -880,7 +880,14 @@ function node_rdf_mapping() { */ function node_hook($type, $hook) { $base = node_type_get_base($type); - return module_hook($base, $hook) ? $base . '_' . $hook : FALSE; + $function = $base . '_' . $hook; + if (module_hook($base, $hook)) { + return $function; + } + if ($base == 'node_content' && function_exists($function)) { + return $function; + } + return FALSE; } /** diff --git a/core/modules/views/lib/Drupal/views/Tests/ViewUnitTestBase.php b/core/modules/views/lib/Drupal/views/Tests/ViewUnitTestBase.php index 334b5da..6aa375b 100644 --- a/core/modules/views/lib/Drupal/views/Tests/ViewUnitTestBase.php +++ b/core/modules/views/lib/Drupal/views/Tests/ViewUnitTestBase.php @@ -31,7 +31,7 @@ protected function setUp() { state()->set('views_test_data_schema', $this->schemaDefinition()); state()->set('views_test_data_views_data', $this->viewsData()); - $this->enableModules(array('views', 'views_test_config', 'views_test_data')); + $this->enableModules(array('system', 'views', 'views_test_config', 'views_test_data')); // Load the test dataset. $data_set = $this->dataSet();