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<string|int, mixed>
Returns the sizes we want to regenerate.
delete_all_batches()  : WC_Background_Process
Delete all batches.
filter_image_sizes_to_only_missing_thumbnails()  : array<string|int, mixed>
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<string|int, mixed>
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<string|int, mixed> $sizes) : array<string|int, mixed>
Parameters
$sizes : array<string|int, mixed>

Sizes to generate.

Return values
array<string|int, mixed>

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<string|int, mixed> $sizes, array<string|int, mixed> $metadata[, int $attachment_id = null ]) : array<string|int, mixed>
Parameters
$sizes : array<string|int, mixed>

An associative array of registered thumbnail image sizes.

$metadata : array<string|int, mixed>

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

$attachment_id : int = null

Attachment ID. Only passed from WP 5.0+.

Return values
array<string|int, mixed>An associative array of image sizes.

schedule_cron_healthcheck()

Schedule cron healthcheck.

public schedule_cron_healthcheck(array<string|int, mixed> $schedules) : array<string|int, mixed>
Parameters
$schedules : array<string|int, mixed>

Schedules.

Return values
array<string|int, mixed>

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.