Changeset 2991 for sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/class-template.php
- Timestamp:
- 04/21/2016 05:57:55 AM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/class-template.php
r2986 r2991 20 20 21 21 /** 22 * @param \WP_Post|int $post Optional. 23 * @return int 24 */ 25 static function get_downloads_count( $post = null ) { 26 $post = get_post( $post ); 27 28 if ( false === ( $count = wp_cache_get( $post->ID, 'plugin_download_count' ) ) ) { 29 global $wpdb; 30 31 // TODO: While the plugin ZIPs are still being served by bbPress, the download stats are stored there. 32 $count = $wpdb->get_var( $wpdb->prepare( "SELECT downloads FROM `" . PLUGINS_TABLE_PREFIX . "download_counts` WHERE topic_id = (SELECT topic_id FROM `" . PLUGINS_TABLE_PREFIX . "topics` WHERE topic_slug = %s )", $post->post_name ) ); 33 34 wp_cache_set( $post->ID, $count, 'plugin_download_count', HOUR_IN_SECONDS ); 35 } 36 37 return (int) $count; 38 } 39 40 /** 22 41 * @return int 23 42 */ … … 26 45 global $wpdb; 27 46 28 $count = $wpdb->get_var( "SELECT SUM(downloads) FROM ` plugin_2_stats`" );29 wp_cache_ add( 'plugin_download_count', $count, 'plugin_download_count', DAY_IN_SECONDS );47 $count = $wpdb->get_var( "SELECT SUM(downloads) FROM `" . PLUGINS_TABLE_PREFIX . "stats`" ); 48 wp_cache_set( 'plugin_download_count', $count, 'plugin_download_count', DAY_IN_SECONDS ); 30 49 } 31 50
Note: See TracChangeset
for help on using the changeset viewer.