-
Notifications
You must be signed in to change notification settings - Fork 2.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Multisite: Show upload space usage for a subsite #8303
base: trunk
Are you sure you want to change the base?
Conversation
Adds functionality to display space usage information for a sub site, to the superadmin in 'Edit site' and to the sub site administration in the media gallery pages.
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the Core Committers: Use this line as a base for the props when committing in SVN:
To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
Test using WordPress PlaygroundThe changes in this pull request can previewed and tested using a WordPress Playground instance. WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser. Some things to be aware of
For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation. |
I added some commits to fix a handful of WPCS issues. |
Phew, all the coding standard issues are now fixed 😅 |
This pull request fixes the issues descripted in the
Trac ticket: https://core.trac.wordpress.org/ticket/60549
In superadmin 'Edit site' page:
and also displays space usage information to the sub site administration in the media gallery pages.
This update introduces a new function, get_space_usage(), which enhances the way WordPress reports upload space usage for a site. The function calculates the space used for uploads and provides a detailed or simplified report based on whether the upload space check is enabled or disabled.
When upload space check is disabled: The function returns a simple message showing the space used in megabytes (e.g., "500 MB Space Used").
When upload space check is enabled: The function provides a more detailed report, including the percentage of space used and the total space allowed (e.g., "Used: 500 MB (50%) of 1 GB").
This enhancement improves transparency and usability for site administrators by offering clearer insights into their site's storage usage. The function also uses localization-friendly strings, ensuring compatibility with multilingual setups.
Technical Details:
The function get_space_usage() leverages existing helper functions like get_space_used(), get_space_allowed(), and size_format() to calculate and format the space usage.
The function respects the upload_space_check_disabled site option to determine the level of detail in the output.
This change is backward-compatible and does not affect existing functionality. It is particularly useful for multisite networks where storage management is critical.
The following images show the visual changes to the various pages.
In "Edit site"

In 'Dashboard'



Before the suggested changes, when the upload_space_check_disabled site option was enabled, the admin had no information about the storage space.
After the suggested changes:
In 'Media Gallery'


In media upload pages


