mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-03-31 18:54:29 +00:00
Themes: Improve performance of get_block_theme_folders function
This commit enhances the performance of the get_block_theme_folders function by introducing a new method called get_block_template_folders within the WP_Theme class. Previously, this function suffered from poor performance due to repeated file lookups using file_exists. The new method implements basic caching, storing the result in the theme's cache, similar to how block themes are cached in the block_theme property (see [55236]). Additionally, this change improves error handling by checking if a theme exists before attempting to look up the file. It also enhances test coverage. Props spacedmonkey, thekt12, swissspidy, flixos90, costdev, mukesh27. Fixes #58319. git-svn-id: https://develop.svn.wordpress.org/trunk@56621 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -0,0 +1,3 @@
|
||||
<!-- wp:paragraph -->
|
||||
<p>Small Header Template Part</p>
|
||||
<!-- /wp:paragraph -->
|
||||
@@ -0,0 +1,8 @@
|
||||
/*
|
||||
Theme Name: Block Theme Child Deprecated Path
|
||||
Theme URI: https://wordpress.org/
|
||||
Description: For testing purposes only.
|
||||
Template: block-theme
|
||||
Version: 1.0.0
|
||||
Text Domain: block-theme-child-deprecated-path
|
||||
*/
|
||||
@@ -0,0 +1,3 @@
|
||||
<!-- wp:paragraph -->
|
||||
<p>Index Template</p>
|
||||
<!-- /wp:paragraph -->
|
||||
@@ -0,0 +1,71 @@
|
||||
{
|
||||
"version": 1,
|
||||
"settings": {
|
||||
"color": {
|
||||
"palette": [
|
||||
{
|
||||
"slug": "light",
|
||||
"name": "Light",
|
||||
"color": "#f5f7f9"
|
||||
},
|
||||
{
|
||||
"slug": "dark",
|
||||
"name": "Dark",
|
||||
"color": "#000"
|
||||
}
|
||||
],
|
||||
"gradients": [
|
||||
{
|
||||
"name": "Custom gradient",
|
||||
"gradient": "linear-gradient(135deg,rgba(0,0,0) 0%,rgb(0,0,0) 100%)",
|
||||
"slug": "custom-gradient"
|
||||
}
|
||||
],
|
||||
"custom": false,
|
||||
"customGradient": false
|
||||
},
|
||||
"typography": {
|
||||
"fontSizes": [
|
||||
{
|
||||
"name": "Custom",
|
||||
"slug": "custom",
|
||||
"size": "100px"
|
||||
}
|
||||
],
|
||||
"customFontSize": false,
|
||||
"customLineHeight": true
|
||||
},
|
||||
"spacing": {
|
||||
"units": [
|
||||
"rem"
|
||||
],
|
||||
"customPadding": true
|
||||
},
|
||||
"blocks": {
|
||||
"core/paragraph": {
|
||||
"color": {
|
||||
"palette": [
|
||||
{
|
||||
"slug": "light",
|
||||
"name": "Light",
|
||||
"color": "#f5f7f9"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"customTemplates": [
|
||||
{
|
||||
"name": "page-home",
|
||||
"title": "Homepage template"
|
||||
}
|
||||
],
|
||||
"templateParts": [
|
||||
{
|
||||
"name": "small-header",
|
||||
"title": "Small Header",
|
||||
"area": "header"
|
||||
}
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user