-
Notifications
You must be signed in to change notification settings - Fork 57
Add automatic cleanup of old core files using WordPress $_old_files list #299
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
Copilot
wants to merge
15
commits into
main
Choose a base branch
from
copilot/add-delete-old-core-files
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
…ication Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add command to delete old core files after update
Add automatic cleanup of old core files using WordPress $_old_files list
Nov 7, 2025
Copilot finished work on behalf of
swissspidy
November 7, 2025 17:20
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
Copilot finished work on behalf of
swissspidy
November 7, 2025 21:36
Contributor
|
we also need to check that this will not cause a regression of #196 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When checksums are unavailable for a WordPress version/locale combination,
wp core updatewarns users to manually cleanup old files. This PR uses WordPress core's$_old_filesglobal array to automatically cleanup these files instead.Changes
Modified
cleanup_extra_files()to use fallback strategy:$_old_filesfor unconditional cleanup$_old_filesfor files not tracked in checksumsAdded cleanup methods:
cleanup_old_files()- deletes all files from$_old_fileswhen checksums unavailablecleanup_old_files_not_in_checksums()- supplements checksum cleanup by removing$_old_filesentries not in checksum arraysget_old_files_list()- centralizes access towp-admin/includes/update-core.phpand$_old_filesarrayremove_old_files_from_list()- shared helper method that handles file/directory removal with path validation (eliminates code duplication)remove_directory()- recursive directory removal with path validation, symlink handling, and error handlingSecurity & Safety features:
realpath()fails (prevents path traversal attacks)Behavior changes:
wp core update --version=3.1 --forcenow shows "Cleaning up files..." instead of "Warning: Checksums not available for WordPress 3.1/en_US. Please cleanup files manually."All cleanup operations skip wp-content directory (user data) and log debug messages on failure.
Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.