Changeset 10693
- Timestamp:
- 02/17/2021 10:22:02 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/inc/cli-commands.php
r10692 r10693 22 22 * : ID of user to attribute all parsed posts to. Default is 5911429, the ID for wordpressdotorg. 23 23 * 24 * [--wp_ver=<wp_ver>] 25 * : Version of WordPress to install. Only taken into account if --src_path is 26 * not defined. Default is the latest release (or whatever version is present 27 * in --src_path if that is defined). 28 * 24 29 * ## EXAMPLES 25 30 * 26 * # Parse la stest WP.31 * # Parse latest WP. 27 32 * $ wp devhub parse 28 33 * 29 34 * # Parse specific copy of WP. 30 35 * $ wp devhub parse --src_path=/path/to/wordpress 36 * 37 * # Parse a particular version of WP. 38 * $ wp evhub parse --wp_ver=5.5.2 31 39 * 32 40 * @when after_wp_load … … 34 42 public function parse( $args, $assoc_args ) { 35 43 $path = $assoc_args['src_path'] ?? null; 44 $wp_ver = $assoc_args['wp_ver'] ?? null; 36 45 37 46 // Verify path is a file or directory. … … 42 51 WP_CLI::error( 'Provided path for WordPress source to parse does not exist.' ); 43 52 } 44 }45 53 } 54 46 55 // If no path provided, use a temporary path. 47 56 if ( ! $path ) { 48 57 $path = WP_CLI\Utils\get_temp_dir() . 'devhub_' . time(); 49 58 50 59 // @todo Attempt to reuse an existing temp dir. 51 60 if ( mkdir( $path ) ) { 52 WP_CLI::log( "Installing latest WordPress into temporary directory ({$path})..." ); 61 if ( $wp_ver ) { 62 WP_CLI::log( "Installing WordPress {$wp_ver} into temporary directory ({$path})..." ); 63 } else { 64 WP_CLI::log( "Installing latest WordPress into temporary directory ({$path})..." ); 65 } 53 66 $cmd = "core download --path={$path}"; 67 if ( $wp_ver ) { 68 $cmd .= " --version={$wp_ver}"; 69 } 54 70 // Install WP into the temp directory. 55 71 WP_CLI::runcommand( $cmd, [] ); … … 58 74 } 59 75 } 60 76 61 77 if ( ! $path ) { 62 78 WP_CLI::error( 'Unable to create temporary directory for downloading WordPress. If retrying fails, consider obtaining the files manually and supplying that path via --src_path argument.' );
Note: See TracChangeset
for help on using the changeset viewer.