[wp-trac] [WordPress Trac] #54582: Problem with deleting old files at the end of a core update when the filesystem is case-insensitive

WordPress Trac noreply at wordpress.org
Tue Aug 30 01:32:53 UTC 2022


#54582: Problem with deleting old files at the end of a core update when the
filesystem is case-insensitive
-------------------------------------------------+-------------------------
 Reporter:  pbiron                               |       Owner:  (none)
     Type:  defect (bug)                         |      Status:  new
 Priority:  high                                 |   Milestone:  Future
                                                 |  Release
Component:  Upgrade/Install                      |     Version:
 Severity:  major                                |  Resolution:
 Keywords:  needs-testing early early-like-      |     Focuses:
  actually-early has-patch changes-requested     |
  has-testing-info                               |
-------------------------------------------------+-------------------------
Changes (by costdev):

 * keywords:  needs-testing early early-like-actually-early has-patch =>
     needs-testing early early-like-actually-early has-patch changes-
     requested has-testing-info


Comment:

 I did a couple of test runs on Local for Windows and the patch seems to
 work just fine.

 == Testing Instructions
 These steps define how to test [https://github.com/WordPress/wordpress-
 develop/pull/3110 PR 3110], and indicate the expected behavior.

 === Setup
 1. Set up a new test site. **Do not test this on wordpress-develop**.
 2. Create the file `wp-content/mu-plugins/wpcore-force-custom-core-
 package.php` with the following contents:
 {{{#!php
 <?php

 /**
  * Plugin Name: WP Core - Force custom Core package.
  * Description: Forces a custom Core upgrade package for testing.
  * Author:      WordPress Core Contributors
  * Author URI:  https://make.wordpress.org/core
  * License:     GPLv2 or later
  * Version:     1.0.0
  */

 add_filter( 'upgrader_pre_download', 'wpcore_force_custom_core_package',
 10, 2 );
 function wpcore_force_custom_core_package( $reply, $package ) {
         global $wp_version;
         $core_update_str = 'downloads.wordpress.org/release/wordpress-';
         $not_core_update = false === strpos( $package, $core_update_str );
         if ( $not_core_update ) return false;
         return __DIR__ . '/custom-package.zip';
 }
 }}}
 3. Download
 [https://downloads.wordpress.org/release/wordpress-5.9-beta1.zip WordPress
 5.9-beta1.zip].
 4. Copy the ZIP file to `wp-content/mu-plugins/`.
 5. Rename the ZIP file to `custom-package.zip`.
 6. Open the ZIP file and replace the contents of `wp-admin/includes
 /update-core.php` with [https://raw.githubusercontent.com/WordPress
 /wordpress-develop/f9590e712e454208c408b9d4d31d7c99b4184aa3/src/wp-
 admin/includes/update-core.php these contents].
 7. Replace `_cleanup_old_files()` with `_cleanup_old_files();`.
 8. Replace `global $_old_files;` with `global $_old_files,
 $wp_filesystem;`.
 9. Add the following to the bottom of `$_old_files`:
 {{{#!php
 <?php
 'wp-includes/Requests/IRI.php',
 'wp-includes/Requests/SSL.php',
 'wp-includes/Requests/IPv6.php',
 'wp-includes/Requests/Exception/HTTP.php',
 'wp-includes/Requests/Exception/Transport/cURL.php',
 'wp-includes/Requests/Proxy/HTTP.php',
 'wp-includes/Requests/Transport/fsockopen.php',
 'wp-includes/Requests/Transport/cURL.php',
 }}}
 10. Save the `wp-admin/includes/update-core.php` file back into the ZIP.
 11. Make a backup copy of the ZIP (the upgrader will delete the ZIP after
 each update).

 === Steps to Test
 1. Navigate to `Dashboard > Updates` and click the update button. Don't
 worry what version it says.
 2. After the update, navigate to `wp-includes/Requests/`

 === Expected Results
 - ✅ The following files should exist and the filename case should match
 these exactly:
 {{{#!php
 <?php
 'wp-includes/Requests/Iri.php'
 'wp-includes/Requests/Ssl.php'
 'wp-includes/Requests/Ipv6.php'
 'wp-includes/Requests/Exception/Http.php'
 'wp-includes/Requests/Exception/Transport/Curl.php'
 'wp-includes/Requests/Proxy/Http.php'
 'wp-includes/Requests/Transport/Fsockopen.php'
 'wp-includes/Requests/Transport/Curl.php'
 }}}

 === Additional Notes
 - When repeating tests, remember to copy the backup ZIP file to `custom-
 package.zip`.
 - Always retain the backup for future tests.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/54582#comment:45>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list