Make WordPress Core

Opened 11 years ago

Closed 11 years ago

Last modified 11 years ago

#35439 closed defect (bug) (fixed)

Prevent (re-)loading of textdomain if already loaded

Reported by: jrf Owned by: ocean90
Priority: normal Milestone: 4.5
Component: Plugins Version:
Severity: normal Keywords: has-patch
Cc: Focuses: performance

Description

On the plugins admin page, the _get_plugin_data_markup_translate() function attempts to load the localization files for all the plugins listed which have a Textdomain header to try and retrieve the localized descriptions and such.

However (active) plugins will often already have loaded their textdomain from within their own code flow, resulting in lots of extraneous file reads which can be avoided.

Just to demonstrate some stats for a test environment I'm running - take note of the Number of attempts made to load a translation:

Without the patch:
http://snag.gy/IaPFZ.jpg

With the patch:
http://snag.gy/XGluW.jpg

Data obtained using the new Debug Bar Localization panel plugin.

Attachments (1)

35439 leaner-textdomain-loading.patch (1.4 KB ) - added by jrf 11 years ago.

Download all attachments as: .zip

Change History (6)

#1 @jrf
11 years ago

  • Keywords has-patch added

#2 @ocean90
11 years ago

  • Milestone Awaiting Review4.5
  • Owner set to ocean90
  • Status newaccepted

#3 @ocean90
11 years ago

Even though is_textdomain_loaded() has some issues, see #35442, I'm fine with the change. WP_Theme is doing the same already and I haven't heard of any issues.

#4 @ocean90
11 years ago

  • Resolutionfixed
  • Status acceptedclosed

In 36282:

Plugins: In _get_plugin_data_markup_translate() don't reload translations if they're already loaded.

Props jrf.
Fixes #35439.

#5 @jrf
11 years ago

@ocean90 Thanks for the quick turn-around!

Note: See TracTickets for help on using tickets.