#60518 closed defect (bug) (fixed)
Plugin Dependencies: Avoid unnecessary DB writes
Reported by: | joemcgill | Owned by: | joemcgill |
---|---|---|---|
Milestone: | 6.5 | Priority: | normal |
Severity: | normal | Version: | |
Component: | Upgrade/Install | Keywords: | has-patch needs-testing |
Focuses: | performance | Cc: |
Description
The Plugin Dependencies feature adds additional DB queries to every request by saving the list of dependencies that were deactivated to a new transient, wp_plugin_dependencies_deactivated_plugins
with an expiry time of 10 seconds.
In most cases, when there are no plugins to deactivate, these extra DB operations seem to be unnecessary. We could check whether the array is empty in WP_Plugin_Dependencies::deactivate_dependents_with_unmet_dependencies
and return early if we know there are no plugins that need to be disabled.
Change History (10)
This ticket was mentioned in PR #6093 on WordPress/wordpress-develop by @joemcgill.
9 months ago
#1
- Keywords has-patch added
#2
@
9 months ago
- Focuses performance added
- Keywords needs-testing added
- Owner set to joemcgill
- Status changed from new to accepted
@joemcgill commented on PR #6093:
9 months ago
#3
The performance test results for this PR look promising, and in line with the measurements I've taken locally. In all cases shown in that summary, the wpBeforeTemplate
metric, which measures the amount of time spent before the templates are rendered, have all decreased by several ms.
9 months ago
#4
Just remember the idea for this was to deactivate plugins with unmet dependencies that changed by any means.
9 months ago
#5
@afragen True, though if none are detected by the loop, there shouldn't be any reason to perform DB operations, yeah?
@youknowriad commented on PR #6093:
9 months ago
#7
Looking at the summary of the performance job of this PR. It's promising (wpBeforeTemplate metric)
@youknowriad commented on PR #6093:
9 months ago
#8
Looking at the summary of the performance job of this PR. It's promising (wpBeforeTemplate metric)
This PR returns early if in
WP_Plugin_Dependencies::deactivate_dependents_with_unmet_dependencies()
if there are no plugins to deactivate, which avoids unnecessary DB operations related to saving the list to a transient for use inWP_Plugin_Dependencies::display_admin_notice_for_deactivated_dependents()
.In my tests, this takes the number of DB queries run on a homepage of Twenty Twenty-four from 29, down to 25.
Trac ticket: https://core.trac.wordpress.org/ticket/60518