WordPress.org

Make WordPress Core

Opened 7 years ago

Closed 6 years ago

Last modified 6 years ago

#23650 closed enhancement (fixed)

make get_space_allowed() filterable

Reported by: jkudish Owned by: nacin
Milestone: 3.7 Priority: normal
Severity: normal Version: 3.4
Component: Multisite Keywords: has-patch
Focuses: Cc:
PR Number:

Description

When the blog_upload_space option is set to 0, instead of returning 0, get_space_allowed() returns the default value which is currently hardcoded to 50 in core.

As discussed in #18119 and committed in [19314], the function should return 0 if the option is set to 0. However this was reverted in [19654] (see #19538). So I am not sure which is the desired behaviour.

The attached patch adds filters for the default value and for the returned value. This is useful for scenarios where you don't want it to fallback to 50 if the option is accidentally set to 0, and you want to set your own default.

I can adjust the patch if the consensus is that an option of 0 should in fact return 0.

Attachments (2)

23650.diff (547 bytes) - added by jkudish 7 years ago.
23650.2.diff (502 bytes) - added by nacin 6 years ago.

Download all attachments as: .zip

Change History (9)

@jkudish
7 years ago

#1 @SergeyBiryukov
7 years ago

  • Component changed from Upload to Multisite

#2 @jeremyfelt
6 years ago

  • Milestone changed from Awaiting Review to 3.7

Moving to 3.7 for discussion. Patch applies ok

#3 @nacin
6 years ago

I wonder if this actually needs there to be a filter for the default. That is basically just a fallback for when the blog_upload_space network-wide option doesn't exist, and it really really should exist. (It is also 100MB as of [20170], and this 50 should too become 100). There is so little logic in get_space_allowed() that a single filter at the bottom should be sufficient.

@nacin
6 years ago

#4 @nacin
6 years ago

I'm game for 23650.2.diff, any objections?

#5 @jeremyfelt
6 years ago

Looks good to me.

#6 @nacin
6 years ago

  • Owner set to nacin
  • Resolution set to fixed
  • Status changed from new to closed

In 25092:

Multisite: Add a filter to get_space_allowed() and increase its internal default value to the network default.

props jkudish for initial patch.
fixes #23650.

#7 @nacin
6 years ago

In 25111:

Multisite tests: Update default space allowed in get_space_allowed(). see #23650, [25092].

Note: See TracTickets for help on using tickets.