[wp-trac] [WordPress Trac] #58656: The function _register_theme_block_patterns check to see if directory exist multiple times
WordPress Trac
noreply at wordpress.org
Wed Jun 28 08:07:38 UTC 2023
#58656: The function _register_theme_block_patterns check to see if directory exist
multiple times
--------------------------+----------------------------
Reporter: spacedmonkey | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Future Release
Component: Editor | Version: 6.2
Severity: normal | Keywords:
Focuses: |
--------------------------+----------------------------
In the function `_register_theme_block_patterns` check to see if a
directory exists three files.
{{{#!php
$dirpath = $theme->get_stylesheet_directory() . '/patterns/';
if ( ! is_dir( $dirpath ) || ! is_readable( $dirpath ) ) {
continue;
}
if ( file_exists( $dirpath ) ) {
$files = glob( $dirpath . '*.php' );
}}}
This calls `is_dir`, `is_readable` and `file_exists` basically the same
thing. This should be avoided.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/58656>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list