WordPress.org

Make WordPress Core

Opened 3 years ago

Closed 3 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 3 years ago.

Download all attachments as: .zip

Change History (9)

wpmuguru3 years ago

comment:1 wpmuguru3 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.

comment:2 SergeyBiryukov3 years ago

  • Milestone changed from Awaiting Review to 3.3

comment:3 nacin3 years ago

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

comment:4 nacin3 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.

comment:5 follow-up: nacin3 years ago

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

comment:6 nacin3 years ago

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

Leaving this open so ryan can review it.

comment:7 in reply to: ↑ 5 wpmuguru3 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.

comment:8 ryan3 years ago

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