Make WordPress Core

Opened 7 years ago

Closed 7 years ago

#41805 closed enhancement (fixed)

Use get_network in populate_network function

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

Description

In populate network there is a raw call to the sites table. This can easily be replaced with a get_network.

Attachments (2)

41805.diff (808 bytes) - added by spacedmonkey 7 years ago.
41805.2.diff (1.0 KB) - added by flixos90 7 years ago.

Download all attachments as: .zip

Change History (4)

@spacedmonkey
7 years ago

@flixos90
7 years ago

#1 @flixos90
7 years ago

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

@spacedmonkey Good catch! 41805.2.diff uses get_network() conditionally. This is needed because populate_network() may also be used when multisite is being set up and the multisite API is not yet available.

#2 @flixos90
7 years ago

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

In 41348:

Multisite: Use get_network() in populate_network() to check whether a network with the given ID already exists.

When multisite is setup already, e.g. in a multi network environment, this change gives a performance benefit over the direct SQL query that was previously used. The SQL query remains in place for when setting up multisite initially as the network API is not available at that point.

Props spacedmonkey.
Fixes #41805.

Note: See TracTickets for help on using tickets.