Problem/Motivation
This module updates affected entities using the Entity API, by loading the entity, performing the embed code swap, and saving it again. This ignores all the past revisions which could be a problem when someone reverts to an old revision. It also causes the entities updated date to be reset to the current time which is not great as it's not really a human that did this change and it might confuse editors on the site. This is especially true because it will seem like the last person to edit the node is also the person to made this change.
Steps to reproduce
Proposed resolution
Instead of using the Entity API, what about doing a direct database query to replace the values? It's more risky but it allows avoiding the problems above, and it allows editing the revision data too.
Remaining tasks
User interface changes
API changes
Data model changes
| Comment | File | Size | Author |
|---|---|---|---|
| #4 | 3350728-4.patch | 948 bytes | dww |
Comments
Comment #2
eelkeblokDefinately sounds like a plan, would be open to MRs. I wonder if this would warrant a 2.0 version, as it is quite a fundamentally different approach. Also, this will probably have an impact on the approach in #3362803: Optimize install hook; we'd need to consider missing entities that have entity tags in older revisions.
Comment #3
dwwFirst of all, thanks for this very helpful module! Mostly working great to solve a need.
Not sure if this belongs here or another issue, but on the site where I'm running this, I want the entity updates from this to result in new revisions being created with a revision_log message about it. I've got it working locally with a few lines of change. I'm happy to put the code as an MR in here, or to open a new issue for it. What do y'all prefer?
I don't believe I want the proposed behavior where this code would reach back into all past revisions and try to update those, too. I like that it's a 1-time conversion (with distinct revisions), and if folks want to revert, it's up to them to re-convert embed tags. Maybe make it so you can re-convert on-demand in some way, instead of immediately uninstalling the module when the initial conversion is done?
Anyway, not clear what direction this issue is heading, and where to share my code. Please advise.
Thanks again!
-Derek
Comment #4
dwwOld school, here's the change as a patch. 😂 I'll convert to an MR in the appropriate issue, once I know where that is. 😅
Thanks,
-Derek
Comment #5
eelkeblokThanks for the input, this is a fundamentally different approach to what seems to be a similar concern. I’d say this is less invasive, so I guess this should get its own issue that we can add without much fuss. I’m thinking the approach from this issue should somehow be opt-in, although that is hard to unify with the way it is triggered now, by just installing the module. Maybe that needs to be changed to some UI with some choices before the queue is built.