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.


Built from https://develop.svn.wordpress.org/branches/6.4@57016


git-svn-id: http://core.svn.wordpress.org/branches/6.4@56527 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Peter Wilson 2023-10-27 00:02:20 +00:00
parent 64bd43c885
commit ead01cff58
2 changed files with 7 additions and 7 deletions

View File

@ -248,7 +248,7 @@ function get_option( $option, $default_value = false ) {
}
/**
* Loads specific options into the cache with a single database query.
* Primes specific options into the cache with a single database query.
*
* Only options that do not already exist in cache will be loaded.
*
@ -258,7 +258,7 @@ function get_option( $option, $default_value = false ) {
*
* @param array $options An array of option names to be loaded.
*/
function wp_load_options( $options ) {
function wp_prime_option_caches( $options ) {
$alloptions = wp_load_alloptions();
$cached_options = wp_cache_get_multiple( $options, 'options' );
@ -321,7 +321,7 @@ function wp_load_options( $options ) {
}
/**
* Loads all options registered with a specific option group.
* Primes the cache of all options registered with a specific option group.
*
* @since 6.4.0
*
@ -329,11 +329,11 @@ function wp_load_options( $options ) {
*
* @param string $option_group The option group to load options for.
*/
function wp_load_options_by_group( $option_group ) {
function wp_prime_option_caches_by_group( $option_group ) {
global $new_allowed_options;
if ( isset( $new_allowed_options[ $option_group ] ) ) {
wp_load_options( $new_allowed_options[ $option_group ] );
wp_prime_option_caches( $new_allowed_options[ $option_group ] );
}
}
@ -348,7 +348,7 @@ function wp_load_options_by_group( $option_group ) {
* @return array An array of key-value pairs for the requested options.
*/
function get_options( $options ) {
wp_load_options( $options );
wp_prime_option_caches( $options );
$result = array();
foreach ( $options as $option ) {

View File

@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
$wp_version = '6.4-RC2-57014';
$wp_version = '6.4-RC2-57016';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.