Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
I have 2 search engines defined in my site, and everytime I export my site configuration they are also exported.
The reason for it is because it is saving the last_submitted date at config file.
I think we should not let that export because this value doesn't look like a site configuration and makes developers always wonder if they changed something at search engines or not.
Steps to reproduce:
- Create a search engine at /admin/config/search/simplesitemap/engines
- Export site configuration
- Run Cron (this action should submit the search engines)
- Export site configuration again
Proposed resolution
Remove last_submitted flag from search engines.
Comment | File | Size | Author |
---|---|---|---|
#13 | simple_sitemap-move-config-to-state-3118519-13.patch | 13.41 KB | lolcode |
| |||
#10 | simple_sitemap-move-config-to-state-3118519-10.patch | 11.88 KB | lolcode |
| |||
#5 | 3118519-5.patch | 2.43 KB | Spokje |
Comments
Comment #2
gbyte CreditAttribution: gbyte as a volunteer and at gbyte commentedNot a bug, but the request makes sense - will look into it.
Comment #3
PCate CreditAttribution: PCate commentedThe State API is designed to store values such as these so they are not part of configuration.
Comment #4
gbyte CreditAttribution: gbyte as a volunteer and at gbyte commentedSure it is; I did not catch the problem when reviewing this submodule. This will require some data model changes though as right now the timestamp is saved as part of the entity data. Feel free to submit a patch to accelerate the process.
Comment #5
SpokjePatch attached that takes the quick (not too dirty?) road by _not_ exporting the `last_updated` field and using the already present State to fill the
last_update
field in thesimple_sitemap_engine
EntityComment #6
SpokjeComment #7
Diego_Mow CreditAttribution: Diego_Mow as a volunteer and at CI&T commentedWorked fine for me!
Comment #8
gbyte CreditAttribution: gbyte as a volunteer and at gbyte commentedComment #9
gbyte CreditAttribution: gbyte as a volunteer and at gbyte commented@Spokje
Thanks for the patch! The status table however will now show the global 'last submitted' date instead of the date the specific search engine was submitted and we have an unnecessary last_submitted field in the entity. I recon we should move the last_submitted data for each engine to state instead.
Comment #10
lolcode CreditAttribution: lolcode commentedI have attempted to move this forward. There are now individual state variables for each engine.
Comment #11
gbyte CreditAttribution: gbyte as a volunteer and at gbyte commented@lolcode Thank you, looks good, will be doing some testing soon and I will get back to you.
Comment #12
AndyF CreditAttribution: AndyF at Fabb for FRUITION commentedThanks @lolcode! Would be great to see this land; I'm really tight on time to actually test it out but I gave it a quick once-over, makes sense to me 👍
I think this should be 8101.
Is it worth setting the state variable before clearing the timestamp on the config entity?
State
instead ofStateInterface
Thanks again!
Comment #13
lolcode CreditAttribution: lolcode commentedRegarding your comments:
1. I think it should be 8301. Thanks I had copied from the older patch.
2. OK. Done.
3. Fixed.
Attaching an updated patch.
Comment #15
gbyte CreditAttribution: gbyte as a volunteer and at gbyte commentedThanks for your input and patience guys, this is now commited.
@lolcode I cleaned up a bit and removed the injected
$configFactory
in\Drupal\simple_sitemap_engines\Plugin\QueueWorker\SitemapSubmitter
and a few variables, as that bit of code was not used anywhere. I still put you down as author, so feel free to review and object.