Skip to content

Migrate WP Serveur hosting compatibility into ThirdParty (part of #8768) - #8778

Open
remyperona wants to merge 1 commit into
developfrom
enhancement/8768-wpserveur
Open

Migrate WP Serveur hosting compatibility into ThirdParty (part of #8768)#8778
remyperona wants to merge 1 commit into
developfrom
enhancement/8768-wpserveur

Conversation

@remyperona

Copy link
Copy Markdown
Contributor

🤖 AI-generated — created by an automated pipeline. Review before acting on this.

Part of #8768

Description

Migrate the WP Serveur hosting-compatibility file (inc/3rd-party/hosting/wp-serveur.php) into the WP_Rocket\ThirdParty\Hostings service-provider architecture, as one of six per-host PRs splitting #8768 for easier review and testing. WP Serveur is detected through HostResolverHostSubscriberFactory (single-match), so its code is instantiated only when the host matches. Runtime behavior is preserved exactly.

Type of change

  • New feature (non-breaking change which adds functionality).
  • Bug fix (non-breaking change which fixes an issue).
  • Enhancement (non-breaking change which improves an existing functionality).
  • Breaking change (fix or feature that would cause existing functionality to not work as before).
  • Sub-task of Migrate hosting compatibility files into ThirdParty service provider #8768
  • Chore
  • Release

Detailed scenario

What / Why

WpServeur becomes a Subscriber_Interface class detected by HostResolver::get_host_service() via DB_HOST containing .wpserveur.net (read through the mockable rocket_get_constant()), and built by HostSubscriberFactory. The procedural require is replaced by container registration.

What was tested

Hostings unit group passes in the wp-env container (composer test-unit -- --group Hostings). Detection, factory case, and subscriber methods are covered by unit tests.

How to test

  • On a WP Serveur site (DB_HOST ends in .wpserveur.net), confirm the WpServeur subscriber is instantiated and its Varnish/mandatory-cookie hooks fire as before.
  • On any other site, confirm it is not instantiated and no wp-serveur require remains in inc/3rd-party/3rd-party.php.

Affected Features & Quality Assurance Scope

  • Hosting compatibility (inc/ThirdParty/Hostings/), HostResolver, HostSubscriberFactory, inc/3rd-party/3rd-party.php.
  • WP Serveur Varnish auto-purge and mandatory-cookie handling.

Technical description

Documentation

New inc/ThirdParty/Hostings/WpServeur.php; a wpserveur branch in HostResolver::get_host_service() (via rocket_get_constant('DB_HOST')); a wpserveur case in HostSubscriberFactory; the wp-serveur require removed and the legacy file deleted. Detection/factory unit tests extended.

New dependencies

None.

Risks

Low — mechanical port mirroring the existing hosts; behavior unchanged and covered by unit tests.

Mandatory Checklist

Code validation

  • I validated all the Acceptance Criteria. If possible, provide screenshots or videos.
  • I triggered all changed lines of code at least once without new errors/warnings/notices.
  • I implemented built-in tests to cover the new/changed code.

Code style

  • I wrote a self-explanatory code about what it does.
  • I protected entry points against unexpected inputs.
  • I did not introduce unnecessary complexity.
  • Output messages (errors, notices, logs) are explicit enough for users to understand the issue and are actionnable.

Unticked items justification

Covered by the Hostings unit suite (run in the wp-env container) plus PHPStan and PHPCS; behavior parity verified against the deleted procedural file.

Additional Checks

  • In the case of complex code, I wrote comments to explain it.
  • When possible, I prepared ways to observe the implemented system (logs, data, etc.).
  • I added error handling logic when using functions that could throw errors (HTTP/API request, filesystem, etc.)

Port inc/3rd-party/hosting/wp-serveur.php into a container-registered
WP_Rocket\ThirdParty\Hostings\WpServeur subscriber, detected via
HostResolver (DB_HOST contains .wpserveur.net, read through the mockable
rocket_get_constant()) and built by HostSubscriberFactory — same hooks,
priorities and callbacks. Removes the wp-serveur require from
inc/3rd-party/3rd-party.php and the legacy file. Adds detection, factory,
and subscriber unit coverage.

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>
@codacy-production

codacy-production Bot commented Aug 28, 2026

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 0 complexity

Metric Results
Complexity 0

View in Codacy

🟢 Coverage 100.00% diff coverage

Metric Results
Coverage variation Report missing for 9bdce291
Diff coverage 100.00% diff coverage (50.00%)

View coverage diff in Codacy

Coverage variation details
Coverable lines Covered lines Coverage
Common ancestor commit (9bdce29) Report Missing Report Missing Report Missing
Head commit (5231daf) 47689 22479 47.14%

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 (#8778) 17 17 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant