Skip to content

Conversation

@superdav42
Copy link
Collaborator

@superdav42 superdav42 commented Dec 10, 2025

Summary by CodeRabbit

  • New Features

    • Added Rocket.net integration supporting automated domain lifecycle management (creation and removal), automatic SSL/TLS support, and API connectivity validation.
  • Documentation

    • Added step-by-step configuration guide for setting up Rocket.net account integration with credential requirements and security best practices.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 10, 2025

Walkthrough

Introduces a new Rocket.net host provider integration that extends the base host provider class with full domain lifecycle management, API authentication, connectivity testing, and user-facing configuration and instruction views. The integration is initialized in the domain manager's load sequence.

Changes

Cohort / File(s) Summary
Rocket host provider implementation
inc/integrations/host-providers/class-rocket-host-provider.php
New Rocket_Host_Provider class with domain add/remove operations, API authentication via JWT token, domain ID lookups, connection testing, detection logic, form field configuration, and metadata (logo, description, instructions). Subdomain operations are no-ops due to wildcard SSL management.
Domain manager integration
inc/managers/class-domain-manager.php
Updated load_integrations() method to instantiate Rocket_Host_Provider during initialization.
User instructions view
views/wizards/host-integrations/rocket-instructions.php
New WordPress template rendering translated, step-by-step Rocket.net integration guidance including API credentials, site ID configuration, and security notes.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

  • API interaction logic: Token fetching with caching mechanism, domain ID lookups handling flexible response shapes, and authenticated request helpers require careful review for correctness and error handling.
  • Domain operation flows: on_add_domain and on_remove_domain methods with API calls and logging need verification against Rocket API specifications.
  • Token caching and error propagation: Ensure JWT token caching doesn't introduce stale token issues and that API failures are properly logged and handled.

Possibly related PRs

  • Add support for hestia panel #243: Adds a different host-provider integration with similar pattern of extending Base_Host_Provider and updating load_integrations() to register the new provider.

Poem

🐰 A Rocket soars through hosting skies,
With JWT and SSL ties,
Domains dance at command's behest,
Your multisite passes the test! 🚀

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Add rocket integration' directly and clearly describes the main change: introducing a new Rocket.net host provider integration for WP_Ultimo with full domain management support.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch rocket-integration

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions
Copy link

🔨 Build Complete - Ready for Testing!

📦 Download Build Artifact (Recommended)

Download the zip build, upload to WordPress and test:

🌐 Test in WordPress Playground (Very Experimental)

Click the link below to instantly test this PR in your browser - no installation needed!
Playground support for multisite is very limitied, hopefully it will get better in the future.

🚀 Launch in Playground

Login credentials: admin / password

@Multisite-Ultimate Multisite-Ultimate deleted a comment from github-actions bot Dec 10, 2025
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (4)
views/wizards/host-integrations/rocket-instructions.php (1)

1-118: Rocket instructions template looks solid; consider simplifying one i18n string.

Markup, escaping, and link attributes all look good and consistent with the rest of the plugin. The only minor nit is Line 12: the sentence is composed from several small esc_html_e() fragments, which can make accurate translations harder in languages with different word order.

If you care about top‑quality translations, consider switching that first paragraph to a single translatable string with placeholders (e.g., via printf), so translators see the whole sentence at once. This is purely optional; the current code is safe and functional.

inc/integrations/host-providers/class-rocket-host-provider.php (3)

70-80: detect() may break on PHP 7.4 due to str_contains; consider a strpos-based implementation.

str_contains() is only available on PHP 8+. If Ultimate Multisite still supports PHP 7.4, this will cause a fatal error when the file is loaded. A simple, compatible alternative is to base this on strpos():

 	public function detect(): bool {
 
-		return str_contains(ABSPATH, 'rocket.net') || str_contains(ABSPATH, 'rocketdotnet');
+		$path = (string) ABSPATH;
+
+		return (false !== strpos($path, 'rocket.net')) || (false !== strpos($path, 'rocketdotnet'));
 	}

If the plugin has officially dropped support for PHP < 8.0, you can ignore this, but it’s worth double‑checking your stated minimum PHP version.


119-175: Use $site_id in domain logs to address PHPMD warnings and improve diagnostics.

