wordpress-develop/tests/phpunit/data
Jonny Harris 3ad20183b0 Editor: Improve performance of _register_theme_block_patterns function.
The `_register_theme_block_patterns` function imposed a significant resource overhead. This issue primarily stems from themes, such as TT4, that register a substantial number of block patterns. These patterns necessitate numerous file operations, including file lookups, file reading into memory, and related processes. To provide an overview, the _register_theme_block_patterns function performed the following file operations:

- is_dir
- is_readable
- file_exists
- glob
- file_get_contents (utilized via get_file_data)

To address these issues, caching using a transient has been added to a new function call `_wp_get_block_patterns`. If theme development mode is disabled and theme exists, the block patterns are saved in a transient cache. This cache is used all requests after that, saving file lookups and reading files into memory. Cache invalidation is done, when themes are switched, deleted or updated. Meaning that block patterns are not stored in the cache incorrectly. 

Props flixos90, joemcgill, peterwilsoncc, costdev, swissspidy, aristath, westonruter, spacedmonkey.
Fixes #59490

git-svn-id: https://develop.svn.wordpress.org/trunk@56765 602fd350-edb4-49c9-b593-d223f7449a82
2023-10-03 15:16:55 +00:00
..
blocks Tests: Add additional tests covering Block Hooks registration 2023-09-18 10:33:24 +00:00
export Ensure svn:eol-style is consistently set for all files (part 2). 2019-10-25 19:27:49 +00:00
feed Help/About: Use the new /documentation/ URLs for HelpHub links in WordPress Admin. 2023-02-23 10:36:33 +00:00
filesystem Filesystem API: Add missing ZIP file for unzip tests. 2023-09-25 23:38:38 +00:00
formatting Themes: Make sure get_file_data() recognizes headers prefixed by <?php tag. 2021-06-18 14:02:44 +00:00
functions Tests: Some test improvements for clean_dirsize_cache() tests: 2021-10-26 02:02:50 +00:00
images Media: Adjust PDF upload handling to remove non-opaque alpha channels from previews. 2023-07-19 22:33:47 +00:00
languages Tests: Increase coverage for translations applied to theme.json 2022-08-31 10:11:30 +00:00
plugins I18N: Introduce WP_Textdomain_Registry to store text domains and their language directory paths. 2022-08-11 12:37:05 +00:00
pomo
templates Themes: Inject theme attribute during serialization. 2023-09-14 08:50:43 +00:00
theme-file-child Themes: Improve child theme file inheritance by introducing functions for locating and fetching the URL or path to files within child and parent themes. 2016-09-08 22:53:57 +00:00
theme-file-parent Themes: Improve child theme file inheritance by introducing functions for locating and fetching the URL or path to files within child and parent themes. 2016-09-08 22:53:57 +00:00
themedir1 Editor: Improve performance of _register_theme_block_patterns function. 2023-10-03 15:16:55 +00:00
uploads Upload: Correct duplicate MIME type for .xlsx files generated by Google Docs. 2023-09-03 12:49:51 +00:00
widgets Docs: Correct the format of some comments per the documentation standards. 2021-12-10 20:28:27 +00:00
WPHTTP-testcase-redirection-script.php HTTP API: Fix request header inconsistencies. 2023-02-03 13:33:18 +00:00