Method |
Description |
|
add ( string $hook, array $args = [], string $priority = 'normal' ) : boolean |
Adds a new job to the Client with the specified arguments and
priority. |
|
build_client ( ) : Client |
Conditionally builds a new Client object. If the constant
WP_GEARS_CLIENT_CLASS is defined it will return an instance of that
class. |
|
build_worker ( ) : Worker |
Conditionally builds a new Worker object. If the constant
WP_GEARS_WORKER_CLASS is defined it will return an instance of
that class. |
|
enable ( ) |
Enables the plugin by registering it's clients and workers. |
|
get_client ( ) : Client |
Returns the Client object used to add jobs. Creates the instance
of the client lazily. |
|
get_config ( string $constant, string $default = '', string $config_prefix = '' ) : mixed |
Helper to pickup config options from Constants with fallbacks. |
|
get_instance ( ) : Plugin |
Returns the singleton instance of the Plugin. Creates the
instance if it is absent. |
|
get_jobs_per_worker ( ) : integer |
Returns the jobs to execute per worker instance |
|
get_worker ( ) |
Returns the Worker object used to execute jobs. Creates the instance
of the worker lazily. |
|
get_wp_load ( ) : string |
Returns the path to the wp-load.php file. |
|
has_config ( string $constant ) : boolean |
Checks if a config option is defined. Empty strings are treated
as an undefined config option. |
|
load_wordpress ( ) |
Tries to load WordPress using wp-load.php. If loading fails an
error message is logged and the Script will exit immediately with
a status code of 1. |
|
quit ( integer $status_code ) |
Helper to quit with a status code. When running under PHPUnit it
returns the status_code instead of exiting immediately. |
|
run ( ) : integer |
Starts processing jobs in the Worker. |
|
work ( ) : integer |
Executes jobs on the current Worker. A Worker will taken up
only one job by default. If WP_GEARS_JOBS_PER_WORKER is defined
that many jobs will be executed before it exits. |
|