Make WordPress Core

Changeset 42471


Ignore:
Timestamp:
01/16/2018 06:55:18 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.3 branch.
Fixes #42963 for 4.3.

Location:
branches/4.3
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/4.3

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

    r33626 r42471  
    10681068        if ( !$wp_filesystem->exists($old_file) )
    10691069            continue;
    1070         $wp_filesystem->delete($old_file, true);
     1070
     1071        // If the file isn't deleted, try writing an empty string to the file instead.
     1072        if ( ! $wp_filesystem->delete( $old_file, true ) && $wp_filesystem->is_file( $old_file ) ) {
     1073            $wp_filesystem->put_contents( $old_file, '' );
     1074        }
    10711075    }
    10721076
Note: See TracChangeset for help on using the changeset viewer.