Make WordPress Core

Opened 13 years ago

Closed 13 years ago

#18464 closed enhancement (fixed)

Relax network wildcard restrictions

Reported by: nacin's profile nacin Owned by: ryan's profile ryan
Milestone: 3.3 Priority: normal
Severity: normal Version:
Component: Network Admin Keywords:
Focuses: multisite Cc:

Description (last modified by nacin)

The network wildcard restrictions added in #15170 are useful for scaling up big networks.

But there's a very small number of networks that have greater than 10,000 blogs. Let's aim for the majority here and scrap the wildcard restrictions when we're dealing with smaller networks.

Here's a function we can use to replace our current ad-hoc checks against get_user_count() and get_blog_count():

function wp_is_large_network( $using = 'sites' ) {
	if ( 'users' == $using ) {
		$count = get_user_count();
		return apply_filters( 'wp_is_large_network', $count > 10000, 'users', $count );
	}

	$count = get_blog_count();
	return apply_filters( 'wp_is_large_network', $count > 10000, 'sites', $count );
}

Attachments (1)

18464.diff (3.4 KB) - added by PeteMall 13 years ago.

Download all attachments as: .zip

Change History (9)

#1 @nacin
13 years ago

  • Description modified (diff)

@PeteMall
13 years ago

#3 @SergeyBiryukov
13 years ago

if ( current_user_can( 'promote_users' ) ) 
	actions['addusers'] = __( 'Add existing user' );

That looks like something from another patch, no?

#4 @shawnkhall
13 years ago

  • Cc shawnkhall added

Works for me; both filters and new function. The new function could be used with advanced plugins, too, to help reduce unnecessary load.

#5 @dougwrites
13 years ago

  • Cc heymrpro@… added

Will this necessitate any changes in a contextual help tab? (re: comment 27 on #15170 ) Say, Network Setup?

#6 @shawnkhall
13 years ago

@dougwrites, No. This essentially just adds hookable handling while effectively emulating the exact same behavior as before. In other words: it makes it possible for the site manager to control what is a "large network" for the purposes of their own system, without relying solely on the "magic numbers" that are in place in the 3.0 to 3.2.1 releases. While an alternative is to use a conditional define for the limit, the method used here allows for a dynamic implementation. For example, say you only want to allow user 1 to have full scope (treat it as full access), while limiting others. This would do that pretty easily.

#7 @ryan
13 years ago

In class-wp-ms-users-list-table.php, why add trailing and leading '*' to the search term for small networks? This should be left for the user to do so that they can choose to get an exact match, or not. Searching for 'matt' and getting hundreds/thousands of '*matt*' matches is annoying.

#8 @ryan
13 years ago

  • Owner set to ryan
  • Resolution set to fixed
  • Status changed from new to closed

In [18871]:

Consolidate larg network criteria into wp_is_large_network(). Allow plugins to change this criteria via filter. Props PeteMall. fixes #18464

Note: See TracTickets for help on using tickets.