[wp-trac] [WordPress Trac] #11615: Avoiding the options table when retrieving a user option
WordPress Trac
wp-trac at lists.automattic.com
Fri Dec 25 08:12:51 UTC 2009
#11615: Avoiding the options table when retrieving a user option
--------------------------+-------------------------------------------------
Reporter: nacin | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: 3.0
Component: Optimization | Version:
Severity: normal | Keywords: has-patch dev-feedback
--------------------------+-------------------------------------------------
Follow up to #11385.
We're querying the options table unnecessarily and unexpectedly on some
calls to get_user_option(). This function first checks if the user option
(say, 'rich_editing') exists at the per-blog per-user level, then the per-
user level, then the per-blog level. The per-blog level can be turned off
via one of the arguments but it is on by default.
There are currently seven different user options we check the options
table for. Four (use_ssl, admin_color, comment_shortcuts, rich_editing)
are set in wp_insert_user(), so unless a plugin deliberately removes the
user meta there and wants the options table to be queried, we'll never
generate needless queries on that.
On the other hand, screen_layout_$screen, plugins_last_view, and
autosave_draft_ids are generating unnecessary queries on the options table
when they have yet to be initialized. Patch here changes those.
Bigger picture here: We should come up with a new get_user_option() that
doesn't check the options table by default. Since there is no use of
get_user_option() in core that should fall back by default, I'm thinking
that the options table check could perhaps be better served by a filter.
--
Ticket URL: <http://core.trac.wordpress.org/ticket/11615>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list