Recent

Table_ManagerclassPro only

Table_Manager

Table Manager class.

Namespace: WebberZone\Better_Search\Pro\Custom_Tables
Since: 4.2.0
Source: includes/pro/custom-tables/class-table-manager.php line 23

Methods

__construct()

Constructor.

Since: 4.2.0
Line: 118

public function __construct(  );

check_db_version()

Check DB version and update if needed.

Since: 4.2.0
Line: 131

public function check_db_version(  );

has_unpopulated_post_dates()

Whether any indexed row is still missing its publish date.

Since: 4.5.0
Line: 197

public function has_unpopulated_post_dates(  ): bool;

Returns: bool — True when at least one row has a NULL post_date_gmt.

column_exists()

Check whether a column exists on a table.

Since: 4.5.0
Line: 217

public function column_exists( string $table_name, string $column_name ): bool;
Type Name Description
string $table_name Table name.
string $column_name Column name.

Returns: bool — True when the column exists.

is_recency_backfill_complete() static

Whether the post_date_gmt backfill has completed for the shared index.

The flag is network-wide because wz_posts is keyed on base_prefix and spans every site.

Since: 4.5.0
Line: 240

static public function is_recency_backfill_complete(  ): bool;

Returns: bool — True when recency ranking may use the indexed dates.

set_recency_backfill_complete() static

Record whether the post_date_gmt backfill has completed.

Flipping the flag on clears the search result caches so the ranking change is visible immediately rather than when each cached result set happens to expire.

Since: 4.5.0
Line: 255

static public function set_recency_backfill_complete( bool $complete ): void;
Type Name Description
bool $complete Whether the backfill has finished.

Returns: void

create_content_table_sql()

Create content table SQL.

Since: 4.2.0
Line: 273

public function create_content_table_sql(  ): string;

Returns: string — SQL to create the content table.

ensure_taxonomy_indexes()

Create missing taxonomy indexes when the index definition has changed.

An explicit retry bypasses the stored signature so an administrator can retry a previously failed ALTER after fixing the database or permissions.

Since: 4.5.0
Line: 362

public function ensure_taxonomy_indexes( bool $force = ... ): bool;
Type Name Description
bool $force Whether to retry even when the current signature was attempted.

Returns: bool — True when supported indexes were checked successfully.

add_functional_json_indexes()

Add multi-valued JSON indexes to the content table if supported.

Since: 4.2.0
Line: 389

public function add_functional_json_indexes( ?array $taxonomies_to_index = ... ): bool;
Type Name Description
string[]|null $taxonomies_to_index Optional normalized taxonomy names.

Returns: bool — True if indexes were added or not needed, false on error.

index_exists()

Check whether a database index exists.

Since: 4.5.0
Line: 438

public function index_exists( string $table_name, string $index_name ): bool;
Type Name Description
string $table_name Table name.
string $index_name Index name.

Returns: bool — True when the index exists.

get_indexable_post_types()

Get indexable post types.

Since: 4.2.4
Line: 458

public function get_indexable_post_types( int $blog_id = ... ): array;
Type Name Description
int $blog_id Optional. Blog ID for multisite. Default 0 (current site).

Returns: array — Array of post type slugs.

is_table_installed()

Check if the Top Ten table is installed.

Since: 4.2.0
Line: 495

public function is_table_installed( $table_name ): bool;
Type Name Description
string $table_name Table name.

Returns: bool — True if the table exists, false otherwise.

tables_exist()

Check if custom tables exist.

Since: 4.2.0
Line: 515

public function tables_exist(  ): bool;

Returns: bool — True if all required tables exist, false otherwise.

create_tables()

Create custom tables.

Since: 4.2.0
Line: 526

public function create_tables(  ): bool;

Returns: bool — True if tables were created or already exist, false on error.

maybe_create_table()

Create table if not exists.

Since: 4.2.0
Line: 547

public function maybe_create_table( $table_name, $sql, $apply_schema = ... ): bool;
Type Name Description
string $table_name Table name.
string $sql SQL to create the table.
bool $apply_schema Run dbDelta even when the table already exists, so schema

Returns: bool — True if table exists or was created.

truncate_tables()

Truncate or clear content table.

Since: 4.2.0
Line: 572

public function truncate_tables( $network_wide = ..., $blog_ids = ... ): void;
Type Name Description
bool $network_wide Whether to truncate all sites or just current site.
array $blog_ids Optional. Array of blog IDs to clear. Only used in network mode.

Returns: void

get_content_count()

Get content table entry count for current blog.

