feat(integrations): add DirectAdmin host provider#1655
Conversation
📝 WalkthroughWalkthroughAdds a DirectAdmin integration provider, authenticated API handling, domain pointer lifecycle automation, setup instructions, registry registration, and tests covering configuration, connectivity, API errors, hooks, and pointer operations. ChangesDirectAdmin integration
Estimated code review effort: 4 (Complex) | ~45 minutes Sequence Diagram(s)sequenceDiagram
participant DomainMapping
participant DirectAdminCapability
participant DirectAdminIntegration
participant DirectAdminAPI
DomainMapping->>DirectAdminCapability: emit mapped domain lifecycle event
DirectAdminCapability->>DirectAdminIntegration: request pointer add or delete
DirectAdminIntegration->>DirectAdminAPI: send authenticated CMD_API_DOMAIN_POINTER request
DirectAdminAPI-->>DirectAdminIntegration: return API response
DirectAdminIntegration-->>DirectAdminCapability: return decoded response or WP_Error
Suggested labels: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 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 |
🔨 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! Login credentials: |
|
Performance Test Results Performance test results for 58c1ba1 are in 🛎️! |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@inc/integrations/providers/directadmin/class-directadmin-integration.php`:
- Around line 295-302: Update the URL-encoded response handling in the
DirectAdmin response parser to add the original body under the `raw` key to the
`$parsed` result before returning it. Preserve the existing `parse_str` behavior
and ensure `test_connection()` can inspect `response['raw']` for HTML login-page
detection.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 32eb0df7-1c94-47f1-a1a2-c49864d71050
⛔ Files ignored due to path filters (1)
assets/img/hosts/directadmin.svgis excluded by!**/*.svg
📒 Files selected for processing (8)
inc/integrations/class-integration-registry.phpinc/integrations/providers/directadmin/class-directadmin-domain-mapping.phpinc/integrations/providers/directadmin/class-directadmin-integration.phptests/WP_Ultimo/Integrations/Integration_Registry_Test.phptests/WP_Ultimo/Integrations/Providers/DirectAdmin/DirectAdmin_Domain_Mapping_Test.phptests/WP_Ultimo/Integrations/Providers/DirectAdmin/DirectAdmin_Integration_Test.phptests/WP_Ultimo/Integrations/Providers/Provider_Integration_Test.phpviews/wizards/host-integrations/directadmin-instructions.php
| if (str_contains($body, '=') || str_contains($body, '&')) { | ||
| $parsed = []; | ||
| parse_str($body, $parsed); | ||
|
|
||
| if ( ! empty($parsed)) { | ||
| return $parsed; | ||
| } | ||
| } |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
Include the raw body in URL-encoded responses to ensure HTML login pages are correctly detected.
If DirectAdmin returns an HTML login page (e.g., due to authentication failure) that happens to contain an = character (like <html lang="en"> or a <form> attribute), parse_str will successfully parse it into garbage keys. Because this parsed array does not include the 'raw' key, the check in test_connection() (isset($response['raw']) && false !== stripos(...)) will falsely evaluate to false. This causes the connection test to succeed instead of surfacing the login-page error.
Adding 'raw' => $body to the parsed result ensures that the raw body is always available for HTML detection, matching the behavior of the fallback parser.
🐛 Proposed fix
if (str_contains($body, '=') || str_contains($body, '&')) {
$parsed = [];
parse_str($body, $parsed);
if ( ! empty($parsed)) {
+ $parsed['raw'] = $body;
return $parsed;
}
}📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| if (str_contains($body, '=') || str_contains($body, '&')) { | |
| $parsed = []; | |
| parse_str($body, $parsed); | |
| if ( ! empty($parsed)) { | |
| return $parsed; | |
| } | |
| } | |
| if (str_contains($body, '=') || str_contains($body, '&')) { | |
| $parsed = []; | |
| parse_str($body, $parsed); | |
| if ( ! empty($parsed)) { | |
| $parsed['raw'] = $body; | |
| return $parsed; | |
| } | |
| } |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@inc/integrations/providers/directadmin/class-directadmin-integration.php`
around lines 295 - 302, Update the URL-encoded response handling in the
DirectAdmin response parser to add the original body under the `raw` key to the
`$parsed` result before returning it. Preserve the existing `parse_str` behavior
and ensure `test_connection()` can inspect `response['raw']` for HTML login-page
detection.
There was a problem hiding this comment.
@coderabbitai Verified: an HTML response containing = can be parsed without retaining its raw content, preventing the connection check from recognizing the login page. The correction belongs in decode_directadmin_response() at inc/integrations/providers/directadmin/class-directadmin-integration.php:302. It is not applied in this pass because the assigned worktree is locked by another active session.
There was a problem hiding this comment.
@superdav42, thanks for confirming. The finding remains valid and unresolved until the parser retains the raw body for form-parsed responses. Please apply the minimal change once the worktree is available, then let me know and I’ll re-check it.
|
CLAIM_RELEASED reason=worker_complete runner=superdav42 ts=2026-07-21T06:17:33Z aidevops_version=3.32.161 opencode_version=1.18.4 |
|
DISPATCH_CLAIM nonce=6b3911e360e4ccfc50d334e09a1d02b3 runner=superdav42 ts=2026-07-24T14:13:36Z max_age_s=120 version=3.32.180 opencode_version=1.18.4 lease_token=6b3911e360e4ccfc50d334e09a1d02b3 device=device-1783824528-2609248-26808 session=issue-1655 phase=prelaunch expires_at=1784902538 |
|
REVIEW_FOLLOWUP_CREATED source_pr=1655 issue=1670 fingerprint=source-pr-1655 runner=superdav42 ts=2026-07-24T14:13:55Z |
Summary
Implementation notes
CMD_API_LOGIN_TESTto validate credentials.CMD_API_DOMAIN_POINTERwithaction=add,from=<mapped-domain>, andalias=yesto attach mapped domains to the configured base domain.CMD_API_DOMAIN_POINTERwithaction=deleteandselect0=<mapped-domain>for removal.Verification
php -lon changed PHP files: pass.vendor/bin/phpcson changed files: pass.vendor/bin/phpunit --filter DirectAdmin: blocked locally because the WordPress test suite is not installed; this PR is opened so CI can run the unit tests.Summary by CodeRabbit