Skip to content

Fix. Cleantalk. New curlopt_resolve way implemented, rotateModerate logic refactored. - #903

Open
alexandergull wants to merge 1 commit into
devfrom
curlopt_resolve_new.ag
Open

alexandergull wants to merge 1 commit into
devfrom
curlopt_resolve_new.ag

Conversation

@alexandergull

Copy link
Copy Markdown
Member

@codecov

codecov Bot commented Oct 6, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 82.82828% with 17 lines in your changes missing coverage. Please review.
✅ Project coverage is 32.80%. Comparing base (674d3cb) to head (4f963c4).

Files with missing lines Patch % Lines
lib/Cleantalk/Antispam/Cleantalk.php 85.10% 7 Missing ⚠️
inc/cleantalk-common.php 0.00% 5 Missing ⚠️
lib/Cleantalk/ApbctWP/ModerateServerConfig.php 94.73% 2 Missing ⚠️
inc/cleantalk-updater.php 0.00% 1 Missing ⚠️
...ntalk/Antispam/IntegrationsByClass/Woocommerce.php 0.00% 1 Missing ⚠️
lib/Cleantalk/ApbctWP/Antispam/ForceProtection.php 0.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##                dev     #903      +/-   ##
============================================
+ Coverage     32.45%   32.80%   +0.35%     
- Complexity     6948     6968      +20     
============================================
  Files           296      297       +1     
  Lines         27216    27236      +20     
============================================
+ Hits           8833     8935     +102     
+ Misses        18383    18301      -82     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copilot AI 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.

Warning

  • Copilot's review of this pull request may be incomplete because some of the changed files are excluded by your Copilot content exclusion settings. See Excluding content from Copilot for details.

Copilot review overview

🟡 Changes recommended

DNS recovery can retry rejected targets, and several migrated callers fail to persist server-state changes.

Review effort: Balanced
Findings: 5 Medium severity

Open (5)
What changed in this PR

Refactors moderate-server rotation and adds cURL DNS overrides while preserving hostname-based TLS verification.

Changes:

  • Adds centralized moderate-server configuration and persistence.
  • Implements CURLOPT_RESOLVE recovery for DNS failures.
  • Migrates request paths and update handling to the new configuration.
File Description
lib/​Cleantalk/​Common/​HTTP/​Request.php Adds the resolve cURL option alias.
lib/​Cleantalk/​ApbctWP/​ModerateServerConfig.php Centralizes cached server state.
lib/​Cleantalk/​ApbctWP/​ContactsEncoder/​ContactsEncoder.php Uses centralized configuration.
lib/​Cleantalk/​ApbctWP/​Antispam/​ForceProtection.php Uses centralized configuration.
lib/​Cleantalk/​Antispam/​IntegrationsByClass/​Woocommerce.php Uses centralized configuration.
lib/​Cleantalk/​Antispam/​Cleantalk.php Refactors rotation and DNS recovery.
inc/​cleantalk-updater.php Resets cache during upgrade.
inc/​cleantalk-common.php Integrates configuration lifecycle.
tests/​ApbctWP/​TestModerateServerConfig.php Excluded from review by policy.
tests/​Antispam/​CleantalkDnsOverrideTest.php Excluded from review by policy.
tests/​StandaloneFunctions/​TestGetServerUrl.php Excluded from review by policy.
tests/​Common/​HTTP/​TestRequestResolveOption.php Excluded from review by policy.
Files excluded by content exclusion policy (4)
  • tests/Antispam/CleantalkDnsOverrideTest.php
  • tests/ApbctWP/TestModerateServerConfig.php
  • tests/Common/HTTP/TestRequestResolveOption.php
  • tests/StandaloneFunctions/TestGetServerUrl.php

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +316 to +320
if ( $type_error === 'getaddrinfo_error' ) {
$this->rotateModerateWithDnsOverride();
} else {
$this->rotateModerate();
//try change server again if next sendRequest failed
$attempt = $attempt + 1;
}
Comment on lines +491 to 498
// Hostname stays intact - only the resolution step is overridden.
$this->work_url = $url_protocol . $url_host . $url_suffix;
$this->dns_resolve_ip = $server['ip'];
$this->server_state_dirty = true;

// Do not checking previous down server
if ( ! empty($this->downServers) && in_array($this->work_url, $this->downServers) ) {
if ( ! empty($this->downServers) && in_array($this->getCurrentTargetKey(), $this->downServers) ) {
continue;
Comment on lines +1457 to 1459
ModerateServerConfig::set($ct);

$ct->sendFeedback($ct_request);
Comment on lines +89 to 90
ModerateServerConfig::set($ct);
$api_response = $ct->checkBot($ct_request);
Comment on lines +382 to 383
ModerateServerConfig::set($ct);
$api_response = $ct->checkBot($ct_request);

This branch has not been deployed

No deployments
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