Changeset 9957
- Timestamp:
- 06/11/2020 04:38:22 AM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-routes/inc/routes/class-stats.php
r9907 r9957 151 151 $items = array(); 152 152 if ( 'plugins' == $view ) { 153 // Fetch top 100 plugins..153 // Fetch top ~500 plugins.. 154 154 $items = get_transient( __METHOD__ . '_plugin_items' ); 155 155 if ( false === $items ) { 156 $api = wp_safe_remote_get( 'https://api.wordpress.org/plugins/info/1.2/?action=query_plugins&request[per_page]=250' );157 156 $items = array(); 158 foreach ( json_decode( wp_remote_retrieve_body( $api ) )->plugins as $plugin ) { 159 $items[ $plugin->slug ] = (object) [ 160 'installs' => $plugin->active_installs, 161 ]; 157 foreach ( range( 1, 2 ) as $page ) { // 2 pages x 250 items per page. 158 $api = wp_safe_remote_get( 'https://api.wordpress.org/plugins/info/1.2/?action=query_plugins&request[per_page]=250&request[page]=' . $page ); 159 foreach ( json_decode( wp_remote_retrieve_body( $api ) )->plugins as $plugin ) { 160 $items[ $plugin->slug ] = (object) [ 161 'installs' => $plugin->active_installs, 162 ]; 163 } 162 164 } 163 165 set_transient( __METHOD__ . '_plugin_items', $items, $items ? DAY_IN_SECONDS : 5 * MINUTE_IN_SECONDS ); … … 174 176 WHERE p.post_type = 'repopackage' AND p.post_status = 'publish' 175 177 ORDER BY pm.meta_value+0 DESC, p.post_date 176 LIMIT 250",178 LIMIT 500", 177 179 OBJECT_K 178 180 );
Note: See TracChangeset
for help on using the changeset viewer.