diff -u b/core/includes/language.inc b/core/includes/language.inc --- b/core/includes/language.inc +++ b/core/includes/language.inc @@ -203,8 +203,8 @@ */ function language_types_set(array $configurable_language_types) { // Ensure that we are getting the defined language negotiation information. An - // invocation of module_install() or module_uninstall() could outdate the - // cached information. + // invocation of \Drupal\Core\Extension\ModuleHandler::install() or + // module_uninstall() could outdate the cached information. drupal_static_reset('language_types_info'); drupal_static_reset('language_negotiation_info'); @@ -343,8 +343,8 @@ */ function language_negotiation_purge() { // Ensure that we are getting the defined language negotiation information. An - // invocation of module_install() or module_uninstall() could outdate the - // cached information. + // invocation of \Drupal\Core\Extension\ModuleHandler::install() or + // module_uninstall() could outdate the cached information. drupal_static_reset('language_negotiation_info'); drupal_static_reset('language_types_info'); diff -u b/core/includes/module.inc b/core/includes/module.inc --- b/core/includes/module.inc +++ b/core/includes/module.inc @@ -205,27 +205,17 @@ * Installs a given list of modules. * * @deprecated as of Drupal 8.0. Use - * Drupal::moduleHandler()->install($module_list, $enable_dependencies = TRUE) + * Drupal::moduleHandler()->install($module_list, $enable_dependencies = TRUE) */ function module_enable($module_list, $enable_dependencies = TRUE) { return Drupal::moduleHandler()->install($module_list, $enable_dependencies); } /** - * Installs a given list of modules. - * - * @deprecated as of Drupal 8.0. Use - * Drupal::moduleHandler()->install($module_list, $enable_dependencies = TRUE). - */ -function module_install($module_list, $enable_dependencies = TRUE) { - return Drupal::moduleHandler()->install($module_list, $enable_dependencies); -} - -/** * Uninstalls a given list of modules. * * @deprecated as of Drupal 8.0. Use - * Drupal::moduleHandler()->uninstall($module_list, $uninstall_dependents = TRUE). + * Drupal::moduleHandler()->uninstall($module_list, $uninstall_dependents = TRUE) */ function module_uninstall($module_list = array(), $uninstall_dependents = TRUE) { return Drupal::moduleHandler()->uninstall($module_list, $uninstall_dependents); @@ -235,7 +225,7 @@ * Uninstalls a given list of modules. * * @deprecated as of Drupal 8.0. Use - * Drupal::moduleHandler()->uninstall($module_list, $uninstall_dependents = TRUE) + * Drupal::moduleHandler()->uninstall($module_list, $uninstall_dependents = TRUE) */ function module_disable($module_list, $uninstall_dependents = TRUE) { return Drupal::moduleHandler()->uninstall($module_list, $uninstall_dependents); @@ -341,7 +331,7 @@ ->save(); // Prepare the new module list, sorted by weight, including filenames. - // @see module_install() + // @see \Drupal\Core\Extension\ModuleHandler::install() $module_handler = Drupal::moduleHandler(); $current_module_filenames = $module_handler->getModuleList(); $current_modules = array_fill_keys(array_keys($current_module_filenames), 0); diff -u b/core/includes/update.inc b/core/includes/update.inc --- b/core/includes/update.inc +++ b/core/includes/update.inc @@ -468,7 +468,7 @@ */ function update_prepare_d8_language() { if (db_table_exists('languages')) { - module_install(array('language')); + Drupal::moduleHandler()->install(array('language')); $languages = db_select('languages', 'l') ->fields('l') @@ -660,7 +660,7 @@ // Make sure that file.module is enabled as it is required for the user // picture upgrade path. - module_install(array('file')); + Drupal::moduleHandler()->install(array('file')); $schema = array( 'description' => 'Generic key/value storage table with an expiration.', @@ -705,7 +705,7 @@ // Like any other module APIs and services, Views' services are not available // in update.php. Existing listings are migrated into configuration, using // the limited standard tools of raw database queries and Drupal::config(). - module_install(array('views')); + Drupal::moduleHandler()->install(array('views')); update_variable_set('update_d8_requirements', TRUE); } diff -u b/core/modules/block/block.install b/core/modules/block/block.install --- b/core/modules/block/block.install +++ b/core/modules/block/block.install @@ -180,7 +180,7 @@ * Enable the Custom Block module. */ function block_update_8006() { - module_install(array('custom_block')); + Drupal::moduleHandler()->install(array('custom_block')); } /** diff -u b/core/modules/block/lib/Drupal/block/Tests/BlockTest.php b/core/modules/block/lib/Drupal/block/Tests/BlockTest.php --- b/core/modules/block/lib/Drupal/block/Tests/BlockTest.php +++ b/core/modules/block/lib/Drupal/block/Tests/BlockTest.php @@ -213,7 +213,7 @@ * Test _block_rehash(). */ function testBlockRehash() { - module_install(array('block_test')); + \Drupal::moduleHandler()->install(array('block_test')); $this->assertTrue(module_exists('block_test'), 'Test block module enabled.'); // Clear the block cache to load the block_test module's block definitions. diff -u b/core/modules/ckeditor/lib/Drupal/ckeditor/Tests/CKEditorAdminTest.php b/core/modules/ckeditor/lib/Drupal/ckeditor/Tests/CKEditorAdminTest.php --- b/core/modules/ckeditor/lib/Drupal/ckeditor/Tests/CKEditorAdminTest.php +++ b/core/modules/ckeditor/lib/Drupal/ckeditor/Tests/CKEditorAdminTest.php @@ -145,7 +145,7 @@ // Now enable the ckeditor_test module, which provides one configurable // CKEditor plugin — this should not affect the Editor config entity. - module_install(array('ckeditor_test')); + \Drupal::moduleHandler()->install(array('ckeditor_test')); $this->container->get('plugin.manager.ckeditor.plugin')->clearCachedDefinitions(); $this->drupalGet('admin/config/content/formats/manage/filtered_html'); $ultra_llama_mode_checkbox = $this->xpath('//input[@type="checkbox" and @name="editor[settings][plugins][llama_contextual_and_button][ultra_llama_mode]" and not(@checked)]'); diff -u b/core/modules/ckeditor/lib/Drupal/ckeditor/Tests/CKEditorLoadingTest.php b/core/modules/ckeditor/lib/Drupal/ckeditor/Tests/CKEditorLoadingTest.php --- b/core/modules/ckeditor/lib/Drupal/ckeditor/Tests/CKEditorLoadingTest.php +++ b/core/modules/ckeditor/lib/Drupal/ckeditor/Tests/CKEditorLoadingTest.php @@ -119,7 +119,7 @@ // NOTE: the tests in CKEditorTest already ensure that changing the // configuration also results in modified CKEditor configuration, so we // don't test that here. - module_install(array('ckeditor_test')); + \Drupal::moduleHandler()->install(array('ckeditor_test')); $this->container->get('plugin.manager.ckeditor.plugin')->clearCachedDefinitions(); $editor->settings['toolbar']['buttons'][0][] = 'Llama'; $editor->save(); diff -u b/core/modules/comment/comment.install b/core/modules/comment/comment.install --- b/core/modules/comment/comment.install +++ b/core/modules/comment/comment.install @@ -54,7 +54,7 @@ * is enabled. We use hook_modules_installed() rather than hook_install() so we * can react to node types of existing modules, and those of modules being * enabled both before and after the Comment module in the loop of - * module_install(). + * \Drupal\Core\Extension\ModuleHandler::install(). * * There is a separate comment bundle for each node type to allow for * per-node-type customization of comment fields. Each one of these bundles diff -u b/core/modules/config/lib/Drupal/config/Tests/ConfigInstallWebTest.php b/core/modules/config/lib/Drupal/config/Tests/ConfigInstallWebTest.php --- b/core/modules/config/lib/Drupal/config/Tests/ConfigInstallWebTest.php +++ b/core/modules/config/lib/Drupal/config/Tests/ConfigInstallWebTest.php @@ -37,7 +37,7 @@ $default_configuration_entity = 'config_test.dynamic.config_integration_test'; // Install the config_test module we're integrating with. - module_install(array('config_test')); + \Drupal::moduleHandler()->install(array('config_test')); // Verify the configuration does not exist prior to installation. $config_static = \Drupal::config($default_config); @@ -46,7 +46,7 @@ $this->assertIdentical($config_entity->isNew(), TRUE); // Install the integration module. - module_install(array('config_integration_test')); + \Drupal::moduleHandler()->install(array('config_integration_test')); // Verify that default module config exists. $config_static = \Drupal::config($default_config); @@ -79,7 +79,7 @@ $this->assertIdentical($config_entity->get('label'), 'Customized integration config label'); // Reinstall the integration module. - module_install(array('config_integration_test')); + \Drupal::moduleHandler()->install(array('config_integration_test')); // Verify the integration module's config was re-installed. $config_static = \Drupal::config($default_config); diff -u b/core/modules/editor/lib/Drupal/editor/Tests/EditorAdminTest.php b/core/modules/editor/lib/Drupal/editor/Tests/EditorAdminTest.php --- b/core/modules/editor/lib/Drupal/editor/Tests/EditorAdminTest.php +++ b/core/modules/editor/lib/Drupal/editor/Tests/EditorAdminTest.php @@ -104,7 +104,7 @@ * Enables the unicorn editor. */ protected function enableUnicornEditor() { - module_install(array('editor_test')); + \Drupal::moduleHandler()->install(array('editor_test')); $this->rebuildContainer(); $this->resetAll(); } diff -u b/core/modules/field/lib/Drupal/field/Tests/FieldImportCreateTest.php b/core/modules/field/lib/Drupal/field/Tests/FieldImportCreateTest.php --- b/core/modules/field/lib/Drupal/field/Tests/FieldImportCreateTest.php +++ b/core/modules/field/lib/Drupal/field/Tests/FieldImportCreateTest.php @@ -44,7 +44,7 @@ // Enable field_test_config module and check that the field and instance // shipped in the module's default config were created. - module_install(array('field_test_config')); + \Drupal::moduleHandler()->install(array('field_test_config')); // A field with one instance. $field = entity_load('field_entity', $field_id); diff -u b/core/modules/forum/lib/Drupal/forum/Tests/ForumTest.php b/core/modules/forum/lib/Drupal/forum/Tests/ForumTest.php --- b/core/modules/forum/lib/Drupal/forum/Tests/ForumTest.php +++ b/core/modules/forum/lib/Drupal/forum/Tests/ForumTest.php @@ -230,7 +230,7 @@ $this->assertEqual(0, $nid_count, 'A forum node was not created when missing a forum vocabulary.'); // Reset the defaults for future tests. - module_install(array('forum')); + \Drupal::moduleHandler()->install(array('forum')); } /** diff -u b/core/modules/language/lib/Drupal/language/Tests/LanguageNegotiationInfoTest.php b/core/modules/language/lib/Drupal/language/Tests/LanguageNegotiationInfoTest.php --- b/core/modules/language/lib/Drupal/language/Tests/LanguageNegotiationInfoTest.php +++ b/core/modules/language/lib/Drupal/language/Tests/LanguageNegotiationInfoTest.php @@ -138,8 +138,7 @@ // Install/uninstall language_test only if we did not already before. if ($last_op != $op) { - $function = "module_{$op}"; - $function($modules); + call_user_func(array($this->container->get('module_handler'), $op), $modules); // Reset hook implementation cache. $this->container->get('module_handler')->resetImplementations(); } diff -u b/core/modules/locale/lib/Drupal/locale/Tests/LocaleContentTest.php b/core/modules/locale/lib/Drupal/locale/Tests/LocaleContentTest.php --- b/core/modules/locale/lib/Drupal/locale/Tests/LocaleContentTest.php +++ b/core/modules/locale/lib/Drupal/locale/Tests/LocaleContentTest.php @@ -214,7 +214,7 @@ * Test filtering Node content by language. */ function testNodeAdminLanguageFilter() { - module_install(array('views')); + \Drupal::moduleHandler()->install(array('views')); // User to add and remove language. $admin_user = $this->drupalCreateUser(array('administer languages', 'access administration pages', 'access content overview', 'administer nodes', 'bypass node access')); diff -u b/core/modules/node/lib/Drupal/node/Tests/NodeAdminTest.php b/core/modules/node/lib/Drupal/node/Tests/NodeAdminTest.php --- b/core/modules/node/lib/Drupal/node/Tests/NodeAdminTest.php +++ b/core/modules/node/lib/Drupal/node/Tests/NodeAdminTest.php @@ -49,7 +49,7 @@ // Create nodes that have different node.changed values. $this->container->get('state')->set('node_test.storage_controller', TRUE); - module_install(array('node_test')); + \Drupal::moduleHandler()->install(array('node_test')); $changed = REQUEST_TIME; foreach (array('dd', 'aa', 'DD', 'bb', 'cc', 'CC', 'AA', 'BB') as $prefix) { $changed += 1000; diff -u b/core/modules/node/node.install b/core/modules/node/node.install --- b/core/modules/node/node.install +++ b/core/modules/node/node.install @@ -696,7 +696,7 @@ */ function node_update_8012() { // Enable the history module without re-installing the schema. - module_install(array('history')); + Drupal::moduleHandler()->install(array('history')); } /** diff -u b/core/modules/simpletest/lib/Drupal/simpletest/Tests/DrupalUnitTestBaseTest.php b/core/modules/simpletest/lib/Drupal/simpletest/Tests/DrupalUnitTestBaseTest.php --- b/core/modules/simpletest/lib/Drupal/simpletest/Tests/DrupalUnitTestBaseTest.php +++ b/core/modules/simpletest/lib/Drupal/simpletest/Tests/DrupalUnitTestBaseTest.php @@ -89,7 +89,7 @@ $this->assertFalse($schema, "'$table' table schema not found."); // Install the module. - module_install(array($module)); + \Drupal::moduleHandler()->install(array($module)); // Verify that the enabled module exists. $this->assertTrue(module_exists($module), "$module module found."); diff -u b/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php b/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php --- b/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php +++ b/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php @@ -811,7 +811,7 @@ } if ($modules) { $modules = array_unique($modules); - $success = module_install($modules, TRUE); + $success = \Drupal::moduleHandler()->install($modules, TRUE); $this->assertTrue($success, t('Enabled modules: %modules', array('%modules' => implode(', ', $modules)))); $this->rebuildContainer(); } diff -u b/core/modules/system/lib/Drupal/system/Tests/Entity/EntityApiInfoTest.php b/core/modules/system/lib/Drupal/system/Tests/Entity/EntityApiInfoTest.php --- b/core/modules/system/lib/Drupal/system/Tests/Entity/EntityApiInfoTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Entity/EntityApiInfoTest.php @@ -26,7 +26,7 @@ * Ensures entity info cache is updated after changes. */ function testEntityInfoChanges() { - module_install(array('entity_cache_test')); + \Drupal::moduleHandler()->install(array('entity_cache_test')); $entity_info = entity_get_info(); $this->assertTrue(isset($entity_info['entity_cache_test']), 'Test entity type found.'); @@ -51,7 +51,7 @@ * @see entity_cache_test_watchdog() */ function testEntityInfoCacheWatchdog() { - module_install(array('entity_cache_test')); + \Drupal::moduleHandler()->install(array('entity_cache_test')); $info = \Drupal::state()->get('entity_cache_test'); $this->assertEqual($info['label'], 'Entity Cache Test', 'Entity info label is correct.'); $this->assertEqual($info['controllers']['storage'], 'Drupal\Core\Entity\DatabaseStorageController', 'Entity controller class info is correct.'); diff -u b/core/modules/system/lib/Drupal/system/Tests/Module/ClassLoaderTest.php b/core/modules/system/lib/Drupal/system/Tests/Module/ClassLoaderTest.php --- b/core/modules/system/lib/Drupal/system/Tests/Module/ClassLoaderTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Module/ClassLoaderTest.php @@ -34,7 +34,7 @@ */ function testClassLoading() { // Enable the module_test and module_autoload_test modules. - module_install(array('module_test', 'module_autoload_test'), FALSE); + \Drupal::moduleHandler()->install(array('module_test', 'module_autoload_test'), FALSE); $this->resetAll(); // Check twice to test an unprimed and primed system_list() cache. for ($i=0; $i<2; $i++) { diff -u b/core/modules/system/lib/Drupal/system/Tests/Module/DependencyTest.php b/core/modules/system/lib/Drupal/system/Tests/Module/DependencyTest.php --- b/core/modules/system/lib/Drupal/system/Tests/Module/DependencyTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Module/DependencyTest.php @@ -89,7 +89,7 @@ * Tests enabling a module that depends on a module which fails hook_requirements(). */ function testEnableRequirementsFailureDependency() { - module_install(array('comment')); + \Drupal::moduleHandler()->install(array('comment')); $this->assertModules(array('requirements1_test'), FALSE); $this->assertModules(array('requirements2_test'), FALSE); @@ -116,7 +116,7 @@ * UI. Dependencies should be enabled before their dependents. */ function testModuleEnableOrder() { - module_install(array('module_test'), FALSE); + \Drupal::moduleHandler()->install(array('module_test'), FALSE); $this->resetAll(); $this->assertModules(array('module_test'), TRUE); \Drupal::state()->set('module_test.dependency', 'dependency'); diff -u b/core/modules/system/lib/Drupal/system/Tests/Module/InstallTest.php b/core/modules/system/lib/Drupal/system/Tests/Module/InstallTest.php --- b/core/modules/system/lib/Drupal/system/Tests/Module/InstallTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Module/InstallTest.php @@ -57,7 +57,7 @@ * be an array. */ function testEnableUserTwice() { - module_install(array('user'), FALSE); + \Drupal::moduleHandler()->install(array('user'), FALSE); $this->assertIdentical(config('system.module')->get('enabled.user'), '0'); } diff -u b/core/modules/system/lib/Drupal/system/Tests/Module/ModuleApiTest.php b/core/modules/system/lib/Drupal/system/Tests/Module/ModuleApiTest.php --- b/core/modules/system/lib/Drupal/system/Tests/Module/ModuleApiTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Module/ModuleApiTest.php @@ -43,7 +43,7 @@ $this->assertModuleList($module_list, t('Standard profile')); // Try to install a new module. - module_install(array('ban')); + \Drupal::moduleHandler()->install(array('ban')); $module_list[] = 'ban'; sort($module_list); $this->assertModuleList($module_list, t('After adding a module')); @@ -98,18 +98,18 @@ $this->assertTrue(cache('bootstrap')->get('module_implements'), 'The module implements cache is populated after requesting a page.'); // Prime ModuleHandler's hook implementation cache by invoking a random hook - // name. The subsequent module_install() below will only call into - // setModuleList(), but will not explicitly reset the hook implementation - // cache, as that is expected to happen implicitly by setting the module - // list. This verifies that the hook implementation cache is cleared - // whenever setModuleList() is called. + // name. The subsequent \Drupal\Core\Extension\ModuleHandler::install() + // below will only call into setModuleList(), but will not explicitly reset + // the hook implementation cache, as that is expected to happen implicitly + // by setting the module list. This verifies that the hook implementation + // cache is cleared whenever setModuleList() is called. $module_handler = \Drupal::moduleHandler(); $module_handler->invokeAll('test'); // Make sure group include files are detected properly even when the file is // already loaded when the cache is rebuilt. // For that activate the module_test which provides the file to load. - module_install(array('module_test')); + \Drupal::moduleHandler()->install(array('module_test')); $module_handler->loadAll(); module_load_include('inc', 'module_test', 'module_test.file'); $modules = $module_handler->getImplementations('test_hook'); @@ -120,7 +120,7 @@ * Test that module_invoke() can load a hook defined in hook_hook_info(). */ function testModuleInvoke() { - module_install(array('module_test'), FALSE); + \Drupal::moduleHandler()->install(array('module_test'), FALSE); $this->resetAll(); $this->drupalGet('module-test/hook-dynamic-loading-invoke'); $this->assertText('success!', 'module_invoke() dynamically loads a hook defined in hook_hook_info().'); @@ -130,7 +130,7 @@ * Test that module_invoke_all() can load a hook defined in hook_hook_info(). */ function testModuleInvokeAll() { - module_install(array('module_test'), FALSE); + \Drupal::moduleHandler()->install(array('module_test'), FALSE); $this->resetAll(); $this->drupalGet('module-test/hook-dynamic-loading-invoke-all'); $this->assertText('success!', 'module_invoke_all() dynamically loads a hook defined in hook_hook_info().'); @@ -143,7 +143,7 @@ * functions execute early in the request handling. */ function testModuleInvokeAllDuringLoadFunction() { - module_install(array('module_test'), FALSE); + \Drupal::moduleHandler()->install(array('module_test'), FALSE); $this->resetAll(); $this->drupalGet('module-test/hook-dynamic-loading-invoke-all-during-load/module_test'); $this->assertText('success!', 'Menu item load function invokes a hook defined in hook_hook_info().'); @@ -156,7 +156,7 @@ // Enable the test module, and make sure that other modules we are testing // are not already enabled. (If they were, the tests below would not work // correctly.) - module_install(array('module_test'), FALSE); + \Drupal::moduleHandler()->install(array('module_test'), FALSE); $this->assertTrue(module_exists('module_test'), 'Test module is enabled.'); $this->assertFalse(module_exists('forum'), 'Forum module is disabled.'); $this->assertFalse(module_exists('ban'), 'Ban module is disabled.'); @@ -166,23 +166,24 @@ // depends on a made-up module, foo. Nothing should be installed. \Drupal::state()->set('module_test.dependency', 'missing dependency'); drupal_static_reset('system_rebuild_module_data'); - $result = module_install(array('forum')); - $this->assertFalse($result, 'module_install() returns FALSE if dependencies are missing.'); - $this->assertFalse(module_exists('forum'), 'module_install() aborts if dependencies are missing.'); + $result = \Drupal::moduleHandler()->install(array('forum')); + $this->assertFalse($result, '\Drupal\Core\Extension\ModuleHandler::install() returns FALSE if dependencies are missing.'); + $this->assertFalse(module_exists('forum'), '\Drupal\Core\Extension\ModuleHandler::install() aborts if dependencies are missing.'); // Now, fix the missing dependency. Forum module depends on ban, but ban - // depends on the PHP module. module_install() should work. + // depends on the PHP module. + // \Drupal\Core\Extension\ModuleHandler::install() should work. \Drupal::state()->set('module_test.dependency', 'dependency'); drupal_static_reset('system_rebuild_module_data'); - $result = module_install(array('forum')); - $this->assertTrue($result, 'module_install() returns the correct value.'); + $result = \Drupal::moduleHandler()->install(array('forum')); + $this->assertTrue($result, '\Drupal\Core\Extension\ModuleHandler::install() returns the correct value.'); // Verify that the fake dependency chain was installed. - $this->assertTrue(module_exists('ban') && module_exists('php'), 'Dependency chain was installed by module_install().'); + $this->assertTrue(module_exists('ban') && module_exists('php'), 'Dependency chain was installed by \Drupal\Core\Extension\ModuleHandler::install().'); // Verify that the original module was installed. $this->assertTrue(module_exists('forum'), 'Module installation with unlisted dependencies succeeded.'); // Finally, verify that the modules were enabled in the correct order. $module_order = \Drupal::state()->get('module_test.install_order') ?: array(); - $this->assertEqual($module_order, array('php', 'ban', 'forum'), 'Modules were enabled in the correct order by module_install().'); + $this->assertEqual($module_order, array('php', 'ban', 'forum'), 'Modules were enabled in the correct order by \Drupal\Core\Extension\ModuleHandler::install().'); // Now uninstall all three modules explicitly, but in the incorrect order, // and make sure that drupal_uninstal_modules() uninstalled them in the @@ -207,13 +208,13 @@ // Enable forum module again, which should enable both the ban module and // php module. But, this time do it with ban module declaring a dependency // on a specific version of php module in its info file. Make sure that - // module_install() still works. + // \Drupal\Core\Extension\ModuleHandler::install() still works. \Drupal::state()->set('module_test.dependency', 'version dependency'); drupal_static_reset('system_rebuild_module_data'); - $result = module_install(array('forum')); - $this->assertTrue($result, 'module_install() returns the correct value.'); + $result = \Drupal::moduleHandler()->install(array('forum')); + $this->assertTrue($result, '\Drupal\Core\Extension\ModuleHandler::install() returns the correct value.'); // Verify that the fake dependency chain was installed. - $this->assertTrue(module_exists('ban') && module_exists('php'), 'Dependency chain was installed by module_install().'); + $this->assertTrue(module_exists('ban') && module_exists('php'), 'Dependency chain was installed by \Drupal\Core\Extension\ModuleHandler::install().'); // Verify that the original module was installed. $this->assertTrue(module_exists('forum'), 'Module installation with version dependencies succeeded.'); // Finally, verify that the modules were enabled in the correct order. @@ -223,7 +224,7 @@ $forum_position = array_search('forum', $enable_order); $php_before_ban = $php_position !== FALSE && $ban_position !== FALSE && $php_position < $ban_position; $ban_before_forum = $ban_position !== FALSE && $forum_position !== FALSE && $ban_position < $forum_position; - $this->assertTrue($php_before_ban && $ban_before_forum, 'Modules were enabled in the correct order by module_install().'); + $this->assertTrue($php_before_ban && $ban_before_forum, 'Modules were enabled in the correct order by \Drupal\Core\Extension\ModuleHandler::install().'); } /** diff -u b/core/modules/system/lib/Drupal/system/Tests/System/DefaultMobileMetaTagsTest.php b/core/modules/system/lib/Drupal/system/Tests/System/DefaultMobileMetaTagsTest.php --- b/core/modules/system/lib/Drupal/system/Tests/System/DefaultMobileMetaTagsTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/System/DefaultMobileMetaTagsTest.php @@ -42,7 +42,7 @@ * Verifies that the default mobile meta tags can be removed. */ public function testRemovingDefaultMetaTags() { - module_install(array('system_module_test')); + \Drupal::moduleHandler()->install(array('system_module_test')); $this->drupalGet(''); foreach ($this->default_metatags as $name => $metatag) { $this->assertNoRaw($metatag, String::format('Default Mobile meta tag "@name" removed properly.', array('@name' => $name)), 'System'); diff -u b/core/modules/system/lib/Drupal/system/Tests/System/InfoAlterTest.php b/core/modules/system/lib/Drupal/system/Tests/System/InfoAlterTest.php --- b/core/modules/system/lib/Drupal/system/Tests/System/InfoAlterTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/System/InfoAlterTest.php @@ -31,7 +31,7 @@ function testSystemInfoAlter() { // Enable seven and the test module. theme_enable(array('seven')); - module_install(array('module_test'), FALSE); + \Drupal::moduleHandler()->install(array('module_test'), FALSE); $this->assertTrue(module_exists('module_test'), 'Test module is enabled.'); // Verify that the rebuilt and altered theme info is returned. diff -u b/core/modules/system/lib/Drupal/system/Tests/System/ThemeTest.php b/core/modules/system/lib/Drupal/system/Tests/System/ThemeTest.php --- b/core/modules/system/lib/Drupal/system/Tests/System/ThemeTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/System/ThemeTest.php @@ -254,7 +254,7 @@ * Test that themes can't be enabled when the base theme or engine is missing. */ function testInvalidTheme() { - module_install(array('theme_page_test')); + \Drupal::moduleHandler()->install(array('theme_page_test')); $this->drupalGet('admin/appearance'); $this->assertText(t('This theme requires the base theme @base_theme to operate correctly.', array('@base_theme' => 'not_real_test_basetheme')), 'Invalid base theme check succeeded.'); $this->assertText(t('This theme requires the theme engine @theme_engine to operate correctly.', array('@theme_engine' => 'not_real_engine')), 'Invalid theme engine check succeeded.'); diff -u b/core/modules/system/lib/Drupal/system/Tests/Upgrade/ModulesDisabledUpgradePathTest.php b/core/modules/system/lib/Drupal/system/Tests/Upgrade/ModulesDisabledUpgradePathTest.php --- b/core/modules/system/lib/Drupal/system/Tests/Upgrade/ModulesDisabledUpgradePathTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Upgrade/ModulesDisabledUpgradePathTest.php @@ -47,7 +47,7 @@ } } $to_enable = array_diff_key($available, $enabled); - module_install(array_keys($to_enable)); + \Drupal::moduleHandler()->install(array_keys($to_enable)); // Check for updates. require_once DRUPAL_ROOT . '/core/includes/update.inc'; require_once DRUPAL_ROOT . '/core/includes/install.inc'; diff -u b/core/modules/system/system.api.php b/core/modules/system/system.api.php --- b/core/modules/system/system.api.php +++ b/core/modules/system/system.api.php @@ -1944,13 +1944,13 @@ * This function differs from hook_install() in that it gives all other modules * a chance to perform actions when a module is installed, whereas * hook_install() is only called on the module actually being installed. See - * module_install() for a detailed description of the order in which install and - * enable hooks are invoked. + * \Drupal\Core\Extension\ModuleHandler::install() for a detailed description of + * the order in which install and enable hooks are invoked. * * @param $modules * An array of the modules that were installed. * - * @see module_install() + * @see \Drupal\Core\Extension\ModuleHandler::install() * @see hook_install() */ function hook_modules_installed($modules) { @@ -2471,7 +2471,7 @@ * be removed during uninstall should be removed with hook_uninstall(). * * @see hook_schema() - * @see module_install() + * @see \Drupal\Core\Extension\ModuleHandler::install() * @see hook_uninstall() * @see hook_modules_installed() */ diff -u b/core/modules/system/system.install b/core/modules/system/system.install --- b/core/modules/system/system.install +++ b/core/modules/system/system.install @@ -1529,7 +1529,7 @@ ->condition('aid', 'system_block_ip_action') ->execute(); // Enable the new Ban module. - module_install(array('ban')); + Drupal::moduleHandler()->install(array('ban')); } else { // Drop old table. @@ -1542,7 +1542,7 @@ */ function system_update_8021() { // Enable the module without re-installing the schema. - module_install(array('action')); + Drupal::moduleHandler()->install(array('action')); // Rename former System module actions. $map = array( 'system_message_action' => 'action_message_action', @@ -1843,7 +1843,7 @@ * Enable the new Entity module. */ function system_update_8042() { - module_install(array('entity')); + Drupal::moduleHandler()->install(array('entity')); } /** @@ -1957,7 +1957,7 @@ */ function system_update_8048() { // Enable the module without re-installing the schema. - module_install(array('menu_link')); + Drupal::moduleHandler()->install(array('menu_link')); // Add the langcode column if it doesn't exist. if (!db_field_exists('menu_inks', 'langcode')) { diff -u b/core/modules/system/tests/modules/entity_cache_test/entity_cache_test.module b/core/modules/system/tests/modules/entity_cache_test/entity_cache_test.module --- b/core/modules/system/tests/modules/entity_cache_test/entity_cache_test.module +++ b/core/modules/system/tests/modules/entity_cache_test/entity_cache_test.module @@ -8,11 +8,11 @@ /** * Implements hook_watchdog(). * - * This hook is called during module_install() and since this hook - * implementation is invoked, we have to expect that this module and dependent - * modules have been properly installed already. So we expect to be able to - * retrieve the entity information that has been registered by the required - * dependency module. + * This hook is called during \Drupal\Core\Extension\ModuleHandler::install() + * and since this hook implementation is invoked, we have to expect that this + * module and dependent modules have been properly installed already. So we + * expect to be able to retrieve the entity information that has been registered + * by the required dependency module. * * @see EnableDisableTestCase::testEntityCache() */ diff -u b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/VocabularyUnitTest.php b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/VocabularyUnitTest.php --- b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/VocabularyUnitTest.php +++ b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/VocabularyUnitTest.php @@ -202,7 +202,7 @@ require_once DRUPAL_ROOT . '/core/includes/install.inc'; module_uninstall(array('taxonomy')); - module_install(array('taxonomy')); + \Drupal::moduleHandler()->install(array('taxonomy')); // Now create a vocabulary with the same name. All field instances // connected to this vocabulary name should have been removed when the diff -u b/core/modules/toolbar/toolbar.install b/core/modules/toolbar/toolbar.install --- b/core/modules/toolbar/toolbar.install +++ b/core/modules/toolbar/toolbar.install @@ -18,7 +18,7 @@ */ function toolbar_update_8000() { // Enable the modules without re-installing the schema. - module_install(array('breakpoint')); + Drupal::moduleHandler()->install(array('breakpoint')); } /** diff -u b/core/modules/tracker/lib/Drupal/tracker/Tests/TrackerTest.php b/core/modules/tracker/lib/Drupal/tracker/Tests/TrackerTest.php --- b/core/modules/tracker/lib/Drupal/tracker/Tests/TrackerTest.php +++ b/core/modules/tracker/lib/Drupal/tracker/Tests/TrackerTest.php @@ -257,7 +257,7 @@ * Tests that publish/unpublish works at admin/content/node. */ function testTrackerAdminUnpublish() { - module_install(array('views')); + \Drupal::moduleHandler()->install(array('views')); $admin_user = $this->drupalCreateUser(array('access content overview', 'administer nodes', 'bypass node access')); $this->drupalLogin($admin_user); diff -u b/core/modules/user/lib/Drupal/user/Tests/UserCancelTest.php b/core/modules/user/lib/Drupal/user/Tests/UserCancelTest.php --- b/core/modules/user/lib/Drupal/user/Tests/UserCancelTest.php +++ b/core/modules/user/lib/Drupal/user/Tests/UserCancelTest.php @@ -67,7 +67,7 @@ * administer the site. */ function testUserCancelUid1() { - module_install(array('views')); + \Drupal::moduleHandler()->install(array('views')); // Update uid 1's name and password to we know it. $password = user_password(); $account = array( @@ -276,7 +276,7 @@ */ function testUserDelete() { \Drupal::config('user.settings')->set('cancel_method', 'user_cancel_delete')->save(); - module_install(array('comment')); + \Drupal::moduleHandler()->install(array('comment')); $this->resetAll(); // Create a user. @@ -392,7 +392,7 @@ * Create an administrative user and mass-delete other users. */ function testMassUserCancelByAdmin() { - module_install(array('views')); + \Drupal::moduleHandler()->install(array('views')); \Drupal::config('user.settings')->set('cancel_method', 'user_cancel_reassign')->save(); // Enable account cancellation notification. \Drupal::config('user.settings')->set('notify.status_canceled', TRUE)->save(); diff -u b/core/modules/user/lib/Drupal/user/Tests/UserLoginTest.php b/core/modules/user/lib/Drupal/user/Tests/UserLoginTest.php --- b/core/modules/user/lib/Drupal/user/Tests/UserLoginTest.php +++ b/core/modules/user/lib/Drupal/user/Tests/UserLoginTest.php @@ -122,7 +122,7 @@ // containing the necessary container builder code and then verify that the // users password gets rehashed during the login. $overridden_count_log2 = 19; - module_install(array('user_custom_phpass_params_test')); + \Drupal::moduleHandler()->install(array('user_custom_phpass_params_test')); $account->pass_raw = $password; $this->drupalLogin($account); diff -u b/core/modules/user/user.install b/core/modules/user/user.install --- b/core/modules/user/user.install +++ b/core/modules/user/user.install @@ -613,7 +613,7 @@ // User pictures can only be migrated to the new user picture image field // if Image module is installed. if (!module_exists('image')) { - $old_schema = module_install(array('image')); + $old_schema = Drupal::moduleHandler()->install(array('image')); if ($old_schema['image'] == SCHEMA_UNINSTALLED) { // Install image.module with schema version 8002 as a previous version // would have to create tables that would be removed again. diff -u b/core/modules/views/lib/Drupal/views/Tests/ViewTestBase.php b/core/modules/views/lib/Drupal/views/Tests/ViewTestBase.php --- b/core/modules/views/lib/Drupal/views/Tests/ViewTestBase.php +++ b/core/modules/views/lib/Drupal/views/Tests/ViewTestBase.php @@ -52,7 +52,7 @@ \Drupal::state()->set('views_test_data_schema', $this->schemaDefinition()); \Drupal::state()->set('views_test_data_views_data', $this->viewsData()); - module_install(array('views_test_data')); + \Drupal::moduleHandler()->install(array('views_test_data')); $this->resetAll(); $this->rebuildContainer(); $this->container->get('module_handler')->reload(); diff -u b/core/modules/views_ui/lib/Drupal/views_ui/Tests/PreviewTest.php b/core/modules/views_ui/lib/Drupal/views_ui/Tests/PreviewTest.php --- b/core/modules/views_ui/lib/Drupal/views_ui/Tests/PreviewTest.php +++ b/core/modules/views_ui/lib/Drupal/views_ui/Tests/PreviewTest.php @@ -31,7 +31,7 @@ * Tests contextual links in the preview form. */ protected function testPreviewContextual() { - module_install(array('contextual')); + \Drupal::moduleHandler()->install(array('contextual')); $this->drupalGet('admin/structure/views/view/test_preview/edit'); $this->assertResponse(200); $this->drupalPost(NULL, $edit = array(), t('Update preview')); only in patch2: unchanged: --- a/core/modules/field/lib/Drupal/field/Tests/reEnableModuleFieldTest.php +++ b/core/modules/field/lib/Drupal/field/Tests/reEnableModuleFieldTest.php @@ -91,15 +91,7 @@ function testReEnabledField() { $this->drupalPost(NULL, $edit, t('Save')); $this->assertRaw(''); - // Disable the telephone module and re-enable it. - module_disable(array('telephone')); - module_enable(array('telephone')); - - // Display the article creation form and verify the widget still exists. - $this->drupalGet('node/add/article'); - $this->assertFieldByName("field_telephone[und][0][value]", '', 'Widget found.'); - - // Test that the module can't be disabled from the UI while there is data + // Test that the module can't be uninstalled from the UI while there is data // for it's fields. $admin_user = $this->drupalCreateUser(array('access administration pages', 'administer modules')); $this->drupalLogin($admin_user); only in patch2: unchanged: --- a/core/modules/system/lib/Drupal/system/Tests/ServiceProvider/ServiceProviderTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/ServiceProvider/ServiceProviderTest.php @@ -46,12 +46,12 @@ function testServiceProviderRegistration() { * Tests that the DIC keeps up with module enable/disable in the same request. */ function testServiceProviderRegistrationDynamic() { - // Disable the module and ensure the service provider's service is not registered. - module_disable(array('service_provider_test')); + // Uninstall the module and ensure the service provider's service is not registered. + \Drupal::moduleHandler()->uninstall(array('service_provider_test')); $this->assertFalse(drupal_container()->has('service_provider_test_class'), 'The service_provider_test_class service does not exist in the DIC.'); - // Enable the module and ensure the service provider's service is registered. - module_enable(array('service_provider_test')); + // Install the module and ensure the service provider's service is registered. + \Drupal::moduleHandler()->install(array('service_provider_test')); $this->assertTrue(drupal_container()->has('service_provider_test_class'), 'The service_provider_test_class service exists in the DIC.'); }