Support exporting/importing revisions

Created on 16 February 2024, 4 months ago
Updated 27 February 2024, 4 months ago

Problem/Motivation

Only the default revision gets exported. It should be possible to export (and import) all revisions.

Steps to reproduce

  • Create a node with multiple revisions.
  • Export the node.

Expected behavior: with revisioning support enabled, all revisions should be exported.

Actual behavior: there's no revisioning support, therefore only the default revision gets exported.

Proposed resolution

Add a submodule that also exports revisions, so it's easy to enable/disable revisioning support as needed.

Remaining tasks

Review, commit, release.

User interface changes

None.

API changes

None. Actually, the submodule is possible by using the already-existing API.

Data model changes

Just like with translations, there should be a revisions entry in the exported YAML.

✨ Feature request
Status

Needs work

Version

1.4

Component

Code

Created by

πŸ‡­πŸ‡ΊHungary Boobaa

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @Boobaa
  • Status changed to Needs review 4 months ago
  • πŸ‡­πŸ‡ΊHungary Boobaa

    The attached patch adds a single_content_sync_revisions submodule, which adds this feature.

  • Assigned to Rangaswini
  • Issue was unassigned.
  • Reviewed patch #2 and works fine with version 1.4. Please refer screenshot
    Step:
    Created a node with multiple revisions.
    Exported the node.
    Result: All revisions are exported now.

  • πŸ‡ΊπŸ‡¦Ukraine abramm Lutsk

    Hi Boobaa,

    Thank you for your effort!
    A few thoughts here.

    1) We definitely don't want to have accessCheck(FALSE). The current user may not have permissions to view all revisions; this code will give them read access. This is a security/data disclosure issue.

    2) The core version requirement should be core_version_requirement: ^9.3 || ^10, same as in root info.yml.

    3) The following line will produce a warning if there are no revisions in YML file:
    if ($content['revisions']) {

    4) The revision creation time should be import/exported the same way we do for created/changed timestamps.

    5) We'd likely need a test for this; also, please create the merge request to run automated tests.

    Thanks!

  • Status changed to Needs work 4 months ago
  • πŸ‡ΊπŸ‡¦Ukraine abramm Lutsk
  • Hi,
    I have tried to using this patch it is getting exported with revision but as I a paragraph field when i am import it i am getting as
    Call to undefined method Drupal\paragraphs\Entity\Paragraph::setRevisionCreationTime() in Drupal\single_content_sync_revisions\ImportSubscriber->onImportEvent() (line 52 )... please look to this issue as well

Production build 0.69.0 2024