PluginProbe
404 Solution / 4.2.0
404 Solution v4.2.0
4.3.5 4.3.4 4.3.3 4.3.2 4.3.1 4.3.0 4.2.0 4.1.19 4.1.18 4.1.17 4.1.16 4.1.15 4.1.13 4.1.12 4.1.11 4.1.10 4.1.9 4.1.8 4.1.7 4.1.6 4.1.5 4.1.4 4.1.3 trunk 2.30.0 All 109 releases
404-solution / includes / ViewReadServiceInterface.php

ViewReadServiceInterface.php in 404 Solution 4.2.0, at includes/ViewReadServiceInterface.php

189 lines 5.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 if (!defined('ABSPATH')) {
4 exit;
5 }
6
7 /**
8 * Interface for the admin list view read path, snapshot caching, and status counts.
9 *
10 * Extracted from DataAccess in Phase 6 of the DataAccess refactor.
11 * Absorbs 5 traits: ViewQueries, ViewSnapshotCache, ViewMetadata,
12 * ViewQueriesHitsLifecycle, ViewQueriesStagedRead.
13 *
14 * @see docs/dataaccess-refactor-plan.md Phase 6.
15 */
16 interface ABJ_404_Solution_ViewReadServiceInterface {
17
18 // --- ViewQueries (status counts, list queries, cache invalidation) ---
19
20 /**
21 * @param bool $bypassCache
22 * @return array<string, int>
23 */
24 public function getRedirectStatusCounts($bypassCache = false): array;
25
26 /**
27 * @param bool $bypassCache
28 * @return array<string, int>
29 */
30 public function getCapturedStatusCounts($bypassCache = false): array;
31
32 /** @return int */
33 public function getHighImpactCapturedCount(): int;
34
35 /** @return string */
36 public function buildHighImpactCapturedCountQuery(): string;
37
38 /**
39 * @template T
40 * @param callable():T $work
41 * @return T
42 */
43 public function runWithDeferredInvalidation(callable $work);
44
45 /** @return void */
46 public function invalidateStatusCountsCache(): void;
47
48 /** @return void */
49 public function invalidateViewSnapshotCache(): void;
50
51 /** @return void */
52 public function clearRegexRedirectsCache(): void;
53
54 /**
55 * @param int $logID
56 * @return int
57 */
58 public function getLogsCount($logID);
59
60 /** @return array<int, array<string, mixed>> */
61 public function getRedirectsAll();
62
63 /** @param string $tempFile @return void */
64 public function doRedirectsExport(string $tempFile): void;
65
66 /** @return array<int, array<string, mixed>> */
67 public function getRedirectsWithLogs();
68
69 /** @return array<int, array<string, mixed>> */
70 public function getRedirectsWithRegEx();
71
72 /** @return array<int, array<string, mixed>> */
73 public function getManualRedirectsWithRegexMetachars();
74
75 /**
76 * @param string $sub
77 * @param array<string, mixed> $tableOptions
78 * @return array<int|string, mixed>
79 */
80 public function getRedirectsForView($sub, $tableOptions);
81
82 /**
83 * @param string $sub
84 * @param array<string, mixed> $tableOptions
85 * @return bool
86 */
87 public function viewRowsSnapshotAvailable($sub, array $tableOptions): bool;
88
89 /**
90 * @param string $sub
91 * @param array<string, mixed> $tableOptions
92 * @return bool
93 */
94 public function viewTableSnapshotAvailable($sub, array $tableOptions): bool;
95
96 /**
97 * @param string $sub
98 * @param array<string, mixed> $tableOptions
99 * @return int
100 */
101 public function getRedirectsForViewCount(string $sub, array $tableOptions): int;
102
103 /**
104 * @param string $sub
105 * @param array<string, mixed> $tableOptions
106 * @param bool $queryAllRowsAtOnce
107 * @param int $limitStart
108 * @param int $limitEnd
109 * @param bool $selectCountOnly
110 * @return string
111 */
112 public function getRedirectsForViewQuery($sub, $tableOptions, $queryAllRowsAtOnce,
113 $limitStart, $limitEnd, $selectCountOnly);
114
115 /**
116 * @param array<int, string> $postIDs
117 * @return array<int, mixed>
118 */
119 public function getExtraDataToPermalinkSuggestions(array $postIDs): array;
120
121 /**
122 * @param string $query
123 * @param array<string, mixed> $data
124 * @return string
125 */
126 public function prepare_query_wp($query, $data);
127
128 /**
129 * @param string $query
130 * @param array<string, mixed> $data
131 * @return array{0: string, 1: array<int, mixed>}
132 */
133 public function prepare_query($query, $data);
134
135 // --- ViewSnapshotCache (warmup) ---
136
137 /**
138 * @param string $sub
139 * @param array<string, mixed> $tableOptions
140 * @return array<string, mixed>
141 */
142 public function warmViewTableSnapshotStage(string $sub, array $tableOptions): array;
143
144 // --- ViewMetadata (table diagnostics, inserts, counts) ---
145
146 /** @return array<string, mixed> */
147 public function getTableEngines();
148
149 /** @return bool */
150 public function isMyISAMSupported(): bool;
151
152 /**
153 * @param string $tableName
154 * @param array<string, mixed> $dataToInsert
155 * @return array<string, mixed>
156 */
157 public function insertAndGetResults($tableName, $dataToInsert);
158
159 /** @return int */
160 public function getCapturedCount();
161
162 /** @return array<int, string> */
163 public function getAllPostTypes();
164
165 /** @return int */
166 public function getLogDiskUsage();
167
168 /**
169 * @param array<int, int> $types
170 * @param int $trashed
171 * @return int
172 */
173 public function getRecordCount($types = array(), $trashed = 0);
174
175 /**
176 * @param string $sub
177 * @param string $failedQuery
178 * @param array<string, mixed> $tableOptions
179 * @param array<string, mixed> $queryResult
180 * @return array<string, mixed>
181 */
182 public function captureViewQueryFailureDiagnostics(string $sub, string $failedQuery, array $tableOptions, array $queryResult): array;
183
184 // --- ViewQueriesHitsLifecycle ---
185
186 /** @return void */
187 public function maybeUpdateRedirectsForViewHitsTable(): void;
188 }
189