Only enforce disk free space checks when doing background updates.

see #25652.

Built from https://develop.svn.wordpress.org/trunk@25869


git-svn-id: http://core.svn.wordpress.org/trunk@25869 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Andrew Nacin 2013-10-24 22:59:29 +00:00
parent 5361a8abca
commit d61e188f23
1 changed files with 10 additions and 6 deletions

View File

@ -622,9 +622,11 @@ function _unzip_file_ziparchive($file, $to, $needed_dirs = array() ) {
* A disk that has zero free bytes has bigger problems. * A disk that has zero free bytes has bigger problems.
* Require we have enough space to unzip the file and copy its contents, with a 10% buffer. * Require we have enough space to unzip the file and copy its contents, with a 10% buffer.
*/ */
if ( defined( 'DOING_CRON' ) && DOING_CRON ) {
$available_space = @disk_free_space( WP_CONTENT_DIR ); $available_space = @disk_free_space( WP_CONTENT_DIR );
if ( $available_space && ( $uncompressed_size * 2.1 ) > $available_space ) if ( $available_space && ( $uncompressed_size * 2.1 ) > $available_space )
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' ) ); 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' ) );
}
$needed_dirs = array_unique($needed_dirs); $needed_dirs = array_unique($needed_dirs);
foreach ( $needed_dirs as $dir ) { foreach ( $needed_dirs as $dir ) {
@ -722,9 +724,11 @@ function _unzip_file_pclzip($file, $to, $needed_dirs = array()) {
* A disk that has zero free bytes has bigger problems. * A disk that has zero free bytes has bigger problems.
* Require we have enough space to unzip the file and copy its contents, with a 10% buffer. * Require we have enough space to unzip the file and copy its contents, with a 10% buffer.
*/ */
if ( defined( 'DOING_CRON' ) && DOING_CRON ) {
$available_space = @disk_free_space( WP_CONTENT_DIR ); $available_space = @disk_free_space( WP_CONTENT_DIR );
if ( $available_space && ( $uncompressed_size * 2.1 ) > $available_space ) if ( $available_space && ( $uncompressed_size * 2.1 ) > $available_space )
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' ) ); 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' ) );
}
$needed_dirs = array_unique($needed_dirs); $needed_dirs = array_unique($needed_dirs);
foreach ( $needed_dirs as $dir ) { foreach ( $needed_dirs as $dir ) {