WordPress.org

Make WordPress Core

Changeset 42466 for branches/4.8


Ignore:
Timestamp:
01/16/2018 06:52:06 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 [42434] to the 4.8 branch.
Fixes #42963 for 4.8.

Location:
branches/4.8
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/4.8

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

    r40880 r42466  
    10881088        if ( !$wp_filesystem->exists($old_file) )
    10891089            continue;
    1090         $wp_filesystem->delete($old_file, true);
     1090
     1091        // If the file isn't deleted, try writing an empty string to the file instead.
     1092        if ( ! $wp_filesystem->delete( $old_file, true ) && $wp_filesystem->is_file( $old_file ) ) {
     1093            $wp_filesystem->put_contents( $old_file, '' );
     1094        }
    10911095    }
    10921096
Note: See TracChangeset for help on using the changeset viewer.