Skip to content
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

Testing toc #14

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,19 @@ Quick links: [Using](#using) | [Installing](#installing) | [Contributing](#contr

## Using

**Featured Commands:**

- [wp database test](#wp-database-test)
- [wp database reset](#wp-database-reset)


This package implements the following commands:


### wp database reset

Reset database content except one administrator user.

~~~
wp database reset --author=<username>
~~~
Expand All @@ -23,6 +36,16 @@ wp database reset --author=<username>
# Reset database and keep `admin` user.
$ wp database reset --author=admin



### wp database test

Reset database content except one administrator user.

~~~
wp database test
~~~

## Installing

Installing this package requires WP-CLI v2.9 or greater. Update to the latest stable release with `wp cli update`.
Expand Down
3 changes: 2 additions & 1 deletion command.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,5 @@
require_once $wpcli_database_command_autoloader;
}

WP_CLI::add_command( 'database', DatabaseCommand::class );
WP_CLI::add_command( 'database reset', [ DatabaseCommand::class, 'reset' ] );
WP_CLI::add_command( 'database test', [ DatabaseCommand::class, 'test' ] );
7 changes: 6 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,13 @@
},
"extra": {
"commands": [
"database reset"
"database reset",
"database test"
],
"featured-commands": [
"database test",
"database reset"
],
"readme": {
"sections": [
"Using",
Expand Down
15 changes: 15 additions & 0 deletions src/DatabaseCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ class DatabaseCommand extends WP_CLI_Command {
*
* @when after_wp_load
*
* @subcommand reset
*
* @param array $args Indexed array of positional arguments.
* @param array $assoc_args Associative array of associative arguments.
*/
Expand Down Expand Up @@ -52,6 +54,19 @@ public function reset( $args, $assoc_args ) {
$this->reset_callback( $author_obj );
}

/**
* Reset database content except one administrator user.
*
* @when after_wp_load
*
* @subcommand test
*
* @param array $args Indexed array of positional arguments.
* @param array $assoc_args Associative array of associative arguments.
*/
public function test( $args, $assoc_args ) {
}

/**
* Reset database.
*
Expand Down