Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/Media_Command.php
Original file line number Diff line number Diff line change
Expand Up @@ -720,7 +720,12 @@ private function needs_regeneration( $att_id, $fullsizepath, $is_pdf, $image_siz
// Warn unless PDF or non-standard image.
if ( ! $is_pdf && is_array( $metadata ) && ! empty( $metadata['sizes'] ) ) {
WP_CLI::warning( sprintf( '%s (ID %d)', $image_sizes->get_error_message(), $att_id ) );
} elseif ( $is_pdf ) {
WP_CLI::log( sprintf( 'Skipping PDF file (ID %d)', $att_id ) );
} elseif ( ! is_array( $metadata ) || empty( $metadata ) ) {
WP_CLI::log( sprintf( 'No metadata (ID %d)', $att_id ) );
Comment on lines +724 to +726
Copy link

Copilot AI Feb 3, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These new log lines are emitted specifically in the image_no_editor WP_Error branch, but the messages don’t mention the actual reason ($image_sizes->get_error_message() / no editor available). In particular, “Skipping PDF file” implies all PDFs are skipped, and “No metadata” isn’t the cause of skipping here. Consider logging an info-level message that includes the underlying image_no_editor reason (and optionally the file type/metadata state) so the output accurately explains why regeneration was skipped.

Suggested change
WP_CLI::log( sprintf( 'Skipping PDF file (ID %d)', $att_id ) );
} elseif ( ! is_array( $metadata ) || empty( $metadata ) ) {
WP_CLI::log( sprintf( 'No metadata (ID %d)', $att_id ) );
WP_CLI::log( sprintf( 'Skipping PDF file (ID %d) due to: %s', $att_id, $image_sizes->get_error_message() ) );
} elseif ( ! is_array( $metadata ) || empty( $metadata ) ) {
WP_CLI::log( sprintf( 'Skipping file with no metadata (ID %d) due to: %s', $att_id, $image_sizes->get_error_message() ) );

Copilot uses AI. Check for mistakes.
Comment on lines +724 to +726
Copy link

Copilot AI Feb 3, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR adds new user-visible skip reason output (PDF + empty metadata), but there are existing Behat scenarios in features/media-regenerate.feature for skipped SVG/PDF regeneration that don’t assert these new messages. Please add/extend a scenario to cover the new log lines so regressions in skip-reason reporting are caught.

Copilot uses AI. Check for mistakes.
}

$skip_it = true;
return false;
}
Expand Down
Loading