WordPress.org

Make WordPress Core

Changeset 42434 for branches/4.9


Ignore:
Timestamp:
01/10/2018 06:10:59 AM (3 years ago)
Author:
dd32
Message:

Upgrade: When deleting old files, if deletion fails attempt to empty the file instead.

Props joemcgill, dd32.
Merges [42433] to the 4.9 branch.
Fixes #42963 for 4.9.

Location:
branches/4.9
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/4.9

  • branches/4.9/src/wp-admin/includes/update-core.php

    r42015 r42434  
    11191119        if ( !$wp_filesystem->exists($old_file) )
    11201120            continue;
    1121         $wp_filesystem->delete($old_file, true);
     1121
     1122        // If the file isn't deleted, try writing an empty string to the file instead.
     1123        if ( ! $wp_filesystem->delete( $old_file, true ) && $wp_filesystem->is_file( $old_file ) ) {
     1124            $wp_filesystem->put_contents( $old_file, '' );
     1125        }
    11221126    }
    11231127
Note: See TracChangeset for help on using the changeset viewer.