| 1 |
<?php |
| 2 |
|
| 3 |
namespace FlyWP\StaticSite\Engine\Incremental; |
| 4 |
|
| 5 |
/** |
| 6 |
* Writes, reads and clears change rows. |
| 7 |
* |
| 8 |
* @since 1.8.0 |
| 9 |
*/ |
| 10 |
interface ChangeStore { |
| 11 |
|
| 12 |
/** |
| 13 |
* @param string $kind url, delete, list or global. |
| 14 |
* @param string|null $object_type post, term, user, blog, archive, date or null. |
| 15 |
* @param int|null $object_id Object ID. |
| 16 |
* @param string|null $url Absolute URL. |
| 17 |
* @param string $reason Short reason. |
| 18 |
* |
| 19 |
* @return bool False on a database error. |
| 20 |
*/ |
| 21 |
public function insert( $kind, $object_type, $object_id, $url, $reason ); |
| 22 |
|
| 23 |
/** |
| 24 |
* Rows with $after_id < id <= $up_to_id, in ID order. |
| 25 |
* |
| 26 |
* @param int $after_id Last ID of the previous batch. |
| 27 |
* @param int $up_to_id Highest ID to read. |
| 28 |
* @param int $limit Batch size. |
| 29 |
* |
| 30 |
* @return array<int, array{id:int, kind:string, object_type:string|null, object_id:int|null, url:string|null, reason:string}> |
| 31 |
*/ |
| 32 |
public function rows( $after_id, $up_to_id, $limit ); |
| 33 |
|
| 34 |
/** |
| 35 |
* @param int $after_id Lowest ID, not included. |
| 36 |
* @param int $up_to_id Highest ID, included. |
| 37 |
* |
| 38 |
* @return bool True when a global row is in the range. |
| 39 |
*/ |
| 40 |
public function has_global( $after_id, $up_to_id ); |
| 41 |
|
| 42 |
/** |
| 43 |
* @return int Highest row ID, 0 when there are no rows. |
| 44 |
*/ |
| 45 |
public function max_id(); |
| 46 |
|
| 47 |
/** |
| 48 |
* @param int $change_id Highest row ID to delete. |
| 49 |
* |
| 50 |
* @return bool False on a database error. |
| 51 |
*/ |
| 52 |
public function clear_up_to( $change_id ); |
| 53 |
} |
| 54 |
|