[wp-trac] [WordPress Trac] #22191: In update_metadata(), compare old/new values before deciding whether to call add_metadata()
WordPress Trac
wp-trac at lists.automattic.com
Mon Oct 15 03:14:18 UTC 2012
#22191: In update_metadata(), compare old/new values before deciding whether to
call add_metadata()
-----------------------+--------------------------
Reporter: nacin | Type: defect (bug)
Status: new | Priority: normal
Milestone: 3.5 | Component: Performance
Version: | Severity: normal
Keywords: has-patch |
-----------------------+--------------------------
In update_metadata(), we query for a meta_id of an existing key. If it
exists, we continue. If we get nothing back, we call add_metadata().
We also compare the old value with the new value, and if they are the
same, we bail.
Since that old value is from cache, it is possible for update_metadata()
to not run a single query on its own if there is nothing to update. Only,
we do, because we do the meta_id query first.
We should do the meta_id query second. This is the same pattern used by
update_option().
Related: #22191, the strict type comparison causes false negatives.
--
Ticket URL: <http://core.trac.wordpress.org/ticket/22191>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list