Make WordPress Core

Changeset 25776


Ignore:
Timestamp:
10/14/2013 08:57:28 PM (10 years ago)
Author:
nacin
Message:

Account for possible failures by disk_free_space(), as well as the potential need to copy the unzipped files.

see #25576.

File:
1 edited

Legend:

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

    r25774 r25776  
    619619    }
    620620
     621    /*
     622     * disk_free_space() could return false. Assume that any falsey value is an error.
     623     * A disk that has zero free bytes has bigger problems.
     624     * Require we have enough space to unzip the file and copy its contents, with a 10% buffer.
     625     */
    621626    $available_space = disk_free_space( WP_CONTENT_DIR );
    622     if ( ( $uncompressed_size * 1.2 ) > $available_space )
     627    if ( $available_space && ( $uncompressed_size * 2.1 ) > $available_space )
    623628        return new WP_Error( 'disk_full_unzip_file', __( 'Could not copy files. You may have run out of disk space.' ), compact( 'uncompressed_size', 'available_space' ) );
    624629
     
    714719    }
    715720
     721    /*
     722     * disk_free_space() could return false. Assume that any falsey value is an error.
     723     * A disk that has zero free bytes has bigger problems.
     724     * Require we have enough space to unzip the file and copy its contents, with a 10% buffer.
     725     */
    716726    $available_space = disk_free_space( WP_CONTENT_DIR );
    717     if ( ( $uncompressed_size * 1.2 ) > $available_space )
     727    if ( $available_space && ( $uncompressed_size * 2.1 ) > $available_space )
    718728        return new WP_Error( 'disk_full_unzip_file', __( 'Could not copy files. You may have run out of disk space.' ), compact( 'uncompressed_size', 'available_space' ) );
    719729
Note: See TracChangeset for help on using the changeset viewer.