WooCommerce Code Reference

WC_Regenerate_Images_Request extends WC_Background_Process
in package

Class that extends WC_Background_Process to process image regeneration in the background.

Table of Contents

$attachment_id  : int
Stores the attachment ID being processed.
__construct()  : mixed
Initiate new background process.
adjust_intermediate_image_sizes()  : array
Returns the sizes we want to regenerate.
delete_all_batches()  : WC_Background_Process
Delete all batches.
filter_image_sizes_to_only_missing_thumbnails()  : array
Filters the list of thumbnail sizes to only include those which have missing files.
is_running()  : bool
Is job running?
kill_process()  : mixed
Kill process.
schedule_cron_healthcheck()  : array
Schedule cron healthcheck.
batch_limit_exceeded()  : bool
Limit each task ran per batch to 1 for image regen.
complete()  : void
This runs once the job has completed all items on the queue.
get_batch()  : stdClass
Get batch.
get_memory_limit()  : int
Get memory limit.
handle()  : mixed
Handle.
is_queue_empty()  : bool
Is queue empty.
is_regeneratable()  : bool
Determines whether an attachment can have its thumbnails regenerated.
task()  : bool
Code to execute for each item in the queue

Properties

Methods

adjust_intermediate_image_sizes()

Returns the sizes we want to regenerate.

public adjust_intermediate_image_sizes(array $sizes) : array
Parameters
$sizes : array

Sizes to generate.

Return values
array

filter_image_sizes_to_only_missing_thumbnails()

Filters the list of thumbnail sizes to only include those which have missing files.

public filter_image_sizes_to_only_missing_thumbnails(array $sizes, array $metadata[, int $attachment_id = null ]) : array
Parameters
$sizes : array

An associative array of registered thumbnail image sizes.

$metadata : array

An associative array of fullsize image metadata: width, height, file.

$attachment_id : int = null

Attachment ID. Only passed from WP 5.0+.

Return values
arrayAn associative array of image sizes.

is_regeneratable()

Determines whether an attachment can have its thumbnails regenerated.

protected is_regeneratable(WP_Post $attachment) : bool

Adapted from Regenerate Thumbnails by Alex Mills.

Parameters
$attachment : WP_Post

An attachment's post object.

Return values
boolWhether the given attachment can have its thumbnails regenerated.