From 822be4a1fc0d9976abaabfa9675a12e8e69eb5f0 Mon Sep 17 00:00:00 2001 From: MiljenkoR Date: Thu, 13 Jun 2024 12:17:32 +0200 Subject: [PATCH 1/2] Add skip verbosity for PDF and empty metadata --- src/Media_Command.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Media_Command.php b/src/Media_Command.php index 8275cb45..c92d8f44 100644 --- a/src/Media_Command.php +++ b/src/Media_Command.php @@ -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 ) ); + } else if ( $is_pdf ) { + WP_CLI::warning( sprintf( 'Skipping PDF file (ID %d)', $att_id ) ); + } else if ( ! is_array( $metadata ) || empty($metadata) ) { + WP_CLI::warning( sprintf( 'No metadata (ID %d)', $att_id ) ); } + $skip_it = true; return false; } From 0ca1e37f27131109a0d460b3e5798c04ffa67dfb Mon Sep 17 00:00:00 2001 From: MiljenkoR Date: Thu, 13 Jun 2024 14:49:49 +0200 Subject: [PATCH 2/2] Change log level; Fix CS --- src/Media_Command.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Media_Command.php b/src/Media_Command.php index c92d8f44..90b22e05 100644 --- a/src/Media_Command.php +++ b/src/Media_Command.php @@ -720,10 +720,10 @@ 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 ) ); - } else if ( $is_pdf ) { - WP_CLI::warning( sprintf( 'Skipping PDF file (ID %d)', $att_id ) ); - } else if ( ! is_array( $metadata ) || empty($metadata) ) { - WP_CLI::warning( sprintf( 'No metadata (ID %d)', $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 ) ); } $skip_it = true;