Make WordPress Core

Changeset 44675


Ignore:
Timestamp:
01/21/2019 08:40:56 PM (6 years ago)
Author:
ocean90
Message:

I18N: Remove JSON translations when deleting a theme or a plugin.

See #29860.
Fixes #45467.

Location:
trunk/src/wp-admin/includes
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/plugin.php

    r44674 r44675  
    10491049                $wp_filesystem->delete( WP_LANG_DIR . '/plugins/' . $plugin_slug . '-' . $translation . '.po' );
    10501050                $wp_filesystem->delete( WP_LANG_DIR . '/plugins/' . $plugin_slug . '-' . $translation . '.mo' );
     1051
     1052                $json_translation_files = glob( WP_LANG_DIR . '/plugins/' . $plugin_slug . '-' . $translation . '-*.json' );
     1053                if ( $json_translation_files ) {
     1054                    array_map( array( $wp_filesystem, 'delete' ), $json_translation_files );
     1055                }
    10511056            }
    10521057        }
  • trunk/src/wp-admin/includes/theme.php

    r44643 r44675  
    8989            $wp_filesystem->delete( WP_LANG_DIR . '/themes/' . $stylesheet . '-' . $translation . '.po' );
    9090            $wp_filesystem->delete( WP_LANG_DIR . '/themes/' . $stylesheet . '-' . $translation . '.mo' );
     91
     92            $json_translation_files = glob( WP_LANG_DIR . '/themes/' . $stylesheet . '-' . $translation . '-*.json' );
     93            if ( $json_translation_files ) {
     94                array_map( array( $wp_filesystem, 'delete' ), $json_translation_files );
     95            }
    9196        }
    9297    }
Note: See TracChangeset for help on using the changeset viewer.