Skip to content

feat(integrations): add DirectAdmin host provider#1655

Merged
superdav42 merged 1 commit into
mainfrom
feature/auto-20260720-213231
Jul 24, 2026
Merged

feat(integrations): add DirectAdmin host provider#1655
superdav42 merged 1 commit into
mainfrom
feature/auto-20260720-213231

Conversation

@superdav42

@superdav42 superdav42 commented Jul 21, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Add a DirectAdmin hosting integration using DirectAdmin CMD_API domain pointer aliases.
  • Register the provider and domain-mapping capability in the integration registry.
  • Add setup wizard instructions, a host logo, and DirectAdmin-focused unit coverage.

Implementation notes

  • Uses CMD_API_LOGIN_TEST to validate credentials.
  • Uses CMD_API_DOMAIN_POINTER with action=add, from=<mapped-domain>, and alias=yes to attach mapped domains to the configured base domain.
  • Uses CMD_API_DOMAIN_POINTER with action=delete and select0=<mapped-domain> for removal.
  • Subdomain events use domain pointer aliases so tenant hostnames continue to serve the multisite document root.

Verification

  • php -l on changed PHP files: pass.
  • vendor/bin/phpcs on changed files: pass.
  • Pre-commit PHPCS and PHPStan on staged PHP 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

  • New Features
    • Added DirectAdmin integration support for connecting and managing credentials.
    • Added automatic domain and subdomain mapping through DirectAdmin domain pointers.
    • Added connection testing and SSL automation support.
    • Added setup instructions for Login Keys, base domains, and SSL configuration.
  • Tests
    • Added coverage for DirectAdmin connection, credential validation, and domain-mapping behavior.

@superdav42 superdav42 added the origin:interactive Created by interactive user session label Jul 21, 2026
@coderabbitai

coderabbitai Bot commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Adds 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.

Changes

DirectAdmin integration

Layer / File(s) Summary
Provider API and configuration
inc/integrations/providers/directadmin/class-directadmin-integration.php, views/wizards/host-integrations/directadmin-instructions.php, tests/WP_Ultimo/Integrations/Providers/DirectAdmin/DirectAdmin_Integration_Test.php
Adds DirectAdmin credentials, connection detection, authenticated API requests, response decoding, error handling, configuration fields, instructions, and integration tests.
Domain pointer lifecycle capability
inc/integrations/providers/directadmin/class-directadmin-domain-mapping.php, tests/WP_Ultimo/Integrations/Providers/DirectAdmin/DirectAdmin_Domain_Mapping_Test.php
Adds domain and subdomain mapping hooks that create or delete DirectAdmin domain pointers, including optional www. aliases, normalization, validation, logging, and tests.
Registry and provider coverage
inc/integrations/class-integration-registry.php, tests/WP_Ultimo/Integrations/Integration_Registry_Test.php, tests/WP_Ultimo/Integrations/Providers/Provider_Integration_Test.php
Registers DirectAdmin and its domain-mapping capability and includes it in registry and provider integration assertions.

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
Loading

Suggested labels: review-feedback-scanned

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: adding a DirectAdmin host provider integration.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/auto-20260720-213231

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.

@github-actions

Copy link
Copy Markdown

🔨 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

@github-actions

Copy link
Copy Markdown

Performance Test Results

Performance test results for 58c1ba1 are in 🛎️!

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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

📥 Commits

Reviewing files that changed from the base of the PR and between d373617 and 14e78ca.

⛔ Files ignored due to path filters (1)
  • assets/img/hosts/directadmin.svg is excluded by !**/*.svg
📒 Files selected for processing (8)
  • inc/integrations/class-integration-registry.php
  • inc/integrations/providers/directadmin/class-directadmin-domain-mapping.php
  • inc/integrations/providers/directadmin/class-directadmin-integration.php
  • tests/WP_Ultimo/Integrations/Integration_Registry_Test.php
  • tests/WP_Ultimo/Integrations/Providers/DirectAdmin/DirectAdmin_Domain_Mapping_Test.php
  • tests/WP_Ultimo/Integrations/Providers/DirectAdmin/DirectAdmin_Integration_Test.php
  • tests/WP_Ultimo/Integrations/Providers/Provider_Integration_Test.php
  • views/wizards/host-integrations/directadmin-instructions.php

Comment on lines +295 to +302
if (str_contains($body, '=') || str_contains($body, '&')) {
$parsed = [];
parse_str($body, $parsed);

if ( ! empty($parsed)) {
return $parsed;
}
}

@coderabbitai coderabbitai Bot Jul 21, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🎯 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.

Suggested change
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.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

@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.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@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.

@superdav42

Copy link
Copy Markdown
Collaborator Author

CLAIM_RELEASED reason=worker_complete runner=superdav42 ts=2026-07-21T06:17:33Z aidevops_version=3.32.161 opencode_version=1.18.4

@superdav42
superdav42 merged commit e3a80ae into main Jul 24, 2026
11 checks passed
@superdav42 superdav42 added the review-feedback-scanned Merged PR already scanned for quality feedback label Jul 24, 2026
@superdav42

Copy link
Copy Markdown
Collaborator Author

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

@superdav42

Copy link
Copy Markdown
Collaborator Author

REVIEW_FOLLOWUP_CREATED source_pr=1655 issue=1670 fingerprint=source-pr-1655 runner=superdav42 ts=2026-07-24T14:13:55Z

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

Labels

origin:interactive Created by interactive user session review-feedback-scanned Merged PR already scanned for quality feedback

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant