Skip to content

Commit 34bbe19

Browse files
committed
Revert "Merge pull request #37 from wp-cli/add-example-to-export-stdout"
This reverts commit 17e2438, reversing changes made to 5159191.
1 parent 17e2438 commit 34bbe19

File tree

2 files changed

+2
-48
lines changed

2 files changed

+2
-48
lines changed

features/db-export.feature

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Feature: Export a WordPress database
2020
"""
2121
And the wp_cli_test.sql file should exist
2222

23-
Scenario: Exclude tables when exporting the database
23+
Scenario: Exclude tables when exporting the dtabase
2424
Given a WP install
2525

2626
When I run `wp db export wp_cli_test.sql --exclude_tables=wp_users --porcelain`
@@ -33,24 +33,3 @@ Feature: Export a WordPress database
3333
"""
3434
wp_options
3535
"""
36-
37-
Scenario: Export database to STDOUT
38-
Given a WP install
39-
40-
When I run `wp db export -`
41-
Then STDOUT should contain:
42-
"""
43-
-- MySQL dump
44-
"""
45-
46-
When I run `wp db export --stdout`
47-
Then STDOUT should contain:
48-
"""
49-
-- MySQL dump
50-
"""
51-
52-
When I try `wp db export - --stdout`
53-
Then STDERR should be:
54-
"""
55-
Error: The file name is not allowed when output mode is STDOUT.
56-
"""

src/DB_Command.php

Lines changed: 1 addition & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -269,9 +269,6 @@ public function query( $args, $assoc_args ) {
269269
* [--exclude_tables=<tables>]
270270
* : The comma separated list of specific tables that should be skipped from exporting. Excluding this parameter will export all tables in the database.
271271
*
272-
* [--stdout]
273-
* : Output database to STDOUT.
274-
*
275272
* [--porcelain]
276273
* : Output filename for the exported database.
277274
*
@@ -305,15 +302,6 @@ public function query( $args, $assoc_args ) {
305302
* $ wp db export --exclude_tables=$(wp db tables --all-tables-with-prefix --format=csv)
306303
* Success: Exported to 'wordpress_dbase-db72bb5.sql'.
307304
*
308-
* # Export database to STDOUT.
309-
* $ wp db export --stdout
310-
* -- MySQL dump 10.13 Distrib 5.7.19, for osx10.12 (x86_64)
311-
* --
312-
* -- Host: localhost Database: wpdev
313-
* -- ------------------------------------------------------
314-
* -- Server version 5.7.19
315-
* ...
316-
*
317305
* @alias dump
318306
*/
319307
public function export( $args, $assoc_args ) {
@@ -323,19 +311,7 @@ public function export( $args, $assoc_args ) {
323311
$hash = substr( md5( mt_rand() ), 0, 7 );
324312
$result_file = sprintf( '%s-%s-%s.sql', DB_NAME, date( 'Y-m-d' ), $hash );;
325313
}
326-
327-
if ( \WP_CLI\Utils\get_flag_value( $assoc_args, 'stdout' ) && ! empty( $args[0] ) ) {
328-
WP_CLI::error( 'The file name is not allowed when output mode is STDOUT.' );
329-
}
330-
331-
if ( \WP_CLI\Utils\get_flag_value( $assoc_args, 'stdout' ) ) {
332-
$stdout = true;
333-
} elseif ( '-' === $result_file ) {
334-
$stdout = true;
335-
} else {
336-
$stdout = false;
337-
}
338-
314+
$stdout = ( '-' === $result_file );
339315
$porcelain = \WP_CLI\Utils\get_flag_value( $assoc_args, 'porcelain' );
340316

341317
// Bail if both porcelain and STDOUT are set.
@@ -375,7 +351,6 @@ public function export( $args, $assoc_args ) {
375351

376352
// Remove parameters not needed for SQL run.
377353
unset( $assoc_args['porcelain'] );
378-
unset( $assoc_args['stdout'] );
379354

380355
self::run( $escaped_command, $assoc_args );
381356

0 commit comments

Comments
 (0)