Silence PHP warnings from disk_free_space(). disk_free_space() will produce a warning in error conditions in addition to returning false, this includes a case where the bytes free is greater than PHP_INT_MAX (which is a error condition we don't need to check).
See #25576, #22704 Built from https://develop.svn.wordpress.org/trunk@25831 git-svn-id: http://core.svn.wordpress.org/trunk@25831 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
412f9dffd4
commit
8abd2f86d5
|
@ -622,7 +622,7 @@ 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.
|
||||||
*/
|
*/
|
||||||
$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' ) );
|
||||||
|
|
||||||
|
@ -722,7 +722,7 @@ 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.
|
||||||
*/
|
*/
|
||||||
$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' ) );
|
||||||
|
|
||||||
|
|
|
@ -773,7 +773,7 @@ function update_core($from, $to) {
|
||||||
|
|
||||||
// If we don't have enough free space, it isn't worth trying again.
|
// If we don't have enough free space, it isn't worth trying again.
|
||||||
// Unlikely to be hit due to the check in unzip_file().
|
// Unlikely to be hit due to the check in unzip_file().
|
||||||
$available_space = disk_free_space( ABSPATH );
|
$available_space = @disk_free_space( ABSPATH );
|
||||||
if ( $available_space && $total_size >= $available_space ) {
|
if ( $available_space && $total_size >= $available_space ) {
|
||||||
$result = new WP_Error( 'disk_full', __( 'There is not enough free disk space to complete the update.' ) );
|
$result = new WP_Error( 'disk_full', __( 'There is not enough free disk space to complete the update.' ) );
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue