Question_Log
Stores asked questions for the Content gaps report.
Rows hold the question, whether it was answered, the source article IDs, whether the
answer was cached, and the time. No IP addresses or user identifiers are stored. The
source column defaults to ai so a future KB search tracker can share the table.
Namespace: WebberZone\Knowledge_Base\Pro\AI
Since: 3.2.0
Source: includes/pro/ai/class-question-log.php line 25
Methods
__construct()
Constructor.
Line: 51
public function __construct( );
is_enabled() static
Whether questions are recorded for the Content gaps report.
Since: 3.2.0
Line: 65
static public function is_enabled( ): bool;
Returns: bool — True if recording is on.
table() static
Table name.
Since: 3.2.0
Line: 76
static public function table( ): string;
Returns: string — Table name with prefix.
maybe_install()
Create or update the table when the schema version changes.
Since: 3.2.0
Line: 87
public function maybe_install( ): void;
Returns: void
install() static
Create or update the table.
Since: 3.2.0
Line: 98
static public function install( ): void;
Returns: void
record()
Record a question.
Since: 3.2.0
Line: 135
public function record( $question, $result, $cached ): void;
| Type | Name | Description |
|---|---|---|
string |
$question |
Question. |
array |
$result |
Result with answered and sources. |
bool |
$cached |
Whether the answer came from the cache. |
Returns: void
schedule_cleanup()
Schedule the daily cleanup.
Since: 3.2.0
Line: 175
public function schedule_cleanup( ): void;
Returns: void
cleanup()
Delete rows older than the retention period.
Since: 3.2.0
Line: 188
public function cleanup( ): int;
Returns: int — Rows deleted.
clear() static
Delete every recorded question.
Since: 3.2.0
Line: 206
static public function clear( ): int;
Returns: int — Rows deleted.
count() static
Number of recorded questions.
Since: 3.2.0
Line: 222
static public function count( ): int;
Returns: int — Count.
get_totals() static
Question totals for a date range.
Since: 3.2.0
Line: 240
static public function get_totals( string $from, string $to ): array;
| Type | Name | Description |
|---|---|---|
string |
$from |
Start, GMT Y-m-d H:i:s. |
string |
$to |
End, GMT Y-m-d H:i:s. |
Returns: array — Array with total, answered, unanswered and cached.
get_unanswered_groups() static
Unanswered questions grouped by normalised text, most asked first.
Since: 3.2.0
Line: 270
static public function get_unanswered_groups( string $from, string $to, int $per_page = ..., int $page = ... ): array;
| Type | Name | Description |
|---|---|---|
string |
$from |
Start, GMT Y-m-d H:i:s. |
string |
$to |
End, GMT Y-m-d H:i:s. |
int |
$per_page |
Rows per page. 0 for all. |
int |
$page |
Page number, from 1. |
Returns: array — Rows with question, count and last_asked (GMT).
count_unanswered_groups() static
Number of distinct unanswered questions in a date range.
Since: 3.2.0
Line: 300
static public function count_unanswered_groups( string $from, string $to ): int;
| Type | Name | Description |
|---|---|---|
string |
$from |
Start, GMT Y-m-d H:i:s. |
string |
$to |
End, GMT Y-m-d H:i:s. |
Returns: int — Count.
uninstall() static
Remove all Ask the Docs data: the question log table, options, cached answers, rate-limit counters and the cleanup event. Called from uninstaller.php.
Question text is always deleted, whatever the uninstall data setting, because the retention period cannot be enforced once the plugin is gone.
Since: 3.2.0
Line: 318
static public function uninstall( ): void;
Returns: void