| @@ -468,15 +468,21 @@ | ||
| 468 | 468 | * the attachment's file should be. |
| 469 | 469 | * |
| 470 | 470 | * @return string|bool File if downloaded, false on failure |
| 471 | 471 | */ |
| 472 | - private function copy_provider_file_to_server($attachment_id, $file) { | |
| 472 | + public function copy_provider_file_to_server($attachment_id, $file) { | |
| 473 | 473 | // Download files |
| 474 | 474 | if (!Item::instance()->moveToServerBySourcePath($attachment_id, $file, 'media_library')) { |
| 475 | 475 | return false; |
| 476 | - } | |
| 476 | + } | |
| 477 | 477 | |
| 478 | 478 | $this->restored_files[] = $file; |
| 479 | + | |
| 480 | + // Shared with woocommerce.php — feeds the same pre_update_item pipeline as | |
| 481 | + // below when a save happens this request, with a shutdown fallback for the | |
| 482 | + // other three callers here (image editor, legacy copy-back, Regenerate | |
| 483 | + // Thumbnails pre-v3), which otherwise have no cleanup at all. | |
| 484 | + Item::instance()->track_restored_for_cleanup( [ $file ] ); | |
| 479 | 485 | |
| 480 | 486 | return $file; |
| 481 | 487 | } |
| 482 | 488 | |