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-sync.php
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ public function can_sync( $attachment_id, $type = 'file' ) {
public function get_sync_version( $attachment_id ) {
$version = $this->managers['media']->get_post_meta( $attachment_id, self::META_KEYS['plugin_version'], true );

return $version !== $this->plugin->version;
return $version . '-' . $this->plugin->version;
}

/**
Expand Down
10 changes: 10 additions & 0 deletions php/media/class-upgrade.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,16 @@ public function convert_cloudinary_version( $attachment_id ) {
} else {
// v2 upgrade.
$public_id = $this->media->get_public_id( $attachment_id, true );
$suffix = $this->media->get_post_meta( $attachment_id, Sync::META_KEYS['suffix'], true );
if ( ! empty( $suffix ) ) {
// Has suffix. Get delete and cleanup public ID.
if ( false !== strpos( $public_id, $suffix ) ) {
$public_id = str_replace( $suffix, '', $public_id );
}
$public_id .= $suffix;
$this->media->delete_post_meta( $attachment_id, Sync::META_KEYS['suffix'] );
update_post_meta( $attachment_id, Sync::META_KEYS['public_id'], $public_id );
}
// Check folder sync in order.
if ( $this->media->is_folder_synced( $attachment_id ) ) {
$public_id_folder = ltrim( dirname( $this->media->get_public_id( $attachment_id ) ) );
Expand Down
5 changes: 5 additions & 0 deletions php/sync/class-push-sync.php
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,11 @@ public function process_assets( $attachments = array() ) {
}
$stat[ $attachment_id ][ $type ] = $this->sync->run_sync_method( $type, 'sync', $attachment_id );
}
$prev_stat = $this->media->get_post_meta( $attachment_id, Sync::META_KEYS['process_log'], true );
if ( empty( $prev_stat ) ) {
$prev_stat = array();
}
$stat[ $attachment_id ] = array_merge( $prev_stat, $stat );
// remove pending.
delete_post_meta( $attachment_id, Sync::META_KEYS['pending'] );
// Record Process log.
Expand Down