diff -u b/core/modules/menu_link_content/menu_link_content.install b/core/modules/menu_link_content/menu_link_content.install
--- b/core/modules/menu_link_content/menu_link_content.install
+++ b/core/modules/menu_link_content/menu_link_content.install
@@ -23,20 +23,25 @@
function menu_link_content_requirements($phase) {
$requirements = [];
- // Check for menu_link_content data integrity issues.
- if (in_array($phase, ['update', 'runtime'], TRUE)) {
- // The 'enabled' field is non-NULL - if we get a NULL value that indicates a
- // failure to join on menu_link_content_data.
+ // Check for invalid data before making links revisionable.
+ /** @var \Drupal\Core\Update\UpdateRegistry $registry */
+ $registry = \Drupal::service('update.post_update_registry');
+ $pending_updates = $registry->getPendingUpdateFunctions();
+ $update_name = 'menu_link_content_post_update_make_menu_link_content_revisionable';
+ if ($phase === 'update' && in_array($update_name, $pending_updates, TRUE)) {
+ // The 'enabled' field is non-NULL - if we get a NULL value that indicates
+ // a failure to join on menu_link_content_data.
$is_broken = \Drupal::entityQuery('menu_link_content')
->condition('enabled', NULL, 'IS NULL')
->range(0, 1)
->accessCheck(FALSE)
->execute();
if ($is_broken) {
- $requirements['menu_link_content_missing_data'] = [
+ $requirements[$update_name] = [
'title' => t('Menu link content data'),
'value' => t("Integrity issues detected"),
- 'description' => t('The menu link content entity type has data integrity issues: you should fix this immediately. See the change record for more information.', [
+ 'description' => t('The %update_name function cannot be run until the data has been fixed. See the change record for more information.', [
+ '%update_name' => $update_name . '()',
':change_record' => 'https://www.drupal.org/node/3117753',
]),
'severity' => REQUIREMENT_ERROR,
diff -u b/core/modules/menu_link_content/tests/src/Functional/Update/MenuLinkContentUpdateTest.php b/core/modules/menu_link_content/tests/src/Functional/Update/MenuLinkContentUpdateTest.php
--- b/core/modules/menu_link_content/tests/src/Functional/Update/MenuLinkContentUpdateTest.php
+++ b/core/modules/menu_link_content/tests/src/Functional/Update/MenuLinkContentUpdateTest.php
@@ -104,10 +104,7 @@
}
/**
- * Test the update hook requirements data integrity check.
- *
- * It was added to prevent errors updating menu link content entities to be
- * revisionable.
+ * Test the update hook requirements check for revisionable menu links.
*
* @see menu_link_content_post_update_make_menu_link_content_revisionable()
* @see menu_link_content_requirements()
@@ -132,7 +129,7 @@
$this->drupalGet($this->updateUrl);
$this->assertSession()->pageTextContains('Errors found');
- $this->assertSession()->elementTextContains('css', '.system-status-report__entry--error', 'The menu link content entity type has data integrity issues: you should fix this immediately.');
+ $this->assertSession()->elementTextContains('css', '.system-status-report__entry--error', 'menu_link_content_post_update_make_menu_link_content_revisionable() function cannot be run until the data has been fixed');
}
/**