If you have an site which already has a lot of content, the install hook can take a while (~3h in our case)

A lot of entity types there we will never import or export to any other site, while others we want to export and import.

Idea here would be to add a hook so a developer can adjust the allowed entity types. Then on all places this is checked.

With this it would be easy to add later a config for this too, but for hook_install a config is too late...

Comments

kfritsche created an issue. See original summary.

kfritsche’s picture

Assigned: kfritsche » Unassigned
Status: Active » Needs review
StatusFileSize
new10.3 KB

Here a patch for this.

kfritsche’s picture

Title: Add hook to be able to ignore entity types » Add config to be able to ignore entity types
StatusFileSize
new10.59 KB
new1.14 KB

Changed to config as it works better than the hook implementation and if you add the config to your profile its also active on install already.

steveoriol’s picture

StatusFileSize
new120.71 KB

hello kfritsche,

I try to use your patch by changing the module config for:

site_uuid_override: '0'
help_menu_disabled: true
entity_types:
 - taxonomy_term

but I get errors when I export the content...
errors
if I use:

site_uuid_override: '0'
help_menu_disabled: true
entity_types: {}

I have no error, but all the entity type.

kfritsche’s picture

StatusFileSize
new3.75 KB
new10.42 KB

Re-roll after latest patches got applied and fixing the reported issue by steveoriol.

kfritsche’s picture

StatusFileSize
new10.32 KB

Re-roll of #5.

grougy’s picture

Hello kfritsche,
Your idea is very usefull,
There is then a bug in ImportQueueResolver :
When an entity is in the whitelist but none of its dependencies, the entity is then wiped from the import queue (because never added to the Graph)
When the entity has no dependency at all it is working fine.
We should test in the loop if at least one dependency is added to the Graph, if not the parent entity needs to be added like if no dependency.
Greg

PS : would it be hard to go further and handle entity bundle in the white list ?

webfaqtory’s picture

Maybe I'm misunderstanding the purpose of this patch but I only want to sync nodes where the content has changed (or even all nodes). I applied the patch with the following config:

site_uuid_override: '0'
help_menu_disabled: false
entity_types:
  - node

The export worked fine and only contained nodes. However the Synchronize page indicated that it was going to remove all content that was not a node. Is there a way for the remove to only apply to the entity_types in the config?

blanca.esqueda’s picture

Hi,

@webfaqtory and @grougy,

You can find functionality that handles partial import/exports in:
https://www.drupal.org/project/content_sync/issues/2873074#comment-13019230

It can handle partial import/exports filtered by entity types, bundles, uuids and actions.

Because of partial imports, some work on the ImportQueueResolver was done:
Now, if an entity has dependencies and it is not included in the content to import then it checks that it exists in the active storage (site DB). if dependencies are not in the active storage then try to pull it from the content sync directory.
Only when dependencies can't be found anywhere the entity import is skipped.

Because of partial exports, an ExportQueueResolver was added to provide the option to export including dependencies.

The new functionality for partial import/exports is handled by Drush commands, but the options will be added to the UI asap.

grougy’s picture

@Blanca.Esqueda
OK thanks for pointing me to the issue. I'll have a look.

kfritsche’s picture

StatusFileSize
new8.77 KB

Re-roll after latest changes.

kfritsche’s picture

StatusFileSize
new1.28 KB
new10.98 KB

Fixing a warning noticed through our internal testing system.

kfritsche’s picture

StatusFileSize
new10.98 KB
new896 bytes

small fix when you have computed values.

kfritsche’s picture

StatusFileSize
new1.02 KB
new10.85 KB

Last fix still had an issue with computed values. This should be hopefully fixed now.

chegor’s picture

#14 works for me.

skaught’s picture

StatusFileSize
new15.23 KB
new13.92 KB

fixes admin settings form to add checkboxes selection of entities to export.

skaught’s picture

StatusFileSize
new13.82 KB

sorry, left a ddl() in #16.

blanca.esqueda’s picture

Version: 8.x-2.x-dev » 4.0.x-dev
Component: Code » Snapshot