Closed (won't fix)
Project:
Default Content
Version:
8.x-1.0-alpha7
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
22 Mar 2019 at 21:46 UTC
Updated:
9 Sep 2019 at 14:07 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
justin2pin commentedPatch attached. This builds from some of the work at #2698425: Do not re-import existing entities (specifically https://www.drupal.org/files/issues/2018-12-11/default_content-dont-reim...).
IMPORTANT: Following the steps below, if successful, WILL OVERWRITE / UPDATE / REPLACE the content on your website with the content from your custom default_content module.
Also: using this patch in conjunction with exporting user 1 or user 0 will cause problems. I recommend installing default_content_extra to remove export files for user 0 and user 1. If using Drush 9, see this issue as well: https://www.drupal.org/project/default_content_extra/issues/3042486
To test:
- Apply attached patch.
- Critical: Change the new setting with drush:
drush cset default_content.settings update 1- You will be prompted to create a new config object for default_content.settings - enter "y".
- Make a change to your exported content (for example, modify the title)
- Uninstall then reinstall your custom default_content module.
- Content on your website should now be updated by the content from your export.
And finally... It looks like this is the direction the module maintainers may have already been going? The changes in patch 2698425-109 make it incredibly simple to add "update" support. Interdiff is attached – all that was necessary was adding the new setting and making one small code change.
Comment #3
justin2pin commentedComment #4
justin2pin commentedAttaching interdiff.
Comment #6
itamair commentedHi ... thanks @justin2pin for this nice attempt,
BUT there are some issues on this.
First of all (light matter) the interdiff shouldn’t be named that way. It shouldn't be a .patch file (as it is not) but a .txt one
(@see the related documentation: https://www.drupal.org/documentation/git/interdiff)
Second, more important, the patch is not applying cleanly.
My
git apply default_content-allow_update-3042504-2_0.patchanswers with the following error/warning:Comment #7
justin2pin commentedThanks @itamair - sure enough, that patch failed for me too. Here's a revised version that should work.
Couple things to note:
For me, git throws whitespace warnings that appear to be left over from this patch:
https://www.drupal.org/files/issues/2018-12-11/default_content-dont-reim...
Also, since issue #2698425: Do not re-import existing entities is still being worked on I do not expect my latest patch to be a permanent solution. But, for folks already using patch 2698425-109 and wishing they could use default_content to update content, this might be helpful.
Regardless, if others like this feature it will need to be revisited and updated after issue #2698425: Do not re-import existing entities is fixed.
Comment #9
itamair commentedOk. Let's make all this more clear with a new correct patch that cleanly applies into the 8.x-1.0-alpha7 branch and that does the following:
- stays over and includes the enhancements of the following issue: Do not reimport existing entities, applying the changes of the #109 patch, but removing the incorrect creation of the default_content-dont-reimport-existing-entities-2698425-102.patch file (it is affected by);
- applies the specific enhancements of this specific issue, already described by @justin2pin in the comment #2
Comment #10
itamair commentedComment #12
itamair commentedfor sake of completeness, this issue patch is mentioned into its parent one here
Comment #13
larowlanThanks for your work here folks, this request has come up before and for a number of reasons we've decided this is outside the scope we want from the module.
The main reason is conflict resolution, we want this module to remain focused on default content and leave content-staging to modules that are designed for that such as
- deploy
- entity_pilot
- so on
Happy if you want to keep patches re-rolled here if you have to apply them for your particular project.
I realise a hard 'no' isn't always the desired response, but we're very much on the same page as the sentiment in this post https://wimleers.com/article/simplicity-maintainability-cdn-module-drupal-8
Comment #14
itamair commentedmah! ... strange. This feature has mainly been introduced to just "update" default content on existing deploys, without having to remove it and re-inject ...
Of course wouldn't aim to compete with "deploy" module.
In our workflow it is working so well with the few enhancements of this issue that should definitely (IMO) be introduced into the module dev branch, & without (the need of) enabling workspaces scenarios (& overhead).
Mostly I don't understand why I should be stopped here and be invited (I would say even forced ...) towards the entity_pilot (only alternative), that seems even not relying on open-source logic (this is commercial! ...).
Not the best example of opensource collaboration.
IMO, a Drupal project/module maintainer (and even creator) shouldn't act as owner of it, but (well ...) just as a maintainer of it.
Still relying on "collaboration over competition", different approaches to similar tasks should be respected, if not even encouraged.
And the community needs should be satisfied (when possible), and not clipped.
But this is just just a thought of mine (that I try to put in practice on the few modules I maintain).
Ok, thanks .. at least will be able to rely on this issue patches for our simple&straight default_content staging workflow.
Comment #15
OnkelTem commentedSimplicity? You mean as in: "too simple to be useful"?
Let's imagine some perfect workflow.
So you prepare an entity, export it, commit to the repository and then your teammate checks it out, yes? No. It doesn't work. If your teammate has an entity with the same *ID* (not UUID!) then the import process breaks on error. Done.
I just don't get: what was the idea behind exporting by UUID and then fallback to the local IDs during import, and that - in another database which by definition doesn't share the same ID poll?
Comment #16
manuel garcia commentedAdding the issue which seems to be the way forward with this as far as I can see.
Comment #17
coderbrandon commented@larowlan I would like to politely disagree with your choice of closing this out as won't fix. There is definitely a use case where importing and re-importing default content multiple times makes sense. One example is during the QA process where we want a clean known slate to do QA against but still allow the QA team to alter/edit content as needed. Another example is when a staging site has begun adding non-scripted content (and thus we can't clear the whole environment) but we need to update some of the previously created default content in a scripted approach.
To be clear, I don't think this module should become something that supports fully featured content staging where content is moved from one environment to another. Instead we should focus on doing "content setup" where we implement features that help with the initial site creation workflow.
Comment #18
manuel.adanI agree with @CoderBrandon and the rest of the people that think this feature is a required one. IMHO, we are not discussing about an extra feature, it is comparable to the reverse gear on a car. My situation:
At the end, I did something similar to what the Umami default content module does, create and process content programmatically on install. For a few nodes, it brings simplicity and full control, avoiding to have enabled the default_content module in production environment, that does not pretty much after the initial deployment.
Comment #19
itamair commentedI further underline/stress that this feature (and related #9 patch) is super useful in updating remote default content, and seems to work very well so far to us ... Definitely a must add-on to this module.
Comment #20
itamair commented