Recent

Table_Manager class Pro only

Table_Manager

Table Manager class.

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

Methods

__construct()

Constructor.

Since: 4.0.0
Line: 66

public function __construct(  );

check_db_version()

Check DB version and update if needed.

Since: 4.0.0
Line: 79

public function check_db_version(  );

create_content_table_sql()

Create content table SQL.

Since: 4.0.0
Line: 115

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.0.0
Line: 158

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.2
Line: 205

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.0.0
Line: 242

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

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

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.0.0
Line: 290

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.0.0
Line: 315

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.0.0
Line: 371

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.0.0
Line: 419

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.0.0
Line: 445

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.0.0
Line: 478

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.1
Line: 503

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.1
Line: 518

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.0.0
Line: 534

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.2.3
Line: 632

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.0.0
Line: 680

public function drop_tables(  ): void;

Returns: void

recreate_fulltext_indexes()

Recreate FULLTEXT indexes.

Since: 4.0.0
Line: 700

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

public function get_fulltext_indexes(  ): array;

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

is_fulltext_indexes_installed()

Check if all FULLTEXT indexes are installed on the custom content table.

Since: 4.2.4
Line: 754

public function is_fulltext_indexes_installed(  ): bool;

Returns: bool — True if all indexes exist, false if any are missing.

get_recreate_custom_tables_sql()

Get SQL queries to drop and recreate the custom tables.

Since: 4.2.4
Line: 783

public function get_recreate_custom_tables_sql(  ): array;

Returns: array — Array of SQL queries.

get_recreate_fulltext_indexes_sql()

Get SQL queries to recreate FULLTEXT indexes on custom tables.

Since: 4.0.0
Line: 806

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.2.4
Line: 830

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.2.4
Line: 855

public function convert_to_innodb(  ): bool;

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

is_supported_db_version() static

Check if the database version supports the custom table schema.

The schema requires JSON columns and generated stored columns: MySQL 5.7.8+ or MariaDB 10.2.7+.

Since: 4.2.4
Line: 911

static public function is_supported_db_version(  ): bool;

Returns: bool — True if the database version is supported.

supports_functional_json_indexes() static

Check if the database supports functional indexes on JSON expressions.

Since: 4.0.0
Line: 930

static public function supports_functional_json_indexes(  ): bool;

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