core-command icon indicating copy to clipboard operation
core-command copied to clipboard

Way to delete old core files after core update

Open wojsmol opened this issue 6 years ago • 6 comments

Feature Request

Describe your use case and the problem you are facing Currently there is no way to delete old core files if during the update checksums for target WP version and locale aren't available. Describe the solution you'd like Command or a flag to delete old core files. A clear and concise description of what you want to happen. A way to delete old core files after core update exists.

wojsmol avatar Nov 13 '19 17:11 wojsmol

WP-CLI currently diffs the old checksums against the new checksums to decide what left-overs to purge in https://github.com/wp-cli/core-command/blob/1fa06e0cdb5d378585a69d01c94ad2d33278cf28/src/Core_Command.php#L1350-L1393

However, for combinations of locales & versions that we don't have checksums available, this just fails with a message that cleaning up by hand is required.

However, WordPress provides a list of files that are supposed to be deleted and deletes them by default on update: https://github.com/WordPress/wordpress-develop/blob/a216b6d83845dc4cdd01ff517cdf36b72043b6b3/src/wp-admin/includes/update-core.php#L20-L791

We should combine this data with the checksums, to use the checksums to only delete old files when they have not been modified, and to unconditionally delete old files when we don't have checksums to verify for modifications.

schlessera avatar Nov 19 '19 17:11 schlessera

I assume my problem goes in the same direction Warning: Checksums not available for WordPress 5.9/de_DE. Please cleanup files manually. Is this still something to be considered fixing as the issue is open since 2 years?

Aaron-Ritter avatar Jan 25 '22 22:01 Aaron-Ritter

@Aaron-Ritter Message posted by you is caused by the same issue. AFAIK the issue is still considered to be fixed.

wojsmol avatar Jan 25 '22 23:01 wojsmol

thanks @wojsmol at least that confirms my finding :) I was wondering if there is an alternative solutions, the Wordpress Updates are in the meantime often scheduled for fully automatic upgrades too, so maybe I could trigger that particular job through wp cli instead avoiding the wp core update all together.

Aaron-Ritter avatar Jan 25 '22 23:01 Aaron-Ritter

@Aaron-Ritter This is indeed still an issue. The latest update for this is that release 5.9 showed that the WordPress update process is broken as well and will be rethought for 6.0. Hopefully, that rethinking can also include WP-CLI-usable logic that just works.

schlessera avatar Jan 26 '22 15:01 schlessera