General: Memoize the return value in `wp_get_wp_version()`.
This aims to optimize performance by saving the return value to a static variable, so that the `version.php` file is not unnecessarily required on each function call. Follow-up to [58813]. Props Cybr, debarghyabanerjee, mukesh27. Fixes #61782. See #61627. Built from https://develop.svn.wordpress.org/trunk@58827 git-svn-id: http://core.svn.wordpress.org/trunk@58223 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
eb33b8b4f7
commit
12991d53a4
|
@ -8819,7 +8819,11 @@ function clean_dirsize_cache( $path ) {
|
||||||
* @return string The current WordPress version.
|
* @return string The current WordPress version.
|
||||||
*/
|
*/
|
||||||
function wp_get_wp_version() {
|
function wp_get_wp_version() {
|
||||||
require ABSPATH . WPINC . '/version.php';
|
static $wp_version;
|
||||||
|
|
||||||
|
if ( ! isset( $wp_version ) ) {
|
||||||
|
require ABSPATH . WPINC . '/version.php';
|
||||||
|
}
|
||||||
|
|
||||||
return $wp_version;
|
return $wp_version;
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '6.7-alpha-58826';
|
$wp_version = '6.7-alpha-58827';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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