diff --git a/core/lib/Drupal/Core/Extension/module.api.php b/core/lib/Drupal/Core/Extension/module.api.php index 2cfbd80..1b62360 100644 --- a/core/lib/Drupal/Core/Extension/module.api.php +++ b/core/lib/Drupal/Core/Extension/module.api.php @@ -697,7 +697,7 @@ function hook_post_update_NAME(&$sandbox) { $node->setTitle('foo'); $node->save(); - return t('Node 123 saved'); + return t('Node %nid saved', ['%nid' => $node->id()]); } /** diff --git a/core/lib/Drupal/Core/Update/UpdateRegistry.php b/core/lib/Drupal/Core/Update/UpdateRegistry.php index dc0bc3f..8d7be81 100644 --- a/core/lib/Drupal/Core/Update/UpdateRegistry.php +++ b/core/lib/Drupal/Core/Update/UpdateRegistry.php @@ -88,7 +88,7 @@ protected function getAvailableUpdateFunctions() { * * @return callable[] */ - public function getMissingUpdateFunctions() { + public function getPendingUpdateFunctions() { // We need a) the list of active modules (we get that from the config // bootstrap factory) and b) the path to the modules, we use the extension // discovery for that. @@ -155,8 +155,8 @@ protected function loadUpdateFile(Extension $module) { * the description from source code comment for each update function. * This array is keyed by the update name. */ - public function getMissingUpdateList() { - $functions = $this->getMissingUpdateFunctions(); + public function getPendingUpdateInformation() { + $functions = $this->getPendingUpdateFunctions(); $ret = []; foreach ($functions as $function) { diff --git a/core/modules/system/src/Controller/DbUpdateController.php b/core/modules/system/src/Controller/DbUpdateController.php index c5fe862..0378f95 100644 --- a/core/modules/system/src/Controller/DbUpdateController.php +++ b/core/modules/system/src/Controller/DbUpdateController.php @@ -267,7 +267,7 @@ protected function selection(Request $request) { break; case 'post_update': $after_update_registry = $this->getPostUpdateRegistry(); - $updates = $after_update_registry->getMissingUpdateList(); + $updates = $after_update_registry->getPendingUpdateInformation(); break; } foreach ($updates as $module => $update) { @@ -589,8 +589,8 @@ protected function triggerBatch(Request $request) { } } - $after_update_registry = $this->getPostUpdateRegistry(); - $post_updates = $after_update_registry->getMissingUpdateFunctions(); + $post_update_registry = $this->getPostUpdateRegistry(); + $post_updates = $post_update_registry->getPendingUpdateFunctions(); if ($post_updates) { // Now we rebuild all caches and after that execute the hook_post_update() diff --git a/core/tests/Drupal/Tests/Core/Update/UpdateRegistryTest.php b/core/tests/Drupal/Tests/Core/Update/UpdateRegistryTest.php index 6be96e1..3877073 100644 --- a/core/tests/Drupal/Tests/Core/Update/UpdateRegistryTest.php +++ b/core/tests/Drupal/Tests/Core/Update/UpdateRegistryTest.php @@ -7,7 +7,6 @@ namespace Drupal\Tests\Core\Update; -use Drupal\Component\Utility\NestedArray; use Drupal\Core\KeyValueStore\KeyValueStoreInterface; use Drupal\Core\Site\Settings; use Drupal\Core\Update\UpdateRegistry; @@ -95,9 +94,9 @@ function module_b_post_update_a() { } /** - * @covers ::getMissingUpdateFunctions + * @covers ::getPendingUpdateFunctions */ - public function testGetMissingUpdateFunctionsWithNoExistingUpdates() { + public function testGetPendingUpdateFunctionsNoExistingUpdates() { $this->setupBasicModules(); $key_value = $this->prophesize(KeyValueStoreInterface::class); @@ -113,13 +112,13 @@ public function testGetMissingUpdateFunctionsWithNoExistingUpdates() { 'module_a_post_update_a', 'module_a_post_update_b', 'module_b_post_update_a' - ], $update_registry->getMissingUpdateFunctions()); + ], $update_registry->getPendingUpdateFunctions()); } /** - * @covers ::getMissingUpdateFunctions + * @covers ::getPendingUpdateFunctions */ - public function testGetMissingUpdateFunctionsWithExistingUpdates() { + public function testGetPendingUpdateFunctionsExistingUpdates() { $this->setupBasicModules(); $key_value = $this->prophesize(KeyValueStoreInterface::class); @@ -134,14 +133,14 @@ public function testGetMissingUpdateFunctionsWithExistingUpdates() { $this->assertEquals(array_values([ 'module_a_post_update_b', 'module_b_post_update_a' - ]), array_values($update_registry->getMissingUpdateFunctions())); + ]), array_values($update_registry->getPendingUpdateFunctions())); } /** - * @covers ::getMissingUpdateList + * @covers ::getPendingUpdateInformation */ - public function testGetMissingUpdateList() { + public function testGetPendingUpdateInformation() { $this->setupBasicModules(); $key_value = $this->prophesize(KeyValueStoreInterface::class); @@ -160,13 +159,13 @@ public function testGetMissingUpdateList() { $expected['module_b']['pending']['a'] = 'Module B update A.'; $expected['module_b']['start'] = 'a'; - $this->assertEquals($expected, $update_registry->getMissingUpdateList()); + $this->assertEquals($expected, $update_registry->getPendingUpdateInformation()); } /** - * @covers ::getMissingUpdateList + * @covers ::getPendingUpdateInformation */ - public function testGetMissingUpdateListWithExistingUpdates() { + public function testGetPendingUpdateInformationWithExistingUpdates() { $this->setupBasicModules(); $key_value = $this->prophesize(KeyValueStoreInterface::class); @@ -184,7 +183,7 @@ public function testGetMissingUpdateListWithExistingUpdates() { $expected['module_b']['pending']['a'] = 'Module B update A.'; $expected['module_b']['start'] = 'a'; - $this->assertEquals($expected, $update_registry->getMissingUpdateList()); + $this->assertEquals($expected, $update_registry->getPendingUpdateInformation()); } }