Making WordPress.org

Changeset 3019


Ignore:
Timestamp:
04/27/2016 07:51:54 AM (9 years ago)
Author:
dd32
Message:

Plugin Directory: When importing, store a list of the SVN tags for later reference.

See #1584

File:
1 edited

Legend:

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

    r3008 r3019  
    7272        $assets = $data['assets'];
    7373        $headers = $data['plugin_headers'];
     74        $tagged_versions = $data['tagged_versions'];
    7475
    7576        $content = '';
     
    101102        }
    102103
    103         update_post_meta( $plugin->ID, 'sections', array_keys( $readme->sections ) );
    104         update_post_meta( $plugin->ID, 'assets_screenshots', $assets['screenshot'] );
    105         update_post_meta( $plugin->ID, 'assets_icons',       $assets['icon'] );
    106         update_post_meta( $plugin->ID, 'assets_banners',     $assets['banner'] );
     104        update_post_meta( $plugin->ID, 'tagged_versions',    wp_slash( $tagged_versions ) );
     105        update_post_meta( $plugin->ID, 'sections',           wp_slash( array_keys( $readme->sections ) ) );
     106        update_post_meta( $plugin->ID, 'assets_screenshots', wp_slash( $assets['screenshot'] ) );
     107        update_post_meta( $plugin->ID, 'assets_icons',       wp_slash( $assets['icon'] ) );
     108        update_post_meta( $plugin->ID, 'assets_banners',     wp_slash( $assets['banner'] ) );
    107109
    108110        // Calculate the 'plugin color' from the average color of the banner if provided. This is used for fallback icons.
     
    112114            $banner_average_color = Tools::get_image_average_color( Template::get_asset_url( $plugin_slug, $first_banner ) );
    113115        }
    114         update_post_meta( $plugin->ID, 'assets_banners_color', $banner_average_color );
     116        update_post_meta( $plugin->ID, 'assets_banners_color', wp_slash( $banner_average_color ) );
    115117
    116118    }
     
    189191        }
    190192
     193        $tagged_versions = SVN::ls( "https://plugins.svn.wordpress.org/{$plugin_slug}/tags/" );
     194        $tagged_versions = array_map( function( $item ) {
     195            return rtrim( $item, '/' );
     196        }, $tagged_versions );
     197
    191198        // Find screenshots in the stable plugin folder (but don't overwrite /assets/)
    192199        foreach ( Filesystem::list_files( "$tmp_dir/$stable/", false /* non-recursive */, '!^screenshot-\d+\.(jpeg|jpg|png|gif)$!' ) as $plugin_screenshot ) {
     
    208215        }
    209216
    210         return compact( 'readme', 'trunk_readme', 'tmp_dir', 'plugin_headers', 'assets' );
     217        return compact( 'readme', 'trunk_readme', 'tmp_dir', 'plugin_headers', 'assets', 'tagged_versions' );
    211218    }
    212219
Note: See TracChangeset for help on using the changeset viewer.