Make WordPress Core


Ignore:
Timestamp:
05/06/2014 05:31:12 AM (11 years ago)
Author:
nacin
Message:

Multisite: Treat 'www' as a special subdomain, reversing 3.9 regression.

props jeremyfelt.
fixes #27927.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/ms.php

    r27718 r28280  
    12261226    /**
    12271227     * @ticket 27003
     1228     * @ticket 27927
    12281229     */
    12291230    function test_get_site_by_path() {
     
    12341235            'make.wordpress.org/'         => array( 'domain' => 'make.wordpress.org', 'path' => '/' ),
    12351236            'make.wordpress.org/foo/'     => array( 'domain' => 'make.wordpress.org', 'path' => '/foo/' ),
     1237            'www.w.org/'                  => array( 'domain' => 'www.w.org',          'path' => '/' ),
     1238            'www.w.org/foo/'              => array( 'domain' => 'www.w.org',          'path' => '/foo/' ),
     1239            'www.w.org/foo/bar/'          => array( 'domain' => 'www.w.org',          'path' => '/foo/bar/' ),
    12361240        );
    12371241
     
    12441248            get_site_by_path( 'wordpress.org', '/notapath/' )->blog_id );
    12451249
     1250        $this->assertEquals( $ids['wordpress.org/'],
     1251            get_site_by_path( 'www.wordpress.org', '/notapath/' )->blog_id );
     1252
    12461253        $this->assertEquals( $ids['wordpress.org/foo/bar/'],
    12471254            get_site_by_path( 'wordpress.org', '/foo/bar/baz/' )->blog_id );
    12481255
    12491256        $this->assertEquals( $ids['wordpress.org/foo/bar/'],
     1257            get_site_by_path( 'www.wordpress.org', '/foo/bar/baz/' )->blog_id );
     1258
     1259        $this->assertEquals( $ids['wordpress.org/foo/bar/'],
    12501260            get_site_by_path( 'wordpress.org', '/foo/bar/baz/', 3 )->blog_id );
     1261
     1262        $this->assertEquals( $ids['wordpress.org/foo/bar/'],
     1263            get_site_by_path( 'www.wordpress.org', '/foo/bar/baz/', 3 )->blog_id );
    12511264
    12521265        $this->assertEquals( $ids['wordpress.org/foo/bar/'],
    12531266            get_site_by_path( 'wordpress.org', '/foo/bar/baz/', 2 )->blog_id );
    12541267
     1268        $this->assertEquals( $ids['wordpress.org/foo/bar/'],
     1269            get_site_by_path( 'www.wordpress.org', '/foo/bar/baz/', 2 )->blog_id );
     1270
    12551271        $this->assertEquals( $ids['wordpress.org/foo/'],
    12561272            get_site_by_path( 'wordpress.org', '/foo/bar/baz/', 1 )->blog_id );
    12571273
     1274        $this->assertEquals( $ids['wordpress.org/foo/'],
     1275            get_site_by_path( 'www.wordpress.org', '/foo/bar/baz/', 1 )->blog_id );
     1276
    12581277        $this->assertEquals( $ids['wordpress.org/'],
    12591278            get_site_by_path( 'wordpress.org', '/', 0 )->blog_id );
    12601279
     1280        $this->assertEquals( $ids['wordpress.org/'],
     1281            get_site_by_path( 'www.wordpress.org', '/', 0 )->blog_id );
     1282
    12611283        $this->assertEquals( $ids['make.wordpress.org/foo/'],
    12621284            get_site_by_path( 'make.wordpress.org', '/foo/bar/baz/qux/', 4 )->blog_id );
     1285
     1286        $this->assertEquals( $ids['make.wordpress.org/foo/'],
     1287            get_site_by_path( 'www.make.wordpress.org', '/foo/bar/baz/qux/', 4 )->blog_id );
     1288
     1289        $this->assertEquals( $ids['www.w.org/'],
     1290            get_site_by_path( 'www.w.org', '/', 0 )->blog_id );
     1291
     1292        $this->assertEquals( $ids['www.w.org/'],
     1293            get_site_by_path( 'www.w.org', '/notapath/' )->blog_id );
     1294
     1295        $this->assertEquals( $ids['www.w.org/foo/bar/'],
     1296            get_site_by_path( 'www.w.org', '/foo/bar/baz/' )->blog_id );
     1297
     1298        $this->assertEquals( $ids['www.w.org/foo/'],
     1299            get_site_by_path( 'www.w.org', '/foo/bar/baz/', 1 )->blog_id );
     1300
     1301        // A site installed with www will not be found by the root domain.
     1302        $this->assertFalse( get_site_by_path( 'w.org', '/' ) );
     1303        $this->assertFalse( get_site_by_path( 'w.org', '/notapath/' ) );
     1304        $this->assertFalse( get_site_by_path( 'w.org', '/foo/bar/baz/' ) );
     1305        $this->assertFalse( get_site_by_path( 'w.org', '/foo/bar/baz/', 1 ) );
     1306
     1307        // A site will not be found by its root domain when an invalid subdomain is requested.
     1308        $this->assertFalse( get_site_by_path( 'invalid.wordpress.org', '/' ) );
     1309        $this->assertFalse( get_site_by_path( 'invalid.wordpress.org', '/foo/bar/' ) );
    12631310    }
    12641311
Note: See TracChangeset for help on using the changeset viewer.