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. Fixes #58962. Built from https://develop.svn.wordpress.org/trunk@57013 git-svn-id: http://core.svn.wordpress.org/trunk@56524 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
a0d7172914
commit
2aa3f8fbeb
|
@ -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.
|
* 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.
|
* @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();
|
$alloptions = wp_load_alloptions();
|
||||||
$cached_options = wp_cache_get_multiple( $options, 'options' );
|
$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
|
* @since 6.4.0
|
||||||
*
|
*
|
||||||
|
@ -329,11 +329,11 @@ function wp_load_options( $options ) {
|
||||||
*
|
*
|
||||||
* @param string $option_group The option group to load options for.
|
* @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;
|
global $new_allowed_options;
|
||||||
|
|
||||||
if ( isset( $new_allowed_options[ $option_group ] ) ) {
|
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.
|
* @return array An array of key-value pairs for the requested options.
|
||||||
*/
|
*/
|
||||||
function get_options( $options ) {
|
function get_options( $options ) {
|
||||||
wp_load_options( $options );
|
wp_prime_option_caches( $options );
|
||||||
|
|
||||||
$result = array();
|
$result = array();
|
||||||
foreach ( $options as $option ) {
|
foreach ( $options as $option ) {
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '6.5-alpha-57012';
|
$wp_version = '6.5-alpha-57013';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
|
Loading…
Reference in New Issue