CreaCaptcha

Log_Command
in package

Inspects and maintains the optional event-log table.

Table of Contents

Methods

clear()  : void
Empties the event-log table.
escape_control_chars()  : string
Replaces terminal control characters with a printable escape.
escape_row()  : array<string, string>
Runs every cell of an event row through escape_control_chars().
list_events()  : void
Lists the most recent event-log rows.
prune()  : void
Deletes event-log rows older than the configured retention period.
resolve_fields()  : array{fields: array, unknown: array}
Splits a `--fields` value and separates known from unknown columns.
show()  : void
Zeigt einen einzelnen Event-Log-Eintrag mit allen Spalten.

Methods

clear()

Empties the event-log table.

public clear(array<int, string> $args, array<string, string> $assoc_args) : void

OPTIONS

[--yes] : Skip the confirmation prompt.

EXAMPLES

wp creacaptcha log clear --yes
Parameters
$args : array<int, string>

Positional arguments.

$assoc_args : array<string, string>

Associative arguments.

escape_control_chars()

Replaces terminal control characters with a printable escape.

public static escape_control_chars(string $value) : string

CLI-5: Die Spalten user_agent, referrer, path, reason, verification_data und request_body stammen aus anonymen Requests. sanitize_text_field() entfernt kein 0x1B, und log list/log show gaben die Rohwerte über den Formatter aus — eine ESC-Sequenz aus einem fremden User-Agent wirkte damit im Terminal des Administrators (Farbwechsel, Cursorbewegung, Überschreiben früherer Zeilen). Neutralisiert werden die C0-Steuerzeichen (0x00–0x1F, einschließlich ESC, CR und LF), DEL (0x7F) und die UTF-8-kodierten C1-Steuerzeichen U+0080–U+009F (0xC2 gefolgt von 0x80–0x9F) — genau der Bereich, den ein Terminal auswertet. Druckbare Zeichen und Mehrbyte-UTF-8 bleiben unverändert; die Ersetzung arbeitet bewusst byteweise (kein /u), damit sie auch an einem ungültigen UTF-8-Rest nicht abbricht.

Kein Escaping heißt hier NICHT „unschädlich": ein Wert kann weiterhin täuschende druckbare Zeichen enthalten (z. B. Unicode-Richtungswechsel). Verhindert wird die Steuerung des Terminals, nicht die Täuschung des Lesers.

Parameters
$value : string

Raw column value.

Return values
string

escape_row()

Runs every cell of an event row through escape_control_chars().

public static escape_row(array<string, mixed> $row) : array<string, string>
Parameters
$row : array<string, mixed>

One event-log row.

Return values
array<string, string>

list_events()

Lists the most recent event-log rows.

public list_events(array<int, string> $args, array<string, string> $assoc_args) : void

OPTIONS

[--number=] : How many rows to show. Default: 20. Gedeckelt auf 1000 (Analytics::query_events()) — ein größerer Wert wird still auf 1000 begrenzt, ohne Meldung.

[--type=] : Filter by event type (verified, failed, firewall, ratelimit, underattack, underattack_passed, challenge).

[--fields=] : Komma-Liste der anzuzeigenden Spalten. Default: created_at,event_type,ip,path. Verfügbare Spalten: id, created_at, event_type, ip, user_id, user_agent, referrer, path, plugin, action, form_id, interceptor, reason, verification_data, request_body. Ein unbekannter Spaltenname ist ein Fehler (Exit 1) — auch dann, wenn die Abfrage keine Zeilen liefert (E3c: die Prüfung läuft gegen die feste Spaltenliste oben, nicht mehr nur gegen die gefundenen Zeilen).

[--format=] : Output format (table, json, yaml, csv).

EXAMPLES

wp creacaptcha log list --number=50 --type=firewall
wp creacaptcha log list --fields=created_at,event_type,plugin,form_id
Parameters
$args : array<int, string>

Positional arguments.

$assoc_args : array<string, string>

Associative arguments.

Tags
subcommand

list

prune()

Deletes event-log rows older than the configured retention period.

public prune(array<int, string> $args, array<string, string> $assoc_args) : void

EXAMPLES

wp creacaptcha log prune

Parameters
$args : array<int, string>

Positional arguments.

$assoc_args : array<string, string>

Associative arguments.

resolve_fields()

Splits a `--fields` value and separates known from unknown columns.

public static resolve_fields(string $requested, array<int, string> $available) : array{fields: array, unknown: array}
Parameters
$requested : string

Raw --fields value.

$available : array<int, string>

Column names of the result set.

Return values
array{fields: array, unknown: array}

show()

Zeigt einen einzelnen Event-Log-Eintrag mit allen Spalten.

public show(array<int, string> $args, array<string, string> $assoc_args) : void

OPTIONS

: Die Event-ID aus der Spalte `id` in `log list`.

[--format=] : Output format (table, json, yaml, csv). Default: table.

EXAMPLES

wp creacaptcha log show 42
wp creacaptcha log show 42 --format=json
Parameters
$args : array<int, string>

Positional arguments.

$assoc_args : array<string, string>

Associative arguments.


        
On this page

Search results