Recent

Table_ManagerclassPro only

Table_Manager

Table Manager class.

Namespace: WebberZone\Contextual_Related_Posts\Pro\Custom_Tables
Since: 4.0.0
Source: includes/pro/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: 118

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

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

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

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

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

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

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

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

truncate_tables()

Truncate or clear content table.

Since: 4.0.0
Line: 327

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

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

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

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

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

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

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

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

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

public function drop_tables(  ): void;

Returns: void

recreate_fulltext_indexes()

Recreate FULLTEXT indexes.

Since: 4.0.0
Line: 712

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

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

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

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

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

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

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

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

static public function supports_functional_json_indexes(  ): bool;

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