[wp-trac] [WordPress Trac] #61484: Prime notoptions within `delete_option()`, `delete_network_option()`.

WordPress Trac noreply at wordpress.org
Wed Jul 24 22:55:17 UTC 2024


#61484: Prime notoptions within `delete_option()`, `delete_network_option()`.
--------------------------------------+--------------------------
 Reporter:  peterwilsoncc             |       Owner:  pbearne
     Type:  enhancement               |      Status:  reopened
 Priority:  normal                    |   Milestone:  6.7
Component:  Options, Meta APIs        |     Version:
 Severity:  normal                    |  Resolution:
 Keywords:  has-patch has-unit-tests  |     Focuses:  performance
--------------------------------------+--------------------------
Changes (by peterwilsoncc):

 * status:  closed => reopened
 * resolution:  fixed =>


Comment:

 Reopening this as @bjorsch picked an issue up while working on #61730.

 In `delete_option()` the `notoptions` cache is set regardless of the
 result of the database query.

 If `wpdb::delete()` returns `false` (database connection error) then it's
 not known if the option exists or not so the cache should probably not be
 set so there ought to be a check for that before setting the cache.

 If `wpdb::delete()` returns `0` the cache can be set as it's known not to
 be an option as there were no rows to delete.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/61484#comment:12>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list