Closed (fixed)
Project:
Entity Browser
Version:
8.x-2.x-dev
Component:
Widget plugins
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
8 Jan 2018 at 15:33 UTC
Updated:
23 Jan 2018 at 17:59 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
tstoecklerHere we go. This worked for me on my local setup.
Comment #3
marcoscanoThank you @tstoeckler!
The code looks good to me, and I have manually tested that an existing browser is correctly migrated to use the new ID, so say a field widget using the old EB will start using the new one.
I was under the impression that we should implement
hook_update_dependencies()to ensure this update hook runs after themedia_entityones, but in fact the code here doesn't interact with the new API in any way. Actually while testing, I had them run in this order:and everything worked just fine.
Looks good to me!
Comment #4
samuel.mortensonShould we be checking if the core media module is enabled before switching people over?
Comment #5
marcoscanoIn theory the 2.x branch shouldn't be used with ME 1.x :
So the only scenario I can think of that being possible, is:
1) Site upgrades to media in core (keeping EB 1.x)
2) Site disables media
3) Site upgrades EB to 2.x
Not sure if we should bother with that though?
Comment #6
samuel.mortenson@marcoscano So hook_requirements only gets run on install, right? So if I was on media_entity and Entity Browser 1.x, then upgraded to Entity Browser 2.x, that hook would never be run, but the update hook would run which would break all of my existing widgets.
Comment #7
marcoscanoI don't think so, if I'm not mistaken
hook_requirements()will always run before anyhook_update_N(), passing'update'as the$phaseparam.Once in our implementation we are disregarding
$phase, it means our requirement is checked always: on install, on DB updates, and when a user visits the status report page. So the scenario of a M.E. 1.x with E.B 2.x would only exist if a user upgraded the codebase and did not run the DB updates, which is a state the user cannot expect everything to work properly :)Edit: We are using this same mechanism in M.E. 2.x to prevent upgrade if certain conditions are not met, and it successfully aborts the DB updates if the requirements are not OK.
Comment #9
samuel.mortensonThanks for the clarifications. Fixed!