Make WordPress Core

Changeset 42469


Ignore:
Timestamp:
01/16/2018 06:54:17 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.5 branch.
Fixes #42963 for 4.5.

Location:
branches/4.5
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/4.5

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

    r36843 r42469  
    10801080        if ( !$wp_filesystem->exists($old_file) )
    10811081            continue;
    1082         $wp_filesystem->delete($old_file, true);
     1082
     1083        // If the file isn't deleted, try writing an empty string to the file instead.
     1084        if ( ! $wp_filesystem->delete( $old_file, true ) && $wp_filesystem->is_file( $old_file ) ) {
     1085            $wp_filesystem->put_contents( $old_file, '' );
     1086        }
    10831087    }
    10841088
Note: See TracChangeset for help on using the changeset viewer.