Tests: Delete attachment files during test cleanup - #8898
Conversation
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the Core Committers: Use this line as a base for the props when committing in SVN: To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
Test using WordPress PlaygroundThe changes in this pull request can previewed and tested using a WordPress Playground instance. WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser. Some things to be aware of
For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation. |
Delete attachments before the bulk database cleanup so their uploaded files and generated image sizes are removed while attachment metadata is still available. Preserve the existing bulk SQL cleanup for other records. Add regression coverage for attachment file and post deletion. Developed in: #8898 Props sirlouen, johnbillion, adrianmoldovanwp. Fixes #41978. git-svn-id: https://develop.svn.wordpress.org/trunk@63586 602fd350-edb4-49c9-b593-d223f7449a82
Delete attachments before the bulk database cleanup so their uploaded files and generated image sizes are removed while attachment metadata is still available. Preserve the existing bulk SQL cleanup for other records. Add regression coverage for attachment file and post deletion. Developed in: WordPress/wordpress-develop#8898 Props sirlouen, johnbillion, adrianmoldovanwp. Fixes #41978. Built from https://develop.svn.wordpress.org/trunk@63586 git-svn-id: http://core.svn.wordpress.org/trunk@62762 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Delete attachment files before
_delete_all_data()clears the database tables. Callingwp_delete_attachment( $id, true )while attachment metadata still exists removes the uploaded file and its associated image files. Other records retain the existing bulk SQL cleanup.This refreshes the original patch for https://core.trac.wordpress.org/ticket/41978 against current trunk without rewriting the PR history. The attachment query now returns scalar IDs, and the regression test verifies that an existing uploaded file and its attachment post are deleted.
Validation
Validated on 640c25f:
Fresh CI is running on the refreshed head.
Use of AI tools
AI assistance for this refresh: Yes
Tool(s): Codex
Model(s): GPT-6, GPT-5.6
Used for: Reviewing the existing patch, refreshing the branch, simplifying the query, correcting the regression test, running validation, and drafting this update.
This pull request is for code review only. Please keep other discussion in the Trac ticket. Do not merge this pull request.