Making WordPress.org


Ignore:
Timestamp:
07/02/2019 04:18:38 AM (7 years ago)
Author:
dd32
Message:

Plugin Directory: Fetch the download count from Post Meta rather than the downloads table directly.

Amends [9009].

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/class-template.php

    r9009 r9010  
    271271         *
    272272         * @static
    273          * @global \wpdb $wpdb WordPress database abstraction object.
    274273         *
    275274         * @param int|\WP_Post|null $post Optional.
     
    279278                $post = get_post( $post );
    280279
    281                 if ( false === ( $count = wp_cache_get( $post->ID, 'plugin_download_count' ) ) ) {
    282                         global $wpdb;
    283 
    284                         $count = $wpdb->get_var( $wpdb->prepare( 'SELECT downloads FROM `' . PLUGINS_TABLE_PREFIX . 'download_counts` WHERE plugin_slug = %s', $post->post_name ) );
    285 
    286                         wp_cache_set( $post->ID, $count, 'plugin_download_count', HOUR_IN_SECONDS );
    287                 }
    288 
    289                 return (int) $count;
     280                return (int)get_post_meta( $post->ID, 'downloads', true );
    290281        }
    291282
Note: See TracChangeset for help on using the changeset viewer.