Networks and Sites: Use metadata api in `*_network_options functions.

Replace logic found in `get_network_option`, `update_network_option` and `delete_network_option` to use the metadata api. Using the metadata api has a number of benefits, such as consistency, default values and useful filters. This change also improves performance by priming the caches of all network options in a single database request. 

Props spacedmonkey, swissspidy, sc0ttkclark, johnjamesjacoby, flixos90, jeremyfelt, pento, peterwilsoncc, mukesh27, desrosj.
Fixes #37181

git-svn-id: https://develop.svn.wordpress.org/trunk@54080 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Jonny Harris
2022-09-06 11:26:45 +00:00
parent bb0cbe3f55
commit bfbbf4928f
9 changed files with 330 additions and 272 deletions

View File

@@ -113,7 +113,7 @@ function get_active_blog_for_user( $user_id ) {
* @return int Number of active sites on the network.
*/
function get_blog_count( $network_id = null ) {
return get_network_option( $network_id, 'blog_count' );
return (int) get_network_option( $network_id, 'blog_count' );
}
/**
@@ -2654,7 +2654,7 @@ function get_space_allowed() {
*
* @param int $space_allowed Upload quota in megabytes for the current blog.
*/
return apply_filters( 'get_space_allowed', $space_allowed );
return (int) apply_filters( 'get_space_allowed', $space_allowed );
}
/**