Changeset 55657
- Timestamp:
- 04/18/2023 11:48:46 AM (16 months ago)
- Location:
- trunk
- Files:
-
- 1 added
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/class-wp-user-query.php
r55654 r55657 120 120 'login__in' => array(), 121 121 'login__not_in' => array(), 122 122 123 ); 123 124 … … 141 142 * @since 5.3.0 Introduced the 'meta_type_key' parameter. 142 143 * @since 5.9.0 Added 'capability', 'capability__in', and 'capability__not_in' parameters. 144 143 145 * 144 146 * @global wpdb $wpdb WordPress database abstraction object. … … 255 257 * @type string[] $login__not_in An array of logins to exclude. Users matching one of these 256 258 * logins will not be included in results. Default empty array. 259 257 260 * } 258 261 */ … … 790 793 791 794 $qv =& $this->query_vars; 795 796 797 798 799 792 800 793 801 /** … … 817 825 {$this->query_limit} 818 826 "; 819 820 if ( is_array( $qv['fields'] ) ) { 821 $this->results = $wpdb->get_results( $this->request ); 827 $cache_value = false; 828 $cache_key = $this->generate_cache_key( $qv, $this->request ); 829 $cache_group = 'users-queries'; 830 if ( $qv['cache_results'] ) { 831 $cache_value = wp_cache_get( $cache_key, $cache_group ); 832 } 833 if ( false !== $cache_value ) { 834 $this->results = $cache_value['user_data']; 835 $this->total_users = $cache_value['total_users']; 822 836 } else { 823 $this->results = $wpdb->get_col( $this->request ); 824 } 825 826 if ( isset( $qv['count_total'] ) && $qv['count_total'] ) { 827 /** 828 * Filters SELECT FOUND_ROWS() query for the current WP_User_Query instance. 829 * 830 * @since 3.2.0 831 * @since 5.1.0 Added the `$this` parameter. 832 * 833 * @global wpdb $wpdb WordPress database abstraction object. 834 * 835 * @param string $sql The SELECT FOUND_ROWS() query for the current WP_User_Query. 836 * @param WP_User_Query $query The current WP_User_Query instance. 837 */ 838 $found_users_query = apply_filters( 'found_users_query', 'SELECT FOUND_ROWS()', $this ); 839 840 $this->total_users = (int) $wpdb->get_var( $found_users_query ); 837 838 if ( is_array( $qv['fields'] ) ) { 839 $this->results = $wpdb->get_results( $this->request ); 840 } else { 841 $this->results = $wpdb->get_col( $this->request ); 842 } 843 844 if ( isset( $qv['count_total'] ) && $qv['count_total'] ) { 845 /** 846 * Filters SELECT FOUND_ROWS() query for the current WP_User_Query instance. 847 * 848 * @since 3.2.0 849 * @since 5.1.0 Added the `$this` parameter. 850 * 851 * @global wpdb $wpdb WordPress database abstraction object. 852 * 853 * @param string $sql The SELECT FOUND_ROWS() query for the current WP_User_Query. 854 * @param WP_User_Query $query The current WP_User_Query instance. 855 */ 856 $found_users_query = apply_filters( 'found_users_query', 'SELECT FOUND_ROWS()', $this ); 857 858 $this->total_users = (int) $wpdb->get_var( $found_users_query ); 859 } 860 861 if ( $qv['cache_results'] ) { 862 $cache_value = array( 863 'user_data' => $this->results, 864 'total_users' => $this->total_users, 865 ); 866 wp_cache_add( $cache_key, $cache_value, $cache_group ); 867 } 841 868 } 842 869 } … … 1012 1039 1013 1040 /** 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1014 1089 * Parses an 'order' query variable and casts it to ASC or DESC as necessary. 1015 1090 * -
trunk/src/wp-includes/default-filters.php
r55620 r55657 115 115 add_action( 'updated_post_meta', 'wp_cache_set_posts_last_changed' ); 116 116 add_action( 'deleted_post_meta', 'wp_cache_set_posts_last_changed' ); 117 118 119 120 121 122 123 124 117 125 118 126 // Term meta. -
trunk/src/wp-includes/load.php
r55652 r55657 777 777 'user_meta', 778 778 'userslugs', 779 779 780 ) 780 781 ); -
trunk/src/wp-includes/ms-blogs.php
r55537 r55657 574 574 'user_meta', 575 575 'userslugs', 576 576 577 ) 577 578 ); … … 667 668 'user_meta', 668 669 'userslugs', 670 669 671 ) 670 672 ); -
trunk/src/wp-includes/ms-functions.php
r55642 r55657 296 296 } 297 297 298 298 299 restore_current_blog(); 299 300 -
trunk/src/wp-includes/user.php
r55584 r55657 1908 1908 1909 1909 wp_cache_delete( $user->ID, 'user_meta' ); 1910 1910 1911 1911 1912 /** … … 5017 5018 ); 5018 5019 } 5020 5021 5022 5023 5024 5025 5026 5027 5028 -
trunk/tests/phpunit/includes/abstract-testcase.php
r55537 r55657 413 413 'user_meta', 414 414 'userslugs', 415 415 416 ) 416 417 );
Note: See TracChangeset
for help on using the changeset viewer.