| 1 |
<?php |
| 2 |
|
| 3 |
if (!defined('ABSPATH')) { |
| 4 |
exit; |
| 5 |
} |
| 6 |
|
| 7 |
/** |
| 8 |
* Public contract for published-content lookups and permalink/spelling cache operations. |
| 9 |
* |
| 10 |
* Extracted from DataAccess in Phase 1 of the DataAccess refactor. Callers that |
| 11 |
* need published-content queries, permalink cache reads/writes, or spelling |
| 12 |
* cache operations program against this interface. |
| 13 |
*/ |
| 14 |
interface ABJ_404_Solution_ContentRepositoryInterface { |
| 15 |
|
| 16 |
// ========================================================================= |
| 17 |
// Published content lookups (from DataAccessTrait_PublishedContent) |
| 18 |
// ========================================================================= |
| 19 |
|
| 20 |
/** |
| 21 |
* @param string $slug |
| 22 |
* @param string $searchTerm |
| 23 |
* @param string $limitResults |
| 24 |
* @param string $orderResults |
| 25 |
* @param string $extraWhereClause |
| 26 |
* @return array<int, object> |
| 27 |
*/ |
| 28 |
public function getPublishedPagesAndPostsIDs($slug = '', $searchTerm = '', |
| 29 |
$limitResults = '', $orderResults = '', $extraWhereClause = ''); |
| 30 |
|
| 31 |
/** @return array<int, object> */ |
| 32 |
public function getPublishedImagesIDs(); |
| 33 |
|
| 34 |
/** |
| 35 |
* @param string|null $slug |
| 36 |
* @param int|null $limit |
| 37 |
* @return array<int, object> |
| 38 |
*/ |
| 39 |
public function getPublishedTags($slug = null, $limit = null); |
| 40 |
|
| 41 |
/** |
| 42 |
* @param array<int, object> $rows |
| 43 |
* @return array<int, object> |
| 44 |
*/ |
| 45 |
public function addURLToTermsRows($rows); |
| 46 |
|
| 47 |
/** |
| 48 |
* @param int|null $term_id |
| 49 |
* @param string|null $slug |
| 50 |
* @param int|null $limit |
| 51 |
* @return array<int, object> |
| 52 |
*/ |
| 53 |
public function getPublishedCategories($term_id = null, $slug = null, $limit = null); |
| 54 |
|
| 55 |
// ========================================================================= |
| 56 |
// Permalink cache (from DataAccessTrait_Maintenance + DataAccessTrait_Stats) |
| 57 |
// ========================================================================= |
| 58 |
|
| 59 |
/** @return void */ |
| 60 |
public function truncatePermalinkCacheTable(): void; |
| 61 |
|
| 62 |
/** @param int $post_id @return void */ |
| 63 |
public function removeFromPermalinkCache(int $post_id): void; |
| 64 |
|
| 65 |
/** |
| 66 |
* @param int|string $id |
| 67 |
* @return string|null |
| 68 |
*/ |
| 69 |
public function getPermalinkFromCache($id); |
| 70 |
|
| 71 |
/** |
| 72 |
* @param array<int, int> $ids |
| 73 |
* @return array<int, object> |
| 74 |
*/ |
| 75 |
public function getPermalinksByIds(array $ids); |
| 76 |
|
| 77 |
/** |
| 78 |
* @param int|string $id |
| 79 |
* @return array<string, mixed>|null |
| 80 |
*/ |
| 81 |
public function getPermalinkEtcFromCache($id); |
| 82 |
|
| 83 |
/** @return array<int, array<string, mixed>>|null */ |
| 84 |
public function getIDsNeededForPermalinkCache(); |
| 85 |
|
| 86 |
/** @return array<string, mixed> */ |
| 87 |
public function updatePermalinkCache(); |
| 88 |
|
| 89 |
/** @return array<string, mixed> */ |
| 90 |
public function updatePermalinkCacheParentPages(); |
| 91 |
|
| 92 |
/** @return int */ |
| 93 |
public function getPermalinkCacheCount(): int; |
| 94 |
|
| 95 |
// ========================================================================= |
| 96 |
// Spelling cache (from DataAccessTrait_Maintenance) |
| 97 |
// ========================================================================= |
| 98 |
|
| 99 |
/** |
| 100 |
* @param string $requestedURLRaw |
| 101 |
* @param mixed $returnValue |
| 102 |
* @return void |
| 103 |
*/ |
| 104 |
public function storeSpellingPermalinksToCache(string $requestedURLRaw, $returnValue): void; |
| 105 |
|
| 106 |
/** |
| 107 |
* @param string $requestedURLRaw |
| 108 |
* @return mixed |
| 109 |
*/ |
| 110 |
public function getSpellingPermalinksFromCache(string $requestedURLRaw); |
| 111 |
|
| 112 |
/** @return void */ |
| 113 |
public function deleteSpellingCache(): void; |
| 114 |
|
| 115 |
// ========================================================================= |
| 116 |
// Old slug lookup (from DataAccessTrait_Maintenance) |
| 117 |
// ========================================================================= |
| 118 |
|
| 119 |
/** |
| 120 |
* @param int|string $post_id |
| 121 |
* @return string|null |
| 122 |
*/ |
| 123 |
public function getOldSlug($post_id); |
| 124 |
} |
| 125 |
|