WordPress.org

Make WordPress Core

Ticket #42963: 42963.diff

File 42963.diff, 663 bytes (added by joemcgill, 3 years ago)
  • src/wp-admin/includes/update-core.php

    diff --git src/wp-admin/includes/update-core.php src/wp-admin/includes/update-core.php
    index a5947e871e..5f5f30bfc3 100644
    function update_core( $from, $to ) { 
    11791179                if ( ! $wp_filesystem->exists( $old_file ) ) {
    11801180                        continue;
    11811181                }
    1182                 $wp_filesystem->delete( $old_file, true );
     1182
     1183                // If the file isn't deleted, try writing an empty string to the file.
     1184                if ( ! $wp_filesystem->delete( $old_file, true ) && is_file( $old_file ) ) {
     1185                        $wp_filesystem->put_contents( $old_file, '' );
     1186                };
    11831187        }
    11841188
    11851189        // Remove any Genericons example.html's from the filesystem