Loading core/core.services.yml +2 −0 Original line number Diff line number Diff line Loading @@ -1630,6 +1630,8 @@ services: update.post_update_registry: class: Drupal\Core\Update\UpdateRegistry factory: ['@update.post_update_registry_factory', create] tags: - { name: event_subscriber } update.post_update_registry_factory: class: Drupal\Core\Update\UpdateRegistryFactory parent: container.trait Loading core/includes/update.inc +8 −6 Original line number Diff line number Diff line Loading @@ -226,8 +226,10 @@ function update_invoke_post_update($function, &$context) { return; } [$module, $name] = explode('_post_update_', $function, 2); \Drupal::moduleHandler()->loadInclude($module, 'php', $module . '.post_update'); // Ensure extension post update code is loaded. [$extension, $name] = explode('_post_update_', $function, 2); \Drupal::service('update.post_update_registry')->getUpdateFunctions($extension); if (function_exists($function)) { try { $ret['results']['query'] = $function($context['sandbox']); Loading Loading @@ -257,17 +259,17 @@ function update_invoke_post_update($function, &$context) { $context['finished'] = $context['sandbox']['#finished']; unset($context['sandbox']['#finished']); } if (!isset($context['results'][$module][$name])) { $context['results'][$module][$name] = []; if (!isset($context['results'][$extension][$name])) { $context['results'][$extension][$name] = []; } $context['results'][$module][$name] = array_merge($context['results'][$module][$name], $ret); $context['results'][$extension][$name] = array_merge($context['results'][$extension][$name], $ret); if (!empty($ret['#abort'])) { // Record this function in the list of updates that were aborted. $context['results']['#abort'][] = $function; } $context['message'] = t('Post updating @module', ['@module' => $module]); $context['message'] = t('Post updating @extension', ['@extension' => $extension]); } /** Loading core/lib/Drupal/Core/Extension/ModuleInstaller.php +0 −12 Original line number Diff line number Diff line Loading @@ -334,14 +334,6 @@ public function install(array $module_list, $enable_dependencies = TRUE) { } $this->updateRegistry->setInstalledVersion($module, $version); // Ensure that all post_update functions are registered already. This // should include existing post-updates, as well as any specified as // having been previously removed, to ensure that newly installed and // updated sites have the same entries in the registry. /** @var \Drupal\Core\Update\UpdateRegistry $post_update_registry */ $post_update_registry = \Drupal::service('update.post_update_registry'); $post_update_registry->registerInvokedUpdates(array_merge($post_update_registry->getModuleUpdateFunctions($module), array_keys($post_update_registry->getRemovedPostUpdates($module)))); // Record the fact that it was installed. $modules_installed[] = $module; Loading Loading @@ -546,10 +538,6 @@ public function uninstall(array $module_list, $uninstall_dependents = TRUE) { /** @var \Drupal\Core\Update\UpdateHookRegistry $update_registry */ $update_registry = \Drupal::service('update.update_hook_registry'); $update_registry->deleteInstalledVersion($module); /** @var \Drupal\Core\Update\UpdateRegistry $post_update_registry */ $post_update_registry = \Drupal::service('update.post_update_registry'); $post_update_registry->filterOutInvokedUpdatesByModule($module); } // Rebuild routes after installing module. This is done here on top of // \Drupal\Core\Routing\RouteBuilder::destruct to not run into errors on Loading core/lib/Drupal/Core/Extension/ThemeInstaller.php +0 −2 Original line number Diff line number Diff line Loading @@ -236,7 +236,6 @@ public function install(array $theme_list, $install_dependencies = TRUE) { } $themes_installed[] = $key; // Record the fact that it was installed. $this->logger->info('%theme theme installed.', ['%theme' => $key]); } Loading Loading @@ -289,7 +288,6 @@ public function uninstall(array $theme_list) { // Remove all configuration belonging to the theme. $this->configManager->uninstall('theme', $key); } // Don't check schema when uninstalling a theme since we are only clearing // keys. Loading core/lib/Drupal/Core/Extension/module.api.php +2 −1 Original line number Diff line number Diff line Loading @@ -698,7 +698,8 @@ function hook_update_N(&$sandbox) { /** * Executes an update which is intended to update data, like entities. * * These implementations have to be placed in a MODULE.post_update.php file. * These implementations have to be placed in a MODULE.post_update.php file or * a THEME.post_update.php file. * * These updates are executed after all hook_update_N() implementations. At this * stage Drupal is already fully repaired so you can use any API as you wish. Loading Loading
core/core.services.yml +2 −0 Original line number Diff line number Diff line Loading @@ -1630,6 +1630,8 @@ services: update.post_update_registry: class: Drupal\Core\Update\UpdateRegistry factory: ['@update.post_update_registry_factory', create] tags: - { name: event_subscriber } update.post_update_registry_factory: class: Drupal\Core\Update\UpdateRegistryFactory parent: container.trait Loading
core/includes/update.inc +8 −6 Original line number Diff line number Diff line Loading @@ -226,8 +226,10 @@ function update_invoke_post_update($function, &$context) { return; } [$module, $name] = explode('_post_update_', $function, 2); \Drupal::moduleHandler()->loadInclude($module, 'php', $module . '.post_update'); // Ensure extension post update code is loaded. [$extension, $name] = explode('_post_update_', $function, 2); \Drupal::service('update.post_update_registry')->getUpdateFunctions($extension); if (function_exists($function)) { try { $ret['results']['query'] = $function($context['sandbox']); Loading Loading @@ -257,17 +259,17 @@ function update_invoke_post_update($function, &$context) { $context['finished'] = $context['sandbox']['#finished']; unset($context['sandbox']['#finished']); } if (!isset($context['results'][$module][$name])) { $context['results'][$module][$name] = []; if (!isset($context['results'][$extension][$name])) { $context['results'][$extension][$name] = []; } $context['results'][$module][$name] = array_merge($context['results'][$module][$name], $ret); $context['results'][$extension][$name] = array_merge($context['results'][$extension][$name], $ret); if (!empty($ret['#abort'])) { // Record this function in the list of updates that were aborted. $context['results']['#abort'][] = $function; } $context['message'] = t('Post updating @module', ['@module' => $module]); $context['message'] = t('Post updating @extension', ['@extension' => $extension]); } /** Loading
core/lib/Drupal/Core/Extension/ModuleInstaller.php +0 −12 Original line number Diff line number Diff line Loading @@ -334,14 +334,6 @@ public function install(array $module_list, $enable_dependencies = TRUE) { } $this->updateRegistry->setInstalledVersion($module, $version); // Ensure that all post_update functions are registered already. This // should include existing post-updates, as well as any specified as // having been previously removed, to ensure that newly installed and // updated sites have the same entries in the registry. /** @var \Drupal\Core\Update\UpdateRegistry $post_update_registry */ $post_update_registry = \Drupal::service('update.post_update_registry'); $post_update_registry->registerInvokedUpdates(array_merge($post_update_registry->getModuleUpdateFunctions($module), array_keys($post_update_registry->getRemovedPostUpdates($module)))); // Record the fact that it was installed. $modules_installed[] = $module; Loading Loading @@ -546,10 +538,6 @@ public function uninstall(array $module_list, $uninstall_dependents = TRUE) { /** @var \Drupal\Core\Update\UpdateHookRegistry $update_registry */ $update_registry = \Drupal::service('update.update_hook_registry'); $update_registry->deleteInstalledVersion($module); /** @var \Drupal\Core\Update\UpdateRegistry $post_update_registry */ $post_update_registry = \Drupal::service('update.post_update_registry'); $post_update_registry->filterOutInvokedUpdatesByModule($module); } // Rebuild routes after installing module. This is done here on top of // \Drupal\Core\Routing\RouteBuilder::destruct to not run into errors on Loading
core/lib/Drupal/Core/Extension/ThemeInstaller.php +0 −2 Original line number Diff line number Diff line Loading @@ -236,7 +236,6 @@ public function install(array $theme_list, $install_dependencies = TRUE) { } $themes_installed[] = $key; // Record the fact that it was installed. $this->logger->info('%theme theme installed.', ['%theme' => $key]); } Loading Loading @@ -289,7 +288,6 @@ public function uninstall(array $theme_list) { // Remove all configuration belonging to the theme. $this->configManager->uninstall('theme', $key); } // Don't check schema when uninstalling a theme since we are only clearing // keys. Loading
core/lib/Drupal/Core/Extension/module.api.php +2 −1 Original line number Diff line number Diff line Loading @@ -698,7 +698,8 @@ function hook_update_N(&$sandbox) { /** * Executes an update which is intended to update data, like entities. * * These implementations have to be placed in a MODULE.post_update.php file. * These implementations have to be placed in a MODULE.post_update.php file or * a THEME.post_update.php file. * * These updates are executed after all hook_update_N() implementations. At this * stage Drupal is already fully repaired so you can use any API as you wish. Loading