Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit0466ed3

Browse files
committed
Further interop with how the rest of WP-CLI feels
1 parent2a99813 commit0466ed3

File tree

1 file changed

+19
-3
lines changed

1 file changed

+19
-3
lines changed

‎class/wpsdb-cli.php‎

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,27 @@ function log_list( $list ) {
1616
}
1717
}
1818

19-
functionkebab_case_to_snake_case($value) {
19+
functionkebab_case_to_snake_case($value) {
2020
returnpreg_replace_callback('/-(.)/u',function($el) {
2121
return'_' .$el[1];
2222
},$value);
2323
}
2424

25+
functionvalues_as_booleans_to_one_and_zero_strings($array ) {
26+
$result = [];
27+
28+
foreach ($arrayas$key =>$value) {
29+
if ($value ==='true' ||$value ==='false' ) {
30+
$result[$key] = (string)(int)($value ==='true');
31+
continue;
32+
}
33+
34+
$result[$key] =$value;
35+
}
36+
37+
return$result;
38+
}
39+
2540
functionkeys_from_kebab_case_to_snake_case($array ) {
2641
$result = [];
2742

@@ -89,7 +104,9 @@ function cli_create_profile( $name, $assoc_args ) {
89104
$new_profile["save_migration_profile"] ="1";
90105
$new_profile["save_migration_profile_option"] ="new";
91106

92-
$new_profile =array_merge($new_profile,$this->keys_from_kebab_case_to_snake_case($assoc_args ) );
107+
$values_for_wordpress =$this->keys_from_kebab_case_to_snake_case($assoc_args );
108+
$values_for_wordpress =$this->values_as_booleans_to_one_and_zero_strings($values_for_wordpress );
109+
$new_profile =array_merge($new_profile,$values_for_wordpress );
93110

94111
if (isset($assoc_args['exclude-post-types'] ) ) {
95112
$new_profile['exclude_post_types'] ='1';
@@ -128,7 +145,6 @@ function cli_create_profile( $name, $assoc_args ) {
128145
}
129146

130147
$wpsdb_settings['profiles'][] =$new_profile;
131-
132148
update_option('wpsdb_settings',$wpsdb_settings );
133149

134150
returntrue;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp