Allow users to configure which referenced entities to export

Created on 1 May 2023, over 1 year ago
Updated 26 July 2024, 2 months ago

Problem/Motivation

The content export of referenced entities is extremely powerful. A great feature would be to allow users to configure which referenced entity types should be exported and which should not. For example, if you wanted to be safe you might configure it to export only referenced files, users, media and taxonomy terms and avoid content - knowing that content deployment is handled by another process (but still using DCD).

Steps to reproduce

N/A

Proposed resolution

Add a configuration option to allow/disallow content entity types and skip those that are not enabled during recursive reference export.

Remaining tasks

This module does not have a schema.yml file to be updated, so there are no changes to make there unless one is added.

User interface changes

A new configuration is added to the DCD settings form.

API changes

None.

Data model changes

None.

Feature request
Status

Fixed

Version

2.0

Component

Code

Created by

🇨🇦Canada joel_osc

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

Comments & Activities

  • Issue created by @joel_osc
  • Status changed to Needs review over 1 year ago
  • 🇨🇦Canada joel_osc

    Here is a patch that adds this functionality.

  • 🇨🇦Canada smulvih2 Canada 🍁
  • 🇩🇪Germany mkalkbrenner 🇩🇪

    Such a feature already exists using the --skip_entity_type option.

  • 🇨🇦Canada joel_osc

    Hi and thank-you for your work on the module!!!

    I think this patch is different than the --skip-entity-type option in that it is add the ability to skip referenced entities by type. Our business requirement is that no referenced nodes are exported. I think, but am not 100% sure, that if we use --skip_entity_type=node then we wouldn't get any nodes at all? Cheers!

  • 🇩🇪Germany mkalkbrenner 🇩🇪

    Can you post a concrete example? Then we could decide what to do.

  • 🇨🇦Canada joel_osc

    Okay, sounds great. An example would be if a user wants to export nid's 10,15,23 and all of the taxonomy references, media references with them but not the node references because they don't want any other local node updates exported other than 10,15,23. In this case you would want the ability to export nodes, but not any referenced nodes. Does this make sense?

  • 🇩🇪Germany mkalkbrenner 🇩🇪

    You could specify an entity type and the concrete entity IDs you want to export.
    I would expect that --skip_entity_type=node should then only affect the node references. If not, that should be the small change.

    BTW we use "changes since". That would export a node you recently worked on and only references that have been changed as well.

  • 🇨🇦Canada smulvih2 Canada 🍁

    I looked into this in more detail. The skip_entity_type option is only available in Drush for export of entire site (drush dcdes). If you pass node to this command (drush dcdes --skip_entity_type=node) it will export all entity types except nodes. I think this is a good option to exclude things like url_alias entities from a full site export.

    The patch in #2 adds a UI to be able to exclude entity types as references. This only comes into play with drush dcder, or exporting with references through the UI. So I could do a drush dcder node, and it will export all nodes with references, but will not include nodes as part of the references from nodes. This granularity is particularly important to have with batch API, since including nodes as references from nodes can lead to one batch operation including hundreds of nodes and timing out. I think now that #3349952 Include dependencies from processed text fields Fixed has been merged, this granularity becomes even more important, if using the "Export processed text dependencies" option.

    I think what is from patch #2 is the ability to pass this list of allowed reference types to Drush, as I know @mkalkbrenner requested this for another one of my patches. This would allow Drush to override what's in the UI if needed, so provides more flexibility.

  • Status changed to Fixed 3 months ago
  • 🇩🇪Germany mkalkbrenner 🇩🇪

    I went ahead and made the existing option skip_entity_type available to all imports. Because you added your setting form to Use Batch API for export/import Needs review I re-used it to configure the entity types to skip.
    Like any other parameter, you could overwrite the setting by providing the dedicated parameter.

    I prefer to keep the existing negative list and to use it everywhere instead of introducing an additional positive list. The advantage is that a new content type gets exported by default using this approach.

  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024