Kill WP_Object_Query. See #15032

git-svn-id: http://svn.automattic.com/wordpress/trunk@16353 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
scribu 2010-11-13 18:32:43 +00:00
parent cd60463f36
commit 40b2c5b6c5
6 changed files with 29 additions and 42 deletions

View File

@ -1,36 +0,0 @@
<?php
/**
* WordPress Query class.
*
* Abstract class for handling advanced queries
*
* @package WordPress
* @since 3.1.0
*/
class WP_Object_Query {
/*
* Populates the $meta_query property
*
* @access protected
* @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;
}
}
?>

View File

@ -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

View File

@ -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.
*

View File

@ -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
@ -1347,7 +1347,7 @@ class WP_Query extends WP_Object_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;

View File

@ -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
@ -463,7 +463,7 @@ class WP_User_Query extends WP_Object_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'] );

View File

@ -103,7 +103,6 @@ wp_not_installed();
// 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' );