Skip to content
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion php/class-media.php
Original file line number Diff line number Diff line change
Expand Up @@ -1477,7 +1477,7 @@ private function create_attachment( $asset, $public_id ) {

$sync_key = $asset['sync_key'];
// Capture public_id. Use core update_post_meta since this attachment data doesnt exist yet.
$this->update_post_meta( $attachment_id, Sync::META_KEYS['public_id'], $public_id );
update_post_meta( $attachment_id, Sync::META_KEYS['public_id'], $public_id );
// Capture version number.
$this->update_post_meta( $attachment_id, Sync::META_KEYS['version'], $asset['version'] );
if ( ! empty( $asset['transformations'] ) ) {
Expand Down
11 changes: 4 additions & 7 deletions php/sync/class-upload-sync.php
Original file line number Diff line number Diff line change
Expand Up @@ -157,14 +157,11 @@ public function handle_bulk_actions( $location, $action, $post_ids ) {
switch ( $action ) {
case 'cloudinary-push':
foreach ( $post_ids as $post_id ) {
if ( ! $this->media->is_local_media( $post_id ) ) {
// Clean up for previous attempts to sync.
$this->sync->delete_cloudinary_meta( $post_id );
continue;
}
if ( ! $this->sync->is_syncable( $post_id ) ) {
continue;
}
// Clean up for previous syncs and start over.
$this->sync->delete_cloudinary_meta( $post_id );
$this->sync->set_signature_item( $post_id, 'file', '' );
$this->media->delete_post_meta( $post_id, Sync::META_KEYS['public_id'] );
$this->sync->add_to_sync( $post_id );
Expand Down Expand Up @@ -271,7 +268,7 @@ function ( $is_synced, $post_id ) use ( $attachment_id ) {
// Set folder Synced.
$this->media->update_post_meta( $attachment_id, Sync::META_KEYS['folder_sync'], $this->media->is_folder_synced( $attachment_id ) );
// Set public_id.
$this->media->update_post_meta( $attachment_id, Sync::META_KEYS['public_id'], $public_id );
update_post_meta( $attachment_id, Sync::META_KEYS['public_id'], $public_id );
// Set version.
$this->media->update_post_meta( $attachment_id, Sync::META_KEYS['version'], $result['version'] );
// Set the delivery type.
Expand Down Expand Up @@ -307,7 +304,7 @@ public function context_update( $attachment_id ) {

if ( ! is_wp_error( $result ) ) {
$this->sync->set_signature_item( $attachment_id, $type );
$this->media->update_post_meta( $attachment_id, Sync::META_KEYS['public_id'], $options['public_id'] );
update_post_meta( $attachment_id, Sync::META_KEYS['public_id'], $options['public_id'] );
}

return $result;
Expand Down