-
Notifications
You must be signed in to change notification settings - Fork 826
Sitemap Generation: Add Blog Stickers to Sitemap Generation functionality #45055
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: trunk
Are you sure you want to change the base?
Conversation
… stickers This update introduces two new filters in the Jetpack_Sitemap_Manager class: - `jetpack_sitemap_suspend_cache_addition` to control cache addition during sitemap generation. - `jetpack_sitemap_use_xmlwriter` to leverage XMLWriter when available, based on blog sticker status. Both filters enhance sitemap generation flexibility by allowing site-specific configurations.
Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.
Interested in more tips and information?
|
Thank you for your PR! When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:
This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖 Follow this PR Review Process:
If you have questions about anything, reach out in #jetpack-developers for guidance! Jetpack plugin: No scheduled milestone found for this plugin. If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack. Wpcomsh plugin:
If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack. |
Code Coverage SummaryCoverage changed in 1 file.
|
…Sitemap_Manager This commit introduces multiple test cases for the callback_filter_use_xmlwriter method, covering various scenarios including: - When has_blog_sticker returns true or false. - When wpcomsh_is_site_sticker_active returns true or false. - Cases where neither function exists. These tests ensure robust handling of XMLWriter usage based on blog sticker status, enhancing the reliability of sitemap generation.
This commit introduces a new file, class-sitemaps-sticker-handlers.php, which adds filters to control the suspension of cache addition and the use of XMLWriter for sitemaps based on active blog stickers. Additionally, tests for these new functionalities have been implemented to ensure proper behavior under various conditions, enhancing the flexibility and reliability of sitemap generation.
This commit updates the SitemapsStickerHandlersTest class to utilize mock functions for testing sticker functionality, replacing the previous Patchwork-based approach. A new mock file, sticker-functions.php, is introduced to define the mock functions `has_blog_sticker` and `wpcomsh_is_site_sticker_active`, allowing for better isolation and control during tests. The test cases are adjusted accordingly to ensure they validate the expected behavior of the sitemap generation based on sticker status.
…nager This commit introduces two new test cases to validate the behavior of the 'jetpack_sitemap_location' filter. The first test checks the default value of the filter, ensuring it is set to an empty string when no value is provided. The second test verifies that a custom filter can modify the sitemap location correctly. These additions enhance the test coverage for the sitemap functionality, ensuring expected behavior in various scenarios.
…-handlers.php with class-wpcomsh-sitemap-sticker-handlers.php. The new class centralizes sticker functionality for managing cache suspension and XMLWriter usage. Updated tests to reflect the new class structure and improved mock function handling for better test isolation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work!
Tests work as per instructions, code looks good.
Fixes HOG-332: Add Blog Sticker filters
Proposed changes:
Other information:
Jetpack product discussion
Test sitemap improvements
Does this pull request change what data or activity we track or use?
N/A
Testing instructions:
jp_sitemap_cron_hook
(e.g. through WP Crontrol)view-source:https://yourwebsite.wpcomstaging.com/sitemap.xml
Jetpack_Sitemap_Buffer_Master_XMLWriter
appears as the 3rd line comment. This confirms the blog sticker has been successfully applied