Changeset 8728
- Timestamp:
- 05/03/2019 04:40:12 AM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/bin/import-plugin.php
r6287 r8728 9 9 ob_start(); 10 10 11 $opts = getopt( '', array( 'url:', 'abspath:', 'plugin:', 'changed-tags:', 'async' ) );11 $opts = getopt( '', array( 'url:', 'abspath:', 'plugin:', 'changed-tags:', 'async', 'create' ) ); 12 12 13 13 // Guess the default parameters: … … 29 29 } 30 30 31 $opts['async'] = isset( $opts['async'] ); 31 $opts['async'] = isset( $opts['async'] ); 32 $opts['create'] = isset( $opts['create'] ); 32 33 33 34 foreach ( array( 'url', 'abspath', 'plugin' ) as $opt ) { … … 35 36 fwrite( STDERR, "Missing Parameter: $opt\n" ); 36 37 fwrite( STDERR, "Usage: php {$argv[0]} --plugin hello-dolly --abspath /home/example/public_html --url https://wordpress.org/plugins/\n" ); 38 fwrite( STDERR, "Optional: --async to queue a job to import, --create to create a Post if none exist.\n" ); 37 39 fwrite( STDERR, "--url and --abspath will be guessed if possible.\n" ); 38 40 die(); … … 59 61 $start_time = microtime( 1 ); 60 62 63 // If the create flag is set, check if the post exists first: 64 if ( $opts['create'] && ! Plugin_Directory::get_plugin_post( $plugin_slug ) ) { 65 66 $create_result = Plugin_Directory::create_plugin_post( array( 67 'post_name' => $plugin_slug, 68 ) ); 69 70 if ( is_wp_error( $create_result ) ) { 71 echo "Failed. {$plugin_slug} post was not be found, and failed to be created.\n"; 72 fwrite( STDERR, "[{$plugin_slug}] Plugin Import Failed: " . $create_result->get_error_message() . "\n" ); 73 exit( 1 ); 74 } 75 } 76 61 77 // If async, queue it to be parsed instead. 62 78 if ( $opts['async'] ) {
Note: See TracChangeset
for help on using the changeset viewer.