STATUS_COMPLETE
STATUS_COMPLETE = 'complete'
Class ActionScheduler_HybridStore
A wrapper around multiple stores that fetches data from both.
$max_args_length : int
Maximum length of args.
$store : \ActionScheduler_Store
ActionScheduler_Store instance.
$primary_store : \ActionScheduler_Store
Primary store instance.
$secondary_store : \ActionScheduler_Store
Secondary store instance.
$migration_runner : \Action_Scheduler\Migration\Runner
Runner instance.
$demarkation_id : int
The dividing line between IDs of actions created by the primary and secondary stores.
find_action(string $hook, array $params = array()) : string
Find the first matching action from the secondary store.
If it exists, migrate it to the primary store immediately. After it migrates, the secondary store will logically contain the next matching action, so return the result thence.
string | $hook | Action's hook. |
array | $params | Action's arguments. |
query_actions(array $query = array(), string $query_type = 'select') : int[]
Find actions matching the query in the secondary source first.
If any are found, migrate them immediately. Then the secondary store will contain the canonical results.
array | $query | Query arguments. |
string | $query_type | Whether to select or count the results. Default, select. |
stake_claim(int $max_actions = 10, null|\DateTime $before_date = null, string[] $hooks = array(), string $group = '') : \ActionScheduler_ActionClaim
If any actions would have been claimed by the secondary store, migrate them immediately, then ask the primary store for the canonical claim.
int | $max_actions | Maximum number of actions to claim. |
null|\DateTime | $before_date | Latest timestamp of actions to claim. |
string[] | $hooks | Hook of actions to claim. |
string | $group | Group of actions to claim. |
set_autoincrement(string $table_name, string $table_suffix) : void
When the actions table is created, set its autoincrement value to be one higher than the posts table to ensure that there are no ID collisions.
string | $table_name | Table name. |
string | $table_suffix | Suffix of table name. |
get_scheduled_date_string(\ActionScheduler_Action $action, null|\DateTime $scheduled_date = null) : string
Get the time MySQL formatted date/time string for an action's (next) scheduled date.
\ActionScheduler_Action | $action | Action. |
null|\DateTime | $scheduled_date | Action's schedule date (optional). |
get_scheduled_date_string_local(\ActionScheduler_Action|null $action, null|\DateTime $scheduled_date = null) : string
Get the time MySQL formatted date/time string for an action's (next) scheduled date.
\ActionScheduler_Action|null | $action | Action. |
null|\DateTime | $scheduled_date | Action's scheduled date (optional). |
validate_schedule(mixed $schedule, int $action_id) : mixed
Validate a ActionScheduler_Schedule object.
mixed | $schedule | The unserialized ActionScheduler_Schedule object. |
int | $action_id | The action ID. |
When the schedule is invalid.
validate_action(\ActionScheduler_Action $action) : mixed
InnoDB indexes have a maximum size of 767 bytes by default, which is only 191 characters with utf8mb4.
Previously, AS wasn't concerned about args length, as we used the (unindex) post_content column. However, with custom tables, we use an indexed VARCHAR column instead.
\ActionScheduler_Action | $action | Action to be validated. |
When json encoded args is too long.
get_store_from_action_id(int $action_id, bool $primary_first = false) : \ActionScheduler_Store
Return which store an action is stored in.
int | $action_id | ID of the action. |
bool | $primary_first | Optional flag indicating search the primary store first. |
None found |
bulk_cancel_actions(int[] $action_ids) : void
Cancel a set of action IDs.
int[] | $action_ids | List of action IDs. |
since | 3.0.0 |
---|
set_demarkation_id(int $id = null) : int
Store the demarkation id in WP options.
int | $id | The ID to set as the demarkation point between the two stores Leave null to use the next ID from the WP posts table. |
The new ID.
codeCoverageIgnore |
---|
migrate(array $action_ids) : mixed
Migrate a list of actions to the table data store.
array | $action_ids | List of action IDs. |
None found |