mirror of
https://github.com/WordPress/WordPress.git
synced 2024-12-22 17:18:32 +01:00
Themes: Avoid errors in some environments from _get_block_templates_paths
.
This adds an `is_dir()` check in `_get_block_templates_paths` before trying to run a `RecursiveDirectoryIterator` to avoid errors being reported in New Relic even thought the errors should be handled by a try/catch block. Follow-up to [57215]. Props iCaleb, sean212, mukesh27, joemcgill. Fixes #60915. Built from https://develop.svn.wordpress.org/trunk@57928 git-svn-id: http://core.svn.wordpress.org/trunk@57429 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
78d729602e
commit
9bb63fd665
@ -229,14 +229,12 @@ function _get_block_templates_paths( $base_directory ) {
|
||||
return $template_path_list[ $base_directory ];
|
||||
}
|
||||
$path_list = array();
|
||||
try {
|
||||
if ( is_dir( $base_directory ) ) {
|
||||
$nested_files = new RecursiveIteratorIterator( new RecursiveDirectoryIterator( $base_directory ) );
|
||||
$nested_html_files = new RegexIterator( $nested_files, '/^.+\.html$/i', RecursiveRegexIterator::GET_MATCH );
|
||||
foreach ( $nested_html_files as $path => $file ) {
|
||||
$path_list[] = $path;
|
||||
}
|
||||
} catch ( Exception $e ) {
|
||||
// Do nothing.
|
||||
}
|
||||
$template_path_list[ $base_directory ] = $path_list;
|
||||
return $path_list;
|
||||
|
@ -16,7 +16,7 @@
|
||||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '6.6-alpha-57926';
|
||||
$wp_version = '6.6-alpha-57928';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
Loading…
Reference in New Issue
Block a user