Skip to content

Instantly share code, notes, and snippets.

@junaidpv
Created August 28, 2023 11:24
Show Gist options
  • Save junaidpv/04fa42d786f24f6b17003b7f4b373947 to your computer and use it in GitHub Desktop.
Save junaidpv/04fa42d786f24f6b17003b7f4b373947 to your computer and use it in GitHub Desktop.
This is a PHP script to run with drush on a drupal site that is giving error when updating from D9.4 to D9.5. The erros appearing like as reported at https://www.drupal.org/project/drupal/issues/3206215 and https://stackoverflow.com/questions/68598939/missing-updates-for-media-drupal-9
<?php
$post_update_registry = \Drupal::service('update.post_update_registry');
$modules = [
'block',
'block_content',
'comment',
'contextual',
'datetime_range',
'dblog',
'editor',
'field',
'image',
'layout_builder',
'layout_discovery',
'media',
'media_library',
'node',
'path',
'responsive_image',
'search',
'system',
'taxonomy',
'text',
'user',
'menu_link_content',
'views'
];
foreach ($modules as $module) {
$removed_post_updates = $post_update_registry->getRemovedPostUpdates('block');
$post_update_registry->registerInvokedUpdates(array_keys($removed_post_updates));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment