Recent

Table_Manager class Pro only

Table_Manager

Table Manager class.

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

Methods

__construct()

Constructor.

Since: 4.2.0
Line: 65

public function __construct(  );

check_db_version()

Check DB version and update if needed.

Since: 4.2.0
Line: 78

public function check_db_version(  );

create_content_table_sql()

Create content table SQL.

Since: 4.2.0
Line: 110

public function create_content_table_sql(  ): string;

Returns: string — SQL to create the content table.

add_functional_json_indexes()

Add functional JSON indexes to the content table if supported.

Since: 4.2.0
Line: 153

public function add_functional_json_indexes(  ): bool;

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

get_indexable_post_types()

Get indexable post types.

Since: 4.2.4
Line: 200

public function get_indexable_post_types( int $blog_id = ... ): array;
TypeNameDescription
int$blog_idOptional. 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: 237

public function is_table_installed( $table_name ): bool;
TypeNameDescription
string$table_nameTable name.

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

tables_exist()

Check if custom tables exist.

Since: 4.2.0
Line: 257

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: 268

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: 285

public function maybe_create_table( $table_name, $sql ): bool;
TypeNameDescription
string$table_nameTable name.
string$sqlSQL to create the table.

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

truncate_tables()

Truncate or clear content table.

Since: 4.2.0
Line: 310

public function truncate_tables( $network_wide = ..., $blog_ids = ... ): void;
TypeNameDescription
bool$network_wideWhether to truncate all sites or just current site.
array$blog_idsOptional. 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: 366

public function get_content_count( $blog_id = ... ): int;
TypeNameDescription
int$blog_idBlog 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: 414

public function get_network_content_count( $blog_ids = ... ): int;
TypeNameDescription
array$blog_idsOptional. 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: 440

public function get_post_count( $blog_id = ... ): int;
TypeNameDescription
int$blog_idBlog 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: 473

public function get_network_post_count( $blog_ids = ... ): int;
TypeNameDescription
array$blog_idsOptional. 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: 498

public function get_indexing_percentage( $blog_id = ... ): int;
TypeNameDescription
int$blog_idOptional. 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: 513

public function get_network_indexing_percentage( $blog_ids = ... ): int;
TypeNameDescription
array$blog_idsOptional. 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: 529

public function cleanup_orphaned_records( $network_wide = ..., $blog_ids = ... ): array;
TypeNameDescription
bool$network_wideWhether to clean up all sites or just current site.
array$blog_idsOptional. 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: 627

public function get_missing_post_ids( int $blog_id = ..., int $limit = ... ): array;
TypeNameDescription
int$blog_idBlog ID. Default 0 (current site).
int$limitMaximum number of IDs to return. Default 100.

Returns: array — Array of post IDs.

drop_tables()

Drop custom tables.

Since: 4.2.0
Line: 675

public function drop_tables(  ): void;

Returns: void

recreate_fulltext_indexes()

Recreate FULLTEXT indexes.

Since: 4.2.0
Line: 695

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: 724

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: 749

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: 779

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: 805

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: 830

public function convert_to_innodb(  ): bool;

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

supports_functional_json_indexes() static

Check if the database supports functional indexes on JSON expressions.

Since: 4.2.0
Line: 854

static public function supports_functional_json_indexes(  ): bool;

Returns: bool — True if functional indexes are supported, false otherwise.