Problem/Motivation
Block settings need config schema. Sitemap's blocks don't have any defined. :)
In reviewing this issue, we discovered that the cache and max_age configuration for the SitemapSyndicateBlock have never been used, meaning we can safely delete them while keeping backwards compatibility.
(note that we also discovered that the rss_front config item needs some work, but that has been split into #3545858: Migrate sitemap.settings.rss_front to SitemapSyndicateBlock's configuration; test, deprecate SitemapSyndicateBlock)
Proposed resolution
Write a patch to remove the cache and max_age configurations. Add an update hook to delete the cache and max_age configurations from sites that have them.
If possible, it would be great to add tests (we have some existing update tests in tests/src/Functional/Update/ and some fixtures in tests/fixtures/update/ ), but @mparker17 (a maintainer) isn't sure how easy that would be.
Remaining tasks
Write a merge request- done by @phenaproxima in #2Write a test for the change?- deferred to #3557990: Add tests for remove_cache_setting_from_syndicate_blocks post-update hookReview and feedback- done by @mparker17 in #4RTBC and feedback- done by @phenaproxima in #14Commit- done by @mparker17 in #17Release- released by @mparker17 in sitemap-8.x-2.5
User interface changes
None.
API changes
None.
Data model changes
None.
Issue fork sitemap-3545794
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 #3
phenaproximaComment #4
mparker17Thank you! I had no idea this configuration even existed! 😅
Looking at
\Drupal\sitemap\Plugin\Block\SitemapSyndicateBlock, I see several bugs...$this->configFactory->get('sitemap.settings')->get('rss_front');but no mention of that key inconfig/schema/sitemap.schema.yml... but I daresay these belong in follow-up issues because using-previously-unused config and/or adding a settings form for config and/or figuring out what
rss_frontis supposed to be sound like larger discussions. Thoughts, @phenaproxima?Comment #5
phenaproximaHmmm...if those things aren't used anywhere, then they should probably be removed instead of codified in config schema! That'd need an update path, I'm betting.
Comment #6
mparker17@phenaproxima are you working on a patch, or would you like me to try? (just want to avoid duplicating our efforts)
Comment #7
mparker17Looking at the history of the
rss_frontconfiguration...The
rss_frontconfiguration item used to control two things: the href for this RSS icon on the Syndicate (sitemap) block, and feed URL on what would become thefrontpageplugin (i.e.:\Drupal\sitemap\Plugin\Sitemap\Frontpage).A separate setting for the
frontpageplugin was established in commit 52ab0d4 from 2017-03-22.The
rss_frontcontrol on the settings page was removed shortly thereafter in commit commit b35b30f from 2017-03-22.While I doubt anyone actually uses this Syndicate block (I don't understand what it's supposed to do — seems like it exists only to output an RSS icon that links to the RSS feed?), I also feel like deleting it would be a backwards-compatibility break / regression, so I think I should just fix it and mark it deprecated so we can (hopefully) delete in a future 3.0.x version.
I've created #3545858: Migrate sitemap.settings.rss_front to SitemapSyndicateBlock's configuration; test, deprecate SitemapSyndicateBlock to capture the work identified in this comment.
Comment #8
mparker17Looking at the history of the
cacheandmax_ageconfiguration...Looks like it came from the
site_map-8.x-1.x-devproject, i.e. added to sitemap in commit 65d9a44 from 2015-11-08.Switching over to the site_map repo, it looks like
cacheandmax_agewere introduced in #2366683: Update site_map to work with 8.0.x branch. As far as I can tell, that issue sought to reconcile the code already in the 8.x-1.x branch with the code in the 7.x-1.x branch. At this point, the 7.x-1.x branch had a$blocks['syndicate']['cache'] = DRUPAL_NO_CACHEline inhook_block_info()from #1098918: Fix block caching & theming; while the Syndicate block's plugin class in the 8.x-1.x branch had a'cache' => DRUPAL_NO_CACHEdefault configuration (from the initial D8 port in #2139181: Drupal 8 version) but it was never used anywhere. I guess making it configurable was better than making it never-cacheable but it seems that the setting may have been a relic that never properly took advantage of D8+'s [dynamic_]page_cache features.Regardless, it looks like the
cacheandmax_ageconfiguration never did anything in D8 at any point, so I think we can delete it (safely, with an update hook) without breaking backwards compatibility.Comment #9
mparker17Adding tags to reflect what needs to be done.
In particular, I should update the issue summary so we know what is/is-not in scope. But I'm going to do that tomorrow.
Comment #10
mparker17Updating the issue summary.
Comment #11
mparker17Updating the issue title to reflect the new scope.
Thanks for your hard work, @phenaproxima!
Comment #12
mparker17@phenaproxima are you still working on this?
I've got something working and tested in #3545858: Migrate sitemap.settings.rss_front to SitemapSyndicateBlock's configuration; test, deprecate SitemapSyndicateBlock — which will likely conflict with some of your changes here, although with relatively trivial resolutions...
sitemap.post_update.phpbut create two different hooks with different names - both functions should exist in the final versiondefaultConfiguration()function insrc/Plugin/Block/SitemapSyndicateBlock.php. - this branch should continue deleting the cache key and friends; the other branch should continue creating therss_feed_pathkey.I'm happy to merge this one first and then fix the merge conflicts in the other branch if that's easiest for you, so I'm going to hold off on merging 3545858 until I hear back from you!.
Thanks!
Comment #13
mparker17@phenaproxima, if you could review and/or RTBC this, that would be great. Thank you!
Comment #14
phenaproximaLooks legit to me! We could add tests in a follow-up.
Comment #15
mparker17@phenaproxima, okay!
I've added #3557990: Add tests for remove_cache_setting_from_syndicate_blocks post-update hook as a follow-up issue, so I'm deleting the "Needs tests" tag.
I also added a post-update hook between #12 and #13 so I'm removing the "Needs update path" tag.
I will merge this shortly.
@phenaproxima I'm feeling very tired today, so I'm not going to make a release today, but if you need a release soon, I'll look into making one in the coming days.
Comment #16
phenaproximaNo worries, @mparker17. This is a Drupal CMS stable release blocker, but I have a workaround in place in our helper module so it's not an immediate emergency. Thanks for your incredibly responsive and responsible maintainership!
Comment #18
mparker17Comment #20
mparker17This fix has been released in sitemap-8.x-2.5.
Comment #21
mparker17(typo in issue summary)