'MISSING UPDATES FOR: MEDIA Drupal 9

I have started facing an issue with locally hosted Drupal 9 (Xampp, Windows 10). The issue started when I was trying to create events in drupal 9 and I was redirected to Install.PHP page. However, upon checking I was redirected to Update.php and the error seems to be as mentioned below.

Install.PHP page message:

Drupal 9.2.2 Drupal already installed To start over, you must empty your existing database and copy default.settings.php over settings.php. To upgrade an existing installation, proceed to the update script. View your existing site.

Update.php Page Message:

MISSING UPDATES FOR: MEDIA The installed version of the Media module is too old to update. Update to a version prior to 9.0.0 first (missing updates: media_post_update_collection_route, media_post_update_storage_handler, media_post_update_enable_standalone_url, media_post_update_add_status_extra_filter).

I'm well aware of the fact that Media is a core module and I havent tried upgrading it or my site. My site has always been a D9 installation and there were no migrations etc. I would really appreciate expert help on this issue.



Solution 1:[1]

Running this in a function in my .theme file did the trick for me:

\Drupal::service('update.post_update_registry')
->registerInvokedUpdates(['media_post_update_collection_route', 'media_post_update_storage_handler', 'media_post_update_enable_standalone_url', 'media_post_update_add_status_extra_filter', 'setting functions as applied according_to_the_error_message']);

I personally used hook_theme() (Make sure to clear your cache for it to run and also remove this code once the issue is fixed.)

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Rubix05