Making WordPress.org

Ticket #5207: 5207_tag-path.diff

File 5207_tag-path.diff, 1.4 KB (added by coreymckrill, 5 years ago)

Fix block files path when $stable_tag is a version number

  • cli/class-import.php

     
    464464                                $blocks[ $block_name ]->title = $trunk_readme->name;
    465465                }
    466466
     467                if ( 'trunk' === $stable_tag ) {
     468                        $stable_path = $stable_tag;
     469                } else {
     470                        $stable_path = "tags/$stable_tag";
     471                }
     472
    467473                // Find blocks dist/build JS files
    468474                $block_files = array();
    469                 $dist_files = SVN::ls( 'https://plugins.svn.wordpress.org' . "/{$plugin_slug}/{$stable_tag}/dist" ) ?: array();
    470                 $build_files = SVN::ls( 'https://plugins.svn.wordpress.org' . "/{$plugin_slug}/{$stable_tag}/build" ) ?: array();
     475                $dist_files = SVN::ls( 'https://plugins.svn.wordpress.org' . "/{$plugin_slug}/{$stable_path}/dist" ) ?: array();
     476                $build_files = SVN::ls( 'https://plugins.svn.wordpress.org' . "/{$plugin_slug}/{$stable_path}/build" ) ?: array();
    471477
    472478                foreach ( $dist_files as $file ) {
    473                         $block_files[] = "/{$stable_tag}/dist/" . $file;
     479                        $block_files[] = "/{$stable_path}/dist/" . $file;
    474480                }
    475481
    476482                foreach ( $build_files as $file ) {
    477                         $block_files[] = "/{$stable_tag}/build/" . $file;
     483                        $block_files[] = "/{$stable_path}/build/" . $file;
    478484                }
    479485
    480486                if ( empty( $block_files ) ) {
    481487                        foreach ( $files_with_blocks as $file ) {
    482                                 $block_files[] = "/{$stable_tag}/" . $file;
     488                                $block_files[] = "/{$stable_path}/" . $file;
    483489                        }
    484490                }
    485491