Opened 2 years ago

Closed 20 months ago

#17883 closed defect (bug) (fixed)

get_blog_option queries DB on default blog_id

Reported by: wpmuguru Owned by: ryan
Priority: normal Milestone: 3.3
Component: Multisite Version: 3.1.3
Severity: normal Keywords: has-patch
Cc:

Description

If get_blog_option is passed null for a blog_id, it queries the DB instead of using the current blog option cache.

In most, if not all, of the MS specific functions that have a $blog_id, if $blog_id is null, the current blog is used.

patch is attached.

Attachments (1)

17883.diff (481 bytes) - added by wpmuguru 2 years ago.

Download all attachments as: .zip

Change History (9)

The $wpdb->get_blog_prefix( ... will return the prefix for the current blog when null is passed. So, the current implementation defaults to the current blog but queries the DB instead of retrieving from cache.

  • Milestone changed from Awaiting Review to 3.3

Added test cases for a slew of changes about to drop: [UT436].

In [18662]:

Allow get_blog_option(null,...) to hit the cache for the current blog. New return values for add_blog_option, update_blog_option, delete_blog_option. Don't set the cache in those functions if add/update/delete_option failed. see #17883.

comment:5 follow-up: ↓ 7   nacin21 months ago

Sorry wpmuguru, tried to stop the commit to include props. Thanks for the contribution as always :-)

  • Owner set to ryan
  • Status changed from new to reviewing

Leaving this open so ryan can review it.

comment:7 in reply to: ↑ 5   wpmuguru20 months ago

Replying to nacin:

Sorry wpmuguru, tried to stop the commit to include props. Thanks for the contribution as always :-)

No problem - I've done the same.

  • Resolution set to fixed
  • Status changed from reviewing to closed
Note: See TracTickets for help on using tickets.