Make WordPress Core

Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#35439 closed defect (bug) (fixed)

Prevent (re-)loading of textdomain if already loaded

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

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 9 years ago.

Download all attachments as: .zip

Change History (6)

#1 @jrf
9 years ago

  • Keywords has-patch added

#2 @ocean90
9 years ago

  • Milestone changed from Awaiting Review to 4.5
  • Owner set to ocean90
  • Status changed from new to accepted

#3 @ocean90
9 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
9 years ago

  • Resolution set to fixed
  • Status changed from accepted to closed

In 36282:

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

Props jrf.
Fixes #35439.

#5 @jrf
9 years ago

@ocean90 Thanks for the quick turn-around!

Note: See TracTickets for help on using tickets.