Changeset 2986 for sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/class-template.php
- Timestamp:
- 04/20/2016 11:59:45 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
r2621 r2986 10 10 11 11 /** 12 * @param string $plugin_slug12 * @param \WP_Post|int $post Optional. 13 13 * @return int 14 14 */ 15 static function get_active_installs_count( $plugin_slug ) { 16 if ( false === ( $count = wp_cache_get( $plugin_slug, 'plugin_active_installs' ) ) ) { 17 global $wpdb; 18 19 $count = (int) $wpdb->get_var( $wpdb->prepare( 20 "SELECT count FROM rev2_daily_stat_summary WHERE type = 'plugin' AND type_name = %s AND stat = 'active_installs' LIMIT 1", 21 $plugin_slug 22 ) ); 23 wp_cache_add( $plugin_slug, $count, 'plugin_active_installs', 1200 ); 24 } 25 26 if ( $count < 10 ) { 27 return 0; 28 } 29 30 if ( $count >= 1000000 ) { 31 return 1000000; 32 } 33 34 return strval( $count )[0] * pow( 10, floor( log10( $count ) ) ); 15 static function get_active_installs_count( $post = null ) { 16 $post = get_post( $post ); 17 18 return get_post_meta( $post->ID, 'active_installs', true ); 35 19 } 36 20
Note: See TracChangeset
for help on using the changeset viewer.