Problem/Motivation
The \Drupal\diff\Controller\PluginRevisionController::compareEntityRevisions() calls getRevisionIds() for all languages and then determines if the language matches by loading the revision. This can be problematic on a site with lots of revisions.
Steps to reproduce
See #2722307: Move translation based conditions into database query on revisions overview page
Proposed resolution
Update \Drupal\diff\Controller\PluginRevisionController::getRevisionIds() to filter the query by "langcode" and "revision_translation_affected".
Remaining tasks
Do it
User interface changes
None.
Introduced terminology
N/A
API changes
Passing an entity id to PluginRevisionController::getRevisionIds is deprecated, pass the entity instead.
Data model changes
Release notes snippet
| Comment | File | Size | Author |
|---|
Issue fork diff-3418442
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
recrit commentedThe attached patch updates
\Drupal\diff\Controller\PluginRevisionController::getRevisionIds()to filter the query by "langcode" and "revision_translation_affected"Comment #4
recrit commentedupdated the patch to check if the entity type is translatable before adding the new conditions to the query
Comment #5
recrit commentedUpdates to the patch: Remove loading all revisions - This is no longer needed since the query is already filtered by language and translation affected.
Comment #6
recrit commentedComment #8
recrit commentedUse the MR 109 for the latest changes applied to 1.8+. Attached is a static patch of the MR to use for composer builds.
Comment #9
recrit commentedcode cleanup complete. All warnings on the MR are for files that are not changed in the MR.
Attached is a static patch of the MR to use for composer builds.
Comment #10
acbramley commentedMR needs to be against 2.x
Comment #12
recrit commentedMR110 created against 2.x
Comment #13
acbramley commentedPostponing this on #2722307: Move translation based conditions into database query on revisions overview page once that is in we can apply the same logic to Diff.
This may also just be a duplicate of #2882334: Revisions are not visible for some nodes
Comment #16
acbramley commentedThe core issue is close to being committed so we can apply the same logic here and clean up a lot of code.
Comment #18
acbramley commentedChanges are done and tests have been fixed, it would be good if anyone with a large multi-lingual setup could manually test these changes and report back :)
Comment #19
heddnPosted some minor feedback on the PR. I did no manual testing.
Comment #20
acbramley commentedDiscussed extensively in slack https://drupal.slack.com/archives/C1BMUQ9U6/p1768919644431179
Let's remove the deprecation in getRevisionIds and make the method private. Once merged we will release 2.0.0
Comment #22
alexpottMade the changes @acbramley and I discussed on slack.
#20 is an excellent plan.
Comment #23
acbramley commentedCreated #3568877: Remove $previous_revision handling from RevisionOverviewForm after reviewing the latest changes. Should probably do that before releasing a stable too.
Comment #24
alexpott@acbramley yeah - I noticed that too.- that was left in to consider reverting https://www.drupal.org/project/diff/issues/2880936 - but I agree #3568877: Remove $previous_revision handling from RevisionOverviewForm makes sense. There's also \Drupal\diff\DiffEntityComparison::summary() which is never called apart from by itself...
Comment #26
acbramley commentedThanks everyone!