Skip to content

Commit 40be42f

Browse files
author
Marco Pereirinha
committed
Cleanup flags
1 parent 8d5796a commit 40be42f

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

cloudinary-image-management-and-manipulation-in-the-cloud-cdn/php/sync/class-push-sync.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -391,6 +391,10 @@ public function prepare_upload( $post, $down_sync = false ) {
391391
$error = sprintf( __( 'File size exceeds the maximum of %s. This media asset will be served from WordPress.', 'cloudinary' ), $max_size_hr );
392392
$media->delete_post_meta( $post->ID, Sync::META_KEYS['pending'] ); // Remove Flag.
393393

394+
// Cleanup flags
395+
delete_post_meta( $post->ID, Sync::META_KEYS['syncing'] );
396+
delete_post_meta( $post->ID, Sync::META_KEYS['downloading'] );
397+
394398
return new \WP_Error( 'upload_error', $error );
395399
}
396400

@@ -629,6 +633,11 @@ public function push_attachments( $attachments ) {
629633
$meta_data[ Sync::META_KEYS['version'] ] = $result['version'];
630634
}
631635
$media->delete_post_meta( $attachment->ID, Sync::META_KEYS['pending'] );
636+
637+
// Cleanup flags
638+
delete_post_meta( $attachment->ID, Sync::META_KEYS['downloading'] );
639+
delete_post_meta( $attachment->ID, Sync::META_KEYS['syncing'] );
640+
632641
$media->delete_post_meta( $attachment->ID, Sync::META_KEYS['sync_error'], false );
633642
if ( ! empty( $this->plugin->config['settings']['global_transformations']['enable_breakpoints'] ) ) {
634643
if ( ! empty( $result['responsive_breakpoints'] ) ) { // Images only.

cloudinary-image-management-and-manipulation-in-the-cloud-cdn/php/sync/class-upload-sync.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,8 @@ public function handle_bulk_actions( $location, $action, $post_ids ) {
145145
delete_post_meta( $post_id, Sync::META_KEYS['sync_error'] );
146146
delete_post_meta( $post_id, Sync::META_KEYS['public_id'] );
147147
delete_post_meta( $post_id, Sync::META_KEYS['pending'] );
148+
delete_post_meta( $post_id, Sync::META_KEYS['downloading'] );
149+
delete_post_meta( $post_id, Sync::META_KEYS['syncing'] );
148150
$file = get_attached_file( $post_id );
149151
wp_generate_attachment_metadata( $post_id, $file );
150152
$this->prep_upload( $post_id );

0 commit comments

Comments
 (0)