Conversation
Codecov Report❌ Patch coverage is
❌ Your patch check has failed because the patch coverage (16.93%) is below the target coverage (70.00%). You can increase the patch coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## dev #788 +/- ##
============================================
- Coverage 14.46% 14.42% -0.04%
- Complexity 5543 5563 +20
============================================
Files 263 263
Lines 27231 27302 +71
============================================
Hits 3939 3939
- Misses 23292 23363 +71 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
Refactors the AntiCrawler firewall module flow and renames/extracts UA blacklist table maintenance helpers, aligning SFW update code to the new AntiCrawler API.
Changes:
- Renamed/extracted UA blacklist import & truncate helpers (
updateUADataTable(),clearUADataTable()) and updated callers. - Refactored
AntiCrawler::check()into clearer pre-check + log-check subroutines and added module constants/debug helper. - Renamed AntiCrawler log cleanup method to
clearLogTable()and updated cron caller.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| lib/Cleantalk/ApbctWP/Firewall/SFWUpdateHelper.php | Switches UA list processing to AntiCrawler::updateUADataTable(). |
| lib/Cleantalk/ApbctWP/Firewall/AntiCrawler.php | Major AntiCrawler flow refactor; adds UA table helpers, cookie/param constants, debug helper, and method renames. |
| cleantalk.php | Updates SFW update stage to use clearUADataTable() and cron cleanup to use clearLogTable(). |
Comments suppressed due to low confidence (2)
lib/Cleantalk/ApbctWP/Firewall/SFWUpdateHelper.php:66
- processUA() checks !empty($result['error']) before verifying that $result is an array. On success AntiCrawler::updateUADataTable() returns an int, so this will trigger a PHP warning (array offset on int). Check is_array($result) (or isset($result['error'])) before reading the 'error' key, or normalize updateUADataTable() to always return an array structure.
$result = AntiCrawler::updateUADataTable($file_path);
if ( ! empty($result['error']) ) {
return array('error' => 'UPDATING UA LIST: ' . $result['error']);
}
if ( ! is_int($result) ) {
return array('error' => 'UPDATING UA LIST: : WRONG_RESPONSE AntiCrawler::update');
cleantalk.php:1592
- AntiCrawler::clearUADataTable() returns void/null on success, but this code immediately reads $result__clear_db['error'], which will raise a PHP warning when the call succeeds (array offset on null). Either make clearUADataTable() return a consistent array result (e.g. [] on success), or guard with is_array($result__clear_db) before accessing ['error'].
$result__clear_db = AntiCrawler::clearUADataTable(
\Cleantalk\ApbctWP\DB::getInstance(),
APBCT_TBL_AC_UA_BL
);
if ( ! empty($result__clear_db['error']) ) {
return $result__clear_db['error'];
}
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| "<script> | ||
| window.addEventListener('DOMContentLoaded', function () { | ||
| ctSetCookie( 'wordpress_apbct_antibot', '" . hash('sha256', $apbct->api_key . $apbct->data['salt']) . "', 0 ); | ||
| ctSetCookie( " . self::COOKIE_NAME__ANTIBOT . ", '" . hash('sha256', $apbct->api_key . $apbct->data['salt']) . "', 0 ); |
| if ( is_array($data) ) { | ||
| $data = ' ' . print_r($data, true); | ||
| } else { | ||
| $data = ''; | ||
| } |
| private function debug(string $message, $data = null, $add_counstructor_data = false) | ||
| { |
https://app.doboard.com/1/task/34566