Skip to content
Corex

MediaRegenerationSource

Corex\Media\MediaRegenerationSource · interface · Add-ons layer

The batch source the {@see MediaRegenerationJob} draws from: the count of image attachments to process, and a single bounded batch of WebP conversions (gather → plan → convert) starting at an offset. Conversions never overwrite an existing sibling or the original (spec 061). Splitting this out keeps the job’s progression logic pure and unit-testable; the WordPress-backed implementation performs the real attachment query and file conversions.

convertBatch(int $offset, int $limit, ?DateTimeImmutable $since): array

Section titled “convertBatch(int $offset, int $limit, ?DateTimeImmutable $since): array”

Convert one bounded batch and report how many succeeded and failed, and each failure by file name with the reason (spec 119). Skipped attachments (already have a sibling, or unsupported) count as neither — they are not failures, except a sibling this run wrote since $since in a step that was stopped before it could count it, which counts as converted.