Making WordPress.org

Changeset 7075


Ignore:
Timestamp:
04/10/2018 04:24:17 AM (6 years ago)
Author:
dd32
Message:

Plugin Directory: API Updater: Lessen how much data is stored for plugin assets.

  • default is only needed for icons, banners don't need it.
  • default is now only used for icons 'geopattern' default icons.

See #3265.

Location:
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory
Files:
2 edited

Legend:

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

    r7072 r7075  
    390390        if ( ! $icon || 'publish' !== $plugin->post_status ) {
    391391            $generated = true;
    392             $icon = $svg = self::get_geopattern_icon_url( $plugin );
     392            $icon = self::get_geopattern_icon_url( $plugin );
    393393        }
    394394
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/jobs/class-api-update-updater.php

    r7072 r7075  
    127127            $banners['1x'] = $raw_banners['banner'];
    128128        }
    129         if ( $banners ) {
    130             $banners['default']  = $banners['2x'] ?? $banners['1x'];
    131         }
    132129
    133130        // RTL Banners (get_plugin_banner 'raw_with_rtl' returns these)
     
    137134        if ( !empty( $raw_banners['banner_rtl'] ) ) {
    138135            $banners_rtl['1x'] = $raw_banners['banner_rtl'];
    139         }
    140         if ( $banners_rtl ) {
    141             $banners_rtl['default']  = $banners_rtl['2x'] ?? $banners_rtl['1x'];
    142136        }
    143137
     
    151145        if ( !empty( $raw_icons['svg'] ) ) {
    152146            $icons['svg'] = $raw_icons['svg'];
     147        }
     148        if ( !empty( $raw_icons['generated'] ) ) {
     149            // Geopattern SVG will be in 'icon':
     150            $icons['default'] = $raw_icons['icon'];
    153151
    154             // We don't need to set the 1x field when it's the SVG.
    155             if ( isset( $icons['1x'] ) && $icons['1x'] == $icons['svg'] ) {
    156                 unset( $icons['1x'] );
    157             }
    158         }
    159         if ( $icons ) {
    160             $icons['default'] = $icons['svg'] ?? ( $icons['2x'] ?? $icons['1x'] );
     152            // Don't set the `1x` field when it's a geopattern icon
     153            unset( $icons['1x'] );
    161154        }
    162155
Note: See TracChangeset for help on using the changeset viewer.