Permalink
Browse files

Update package with latest scaffolded components

  • Loading branch information...
danielbachhuber committed Aug 2, 2017
1 parent 8574ba7 commit f2030cc80616c8f178c96a8b108d179e398e8255
View
@@ -0,0 +1,11 @@
<!--
Thanks for creating a new issue!
Found a bug or want to suggest an enhancement? Before completing your issue, please review our best practices: https://make.wordpress.org/cli/handbook/bug-reports/
Need help with something? GitHub issues aren't for general support questions, but there are other venues you can try: https://wp-cli.org/#support
You can safely delete this comment.
-->
@@ -0,0 +1,14 @@
<!--
Thanks for submitting a pull request!
Here's an overview to our process:
1. One of the project committers will soon provide a code review.
2. You are expected to address the code review comments in a timely manner.
3. Please make sure to include functional tests for your changes.
4. The reviewing committer will merge your pull request as soon as it passes code review (and provided it fits within the scope of the project).
You can safely delete this comment.
-->
View
@@ -1,8 +1,6 @@
.DS_Store
wp-cli.local.yml
composer.lock
node_modules/
vendor/
*.zip
*.tar.gz
.*.swp
View
@@ -29,6 +29,8 @@ matrix:
env: WP_VERSION=latest
- php: 5.6
env: WP_VERSION=latest
- php: 5.6
env: WP_VERSION=3.7.11
- php: 5.6
env: WP_VERSION=trunk
- php: 5.3
@@ -46,4 +48,4 @@ before_script:
- composer validate
script:
- behat --format progress --strict
- bash bin/test.sh
View
@@ -0,0 +1,8 @@
Contributing
============
We appreciate you taking the initiative to contribute to this project.
Contributing isn’t limited to just code. We encourage you to contribute in the way that best fits your abilities, by writing tutorials, giving a demo at your local meetup, helping other users with their support questions, or revising our documentation.
For a more thorough introduction, [check out WP-CLI's guide to contributing](https://make.wordpress.org/cli/handbook/contributing/). This package follows those policy and guidelines.
View
193 README.md
@@ -5,7 +5,7 @@ Perform basic database operations using credentials stored in wp-config.php.
[![Build Status](https://travis-ci.org/wp-cli/db-command.svg?branch=master)](https://travis-ci.org/wp-cli/db-command)
Quick links: [Using](#using) | [Installing](#installing) | [Contributing](#contributing)
Quick links: [Using](#using) | [Installing](#installing) | [Contributing](#contributing) | [Support](#support)
## Using
@@ -16,7 +16,7 @@ This package implements the following commands:
Create a new database.
~~~
wp db create
wp db create
~~~
Runs `CREATE_DATABASE` SQL statement using `DB_HOST`, `DB_NAME`,
@@ -83,7 +83,7 @@ specified in wp-config.php.
Check the current status of the database.
~~~
wp db check
wp db check
~~~
Runs `mysqlcheck` utility with `--check` using `DB_HOST`,
@@ -105,7 +105,7 @@ for more details on the `CHECK TABLE` statement.
Optimize the database.
~~~
wp db optimize
wp db optimize
~~~
Runs `mysqlcheck` utility with `--optimize=true` using `DB_HOST`,
@@ -120,14 +120,31 @@ for more details on the `OPTIMIZE TABLE` statement.
$ wp db optimize
Success: Database optimized.
*Note:* `wp db optimize` optimizes the entire database, including non-WordPress tables. [See #24](https://github.com/wp-cli/db-command/issues/24)
### wp db prefix
Display the database table prefix.
~~~
wp db prefix
~~~
Display the database table prefix, as defined by the database handler's interpretation of the current site.
**EXAMPLES**
$ wp db prefix
wp_
### wp db repair
Repair the database.
~~~
wp db repair
wp db repair
~~~
Runs `mysqlcheck` utility with `--repair=true` using `DB_HOST`,
@@ -311,6 +328,136 @@ defined in the SQL.
### wp db search
Find a string in the database.
~~~
wp db search <search> [<tables>...] [--network] [--all-tables-with-prefix] [--all-tables] [--before_context=<num>] [--after_context=<num>] [--regex] [--regex-flags=<regex-flags>] [--regex-delimiter=<regex-delimiter>] [--table_column_once] [--one_line] [--matches_only] [--stats] [--table_column_color=<color_code>] [--id_color=<color_code>] [--match_color=<color_code>]
~~~
Searches through all or a selection of database tables for a given string, Outputs colorized references to the string.
Defaults to searching through all tables registered to $wpdb. On multisite, this default is limited to the tables for the current site.
**OPTIONS**
<search>
String to search for. The search is case-insensitive by default.
[<tables>...]
One or more tables to search through for the string.
[--network]
Search through all the tables registered to $wpdb in a multisite install.
[--all-tables-with-prefix]
Search through all tables that match the registered table prefix, even if not registered on $wpdb. On one hand, sometimes plugins use tables without registering them to $wpdb. On another hand, this could return tables you don't expect. Overrides --network.
[--all-tables]
Search through ALL tables in the database, regardless of the prefix, and even if not registered on $wpdb. Overrides --network and --all-tables-with-prefix.
[--before_context=<num>]
Number of characters to display before the match.
---
default: 40
---
[--after_context=<num>]
Number of characters to display after the match.
---
default: 40
---
[--regex]
Runs the search as a regular expression (without delimiters). The search becomes case-sensitive (i.e. no PCRE flags are added, except 'u' if the database charset is UTF-8). Delimiters must be escaped if they occur in the expression.
[--regex-flags=<regex-flags>]
Pass PCRE modifiers to the regex search (e.g. 'i' for case-insensitivity). Note that 'u' (UTF-8 mode) will not be automatically added.
[--regex-delimiter=<regex-delimiter>]
The delimiter to use for the regex. It must be escaped if it appears in the search string.
---
default: /
---
[--table_column_once]
Output the 'table:column' line once before all matching row lines in the table column rather than before each matching row.
[--one_line]
Place the 'table:column' output on the same line as the row id and match ('table:column:id:match'). Overrides --table_column_once.
[--matches_only]
Only output the string matches (including context). No 'table:column's or row ids are outputted.
[--stats]
Output stats on the number of matches found, time taken, tables/columns/rows searched, tables skipped.
[--table_column_color=<color_code>]
Percent color code to use for the 'table:column' output. For a list of available percent color codes, see below. Default '%G' (bright green).
[--id_color=<color_code>]
Percent color code to use for the row id output. For a list of available percent color codes, see below. Default '%Y' (bright yellow).
[--match_color=<color_code>]
Percent color code to use for the match (unless both before and after context are 0, when no color code is used). For a list of available percent color codes, see below. Default '%3%k' (black on a mustard background).
The percent color codes available are:
'%y' Yellow (dark) (mustard)
'%g' Green (dark)
'%b' Blue (dark)
'%r' Red (dark)
'%m' Magenta (dark)
'%c' Cyan (dark)
'%w' White (dark) (light gray)
'%k' Black
'%Y' Yellow (bright)
'%G' Green (bright)
'%B' Blue (bright)
'%R' Red (bright)
'%M' Magenta (bright)
'%C' Cyan (bright)
'%W' White
'%K' Black (bright) (dark gray)
'%3' Yellow background (dark) (mustard)
'%2' Green background (dark)
'%4' Blue background (dark)
'%1' Red background (dark)
'%5' Magenta background (dark)
'%6' Cyan background (dark)
'%7' White background (dark) (light gray)
'%0' Black background
'%8' Reverse
'%U' Underline
'%F' Blink (unlikely to work)
They can be concatenated. For instance, the default match color of black on a mustard (dark yellow) background '%3%k' can be made black on a bright yellow background with '%Y%0%8'.
**EXAMPLES**
# Search through the database for the 'wordpress-develop' string
$ wp db search wordpress-develop
wp_options:option_value
1:http://wordpress-develop.dev
wp_options:option_value
1:http://example.com/foo
...
# Search through a multisite database on the subsite 'foo' for the 'example.com' string
$ wp db search example.com --url=example.com/foo
wp_2_comments:comment_author_url
1:http://example.com/
wp_2_options:option_value
...
# Search through the database for the 'https?://' regular expression, printing stats.
$ wp db search 'https?:\/\/' --regex --stats
wp_comments:comment_author_url
1:https://wordpress.org/
...
Success: Found 99146 matches in 10.752s (10.559s searching). Searched 12 tables, 53 columns, 1358907 rows. 1 table skipped: wp_term_relationships.
### wp db tables
List the database tables.
@@ -451,21 +598,6 @@ The size defaults to a human-readable number.
$ wp db size --size_format=mb
6
### wp db prefix
Display the database table prefix.
~~~
wp db prefix
~~~
Display the database table prefix, as defined by the database handler's interpretation of the current site.
**EXAMPLES**
$ wp db prefix
wp_
## Installing
This package is included with WP-CLI itself, no additional installation necessary.
@@ -480,30 +612,25 @@ We appreciate you taking the initiative to contribute to this project.
Contributing isn’t limited to just code. We encourage you to contribute in the way that best fits your abilities, by writing tutorials, giving a demo at your local meetup, helping other users with their support questions, or revising our documentation.
For a more thorough introduction, [check out WP-CLI's guide to contributing](https://make.wordpress.org/cli/handbook/contributing/). This package follows those policy and guidelines.
### Reporting a bug
Think you’ve found a bug? We’d love for you to help us get it fixed.
Before you create a new issue, you should [search existing issues](https://github.com/wp-cli/db-command/issues?q=label%3Abug%20) to see if there’s an existing resolution to it, or if it’s already been fixed in a newer version.
Once you’ve done a bit of searching and discovered there isn’t an open or fixed issue for your bug, please [create a new issue](https://github.com/wp-cli/db-command/issues/new) with the following:
1. What you were doing (e.g. "When I run `wp post list`").
2. What you saw (e.g. "I see a fatal about a class being undefined.").
3. What you expected to see (e.g. "I expected to see the list of posts.")
Include as much detail as you can, and clear steps to reproduce if possible.
Once you’ve done a bit of searching and discovered there isn’t an open or fixed issue for your bug, please [create a new issue](https://github.com/wp-cli/db-command/issues/new). Include as much detail as you can, and clear steps to reproduce if possible. For more guidance, [review our bug report documentation](https://make.wordpress.org/cli/handbook/bug-reports/).
### Creating a pull request
Want to contribute a new feature? Please first [open a new issue](https://github.com/wp-cli/db-command/issues/new) to discuss whether the feature is a good fit for the project.
Once you've decided to commit the time to seeing your pull request through, please follow our guidelines for creating a pull request to make sure it's a pleasant experience:
Once you've decided to commit the time to seeing your pull request through, [please follow our guidelines for creating a pull request](https://make.wordpress.org/cli/handbook/pull-requests/) to make sure it's a pleasant experience. See "[Setting up](https://make.wordpress.org/cli/handbook/pull-requests/#setting-up)" for details specific to working on this package locally.
## Support
1. Create a feature branch for each contribution.
2. Submit your pull request early for feedback.
3. Include functional tests with your changes. [Read the WP-CLI documentation](https://wp-cli.org/docs/pull-requests/#functional-tests) for an introduction.
4. Follow the [WordPress Coding Standards](http://make.wordpress.org/core/handbook/coding-standards/).
Github issues aren't for general support questions, but there are other venues you can try: http://wp-cli.org/#support
*This README.md is generated dynamically from the project's codebase using `wp scaffold package-readme` ([doc](https://github.com/wp-cli/scaffold-package-command#wp-scaffold-package-readme)). To suggest changes, please submit a pull request against the corresponding part of the codebase.*
View
@@ -0,0 +1,13 @@
#!/bin/bash
set -ex
# Run the unit tests, if they exist
if [ -f "phpunit.xml" ] || [ -f "phpunit.xml.dist" ]
then
phpunit
fi
# Run the functional tests
BEHAT_TAGS=$(php utils/behat-tags.php)
behat --format progress $BEHAT_TAGS --strict
Oops, something went wrong.

0 comments on commit f2030cc

Please sign in to comment.