feat: change log table with retention cron and limits option

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01At3V6SjwbMe6eMzVGW3Hs7
This commit is contained in:
2026-09-25 21:58:15 +02:00
co-authored by Claude Opus 5.5
parent 1df655a74e
commit 261972751f
14 changed files with 593 additions and 0 deletions
+67
View File
@@ -0,0 +1,67 @@
<?php
declare(strict_types=1);
if (! class_exists('wpdb')) {
/**
* Minimal wpdb for unit tests. prepare()/esc_like() behave like the real ones
* closely enough for assertions on the generated SQL; query methods are meant
* to be mocked via Mockery::mock(wpdb::class)->makePartial().
*/
class wpdb
{
public $prefix = 'wp_';
public $posts = 'wp_posts';
public $postmeta = 'wp_postmeta';
public $usermeta = 'wp_usermeta';
public $options = 'wp_options';
public $insert_id = 0;
public function prepare($query, ...$args)
{
if (count($args) === 1 && is_array($args[0])) {
$args = $args[0];
}
// Quotes string placeholders but does not escape, so tests can assert on raw values.
$query = str_replace("'%s'", '%s', $query);
$query = str_replace('%s', "'%s'", $query);
return vsprintf($query, $args);
}
public function esc_like($text)
{
return addcslashes($text, '_%\\');
}
public function get_charset_collate()
{
return 'DEFAULT CHARACTER SET utf8mb4';
}
public function insert($table, $data, $format = null)
{
return 1;
}
public function query($query)
{
return 0;
}
public function get_col($query = null, $x = 0)
{
return [];
}
public function get_var($query = null, $x = 0, $y = 0)
{
return null;
}
public function get_results($query = null, $output = 'OBJECT')
{
return [];
}
}
}