-
Notifications
You must be signed in to change notification settings - Fork 90
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add --slug=<site>
as an available parameter to wp site
commands
#416
Conversation
Great work so far, @tubiz ! Are you still up for adding feature tests for this? |
Yes. I will get started with adding the feature tests. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we include some tests covering this change? Also, it'd be great to abstract the site fetcher to a dedicated method.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Getting better! I think there's just one last bit to address.
$this->update_site_status( [ $blog->blog_id ], 'archived', 1 ); | ||
} else { | ||
$this->update_site_status( $args, 'archived', 1 ); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For all of these, we also need to provide some error mechanism when neither <id>
nor --slug=
are provided. Check out wp plugin activate
and its sibling commands for an example of how this can be implemented:
https://github.com/wp-cli/extension-command/blob/6a68d247969b8968b007a4d664e0de14bf69e775/src/Plugin_Command.php#L317-L320
https://github.com/wp-cli/extension-command/blob/6a68d247969b8968b007a4d664e0de14bf69e775/src/WP_CLI/ParsePluginNameInput.php#L9-L47
We'll want to add tests for this aspect too.
Your get_site_by_slug()
method could be updated to $this->get_sites( $args, $assoc_args )
and return a $blogs
variable that's passed directly into $this->update_site_status()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Update get_site_by_slug()
method to get_sites_ids()
The check to ensure that the site IDs or slug are provided is now done in the check_site_ids_and_slug()
method.
--slug=<site>
as an available parameter to wp site
commands
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixes #257
Slug has been added as an available parameter for the wp site commands listed below
wp site archive --slug={siteslug}
wp site activate --slug={siteslug}
wp site deactivate --slug={siteslug}
wp site mature --slug={siteslug}
wp site private --slug={siteslug}
wp site public --slug={siteslug}
wp site spam --slug={siteslug}
wp site unarchive --slug={siteslug}
wp site unmature --slug={siteslug}
wp site unspam --slug={siteslug}
Related wp-cli/wp-cli#5832