Making WordPress.org

Changeset 9137


Ignore:
Timestamp:
09/13/2019 03:57:15 PM (5 years ago)
Author:
tellyworth
Message:

Plugins: improve import of block metadata.

This adds a default block_title if none is available, and uses the stable_tag for assets.

File:
1 edited

Legend:

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

    r9119 r9137  
    193193            if ( $changed || count ( get_post_meta( $plugin->ID, 'block_name' ) ) !== count ( $blocks ) ) {
    194194                delete_post_meta( $plugin->ID, 'block_name' );
     195                delete_post_meta( $plugin->ID, 'block_title' );
    195196                foreach ( $blocks as $block ) {
    196197                    add_post_meta( $plugin->ID, 'block_name', $block->name, false );
     198                    add_post_meta( $plugin->ID, 'block_title', ( $block->title ?: $plugin->post_title ), false );
    197199                }
    198200            }
     
    200202            delete_post_meta( $plugin->ID, 'all_blocks' );
    201203            delete_post_meta( $plugin->ID, 'block_name' );
     204            delete_post_meta( $plugin->ID, 'block_title' );
    202205        }
    203206
     
    459462        // Find blocks dist/build JS files
    460463        $block_files = array();
    461         $dist_files = SVN::ls( 'https://plugins.svn.wordpress.org' . "/{$plugin_slug}/trunk/dist" ) ?: array();
    462         $build_files = SVN::ls( 'https://plugins.svn.wordpress.org' . "/{$plugin_slug}/trunk/build" ) ?: array();
     464        $dist_files = SVN::ls( 'https://plugins.svn.wordpress.org' . "/{$plugin_slug}/{$stable_tag}/dist" ) ?: array();
     465        $build_files = SVN::ls( 'https://plugins.svn.wordpress.org' . "/{$plugin_slug}/{$stable_tag}/build" ) ?: array();
    463466
    464467        foreach ( $dist_files as $file ) {
    465             $block_files[] = '/trunk/dist/' . $file;
     468            $block_files[] = "/{$stable_tag}/dist/" . $file;
    466469        }
    467470
    468471        foreach ( $build_files as $file ) {
    469             $block_files[] = '/trunk/build/' . $file;
     472            $block_files[] = "/{$stable_tag}/build/" . $file;
    470473        }
    471474
    472475        if ( empty( $block_files ) ) {
    473476            foreach ( $files_with_blocks as $file ) {
    474                 $block_files[] = '/trunk/' . $file;
     477                $block_files[] = "/{$stable_tag}/" . $file;
    475478            }
    476479        }
Note: See TracChangeset for help on using the changeset viewer.