Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Apply upstream performance improvement to _get_block_templates_paths #45541

Closed
WunderBart opened this issue Mar 13, 2024 · 0 comments · Fixed by #45619
Closed

Apply upstream performance improvement to _get_block_templates_paths #45541

WunderBart opened this issue Mar 13, 2024 · 0 comments · Fixed by #45619
Assignees
Labels
focus: performance The issue/PR is related to performance. team: Kirigami & Origami

Comments

@WunderBart
Copy link
Contributor

Original request: pcShBQ-1x1-p2

_get_block_templates_paths had recently received a performance bump. We can't use it directly since it's marked as @access private, but we can surely apply those improvements to our implementation, e.g.,

public static function get_template_paths( $base_directory ) {
$path_list = array();
if ( file_exists( $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;
}
}
return $path_list;
}

cc: @joshuatf @tjcafferkey @gigitux

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
focus: performance The issue/PR is related to performance. team: Kirigami & Origami
Projects
No open projects
Development

Successfully merging a pull request may close this issue.

2 participants