Changeset 9018
- Timestamp:
- 07/02/2019 07:41:56 AM (6 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
r8256 r9018 152 152 // Fetch top 100 plugins.. 153 153 $items = get_transient( __METHOD__ . '_plugin_items' ); 154 if ( !$items ) {154 if ( false === $items ) { 155 155 $api = wp_safe_remote_get( 'https://api.wordpress.org/plugins/info/1.2/?action=query_plugins&request[per_page]=250' ); 156 $items = array(); 156 157 foreach ( json_decode( wp_remote_retrieve_body( $api ) )->plugins as $plugin ) { 157 158 $items[ $plugin->slug ] = (object) [ … … 159 160 ]; 160 161 } 161 set_transient( __METHOD__ . '_plugin_items', $items, DAY_IN_SECONDS );162 set_transient( __METHOD__ . '_plugin_items', $items, $items ? DAY_IN_SECONDS : 5 * MINUTE_IN_SECONDS ); 162 163 } 163 164 } elseif ( 'themes' == $view && defined( 'WPORG_THEME_DIRECTORY_BLOGID' ) ) { 164 165 $items = get_transient( __METHOD__ . '_theme_items' ); 165 if ( !$items ) {166 if ( false === $items ) { 166 167 // The Themes API API isn't playing nice.. Easiest way.. 167 168 switch_to_blog( WPORG_THEME_DIRECTORY_BLOGID ); … … 179 180 unset( $items[$slug]->slug ); 180 181 } 181 set_transient( __METHOD__ . '_theme_items', $items, DAY_IN_SECONDS );182 set_transient( __METHOD__ . '_theme_items', $items, $items ? DAY_IN_SECONDS : 5 * MINUTE_IN_SECONDS ); 182 183 } 183 184 } else {
Note: See TracChangeset
for help on using the changeset viewer.