Make WordPress Core

Changeset 42470


Ignore:
Timestamp:
01/16/2018 06:54:44 AM (6 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.4 branch.
Fixes #42963 for 4.4.

Location:
branches/4.4
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/4.4

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

    r35738 r42470  
    10771077        if ( !$wp_filesystem->exists($old_file) )
    10781078            continue;
    1079         $wp_filesystem->delete($old_file, true);
     1079
     1080        // If the file isn't deleted, try writing an empty string to the file instead.
     1081        if ( ! $wp_filesystem->delete( $old_file, true ) && $wp_filesystem->is_file( $old_file ) ) {
     1082            $wp_filesystem->put_contents( $old_file, '' );
     1083        }
    10801084    }
    10811085
Note: See TracChangeset for help on using the changeset viewer.