mirror of
https://github.com/WordPress/WordPress.git
synced 2025-01-03 06:57:35 +01:00
Editor: Read theme.json files stored in styles/
folder only once.
Uses `read_json_file` to access cached file if it exists instead of using `wp_json_file_decode` directly. Props oandregal, aaronrobertshaw, joemcgill, ramonopoly, isabel_brison. See #61451. Built from https://develop.svn.wordpress.org/trunk@58428 git-svn-id: http://core.svn.wordpress.org/trunk@57877 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
aeb9f37238
commit
e820f8cdf9
@ -725,6 +725,7 @@ class WP_Theme_JSON_Resolver {
|
|||||||
* @since 6.6.0 Added configurable scope parameter to allow filtering
|
* @since 6.6.0 Added configurable scope parameter to allow filtering
|
||||||
* theme.json partial files by the scope to which they
|
* theme.json partial files by the scope to which they
|
||||||
* can be applied e.g. theme vs block etc.
|
* can be applied e.g. theme vs block etc.
|
||||||
|
* Added basic caching for read theme.json partial files.
|
||||||
*
|
*
|
||||||
* @param string $scope The scope or type of style variation to retrieve e.g. theme, block etc.
|
* @param string $scope The scope or type of style variation to retrieve e.g. theme, block etc.
|
||||||
* @return array
|
* @return array
|
||||||
@ -751,7 +752,7 @@ class WP_Theme_JSON_Resolver {
|
|||||||
}
|
}
|
||||||
ksort( $variation_files );
|
ksort( $variation_files );
|
||||||
foreach ( $variation_files as $path => $file ) {
|
foreach ( $variation_files as $path => $file ) {
|
||||||
$decoded_file = wp_json_file_decode( $path, array( 'associative' => true ) );
|
$decoded_file = self::read_json_file( $path );
|
||||||
if ( is_array( $decoded_file ) && static::style_variation_has_scope( $decoded_file, $scope ) ) {
|
if ( is_array( $decoded_file ) && static::style_variation_has_scope( $decoded_file, $scope ) ) {
|
||||||
$translated = static::translate( $decoded_file, wp_get_theme()->get( 'TextDomain' ) );
|
$translated = static::translate( $decoded_file, wp_get_theme()->get( 'TextDomain' ) );
|
||||||
$variation = ( new WP_Theme_JSON( $translated ) )->get_raw_data();
|
$variation = ( new WP_Theme_JSON( $translated ) )->get_raw_data();
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '6.6-beta2-58427';
|
$wp_version = '6.6-beta2-58428';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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
Block a user