From 7facf32022172da22bab57859a54418d40753d61 Mon Sep 17 00:00:00 2001 From: starjive Date: Sat, 24 Sep 2016 12:33:20 +0200 Subject: [PATCH] Clean up every sentence about migrate to sync, and grammar --- class/command.php | 14 +++--- class/wpsdb-cli.php | 78 ++++++++++++++++----------------- languages/wp-sync-db-cli-en.pot | 50 --------------------- languages/wp-sync-db-cli.pot | 75 +++++++++++++++++++++++++++++++ wp-sync-db-cli.php | 8 ++-- 5 files changed, 125 insertions(+), 100 deletions(-) delete mode 100644 languages/wp-sync-db-cli-en.pot create mode 100644 languages/wp-sync-db-cli.pot diff --git a/class/command.php b/class/command.php index cee217e..b60e88f 100644 --- a/class/command.php +++ b/class/command.php @@ -1,33 +1,33 @@ - * : ID of the profile to use for the migration. + * : ID of the profile to use for the syncing. * * ## EXAMPLES * - * wp wpsdb migrate 1 + * wp wpsdb sync 1 * * @synopsis * * @since 1.0 */ - public function migrate( $args, $assoc_args ) { + public function sync( $args, $assoc_args ) { $profile = $args[0]; - $result = wpsdb_migrate( $profile ); + $result = wpsdb_sync( $profile ); if ( true === $result ) { - WP_CLI::success( __( 'Migration successful.', 'wp-sync-db-cli' ) ); + WP_CLI::success( __( 'Syncing successful.', 'wp-sync-db-cli' ) ); return; } diff --git a/class/wpsdb-cli.php b/class/wpsdb-cli.php index ab59116..549c938 100644 --- a/class/wpsdb-cli.php +++ b/class/wpsdb-cli.php @@ -10,7 +10,7 @@ function __construct( $plugin_file_path ) { if( ! $this->meets_version_requirements( '1.4b1' ) ) return; } - function cli_migration( $profile ) { + function cli_syncing( $profile ) { global $wpsdb; $wpsdb_settings = get_option( 'wpsdb_settings' ); --$profile; @@ -19,13 +19,13 @@ function cli_migration( $profile ) { if( ! isset( $wpsdb_settings['profiles'][$profile] ) ) return $this->cli_error( __( 'Profile ID not found.', 'wp-sync-db-cli' ) ); $this->set_time_limit(); - $wpsdb->set_cli_migration(); + $wpsdb->set_cli_syncing(); - $profile = apply_filters( 'wpsdb_cli_profile_before_migration', $wpsdb_settings['profiles'][$profile] ); + $profile = apply_filters( 'wpsdb_cli_profile_before_syncing', $wpsdb_settings['profiles'][$profile] ); $connection_info = explode( "\n", $profile['connection_info'] ); $form_data = http_build_query( $profile ); - if( 'savefile' == $profile['action'] ) return $this->cli_error( __( 'Exports not supported for CLI migrations. Please instead select push or pull instead.', 'wp-sync-db-cli' ) ); + if( 'savefile' == $profile['action'] ) return $this->cli_error( __( 'Exports not supported for CLI syncing. Please instead select push or pull instead.', 'wp-sync-db-cli' ) ); do_action( 'wpsdb_cli_before_verify_connection_to_remote_site', $profile ); @@ -38,16 +38,16 @@ function cli_migration( $profile ) { if( is_wp_error( $verify_connection_response = $this->verify_cli_response( $response, 'ajax_verify_connection_to_remote_site()' ) ) ) return $verify_connection_response; $verify_connection_response = apply_filters( 'wpsdb_cli_verify_connection_response', $verify_connection_response ); - do_action( 'wpsdb_cli_before_initiate_migration', $profile, $verify_connection_response ); + do_action( 'wpsdb_cli_before_initiate_syncing', $profile, $verify_connection_response ); // this request does one last verification check and creates export / backup files (if required) $_POST['form_data'] = $form_data; - $_POST['stage'] = ( '0' == $profile['create_backup'] ) ? 'migrate' : 'backup'; - $_POST = apply_filters( 'wpsdb_cli_initiate_migration_args', $_POST, $profile, $verify_connection_response ); - $response = $wpsdb->ajax_initiate_migration(); - if( is_wp_error( $initiate_migration_response = $this->verify_cli_response( $response, 'ajax_initiate_migration()' ) ) ) return $initiate_migration_response; + $_POST['stage'] = ( '0' == $profile['create_backup'] ) ? 'sync' : 'backup'; + $_POST = apply_filters( 'wpsdb_cli_initiate_syncing_args', $_POST, $profile, $verify_connection_response ); + $response = $wpsdb->ajax_initiate_syncing(); + if( is_wp_error( $initiate_syncing_response = $this->verify_cli_response( $response, 'ajax_initiate_syncing()' ) ) ) return $initiate_syncing_response; - $initiate_migration_response = apply_filters( 'wpsdb_cli_initiate_migration_response', $initiate_migration_response ); + $initiate_syncing_response = apply_filters( 'wpsdb_cli_initiate_syncing_response', $initiate_syncing_response ); // determine which tables to backup (if required) $tables_to_backup = array(); @@ -70,34 +70,34 @@ function cli_migration( $profile ) { } } } - $tables_to_backup = apply_filters( 'wpsdb_cli_tables_to_backup', $tables_to_backup, $profile, $verify_connection_response, $initiate_migration_response ); + $tables_to_backup = apply_filters( 'wpsdb_cli_tables_to_backup', $tables_to_backup, $profile, $verify_connection_response, $initiate_syncing_response ); - // determine which tables to migrate - $tables_to_migrate = array(); + // determine which tables to sync + $tables_to_sync = array(); if( 'push' == $profile['action'] ) { - if( 'migrate_only_with_prefix' == $profile['table_migrate_option'] ) { - $tables_to_migrate = $this->get_tables( 'prefix' ); - } elseif( 'migrate_select' == $profile['table_migrate_option'] ) { - $tables_to_migrate = array_intersect( $profile['select_tables'], $this->get_tables() ); + if( 'sync_only_with_prefix' == $profile['table_sync_option'] ) { + $tables_to_sync = $this->get_tables( 'prefix' ); + } elseif( 'sync_select' == $profile['table_sync_option'] ) { + $tables_to_sync = array_intersect( $profile['select_tables'], $this->get_tables() ); } } elseif( 'pull' == $profile['action'] ) { - if( 'migrate_only_with_prefix' == $profile['table_migrate_option'] ) { - $tables_to_migrate = $verify_connection_response['prefixed_tables']; - } elseif( 'migrate_select' == $profile['table_migrate_option'] ) { - $tables_to_migrate = array_intersect( $profile['select_tables'], $verify_connection_response['tables'] ); + if( 'sync_only_with_prefix' == $profile['table_sync_option'] ) { + $tables_to_sync = $verify_connection_response['prefixed_tables']; + } elseif( 'sync_select' == $profile['table_sync_option'] ) { + $tables_to_sync = array_intersect( $profile['select_tables'], $verify_connection_response['tables'] ); } } - $tables_to_migrate = apply_filters( 'wpsdb_cli_tables_to_migrate', $tables_to_migrate, $profile, $verify_connection_response, $initiate_migration_response ); + $tables_to_sync = apply_filters( 'wpsdb_cli_tables_to_sync', $tables_to_sync, $profile, $verify_connection_response, $initiate_syncing_response ); - $_POST['dump_filename'] = $initiate_migration_response['dump_filename']; + $_POST['dump_filename'] = $initiate_syncing_response['dump_filename']; $_POST['gzip'] = ( '1' == $verify_connection_response['gzip'] ) ? 1 : 0; $_POST['bottleneck'] = $verify_connection_response['bottleneck']; $_POST['prefix'] = $verify_connection_response['prefix']; - $tables_to_process = ( 'backup' == $_POST['stage'] ) ? $tables_to_backup : $tables_to_migrate; + $tables_to_process = ( 'backup' == $_POST['stage'] ) ? $tables_to_backup : $tables_to_sync; $stage_interator = ( 'backup' == $_POST['stage'] ) ? 1 : 2; - do_action( 'wpsdb_cli_before_migrate_tables', $profile, $verify_connection_response, $initiate_migration_response ); + do_action( 'wpsdb_cli_before_sync_tables', $profile, $verify_connection_response, $initiate_syncing_response ); do { foreach( $tables_to_process as $key => $table ) { @@ -112,36 +112,36 @@ function cli_migration( $profile ) { $_POST['current_row'] = $current_row; $_POST['primary_keys'] = $primary_keys; - $_POST = apply_filters( 'wpsdb_cli_migrate_table_args', $_POST, $profile, $verify_connection_response, $initiate_migration_response ); - $response = $wpsdb->ajax_migrate_table(); - if( is_wp_error( $migrate_table_response = $this->verify_cli_response( $response, 'ajax_migrate_table()' ) ) ) return $migrate_table_response; - $migrate_table_response = apply_filters( 'wpsdb_cli_migrate_table_response', $migrate_table_response, $_POST, $profile, $verify_connection_response, $initiate_migration_response ); + $_POST = apply_filters( 'wpsdb_cli_sync_table_args', $_POST, $profile, $verify_connection_response, $initiate_syncing_response ); + $response = $wpsdb->ajax_sync_table(); + if( is_wp_error( $sync_table_response = $this->verify_cli_response( $response, 'ajax_sync_table()' ) ) ) return $sync_table_response; + $sync_table_response = apply_filters( 'wpsdb_cli_sync_table_response', $sync_table_response, $_POST, $profile, $verify_connection_response, $initiate_syncing_response ); - $current_row = $migrate_table_response['current_row']; - $primary_keys = $migrate_table_response['primary_keys']; + $current_row = $sync_table_response['current_row']; + $primary_keys = $sync_table_response['primary_keys']; } while ( -1 != $current_row ); } ++$stage_interator; - $_POST['stage'] = 'migrate'; - $tables_to_process = $tables_to_migrate; + $_POST['stage'] = 'sync'; + $tables_to_process = $tables_to_sync; } while ( $stage_interator < 3 ); - do_action( 'wpsdb_cli_before_finalize_migration', $profile, $verify_connection_response, $initiate_migration_response ); + do_action( 'wpsdb_cli_before_finalize_syncing', $profile, $verify_connection_response, $initiate_syncing_response ); - $finalize_migration_response = apply_filters( 'wpsdb_cli_finalize_migration', true, $profile, $verify_connection_response, $initiate_migration_response ); - if( is_wp_error( $finalize_migration_response ) ) return $finalize_migration_response; + $finalize_syncing_response = apply_filters( 'wpsdb_cli_finalize_syncing', true, $profile, $verify_connection_response, $initiate_syncing_response ); + if( is_wp_error( $finalize_syncing_response ) ) return $finalize_syncing_response; $_POST['tables'] = implode( ',', $tables_to_process ); $_POST['temp_prefix'] = $verify_connection_response['temp_prefix']; - $_POST = apply_filters( 'wpsdb_cli_finalize_migration_args', $_POST, $profile, $verify_connection_response, $initiate_migration_response ); + $_POST = apply_filters( 'wpsdb_cli_finalize_syncing_args', $_POST, $profile, $verify_connection_response, $initiate_syncing_response ); // don't send redundant POST variables $_POST = $this->filter_post_elements( $_POST, array( 'action', 'intent', 'url', 'key', 'form_data', 'prefix', 'type', 'location', 'tables', 'temp_prefix' ) ); - $response = trim( $wpsdb->ajax_finalize_migration() ); + $response = trim( $wpsdb->ajax_finalize_syncing() ); if( ! empty( $response ) ) return $this->cli_error( $response ); - do_action( 'wpsdb_cli_after_finalize_migration', $profile, $verify_connection_response, $initiate_migration_response ); + do_action( 'wpsdb_cli_after_finalize_syncing', $profile, $verify_connection_response, $initiate_syncing_response ); return true; } diff --git a/languages/wp-sync-db-cli-en.pot b/languages/wp-sync-db-cli-en.pot deleted file mode 100644 index de30979..0000000 --- a/languages/wp-sync-db-cli-en.pot +++ /dev/null @@ -1,50 +0,0 @@ -msgid "" -msgstr "" -"Project-Id-Version: WP Sync DB CLI\n" -"POT-Creation-Date: 2014-05-27 11:40+1000\n" -"PO-Revision-Date: 2014-05-27 11:41+1000\n" -"Last-Translator: Delicious Brains \n" -"Language-Team: Delicious Brains \n" -"Language: en\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"X-Generator: Poedit 1.6.5\n" -"X-Poedit-Basepath: ..\n" -"X-Poedit-SourceCharset: UTF-8\n" -"X-Poedit-KeywordsList: __;_e;_n:1,2;_x:1,2c;_ex:1,2c;_nx:4c,1,2;esc_attr__;" -"esc_attr_e;esc_attr_x:1,2c;esc_html__;esc_html_e;esc_html_x:1,2c;_n_noop:1,2;" -"_nx_noop:3c,1,2;__ngettext_noop:1,2\n" -"Plural-Forms: nplurals=2; plural=(n != 1);\n" -"X-Poedit-SearchPath-0: .\n" - -#: class/command.php:30 -msgid "Migration successful." -msgstr "" - -#: class/wpsdb-cli.php:19 -msgid "Please update WP Sync DB." -msgstr "" - -#: class/wpsdb-cli.php:20 -msgid "Profile ID missing." -msgstr "" - -#: class/wpsdb-cli.php:21 -msgid "Profile ID not found." -msgstr "" - -#: class/wpsdb-cli.php:30 -msgid "" -"Exports not supported for CLI migrations. Please instead select push or pull " -"instead." -msgstr "" - -#: class/wpsdb-cli.php:158 -#, php-format -msgid "%1$s was expecting a JSON response, instead we received: %2$s" -msgstr "" - -#: wp-sync-db-cli.php:44 -msgid "WP Sync DB CLI class not available" -msgstr "" diff --git a/languages/wp-sync-db-cli.pot b/languages/wp-sync-db-cli.pot new file mode 100644 index 0000000..209b2c5 --- /dev/null +++ b/languages/wp-sync-db-cli.pot @@ -0,0 +1,75 @@ +# Loco Gettext template +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: WP Sync DB CLI\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2016-09-21 13:55+0000\n" +"POT-Revision-Date: Sat Sep 24 2016 12:19:01 GMT+0200 (W. Europe Standard " +"Time)\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: \n" +"Language: \n" +"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Poedit-SourceCharset: UTF-8\n" +"X-Generator: Loco - https://localise.biz/\n" +"X-Poedit-Basepath: .\n" +"X-Poedit-SearchPath-0: ..\n" +"X-Poedit-KeywordsList: _:1;gettext:1;dgettext:2;ngettext:1,2;dngettext:2,3;" +"__:1;_e:1;_c:1;_n:1,2;_n_noop:1,2;_nc:1,2;__ngettext:1,2;__ngettext_noop:1,2;" +"_x:1,2c;_ex:1,2c;_nx:1,2,4c;_nx_noop:1,2,3c;_n_js:1,2;_nx_js:1,2,3c;" +"esc_attr__:1;esc_html__:1;esc_attr_e:1;esc_html_e:1;esc_attr_x:1,2c;" +"esc_html_x:1,2c;comments_number_link:2,3;t:1;st:1;trans:1;transChoice:1,2" + +#. Name of the plugin +msgid "WP Sync DB CLI" +msgstr "" + +#. Description of the plugin +msgid "" +"An extension to WP Sync DB, allows you to execute syncing using a function " +"call or via WP-CLI" +msgstr "" + +#. Author of the plugin +msgid "Sean Lang" +msgstr "" + +#. Author URI of the plugin +msgid "http://slang.cx" +msgstr "" + +#: ../wp-sync-db-cli.php:35 +msgid "WP Sync DB CLI class not available" +msgstr "" + +#: ../class/command.php:30 +msgid "Syncing successful." +msgstr "" + +#: ../class/wpsdb-cli.php:17 +msgid "Please update WP Sync DB." +msgstr "" + +#: ../class/wpsdb-cli.php:18 +msgid "Profile ID missing." +msgstr "" + +#: ../class/wpsdb-cli.php:19 +msgid "Profile ID not found." +msgstr "" + +#: ../class/wpsdb-cli.php:28 +msgid "" +"Exports not supported for CLI syncing. Please instead select push or pull " +"instead." +msgstr "" + +#: ../class/wpsdb-cli.php:156 +#, php-format +msgid "%1$s was expecting a JSON response, instead we received: %2$s" +msgstr "" diff --git a/wp-sync-db-cli.php b/wp-sync-db-cli.php index e356bd0..e920ba0 100644 --- a/wp-sync-db-cli.php +++ b/wp-sync-db-cli.php @@ -1,11 +1,11 @@ cli_migration( $profile ); + return $wpsdb_cli->cli_syncing( $profile ); }