Since: 4.2.0
Line: 628

public function get_content_count( $blog_id = ... ): int;
Type Name Description
int $blog_id Blog ID.

Returns: int — Number of entries in content table.

get_network_content_count()

Get content table entry count across all blogs.

Since: 4.2.0
Line: 676

public function get_network_content_count( $blog_ids = ... ): int;
Type Name Description
array $blog_ids Optional. Array of blog IDs to count. Default empty array.

Returns: int — Total number of entries in content table.

get_post_count()

Get total published posts count for a blog.

Since: 4.2.0
Line: 702

public function get_post_count( $blog_id = ... ): int;
Type Name Description
int $blog_id Blog ID. Default is current blog.

Returns: int — Number of published posts.

get_network_post_count()

Get total published posts count across all blogs.

Since: 4.2.0
Line: 735

public function get_network_post_count( $blog_ids = ... ): int;
Type Name Description
array $blog_ids Optional. Array of blog IDs to count. Default empty array.

Returns: int — Total number of published posts.

get_indexing_percentage()

Get the indexing percentage for the current site.

Since: 4.2.4
Line: 760

public function get_indexing_percentage( $blog_id = ... ): int;
Type Name Description
int $blog_id Optional. Blog ID for multisite. Default 0 (current site).

Returns: int — Percentage of posts indexed (0-100).

get_network_indexing_percentage()

Get the indexing percentage across multiple sites.

Since: 4.2.4
Line: 775

public function get_network_indexing_percentage( $blog_ids = ... ): int;
Type Name Description
array $blog_ids Optional. Array of blog IDs. Default empty array (all sites).

Returns: int — Percentage of posts indexed (0-100).

cleanup_orphaned_records()

Clean up orphaned records from the custom table.

Since: 4.2.0
Line: 791

public function cleanup_orphaned_records( $network_wide = ..., $blog_ids = ... ): array;
Type Name Description
bool $network_wide Whether to clean up all sites or just current site.
array $blog_ids Optional. Array of blog IDs to clean up. Only used in network mode.

Returns: array — Array with count of deleted records and status.

get_missing_post_ids()

Get published post IDs that are missing from the custom table.

Since: 4.3.0
Line: 889

public function get_missing_post_ids( int $blog_id = ..., int $limit = ... ): array;
Type Name Description
int $blog_id Blog ID. Default 0 (current site).
int $limit Maximum number of IDs to return. Default 100.

Returns: array — Array of post IDs.

drop_tables()

Drop custom tables.

Since: 4.2.0
Line: 937

public function drop_tables(  ): void;

Returns: void

recreate_fulltext_indexes()

Recreate FULLTEXT indexes.

Since: 4.2.0
Line: 957

public function recreate_fulltext_indexes(  ): bool;

Returns: bool — True on success, false on failure.

get_fulltext_indexes()

Get the list of fulltext indexes to be created on the custom content table.

Since: 4.2.0
Line: 986

public function get_fulltext_indexes(  ): array;

Returns: array — Array of fulltext indexes with their respective columns.

drop_fulltext_indexes()

Drop FULLTEXT indexes from the custom content table.

Since: 4.3.0
Line: 1011

public function drop_fulltext_indexes(  ): bool;

Returns: bool — True on success, false on failure.

get_recreate_fulltext_indexes_sql()

Get SQL queries to recreate FULLTEXT indexes on custom tables.

Since: 4.2.0
Line: 1041

public function get_recreate_fulltext_indexes_sql(  ): array;

Returns: array — Array of SQL queries.

get_table_engine()

Get the storage engine of the custom content table.

Since: 4.3.0
Line: 1067

public function get_table_engine(  ): string|false;

Returns: string|false — The engine name (e.g. ‘InnoDB’, ‘MyISAM’) or false on failure.

convert_to_innodb()

Convert the custom content table to InnoDB and recreate FULLTEXT indexes.

Since: 4.3.0
Line: 1092

public function convert_to_innodb(  ): bool;

Returns: bool — True on success, false on failure.

supports_functional_json_indexes() static

Functional indexes cannot index a JSON-valued expression.

Since: 4.2.0
Line: 1117

static public function supports_functional_json_indexes(  ): bool;

Returns: bool — Always false for JSON expressions.

supports_multi_valued_indexes() static

Check if the database supports multi-valued indexes on JSON arrays.

Since: 4.5.0
Line: 1128

static public function supports_multi_valued_indexes(  ): bool;

Returns: bool — True if multi-valued indexes are supported, false otherwise.