Making WordPress.org

Changeset 10279


Ignore:
Timestamp:
09/21/2020 07:43:13 PM (4 years ago)
Author:
coffee2code
Message:

Developer, CLI commands: Default the importing user to wordpressdotorg if not specified by the now-optional --user_id argument.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/inc/cli-commands.php

    r8040 r10279  
    1818     * an active install.
    1919     *
    20      * <user-id>
    21      * : ID of user to attribute all parsed posts to.
     20     * [--user_id=<user_id>]
     21     * : ID of user to attribute all parsed posts to. Default is 5911429, the ID for wordpressdotorg.
    2222     *
    2323     * ## EXAMPLES
    2424     *
    2525     *     # Parse WP 4.9.5 into DevHub.
    26      *     $ wp devhub /home/wporgdev/developer/wp495 3606
     26     *     $ wp devhub /home/wporgdev/developer/wp495
    2727     *
    2828     * @when after_wp_load
    2929     */
    3030    public function parse( $args, $assoc_args ) {
    31         list( $path, $user_id ) = $args;
     31        list( $path ) = $args;
    3232
    33         if ( ! is_numeric( $user_id ) ) {
    34             WP_CLI::error( 'Invalid user_id provided.' );
    35         } else {
    36             $user_id = (int) $user_id;
    37         }
     33        $user_id = $assoc_args['user_id'] ?? 5911429; // 5911429 = ID for wordpressdotorg
    3834        $user = get_user_by( 'id', $user_id );
    3935        if ( ! $user ) {
Note: See TracChangeset for help on using the changeset viewer.