From 1c0849c2b269eb1b807f735443d8f91ee3aa3faf Mon Sep 17 00:00:00 2001 From: Dominik Schilling Date: Mon, 21 Jan 2019 20:41:50 +0000 Subject: [PATCH] I18N: Remove JSON translations when deleting a theme or a plugin. See #29860. Fixes #45467. Built from https://develop.svn.wordpress.org/trunk@44675 git-svn-id: http://core.svn.wordpress.org/trunk@44506 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/includes/plugin.php | 5 +++++ wp-admin/includes/theme.php | 5 +++++ wp-includes/version.php | 2 +- 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/wp-admin/includes/plugin.php b/wp-admin/includes/plugin.php index a2a579eacb..05e3861f17 100644 --- a/wp-admin/includes/plugin.php +++ b/wp-admin/includes/plugin.php @@ -1048,6 +1048,11 @@ function delete_plugins( $plugins, $deprecated = '' ) { foreach ( $translations as $translation => $data ) { $wp_filesystem->delete( WP_LANG_DIR . '/plugins/' . $plugin_slug . '-' . $translation . '.po' ); $wp_filesystem->delete( WP_LANG_DIR . '/plugins/' . $plugin_slug . '-' . $translation . '.mo' ); + + $json_translation_files = glob( WP_LANG_DIR . '/plugins/' . $plugin_slug . '-' . $translation . '-*.json' ); + if ( $json_translation_files ) { + array_map( array( $wp_filesystem, 'delete' ), $json_translation_files ); + } } } } diff --git a/wp-admin/includes/theme.php b/wp-admin/includes/theme.php index 1b472f3daf..7c307c33eb 100644 --- a/wp-admin/includes/theme.php +++ b/wp-admin/includes/theme.php @@ -88,6 +88,11 @@ function delete_theme( $stylesheet, $redirect = '' ) { foreach ( $translations as $translation => $data ) { $wp_filesystem->delete( WP_LANG_DIR . '/themes/' . $stylesheet . '-' . $translation . '.po' ); $wp_filesystem->delete( WP_LANG_DIR . '/themes/' . $stylesheet . '-' . $translation . '.mo' ); + + $json_translation_files = glob( WP_LANG_DIR . '/themes/' . $stylesheet . '-' . $translation . '-*.json' ); + if ( $json_translation_files ) { + array_map( array( $wp_filesystem, 'delete' ), $json_translation_files ); + } } } diff --git a/wp-includes/version.php b/wp-includes/version.php index bbe8f961b4..dafa089a1a 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -13,7 +13,7 @@ * * @global string $wp_version */ -$wp_version = '5.1-beta1-44674'; +$wp_version = '5.1-beta1-44675'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.