Making WordPress.org

Changeset 4572


Ignore:
Timestamp:
12/23/2016 02:10:39 AM (7 years ago)
Author:
dd32
Message:

Plugin Directory: API: Return an empty array of tags for when the hot_tags api is unavailable.
The handling for the 'error' key was previously being matched by.. the error tag.. Even when an error is returned to the client though, WordPress includes no error-case handler here, so returning an empty array is safer.

See #2112

File:
1 edited

Legend:

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

    r4570 r4572  
    204204
    205205            if ( 200 != $response->status ) {
    206                 $response = array( 'error' => 'Temporarily Unavailable' );
     206                $response = array(); // WordPress includes no handling for this API being unavailable, so just return nothing.
    207207                wp_cache_set( $cache_key, $response, self::CACHE_GROUP, 30 ); // Short expiry for when we've got issues
    208208            } else {
     
    210210                wp_cache_set( $cache_key, $response, self::CACHE_GROUP, self::CACHE_EXPIRY );
    211211            }
    212         }
    213 
    214         if ( isset( $response['error'] ) ) {
    215             $this->output( (object) $response );
    216             return;
    217212        }
    218213
Note: See TracChangeset for help on using the changeset viewer.