STATUS_COMPLETE
STATUS_COMPLETE = 'complete'
Class ActionScheduler_DBStore
Action data table data store.
$max_args_length : int
Maximum length of args.
$max_index_length : int
Maximum length of index.
$claim_filters : array
List of claim filters.
$store : \ActionScheduler_Store
ActionScheduler_Store instance.
$claim_before_date : \DateTime|null
Used to share information about the before_date property of claims internally.
This is used in preference to passing the same information as a method param for backwards-compatibility reasons.
save_action(\ActionScheduler_Action $action, \DateTime|null $scheduled_date = null) : int
Save an action. Can save duplicate action as well, prefer using `save_unique_action` instead.
\ActionScheduler_Action | $action | Action object. |
\DateTime|null | $scheduled_date | Optional schedule date. Default null. |
Throws exception when saving the action fails.
Action ID.
find_action(string $hook, array $params = array()) : string|null
Find an action.
Note: the query ordering changes based on the passed 'status' value.
string | $hook | Action hook. |
array | $params | Parameters of the action to find. |
ID of the next action matching the criteria or NULL if not found.
query_actions(array $query = array(), string $query_type = 'select') : string|array|null
Query for action count or list of action IDs.
array | $query | Query filtering options. |
string | $query_type | Whether to select or count the results. Defaults to select. |
The IDs of actions matching the query. Null on failure.
stake_claim(int $max_actions = 10, \DateTime|null $before_date = null, array $hooks = array(), string $group = '') : \ActionScheduler_ActionClaim
Stake a claim on actions.
int | $max_actions | Maximum number of action to include in claim. |
\DateTime|null | $before_date | Jobs must be schedule before this date. Defaults to now. |
array | $hooks | Hooks to filter for. |
string | $group | Group to filter for. |
save_unique_action(\ActionScheduler_Action $action, \DateTime|null $scheduled_date = null) : int
Save an action, checks if this is a unique action before actually saving.
\ActionScheduler_Action | $action | Action object. |
\DateTime|null | $scheduled_date | Optional schedule date. Default null. |
Throws exception when saving the action fails.
Action ID.
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.
hash_args(string $args) : string
Generate a hash from json_encoded $args using MD5 as this isn't for security.
string | $args | JSON encoded action args. |
None found |
get_args_for_query(array $args) : string
Get action args query param value from action args.
array | $args | Action args. |
None found |
get_group_ids(string|array $slugs, bool $create_if_not_exists = true) : array
Get a group's ID based on its name/slug.
string|array | $slugs | The string name of a group, or names for several groups. |
bool | $create_if_not_exists | Whether to create the group if it does not already exist. Default, true - create the group. |
The group IDs, if they exist or were successfully created. May be empty.
None found |
create_group(string $slug) : int
Create an action group.
string | $slug | Group slug. |
Group ID.
None found |
get_null_action() : \ActionScheduler_NullAction
Create a null action.
None found |
make_action_from_db_record(object $data) : \ActionScheduler_Action|\ActionScheduler_CanceledAction|\ActionScheduler_FinishedAction
Create an action from a database record.
object | $data | Action database record. |
None found |
get_query_actions_sql(array $query, string $select_or_count = 'select') : string
Returns the SQL statement to query (or count) actions.
array | $query | Filtering options. |
string | $select_or_count | Whether the SQL should select and return the IDs or just the row count. |
If the query is invalid.
When "unknown partial args matching value".
SQL statement already properly escaped.
since |
3.3.0 $query['status'] accepts array of statuses instead of a single status. |
---|
get_date_gmt(int $action_id) : \DateTime
Get the GMT schedule date for an action.
int | $action_id | Action ID. |
If action cannot be identified.
The GMT date the action is scheduled to run, or the date that it ran.
None found |
None found |
claim_actions(string $claim_id, int $limit, \DateTime|null $before_date = null, array $hooks = array(), string $group = '') : int
Mark actions claimed.
string | $claim_id | Claim Id. |
int | $limit | Number of action to include in claim. |
\DateTime|null | $before_date | Should use UTC timezone. |
array | $hooks | Hooks to filter for. |
string | $group | Group to filter for. |
Throws InvalidArgumentException if group doesn't exist.
Throws RuntimeException if unable to claim action.
The number of actions that were claimed.
None found |
save_action_to_db(\ActionScheduler_Action $action, ?\DateTime $date = null, bool $unique = false) : int
Save an action.
\ActionScheduler_Action | $action | Action object. |
?\DateTime | $date | Optional schedule date. Default null. |
bool | $unique | Whether the action should be unique. |
Throws exception when saving the action fails.
Action ID.
None found |
build_insert_sql(array $data, bool $unique) : string
Helper function to build insert query.
array | $data | Row data for action. |
bool | $unique | Whether the action should be unique. |
Insert query.
None found |
build_where_clause_for_insert(array $data, string $table_name, bool $unique) : string
Helper method to build where clause for action insert statement.
array | $data | Row data for action. |
string | $table_name | Action table name. |
bool | $unique | Where action should be unique. |
Where clause to be used with insert.
None found |
get_placeholder_for_column(string $column_name) : string
Helper method to get $wpdb->prepare placeholder for a given column name.
string | $column_name | Name of column in actions table. |
Placeholder to use for given column.
None found |