-
-
Notifications
You must be signed in to change notification settings - Fork 70
Add integration for enhance panel #267
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
Conversation
WalkthroughIntroduces a new Enhance Control Panel integration for WP Ultimo, including a host provider class that manages domain and subdomain lifecycle events with the Enhance API, comprehensive wiki documentation for setup and configuration, updates to the domain manager to load the integration, and sidebar references to the new documentation. Changes
Sequence DiagramsequenceDiagram
participant WP as WordPress<br/>(Ultimate Multisite)
participant PM as Domain Manager
participant EP as Enhance<br/>Host Provider
participant API as Enhance API
Note over WP,API: Domain Lifecycle Event
WP->>PM: Domain event triggered<br/>(add/remove domain/subdomain)
PM->>EP: Calls lifecycle hook<br/>(on_add_domain, on_remove_domain, etc.)
rect rgb(220, 240, 255)
Note over EP,API: API Communication Phase
EP->>EP: Prepare API request<br/>with authentication token
EP->>API: send_enhance_api_request<br/>(endpoint, method, data)
API-->>EP: Response (JSON)
end
rect rgb(240, 220, 255)
Note over EP: Error Handling & Logging
EP->>EP: Parse response,<br/>normalize errors
EP->>EP: Log request/response
end
EP-->>PM: Return result
PM-->>WP: Sync complete
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20–25 minutes
Possibly related PRs
Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
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. Comment |
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.
Actionable comments posted: 0
🧹 Nitpick comments (3)
.wiki/Enhance-Integration.md (1)
74-81: Tighten markdown formatting for better linting and readabilityA few small doc tweaks would clean up markdownlint/style warnings and improve rendering:
- Add explicit languages to generic fenced code blocks (e.g., line 74 URL snippet, and the API examples around lines 255–282). For example:
- Use
```textfor the bare API URL.- Use
```http(ortext) for theAuthorization: Bearer ...header andGET/POST/DELETE /servers...endpoint examples.- The bold “Error: ...” labels in Troubleshooting (lines ~180, ~186, ~191) are effectively subheadings; consider turning them into proper headings (e.g.,
#### Error: "Failed to connect to Enhance API"), which also addresses MD036.- Optional: around the DNS/SSL explanation (lines ~149–154), the word “automatically” appears twice in close proximity; you could trim one occurrence to make the sentence a bit tighter.
These are non-functional but will keep markdownlint quiet and make the page a bit clearer.
Also applies to: 149-154, 176-195, 255-282
inc/integrations/host-providers/class-enhance-host-provider.php (2)
46-47: Align tutorial link and API URL placeholder with this repo and expected formatTwo small consistency tweaks to consider:
protected $tutorial_linkstill points tohttps://github.com/superdav42/wp-multisite-waas/wiki/Enhance-Integration, while this project ships its own.wiki/Enhance-Integration.mdunder theMultisite-Ultimate/ultimate-multisiterepo. Updating the URL will keep the in-app “tutorial” link aligned with the docs shipped here.- The
WU_ENHANCE_API_URLplaceholder currently showse.g. https://your-enhance-server.com, but the docs and runtime expectation require/api/(you later rely onrtrim(WU_ENHANCE_API_URL, '/') . $endpoint). Changing the placeholder to something likee.g. https://your-enhance-panel.com/api/will reduce configuration mistakes.Also applies to: 100-115
196-203: Remove or use$delete_responseto avoid an unused variable
$delete_responseis assigned inon_remove_domain()but never read, which static analysis correctly flags and which also hides a potential place to react to API failures.If you just want to fire-and-forget, you can drop the variable:
- $delete_response = $this->send_enhance_api_request( - '/servers/' . $server_id . '/domains/' . $domain_id, - 'DELETE' - ); - - wu_log_add('integration-enhance', sprintf('Domain %s removal request sent', $domain)); + $this->send_enhance_api_request( + '/servers/' . $server_id . '/domains/' . $domain_id, + 'DELETE' + ); + + wu_log_add('integration-enhance', sprintf('Domain %s removal request sent', $domain));Alternatively, you could inspect
$delete_responseand log a different message on error, but either way avoiding the unused variable will keep PHPMD happy.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
assets/img/hosts/enhance.svgis excluded by!**/*.svg
📒 Files selected for processing (4)
.wiki/Enhance-Integration.md(1 hunks).wiki/_Sidebar.md(1 hunks)inc/integrations/host-providers/class-enhance-host-provider.php(1 hunks)inc/managers/class-domain-manager.php(1 hunks)
🧰 Additional context used
🧬 Code graph analysis (2)
inc/managers/class-domain-manager.php (1)
inc/integrations/host-providers/class-enhance-host-provider.php (1)
Enhance_Host_Provider(20-424)
inc/integrations/host-providers/class-enhance-host-provider.php (2)
inc/integrations/host-providers/class-base-host-provider.php (2)
Base_Host_Provider(20-656)supports(337-340)inc/functions/helper.php (2)
wu_log_add(208-211)wu_get_isset(66-73)
🪛 Gitleaks (8.29.0)
.wiki/Enhance-Integration.md
[high] 63-65: Discovered a potential authorization token provided in a curl command header, which could compromise the curl accessed resource.
(curl-auth-header)
🪛 LanguageTool
.wiki/Enhance-Integration.md
[style] ~153-~153: This adverb was used twice in the sentence. Consider removing one of them or replacing them with a synonym.
Context: ...ally - Enhance handles SSL provisioning automatically, so manual SSL configuration is not req...
(ADVERB_REPETITION_PREMIUM)
🪛 markdownlint-cli2 (0.18.1)
.wiki/Enhance-Integration.md
74-74: Fenced code blocks should have a language specified
(MD040, fenced-code-language)
180-180: Emphasis used instead of a heading
(MD036, no-emphasis-as-heading)
186-186: Emphasis used instead of a heading
(MD036, no-emphasis-as-heading)
191-191: Emphasis used instead of a heading
(MD036, no-emphasis-as-heading)
257-257: Fenced code blocks should have a language specified
(MD040, fenced-code-language)
264-264: Fenced code blocks should have a language specified
(MD040, fenced-code-language)
269-269: Fenced code blocks should have a language specified
(MD040, fenced-code-language)
274-274: Fenced code blocks should have a language specified
(MD040, fenced-code-language)
280-280: Fenced code blocks should have a language specified
(MD040, fenced-code-language)
🪛 PHPMD (2.15.0)
inc/integrations/host-providers/class-enhance-host-provider.php
197-197: Avoid unused local variables such as '$delete_response'. (undefined)
(UnusedLocalVariable)
⏰ 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.1, chrome)
- GitHub Check: cypress (8.2, chrome)
🔇 Additional comments (3)
.wiki/_Sidebar.md (1)
39-47: Host provider links for Enhance and Hestia look consistentThe new sidebar entries follow the existing naming and link pattern for host provider integrations; no issues from a docs/navigation standpoint.
inc/managers/class-domain-manager.php (1)
952-1007: Enhance host provider is correctly wired into the integration loaderLoading
\WP_Ultimo\Integrations\Host_Providers\Enhance_Host_Provider::get_instance()alongside the other host providers keeps the pattern consistent and ensures the new integration is initialized beforewp_ultimo_host_providers_loadruns.inc/integrations/host-providers/class-enhance-host-provider.php (1)
20-423: Overall Enhance host provider implementation looks solidThe integration cleanly follows the Base_Host_Provider pattern: detection via constants, well-defined fields, centralized
send_enhance_api_request()with logging and error normalization, and domain/subdomain hooks wired to the Enhance API plus a focusedtest_connection()path. The explainer lines and docs align with the behavior inon_add_domain/on_remove_domain.
Test build:
ultimate-multisite.zip
Summary by CodeRabbit
Documentation
New Features