I18N: Improve translation file cache group & expiration.
Adds an explicit 1 hour expiration for the translation file cache introduced in [57287] / #58919. This prevents stale caches when a site does not use the regular way of installing language packs, for example when an atomic filesystem is involved. Also configures the translation_files group as a global cache group on multisite. Reviewed by swissspidy. Merges [57831] to the to the 6.5 branch. Props dd32. Fixes #60764. Built from https://develop.svn.wordpress.org/branches/6.5@57838 git-svn-id: http://core.svn.wordpress.org/branches/6.5@57339 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
4af7fa8ec0
commit
2d39c954a2
|
@ -183,8 +183,8 @@ class WP_Textdomain_Registry {
|
||||||
return $files;
|
return $files;
|
||||||
}
|
}
|
||||||
|
|
||||||
$cache_key = 'cached_mo_files_' . md5( $path );
|
$cache_key = md5( $path );
|
||||||
$files = wp_cache_get( $cache_key, 'translations' );
|
$files = wp_cache_get( $cache_key, 'translation_files' );
|
||||||
|
|
||||||
if ( false === $files ) {
|
if ( false === $files ) {
|
||||||
$files = glob( $path . '*.mo' );
|
$files = glob( $path . '*.mo' );
|
||||||
|
@ -197,7 +197,7 @@ class WP_Textdomain_Registry {
|
||||||
$files = array_merge( $files, $php_files );
|
$files = array_merge( $files, $php_files );
|
||||||
}
|
}
|
||||||
|
|
||||||
wp_cache_set( $cache_key, $files, 'translations' );
|
wp_cache_set( $cache_key, $files, 'translation_files', HOUR_IN_SECONDS );
|
||||||
}
|
}
|
||||||
|
|
||||||
return $files;
|
return $files;
|
||||||
|
@ -246,13 +246,13 @@ class WP_Textdomain_Registry {
|
||||||
foreach ( $translation_types as $type ) {
|
foreach ( $translation_types as $type ) {
|
||||||
switch ( $type ) {
|
switch ( $type ) {
|
||||||
case 'plugin':
|
case 'plugin':
|
||||||
wp_cache_delete( 'cached_mo_files_' . md5( WP_LANG_DIR . '/plugins/' ), 'translations' );
|
wp_cache_delete( md5( WP_LANG_DIR . '/plugins/' ), 'translation_files' );
|
||||||
break;
|
break;
|
||||||
case 'theme':
|
case 'theme':
|
||||||
wp_cache_delete( 'cached_mo_files_' . md5( WP_LANG_DIR . '/themes/' ), 'translations' );
|
wp_cache_delete( md5( WP_LANG_DIR . '/themes/' ), 'translation_files' );
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
wp_cache_delete( 'cached_mo_files_' . md5( WP_LANG_DIR . '/' ), 'translations' );
|
wp_cache_delete( md5( WP_LANG_DIR . '/' ), 'translation_files' );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -876,6 +876,7 @@ function wp_start_object_cache() {
|
||||||
'site-queries',
|
'site-queries',
|
||||||
'site-transient',
|
'site-transient',
|
||||||
'theme_files',
|
'theme_files',
|
||||||
|
'translation_files',
|
||||||
'rss',
|
'rss',
|
||||||
'users',
|
'users',
|
||||||
'user-queries',
|
'user-queries',
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '6.5-RC2-57837';
|
$wp_version = '6.5-RC2-57838';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
|
Loading…
Reference in New Issue