| 1 |
<?php |
| 2 |
|
| 3 |
if (!defined('ABSPATH')) { |
| 4 |
exit; |
| 5 |
} |
| 6 |
|
| 7 |
/** |
| 8 |
* Read-side queries over the log tables and rollup: row population from the |
| 9 |
* hits rollup, distinct recent URL extraction, exact / fuzzy URL lookup, |
| 10 |
* paged list reads, and daily activity trends for the dashboard. |
| 11 |
*/ |
| 12 |
interface ABJ_404_Solution_LogReadQueryInterface { |
| 13 |
|
| 14 |
/** |
| 15 |
* Default size of the recency window scanned to find distinct logged URLs. |
| 16 |
* Mirrored as ABJ_404_Solution_LogsReadQueries::DEFAULT_RECENT_LOG_WINDOW so |
| 17 |
* interface defaults do not depend on the implementation being loaded. |
| 18 |
*/ |
| 19 |
const DEFAULT_DISTINCT_RECENT_LOG_WINDOW = 5000; |
| 20 |
|
| 21 |
/** Default cap on distinct URLs returned by getDistinctLoggedUrls(). */ |
| 22 |
const DEFAULT_DISTINCT_URL_CAP = 500; |
| 23 |
|
| 24 |
/** |
| 25 |
* Populate logshits / logsid / last_used on each row from the pre-aggregated |
| 26 |
* wp_abj404_logs_hits rollup. |
| 27 |
* |
| 28 |
* @param array<int, array<string, mixed>> $rows |
| 29 |
* @return array<int, array<string, mixed>> |
| 30 |
*/ |
| 31 |
public function populateLogsData($rows); |
| 32 |
|
| 33 |
/** |
| 34 |
* Distinct recently-requested URLs from the 404 log table. |
| 35 |
* |
| 36 |
* @param int $recentLogWindow Max rows scanned from logsv2 before deduplication. |
| 37 |
* @param int $distinctUrlCap Max distinct URLs returned. |
| 38 |
* @return array<int, string> |
| 39 |
*/ |
| 40 |
public function getDistinctLoggedUrls( |
| 41 |
int $recentLogWindow = self::DEFAULT_DISTINCT_RECENT_LOG_WINDOW, |
| 42 |
int $distinctUrlCap = self::DEFAULT_DISTINCT_URL_CAP |
| 43 |
): array; |
| 44 |
|
| 45 |
/** |
| 46 |
* @param string $specificURL |
| 47 |
* @return array<int, array<string, mixed>> |
| 48 |
*/ |
| 49 |
public function getLogsIDandURL($specificURL = ''); |
| 50 |
|
| 51 |
/** |
| 52 |
* @param string $specificURL |
| 53 |
* @param string|int $limitResults |
| 54 |
* @return array<int, array<string, mixed>> |
| 55 |
*/ |
| 56 |
public function getLogsIDandURLLike($specificURL, $limitResults); |
| 57 |
|
| 58 |
/** |
| 59 |
* @param array<string, mixed> $tableOptions orderby, paged, perpage, etc. |
| 60 |
* @return array<int, array<string, mixed>> |
| 61 |
*/ |
| 62 |
public function getLogRecords($tableOptions); |
| 63 |
|
| 64 |
/** |
| 65 |
* @param int $days Number of days (default 30, clamped to 1-90) |
| 66 |
* @return array<int, array<string, mixed>> |
| 67 |
*/ |
| 68 |
public function getDailyActivityTrend(int $days = 30): array; |
| 69 |
} |
| 70 |
|