diff --git a/asset/dist/js/script-113.js b/asset/dist/js/script-113.js index 88dbc6f..4e7c62c 100644 --- a/asset/dist/js/script-113.js +++ b/asset/dist/js/script-113.js @@ -1,9 +1,9 @@ -var wpmdb = wpmdb || {}; -wpmdb.mst = { +var wpsdb = wpsdb || {}; +wpsdb.mst = { remote_mst_unavailable: false }; -(function( $, wpmdb ) { +(function( $, wpsdb ) { var $mst_options = $( '.mst-options' ); var $mst_select_subsite = $( '#mst-select-subsite' ); var $mst_options_content = $( '.mst-options .expandable-content' ); @@ -26,8 +26,8 @@ wpmdb.mst = { } function disable_mst_options() { - $.wpmdb.do_action( 'wpmdb_lock_replace_url', false ); - $.wpmdb.do_action( 'wpmdb_enable_table_migration_options' ); + $.wpsdb.do_action( 'wpsdb_lock_replace_url', false ); + $.wpsdb.do_action( 'wpsdb_enable_table_syncing_options' ); $mst_select_subsite.attr( 'data-available', '0' ); $mst_select_subsite.prop( 'checked', false ); $mst_select_subsite.attr( 'disabled', 'disabled' ); @@ -45,7 +45,7 @@ wpmdb.mst = { // MST options can only be used from a multisite install at present. // TODO: Remove this test if MST is to be usable from a single site install. - if ( 'false' === wpmdb_data.site_details.is_multisite ) { + if ( 'false' === wpsdb_data.site_details.is_multisite ) { disable_mst_options(); $mst_options.hide(); return; @@ -53,32 +53,32 @@ wpmdb.mst = { // For Pull/Push remote should be a single site install. // TODO: Remove this test if MST is to manage subsite to subsite. - if ( 'savefile' !== wpmdb_migration_type() && - 'undefined' !== typeof wpmdb.mst.remote_connection_data && - 'true' === wpmdb.mst.remote_connection_data.site_details.is_multisite ) { + if ( 'savefile' !== wpsdb_syncing_type() && + 'undefined' !== typeof wpsdb.mst.remote_connection_data && + 'true' === wpsdb.mst.remote_connection_data.site_details.is_multisite ) { disable_mst_options(); $mst_options.hide(); return; } // For Pull/Push remote should have same base prefix. - // TODO: Allow migrating to different base prefix. - if ( 'savefile' !== wpmdb_migration_type() && + // TODO: Allow syncing to different base prefix. + if ( 'savefile' !== wpsdb_syncing_type() && false === unavailable && - 'undefined' !== typeof wpmdb.mst.remote_connection_data && - 'undefined' !== typeof wpmdb.mst.remote_connection_data.site_details && - wpmdb_data.site_details.prefix !== wpmdb.mst.remote_connection_data.site_details.prefix ) { + 'undefined' !== typeof wpsdb.mst.remote_connection_data && + 'undefined' !== typeof wpsdb.mst.remote_connection_data.site_details && + wpsdb_data.site_details.prefix !== wpsdb.mst.remote_connection_data.site_details.prefix ) { disable_mst_options(); maybe_update_local_url_for_subsite( false ); - $( '.mst-remote-location' ).html( wpmdb.mst.remote_connection_data.url ); - $( '.mst-remote-prefix' ).html( wpmdb.mst.remote_connection_data.site_details.prefix ); + $( '.mst-remote-location' ).html( wpsdb.mst.remote_connection_data.url ); + $( '.mst-remote-prefix' ).html( wpsdb.mst.remote_connection_data.site_details.prefix ); $mst_different_prefix_notice.show(); return; } $mst_different_prefix_notice.hide(); // For Pull/Push remote also needs MST. - if ( unavailable && 'true' === wpmdb_data.site_details.is_multisite && 'savefile' !== wpmdb_migration_type() ) { + if ( unavailable && 'true' === wpsdb_data.site_details.is_multisite && 'savefile' !== wpsdb_syncing_type() ) { disable_mst_options(); maybe_update_local_url_for_subsite( false ); $mst_unavailable.show(); @@ -86,13 +86,13 @@ wpmdb.mst = { } $mst_unavailable.hide(); - if ( 'savefile' !== wpmdb_migration_type() && - 'undefined' !== typeof wpmdb.mst.remote_connection_data && - wpmdb_data.mst_version !== wpmdb.mst.remote_connection_data.mst_version ) { + if ( 'savefile' !== wpsdb_syncing_type() && + 'undefined' !== typeof wpsdb.mst.remote_connection_data && + wpsdb_data.mst_version !== wpsdb.mst.remote_connection_data.mst_version ) { disable_mst_options(); maybe_update_local_url_for_subsite( false ); - $( '.mst-remote-location' ).html( wpmdb.mst.remote_connection_data.url ); - $( '.mst-remote-version' ).html( wpmdb.mst.remote_connection_data.mst_version ); + $( '.mst-remote-location' ).html( wpsdb.mst.remote_connection_data.url ); + $( '.mst-remote-version' ).html( wpsdb.mst.remote_connection_data.mst_version ); $mst_different_plugin_version_notice.show(); return; } @@ -112,10 +112,10 @@ wpmdb.mst = { } function maybe_lock_replace_url() { - if ( doing_mst_select_subsite() && 'savefile' !== wpmdb_migration_type() ) { - $.wpmdb.do_action( 'wpmdb_lock_replace_url', true ); + if ( doing_mst_select_subsite() && 'savefile' !== wpsdb_syncing_type() ) { + $.wpsdb.do_action( 'wpsdb_lock_replace_url', true ); } else { - $.wpmdb.do_action( 'wpmdb_lock_replace_url', false ); + $.wpsdb.do_action( 'wpsdb_lock_replace_url', false ); } } @@ -126,7 +126,7 @@ wpmdb.mst = { } // If not an Export, we know what the new table prefix should be. - if ( 'savefile' !== wpmdb_migration_type() ) { + if ( 'savefile' !== wpsdb_syncing_type() ) { $mst_new_prefix.hide(); $mst_new_prefix_readonly.show(); $mst_new_prefix_field.children( 'label' ).addClass( 'disabled' ); @@ -134,7 +134,7 @@ wpmdb.mst = { var new_prefix = table_prefix; var selected_subsite = get_selected_subsite(); - if ( 'pull' === wpmdb_migration_type() ) { + if ( 'pull' === wpsdb_syncing_type() ) { if ( undefined !== selected_subsite.blog_id && 1 < selected_subsite.blog_id ) { new_prefix = new_prefix + selected_subsite.blog_id + '_'; } @@ -158,7 +158,7 @@ wpmdb.mst = { maybe_lock_replace_url(); - $.wpmdb.do_action( 'wpmdbmst_select_subsite_changed', args ); + $.wpsdb.do_action( 'wpsdbmst_select_subsite_changed', args ); } function get_selected_subsite() { @@ -179,7 +179,7 @@ wpmdb.mst = { function selected_subsite_changed() { var selected_subsite = get_selected_subsite(); - $.wpmdb.do_action( 'wpmdbmst_selected_subsite_changed', selected_subsite ); + $.wpsdb.do_action( 'wpsdbmst_selected_subsite_changed', selected_subsite ); } var subsite_for_tables = false; @@ -187,17 +187,17 @@ wpmdb.mst = { function update_table_selects( selected_subsite ) { // Force table select lists to be refreshed (and filtered again). - $.wpmdb.do_action( 'wpmdb_refresh_table_selects' ); + $.wpsdb.do_action( 'wpsdb_refresh_table_selects' ); - if ( 'pull' === wpmdb_migration_type() ) { - $.wpmdb.do_action( 'wpmdb_update_pull_table_select' ); + if ( 'pull' === wpsdb_syncing_type() ) { + $.wpsdb.do_action( 'wpsdb_update_pull_table_select' ); } else { - $.wpmdb.do_action( 'wpmdb_update_push_table_select' ); + $.wpsdb.do_action( 'wpsdb_update_push_table_select' ); } - // We may need to enable or disable the ability to select the "Migrate all tables with prefix ..." option. + // We may need to enable or disable the ability to select the "Sync all tables with prefix ..." option. if ( doing_mst_select_subsite() ) { - $.wpmdb.do_action( 'wpmdb_disable_table_migration_options' ); + $.wpsdb.do_action( 'wpsdb_disable_table_syncing_options' ); // When switching subsites select all the tables unless still loading saved profile. if ( finished_loading && @@ -206,25 +206,25 @@ wpmdb.mst = { ( undefined !== subsite_for_tables.blog_id && undefined !== selected_subsite.blog_id && subsite_for_tables.blog_id !== selected_subsite.blog_id ) ) ) { - $.wpmdb.do_action( 'wpmdb_select_all_tables' ); + $.wpsdb.do_action( 'wpsdb_select_all_tables' ); } } else { - $.wpmdb.do_action( 'wpmdb_enable_table_migration_options' ); + $.wpsdb.do_action( 'wpsdb_enable_table_syncing_options' ); } subsite_for_tables = selected_subsite; } function select_subsite_tables_on_change_action( data ) { - if ( undefined !== wpmdb.mst.remote_connection_data && - 'true' !== wpmdb.mst.remote_connection_data.site_details.is_multisite && + if ( undefined !== wpsdb.mst.remote_connection_data && + 'true' !== wpsdb.mst.remote_connection_data.site_details.is_multisite && doing_mst_select_subsite() && - data.last_migration_type !== data.migration_type + data.last_syncing_type !== data.syncing_type ) { - // Timeout required otherwise wpmdb_update_push/pull_table_select action runs after this + // Timeout required otherwise wpsdb_update_push/pull_table_select action runs after this setTimeout( function() { - $.wpmdb.do_action( 'wpmdb_select_all_tables' ); + $.wpsdb.do_action( 'wpsdb_select_all_tables' ); } ); } } @@ -239,7 +239,7 @@ wpmdb.mst = { } var replace_right = false; - if ( 'pull' === wpmdb_migration_type() ) { + if ( 'pull' === wpsdb_syncing_type() ) { replace_right = true; } @@ -266,7 +266,7 @@ wpmdb.mst = { return true; } } else { - var escaped_table_name = wpmdb.preg_quote( table_name ); + var escaped_table_name = wpsdb.preg_quote( table_name ); var regex = new RegExp( table_prefix + '([0-9]+)_', 'i' ); var results = regex.exec( escaped_table_name ); return null == results; // If null is returned, there was no match which is good in this case. @@ -277,7 +277,7 @@ wpmdb.mst = { } function filter_table_for_subsite( exclude, table_name ) { - if ( 'false' === wpmdb_data.site_details.is_multisite ) { + if ( 'false' === wpsdb_data.site_details.is_multisite ) { return exclude; } @@ -293,28 +293,28 @@ wpmdb.mst = { return true; } - if ( 1 === wpmdb.subsite_for_table( table_prefix, table_name ) ) { + if ( 1 === wpsdb.subsite_for_table( table_prefix, table_name ) ) { // wp_users and wp_usermeta are relevant to all sites, shortcut out. - if ( wpmdb.table_is( table_prefix, 'users', table_name ) || wpmdb.table_is( table_prefix, 'usermeta', table_name ) ) { + if ( wpsdb.table_is( table_prefix, 'users', table_name ) || wpsdb.table_is( table_prefix, 'usermeta', table_name ) ) { return exclude; } - // Following tables are Multisite setup tables and can be excluded from migration. + // Following tables are Multisite setup tables and can be excluded from syncing. // We'll handle getting any data we need from these tables elsewhere. var ms_tables = [ 'blog_versions', 'blogs', 'registration_log', 'signups', 'site', 'sitemeta' ]; $.each( ms_tables, function( index, ms_table ) { - if ( wpmdb.table_is( table_prefix, ms_table, table_name ) ) { + if ( wpsdb.table_is( table_prefix, ms_table, table_name ) ) { exclude = true; } } ); } // If pulling from a single site install, all properly prefixed tables are relevant. - if ( 'pull' === wpmdb_migration_type() && - 'undefined' !== typeof wpmdb.mst.remote_connection_data && - 'true' !== wpmdb.mst.remote_connection_data.site_details.is_multisite ) { + if ( 'pull' === wpsdb_syncing_type() && + 'undefined' !== typeof wpsdb.mst.remote_connection_data && + 'true' !== wpsdb.mst.remote_connection_data.site_details.is_multisite ) { return exclude; } @@ -327,28 +327,28 @@ wpmdb.mst = { } function validate_new_prefix( new_prefix ) { - var escaped_new_prefix = wpmdb.preg_quote( new_prefix ); + var escaped_new_prefix = wpsdb.preg_quote( new_prefix ); var regex = new RegExp( '[^a-z0-9_]', 'i' ); var results = regex.exec( escaped_new_prefix ); return null == results; // If null is returned there was no match, which is good in this case. } - function filter_migration_profile_ready( value, args ) { - if ( 'false' === wpmdb_data.site_details.is_multisite || false === doing_mst_select_subsite() ) { + function filter_syncing_profile_ready( value, args ) { + if ( 'false' === wpsdb_data.site_details.is_multisite || false === doing_mst_select_subsite() ) { return value; } var new_prefix = $mst_new_prefix.val(); if ( false === get_selected_subsite() ) { - alert( wpmdbmst_strings.please_select_a_subsite ); + alert( wpsdbmst_strings.please_select_a_subsite ); value = false; } else if ( 0 === new_prefix.trim().length ) { - alert( wpmdbmst_strings.please_enter_a_prefix ); + alert( wpsdbmst_strings.please_enter_a_prefix ); value = false; } else if ( false === validate_new_prefix( new_prefix ) ) { - alert( wpmdbmst_strings.new_prefix_contents ); + alert( wpsdbmst_strings.new_prefix_contents ); value = false; } @@ -361,22 +361,22 @@ wpmdb.mst = { // If dealing with non-primary subsite tables and a single site install, we may need to adjust table names to be backed up. if ( undefined !== selected_subsite.blog_id && 1 < selected_subsite.blog_id && - ( 'false' === wpmdb_data.site_details.is_multisite || 'true' !== wpmdb.mst.remote_connection_data.site_details.is_multisite ) ) { + ( 'false' === wpsdb_data.site_details.is_multisite || 'true' !== wpsdb.mst.remote_connection_data.site_details.is_multisite ) ) { $.each( selected_tables, function( index, table_name ) { - if ( false === wpmdb.table_is( table_prefix, 'users', table_name ) && false === wpmdb.table_is( table_prefix, 'usermeta', table_name ) ) { + if ( false === wpsdb.table_is( table_prefix, 'users', table_name ) && false === wpsdb.table_is( table_prefix, 'usermeta', table_name ) ) { // Table to backup needs subsite prefix? if ( false === is_subsite_table( table_prefix, table_name ) && ( - ( 'pull' === wpmdb_migration_type() && 'true' === wpmdb_data.site_details.is_multisite ) || - ( 'push' === wpmdb_migration_type() && 'true' === wpmdb.mst.remote_connection_data.site_details.is_multisite ) + ( 'pull' === wpsdb_syncing_type() && 'true' === wpsdb_data.site_details.is_multisite ) || + ( 'push' === wpsdb_syncing_type() && 'true' === wpsdb.mst.remote_connection_data.site_details.is_multisite ) ) ) { selected_tables[ index ] = $mst_new_prefix.val() + table_name.substr( table_prefix.length ); } // Table to backup needs subsite prefix removed? if ( true === is_subsite_table( table_prefix, table_name ) && ( - ( 'pull' === wpmdb_migration_type() && 'false' === wpmdb_data.site_details.is_multisite ) || - ( 'push' === wpmdb_migration_type() && 'true' !== wpmdb.mst.remote_connection_data.site_details.is_multisite ) + ( 'pull' === wpsdb_syncing_type() && 'false' === wpsdb_data.site_details.is_multisite ) || + ( 'push' === wpsdb_syncing_type() && 'true' !== wpsdb.mst.remote_connection_data.site_details.is_multisite ) ) ) { selected_tables[ index ] = $mst_new_prefix.val() + table_name.substr( ( table_prefix + selected_subsite.blog_id + '_' ).length ); } @@ -397,48 +397,48 @@ wpmdb.mst = { } function update_remote_connection_data( connection_data ) { - wpmdb.mst.remote_connection_data = connection_data; - wpmdb.mst.remote_mst_unavailable = ( 'undefined' === typeof connection_data.mst_available ); + wpsdb.mst.remote_connection_data = connection_data; + wpsdb.mst.remote_mst_unavailable = ( 'undefined' === typeof connection_data.mst_available ); } // IMPORTANT: This action fires before find/replace columns are swapped for pull/push. - $.wpmdb.add_action( 'move_connection_info_box', function( args ) { + $.wpsdb.add_action( 'move_connection_info_box', function( args ) { table_prefix = $( '.table-select-wrap .table-prefix' ).text(); if ( null === original_local_url ) { - original_local_url = $.wpmdb.apply_filters( 'wpmdb_base_old_url' ); + original_local_url = $.wpsdb.apply_filters( 'wpsdb_base_old_url' ); } - if ( undefined !== args.migration_type && undefined !== args.last_migration_type ) { - if ( args.migration_type !== args.last_migration_type && ( 'pull' === args.migration_type || 'pull' === args.last_migration_type ) ) { + if ( undefined !== args.syncing_type && undefined !== args.last_syncing_type ) { + if ( args.syncing_type !== args.last_syncing_type && ( 'pull' === args.syncing_type || 'pull' === args.last_syncing_type ) ) { reverse_replace = true; } } - wpmdb_toggle_migration_action_text(); - hide_show_options( wpmdb.mst.remote_mst_unavailable ); - $.wpmdb.do_action( 'wpmdb_refresh_table_selects' ); + wpsdb_toggle_syncing_action_text(); + hide_show_options( wpsdb.mst.remote_mst_unavailable ); + $.wpsdb.do_action( 'wpsdb_refresh_table_selects' ); if ( reverse_replace ) { reverse_replace = false; } } ); - $.wpmdb.add_action( 'verify_connection_to_remote_site', function( connection_data ) { + $.wpsdb.add_action( 'verify_connection_to_remote_site', function( connection_data ) { update_remote_connection_data( connection_data ); - hide_show_options( wpmdb.mst.remote_mst_unavailable ); + hide_show_options( wpsdb.mst.remote_mst_unavailable ); } ); - $.wpmdb.add_action( 'wpmdbmst_select_subsite_changed', selected_subsite_changed ); - $.wpmdb.add_action( 'wpmdbmst_selected_subsite_changed', update_table_selects ); - $.wpmdb.add_action( 'wpmdbmst_selected_subsite_changed', maybe_update_local_url_for_subsite ); - $.wpmdb.add_action( 'wpmdbmst_selected_subsite_changed', hide_show_new_prefix_field ); - $.wpmdb.add_action( 'move_connection_info_box', select_subsite_tables_on_change_action ); + $.wpsdb.add_action( 'wpsdbmst_select_subsite_changed', selected_subsite_changed ); + $.wpsdb.add_action( 'wpsdbmst_selected_subsite_changed', update_table_selects ); + $.wpsdb.add_action( 'wpsdbmst_selected_subsite_changed', maybe_update_local_url_for_subsite ); + $.wpsdb.add_action( 'wpsdbmst_selected_subsite_changed', hide_show_new_prefix_field ); + $.wpsdb.add_action( 'move_connection_info_box', select_subsite_tables_on_change_action ); - $.wpmdb.add_action( 'wpmdb_connection_data_updated', update_remote_connection_data ); + $.wpsdb.add_action( 'wpsdb_connection_data_updated', update_remote_connection_data ); - $.wpmdb.add_filter( 'wpmdb_exclude_table', filter_table_for_subsite ); - $.wpmdb.add_filter( 'wpmdb_migration_profile_ready', filter_migration_profile_ready ); - $.wpmdb.add_filter( 'wpmdb_backup_selected_tables', filter_backup_selected_tables ); + $.wpsdb.add_filter( 'wpsdb_exclude_table', filter_table_for_subsite ); + $.wpsdb.add_filter( 'wpsdb_syncing_profile_ready', filter_syncing_profile_ready ); + $.wpsdb.add_filter( 'wpsdb_backup_selected_tables', filter_backup_selected_tables ); - $.wpmdb.add_filter( 'wpmdbmf_enable_select_subsites', filter_mf_enable_select_subsites ); + $.wpsdb.add_filter( 'wpsdbmf_enable_select_subsites', filter_mf_enable_select_subsites ); $( document ).ready( function() { $( 'body' ).on( 'change', '#mst-select-subsite', function( e ) { @@ -449,8 +449,8 @@ wpmdb.mst = { selected_subsite_changed(); } ); - hide_show_options( wpmdb.mst.remote_mst_unavailable ); + hide_show_options( wpsdb.mst.remote_mst_unavailable ); finished_loading = true; } ); -})( jQuery, wpmdb ); +})( jQuery, wpsdb ); diff --git a/asset/dist/js/script-113.min.js b/asset/dist/js/script-113.min.js index 2f7cfaa..c3ed042 100644 --- a/asset/dist/js/script-113.min.js +++ b/asset/dist/js/script-113.min.js @@ -1 +1 @@ -var wpmdb=wpmdb||{};wpmdb.mst={remote_mst_unavailable:!1},function(a,b){function c(){return"1"===w.attr("data-available")&&w.is(":checked")?!0:!1}function d(){a.wpmdb.do_action("wpmdb_lock_replace_url",!1),a.wpmdb.do_action("wpmdb_enable_table_migration_options"),w.attr("data-available","0"),w.prop("checked",!1),w.attr("disabled","disabled"),a(".mst").addClass("disabled"),x.hide()}function e(){w.attr("data-available","1"),w.removeAttr("disabled"),a(".mst").removeClass("disabled")}function f(f){return"false"===wpmdb_data.site_details.is_multisite?(d(),void v.hide()):"savefile"!==wpmdb_migration_type()&&"undefined"!=typeof b.mst.remote_connection_data&&"true"===b.mst.remote_connection_data.site_details.is_multisite?(d(),void v.hide()):"savefile"!==wpmdb_migration_type()&&!1===f&&"undefined"!=typeof b.mst.remote_connection_data&&"undefined"!=typeof b.mst.remote_connection_data.site_details&&wpmdb_data.site_details.prefix!==b.mst.remote_connection_data.site_details.prefix?(d(),n(!1),a(".mst-remote-location").html(b.mst.remote_connection_data.url),a(".mst-remote-prefix").html(b.mst.remote_connection_data.site_details.prefix),void F.show()):(F.hide(),f&&"true"===wpmdb_data.site_details.is_multisite&&"savefile"!==wpmdb_migration_type()?(d(),n(!1),void D.show()):(D.hide(),"savefile"!==wpmdb_migration_type()&&"undefined"!=typeof b.mst.remote_connection_data&&wpmdb_data.mst_version!==b.mst.remote_connection_data.mst_version?(d(),n(!1),a(".mst-remote-location").html(b.mst.remote_connection_data.url),a(".mst-remote-version").html(b.mst.remote_connection_data.mst_version),void E.show()):(E.hide(),e(),c()?(x.show(),k()):x.hide(),g(),void v.show())))}function g(){c()&&"savefile"!==wpmdb_migration_type()?a.wpmdb.do_action("wpmdb_lock_replace_url",!0):a.wpmdb.do_action("wpmdb_lock_replace_url",!1)}function h(){if(""===y.val())return void z.hide();if("savefile"!==wpmdb_migration_type()){A.hide(),C.show(),z.children("label").addClass("disabled");var a=J,b=j();"pull"===wpmdb_migration_type()&&void 0!==b.blog_id&&1 $mst_select_subsite = false; $mst_selected_subsite = 0; if ( isset( $assoc_args['subsite'] ) ) { if ( ! is_multisite() ) { - return $wpmdbpro_cli->cli_error( __( 'The installation must be a Multisite network to make use of the subsite option', 'wp-migrate-db-pro-multisite-tools' ) ); + return $wpsdb_cli->cli_error( __( 'The installation must be a Multisite network to make use of the subsite option', 'wp-sync-db-pro-multisite-tools' ) ); } if ( empty( $assoc_args['subsite'] ) ) { - return $wpmdbpro_cli->cli_error( __( 'A valid Blog ID or Subsite URL must be supplied to make use of the subsite option', 'wp-migrate-db-pro-multisite-tools' ) ); + return $wpsdb_cli->cli_error( __( 'A valid Blog ID or Subsite URL must be supplied to make use of the subsite option', 'wp-sync-db-pro-multisite-tools' ) ); } $mst_selected_subsite = $this->get_subsite_id( $assoc_args['subsite'] ); if ( false === $mst_selected_subsite ) { - return $wpmdbpro_cli->cli_error( __( 'A valid Blog ID or Subsite URL must be supplied to make use of the subsite option', 'wp-migrate-db-pro-multisite-tools' ) ); + return $wpsdb_cli->cli_error( __( 'A valid Blog ID or Subsite URL must be supplied to make use of the subsite option', 'wp-sync-db-pro-multisite-tools' ) ); } $mst_select_subsite = true; @@ -65,21 +65,21 @@ public function add_extra_cli_args( $profile, $args, $assoc_args ) { $new_prefix = $wpdb->base_prefix; if ( isset( $assoc_args['prefix'] ) ) { if ( false === $mst_select_subsite ) { - return $wpmdbpro_cli->cli_error( __( 'A new table name prefix may only be specified for subsite exports.', 'wp-migrate-db-pro-multisite-tools' ) ); + return $wpsdb_cli->cli_error( __( 'A new table name prefix may only be specified for subsite exports.', 'wp-sync-db-pro-multisite-tools' ) ); } if ( empty( $assoc_args['prefix'] ) ) { - return $wpmdbpro_cli->cli_error( __( 'A valid prefix must be supplied to make use of the prefix option', 'wp-migrate-db-pro-multisite-tools' ) ); + return $wpsdb_cli->cli_error( __( 'A valid prefix must be supplied to make use of the prefix option', 'wp-sync-db-pro-multisite-tools' ) ); } $new_prefix = trim( $assoc_args['prefix'] ); if ( sanitize_key( $new_prefix ) !== $new_prefix ) { - return $wpmdbpro_cli->cli_error( $this->get_string( 'new_prefix_contents' ) ); + return $wpsdb_cli->cli_error( $this->get_string( 'new_prefix_contents' ) ); } } elseif ( 1 < $mst_selected_subsite && 'pull' === $profile['action'] ) { $new_prefix .= $mst_selected_subsite . '_'; } - // Disable Media Files Select Subsites if using Subsite Migration. + // Disable Media Files Select Subsites if using Subsite Syncing. if ( $mst_select_subsite && ! empty( $profile['mf_select_subsites'] ) && ! empty( $profile['mf_selected_subsites'] ) ) { unset( $profile['mf_select_subsites'], $profile['mf_selected_subsites'] ); } diff --git a/class/wpmdbpro-multisite-tools.php b/class/wpsdb-multisite-tools.php similarity index 79% rename from class/wpmdbpro-multisite-tools.php rename to class/wpsdb-multisite-tools.php index f6aeb9e..e332054 100644 --- a/class/wpmdbpro-multisite-tools.php +++ b/class/wpsdb-multisite-tools.php @@ -1,7 +1,7 @@ plugin_slug = 'wp-migrate-db-pro-multisite-tools'; - $this->plugin_version = $GLOBALS['wpmdb_meta']['wp-migrate-db-pro-multisite-tools']['version']; + $this->plugin_slug = 'wp-sync-db-pro-multisite-tools'; + $this->plugin_version = $GLOBALS['wpsdb_meta']['wp-sync-db-pro-multisite-tools']['version']; if ( ! $this->meets_version_requirements( '1.6.1' ) ) { return; } @@ -24,39 +24,39 @@ function __construct( $plugin_file_path ) { 'keep_active_plugins', ); - add_action( 'wpmdb_before_migration_options', array( $this, 'migration_form_controls' ) ); - add_action( 'wpmdb_load_assets', array( $this, 'load_assets' ) ); - add_action( 'wpmdb_diagnostic_info', array( $this, 'diagnostic_info' ) ); - add_filter( 'wpmdb_accepted_profile_fields', array( $this, 'accepted_profile_fields' ) ); - add_filter( 'wpmdb_establish_remote_connection_data', array( $this, 'establish_remote_connection_data' ) ); - add_filter( 'wpmdb_data', array( $this, 'js_variables' ) ); - - add_filter( 'wpmdb_exclude_table', array( $this, 'filter_table_for_subsite' ), 10, 2 ); - add_filter( 'wpmdb_tables', array( $this, 'filter_tables_for_subsite' ), 10, 2 ); - add_filter( 'wpmdb_table_sizes', array( $this, 'filter_table_sizes_for_subsite' ), 10, 2 ); - add_filter( 'wpmdb_target_table_name', array( $this, 'filter_target_table_name' ), 10, 4 ); - add_filter( 'wpmdb_table_row', array( $this, 'filter_table_row' ), 10, 4 ); - add_filter( 'wpmdb_find_and_replace', array( $this, 'filter_find_and_replace' ), 10, 3 ); - add_filter( 'wpmdb_finalize_target_table_name', array( $this, 'filter_finalize_target_table_name' ), 10, 3 ); - add_filter( 'wpmdb_preserved_options', array( $this, 'filter_preserved_options' ), 10, 2 ); - add_filter( 'wpmdb_preserved_options_data', array( $this, 'filter_preserved_options_data' ), 10, 2 ); - add_filter( 'wpmdb_get_alter_queries', array( $this, 'filter_get_alter_queries' ) ); - - global $wpmdbpro; - $this->wpmdbpro = $wpmdbpro; - - if ( class_exists( 'WPMDBPro_Media_Files' ) ) { - add_filter( 'wpmdbmf_include_subsite', array( $this, 'include_subsite' ), 10, 3 ); - add_filter( 'wpmdbmf_destination_file_path', array( $this, 'filter_mf_destination_file_path' ), 10, 3 ); - add_filter( 'wpmdbmf_file_not_on_local', array( $this, 'filter_mf_file_not_on_local' ), 10, 3 ); - add_filter( 'wpmdbmf_get_remote_attachment_batch_response', array( $this, 'filter_mf_get_remote_attachment_batch_response', ), 10, 3 ); - add_filter( 'wpmdbmf_exclude_local_media_file_from_removal', array( $this, 'filter_mf_exclude_local_media_file_from_removal', ), 10, 4 ); - add_filter( 'wpmdbmf_file_to_download', array( $this, 'filter_mf_file_to_download', ), 10, 3 ); + add_action( 'wpsdb_before_syncing_options', array( $this, 'syncing_form_controls' ) ); + add_action( 'wpsdb_load_assets', array( $this, 'load_assets' ) ); + add_action( 'wpsdb_diagnostic_info', array( $this, 'diagnostic_info' ) ); + add_filter( 'wpsdb_accepted_profile_fields', array( $this, 'accepted_profile_fields' ) ); + add_filter( 'wpsdb_establish_remote_connection_data', array( $this, 'establish_remote_connection_data' ) ); + add_filter( 'wpsdb_data', array( $this, 'js_variables' ) ); + + add_filter( 'wpsdb_exclude_table', array( $this, 'filter_table_for_subsite' ), 10, 2 ); + add_filter( 'wpsdb_tables', array( $this, 'filter_tables_for_subsite' ), 10, 2 ); + add_filter( 'wpsdb_table_sizes', array( $this, 'filter_table_sizes_for_subsite' ), 10, 2 ); + add_filter( 'wpsdb_target_table_name', array( $this, 'filter_target_table_name' ), 10, 4 ); + add_filter( 'wpsdb_table_row', array( $this, 'filter_table_row' ), 10, 4 ); + add_filter( 'wpsdb_find_and_replace', array( $this, 'filter_find_and_replace' ), 10, 3 ); + add_filter( 'wpsdb_finalize_target_table_name', array( $this, 'filter_finalize_target_table_name' ), 10, 3 ); + add_filter( 'wpsdb_preserved_options', array( $this, 'filter_preserved_options' ), 10, 2 ); + add_filter( 'wpsdb_preserved_options_data', array( $this, 'filter_preserved_options_data' ), 10, 2 ); + add_filter( 'wpsdb_get_alter_queries', array( $this, 'filter_get_alter_queries' ) ); + + global $wpsdb; + $this->wpsdb = $wpsdb; + + if ( class_exists( 'WPSDB_Media_Files' ) ) { + add_filter( 'wpsdbmf_include_subsite', array( $this, 'include_subsite' ), 10, 3 ); + add_filter( 'wpsdbmf_destination_file_path', array( $this, 'filter_mf_destination_file_path' ), 10, 3 ); + add_filter( 'wpsdbmf_file_not_on_local', array( $this, 'filter_mf_file_not_on_local' ), 10, 3 ); + add_filter( 'wpsdbmf_get_remote_attachment_batch_response', array( $this, 'filter_mf_get_remote_attachment_batch_response', ), 10, 3 ); + add_filter( 'wpsdbmf_exclude_local_media_file_from_removal', array( $this, 'filter_mf_exclude_local_media_file_from_removal', ), 10, 4 ); + add_filter( 'wpsdbmf_file_to_download', array( $this, 'filter_mf_file_to_download', ), 10, 3 ); } } /** - * Does the given user need to be migrated? + * Does the given user need to be synced? * * @param int $user_id * @param int $blog_id Optional. @@ -98,7 +98,7 @@ private function is_user_required_for_blog( $user_id, $blog_id = 0 ) { return $users[ $blog_id ][ $user_id ]; } - // If the user has any posts that are going to be migrated, we need the user regardless of whether they still have access. + // If the user has any posts that are going to be synced, we need the user regardless of whether they still have access. switch_to_blog( $blog_id ); $user_posts = count_user_posts( $user_id ); restore_current_blog(); @@ -118,23 +118,23 @@ private function is_user_required_for_blog( $user_id, $blog_id = 0 ) { /** * Return subsite id if subsite selected. * - * @param WPMDB_Base $plugin_instance + * @param WPSDB_Base $plugin_instance * - * @return int Will return 0 if not doing MST migration. + * @return int Will return 0 if not doing MST syncing. * - * Will return 0 if not doing MST migration. + * Will return 0 if not doing MST syncing. */ public function selected_subsite( &$plugin_instance = null ) { $blog_id = 0; if ( empty( $plugin_instance ) ) { - $plugin_instance = &$this->wpmdbpro; + $plugin_instance = &$this->wpsdb; } $this->state_data = $plugin_instance->set_post_data(); if ( ! empty( $this->state_data['form_data'] ) ) { - $this->form_data = $this->parse_migration_form_data( $this->state_data['form_data'] ); + $this->form_data = $this->parse_syncing_form_data( $this->state_data['form_data'] ); $select_subsite = $this->profile_value( 'mst_select_subsite' ); $selected_subsite = $this->profile_value( 'mst_selected_subsite' ); @@ -145,7 +145,7 @@ public function selected_subsite( &$plugin_instance = null ) { $selected_subsite = $this->profile_value( 'select_subsite' ); } - // During a migration, this is where the subsite's id will be derived. + // During a syncing, this is where the subsite's id will be derived. if ( empty( $blog_id ) && ! empty( $select_subsite ) && ! empty( $selected_subsite ) && @@ -155,7 +155,7 @@ public function selected_subsite( &$plugin_instance = null ) { } } - // When loading a saved migration profile, this is where the subsite's id will be derived. + // When loading a saved syncing profile, this is where the subsite's id will be derived. global $loaded_profile; if ( empty( $blog_id ) && ! empty( $loaded_profile['mst_select_subsite'] ) && @@ -174,10 +174,10 @@ public function selected_subsite( &$plugin_instance = null ) { } /** - * Adds the multisite tools settings to the migration setting page in core. + * Adds the multisite tools settings to the syncing setting page in core. */ - public function migration_form_controls() { - $this->template( 'migrate' ); + public function syncing_form_controls() { + $this->template( 'sync' ); } /** @@ -231,13 +231,13 @@ public function get_strings() { } $strings = array( - 'migration_failed' => __( 'Migration failed', 'wp-migrate-db-pro-multisite-tools' ), - 'please_select_a_subsite' => __( 'Please select a subsite.', 'wp-migrate-db-pro-multisite-tools' ), - 'please_enter_a_prefix' => __( 'Please enter a new table prefix.', 'wp-migrate-db-pro-multisite-tools' ), - 'new_prefix_contents' => __( 'Please only enter letters, numbers or underscores for the new table prefix.', 'wp-migrate-db-pro-multisite-tools' ), - 'export_subsite_option' => __( 'Export a subsite as a single site install', 'wp-migrate-db-pro-multisite-tools' ), - 'pull_subsite_option' => __( 'Pull into a specific subsite', 'wp-migrate-db-pro-multisite-tools' ), - 'push_subsite_option' => __( 'Push a specific subsite', 'wp-migrate-db-pro-multisite-tools' ), + 'syncing_failed' => __( 'Syncing failed', 'wp-sync-db-pro-multisite-tools' ), + 'please_select_a_subsite' => __( 'Please select a subsite.', 'wp-sync-db-pro-multisite-tools' ), + 'please_enter_a_prefix' => __( 'Please enter a new table prefix.', 'wp-sync-db-pro-multisite-tools' ), + 'new_prefix_contents' => __( 'Please only enter letters, numbers or underscores for the new table prefix.', 'wp-sync-db-pro-multisite-tools' ), + 'export_subsite_option' => __( 'Export a subsite as a single site install', 'wp-sync-db-pro-multisite-tools' ), + 'pull_subsite_option' => __( 'Pull into a specific subsite', 'wp-sync-db-pro-multisite-tools' ), + 'push_subsite_option' => __( 'Push a specific subsite', 'wp-sync-db-pro-multisite-tools' ), ); return $strings; @@ -266,21 +266,21 @@ public function load_assets() { $min = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min'; $src = $plugins_url . 'asset/dist/css/styles.css'; - wp_enqueue_style( 'wp-migrate-db-pro-multisite-tools-styles', $src, array( 'wp-migrate-db-pro-styles' ), $version ); + wp_enqueue_style( 'wp-sync-db-pro-multisite-tools-styles', $src, array( 'wp-sync-db-pro-styles' ), $version ); $src = $plugins_url . "asset/dist/js/script{$ver_string}{$min}.js"; - wp_enqueue_script( 'wp-migrate-db-pro-multisite-tools-script', + wp_enqueue_script( 'wp-sync-db-pro-multisite-tools-script', $src, array( 'jquery', - 'wp-migrate-db-pro-common', - 'wp-migrate-db-pro-hook', - 'wp-migrate-db-pro-script', + 'wp-sync-db-pro-common', + 'wp-sync-db-pro-hook', + 'wp-sync-db-pro-script', ), $version, true ); - wp_localize_script( 'wp-migrate-db-pro-multisite-tools-script', 'wpmdbmst_strings', $this->get_strings() ); + wp_localize_script( 'wp-sync-db-pro-multisite-tools-script', 'wpsdbmst_strings', $this->get_strings() ); } /** @@ -295,7 +295,7 @@ public function diagnostic_info() { } /** - * Should the given table be excluded from a subsite migration. + * Should the given table be excluded from a subsite syncing. * * @param bool $exclude * @param string $table_name @@ -311,12 +311,12 @@ public function filter_table_for_subsite( $exclude, $table_name ) { if ( 0 < $blog_id ) { // wp_users and wp_usermeta are relevant to all sites, shortcut out. - if ( $this->wpmdbpro->table_is( '', $table_name, 'non_ms_global' ) ) { + if ( $this->wpsdb->table_is( '', $table_name, 'non_ms_global' ) ) { return $exclude; } - // Following tables are Multisite setup tables and can be excluded from migration. - if ( $this->wpmdbpro->table_is( '', $table_name, 'ms_global' ) ) { + // Following tables are Multisite setup tables and can be excluded from syncing. + if ( $this->wpsdb->table_is( '', $table_name, 'ms_global' ) ) { return true; } @@ -341,7 +341,7 @@ public function filter_table_for_subsite( $exclude, $table_name ) { } /** - * Filter the given tables if doing a subsite migration. + * Filter the given tables if doing a subsite syncing. * * @param array $tables * @param string $scope @@ -375,7 +375,7 @@ public function filter_tables_for_subsite( $tables, $scope = 'regular' ) { } /** - * Filter the given tables with sizes if doing a subsite migration. + * Filter the given tables with sizes if doing a subsite syncing. * * @param array $table_sizes * @param string $scope @@ -393,7 +393,7 @@ public function filter_table_sizes_for_subsite( $table_sizes, $scope = 'regular' } /** - * Change the name of the given table if subsite selected and migration profile has new prefix. + * Change the name of the given table if subsite selected and syncing profile has new prefix. * * @param string $table_name * @param string $action @@ -409,7 +409,7 @@ public function filter_target_table_name( $table_name, $action, $stage, $site_de return $table_name; } - $new_prefix = $this->wpmdbpro->profile_value( 'new_prefix' ); + $new_prefix = $this->wpsdb->profile_value( 'new_prefix' ); if ( empty( $new_prefix ) ) { return $table_name; @@ -417,7 +417,7 @@ public function filter_target_table_name( $table_name, $action, $stage, $site_de global $wpdb; $old_prefix = $wpdb->base_prefix; - if ( is_multisite() && 1 < $blog_id && ! $this->wpmdbpro->table_is( '', $table_name, 'global', '', $blog_id ) ) { + if ( is_multisite() && 1 < $blog_id && ! $this->wpsdb->table_is( '', $table_name, 'global', '', $blog_id ) ) { $old_prefix .= $blog_id . '_'; } @@ -427,9 +427,9 @@ public function filter_target_table_name( $table_name, $action, $stage, $site_de ( 'pull' === $action && 'true' === $site_details['local']['is_multisite'] ) || ( 'push' === $action && 'true' === $site_details['remote']['is_multisite'] ) ) && - $this->wpmdbpro->table_is( '', $table_name, 'global' ) + $this->wpsdb->table_is( '', $table_name, 'global' ) ) { - $new_prefix .= 'wpmdbglobal_'; + $new_prefix .= 'wpsdbglobal_'; } if ( 0 === stripos( $table_name, $old_prefix ) ) { @@ -440,7 +440,7 @@ public function filter_target_table_name( $table_name, $action, $stage, $site_de } /** - * Handler for the wpmdb_table_row filter. + * Handler for the wpsdb_table_row filter. * The given $row can be modified, but if we return false the row will not be used. * * @param stdClass $row @@ -458,7 +458,7 @@ public function filter_table_row( $row, $table_name, $action, $stage ) { return $use; } - $new_prefix = $this->wpmdbpro->profile_value( 'new_prefix' ); + $new_prefix = $this->wpsdb->profile_value( 'new_prefix' ); if ( empty( $new_prefix ) ) { return $row; @@ -471,20 +471,20 @@ public function filter_table_row( $row, $table_name, $action, $stage ) { $old_prefix .= $blog_id . '_'; } - if ( $this->wpmdbpro->table_is( 'options', $table_name ) ) { - // Rename options records like wp_X_user_roles to wp_Y_user_roles otherwise no users can do anything in the migrated site. + if ( $this->wpsdb->table_is( 'options', $table_name ) ) { + // Rename options records like wp_X_user_roles to wp_Y_user_roles otherwise no users can do anything in the synced site. if ( 0 === stripos( $row->option_name, $old_prefix ) ) { $row->option_name = substr_replace( $row->option_name, $new_prefix, 0, strlen( $old_prefix ) ); } } - if ( $this->wpmdbpro->table_is( 'usermeta', $table_name ) ) { + if ( $this->wpsdb->table_is( 'usermeta', $table_name ) ) { if ( ! $this->is_user_required_for_blog( $row->user_id, $blog_id ) ) { $use = false; } elseif ( 1 == $blog_id ) { $prefix_escaped = preg_quote( $wpdb->base_prefix ); if ( 1 === preg_match( '/^' . $prefix_escaped . '([0-9]+)_/', $row->meta_key, $matches ) ) { - // Remove non-primary subsite records from usermeta when migrating primary subsite. + // Remove non-primary subsite records from usermeta when syncing primary subsite. $use = false; } elseif ( 0 === stripos( $row->meta_key, $old_prefix ) ) { // Rename prefixed keys. @@ -501,7 +501,7 @@ public function filter_table_row( $row, $table_name, $action, $stage ) { } } - if ( $this->wpmdbpro->table_is( 'users', $table_name ) ) { + if ( $this->wpsdb->table_is( 'users', $table_name ) ) { if ( ! $this->is_user_required_for_blog( $row->ID, $blog_id ) ) { $use = false; } @@ -511,7 +511,7 @@ public function filter_table_row( $row, $table_name, $action, $stage ) { } /** - * Handler for the wpmdb_find_and_replace filter. + * Handler for the wpsdb_find_and_replace filter. * * @param array $tmp_find_replace_pairs * @param string $intent @@ -590,7 +590,7 @@ public function filter_find_and_replace( $tmp_find_replace_pairs, $intent, $site } /** - * Change the name of the given table depending on migration profile settings and source and target site setup. + * Change the name of the given table depending on syncing profile settings and source and target site setup. * * @param string $table_name * @param string $intent @@ -598,7 +598,7 @@ public function filter_find_and_replace( $tmp_find_replace_pairs, $intent, $site * * @return string * - * This is run in response to the wpmdb_finalize_target_table_name filter on the target site. + * This is run in response to the wpsdb_finalize_target_table_name filter on the target site. */ public function filter_finalize_target_table_name( $table_name, $intent, $site_details ) { $blog_id = $this->selected_subsite(); @@ -607,19 +607,19 @@ public function filter_finalize_target_table_name( $table_name, $intent, $site_d return $table_name; } - $new_prefix = $this->wpmdbpro->profile_value( 'new_prefix' ); + $new_prefix = $this->wpsdb->profile_value( 'new_prefix' ); if ( empty( $new_prefix ) ) { return $table_name; } - // During a MST migration we add a custom prefix to the global tables so that we can manipulate their data before use. - if ( is_multisite() && $this->wpmdbpro->table_is( '', $table_name, 'global', $new_prefix, $blog_id ) ) { - $new_prefix .= 'wpmdbglobal_'; + // During a MST syncing we add a custom prefix to the global tables so that we can manipulate their data before use. + if ( is_multisite() && $this->wpsdb->table_is( '', $table_name, 'global', $new_prefix, $blog_id ) ) { + $new_prefix .= 'wpsdbglobal_'; } $old_prefix = ( 'pull' === $intent ? $site_details['remote']['prefix'] : $site_details['local']['prefix'] ); - if ( ! is_multisite() && 1 < $blog_id && ! $this->wpmdbpro->table_is( '', $table_name, 'global', $new_prefix, $blog_id ) ) { + if ( ! is_multisite() && 1 < $blog_id && ! $this->wpsdb->table_is( '', $table_name, 'global', $new_prefix, $blog_id ) ) { $old_prefix .= $blog_id . '_'; } @@ -637,8 +637,8 @@ public function filter_finalize_target_table_name( $table_name, $intent, $site_d * * @return array|string */ - public function parse_migration_form_data( $data ) { - $form_data = parent::parse_migration_form_data( $data ); + public function parse_syncing_form_data( $data ) { + $form_data = parent::parse_syncing_form_data( $data ); $form_data = array_intersect_key( $form_data, array_flip( $this->accepted_fields ) ); @@ -650,12 +650,12 @@ public function parse_migration_form_data( $data ) { * * @param string $file_path * @param string $intent - * @param WPMDBPro_Media_Files_Base $wpmdbmf + * @param WPSDB_Media_Files_Base $wpsdbmf * * @return string */ - public function filter_mf_destination_file_path( $file_path, $intent, $wpmdbmf ) { - $blog_id = $this->selected_subsite( $wpmdbmf ); + public function filter_mf_destination_file_path( $file_path, $intent, $wpsdbmf ) { + $blog_id = $this->selected_subsite( $wpsdbmf ); if ( 1 > $blog_id ) { return $file_path; @@ -673,12 +673,12 @@ public function filter_mf_destination_file_path( $file_path, $intent, $wpmdbmf ) * * @param string $file * @param string $intent - * @param WPMDBPro_Media_Files_Base $wpmdbmf + * @param WPSDB_Media_Files_Base $wpsdbmf * * @return string */ - public function filter_mf_file_not_on_local( $file, $intent, $wpmdbmf ) { - $blog_id = $this->selected_subsite( $wpmdbmf ); + public function filter_mf_file_not_on_local( $file, $intent, $wpsdbmf ) { + $blog_id = $this->selected_subsite( $wpsdbmf ); if ( 1 > $blog_id ) { return $file; @@ -704,12 +704,12 @@ public function filter_mf_file_not_on_local( $file, $intent, $wpmdbmf ) { * * @param array $response * @param string $intent - * @param WPMDBPro_Media_Files_Base $wpmdbmf + * @param WPSDB_Media_Files_Base $wpsdbmf * * @return string */ - public function filter_mf_get_remote_attachment_batch_response( $response, $intent, $wpmdbmf ) { - $blog_id = $this->selected_subsite( $wpmdbmf ); + public function filter_mf_get_remote_attachment_batch_response( $response, $intent, $wpsdbmf ) { + $blog_id = $this->selected_subsite( $wpsdbmf ); if ( 1 > $blog_id ) { return $response; @@ -745,12 +745,12 @@ public function filter_mf_get_remote_attachment_batch_response( $response, $inte * * @param string $file * @param string $intent - * @param WPMDBPro_Media_Files_Base $wpmdbmf + * @param WPSDB_Media_Files_Base $wpsdbmf * * @return string */ - public function filter_mf_file_to_download( $file, $intent, $wpmdbmf ) { - $blog_id = $this->selected_subsite( $wpmdbmf ); + public function filter_mf_file_to_download( $file, $intent, $wpsdbmf ) { + $blog_id = $this->selected_subsite( $wpsdbmf ); if ( 1 > $blog_id ) { return $file; @@ -772,17 +772,17 @@ public function filter_mf_file_to_download( $file, $intent, $wpmdbmf ) { * @param bool $value * @param string $upload_dir * @param string $short_file_path - * @param WPMDBPro_Media_Files_Base $wpmdbmf + * @param WPSDB_Media_Files_Base $wpsdbmf * * @return bool */ - public function filter_mf_exclude_local_media_file_from_removal( $value, $upload_dir, $short_file_path, $wpmdbmf ) { + public function filter_mf_exclude_local_media_file_from_removal( $value, $upload_dir, $short_file_path, $wpsdbmf ) { // Already excluded, don't override. if ( $value ) { return $value; } - $blog_id = $this->selected_subsite( $wpmdbmf ); + $blog_id = $this->selected_subsite( $wpsdbmf ); if ( 1 > $blog_id ) { return $value; @@ -803,16 +803,16 @@ public function filter_mf_exclude_local_media_file_from_removal( $value, $upload } /** - * Handler for "wpmdbmf_include_subsite" filter to disallow subsite's media to be migrated if not selected. + * Handler for "wpsdbmf_include_subsite" filter to disallow subsite's media to be synced if not selected. * * @param bool $value * @param int $blog_id - * @param WPMDBPro_Media_Files_Base $wpmdbmf + * @param WPSDB_Media_Files_Base $wpsdbmf * * @return bool */ - public function include_subsite( $value, $blog_id, $wpmdbmf ) { - $selected_blog_id = $this->selected_subsite( $wpmdbmf ); + public function include_subsite( $value, $blog_id, $wpsdbmf ) { + $selected_blog_id = $this->selected_subsite( $wpsdbmf ); if ( 1 > $selected_blog_id ) { return $value; @@ -850,7 +850,7 @@ public function filter_preserved_options( $preserved_options, $intent = '' ) { } /** - * Maybe preserve the WPMDB plugins if they aren't already preserved. + * Maybe preserve the WPSDB plugins if they aren't already preserved. * * @param array $preserved_options_data * @param string $intent @@ -874,23 +874,23 @@ public function filter_preserved_options_data( $preserved_options_data, $intent $table_name = esc_sql( $table ); $option_value = unserialize( $option['option_value'] ); - $migrated_plugins = array(); - $wpmdb_plugins = array(); + $synced_plugins = array(); + $wpsdb_plugins = array(); if ( $result = $wpdb->get_var( "SELECT option_value FROM $table_name WHERE option_name = 'active_plugins'" ) ) { $unserialized = unserialize( $result ); if ( is_array( $unserialized ) ) { - $migrated_plugins = $unserialized; + $synced_plugins = $unserialized; } } foreach ( $option_value as $plugin_key => $plugin ) { - if ( 0 === strpos( $plugin, 'wp-migrate-db' ) ) { - $wpmdb_plugins[] = $plugin; + if ( 0 === strpos( $plugin, 'wp-sync-db' ) ) { + $wpsdb_plugins[] = $plugin; } } - $merged_plugins = array_unique( array_merge( $wpmdb_plugins, $migrated_plugins ) ); + $merged_plugins = array_unique( array_merge( $wpsdb_plugins, $synced_plugins ) ); $option['option_value'] = serialize( $merged_plugins ); $preserved_options_data[ $table ][ $key ] = $option; break; @@ -903,7 +903,7 @@ public function filter_preserved_options_data( $preserved_options_data, $intent } /** - * Append more queries to be run at finalize_migration. + * Append more queries to be run at finalize_syncing. * * @param array $queries * @@ -930,22 +930,22 @@ public function filter_get_alter_queries( $queries ) { $comments_imported = false; $target_comments_table = null; foreach ( $tables as $table ) { - if ( empty( $source_users_table ) && $this->wpmdbpro->table_is( 'users', $table ) ) { + if ( empty( $source_users_table ) && $this->wpsdb->table_is( 'users', $table ) ) { $target_users_table = $table; $source_users_table = $this->filter_finalize_target_table_name( $table, $this->state_data['intent'], $this->state_data['site_details'] ); continue; } - if ( empty( $source_usermeta_table ) && $this->wpmdbpro->table_is( 'usermeta', $table ) ) { + if ( empty( $source_usermeta_table ) && $this->wpsdb->table_is( 'usermeta', $table ) ) { $target_usermeta_table = $table; $source_usermeta_table = $this->filter_finalize_target_table_name( $table, $this->state_data['intent'], $this->state_data['site_details'] ); continue; } - if ( ! $posts_imported && $this->wpmdbpro->table_is( 'posts', $table ) ) { + if ( ! $posts_imported && $this->wpsdb->table_is( 'posts', $table ) ) { $posts_imported = true; $target_posts_table = $this->filter_finalize_target_table_name( $table, $this->state_data['intent'], $this->state_data['site_details'] ); continue; } - if ( ! $comments_imported && $this->wpmdbpro->table_is( 'comments', $table ) ) { + if ( ! $comments_imported && $this->wpsdb->table_is( 'comments', $table ) ) { $comments_imported = true; $target_comments_table = $this->filter_finalize_target_table_name( $table, $this->state_data['intent'], $this->state_data['site_details'] ); continue; @@ -998,13 +998,13 @@ public function filter_get_alter_queries( $queries ) { } } - $queries[]['query'] = "ALTER TABLE `{$target_users_table}` ADD COLUMN wpmdb_user_id BIGINT(20) UNSIGNED;\n"; + $queries[]['query'] = "ALTER TABLE `{$target_users_table}` ADD COLUMN wpsdb_user_id BIGINT(20) UNSIGNED;\n"; $where = ''; if ( ! empty( $updated_user_ids ) ) { $where = 'WHERE u2.id NOT IN (' . join( ',', $updated_user_ids ) . ')'; } - $queries[]['query'] = "INSERT INTO `{$target_users_table}` (user_login, user_pass, user_nicename, user_email, user_url, user_registered, user_activation_key, user_status, display_name, wpmdb_user_id) + $queries[]['query'] = "INSERT INTO `{$target_users_table}` (user_login, user_pass, user_nicename, user_email, user_url, user_registered, user_activation_key, user_status, display_name, wpsdb_user_id) SELECT u2.user_login, u2.user_pass, u2.user_nicename, u2.user_email, u2.user_url, u2.user_registered, u2.user_activation_key, u2.user_status, u2.display_name, u2.id FROM `{$source_users_table}` AS u2 {$where};\n"; @@ -1013,14 +1013,14 @@ public function filter_get_alter_queries( $queries ) { $queries[]['query'] = "INSERT INTO `{$target_usermeta_table}` (user_id, meta_key, meta_value) SELECT u.id, m2.meta_key, m2.meta_value FROM `{$source_usermeta_table}` AS m2 - JOIN `{$target_users_table}` AS u ON m2.user_id = u.wpmdb_user_id;\n"; + JOIN `{$target_users_table}` AS u ON m2.user_id = u.wpsdb_user_id;\n"; } if ( $posts_imported ) { $queries[]['query'] = " UPDATE `{$target_posts_table}` AS p, `{$target_users_table}` AS u SET p.post_author = u.id - WHERE p.post_author = u.wpmdb_user_id + WHERE p.post_author = u.wpsdb_user_id ;\n"; } @@ -1028,12 +1028,12 @@ public function filter_get_alter_queries( $queries ) { $queries[]['query'] = " UPDATE `{$target_comments_table}` AS c, `{$target_users_table}` AS u SET c.user_id = u.id - WHERE c.user_id = u.wpmdb_user_id + WHERE c.user_id = u.wpsdb_user_id ;\n"; } $queries[]['query'] = "DROP TABLE `{$source_users_table}`;\n"; - $queries[]['query'] = "ALTER TABLE `{$target_users_table}` DROP COLUMN wpmdb_user_id;\n"; + $queries[]['query'] = "ALTER TABLE `{$target_users_table}` DROP COLUMN wpsdb_user_id;\n"; } // Cleanup imported usermeta table, whether used by above user related queries or not. diff --git a/languages/wp-migrate-db-pro-multisite-tools-en.pot b/languages/wp-migrate-db-pro-multisite-tools-en.pot deleted file mode 100644 index 8f4448d..0000000 --- a/languages/wp-migrate-db-pro-multisite-tools-en.pot +++ /dev/null @@ -1,116 +0,0 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER -# This file is distributed under the same license as the PACKAGE package. -# FIRST AUTHOR , YEAR. -# -#, fuzzy -msgid "" -msgstr "" -"Project-Id-Version: wp-migrate-db-pro-multisite-tools\n" -"Report-Msgid-Bugs-To: nom@deliciousbrains.com\n" -"POT-Creation-Date: 2016-07-11 18:30-0700\n" -"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" -"Last-Translator: FULL NAME \n" -"Language-Team: LANGUAGE \n" -"Language: \n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=CHARSET\n" -"Content-Transfer-Encoding: 8bit\n" - -#: class/cli/wpmdbpro-multisite-tools-cli.php:49 -msgid "" -"The installation must be a Multisite network to make use of the subsite " -"option" -msgstr "" - -#: class/cli/wpmdbpro-multisite-tools-cli.php:52 -#: class/cli/wpmdbpro-multisite-tools-cli.php:57 -msgid "" -"A valid Blog ID or Subsite URL must be supplied to make use of the subsite " -"option" -msgstr "" - -#: class/cli/wpmdbpro-multisite-tools-cli.php:68 -msgid "A new table name prefix may only be specified for subsite exports." -msgstr "" - -#: class/cli/wpmdbpro-multisite-tools-cli.php:71 -msgid "A valid prefix must be supplied to make use of the prefix option" -msgstr "" - -#: class/wpmdbpro-multisite-tools.php:234 -msgid "Migration failed" -msgstr "" - -#: class/wpmdbpro-multisite-tools.php:235 -msgid "Please select a subsite." -msgstr "" - -#: class/wpmdbpro-multisite-tools.php:236 -msgid "Please enter a new table prefix." -msgstr "" - -#: class/wpmdbpro-multisite-tools.php:237 -msgid "" -"Please only enter letters, numbers or underscores for the new table prefix." -msgstr "" - -#: class/wpmdbpro-multisite-tools.php:238 -msgid "Export a subsite as a single site install" -msgstr "" - -#: class/wpmdbpro-multisite-tools.php:239 -msgid "Pull into a specific subsite" -msgstr "" - -#: class/wpmdbpro-multisite-tools.php:240 -msgid "Push a specific subsite" -msgstr "" - -#: template/migrate.php:28 -msgid "Select a subsite" -msgstr "" - -#: template/migrate.php:46 -msgid "New Table Name Prefix" -msgstr "" - -#: template/migrate.php:48 -msgid "New Prefix" -msgstr "" - -#: template/migrate.php:55 -msgid "Addon Missing" -msgstr "" - -#: template/migrate.php:55 -msgid "" -"The Multisite Tools addon is inactive on the remote site. " -"Please install and activate it to enable subsite migrations." -msgstr "" - -#: template/migrate.php:59 -msgid "Version Mismatch" -msgstr "" - -#: template/migrate.php:59 -#, php-format -msgid "" -"We have detected you have version " -"of WP Migrate DB Pro Multisite Tools at but are using %1$s here. Please go to the Plugins page on both installs and check for updates." -msgstr "" - -#: template/migrate.php:63 -msgid "Different Table Prefixes" -msgstr "" - -#: template/migrate.php:63 -#, php-format -msgid "" -"We have detected you have table prefix \"\" at but have \"%1$s\" " -"here. Multisite Tools currently only supports migrating subsites between " -"sites with the same base table prefix." -msgstr "" diff --git a/languages/wp-sync-db-multisite-tools.pot b/languages/wp-sync-db-multisite-tools.pot new file mode 100644 index 0000000..97b078f --- /dev/null +++ b/languages/wp-sync-db-multisite-tools.pot @@ -0,0 +1,139 @@ +# Loco Gettext template +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: WP Sync DB Multisite Tools\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:05 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 Multisite Tools" +msgstr "" + +#. Description of the plugin +msgid "An extension to WP Sync DB, supporting Multisite syncing." +msgstr "" + +#. Author of the plugin +msgid "Sean Lang" +msgstr "" + +#. Author URI of the plugin +msgid "http://slang.cx" +msgstr "" + +#: ../class/wpsdb-multisite-tools.php:234 +msgid "Syncing failed" +msgstr "" + +#: ../class/wpsdb-multisite-tools.php:235 +msgid "Please select a subsite." +msgstr "" + +#: ../class/wpsdb-multisite-tools.php:236 +msgid "Please enter a new table prefix." +msgstr "" + +#: ../class/wpsdb-multisite-tools.php:237 +msgid "Please only enter letters, numbers or underscores for the new table prefix." +msgstr "" + +#: ../class/wpsdb-multisite-tools.php:238 +msgid "Export a subsite as a single site install" +msgstr "" + +#: ../class/wpsdb-multisite-tools.php:239 +msgid "Pull into a specific subsite" +msgstr "" + +#: ../class/wpsdb-multisite-tools.php:240 +msgid "Push a specific subsite" +msgstr "" + +#: ../class/cli/wpsdb-multisite-tools-cli.php:49 +msgid "" +"The installation must be a Multisite network to make use of the subsite " +"option" +msgstr "" + +#: ../class/cli/wpsdb-multisite-tools-cli.php:52 ../class/cli/wpsdb-multisite- +#: tools-cli.php:57 +msgid "" +"A valid Blog ID or Subsite URL must be supplied to make use of the subsite " +"option" +msgstr "" + +#: ../class/cli/wpsdb-multisite-tools-cli.php:68 +msgid "A new table name prefix may only be specified for subsite exports." +msgstr "" + +#: ../class/cli/wpsdb-multisite-tools-cli.php:71 +msgid "A valid prefix must be supplied to make use of the prefix option" +msgstr "" + +#: ../template/sync.php:28 +msgid "Select a subsite" +msgstr "" + +#: ../template/sync.php:46 +msgid "New Table Name Prefix" +msgstr "" + +#: ../template/sync.php:48 +msgid "New Prefix" +msgstr "" + +#: ../template/sync.php:55 +msgid "Addon Missing" +msgstr "" + +#: ../template/sync.php:55 +msgid "" +"The Multisite Tools addon is inactive on the remote site. " +"Please install and activate it to enable subsite syncing." +msgstr "" + +#: ../template/sync.php:59 +msgid "Version Mismatch" +msgstr "" + +#: ../template/sync.php:59 +#, php-format +msgid "" +"We have detected you have version " +"of WP Sync DB Multisite Tools at " +"but are using %1$s here. Please go to the Plugins page on " +"both installs and check for updates." +msgstr "" + +#: ../template/sync.php:63 +msgid "Different Table Prefixes" +msgstr "" + +#: ../template/sync.php:63 +#, php-format +msgid "" +"We have detected you have table prefix \"\" at but have " +"\"%1$s\" here. Multisite Tools currently only supports syncing subsites " +"between sites with the same base table prefix." +msgstr "" diff --git a/template/migrate.php b/template/sync.php similarity index 61% rename from template/migrate.php rename to template/sync.php index 4d31dc5..31c17da 100644 --- a/template/migrate.php +++ b/template/sync.php @@ -25,7 +25,7 @@ %1$s', - esc_html( '-- ' . __( 'Select a subsite', 'wp-migrate-db-pro-multisite-tools' ) . ' --' ) + esc_html( '-- ' . __( 'Select a subsite', 'wp-sync-db-pro-multisite-tools' ) . ' --' ) ); foreach ( $this->subsites_list() as $blog_id => $subsite_path ) { $selected = ''; @@ -43,24 +43,24 @@