Make WordPress Core

Opened 9 years ago

Closed 9 years ago

#41805 closed enhancement (fixed)

Use get_network in populate_network function

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

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 9 years ago.
41805.2.diff (1.0 KB ) - added by flixos90 9 years ago.

Download all attachments as: .zip

Change History (4)

@spacedmonkey
9 years ago

@flixos90
9 years ago

#1 @flixos90
9 years ago

  • Milestone Awaiting Review4.9
  • Owner set to flixos90
  • Status newreviewing

@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
9 years ago

  • Resolutionfixed
  • Status reviewingclosed

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.