Skip to content

Commit

Permalink
Kill WP_Object_Query. See #15032
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.automattic.com/wordpress/trunk@16353 1a063a9b-81f0-0310-95a4-ce76da25c4cd
  • Loading branch information
scribu committed Nov 13, 2010
1 parent cd60463 commit 40b2c5b
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 42 deletions.
36 changes: 0 additions & 36 deletions wp-includes/class-wp-object-query.php

This file was deleted.

2 changes: 1 addition & 1 deletion wp-includes/comment.php
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ function get_comments( $args = '' ) {
*
* @since 3.1.0
*/
class WP_Comment_Query extends WP_Object_Query {
class WP_Comment_Query {

/**
* Execute the query
Expand Down
24 changes: 24 additions & 0 deletions wp-includes/meta.php
Original file line number Diff line number Diff line change
Expand Up @@ -444,6 +444,30 @@ function get_meta_sql( $meta_query, $meta_type, $primary_table, $primary_id_colu
return apply_filters_ref_array( 'get_meta_sql', array( compact( 'join', 'where' ), $meta_query, $meta_type, $primary_table, $primary_id_column, &$context ) );
}

/*
* Populates the $meta_query property
*
* @access private
* @since 3.1.0
*
* @param array $qv The query variables
*/
function _parse_meta_query( &$qv ) {
$meta_query = array();

// Simple query needs to be first for orderby=meta_value to work correctly
foreach ( array( 'key', 'value', 'compare', 'type' ) as $key ) {
if ( !empty( $qv[ "meta_$key" ] ) )
$meta_query[0][ $key ] = $qv[ "meta_$key" ];
}

if ( !empty( $qv['meta_query'] ) && is_array( $qv['meta_query'] ) ) {
$meta_query = array_merge( $meta_query, $qv['meta_query'] );
}

$qv['meta_query'] = $meta_query;
}

/**
* Retrieve the name of the metadata table for the specified object type.
*
Expand Down
4 changes: 2 additions & 2 deletions wp-includes/query.php
Original file line number Diff line number Diff line change
Expand Up @@ -688,7 +688,7 @@ function the_comment() {
*
* @since 1.5.0
*/
class WP_Query extends WP_Object_Query {
class WP_Query {

/**
* Query vars set by the user
Expand Down Expand Up @@ -1347,7 +1347,7 @@ function parse_query($query) {

$this->parse_tax_query( $qv );

$this->parse_meta_query( $qv );
_parse_meta_query( $qv );

if ( empty($qv['author']) || ($qv['author'] == '0') ) {
$this->is_author = false;
Expand Down
4 changes: 2 additions & 2 deletions wp-includes/user.php
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ function delete_user_option( $user_id, $option_name, $global = false ) {
*
* @since 3.1.0
*/
class WP_User_Query extends WP_Object_Query {
class WP_User_Query {

/**
* List of found user ids
Expand Down Expand Up @@ -463,7 +463,7 @@ function prepare_query() {
$this->query_where .= $this->get_search_sql( $search, $search_columns, $wild );
}

$this->parse_meta_query( $qv );
_parse_meta_query( $qv );

$role = trim( $qv['role'] );
$blog_id = absint( $qv['blog_id'] );
Expand Down
1 change: 0 additions & 1 deletion wp-settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,6 @@
// Load most of WordPress.
require( ABSPATH . WPINC . '/class-wp-walker.php' );
require( ABSPATH . WPINC . '/class-wp-ajax-response.php' );
require( ABSPATH . WPINC . '/class-wp-object-query.php' );
require( ABSPATH . WPINC . '/formatting.php' );
require( ABSPATH . WPINC . '/capabilities.php' );
require( ABSPATH . WPINC . '/query.php' );
Expand Down

0 comments on commit 40b2c5b

Please sign in to comment.