RemoteInboxNotificationsEngine
extends RemoteSpecsEngine
in package
Remote Inbox Notifications engine.
This goes through the specs and runs (creates admin notes) for those specs that are able to be triggered.
Table of Contents
- STORED_STATE_OPTION_NAME = 'wc_remote_inbox_notifications_stored_state'
- WCA_UPDATED_OPTION_NAME = 'wc_remote_inbox_notifications_wca_updated'
- get_note_from_db() : Note
- Get the note. This is used to display localized note.
- get_stored_state() : object
- Gets the stored state option, and does the initial set up if it doesn't already exist.
- init() : mixed
- Initialize the engine.
- log_errors() : mixed
- Log errors.
- on_admin_init() : mixed
- Init is continued via admin_init so that WC is loaded when the product query is used, otherwise the query generates a "0 = 1" in the WHERE condition and thus doesn't return any results.
- on_init() : mixed
- An init hook is used here so that StoredStateSetupForProducts can set up a hook that gets triggered by action-scheduler - this is needed because the admin_init hook doesn't get triggered by WP Cron.
- run() : mixed
- Go through the specs and run them.
- run_on_deactivated_plugin() : mixed
- The deactivated_plugin hook happens before the option is updated (https://github.com/WordPress/WordPress/blob/master/wp-admin/includes/plugin.php#L826) so this captures the deactivated plugin path and pushes it into the PluginsProvider.
- run_on_woocommerce_admin_updated() : mixed
- Set an option indicating that WooCommerce Admin has just been updated, run the specs, then clear that option. This lets the WooCommerceAdminUpdatedRuleProcessor trigger on WCA update.
- update_profile_option() : mixed
- This is triggered when the profile option is updated and if the profiler is being completed, triggers a run of the engine.
- update_stored_state() : mixed
- Update the stored state option.
Constants
STORED_STATE_OPTION_NAME
public
mixed
STORED_STATE_OPTION_NAME
= 'wc_remote_inbox_notifications_stored_state'
WCA_UPDATED_OPTION_NAME
public
mixed
WCA_UPDATED_OPTION_NAME
= 'wc_remote_inbox_notifications_wca_updated'
Methods
get_note_from_db()
Get the note. This is used to display localized note.
public
static get_note_from_db(Note $note_from_db) : Note
Parameters
- $note_from_db : Note
-
The note object created from db.
Return values
Note — The note.get_stored_state()
Gets the stored state option, and does the initial set up if it doesn't already exist.
public
static get_stored_state() : object
Return values
object — The stored state option.init()
Initialize the engine.
public
static init() : mixed
Return values
mixed —log_errors()
Log errors.
public
static log_errors([array<string|int, mixed> $errors = array() ]) : mixed
Parameters
- $errors : array<string|int, mixed> = array()
-
Array of errors from \Throwable interface.
Return values
mixed —on_admin_init()
Init is continued via admin_init so that WC is loaded when the product query is used, otherwise the query generates a "0 = 1" in the WHERE condition and thus doesn't return any results.
public
static on_admin_init() : mixed
Return values
mixed —on_init()
An init hook is used here so that StoredStateSetupForProducts can set up a hook that gets triggered by action-scheduler - this is needed because the admin_init hook doesn't get triggered by WP Cron.
public
static on_init() : mixed
Return values
mixed —run()
Go through the specs and run them.
public
static run() : mixed
Return values
mixed —run_on_deactivated_plugin()
The deactivated_plugin hook happens before the option is updated (https://github.com/WordPress/WordPress/blob/master/wp-admin/includes/plugin.php#L826) so this captures the deactivated plugin path and pushes it into the PluginsProvider.
public
static run_on_deactivated_plugin(string $plugin) : mixed
Parameters
- $plugin : string
-
Path to the plugin file relative to the plugins directory.
Return values
mixed —run_on_woocommerce_admin_updated()
Set an option indicating that WooCommerce Admin has just been updated, run the specs, then clear that option. This lets the WooCommerceAdminUpdatedRuleProcessor trigger on WCA update.
public
static run_on_woocommerce_admin_updated() : mixed
Return values
mixed —update_profile_option()
This is triggered when the profile option is updated and if the profiler is being completed, triggers a run of the engine.
public
static update_profile_option(mixed $old_value, mixed $new_value) : mixed
Parameters
- $old_value : mixed
-
Old value.
- $new_value : mixed
-
New value.
Return values
mixed —update_stored_state()
Update the stored state option.
public
static update_stored_state(object $stored_state) : mixed
Parameters
- $stored_state : object
-
The stored state.