Make WordPress Core


Ignore:
Timestamp:
10/24/2022 06:35:30 PM (2 years ago)
Author:
ocean90
Message:

I18N: Change how WP_Textdomain_Registry stores the default languages path.

WP_Textdomain_Registry was introduced in [53874] to store text domains and their language directory paths, addressing issues with just-in-time loading of textdomains when using locale switching and when usingload_*_textdomain() functions.

Said change has inadvertently caused a performance regression exactly when usingload_*_textdomain(), which still often is the case, where the cached information was not further used or even overridden.

This change addresses that issue by storing the default languages paths in a separate way, while at the same time making WP_Textdomain_Registry easier to maintain and adding new tests to catch future regressions.

Props flixos90, spacedmonkey, ocean90, SergeyBiryukov, costdev.
Merges [54669] to the 6.1 branch.
See #39210.

Location:
branches/6.1
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/6.1

  • branches/6.1/tests/phpunit/tests/l10n/loadTextdomain.php

    r53874 r54682  
    2929        global $wp_textdomain_registry;
    3030
    31         $wp_textdomain_registry->reset();
     31        $wp_textdomain_registry = new WP_Textdomain_Registry();
    3232    }
    3333
     
    3737        global $wp_textdomain_registry;
    3838
    39         $wp_textdomain_registry->reset();
     39        $wp_textdomain_registry = new WP_Textdomain_Registry();
    4040
    4141        parent::tear_down();
Note: See TracChangeset for help on using the changeset viewer.