I think it would be good to move out frequently changing non static elements from configuration to another storage space. I am thinking about items like max_filesize, updated stamp, links, and context from an xmlsitemap instance. These are constantly changing values (perhaps) and configuration synch will reset them to incorrect values.
Is this a direction you'd like to move forward with?
Background: We export our configuration to a known good configuration for production deployment. We will then bring production db down and run configuration imports locally for feature development ultimately resulting in configuration export as a feature branch is complete and ready to be merged into our production branch.
There are several xmlsitemap configuration entities that are exported. That is known good configuration and we like that. We also export our xmlsitemap instance. Because the instance config is always being updated by new nodes it will always overwrite good data with old data which is not desirable behavior.
| Comment | File | Size | Author |
|---|---|---|---|
| #8 | consider_moving-2767647-8.patch | 4.44 KB | plopesc |
| #8 | interdiff.txt | 730 bytes | plopesc |
| #4 | Selection_001.jpg | 293.33 KB | juampynr |
Comments
Comment #2
sam152 commentedYep, the state API was design for this. For our workflow, these will be reverted every time we deploy.
Comment #3
hctomThis should defininetely be saved in the state API as it breaks config deployment workflows because you'd deploy wrong config data. Unfortunately this is baked into the xmlsitemap config entity. Are there any reasons for this?
Comment #4
juampynr commentedHere is what we currently have in the XmlSitemap entity:
Here are a few questions:
Comment #5
sam152 commentedI think it should remain a config object, I'm guessing a lot of other parts of the module rely on it and semantically it makes sense, it's an item of configuration created by admins. The only things which should move to states API are the things which change when the sitemap is regenerated on each environment. The ones I can spot are:
As far as how they are related? Each sitemap has an ID, why not store them in states API keyed by a combination of the module name and the ID of the sitemap.
Comment #6
plopescHello
We are having this issue in our current project and proposing here a fix for this. Here is a brief description:
XmlSitemapentity definition (chunks, links, max_filesize, updated)XmlSitemapStorageservice to manage theXmlSitemapentity operationsXmlSitemapentity to store the environment-dependent dataXmlSitemapentityNow, the environment-dependetn data is not being exported, but it is being loaded and stored transparently to end users.
Regards
Comment #7
hctomI just found some time to have a quick look at the provided patch (just checking the patch contents - did not apply it yet), and I guess this is in there by accident, right?
Comment #8
plopescThanks @hctom
I completely forgot to remove that line of debugging code.
Attaching now the updated patch and the related interdiff
Comment #9
freelockWas just hitting this issue -- We check the config of all production sites nightly, and XMLSitemap is triggering a change every night...
I was thinking of suggesting exactly what you're proposing with this patch -- move the frequently changed things into the State API.
Will apply and see if it works correctly and addresses our needs...
Comment #10
Anonymous (not verified) commentedWorks perfectly. I've tested against latest commit.
If no upgrade path is required (the module is still in alpha), I would say that this patch is RTBC.
Comment #11
Anonymous (not verified) commentedComment #12
freelockConfirmed working for me, too!
Comment #14
juampynr commentedCommitted. Thanks everyone!
Comment #16
dalinFWIW, this issue still exists if you try to use
https://www.drupal.org/project/config_readonly
But we can't quite figure out which config variable is still being written to.
Our workaround was to add the configuration name
xmlsitemap.xmlsitemap.*into the config readonly whitelist in thesettings.php.