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

Adapt package for framework v2 #192

Merged
merged 18 commits into from Aug 5, 2018
Merged
Changes from 1 commit
Commits
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.
+9 −7
Diff settings

Always

Just for now

Fix bug in site option patch STDIN detection

  • Loading branch information...
schlessera committed Aug 5, 2018
commit cb5459ba850b56a5fcfa1c1cc3d96f86d2c02564
Copy path View file
@@ -2,6 +2,7 @@
use WP_CLI\Entity\RecursiveDataStructureTraverser;
use WP_CLI\Utils;
use WP_CLI\Entity\Utils as EntityUtils;
/**
* Adds, updates, deletes, and lists site options in a multisite installation.
@@ -174,7 +175,7 @@ public function list_( $args, $assoc_args ) {
$fields = explode( ',', $assoc_args['fields'] );
}
if ( \WP_CLI\Utils\get_flag_value( $assoc_args, 'format' ) === 'total_bytes' ) {
if ( Utils\get_flag_value( $assoc_args, 'format' ) === 'total_bytes' ) {
$fields = array( 'size_bytes' );
$size_query = ",SUM(LENGTH(meta_value)) AS `size_bytes`";
}
@@ -190,7 +191,7 @@ public function list_( $args, $assoc_args ) {
}
$results = $wpdb->get_results( $query );
if ( \WP_CLI\Utils\get_flag_value( $assoc_args, 'format' ) === 'total_bytes' ) {
if ( Utils\get_flag_value( $assoc_args, 'format' ) === 'total_bytes' ) {
WP_CLI::line( $results[0]->size_bytes );
} else {
$formatter = new \WP_CLI\Formatter(
@@ -362,12 +363,13 @@ public function patch( $args, $assoc_args ) {
if ( 'delete' == $action ) {
$patch_value = null;
} elseif ( \WP_CLI\Entity\Utils::has_stdin() ) {
$stdin_value = WP_CLI::get_value_from_arg_or_stdin( $args, -1 );
$patch_value = WP_CLI::read_value( trim( $stdin_value ), $assoc_args );
} else {
// Take the patch value as the last positional argument. Mutates $key_path to be 1 element shorter!
$patch_value = WP_CLI::read_value( array_pop( $key_path ), $assoc_args );
$stdin_value = EntityUtils::has_stdin()
? trim( WP_CLI::get_value_from_arg_or_stdin( $args, -1 ) )
: null;
$patch_value = ! empty( $stdin_value )
? WP_CLI::read_value( $stdin_value, $assoc_args )
: WP_CLI::read_value( array_pop( $key_path ), $assoc_args );
}
/* Need to make a copy of $current_value here as it is modified by reference */
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.