Skip to content

Commit

Permalink
Merge pull request #52 from wp-cli/update-readme
Browse files Browse the repository at this point in the history
Update scaffolded README and tests with latest
  • Loading branch information
schlessera authored Sep 29, 2017
2 parents 4aade4b + 575290d commit db37442
Show file tree
Hide file tree
Showing 5 changed files with 226 additions and 81 deletions.
22 changes: 14 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ Executes an arbitrary SQL query using `DB_HOST`, `DB_NAME`, `DB_USER`
$ wp db query < debug.sql

# Check all tables in the database
$ wp db query "CHECK TABLE $(wp db tables | paste -s -d',');"
$ wp db query "CHECK TABLE $(wp db tables | paste -s -d, -);"
+---------------------------------------+-------+----------+----------+
| Table | Op | Msg_type | Msg_text |
+---------------------------------------+-------+----------+----------+
Expand Down Expand Up @@ -298,6 +298,15 @@ Runs `mysqldump` utility using `DB_HOST`, `DB_NAME`, `DB_USER` and
$ wp db export --exclude_tables=$(wp db tables --all-tables-with-prefix --format=csv)
Success: Exported to 'wordpress_dbase-db72bb5.sql'.

# Export database to STDOUT.
$ wp db export -
-- MySQL dump 10.13 Distrib 5.7.19, for osx10.12 (x86_64)
--
-- Host: localhost Database: wpdev
-- ------------------------------------------------------
-- Server version 5.7.19
...



### wp db import
Expand Down Expand Up @@ -371,16 +380,13 @@ Defaults to searching through all tables registered to $wpdb. On multisite, this
---

[--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.
Runs the search as a regular expression (without delimiters). The search becomes case-sensitive (i.e. no PCRE flags are added). 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.
Pass PCRE modifiers to the regex search (e.g. 'i' for case-insensitivity).

[--regex-delimiter=<regex-delimiter>]
The delimiter to use for the regex. It must be escaped if it appears in the search string.
---
default: /
---
The delimiter to use for the regex. It must be escaped if it appears in the search string. The default value is the result of `chr(1)`.

[--table_column_once]
Output the 'table:column' line once before all matching row lines in the table column rather than before each matching row.
Expand Down Expand Up @@ -451,7 +457,7 @@ They can be concatenated. For instance, the default match color of black on a mu
...

# Search through the database for the 'https?://' regular expression, printing stats.
$ wp db search 'https?:\/\/' --regex --stats
$ wp db search 'https?://' --regex --stats
wp_comments:comment_author_url
1:https://wordpress.org/
...
Expand Down
8 changes: 6 additions & 2 deletions features/bootstrap/FeatureContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -699,11 +699,15 @@ public function get_php_binary() {
return 'php';
}

public function start_php_server() {
public function start_php_server( $subdir = '' ) {
$dir = $this->variables['RUN_DIR'] . '/';
if ( $subdir ) {
$dir .= trim( $subdir, '/' ) . '/';
}
$cmd = Utils\esc_cmd( '%s -S %s -t %s -c %s %s',
$this->get_php_binary(),
'localhost:8080',
$this->variables['RUN_DIR'] . '/wordpress/',
$dir,
get_cfg_var( 'cfg_file_path' ),
$this->variables['RUN_DIR'] . '/vendor/wp-cli/server-command/router.php'
);
Expand Down
22 changes: 12 additions & 10 deletions features/bootstrap/Process.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,15 +87,17 @@ public function run() {
self::$run_times[ $this->command ][1]++;
}

return new ProcessRun( array(
'stdout' => $stdout,
'stderr' => $stderr,
'return_code' => $return_code,
'command' => $this->command,
'cwd' => $this->cwd,
'env' => $this->env,
'run_time' => $run_time,
) );
return new ProcessRun(
array(
'stdout' => $stdout,
'stderr' => $stderr,
'return_code' => $return_code,
'command' => $this->command,
'cwd' => $this->cwd,
'env' => $this->env,
'run_time' => $run_time,
)
);
}

/**
Expand All @@ -107,7 +109,7 @@ public function run_check() {
$r = $this->run();

// $r->STDERR is incorrect, but kept incorrect for backwards-compat
if ( $r->return_code || !empty( $r->STDERR ) ) {
if ( $r->return_code || ! empty( $r->STDERR ) ) {
throw new \RuntimeException( $r );
}

Expand Down
Loading

0 comments on commit db37442

Please sign in to comment.