WordPress.org

Making WordPress.org

Changeset 9892


Ignore:
Timestamp:
05/20/2020 04:32:44 AM (12 months ago)
Author:
tellyworth
Message:

Plugin dir: improve block asset detection

Fixes the logic for handling tag paths.

Props coreymckrill, ryelle.
See #5207.

File:
1 edited

Legend:

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

    r9139 r9892  
    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        }
Note: See TracChangeset for help on using the changeset viewer.