WordPress.org

Make WordPress Core

Changeset 40391


Ignore:
Timestamp:
04/07/17 13:14:36 (5 months ago)
Author:
flixos90
Message:

Multisite: Partially revert [40295].

[40295] removed the restriction of a minimum amount of characters for new site names, which could cause unexpected behavior. That changeset is reverted here with the exception of the removal of the is_super_admin() check, which can safely be omitted. A new filter for the minimum site name length will be introduced later to be able to modify that behavior.

See #39676, #37616.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/ms-functions.php

    r40371 r40391  
    577577    if ( in_array( $blogname, $illegal_names ) ) 
    578578        $errors->add('blogname',  __( 'That name is not allowed.' ) ); 
     579 
     580    if ( strlen( $blogname ) < 4 ) { 
     581        $errors->add('blogname',  __( 'Site name must be at least 4 characters.' ) ); 
     582    } 
    579583 
    580584    // do not allow users to create a blog that conflicts with a page on the main blog. 
  • trunk/tests/phpunit/tests/multisite/wpmuValidateBlogSignup.php

    r40295 r40391  
    6565            array( self::$existing_blog_name, 'Site names must not collide with an existing site name.' ), 
    6666            array( self::$existing_user_login, 'Site names must not collide with an existing user login.' ), 
     67            array( 'foo', 'Site names must at least contain 4 characters.' ), 
    6768        ); 
    6869 
     
    8687        $this->assertEmpty( $result['errors']->get_error_codes() ); 
    8788    } 
    88  
    89     /** 
    90      * @ticket 39676 
    91      */ 
    92     public function test_validate_short_blogname() { 
    93         $result = wpmu_validate_blog_signup( 'foo', 'Foo Site Title', get_userdata( self::$super_admin_id ) ); 
    94         $this->assertEmpty( $result['errors']->get_error_codes() ); 
    95     } 
    9689} 
    9790 
Note: See TracChangeset for help on using the changeset viewer.