$site_id is currently unused in on_add_domain() and on_remove_domain(), which PHPMD correctly flags. It’s also useful context in logs when troubleshooting mapping issues. You can incorporate it into the existing log messages, e.g.:

 	public function on_add_domain($domain, $site_id): void {
@@
-		if (is_wp_error($response)) {
-			wu_log_add('integration-rocket', sprintf('[Add Domain] %s: %s', $domain, $response->get_error_message()), LogLevel::ERROR);
-		} else {
+		if (is_wp_error($response)) {
+			wu_log_add(
+				'integration-rocket',
+				sprintf('[Add Domain] %s (site %d): %s', $domain, $site_id, $response->get_error_message()),
+				LogLevel::ERROR
+			);
+		} else {
@@
-			if (200 === $response_code || 201 === $response_code) {
-				wu_log_add('integration-rocket', sprintf('[Add Domain] %s: Success - %s', $domain, $response_body));
-			} else {
-				wu_log_add('integration-rocket', sprintf('[Add Domain] %s: Failed (HTTP %d) - %s', $domain, $response_code, $response_body), LogLevel::ERROR);
+			if (200 === $response_code || 201 === $response_code) {
+				wu_log_add(
+					'integration-rocket',
+					sprintf('[Add Domain] %s (site %d): Success - %s', $domain, $site_id, $response_body)
+				);
+			} else {
+				wu_log_add(
+					'integration-rocket',
+					sprintf('[Add Domain] %s (site %d): Failed (HTTP %d) - %s', $domain, $site_id, $response_code, $response_body),
+					LogLevel::ERROR
+				);
 			}
 		}
 	}
@@
 	public function on_remove_domain($domain, $site_id): void {
@@
-		if (! $domain_id) {
-			wu_log_add('integration-rocket', sprintf('[Remove Domain] %s: Domain not found on Rocket.net', $domain), LogLevel::WARNING);
+		if (! $domain_id) {
+			wu_log_add(
+				'integration-rocket',
+				sprintf('[Remove Domain] %s (site %d): Domain not found on Rocket.net', $domain, $site_id),
+				LogLevel::WARNING
+			);
@@
-		if (is_wp_error($response)) {
-			wu_log_add('integration-rocket', sprintf('[Remove Domain] %s: %s', $domain, $response->get_error_message()), LogLevel::ERROR);
-		} else {
+		if (is_wp_error($response)) {
+			wu_log_add(
+				'integration-rocket',
+				sprintf('[Remove Domain] %s (site %d): %s', $domain, $site_id, $response->get_error_message()),
+				LogLevel::ERROR
+			);
+		} else {
@@
-			if (200 === $response_code || 204 === $response_code) {
-				wu_log_add('integration-rocket', sprintf('[Remove Domain] %s: Success - %s', $domain, $response_body));
-			} else {
-				wu_log_add('integration-rocket', sprintf('[Remove Domain] %s: Failed (HTTP %d) - %s', $domain, $response_code, $response_body), LogLevel::ERROR);
+			if (200 === $response_code || 204 === $response_code) {
+				wu_log_add(
+					'integration-rocket',
+					sprintf('[Remove Domain] %s (site %d): Success - %s', $domain, $site_id, $response_body)
+				);
+			} else {
+				wu_log_add(
+					'integration-rocket',
+					sprintf('[Remove Domain] %s (site %d): Failed (HTTP %d) - %s', $domain, $site_id, $response_code, $response_body),
+					LogLevel::ERROR
+				);
 			}
 		}
 	}

This both satisfies the static analysis warning and gives you more actionable logs when something goes wrong. Based on static analysis hints.


187-205: Log subdomain no‑op handlers to use parameters and clarify behavior.

on_add_subdomain() and on_remove_subdomain() intentionally do nothing, but PHPMD warns about unused $subdomain and $site_id. Adding a debug‑level log clarifies the no‑op behavior and marks parameters as used:

 	public function on_add_subdomain($subdomain, $site_id) {
-		// Rocket.net manages subdomains automatically via wildcard SSL
-		// No action needed
+		// Rocket.net manages subdomains automatically via wildcard SSL.
+		// Log and return so behavior is explicit and parameters are used.
+		wu_log_add(
+			'integration-rocket',
+			sprintf('[Add Subdomain] %s (site %d): no action required, handled via wildcard SSL.', $subdomain, $site_id),
+			LogLevel::DEBUG
+		);
 	}
@@
 	public function on_remove_subdomain($subdomain, $site_id) {
-		// Rocket.net manages subdomains automatically via wildcard SSL
-		// No action needed
+		// Rocket.net manages subdomains automatically via wildcard SSL.
+		// Log and return so behavior is explicit and parameters are used.
+		wu_log_add(
+			'integration-rocket',
+			sprintf('[Remove Subdomain] %s (site %d): no action required, handled via wildcard SSL.', $subdomain, $site_id),
+			LogLevel::DEBUG
+		);
 	}

This should resolve the PHPMD UnusedFormalParameter warnings and provide useful traceability for subdomain events. Based on static analysis hints.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 6ad55ce and d650e88.

⛔ Files ignored due to path filters (1)
  • assets/img/hosts/rocket.svg is excluded by !**/*.svg
📒 Files selected for processing (3)
  • inc/integrations/host-providers/class-rocket-host-provider.php (1 hunks)
  • inc/managers/class-domain-manager.php (1 hunks)
  • views/wizards/host-integrations/rocket-instructions.php (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (2)
inc/managers/class-domain-manager.php (1)
inc/integrations/host-providers/class-rocket-host-provider.php (1)
  • Rocket_Host_Provider (20-429)
inc/integrations/host-providers/class-rocket-host-provider.php (2)
inc/integrations/host-providers/class-base-host-provider.php (1)
  • supports (337-340)
inc/functions/helper.php (1)
  • wu_log_add (208-211)
🪛 PHPMD (2.15.0)
inc/integrations/host-providers/class-rocket-host-provider.php

119-119: Avoid unused parameters such as '$site_id'. (undefined)

(UnusedFormalParameter)


151-151: Avoid unused parameters such as '$site_id'. (undefined)

(UnusedFormalParameter)


187-187: Avoid unused parameters such as '$subdomain'. (undefined)

(UnusedFormalParameter)


187-187: Avoid unused parameters such as '$site_id'. (undefined)

(UnusedFormalParameter)


202-202: Avoid unused parameters such as '$subdomain'. (undefined)

(UnusedFormalParameter)


202-202: Avoid unused parameters such as '$site_id'. (undefined)

(UnusedFormalParameter)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: cypress (8.2, chrome)
  • GitHub Check: cypress (8.1, chrome)
🔇 Additional comments (2)
inc/managers/class-domain-manager.php (1)

1008-1011: Rocket provider registration in load_integrations() is consistent.

The new Rocket_Host_Provider::get_instance() call follows the same pattern and ordering as the existing host providers and should integrate cleanly with the existing discovery/filter mechanisms.

inc/integrations/host-providers/class-rocket-host-provider.php (1)

403-428: Instructions, description, and logo wiring look correct.

get_instructions(), get_description(), and get_logo() align with existing host providers: they point at the new template, return a translated description, and use wu_get_asset for the host logo. Nothing to change here.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants