Multisite: Use WP_Site_Query to power WP_MS_Sites_List_Table.

`WP_Site_Query` provides for a cleaner `prepare_items()` method. It significantly improves the search experience in the sites list table:

* In a subdomain configuration, domain and path are searched for a provided terms.
* In a subdirectory configuration, path is searched for a provided term.
* The full domain is searched in a subdomain configuration rather than the portion not matching the network's domain.
* Terms are searched as `%term%` by default. Adding `*` in the middle of a term will search `%te%rm%`.

Props flixos90, Fab1en.
Fixes #33185, #24833, #21837, #36675.


git-svn-id: https://develop.svn.wordpress.org/trunk@37736 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Jeremy Felt
2016-06-17 00:02:05 +00:00
parent 3d56328372
commit 96d7eadb0c
2 changed files with 58 additions and 48 deletions

View File

@@ -73,8 +73,11 @@ class Tests_WP_MS_Sites_List_Table extends WP_UnitTestCase {
$expected = array(
self::$site_ids['wordpress.org/foo/'],
self::$site_ids['wordpress.org/foo/bar/'],
self::$site_ids['wordpress.org/afoo/'],
self::$site_ids['make.wordpress.org/foo/'],
self::$site_ids['www.w.org/foo/'],
self::$site_ids['www.w.org/foo/bar/'],
);
$this->assertEqualSets( $expected, $items );
@@ -131,6 +134,9 @@ class Tests_WP_MS_Sites_List_Table extends WP_UnitTestCase {
$expected = array(
self::$site_ids['test.example.org/'],
self::$site_ids['test2.example.org/'],
self::$site_ids['test3.example.org/zig/'],
self::$site_ids['atest.example.org/'],
);
$this->assertEqualSets( $expected, $items );
@@ -154,6 +160,7 @@ class Tests_WP_MS_Sites_List_Table extends WP_UnitTestCase {
self::$site_ids['test.example.org/'],
self::$site_ids['test2.example.org/'],
self::$site_ids['test3.example.org/zig/'],
self::$site_ids['atest.example.org/'],
);
$this->assertEqualSets( $expected, $items );
@@ -176,6 +183,7 @@ class Tests_WP_MS_Sites_List_Table extends WP_UnitTestCase {
$expected = array(
self::$site_ids['wordpress.org/foo/'],
self::$site_ids['wordpress.org/foo/bar/'],
self::$site_ids['wordpress.org/afoo/'],
self::$site_ids['make.wordpress.org/foo/'],
self::$site_ids['www.w.org/foo/'],
self::$site_ids['www.w.org/foo/bar/'],