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

Commit3aaa5b6

Browse files
committed
Set sensible defaults
1 parent6f27aa9 commit3aaa5b6

File tree

1 file changed

+44
-25
lines changed

1 file changed

+44
-25
lines changed

‎class/wpsdb-cli.php‎

Lines changed: 44 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,14 @@ function cli_create_profile( $name, $assoc_args ) {
2828

2929
$new_profile =array();
3030

31-
$new_profile["create_new_profile"] ="Staging";
32-
$new_profile["name"] ="Staging";
31+
$new_profile["name"] =$name;
32+
$new_profile["create_new_profile"] =$name;
33+
34+
$new_profile["action"] ="pull";
35+
36+
$new_profile['connection_info'] =implode("\n",array($assoc_args['remote_wordpress'],$assoc_args['token'] ) );
37+
38+
$new_profile["table_migrate_option"] ='migrate_only_with_prefix';
3339

3440
// This is probably going to be a faff to do so leave it.
3541
$new_profile["replace_old"] =array(
@@ -42,41 +48,54 @@ function cli_create_profile( $name, $assoc_args ) {
4248
"/app/web"
4349
);
4450

45-
// This is all the tables in a standard Outlandish WordPress install we
46-
// by default sync.
47-
$new_profile["select_tables"] =array(
48-
"wp_commentmeta",
49-
"wp_comments",
50-
"wp_links",
51-
"wp_options",
52-
"wp_p2p",
53-
"wp_p2pmeta",
54-
"wp_postmeta",
55-
"wp_posts",
56-
"wp_term_relationships",
57-
"wp_term_taxonomy",
58-
"wp_termmeta",
59-
"wp_terms",
60-
"wp_usermeta",
61-
"wp_users",
62-
);
63-
6451
$new_profile["save_computer"] ="1";
6552
$new_profile["gzip_file"] ="1";
6653
$new_profile["replace_guids"] ="1";
6754
$new_profile["exclude_spam"] ="1";
6855
$new_profile["keep_active_plugins"] ="1";
6956
$new_profile["create_backup"] ="0";
57+
$new_profile["backup_option"] ="backup_selected";
58+
7059
$new_profile["exclude_post_types"] ="0";
71-
$new_profile["action"] ="pull";
72-
$new_profile["connection_info"] ="";
73-
$new_profile["table_migrate_option"] ="migrate_select";
7460
$new_profile["exclude_transients"] ="1";
75-
$new_profile["backup_option"] ="backup_selected";
7661
$new_profile["media_files"] ="1";
62+
7763
$new_profile["save_migration_profile"] ="1";
7864
$new_profile["save_migration_profile_option"] ="new";
7965

66+
$new_profile =array_merge($new_profile,$assoc_args );
67+
68+
if (isset($assoc_args['select_tables'] ) ) {
69+
$new_profile["table_migrate_option"] ='migrate_select';
70+
71+
if ($new_profile["select_tables"] ==='outlandish' ) {
72+
WP_CLI::log(__('Selecting Outlandish default WordPress tables for migraton.','wp-sync-db-cli' ) );
73+
$new_profile["select_tables"] =array(
74+
"wp_commentmeta",
75+
"wp_comments",
76+
"wp_links",
77+
"wp_options",
78+
"wp_p2p",
79+
"wp_p2pmeta",
80+
"wp_postmeta",
81+
"wp_posts",
82+
"wp_term_relationships",
83+
"wp_term_taxonomy",
84+
"wp_termmeta",
85+
"wp_terms",
86+
"wp_usermeta",
87+
"wp_users",
88+
);
89+
}else {
90+
$new_profile["select_tables"] =explode(',',$assoc_args['select_tables'] );
91+
WP_CLI::log(__('The following tables are selected for migration:','wp-sync-db-cli' ) );
92+
93+
foreach ($new_profile["select_tables"]as$table ) {
94+
WP_CLI::log("-$table" );
95+
}
96+
}
97+
}
98+
8099
$wpsdb_settings['profiles'][] =$new_profile;
81100

82101
update_option('wpsdb_settings',$wpsdb_settings );

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp