[wp-trac] [WordPress Trac] #58319: Improve performance of get_block_theme_folders

WordPress Trac noreply at wordpress.org
Tue Sep 19 16:16:07 UTC 2023


#58319: Improve performance of get_block_theme_folders
--------------------------------------------+---------------------------
 Reporter:  spacedmonkey                    |       Owner:  spacedmonkey
     Type:  enhancement                     |      Status:  closed
 Priority:  normal                          |   Milestone:  6.4
Component:  Themes                          |     Version:  5.9
 Severity:  normal                          |  Resolution:  fixed
 Keywords:  has-patch needs-testing commit  |     Focuses:  performance
--------------------------------------------+---------------------------
Changes (by spacedmonkey):

 * status:  reviewing => closed
 * resolution:   => fixed


Comment:

 In [changeset:"56621" 56621]:
 {{{
 #!CommitTicketReference repository="" revision="56621"
 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.
 }}}

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/58319#comment:23>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list