WP_Textdomain_Registry::invalidate_mo_files_cache()
Invalidate the cache for .mo files.
This function deletes the cache entries related to .mo files when triggered by specific actions, such as the completion of an upgrade process.
Метод класса: WP_Textdomain_Registry{}
Хуков нет.
Возвращает
null
. Ничего (null).
Использование
$WP_Textdomain_Registry = new WP_Textdomain_Registry(); $WP_Textdomain_Registry->invalidate_mo_files_cache( $upgrader, $hook_extra );
- $upgrader(WP_Upgrader) (обязательный)
- Unused. WP_Upgrader instance. In other contexts this might be a Theme_Upgrader, Plugin_Upgrader, Core_Upgrade, or Language_Pack_Upgrader instance.
- $hook_extra(массив) (обязательный)
Array of bulk item update data.
-
action(строка)
Type of action.
По умолчанию: 'update' -
type(строка)
Type of update process. Accepts 'plugin', 'theme', 'translation', or 'core'. -
bulk(true|false)
Whether the update process is a bulk update.
По умолчанию: true -
plugins(массив)
Array of the basename paths of the plugins' main files. -
themes(массив)
The theme slugs. -
translations(массив)
Array of translations update data.-
language(строка)
The locale the translation is for. -
type(строка)
Type of translation. Accepts 'plugin', 'theme', or 'core'. -
slug(строка)
Text domain the translation is for. The slug of a theme/plugin or 'default' for core translations. - version(строка)
The version of a theme, plugin, or core.
-
-
Список изменений
С версии 6.5.0 | Введена. |
Код WP_Textdomain_Registry::invalidate_mo_files_cache() WP Textdomain Registry::invalidate mo files cache WP 6.7.1
public function invalidate_mo_files_cache( $upgrader, $hook_extra ) { if ( ! isset( $hook_extra['type'] ) || 'translation' !== $hook_extra['type'] || array() === $hook_extra['translations'] ) { return; } $translation_types = array_unique( wp_list_pluck( $hook_extra['translations'], 'type' ) ); foreach ( $translation_types as $type ) { switch ( $type ) { case 'plugin': wp_cache_delete( md5( WP_LANG_DIR . '/plugins/' ), 'translation_files' ); break; case 'theme': wp_cache_delete( md5( WP_LANG_DIR . '/themes/' ), 'translation_files' ); break; default: wp_cache_delete( md5( WP_LANG_DIR . '/' ), 'translation_files' ); break; } } }