Making WordPress.org


Ignore:
Timestamp:
06/15/2016 04:47:04 AM (8 years ago)
Author:
dd32
Message:

Plugin Directory: Add a SVN watching script to process & import plugins to the plugin directory after each commit.

This doesn't act as a post-commit hook, but instead is designed to be run in an endless loop.

See #1720

File:
1 edited

Legend:

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

    r3164 r3373  
    99ob_start();
    1010
    11 $opts = getopt( '', array( 'url:', 'abspath:', 'plugin:' ) );
     11$opts = getopt( '', array( 'url:', 'abspath:', 'plugin:', 'changed-tags:' ) );
    1212
    1313// Guess the default parameters:
     
    2121if ( empty( $opts['abspath'] ) && false !== strpos( __DIR__, 'wp-content' ) ) {
    2222    $opts['abspath'] = substr( __DIR__, 0, strpos( __DIR__, 'wp-content' ) );
     23}
     24
     25if ( empty( $opts['changed-tags'] ) ) {
     26    $opts['changed-tags'] = array( 'trunk' );
     27} else {
     28    $opts['changed-tags'] = explode( ',', $opts['changed-tags'] );
    2329}
    2430
     
    4753}
    4854
    49 $plugin_slug = $opts['plugin'];
     55$plugin_slug  = $opts['plugin'];
     56$changed_tags = $opts['changed-tags'];
     57$start_time   = microtime(1);
    5058
    5159echo "Processing Import for $plugin_slug... ";
    5260try {
    5361    $importer = new CLI\Import;
    54     $importer->import_from_svn( $plugin_slug );
    55     echo "OK\n";
     62    $importer->import_from_svn( $plugin_slug, $changed_tags );
     63    echo "OK. Took " . round( microtime(1) - $start_time, 2 )  . "s\n";
    5664} catch( \Exception $e ) {
    57     echo "Failed.\n";
     65    echo "Failed. Took " . round( microtime(1) - $start_time, 2 )  . "s\n";
     66
    5867    fwrite( STDERR, "[{$plugin_slug}] Plugin Import Failed: " . $e->getMessage() . "\n" );
    5968    exit(1);
Note: See TracChangeset for help on using the changeset viewer.