Making WordPress.org


Ignore:
Timestamp:
10/03/2024 02:23:43 AM (23 months ago)
Author:
dd32
Message:

Plugin Directory: Bin: Allow passing a download URL to the rebuild-zips command for ease of use.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/bin/rebuild-zip.php

    r8482 r14090  
    1717// Guess the default parameters:
    1818if ( empty( $opts ) && $argc == 2 ) {
    19         $opts['plugin'] = $argv[1];
    20         $argv[1]        = '--plugin ' . $argv[1];
     19        if ( preg_match( '#^https?://downloads.w(ordpress)?.org/plugin/(?P<slug>[a-z0-9-]+)(\.(?P<version>.+))?\.zip$#', $argv[1], $m ) ) {
     20
     21                $opts['plugin'] = $m['slug'];
     22                $argv[1]        = '--plugin ' . $m['slug'];
     23
     24                $opts['versions'] = $m['version'] ?: 'trunk';
     25                $argv[2]              = '--versions ' . $opts['versions'];
     26        } else {
     27                $opts['plugin'] = $argv[1];
     28                $argv[1]        = '--plugin ' . $argv[1];
     29        }
    2130}
    2231if ( empty( $opts ) && $argc == 3 ) {
     
    4049        if ( empty( $opts[ $opt ] ) ) {
    4150                fwrite( STDERR, "Missing Parameter: $opt\n" );
    42                 fwrite( STDERR, "Usage: php {$argv[0]} --plugin hello-dolly --versions 1.0,trunk --abspath /home/example/public_html --url https://wordpress.org/plugins/\n" );
     51                fwrite( STDERR, "Usage: \n" );
     52                fwrite( STDERR, "\tphp {$argv[0]} --plugin hello-dolly --versions 1.0,trunk\n" );
     53                fwrite( STDERR, "\tphp {$argv[0]} https://downloads.wordpress.org/plugin/hello-dolly.1.0.zip\n" );
     54                fwrite( STDERR, "\tphp {$argv[0]} --plugin hello-dolly --versions 1.0,trunk --abspath /home/example/public_html --url https://wordpress.org/plugins/\n" );
    4355                fwrite( STDERR, "--url and --abspath will be guessed if possible.\n" );
    4456                fwrite( STDERR, "--versions if skipped will rebuild all tags/trunk.\n" );
Note: See TracChangeset for help on using the changeset viewer.