Changeset 13759
- Timestamp:
- 05/30/2024 04:48:38 AM (22 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/theme-directory/class-themes-api.php
r12632 r13759 223 223 */ 224 224 public function hot_tags() { 225 $cache_key = sanitize_key( __METHOD__ ); 226 if ( false === ( $this->response = wp_cache_get( $cache_key, $this->cache_group ) ) ) { 227 $tags = get_tags( array( 228 'orderby' => 'count', 229 'order' => 'DESC', 230 'hide_empty' => false, 231 ) ); 232 233 // Format in the API representation. 234 foreach ( $tags as $tag ) { 235 $this->response[ $tag->slug ] = array( 236 'name' => $tag->name, 237 'slug' => $tag->slug, 238 'count' => $tag->count, 239 ); 240 } 241 242 wp_cache_add( $cache_key, $this->response, $this->cache_group, $this->cache_life ); 225 $tags = get_tags( array( 226 'orderby' => 'count', 227 'order' => 'DESC', 228 'hide_empty' => false, 229 ) ); 230 231 // Format in the API representation. 232 foreach ( $tags as $tag ) { 233 $this->response[ $tag->slug ] = array( 234 'name' => $tag->name, 235 'slug' => $tag->slug, 236 'count' => $tag->count, 237 ); 243 238 } 244 239 … … 481 476 $this->fields = array_merge( $this->fields, $defaults, (array) $this->request->fields ); 482 477 483 // If there is a cached result, return that.484 $cache_key = sanitize_key( __METHOD__ . ':' . get_locale() . ':' . $this->request->slug . ':' . md5( serialize( $this->fields ) ) );485 if ( false !== ( $this->response = wp_cache_get( $cache_key, $this->cache_group ) ) && empty( $this->request->cache_buster ) ) {486 return;487 }488 489 478 if ( !empty( $post ) && 'repopackage' == $post->post_type && $this->request->slug === $post->post_name ) { 490 479 $this->response = $this->fill_theme( $post ); … … 503 492 } 504 493 } 505 506 wp_cache_set( $cache_key, $this->response, $this->cache_group, $this->cache_life );507 494 } 508 495 … … 551 538 $this->fields = array_merge( $this->fields, $defaults, $this->request->fields ); 552 539 553 // If there is a cached result, return that.554 $cache_key = sanitize_key( __METHOD__ . ':' . get_locale() . ':' . md5( serialize( $this->request ) . serialize( $this->fields ) ) );555 if ( false !== ( $this->response = wp_cache_get( $cache_key, $this->cache_group ) ) && empty( $this->request->cache_buster ) ) {556 return;557 }558 559 540 $this->result = $this->perform_wp_query(); 560 541 … … 576 557 $this->response->themes[] = $this->fill_theme( $theme ); 577 558 } 578 579 wp_cache_set( $cache_key, $this->response, $this->cache_group, $this->cache_life );580 559 } 581 560 … … 678 657 'post_type' => 'theme_shop', 679 658 'posts_per_page' => -1, 659 // NOTE: This rand() disables WP_Query caching. 680 660 'orderby' => 'rand(' . gmdate('YmdH') . ')', 681 661 ) ); … … 704 684 */ 705 685 public function fill_theme( $theme ) { 706 // If there is a cached theme for the current locale, return that.707 $cache_key = sanitize_key( implode( '-', array( $theme->post_name, md5( serialize( $this->fields ) ), get_locale() ) ) );708 if ( false !== ( $phil = wp_cache_get( $cache_key, $this->cache_group ) ) && empty( $this->request->cache_buster ) ) {709 return $phil;710 }711 712 686 global $wpdb; 713 687 … … 944 918 } 945 919 946 wp_cache_set( $cache_key, $phil, $this->cache_group, $this->cache_life );947 948 920 return $phil; 949 921 }
Note: See TracChangeset
for help on using the changeset viewer.