- πͺπΈSpain eduardo morales alberti Spain, πͺπΊ
In our case, we tried to find all the UUIDs definitions on the default_content and remove them, it will remove all entities defined by default_content.
We tried the drush command and the paragraphs were not removed for example.$entity_types = [ 'node', 'paragraph', 'taxonomy_term', 'media', 'file', 'menu_link_content', ]; $uuids = []; $module_folder = \Drupal::moduleHandler() ->getModule($module) ->getPath() . '/content'; $dirs = array_filter(glob($module_folder . '/content/*'), 'is_dir'); $uuids = []; $pattern = '/uuid: (\w.*-\w.*-\w.*-\w.*-\w.*)/m'; foreach ($dirs as $dir) { $entity_type = basename($dir); if (!in_array($entity_type, $entity_types)) { continue; } $files = glob($dir . '/*.yml'); foreach ($files as $file) { $contents = file_get_contents($file); if (preg_match_all($pattern, $contents, $matches, PREG_SET_ORDER, 0)) { foreach ($matches as $match) { $uuids[] = $match[1]; } } $uuids = array_unique($uuids); } } foreach ($entity_types as $entity_type) { $entities = \Drupal::entityTypeManager()->getStorage($entity_type)->loadByProperties(['uuid' => $uuids]); \Drupal::entityTypeManager()->getStorage($entity_type)->delete($entities); }
- Merge request !45Resolve #3282547 "Drush delete content reimport" β (Open) created by eduardo morales alberti
- last update
8 months ago 13 pass - πͺπΈSpain eduardo morales alberti Spain, πͺπΊ
We created a new branch "3282547-drush-delete-content-reimport" to delete all entities from default_content based on all the uuids defined on the default_content module.
Also we add a reimport command (deletes and import again the content). - last update
8 months ago 13 pass - last update
8 months ago 13 pass - π§π―Benin delacosta456
hi @eduardo-morales-alberti
I was looking for something like this.
The patch applied correctly but looks to have breaks another patch Drush comand to export all items from entity with defined criteria β¨ Drush comand to export all items from entity with defined criteria Needs review that i was using to export at once node+references to folder .Example :
drush dcer node 34 --folder=modules/custom/mycustom_default_content/content
after the merge request 45.patch
the above command doesn't work and send the following error
In LegacyServiceInstantiator.php line 282: You have requested a non-existent parameter "default_content.deleter".
Can you help
Thanks