Skip to content

Commit db37442

Browse files
authored
Merge pull request #52 from wp-cli/update-readme
Update scaffolded README and tests with latest
2 parents 4aade4b + 575290d commit db37442

File tree

5 files changed

+226
-81
lines changed

5 files changed

+226
-81
lines changed

README.md

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ Executes an arbitrary SQL query using `DB_HOST`, `DB_NAME`, `DB_USER`
213213
$ wp db query < debug.sql
214214

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

301+
# Export database to STDOUT.
302+
$ wp db export -
303+
-- MySQL dump 10.13 Distrib 5.7.19, for osx10.12 (x86_64)
304+
--
305+
-- Host: localhost Database: wpdev
306+
-- ------------------------------------------------------
307+
-- Server version 5.7.19
308+
...
309+
301310

302311

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

373382
[--regex]
374-
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.
383+
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.
375384

376385
[--regex-flags=<regex-flags>]
377-
Pass PCRE modifiers to the regex search (e.g. 'i' for case-insensitivity). Note that 'u' (UTF-8 mode) will not be automatically added.
386+
Pass PCRE modifiers to the regex search (e.g. 'i' for case-insensitivity).
378387

379388
[--regex-delimiter=<regex-delimiter>]
380-
The delimiter to use for the regex. It must be escaped if it appears in the search string.
381-
---
382-
default: /
383-
---
389+
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)`.
384390

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

453459
# Search through the database for the 'https?://' regular expression, printing stats.
454-
$ wp db search 'https?:\/\/' --regex --stats
460+
$ wp db search 'https?://' --regex --stats
455461
wp_comments:comment_author_url
456462
1:https://wordpress.org/
457463
...

features/bootstrap/FeatureContext.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -699,11 +699,15 @@ public function get_php_binary() {
699699
return 'php';
700700
}
701701

702-
public function start_php_server() {
702+
public function start_php_server( $subdir = '' ) {
703+
$dir = $this->variables['RUN_DIR'] . '/';
704+
if ( $subdir ) {
705+
$dir .= trim( $subdir, '/' ) . '/';
706+
}
703707
$cmd = Utils\esc_cmd( '%s -S %s -t %s -c %s %s',
704708
$this->get_php_binary(),
705709
'localhost:8080',
706-
$this->variables['RUN_DIR'] . '/wordpress/',
710+
$dir,
707711
get_cfg_var( 'cfg_file_path' ),
708712
$this->variables['RUN_DIR'] . '/vendor/wp-cli/server-command/router.php'
709713
);

features/bootstrap/Process.php

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -87,15 +87,17 @@ public function run() {
8787
self::$run_times[ $this->command ][1]++;
8888
}
8989

90-
return new ProcessRun( array(
91-
'stdout' => $stdout,
92-
'stderr' => $stderr,
93-
'return_code' => $return_code,
94-
'command' => $this->command,
95-
'cwd' => $this->cwd,
96-
'env' => $this->env,
97-
'run_time' => $run_time,
98-
) );
90+
return new ProcessRun(
91+
array(
92+
'stdout' => $stdout,
93+
'stderr' => $stderr,
94+
'return_code' => $return_code,
95+
'command' => $this->command,
96+
'cwd' => $this->cwd,
97+
'env' => $this->env,
98+
'run_time' => $run_time,
99+
)
100+
);
99101
}
100102

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

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

0 commit comments

Comments
 (0)