WordPress.org

Make WordPress Core

Opened 5 years ago

Closed 5 years ago

#17883 closed defect (bug) (fixed)

get_blog_option queries DB on default blog_id

Reported by: wpmuguru Owned by: ryan
Milestone: 3.3 Priority: normal
Severity: normal Version: 3.1.3
Component: Multisite Keywords: has-patch
Focuses: 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 5 years ago.

Download all attachments as: .zip

Change History (9)

@wpmuguru
5 years ago

#1 @wpmuguru
5 years ago

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.

#2 @SergeyBiryukov
5 years ago

  • Milestone changed from Awaiting Review to 3.3

#3 @nacin
5 years ago

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

#4 @nacin
5 years ago

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.

#5 follow-up: @nacin
5 years ago

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

#6 @nacin
5 years ago

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

Leaving this open so ryan can review it.

#7 in reply to: ↑ 5 @wpmuguru
5 years 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.

#8 @ryan
5 years ago

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