Skip to content
Snippets Groups Projects
Unverified Commit 6e7715a8 authored by Alex Pott's avatar Alex Pott
Browse files

Issue #3492282 by nicxvan, longwave, catch: Refactor away ModuleInstaller::invokeAll()

parent 86b2f9e2
No related branches found
No related tags found
No related merge requests found
......@@ -563,7 +563,7 @@ public function uninstall(array $module_list, $uninstall_dependents = TRUE) {
}
// Allow modules to react prior to the uninstallation of a module.
$this->invokeAll('module_preuninstall', [$module, $sync_status]);
$this->moduleHandler->invokeAll('module_preuninstall', [$module, $sync_status]);
// Uninstall the module.
$this->moduleHandler->loadInclude($module, 'install');
......@@ -657,12 +657,12 @@ public function uninstall(array $module_list, $uninstall_dependents = TRUE) {
\Drupal::service('router.builder')->rebuild();
// Let other modules react.
$this->invokeAll('modules_uninstalled', [$module_list, $sync_status]);
$this->moduleHandler->invokeAll('modules_uninstalled', [$module_list, $sync_status]);
// Flush all persistent caches.
// Any cache entry might implicitly depend on the uninstalled modules,
// so clear all of them explicitly.
$this->invokeAll('cache_flush');
$this->moduleHandler->invokeAll('cache_flush');
foreach (Cache::getBins() as $cache_backend) {
$cache_backend->deleteAll();
}
......@@ -799,7 +799,7 @@ protected function uninstallSchema(string $module): void {
}
/**
* Call procedural hooks in all installed modules during installation.
* Call a procedural hook in an installed module during installation.
*
* Hooks called during install will remain procedural.
* - hook_install()
......@@ -811,21 +811,6 @@ protected function uninstallSchema(string $module): void {
* - hook_update_last_removed()
* - hook_update_N()
*
* @param string $hook
* The name of the hook to invoke.
* @param array $args
* Arguments to pass to the hook.
*/
protected function invokeAll($hook, $args = []): void {
$this->moduleHandler->loadAll();
$this->moduleHandler->invokeAll($hook, $args);
}
/**
* Call a procedural hook in an installed module during installation.
*
* Hook_install(), hook_uninstall() etc. will remain procedural.
*
* @param string $module
* The module (it can be a profile, too).
* @param string $hook
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment