Migrate Presslabs hosting compatibility into ThirdParty (part of #8768) - #8780
Migrate Presslabs hosting compatibility into ThirdParty (part of #8768)#8780remyperona wants to merge 1 commit into
Conversation
Port inc/3rd-party/hosting/presslabs.php into a container-registered WP_Rocket\ThirdParty\Hostings\Presslabs subscriber, detected via HostResolver (PL_INSTANCE_REF + \Presslabs\Cache\CacheHandler + advanced-cache.php present) and built by HostSubscriberFactory. The constructor keeps the (idempotent) require_once of advanced-cache.php. Also fixes the long-standing clean_home() bug (it guarded on undefined $post/$permalink instead of its $root/$lang parameters and so never purged the homepage). Regression test asserts the corrected behavior. Part of #8768. One of six per-host PRs splitting the hosting-compat migration for easier review and testing. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Up to standards ✅🟢 Issues
|
| Category | Results |
|---|---|
| UnusedCode | 1 medium |
🟢 Metrics 11 complexity
Metric Results Complexity 11
🟢 Coverage 100.00% diff coverage
Metric Results Coverage variation Report missing for 9bdce291 Diff coverage ✅ 100.00% diff coverage (50.00%) Coverage variation details
Coverable lines Covered lines Coverage Common ancestor commit (9bdce29) Report Missing Report Missing Report Missing Head commit (38cadfe) 47687 22504 47.19% Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch:
<coverage of head commit> - <coverage of common ancestor commit>Diff coverage details
Coverable lines Covered lines Diff coverage Pull request (#8780) 42 42 100.00% Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified:
<covered lines added or modified>/<coverable lines added or modified> * 100%1 Codacy didn't receive coverage data for the commit, or there was an error processing the received data. Check your integration for errors and validate that your coverage setup is correct.
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
Part of #8768
Description
Migrate the Presslabs hosting-compatibility file (
inc/3rd-party/hosting/presslabs.php) into theWP_Rocket\ThirdParty\Hostingsservice-provider architecture, as one of six per-host PRs splitting #8768 for easier review and testing. Detected throughHostResolver→HostSubscriberFactory(single-match). Also fixes a long-standingclean_home()bug.Type of change
Detailed scenario
What / Why
Presslabsbecomes aSubscriber_Interfaceclass detected viadefined('PL_INSTANCE_REF')+class_exists('\Presslabs\Cache\CacheHandler')+advanced-cache.phppresent. The constructor keeps the idempotentrequire_once advanced-cache.php(safe: the class is already loaded per the detection guard). Theclean_home()dead-guard bug is fixed so the homepage is actually purged.What was tested
Hostings unit group passes in the wp-env container (
composer test-unit -- --group Hostings), including the correctedclean_home()regression test.How to test
after_rocket_clean_homeand confirm the homepage URL is invalidated (previously a no-op).requireremains in3rd-party.php.Affected Features & Quality Assurance Scope
inc/ThirdParty/Hostings/),HostResolver,HostSubscriberFactory,inc/3rd-party/3rd-party.php.Technical description
Documentation
New
inc/ThirdParty/Hostings/Presslabs.php; apresslabsbranch inHostResolver; apresslabscase inHostSubscriberFactory; presslabsrequireremoved and legacy file deleted. Bug fix:clean_home()no longer guards on undefined$post/$permalink. Regression test updated to assert the homepage is invalidated.New dependencies
None.
Risks
Low–medium — a mechanical port plus one behavior-restoring bug fix, both covered by unit tests;
Presslabs.phpis ported from the validated combined branch.Mandatory Checklist
Code validation
Code style
Unticked items justification
Covered by the Hostings unit suite (run in the wp-env container) plus PHPStan and PHPCS; behavior parity (and the intentional clean_home fix) verified against the deleted procedural file.
Additional Checks