Make WordPress Core

Opened 7 years ago

Closed 7 years ago

#40489 closed enhancement (fixed)

Add network ID parameter to wp_is_large_network()

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


Since network options are globally accessible for every network (without involving any expensive switching function), we should add a $network_id parameter to wp_is_large_network() that will allow to check those conditions for a network other than the current one.

This enhancement is furthermore required in order to make #40384 and #40385 possible.

Attachments (2)

40489.diff (2.0 KB) - added by flixos90 7 years ago.
40489.2.diff (6.1 KB) - added by flixos90 7 years ago.

Download all attachments as: .zip

Change History (6)

7 years ago

#1 @flixos90
7 years ago

  • Keywords has-patch needs-unit-tests added; needs-patch removed
  • Owner set to flixos90
  • Status changed from new to assigned

40489.diff adds the $network_id parameter to the function as well as to the filter. Are there any objections to doing that in the way it happens in that patch, or in general?

We should definitely add thorough unit tests for both the function as well as different usages of the filter to verify things work as expected.

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

7 years ago

7 years ago

#3 @flixos90
7 years ago

  • Keywords has-unit-tests commit added; needs-unit-tests removed

40489.2.diff adds unit tests for the function and the filter:

  • One test with data for the default function behavior.
  • One test with data for a filter that only allows a maximum of 1000 when using 'users'.
  • One test with data for a filter that only allows a maximum of 1000 for a specific network.

All test data includes variants with a different network than the current one, in order to test the actual changes from this ticket.

#4 @flixos90
7 years ago

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

In 40590:

Multisite: Add $network_id parameter to wp_is_large_network().

Now that get_blog_count() and get_user_count() both support passing a $network_id parameter (see [40370] and [40371]), similar functionality is now available for wp_is_large_network(). In addition, the filter wp_is_large_network now accepts the network ID as its fourth parameter.

This changeset furthermore introduces unit tests for the wp_is_large_network() function and its filter.

Fixes #40489.

Note: See TracTickets for help on using tickets.