fix(uploads): reclaim abandoned front-submit attachments

Mark new regular and chunked uploads as pending and claim persisted article references, including partial saves and large reference sets. Protect associated media from cleanup and add upload lifecycle regression coverage.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
kate522andClaude Fable 5 committed 2026-10-30 21:57:46 +08:00
1 parent f9b7997ec2
commit 32ac2112b0
10 files changed
+960 -26

No files matched your search

+1 -2
View File
@@ -38,8 +38,6 @@ class FrontSubmit {
add_action('wp_ajax_nopriv_aksrt_submit_post', [$this, 'ajax_submit_post']);
add_action('rest_api_init', [$this, 'register_rest_routes']);
add_action('aksrt_new_add_posts', [$this, 'sync_post_attachments']);
add_action('aksrt_new_edit_posts', [$this, 'sync_post_attachments']);
add_filter('body_class', [$this, 'body_class']);
add_filter('wp_robots', [$this, 'robots_noindex']);
@@ -231,6 +229,7 @@ class FrontSubmit {
return new \WP_Error('aksrt_upload_failed', __('上传后无法读取文件。', 'aksrt'), ['status' => 500]);
}
\AKSRT\Attachment\PendingUploads::mark($attachment_id);
$attachment['success'] = true;
return new \WP_REST_Response($attachment, 201);
}