Skip to content

Commit b207038

Browse files
committed
update offloading signature logic
1 parent 1fccbd6 commit b207038

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

composer.lock

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

inc/cli/cli_media.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ private function update_images_template( $action ) {
4646
if ( $settings->get( 'offload_media' ) === 'disabled' ) {
4747
return \WP_CLI::error( __( 'You need to have the offload_media option enabled in order to use this command', 'optimole-wp' ) );
4848
}
49+
50+
Optml_Media_Offload::clear_offload_errors_meta();
4951
WP_CLI::line( $strings[ $action ]['info'] );
5052
$number_of_images_for = 'offload_images';
5153
if ( $action === 'rollback' ) {
@@ -54,6 +56,11 @@ private function update_images_template( $action ) {
5456
$number_of_images = Optml_Media_Offload::number_of_images_and_pages( $number_of_images_for );
5557
Optml_Media_Offload::record_process_meta( $number_of_images );
5658
$batch = 5;
59+
if ( $number_of_images === 0 ) {
60+
WP_CLI::success( $strings[ $action ]['success'] );
61+
62+
return;
63+
}
5764
$possible_batch = ceil( $number_of_images / 10 );
5865
if ( $possible_batch < $batch ) {
5966
$batch = $possible_batch;

0 commit comments

Comments
 (0)