Index_Scope_Manager implements Standard_Service, Registerable
Coordinates index rebuilds after Posts Table Pro scope changes.
Tags
Interfaces, Classes and Traits
- Standard_Service
- Registerable
Table of Contents
- DIRTY_OPTION_KEY = 'ptp_index_scope_dirty'
- DIRTY_TOKEN_OPTION_KEY = 'ptp_index_scope_dirty_token'
- LAST_REBUILT_OPTION_KEY = 'ptp_index_scope_last_rebuilt'
- $indexed_post_types : array<string|int, string>|null
- Cached post-type scope for the current request.
- $indexed_post_types_token : string|null
- Dirty token associated with the cached post-type scope.
- filter_index_scope_args() : array<string|int, mixed>
- Replace post types in the shared scope filter with PTP's authoritative scope.
- filter_indexed_search() : bool
- Avoid indexed queries while a scope change is waiting to synchronize.
- handle_option_change() : void
- Handle creation or changes to the dedicated settings option.
- handle_table_generator_response() : mixed
- Mark successful table-generator mutations that may change automatic scope.
- mark_dirty() : void
- Mark the scope for synchronization on the next request.
- register() : mixed
- Register scope filters and deferred synchronization.
- synchronize() : void
- Synchronize the current adapted scope after DataViews has initialized.
- clear_dirty() : void
- Clear the dirty marker after synchronization.
- get_indexed_post_types() : array<string|int, string>
- Resolve the post-type scope once per request.
- is_rebuild_running() : bool
- Check whether the PTP index is being rebuilt.
- is_scope_mutation() : bool
- Determine whether a successful generator response represents a scope mutation.
Constants
DIRTY_OPTION_KEY
public
mixed
DIRTY_OPTION_KEY
= 'ptp_index_scope_dirty'
Tags
DIRTY_TOKEN_OPTION_KEY
public
mixed
DIRTY_TOKEN_OPTION_KEY
= 'ptp_index_scope_dirty_token'
Tags
LAST_REBUILT_OPTION_KEY
public
mixed
LAST_REBUILT_OPTION_KEY
= 'ptp_index_scope_last_rebuilt'
Tags
Properties
$indexed_post_types
Cached post-type scope for the current request.
private
array<string|int, string>|null
$indexed_post_types
Tags
$indexed_post_types_token
Dirty token associated with the cached post-type scope.
private
string|null
$indexed_post_types_token
Tags
Methods
filter_index_scope_args()
Replace post types in the shared scope filter with PTP's authoritative scope.
public
filter_index_scope_args(array<string|int, mixed> $scope_args) : array<string|int, mixed>
Parameters
- $scope_args : array<string|int, mixed>
-
Existing scope arguments.
Tags
Return values
array<string|int, mixed> —filter_indexed_search()
Avoid indexed queries while a scope change is waiting to synchronize.
public
filter_indexed_search(bool $use_indexed, mixed $query, mixed $prefix) : bool
Parameters
- $use_indexed : bool
-
Whether the indexed path is available.
- $query : mixed
-
Current query object.
- $prefix : mixed
-
DataViews plugin prefix or indexed-search arguments.
Tags
Return values
bool —handle_option_change()
Handle creation or changes to the dedicated settings option.
public
handle_option_change(string $option) : void
Parameters
- $option : string
-
Option name.
Tags
Return values
void —handle_table_generator_response()
Mark successful table-generator mutations that may change automatic scope.
public
static handle_table_generator_response(mixed $data, array<string|int, mixed> $class_function, string $status) : mixed
Parameters
- $data : mixed
-
Response data.
- $class_function : array<string|int, mixed>
-
Calling class and method.
- $status : string
-
Response status.
Tags
Return values
mixed —mark_dirty()
Mark the scope for synchronization on the next request.
public
static mark_dirty() : void
Tags
Return values
void —register()
Register scope filters and deferred synchronization.
public
register() : mixed
Tags
Return values
mixed —synchronize()
Synchronize the current adapted scope after DataViews has initialized.
public
synchronize() : void
Tags
Return values
void —clear_dirty()
Clear the dirty marker after synchronization.
private
static clear_dirty(string $dirty_token) : void
Parameters
- $dirty_token : string
-
Token captured when synchronization started.
Tags
Return values
void —get_indexed_post_types()
Resolve the post-type scope once per request.
private
get_indexed_post_types() : array<string|int, string>
Tags
Return values
array<string|int, string> —is_rebuild_running()
Check whether the PTP index is being rebuilt.
private
is_rebuild_running() : bool
Tags
Return values
bool —is_scope_mutation()
Determine whether a successful generator response represents a scope mutation.
private
static is_scope_mutation(array<string|int, mixed> $class_function) : bool
Parameters
- $class_function : array<string|int, mixed>
-
Calling class and method.