PluginProbe
Media Cloud Sync / 1.4.2
Media Cloud Sync v1.4.2
1.4.2 1.4.1 1.4.0 1.3.12 1.3.11 1.3.10 trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.1.0 1.1.1 1.2.0 1.2.10 1.2.11 1.2.12 1.2.13 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.2.7 1.2.8 All 36 releases
← All changes | includes/compatbility/compatibility.php +30 -2 1.4.0 → 1.4.2 View file →
@@ -50,8 +50,9 @@
50 50 add_filter( 'wpmcs_get_attached_file_noop', array( $this, 'image_editor_download_file' ), 10, 4 );
51 51 add_filter( 'wpmcs_get_attached_file', array( $this, 'image_editor_download_file' ), 10, 4 );
52 52 add_filter( 'wpmcs_get_attached_file', array( $this, 'customizer_crop_download_file' ), 10, 4 );
53 53 add_filter( 'wpmcs_pre_update_item_additional_files_to_remove_from_server', [ $this, 'customizer_crop_remove_restored_files' ], 10, 5 );
54 + add_filter( 'wpmcs_do_reupload_media', [ $this, 'force_reupload_on_image_editor_save' ], 10, 3 );
54 55
55 56 /*
56 57 * WP_Customize_Control
57 58 * /wp-includes/class-wp-customize_control.php
@@ -201,11 +202,32 @@
201 202
202 203 return $url;
203 204 }
204 205
206 + /**
207 + * A flip or 180° rotation changes pixel content without changing any
208 + * declared width/height, which shouldForceReupload() can't detect —
209 + * force it explicitly for any image-editor commit (save or restore).
210 + * @since 1.4.3
211 + */
212 + public function force_reupload_on_image_editor_save($do_reupload, $attachment_id, $source_type) {
213 + if ($do_reupload) {
214 + return $do_reupload;
215 + }
205 216
217 + $action = Utils::filter_input('action', INPUT_GET) ?: Utils::filter_input('action', INPUT_POST);
218 + $do = Utils::filter_input('do', INPUT_POST);
206 219
220 + if (in_array($do, ['save', 'restore'], true) && in_array($action, ['image-editor', 'imgedit-preview'], true)) {
221 + return true;
222 + }
207 223
224 + return $do_reupload;
225 + }
226 +
227 +
228 +
229 +
208 230 /**
209 231 * Called after REST API callback, and removes server files from the server for routes that need it.
210 232 *
211 233 * @param WP_HTTP_Response $response The response object.
@@ -468,15 +490,21 @@
468 490 * the attachment's file should be.
469 491 *
470 492 * @return string|bool File if downloaded, false on failure
471 493 */
472 - private function copy_provider_file_to_server($attachment_id, $file) {
494 + public function copy_provider_file_to_server($attachment_id, $file) {
473 495 // Download files
474 496 if (!Item::instance()->moveToServerBySourcePath($attachment_id, $file, 'media_library')) {
475 497 return false;
476 - }
498 + }
477 499
478 500 $this->restored_files[] = $file;
501 +
502 + // Shared with woocommerce.php — feeds the same pre_update_item pipeline as
503 + // below when a save happens this request, with a shutdown fallback for the
504 + // other three callers here (image editor, legacy copy-back, Regenerate
505 + // Thumbnails pre-v3), which otherwise have no cleanup at all.
506 + Item::instance()->track_restored_for_cleanup( [ $file ] );
479 507
480 508 return $file;
481 509 }
482 510