Make WordPress Core

Changeset 57016


Ignore:
Timestamp:
10/27/2023 12:00:15 AM (12 months ago)
Author:
peterwilsoncc
Message:

Options, Meta APIs: Rename option cache priming functions.

Rename the option cache priming functions to more closely follow the naming convention used by other cache priming functions.

  • wp_load_options() becomes wp_prime_option_caches()
  • wp_load_options_by_group() becomes wp_prime_option_caches_by_group()

The unit test files and classes are renamed accordingly.

Unlike the existing cache priming functions, these functions were introduced with the intention of being public so use the wp_ prefix rather than the _ prefix used by the functions initially introduced as private functions but since made public.

Follow up to [56445],[56990].

Props flixos90, peterwilsoncc, joemcgill, SergeyBiryukov, desrosj.
Reviewed by flixos90.
Merges [57013] to the 6.4 branch.
Fixes #58962.

Location:
branches/6.4
Files:
2 deleted
2 edited
2 copied

Legend:

Unmodified
Added
Removed
  • branches/6.4

  • branches/6.4/src/wp-includes/option.php

    r57004 r57016  
    249249
    250250/**
    251  * Loads specific options into the cache with a single database query.
     251 * Primes specific options into the cache with a single database query.
    252252 *
    253253 * Only options that do not already exist in cache will be loaded.
     
    259259 * @param array $options An array of option names to be loaded.
    260260 */
    261 function wp_load_options( $options ) {
     261function wp_prime_option_caches( $options ) {
    262262    $alloptions     = wp_load_alloptions();
    263263    $cached_options = wp_cache_get_multiple( $options, 'options' );
     
    322322
    323323/**
    324  * Loads all options registered with a specific option group.
     324 * Primes the cache of all options registered with a specific option group.
    325325 *
    326326 * @since 6.4.0
     
    330330 * @param string $option_group The option group to load options for.
    331331 */
    332 function wp_load_options_by_group( $option_group ) {
     332function wp_prime_option_caches_by_group( $option_group ) {
    333333    global $new_allowed_options;
    334334
    335335    if ( isset( $new_allowed_options[ $option_group ] ) ) {
    336         wp_load_options( $new_allowed_options[ $option_group ] );
     336        wp_prime_option_caches( $new_allowed_options[ $option_group ] );
    337337    }
    338338}
     
    349349 */
    350350function get_options( $options ) {
    351     wp_load_options( $options );
     351    wp_prime_option_caches( $options );
    352352
    353353    $result = array();
Note: See TracChangeset for help on using the changeset viewer.