WooCommerce Code Reference

Search results

WC_Background_Updater extends WC_Background_Process

WC_Background_Updater Class.

Table of Contents

__construct() Initiate new background process. mixed
dispatch() Dispatch updater. mixed
handle_cron_healthcheck() Handle cron healthcheck mixed
schedule_event() Schedule fallback event. mixed
is_updating() Is the updater running? bool
task() Task string|bool
complete() Complete mixed
is_memory_exceeded() See if the batch limit has been exceeded. bool
is_queue_empty() Is queue empty. bool
get_batch() Get batch. stdClass
batch_limit_exceeded() See if the batch limit has been exceeded. bool
handle() Handle. mixed
get_memory_limit() Get memory limit. int
schedule_cron_healthcheck() Schedule cron healthcheck. array
delete_all_batches() Delete all batches. WC_Background_Process
kill_process() Kill process. mixed

Methods

dispatch()

Dispatch updater.

public dispatch( ) : mixed

Updater will still run via cron job if this fails for any reason.

Return values
mixed

handle_cron_healthcheck()

Handle cron healthcheck

public handle_cron_healthcheck( ) : mixed

Restart the background process if not already running and data exists in the queue.

Return values
mixed

task()

Task

protected task( $callback : string ) : string|bool

Override this method to perform any actions required on each queue item. Return the modified item for further processing in the next pass through. Or, return false to remove the item from the queue.

Parameters
$callback : string

Update callback function.

Return values
string|bool

complete()

Complete

protected complete( ) : mixed

Override if applicable, but ensure that the below actions are performed, or, call parent::complete().

Return values
mixed

is_memory_exceeded()

See if the batch limit has been exceeded.

public is_memory_exceeded( ) : bool
Return values
bool

get_batch()

Get batch.

protected get_batch( ) : stdClass
Return values
stdClass

Return the first batch from the queue.

batch_limit_exceeded()

See if the batch limit has been exceeded.

protected batch_limit_exceeded( ) : bool
Return values
bool

handle()

Handle.

protected handle( ) : mixed

Pass each queue item to the task handler, while remaining within server memory and time limit constraints.

Return values
mixed

schedule_cron_healthcheck()

Schedule cron healthcheck.

public schedule_cron_healthcheck( $schedules : array ) : array
Parameters
$schedules : array

Schedules.

Return values
array

kill_process()

Kill process.

public kill_process( ) : mixed

Stop processing queue items, clear cronjob and delete all batches.

Return values
mixed
Back to the top