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
Original file line number Diff line number Diff line change
Expand Up @@ -404,6 +404,7 @@ public function prepare_upload( $post, $push_sync = false ) {
if ( true === $push_sync ) {
$download = $this->sync->managers['download']->down_sync( $post->ID );
if ( is_wp_error( $download ) ) {
delete_post_meta( $post->ID, Sync::META_KEYS['downloading'] );
update_post_meta( $post->ID, Sync::META_KEYS['sync_error'], $download->get_error_message() );

return new \WP_Error( 'attachment_download_error', $download->get_error_message() );
Expand Down Expand Up @@ -541,7 +542,7 @@ public function prepare_upload( $post, $push_sync = false ) {
$suffix_data = wp_parse_args( $suffix_meta, $suffix_defaults );

// Prepare a uniqueness check and get a suffix if needed.
if ( true === $push_sync ) {
if ( true === $push_sync && true !== $downsync ) {
if ( $public_id !== $suffix_data['public_id'] || empty( $suffix_data['suffix'] ) ) {
$suffix_data['suffix'] = $this->sync->add_suffix_maybe( $public_id, $post->ID );
if ( ! empty( $suffix_data['suffix'] ) ) {
Expand Down Expand Up @@ -681,6 +682,7 @@ public function push_attachments( $attachments ) {
$error = $result->get_error_message();
$stats['fail'][] = $error;
$this->media->update_post_meta( $attachment->ID, Sync::META_KEYS['sync_error'], $error );
delete_post_meta( $attachment->ID, Sync::META_KEYS['syncing'] );
continue;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ public function mark( $id, $type = 'done' ) {
$queue[ $type ][] = '<div>' . basename( $file ) . ': ' . $state->get_error_message() . '</div>';
// Add a flag that this file had an error as to not try process it again.
update_post_meta( $id, Sync::META_KEYS['sync_error'], $state->get_error_message() );
delete_post_meta( $id, Sync::META_KEYS['syncing'], $state->get_error_message() );
}
} else {
if ( ! in_array( $id, $queue[ $type ], true ) ) {
Expand Down