Problem/Motivation
Content that needs update or new content doesn't have to require a module/profile install in order to be imported. Normally it should be easy to make changes on content or add new content even the site is on production.
Proposed resolution
Add 2 new Drush commands:
default-content-import-module: Imports or updates all the content provided by a module or profile.default-content-import: Imports or updates the content provided by all enabled modules and default profile.
Remaining tasks
- [#https://www.drupal.org/node/2698425]
- [Please add]
User interface changes
API changes
Data model changes
| Comment | File | Size | Author |
|---|---|---|---|
| #142 | 2640734-warning-about-missing-dependencies.patch | 771 bytes | bladedu |
Issue fork default_content-2640734
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
claudiu.cristeaPatch.
Comment #3
claudiu.cristeaIS change.
Comment #4
sam152 commentedPerhaps this check should be moved into the importContent if it's important? Currently it's checked twice in the drush file.
Could this same validation be used by the other drush commands that take a module as an argument?
Is INEXISTENT_MODULE a drush thing? Is non-existent meant here?
Nit: short-descriptions should be one line.
Would be good to get some more eyes over this.
Comment #5
claudiu.cristea#4.1: It's not used twice in Drush but in .module. I don't see the reason for that check, thus I removed from patch. Moving in import is out of scope of this issue.
#4.2: OK, I added the validation to the other command event it's off-topic for this issue.
#4.3: OK, changed to
INVALID_MODULE.#4.4: Fixed.
#4.5: Someone could argue that removing the existing entity is not correct because the overridden data should rather be a new revision of the existing entity (in case of revisionables). Well, this is very complex to implement (I tried) because the object resulted from decoding doesn't fit the existing object even they are the same. This is a problem of the entity system, specifically of how
\Drupal\Core\Field\FieldItemListInterface::equals()works. For example if a node entity is imported, the existing entity $node->path value is an empty array[]while the decoded value is['alias' => NULL, 'pid' => NULL]. For such a case, a new revision will be created and this is wrong. We don't want to create new revisions unless a real, human-signifiant, change has been made.But this would be to much as for default_content entities we already have the "revisioning" assured in code (because the code is in a VCS). To get a reasonable compromise, I added a new parameter to
importContent().This prevents overriding by default.
Comment #6
ademarco commentedShouldn't this be
$this->entityRepository->loadEntityByUuid(...)?Comment #7
id.tarzanych commentedWorked for me. Thanks!
Created a fixed patch for those who need a link to file.
Comment #8
claudiu.cristeaGreat! I'm moving this to RTBC as @id.tarzanych confirmed that works as expected and all review points were addressed.
Comment #9
keesje commented#7 confirmed as working, great!
I doubt the "$existing_entity->delete();" part though. For standalone entities this is OK, but what about references?
Case:
Import terms. Use these for tagging nodes (adding references from nodes to terms). Than "update" these terms by delete followed by save. All references would be gone right? This is not updating, this is re-adding, which can be OK in some cases.
Comment #10
keesje commentedThis patch has a more intelligent "update" handling of existing entities: https://www.drupal.org/node/2698425#comment-11377803
Comment #11
keesje commentedI combined the patches
Comment #12
damontgomery commentedTested #11 and it seems good. It fixes several issues we've had.
- Can install a content module on a site where the node already existed without throwing an error.
- Can install new content once the module has already be run by executing the drush command.
Comment #13
keesje commentedComment #14
realgt commentedAfter applying patch #11 i was able to run the import once, but on the second time i was unable to access /admin/content and got the same error listed here: http://drupal.stackexchange.com/questions/200492/can-not-access-contents...
Comment #15
keesje commentedInteresting, van you add steps to reproduce please?
Comment #16
claudiu.cristea@keesje, are so kind to provide an interdiff for #11 against #7?
Comment #17
claudiu.cristeaComment #18
keesje commentedLike this?
Comment #19
claudiu.cristeaNot exactly :) See https://www.drupal.org/documentation/git/interdiff. We create interdiffs on each patch, even the change is very small, because it help reviewers to understand the changes from the previous patch.
Comment #20
keesje commentedCheck, thanks.
Comment #21
codium commentedTested #11, complex entity (nested entity references), works smoothly
Comment #22
kalpaitch commentedVery nice indeed @keesje, works like a dream. I have a complex setup as well with paragraphs and file entities.
I have a few small updates to this patch because I'm a pedant:
!empty()check from the_drush_default_content_valid_module()function and made$modulea required param on the basis that it seems a bit frivolous to check whether a non-existent module is a valid module :)Comment #23
jfcolomer commented#22 Manually import working great, thanks!
Comment #24
andypostIt needs work, for translations and revisions
I see no profile involved...
I'd better export nothing if no modules passed, so where is a profile?
No need, just use new
PluralTranslatableMarkupnit, trailing writespace
better to check that entity supports this method, check core's
RevisionableInterfaceComment #25
andypostalso better split that patch because it does not what subject said
Comment #26
ao2 commentedHi,
it is worth noting that importing existing users (in particular the
adminuser) works only on the same site installation.For instance, this works:
However importing some previously exported content into a new site does not work, at least not when importing the
adminuser if any node references it.To reproduce, install using a profile without content, and then try to import some exported nodes authored by
admin:This is not specific to manual import tho, it happens also at install time if the profile provides the
content/dir, I am just mentioning the issue here to make people aware; see #2698425-4: Do not re-import existing entities and #2698425-19: Do not re-import existing entities for more details.Thanks,
Antonio
Comment #27
ao2 commentedBTW, the
cpcommand in the example above also suggest that some import command which accepts a--folderoption could make sense, for symmetry withdefault-content-export-references.Comment #28
larowlanFeels like we're moving beyond the realm of default content here, into the deploy realm.
I'm not keen to introduce additional complexity to support use-cases that are beyond the scope of the module.
Can you convince the maintainers that this is in fact for default content and not for deploying?
Comment #29
keesje commented@larowlan valid point!
Comment #30
claudiu.cristea@larowlan, but with config you can provide "default config" and then "config updates". Why shouldn't this be possible with content at least in a limited way? I know that content deploy and staging is a more complex issue (covered by https://www.drupal.org/project/deploy suite). Here what we want to achieve is when we have some default content installed with default_content, we want be able to pull changes from code.
EDIT:
Use case: A simple presentation site with 2-3 pages. I want to be able to change the About page locally and then push changes to production via Git.
Comment #31
ao2 commentedRegarding my own comments, my point was just that
default_contentshould be able to re-import (either manually or at install time) whatever has been previously exported.If it exports the
adminuser because it was referenced by some node, I'd expect it to be able to re-import it.My use case would be to share a baseline site (an installation profile with config and some default content) to make it easier to demonstrate bugs, or to create themes.
Comment #32
andypostPersonally I like to see issue with uid (0|1) fixed in separate in
#2698425: Do not re-import existing entities or #2815051: Skip exporting core users by default
Comment #33
larowlanOk, thanks - seems reasonable @claudiu.cristea
Agree with @andypost that the existing issues cover the pain points around admin user.
Comment #34
Algeron commentedIn case anyone else is having errors related to importing entity reference revisions, see #2848029: Prevent duplicate revisions by checking whether a host entity is already saved
Comment #35
andypostJust tested that on project, and discovered that domain_access module blocking loading nodes so this command require UID=1 switch and tests
called twice
trailing spaces
setOriginalId() already calls next line internally
there should be check for revisionable interface and somehow bc for core 8.3.x
I'd prefer that as separate patch #2698425: Do not re-import existing entities
Comment #36
kalpaitch commentedThanks Andy, could we clear up point 5 first. This ticket has a lot to do with #2698425: Do not reimport existing entities because the work for that ticket was originally done on this ticket. So as @vijaycs85 points out we either have to remove it from this ticket or combine the two together.
If we remove it, we have to block this ticket until that one is merged, so that we can correctly add the flag to the drush command. Also if we remove it I think it would be good to put your points 1-4 on that ticket and not this.
Happy either way, just trying to avoid blocking one ticket for too long.
Either way it would be good to have tests that cover the import. I guess this should really have been done previously so could either be covered by another ticket or by #2698425: Do not reimport existing entities.
Comment #37
kalpaitch commentedOh yea and in regards to tests, it might be quite good to convert them to PHPUnit tests before we get too far.Or at least write the new tests in PHPUnit.
Comment #38
kalpaitch commentedAs has been suggested by a few people, here is a patch that separates the other import issues. Of course this only provides drush commands now, so all comments on import bugs can be raised separately or on existing tickets https://www.drupal.org/node/2698425 and https://www.drupal.org/node/2815051
Comment #40
ao2 commentedThe patch does not apply cleanly anymore after commit 11fa54825b611dc280dd0621b090c2b53dea0f29
Comment #41
ao2 commentedI rebased the patch on the latest code.
A normal
interdiffbetween the two patches didn't work, but I am attaching a diff between the them, the changes since #38 are:run-asoption_drush_default_content_setup();and_drush_default_content_teardown();calls indrush_default_content_export_modulesanddrush_default_content_import_modulesComment #42
ao2 commentedComment #43
kalpaitch commentedAll looks super good. Reviewed and tested.
One thing, we should make this depend on #2698425: Do not reimport existing entities getting in. And then add the 'update' flag to all drush import commands.
Comment #44
getu-lar commentedI also successfully reviewed and tested this together with #2698425.
Comment #45
andypostI'd like to commit more complicated issue first #2614644: Split DefaultContentManager into Exporter and Importer
Comment #46
ao2 commentedIn the meantime I am hiding the patch from #41 (because of #2857589: Remove the run-as option in drush commands) and showing again the one from #38, which applies again on the latest 8.x-1.x branch.
Comment #47
larowlanYep, let's get the split in first, please help with rerolls and reviews over there
Comment #48
piggito commentedI generated a new patch for those like me who want a drush command to update the default content right now.
This patch adjusts the work in #38 to the changes in https://www.drupal.org/node/2698425#comment-12001085
and allows to update content using the option update_existing in "drush default-content-import-module" and "drush default-content-import-modules"
Comment #50
andypost#2614644: Split DefaultContentManager into Exporter and Importer
Comment #51
dawehnerNote: https://github.com/larowlan/default_content/pull/60 does something similar but instead moves most of the logic into the
Importerclass, so as such makes is much easier to test.Comment #52
kalpaitch commentedCool, I think it would be good to try to get this one in first as there are quite a few tickets that could use or extend this. As a result I've stripped out all the functionality not directly related to adding a manual import command. Will raise any separate issues as needed.
@piggito I'm with you on wanting the update flag in right now, but in the interests of keeping issues separate I haven't added to the re-roll as per #36.
@dawehner agreed, getting as much logic into the importer and exporter classes will allow other UIs to use in the future. Updated with the re-roll.
Comment #53
kalpaitch commentedNo interdiff on that last patch because it's a complete re-roll. Everything's moved.
Comment #54
dawehner@kalpaitch
Do you want to pull in my test coverage as well? I strongly believe this would be valueable here :)
Comment #55
kalpaitch commented@dawehner I think your dead right, but really these are just drush commands. If it's alright I've added this to #2868710: Add tests for Importer to improve the test coverage of this new Importservice...
Comment #56
dawehnerIt is a bit hard to see why we don't pull them from https://github.com/dawehner/default_content/blob/import-command/tests/sr... directly :)
Comment #57
dawehnerDocumentation no longer matches the signature.
We could inject the installation profile container parameter.
I added some documentation on top of it, to make it clear what this method tries to do. Yeah for using
array_reduce().That is a weird syntax for a list of entities. I used the other one which is already used in the same file.
Comment #58
larowlannit, whitespace issue
Otherwise, looking good - can be fixed on commit
Comment #59
andypost#58 could be fixed on commit, it conflicts with another patch #2698425: Do not re-import existing entities
Guess to commit that later
That may need another argument to pass after #2698425: Do not re-import existing entities
Comment #60
andypostComment #61
antonnaviReroll-ed
Comment #63
piggito commentedIt seems like the ImportIntegrationTest wasn't considering 2 nodes in default_conten_test and caused patch #61 to fail. I worked over patch #61 and fixed the test.
Comment #64
piggito commentedComment #65
andypostLooks good to me, imo we should get this in before #2698425: Do not re-import existing entities
Comment #66
larowlanthese lines are duplicated, please move them to a method such as
doImportTestsand call it in both placesComment #67
antonnaviPatch was updated: Duplicated code in test was moved to the separated method.
Comment #68
dawehnerNitpick: You could use
TermInterface[]here, but this is a super minor change to be honest.Comment #69
aless86 commented#67 works for me! When the patch could be applied?
Comment #70
kalpaitch commentedAwesome, looks good.
Comment #71
larowlanYep, this can go in before the next release
Comment #72
validoll commentedAdded Drush 9 support from https://www.drupal.org/project/default_content/issues/2912723
Comment #73
validoll commentedComment #74
validoll commentedForgot add 'extra' section to composer.json
Comment #75
5n00py commentedHi, everyone.
Does this patch supports re-import of entities ?
I have following error on `drush dcia`
Comment #76
eelkeblokThat would be #2698425: Do not re-import existing entities (I do believe it also supports updating existing entities, despite the title).
Comment #77
eelkeblokWould it make sense to commit this first as #67 and add the Drush 9 stuff in a separate issue?Sorry, disregard. Drush 9 support has been added to the existing drush commands, so it only makes sense to have newly added drush commands to support it too.Comment #78
timwoodPatch from #74 doesn't apply to -dev anymore. Anyone have time / knowledge to re-roll?
Comment #79
timwoodAfter a quick look I realized the changes to composer.json were previously committed in https://cgit.drupalcode.org/default_content/commit/?id=a3bc209 for issue https://www.drupal.org/node/2826455. Just that bit needed to be removed for the patch to apply cleanly.
I've made the patch from #72 the most current and hidden #74 as the only difference between the two was the extras section in composer.json.
Comment #80
timwoodWhen running the
drush dciacommand provided by this patch, if the default content user directory doesn't exist (perhaps because you are using the patch from https://www.drupal.org/project/default_content/issues/2815051), the following error occurs.If the directory exists and is empty, no such error occurs.
Comment #81
larowlanno new patch?
Comment #82
timwoodSorry, I'm unable to contribute a patch to help resolve the error I mentioned. I also realize that the functionality from the other issue (Skip exporting core users) doesn't seem to be working anyway as it keeps exporting the admin user.
Comment #83
das-peter commentedRe-rolled.
Comment #84
prineshazar commented+1, this would be extremely helpful for us who want to deploy content and manage them through updates.
Comment #85
yassersamman#83 working great.
Comment #86
larowlanNeeds work for the @module arg to PluralTranslatableMarkup
Should we have the arguments here for @module? Should @module be in the singular string too?
neat trick
unneeded?
same issue here with the @module
why do we need to support the null case?
nice
should we qualify this with 'from enabled modules and the active profile'?
Comment #87
neclimdul1 and 4 addressed. I mostly rerolled because I'd been annoyed by this for a while and was working on something related. Total is clearly copied from the other command so replaced with @module as well.
2. agreed
3. diff removed.
5. That very much looks like PhpStorm guessing something. I don't see a reason this method is different from the procedural version or a reason explicitly handling null would be needed. I just remove null from the doc.
7. probably. Changed to "Imports default content from all enabled modules and active profile."
Comment #88
neclimdulBah, I really messed that up. Description is right but I did my work on the wrong branch and got another patch mixed in. You'll notice the interdiff is mostly the same though.
Comment #90
jurgenhaasI have successfully tested #88 and it looks like we now need options for Drush to set
$update_existingto true, because there doesn't exist any code yet which changed that variable from FALSE to TRUE. Is that correct? If so, I'd be happy to provide a modified patch for that.Comment #91
neclimdulso #2698425: Do not re-import existing entities and this are kinda mucking about in the same place and conflict. That's were I messed up in #87 because I had been messing with merging the two patches and what that would look like. Which ever one goes in first will need to be updated to support the other and I have a patch locally that adds the drush options for update. Its pretty trivial but it doesn't make sense until one of the patches lands.
Comment #92
ao2 commentedJust nitpicking, sometimes the word "entity" is used instead of "entry":
I tested #88 and it works well for me when importing content the first time, so I'd say le't merge it and move forward.
The change is very useful even though it does not support all use cases yet.
Comment #93
jurgenhaasI have added to the patch from #88 the option
update-existingto the Drush 9 commanddefault-content:import-moduleComment #94
muldos commentedHi,
the patch in #93 wasn't applying anymore
line 11 in default_content.services.yml
is now injecting the account switcher services
so I've updated the patch to fix that.
Extra : Little summary about patches provided here
By the way, this patch (and previousely #93) only make sense if you also plan to use the patch of https://www.drupal.org/project/default_content/issues/2698425
this 2 issues (and their patches) are required if you want to be able to import content without having to uninstall / install a module and also if you want to avoid conflict when importing an already existing entity.
My patch and #93 allow to pass a flag (--update-existing) that is only used by the code provided in issues 2698425.
For the record you will have to choose which patch to apply automatically, and which one to apply manually, because the are incompatible.
Comment #95
ivnishIt implements in the https://www.drupal.org/project/default_content_deploy module
Comment #96
douggreen commentedThe command reports that nothing has been importing when something has.
I think that importContent() should
return $created + $updated;Comment #97
svetoslav.dragoev commentedHi,
the patch in #94 wasn't applying anymore
line 11 in default_content.services.yml
arguments: arguments: ['@serializer', '@entity_type.manager', '@entity.repository', '@hal.link_manager', '@event_dispatcher', '@module_handler', '@info_parser', '%default_content.link_domain%', '@account_switcher']
is now injecting the file system services
arguments: arguments: ['@serializer', '@entity_type.manager', '@entity.repository', '@hal.link_manager', '@event_dispatcher', '@module_handler', '@info_parser', '%default_content.link_domain%', '@account_switcher', '@file_system']
so I've updated the patch to fix that.
Comment #98
svetoslav.dragoev commentedAnd another re-roll of 2640734-94.default_content.Allow-manual-imports.patch if you have applied "Do not reimport existing entities": "https://www.drupal.org/files/issues/2020-02-05/2698425--accept-content-u..." already.
Comment #99
eelkeblokSince, as I understood from another issue, the 1.x version is not going to get any new features (great fan of the yml-approach of 2.x, btw), I suppose this will need retargeting to 2.x as well.
Comment #102
bgilhome commentedHere's a patch from the branch in the MR against 2.0.x, in case anyone wants to test without having to checkout the branch.
Comment #103
phjou@bgihome You can have the patch when someone is doing a merge request:
https://git.drupalcode.org/project/default_content/-/merge_requests/1.patch
Comment #104
flyke commentedI can apply patch #102 on default_content 2.0.x-dev.
But if I execute the command on my exported nodes, like this:
drush default-content:import-module my_custom_moduleThen I get this error:
For me all import problems are fixed by using these patches:
Comment #105
siegristReroll. Can someone check if this patch still does what it was intended to? There were apparently a lot of changes lately. Thanks.
Comment #106
Fonteijne commenteddrush dcim custom_modulestill overwrites existing content.It has the same result as
drush dcim custom_module --update-existingThe importContent() (Importer.php:152) does not allow the options argument given in contentImportModule() (DefaultContentCommands.php:140).
Therefore the flag 'update-existing' doesn't do anything. Even when documentation states otherwise.
Unfortunately the content is currently always being overwritten.
Comment #109
rowrowrowrow commentedThis adds support for the '--update-existing' flag to be used with the 'import all' and 'import module' commands. It will now force update all existing entities with exported values. If you don't use that flag it will only import new entities.
I noticed some code for exporting/importing json and wasn't sure if we care about that now. I'm not sure if that should be removed or not.
Comment #110
rowrowrowrow commentedUsing filter_var for better user experience while flag handling. I.e. you can pass '--update-existing=false' and expect it not to update existing entities. In the previous version only something like omitting or '--update-existing=0' would work.
Comment #111
xurizaemonHi @rowrowrow. Can I check if it was intentional to introduce changes from #2698425: Do not re-import existing entities to this MR in #108? This patch no longer applies for us as a result.
FYI (you may be aware of this), you can combine patches in cweagans/composer-patches, eg:
"drupal/default_content": { "#2698425: Do not reimport existing entities": "https://git.drupalcode.org/project/default_content/-/merge_requests/14.diff", "#2640734: Allow manual imports": "https://git.drupalcode.org/project/default_content/-/merge_requests/1.diff" },However, the above no longer applies, and a user referring to MR1 would now have some or all of the changes from #2698425: Do not re-import existing entities / MR14 also. It does become complicated to handle multiple patches to a project. Currently MR1 here is unclear to me, and I'd propose that we either clarify that or revert those changes and rework so they can apply cleanly (one MR per issue, one issue per MR).
That said, I'm not the maintainer, just a fellow contributor - so what I say isn't the rules ;)
(Caveat: It's not recommended practice to refer to MR URLs for composer patches, as they are subject to breakage via changes. That's a separate discussion!)
Comment #112
rowrowrowrow commentedHey @xurizaemon, yes it was intentional. I found that I wasn't able to apply the patch from https://www.drupal.org/project/default_content/issues/2698425 cleanly after making some necessary changes and some of the logic from that patch was required to get the update-existing flags working. I was also using both this patch and the other but am able to solely use this one for both purposes.
To me there is clearly an overlap between the two issues as being able to stop the update of existing entities is a prerequisite for enabling/disabling them using something like an update-existing flag. Hopefully that makes sense and I hope I'm not messing things up here too much. If we need to undo stuff let me know and I'm happy to help.
Also, @here I think we should add a flag for updating entities only if their data differs, i.e. to avoid the consequences of saving an unchanged entity like caching etc... I had some thoughts about how to do it but I think that should be a separate ticket.
Comment #113
xurizaemonOK. Thanks for the quick reply @rowrowrowrow!
If it makes sense for the issues need to be combined then no objection from me, with the request that this be communicated / coordinated between the affected issues. The impact for us was that an automated dev build tracking both of those MR URLs started to fail because when 83fe76a5 appears in both patches, the patch process fails, breaking the build. Fixed now, no hard feelings, just wanted to clarify the plan here :)
Looking back - I don't recall what the purpose of the MR opened in #107 was - maybe a reroll of current patches, I'm not sure the MR added anything at all. It's likely the intent there was to generate a patch URL which applied to current 2.0.x, or something like that.
Anyway - attached is a version of the patch which I believe corresponds to !1 before that latest set of changes - this is just in case someone else finds themself in the same boat and winds up here looking for a patch to use.
Please note: the attached patch does not include any changes beyond #107 and is not a proposed update to the WIP in the MR.
Cheers
Comment #114
barig commentedHi everyone !
Thanks for this great patch, hope it'll be merged soon in the module ! (and thanks of course for this great module ;-) ).
I rerolled the patch against 2.0.0-alpha1 version just to fix some deprecations and an error displayed when calling "drush dcim":
I wanted to roll the patch against dev version of the module but it doesn't work so I kept with the 2.0.0-alpha1 release.
Thanks again !
Best regards,
Bastien
Comment #115
DonAtt commentedUsing the patch in #114 I had an error while running
drush dcia --update-existing:[warning] Undefined variable $update_existing Importer.php:292The reason is that the closure in
importAllContent()does not inherit$update_existingfrom the parent scope.Fix in line 291:
Attached the fixed patch.
Comment #116
alorencThanks, patch from #115 works for me
Comment #117
claudiu.cristeaThis is a new feature so I wouldn't provide support for Drush 8.
I think we should avoid any confusion and merge the 2 commands in a single one,
default-content:import. This command will take as argument an *optional* list of modules (space delimited). When the list is passed will limit the import to the list. When no argument is passed, will import from all installed modules.I don't think that makes sense to add this method (why not a 3rd one,
importMultiple()?). No, I think we should have this logic inside the Drush command.The param comment seem to be off
Comment #119
claudiu.cristeaWorking on this.
Comment #120
claudiu.cristeaMore remarks
So, we're exporting twice?
I think we should throw an exception instead
Comment #121
claudiu.cristeaMore remarks (2):
It's OK that we want to preserve the current import behavior when the new argument (
$update_existing) is not passed. Indeed, it honors the backwards However, the Drush command default should be reverted. The scope of this new feature is to update existing content. We can use a logical--update/--no-updateoption.Comment #122
claudiu.cristeaFixed most of the remarks. However, this needs tests.
Comment #123
claudiu.cristeaReady for review.
Comment #125
dimilias commentedUpdated MR 20 to resolve a conflict with the latest 2.x.
Does what it says though I did not look for edge cases. +1 RTBC.
Comment #126
berdirComment #127
xurizaemonAttaching a copy of the MR20 patch as at e164a354 (comment 124). No changes introduced here and not directing effort back to .patch uploads, just making a static patch available for builds which isn't a mutable MR patch URL.
Comment #128
xurizaemon(apologies for the update noise, .diff this time)
Comment #129
calebtr commentedUpdating to 'needs review'.
Comment #131
pfrenssenThis still needs work, most of the remarks from @Berdir in the MR still need to be resolved.
Comment #132
pfrenssenI am working on removing the changes that were out of scope of this issue and in scope of #2698425: Do not re-import existing entities. However that breaks the tests here. We are getting integrity constraint violations on existing content (which is the exact problem that is being solved in #2698425: Do not re-import existing entities).
So this indicates that that #2698425: Do not re-import existing entities is a hard blocker for this issue.
I propose to do the following:
Comment #134
pfrenssenPostponed on #2698425: Do not re-import existing entities.
Comment #135
neclimdulYeah it always kinda has been. LOL I'd been maintaining a combined patch for a project for that reason.
Because its a bit hard to test #2698425: Do not re-import existing entities without this here's a patch rerolling !24 over the merge request from the other issue.
Comment #136
neclimdulThe interface doesn't document it (which is its own bug of sorts) but Importer::importContent can throw exceptions. This triggers confusing fatal errors from Drush so it would be best to handle them in the command.
Also "No, I think we should have this logic inside the Drush command. " but the importAllContent command was removed entirely. I haven't added it here but seems like it was probably a useful command.
Also also, unrelated but the decode calls in importContent can throw exceptions which should be caught and re-thrown as something useful. To see this in action try putting your yaml export in a .json file and see the parse error crash things. Not that anyone would ever do that by accident...
Comment #137
pfrenssenI'm thinking to be on the safe side we should default the overwriting of existing content to
FALSEso it is safer by default. If people do want to overwrite existing content they'll have to manually add the--updateoption.Comment #138
eelkeblokI updated !24 with the latest commits from #2698425: Do not re-import existing entities and changed the default to FALSE.
Comment #139
eelkeblokWhen the extension list is left empty, the dcim command in the latest MR will import content from all installed extensions, so I think that is what the import all used to do, right?
Comment #141
pfrenssenComment #142
bladeduWe tested the MR 24 and it works perfectly. We noticed, though, that if a dependency file miss Default content simply ignore them, because the method Graph::searchAndSort from core doesn't add them to the array list returned and sorted.
The only trace of them is found in `vertexes`
We'd like to propose a small, but very useful, patch that adds a log warning when some dependencies are missing.
Comment #143
delacosta456 commentedhi
i am trying to aplly the MR24 on D10.2 with php 8.2 without success can somebody help with this
Thanks
Comment #145
vselivanovHi!
I updated MR 24 with the latest code from 2.0.x: 542125c commit Issue #3428127 by deepakkm, ankitv18, Berdir: Automated Drupal 11 compatibility fixes for default_content
Comment #148
eelkeblok