Closes #6795 Clean LCP when site logo is changed#8080
Closes #6795 Clean LCP when site logo is changed#8080remyperona wants to merge 2 commits intodevelopfrom
Conversation
There was a problem hiding this comment.
Pull request overview
This PR addresses issue #6795 by implementing functionality to clean LCP (Largest Contentful Paint) data when the site logo is changed. The implementation hooks into WordPress's pre_set_theme_mod_custom_logo filter to detect logo changes and clears performance hints optimization tables accordingly.
Changes:
- Added a new method
clean_on_logo_changeto the PerformanceHints Admin Controller that truncates performance hints tables when the logo value changes - Registered the
pre_set_theme_mod_custom_logofilter hook in the PerformanceHints Admin Subscriber to trigger the cleanup - Added unit tests to verify the logo change detection and truncation behavior
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
| inc/Engine/Common/PerformanceHints/Admin/Controller.php | Added clean_on_logo_change method that compares new and old logo values and truncates tables if they differ |
| inc/Engine/Common/PerformanceHints/Admin/Subscriber.php | Registered pre_set_theme_mod_custom_logo filter hook and added subscriber method to delegate to controller |
| tests/Unit/inc/Engine/Common/PerformanceHints/Admin/Controller/CleanOnLogoChangeTest.php | Unit test verifying truncation is called only when logo value changes |
| tests/Fixtures/inc/Engine/Common/PerformanceHints/Admin/Controller/CleanOnLogoChangeTest.php | Test fixtures with scenarios for unchanged and changed logo values |
tests/Unit/inc/Engine/Common/PerformanceHints/Admin/Controller/CleanOnLogoChangeTest.php
Show resolved
Hide resolved
tests/Fixtures/inc/Engine/Common/PerformanceHints/Admin/Controller/CleanOnLogoChangeTest.php
Show resolved
Hide resolved
Coverage summary from CodacySee diff coverage on Codacy
Coverage variation details
Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: Diff coverage details
Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: See your quality gate settings Change summary preferencesFootnotes
|
Description
Fixes #6795
Type of change
Detailed scenario
What was tested
Changed the site logo in a theme using the block editor
How to test
Changing the site logo in the customizer or in the block editor should trigger a cleanup of the LCP raws in the database.
Affected Features & Quality Assurance Scope
Critical images on site logo change
Technical description
Documentation
This PR addresses issue #6795 by implementing functionality to clean LCP (Largest Contentful Paint) data when the site logo is changed. The implementation hooks into WordPress's
pre_set_theme_mod_custom_logofilter to detect logo changes and clears performance hints optimization tables accordingly.Changes:
clean_on_logo_changeto the PerformanceHints Admin Controller that truncates performance hints tables when the logo value changespre_set_theme_mod_custom_logofilter hook in the PerformanceHints Admin Subscriber to trigger the cleanupMandatory Checklist
Code validation
Code style