Making WordPress.org

Changeset 4563


Ignore:
Timestamp:
12/21/2016 07:37:30 AM (8 years ago)
Author:
dd32
Message:

Plugin Directory: Allow bin/import-plugin.php to be used to queue up an async job to parse a plugin rather than performing it locally.

Location:
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory
Files:
2 edited

Legend:

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

    r3373 r4563  
    99ob_start();
    1010
    11 $opts = getopt( '', array( 'url:', 'abspath:', 'plugin:', 'changed-tags:' ) );
     11$opts = getopt( '', array( 'url:', 'abspath:', 'plugin:', 'changed-tags:', 'async' ) );
    1212
    1313// Guess the default parameters:
     
    2828    $opts['changed-tags'] = explode( ',', $opts['changed-tags'] );
    2929}
     30
     31$opts['async'] = isset( $opts['async'] );
    3032
    3133foreach ( array( 'url', 'abspath', 'plugin' ) as $opt ) {
     
    5759$start_time   = microtime(1);
    5860
     61// If async, queue it to be parsed instead.
     62if ( $opts['async'] ) {
     63    Jobs\Plugin_Import::queue( $plugin_slug, array( 'tags_touched' => $changed_tags ) );
     64    echo "Queueing Import for $plugin_slug... OK\n";
     65    die();
     66}
     67
    5968echo "Processing Import for $plugin_slug... ";
    6069try {
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/jobs/class-plugin-import.php

    r4522 r4563  
    3232    public static function cron_trigger( $plugin_data ) {
    3333        $plugin_slug  = $plugin_data['plugin'];
    34         $changed_tags = $plugin_data['tags_touched'];
     34        $changed_tags = isset( $plugin_data['tags_touched'] ) ? $plugin_data['tags_touched'] : array( 'trunk' );
    3535
    3636        try {
Note: See TracChangeset for help on using the changeset viewer.