Make WordPress Core

Changeset 42468


Ignore:
Timestamp:
01/16/2018 06:53:28 AM (7 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.6 branch.
Fixes #42963 for 4.6.

Location:
branches/4.6
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/4.6

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

    r38243 r42468  
    10821082        if ( !$wp_filesystem->exists($old_file) )
    10831083            continue;
    1084         $wp_filesystem->delete($old_file, true);
     1084
     1085        // If the file isn't deleted, try writing an empty string to the file instead.
     1086        if ( ! $wp_filesystem->delete( $old_file, true ) && $wp_filesystem->is_file( $old_file ) ) {
     1087            $wp_filesystem->put_contents( $old_file, '' );
     1088        }
    10851089    }
    10861090
Note: See TracChangeset for help on using the changeset viewer.