Make WordPress Core

Changeset 42433


Ignore:
Timestamp:
01/10/2018 06:09:51 AM (7 years ago)
Author:
dd32
Message:

Upgrade: When deleting old files, if deletion fails attempt to empty the file instead.

Props joemcgill, dd32.
Fixes #42963 for trunk.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/update-core.php

    r42343 r42433  
    11441144            continue;
    11451145        }
    1146         $wp_filesystem->delete( $old_file, true );
     1146
     1147        // If the file isn't deleted, try writing an empty string to the file instead.
     1148        if ( ! $wp_filesystem->delete( $old_file, true ) && $wp_filesystem->is_file( $old_file ) ) {
     1149            $wp_filesystem->put_contents( $old_file, '' );
     1150        }
    11471151    }
    11481152
Note: See TracChangeset for help on using the changeset viewer.