MS: Allow for a blog_upload_space setting of 0 to restrict uploads.

Previously, an value matching `empty()` would have been bypassed in favor of the default setting for 100MB.

Related #19538, r19639, r19652, where we saw the bug, fixed the bug, and then unfixed the bug so that it was not a surprise in a point release.

See #34037.


git-svn-id: https://develop.svn.wordpress.org/trunk@35016 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Jeremy Felt 2015-10-10 23:14:11 +00:00
parent 52c2492afb
commit d9edf86faf
3 changed files with 6 additions and 6 deletions

View File

@ -2296,7 +2296,7 @@ function get_space_allowed() {
if ( ! is_numeric( $space_allowed ) )
$space_allowed = get_site_option( 'blog_upload_space' );
if ( empty( $space_allowed ) || ! is_numeric( $space_allowed ) )
if ( ! is_numeric( $space_allowed ) )
$space_allowed = 100;
/**

View File

@ -94,10 +94,10 @@ class Tests_Multisite_Get_Space_Allowed extends WP_UnitTestCase {
array( false, false, 100 ),
array( 'NAN', 'NAN', 100 ),
// These are likely unexpected.
array( 0, 666, 100 ),
array( false, 0, 100 ),
array( 'NAN', 0, 100 ),
// These effectively disable uploads.
array( 0, 666, 0 ),
array( false, 0, 0 ),
array( 'NAN', 0, 0 ),
);
}

View File

@ -102,7 +102,7 @@ class Tests_Multisite_Is_Upload_Space_Available extends WP_UnitTestCase {
$available = is_upload_space_available();
remove_filter( 'pre_get_space_used', array( $this, '_filter_space_used_small' ) );
$this->assertTrue( $available );
$this->assertFalse( $available );
}
function test_is_upload_space_available_upload_space_negative() {