Issue #2760883 by fgm: API docs reference ModuleHandler::install() instead of ModuleInstaller
parent
4668a2605b
commit
f8bd3f7db6
|
@ -186,7 +186,7 @@ function module_set_weight($module, $weight) {
|
|||
->save(TRUE);
|
||||
|
||||
// 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();
|
||||
$current_module_filenames = $module_handler->getModuleList();
|
||||
$current_modules = array_fill_keys(array_keys($current_module_filenames), 0);
|
||||
|
|
|
@ -175,7 +175,7 @@ function hook_module_preinstall($module) {
|
|||
* 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
|
||||
* \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.
|
||||
*
|
||||
* This hook should be implemented in a .module file, not in an .install file.
|
||||
|
@ -183,7 +183,7 @@ function hook_module_preinstall($module) {
|
|||
* @param $modules
|
||||
* An array of the modules that were installed.
|
||||
*
|
||||
* @see \Drupal\Core\Extension\ModuleHandler::install()
|
||||
* @see \Drupal\Core\Extension\ModuleInstaller::install()
|
||||
* @see hook_install()
|
||||
*/
|
||||
function hook_modules_installed($modules) {
|
||||
|
@ -223,7 +223,7 @@ function hook_modules_installed($modules) {
|
|||
* be removed during uninstall should be removed with hook_uninstall().
|
||||
*
|
||||
* @see hook_schema()
|
||||
* @see \Drupal\Core\Extension\ModuleHandler::install()
|
||||
* @see \Drupal\Core\Extension\ModuleInstaller::install()
|
||||
* @see hook_uninstall()
|
||||
* @see hook_modules_installed()
|
||||
*/
|
||||
|
|
|
@ -73,7 +73,7 @@ class InstallerServiceProvider implements ServiceProviderInterface, ServiceModif
|
|||
// No service may persist when the early installer kernel is rebooted into
|
||||
// the production environment.
|
||||
// @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.
|
||||
foreach ($container->findTaggedServiceIds('persist') as $id => $tags) {
|
||||
$definition = $container->getDefinition($id);
|
||||
|
|
|
@ -276,8 +276,8 @@ class LanguageNegotiator implements LanguageNegotiatorInterface {
|
|||
*/
|
||||
function purgeConfiguration() {
|
||||
// Ensure that we are getting the defined language negotiation information.
|
||||
// An invocation of \Drupal\Core\Extension\ModuleHandler::install() or
|
||||
// \Drupal\Core\Extension\ModuleHandler::uninstall() could invalidate the
|
||||
// An invocation of \Drupal\Core\Extension\ModuleInstaller::install() or
|
||||
// \Drupal\Core\Extension\ModuleInstaller::uninstall() could invalidate the
|
||||
// cached information.
|
||||
$this->negotiatorManager->clearCachedDefinitions();
|
||||
$this->languageManager->reset();
|
||||
|
@ -291,8 +291,8 @@ class LanguageNegotiator implements LanguageNegotiatorInterface {
|
|||
*/
|
||||
function updateConfiguration(array $types) {
|
||||
// Ensure that we are getting the defined language negotiation information.
|
||||
// An invocation of \Drupal\Core\Extension\ModuleHandler::install() or
|
||||
// \Drupal\Core\Extension\ModuleHandler::uninstall() could invalidate the
|
||||
// An invocation of \Drupal\Core\Extension\ModuleInstaller::install() or
|
||||
// \Drupal\Core\Extension\ModuleInstaller::uninstall() could invalidate the
|
||||
// cached information.
|
||||
$this->negotiatorManager->clearCachedDefinitions();
|
||||
$this->languageManager->reset();
|
||||
|
|
|
@ -115,7 +115,7 @@ class ModuleHandlerTest extends KernelTestBase {
|
|||
$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.
|
||||
// Color module depends on Config. Config depends on Help module.
|
||||
|
@ -123,7 +123,7 @@ class ModuleHandlerTest extends KernelTestBase {
|
|||
drupal_static_reset('system_rebuild_module_data');
|
||||
|
||||
$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.
|
||||
$this->assertTrue($this->moduleHandler()->moduleExists('config') && $this->moduleHandler()->moduleExists('help'), 'Dependency chain was installed.');
|
||||
|
@ -136,10 +136,10 @@ class ModuleHandlerTest extends KernelTestBase {
|
|||
$this->assertEqual($module_order, array('help', 'config', 'color'));
|
||||
|
||||
// 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.
|
||||
$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) {
|
||||
$this->assertEqual(drupal_get_installed_schema_version($module), SCHEMA_UNINSTALLED, "$module module was uninstalled.");
|
||||
|
@ -150,12 +150,12 @@ class ModuleHandlerTest extends KernelTestBase {
|
|||
// Enable Color module again, which should enable both the Config module and
|
||||
// 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
|
||||
// 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_static_reset('system_rebuild_module_data');
|
||||
|
||||
$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.
|
||||
$this->assertTrue($this->moduleHandler()->moduleExists('config') && $this->moduleHandler()->moduleExists('help'), 'Dependency chain was installed.');
|
||||
|
@ -191,7 +191,7 @@ class ModuleHandlerTest extends KernelTestBase {
|
|||
|
||||
// Uninstall the profile module "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->assertEqual(drupal_get_installed_schema_version($dependency), SCHEMA_UNINSTALLED, "$dependency module was uninstalled.");
|
||||
|
||||
|
@ -229,7 +229,7 @@ class ModuleHandlerTest extends KernelTestBase {
|
|||
|
||||
// Uninstalling entity_test is not possible when there is content.
|
||||
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->fail($message);
|
||||
}
|
||||
|
@ -239,7 +239,7 @@ class ModuleHandlerTest extends KernelTestBase {
|
|||
|
||||
// Uninstalling help needs entity_test to be un-installable.
|
||||
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->fail($message);
|
||||
}
|
||||
|
@ -251,7 +251,7 @@ class ModuleHandlerTest extends KernelTestBase {
|
|||
$entity->delete();
|
||||
|
||||
$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.");
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue