Skip to content

Commit da1ce1d

Browse files
authored
Keep cloud reporting on when the cached API status is missing + 2.17.3 (#176)
* Keep cloud reporting on when the cached API status is missing is_premium() read only a cached status, and nothing re-checked the key once that cache was gone: is_api_active() had no callers. The cache is cleared on every settings save and expires after 12 hours, so a connected site silently stopped sending detections at the first save or within 12 hours of connecting. A missing status now counts as unknown, keeps cloud features on, and schedules a background re-check that sets it to active or inactive. * Prepare WordPress plugin 2.17.3
1 parent 539fb05 commit da1ce1d

6 files changed

Lines changed: 70 additions & 7 deletions

File tree

‎cdn-files/plugin-info.json‎

Lines changed: 3 additions & 3 deletions
Large diffs are not rendered by default.

‎changelog.txt‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
*** WebDecoy Bot Detection Changelog ***
22

3+
= 2.17.3 - 2026-12-02 =
4+
* Fixed: a site connected to WebDecoy Cloud stopped sending detections there after its settings were next saved, or within 12 hours of connecting. Cloud reporting now stays on and the connection is re-checked in the background.
5+
* Fixed: the WebDecoy-Test/ check said a test detection was recorded even when it never reached WebDecoy Cloud, for the same reason.
6+
* Changed: pages no longer carry a JavaScript verification token, and the plugin no longer reports each page view to WebDecoy Cloud for it. Cloud never received the reply it waited for, so the check could mark real visitors and search crawlers as scrapers.
7+
* Improved: names 37 more bots and crawlers (440 in total), including Devin, BLEXBot, Siteimprove, ZoominfoBot, CriteoBot and the Library of Congress crawler.
8+
39
= 2.17.2 - 2026-11-29 =
410
* Improved: Names 126 more bots, crawlers and AI agents (403 in total), including Google-Agent, Claude-Agent, Grok-Agent, DeepSeekBot and Amazon's AgentCore browser. With automatic robots.txt or crawler page-cache bypass on, the new crawlers in your chosen categories are included.
511
* Fixed: People using the NAVER app, the Ecosia browser, or Instagram and Threads on Redmi Note 12 Pro phones are no longer counted as bots.

‎includes/class-webdecoy-cloud-connect.php‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -503,6 +503,21 @@ public static function normalize_entitlements(array $raw, int $now): array
503503
];
504504
}
505505

506+
/**
507+
* Whether a cached API status lets cloud features run (is_premium()).
508+
*
509+
* Only a confirmed refusal ('inactive') or a recent network failure
510+
* ('error') turns them off. A missing status used to read as off, and
511+
* nothing ever re-checked the key, so a connected site stopped reporting
512+
* at the first settings save or within 12 hours of connecting at most.
513+
*
514+
* @param mixed $cached get_transient('webdecoy_api_status')
515+
*/
516+
public static function status_allows_cloud($cached): bool
517+
{
518+
return $cached === 'active' || $cached === false;
519+
}
520+
506521
/**
507522
* Constant-form hex check. `$length` of 0 means "any non-empty length".
508523
*/

‎readme.txt‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Donate link: https://webdecoy.com
44
Tags: ai crawlers, block ai bots, gptbot, bot detection, llms.txt
55
Requires at least: 6.1
66
Tested up to: 7.2
7-
Stable tag: 2.17.2
7+
Stable tag: 2.17.3
88
Requires PHP: 7.4
99
License: GPLv2 or later
1010
License URI: https://www.gnu.org/licenses/gpl-2.0.html
@@ -275,6 +275,12 @@ The bundled good-bot list (sdk/src/GoodBotList.php) stores a documentation URL f
275275

276276
== Changelog ==
277277

278+
= 2.17.3 =
279+
* Fixed: a site connected to WebDecoy Cloud stopped sending detections there after its settings were next saved, or within 12 hours of connecting. Cloud reporting now stays on and the connection is re-checked in the background.
280+
* Fixed: the WebDecoy-Test/ check said a test detection was recorded even when it never reached WebDecoy Cloud, for the same reason.
281+
* Changed: pages no longer carry a JavaScript verification token, and the plugin no longer reports each page view to WebDecoy Cloud for it. Cloud never received the reply it waited for, so the check could mark real visitors and search crawlers as scrapers.
282+
* Improved: names 37 more bots and crawlers (440 in total), including Devin, BLEXBot, Siteimprove, ZoominfoBot, CriteoBot and the Library of Congress crawler.
283+
278284
= 2.17.2 =
279285
* Improved: Names 126 more bots, crawlers and AI agents (403 in total), including Google-Agent, Claude-Agent, Grok-Agent, DeepSeekBot and Amazon's AgentCore browser. With automatic robots.txt or crawler page-cache bypass on, the new crawlers in your chosen categories are included.
280286
* Fixed: People using the NAVER app, the Ecosia browser, or Instagram and Threads on Redmi Note 12 Pro phones are no longer counted as bots.

‎tests/CloudConnectTest.php‎

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,3 +173,23 @@
173173
$same('https://app.webdecoy.com/onboarding/setup', WebDecoy_Cloud_Connect::setup_url_from(['setup_url' => $bad]), $bad);
174174
}
175175
});
176+
177+
echo "\nCloud Connect: cached API status\n";
178+
179+
$t('a missing status keeps cloud reporting on; only a refusal or network error turns it off', function () use ($same) {
180+
$same(true, WebDecoy_Cloud_Connect::status_allows_cloud('active'));
181+
$same(true, WebDecoy_Cloud_Connect::status_allows_cloud(false), 'expired, cleared or evicted is unknown, not inactive');
182+
$same(false, WebDecoy_Cloud_Connect::status_allows_cloud('inactive'));
183+
$same(false, WebDecoy_Cloud_Connect::status_allows_cloud('error'));
184+
});
185+
186+
$t('a missing status schedules a re-check of the key, and the re-check is wired', function () use ($true) {
187+
$src = (string) file_get_contents(dirname(__DIR__) . '/webdecoy.php');
188+
$start = strpos($src, 'public function is_api_status_active(): bool');
189+
$true($start !== false, 'is_api_status_active not found; this test is stale');
190+
$body = substr($src, $start, (int) strpos($src, "\n }\n", $start) - $start);
191+
$true(strpos($body, "wp_schedule_single_event(time(), 'webdecoy_check_api_status')") !== false, 'a missing status must schedule a re-check');
192+
$true(strpos($body, 'WebDecoy_Cloud_Connect::status_allows_cloud(') !== false, 'the status must be read through status_allows_cloud');
193+
$true(strpos($src, "add_action('webdecoy_check_api_status', [\$this, 'cron_check_api_status'])") !== false, 'the re-check hook must be registered');
194+
$true(preg_match('/function cron_check_api_status\(\): void\s*\{\s*\$this->is_api_active\(true\);/', $src) === 1, 'the re-check must force a fresh validation');
195+
});

‎webdecoy.php‎

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* Plugin Name: WebDecoy – AI Crawler Analytics, Block AI Bots, Robots.txt & llms.txt
44
* Plugin URI: https://webdecoy.com/wordpress
55
* Description: Understand AI crawler visits and bot identity evidence in WordPress, with local analytics and protection against spam, login abuse, and WooCommerce card testing.
6-
* Version: 2.17.2
6+
* Version: 2.17.3
77
* Requires at least: 6.1
88
* Requires PHP: 7.4
99
* Author: WebDecoy
@@ -41,7 +41,7 @@ function str_starts_with(string $haystack, string $needle): bool
4141
}
4242

4343
// Plugin constants
44-
define('WEBDECOY_VERSION', '2.17.2');
44+
define('WEBDECOY_VERSION', '2.17.3');
4545
define('WEBDECOY_PLUGIN_FILE', __FILE__);
4646
define('WEBDECOY_PLUGIN_DIR', plugin_dir_path(__FILE__));
4747
define('WEBDECOY_PLUGIN_URL', plugin_dir_url(__FILE__));
@@ -984,6 +984,9 @@ private function init_hooks(): void
984984
// Clear API cache when settings are saved
985985
add_action('update_option_webdecoy_options', [$this, 'clear_api_status_cache']);
986986

987+
// Re-check the API key when its cached status is gone.
988+
add_action('webdecoy_check_api_status', [$this, 'cron_check_api_status']);
989+
987990
// Safety-net cron drain of the violation-report spool.
988991
add_action('webdecoy_flush_violations', [$this, 'cron_flush_violations']);
989992

@@ -3427,7 +3430,20 @@ public function is_api_status_active(): bool
34273430
// Only check the cache - don't make API calls during initialization
34283431
$cached = get_transient('webdecoy_api_status');
34293432

3430-
return $cached === 'active';
3433+
// No cached status (it expired, a settings save cleared it, or an
3434+
// object cache evicted it) is unknown, not inactive: re-check the key
3435+
// in the background instead of switching cloud reporting off for good.
3436+
if ($cached === false && !wp_next_scheduled('webdecoy_check_api_status')) {
3437+
wp_schedule_single_event(time(), 'webdecoy_check_api_status');
3438+
}
3439+
3440+
return WebDecoy_Cloud_Connect::status_allows_cloud($cached);
3441+
}
3442+
3443+
/** Background re-check of the API key, scheduled by is_api_status_active(). */
3444+
public function cron_check_api_status(): void
3445+
{
3446+
$this->is_api_active(true);
34313447
}
34323448

34333449
/**

0 commit comments

Comments
 (0)