Data
Reads and erases the data stored by the plugin.
Namespace: WebberZone\WFP\Util
Since: 3.4.0
Source: includes/util/class-data.php line 24
Methods
get_option_names() static
Every option name the plugin creates on a site.
Since: 3.4.0
Line: 71
static public function get_option_names( ): array;
Returns: array — Array of option names.
count_tracked_posts() static
Count the posts that hold tracking data.
Since: 3.4.0
Line: 92
static public function count_tracked_posts( ): int;
Returns: int — Number of posts with tracking data.
get_tracking_batch() static
Read a batch of tracking data, ordered by post ID.
Uses keyset pagination rather than OFFSET so that rows written while the export runs cannot shift the window and duplicate a row.
Since: 3.4.0
Line: 115
static public function get_tracking_batch( int $after_post_id = ..., int $limit = ... ): array;
| Type | Name | Description |
|---|---|---|
int |
$after_post_id |
Return source posts with an ID greater than this. Pass 0 to start. |
int |
$limit |
Maximum number of rows to read. |
Returns: array — int, last_id: int, posts: array<int, int[]>} Batch of tracking data.
prime_batch_caches() static
Prime the post cache for every post referenced in a batch.
Turns the per-cell get_post() lookups that follow into cache hits.
Since: 3.4.0
Line: 195
static public function prime_batch_caches( array $posts ): array;
| Type | Name | Description |
|---|---|---|
array |
$posts |
Returns: array — The post IDs that were primed, to hand back to forget_post_ids().
prime_post_ids() static
Prime the post cache for a list of post IDs.
Since: 3.4.0
Line: 207
static public function prime_post_ids( array $ids ): array;
| Type | Name | Description |
|---|---|---|
array |
$ids |
Returns: array — The post IDs that were primed.
forget_post_ids() static
Drop posts from the object cache once a batch has been written.
Without this the export holds on to every post it primes, so memory grows with the size of the site instead of staying flat.
Since: 3.4.0
Line: 228
static public function forget_post_ids( array $ids ): void;
| Type | Name | Description |
|---|---|---|
int[] |
$ids |
Post IDs to forget. |
Returns: void
get_export_columns() static
Column headings for the detailed export.
Since: 3.4.0
Line: 241
static public function get_export_columns( ): array;
Returns: array — Array of column headings.
build_detailed_rows() static
Build the detailed export rows for a batch.
One row per source post to followed post pair. Position 1 is the most recently followed post, matching the order the tracker stores.
Since: 3.4.0
Line: 268
static public function build_detailed_rows( array $posts ): array;
| Type | Name | Description |
|---|---|---|
array |
$posts |
Returns: array — array<int, int|string>> Rows ready to be written as CSV.
delete_tracking_data() static
Delete the tracking data and the cached output that derives from it.
Settings are left untouched.
Since: 3.4.0
Line: 344
static public function delete_tracking_data( ): int;
Returns: int — Number of posts that held tracking data.
delete_cache_data() static
Delete every cache post meta key the plugin has written.
Deletes by key rather than with a single DELETE ... LIKE so that the
post meta cache is invalidated along with the rows.
Since: 3.4.0
Line: 363
static public function delete_cache_data( ): int;
Returns: int — Number of distinct cache keys deleted.
delete_all_data() static
Delete every trace of the plugin on the current site.
Used by both the Tools page and uninstall.php, so that the two can
never drift apart.
Since: 3.4.0
Line: 394
static public function delete_all_data( ): void;
Returns: void