WordPress.org

Make WordPress Core

Opened 3 years ago

Closed 3 years ago

#37118 closed enhancement (fixed)

Move call of get_blog_details() inside of ms_site_check()

Reported by: danielbachhuber Owned by: jeremyfelt
Milestone: 4.6 Priority: normal
Severity: normal Version:
Component: Bootstrap/Load Keywords: has-patch commit
Focuses: multisite Cc:
PR Number:

Description

get_blog_details() is unnecessarily called at the top of ms_site_check(). It should be called when the blog's details are actually needed.

When a non-web context is bypassing ms_site_check() using the ms_site_check filter, the call to get_blog_details() causes a MySQL error notice when WordPress isn't yet installed.

Related #34936
From https://github.com/wp-cli/wp-cli/issues/2278#issuecomment-226634504

Attachments (1)

37118.1.diff (697 bytes) - added by danielbachhuber 3 years ago.

Download all attachments as: .zip

Change History (5)

#1 @danielbachhuber
3 years ago

  • Owner set to jorbin
  • Status changed from new to assigned

#2 @jeremyfelt
3 years ago

  • Focuses multisite added
  • Keywords commit added

+1

Noting #36935 for cross-reference. We'll be able to replace this with get_site() at some point, but the move is good either way.

#3 @jeremyfelt
3 years ago

  • Owner changed from jorbin to jeremyfelt
  • Status changed from assigned to reviewing

#4 @jeremyfelt
3 years ago

  • Resolution set to fixed
  • Status changed from reviewing to closed

In 37850:

Multisite: Move call of get_blog_details() inside ms_site_check().

This allows the ms_site_check filter or is_super_admin() check to return true before get_blog_details() is used.

Props danielbachhuber.
Fixes #37118.

Note: See TracTickets for help on using tickets.