Commit f8bd3f7d authored by xjm's avatar xjm

Issue #2760883 by fgm: API docs reference ModuleHandler::install() instead of ModuleInstaller

parent 4668a260
...@@ -186,7 +186,7 @@ function module_set_weight($module, $weight) { ...@@ -186,7 +186,7 @@ function module_set_weight($module, $weight) {
->save(TRUE); ->save(TRUE);
// Prepare the new module list, sorted by weight, including filenames. // Prepare the new module list, sorted by weight, including filenames.
// @see \Drupal\Core\Extension\ModuleHandler::install() // @see \Drupal\Core\Extension\ModuleInstaller::install()
$module_handler = \Drupal::moduleHandler(); $module_handler = \Drupal::moduleHandler();
$current_module_filenames = $module_handler->getModuleList(); $current_module_filenames = $module_handler->getModuleList();
$current_modules = array_fill_keys(array_keys($current_module_filenames), 0); $current_modules = array_fill_keys(array_keys($current_module_filenames), 0);
......
...@@ -175,7 +175,7 @@ function hook_module_preinstall($module) { ...@@ -175,7 +175,7 @@ function hook_module_preinstall($module) {
* This function differs from hook_install() in that it gives all other modules * This function differs from hook_install() in that it gives all other modules
* a chance to perform actions when a module is installed, whereas * a chance to perform actions when a module is installed, whereas
* hook_install() is only called on the module actually being installed. See * hook_install() is only called on the module actually being installed. See
* \Drupal\Core\Extension\ModuleHandler::install() for a detailed description of * \Drupal\Core\Extension\ModuleInstaller::install() for a detailed description of
* the order in which install hooks are invoked. * the order in which install hooks are invoked.
* *
* This hook should be implemented in a .module file, not in an .install file. * This hook should be implemented in a .module file, not in an .install file.
...@@ -183,7 +183,7 @@ function hook_module_preinstall($module) { ...@@ -183,7 +183,7 @@ function hook_module_preinstall($module) {
* @param $modules * @param $modules
* An array of the modules that were installed. * An array of the modules that were installed.
* *
* @see \Drupal\Core\Extension\ModuleHandler::install() * @see \Drupal\Core\Extension\ModuleInstaller::install()
* @see hook_install() * @see hook_install()
*/ */
function hook_modules_installed($modules) { function hook_modules_installed($modules) {
...@@ -223,7 +223,7 @@ function hook_modules_installed($modules) { ...@@ -223,7 +223,7 @@ function hook_modules_installed($modules) {
* be removed during uninstall should be removed with hook_uninstall(). * be removed during uninstall should be removed with hook_uninstall().
* *
* @see hook_schema() * @see hook_schema()
* @see \Drupal\Core\Extension\ModuleHandler::install() * @see \Drupal\Core\Extension\ModuleInstaller::install()
* @see hook_uninstall() * @see hook_uninstall()
* @see hook_modules_installed() * @see hook_modules_installed()
*/ */
......
...@@ -73,7 +73,7 @@ public function alter(ContainerBuilder $container) { ...@@ -73,7 +73,7 @@ public function alter(ContainerBuilder $container) {
// No service may persist when the early installer kernel is rebooted into // No service may persist when the early installer kernel is rebooted into
// the production environment. // the production environment.
// @todo The DrupalKernel reboot performed by drupal_install_system() is // @todo The DrupalKernel reboot performed by drupal_install_system() is
// actually not a "regular" reboot (like ModuleHandler::install()), so // actually not a "regular" reboot (like ModuleInstaller::install()), so
// services are not actually persisted. // services are not actually persisted.
foreach ($container->findTaggedServiceIds('persist') as $id => $tags) { foreach ($container->findTaggedServiceIds('persist') as $id => $tags) {
$definition = $container->getDefinition($id); $definition = $container->getDefinition($id);
......
...@@ -276,8 +276,8 @@ function saveConfiguration($type, $enabled_methods) { ...@@ -276,8 +276,8 @@ function saveConfiguration($type, $enabled_methods) {
*/ */
function purgeConfiguration() { function purgeConfiguration() {
// Ensure that we are getting the defined language negotiation information. // Ensure that we are getting the defined language negotiation information.
// An invocation of \Drupal\Core\Extension\ModuleHandler::install() or // An invocation of \Drupal\Core\Extension\ModuleInstaller::install() or
// \Drupal\Core\Extension\ModuleHandler::uninstall() could invalidate the // \Drupal\Core\Extension\ModuleInstaller::uninstall() could invalidate the
// cached information. // cached information.
$this->negotiatorManager->clearCachedDefinitions(); $this->negotiatorManager->clearCachedDefinitions();
$this->languageManager->reset(); $this->languageManager->reset();
...@@ -291,8 +291,8 @@ function purgeConfiguration() { ...@@ -291,8 +291,8 @@ function purgeConfiguration() {
*/ */
function updateConfiguration(array $types) { function updateConfiguration(array $types) {
// Ensure that we are getting the defined language negotiation information. // Ensure that we are getting the defined language negotiation information.
// An invocation of \Drupal\Core\Extension\ModuleHandler::install() or // An invocation of \Drupal\Core\Extension\ModuleInstaller::install() or
// \Drupal\Core\Extension\ModuleHandler::uninstall() could invalidate the // \Drupal\Core\Extension\ModuleInstaller::uninstall() could invalidate the
// cached information. // cached information.
$this->negotiatorManager->clearCachedDefinitions(); $this->negotiatorManager->clearCachedDefinitions();
$this->languageManager->reset(); $this->languageManager->reset();
......
...@@ -115,7 +115,7 @@ function testDependencyResolution() { ...@@ -115,7 +115,7 @@ function testDependencyResolution() {
$this->pass(t('ModuleInstaller::install() throws an exception if dependencies are missing.')); $this->pass(t('ModuleInstaller::install() throws an exception if dependencies are missing.'));
} }
$this->assertFalse($this->moduleHandler()->moduleExists('color'), 'ModuleHandler::install() aborts if dependencies are missing.'); $this->assertFalse($this->moduleHandler()->moduleExists('color'), 'ModuleInstaller::install() aborts if dependencies are missing.');
// Fix the missing dependency. // Fix the missing dependency.
// Color module depends on Config. Config depends on Help module. // Color module depends on Config. Config depends on Help module.
...@@ -123,7 +123,7 @@ function testDependencyResolution() { ...@@ -123,7 +123,7 @@ function testDependencyResolution() {
drupal_static_reset('system_rebuild_module_data'); drupal_static_reset('system_rebuild_module_data');
$result = $this->moduleInstaller()->install(array('color')); $result = $this->moduleInstaller()->install(array('color'));
$this->assertTrue($result, 'ModuleHandler::install() returns the correct value.'); $this->assertTrue($result, 'ModuleInstaller::install() returns the correct value.');
// Verify that the fake dependency chain was installed. // Verify that the fake dependency chain was installed.
$this->assertTrue($this->moduleHandler()->moduleExists('config') && $this->moduleHandler()->moduleExists('help'), 'Dependency chain was installed.'); $this->assertTrue($this->moduleHandler()->moduleExists('config') && $this->moduleHandler()->moduleExists('help'), 'Dependency chain was installed.');
...@@ -136,10 +136,10 @@ function testDependencyResolution() { ...@@ -136,10 +136,10 @@ function testDependencyResolution() {
$this->assertEqual($module_order, array('help', 'config', 'color')); $this->assertEqual($module_order, array('help', 'config', 'color'));
// Uninstall all three modules explicitly, but in the incorrect order, // Uninstall all three modules explicitly, but in the incorrect order,
// and make sure that ModuleHandler::uninstall() uninstalled them in the // and make sure that ModuleInstaller::uninstall() uninstalled them in the
// correct sequence. // correct sequence.
$result = $this->moduleInstaller()->uninstall(array('config', 'help', 'color')); $result = $this->moduleInstaller()->uninstall(array('config', 'help', 'color'));
$this->assertTrue($result, 'ModuleHandler::uninstall() returned TRUE.'); $this->assertTrue($result, 'ModuleInstaller::uninstall() returned TRUE.');
foreach (array('color', 'config', 'help') as $module) { foreach (array('color', 'config', 'help') as $module) {
$this->assertEqual(drupal_get_installed_schema_version($module), SCHEMA_UNINSTALLED, "$module module was uninstalled."); $this->assertEqual(drupal_get_installed_schema_version($module), SCHEMA_UNINSTALLED, "$module module was uninstalled.");
...@@ -150,12 +150,12 @@ function testDependencyResolution() { ...@@ -150,12 +150,12 @@ function testDependencyResolution() {
// Enable Color module again, which should enable both the Config module and // Enable Color module again, which should enable both the Config module and
// Help module. But, this time do it with Config module declaring a // Help module. But, this time do it with Config module declaring a
// dependency on a specific version of Help module in its info file. Make // dependency on a specific version of Help module in its info file. Make
// sure that Drupal\Core\Extension\ModuleHandler::install() still works. // sure that Drupal\Core\Extension\ModuleInstaller::install() still works.
\Drupal::state()->set('module_test.dependency', 'version dependency'); \Drupal::state()->set('module_test.dependency', 'version dependency');
drupal_static_reset('system_rebuild_module_data'); drupal_static_reset('system_rebuild_module_data');
$result = $this->moduleInstaller()->install(array('color')); $result = $this->moduleInstaller()->install(array('color'));
$this->assertTrue($result, 'ModuleHandler::install() returns the correct value.'); $this->assertTrue($result, 'ModuleInstaller::install() returns the correct value.');
// Verify that the fake dependency chain was installed. // Verify that the fake dependency chain was installed.
$this->assertTrue($this->moduleHandler()->moduleExists('config') && $this->moduleHandler()->moduleExists('help'), 'Dependency chain was installed.'); $this->assertTrue($this->moduleHandler()->moduleExists('config') && $this->moduleHandler()->moduleExists('help'), 'Dependency chain was installed.');
...@@ -191,7 +191,7 @@ function testUninstallProfileDependency() { ...@@ -191,7 +191,7 @@ function testUninstallProfileDependency() {
// Uninstall the profile module "dependency". // Uninstall the profile module "dependency".
$result = $this->moduleInstaller()->uninstall(array($dependency)); $result = $this->moduleInstaller()->uninstall(array($dependency));
$this->assertTrue($result, 'ModuleHandler::uninstall() returns TRUE.'); $this->assertTrue($result, 'ModuleInstaller::uninstall() returns TRUE.');
$this->assertFalse($this->moduleHandler()->moduleExists($dependency)); $this->assertFalse($this->moduleHandler()->moduleExists($dependency));
$this->assertEqual(drupal_get_installed_schema_version($dependency), SCHEMA_UNINSTALLED, "$dependency module was uninstalled."); $this->assertEqual(drupal_get_installed_schema_version($dependency), SCHEMA_UNINSTALLED, "$dependency module was uninstalled.");
...@@ -229,7 +229,7 @@ function testUninstallContentDependency() { ...@@ -229,7 +229,7 @@ function testUninstallContentDependency() {
// Uninstalling entity_test is not possible when there is content. // Uninstalling entity_test is not possible when there is content.
try { try {
$message = 'ModuleHandler::uninstall() throws ModuleUninstallValidatorException upon uninstalling a module which does not pass validation.'; $message = 'ModuleInstaller::uninstall() throws ModuleUninstallValidatorException upon uninstalling a module which does not pass validation.';
$this->moduleInstaller()->uninstall(array('entity_test')); $this->moduleInstaller()->uninstall(array('entity_test'));
$this->fail($message); $this->fail($message);
} }
...@@ -239,7 +239,7 @@ function testUninstallContentDependency() { ...@@ -239,7 +239,7 @@ function testUninstallContentDependency() {
// Uninstalling help needs entity_test to be un-installable. // Uninstalling help needs entity_test to be un-installable.
try { try {
$message = 'ModuleHandler::uninstall() throws ModuleUninstallValidatorException upon uninstalling a module which does not pass validation.'; $message = 'ModuleInstaller::uninstall() throws ModuleUninstallValidatorException upon uninstalling a module which does not pass validation.';
$this->moduleInstaller()->uninstall(array('help')); $this->moduleInstaller()->uninstall(array('help'));
$this->fail($message); $this->fail($message);
} }
...@@ -251,7 +251,7 @@ function testUninstallContentDependency() { ...@@ -251,7 +251,7 @@ function testUninstallContentDependency() {
$entity->delete(); $entity->delete();
$result = $this->moduleInstaller()->uninstall(array('help')); $result = $this->moduleInstaller()->uninstall(array('help'));
$this->assertTrue($result, 'ModuleHandler::uninstall() returns TRUE.'); $this->assertTrue($result, 'ModuleInstaller::uninstall() returns TRUE.');
$this->assertEqual(drupal_get_installed_schema_version('entity_test'), SCHEMA_UNINSTALLED, "entity_test module was uninstalled."); $this->assertEqual(drupal_get_installed_schema_version('entity_test'), SCHEMA_UNINSTALLED, "entity_test module was uninstalled.");
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment