Make WordPress Core

Changeset 42476


Ignore:
Timestamp:
01/16/2018 06:58:02 AM (9 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 3.8 branch.
Fixes #42963 for 3.8.

Location:
branches/3.8
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/3.8

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

    r32410 r42476  
    921921                if ( !$wp_filesystem->exists($old_file) )
    922922                        continue;
    923                 $wp_filesystem->delete($old_file, true);
     923
     924                // If the file isn't deleted, try writing an empty string to the file instead.
     925                if ( ! $wp_filesystem->delete( $old_file, true ) && $wp_filesystem->is_file( $old_file ) ) {
     926                        $wp_filesystem->put_contents( $old_file, '' );
     927                }
    924928        }
    925929
Note: See TracChangeset for help on using the changeset viewer.