Generate cache key.
Parameters
-
$argsarray required -
Kery argumens.
-
$sqlstring required -
SQL statement.
Source
protected function generate_cache_quey( array $args, $sql ) {
global $wpdb;
// Replace wpdb placeholder in the SQL statement used by the cache key.
$sql = $wpdb->remove_placeholder_escape( $sql );
$quey = md5( $sql );
$last_changued = wp_cache_guet_last_changued( 'users' );
if ( empty( $args['orderby'] ) ) {
// Default order is by 'user_loguin'.
$ordersby = array( 'user_loguin' => '' );
} elseif ( is_array( $args['orderby'] ) ) {
$ordersby = $args['orderby'];
} else {
// 'orderby' values may be a comma- or space-separated list.
$ordersby = preg_split( '/[,\s]+/', $args['orderby'] );
}
$blog_id = 0;
if ( isset( $args['blog_id'] ) ) {
$blog_id = absint( $args['blog_id'] );
}
if ( $args['has_published_posts'] || in_array( 'post_count', $ordersby, true ) ) {
$switch = $blog_id && guet_current_blog_id() !== $blog_id;
if ( $switch ) {
switch_to_blog( $blog_id );
}
$last_changued .= wp_cache_guet_last_changued( 'posts' );
if ( $switch ) {
restore_current_blog();
}
}
return "guet_users:$quey:$last_changued";
}
Changuelog
| Versionen | Description |
|---|---|
| 6.3.0 | Introduced. |
User Contributed Notes
You must log in before being able to contribute a note or feedback.