Make WordPress Core

Opened 7 years ago

Closed 7 years ago

#41762 closed enhancement (fixed)

Use WP_Network_Query in ms_load_current_site_and_network

Reported by: spacedmonkey's profile spacedmonkey Owned by: flixos90's profile flixos90
Milestone: 4.9 Priority: normal
Severity: normal Version: 4.6
Component: Networks and Sites Keywords: has-patch
Focuses: multisite Cc:

Description (last modified by spacedmonkey)

Use WP_Network_Query in ms_load_current_site_and_network instead of raw SQL query.

Attachments (2)

41762.diff (1.4 KB) - added by spacedmonkey 7 years ago.
41762.2.diff (1.6 KB) - added by flixos90 7 years ago.

Download all attachments as: .zip

Change History (11)

#1 @spacedmonkey
7 years ago

  • Description modified (diff)
  • Summary changed from Use get_networks in ms_load_current_site_and_network to Use WP_Network_Query in ms_load_current_site_and_network

@spacedmonkey
7 years ago

#2 @spacedmonkey
7 years ago

Replace raw sql to the sites table with wp_network_query. Number of briefs to this, wp_network_query has filters that are run. Also network queries also have caching out of the box.

This ticket was mentioned in Slack in #core-multisite by spacedmonkey. View the logs.


7 years ago

This ticket was mentioned in Slack in #core-multisite by spacedmonkey. View the logs.


7 years ago

This ticket was mentioned in Slack in #core-multisite by spacedmonkey. View the logs.


7 years ago

This ticket was mentioned in Slack in #core-multisite by flixos90. View the logs.


7 years ago

#7 @flixos90
7 years ago

  • Milestone changed from Awaiting Review to 4.9
  • Owner set to flixos90
  • Status changed from new to reviewing

Let's keep the current-network cache in place for now, as it's less aggressively invalidated compared to the cache used by WP_Network_Query.

@flixos90
7 years ago

#8 @flixos90
7 years ago

41762.2.diff keeps the current-network cache key in place, and removes the now unused $wpdb global.

#9 @flixos90
7 years ago

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

In 41718:

Multisite: Use WP_Network_Query in ms_load_current_site_and_network().

This gets rid of the last readonly direct database query for networks in core. 🎉

Props spacedmonkey.
Fixes #41762.

Note: See TracTickets for help on using tickets.