I18N: Cache list of language file paths in WP_Textdomain_Registry.

Loading a list of language file paths using `glob()` can be expensive if involving thousands of files.

Expands scope of `WP_Textdomain_Registry` to cache list of language file paths in object cache and provides a way to invalidate that cache upon translation updates. Plugins can clear the cache using calls such as `wp_cache_delete( 'cached_mo_files_' . md5( $path ), 'translations' );`

Props mreishus, swissspidy
Fixes #58919
Built from https://develop.svn.wordpress.org/trunk@57287


git-svn-id: http://core.svn.wordpress.org/trunk@56793 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Pascal Birchler
2024-01-15 19:05:14 +00:00
parent b713c5eb9c
commit 4d37fc7865
4 changed files with 127 additions and 24 deletions

View File

@@ -380,6 +380,7 @@ $GLOBALS['wp_embed'] = new WP_Embed();
* @global WP_Textdomain_Registry $wp_textdomain_registry WordPress Textdomain Registry.
*/
$GLOBALS['wp_textdomain_registry'] = new WP_Textdomain_Registry();
$GLOBALS['wp_textdomain_registry']->init();
// Load multisite-specific files.
if ( is_multisite() ) {