Make WordPress Core

Ticket #51678: patch_51678.patch

File patch_51678.patch, 1.1 KB (added by vedjain, 5 years ago)

Possible patch for performance regression issue

  • wp-includes/class-wp-locale-switcher.php

    diff --git a/wp-includes/class-wp-locale-switcher.php b/wp-includes/class-wp-locale-switcher.php
    index 8a9bbc3903..9f2893d35e 100644
    a b class WP_Locale_Switcher { 
    189189         * @param string $locale The locale to load translations for.
    190190         */
    191191        private function load_translations( $locale ) {
    192                 global $l10n;
     192                global $l10n, $wp_textdomain_registry;
    193193
    194194                $domains = $l10n ? array_keys( $l10n ) : array();
    195195
    196196                load_default_textdomain( $locale );
     197                $wp_textdomain_registry->reset();
    197198
    198199                foreach ( $domains as $domain ) {
    199200                        // The default text domain is handled by `load_default_textdomain()`.
  • wp-includes/l10n.php

    diff --git a/wp-includes/l10n.php b/wp-includes/l10n.php
    index 6bca550e98..af647c0f52 100644
    a b function load_textdomain( $domain, $mofile ) { 
    740740        $mofile = apply_filters( 'load_textdomain_mofile', $mofile, $domain );
    741741
    742742        if ( ! is_readable( $mofile ) ) {
     743                $wp_textdomain_registry->set( $domain, false );
    743744                return false;
    744745        }
    745746