Constants

LOG_TABLE

LOG_TABLE = 'actionscheduler_logs'

Properties

$schema_version

$schema_version : int

Schema version.

Increment this value to trigger a schema update.

Type

normal

$db_version

$db_version : string

Schema version stored in database.

Type

normal

$tables

$tables : array

Names of tables that will be registered by this class.

Type

normal

Methods

init()

init() : mixed

Performs additional setup work required to support this schema.

Returns

mixed

register_tables()

register_tables(bool  $force_update = false) : void

Register tables with WordPress, and create them if needed.

Parameters

bool $force_update

Optional. Default false. Use true to always run the schema update.

tables_exist()

tables_exist() : bool

Confirms that all of the tables registered by this schema class have been created.

Returns

bool

__construct()

__construct() : mixed

Construct.

Returns

mixed

update_schema_3_0()

update_schema_3_0(string  $table, string  $db_version) : mixed

Update the logs table schema, allowing datetime fields to be NULL.

This is needed because the NOT NULL constraint causes a conflict with some versions of MySQL configured with sql_mode=NO_ZERO_DATE, which can for instance lead to tables not being created.

Most other schema updates happen via ActionScheduler_Abstract_Schema::update_table(), however that method relies on dbDelta() and this change is not possible when using that function.

Parameters

string $table

Name of table being updated.

string $db_version

The existing schema version of the table.

Returns

mixed

get_table_definition()

get_table_definition(string  $table) : string

Get table definition.

Parameters

string $table

Table name.

Returns

string —

The CREATE TABLE statement, suitable for passing to dbDelta

get_full_table_name()

get_full_table_name(string  $table) : string

Get full table name.

Parameters

string $table

Table name.

Returns

string —

The full name of the table, including the table prefix for the current blog

schema_update_required()

schema_update_required() : bool

Determine if the database schema is out of date by comparing the integer found in $this->schema_version with the option set in the WordPress options table

Returns

bool

mark_schema_update_complete()

mark_schema_update_complete() : void

Update the option in WordPress to indicate that our schema is now up to date

update_table()

update_table(string  $table) : void

Update the schema for the given table

Parameters

string $table

The name of the table to update.