[wp-trac] [WordPress Trac] #42217: Plugins misuse get_plugins(), should be cached
WordPress Trac
noreply at wordpress.org
Sat Oct 14 09:15:13 UTC 2017
#42217: Plugins misuse get_plugins(), should be cached
-------------------------+-----------------------------
Reporter: fabifott | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Plugins | Version: 4.8
Severity: normal | Keywords:
Focuses: performance |
-------------------------+-----------------------------
Many popular plugins misuse `get_plugins()`. They call it to check if a
certain extension is available, and they do it every request.
This is the actual reason why it is recommended to keep your plugins
directory clean.
I tried to reach some of the plugin devs telling them that they are using
`get_plugins()` in a wrong way, but they did not listen.
`get_plugins()` uses the non-persistent object cache. Once there is some
plugin call it, it will scan the plugin directory. It depending on your
number of installed plugins, this can take a while. (On VVV, host i7
skylake with NVME SSD, 32 plugins in the plugins dir, 400 - 600 ms). Any
subsequent calls during the same request are at no cost.
For a fix I propose to use an additional transient for caching. This
transient should have a lifetime of at least 1 hour. To be able to
instantly find plugins that have been installed or updated on the file
system, this transient should be deleted on every request of the plugins
admin screen. Additionally, it can be refreshed on every cron request.
This would significantly increase performance of the dashboard, if there
is at least one plugin misusing `get_plugins()`.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/42217>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list