Make WordPress Core

Changeset 48065


Ignore:
Timestamp:
06/16/2020 07:07:04 PM (5 years ago)
Author:
SergeyBiryukov
Message:

Coding Standards: Rename the $clean or $ids variable in several functions to $non_cached_ids for clarity.

  • _get_non_cached_ids()
  • update_meta_cache()
  • update_object_term_cache()

See #49542.

Location:
trunk/src/wp-includes
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/functions.php

    r48059 r48065  
    63606360 */
    63616361function _get_non_cached_ids( $object_ids, $cache_key ) {
    6362     $clean        = array();
    6363     $cache_values = wp_cache_get_multiple( $object_ids, $cache_key );
    6364     foreach ( $cache_values as $id => $cache_value ) {
    6365         $id = (int) $id;
    6366         if ( ! $cache_value ) {
    6367             $clean[] = $id;
    6368         }
    6369     }
    6370 
    6371     return $clean;
     6362    $non_cached_ids = array();
     6363    $cache_values   = wp_cache_get_multiple( $object_ids, $cache_key );
     6364
     6365    foreach ( $cache_values as $id => $value ) {
     6366        if ( ! $value ) {
     6367            $non_cached_ids[] = (int) $id;
     6368        }
     6369    }
     6370
     6371    return $non_cached_ids;
    63726372}
    63736373
  • trunk/src/wp-includes/meta.php

    r48055 r48065  
    927927    }
    928928
    929     $cache_key    = $meta_type . '_meta';
    930     $ids          = array();
    931     $cache        = array();
    932     $cache_values = wp_cache_get_multiple( $object_ids, $cache_key );
     929    $cache_key      = $meta_type . '_meta';
     930    $non_cached_ids = array();
     931    $cache          = array();
     932    $cache_values   = wp_cache_get_multiple( $object_ids, $cache_key );
     933
    933934    foreach ( $cache_values as $id => $cached_object ) {
    934935        if ( false === $cached_object ) {
    935             $ids[] = $id;
     936            $non_cached_ids[] = $id;
    936937        } else {
    937938            $cache[ $id ] = $cached_object;
     
    939940    }
    940941
    941     if ( empty( $ids ) ) {
     942    if ( empty( $non_cached_ids ) ) {
    942943        return $cache;
    943944    }
    944945
    945946    // Get meta info.
    946     $id_list   = join( ',', $ids );
     947    $id_list   = join( ',', $non_cached_ids );
    947948    $id_column = ( 'user' === $meta_type ) ? 'umeta_id' : 'meta_id';
    948949
     
    968969    }
    969970
    970     foreach ( $ids as $id ) {
     971    foreach ( $non_cached_ids as $id ) {
    971972        if ( ! isset( $cache[ $id ] ) ) {
    972973            $cache[ $id ] = array();
  • trunk/src/wp-includes/taxonomy.php

    r48055 r48065  
    32693269        $terms  = $wpdb->get_results( "SELECT term_id, taxonomy FROM $wpdb->term_taxonomy WHERE term_taxonomy_id IN ($tt_ids)" );
    32703270        $ids    = array();
     3271
    32713272        foreach ( (array) $terms as $term ) {
    32723273            $taxonomies[] = $term->taxonomy;
     
    32743275            wp_cache_delete( $term->term_id, 'terms' );
    32753276        }
     3277
    32763278        $taxonomies = array_unique( $taxonomies );
    32773279    } else {
    32783280        $taxonomies = array( $taxonomy );
     3281
    32793282        foreach ( $taxonomies as $taxonomy ) {
    32803283            foreach ( $ids as $id ) {
     
    34063409    }
    34073410
    3408     $object_ids = array_map( 'intval', $object_ids );
     3411    $object_ids     = array_map( 'intval', $object_ids );
     3412    $non_cached_ids = array();
    34093413
    34103414    $taxonomies = get_object_taxonomies( $object_type );
    34113415
    3412     $ids = array();
    34133416    foreach ( $taxonomies as $taxonomy ) {
    34143417        $cache_values = wp_cache_get_multiple( (array) $object_ids, "{$taxonomy}_relationships" );
    3415         foreach ( $cache_values as $key => $value ) {
     3418
     3419        foreach ( $cache_values as $id => $value ) {
    34163420            if ( false === $value ) {
    3417                 $ids[] = $key;
     3421                $non_cached_ids[] = $id;
    34183422                break;
    34193423            }
     
    34213425    }
    34223426
    3423     if ( empty( $ids ) ) {
     3427    if ( empty( $non_cached_ids ) ) {
    34243428        return false;
    34253429    }
    34263430
    34273431    $terms = wp_get_object_terms(
    3428         $ids,
     3432        $non_cached_ids,
    34293433        $taxonomies,
    34303434        array(
     
    34403444    }
    34413445
    3442     foreach ( $ids as $id ) {
     3446    foreach ( $non_cached_ids as $id ) {
    34433447        foreach ( $taxonomies as $taxonomy ) {
    34443448            if ( ! isset( $object_terms[ $id ][ $taxonomy ] ) ) {
Note: See TracChangeset for help on using the changeset viewer.