Make WordPress Core


Ignore:
Timestamp:
09/06/2022 11:26:45 AM (21 months ago)
Author:
spacedmonkey
Message:

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/ms-functions.php

    r53251 r54080  
    114114 */
    115115function get_blog_count( $network_id = null ) {
    116     return get_network_option( $network_id, 'blog_count' );
     116    return (int) get_network_option( $network_id, 'blog_count' );
    117117}
    118118
     
    26552655     * @param int $space_allowed Upload quota in megabytes for the current blog.
    26562656     */
    2657     return apply_filters( 'get_space_allowed', $space_allowed );
     2657    return (int) apply_filters( 'get_space_allowed', $space_allowed );
    26582658}
    26592659
Note: See TracChangeset for help on using the changeset viewer.