mirror of
https://github.com/WordPress/WordPress.git
synced 2024-11-15 07:05:37 +01:00
Upgrade: When deleting old files, if deletion fails attempt to empty the file instead.
Props joemcgill, dd32. Merges [42434] to the 4.7 branch. Fixes #42963 for 4.7. Built from https://develop.svn.wordpress.org/branches/4.7@42467 git-svn-id: http://core.svn.wordpress.org/branches/4.7@42296 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
5abbd8a7b5
commit
5c6ad6022c
@ -1084,7 +1084,11 @@ function update_core($from, $to) {
|
|||||||
$old_file = $to . $old_file;
|
$old_file = $to . $old_file;
|
||||||
if ( !$wp_filesystem->exists($old_file) )
|
if ( !$wp_filesystem->exists($old_file) )
|
||||||
continue;
|
continue;
|
||||||
$wp_filesystem->delete($old_file, true);
|
|
||||||
|
// If the file isn't deleted, try writing an empty string to the file instead.
|
||||||
|
if ( ! $wp_filesystem->delete( $old_file, true ) && $wp_filesystem->is_file( $old_file ) ) {
|
||||||
|
$wp_filesystem->put_contents( $old_file, '' );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remove any Genericons example.html's from the filesystem
|
// Remove any Genericons example.html's from the filesystem
|
||||||
|
Loading…
Reference in New Issue
Block a user