Revert [25446] now that wp_blogs
.archived
is no longer an ENUM field. see #14511.
git-svn-id: https://develop.svn.wordpress.org/trunk@25590 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
05ffd2dad0
commit
05c7da77fa
@ -2042,7 +2042,7 @@ function wp_get_sites( $args = array() ) {
|
|||||||
$query .= $wpdb->prepare( "AND public = %d ", $args['public'] );
|
$query .= $wpdb->prepare( "AND public = %d ", $args['public'] );
|
||||||
|
|
||||||
if ( isset( $args['archived'] ) )
|
if ( isset( $args['archived'] ) )
|
||||||
$query .= $wpdb->prepare( "AND archived = %s ", (int) $args['archived'] ); // ENUM field
|
$query .= $wpdb->prepare( "AND archived = %d ", $args['archived'] );
|
||||||
|
|
||||||
if ( isset( $args['mature'] ) )
|
if ( isset( $args['mature'] ) )
|
||||||
$query .= $wpdb->prepare( "AND mature = %d ", $args['mature'] );
|
$query .= $wpdb->prepare( "AND mature = %d ", $args['mature'] );
|
||||||
|
@ -1089,25 +1089,6 @@ class Tests_MS extends WP_UnitTestCase {
|
|||||||
// Expect 0 sites when using an offset larger than the number of sites
|
// Expect 0 sites when using an offset larger than the number of sites
|
||||||
$this->assertCount( 0, wp_get_sites( array( 'offset' => 20 ) ) );
|
$this->assertCount( 0, wp_get_sites( array( 'offset' => 20 ) ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Test the 'archived' argument for wp_get_sites().
|
|
||||||
*
|
|
||||||
* archived is an ENUM, not an integer field.
|
|
||||||
* ENUM('0', '1') means '0' is index 1 and '1' is index 2.
|
|
||||||
* `WHERE archived = 1` is like saying `WHERE archived = '0'`.
|
|
||||||
* `WHERE archived = 0` would produce no results.
|
|
||||||
*
|
|
||||||
* @ticket 14511
|
|
||||||
*/
|
|
||||||
function test_wp_get_sites_archived_enum() {
|
|
||||||
global $wpdb;
|
|
||||||
$id = $this->factory->blog->create( array( 'site_id' => 2, 'meta' => array( 'archived' => '1' ) ) );
|
|
||||||
$this->factory->blog->create( array( 'site_id' => 2, 'meta' => array( 'archived' => '0' ) ) );
|
|
||||||
$results = wp_get_sites( array( 'network_id' => 2, 'archived' => 1 ) );
|
|
||||||
$this->assertCount( 1, $results );
|
|
||||||
$this->assertEquals( $id, $results[0]['blog_id'], "This query is wrong:\n" . $wpdb->last_query );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
endif;
|
endif;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user