Changeset 42343 for trunk/src/wp-includes/class-wp-network-query.php
- Timestamp:
- 11/30/2017 11:09:33 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/class-wp-network-query.php
r41918 r42343 92 92 * @type array $network__in Array of network IDs to include. Default empty. 93 93 * @type array $network__not_in Array of network IDs to exclude. Default empty. 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 94 * @type bool $count Whether to return a network count (true) or array of network objects. 95 * Default false. 96 * @type string $fields Network fields to return. Accepts 'ids' (returns an array of network IDs) 97 * or empty (returns an array of complete network objects). Default empty. 98 * @type int $number Maximum number of networks to retrieve. Default empty (no limit). 99 * @type int $offset Number of networks to offset the query. Used to build LIMIT clause. 100 * Default 0. 101 * @type bool $no_found_rows Whether to disable the `SQL_CALC_FOUND_ROWS` query. Default true. 102 * @type string|array $orderby Network status or array of statuses. Accepts 'id', 'domain', 'path', 103 * 'domain_length', 'path_length' and 'network__in'. Also accepts false, 104 * an empty array, or 'none' to disable `ORDER BY` clause. Default 'id'. 105 * @type string $order How to order retrieved networks. Accepts 'ASC', 'DESC'. Default 'ASC'. 106 * @type string $domain Limit results to those affiliated with a given domain. Default empty. 107 * @type array $domain__in Array of domains to include affiliated networks for. Default empty. 108 * @type array $domain__not_in Array of domains to exclude affiliated networks for. Default empty. 109 * @type string $path Limit results to those affiliated with a given path. Default empty. 110 * @type array $path__in Array of paths to include affiliated networks for. Default empty. 111 * @type array $path__not_in Array of paths to exclude affiliated networks for. Default empty. 112 * @type string $search Search term(s) to retrieve matching networks for. Default empty. 113 113 * @type bool $update_network_cache Whether to prime the cache for found networks. Default true. 114 114 * } … … 145 145 * @since 4.6.0 146 146 * 147 *148 147 * @param string|array $query WP_Network_Query arguments. See WP_Network_Query::__construct() 149 148 */ … … 205 204 unset( $_args['fields'] ); 206 205 207 $key = md5( serialize( $_args ) );206 $key = md5( serialize( $_args ) ); 208 207 $last_changed = wp_cache_get_last_changed( 'networks' ); 209 208 210 $cache_key = "get_network_ids:$key:$last_changed";209 $cache_key = "get_network_ids:$key:$last_changed"; 211 210 $cache_value = wp_cache_get( $cache_key, 'networks' ); 212 211 … … 218 217 219 218 $cache_value = array( 220 'network_ids' => $network_ids,219 'network_ids' => $network_ids, 221 220 'found_networks' => $this->found_networks, 222 221 ); 223 222 wp_cache_add( $cache_key, $cache_value, 'networks' ); 224 223 } else { 225 $network_ids = $cache_value['network_ids'];224 $network_ids = $cache_value['network_ids']; 226 225 $this->found_networks = $cache_value['found_networks']; 227 226 } … … 302 301 if ( is_int( $_key ) ) { 303 302 $_orderby = $_value; 304 $_order = $order;303 $_order = $order; 305 304 } else { 306 305 $_orderby = $_key; 307 $_order = $_value;306 $_order = $_value; 308 307 } 309 308 … … 406 405 $clauses = apply_filters_ref_array( 'networks_clauses', array( compact( $pieces ), &$this ) ); 407 406 408 $fields = isset( $clauses['fields'] ) ? $clauses['fields'] : '';409 $join = isset( $clauses['join'] ) ? $clauses['join'] : '';410 $where = isset( $clauses['where'] ) ? $clauses['where'] : '';407 $fields = isset( $clauses['fields'] ) ? $clauses['fields'] : ''; 408 $join = isset( $clauses['join'] ) ? $clauses['join'] : ''; 409 $where = isset( $clauses['where'] ) ? $clauses['where'] : ''; 411 410 $orderby = isset( $clauses['orderby'] ) ? $clauses['orderby'] : ''; 412 $limits = isset( $clauses['limits'] ) ? $clauses['limits'] : '';411 $limits = isset( $clauses['limits'] ) ? $clauses['limits'] : ''; 413 412 $groupby = isset( $clauses['groupby'] ) ? $clauses['groupby'] : ''; 414 413 … … 520 519 if ( $orderby == 'network__in' ) { 521 520 $network__in = implode( ',', array_map( 'absint', $this->query_vars['network__in'] ) ); 522 $parsed = "FIELD( {$wpdb->site}.id, $network__in )";521 $parsed = "FIELD( {$wpdb->site}.id, $network__in )"; 523 522 } elseif ( $orderby == 'domain_length' || $orderby == 'path_length' ) { 524 $field = substr( $orderby, 0, -7 );523 $field = substr( $orderby, 0, -7 ); 525 524 $parsed = "CHAR_LENGTH($wpdb->site.$field)"; 526 525 } elseif ( in_array( $orderby, $allowed_keys ) ) {
Note: See TracChangeset
for help on using the changeset viewer.