Commit Graph
4 Commits
Author SHA1 Message Date
Adam Daley b6155aaa93 Keep DirectAdmin POST fields out of request URLs 2026-10-06 21:11:10 +01:00
Adam Daley 054dc0311a Backport remaining trivial fixes from main (#4299, #4072)
Normalize the Cookie consent nav label casing and forward the suspension
reason/details to DirectAdmin on suspend. The huraga gateway highlight
(#4096) is already covered on this branch, including its dark-border
follow-up, so no change was needed there.
2026-10-03 02:54:32 +01:00
Adam Daley c3fbd5f835 Fix DirectAdmin account updates silently ignoring custom package values
Hand-extracted from b364588f3 (#4166), same rationale as the Plesk fix
in 3848e6258 -- this piece is unrelated to everything else that huge
commit bundled together and stands on its own.

Two bugs in Server_Manager_Directadmin, both against the same
Server_Package::__call() silent-failure trap (undefined method calls
error_log and return '' rather than fail loudly):

- modifyAccount() built its own separate $fields array instead of
  reusing getCustomPackageFields() (the array createAccount() already
  builds correctly). It called getHasAnonymousFtp(), getHasCatchAll(),
  getHasCgi(), getHasCron(), getHasPhp(), getHasSpamFilter(),
  getHasShell(), getHasSsl(), getMaxEmailForwarders(),
  getMaxEmailLists(), and getMaxEmailAutoresponders() -- none of which
  exist on Server_Package. Every DirectAdmin account update through
  FOSSBilling silently reset aftp/catchall/cgi/cron/php/spam/ssh/ssl to
  OFF and email quotas to 0/empty, regardless of the hosting plan's
  actual configuration.
- getCustomPackageFields() itself (used by createAccount(), and now
  reused by modifyAccount()) had already been fixed for most fields
  but still called getMaxEmailForwarders()/getMaxEmailLists()/
  getMaxEmailAutoresponders() for nemailf/nemailml/nemailr, hitting
  the same silent-empty trap for those three on account creation too.

modifyAccount() now calls getCustomPackageFields($package) and layers
its own dnscontrol/sysinfo/action/ns1/ns2/user fields on top, instead
of maintaining a second, drifted-out-of-sync copy. nemailf/nemailml/
nemailr now read getCustomValue() like every other field in that
method. Introduces getCustomPackageFlag(), matching the equivalent
helper in the Plesk fix: treats a missing custom value as $default
(so already-covered flags like dnscontrol/sysinfo can default to 'ON'
without every other flag having to), and runs a present value through
FOSSBilling\Tools::normalizeBoolean() so a stored 'false'/'0' string
isn't truthy under a plain PHP ?: check.

createDirectadminManager() (an HTTP-client-injecting test double) and
the two tests exercising modifyAccount() are ported from the same
upstream commit; that helper's own origin (adcd85f52, "Improve overdue
order suspension handling") was declined earlier in this branch's
triage as feature-shaped, so it's recreated here rather than pulled in
via that commit.

composer test: 2471 passed. composer phpstan: no errors.
2026-08-16 20:05:57 +01:00
137a10dbf3 Apply autofixes and update CODEOWNERS for code quality (#3959)
* Apply suggested fix to tests/Unit/FOSSBilling/RateLimiterTest.php from Copilot Autofix

Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>

* Apply suggested fix to tests/Unit/FOSSBilling/RateLimiterTest.php from Copilot Autofix

Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>

* Apply suggested fix to src/library/Server/Manager/Directadmin.php from Copilot Autofix

Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>

* Apply suggested fix to tests/Unit/FOSSBilling/Api/AbstractApiTest.php from Copilot Autofix

Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>

* Remove tests path from CODEOWNERS

* Apply suggested fix to src/modules/Order/Service.php from Copilot Autofix

Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>

* Fix uncancel emails and zero-credit payments

* Preserve orders when invoice generation fails

* Fix RateLimiterTest CI failures from prior autofix commits

- Add a public RateLimiter::getStatus() so tests can read the token
  limit for a policy without hardcoding it (getRateLimitState() now
  reuses it).
- Fix consumeOrThrow test's toThrow() call: Pest expects the assertion
  closure as the first argument (with the exception type-hinted), not
  as a second argument alongside the class string.

* Fix DirectAdmin apostrophe entity decoding to avoid trailing semicolon

str_replace('&#39', "'", $data) also matched the fully-terminated
&#39; entity, replacing just the &#39 part and leaving the semicolon
behind (e.g. "O&#39;Brien" became "O';Brien"). Replace the terminated
form first, then the legacy unterminated form, so both decode to a
plain apostrophe.

* Fix for pull request finding

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
2026-07-11 16:20:59 +01:00