After upgrading to 8.5.0 core media from media_entity 1.x, the recommendation is to remove the uninstalled media_entity 2.x module from the codebase.
Doing so produces a warning for me, it seems the system is still looking for the media_entity.install file:
User warning: The following module is missing from the file system: media_entity in drupal_get_filename() (line 268 of core/includes/bootstrap.inc).
drupal_get_filename('module', 'media_entity') (Line: 291)
drupal_get_path('module', 'media_entity') (Line: 134)
module_load_include('install', 'media_entity') (Line: 93)
module_load_install('media_entity') (Line: 82)
drupal_load_updates() (Line: 109)
Drupal\system\SystemManager->listRequirements() (Line: 96)
Drupal\system\SystemManager->checkRequirements() (Line: 102)
Drupal\system\Controller\SystemController->overview('system.admin_config')
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 582)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 124)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 151)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 68)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 57)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 50)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 657)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)
Comments
Comment #2
marcoscanoDid you experience any problems or error messages while running the DB updates?
It seems that it still thinks that the module is enabled, but the updb code should have uninstalled it. I assume an additional cache clear doesn't solve the warning message, right?
Comment #3
johnpitcairn commentedHmm ... I am now about a hundred cache clears and a few cron runs further on and it does seem to have disappeared in the UI.
I still get it if I run
drush updatedbor visit/update.phpComment #4
Mytko Enko commentedHave you tried this - https://www.drupal.org/node/2487215
Comment #5
johnpitcairn commented@Mytko Enko: Yes removing media_entity from the system schema via direct sql query does work, but it's a something of a last resort, and leaves me wondering if there are other problems it may be masking. I'd much prefer putting the module back into the codebase and uninstalling it manually, but of course that isn't really possible or advisable post-upgrade.
Comment #6
karlsheaI'm also getting the same error. No warnings or anything during the upgrade process.
Comment #7
spokjeSame error here, also no warnings/errors during upgrade process.
To make this a bit more useful post, and saving anyone the extra click for #4, this does the trick:
drush sql-query "DELETE FROM key_value WHERE collection='system.schema' AND name='media_entity'"But I also agree with #5. It's a last resort and not something you want every user that is going to migrate to Core Media having to do.
Comment #8
tstoecklerHit this as well today. This is because Media Entity is uninstalled from within an update function from the module itself. What happens is that even though during the installation the schema version is correctly removed, after the update has finished
update_do_one()callsdrupal_set_installed_schema_version($module, $number)so that there will still be a lingering schema version afterwards.Afterwards any call to
drupal_load_updates()will find that schema version and will callmodule_load_install('media_entity')which will trigger the error above.Not sure yet what to do about this, but it's certainly a major issue.
I guess we could maybe run something in core to clean this up?
Comment #9
tstoecklerThis is what fixed it for me in a custom module.
Comment #10
hchonovShould we add this to the core media module to fix this for installations, which have been updated already?
Comment #11
tstoecklerYes, I think that would make sense. It certainly must be run by code that is not inside media_entity itself, so I think the core media module would be a logical place, especially since something along the lines of #9 should suffice and that's not really a lot of code to maintain.
I'd be interested to hear what the Media maintainers say about this, though.
Comment #12
hchonovTentatively moving the issue to the Core media system. Feel free to revert, but I think that makes the most sense.
Comment #13
seanbI agree this is an annoying issue, but I don't think we should solve this in a core update hook. Maybe a new branch of media_entity with a uninstall hook that fixes this? You can install and directly uninstall media_entity 3.x to fix it if you don't want to add your own update hook?
Comment #14
hchonovI am not sure that it is nice to ask people to install a specific version of the media_entity module as they moved from it to the core one. We cannot reach to all the people, but with a core media update we'll fix all sites silently without having to inform anyone about anything. The media core module is aware of the media_entity module - see media_requirements() in media.install, therefore I don't think there is a problem with adding a simple update to the media module.
Comment #17
frederickjh@tstoeckler Thanks for the code. That solved it for me.
For those GUI users there should be some sort of resolution to this issue that does not involve a custom module or the command line.
Comment #18
tstoecklerSee the newly opened #3063734: Support uninstalling the module providing the update hook in hook_update_N for some updates on this.
Comment #19
chr.fritschI think we can close this issue since #3063719: Remove media_entity from the update schema list was merged
Comment #20
tstoecklerI personally think it would be nice to clean this up for people that have already done the upgrade, since Media in Core has been stable for a while. We could add an update hook to the Media module. Going on #9, we could do something like this:
Comment #21
chr.fritschSounds like a plan. I am moving this back to the media_entity issue queue
Comment #22
berdirthis can't be solved in media_entity, because that is already uninstalled, it can only be done from a module that's still installed and media in core would be an obvious choice.
Comment #23
chr.fritschAhh, stupid me. 🙈