WP Migrate DB - Version 0.9

Version Description

Download this release

Release Info

Developer deliciousbrains
Plugin Icon 128x128 WP Migrate DB
Version 0.9
Comparing to
See all releases

Code changes from version 0.8 to 0.9

asset/dist/css/styles.css CHANGED
@@ -1 +1 @@
1
- #wpmdb-main{width:742px;position:relative;min-height:950px}.wpmdb h2 ~ .error,.wpmdb h2 ~ .notice,.wpmdb h2 ~ .updated{clear:both}.wpmdb div.updated.warning{max-width:742px;box-sizing:border-box;margin:10px 0}.wpmdb div.updated.warning p{font-size:13px;margin:0.5em 0}.wpmdb a{text-decoration:none}.wpmdb li{margin-bottom:5px;position:relative}.wpmdb ul{margin:0}.wpmdb input[type=checkbox],.wpmdb input[type=radio]{margin-right:5px;vertical-align:baseline;margin-top:0}.wpmdb input[type=text],.wpmdb input[type=password]{padding:5px}.wpmdb input[disabled=disabled]{cursor:default}.wpmdb label.disabled{color:#888;cursor:default}.wpmdb .option-section{border-bottom:1px solid #ccc;padding-bottom:20px;margin-bottom:20px}.wpmdb .option-section h3{font-size:18px;font-weight:normal}.wpmdb p.migrate-db{overflow:hidden;min-height:29px}.wpmdb p.migrate-db input{float:left}.wpmdb p.migrate-db img{float:left;margin:3px 0 0 5px}.wpmdb p.migrate-db .save-settings-button{margin-left:10px;display:none}.wpmdb .indent-wrap{margin-left:24px}.wpmdb .expandable-content{display:none;margin-top:10px}.wpmdb .expandable-content li:last-child{margin-bottom:0px}.wpmdb .header-wrapper{margin-bottom:10px}.wpmdb .header-expand-collapse{cursor:pointer;display:inline-block}.wpmdb .option-description{font-size:12px;color:#999;margin-left:8px;font-weight:normal}.wpmdb .option-group li:last-child{margin-bottom:0}.wpmdb .connection-status{display:none;overflow:auto}.wpmdb .connection-status.error{color:#9D1818}.wpmdb .copy-licence-to-remote-site{display:inline-block}.wpmdb .ajax-spinner{left:6px;position:relative;top:3px}.wpmdb div.message{margin:15px 0 0}.wpmdb .licence-wrap h3{margin:0 0 10px 0}.wpmdb .licence-input{clear:both;display:block;font-family:Consolas, Monaco, monospace;font-size:14px;margin-bottom:7px;padding:10px;width:418px}.wpmdb .register-licence{float:left;outline:none}.wpmdb .licence-status{color:#A21B1B;font-weight:bold;clear:both;padding-top:0.5em;margin:0}.wpmdb .licence-status.success{color:#333}.wpmdb .register-licence-ajax-spinner{margin:4px 0 0 8px}.wpmdb .return-to-profile-selection{margin-bottom:15px;display:inline-block}.wpmdb .return-to-profile-selection.bottom{margin-top:10px}.wpmdb h2.nav-tab-wrapper{margin-top:10px;margin-bottom:20px;padding-left:5px}.wpmdb h2.nav-tab-wrapper a.nav-tab-active{color:#464646;cursor:default}.wpmdb label{display:inline-block;clear:both}.wpmdb .migration-profile-options li{position:relative;width:520px}.wpmdb .migration-profile-options li a{padding:5px 10px;width:500px;border:1px solid #ddd;margin:0px 0px 7px;display:block;font-size:14px;color:#333}.wpmdb .migration-profile-options li a:hover{border-color:#bbb}.wpmdb .main-list-delete-profile-link{color:#999999;font-family:"Times New Roman", serif;font-size:26px;font-weight:200;position:absolute;right:7px;top:6px;cursor:pointer}.wpmdb .main-list-delete-profile-link:hover{color:#444}.wpmdb .crumbs{overflow:hidden;border-bottom:1px solid #ccc;padding:12px 0}.wpmdb .crumbs .crumb{position:relative;display:block;float:left;margin-right:4px;padding-right:3px;font-size:13px;font-weight:bold}.wpmdb .crumbs span.crumb{padding-left:25px}.wpmdb .crumbs span.crumb:before{content:"\f345";position:absolute;left:0;top:0;display:inline-block;-webkit-font-smoothing:antialiased;font:normal 18px/1 'dashicons';vertical-align:middle}.wpmdb .option-group li{margin-bottom:5px}.wpmdb .option-group>li{margin-bottom:8px}.wpmdb .option-group li>label{font-size:14px;font-weight:bold}.wpmdb .option-group ul{display:none;margin:10px 0px 10px 25px}.wpmdb .option-group ul label{font-size:12px;font-weight:normal}.wpmdb .option-heading,.wpmdb .checkbox-label{font-size:14px;font-weight:bold}.wpmdb .checkbox-label input[type=checkbox]{margin-right:7px;position:relative;top:-1px}.wpmdb .expand-collapse-arrow{margin-right:9px}.wpmdb .migrate-selection{padding-top:20px}.wpmdb .migrate-connection-info{min-width:675px;margin:0}.wpmdb .migrate-tab .pull-push-connection-info{width:418px;height:65px;color:#333;font-family:Consolas, Monaco, monospace;font-size:15px;line-height:21px;padding:10px}.wpmdb .basic-access-auth-wrapper{display:none;margin-bottom:5px}.wpmdb .auth-username,.wpmdb .auth-password{width:206px;margin-top:3px}.wpmdb .auth-password{width:207px}.wpmdb .connection-info-wrapper{display:none;width:670px}.wpmdb .connect-button{margin-top:2px}.wpmdb .temp-disabled{background-color:#EEEEEE;color:#888888;font-family:Consolas, Monaco, monospace;text-shadow:0 1px 0 #FFFFFF}.wpmdb .push-list ul{margin-bottom:0px}.wpmdb .find-heading,.wpmdb .replace-heading{float:left}.wpmdb .find-heading{width:400px}.wpmdb .replace-fields{border-collapse:collapse;border-spacing:0px}.wpmdb .replace-fields input{width:295px}.wpmdb .replace-fields tr td{padding-bottom:7px}.wpmdb .replace-fields tr:last-child td{padding-bottom:0px}.wpmdb .arrow-col{width:93px;text-align:center;vertical-align:middle}.wpmdb .right-arrow{font-size:36px;color:#aaa;font-family:arial, sans-serif}.wpmdb .replace-right-col span{border-radius:50%;border:1px solid #ccc;background-color:#eee;width:16px;height:16px;display:inline-block;position:relative;top:4px;cursor:pointer}.wpmdb .replace-right-col span:hover{border-color:#aaa}.wpmdb .pin .sort-handle-col{opacity:0.5;cursor:default}.wpmdb .pin .sort-handle{cursor:default !important}.wpmdb .sort-handle-col{width:20px;cursor:-webkit-grab;cursor:-moz-grab}.wpmdb .sort-handle:before{content:"\f214";display:inline-block;-webkit-font-smoothing:antialiased;font:normal 20px/1 'dashicons';vertical-align:top;color:#aaa;background-color:transparent !important;margin-right:4px}.wpmdb .original-repeatable-field{display:none}.wpmdb .no-replaces-message{display:none;margin-bottom:0px}.wpmdb .inline-message.missing-replace{margin-top:15px;display:none}.wpmdb #new-path-missing-warning{margin-top:5px}.wpmdb .tables-header{display:inline-block}.wpmdb .expand-collapse-arrow{display:inline-block;position:relative;top:-2px;font-size:11px}.wpmdb .collapsed{-webkit-transform:scale(1) rotate(-90deg) translateX(0px) translateY(0px) skewX(0deg) skewY(0deg);-ms-transform:scale(1) rotate(-90deg) translateX(0px) translateY(0px) skewX(0deg) skewY(0deg);transform:scale(1) rotate(-90deg) translateX(0px) translateY(0px) skewX(0deg) skewY(0deg)}.wpmdb .select-deselect-divider{margin:0 6px}.wpmdb .select-wrap{display:none;margin-top:12px}.wpmdb .select-post-types-wrap{display:block}.wpmdb .exclude-post-types-warning{font-size:13px;font-weight:bold;color:#9c1f1f}.wpmdb .exclude-post-types-warning p{margin:0 0 12px 0}.wpmdb .multiselect{min-width:550px;min-height:180px;margin-bottom:10px}.wpmdb .table-migrate-options li label{font-size:12px;font-weight:normal}.wpmdb .table-migrate-options li{margin-bottom:5px}.wpmdb .general-helper{border-radius:50%;border:1px solid #ccc;background-color:#eee;width:15px;height:15px;display:inline-block;position:relative;top:4px;margin-top:-4px;cursor:pointer;margin-left:2px}.wpmdb .general-helper:hover{border-color:#aaa}.wpmdb .general-helper:after{content:"?";color:#999999;font-size:10px;font-weight:bold;left:4px;position:absolute;top:-1px}.wpmdb .helper-message{padding:10px 16px;border-radius:3px;background-color:#fff;position:absolute;width:500px;z-index:9999;display:none;box-shadow:0px 0px 10px rgba(0,0,0,0.2)}.wpmdb .inline-message{padding:10px;border-radius:3px;margin-top:5px}.wpmdb .inline-message.error{border:1px solid #CC0000;background-color:#FFEBE8}.wpmdb .inline-message.warning{background-color:#FFFFE0;border:1px solid #E6DB55}.wpmdb .helper-message:after{content:'';border-bottom:8px solid transparent;border-right:8px solid #fff;border-top:8px solid transparent;display:block;height:0;left:-7px;position:absolute;top:11px;width:0}.wpmdb .helper-message.bottom:before{content:'';border-left:8px solid transparent;border-right:8px solid transparent;border-bottom:8px solid #aaa;border-top:0;display:block;height:0;left:50%;margin-left:-8px;position:absolute;top:-9px;width:0}.wpmdb .helper-message.bottom:after{content:'';border-left:8px solid transparent;border-right:8px solid transparent;border-bottom:8px solid #fff;border-top:0;display:block;height:0;left:50%;margin-left:-8px;position:absolute;top:-8px;width:0}.wpmdb .label-disabled{color:#888}.wpmdb .prefix-notice,.wpmdb .ssl-notice,.wpmdb .different-plugin-version-notice,.wpmdb .directory-permission-notice{background-color:#FFFFE0;border:1px solid #E6DB55;padding:15px;border-radius:3px;margin-bottom:15px;display:none}.wpmdb .prefix-notice p,.wpmdb .ssl-notice p,.wpmdb .different-plugin-version-notice p,.wpmdb .directory-permission-notice p{margin-top:0px}.wpmdb .prefix-notice p:last-child,.wpmdb .ssl-notice p:last-child,.wpmdb .different-plugin-version-notice p:last-child,.wpmdb .directory-permission-notice p:last-child{margin:0px}.wpmdb .different-plugin-version-notice,.wpmdb .directory-permission-notice{background-color:#FFEBE8;border-color:#CC0000}.wpmdb .different-plugin-version-notice a,.wpmdb .directory-permission-notice a{color:#CC0000;text-decoration:underline}.wpmdb .mixed-case-table-name-notice{display:none}.wpmdb .save-migration-profile-wrap li label{font-size:12px;font-weight:normal}.wpmdb .save-migration-profile-wrap li{margin-bottom:5px;padding-left:25px}.wpmdb .save-migration-profile-wrap .indent-wrap{margin-left:0px}.wpmdb .create-new-label{margin-right:8px}.wpmdb .create-new-profile{position:absolute;top:-5px}.wpmdb .replace-remove-row,.wpmdb .delete-profile{background-color:#eee;border:1px solid #ccc;border-radius:50% 50% 50% 50%;cursor:pointer;height:11px;left:5px;margin-left:2px;position:absolute;margin-top:-6px;top:50%;width:11px;display:block;background-position:50% 50%;background-size:6px 6px;background-repeat:no-repeat}.wpmdb .replace-remove-row:after,.wpmdb .delete-profile:after{content:"\00d7";left:2px;position:absolute;top:-3px;color:#aaa;font-size:12px}.wpmdb .replace-remove-row:after{position:relative}.wpmdb .replace-remove-row:hover,.wpmdb .delete-profile:hover{border-color:#aaa}.wpmdb .ajax-success-msg{font-weight:bold;margin-left:9px;position:absolute;display:inline-block}.wpmdb .migrate-db .ajax-success-msg{margin-top:3px}.wpmdb p img.save-profile-ajax-spinner{margin:6px 0 0 10px}.wpmdb .backup-description{left:20px;position:relative}.wpmdb .backup-option-disabled{margin-bottom:0px !important}.wpmdb .settings-tab{display:none}.wpmdb .settings-tab .slider{max-width:416px}.wpmdb .settings-tab .slider-label{display:block;margin-bottom:10px;float:left;width:50%}.wpmdb .settings-tab .slider-label-wrapper{max-width:416px;width:100%;position:relative}.wpmdb .settings-tab .amount{width:50%;text-align:right;display:block;float:left}.wpmdb .settings-tab .slider-spinner{position:absolute;right:-35px;bottom:-13px}.wpmdb .settings-tab .slider-success-msg{right:-63px;bottom:-14px;position:absolute;font-weight:bold}.wpmdb .settings-tab .ui-slider{border:2px solid #fff;height:10px;border-radius:2px;position:relative}.wpmdb .settings-tab .ui-slider-handle{width:20px;height:20px;background-color:#ade7b5;border:2px solid #fff;border-radius:50%;display:block;position:absolute;top:-7px;outline:none;margin-left:-11px}.wpmdb .settings-tab .ui-slider-handle:active{background-color:#86db91;border-color:#eee}.wpmdb .settings-tab .ui-slider-range{background-color:#eee;height:100%}.wpmdb .settings-tab .form-table{margin-top:0}.wpmdb .settings-tab .form-table h3,.wpmdb .settings-tab .form-table h4,.wpmdb .settings-tab .form-table p{margin:0;line-height:1.2}.wpmdb .settings-tab .form-table h3{font-weight:normal}.wpmdb .settings-tab .form-table h4{font-size:15px}.wpmdb .settings-tab .form-table h4 .helper-message{font-weight:normal}.wpmdb .settings-tab .form-table h4 img.ajax-spinner{position:absolute;float:left;top:auto;left:auto;margin-top:1px}.wpmdb .settings-tab .form-table h4 .setting-status .ajax-success-msg{margin-left:6px}.wpmdb .settings-tab .form-table tr td{padding:10px 0}.wpmdb .settings-tab .form-table tr.wpmdb-setting-title td{padding-bottom:0}.wpmdb .settings-tab .form-table tr.wpmdb-setting-title td h3{margin:10px 0}.wpmdb .settings-tab .form-table tr:first-child td{padding-top:0}.wpmdb .settings-tab .form-table tr:first-child td h3{margin-top:0}.wpmdb .settings-tab .form-table tr td:first-child{vertical-align:top;min-width:100px}.wpmdb .settings-tab .form-table tr.option-section label{font-weight:normal;position:relative}.wpmdb .settings-tab .form-table tr.option-section li{margin-bottom:5px}.wpmdb .settings-tab .form-table tr.option-section li:last-child{margin-bottom:0px}.wpmdb .settings-tab .form-table tr.option-section.allow-remote-requests-wrap .ajax-spinner,.wpmdb .settings-tab .form-table tr.option-section.plugin-compatibility-section .ajax-spinner{right:-23px;left:inherit;top:0px;position:absolute}.wpmdb .settings-tab .form-table tr.option-section .bubble .ajax-spinner{right:-45px}.wpmdb .settings-tab .form-table tr.option-section .bubble .ajax-success-msg{right:-65px}.wpmdb .settings-tab .form-table tr.option-section td{padding-bottom:20px}.wpmdb .settings-tab .form-table tr.licence-wrap td{padding-top:0}.wpmdb .settings-tab .form-table tr.licence-wrap td .notification-message{margin:10px 0 0 0}.wpmdb .settings-tab .form-table tr.licence-wrap td #welcome-wrap{height:170px;padding-top:20px;box-shadow:0 1px 1px 0 rgba(0,0,0,0.1);clear:both}.wpmdb .settings-tab .form-table tr.licence-wrap td #welcome-wrap #welcome-img{width:170px;height:170px;float:left}.wpmdb .settings-tab .form-table tr.licence-wrap td #welcome-wrap .welcome-text{height:130px;padding:20px 25px 20px 195px;background:#fff}.wpmdb .settings-tab .form-table tr.licence-wrap td #welcome-wrap .welcome-text h3{font-weight:lighter;font-size:22px;margin-bottom:10px}.wpmdb .settings-tab .form-table tr.licence-wrap td #welcome-wrap .welcome-text p{font-size:15px;line-height:1.5}.wpmdb .settings-tab .form-table tr.licence-wrap td #welcome-wrap .welcome-text a{font-weight:bold}.wpmdb .settings-tab .form-table tr.plugin-compatibility-section td{padding-top:0}.wpmdb .settings-tab .form-table .general-helper:after{top:-1px;font-size:22px;height:20px}.wpmdb .settings-tab .setting-status{padding-left:6px}.wpmdb .settings-tab .slider-label span{font-weight:bold}.wpmdb .allow-remote-reqeusts{font-size:14px;font-weight:bold}.wpmdb .connection-info-label{margin-top:15px;margin-bottom:5px;display:block}.wpmdb .connection-info{clear:both;font-size:15px;line-height:21px;font-family:Consolas, Monaco, monospace;padding:10px 10px;height:67px;text-shadow:0px 1px 0px #fff;display:block;margin-bottom:7px;width:418px}.wpmdb .reset-button-wrap{width:418px}.wpmdb .reset-api-key{float:left}.wpmdb .reset-api-key-ajax-spinner{float:left;margin:4px 7px}.wpmdb .masked-licence{margin-top:0px}.wpmdb .bull{font-size:22px;position:relative;top:4px}.wpmdb .plugin-compatibility-wrap{padding:18px 18px 18px 100px;background-color:#e6e6e6;margin-left:0}.wpmdb .plugin-compatibility-wrap p:last-of-type{margin:10px 0 0 0}.wpmdb ul.plugin-compatibility-options{display:block;margin:10px 0 10px 0px}.wpmdb .plugin-compatibility-spinner{position:relative;top:3px;left:10px}.wpmdb .plugin-compatibility-success-msg{position:relative;left:10px;font-weight:bold}.wpmdb .wpmdb-switch{position:relative;display:inline-block;padding:2px;overflow:hidden;border-radius:2px;background-color:#d4d3d3;cursor:pointer}.wpmdb .wpmdb-switch.on{background-color:#ade7b5}.wpmdb .wpmdb-switch span{visibility:hidden;box-sizing:border-box;float:left;display:inline-block;height:100%;font-size:12px;line-height:20px;border-radius:2px;-webkit-border-radius:2px;font-weight:bold;padding:4px 8px;background:#fff;color:#8d8d8d;z-index:1}.wpmdb .wpmdb-switch span.on{color:#82d78b}.wpmdb .wpmdb-switch span.checked{visibility:visible}.wpmdb .wpmdb-switch.disabled{cursor:default;background:#e6e6e6}.wpmdb .wpmdb-switch.disabled span{background:#f1f1f1;color:#d6d6d6}.wpmdb .wpmdb-switch input[type="checkbox"]{position:absolute !important;top:0;left:0;opacity:0;z-index:-1}.wpmdb .help-tab{display:none}.wpmdb .help-tab h3{font-size:18px;font-weight:normal}.wpmdb .help-tab .support{border-bottom:1px solid #ccc;margin-bottom:25px;padding-bottom:18px}.wpmdb .help-tab .support p{width:640px}.wpmdb .help-tab .support .email a{font-size:12px}.wpmdb .help-tab .support .upgrade-to-pro{font-size:16px;font-weight:bold}.wpmdb .help-tab .support .upgrade-to-pro a{white-space:nowrap}.wpmdb .help-tab .support .ajax-spinner{top:2px}.wpmdb .help-tab .video-viewer{margin-bottom:30px;border:1px solid #ccc}.wpmdb .help-tab .videos{width:640px}.wpmdb .help-tab .videos ul>li{margin-bottom:30px;overflow:hidden;position:relative}.wpmdb .help-tab .videos ul>li a{overflow:hidden;display:block;width:320px;height:180px;float:left;margin-right:15px;position:relative;z-index:1;border:1px solid #ccc}.wpmdb .help-tab .videos ul>li a:before,.wpmdb .help-tab .videos ul>li a:after{position:absolute;content:" ";margin:auto;left:0;right:0;top:0;bottom:0}.wpmdb .help-tab .videos ul>li a:before{width:64px;height:64px;border-radius:64px;filter:progid:DXImageTransform.Microsoft.Alpha(Opacity=80);opacity:0.8;border:1px solid #ddd;background-color:#fff;z-index:2}.wpmdb .help-tab .videos ul>li a:after{filter:progid:DXImageTransform.Microsoft.Alpha(Opacity=80);opacity:0.8;border:21.33333px solid transparent;border-top-width:12.8px;border-bottom-width:12.8px;border-left-color:#333;background:transparent;display:block;left:25px;width:0px;height:0px;z-index:3}.wpmdb .help-tab .videos .video:last-child{margin-bottom:0px}.wpmdb .help-tab .videos img{width:320px;height:240px;position:relative;top:50%;margin-top:-120px}.wpmdb .help-tab .debug{width:640px;border-bottom:1px solid #CCCCCC;margin-bottom:25px;padding-bottom:28px}.wpmdb .help-tab .debug textarea{width:100%;min-height:200px;font-family:Consolas, Monaco, monospace;margin-bottom:5px}.wpmdb .help-tab h4{margin:0 0 0.2em 0}.wpmdb .help-tab p{margin:0 0 0.5em 0}.wpmdb .help-tab iframe{display:none}.wpmdb .addons-tab{display:none}.wpmdb .addons-tab .addon{position:relative;width:100%;min-height:138px;padding:25px 30px 30px 165px;box-sizing:border-box;color:#fff;margin-top:15px}.wpmdb .addons-tab .addon .actions{float:right;font-size:14px}.wpmdb .addons-tab .addon .actions>*{margin-right:10px}.wpmdb .addons-tab .addon .actions *:last-child{margin-right:0}.wpmdb .addons-tab .addon .actions .action{background-color:#fff;font-weight:bold;display:inline-block;padding:0.2em 0.4em}.wpmdb .addons-tab .addon .actions .action:hover{background-color:rgba(255,255,255,0.92)}.wpmdb .addons-tab .addon .actions .status{border-bottom:2px solid #fff;padding-bottom:0.1em}.wpmdb .addons-tab .addon h1{font-family:"HelveticaNeue-Light", "Helvetica Neue Light", "Helvetica Neue", sans-serif;font-weight:normal;float:left;margin:0;margin-top:5px;color:#fff}.wpmdb .addons-tab .addon p{font-size:16px;line-height:1.2em;clear:both;margin:0}.wpmdb .addons-tab .addon p a{text-decoration:underline;color:#fff}.wpmdb .addons-tab .addon p a:hover{color:rgba(255,255,255,0.9)}.wpmdb .addons-tab .addon.wp-migrate-db-pro-media-files{background:#3fab3f url(../img/icon-media-files.svg) no-repeat 30px 30px;background-size:110px 85px}.wpmdb .addons-tab .addon.wp-migrate-db-pro-media-files .action{color:#3fab3f}.wpmdb .addons-tab .addon.wp-migrate-db-pro-cli{background:#272822 url(../img/icon-cli.svg) no-repeat 30px 30px;background-size:110px 97px;min-height:157px;color:#ddd}.wpmdb .addons-tab .addon.wp-migrate-db-pro-cli .action{color:#272822;background-color:#ddd}.wpmdb .addons-tab .addon.wp-migrate-db-pro-cli .action:hover{color:#272822;background-color:#eee}.wpmdb .addons-tab .addon.wp-migrate-db-pro-cli .status{border-bottom-color:#ddd}.wpmdb .addons-tab .addon.wp-migrate-db-pro-cli p a{color:#ddd}.wpmdb .addons-tab .addon.wp-migrate-db-pro-cli p a:hover{color:#f7f7f7}.wpmdb .addons-tab .addon.wp-migrate-db-pro-cli code{white-space:nowrap;margin:0;padding:0}.wpmdb .addons-tab .addon.wp-migrate-db-pro-multisite-tools{background:#a90000 url(../img/icon-multisite-tools.svg) no-repeat 30px 20px;background-size:110px 118px;min-height:157px}.wpmdb .addons-tab .addon.wp-migrate-db-pro-multisite-tools .action{color:#a90000}.wpmdb-not-pro .wpmdb .wpmdb-main{margin-top:15px}.wpmdb-not-pro .wpmdb .migrate-selection ul{margin:0px}.wpmdb-not-pro .wpmdb .help-tab .support p{width:auto}#wpmdb-sidebar{position:absolute;top:-21px;right:-312px;width:292px}#wpmdb-sidebar .block{padding:20px;border:1px solid #ccc}#wpmdb-sidebar .subscribe{border-top:none}#wpmdb-sidebar .subscribe h2{padding:0;margin:0;margin-bottom:0.5em;color:#666;font-size:20px;line-height:1.2em;float:none}#wpmdb-sidebar .subscribe h3{font-size:16px;margin:0}#wpmdb-sidebar .subscribe p{margin:0}#wpmdb-sidebar .subscribe p.interesting{margin-bottom:1em;line-height:1.4}#wpmdb-sidebar .subscribe .links{margin-bottom:2em}#wpmdb-sidebar .subscribe .links a{text-decoration:none}#wpmdb-sidebar .subscribe .promise{color:#999;font-size:12px;line-height:1.4em}#wpmdb-sidebar .subscribe .field{margin-bottom:0.5em}#wpmdb-sidebar .subscribe .field p{margin-bottom:0.3em}#wpmdb-sidebar .subscribe .field.submit-button{margin-bottom:1em}#wpmdb-sidebar .testimonial{border-top:none}#wpmdb-sidebar .testimonial p{margin:0}#wpmdb-sidebar .testimonial .quote{font-size:20px}#wpmdb-sidebar .testimonial .author{white-space:nowrap;text-align:right}#wpmdb-sidebar .testimonial .stars{white-space:nowrap;margin-bottom:5px}#wpmdb-sidebar .testimonial .via{text-align:right;font-size:12px}#wpmdb-sidebar .testimonial .via a{color:#666}#wpmdb-sidebar .testimonial .via a:before{content:"\f301";display:inline-block;-webkit-font-smoothing:antialiased;font:normal 18px/1 'dashicons';vertical-align:top;margin-right:3px}@media (min--moz-device-pixel-ratio: 1.3), (-webkit-min-device-pixel-ratio: 1.3), (min-device-pixel-ratio: 1.3), (min-resolution: 1.3dppx){#wpmdb-sidebar .wpmdb-banner{background-image:url(../img/wp-migrate-db-pro@2x.jpg);background-size:292px 292px;width:292px;height:292px;display:block}#wpmdb-sidebar .wpmdb-banner img{display:none}}@media screen and (max-width: 1252px){#wpmdb-sidebar{position:relative;top:auto;right:auto;margin-top:50px}}body.mp6 input[type=checkbox]:disabled{opacity:1;border-color:#ccc}body.mp6 #wpmdb-main{font-size:14px}body.mp6 p{font-size:14px}body.mp6 .wrap>h1{float:left}body.mp6 .wrap h2{float:left}body.mp6 .wpmdb .content-tab{padding-top:15px}body.mp6 .wpmdb .migrate-tab{padding-top:0}body.mp6 .wpmdb input[type=checkbox],body.mp6 .wpmdb input[type=radio]{vertical-align:middle;margin-top:-4px}body.mp6 .wpmdb input[type=text],body.mp6 .wpmdb input[type=password]{padding:3px 5px}body.mp6 .wpmdb input.code{padding-top:6px}body.mp6 .wpmdb label{font-size:14px}body.mp6 .wpmdb h2.nav-tab-wrapper{float:none;margin-bottom:0;width:722px;font-size:23px;line-height:29px;padding:9px 0 0 5px}body.mp6 .wpmdb .help-tab h3{margin-top:0}body.mp6 .wpmdb .temp-disabled{background-color:#f9f9f9}body.mp6 .wpmdb .migration-profile-options li a{border-color:#ccc;color:#555;background-color:#e4e4e4}body.mp6 .wpmdb .migration-profile-options li a:hover{background-color:#fff;color:#464646}body.mp6 .wpmdb .settings-tab .slider-label span{vertical-align:middle}body.mp6 .wpmdb .settings-tab .slider-label-wrapper{font-size:14px}body.mp6 .wpmdb .settings-tab .ui-slider{border-color:#fff;background-color:#fff}body.mp6 .wpmdb .settings-tab .ui-slider-range{background-color:#ade7b5}body.mp6 .wpmdb .settings-tab .option-section li label{font-size:14px}body.mp6 .wpmdb .connection-info,body.mp6 .wpmdb .migrate-tab .pull-push-connection-info{font-weight:bold;font-size:14px}body.mp6 .wpmdb .general-helper{border:0;width:auto;height:auto;top:auto;margin:0}body.mp6 .wpmdb .general-helper:after{content:"\f223";display:inline-block;-webkit-font-smoothing:antialiased;font:normal 22px/1 'dashicons';vertical-align:top;top:auto;left:auto;position:relative}body.mp6 .wpmdb .helper-message{font-size:14px;line-height:1.4em}body.mp6 .wpmdb .right-arrow{display:none}body.mp6 .wpmdb .arrow-col{width:75px}body.mp6 .wpmdb .arrow-col:after{content:"\f344";display:inline-block;-webkit-font-smoothing:antialiased;font:normal 22px/1 'dashicons';vertical-align:top;color:#999}body.mp6 .wpmdb .arrow-col:hover{cursor:pointer}body.mp6 .wpmdb .arrow-col:hover:after{color:#666}body.mp6 .wpmdb .arrow-col.disabled:after{opacity:0.5}body.mp6 .wpmdb .arrow-col.disabled:hover{cursor:default}body.mp6 .wpmdb .arrow-col.disabled:hover:after{color:#999}body.mp6 .wpmdb .find-heading{width:409px}body.mp6 .wpmdb .replace-fields input{width:304px}body.mp6 .wpmdb .replace-right-col span{border-color:#999}body.mp6 .wpmdb .replace-right-col span:hover{border-color:#666}body.mp6 .wpmdb .replace-add-row:after,body.mp6 .wpmdb .replace-add-row:before{background-color:#999}body.mp6 .wpmdb .replace-add-row:hover:after,body.mp6 .wpmdb .replace-add-row:hover:before{background-color:#666}body.mp6 .wpmdb .option-group.migrate-selection>li>label{font-size:16px}body.mp6 .wpmdb .saved-migration-profile-label{font-size:16px}body.mp6 .wpmdb .option-heading,body.mp6 .wpmdb .checkbox-label{font-size:16px}body.mp6 .wpmdb .checkbox-label input[type=checkbox]{top:auto}body.mp6 .wpmdb .return-to-profile-selection{font-size:14px}body.mp6 .wpmdb .option-description{font-size:13px}body.mp6 .wpmdb .save-migration-profile-wrap li{position:relative}body.mp6 .wpmdb .replace-remove-row,body.mp6 .wpmdb .delete-profile{border:0;border-radius:0;height:auto;width:auto;left:0;top:50%;margin-left:0}body.mp6 .wpmdb .replace-remove-row:after,body.mp6 .wpmdb .delete-profile:after{content:"\f153";display:inline-block;-webkit-font-smoothing:antialiased;font:normal 18px/1 'dashicons';vertical-align:middle;color:#999}body.mp6 .wpmdb .replace-remove-row:hover:after,body.mp6 .wpmdb .delete-profile:hover:after{color:#666}body.mp6 .wpmdb .delete-profile:after{color:#ccc}body.mp6 .wpmdb .delete-profile:hover:after{color:#aaa}body.mp6 .wpmdb .addons-tab .addons-content>div:nth-child(1),body.mp6 .wpmdb .addons-tab .addons-content>article:nth-child(1){margin-top:0px}body.mp6 .wpmdb .addons-tab .addon h1{font-family:'Open Sans', sans-serif;font-weight:200;font-size:24px;margin-top:2px}body.mp6 .wpmdb .addons-tab .addon.wp-migrate-db-pro-cli h1{margin-top:5px}body.mp6 .wpmdb .addons-tab .addon p{font-size:14px;line-height:1.4em}body.mp6 .wpmdb .help-tab .support p,body.mp6 .wpmdb .help-tab .support .email a{font-size:14px}body.mp6 .wpmdb .help-tab div.warning p{font-size:13px}body.mp6 .wpmdb .help-tab .videos h4,body.mp6 .wpmdb .help-tab .videos p{font-size:14px}body.mp6 .wpmdb .inline-message,body.mp6 .wpmdb .notification-message{border-radius:0;border:0;box-shadow:0 1px 1px 0 rgba(0,0,0,0.1);padding:10px 14px;font-size:13px}body.mp6 .wpmdb .notification-message{margin-bottom:20px;background-color:#fff}body.mp6 .wpmdb .notification-message.ssl-notice,body.mp6 .wpmdb .notification-message.invalid-licence{margin-bottom:0;margin-top:15px}body.mp6 .wpmdb .notification-message p{font-size:13px;margin-top:0}body.mp6 .wpmdb .notification-message p:last-child{margin:0}body.mp6 .wpmdb .notification-message h4{margin-top:0}body.mp6 .wpmdb .notification-message a{color:#0074a2;text-decoration:none}body.mp6 .wpmdb .notification-message a:hover{color:#2ea2cc}body.mp6 .wpmdb div.notification-message.invalid-licence p:last-child{margin:0.5em 0}body.mp6 .wpmdb div.notification-message.invalid-licence p:last-child a.button{color:#555555}body.mp6 .wpmdb .inline-message.error,body.mp6 .wpmdb .notification-message.error-notice{border-left:4px solid #dd3d36;background-color:#fff}body.mp6 .wpmdb .inline-message.warning,body.mp6 .wpmdb .notification-message.warning-notice{background-color:#fff;border-left:4px solid #ffba00}body.mp6 .wpmdb .inline-message.success,body.mp6 .wpmdb .notification-message.success-notice{border-left:4px solid #7ad03a}body.mp6 .wpmdb .ssl-notice{margin-bottom:0}body.mp6 .wpmdb .different-plugin-version-notice,body.mp6 .wpmdb .directory-permission-notice{margin-bottom:10px}body.mp6 .wpmdb .licence-status{color:#444;float:left;font-weight:normal}body.mp6 #overlay{background-color:rgba(0,0,0,0.5)}body.mp6 .migration-progress-ajax-spinner{top:20px}#overlay{background-color:rgba(255,255,255,0.9);position:fixed;top:0;left:0;width:100%;height:100%;z-index:100000;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-orient:horizontal;-webkit-box-direction:normal;-webkit-flex-direction:row;-ms-flex-direction:row;flex-direction:row;-webkit-box-align:start;-webkit-align-items:flex-start;-ms-flex-align:start;align-items:flex-start;-webkit-box-pack:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center;-webkit-transition:opacity .3s ease-out;transition:opacity .3s ease-out}#overlay.show{opacity:1;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex}#overlay.hide{opacity:0;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex}.stage-tabs{margin:0;z-index:5}.stage-tabs .stage-tab{box-sizing:border-box;display:block;float:left;width:auto;height:45px;margin:0 5px -1px 0;background-color:#ddd;border:1px solid #aaa;padding:.5em 1.5em 0;line-height:1.3;text-align:center;text-transform:capitalize;color:#333;-webkit-transition:background-color .2s ease-in-out;transition:background-color .2s ease-in-out}.stage-tabs .stage-tab.active{background-color:#fff;border-bottom-color:#fff}.stage-tabs .stage-status{display:block;font-size:.8em;font-style:italic}.cancelled .stage-tabs,.cancelled .migration-progress-stages,.wpmdb-error .stage-tabs,.wpmdb-error .migration-progress-stages{display:none}.complete .stage-tabs .stage-tab:not(.active){cursor:pointer}.complete .stage-tabs .stage-tab:not(.active):hover{background-color:#eee}.migration-progress-stages{position:relative;margin:0 -30px 0;background:#fff;border-top:1px solid #aaa;overflow-y:auto}.migration-progress-stages .migration-progress-stage-container{top:0;left:0;width:100%;padding:0}.migration-progress-stages .migration-progress-stage-container.queued,.migration-progress-stages .migration-progress-stage-container.complete{display:none}.migration-progress-stages .migration-progress-stage-container.active{display:block}.migration-progress-stages .stage-progress{position:absolute;left:30px;right:30px;top:0;text-transform:capitalize;padding:15px 0 0;height:65px;box-sizing:border-box;background:#fff;z-index:100}.migration-progress-stages .stage-progress .lowercase{text-transform:lowercase}.migration-progress-stages .stage-progress .tables-complete{margin-left:3em}.migration-progress-stages .stage-progress .progress-bar-wrapper{position:relative;height:10px;width:100%;background-color:#eee;margin:15px 0 10px}.migration-progress-stages .stage-progress .progress-bar{background-color:#406fa4}.migration-progress-stages .stage-progress .show-hide-tables{display:block;float:right;cursor:pointer}.migration-progress-stages .progress-items{position:relative;overflow-y:auto;padding:70px 30px 10px;z-index:0}.migration-progress-stages .item-progress{position:relative;background-color:#eee;overflow:hidden;margin:0 0 .8em 0}.migration-progress-stages .item-progress .dashicons-yes.dashicons{position:absolute;right:.3em;top:0.12em;z-index:20;background:#333;color:#85d937;width:.75em;height:.75em;border-radius:50%;text-indent:-.18em;line-height:.8;vertical-align:2em;font-size:2em;opacity:0;-webkit-transition:opacity .3s ease-in;transition:opacity .3s ease-in;-webkit-transition-delay:1s;transition-delay:1s}.migration-progress-stages .item-progress.complete .dashicons-yes{opacity:1}.migration-progress-stages .item-progress .progress-bar{background:#85d937}.migration-progress-stages .item-progress .item-info{margin:0;position:relative;padding:.25em 0 .25em 1em;font-size:1em;z-index:10}.migration-progress-stages .hide-tables .progress-items{height:0px !important;opacity:0}.migration-progress-stages .progress-bar{position:absolute;top:0;left:0;height:100%;-webkit-transition:width 1s ease-out;transition:width 1s ease-out;z-index:0}.progress-content:not(.complete) .migration-progress-stages .active .stage-progress .progress-bar-wrapper{background-image:-webkit-linear-gradient(135deg, rgba(255,255,255,0.35) 25%, rgba(0,0,0,0) 25%, rgba(0,0,0,0) 50%, rgba(255,255,255,0.35) 50%, rgba(255,255,255,0.35) 75%, rgba(0,0,0,0) 75%, rgba(0,0,0,0));background-image:linear-gradient(-45deg, rgba(255,255,255,0.35) 25%,rgba(0,0,0,0) 25%,rgba(0,0,0,0) 50%,rgba(255,255,255,0.35) 50%,rgba(255,255,255,0.35) 75%,rgba(0,0,0,0) 75%,rgba(0,0,0,0));background-size:20px 20px;-webkit-animation:progress-bg-anim 5s linear infinite;animation:progress-bg-anim 5s linear infinite}.progress-content:not(.complete) .migration-progress-stages .item-progress:first-child{background-image:-webkit-linear-gradient(135deg, rgba(255,255,255,0.3) 25%, rgba(0,0,0,0) 25%, rgba(0,0,0,0) 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) 75%, rgba(0,0,0,0) 75%, rgba(0,0,0,0));background-image:linear-gradient(-45deg, rgba(255,255,255,0.3) 25%,rgba(0,0,0,0) 25%,rgba(0,0,0,0) 50%,rgba(255,255,255,0.3) 50%,rgba(255,255,255,0.3) 75%,rgba(0,0,0,0) 75%,rgba(0,0,0,0));background-size:50px 50px;-webkit-animation:progress-bg-anim 2s linear infinite;animation:progress-bg-anim 2s linear infinite}@-webkit-keyframes progress-bg-anim{0%{background-position:0 0}100%{background-position:50px 50px}}@keyframes progress-bg-anim{0%{background-position:0 0}100%{background-position:50px 50px}}.clearfix:before,.clearfix:after{content:"";display:table}.clearfix:after{clear:both}.clearfix{zoom:1}.general-spinner{width:16px;height:16px}.migration-error{color:#a21b1b;display:block;max-height:400px;max-width:100%;overflow:auto;word-wrap:break-word}.migration-php-errors{display:none;margin:20px 0;overflow-y:scroll;height:180px}.progress-overlay-container{display:none;position:relative;background-color:#eee;padding:30px 30px 15px;box-shadow:0 0 10px rgba(0,0,0,0.5);cursor:default;font-size:14px;z-index:1;margin:0 10px;box-sizing:border-box;-webkit-box-orient:vertical;-webkit-box-direction:normal;-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column;max-height:95%;overflow-y:hidden;-webkit-transition:opacity .3s ease-out, -webkit-transform .5s ease-out;transition:opacity .3s ease-out, transform .5s ease-out;-webkit-box-flex:0;-webkit-flex:0 1 0%;-ms-flex:0 1 0%;flex:0 1 0%}.progress-overlay-container.show{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;opacity:1}.progress-overlay-container.hide{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;opacity:0;-webkit-transform:translateY(-100%);-ms-transform:translateY(-100%);transform:translateY(-100%)}.progress-overlay-container>div{-webkit-box-flex:1;-webkit-flex:1 0 auto;-ms-flex:1 0 auto;flex:1 0 auto}.progress-content{width:58%;-webkit-flex-basis:58%;-ms-flex-preferred-size:58%;flex-basis:58%;max-width:700px;min-width:500px}.progress-content .migration-progress-stages{-webkit-box-flex:100;-webkit-flex:100 1 auto;-ms-flex:100 1 auto;flex:100 1 auto}@media all and (-ms-high-contrast: none){.progress-content .migration-progress-stages{height:300px}}.progress-content .progress-title{margin-top:0;font-size:22px;font-family:'Open Sans', 'HelveticaNeue-Light', 'Helvetica Neue Light', 'Helvetica Neue', sans-serif;font-weight:normal;width:85%;line-height:1.3}.progress-content .progress-title .domain-label{white-space:nowrap}.progress-content .progress-title .dashicons{display:inline;vertical-align:middle;margin-left:-.15em;padding-right:.3em;font-size:42px}.progress-content .progress-info-wrapper{margin-bottom:10px}.progress-content .progress-text{clear:left;float:left;width:100%}.progress-content .timer{position:absolute;top:35px;right:55px}.progress-content .progress-tables{overflow:hidden;margin-bottom:2px;padding:0 0 20px 0}.progress-content .progress-tables-hover-boxes{position:absolute;top:0px;left:0px;display:block;width:100%}.progress-content .progress-chunk-hover{display:block;float:left;height:35px;position:relative;top:-5px;z-index:1}.progress-content .progress-chunk{box-sizing:border-box;float:left;display:block;height:6px;border-right:1px solid #ccc;border-bottom:1px solid #ccc;color:#999;position:relative;text-align:center}.progress-content .progress-chunk>span{padding:0px 3px;white-space:nowrap;text-overflow:ellipsis;margin-top:10px;display:inline-block}.progress-content .progress-label{padding:5px 10px;border:1px solid #ccc;border-radius:3px;background-color:#fff;font-family:Consolas, Monaco, monospace;font-size:12px;display:inline-block;top:-35px;position:absolute;opacity:0;-webkit-transition:opacity 200ms ease-in-out;transition:opacity 200ms ease-in-out}.progress-content .label-visible{opacity:1}.progress-content .progress-label:before{content:"";width:0;height:0;border-left:4px solid transparent;border-right:4px solid transparent;border-top:4px solid #ccc;display:block;position:absolute;bottom:-5px;left:50%;margin-left:-2px}.progress-content .progress-label:after{content:"";width:0;height:0;border-left:4px solid transparent;border-right:4px solid transparent;border-top:4px solid #fff;display:block;position:absolute;bottom:-4px;left:50%;margin-left:-2px}.progress-content .migration-progress-ajax-spinner{left:7px;position:relative;top:15px}.progress-content .close-progress-content{color:#999;cursor:pointer;font-family:"Times New Roman", serif;font-size:26px;font-weight:200;position:absolute;right:10px;top:5px;padding:5px;display:none}.progress-content .close-progress-content:hover{color:#666;border-color:#aaa}.progress-content .migration-controls{display:block;-webkit-transition:opacity .2s ease-out;transition:opacity .2s ease-out;padding-top:15px}.progress-content .migration-controls.hidden{opacity:0;pointer-events:none}.progress-content .migration-controls span{float:left;text-align:center;display:block}.progress-content .migration-controls span:first-child{margin-right:10px;width:71px}.progress-content .migration-controls .pause-before-finalize{display:none;float:right;margin-top:5px}.progress-content .pro-version{margin-top:45px;padding-top:40px;position:relative;border-top:1px solid #ccc}.progress-content .pro-version iframe{position:absolute;top:40px;right:0;display:block}.progress-content .pro-version-content{padding-right:460px;min-height:255px}.progress-content .pro-version-content h1{line-height:1em;margin-top:0;font-size:20px}.progress-content .pro-version-content ul{margin-left:24px}.progress-content .pro-version-content li{position:relative;font-size:14px;line-height:1.4em;margin-bottom:15px;max-width:580px}.progress-content .pro-version-content li:before{content:"\f147";display:inline-block;-webkit-font-smoothing:antialiased;font:normal 30px/1 'dashicons';position:absolute;top:-3px;left:-32px;vertical-align:top;font-family:'dashicons'}.progress-content .pro-version-content .pro-quote{margin:0 0 20px 0;max-width:570px}.progress-content .pro-version-content .pro-quote .dashicons-star-filled{font-size:16px;width:16px;height:16px;position:relative;top:2px}.progress-content .pro-version-content .pro-quote-author{font-style:italic;white-space:nowrap}.progress-content.wpmdb-error{outline:3px solid #dc3232}@media screen and (max-width: 1096px){.progress-content .pro-version iframe{position:relative;top:auto;right:auto}.progress-content .pro-version-content{min-height:0;padding:0 0 20px 0}}.migrate-tab>.pro-version{display:none}#overlay .pro-version{width:42%;padding-left:0;padding-right:0;-webkit-flex-basis:42%;-ms-flex-preferred-size:42%;flex-basis:42%;max-width:515px;min-width:400px;max-height:100%;-webkit-box-ordinal-group:3;-webkit-order:2;-ms-flex-order:2;order:2;font-size:14px;display:block;-webkit-transition:-webkit-transform .3s ease-out, opacity .3s ease-out, margin-left .2s .3s ease-in-out;transition:transform .3s ease-out, opacity .3s ease-out, margin-left .2s .3s ease-in-out}#overlay .pro-version.remove{margin-left:-525px !important}#overlay .pro-version .pro-version-content{padding:0 30px}#overlay .pro-version .pro-version-content h1{font-size:22px;font-weight:bold;margin:0 0 30px}#overlay .pro-version .pro-version-content li{margin-bottom:10px;padding-left:35px;position:relative}#overlay .pro-version .pro-version-content li .dashicons{display:block;position:absolute;font-size:2em;top:-3px;left:0}#overlay .pro-version .pro-version-content .pro-quote{border:1px solid #bbb;border-radius:3px;padding:15px 15px 15px 100px;margin:30px 0;position:relative;background:url("../img/mor10.png") no-repeat 15px 31px;background-size:51px 51px}@media (min--moz-device-pixel-ratio: 1.3), (-webkit-min-device-pixel-ratio: 1.3), (min-device-pixel-ratio: 1.3), (min-resolution: 1.3dppx){#overlay .pro-version .pro-version-content .pro-quote{background-image:url("../img/mor10@2x.png")}}#overlay .pro-version .pro-version-content .pro-quote p{margin:0;font-size:13px}#overlay .pro-version .pro-version-content .pro-quote .pro-quote-author{font-size:14px;font-weight:bold;color:#999;margin-bottom:5px}#overlay .pro-version .pro-version-content .pro-quote .pro-quote-author .dashicons{float:right;color:#999}#overlay .pro-version .pro-version-content .pro-quote .stars{position:absolute;bottom:0;left:0;width:100%;height:0;overflow:visible;text-align:center}#overlay .pro-version .pro-version-content .pro-quote .stars span{background:#eee;color:#999;margin-top:-.5em}#overlay .pro-version .pro-version-content .pro-quote .stars span:first-child{padding-left:.1em}#overlay .pro-version .pro-version-content .pro-quote .stars span:last-child{padding-right:.1em}#overlay .pro-version iframe,#overlay .pro-version .iframe{width:100%;height:289px;background:#000}#overlay .pro-version .button{display:block;position:relative;width:250px;margin:20px auto 10px;text-align:center}#overlay .pro-version .close-pro-version{color:#999;cursor:pointer;font-family:"Times New Roman", serif;font-size:26px;font-weight:200;position:absolute;right:10px;top:5px;padding:5px;display:block}#overlay .pro-version .close-pro-version:hover{color:#666;border-color:#aaa}
1
+ #wpmdb-main{width:742px;position:relative;min-height:950px}.wpmdb h2 ~ .error,.wpmdb h2 ~ .notice,.wpmdb h2 ~ .updated{clear:both}.wpmdb div.updated.warning{max-width:742px;box-sizing:border-box;margin:10px 0}.wpmdb div.updated.warning p{font-size:13px;margin:0.5em 0}.wpmdb a{text-decoration:none}.wpmdb li{margin-bottom:5px;position:relative}.wpmdb ul{margin:0}.wpmdb input[type=checkbox],.wpmdb input[type=radio]{margin-right:5px;vertical-align:baseline;margin-top:0}.wpmdb input[type=text],.wpmdb input[type=password]{padding:5px}.wpmdb input[disabled=disabled]{cursor:default}.wpmdb label.disabled{color:#888;cursor:default}.wpmdb .option-section{border-bottom:1px solid #ccc;padding-bottom:20px;margin-bottom:20px}.wpmdb .option-section h3{font-size:18px;font-weight:normal}.wpmdb p.migrate-db{overflow:hidden;min-height:29px}.wpmdb p.migrate-db input{float:left}.wpmdb p.migrate-db img{float:left;margin:3px 0 0 5px}.wpmdb p.migrate-db .save-settings-button{margin-left:10px;display:none}.wpmdb .indent-wrap{margin-left:24px}.wpmdb .expandable-content{display:none;margin-top:10px}.wpmdb .expandable-content li:last-child{margin-bottom:0px}.wpmdb .header-wrapper{margin-bottom:10px}.wpmdb .header-expand-collapse{cursor:pointer;display:inline-block}.wpmdb .option-description{font-size:12px;color:#999;margin-left:8px;font-weight:normal}.wpmdb .option-group li:last-child{margin-bottom:0}.wpmdb .connection-status{display:none;overflow:auto}.wpmdb .connection-status.error{color:#9D1818}.wpmdb .copy-licence-to-remote-site{display:inline-block}.wpmdb .ajax-spinner{left:6px;position:relative;top:3px}.wpmdb div.message{margin:15px 0 0}.wpmdb .licence-wrap h3{margin:0 0 10px 0}.wpmdb .licence-input{clear:both;display:block;font-family:Consolas, Monaco, monospace;font-size:14px;margin-bottom:7px;padding:10px;width:418px}.wpmdb .register-licence{float:left;outline:none}.wpmdb .licence-status{color:#A21B1B;font-weight:bold;clear:both;padding-top:0.5em;margin:0}.wpmdb .licence-status.success{color:#333}.wpmdb .register-licence-ajax-spinner{margin:4px 0 0 8px}.wpmdb .return-to-profile-selection{margin-bottom:15px;display:inline-block}.wpmdb .return-to-profile-selection.bottom{margin-top:10px}.wpmdb h2.nav-tab-wrapper{margin-top:10px;margin-bottom:20px;padding-left:5px}.wpmdb h2.nav-tab-wrapper a.nav-tab-active{color:#464646;cursor:default}.wpmdb label{display:inline-block;clear:both}.wpmdb .migration-profile-options li{position:relative;width:520px}.wpmdb .migration-profile-options li a{padding:5px 10px;width:500px;border:1px solid #ddd;margin:0px 0px 7px;display:block;font-size:14px;color:#333}.wpmdb .migration-profile-options li a:hover{border-color:#bbb}.wpmdb .main-list-delete-profile-link{color:#999999;font-size:26px;font-weight:200;position:absolute;right:7px;top:4px;cursor:pointer}.wpmdb .main-list-delete-profile-link:hover{color:#444}.wpmdb .crumbs{overflow:hidden;border-bottom:1px solid #ccc;padding:12px 0}.wpmdb .crumbs .crumb{position:relative;display:block;float:left;margin-right:4px;padding-right:3px;font-size:13px;font-weight:bold}.wpmdb .crumbs span.crumb{padding-left:25px}.wpmdb .crumbs span.crumb:before{content:"\f345";position:absolute;left:0;top:0;display:inline-block;-webkit-font-smoothing:antialiased;font:normal 18px/1 'dashicons';vertical-align:middle}.wpmdb .option-group li{margin-bottom:5px}.wpmdb .option-group>li{margin-bottom:8px}.wpmdb .option-group li>label{font-size:14px;font-weight:bold}.wpmdb .option-group ul{display:none;margin:10px 0px 10px 25px}.wpmdb .option-group ul label{font-size:12px;font-weight:normal}.wpmdb .option-heading,.wpmdb .checkbox-label{font-size:14px;font-weight:bold}.wpmdb .checkbox-label input[type=checkbox]{margin-right:7px;position:relative;top:-1px}.wpmdb .expand-collapse-arrow{margin-right:9px}.wpmdb .migrate-selection{padding-top:20px}.wpmdb .migrate-connection-info{min-width:675px;margin:0}.wpmdb .migrate-tab .pull-push-connection-info{width:418px;height:65px;color:#333;font-family:Consolas, Monaco, monospace;font-size:15px;line-height:21px;padding:10px}.wpmdb .basic-access-auth-wrapper{display:none;margin-bottom:5px}.wpmdb .auth-username,.wpmdb .auth-password{width:206px;margin-top:3px}.wpmdb .auth-password{width:207px}.wpmdb .connection-info-wrapper{display:none;width:670px}.wpmdb .connect-button{margin-top:2px}.wpmdb .temp-disabled{background-color:#EEEEEE;color:#888888;font-family:Consolas, Monaco, monospace;text-shadow:0 1px 0 #FFFFFF}.wpmdb .push-list ul{margin-bottom:0px}.wpmdb .find-heading,.wpmdb .replace-heading{float:left}.wpmdb .find-heading{width:400px}.wpmdb .replace-fields{border-collapse:collapse;border-spacing:0px}.wpmdb .replace-fields input{width:295px}.wpmdb .replace-fields tr td{padding-bottom:7px}.wpmdb .replace-fields tr:last-child td{padding-bottom:0px}.wpmdb .arrow-col{width:93px;text-align:center;vertical-align:middle}.wpmdb .right-arrow{font-size:36px;color:#aaa}.wpmdb .replace-right-col span{border-radius:50%;border:1px solid #ccc;background-color:#eee;width:16px;height:16px;display:inline-block;position:relative;top:4px;cursor:pointer}.wpmdb .replace-right-col span:hover{border-color:#aaa}.wpmdb .pin .sort-handle-col{opacity:0.5;cursor:default}.wpmdb .pin .sort-handle{cursor:default !important}.wpmdb .sort-handle-col{width:20px;cursor:-moz-grab}.wpmdb .sort-handle:before{content:"\f214";display:inline-block;-webkit-font-smoothing:antialiased;font:normal 20px/1 'dashicons';vertical-align:top;color:#aaa;background-color:transparent !important;margin-right:4px}.wpmdb .original-repeatable-field{display:none}.wpmdb .no-replaces-message{display:none;margin-bottom:0px}.wpmdb .inline-message.missing-replace{margin-top:15px;display:none}.wpmdb #new-path-missing-warning{margin-top:5px}.wpmdb .tables-header{display:inline-block}.wpmdb .expand-collapse-arrow{display:inline-block;position:relative;top:-2px;font-size:11px}.wpmdb .collapsed{-webkit-transform:scale(1) rotate(-90deg) translateX(0px) translateY(0px) skewX(0deg) skewY(0deg);transform:scale(1) rotate(-90deg) translateX(0px) translateY(0px) skewX(0deg) skewY(0deg)}.wpmdb .select-deselect-divider{margin:0 6px}.wpmdb .select-wrap{display:none;margin-top:12px}.wpmdb .select-post-types-wrap{display:block}.wpmdb .exclude-post-types-warning{font-size:13px;font-weight:bold;color:#9c1f1f}.wpmdb .exclude-post-types-warning p{margin:0 0 12px 0}.wpmdb .multiselect{min-width:550px;min-height:180px;margin-bottom:10px}.wpmdb .table-migrate-options li label{font-size:12px;font-weight:normal}.wpmdb .table-migrate-options li{margin-bottom:5px}.wpmdb .general-helper{border-radius:50%;border:1px solid #ccc;background-color:#eee;width:15px;height:15px;display:inline-block;position:relative;top:4px;margin-top:-4px;cursor:pointer;margin-left:2px}.wpmdb .general-helper:hover{border-color:#aaa}.wpmdb .general-helper:after{content:"?";color:#999999;font-size:10px;font-weight:bold;left:4px;position:absolute;top:-1px}.wpmdb .helper-message{padding:10px 16px;border-radius:3px;background-color:#fff;position:absolute;width:500px;z-index:9999;display:none;box-shadow:0px 0px 10px rgba(0,0,0,0.2)}.wpmdb .inline-message{padding:10px;border-radius:3px;margin-top:5px}.wpmdb .inline-message.error{border:1px solid #CC0000;background-color:#FFEBE8}.wpmdb .inline-message.warning{background-color:#FFFFE0;border:1px solid #E6DB55}.wpmdb .helper-message:after{content:'';border-bottom:8px solid transparent;border-right:8px solid #fff;border-top:8px solid transparent;display:block;height:0;left:-7px;position:absolute;top:11px;width:0}.wpmdb .helper-message.bottom:before{content:'';border-left:8px solid transparent;border-right:8px solid transparent;border-bottom:8px solid #aaa;border-top:0;display:block;height:0;left:50%;margin-left:-8px;position:absolute;top:-9px;width:0}.wpmdb .helper-message.bottom:after{content:'';border-left:8px solid transparent;border-right:8px solid transparent;border-bottom:8px solid #fff;border-top:0;display:block;height:0;left:50%;margin-left:-8px;position:absolute;top:-8px;width:0}.wpmdb .label-disabled{color:#888}.wpmdb .prefix-notice,.wpmdb .ssl-notice,.wpmdb .different-plugin-version-notice,.wpmdb .directory-permission-notice{background-color:#FFFFE0;border:1px solid #E6DB55;padding:15px;border-radius:3px;margin-bottom:15px;display:none}.wpmdb .prefix-notice p,.wpmdb .ssl-notice p,.wpmdb .different-plugin-version-notice p,.wpmdb .directory-permission-notice p{margin-top:0px}.wpmdb .prefix-notice p:last-child,.wpmdb .ssl-notice p:last-child,.wpmdb .different-plugin-version-notice p:last-child,.wpmdb .directory-permission-notice p:last-child{margin:0px}.wpmdb .different-plugin-version-notice,.wpmdb .directory-permission-notice{background-color:#FFEBE8;border-color:#CC0000}.wpmdb .different-plugin-version-notice a,.wpmdb .directory-permission-notice a{color:#CC0000;text-decoration:underline}.wpmdb .mixed-case-table-name-notice{display:none}.wpmdb .save-migration-profile-wrap li label{font-size:12px;font-weight:normal}.wpmdb .save-migration-profile-wrap li{margin-bottom:5px;padding-left:25px}.wpmdb .save-migration-profile-wrap .indent-wrap{margin-left:0px}.wpmdb .create-new-label{margin-right:8px}.wpmdb .create-new-profile{position:absolute;top:-5px}.wpmdb .replace-remove-row,.wpmdb .delete-profile{background-color:#eee;border:1px solid #ccc;border-radius:50% 50% 50% 50%;cursor:pointer;height:11px;left:5px;margin-left:2px;position:absolute;margin-top:-6px;top:50%;width:11px;display:block;background-position:50% 50%;background-size:6px 6px;background-repeat:no-repeat}.wpmdb .replace-remove-row:after,.wpmdb .delete-profile:after{content:"\00d7";left:2px;position:absolute;top:-3px;color:#aaa;font-size:12px}.wpmdb .replace-remove-row:after{position:relative}.wpmdb .replace-remove-row:hover,.wpmdb .delete-profile:hover{border-color:#aaa}.wpmdb .ajax-success-msg{font-weight:bold;margin-left:9px;position:absolute;display:inline-block}.wpmdb .migrate-db .ajax-success-msg{margin-top:3px}.wpmdb p img.save-profile-ajax-spinner{margin:6px 0 0 10px}.wpmdb .backup-description{left:20px;position:relative}.wpmdb .backup-option-disabled{margin-bottom:0px !important}.wpmdb .settings-tab{display:none}.wpmdb .settings-tab .slider{max-width:416px}.wpmdb .settings-tab .slider-label{display:block;margin-bottom:10px;float:left;width:50%}.wpmdb .settings-tab .slider-label-wrapper{max-width:416px;width:100%;position:relative}.wpmdb .settings-tab .amount{width:50%;text-align:right;display:block;float:left}.wpmdb .settings-tab .slider-spinner{position:absolute;right:-35px;bottom:-13px}.wpmdb .settings-tab .slider-success-msg{right:-63px;bottom:-14px;position:absolute;font-weight:bold}.wpmdb .settings-tab .ui-slider{border:2px solid #fff;height:10px;border-radius:2px;position:relative}.wpmdb .settings-tab .ui-slider-handle{width:20px;height:20px;background-color:#ade7b5;border:2px solid #fff;border-radius:50%;display:block;position:absolute;top:-7px;outline:none;margin-left:-11px}.wpmdb .settings-tab .ui-slider-handle:active{background-color:#86db91;border-color:#eee}.wpmdb .settings-tab .ui-slider-range{background-color:#eee;height:100%}.wpmdb .settings-tab .form-table{margin-top:0}.wpmdb .settings-tab .form-table h3,.wpmdb .settings-tab .form-table h4,.wpmdb .settings-tab .form-table p{margin:0;line-height:1.2}.wpmdb .settings-tab .form-table h3{font-weight:normal}.wpmdb .settings-tab .form-table h4{font-size:15px}.wpmdb .settings-tab .form-table h4 .helper-message{font-weight:normal}.wpmdb .settings-tab .form-table h4 img.ajax-spinner{position:absolute;float:left;top:auto;left:auto;margin-top:1px}.wpmdb .settings-tab .form-table h4 .setting-status .ajax-success-msg{margin-left:6px}.wpmdb .settings-tab .form-table tr td{padding:10px 0}.wpmdb .settings-tab .form-table tr.wpmdb-setting-title td{padding-bottom:0}.wpmdb .settings-tab .form-table tr.wpmdb-setting-title td h3{margin:10px 0}.wpmdb .settings-tab .form-table tr:first-child td{padding-top:0}.wpmdb .settings-tab .form-table tr:first-child td h3{margin-top:0}.wpmdb .settings-tab .form-table tr td:first-child{vertical-align:top;min-width:100px}.wpmdb .settings-tab .form-table tr.option-section label{font-weight:normal;position:relative}.wpmdb .settings-tab .form-table tr.option-section li{margin-bottom:5px}.wpmdb .settings-tab .form-table tr.option-section li:last-child{margin-bottom:0px}.wpmdb .settings-tab .form-table tr.option-section.allow-remote-requests-wrap .ajax-spinner,.wpmdb .settings-tab .form-table tr.option-section.plugin-compatibility-section .ajax-spinner{right:-23px;left:inherit;top:0px;position:absolute}.wpmdb .settings-tab .form-table tr.option-section .bubble .ajax-spinner{right:-45px}.wpmdb .settings-tab .form-table tr.option-section .bubble .ajax-success-msg{right:-65px}.wpmdb .settings-tab .form-table tr.option-section td{padding-bottom:20px}.wpmdb .settings-tab .form-table tr.licence-wrap td{padding-top:0}.wpmdb .settings-tab .form-table tr.licence-wrap td .notification-message{margin:10px 0 0 0}.wpmdb .settings-tab .form-table tr.licence-wrap td #welcome-wrap{height:170px;padding-top:20px;box-shadow:0 1px 1px 0 rgba(0,0,0,0.1);clear:both}.wpmdb .settings-tab .form-table tr.licence-wrap td #welcome-wrap #welcome-img{width:170px;height:170px;float:left}.wpmdb .settings-tab .form-table tr.licence-wrap td #welcome-wrap .welcome-text{height:130px;padding:20px 25px 20px 195px;background:#fff}.wpmdb .settings-tab .form-table tr.licence-wrap td #welcome-wrap .welcome-text h3{font-weight:lighter;font-size:22px;margin-bottom:10px}.wpmdb .settings-tab .form-table tr.licence-wrap td #welcome-wrap .welcome-text p{font-size:15px;line-height:1.5}.wpmdb .settings-tab .form-table tr.licence-wrap td #welcome-wrap .welcome-text a{font-weight:bold}.wpmdb .settings-tab .form-table tr.plugin-compatibility-section td{padding-top:0}.wpmdb .settings-tab .form-table .general-helper:after{top:-1px;font-size:22px;height:20px}.wpmdb .settings-tab .setting-status{padding-left:6px}.wpmdb .settings-tab .slider-label span{font-weight:bold}.wpmdb .allow-remote-reqeusts{font-size:14px;font-weight:bold}.wpmdb .connection-info-label{margin-top:15px;margin-bottom:5px;display:block}.wpmdb .connection-info{clear:both;font-size:15px;line-height:21px;font-family:Consolas, Monaco, monospace;padding:10px 10px;height:67px;text-shadow:0px 1px 0px #fff;display:block;margin-bottom:7px;width:418px}.wpmdb .reset-button-wrap{width:418px}.wpmdb .reset-button-wrap .button{float:left;position:relative}.wpmdb .reset-button-wrap .button:first-of-type{margin-right:10px}.wpmdb .reset-button-wrap .button.copy-api-key .copy-api-key-confirmation{display:none;left:0;position:absolute;text-align:center;top:0;height:100%;width:100%;color:#333}.wpmdb .reset-button-wrap .reset-api-key-ajax-spinner{float:left;margin:4px 7px}.wpmdb .masked-licence{margin-top:0px}.wpmdb .bull{font-size:22px;position:relative;top:4px}.wpmdb .plugin-compatibility-wrap{padding:18px 18px 18px 100px;background-color:#e6e6e6;margin-left:0}.wpmdb .plugin-compatibility-wrap p:last-of-type{margin:10px 0 0 0}.wpmdb ul.plugin-compatibility-options{display:block;margin:10px 0 10px 0px}.wpmdb .plugin-compatibility-spinner{position:relative;top:3px;left:10px}.wpmdb .plugin-compatibility-success-msg{position:relative;left:10px;font-weight:bold}.wpmdb .wpmdb-switch{position:relative;display:inline-block;padding:2px;overflow:hidden;border-radius:2px;background-color:#d4d3d3;cursor:pointer}.wpmdb .wpmdb-switch.on{background-color:#ade7b5}.wpmdb .wpmdb-switch span{visibility:hidden;box-sizing:border-box;float:left;display:inline-block;height:100%;font-size:12px;line-height:20px;border-radius:2px;-webkit-border-radius:2px;font-weight:bold;padding:4px 8px;background:#fff;color:#8d8d8d;z-index:1}.wpmdb .wpmdb-switch span.on{color:#82d78b}.wpmdb .wpmdb-switch span.checked{visibility:visible}.wpmdb .wpmdb-switch.disabled{cursor:default;background:#e6e6e6}.wpmdb .wpmdb-switch.disabled span{background:#f1f1f1;color:#d6d6d6}.wpmdb .wpmdb-switch input[type="checkbox"]{position:absolute !important;top:0;left:0;opacity:0;z-index:-1}.wpmdb .help-tab{display:none}.wpmdb .help-tab h3{font-size:18px;font-weight:normal}.wpmdb .help-tab .support{border-bottom:1px solid #ccc;margin-bottom:25px;padding-bottom:18px}.wpmdb .help-tab .support p{width:640px}.wpmdb .help-tab .support .email a{font-size:12px}.wpmdb .help-tab .support .upgrade-to-pro{font-size:16px;font-weight:bold}.wpmdb .help-tab .support .upgrade-to-pro a{white-space:nowrap}.wpmdb .help-tab .support .ajax-spinner{top:2px}.wpmdb .help-tab .debug .ajax-spinner{top:6px}.wpmdb .help-tab .debug .ajax-success-msg{margin-top:5px}.wpmdb .help-tab .video-viewer{margin-bottom:30px;border:1px solid #ccc}.wpmdb .help-tab .videos{width:640px}.wpmdb .help-tab .videos ul>li{margin-bottom:30px;overflow:hidden;position:relative}.wpmdb .help-tab .videos ul>li a{overflow:hidden;display:block;width:320px;height:180px;float:left;margin-right:15px;position:relative;z-index:1;border:1px solid #ccc}.wpmdb .help-tab .videos ul>li a:before,.wpmdb .help-tab .videos ul>li a:after{position:absolute;content:" ";margin:auto;left:0;right:0;top:0;bottom:0}.wpmdb .help-tab .videos ul>li a:before{width:64px;height:64px;border-radius:64px;filter:progid:DXImageTransform.Microsoft.Alpha(Opacity=80);opacity:.8;border:1px solid #ddd;background-color:#fff;z-index:2}.wpmdb .help-tab .videos ul>li a:after{filter:progid:DXImageTransform.Microsoft.Alpha(Opacity=80);opacity:.8;border:21.33333px solid transparent;border-top-width:12.8px;border-bottom-width:12.8px;border-left-color:#333;background:transparent;display:block;left:25px;width:0px;height:0px;z-index:3}.wpmdb .help-tab .videos .video:last-child{margin-bottom:0px}.wpmdb .help-tab .videos img{width:320px;height:240px;position:relative;top:50%;margin-top:-120px}.wpmdb .help-tab .debug{width:640px;border-bottom:1px solid #CCCCCC;margin-bottom:25px;padding-bottom:28px}.wpmdb .help-tab .debug textarea{width:100%;min-height:200px;font-family:Consolas, Monaco, monospace;margin-bottom:5px}.wpmdb .help-tab h4{margin:0 0 0.2em 0}.wpmdb .help-tab p{margin:0 0 0.5em 0}.wpmdb .help-tab iframe{display:none}.wpmdb .addons-tab{display:none}.wpmdb .addons-tab .addon{position:relative;width:100%;min-height:138px;padding:25px 30px 30px 165px;box-sizing:border-box;color:#fff;margin-top:15px}.wpmdb .addons-tab .addon .actions{float:right;font-size:14px}.wpmdb .addons-tab .addon .actions>*{margin-right:10px}.wpmdb .addons-tab .addon .actions *:last-child{margin-right:0}.wpmdb .addons-tab .addon .actions .action{background-color:#fff;font-weight:bold;display:inline-block;padding:0.2em 0.4em}.wpmdb .addons-tab .addon .actions .action:hover{background-color:rgba(255,255,255,0.92)}.wpmdb .addons-tab .addon .actions .status{border-bottom:2px solid #fff;padding-bottom:0.1em}.wpmdb .addons-tab .addon h1{font-weight:normal;float:left;margin:0;margin-top:5px;color:#fff}.wpmdb .addons-tab .addon p{font-size:16px;line-height:1.2em;clear:both;margin:0}.wpmdb .addons-tab .addon p a{text-decoration:underline;color:#fff}.wpmdb .addons-tab .addon p a:hover{color:rgba(255,255,255,0.9)}.wpmdb .addons-tab .addon.wp-migrate-db-pro-media-files{background:#3fab3f url(../img/icon-media-files.svg) no-repeat 30px 30px;background-size:110px 85px}.wpmdb .addons-tab .addon.wp-migrate-db-pro-media-files .action{color:#3fab3f}.wpmdb .addons-tab .addon.wp-migrate-db-pro-cli{background:#272822 url(../img/icon-cli.svg) no-repeat 30px 30px;background-size:110px 97px;min-height:157px;color:#ddd}.wpmdb .addons-tab .addon.wp-migrate-db-pro-cli .action{color:#272822;background-color:#ddd}.wpmdb .addons-tab .addon.wp-migrate-db-pro-cli .action:hover{color:#272822;background-color:#eee}.wpmdb .addons-tab .addon.wp-migrate-db-pro-cli .status{border-bottom-color:#ddd}.wpmdb .addons-tab .addon.wp-migrate-db-pro-cli p a{color:#ddd}.wpmdb .addons-tab .addon.wp-migrate-db-pro-cli p a:hover{color:#f7f7f7}.wpmdb .addons-tab .addon.wp-migrate-db-pro-cli code{white-space:nowrap;margin:0;padding:0}.wpmdb .addons-tab .addon.wp-migrate-db-pro-multisite-tools{background:#a90000 url(../img/icon-multisite-tools.svg) no-repeat 30px 20px;background-size:110px 118px;min-height:157px}.wpmdb .addons-tab .addon.wp-migrate-db-pro-multisite-tools .action{color:#a90000}.wpmdb-not-pro .wpmdb .wpmdb-main{margin-top:15px}.wpmdb-not-pro .wpmdb .help-tab .support p{width:auto}#wpmdb-sidebar{position:absolute;top:-21px;right:-312px;width:292px}#wpmdb-sidebar .block{padding:20px;border:1px solid #ccc}#wpmdb-sidebar .subscribe{border-top:none}#wpmdb-sidebar .subscribe h2{padding:0;margin:0;margin-bottom:0.5em;color:#666;font-size:20px;line-height:1.2em;float:none}#wpmdb-sidebar .subscribe h3{font-size:16px;margin:0}#wpmdb-sidebar .subscribe p{margin:0}#wpmdb-sidebar .subscribe p.interesting{margin-bottom:1em;line-height:1.4}#wpmdb-sidebar .subscribe .links{margin-bottom:2em}#wpmdb-sidebar .subscribe .links a{text-decoration:none}#wpmdb-sidebar .subscribe .promise{color:#999;font-size:12px;line-height:1.4em}#wpmdb-sidebar .subscribe .field{margin-bottom:0.5em}#wpmdb-sidebar .subscribe .field p{margin-bottom:0.3em}#wpmdb-sidebar .subscribe .field.submit-button{margin-bottom:1em}#wpmdb-sidebar .testimonial{border-top:none}#wpmdb-sidebar .testimonial p{margin:0}#wpmdb-sidebar .testimonial .quote{font-size:20px}#wpmdb-sidebar .testimonial .author{white-space:nowrap;text-align:right}#wpmdb-sidebar .testimonial .stars{white-space:nowrap;margin-bottom:5px}#wpmdb-sidebar .testimonial .via{text-align:right;font-size:12px}#wpmdb-sidebar .testimonial .via a{color:#666}#wpmdb-sidebar .testimonial .via a:before{content:"\f301";display:inline-block;-webkit-font-smoothing:antialiased;font:normal 18px/1 'dashicons';vertical-align:top;margin-right:3px}@media (min--moz-device-pixel-ratio: 1.3), (-webkit-min-device-pixel-ratio: 1.3), (min-device-pixel-ratio: 1.3), (min-resolution: 1.3dppx){#wpmdb-sidebar .wpmdb-banner{background-image:url(../img/wp-migrate-db-pro@2x.jpg);background-size:292px 292px;width:292px;height:292px;display:block}#wpmdb-sidebar .wpmdb-banner img{display:none}}@media screen and (max-width: 1252px){#wpmdb-sidebar{position:relative;top:auto;right:auto;margin-top:50px}}body.mp6 input[type=checkbox]:disabled{opacity:1;border-color:#ccc}body.mp6 #wpmdb-main{font-size:14px}body.mp6 p{font-size:14px}body.mp6 .wrap>h1{float:left}body.mp6 .wrap h2{float:left}body.mp6 .wpmdb .content-tab{padding-top:15px}body.mp6 .wpmdb .migrate-tab{padding-top:0}body.mp6 .wpmdb input[type=checkbox],body.mp6 .wpmdb input[type=radio]{vertical-align:middle;margin-top:-4px}body.mp6 .wpmdb input[type=text],body.mp6 .wpmdb input[type=password]{padding:3px 5px}body.mp6 .wpmdb input.code{padding-top:6px}body.mp6 .wpmdb label{font-size:14px}body.mp6 .wpmdb h2.nav-tab-wrapper{float:none;margin-bottom:0;width:722px;font-size:23px;line-height:29px;padding:9px 0 0 5px}body.mp6 .wpmdb .help-tab h3{margin-top:0}body.mp6 .wpmdb .temp-disabled{background-color:#f9f9f9}body.mp6 .wpmdb .migration-profile-options li a{border-color:#ccc;color:#555;background-color:#e4e4e4}body.mp6 .wpmdb .migration-profile-options li a:hover{background-color:#fff;color:#464646}body.mp6 .wpmdb .settings-tab .slider-label span{vertical-align:middle}body.mp6 .wpmdb .settings-tab .slider-label-wrapper{font-size:14px}body.mp6 .wpmdb .settings-tab .ui-slider{border-color:#fff;background-color:#fff}body.mp6 .wpmdb .settings-tab .ui-slider-range{background-color:#ade7b5}body.mp6 .wpmdb .settings-tab .option-section li label{font-size:14px}body.mp6 .wpmdb .connection-info,body.mp6 .wpmdb .migrate-tab .pull-push-connection-info{font-weight:bold;font-size:14px}body.mp6 .wpmdb .general-helper{border:0;width:auto;height:auto;top:auto;margin:0}body.mp6 .wpmdb .general-helper:after{content:"\f223";display:inline-block;-webkit-font-smoothing:antialiased;font:normal 22px/1 'dashicons';vertical-align:top;top:auto;left:auto;position:relative}body.mp6 .wpmdb .helper-message{font-size:14px;line-height:1.4em}body.mp6 .wpmdb .right-arrow{display:none}body.mp6 .wpmdb .arrow-col{width:52px}body.mp6 .wpmdb .arrow-col:after{content:"\f344";display:inline-block;-webkit-font-smoothing:antialiased;font:normal 22px/1 'dashicons';vertical-align:top;color:#999}body.mp6 .wpmdb .arrow-col:hover{cursor:pointer}body.mp6 .wpmdb .arrow-col:hover:after{color:#666}body.mp6 .wpmdb .arrow-col.disabled:after{opacity:0.5}body.mp6 .wpmdb .arrow-col.disabled:hover{cursor:default}body.mp6 .wpmdb .arrow-col.disabled:hover:after{color:#999}body.mp6 .wpmdb .find-heading{width:409px}body.mp6 .wpmdb .replace-fields input{width:304px}body.mp6 .wpmdb .replace-right-col span{border-color:#999}body.mp6 .wpmdb .replace-right-col span:hover{border-color:#666}body.mp6 .wpmdb .replace-add-row:after,body.mp6 .wpmdb .replace-add-row:before{background-color:#999}body.mp6 .wpmdb .replace-add-row:hover:after,body.mp6 .wpmdb .replace-add-row:hover:before{background-color:#666}body.mp6 .wpmdb .option-group.migrate-selection>li>label{font-size:16px}body.mp6 .wpmdb .saved-migration-profile-label{font-size:16px}body.mp6 .wpmdb .option-heading,body.mp6 .wpmdb .checkbox-label{font-size:16px}body.mp6 .wpmdb .checkbox-label input[type=checkbox]{top:auto}body.mp6 .wpmdb .return-to-profile-selection{font-size:14px}body.mp6 .wpmdb .option-description{font-size:13px}body.mp6 .wpmdb .save-migration-profile-wrap li{position:relative}body.mp6 .wpmdb .replace-remove-row,body.mp6 .wpmdb .delete-profile{border:0;border-radius:0;height:auto;width:auto;left:0;top:50%;margin-left:0}body.mp6 .wpmdb .replace-remove-row:after,body.mp6 .wpmdb .delete-profile:after{content:"\f153";display:inline-block;-webkit-font-smoothing:antialiased;font:normal 18px/1 'dashicons';vertical-align:middle;color:#999}body.mp6 .wpmdb .replace-remove-row:hover:after,body.mp6 .wpmdb .delete-profile:hover:after{color:#666}body.mp6 .wpmdb .row-action-buttons{position:relative;width:60px}body.mp6 .wpmdb .row-action-buttons .helper-message{width:320px}body.mp6 .wpmdb .row-action-buttons .replace-remove-row{margin-left:4px;border:0;border-radius:50%;height:22px;width:auto;left:0;top:0;display:block;float:left;position:relative;margin-top:0}body.mp6 .wpmdb .row-action-buttons .replace-remove-row:after{display:inline-block;vertical-align:top;top:auto;position:relative;left:auto;height:22px;line-height:22px}body.mp6 .wpmdb .row-action-buttons .general-helper{display:inline-block;position:static;margin-left:4px}body.mp6 .wpmdb .row-action-buttons .general-helper:first-child{margin-left:2px}body.mp6 .wpmdb .row-action-buttons .general-helper:after{display:inline-block;vertical-align:top;top:auto;left:auto;position:relative}body.mp6 .wpmdb .delete-profile:after{color:#ccc}body.mp6 .wpmdb .delete-profile:hover:after{color:#aaa}body.mp6 .wpmdb .addons-tab .addons-content>div:nth-child(1),body.mp6 .wpmdb .addons-tab .addons-content>article:nth-child(1){margin-top:0px}body.mp6 .wpmdb .addons-tab .addon h1{font-weight:300;font-size:25px;margin-top:2px}body.mp6 .wpmdb .addons-tab .addon.wp-migrate-db-pro-cli h1{margin-top:5px}body.mp6 .wpmdb .addons-tab .addon p{font-size:14px;line-height:1.4em}body.mp6 .wpmdb .help-tab .support p,body.mp6 .wpmdb .help-tab .support .email a{font-size:14px}body.mp6 .wpmdb .help-tab div.warning p{font-size:13px}body.mp6 .wpmdb .help-tab .videos h4,body.mp6 .wpmdb .help-tab .videos p{font-size:14px}body.mp6 .wpmdb .inline-message,body.mp6 .wpmdb .notification-message{border-radius:0;border:0;box-shadow:0 1px 1px 0 rgba(0,0,0,0.1);padding:10px 14px;font-size:13px}body.mp6 .wpmdb .notification-message{margin-bottom:20px;background-color:#fff}body.mp6 .wpmdb .notification-message.ssl-notice,body.mp6 .wpmdb .notification-message.invalid-licence{margin-bottom:0;margin-top:15px}body.mp6 .wpmdb .notification-message p{font-size:13px;margin-top:0}body.mp6 .wpmdb .notification-message p:last-child{margin:0}body.mp6 .wpmdb .notification-message h4{margin-top:0}body.mp6 .wpmdb .notification-message a{color:#0074a2;text-decoration:none}body.mp6 .wpmdb .notification-message a:hover{color:#2ea2cc}body.mp6 .wpmdb div.notification-message.invalid-licence p:last-child{margin:0.5em 0}body.mp6 .wpmdb div.notification-message.invalid-licence p:last-child a.button{color:#555555}body.mp6 .wpmdb .inline-message.error,body.mp6 .wpmdb .notification-message.error-notice{border-left:4px solid #dd3d36;background-color:#fff}body.mp6 .wpmdb .inline-message.warning,body.mp6 .wpmdb .notification-message.warning-notice{background-color:#fff;border-left:4px solid #ffba00}body.mp6 .wpmdb .inline-message.success,body.mp6 .wpmdb .notification-message.success-notice{border-left:4px solid #7ad03a}body.mp6 .wpmdb .ssl-notice{margin-bottom:0}body.mp6 .wpmdb .different-plugin-version-notice,body.mp6 .wpmdb .directory-permission-notice{margin-bottom:10px}body.mp6 .wpmdb .licence-status{color:#444;float:left;font-weight:normal}body.mp6 #overlay{background-color:rgba(0,0,0,0.5)}body.mp6 .migration-progress-ajax-spinner{top:20px}#overlay{background-color:rgba(255,255,255,0.9);position:fixed;top:0;left:0;width:100%;height:100%;z-index:100000;overflow-x:auto;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-orient:horizontal;-webkit-box-direction:normal;-ms-flex-direction:row;flex-direction:row;-webkit-box-align:start;-ms-flex-align:start;align-items:flex-start;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;-webkit-transition:opacity .3s ease-out;transition:opacity .3s ease-out}#overlay.show{opacity:1;display:-webkit-box;display:-ms-flexbox;display:flex}@media screen and (max-width: 700px){#overlay.show{-webkit-box-pack:start;-ms-flex-pack:start;justify-content:flex-start}}#overlay.hide{opacity:0;display:-webkit-box;display:-ms-flexbox;display:flex}@media screen and (max-width: 1120px){.wpmdb-not-pro #overlay.show{-webkit-box-pack:start;-ms-flex-pack:start;justify-content:flex-start}}.stage-tabs{margin:0;z-index:5}.stage-tabs .stage-tab{box-sizing:border-box;display:block;float:left;width:auto;height:45px;margin:0 5px -1px 0;background-color:#ddd;border:1px solid #aaa;padding:.5em 1.5em 0;line-height:1.3;text-align:center;text-transform:capitalize;color:#333;-webkit-transition:background-color .2s ease-in-out;transition:background-color .2s ease-in-out}.stage-tabs .stage-tab.active{background-color:#fff;border-bottom-color:#fff}.stage-tabs .stage-status{display:block;font-size:.8em;font-style:italic}.complete .stage-tabs .stage-tab:not(.active){cursor:pointer}.complete .stage-tabs .stage-tab:not(.active):hover{background-color:#eee}.migration-progress-stages{position:relative;margin:0 -30px 0;background:#fff;overflow-y:auto}.migration-progress-stages .migration-progress-stage-container{top:0;left:0;width:100%;padding:0}.migration-progress-stages .migration-progress-stage-container.queued,.migration-progress-stages .migration-progress-stage-container.complete{display:none}.migration-progress-stages .migration-progress-stage-container.active{display:block}.migration-progress-stages .truncation-notice{margin:-10px 30px 10px;padding:5px 10px;color:#999;text-align:center}.migration-progress-stages .hide-tables .truncation-notice{display:none}.migration-progress-stages .progress-items{position:relative;overflow-y:auto;padding:10px 30px 10px;z-index:0}.migration-progress-stages .item-progress{position:relative;background-color:#eee;overflow:hidden;margin:0 0 .8em 0;-webkit-transition:height .2s ease-in-out, margin .2s ease-in-out;transition:height .2s ease-in-out, margin .2s ease-in-out}.migration-progress-stages .item-progress .dashicons-yes.dashicons{position:absolute;right:.3em;top:0.12em;z-index:20;background:#333;color:#85d937;width:.75em;height:.75em;border-radius:50%;text-indent:-.18em;line-height:.8;vertical-align:2em;font-size:2em;opacity:0;-webkit-transition:opacity .3s ease-in;transition:opacity .3s ease-in;-webkit-transition-delay:.5s;transition-delay:.5s}.migration-progress-stages .item-progress.complete .dashicons-yes{opacity:1}.migration-progress-stages .item-progress .progress-bar{background:#85d937}.migration-progress-stages .item-progress .item-info{margin:0;position:relative;padding:.25em 0 .25em 1em;font-size:1em;z-index:10}.migration-progress-stages .hide-tables .progress-items{height:0px !important;opacity:0}@-webkit-keyframes progress-bg-anim{0%{background-position:0 0}100%{background-position:50px 50px}}@keyframes progress-bg-anim{0%{background-position:0 0}100%{background-position:50px 50px}}.clearfix:before,.clearfix:after{content:"";display:table}.clearfix:after{clear:both}.clearfix{zoom:1}.general-spinner{width:16px;height:16px}.migration-error{color:#a21b1b;display:block;max-height:400px;max-width:100%;overflow:auto;word-wrap:break-word}.migration-php-errors{display:none;margin:20px 0;overflow-y:scroll;height:180px}.progress-overlay-container{display:none;position:relative;background-color:#eee;padding:30px 30px 15px;box-shadow:0 0 10px rgba(0,0,0,0.5);cursor:default;font-size:14px;z-index:1;margin:0 10px;box-sizing:border-box;-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column;max-height:95%;overflow-y:hidden;-webkit-transition:opacity .3s ease-out, -webkit-transform .5s ease-out;transition:opacity .3s ease-out, transform .5s ease-out;width:700px;min-width:700px;-ms-flex-preferred-size:700px;flex-basis:700px;-webkit-box-flex:0;-ms-flex:0 1 0%;flex:0 1 0%}.progress-overlay-container.show{display:-webkit-box;display:-ms-flexbox;display:flex;opacity:1}.progress-overlay-container.hide{display:-webkit-box;display:-ms-flexbox;display:flex;opacity:0;-webkit-transform:translateY(-100%);transform:translateY(-100%)}.progress-overlay-container>div{-webkit-box-flex:1;-ms-flex:1 0 auto;flex:1 0 auto}.progress-overlay-container .migration-progress-stages{-webkit-box-flex:100;-ms-flex:100 1 auto;flex:100 1 auto}@media all and (-ms-high-contrast: none){.progress-overlay-container .migration-progress-stages{height:300px}}.progress-overlay-container .progress-title{margin-top:0;font-size:22px;font-weight:normal;width:85%;line-height:1.3}.progress-overlay-container .progress-title .domain-label{white-space:nowrap}.progress-overlay-container .progress-title .dashicons{display:inline;vertical-align:middle;margin-left:-.15em;padding-right:.3em;font-size:42px}.progress-overlay-container .progress-info-wrapper{margin-bottom:10px}.progress-overlay-container .progress-text{clear:left;float:left;width:100%}.progress-overlay-container .timer{position:absolute;top:35px;right:55px}.progress-overlay-container .progress-bar{position:absolute;top:0;left:0;height:100%;-webkit-transition:width 1s ease-out;transition:width 1s ease-out;z-index:0}.progress-overlay-container .stage-progress{display:none;text-transform:capitalize;padding:15px 30px 0;margin:0 -30px;height:65px;box-sizing:border-box;background:#fff;border-top:1px solid #aaa;z-index:100}.progress-overlay-container .stage-progress.active{display:block}.progress-overlay-container .stage-progress .lowercase{text-transform:lowercase}.progress-overlay-container .stage-progress .tables-complete{margin-left:3em}.progress-overlay-container .stage-progress .progress-bar-wrapper{position:relative;height:10px;width:100%;background-color:#eee;margin:15px 0 10px;background-image:-webkit-linear-gradient(135deg, rgba(255,255,255,0.35) 25%, rgba(0,0,0,0) 25%, rgba(0,0,0,0) 50%, rgba(255,255,255,0.35) 50%, rgba(255,255,255,0.35) 75%, rgba(0,0,0,0) 75%, rgba(0,0,0,0));background-image:linear-gradient(-45deg, rgba(255,255,255,0.35) 25%,rgba(0,0,0,0) 25%,rgba(0,0,0,0) 50%,rgba(255,255,255,0.35) 50%,rgba(255,255,255,0.35) 75%,rgba(0,0,0,0) 75%,rgba(0,0,0,0));background-size:20px 20px;-webkit-animation:progress-bg-anim 5s linear infinite;animation:progress-bg-anim 5s linear infinite}.progress-overlay-container .stage-progress .progress-bar{background-color:#406fa4}.progress-overlay-container .stage-progress .show-hide-tables{display:block;float:right;cursor:pointer}.progress-overlay-container .progress-tables{overflow:hidden;margin-bottom:2px;padding:0 0 20px 0}.progress-overlay-container .progress-tables-hover-boxes{position:absolute;top:0px;left:0px;display:block;width:100%}.progress-overlay-container .progress-chunk-hover{display:block;float:left;height:35px;position:relative;top:-5px;z-index:1}.progress-overlay-container .progress-chunk{box-sizing:border-box;float:left;display:block;height:6px;border-right:1px solid #ccc;border-bottom:1px solid #ccc;color:#999;position:relative;text-align:center}.progress-overlay-container .progress-chunk>span{padding:0px 3px;white-space:nowrap;text-overflow:ellipsis;margin-top:10px;display:inline-block}.progress-overlay-container .progress-label{padding:5px 10px;border:1px solid #ccc;border-radius:3px;background-color:#fff;font-family:Consolas, Monaco, monospace;font-size:12px;display:inline-block;top:-35px;position:absolute;opacity:0;-webkit-transition:opacity 200ms ease-in-out;transition:opacity 200ms ease-in-out}.progress-overlay-container .label-visible{opacity:1}.progress-overlay-container .progress-label:before{content:"";width:0;height:0;border-left:4px solid transparent;border-right:4px solid transparent;border-top:4px solid #ccc;display:block;position:absolute;bottom:-5px;left:50%;margin-left:-2px}.progress-overlay-container .progress-label:after{content:"";width:0;height:0;border-left:4px solid transparent;border-right:4px solid transparent;border-top:4px solid #fff;display:block;position:absolute;bottom:-4px;left:50%;margin-left:-2px}.progress-overlay-container .migration-progress-ajax-spinner{left:7px;position:relative;top:15px}.progress-overlay-container .close-progress-content{color:#999;cursor:pointer;font-size:26px;font-weight:200;position:absolute;right:10px;top:5px;padding:5px;display:none}.progress-overlay-container .close-progress-content:hover{color:#666;border-color:#aaa}.progress-overlay-container .migration-controls{display:block;-webkit-transition:opacity .2s ease-out;transition:opacity .2s ease-out;padding-top:15px}.progress-overlay-container .migration-controls.hidden{opacity:0;pointer-events:none}.progress-overlay-container .migration-controls span{float:left;text-align:center;display:block}.progress-overlay-container .migration-controls span:first-child{margin-right:10px;width:71px}.progress-overlay-container .migration-controls .pause-before-finalize{display:none;float:right;margin-top:5px}.progress-overlay-container .migration-controls #pause-before-finalize{margin-top:0}.progress-overlay-container .pro-version{margin-top:45px;padding-top:40px;position:relative;border-top:1px solid #ccc}.progress-overlay-container .pro-version iframe{position:absolute;top:40px;right:0;display:block}.progress-overlay-container .pro-version-content{padding-right:460px;min-height:255px}.progress-overlay-container .pro-version-content h1{line-height:1em;margin-top:0;font-size:20px}.progress-overlay-container .pro-version-content ul{margin-left:24px}.progress-overlay-container .pro-version-content li{position:relative;font-size:14px;line-height:1.4em;margin-bottom:15px;max-width:580px}.progress-overlay-container .pro-version-content .pro-quote{margin:0 0 20px 0;max-width:570px}.progress-overlay-container .pro-version-content .pro-quote .dashicons-star-filled{font-size:16px;width:16px;height:16px;position:relative;top:2px}.progress-overlay-container .pro-version-content .pro-quote-author{font-style:italic;white-space:nowrap}.progress-overlay-container.wpmdb-error{outline:3px solid #dc3232}@media screen and (max-width: 1096px){.progress-overlay-container .pro-version iframe{position:relative;top:auto;right:auto}.progress-overlay-container .pro-version-content{min-height:0;padding:0 0 20px 0}}.progress-overlay-container:not(.complete) .migration-progress-stages .item-progress:first-child{background-image:-webkit-linear-gradient(135deg, rgba(255,255,255,0.3) 25%, rgba(0,0,0,0) 25%, rgba(0,0,0,0) 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) 75%, rgba(0,0,0,0) 75%, rgba(0,0,0,0));background-image:linear-gradient(-45deg, rgba(255,255,255,0.3) 25%,rgba(0,0,0,0) 25%,rgba(0,0,0,0) 50%,rgba(255,255,255,0.3) 50%,rgba(255,255,255,0.3) 75%,rgba(0,0,0,0) 75%,rgba(0,0,0,0));background-size:50px 50px;-webkit-animation:progress-bg-anim 2s linear infinite;animation:progress-bg-anim 2s linear infinite}.progress-overlay-container.paused .active.stage-progress .progress-bar-wrapper{-webkit-animation-play-state:paused;animation-play-state:paused}.progress-overlay-container.paused .migration-progress-stages .item-progress:first-child{-webkit-animation-play-state:paused;animation-play-state:paused}.progress-overlay-container .migration-progress-stages .determining-media .item-progress:first-child{background-image:none;-webkit-animation:none;animation:none}.progress-overlay-container.cancelled .stage-tabs,.progress-overlay-container.cancelled .migration-progress-stages,.progress-overlay-container.cancelled .stage-progress.active,.progress-overlay-container.wpmdb-error .stage-tabs,.progress-overlay-container.wpmdb-error .migration-progress-stages,.progress-overlay-container.wpmdb-error .stage-progress.active{display:none}.migrate-tab>.pro-version{display:none}#overlay .pro-version{width:42%;padding-left:0;padding-right:0;-ms-flex-preferred-size:42%;flex-basis:42%;max-width:515px;min-width:400px;max-height:100%;-webkit-box-ordinal-group:3;-ms-flex-order:2;order:2;font-size:14px;display:block;-webkit-transition:-webkit-transform .3s ease-out, opacity .3s ease-out, margin-left .2s .3s ease-in-out;transition:transform .3s ease-out, opacity .3s ease-out, margin-left .2s .3s ease-in-out}#overlay .pro-version.remove{margin-left:-525px !important}#overlay .pro-version .pro-version-content{padding:0 30px}#overlay .pro-version .pro-version-content h1{font-size:22px;font-weight:bold;margin:0 0 30px}#overlay .pro-version .pro-version-content li{margin-bottom:10px;padding-left:35px;position:relative}#overlay .pro-version .pro-version-content li .dashicons{display:block;position:absolute;font-size:2em;top:-3px;left:0}#overlay .pro-version .pro-version-content .pro-quote{border:1px solid #bbb;border-radius:3px;padding:15px 15px 15px 100px;margin:30px 0;position:relative;background:url("../img/mor10.png") no-repeat 15px 31px;background-size:51px 51px}@media (min--moz-device-pixel-ratio: 1.3), (-webkit-min-device-pixel-ratio: 1.3), (min-device-pixel-ratio: 1.3), (min-resolution: 1.3dppx){#overlay .pro-version .pro-version-content .pro-quote{background-image:url("../img/mor10@2x.png")}}#overlay .pro-version .pro-version-content .pro-quote p{margin:0;font-size:13px}#overlay .pro-version .pro-version-content .pro-quote .pro-quote-author{font-size:14px;font-weight:bold;color:#999;margin-bottom:5px}#overlay .pro-version .pro-version-content .pro-quote .pro-quote-author .dashicons{float:right;color:#999}#overlay .pro-version .pro-version-content .pro-quote .stars{position:absolute;bottom:0;left:0;width:100%;height:0;overflow:visible;text-align:center}#overlay .pro-version .pro-version-content .pro-quote .stars span{background:#eee;color:#999;margin-top:-.5em}#overlay .pro-version .pro-version-content .pro-quote .stars span:first-child{padding-left:.1em}#overlay .pro-version .pro-version-content .pro-quote .stars span:last-child{padding-right:.1em}#overlay .pro-version iframe,#overlay .pro-version .iframe{width:100%;height:289px;background:#000}#overlay .pro-version .button{display:block;position:relative;width:250px;margin:20px auto 10px;text-align:center}#overlay .pro-version .close-pro-version{color:#999;cursor:pointer;font-size:26px;font-weight:200;position:absolute;right:10px;top:5px;padding:5px;display:block}#overlay .pro-version .close-pro-version:hover{color:#666;border-color:#aaa}
asset/dist/js/{common.js → common-09.js} RENAMED
@@ -27,10 +27,14 @@ function wpmdb_toggle_migration_action_text() {
27
  /**
28
  * Return the currently selected migration type selected.
29
  *
30
- * @return string Will return `push`, `pull`, or `savefile` for exporting as a file.
31
  */
32
  function wpmdb_migration_type() {
33
- return jQuery( 'input[name=action]:checked' ).val();
 
 
 
 
34
  }
35
 
36
  function wpmdb_call_next_hook() {
@@ -157,26 +161,35 @@ wpmdb.subsite_for_table = function( table_prefix, table_name ) {
157
  }
158
  };
159
 
160
- wpmdb.functions.convertKBSizeToHR = function( size, dec, kbSize ) {
 
161
  kbSize = kbSize || 1000;
162
  dec = dec || 2;
163
  size = parseInt( size );
164
 
165
  if ( kbSize > Math.abs( size ) ) {
166
- return size.toFixed( 0 ) + ' KB';
 
 
 
 
 
 
 
 
167
  }
168
- var units = [ 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB' ];
169
- var u = -1;
170
- do {
171
- size /= kbSize;
172
- ++u;
173
- } while ( Math.abs( size ) >= kbSize && u < units.length - 1 );
174
-
175
- return Math.round( size * Math.pow( 10, dec ) ) / Math.pow( 10, dec ) + ' ' + units[ u ];
176
- };
177
 
178
- (function( $ ) {
179
-
180
- // jQuery code here
 
 
181
 
182
- })( jQuery );
 
 
 
 
 
 
 
27
  /**
28
  * Return the currently selected migration type selected.
29
  *
30
+ * @return string Will return `push`, `pull`, `savefile`, or `` for exporting as a file.
31
  */
32
  function wpmdb_migration_type() {
33
+ var action = jQuery( 'input[name=action]:checked' );
34
+ if ( 0 === action.length ) {
35
+ return '';
36
+ }
37
+ return action.val();
38
  }
39
 
40
  function wpmdb_call_next_hook() {
161
  }
162
  };
163
 
164
+ wpmdb.functions.convertKBSizeToHR = function( size, dec, kbSize, retArray ) {
165
+ var retVal, units;
166
  kbSize = kbSize || 1000;
167
  dec = dec || 2;
168
  size = parseInt( size );
169
 
170
  if ( kbSize > Math.abs( size ) ) {
171
+ retVal = [ size.toFixed( 0 ), 'KB' ];
172
+ } else {
173
+ units = [ 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB' ];
174
+ var u = -1;
175
+ do {
176
+ size /= kbSize;
177
+ ++u;
178
+ } while ( Math.abs( size ) >= kbSize && u < units.length - 1 );
179
+ retVal = [ Math.round( size * Math.pow( 10, dec ) ) / Math.pow( 10, dec ), units[ u ] ];
180
  }
 
 
 
 
 
 
 
 
 
181
 
182
+ if ( ! retArray ) {
183
+ retVal = retVal[0] + ' ' + retVal[1];
184
+ }
185
+ return retVal;
186
+ };
187
 
188
+ wpmdb.functions.convertKBSizeToHRFixed = function( size, dec, kbSize ) {
189
+ dec = dec || 2;
190
+ var hrSizeArray = wpmdb.functions.convertKBSizeToHR( size, dec, kbSize, true );
191
+ if ( 'KB' !== hrSizeArray[1] ) {
192
+ return hrSizeArray[ 0 ].toFixed( 2 ) + ' ' + hrSizeArray[ 1 ];
193
+ }
194
+ return hrSizeArray[ 0 ] + ' ' + hrSizeArray[ 1 ];
195
+ };
asset/dist/js/common-09.min.js ADDED
@@ -0,0 +1 @@
 
1
+ function wpmdb_toggle_migration_action_text(){jQuery(".action-text").hide(),jQuery(".action-text."+jQuery("input[name=action]:checked").val()).show()}function wpmdb_migration_type(){var a=jQuery("input[name=action]:checked");return 0===a.length?"":a.val()}function wpmdb_call_next_hook(){wpmdb.common.call_stack.length||(wpmdb.common.call_stack=wpmdb.common.hooks);var a=wpmdb.common.call_stack[0];wpmdb.common.call_stack.shift(),a.call(this)}function wpmdb_add_commas(a){a+="";for(var b=a.split("."),c=b[0],d=1<b.length?"."+b[1]:"",e=/(\d+)(\d{3})/;e.test(c);)c=c.replace(e,"$1,$2");return c+d}function wpmdb_parse_json(a){var b={};try{b=jQuery.parseJSON(a)}catch(c){return!1}return b}function wpmdbGetAjaxErrors(a,b,c,d){var e=!1,f="",g=wpmdb_parse_json(c);if(!1===g){e=!0,a=wpmdb_strings.ajax_json_message,b="(#144)";var h=c;c=wpmdb_strings.ajax_json_errors+" "+b,c+='<br><a class="show-errors-toggle" href="#">'+wpmdb_strings.view_error_messages+"</a> ",c+='<div class="migration-php-errors">'+h+"</div>"}return(e||"undefined"!==d)&&(f+="<strong>"+a+"</strong> &mdash; "),e||"undefined"===d||(f+=wpmdb_strings.status+": "+d.status+" "+d.statusText,f+="<br /><br />"+wpmdb_strings.response+":<br />"),e||(c+=" "+b),f+=c}var wpmdb=wpmdb||{};wpmdb.common={hooks:[],call_stack:[],non_fatal_errors:"",migration_error:!1},wpmdb.functions={},wpmdb.preg_quote=function(a,b){return String(a).replace(new RegExp("[.\\\\+*?\\[\\^\\]$(){}=!<>|:\\"+(b||"")+"-]","g"),"\\$&")},wpmdb.table_is=function(a,b,c){if((a+b).toLowerCase()===c.toLowerCase())return!0;var d=wpmdb.preg_quote(c),e=new RegExp(a+"([0-9]+)_"+b,"i"),f=e.exec(d);return null!=f},wpmdb.subsite_for_table=function(a,b){var c=wpmdb.preg_quote(b),d=new RegExp(a+"([0-9]+)_","i"),e=d.exec(c);return null===e?1:e[1]},wpmdb.functions.convertKBSizeToHR=function(a,b,c,d){var e,f;if(c=c||1e3,b=b||2,a=parseInt(a),c>Math.abs(a))e=[a.toFixed(0),"KB"];else{f=["MB","GB","TB","PB","EB","ZB","YB"];var g=-1;do a/=c,++g;while(Math.abs(a)>=c&&g<f.length-1);e=[Math.round(a*Math.pow(10,b))/Math.pow(10,b),f[g]]}return d||(e=e[0]+" "+e[1]),e},wpmdb.functions.convertKBSizeToHRFixed=function(a,b,c){b=b||2;var d=wpmdb.functions.convertKBSizeToHR(a,b,c,!0);return"KB"!==d[1]?d[0].toFixed(2)+" "+d[1]:d[0]+" "+d[1]};
asset/dist/js/common.min.js DELETED
@@ -1 +0,0 @@
1
- function wpmdb_toggle_migration_action_text(){jQuery(".action-text").hide(),jQuery(".action-text."+jQuery("input[name=action]:checked").val()).show()}function wpmdb_migration_type(){return jQuery("input[name=action]:checked").val()}function wpmdb_call_next_hook(){wpmdb.common.call_stack.length||(wpmdb.common.call_stack=wpmdb.common.hooks);var a=wpmdb.common.call_stack[0];wpmdb.common.call_stack.shift(),a.call(this)}function wpmdb_add_commas(a){a+="";for(var b=a.split("."),c=b[0],d=1<b.length?"."+b[1]:"",e=/(\d+)(\d{3})/;e.test(c);)c=c.replace(e,"$1,$2");return c+d}function wpmdb_parse_json(a){var b={};try{b=jQuery.parseJSON(a)}catch(c){return!1}return b}function wpmdbGetAjaxErrors(a,b,c,d){var e=!1,f="",g=wpmdb_parse_json(c);if(!1===g){e=!0,a=wpmdb_strings.ajax_json_message,b="(#144)";var h=c;c=wpmdb_strings.ajax_json_errors+" "+b,c+='<br><a class="show-errors-toggle" href="#">'+wpmdb_strings.view_error_messages+"</a> ",c+='<div class="migration-php-errors">'+h+"</div>"}return(e||"undefined"!==d)&&(f+="<strong>"+a+"</strong> &mdash; "),e||"undefined"===d||(f+=wpmdb_strings.status+": "+d.status+" "+d.statusText,f+="<br /><br />"+wpmdb_strings.response+":<br />"),e||(c+=" "+b),f+=c}var wpmdb=wpmdb||{};wpmdb.common={hooks:[],call_stack:[],non_fatal_errors:"",migration_error:!1},wpmdb.functions={},wpmdb.preg_quote=function(a,b){return String(a).replace(new RegExp("[.\\\\+*?\\[\\^\\]$(){}=!<>|:\\"+(b||"")+"-]","g"),"\\$&")},wpmdb.table_is=function(a,b,c){if((a+b).toLowerCase()===c.toLowerCase())return!0;var d=wpmdb.preg_quote(c),e=new RegExp(a+"([0-9]+)_"+b,"i"),f=e.exec(d);return null!=f},wpmdb.subsite_for_table=function(a,b){var c=wpmdb.preg_quote(b),d=new RegExp(a+"([0-9]+)_","i"),e=d.exec(c);return null===e?1:e[1]},wpmdb.functions.convertKBSizeToHR=function(a,b,c){if(c=c||1e3,b=b||2,a=parseInt(a),c>Math.abs(a))return a.toFixed(0)+" KB";var d=["MB","GB","TB","PB","EB","ZB","YB"],e=-1;do a/=c,++e;while(Math.abs(a)>=c&&e<d.length-1);return Math.round(a*Math.pow(10,b))/Math.pow(10,b)+" "+d[e]},function(a){}(jQuery);
 
asset/dist/js/{hook.js → hook-09.js} RENAMED
File without changes
asset/dist/js/{hook.min.js → hook-09.min.js} RENAMED
@@ -1 +1 @@
1
- !function(a){a.wpmdb={hooks:{action:{},filter:{}},add_action:function(a,b,c){jQuery.wpmdb.add_hook("action",a,b,c)},add_filter:function(a,b,c){jQuery.wpmdb.add_hook("filter",a,b,c)},do_action:function(a,b){jQuery.wpmdb.do_hook("action",a,null,b)},apply_filters:function(a,b,c){return jQuery.wpmdb.do_hook("filter",a,b,c)},remove_action:function(a,b){jQuery.wpmdb.remove_hook("action",a,b)},remove_filter:function(a,b){jQuery.wpmdb.remove_hook("filter",a,b)},add_hook:function(a,b,c,d){void 0===jQuery.wpmdb.hooks[a][b]&&(jQuery.wpmdb.hooks[a][b]=[]);var e=jQuery.wpmdb.hooks[a][b];void 0===d&&(d=b+"_"+e.length),jQuery.wpmdb.hooks[a][b].push({tag:d,callable:c})},do_hook:function(a,b,c,d){if(void 0!==jQuery.wpmdb.hooks[a][b])for(var e=jQuery.wpmdb.hooks[a][b],f=0;f<e.length;f++)"action"===a?e[f].callable(d):c=e[f].callable(c,d);return"filter"===a?c:void 0},remove_hook:function(a,b,c){if(void 0!==jQuery.wpmdb.hooks[a][b])for(var d=jQuery.wpmdb.hooks[a][b],e=d.length-1;e>0;e--)(void 0===c||c===d[e].tag)&&d.splice(e,1)}}}(jQuery);
1
+ !function(a){a.wpmdb={hooks:{action:{},filter:{}},add_action:function(a,b,c){jQuery.wpmdb.add_hook("action",a,b,c)},add_filter:function(a,b,c){jQuery.wpmdb.add_hook("filter",a,b,c)},do_action:function(a,b){jQuery.wpmdb.do_hook("action",a,null,b)},apply_filters:function(a,b,c){return jQuery.wpmdb.do_hook("filter",a,b,c)},remove_action:function(a,b){jQuery.wpmdb.remove_hook("action",a,b)},remove_filter:function(a,b){jQuery.wpmdb.remove_hook("filter",a,b)},add_hook:function(a,b,c,d){void 0===jQuery.wpmdb.hooks[a][b]&&(jQuery.wpmdb.hooks[a][b]=[]);var e=jQuery.wpmdb.hooks[a][b];void 0===d&&(d=b+"_"+e.length),jQuery.wpmdb.hooks[a][b].push({tag:d,callable:c})},do_hook:function(a,b,c,d){if(void 0!==jQuery.wpmdb.hooks[a][b])for(var e=jQuery.wpmdb.hooks[a][b],f=0;f<e.length;f++)"action"===a?e[f].callable(d):c=e[f].callable(c,d);return"filter"===a?c:void 0},remove_hook:function(a,b,c){if(void 0!==jQuery.wpmdb.hooks[a][b])for(var d=jQuery.wpmdb.hooks[a][b],e=d.length-1;e>0;e--)void 0!==c&&c!==d[e].tag||d.splice(e,1)}}}(jQuery);
asset/dist/js/{multisite.js → multisite-09.js} RENAMED
@@ -16,7 +16,7 @@ wpmdb.multisite = {};
16
 
17
  var selected = ' ';
18
  if ( ( undefined === selected_subsite_ids || null === selected_subsite_ids || 0 === selected_subsite_ids.length ) ||
19
- ( undefined !== selected_subsite_ids && null !== selected_subsite_ids && 0 < selected_subsite_ids.length && -1 !== $.inArray( blog_id, selected_subsite_ids ) )
20
  ) {
21
  selected = ' selected="selected" ';
22
  site_selected = true;
@@ -31,5 +31,4 @@ wpmdb.multisite = {};
31
  }
32
  }
33
  };
34
-
35
  })( jQuery, wpmdb );
16
 
17
  var selected = ' ';
18
  if ( ( undefined === selected_subsite_ids || null === selected_subsite_ids || 0 === selected_subsite_ids.length ) ||
19
+ ( undefined !== selected_subsite_ids && null !== selected_subsite_ids && 0 < selected_subsite_ids.length && -1 !== $.inArray( blog_id, selected_subsite_ids ) )
20
  ) {
21
  selected = ' selected="selected" ';
22
  site_selected = true;
31
  }
32
  }
33
  };
 
34
  })( jQuery, wpmdb );
asset/dist/js/{multisite.min.js → multisite-09.min.js} RENAMED
File without changes
asset/dist/js/plugin-update-09.js ADDED
@@ -0,0 +1,83 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ (function( $ ) {
2
+
3
+ var doing_check_licence = false;
4
+ var fade_duration = 650;
5
+
6
+ var admin_url = ajaxurl.replace( '/admin-ajax.php', '' );
7
+ var spinner_url = admin_url + '/images/spinner';
8
+ var spinner;
9
+ if ( 2 < window.devicePixelRatio ) {
10
+ spinner_url += '-2x';
11
+ }
12
+ spinner_url += '.gif';
13
+ spinner = $( '<img src="' + spinner_url + '" alt="" class="check-licence-spinner" />' );
14
+
15
+ $( document ).ready( function() {
16
+
17
+ $( 'body' ).on( 'click', '.check-my-licence-again', function( e ) {
18
+ e.preventDefault();
19
+ $( this ).blur();
20
+
21
+ if ( doing_check_licence ) {
22
+ return false;
23
+ }
24
+
25
+ doing_check_licence = true;
26
+
27
+ $( this ).hide();
28
+ spinner.insertAfter( this );
29
+
30
+ var check_again_link = ' <a class="check-my-licence-again" href="#">' + wpmdb_update_strings.check_license_again + '</a>';
31
+
32
+ $.ajax( {
33
+ url: ajaxurl,
34
+ type: 'POST',
35
+ dataType: 'json',
36
+ cache: false,
37
+ data: {
38
+ action: 'wpmdb_check_licence',
39
+ nonce: wpmdb_nonces.check_licence,
40
+ context: 'update'
41
+ },
42
+ error: function( jqXHR, textStatus, errorThrown ) {
43
+ doing_check_licence = false;
44
+ $( '.wpmdb-licence-error-notice' ).fadeOut( fade_duration, function() {
45
+ $( '.wpmdb-licence-error-notice' ).empty()
46
+ .html( wpmdb_update_strings.license_check_problem + check_again_link )
47
+ .fadeIn( fade_duration );
48
+ } );
49
+ },
50
+ success: function( data ) {
51
+ doing_check_licence = false;
52
+ if ( 'undefined' !== typeof data.errors ) {
53
+ var msg = '';
54
+ for ( var key in data.errors ) {
55
+ msg += data.errors[ key ];
56
+ }
57
+ $( '.wpmdb-licence-error-notice' ).fadeOut( fade_duration, function() {
58
+ $( '.check-licence-spinner' ).remove();
59
+ $( '.wpmdb-licence-error-notice' ).empty()
60
+ .html( msg )
61
+ .fadeIn( fade_duration );
62
+ } );
63
+ } else {
64
+
65
+ // Success
66
+ // Fade out, empty wpmdb custom error content, swap back in the original wordpress upgrade message, fade in
67
+ $( '.wpmdbpro-custom-visible' ).fadeOut( fade_duration, function() {
68
+ $( '.check-licence-spinner' ).remove();
69
+ $( '.wpmdbpro-custom-visible' ).empty()
70
+ .html( $( '.wpmdb-original-update-row' ).html() )
71
+ .fadeIn( fade_duration );
72
+ } );
73
+ }
74
+ }
75
+ } );
76
+
77
+ } );
78
+
79
+ $( '.wpmdbpro-custom' ).prev().addClass( 'wpmdbpro-has-message' );
80
+
81
+ } );
82
+
83
+ })( jQuery );
asset/dist/js/plugin-update-09.min.js ADDED
@@ -0,0 +1 @@
 
1
+ !function(a){var b,c=!1,d=650,e=ajaxurl.replace("/admin-ajax.php",""),f=e+"/images/spinner";2<window.devicePixelRatio&&(f+="-2x"),f+=".gif",b=a('<img src="'+f+'" alt="" class="check-licence-spinner" />'),a(document).ready(function(){a("body").on("click",".check-my-licence-again",function(e){if(e.preventDefault(),a(this).blur(),c)return!1;c=!0,a(this).hide(),b.insertAfter(this);var f=' <a class="check-my-licence-again" href="#">'+wpmdb_update_strings.check_license_again+"</a>";a.ajax({url:ajaxurl,type:"POST",dataType:"json",cache:!1,data:{action:"wpmdb_check_licence",nonce:wpmdb_nonces.check_licence,context:"update"},error:function(b,e,g){c=!1,a(".wpmdb-licence-error-notice").fadeOut(d,function(){a(".wpmdb-licence-error-notice").empty().html(wpmdb_update_strings.license_check_problem+f).fadeIn(d)})},success:function(b){if(c=!1,"undefined"!=typeof b.errors){var e="";for(var f in b.errors)e+=b.errors[f];a(".wpmdb-licence-error-notice").fadeOut(d,function(){a(".check-licence-spinner").remove(),a(".wpmdb-licence-error-notice").empty().html(e).fadeIn(d)})}else a(".wpmdbpro-custom-visible").fadeOut(d,function(){a(".check-licence-spinner").remove(),a(".wpmdbpro-custom-visible").empty().html(a(".wpmdb-original-update-row").html()).fadeIn(d)})}})}),a(".wpmdbpro-custom").prev().addClass("wpmdbpro-has-message")})}(jQuery);
asset/dist/js/script-09.js ADDED
@@ -0,0 +1,4039 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 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
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
2
+ var $ = jQuery;
3
+ var MigrationProgressModel = require( 'MigrationProgress-model' );
4
+ var MigrationProgressView = require( 'MigrationProgress-view' );
5
+ var $overlayOriginal = $( '<div id="overlay" class="hide"></div>' );
6
+ var $progressContentOriginal = $( '.progress-content' ).clone().addClass( 'hide' );
7
+ var $proVersion = $( '.pro-version' ).addClass( 'hide' );
8
+
9
+ $overlayOriginal.append( $proVersion );
10
+
11
+ var MigrationProgressController = {
12
+ migration: {
13
+ model: {},
14
+ view: {},
15
+ $progress: {},
16
+ $wrapper: {},
17
+ $overlay: {},
18
+ status: 'active',
19
+ title: '',
20
+ text: '',
21
+ timerCount: 0,
22
+ elapsedInterval: 0,
23
+ currentStageNum: 0,
24
+ counterDisplay: false,
25
+ originalTitle: document.title,
26
+ setTitle: function( title ) {
27
+ this.$progress.find( '.progress-title' ).html( title );
28
+ this.title = title;
29
+ },
30
+ setStatus: function( status ) {
31
+ this.$progress
32
+ .removeClass( this.status )
33
+ .addClass( ( 'error' === status ) ? 'wpmdb-error' : status );
34
+
35
+ // Possible statuses include: 'error', 'paused', 'complete', 'cancelling'
36
+ if ( 'error' === status ) {
37
+ this.$progress.find( '.progress-text' ).addClass( 'migration-error' );
38
+ }
39
+
40
+ this.status = status;
41
+
42
+ this.updateTitleElem();
43
+ },
44
+ setText: function( text ) {
45
+ if ( 'string' !== typeof text ) {
46
+ text = '';
47
+ }
48
+
49
+ if ( 0 >= text.indexOf( 'wpmdb_error' ) ) {
50
+ text = this.decodeErrorObject( text );
51
+ }
52
+
53
+ this.$progress.find( '.progress-text' ).html( text );
54
+ this.text = text;
55
+ },
56
+ setState: function( title, text, status ) {
57
+ if ( null !== title ) {
58
+ this.setTitle( title );
59
+ }
60
+ if ( null !== text ) {
61
+ this.setText( text );
62
+ }
63
+ if ( null !== status ) {
64
+ this.setStatus( status );
65
+ }
66
+ },
67
+ startTimer: function() {
68
+ this.timerCount = 0;
69
+ this.counterDisplay = $( '.timer' );
70
+ this.elapsedInterval = setInterval( this.incrementTimer, 1000 );
71
+ },
72
+ pauseTimer: function() {
73
+ clearInterval( this.elapsedInterval );
74
+ },
75
+ resumeTimer: function() {
76
+ this.elapsedInterval = setInterval( this.incrementTimer, 1000 );
77
+ },
78
+ incrementTimer: function() {
79
+ wpmdb.current_migration.timerCount = wpmdb.current_migration.timerCount + 1;
80
+ wpmdb.current_migration.displayCount();
81
+ },
82
+ displayCount: function() {
83
+ var hours = Math.floor( this.timerCount / 3600 ) % 24;
84
+ var minutes = Math.floor( this.timerCount / 60 ) % 60;
85
+ var seconds = this.timerCount % 60;
86
+ var display = this.pad( hours, 2, 0 ) + ':' + this.pad( minutes, 2, 0 ) + ':' + this.pad( seconds, 2, 0 );
87
+ this.counterDisplay.html( display );
88
+ },
89
+ updateTitleElem: function() {
90
+ var activeStage = this.model.get( 'activeStageName' );
91
+ var stageModel = this.model.getStageModel( activeStage );
92
+ var percentDone = Math.max( 0, stageModel.getTotalProgressPercent() );
93
+ var numStages = this.model.get( 'stages' ).length;
94
+ var currentStage = this.currentStageNum;
95
+ var currentStatus = this.status;
96
+ var progressText = wpmdb_strings.title_progress;
97
+
98
+ if ( 'complete' === stageModel.get( 'status' ) && 0 === stageModel.get( 'totalSize' ) ) {
99
+ percentDone = 100;
100
+ }
101
+
102
+ progressText = progressText.replace( '%1$s', percentDone + '%' );
103
+ progressText = progressText.replace( '%2$s', currentStage );
104
+ progressText = progressText.replace( '%3$s', numStages );
105
+
106
+ if ( 1 === numStages ) {
107
+ progressText = percentDone + '%';
108
+ }
109
+
110
+ if ( wpmdb_strings[ 'title_' + currentStatus ] ) {
111
+ progressText = wpmdb_strings[ 'title_' + currentStatus ];
112
+ }
113
+
114
+ progressText = progressText + ' - ' + this.originalTitle;
115
+
116
+ document.title = progressText;
117
+ },
118
+ restoreTitleElem: function() {
119
+ document.title = this.originalTitle;
120
+ },
121
+ pad: function( num, width, padChar ) {
122
+ padChar = padChar || '0';
123
+ num = num + '';
124
+ return num.length >= width ? num : new Array( width - num.length + 1 ).join( padChar ) + num;
125
+ },
126
+
127
+ // fixes error objects that have been mangled by html encoding
128
+ decodeErrorObject: function( input ) {
129
+ var inputDecoded = input
130
+ .replace( /\{&quot;/g, '{#q!#' )
131
+ .replace( /\&quot;}/g, '#q!#}' )
132
+ .replace( /,&quot;/g, ',#q!#' )
133
+ .replace( /&quot;:/g, '#q!#:' )
134
+ .replace( /:&quot;/g, ':#q!#' )
135
+ .replace( /&quot;/g, '\\"' )
136
+ .replace( /#q!#/g, '"' )
137
+ .replace( /&gt;/g, '>' )
138
+ .replace( /&lt;/g, '<' );
139
+ try {
140
+ inputDecoded = JSON.parse( inputDecoded );
141
+ } catch ( e ) {
142
+ return input;
143
+ }
144
+ return ( 'object' === typeof inputDecoded && 'undefined' !== typeof inputDecoded.body ) ? inputDecoded : input;
145
+ },
146
+ fixProgressStageWidthForScrollBar: function() {
147
+ var scrollBarWidth = Math.abs( this.$wrapper[0].offsetWidth - this.$wrapper[0].clientWidth );
148
+ var visibleProgressItems = this.$wrapper.find( '.active .progress-items' );
149
+ var leftPad = parseInt( visibleProgressItems.css( 'padding-left' ), 10 );
150
+ var rightPad = parseInt( visibleProgressItems.css( 'padding-right' ), 10 );
151
+
152
+ if ( 0 !== scrollBarWidth || ( 0 === scrollBarWidth && rightPad !== leftPad ) ) {
153
+ visibleProgressItems.css( 'padding-right', leftPad - scrollBarWidth + 'px' );
154
+ }
155
+ }
156
+ },
157
+ newMigration: function( settings ) {
158
+ $( '#overlay' ).remove();
159
+ $( '.progress-content' ).remove();
160
+ this.migration.$overlay = $overlayOriginal.clone();
161
+
162
+ $( '#wpwrap' ).append( this.migration.$overlay );
163
+
164
+ this.migration.model = new MigrationProgressModel( settings );
165
+ this.migration.view = new MigrationProgressView( {
166
+ model: this.migration.model
167
+ } );
168
+
169
+ this.migration.$progress = $progressContentOriginal.clone();
170
+ this.migration.$wrapper = this.migration.view.$el;
171
+ this.migration.$progress.find( '.migration-progress-stages' ).replaceWith( this.migration.$wrapper );
172
+
173
+ this.migration.$proVersion = this.migration.$overlay.find( '.pro-version' );
174
+ var proVersionIFrame = this.migration.$proVersion.find( 'iframe' ).remove().clone();
175
+
176
+ this.migration.$overlay.prepend( this.migration.$progress );
177
+
178
+ // timeout needed so class is added after elements are appended to dom and transition runs.
179
+ var self = this;
180
+ setTimeout( function() {
181
+ self.migration.$overlay.add( self.migration.$progress ).add( self.migration.$proVersion ).removeClass( 'hide' ).addClass( 'show' );
182
+ if ( self.migration.$proVersion.length ) {
183
+ setTimeout( function() {
184
+ self.migration.$proVersion.find( '.iframe' ).append( proVersionIFrame );
185
+ }, 500 );
186
+ }
187
+ }, 0 );
188
+
189
+ this.migration.currentStageNum = 0;
190
+
191
+ this.migration.$proVersion.on( 'click', '.close-pro-version', function() {
192
+ self.migration.$proVersion.find( 'iframe' ).remove();
193
+ self.migration.$proVersion.addClass( 'hide remove' );
194
+ setTimeout( function() {
195
+ self.migration.$proVersion.remove();
196
+ }, 500 );
197
+ } );
198
+
199
+ this.migration.model.on( 'migrationComplete', function() {
200
+ self.utils.updateProgTableVisibilitySetting();
201
+ self.utils.updatePauseBeforeFinalizeSetting();
202
+ self.migration.pauseTimer();
203
+ } );
204
+
205
+ $( window ).on( 'resize', _.debounce( this.migration.fixProgressStageWidthForScrollBar.bind( this.migration ), 100 ) );
206
+ this.migration.model.on( 'change:activeStage', this.migration.fixProgressStageWidthForScrollBar.bind( this.migration ) );
207
+
208
+ return this.migration;
209
+ },
210
+ utils: require( 'MigrationProgress-utils' )
211
+ };
212
+
213
+ module.exports = MigrationProgressController;
214
+
215
+ },{"MigrationProgress-model":2,"MigrationProgress-utils":3,"MigrationProgress-view":4}],2:[function(require,module,exports){
216
+ var MigrationProgressStageModel = require( 'MigrationProgressStage-model' );
217
+ var $ = jQuery;
218
+
219
+ var MigrationProgressModel = Backbone.Model.extend( {
220
+ defaults: {
221
+ _initialStages: null,
222
+ stages: null,
223
+ activeStageName: null,
224
+ stageModels: null,
225
+ localTableRows: null,
226
+ localTableSizes: null,
227
+ remoteTableRows: null,
228
+ remoteTableSizes: null,
229
+ migrationStatus: 'active',
230
+ migrationIntent: 'savefile'
231
+ },
232
+ initialize: function() {
233
+ this.set( 'stageModels', {} );
234
+ this.set( '_initialStages', this.get( 'stages' ) );
235
+ this.set( 'stages', [] );
236
+ _.each( this.get( '_initialStages' ), function( stage, items, dataType ) {
237
+ this.addStage( stage.name, items, dataType );
238
+ }, this );
239
+ },
240
+ addStage: function( name, items, dataType, extend ) {
241
+ var itemsArr = [];
242
+ var stage;
243
+
244
+ _.each( items, function( item ) {
245
+ var size, rows;
246
+
247
+ if ( 'remote' === dataType ) {
248
+ size = this.get( 'remoteTableSizes' )[ item ];
249
+ rows = this.get( 'remoteTableRows' )[ item ];
250
+ } else {
251
+ size = this.get( 'localTableSizes' )[ item ];
252
+ rows = this.get( 'localTableRows' )[ item ];
253
+ }
254
+
255
+ itemsArr.push( {
256
+ name: item,
257
+ size: size,
258
+ rows: rows
259
+ } );
260
+ }, this );
261
+
262
+ stage = {
263
+ name: name,
264
+ items: itemsArr,
265
+ dataType: dataType
266
+ };
267
+
268
+ if ( 'object' === typeof extend ) {
269
+ stage = $.extend( stage, extend );
270
+ }
271
+
272
+ this.addStageModel( stage );
273
+
274
+ this.trigger( 'stage:added', this.get( 'stageModels' )[ name ] );
275
+ this.get( 'stageModels' )[ name ].on( 'change', function() {
276
+ this.trigger( 'change' );
277
+ }, this );
278
+
279
+ return this.getStageModel( stage.name );
280
+ },
281
+ addStageItem: function( stage, name, size, rows ) {
282
+ this.getStageModel( stage ).addItem( name, size, rows );
283
+ },
284
+ addStageModel: function( stage ) {
285
+ var stages = this.get( 'stages' );
286
+ var stageModels = this.get( 'stageModels' );
287
+ var newStageModel = new MigrationProgressStageModel( stage );
288
+
289
+ stages.push( stage );
290
+ stageModels[ stage.name ] = newStageModel;
291
+
292
+ this.set( 'stages', stages );
293
+ this.set( 'stageModels', stageModels );
294
+ },
295
+ getStageModel: function( name ) {
296
+ return this.get( 'stageModels' )[ name ];
297
+ },
298
+ getStageItems: function( stage, map ) {
299
+ var stageModel = this.getStageModel( stage );
300
+ var items = stageModel.get( 'items' );
301
+
302
+ if ( undefined === map ) {
303
+ return items;
304
+ } else {
305
+ return items.map( function( item ) {
306
+ return item[ map ];
307
+ } );
308
+ }
309
+ },
310
+ setActiveStage: function( stage ) {
311
+ this.setStageComplete();
312
+ this.set( 'activeStageName', stage );
313
+ this.getStageModel( stage ).set( 'status', 'active' );
314
+ this.trigger( 'change:activeStage' );
315
+ },
316
+ setStageComplete: function( stage ) {
317
+ if ( ! stage ) {
318
+ stage = this.get( 'activeStageName' );
319
+ }
320
+ if ( null !== stage ) {
321
+ this.getStageModel( stage ).set( 'status', 'complete' );
322
+ }
323
+
324
+ wpmdb.current_migration.currentStageNum = wpmdb.current_migration.currentStageNum + 1;
325
+ },
326
+ setMigrationComplete: function() {
327
+ var lastStage = this.getStageModel( this.get( 'activeStageName' ) );
328
+ this.setStageComplete();
329
+ this.trigger( 'migrationComplete' );
330
+ this.set( 'migrationStatus', 'complete' );
331
+ lastStage.activateTab();
332
+ }
333
+ } );
334
+
335
+ module.exports = MigrationProgressModel;
336
+
337
+ },{"MigrationProgressStage-model":5}],3:[function(require,module,exports){
338
+ var $ = jQuery;
339
+
340
+ module.exports = {
341
+ updateProgTableVisibilitySetting: function() {
342
+ if ( ! wpmdb_data.prog_tables_visibility_changed ) {
343
+ return;
344
+ }
345
+ wpmdb_data.prog_tables_visibility_changed = false;
346
+
347
+ $.ajax( {
348
+ url: ajaxurl,
349
+ type: 'POST',
350
+ dataType: 'text',
351
+ cache: false,
352
+ data: {
353
+ action: 'wpmdb_save_setting',
354
+ nonce: wpmdb_data.nonces.save_setting,
355
+ setting: 'prog_tables_hidden',
356
+ checked: Boolean( wpmdb_data.prog_tables_hidden )
357
+ },
358
+ error: function( jqXHR, textStatus, errorThrown ) {
359
+ console.log( 'Could not save progress item visibility setting', errorThrown );
360
+ }
361
+ } );
362
+ },
363
+ updatePauseBeforeFinalizeSetting: function() {
364
+ if ( ! wpmdb_data.pause_before_finalize_changed ) {
365
+ return;
366
+ }
367
+ wpmdb_data.pause_before_finalize_changed = false;
368
+
369
+ $.ajax( {
370
+ url: ajaxurl,
371
+ type: 'POST',
372
+ dataType: 'text',
373
+ cache: false,
374
+ data: {
375
+ action: 'wpmdb_save_setting',
376
+ nonce: wpmdb_data.nonces.save_setting,
377
+ setting: 'pause_before_finalize',
378
+ checked: Boolean( wpmdb_data.pause_before_finalize )
379
+ },
380
+ error: function( jqXHR, textStatus, errorThrown ) {
381
+ console.log( 'Could not save pause before finalize setting', errorThrown );
382
+ }
383
+ } );
384
+ }
385
+ };
386
+
387
+ },{}],4:[function(require,module,exports){
388
+ var MigrationProgressStageView = require( './MigrationProgressStage-view.js' );
389
+ var $ = jQuery;
390
+
391
+ var MigrationProgressView = Backbone.View.extend( {
392
+ tagName: 'div',
393
+ className: 'migration-progress-stages',
394
+ id: 'migration-progress-stages',
395
+ self: this,
396
+ initialize: function() {
397
+ this.$el.empty();
398
+
399
+ this.model.on( 'stage:added', function( stageModel ) {
400
+ this.addStageView( stageModel );
401
+ }, this );
402
+
403
+ _.each( this.model.get( 'stageModels' ), this.addStageView, this );
404
+ },
405
+ addStageView: function( stageModel ) {
406
+ var newStageSubView = new MigrationProgressStageView( {
407
+ model: stageModel
408
+ } );
409
+ stageModel.trigger( 'view:initialized', newStageSubView );
410
+ this.$el.append( newStageSubView.$el );
411
+ this.$el.parent().find( '.stage-tabs' ).append( newStageSubView.$tabElem );
412
+ }
413
+ } );
414
+
415
+ module.exports = MigrationProgressView;
416
+
417
+ },{"./MigrationProgressStage-view.js":6}],5:[function(require,module,exports){
418
+ var $ = jQuery;
419
+
420
+ var MigrationProgressStage = Backbone.Model.extend( {
421
+ defaults: {
422
+ status: 'queued',
423
+ _initialItems: null,
424
+ items: null,
425
+ lookupItems: null,
426
+ totalSize: 0,
427
+ totalTransferred: 0,
428
+ dataType: 'local',
429
+ name: '',
430
+ itemsComplete: 0,
431
+ strings: null
432
+ },
433
+ initialize: function() {
434
+ this.initStrings();
435
+
436
+ this.set( '_initialItems', this.get( 'items' ).slice() );
437
+ this.set( 'items', [] );
438
+ this.set( 'lookupItems', {} );
439
+
440
+ _.each( this.get( '_initialItems' ), function( item ) {
441
+ this.addItem( item.name, item.size, item.rows );
442
+ }, this );
443
+
444
+ this.on( 'view:initialized', this.triggerItemViewInit );
445
+
446
+ this.on( 'change', function() {
447
+ wpmdb.current_migration.updateTitleElem();
448
+ } );
449
+ },
450
+ initStrings: function() {
451
+ var default_strings = {
452
+ stage_title: this.get( 'name' ),
453
+ migrated: wpmdb_strings.migrated,
454
+ queued: wpmdb_strings.queued,
455
+ active: wpmdb_strings.running,
456
+ complete: wpmdb_strings.complete,
457
+ hide: wpmdb_strings.hide,
458
+ show: wpmdb_strings.show,
459
+ itemsName: wpmdb_strings.tables
460
+ };
461
+ var strings = this.get( 'strings' );
462
+
463
+ strings = ( 'object' === typeof strings ) ? strings : {};
464
+ strings = $.extend( default_strings, strings );
465
+
466
+ strings.items_migrated = strings.itemsName + ' ' + strings.migrated;
467
+ strings.hide_items = strings.hide + ' ' + strings.itemsName;
468
+ strings.show_items = strings.show + ' ' + strings.itemsName;
469
+
470
+ this.set( 'strings', strings );
471
+ },
472
+ addItem: function( name, size, rows ) {
473
+ var items = this.get( 'items' );
474
+ var item = {
475
+ name: name,
476
+ size: size || 1,
477
+ rows: rows || size,
478
+ stageName: this.get( 'name' ),
479
+ $el: null,
480
+ transferred: 0,
481
+ rowsTransferred: 0,
482
+ complete: false
483
+ };
484
+
485
+ items.push( item );
486
+ this.get( 'lookupItems' )[ name ] = items.length - 1;
487
+
488
+ this.set( 'totalSize', parseInt( this.get( 'totalSize' ) ) + parseInt( size ) );
489
+ this.trigger( 'item:added', item );
490
+ },
491
+ triggerItemViewInit: function() {
492
+ var items = this.get( 'items' );
493
+ var self = this;
494
+ _.each( items, function( item ) {
495
+ self.trigger( 'item:added', item );
496
+ } );
497
+ },
498
+ getTotalSizeTransferred: function() {
499
+ return this.get( 'totalTransferred' );
500
+ },
501
+ countItemsComplete: function() {
502
+ return this.get( 'itemsComplete' );
503
+ },
504
+ getTotalProgressPercent: function() {
505
+ var transferred = this.getTotalSizeTransferred();
506
+ var total = this.get( 'totalSize' );
507
+ if ( 0 >= transferred || 0 >= total ) {
508
+ return 0;
509
+ }
510
+ return Math.min( 100, Math.floor( ( transferred / total ) * 100 ) );
511
+ },
512
+ activateTab: function() {
513
+ this.trigger( 'activateTab' );
514
+ wpmdb.current_migration.model.trigger( 'change:activeStage' );
515
+ },
516
+ setItemComplete: function( itemName ) {
517
+ var item = this.getItemByName( itemName );
518
+ var totalTransferred = this.get( 'totalTransferred' );
519
+ var itemsComplete = this.get( 'itemsComplete' );
520
+
521
+ this.set( 'itemsComplete', ++itemsComplete );
522
+
523
+ totalTransferred += item.size - item.transferred;
524
+ this.set( 'totalTransferred', totalTransferred );
525
+
526
+ item.transferred = item.size;
527
+ item.complete = true;
528
+ item.rowsTransferred = item.rows;
529
+ this.trigger( 'change change:items', item );
530
+ },
531
+ setItemRowsTransferred: function( itemName, numRows ) {
532
+ var amtDone, estTransferred;
533
+ var item = this.getItemByName( itemName );
534
+ var totalTransferred = this.get( 'totalTransferred' );
535
+
536
+ if ( -1 === parseInt( numRows ) ) {
537
+ amtDone = 1;
538
+ } else {
539
+ amtDone = Math.min( 1, numRows / item.rows );
540
+ }
541
+
542
+ if ( 1 === amtDone ) {
543
+ this.setItemComplete( itemName );
544
+ return;
545
+ }
546
+
547
+ estTransferred = item.size * amtDone;
548
+
549
+ totalTransferred += estTransferred - item.transferred;
550
+ this.set( 'totalTransferred', totalTransferred );
551
+
552
+ item.transferred = estTransferred;
553
+ item.rowsTransferred = numRows;
554
+ this.trigger( 'change change:items', item );
555
+ },
556
+ getItemByName: function( itemName ) {
557
+ var item = this.get( 'items' )[ this.get( 'lookupItems' )[ itemName ] ] || {};
558
+ if ( itemName === item.name ) {
559
+ return item;
560
+ } else {
561
+ return this.determineItemByName( itemName );
562
+ }
563
+ },
564
+ determineItemByName: function( itemName ) {
565
+ var items = this.get( 'items' );
566
+ for ( var index = 0; index < items.length; index++ ) {
567
+ var item = items[ index ];
568
+ if ( itemName === item.name ) {
569
+ this.get( 'lookupItems' ).itemName = index;
570
+ return item;
571
+ }
572
+ }
573
+ }
574
+ } );
575
+
576
+ module.exports = MigrationProgressStage;
577
+
578
+ },{}],6:[function(require,module,exports){
579
+ var $ = jQuery;
580
+
581
+ var MigrationProgressStageView = Backbone.View.extend( {
582
+ tagName: 'div',
583
+ className: 'migration-progress-stage-container hide-tables',
584
+ $totalProgressElem: null,
585
+ $tabElem: null,
586
+ $showHideTablesElem: null,
587
+ $pauseBeforeFinalizeElem: null,
588
+ $pauseBeforeFinalizeCheckbox: null,
589
+ $itemsContainer: null,
590
+ itemViews: null,
591
+ maxDomNodes: 100,
592
+ visibleDomNodes: 0,
593
+ queuedElements: null,
594
+ $truncationNotice: null,
595
+ $truncationNoticeHiddenItems: null,
596
+ initialize: function() {
597
+ this.$el.empty();
598
+ this.$el.attr( 'data-stage', this.model.get( 'name' ) ).addClass( 'queued ' + this.model.get( 'name' ) );
599
+
600
+ this.queuedElements = [];
601
+
602
+ this.initTotalProgressElem();
603
+ wpmdb.current_migration.view.$el.parent().find( '.stage-tabs' ).after( this.$totalProgressElem );
604
+
605
+ this.$itemsContainer = $( '<div class=progress-items />' );
606
+ this.$el.append( this.$itemsContainer );
607
+
608
+ this.initTabElem();
609
+
610
+ this.model.on( 'item:added', this.maybeAddElementToView, this );
611
+
612
+ _.each( this.model.get( 'itemModels' ), this.maybeAddElementToView, this );
613
+ this.model.on( 'change', function() {
614
+ this.updateProgressElem();
615
+ this.updateStageTotals();
616
+ }, this );
617
+
618
+ this.model.on( 'change:status', function( e ) {
619
+ this.$el.removeClass( 'queued active' ).addClass( this.model.get( 'status' ) );
620
+ this.$totalProgressElem.removeClass( 'queued active' ).addClass( this.model.get( 'status' ) );
621
+ this.$tabElem.removeClass( 'queued active' ).addClass( this.model.get( 'status' ) )
622
+ .find( '.stage-status' ).text( this.model.get( 'strings' )[ this.model.get( 'status' ) ] );
623
+ }, this );
624
+
625
+ this.model.on( 'change:items', function( item ) {
626
+ if ( item.name ) {
627
+ this.setItemProgress( item );
628
+ }
629
+ }, this );
630
+
631
+ this.model.on( 'activateTab', function() {
632
+ if ( 'complete' === wpmdb.current_migration.model.get( 'migrationStatus' ) ) {
633
+ this.$totalProgressElem.addClass( 'active' ).siblings().removeClass( 'active' );
634
+ this.$tabElem.addClass( 'active' ).siblings().removeClass( 'active' );
635
+ this.$el.addClass( 'active' ).siblings().removeClass( 'active' );
636
+ }
637
+ }, this );
638
+ },
639
+ initTotalProgressElem: function() {
640
+ this.initShowHideTablesElem();
641
+ this.initPauseBeforeFinalizeElem();
642
+
643
+ this.$totalProgressElem = $( '<div class="stage-progress ' + this.model.get( 'name' ) + '" />' )
644
+ .append( '<span class=percent-complete>0</span>% ' + this.model.get( 'strings' ).complete + ' ' )
645
+ .append( '(<span class=size-complete>0 MB</span> / <span class=size-total>0 MB</span>) ' )
646
+ .append( '<span class=tables-complete>0</span> <span class=lowercase >of</span> <span class=tables-total>0</span> ' + this.model.get( 'strings' ).items_migrated )
647
+ .append( this.$showHideTablesElem )
648
+ .append( '<div class=progress-bar-wrapper><div class=progress-bar /></div>' );
649
+
650
+ this.updateStageTotals();
651
+ },
652
+ initShowHideTablesElem: function() {
653
+ this.$showHideTablesElem = $( '<a class=show-hide-tables/>' ).text( this.model.get( 'strings' ).show_items );
654
+ var self = this;
655
+ this.$showHideTablesElem.on( 'click show-hide-progress-tables', function() {
656
+ var progTablesHidden;
657
+ if ( self.$el.hasClass( 'hide-tables' ) ) { // show tables
658
+ progTablesHidden = false;
659
+ self.$el.add( self.$el.siblings() ).removeClass( 'hide-tables' );
660
+ self.$showHideTablesElem.text( self.model.get( 'strings' ).hide_items );
661
+ } else { // hide tables
662
+ progTablesHidden = true;
663
+ self.$el.add( self.$el.siblings() ).addClass( 'hide-tables' );
664
+ self.$showHideTablesElem.text( self.model.get( 'strings' ).show_items );
665
+ }
666
+
667
+ if ( Boolean( progTablesHidden ) !== Boolean( wpmdb_data.prog_tables_hidden ) ) {
668
+ wpmdb_data.prog_tables_visibility_changed = true;
669
+ wpmdb_data.prog_tables_hidden = progTablesHidden;
670
+ }
671
+ } );
672
+
673
+ // show progress tables on init if hidden is false
674
+ if ( ! wpmdb_data.prog_tables_hidden ) {
675
+ this.$showHideTablesElem.triggerHandler( 'show-hide-progress-tables' );
676
+ }
677
+
678
+ // make sure text reflects current state when showing
679
+ this.model.on( 'change:status activateTab', function() {
680
+ if ( wpmdb_data.prog_tables_hidden ) {
681
+ self.$showHideTablesElem.text( self.model.get( 'strings' ).show_items );
682
+ } else {
683
+ self.$showHideTablesElem.text( self.model.get( 'strings' ).hide_items );
684
+ }
685
+ } );
686
+ },
687
+ initPauseBeforeFinalizeElem: function() {
688
+ this.$pauseBeforeFinalizeElem = $( '.pause-before-finalize' );
689
+ this.$pauseBeforeFinalizeCheckbox = this.$pauseBeforeFinalizeElem.find( 'input[type=checkbox]' );
690
+ var self = this;
691
+ var isChecked = false;
692
+ var migrationIntent = wpmdb.current_migration.model.get( 'migrationIntent' );
693
+
694
+ // make sure checkbox is checked based on current state
695
+ if ( wpmdb_data.pause_before_finalize ) {
696
+ isChecked = true;
697
+ }
698
+ this.$pauseBeforeFinalizeCheckbox.prop( 'checked', isChecked );
699
+
700
+ // only display on certain migrations
701
+ if ( -1 !== $.inArray( migrationIntent, [ 'push', 'pull', 'find_replace' ] ) ) {
702
+ if ( 'find_replace' === migrationIntent ) {
703
+ $( '#pause-before-finalize-label' ).text( wpmdb_strings.pause_before_finalize_find_replace );
704
+ }
705
+ this.$pauseBeforeFinalizeElem.show();
706
+ } else {
707
+ this.$pauseBeforeFinalizeElem.hide();
708
+ }
709
+
710
+ // hide on media stage
711
+ wpmdb.current_migration.model.on( 'change:activeStage', function() {
712
+ if ( 'media' === wpmdb.current_migration.model.get( 'activeStageName' ) ) {
713
+ self.$pauseBeforeFinalizeElem.hide();
714
+ }
715
+ } );
716
+
717
+ this.$pauseBeforeFinalizeElem.on( 'click', function() {
718
+ var pauseBeforeFinalizeValue = Boolean( self.$pauseBeforeFinalizeCheckbox.is( ':checked' ) );
719
+ if ( pauseBeforeFinalizeValue !== Boolean( wpmdb_data.pause_before_finalize ) ) {
720
+ wpmdb_data.pause_before_finalize_changed = true;
721
+ wpmdb_data.pause_before_finalize = pauseBeforeFinalizeValue;
722
+ }
723
+ } );
724
+ },
725
+ initTabElem: function() {
726
+ var self = this;
727
+ this.$tabElem = $( '<a class=stage-tab>' )
728
+ .append( '<span class=stage-title>' + this.model.get( 'strings' ).stage_title + '</span> ' )
729
+ .append( '<span class=stage-status>' + this.model.get( 'strings' ).queued + '</span> ' )
730
+ .on( 'click', function() {
731
+ self.model.activateTab();
732
+ } );
733
+ },
734
+ updateProgressElem: function() {
735
+ var percentDone = Math.max( 0, this.model.getTotalProgressPercent() );
736
+ var sizeDone = wpmdb.functions.convertKBSizeToHRFixed( Math.min( this.model.getTotalSizeTransferred(), this.model.get( 'totalSize' ) ) );
737
+ var tablesDone = Math.min( this.model.countItemsComplete(), this.model.get( 'items' ).length );
738
+
739
+ if ( 'complete' === this.model.get( 'status' ) && 0 === this.model.get( 'totalSize' ) ) {
740
+ percentDone = 100;
741
+ this.$showHideTablesElem.fadeOut();
742
+ }
743
+
744
+ this.$totalProgressElem.find( '.percent-complete' ).text( percentDone );
745
+ this.$totalProgressElem.find( '.size-complete' ).text( sizeDone );
746
+ this.$totalProgressElem.find( '.tables-complete' ).text( wpmdb_add_commas( tablesDone ) );
747
+ this.$totalProgressElem.find( '.progress-bar-wrapper .progress-bar' ).css( { width: percentDone + '%' } );
748
+ },
749
+ updateStageTotals: function() {
750
+ var itemCount = this.model.get( 'items' ).length;
751
+ this.$totalProgressElem.find( '.tables-total' ).text( wpmdb_add_commas( itemCount ) );
752
+ this.$totalProgressElem.find( '.size-total' ).text( wpmdb.functions.convertKBSizeToHR( this.model.get( 'totalSize' ) ) );
753
+ },
754
+ initializeItemElement: function( item ) {
755
+ var $el = $( '<div class="item-progress" />' );
756
+ var $progress = $( '<div class="progress-bar"/>' ).css( 'width', '0%' );
757
+ var $title = $( '<p>' ).addClass( 'item-info' )
758
+ .append( $( '<span class="name" />' ).text( item.name ) )
759
+ .append( ' ' )
760
+ .append( $( '<span class="size" />' ).text( '(' + wpmdb.functions.convertKBSizeToHRFixed( item.size ) + ')' ) );
761
+
762
+ $el.append( $title );
763
+ $el.append( $progress );
764
+ $el.append( '<span class="dashicons dashicons-yes"/>' );
765
+
766
+ $el.attr( 'id', 'item-' + item.name );
767
+ $el.attr( 'data-stage', this.model.get( 'name' ) );
768
+
769
+ item.$el = $el;
770
+ item.$progress = $progress;
771
+ item.$title = $title;
772
+
773
+ return item;
774
+ },
775
+ maybeAddElementToView: function( item ) {
776
+ if ( this.visibleDomNodes < this.maxDomNodes ) {
777
+ ++this.visibleDomNodes;
778
+ this.$itemsContainer.append( this.initializeItemElement( item ).$el );
779
+ } else {
780
+ this.queuedElements.push( item );
781
+ if ( ! this.$truncationNotice ) {
782
+ this.showTruncationNotice();
783
+ } else {
784
+ this.updateTruncationNotice();
785
+ }
786
+ }
787
+ },
788
+ showTruncationNotice: function() {
789
+ if ( this.$truncationNotice ) {
790
+ return;
791
+ }
792
+ this.$truncationNotice = $( '<div class="truncation-notice" >' + wpmdb_strings.progress_items_truncated_msg.replace( '%1$s', '<span class="hidden-items">' + wpmdb_add_commas( this.queuedElements.length ) + '</span>' ) + '</div>' );
793
+ this.$truncationNoticeHiddenItems = this.$truncationNotice.find( '.hidden-items' );
794
+ this.$itemsContainer.after( this.$truncationNotice );
795
+ },
796
+ updateTruncationNotice: function() {
797
+ this.$truncationNoticeHiddenItems.text( wpmdb_add_commas( this.queuedElements.length ) );
798
+ },
799
+ getNextElementForView: function( $el ) {
800
+ var queueItem;
801
+ if ( this.queuedElements.length ) {
802
+ if ( $el ) {
803
+ this.queuedElements.push( $el );
804
+ }
805
+ queueItem = this.queuedElements.shift();
806
+ if ( queueItem instanceof $ ) {
807
+ $el = queueItem;
808
+ } else {
809
+ $el = this.initializeItemElement( queueItem ).$el;
810
+ }
811
+ }
812
+ return $el;
813
+ },
814
+ setItemProgress: function( item ) {
815
+ var percentDone = Math.min( 100, Math.ceil( 100 * ( item.transferred / item.size ) ) );
816
+ item.$progress.css( 'width', percentDone + '%' );
817
+ if ( 100 <= percentDone ) {
818
+ this.elemComplete( item );
819
+ }
820
+ },
821
+ elemComplete: function( item ) {
822
+ var $el = item.$el.addClass( 'complete' );
823
+
824
+ // skip moving item to end of list if there's only one item in the list
825
+ if ( 1 === this.model.get( 'items' ).length ) {
826
+ return;
827
+ }
828
+
829
+ var $nextEl = this.getNextElementForView( $el );
830
+
831
+ var height = $el.height();
832
+ var marginBottom = $el.css( 'margin-bottom' );
833
+
834
+ var $clone = $nextEl.clone().css( { height: 0, marginBottom: 0 } ).addClass( 'clone' );
835
+ $clone.appendTo( this.$itemsContainer );
836
+ $el.css( { height: height, marginBottom: marginBottom } );
837
+
838
+ setTimeout( function() {
839
+ $el.css( { height: 0, marginBottom: 0 } );
840
+ $clone.css( { height: height, marginBottom: marginBottom } );
841
+
842
+ setTimeout( function() {
843
+ $el.css( { height: 'auto', marginBottom: marginBottom } ).remove();
844
+ $clone.remove();
845
+ this.$itemsContainer.find( '.item-progress:not(.clone)' ).last().after( $nextEl.css( { height: 'auto', marginBottom: marginBottom } ) );
846
+ }.bind( this ), 250 );
847
+
848
+ }.bind( this ), 1000 );
849
+
850
+ }
851
+ } );
852
+
853
+ module.exports = MigrationProgressStageView;
854
+
855
+ },{}],7:[function(require,module,exports){
856
+ (function( $, wpmdb ) {
857
+
858
+ var connection_established = false;
859
+ var last_replace_switch = '';
860
+ var doing_ajax = false;
861
+ var doing_licence_registration_ajax = false;
862
+ var doing_reset_api_key_ajax = false;
863
+ var doing_save_profile = false;
864
+ var doing_plugin_compatibility_ajax = false;
865
+ var profile_name_edited = false;
866
+ var checked_licence = false;
867
+ var show_prefix_notice = false;
868
+ var show_ssl_notice = false;
869
+ var force_reconnect = false;
870
+ var migration_selection = '';
871
+ var show_version_notice = false;
872
+ var migration_completed = false;
873
+ var currently_migrating = false;
874
+ var dump_filename = '';
875
+ var dump_path = '';
876
+ var migration_intent;
877
+ var remote_site;
878
+ var secret_key;
879
+ var form_data;
880
+ var stage;
881
+ var elapsed_interval;
882
+ var completed_msg;
883
+ var tables_to_migrate = '';
884
+ var migration_paused = false;
885
+ var previous_progress_title = '';
886
+ var previous_progress_text_primary = '';
887
+ var previous_progress_text_secondary = '';
888
+ var cancelling_text = '';
889
+ var paused_text = '';
890
+ var migration_cancelled = false;
891
+ var flag_skip_delay = false;
892
+ var delay_between_requests = 0;
893
+ var fade_duration = 400;
894
+ var pause_before_finalize = false;
895
+ var is_auto_pause_before_finalize = false;
896
+
897
+ wpmdb.migration_progress_controller = require( 'MigrationProgress-controller' );
898
+ wpmdb.current_migration = null;
899
+ wpmdb.migration_selection = wpmdb_migration_type();
900
+
901
+ var admin_url = ajaxurl.replace( '/admin-ajax.php', '' ), spinner_url = admin_url + '/images/spinner';
902
+
903
+ if ( 2 < window.devicePixelRatio ) {
904
+ spinner_url += '-2x';
905
+ }
906
+ spinner_url += '.gif';
907
+ var ajax_spinner = '<img src="' + spinner_url + '" alt="" class="ajax-spinner general-spinner" />';
908
+
909
+ window.onbeforeunload = function( e ) {
910
+ if ( currently_migrating ) {
911
+ e = e || window.event;
912
+
913
+ // For IE and Firefox prior to version 4
914
+ if ( e ) {
915
+ e.returnValue = wpmdb_strings.sure;
916
+ }
917
+
918
+ // For Safari
919
+ return wpmdb_strings.sure;
920
+ }
921
+ };
922
+
923
+ function pad( n, width, z ) {
924
+ z = z || '0';
925
+ n = n + '';
926
+ return n.length >= width ? n : new Array( width - n.length + 1 ).join( z ) + n;
927
+ }
928
+
929
+ function is_int( n ) {
930
+ n = parseInt( n );
931
+ return 'number' === typeof n && 0 === n % 1;
932
+ }
933
+
934
+ function get_intersect( arr1, arr2 ) {
935
+ var r = [], o = {}, l = arr2.length, i, v;
936
+ for ( i = 0; i < l; i++ ) {
937
+ o[ arr2[ i ] ] = true;
938
+ }
939
+ l = arr1.length;
940
+ for ( i = 0; i < l; i++ ) {
941
+ v = arr1[ i ];
942
+ if ( v in o ) {
943
+ r.push( v );
944
+ }
945
+ }
946
+ return r;
947
+ }
948
+
949
+ function get_query_var( name ) {
950
+ name = name.replace( /[\[]/, '\\[' ).replace( /[\]]/, '\\]' );
951
+ var regex = new RegExp( '[\\?&]' + name + '=([^&#]*)' ),
952
+ results = regex.exec( location.search );
953
+ return null === results ? '' : decodeURIComponent( results[ 1 ].replace( /\+/g, ' ' ) );
954
+ }
955
+
956
+ function maybe_show_ssl_warning( url, key, remote_scheme ) {
957
+ var scheme = url.substr( 0, url.indexOf( ':' ) );
958
+ if ( remote_scheme !== scheme && url.indexOf( 'https' ) !== -1 ) {
959
+ $( '.ssl-notice' ).show();
960
+ show_ssl_notice = true;
961
+ url = url.replace( 'https', 'http' );
962
+ $( '.pull-push-connection-info' ).val( url + '\n' + key );
963
+ return;
964
+ }
965
+ show_ssl_notice = false;
966
+ return;
967
+ }
968
+
969
+ function maybe_show_prefix_notice( prefix ) {
970
+ if ( prefix !== wpmdb_data.this_prefix ) {
971
+ $( '.remote-prefix' ).html( prefix );
972
+ show_prefix_notice = true;
973
+ if ( 'pull' === wpmdb_migration_type() ) {
974
+ $( '.prefix-notice.pull' ).show();
975
+ } else {
976
+ $( '.prefix-notice.push' ).show();
977
+ }
978
+ }
979
+ }
980
+
981
+ function maybe_show_mixed_cased_table_name_warning() {
982
+ if ( 'undefined' === typeof wpmdb.common.connection_data || false === wpmdb.common.connection_data ) {
983
+ return;
984
+ }
985
+
986
+ var migration_intent = wpmdb_migration_type();
987
+ var tables_to_migrate = get_tables_to_migrate( null, null );
988
+
989
+ $( '.mixed-case-table-name-notice' ).hide();
990
+
991
+ if ( null === tables_to_migrate ) {
992
+ return;
993
+ }
994
+
995
+ tables_to_migrate = tables_to_migrate.join( '' );
996
+
997
+ // The table names are all lowercase, no need to display the warning.
998
+ if ( tables_to_migrate === tables_to_migrate.toLowerCase() ) {
999
+ return;
1000
+ }
1001
+
1002
+ /*
1003
+ * Do not display the warning if the remote lower_case_table_names does not equal "1" (i.e the only problematic setting)
1004
+ * Applies to push/export migrations.
1005
+ */
1006
+ if ( '1' !== wpmdb.common.connection_data.lower_case_table_names && ( 'push' === migration_intent || 'savefile' === migration_intent ) ) {
1007
+ return;
1008
+ }
1009
+
1010
+ /*
1011
+ * Do not display the warning if the local lower_case_table_names does not equal "1" (i.e the only problematic setting)
1012
+ * Only applies to pull migrations.
1013
+ */
1014
+ if ( '1' !== wpmdb_data.lower_case_table_names && 'pull' === migration_intent ) {
1015
+ return;
1016
+ }
1017
+
1018
+ /*
1019
+ * At this stage we've determined:
1020
+ * 1. The source database contains at least one table that contains an uppercase character.
1021
+ * 2. The destination environment has lower_case_table_names set to 1.
1022
+ * 3. The source database table containing the uppercase letter will be converted to lowercase during the migration.
1023
+ */
1024
+
1025
+ if ( 'push' === migration_intent || 'savefile' === migration_intent ) {
1026
+ $( '.mixed-case-table-name-notice.push' ).show();
1027
+ } else {
1028
+ $( '.mixed-case-table-name-notice.pull' ).show();
1029
+ }
1030
+ }
1031
+
1032
+ function get_domain_name( url ) {
1033
+ var temp_url = url;
1034
+ var domain = temp_url.replace( /\/\/(.*)@/, '//' ).replace( 'http://', '' ).replace( 'https://', '' ).replace( 'www.', '' );
1035
+ return domain;
1036
+ }
1037
+
1038
+ function update_domain_placeholder( label, url, stage ) {
1039
+ var domain = get_domain_name( url );
1040
+
1041
+ if ( 'completed' === stage ) {
1042
+ return label.replace( /\%s\s?/, '<span class=domain-label>' + domain + '</span>&nbsp;' );
1043
+ }
1044
+
1045
+ return label.replace( /\%s(\S*)\s?/, '<span class=domain-label>' + domain + '$1</span>&nbsp;' );
1046
+ }
1047
+
1048
+ function get_migration_status_label( url, intent, stage ) {
1049
+ var migrating_stage_label = '';
1050
+ var completed_stage_label = '';
1051
+
1052
+ switch ( intent ) {
1053
+ case 'push':
1054
+ migrating_stage_label = wpmdb_strings.push_migration_label_migrating;
1055
+ completed_stage_label = wpmdb_strings.push_migration_label_completed;
1056
+ break;
1057
+ case 'pull':
1058
+ migrating_stage_label = wpmdb_strings.pull_migration_label_migrating;
1059
+ completed_stage_label = wpmdb_strings.pull_migration_label_completed;
1060
+ break;
1061
+ case 'find_replace':
1062
+ migrating_stage_label = wpmdb_strings.find_replace_label_migrating;
1063
+ completed_stage_label = wpmdb_strings.find_replace_label_completed;
1064
+ break;
1065
+ case 'savefile':
1066
+ migrating_stage_label = wpmdb_strings.exporting_please_wait;
1067
+ completed_stage_label = wpmdb_strings.exporting_complete;
1068
+ break;
1069
+ }
1070
+
1071
+ var label = migrating_stage_label;
1072
+
1073
+ if ( 'completed' === stage ) {
1074
+ label = completed_stage_label;
1075
+ }
1076
+
1077
+ if ( 'push' === intent || 'pull' === intent ) {
1078
+ label = update_domain_placeholder( label, url, stage );
1079
+ }
1080
+
1081
+ return label;
1082
+ }
1083
+
1084
+ function remove_protocol( url ) {
1085
+ return url.replace( /^https?:/i, '' );
1086
+ }
1087
+
1088
+ function disable_export_type_controls() {
1089
+ $( '.option-group' ).each( function( index ) {
1090
+ $( 'input', this ).attr( 'disabled', 'disabled' );
1091
+ $( 'label', this ).css( 'cursor', 'default' );
1092
+ } );
1093
+ }
1094
+
1095
+ function enable_export_type_controls() {
1096
+ $( '.option-group' ).each( function( index ) {
1097
+ $( 'input', this ).removeAttr( 'disabled' );
1098
+ $( 'label', this ).css( 'cursor', 'pointer' );
1099
+ } );
1100
+ }
1101
+
1102
+ function set_slider_value( parent_selector, value, unit, display ) {
1103
+ var display_value = value;
1104
+
1105
+ if ( undefined !== display ) {
1106
+ display_value = display;
1107
+ }
1108
+
1109
+ $( '.slider', parent_selector ).slider( 'value', parseInt( value ) );
1110
+ $( '.amount', parent_selector ).html( wpmdb_add_commas( display_value ) + ' ' + unit );
1111
+ }
1112
+
1113
+ function set_pause_resume_button( event ) {
1114
+ if ( true === migration_paused ) {
1115
+ migration_paused = false;
1116
+ doing_ajax = true;
1117
+
1118
+ wpmdb.current_migration.setState( previous_progress_title, previous_progress_text_primary, 'active' );
1119
+ $( '.pause-resume' ).html( wpmdb_strings.pause );
1120
+
1121
+ // Resume the timer
1122
+ wpmdb.current_migration.resumeTimer();
1123
+
1124
+ wpmdb.functions.execute_next_step();
1125
+ } else {
1126
+ migration_paused = true;
1127
+ doing_ajax = false;
1128
+ paused_text = wpmdb_strings.migration_paused;
1129
+ previous_progress_title = $( '.progress-title' ).html();
1130
+ previous_progress_text_primary = $( '.progress-text', '.progress-wrapper-primary' ).html();
1131
+ previous_progress_text_secondary = $( '.progress-text', '.progress-wrapper-secondary ' ).html();
1132
+
1133
+ if ( 'find_replace' === migration_intent ) {
1134
+ paused_text = wpmdb_strings.find_replace_paused;
1135
+ }
1136
+
1137
+ wpmdb.current_migration.setState( paused_text, wpmdb_strings.completing_current_request, null );
1138
+ $( 'body' ).off( 'click', '.pause-resume' ); // Is re-bound at execute_next_step when migration is finally paused
1139
+ $( 'body' ).off( 'click', '.cancel' ); // Is re-bound at execute_next_step when migration is finally paused
1140
+ }
1141
+ }
1142
+
1143
+ function create_table_select( tables, table_sizes_hr, selected_tables ) {
1144
+ var $table_select = document.createElement( 'select' );
1145
+ $( $table_select ).attr( {
1146
+ multiple: 'multiple',
1147
+ name: 'select_tables[]',
1148
+ id: 'select-tables',
1149
+ class: 'multiselect'
1150
+ } );
1151
+
1152
+ if ( 0 < tables.length ) {
1153
+ $.each( tables, function( index, table ) {
1154
+ if ( $.wpmdb.apply_filters( 'wpmdb_exclude_table', false, table ) ) {
1155
+ return;
1156
+ }
1157
+
1158
+ var selected = ' ';
1159
+ if ( undefined !== selected_tables && null !== selected_tables && 0 < selected_tables.length && -1 !== $.inArray( table, selected_tables ) ) {
1160
+ selected = ' selected="selected" ';
1161
+ }
1162
+ $( $table_select ).append( '<option' + selected + 'value="' + table + '">' + table + ' (' + table_sizes_hr[ table ] + ')</option>' );
1163
+ } );
1164
+ }
1165
+
1166
+ return $table_select;
1167
+ }
1168
+
1169
+ /**
1170
+ * Filter temporary tables out of create_table_select().
1171
+ *
1172
+ * @param exclude
1173
+ * @param table_name
1174
+ * @returns {bool}
1175
+ */
1176
+ function filter_temp_tables( exclude, table_name ) {
1177
+ var temp_prefix = wpmdb_data.this_temp_prefix;
1178
+
1179
+ if ( 'pull' === wpmdb_migration_type() && 'undefined' !== typeof wpmdb.common.connection_data && 'undefined' !== typeof wpmdb.common.connection_data.temp_prefix ) {
1180
+ temp_prefix = wpmdb.common.connection_data.temp_prefix;
1181
+ }
1182
+
1183
+ if ( temp_prefix === table_name.substring( 0, temp_prefix.length ) ) {
1184
+ return true;
1185
+ }
1186
+
1187
+ return exclude;
1188
+ }
1189
+ $.wpmdb.add_filter( 'wpmdb_exclude_table', filter_temp_tables );
1190
+
1191
+ /**
1192
+ * Returns tables selected for migration.
1193
+ *
1194
+ * @param value
1195
+ * @param args
1196
+ * @returns {string}
1197
+ *
1198
+ * Also handler for wpmdb_get_tables_to_migrate filter, disregards input values as it is the primary source.
1199
+ */
1200
+ function get_tables_to_migrate( value, args ) {
1201
+ var tables = '';
1202
+ var mig_type = wpmdb_migration_type();
1203
+ var table_intent = $( 'input[name=table_migrate_option]:checked' ).val();
1204
+
1205
+ // Grab tables as per what the user has selected from the multiselect box or all prefixed tables.
1206
+ if ( 'migrate_select' === table_intent ) {
1207
+ tables = $( '#select-tables' ).val();
1208
+ } else {
1209
+ if ( 'pull' !== mig_type && 'undefined' !== typeof wpmdb_data.this_prefixed_tables ) {
1210
+ tables = wpmdb_data.this_prefixed_tables;
1211
+ }
1212
+ if ( 'pull' === mig_type && 'undefined' !== typeof wpmdb.common.connection_data && 'undefined' !== typeof wpmdb.common.connection_data.prefixed_tables ) {
1213
+ tables = wpmdb.common.connection_data.prefixed_tables;
1214
+ }
1215
+ }
1216
+
1217
+ return tables;
1218
+ }
1219
+
1220
+ function get_table_prefix( value, args ) {
1221
+ return $( '.table-select-wrap .table-prefix' ).text();
1222
+ }
1223
+
1224
+ function lock_replace_url( lock ) {
1225
+ if ( true === lock ) {
1226
+ $( '.replace-row.pin .replace-right-col input[type="text"]' ).attr( 'readonly', 'readonly' );
1227
+ $( '.replace-row.pin .arrow-col' ).addClass( 'disabled' );
1228
+ } else {
1229
+ $( '.replace-row.pin .replace-right-col input[type="text"]' ).removeAttr( 'readonly' );
1230
+ $( '.replace-row.pin .arrow-col' ).removeClass( 'disabled' );
1231
+ }
1232
+ }
1233
+
1234
+ function set_connection_data( data ) {
1235
+ wpmdb.common.previous_connection_data = wpmdb.common.connection_data;
1236
+ wpmdb.common.connection_data = data;
1237
+ $.wpmdb.do_action( 'wpmdb_connection_data_updated', data );
1238
+ }
1239
+
1240
+ /**
1241
+ * Returns formatted info for the Max Request Size slider.
1242
+ *
1243
+ * @param value
1244
+ * @return object
1245
+ */
1246
+ function get_max_request_display_info( value ) {
1247
+ var display_info = {};
1248
+
1249
+ display_info.unit = 'MB';
1250
+ display_info.amount = ( value / 1024 ).toFixed( 2 );
1251
+
1252
+ return display_info;
1253
+ }
1254
+
1255
+ $( document ).ready( function() {
1256
+ wpmdb.migration_state_id = '';
1257
+
1258
+ $( '#plugin-compatibility' ).change( function( e ) {
1259
+ var install = '1';
1260
+ var $status = $( this ).closest( 'td' ).next( 'td' ).find( '.setting-status' );
1261
+
1262
+ if ( $( this ).is( ':checked' ) ) {
1263
+ var answer = confirm( wpmdb_strings.mu_plugin_confirmation );
1264
+
1265
+ if ( ! answer ) {
1266
+ $( this ).prop( 'checked', false );
1267
+ return;
1268
+ }
1269
+ } else {
1270
+ install = '0';
1271
+ }
1272
+
1273
+ $( '.plugin-compatibility-wrap' ).toggle();
1274
+
1275
+ $status.find( '.ajax-success-msg' ).remove();
1276
+ $status.append( ajax_spinner );
1277
+ $( '#plugin-compatibility' ).attr( 'disabled', 'disabled' );
1278
+ $( '.plugin-compatibility' ).addClass( 'disabled' );
1279
+
1280
+ $.ajax( {
1281
+ url: ajaxurl,
1282
+ type: 'POST',
1283
+ dataType: 'text',
1284
+ cache: false,
1285
+ data: {
1286
+ action: 'wpmdb_plugin_compatibility',
1287
+ install: install,
1288
+ nonce: wpmdb_data.nonces.plugin_compatibility
1289
+ },
1290
+ error: function( jqXHR, textStatus, errorThrown ) {
1291
+ alert( wpmdb_strings.plugin_compatibility_settings_problem + '\r\n\r\n' + wpmdb_strings.status + ' ' + jqXHR.status + ' ' + jqXHR.statusText + '\r\n\r\n' + wpmdb_strings.response + '\r\n' + jqXHR.responseText );
1292
+ $( '.ajax-spinner' ).remove();
1293
+ $( '#plugin-compatibility' ).removeAttr( 'disabled' );
1294
+ $( '.plugin-compatibility' ).removeClass( 'disabled' );
1295
+ },
1296
+ success: function( data ) {
1297
+ if ( '' !== $.trim( data ) ) {
1298
+ alert( data );
1299
+ } else {
1300
+ $status.append( '<span class="ajax-success-msg">' + wpmdb_strings.saved + '</span>' );
1301
+ $( '.ajax-success-msg' ).fadeOut( 2000, function() {
1302
+ $( this ).remove();
1303
+ } );
1304
+ }
1305
+ $( '.ajax-spinner' ).remove();
1306
+ $( '#plugin-compatibility' ).removeAttr( 'disabled' );
1307
+ $( '.plugin-compatibility' ).removeClass( 'disabled' );
1308
+ }
1309
+ } );
1310
+
1311
+ } );
1312
+
1313
+ if ( $( '#plugin-compatibility' ).is( ':checked' ) ) {
1314
+ $( '.plugin-compatibility-wrap' ).show();
1315
+ }
1316
+
1317
+ if ( 0 <= navigator.userAgent.indexOf( 'MSIE' ) || 0 <= navigator.userAgent.indexOf( 'Trident' ) ) {
1318
+ $( '.ie-warning' ).show();
1319
+ }
1320
+
1321
+ if ( 0 === wpmdb_data.valid_licence ) {
1322
+ $( '#savefile' ).prop( 'checked', true );
1323
+ }
1324
+ var max_request_size_container = $( '.max-request-size' );
1325
+ var max_request_size_slider = $( '.slider', max_request_size_container );
1326
+ max_request_size_slider.slider( {
1327
+ range: 'min',
1328
+ value: parseInt( wpmdb_data.max_request / 1024 ),
1329
+ min: 512,
1330
+ max: parseInt( wpmdb_data.bottleneck / 1024 ),
1331
+ step: 256,
1332
+ create: function( event, ui ) {
1333
+ var display_info = get_max_request_display_info( wpmdb_data.max_request / 1024 );
1334
+ set_slider_value( max_request_size_container, wpmdb_data.max_request / 1024, display_info.unit, display_info.amount );
1335
+ },
1336
+ slide: function( event, ui ) {
1337
+ var display_info = get_max_request_display_info( ui.value );
1338
+ set_slider_value( max_request_size_container, ui.value, display_info.unit, display_info.amount );
1339
+ },
1340
+ stop: function( event, ui ) {
1341
+ $( '.slider-success-msg' ).remove();
1342
+ $( '.amount', max_request_size_container ).after( '<img src="' + spinner_url + '" alt="" class="slider-spinner general-spinner" />' );
1343
+ max_request_size_slider.slider( 'disable' );
1344
+
1345
+ $.ajax( {
1346
+ url: ajaxurl,
1347
+ type: 'POST',
1348
+ cache: false,
1349
+ data: {
1350
+ action: 'wpmdb_update_max_request_size',
1351
+ max_request_size: parseInt( ui.value ),
1352
+ nonce: wpmdb_data.nonces.update_max_request_size
1353
+ },
1354
+ error: function( jqXHR, textStatus, errorThrown ) {
1355
+ max_request_size_slider.slider( 'enable' );
1356
+ $( '.slider-spinner', max_request_size_container ).remove();
1357
+ alert( wpmdb_strings.max_request_size_problem );
1358
+ var display_info = get_max_request_display_info( wpmdb_data.max_request / 1024 );
1359
+ set_slider_value( max_request_size_container, wpmdb_data.max_request / 1024, display_info.unit, display_info.amount );
1360
+ max_request_size_slider.slider( 'enable' );
1361
+ },
1362
+ success: function() {
1363
+ max_request_size_slider.slider( 'enable' );
1364
+ $( '.slider-label-wrapper', max_request_size_container ).append( '<span class="slider-success-msg">' + wpmdb_strings.saved + '</span>' );
1365
+ $( '.slider-success-msg', max_request_size_container ).fadeOut( 2000, function() {
1366
+ $( this ).remove();
1367
+ } );
1368
+ $( '.slider-spinner', max_request_size_container ).remove();
1369
+ }
1370
+ } );
1371
+ }
1372
+ } );
1373
+
1374
+ var delay_between_requests_container = $( '.delay-between-requests' );
1375
+ var delay_between_requests_slider = $( '.slider', delay_between_requests_container );
1376
+ delay_between_requests_slider.slider( {
1377
+ range: 'min',
1378
+ value: parseInt( wpmdb_data.delay_between_requests / 1000 ),
1379
+ min: 0,
1380
+ max: 10,
1381
+ step: 1,
1382
+ create: function( event, ui ) {
1383
+ set_slider_value( delay_between_requests_container, wpmdb_data.delay_between_requests / 1000, 's' );
1384
+ },
1385
+ slide: function( event, ui ) {
1386
+ set_slider_value( delay_between_requests_container, ui.value, 's' );
1387
+ },
1388
+ stop: function( event, ui ) {
1389
+ $( '.slider-success-msg' ).remove();
1390
+ $( '.amount', delay_between_requests_container ).after( '<img src="' + spinner_url + '" alt="" class="slider-spinner general-spinner" />' );
1391
+ delay_between_requests_slider.slider( 'disable' );
1392
+
1393
+ $.ajax( {
1394
+ url: ajaxurl,
1395
+ type: 'POST',
1396
+ cache: false,
1397
+ data: {
1398
+ action: 'wpmdb_update_delay_between_requests',
1399
+ delay_between_requests: parseInt( ui.value * 1000 ),
1400
+ nonce: wpmdb_data.nonces.update_delay_between_requests
1401
+ },
1402
+ error: function( jqXHR, textStatus, errorThrown ) {
1403
+ delay_between_requests_slider.slider( 'enable' );
1404
+ $( '.slider-spinner', delay_between_requests_container ).remove();
1405
+ alert( wpmdb_strings.delay_between_requests_problem );
1406
+ set_slider_value( delay_between_requests_container, wpmdb_data.delay_between_requests / 1000, 's' );
1407
+ delay_between_requests_slider.slider( 'enable' );
1408
+ },
1409
+ success: function() {
1410
+ wpmdb_data.delay_between_requests = parseInt( ui.value * 1000 );
1411
+ delay_between_requests_slider.slider( 'enable' );
1412
+ $( '.slider-label-wrapper', delay_between_requests_container ).append( '<span class="slider-success-msg">' + wpmdb_strings.saved + '</span>' );
1413
+ $( '.slider-success-msg', delay_between_requests_container ).fadeOut( 2000, function() {
1414
+ $( this ).remove();
1415
+ } );
1416
+ $( '.slider-spinner', delay_between_requests_container ).remove();
1417
+ }
1418
+ } );
1419
+ }
1420
+ } );
1421
+
1422
+ var $push_select = $( '#select-tables' ).clone();
1423
+ var $pull_select = $( '#select-tables' ).clone();
1424
+ var $push_post_type_select = $( '#select-post-types' ).clone();
1425
+ var $pull_post_type_select = $( '#select-post-types' ).clone();
1426
+ var $push_select_backup = $( '#select-backup' ).clone();
1427
+ var $pull_select_backup = $( '#select-backup' ).clone();
1428
+
1429
+ $( '.help-tab .video' ).each( function() {
1430
+ var $container = $( this ),
1431
+ $viewer = $( '.video-viewer' );
1432
+
1433
+ $( 'a', this ).click( function( e ) {
1434
+ e.preventDefault();
1435
+
1436
+ $viewer.attr( 'src', '//www.youtube.com/embed/' + $container.data( 'video-id' ) + '?autoplay=1' );
1437
+ $viewer.show();
1438
+ var offset = $viewer.offset();
1439
+ $( window ).scrollTop( offset.top - 50 );
1440
+ } );
1441
+ } );
1442
+
1443
+ $( '.backup-options' ).show();
1444
+ $( '.keep-active-plugins' ).show();
1445
+ if ( 'savefile' === wpmdb_migration_type() ) {
1446
+ $( '.backup-options' ).hide();
1447
+ $( '.keep-active-plugins' ).hide();
1448
+ }
1449
+
1450
+ last_replace_switch = wpmdb_migration_type();
1451
+
1452
+ function check_licence( licence ) {
1453
+ var update_licence_content = ! doing_licence_registration_ajax;
1454
+ checked_licence = true;
1455
+ $.ajax( {
1456
+ url: ajaxurl,
1457
+ type: 'POST',
1458
+ dataType: 'json',
1459
+ cache: false,
1460
+ data: {
1461
+ action: 'wpmdb_check_licence',
1462
+ licence: licence,
1463
+ context: 'all',
1464
+ nonce: wpmdb_data.nonces.check_licence
1465
+ },
1466
+ error: function( jqXHR, textStatus, errorThrown ) {
1467
+ alert( wpmdb_strings.license_check_problem );
1468
+ },
1469
+ success: function( data ) {
1470
+
1471
+ var $support_content = $( '.support-content' );
1472
+ var $addons_content = $( '.addons-content' );
1473
+ var $licence_content = $( '.licence-status:not(.notification-message)' );
1474
+ var licence_msg, support_msg, addons_msg;
1475
+
1476
+ if ( 'undefined' !== typeof data.dbrains_api_down ) {
1477
+ support_msg = data.dbrains_api_down + data.message;
1478
+ addons_msg = data.dbrains_api_down;
1479
+ } else if ( 'undefined' !== typeof data.errors ) {
1480
+
1481
+ if ( 'undefined' !== typeof data.errors.subscription_expired ) {
1482
+ licence_msg = data.errors.subscription_expired.licence;
1483
+ support_msg = data.errors.subscription_expired.support;
1484
+ addons_msg = data.errors.subscription_expired.addons;
1485
+ } else {
1486
+ var msg = '';
1487
+ for ( var key in data.errors ) {
1488
+ msg += data.errors[ key ];
1489
+ }
1490
+ support_msg = msg;
1491
+ addons_msg = msg;
1492
+ }
1493
+ if ( 'undefined' !== typeof data.addon_content ) {
1494
+ addons_msg += '\n' + data.addon_content;
1495
+ }
1496
+ } else {
1497
+ support_msg = data.message;
1498
+ addons_msg = data.addon_content;
1499
+ }
1500
+
1501
+ if ( update_licence_content ) {
1502
+ $licence_content.stop().fadeOut( fade_duration, function() {
1503
+ if ( 'undefined' === typeof licence_msg ) {
1504
+ $( this ).css( { visibility: 'hidden', display: 'block' } ).slideUp();
1505
+ licence_msg = '';
1506
+ }
1507
+
1508
+ $( this )
1509
+ .empty()
1510
+ .html( licence_msg )
1511
+ .stop()
1512
+ .fadeIn( fade_duration );
1513
+ } );
1514
+ }
1515
+
1516
+ $support_content.stop().fadeOut( fade_duration, function() {
1517
+ $( this )
1518
+ .empty()
1519
+ .html( support_msg )
1520
+ .stop()
1521
+ .fadeIn( fade_duration );
1522
+ } );
1523
+ $addons_content.stop().fadeOut( fade_duration, function() {
1524
+ $( this )
1525
+ .empty()
1526
+ .html( addons_msg )
1527
+ .stop()
1528
+ .fadeIn( fade_duration );
1529
+ } );
1530
+
1531
+ }
1532
+ } );
1533
+ }
1534
+
1535
+ /**
1536
+ * Handle 'Check License Again' functionality found in expired license messages.
1537
+ */
1538
+ $( '.content-tab' ).on( 'click', '.check-my-licence-again', function( e ) {
1539
+ e.preventDefault();
1540
+ checked_licence = false;
1541
+ $( e.target ).replaceWith( 'Checking... ' + ajax_spinner );
1542
+ check_licence( null, 'all' );
1543
+ } );
1544
+ function refresh_table_selects() {
1545
+ if ( undefined !== wpmdb_data && undefined !== wpmdb_data.this_tables && undefined !== wpmdb_data.this_table_sizes_hr ) {
1546
+ $push_select = create_table_select( wpmdb_data.this_tables, wpmdb_data.this_table_sizes_hr, $( $push_select ).val() );
1547
+ }
1548
+
1549
+ if ( undefined !== wpmdb.common.connection_data && undefined !== wpmdb.common.connection_data.tables && undefined !== wpmdb.common.connection_data.table_sizes_hr ) {
1550
+ $pull_select = create_table_select( wpmdb.common.connection_data.tables, wpmdb.common.connection_data.table_sizes_hr, $( $pull_select ).val() );
1551
+ }
1552
+ }
1553
+
1554
+ $.wpmdb.add_action( 'wpmdb_refresh_table_selects', refresh_table_selects );
1555
+
1556
+ function update_push_table_select() {
1557
+ $( '#select-tables' ).remove();
1558
+ $( '.select-tables-wrap' ).prepend( $push_select );
1559
+ $( '#select-tables' ).change();
1560
+ }
1561
+
1562
+ $.wpmdb.add_action( 'wpmdb_update_push_table_select', update_push_table_select );
1563
+
1564
+ function update_pull_table_select() {
1565
+ $( '#select-tables' ).remove();
1566
+ $( '.select-tables-wrap' ).prepend( $pull_select );
1567
+ $( '#select-tables' ).change();
1568
+ }
1569
+
1570
+ $.wpmdb.add_action( 'wpmdb_update_pull_table_select', update_pull_table_select );
1571
+
1572
+ function disable_table_migration_options() {
1573
+ $( '#migrate-selected' ).parents( '.option-section' ).children( '.header-expand-collapse' ).children( '.expand-collapse-arrow' ).removeClass( 'collapsed' );
1574
+ $( '.table-select-wrap' ).show();
1575
+ $( '#migrate-only-with-prefix' ).prop( 'checked', false );
1576
+ $( '#migrate-selected' ).prop( 'checked', true );
1577
+ $( '.table-migrate-options' ).hide();
1578
+ $( '.select-tables-wrap' ).show();
1579
+ }
1580
+
1581
+ $.wpmdb.add_action( 'wpmdb_disable_table_migration_options', disable_table_migration_options );
1582
+
1583
+ function enable_table_migration_options() {
1584
+ $( '.table-migrate-options' ).show();
1585
+ }
1586
+
1587
+ $.wpmdb.add_action( 'wpmdb_enable_table_migration_options', enable_table_migration_options );
1588
+
1589
+ function select_all_tables() {
1590
+ $( '#select-tables' ).children( 'option' ).prop( 'selected', true );
1591
+ $( '#select-tables' ).change();
1592
+ }
1593
+
1594
+ $.wpmdb.add_action( 'wpmdb_select_all_tables', select_all_tables );
1595
+
1596
+ function base_old_url( value, args ) {
1597
+ return remove_protocol( wpmdb_data.this_url );
1598
+ }
1599
+
1600
+ $.wpmdb.add_filter( 'wpmdb_base_old_url', base_old_url );
1601
+
1602
+ function establish_remote_connection_from_saved_profile() {
1603
+ var action = wpmdb_migration_type();
1604
+ var connection_info = $.trim( $( '.pull-push-connection-info' ).val() ).split( '\n' );
1605
+ if ( 'undefined' === typeof wpmdb_default_profile ||
1606
+ true === wpmdb_default_profile ||
1607
+ 'savefile' === action ||
1608
+ 'find_replace' === action ||
1609
+ doing_ajax ||
1610
+ ! wpmdb_data.is_pro ) {
1611
+ return;
1612
+ }
1613
+
1614
+ doing_ajax = true;
1615
+ disable_export_type_controls();
1616
+
1617
+ $( '.connection-status' ).html( wpmdb_strings.establishing_remote_connection );
1618
+ $( '.connection-status' ).removeClass( 'notification-message error-notice migration-error' );
1619
+ $( '.connection-status' ).append( ajax_spinner );
1620
+
1621
+ var intent = wpmdb_migration_type();
1622
+
1623
+ $.ajax( {
1624
+ url: ajaxurl,
1625
+ type: 'POST',
1626
+ dataType: 'json',
1627
+ cache: false,
1628
+ data: {
1629
+ action: 'wpmdb_verify_connection_to_remote_site',
1630
+ url: connection_info[ 0 ],
1631
+ key: connection_info[ 1 ],
1632
+ intent: intent,
1633
+ nonce: wpmdb_data.nonces.verify_connection_to_remote_site,
1634
+ convert_post_type_selection: wpmdb_convert_post_type_selection,
1635
+ profile: wpmdb_data.profile
1636
+ },
1637
+ error: function( jqXHR, textStatus, errorThrown ) {
1638
+ $( '.connection-status' ).html( get_ajax_errors( jqXHR.responseText, '(#102)', jqXHR ) );
1639
+ $( '.connection-status' ).addClass( 'notification-message error-notice migration-error' );
1640
+ $( '.ajax-spinner' ).remove();
1641
+ doing_ajax = false;
1642
+ enable_export_type_controls();
1643
+ },
1644
+ success: function( data ) {
1645
+ $( '.ajax-spinner' ).remove();
1646
+ doing_ajax = false;
1647
+ enable_export_type_controls();
1648
+
1649
+ if ( 'undefined' !== typeof data.wpmdb_error && 1 === data.wpmdb_error ) {
1650
+ $( '.connection-status' ).html( data.body );
1651
+ $( '.connection-status' ).addClass( 'notification-message error-notice migration-error' );
1652
+
1653
+ if ( data.body.indexOf( '401 Unauthorized' ) > -1 ) {
1654
+ $( '.basic-access-auth-wrapper' ).show();
1655
+ }
1656
+
1657
+ return;
1658
+ }
1659
+
1660
+ maybe_show_ssl_warning( connection_info[ 0 ], connection_info[ 1 ], data.scheme );
1661
+ maybe_show_prefix_notice( data.prefix );
1662
+
1663
+ $( '.pull-push-connection-info' ).addClass( 'temp-disabled' );
1664
+ $( '.pull-push-connection-info' ).attr( 'readonly', 'readonly' );
1665
+ $( '.connect-button' ).hide();
1666
+
1667
+ $( '.connection-status' ).hide();
1668
+ $( '.step-two' ).show();
1669
+ connection_established = true;
1670
+ set_connection_data( data );
1671
+ move_connection_info_box();
1672
+
1673
+ maybe_show_mixed_cased_table_name_warning();
1674
+
1675
+ var loaded_tables = '';
1676
+ if ( false === wpmdb_default_profile && 'undefined' !== typeof wpmdb_loaded_tables ) {
1677
+ loaded_tables = wpmdb_loaded_tables;
1678
+ }
1679
+
1680
+ $pull_select = create_table_select( wpmdb.common.connection_data.tables, wpmdb.common.connection_data.table_sizes_hr, loaded_tables );
1681
+
1682
+ var loaded_post_types = '';
1683
+ if ( false === wpmdb_default_profile && 'undefined' !== typeof wpmdb_loaded_post_types ) {
1684
+ if ( 'undefined' !== typeof data.select_post_types ) {
1685
+ $( '#exclude-post-types' ).attr( 'checked', 'checked' );
1686
+ $( '.post-type-select-wrap' ).show();
1687
+ loaded_post_types = data.select_post_types;
1688
+ } else {
1689
+ loaded_post_types = wpmdb_loaded_post_types;
1690
+ }
1691
+ }
1692
+
1693
+ var $post_type_select = document.createElement( 'select' );
1694
+ $( $post_type_select ).attr( {
1695
+ multiple: 'multiple',
1696
+ name: 'select_post_types[]',
1697
+ id: 'select-post-types',
1698
+ class: 'multiselect'
1699
+ } );
1700
+
1701
+ $.each( wpmdb.common.connection_data.post_types, function( index, value ) {
1702
+ var selected = $.inArray( value, loaded_post_types );
1703
+ if ( -1 !== selected || ( true === wpmdb_convert_exclude_revisions && 'revision' !== value ) ) {
1704
+ selected = ' selected="selected" ';
1705
+ } else {
1706
+ selected = ' ';
1707
+ }
1708
+ $( $post_type_select ).append( '<option' + selected + 'value="' + value + '">' + value + '</option>' );
1709
+ } );
1710
+
1711
+ $pull_post_type_select = $post_type_select;
1712
+
1713
+ var loaded_tables_backup = '';
1714
+ if ( false === wpmdb_default_profile && 'undefined' !== typeof wpmdb_loaded_tables_backup ) {
1715
+ loaded_tables_backup = wpmdb_loaded_tables_backup;
1716
+ }
1717
+
1718
+ var $table_select_backup = document.createElement( 'select' );
1719
+ $( $table_select_backup ).attr( {
1720
+ multiple: 'multiple',
1721
+ name: 'select_backup[]',
1722
+ id: 'select-backup',
1723
+ class: 'multiselect'
1724
+ } );
1725
+
1726
+ $.each( wpmdb.common.connection_data.tables, function( index, value ) {
1727
+ var selected = $.inArray( value, loaded_tables_backup );
1728
+ if ( -1 !== selected ) {
1729
+ selected = ' selected="selected" ';
1730
+ } else {
1731
+ selected = ' ';
1732
+ }
1733
+ $( $table_select_backup ).append( '<option' + selected + 'value="' + value + '">' + value + ' (' + wpmdb.common.connection_data.table_sizes_hr[ value ] + ')</option>' );
1734
+ } );
1735
+
1736
+ $push_select_backup = $table_select_backup;
1737
+
1738
+ if ( 'pull' === wpmdb_migration_type() ) {
1739
+ $.wpmdb.do_action( 'wpmdb_update_pull_table_select' );
1740
+ $( '#select-post-types' ).remove();
1741
+ $( '.exclude-post-types-warning' ).after( $pull_post_type_select );
1742
+ $( '#select-backup' ).remove();
1743
+ $( '.backup-tables-wrap' ).prepend( $pull_select_backup );
1744
+ $( '.table-prefix' ).html( data.prefix );
1745
+ $( '.uploads-dir' ).html( wpmdb_data.this_uploads_dir );
1746
+ } else {
1747
+ $( '#select-backup' ).remove();
1748
+ $( '.backup-tables-wrap' ).prepend( $push_select_backup );
1749
+ }
1750
+
1751
+ $.wpmdb.do_action( 'verify_connection_to_remote_site', wpmdb.common.connection_data );
1752
+ }
1753
+
1754
+ } );
1755
+
1756
+ }
1757
+
1758
+ // automatically validate connection info if we're loading a saved profile
1759
+ establish_remote_connection_from_saved_profile();
1760
+
1761
+ // add to <a> tags which act as JS event buttons, will not jump page to top and will deselect the button
1762
+ $( 'body' ).on( 'click', '.js-action-link', function( e ) {
1763
+ e.preventDefault();
1764
+ $( this ).blur();
1765
+ } );
1766
+
1767
+ function enable_pro_licence( data, licence_key ) {
1768
+ $( '.licence-input, .register-licence' ).remove();
1769
+ $( '.licence-not-entered' ).prepend( data.masked_licence );
1770
+ $( '.support-content' ).empty().html( '<p>' + wpmdb_strings.fetching_license + '<img src="' + spinner_url + '" alt="" class="ajax-spinner general-spinner" /></p>' );
1771
+ check_licence( licence_key );
1772
+
1773
+ $( '.migrate-selection label' ).removeClass( 'disabled' );
1774
+ $( '.migrate-selection input' ).removeAttr( 'disabled' );
1775
+ }
1776
+
1777
+ $( '.licence-input' ).keypress( function( e ) {
1778
+ if ( 13 === e.which ) {
1779
+ e.preventDefault();
1780
+ $( '.register-licence' ).click();
1781
+ }
1782
+ } );
1783
+
1784
+ // registers your licence
1785
+ $( 'body' ).on( 'click', '.register-licence', function( e ) {
1786
+ e.preventDefault();
1787
+
1788
+ if ( doing_licence_registration_ajax ) {
1789
+ return;
1790
+ }
1791
+
1792
+ var licence_key = $.trim( $( '.licence-input' ).val() );
1793
+ var $licence_status = $( '.licence-status' );
1794
+
1795
+ $licence_status.removeClass( 'notification-message error-notice success-notice' );
1796
+
1797
+ if ( '' === licence_key ) {
1798
+ $licence_status.html( '<div class="notification-message error-notice">' + wpmdb_strings.enter_license_key + '</div>' );
1799
+ return;
1800
+ }
1801
+
1802
+ $licence_status.empty().removeClass( 'success' );
1803
+ doing_licence_registration_ajax = true;
1804
+ $( '.button.register-licence' ).after( '<img src="' + spinner_url + '" alt="" class="register-licence-ajax-spinner general-spinner" />' );
1805
+
1806
+ $.ajax( {
1807
+ url: ajaxurl,
1808
+ type: 'POST',
1809
+ dataType: 'JSON',
1810
+ cache: false,
1811
+ data: {
1812
+ action: 'wpmdb_activate_licence',
1813
+ licence_key: licence_key,
1814
+ nonce: wpmdb_data.nonces.activate_licence,
1815
+ context: 'licence'
1816
+ },
1817
+ error: function( jqXHR, textStatus, errorThrown ) {
1818
+ doing_licence_registration_ajax = false;
1819
+ $( '.register-licence-ajax-spinner' ).remove();
1820
+ $licence_status.html( wpmdb_strings.register_license_problem );
1821
+ },
1822
+ success: function( data ) {
1823
+ $( '.register-licence-ajax-spinner' ).remove();
1824
+
1825
+ if ( 'undefined' !== typeof data.errors ) {
1826
+ var msg = '';
1827
+ for ( var key in data.errors ) {
1828
+ msg += data.errors[ key ];
1829
+ }
1830
+ $licence_status.html( msg );
1831
+
1832
+ if ( 'undefined' !== typeof data.masked_licence ) {
1833
+ enable_pro_licence( data, licence_key );
1834
+ $( '.migrate-tab .invalid-licence' ).hide();
1835
+ }
1836
+ } else if ( 'undefined' !== typeof data.wpmdb_error && 'undefined' !== typeof data.body ) {
1837
+ $licence_status.html( data.body );
1838
+ } else {
1839
+ if ( 1 === Number( data.is_first_activation ) ) {
1840
+ wpmdb_strings.welcome_text = wpmdb_strings.welcome_text.replace( '%1$s', 'https://deliciousbrains.com/wp-migrate-db-pro/doc/quick-start-guide/' );
1841
+ wpmdb_strings.welcome_text = wpmdb_strings.welcome_text.replace( '%2$s', 'https://deliciousbrains.com/wp-migrate-db-pro/videos/' );
1842
+
1843
+ $licence_status.after(
1844
+ '<div id="welcome-wrap">' +
1845
+ '<img id="welcome-img" src="' + wpmdb_data.this_plugin_url + 'asset/dist/img/welcome.jpg" />' +
1846
+ '<div class="welcome-text">' +
1847
+ '<h3>' + wpmdb_strings.welcome_title + '</h3>' +
1848
+ '<p>' + wpmdb_strings.welcome_text + '</p>' +
1849
+ '</div>' +
1850
+ '</div>'
1851
+ );
1852
+ }
1853
+
1854
+ $licence_status.html( wpmdb_strings.license_registered ).delay( 5000 ).fadeOut( 1000, function() {
1855
+ $( this ).css( { visibility: 'hidden', display: 'block' } ).slideUp();
1856
+ } );
1857
+ $licence_status.addClass( 'success notification-message success-notice' );
1858
+ enable_pro_licence( data, licence_key );
1859
+ $( '.invalid-licence' ).hide();
1860
+ }
1861
+
1862
+ doing_licence_registration_ajax = false;
1863
+ }
1864
+ } );
1865
+
1866
+ } );
1867
+
1868
+ // clears the debug log
1869
+ $( '.clear-log' ).click( function() {
1870
+ $( '.ajax-spinner, .ajax-success-msg' ).remove();
1871
+ $( this ).after( ajax_spinner );
1872
+ $( '.debug-log-textarea' ).val( '' );
1873
+ $.ajax( {
1874
+ url: ajaxurl,
1875
+ type: 'POST',
1876
+ dataType: 'text',
1877
+ cache: false,
1878
+ data: {
1879
+ action: 'wpmdb_clear_log',
1880
+ nonce: wpmdb_data.nonces.clear_log
1881
+ },
1882
+ error: function( jqXHR, textStatus, errorThrown ) {
1883
+ $( '.ajax-spinner' ).remove();
1884
+ alert( wpmdb_strings.clear_log_problem );
1885
+ },
1886
+ success: function( data ) {
1887
+ $( '.ajax-spinner, .ajax-success-msg' ).remove();
1888
+ refresh_debug_log();
1889
+ $( '.clear-log' ).after( '<span class="ajax-success-msg">' + wpmdb_strings.clear_error_log + '</span>' );
1890
+ $( '.ajax-success-msg' ).fadeOut( 2000, function() {
1891
+ $( this ).remove();
1892
+ } );
1893
+ }
1894
+ } );
1895
+ } );
1896
+
1897
+ // updates the debug log when the user switches to the help tab
1898
+ function refresh_debug_log() {
1899
+ $.ajax( {
1900
+ url: ajaxurl,
1901
+ type: 'POST',
1902
+ dataType: 'text',
1903
+ cache: false,
1904
+ data: {
1905
+ action: 'wpmdb_get_log',
1906
+ nonce: wpmdb_data.nonces.get_log
1907
+ },
1908
+ error: function( jqXHR, textStatus, errorThrown ) {
1909
+ alert( wpmdb_strings.update_log_problem );
1910
+ },
1911
+ success: function( data ) {
1912
+ $( '.debug-log-textarea' ).val( data );
1913
+ }
1914
+ } );
1915
+ }
1916
+
1917
+ // select all tables
1918
+ $( '.multiselect-select-all' ).click( function() {
1919
+ var multiselect = $( this ).parents( '.select-wrap' ).children( '.multiselect' );
1920
+ $( 'option', multiselect ).prop( 'selected', 1 );
1921
+ $( multiselect ).focus().trigger( 'change' );
1922
+ } );
1923
+
1924
+ // deselect all tables
1925
+ $( '.multiselect-deselect-all' ).click( function() {
1926
+ var multiselect = $( this ).parents( '.select-wrap' ).children( '.multiselect' );
1927
+ $( 'option', multiselect ).removeAttr( 'selected' );
1928
+ $( multiselect ).focus().trigger( 'change' );
1929
+ } );
1930
+
1931
+ // invert table selection
1932
+ $( '.multiselect-invert-selection' ).click( function() {
1933
+ var multiselect = $( this ).parents( '.select-wrap' ).children( '.multiselect' );
1934
+ $( 'option', multiselect ).each( function() {
1935
+ $( this ).attr( 'selected', !$( this ).attr( 'selected' ) );
1936
+ } );
1937
+ $( multiselect ).focus().trigger( 'change' );
1938
+ } );
1939
+
1940
+ // on option select hide all "advanced" option divs and show the correct div for the option selected
1941
+ $( '.option-group input[type=radio]' ).change( function() {
1942
+ var group = $( this ).closest( '.option-group' );
1943
+ $( 'ul', group ).hide();
1944
+ var parent = $( this ).closest( 'li' );
1945
+ $( 'ul', parent ).show();
1946
+ } );
1947
+
1948
+ // on page load, expand hidden divs for selected options (browser form cache)
1949
+ $( '.option-group' ).each( function() {
1950
+ $( '.option-group input[type=radio]' ).each( function() {
1951
+ if ( $( this ).is( ':checked' ) ) {
1952
+ var parent = $( this ).closest( 'li' );
1953
+ $( 'ul', parent ).show();
1954
+ }
1955
+ } );
1956
+ } );
1957
+
1958
+ // expand and collapse content on click
1959
+ $( '.header-expand-collapse' ).click( function() {
1960
+ if ( $( '.expand-collapse-arrow', this ).hasClass( 'collapsed' ) ) {
1961
+ $( '.expand-collapse-arrow', this ).removeClass( 'collapsed' );
1962
+ $( this ).next().show();
1963
+ } else {
1964
+ $( '.expand-collapse-arrow', this ).addClass( 'collapsed' );
1965
+ $( this ).next().hide();
1966
+ }
1967
+ } );
1968
+
1969
+ $( '.checkbox-label input[type=checkbox]' ).change( function() {
1970
+ if ( $( this ).is( ':checked' ) ) {
1971
+ $( this ).parent().next().show();
1972
+ } else {
1973
+ $( this ).parent().next().hide();
1974
+ }
1975
+ } );
1976
+
1977
+ // warning for excluding post types
1978
+ $( '.select-post-types-wrap' ).on( 'change', '#select-post-types', function() {
1979
+ exclude_post_types_warning();
1980
+ } );
1981
+
1982
+ function exclude_post_types_warning() {
1983
+ var excluded_post_types = $( '#select-post-types' ).val();
1984
+ var excluded_post_types_text = '';
1985
+ var $exclude_post_types_warning = $( '.exclude-post-types-warning' );
1986
+ var $exclude_post_types_migrate_msg = $exclude_post_types_warning.find( '.migrate-msg' );
1987
+ var $exclude_post_types_find_replace_msg = $exclude_post_types_warning.find( '.find-replace-msg' );
1988
+
1989
+ if ( 'find_replace' === wpmdb_migration_type() ) {
1990
+ $exclude_post_types_migrate_msg.hide();
1991
+ $exclude_post_types_find_replace_msg.show();
1992
+ } else {
1993
+ $exclude_post_types_find_replace_msg.hide();
1994
+ $exclude_post_types_migrate_msg.show();
1995
+ }
1996
+
1997
+ if ( excluded_post_types ) {
1998
+ excluded_post_types_text = '<code>' + excluded_post_types.join( '</code>, <code>' ) + '</code>';
1999
+ $( '.excluded-post-types' ).html( excluded_post_types_text );
2000
+
2001
+ if ( '0' === $exclude_post_types_warning.css( 'opacity' ) ) {
2002
+ $exclude_post_types_warning
2003
+ .css( { opacity: 0 } )
2004
+ .slideDown( 200 )
2005
+ .animate( { opacity: 1 } );
2006
+ }
2007
+ } else {
2008
+ $exclude_post_types_warning
2009
+ .css( { opacity: 0 } )
2010
+ .slideUp( 200 )
2011
+ .animate( { opacity: 0 } );
2012
+ }
2013
+ }
2014
+
2015
+ if ( $( '#exclude-post-types' ).is( ':checked' ) ) {
2016
+ if ( $( '#select-post-types' ).val() ) {
2017
+ $( '.exclude-post-types-warning' ).css( { display: 'block', opacity: 1 } );
2018
+ }
2019
+ }
2020
+
2021
+ // special expand and collapse content on click for save migration profile
2022
+ $( '#save-migration-profile' ).change( function() {
2023
+ wpmdb.functions.update_migrate_button_text();
2024
+ if ( $( this ).is( ':checked' ) ) {
2025
+ $( '.save-settings-button' ).show();
2026
+ } else {
2027
+ $( '.save-settings-button' ).hide();
2028
+ }
2029
+ } );
2030
+
2031
+ if ( $( '#save-migration-profile' ).is( ':checked' ) ) {
2032
+ $( '.save-settings-button' ).show();
2033
+ }
2034
+
2035
+ $( '.create-new-profile' ).focus( function() {
2036
+ $( '#create_new' ).prop( 'checked', true );
2037
+ } );
2038
+
2039
+ $( '.checkbox-label input[type=checkbox]' ).each( function() {
2040
+ if ( $( this ).is( ':checked' ) ) {
2041
+ $( this ).parent().next().show();
2042
+ }
2043
+ } );
2044
+
2045
+ // AJAX migrate button
2046
+ $( '.migrate-db-button' ).click( function( event ) {
2047
+ $( this ).blur();
2048
+ event.preventDefault();
2049
+ wpmdb.migration_state_id = '';
2050
+
2051
+ if ( false === $.wpmdb.apply_filters( 'wpmdb_migration_profile_ready', true ) ) {
2052
+ return;
2053
+ }
2054
+
2055
+ // check that they've selected some tables to migrate
2056
+ if ( $( '#migrate-selected' ).is( ':checked' ) && null === $( '#select-tables' ).val() ) {
2057
+ alert( wpmdb_strings.please_select_one_table );
2058
+ return;
2059
+ }
2060
+
2061
+ // check that they've selected some tables to backup
2062
+ if ( 'savefile' !== wpmdb_migration_type() && $( '#backup-manual-select' ).is( ':checked' ) && null === $( '#select-backup' ).val() ) {
2063
+ alert( wpmdb_strings.please_select_one_table_backup );
2064
+ return;
2065
+ }
2066
+
2067
+ var new_url_missing = false;
2068
+ var new_file_path_missing = false;
2069
+ if ( $( '#new-url' ).length && !$( '#new-url' ).val() ) {
2070
+ $( '#new-url-missing-warning' ).show();
2071
+ $( '#new-url' ).focus();
2072
+ $( 'html,body' ).scrollTop( 0 );
2073
+ new_url_missing = true;
2074
+ }
2075
+
2076
+ if ( $( '#new-path' ).length && !$( '#new-path' ).val() ) {
2077
+ $( '#new-path-missing-warning' ).show();
2078
+ if ( false === new_url_missing ) {
2079
+ $( '#new-path' ).focus();
2080
+ $( 'html,body' ).scrollTop( 0 );
2081
+ }
2082
+ new_file_path_missing = true;
2083
+ }
2084
+
2085
+ if ( true === new_url_missing || true === new_file_path_missing ) {
2086
+ return;
2087
+ }
2088
+
2089
+ // also save profile
2090
+ if ( $( '#save-migration-profile' ).is( ':checked' ) ) {
2091
+ save_active_profile();
2092
+ }
2093
+
2094
+ form_data = $( $( '#migrate-form' )[0].elements ).not( '.auth-credentials' ).serialize();
2095
+
2096
+ migration_intent = wpmdb_migration_type();
2097
+
2098
+ stage = 'backup';
2099
+
2100
+ if ( 'savefile' === migration_intent ) {
2101
+ stage = 'migrate';
2102
+ }
2103
+
2104
+ if ( false === $( '#create-backup' ).is( ':checked' ) ) {
2105
+ stage = 'migrate';
2106
+ }
2107
+
2108
+ wpmdb.current_migration = wpmdb.migration_progress_controller.newMigration( {
2109
+ 'localTableSizes': wpmdb_data.this_table_sizes,
2110
+ 'localTableRows': wpmdb_data.this_table_rows,
2111
+ 'remoteTableSizes': 'undefined' !== typeof wpmdb.common.connection_data ? wpmdb.common.connection_data.table_sizes : null,
2112
+ 'remoteTableRows': 'undefined' !== typeof wpmdb.common.connection_data ? wpmdb.common.connection_data.table_rows : null,
2113
+ 'migrationIntent': wpmdb_migration_type()
2114
+ } );
2115
+
2116
+ var backup_option = $( 'input[name=backup_option]:checked' ).val();
2117
+ var table_option = $( 'input[name=table_migrate_option]:checked' ).val();
2118
+ var selected_tables = '';
2119
+ var data_type = '';
2120
+
2121
+ // set up backup stage
2122
+ if ( 'backup' === stage ) {
2123
+ if ( 'migrate_only_with_prefix' === table_option && 'backup_selected' === backup_option ) {
2124
+ backup_option = 'backup_only_with_prefix';
2125
+ }
2126
+ if ( 'push' === migration_intent ) {
2127
+ data_type = 'remote';
2128
+ if ( 'backup_only_with_prefix' === backup_option ) {
2129
+ tables_to_migrate = wpmdb.common.connection_data.prefixed_tables;
2130
+ } else if ( 'backup_selected' === backup_option ) {
2131
+ selected_tables = $( '#select-tables' ).val();
2132
+ selected_tables = $.wpmdb.apply_filters( 'wpmdb_backup_selected_tables', selected_tables );
2133
+ tables_to_migrate = get_intersect( selected_tables, wpmdb.common.connection_data.tables );
2134
+ } else if ( 'backup_manual_select' === backup_option ) {
2135
+ tables_to_migrate = $( '#select-backup' ).val();
2136
+ }
2137
+ } else {
2138
+ data_type = 'local';
2139
+ if ( 'backup_only_with_prefix' === backup_option ) {
2140
+ tables_to_migrate = wpmdb_data.this_prefixed_tables;
2141
+ } else if ( 'backup_selected' === backup_option ) {
2142
+ selected_tables = $( '#select-tables' ).val();
2143
+ selected_tables = $.wpmdb.apply_filters( 'wpmdb_backup_selected_tables', selected_tables );
2144
+ tables_to_migrate = get_intersect( selected_tables, wpmdb_data.this_tables );
2145
+ } else if ( 'backup_manual_select' === backup_option ) {
2146
+ tables_to_migrate = $( '#select-backup' ).val();
2147
+ }
2148
+ }
2149
+
2150
+ wpmdb.current_migration.model.addStage( 'backup', tables_to_migrate, data_type, {
2151
+ strings: {
2152
+ migrated: wpmdb_strings.backed_up
2153
+ }
2154
+ } );
2155
+ }
2156
+
2157
+ // set up migration stage
2158
+ if ( -1 !== $.inArray( migration_intent, [ 'push', 'savefile', 'find_replace' ] ) ) {
2159
+ data_type = 'local';
2160
+ } else {
2161
+ data_type = 'remote';
2162
+ }
2163
+
2164
+ if ( 'find_replace' === migration_intent ) {
2165
+ if ( 'backup' !== stage ) {
2166
+ stage = 'find_replace';
2167
+ }
2168
+
2169
+ wpmdb.current_migration.model.addStage( 'find_replace', get_tables_to_migrate( null, null ), data_type, {
2170
+ strings: {
2171
+ migrated: wpmdb_strings.searched,
2172
+ stage_title: wpmdb_strings.migrate_button_find_replace
2173
+ }
2174
+ } );
2175
+ } else {
2176
+ wpmdb.current_migration.model.addStage( 'migrate', get_tables_to_migrate( null, null ), data_type );
2177
+ }
2178
+
2179
+ // add any additional migration stages via hook
2180
+ $.wpmdb.do_action( 'wpmdb_add_migration_stages', {
2181
+ 'data_type': data_type,
2182
+ 'tables_to_migrate': get_tables_to_migrate( null, null )
2183
+ } );
2184
+
2185
+ var table_intent = $( 'input[name=table_migrate_option]:checked' ).val();
2186
+ var connection_info = $.trim( $( '.pull-push-connection-info' ).val() ).split( '\n' );
2187
+ var table_rows = '';
2188
+
2189
+ remote_site = connection_info[ 0 ];
2190
+ secret_key = connection_info[ 1 ];
2191
+
2192
+ var static_migration_label = get_migration_status_label( remote_site, migration_intent, 'migrating' );
2193
+ completed_msg = get_migration_status_label( remote_site, migration_intent, 'completed' );
2194
+
2195
+ if ( 'find_replace' === stage ) {
2196
+ tables_to_migrate = wpmdb.current_migration.model.getStageItems( 'find_replace', 'name' );
2197
+ } else if ( 'backup' === stage ) {
2198
+ tables_to_migrate = wpmdb.current_migration.model.getStageItems( 'backup', 'name' );
2199
+ } else {
2200
+ tables_to_migrate = wpmdb.current_migration.model.getStageItems( 'migrate', 'name' );
2201
+ }
2202
+
2203
+ wpmdb.current_migration.model.setActiveStage( stage );
2204
+
2205
+ wpmdb.current_migration.setTitle( static_migration_label );
2206
+
2207
+ wpmdb.current_migration.startTimer();
2208
+
2209
+ currently_migrating = true;
2210
+ wpmdb.current_migration.setStatus( 'active' );
2211
+
2212
+ var request_data = {
2213
+ action: 'wpmdb_initiate_migration',
2214
+ intent: migration_intent,
2215
+ url: remote_site,
2216
+ key: secret_key,
2217
+ form_data: form_data,
2218
+ stage: stage,
2219
+ nonce: wpmdb_data.nonces.initiate_migration
2220
+ };
2221
+
2222
+ request_data.site_details = {
2223
+ local: wpmdb_data.site_details
2224
+ };
2225
+
2226
+ if ( -1 === $.inArray( migration_intent, [ 'savefile', 'find_replace' ] ) ) {
2227
+ request_data.temp_prefix = wpmdb.common.connection_data.temp_prefix;
2228
+ request_data.site_details.remote = wpmdb.common.connection_data.site_details;
2229
+ }
2230
+
2231
+ // site_details can have a very large number of elements that blows out PHP's max_input_vars
2232
+ // so we reduce it down to one variable for this one POST.
2233
+ request_data.site_details = JSON.stringify( request_data.site_details );
2234
+
2235
+ doing_ajax = true;
2236
+
2237
+ $.ajax( {
2238
+ url: ajaxurl,
2239
+ type: 'POST',
2240
+ dataType: 'json',
2241
+ cache: false,
2242
+ data: request_data,
2243
+ error: function( jqXHR, textStatus, errorThrown ) {
2244
+
2245
+ wpmdb.current_migration.setState( wpmdb_strings.migration_failed, get_ajax_errors( jqXHR.responseText, '(#112)', jqXHR ), 'error' );
2246
+
2247
+ console.log( jqXHR );
2248
+ console.log( textStatus );
2249
+ console.log( errorThrown );
2250
+ doing_ajax = false;
2251
+ wpmdb.common.migration_error = true;
2252
+ wpmdb.functions.migration_complete_events();
2253
+ return;
2254
+ },
2255
+ success: function( data ) {
2256
+ doing_ajax = false;
2257
+ if ( 'undefined' !== typeof data && 'undefined' !== typeof data.wpmdb_error && 1 === data.wpmdb_error ) {
2258
+ wpmdb.common.migration_error = true;
2259
+ wpmdb.functions.migration_complete_events();
2260
+ wpmdb.current_migration.setState( wpmdb_strings.migration_failed, data.body, 'error' );
2261
+
2262
+ return;
2263
+ }
2264
+
2265
+ wpmdb.migration_state_id = data.migration_state_id;
2266
+
2267
+ var i = 0;
2268
+
2269
+ // Set delay between requests - use max of local/remote values, 0 if doing export
2270
+ delay_between_requests = 0;
2271
+ if ( 'savefile' !== migration_intent && 'undefined' !== typeof wpmdb.common.connection_data && 'undefined' !== typeof wpmdb.common.connection_data.delay_between_requests ) {
2272
+ delay_between_requests = Math.max( parseInt( wpmdb_data.delay_between_requests ), parseInt( wpmdb.common.connection_data.delay_between_requests ) );
2273
+ }
2274
+
2275
+ wpmdb.functions.migrate_table_recursive = function( current_row, primary_keys ) {
2276
+
2277
+ if ( i >= tables_to_migrate.length ) {
2278
+ if ( 'backup' === stage ) {
2279
+
2280
+ stage = 'migrate';
2281
+ if ( 'find_replace' === migration_intent ) {
2282
+ stage = 'find_replace';
2283
+ }
2284
+
2285
+ wpmdb.current_migration.model.setActiveStage( stage );
2286
+
2287
+ i = 0;
2288
+
2289
+ // should get from model
2290
+ tables_to_migrate = get_tables_to_migrate( null, null );
2291
+
2292
+ } else {
2293
+ $( '.progress-label' ).removeClass( 'label-visible' );
2294
+
2295
+ wpmdb.common.hooks = $.wpmdb.apply_filters( 'wpmdb_before_migration_complete_hooks', wpmdb.common.hooks );
2296
+ wpmdb.common.hooks.push( wpmdb.functions.migration_complete );
2297
+ wpmdb.common.hooks.push( wpmdb.functions.wpmdb_flush );
2298
+ wpmdb.common.hooks = $.wpmdb.apply_filters( 'wpmdb_after_migration_complete_hooks', wpmdb.common.hooks );
2299
+ wpmdb.common.hooks.push( wpmdb.functions.migration_complete_events );
2300
+ wpmdb.common.next_step_in_migration = { fn: wpmdb_call_next_hook };
2301
+ wpmdb.functions.execute_next_step();
2302
+ return;
2303
+ }
2304
+ }
2305
+
2306
+ var last_table = 0;
2307
+ if ( i === ( tables_to_migrate.length - 1 ) ) {
2308
+ last_table = 1;
2309
+ }
2310
+
2311
+ var gzip = 0;
2312
+ if ( 'savefile' !== migration_intent && 'find_replace' !== migration_intent && 1 === parseInt( wpmdb.common.connection_data.gzip ) ) {
2313
+ gzip = 1;
2314
+ }
2315
+
2316
+ var request_data = {
2317
+ action: 'wpmdb_migrate_table',
2318
+ migration_state_id: wpmdb.migration_state_id,
2319
+ table: tables_to_migrate[ i ],
2320
+ stage: stage,
2321
+ current_row: current_row,
2322
+ last_table: last_table,
2323
+ primary_keys: primary_keys,
2324
+ gzip: gzip,
2325
+ nonce: wpmdb_data.nonces.migrate_table
2326
+ };
2327
+
2328
+ if ( 'savefile' !== migration_intent && 'find_replace' !== migration_intent ) {
2329
+ request_data.bottleneck = wpmdb.common.connection_data.bottleneck;
2330
+ request_data.prefix = wpmdb.common.connection_data.prefix;
2331
+ }
2332
+
2333
+ if ( wpmdb.common.connection_data && wpmdb.common.connection_data.path_current_site && wpmdb.common.connection_data.domain ) {
2334
+ request_data.path_current_site = wpmdb.common.connection_data.path_current_site;
2335
+ request_data.domain_current_site = wpmdb.common.connection_data.domain;
2336
+ }
2337
+
2338
+ doing_ajax = true;
2339
+
2340
+ $.ajax( {
2341
+ url: ajaxurl,
2342
+ type: 'POST',
2343
+ dataType: 'text',
2344
+ cache: false,
2345
+ timeout: 0,
2346
+ data: request_data,
2347
+ error: function( jqXHR, textStatus, errorThrown ) {
2348
+ var progress_text = wpmdb_strings.table_process_problem + ' ' + tables_to_migrate[ i ] + '<br /><br />' + wpmdb_strings.status + ': ' + jqXHR.status + ' ' + jqXHR.statusText + '<br /><br />' + wpmdb_strings.response + ':<br />' + jqXHR.responseText;
2349
+ wpmdb.current_migration.setState( wpmdb_strings.migration_failed, progress_text, 'error' );
2350
+
2351
+ doing_ajax = false;
2352
+ console.log( jqXHR );
2353
+ console.log( textStatus );
2354
+ console.log( errorThrown );
2355
+ wpmdb.common.migration_error = true;
2356
+ wpmdb.functions.migration_complete_events();
2357
+ return;
2358
+ },
2359
+ success: function( data ) {
2360
+ doing_ajax = false;
2361
+ data = $.trim( data );
2362
+ var row_information = wpmdb_parse_json( data );
2363
+ var error_text = '';
2364
+
2365
+ if ( false === row_information || null === row_information ) {
2366
+
2367
+ // should update model
2368
+ if ( '' === data || null === data ) {
2369
+ error_text = wpmdb_strings.table_process_problem_empty_response + ' ' + tables_to_migrate[ i ];
2370
+ } else {
2371
+ error_text = get_ajax_errors( data, null, null );
2372
+ }
2373
+
2374
+ wpmdb.current_migration.setState( wpmdb_strings.migration_failed, error_text, 'error' );
2375
+ wpmdb.common.migration_error = true;
2376
+ wpmdb.functions.migration_complete_events();
2377
+ return;
2378
+ }
2379
+
2380
+ if ( 'undefined' !== typeof row_information.wpmdb_error && 1 === row_information.wpmdb_error ) {
2381
+ wpmdb.current_migration.setState( wpmdb_strings.migration_failed, row_information.body, 'error' );
2382
+ wpmdb.common.migration_error = true;
2383
+ wpmdb.functions.migration_complete_events();
2384
+ return;
2385
+ }
2386
+
2387
+ //successful iteration, update model
2388
+ wpmdb.current_migration.setText();
2389
+ wpmdb.current_migration.model.getStageModel( stage ).setItemRowsTransferred( tables_to_migrate[ i ], row_information.current_row );
2390
+
2391
+ // We need the returned file name for delivery or display to the user.
2392
+ if ( 1 === last_table && 'savefile' === migration_intent ) {
2393
+ if ( 'undefined' !== typeof row_information.dump_filename ) {
2394
+ dump_filename = row_information.dump_filename;
2395
+ }
2396
+ if ( 'undefined' !== typeof row_information.dump_path ) {
2397
+ dump_path = row_information.dump_path;
2398
+ }
2399
+ }
2400
+
2401
+ if ( -1 === parseInt( row_information.current_row ) ) {
2402
+ i++;
2403
+ row_information.current_row = '';
2404
+ row_information.primary_keys = '';
2405
+ }
2406
+
2407
+ wpmdb.common.next_step_in_migration = {
2408
+ fn: wpmdb.functions.migrate_table_recursive,
2409
+ args: [ row_information.current_row, row_information.primary_keys ]
2410
+ };
2411
+ wpmdb.functions.execute_next_step();
2412
+ }
2413
+ } );
2414
+
2415
+ };
2416
+
2417
+ wpmdb.common.next_step_in_migration = {
2418
+ fn: wpmdb.functions.migrate_table_recursive,
2419
+ args: [ '-1', '' ]
2420
+ };
2421
+ wpmdb.functions.execute_next_step();
2422
+
2423
+ }
2424
+
2425
+ } ); // end ajax
2426
+
2427
+ } );
2428
+
2429
+ wpmdb.functions.migration_complete_events = function() {
2430
+ if ( false === wpmdb.common.migration_error ) {
2431
+ if ( '' === wpmdb.common.non_fatal_errors ) {
2432
+ if ( 'savefile' !== migration_intent && true === $( '#save_computer' ).is( ':checked' ) ) {
2433
+ wpmdb.current_migration.setText();
2434
+ }
2435
+
2436
+ completed_msg = completed_msg + '&nbsp;<div class="dashicons dashicons-yes"></div>';
2437
+
2438
+ if ( true === migration_cancelled ) {
2439
+ var cancel_success = wpmdb_strings.migration_cancelled_success;
2440
+
2441
+ if ( 'find_replace' === migration_intent ) {
2442
+ cancel_success = wpmdb_strings.find_replace_cancelled_success;
2443
+ }
2444
+
2445
+ wpmdb.current_migration.setState( completed_msg, cancel_success, 'cancelled' );
2446
+ } else {
2447
+ wpmdb.current_migration.setState( completed_msg, '', 'complete' );
2448
+ }
2449
+
2450
+ } else {
2451
+ wpmdb.current_migration.setState( wpmdb_strings.completed_with_some_errors, wpmdb.common.non_fatal_errors, 'error' );
2452
+ }
2453
+ }
2454
+
2455
+ $( '.migration-controls' ).addClass( 'hidden' );
2456
+
2457
+ // reset migration variables so consecutive migrations work correctly
2458
+ wpmdb.common.hooks = [];
2459
+ wpmdb.common.call_stack = [];
2460
+ wpmdb.common.migration_error = false;
2461
+ currently_migrating = false;
2462
+ migration_completed = true;
2463
+ migration_paused = false;
2464
+ migration_cancelled = false;
2465
+ doing_ajax = false;
2466
+ wpmdb.common.non_fatal_errors = '';
2467
+
2468
+ $( '.progress-label' ).remove();
2469
+ $( '.migration-progress-ajax-spinner' ).remove();
2470
+ $( '.close-progress-content' ).show();
2471
+ $( '#overlay' ).css( 'cursor', 'pointer' );
2472
+ wpmdb.current_migration.model.setMigrationComplete();
2473
+ };
2474
+
2475
+ wpmdb.functions.migration_complete = function() {
2476
+
2477
+ $( '.migration-controls' ).addClass( 'hidden' );
2478
+
2479
+ if ( 'savefile' === migration_intent ) {
2480
+ currently_migrating = false;
2481
+ var migrate_complete_text = wpmdb_strings.migration_complete;
2482
+ if ( $( '#save_computer' ).is( ':checked' ) ) {
2483
+ var url = wpmdb_data.this_download_url + encodeURIComponent( dump_filename );
2484
+ if ( $( '#gzip_file' ).is( ':checked' ) ) {
2485
+ url += '&gzip=1';
2486
+ }
2487
+ window.location = url;
2488
+ } else {
2489
+ migrate_complete_text = wpmdb_strings.completed_dump_located_at + ' ' + dump_path;
2490
+ }
2491
+
2492
+ if ( false === wpmdb.common.migration_error ) {
2493
+
2494
+ wpmdb.functions.migration_complete_events();
2495
+ wpmdb.current_migration.setState( completed_msg, migrate_complete_text, 'complete' );
2496
+
2497
+ }
2498
+
2499
+ } else { // rename temp tables, delete old tables
2500
+
2501
+ wpmdb.current_migration.setState( null, wpmdb_strings.finalizing_migration, 'finalizing' );
2502
+
2503
+ var request_data = {
2504
+ action: 'wpmdb_finalize_migration',
2505
+ migration_state_id: wpmdb.migration_state_id,
2506
+ tables: tables_to_migrate.join( ',' ),
2507
+ nonce: wpmdb_data.nonces.finalize_migration
2508
+ };
2509
+
2510
+ if ( 'find_replace' !== migration_intent ) {
2511
+ request_data.prefix = wpmdb.common.connection_data.prefix;
2512
+ }
2513
+
2514
+ doing_ajax = true;
2515
+ $.ajax( {
2516
+ url: ajaxurl,
2517
+ type: 'POST',
2518
+ dataType: 'text',
2519
+ cache: false,
2520
+ data: request_data,
2521
+ error: function( jqXHR, textStatus, errorThrown ) {
2522
+ doing_ajax = false;
2523
+ wpmdb.current_migration.setState( wpmdb_strings.migration_failed, wpmdb_strings.finalize_tables_problem, 'error' );
2524
+
2525
+ alert( jqXHR + ' : ' + textStatus + ' : ' + errorThrown );
2526
+ wpmdb.common.migration_error = true;
2527
+ wpmdb.functions.migration_complete_events();
2528
+ return;
2529
+ },
2530
+ success: function( data ) {
2531
+ doing_ajax = false;
2532
+ if ( '1' !== $.trim( data ) ) {
2533
+ wpmdb.current_migration.setState( wpmdb_strings.migration_failed, data, 'error' );
2534
+
2535
+ wpmdb.common.migration_error = true;
2536
+ wpmdb.functions.migration_complete_events();
2537
+ return;
2538
+ }
2539
+ wpmdb.common.next_step_in_migration = { fn: wpmdb_call_next_hook };
2540
+ wpmdb.functions.execute_next_step();
2541
+ }
2542
+ } );
2543
+ }
2544
+ };
2545
+
2546
+ wpmdb.functions.wpmdb_flush = function() {
2547
+ if ( 'savefile' !== migration_intent ) {
2548
+ wpmdb.current_migration.setText( wpmdb_strings.flushing );
2549
+ doing_ajax = true;
2550
+ $.ajax( {
2551
+ url: ajaxurl,
2552
+ type: 'POST',
2553
+ dataType: 'text',
2554
+ cache: false,
2555
+ data: {
2556
+ action: 'wpmdb_flush',
2557
+ migration_state_id: wpmdb.migration_state_id,
2558
+ nonce: wpmdb_data.nonces.flush
2559
+ },
2560
+ error: function( jqXHR, textStatus, errorThrown ) {
2561
+ doing_ajax = false;
2562
+ wpmdb.current_migration.setState( wpmdb_strings.migration_failed, wpmdb_strings.flush_problem, 'error' );
2563
+
2564
+ alert( jqXHR + ' : ' + textStatus + ' : ' + errorThrown );
2565
+ wpmdb.common.migration_error = true;
2566
+ wpmdb.functions.migration_complete_events();
2567
+ return;
2568
+ },
2569
+ success: function( data ) {
2570
+ doing_ajax = false;
2571
+ if ( '1' !== $.trim( data ) ) {
2572
+ wpmdb.current_migration.setState( wpmdb_strings.migration_failed, data, 'error' );
2573
+
2574
+ wpmdb.common.migration_error = true;
2575
+ wpmdb.functions.migration_complete_events();
2576
+ return;
2577
+ }
2578
+ wpmdb.common.next_step_in_migration = { fn: wpmdb_call_next_hook };
2579
+ wpmdb.functions.execute_next_step();
2580
+ }
2581
+ } );
2582
+ }
2583
+ };
2584
+
2585
+ wpmdb.functions.update_migrate_button_text = function() {
2586
+ var migration_intent = wpmdb_migration_type();
2587
+ var save_string = ( $( '#save-migration-profile' ).is( ':checked' ) ) ? '_save' : '';
2588
+ var migrate_string = 'migrate_button_' + ( ( 'savefile' === migration_intent ) ? 'export' : migration_intent ) + save_string;
2589
+ $( '.migrate-db .button-primary' ).val( wpmdb_strings[ migrate_string ] );
2590
+ };
2591
+
2592
+ wpmdb.functions.update_migrate_button_text();
2593
+
2594
+ // close progress pop up once migration is completed
2595
+ $( 'body' ).on( 'click', '.close-progress-content-button', function( e ) {
2596
+ hide_overlay();
2597
+ wpmdb.current_migration.restoreTitleElem();
2598
+ } );
2599
+
2600
+ $( 'body' ).on( 'click', '#overlay', function( e ) {
2601
+ if ( true === migration_completed && e.target === this ) {
2602
+ hide_overlay();
2603
+ wpmdb.current_migration.restoreTitleElem();
2604
+ }
2605
+ } );
2606
+
2607
+ function hide_overlay() {
2608
+ $( '#overlay' ).removeClass( 'show' ).addClass( 'hide' );
2609
+ $( '#overlay > div' ).removeClass( 'show' ).addClass( 'hide' );
2610
+ wpmdb.current_migration.$proVersion.find( 'iframe' ).remove();
2611
+ setTimeout( function() {
2612
+ $( '#overlay' ).remove();
2613
+ }, 500 );
2614
+ migration_completed = false;
2615
+ }
2616
+
2617
+ // AJAX save button profile
2618
+ $( '.save-settings-button' ).click( function( event ) {
2619
+ event.preventDefault();
2620
+ if ( '' === $.trim( $( '.create-new-profile' ).val() ) && $( '#create_new' ).is( ':checked' ) ) {
2621
+ alert( wpmdb_strings.enter_name_for_profile );
2622
+ $( '.create-new-profile' ).focus();
2623
+ return;
2624
+ }
2625
+ save_active_profile();
2626
+ } );
2627
+
2628
+ function save_active_profile() {
2629
+ var profile;
2630
+ $( '.save-settings-button' ).blur();
2631
+
2632
+ if ( doing_save_profile ) {
2633
+ return;
2634
+ }
2635
+
2636
+ // check that they've selected some tables to migrate
2637
+ if ( $( '#migrate-selected' ).is( ':checked' ) && null === $( '#select-tables' ).val() ) {
2638
+ alert( wpmdb_strings.please_select_one_table );
2639
+ return;
2640
+ }
2641
+
2642
+ // check that they've selected some tables to backup
2643
+ if ( 'savefile' !== wpmdb_migration_type() && $( '#backup-manual-select' ).is( ':checked' ) && null === $( '#select-backup' ).val() ) {
2644
+ alert( wpmdb_strings.please_select_one_table_backup );
2645
+ return;
2646
+ }
2647
+
2648
+ var create_new_profile = false;
2649
+
2650
+ if ( $( '#create_new' ).is( ':checked' ) ) {
2651
+ create_new_profile = true;
2652
+ }
2653
+ var profile_name = $( '.create-new-profile' ).val();
2654
+
2655
+ doing_save_profile = true;
2656
+ profile = $( $( '#migrate-form' )[0].elements ).not( '.auth-credentials' ).serialize();
2657
+
2658
+ $( '.save-settings-button' ).attr( 'disabled', 'disabled' )
2659
+ .after( '<img src="' + spinner_url + '" alt="" class="save-profile-ajax-spinner general-spinner" />' );
2660
+
2661
+ doing_ajax = true;
2662
+
2663
+ $.ajax( {
2664
+ url: ajaxurl,
2665
+ type: 'POST',
2666
+ dataType: 'text',
2667
+ cache: false,
2668
+ data: {
2669
+ action: 'wpmdb_save_profile',
2670
+ profile: profile,
2671
+ nonce: wpmdb_data.nonces.save_profile
2672
+ },
2673
+ error: function( jqXHR, textStatus, errorThrown ) {
2674
+ doing_ajax = false;
2675
+ alert( wpmdb_strings.save_profile_problem );
2676
+ $( '.save-settings-button' ).removeAttr( 'disabled' );
2677
+ $( '.save-profile-ajax-spinner' ).remove();
2678
+ $( '.save-settings-button' ).after( '<span class="ajax-success-msg">' + wpmdb_strings.saved + '</span>' );
2679
+ $( '.ajax-success-msg' ).fadeOut( 2000, function() {
2680
+ $( this ).remove();
2681
+ } );
2682
+ doing_save_profile = false;
2683
+ },
2684
+ success: function( data ) {
2685
+ var updated_profile_id = parseInt( $( '#migrate-form input[name=save_migration_profile_option]:checked' ).val(), 10 ) + 1;
2686
+ doing_ajax = false;
2687
+ $( '.save-settings-button' ).removeAttr( 'disabled' );
2688
+ $( '.save-profile-ajax-spinner' ).remove();
2689
+ $( '.save-settings-button' ).after( '<span class="ajax-success-msg">' + wpmdb_strings.saved + '</span>' );
2690
+ $( '.ajax-success-msg' ).fadeOut( 2000, function() {
2691
+ $( this ).remove();
2692
+ } );
2693
+ doing_save_profile = false;
2694
+ $( '.create-new-profile' ).val( '' );
2695
+
2696
+ if ( create_new_profile ) {
2697
+ var new_profile_key = parseInt( data, 10 );
2698
+ var new_profile_id = new_profile_key + 1;
2699
+ var new_li = $( '<li><span class="delete-profile" data-profile-id="' + new_profile_id + '"></span><label for="profile-' + new_profile_id + '"><input id="profile-' + new_profile_id + '" value="' + new_profile_key + '" name="save_migration_profile_option" type="radio"></label></li>' );
2700
+ new_li.find( 'label' ).append( document.createTextNode( ' ' + profile_name ) );
2701
+ updated_profile_id = new_profile_id;
2702
+
2703
+ $( '#create_new' ).parents( 'li' ).before( new_li );
2704
+ $( '#profile-' + new_profile_id ).attr( 'checked', 'checked' );
2705
+ }
2706
+
2707
+ // Push updated profile id to history if available
2708
+ var updated_url = window.location.href.replace( '#migrate', '' ).replace( /&wpmdb-profile=-?\d+/, '' ) + '&wpmdb-profile=' + updated_profile_id;
2709
+ var updated_profile_name = $( '#migrate-form input[name=save_migration_profile_option]:checked' ).parent().text().trim();
2710
+
2711
+ if ( 'function' === typeof window.history.pushState ) {
2712
+ if ( $( '#migrate-form .crumbs' ).length ) {
2713
+ $( '#migrate-form .crumbs .crumb:last' ).text( updated_profile_name );
2714
+ } else {
2715
+ var $crumbs = $( '<div class="crumbs" />' )
2716
+ .append( '<a class="crumb" href="' + wpmdb_data.this_plugin_base + '"> Saved Profiles </a>' )
2717
+ .append( '<span class="crumb">' + updated_profile_name + '</span>' );
2718
+ $( '#migrate-form' ).prepend( $crumbs );
2719
+ }
2720
+ window.history.pushState( { updated_profile_id: updated_profile_id }, null, updated_url );
2721
+ }
2722
+ }
2723
+ } );
2724
+ }
2725
+
2726
+ // save file (export) / push / pull special conditions
2727
+ function move_connection_info_box() {
2728
+ $( '.connection-status' ).hide();
2729
+ $( '.prefix-notice' ).hide();
2730
+ $( '.ssl-notice' ).hide();
2731
+ $( '.different-plugin-version-notice' ).hide();
2732
+ $( '.step-two' ).show();
2733
+ $( '.backup-options' ).show();
2734
+ $( '.keep-active-plugins' ).show();
2735
+ $( '.directory-permission-notice' ).hide();
2736
+ $( '#create-backup' ).removeAttr( 'disabled' );
2737
+ $( '#create-backup-label' ).removeClass( 'disabled' );
2738
+ $( '.backup-option-disabled' ).hide();
2739
+ $( '.compatibility-older-mysql' ).hide();
2740
+ var connection_info = $.trim( $( '.pull-push-connection-info' ).val() ).split( '\n' );
2741
+ var profile_name;
2742
+ wpmdb_toggle_migration_action_text();
2743
+
2744
+ $.wpmdb.do_action( 'move_connection_info_box', {
2745
+ 'migration_type': wpmdb_migration_type(),
2746
+ 'last_migration_type': last_replace_switch
2747
+ } );
2748
+
2749
+ if ( 'pull' === wpmdb_migration_type() ) {
2750
+ $( '.pull-list li' ).append( $connection_info_box );
2751
+ $connection_info_box.show( function() {
2752
+ var connection_textarea = $( this ).find( '.pull-push-connection-info' );
2753
+ if ( ! connection_textarea.val() ) {
2754
+ connection_textarea.focus();
2755
+ }
2756
+ } );
2757
+ if ( ( 'push' === wpmdb.migration_selection || 'savefile' === wpmdb.migration_selection ) && 2 === connection_info.length ) {
2758
+ wpmdb.force_reconnect = true;
2759
+ $( '.pull-list li' ).append( $connection_info_box );
2760
+ $( '.pull-push-connection-info' ).removeClass( 'temp-disabled' ).attr( 'readonly', 'readonly' );
2761
+ $( '.connect-button' ).hide();
2762
+ connection_box_changed();
2763
+ return;
2764
+ }
2765
+ if ( connection_established ) {
2766
+ $( '.connection-status' ).hide();
2767
+ $( '.step-two' ).show();
2768
+ $( '.table-prefix' ).html( wpmdb.common.connection_data.prefix );
2769
+ $( '.backup-table-prefix' ).html( wpmdb_data.site_details.prefix );
2770
+ $( '.uploads-dir' ).html( wpmdb_data.this_uploads_dir );
2771
+ if ( false === profile_name_edited ) {
2772
+ profile_name = get_domain_name( wpmdb.common.connection_data.url );
2773
+ $( '.create-new-profile' ).val( profile_name );
2774
+ }
2775
+ if ( true === show_prefix_notice ) {
2776
+ $( '.prefix-notice.pull' ).show();
2777
+ }
2778
+ if ( true === show_ssl_notice ) {
2779
+ $( '.ssl-notice' ).show();
2780
+ }
2781
+ if ( true === show_version_notice ) {
2782
+ $( '.different-plugin-version-notice' ).show();
2783
+ $( '.step-two' ).hide();
2784
+ }
2785
+ wpmdb_toggle_migration_action_text();
2786
+ if ( false === wpmdb_data.write_permission ) {
2787
+ $( '#create-backup' ).prop( 'checked', false );
2788
+ $( '#create-backup' ).attr( 'disabled', 'disabled' );
2789
+ $( '#create-backup-label' ).addClass( 'disabled' );
2790
+ $( '.backup-option-disabled' ).show();
2791
+ $( '.upload-directory-location' ).html( wpmdb_data.this_upload_dir_long );
2792
+ }
2793
+ } else {
2794
+ $( '.connection-status' ).show();
2795
+ $( '.step-two' ).hide();
2796
+ }
2797
+ } else if ( 'push' === wpmdb_migration_type() ) {
2798
+ $( '.push-list li' ).append( $connection_info_box );
2799
+ $connection_info_box.show( function() {
2800
+ var connection_textarea = $( this ).find( '.pull-push-connection-info' );
2801
+ if ( ! connection_textarea.val() ) {
2802
+ connection_textarea.focus();
2803
+ }
2804
+ } );
2805
+ if ( ( 'pull' === wpmdb.migration_selection || 'savefile' === wpmdb.migration_selection ) && 2 === connection_info.length ) {
2806
+ wpmdb.force_reconnect = true;
2807
+ $( '.push-list li' ).append( $connection_info_box );
2808
+ $( '.pull-push-connection-info' ).removeClass( 'temp-disabled' ).attr( 'readonly', 'readonly' );
2809
+ $( '.connect-button' ).hide();
2810
+ connection_box_changed();
2811
+ return;
2812
+ }
2813
+ if ( connection_established ) {
2814
+ $( '.connection-status' ).hide();
2815
+ $( '.step-two' ).show();
2816
+ $( '.table-prefix' ).html( wpmdb_data.this_prefix );
2817
+ $( '.backup-table-prefix' ).html( wpmdb.common.connection_data.prefix );
2818
+ $( '.uploads-dir' ).html( wpmdb.common.connection_data.uploads_dir );
2819
+ if ( false === profile_name_edited ) {
2820
+ profile_name = get_domain_name( wpmdb.common.connection_data.url );
2821
+ $( '.create-new-profile' ).val( profile_name );
2822
+ }
2823
+ if ( true === show_prefix_notice ) {
2824
+ $( '.prefix-notice.push' ).show();
2825
+ }
2826
+ if ( true === show_ssl_notice ) {
2827
+ $( '.ssl-notice' ).show();
2828
+ }
2829
+ if ( true === show_version_notice ) {
2830
+ $( '.different-plugin-version-notice' ).show();
2831
+ $( '.step-two' ).hide();
2832
+ }
2833
+ wpmdb_toggle_migration_action_text();
2834
+ if ( '0' === wpmdb.common.connection_data.write_permissions ) {
2835
+ $( '#create-backup' ).prop( 'checked', false );
2836
+ $( '#create-backup' ).attr( 'disabled', 'disabled' );
2837
+ $( '#create-backup-label' ).addClass( 'disabled' );
2838
+ $( '.backup-option-disabled' ).show();
2839
+ $( '.upload-directory-location' ).html( wpmdb.common.connection_data.upload_dir_long );
2840
+ }
2841
+ } else {
2842
+ $( '.connection-status' ).show();
2843
+ $( '.step-two' ).hide();
2844
+ }
2845
+ } else if ( 'savefile' === wpmdb_migration_type() || 'find_replace' === wpmdb_migration_type() ) {
2846
+ $( '.connection-status' ).hide();
2847
+ $( '.step-two' ).show();
2848
+ $( '.table-prefix' ).html( wpmdb_data.this_prefix );
2849
+ $( '.compatibility-older-mysql' ).show();
2850
+ if ( false === profile_name_edited ) {
2851
+ $( '.create-new-profile' ).val( '' );
2852
+ }
2853
+
2854
+ if ( 'find_replace' !== wpmdb_migration_type() ) {
2855
+ $( '.backup-options' ).hide();
2856
+ }
2857
+
2858
+ $( '.keep-active-plugins' ).hide();
2859
+ if ( false === wpmdb_data.write_permission ) {
2860
+ $( '.directory-permission-notice' ).show();
2861
+ $( '.step-two' ).hide();
2862
+ }
2863
+
2864
+ if ( 'find_replace' === wpmdb_migration_type() ) {
2865
+ if ( 'true' === wpmdb_data.is_multisite ) {
2866
+ var $old_replace_col = $( '.old-replace-col' ).eq( 1 );
2867
+ $old_replace_col.parent().removeClass( 'pin' ).find( '.replace-remove-row' ).show();
2868
+ $old_replace_col.find( 'input' ).removeAttr( 'readonly' );
2869
+ }
2870
+ }
2871
+
2872
+ }
2873
+
2874
+ maybe_show_mixed_cased_table_name_warning();
2875
+ }
2876
+
2877
+ // move around textarea depending on whether or not the push/pull options are selected
2878
+ var $connection_info_box = $( '.connection-info-wrapper' );
2879
+ move_connection_info_box();
2880
+
2881
+ $( '.migrate-selection.option-group input[type=radio]' ).change( function() {
2882
+ move_connection_info_box();
2883
+ wpmdb.migration_selection = wpmdb_migration_type();
2884
+ if ( connection_established ) {
2885
+ change_replace_values();
2886
+ }
2887
+ wpmdb.functions.update_migrate_button_text();
2888
+ } );
2889
+
2890
+ function change_replace_values() {
2891
+ var old_url = null;
2892
+ var old_path = null;
2893
+ if ( null !== wpmdb.common.previous_connection_data && 'object' === typeof wpmdb.common.previous_connection_data && wpmdb.common.previous_connection_data.url !== wpmdb.common.connection_data.url ) {
2894
+ old_url = remove_protocol( wpmdb.common.previous_connection_data.url );
2895
+ old_path = wpmdb.common.previous_connection_data.path;
2896
+ }
2897
+
2898
+ if ( 'push' === wpmdb_migration_type() || 'savefile' === wpmdb_migration_type() ) {
2899
+ if ( 'pull' === last_replace_switch ) {
2900
+ $( '.replace-row' ).each( function() {
2901
+ var old_val = $( '.old-replace-col input', this ).val();
2902
+ $( '.old-replace-col input', this ).val( $( '.replace-right-col input', this ).val() );
2903
+ $( '.replace-right-col input', this ).val( old_val );
2904
+ } );
2905
+ } else if ( 'push' === last_replace_switch && 'push' === wpmdb_migration_type() && null !== old_url && null !== old_path ) {
2906
+ $( '.replace-row' ).each( function() {
2907
+ var old_val = $( '.replace-right-col input', this ).val();
2908
+ if ( old_val === old_path ) {
2909
+ $( '.replace-right-col input', this ).val( wpmdb.common.connection_data.path );
2910
+ }
2911
+ if ( old_val === old_url ) {
2912
+ $( '.replace-right-col input', this ).val( remove_protocol( wpmdb.common.connection_data.url ) );
2913
+ }
2914
+ } );
2915
+ }
2916
+ $.wpmdb.do_action( 'wpmdb_update_push_table_select' );
2917
+ $( '#select-post-types' ).remove();
2918
+ $( '.exclude-post-types-warning' ).after( $push_post_type_select );
2919
+ exclude_post_types_warning();
2920
+ $( '#select-backup' ).remove();
2921
+ $( '.backup-tables-wrap' ).prepend( $push_select_backup );
2922
+ } else if ( 'pull' === wpmdb_migration_type() ) {
2923
+ if ( '' === last_replace_switch || 'push' === last_replace_switch || 'savefile' === last_replace_switch ) {
2924
+ $( '.replace-row' ).each( function() {
2925
+ var old_val = $( '.old-replace-col input', this ).val();
2926
+ $( '.old-replace-col input', this ).val( $( '.replace-right-col input', this ).val() );
2927
+ $( '.replace-right-col input', this ).val( old_val );
2928
+ } );
2929
+ } else if ( 'pull' === last_replace_switch && 'pull' === wpmdb_migration_type() && null !== old_url && null !== old_path ) {
2930
+ $( '.replace-row' ).each( function() {
2931
+ var old_val = $( '.old-replace-col input', this ).val();
2932
+ if ( old_val === old_path ) {
2933
+ $( '.old-replace-col input', this ).val( wpmdb.common.connection_data.path );
2934
+ }
2935
+ if ( old_val === old_url ) {
2936
+ $( '.old-replace-col input', this ).val( remove_protocol( wpmdb.common.connection_data.url ) );
2937
+ }
2938
+ } );
2939
+ }
2940
+ $.wpmdb.do_action( 'wpmdb_update_pull_table_select' );
2941
+ $( '#select-post-types' ).remove();
2942
+ $( '.exclude-post-types-warning' ).after( $pull_post_type_select );
2943
+ exclude_post_types_warning();
2944
+ $( '#select-backup' ).remove();
2945
+ $( '.backup-tables-wrap' ).prepend( $pull_select_backup );
2946
+ }
2947
+ last_replace_switch = wpmdb_migration_type();
2948
+ }
2949
+
2950
+ // hide second section if pull or push is selected with no connection established
2951
+ if ( ( 'pull' === wpmdb_migration_type() || 'push' === wpmdb_migration_type() ) && ! connection_established ) {
2952
+ $( '.step-two' ).hide();
2953
+ $( '.connection-status' ).show();
2954
+ }
2955
+
2956
+ // show / hide GUID helper description
2957
+ $( '.general-helper' ).click( function( e ) {
2958
+ e.preventDefault();
2959
+ var icon = $( this ),
2960
+ bubble = $( this ).next();
2961
+
2962
+ // Close any that are already open
2963
+ $( '.helper-message' ).not( bubble ).hide();
2964
+
2965
+ var position = icon.position();
2966
+ if ( bubble.hasClass( 'bottom' ) ) {
2967
+ var bubble_offset = 1;
2968
+
2969
+ if ( $( this ).is( ':first-child' ) ) {
2970
+ bubble_offset = 3;
2971
+ }
2972
+
2973
+ bubble.css( {
2974
+ 'left': ( ( position.left - bubble.width() / 2 ) - bubble_offset ) + 'px',
2975
+ 'top': ( position.top + icon.height() + 9 ) + 'px'
2976
+ } );
2977
+ } else {
2978
+ bubble.css( {
2979
+ 'left': ( position.left + icon.width() + 9 ) + 'px',
2980
+ 'top': ( position.top + icon.height() / 2 - 18 ) + 'px'
2981
+ } );
2982
+ }
2983
+ bubble.toggle();
2984
+ e.stopPropagation();
2985
+ } );
2986
+
2987
+ $( 'body' ).click( function() {
2988
+ $( '.helper-message' ).hide();
2989
+ } );
2990
+
2991
+ $( '.helper-message' ).click( function( e ) {
2992
+ e.stopPropagation();
2993
+ } );
2994
+
2995
+ $( 'body' ).on( 'click', '.show-errors-toggle', function( e ) {
2996
+ e.preventDefault();
2997
+ $( this ).next( '.migration-php-errors' ).toggle();
2998
+ } );
2999
+
3000
+ /**
3001
+ * Core plugin wrapper for the common AJAX error detecting method
3002
+ *
3003
+ * @param text
3004
+ * @param code
3005
+ * @param jqXHR
3006
+ *
3007
+ * @returns {string}
3008
+ */
3009
+ function get_ajax_errors( text, code, jqXHR ) {
3010
+ return wpmdbGetAjaxErrors( wpmdb_strings.connection_local_server_problem, code, text, jqXHR );
3011
+ }
3012
+
3013
+ // migrate / settings tabs
3014
+ $( '.nav-tab' ).click( function() {
3015
+ var hash = $( this ).attr( 'data-div-name' );
3016
+ hash = hash.replace( '-tab', '' );
3017
+ window.location.hash = hash;
3018
+ switch_to_plugin_tab( hash, false );
3019
+ } );
3020
+
3021
+ $( 'body' ).on( 'click', 'a[href^="#"]', function( event ) {
3022
+ var href = $( event.target ).attr( 'href' );
3023
+ var tab_name = href.substr( 1 );
3024
+
3025
+ if ( tab_name ) {
3026
+ var nav_tab = $( '.' + tab_name );
3027
+ if ( 1 === nav_tab.length ) {
3028
+ nav_tab.trigger( 'click' );
3029
+ event.preventDefault();
3030
+ }
3031
+ }
3032
+ } );
3033
+
3034
+ // repeatable fields
3035
+ $( 'body' ).on( 'click', '.add-row', function() {
3036
+ var $parent_tr = $( this ).parents( 'tr' );
3037
+ $parent_tr.before( $( '.original-repeatable-field' ).clone().removeClass( 'original-repeatable-field' ) );
3038
+ $parent_tr.prev().find( '.old-replace-col input' ).focus();
3039
+ } );
3040
+
3041
+ // repeatable fields
3042
+ $( 'body' ).on( 'click', '.replace-remove-row', function() {
3043
+ $( this ).parents( 'tr' ).remove();
3044
+ if ( 2 >= $( '.replace-row' ).length ) {
3045
+ $( '.no-replaces-message' ).show();
3046
+ }
3047
+
3048
+ var prev_id = $( this ).prev().attr( 'id' );
3049
+ if ( 'new-url' === prev_id || 'new-path' === prev_id ) {
3050
+ $( '#' + prev_id + '-missing-warning' ).hide();
3051
+ }
3052
+ } );
3053
+
3054
+ // Hide New URL & New Path Warnings on change.
3055
+ $( 'body' )
3056
+ .on( 'change', '#new-url', function() {
3057
+ $( '#new-url-missing-warning' ).hide();
3058
+ } )
3059
+ .on( 'change', '#new-path', function() {
3060
+ $( '#new-path-missing-warning' ).hide();
3061
+ } );
3062
+
3063
+ // Copy Find field to associated Replace field on arrow click.
3064
+ $( 'body' ).on( 'click', '.arrow-col', function() {
3065
+ var replace_row_arrow = this;
3066
+
3067
+ if ( $( replace_row_arrow ).hasClass( 'disabled' ) ) {
3068
+ return;
3069
+ }
3070
+
3071
+ var original_value = $( replace_row_arrow ).prev( 'td' ).find( 'input' ).val();
3072
+ var new_value_input = $( replace_row_arrow ).next( 'td' ).find( 'input' );
3073
+ new_value_input.val( original_value );
3074
+
3075
+ // Hide New URL or New Path Warning if changed.
3076
+ if ( 'new-url' === new_value_input.prop( 'id' ) ) {
3077
+ $( '#new-url-missing-warning' ).hide();
3078
+ } else if ( 'new-path' === new_value_input.prop( 'id' ) ) {
3079
+ $( '#new-path-missing-warning' ).hide();
3080
+ }
3081
+ } );
3082
+
3083
+ $( '.add-replace' ).click( function() {
3084
+ $( '.replace-fields' ).prepend( $( '.original-repeatable-field' ).clone().removeClass( 'original-repeatable-field' ) );
3085
+ $( '.no-replaces-message' ).hide();
3086
+ } );
3087
+
3088
+ $( '#find-and-replace-sort tbody' ).sortable( {
3089
+ items: '> tr:not(.pin)',
3090
+ handle: 'td:first',
3091
+ start: function() {
3092
+ $( '.sort-handle' ).css( 'cursor', '-webkit-grabbing' );
3093
+ $( '.sort-handle' ).css( 'cursor', '-moz-grabbing' );
3094
+ },
3095
+ stop: function() {
3096
+ $( '.sort-handle' ).css( 'cursor', '-webkit-grab' );
3097
+ $( '.sort-handle' ).css( 'cursor', '-moz-grab' );
3098
+ }
3099
+ } );
3100
+
3101
+ function validate_url( url ) {
3102
+ return /^([a-z]([a-z]|\d|\+|-|\.)*):(\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?((\[(|(v[\da-f]{1,}\.(([a-z]|\d|-|\.|_|~)|[!\$&'\(\)\*\+,;=]|:)+))\])|((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=])*)(:\d*)?)(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*|(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)|((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)|((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)){0})(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i.test( url );
3103
+ }
3104
+
3105
+ function switch_to_plugin_tab( hash, skip_addons_check ) {
3106
+ $( '.nav-tab' ).removeClass( 'nav-tab-active' );
3107
+ $( '.nav-tab.' + hash ).addClass( 'nav-tab-active' );
3108
+ $( '.content-tab' ).hide();
3109
+ $( '.' + hash + '-tab' ).show();
3110
+
3111
+ if ( 'settings' === hash ) {
3112
+ if ( true === should_check_licence() ) {
3113
+ $( 'p.licence-status' ).append( 'Checking License... ' ).append( ajax_spinner );
3114
+ check_licence();
3115
+ }
3116
+ }
3117
+
3118
+ if ( 'help' === hash ) {
3119
+ refresh_debug_log();
3120
+ if ( true === should_check_licence() ) {
3121
+ $( '.support-content p' ).append( ajax_spinner );
3122
+ check_licence();
3123
+ }
3124
+ }
3125
+
3126
+ if ( 'addons' === hash && true !== skip_addons_check ) {
3127
+ if ( true === should_check_licence() ) {
3128
+ $( '.addons-content p' ).append( ajax_spinner );
3129
+ check_licence();
3130
+ }
3131
+ }
3132
+ }
3133
+
3134
+ function should_check_licence() {
3135
+ if ( false === checked_licence && '1' === wpmdb_data.has_licence && 'true' === wpmdb_data.is_pro ) {
3136
+ return true;
3137
+ }
3138
+ return false;
3139
+ }
3140
+
3141
+ var hash = '';
3142
+
3143
+ // check for hash in url (settings || migrate) switch tabs accordingly
3144
+ if ( window.location.hash ) {
3145
+ hash = window.location.hash.substring( 1 );
3146
+ switch_to_plugin_tab( hash, false );
3147
+ }
3148
+
3149
+ if ( '' !== get_query_var( 'install-plugin' ) ) {
3150
+ hash = 'addons';
3151
+ checked_licence = true;
3152
+ switch_to_plugin_tab( hash, true );
3153
+ }
3154
+
3155
+ // process notice links clicks, eg. dismiss, reminder
3156
+ $( '.notice-link' ).click( function( e ) {
3157
+ e.preventDefault();
3158
+ $( this ).closest( '.inline-message' ).hide();
3159
+ $.ajax( {
3160
+ url: ajaxurl,
3161
+ type: 'POST',
3162
+ dataType: 'text',
3163
+ cache: false,
3164
+ data: {
3165
+ action: 'wpmdb_process_notice_link',
3166
+ nonce: wpmdb_data.nonces.process_notice_link,
3167
+ notice: $( this ).data( 'notice' ),
3168
+ type: $( this ).data( 'type' ),
3169
+ reminder: $( this ).data( 'reminder' )
3170
+ }
3171
+ } );
3172
+ } );
3173
+
3174
+ // When read-only connection info is copied, convert it to one line
3175
+ $( '#connection_info' ).on( 'copy', function( e ) {
3176
+ var $this = $( this );
3177
+
3178
+ // Test for two lines
3179
+ var lines = $this.val().split( '\n' );
3180
+ if ( 2 === lines.length ) {
3181
+
3182
+ // Wrapping in a try in case there's no browser support
3183
+ try {
3184
+
3185
+ // Combine the two lines into one
3186
+ e.originalEvent.clipboardData.setData( 'text/plain', lines.join( ' ' ) );
3187
+ e.preventDefault(); // Default behaviour is to copy any selected text
3188
+ }
3189
+ catch ( err ) {
3190
+
3191
+ // Do nothing. Allow normal copying
3192
+ }
3193
+ }
3194
+ });
3195
+
3196
+ // regenerates the saved secret key
3197
+ $( '.reset-api-key' ).click( function() {
3198
+ var answer = confirm( wpmdb_strings.reset_api_key );
3199
+
3200
+ if ( ! answer || doing_reset_api_key_ajax ) {
3201
+ return;
3202
+ }
3203
+
3204
+ doing_reset_api_key_ajax = true;
3205
+ $( '.reset-api-key' ).after( '<img src="' + spinner_url + '" alt="" class="reset-api-key-ajax-spinner general-spinner" />' );
3206
+
3207
+ $.ajax( {
3208
+ url: ajaxurl,
3209
+ type: 'POST',
3210
+ dataType: 'text',
3211
+ cache: false,
3212
+ data: {
3213
+ action: 'wpmdb_reset_api_key',
3214
+ nonce: wpmdb_data.nonces.reset_api_key
3215
+ },
3216
+ error: function( jqXHR, textStatus, errorThrown ) {
3217
+ alert( wpmdb_strings.reset_api_key_problem );
3218
+ $( '.reset-api-key-ajax-spinner' ).remove();
3219
+ doing_reset_api_key_ajax = false;
3220
+ },
3221
+ success: function( data ) {
3222
+ $( '.reset-api-key-ajax-spinner' ).remove();
3223
+ doing_reset_api_key_ajax = false;
3224
+ $( '.connection-info' ).html( data );
3225
+ wpmdb_data.connection_info = $.trim( data ).split( '\n' );
3226
+ }
3227
+ } );
3228
+
3229
+ } );
3230
+
3231
+ // Copy the connection info to the clipboard
3232
+ $( '.copy-api-key' ).click( function() {
3233
+
3234
+ var $el = $( this );
3235
+
3236
+ // Get connection_info input
3237
+ var $connection_info = $( '#connection_info' );
3238
+
3239
+ // Get the connection info
3240
+ var two_lines = $connection_info.val();
3241
+
3242
+ // Make it one line, if it's two
3243
+ var one_line = two_lines.replace( '\n', ' ' );
3244
+
3245
+ // Replace two lines with one
3246
+ $connection_info.val( one_line );
3247
+
3248
+ // Select the input val
3249
+ $connection_info.select();
3250
+
3251
+ try {
3252
+
3253
+ // Copy connection_info
3254
+ document.execCommand( 'copy' );
3255
+
3256
+ // Unselect connection_info input
3257
+ $connection_info.blur();
3258
+
3259
+ // show confirmation
3260
+ $el.css( 'color', 'transparent' );
3261
+ var $confirmation = $( '.copy-api-key-confirmation' ).show();
3262
+
3263
+ // fadeout confirmation
3264
+ setTimeout( function() {
3265
+ $confirmation.fadeOut( 'fast' );
3266
+ setTimeout( function() {
3267
+ $el.css( 'color', '' );
3268
+ }, 200 );
3269
+
3270
+ }, 1000 );
3271
+ }
3272
+ catch ( err ) {
3273
+ alert( 'please press Ctrl/Cmd+C to copy' );
3274
+ }
3275
+
3276
+ // Replace the input val with the two lines
3277
+ $connection_info.val( two_lines );
3278
+ } );
3279
+
3280
+ // show / hide table select box when specific settings change
3281
+ $( 'input.multiselect-toggle' ).change( function() {
3282
+ $( this ).parents( '.expandable-content' ).children( '.select-wrap' ).toggle();
3283
+ } );
3284
+
3285
+ $( '.show-multiselect' ).each( function() {
3286
+ if ( $( this ).is( ':checked' ) ) {
3287
+ $( this ).parents( '.option-section' ).children( '.header-expand-collapse' ).children( '.expand-collapse-arrow' ).removeClass( 'collapsed' );
3288
+ $( this ).parents( '.expandable-content' ).show();
3289
+ $( this ).parents( '.expandable-content' ).children( '.select-wrap' ).toggle();
3290
+ }
3291
+ } );
3292
+
3293
+ $( 'input[name=backup_option]' ).change( function() {
3294
+ $( '.backup-tables-wrap' ).hide();
3295
+ if ( 'backup_manual_select' === $( this ).val() ) {
3296
+ $( '.backup-tables-wrap' ).show();
3297
+ }
3298
+ } );
3299
+
3300
+ if ( $( '#backup-manual-select' ).is( ':checked' ) ) {
3301
+ $( '.backup-tables-wrap' ).show();
3302
+ }
3303
+
3304
+ $( '.plugin-compatibility-save' ).click( function() {
3305
+ if ( doing_plugin_compatibility_ajax ) {
3306
+ return;
3307
+ }
3308
+ $( this ).addClass( 'disabled' );
3309
+ var select_element = $( '#selected-plugins' );
3310
+ $( select_element ).attr( 'disabled', 'disabled' );
3311
+
3312
+ $( '.plugin-compatibility-success-msg' ).remove();
3313
+
3314
+ doing_plugin_compatibility_ajax = true;
3315
+ $( this ).after( '<img src="' + spinner_url + '" alt="" class="plugin-compatibility-spinner general-spinner" />' );
3316
+
3317
+ $.ajax( {
3318
+ url: ajaxurl,
3319
+ type: 'POST',
3320
+ dataType: 'text',
3321
+ cache: false,
3322
+ data: {
3323
+ action: 'wpmdb_blacklist_plugins',
3324
+ blacklist_plugins: $( select_element ).val(),
3325
+ nonce: wpmdb_data.nonces.blacklist_plugins
3326
+ },
3327
+ error: function( jqXHR, textStatus, errorThrown ) {
3328
+ alert( wpmdb_strings.blacklist_problem + '\r\n\r\n' + wpmdb_strings.status + ' ' + jqXHR.status + ' ' + jqXHR.statusText + '\r\n\r\n' + wpmdb_strings.response + '\r\n' + jqXHR.responseText );
3329
+ $( select_element ).removeAttr( 'disabled' );
3330
+ $( '.plugin-compatibility-save' ).removeClass( 'disabled' );
3331
+ doing_plugin_compatibility_ajax = false;
3332
+ $( '.plugin-compatibility-spinner' ).remove();
3333
+ },
3334
+ success: function( data ) {
3335
+ if ( '' !== $.trim( data ) ) {
3336
+ alert( data );
3337
+ }
3338
+ $( select_element ).removeAttr( 'disabled' );
3339
+ $( '.plugin-compatibility-save' ).removeClass( 'disabled' );
3340
+ doing_plugin_compatibility_ajax = false;
3341
+ $( '.plugin-compatibility-spinner' ).remove();
3342
+ $( '.plugin-compatibility-save' ).after( '<span class="plugin-compatibility-success-msg">' + wpmdb_strings.saved + '</span>' );
3343
+ $( '.plugin-compatibility-success-msg' ).fadeOut( 2000 );
3344
+ }
3345
+ } );
3346
+ } );
3347
+
3348
+ // delete a profile from the migrate form area
3349
+ $( 'body' ).on( 'click', '.delete-profile', function() {
3350
+ var name = $( this ).next().clone();
3351
+ $( 'input', name ).remove();
3352
+ name = $.trim( $( name ).html() );
3353
+ var answer = confirm( wpmdb_strings.remove_profile.replace( '{{profile}}', name ) );
3354
+
3355
+ if ( ! answer ) {
3356
+ return;
3357
+ }
3358
+ var $profile_li = $( this ).parent();
3359
+
3360
+ if ( $profile_li.find( 'input:checked' ).length ) {
3361
+ var $new_profile_li = $profile_li.siblings().last();
3362
+ $new_profile_li.find( 'input[type=radio]' ).prop( 'checked', 'checked' );
3363
+ $new_profile_li.find( 'input[type=text]' ).focus();
3364
+ $( '#migrate-form .crumbs .crumb:last' ).text( 'New Profile' );
3365
+
3366
+ if ( 'function' === typeof window.history.pushState ) {
3367
+ var updated_url = window.location.href.replace( '#migrate', '' ).replace( /&wpmdb-profile=-?\d+/, '' ) + '&wpmdb-profile=-1';
3368
+ window.history.pushState( { updated_profile_id: -1 }, null, updated_url );
3369
+ }
3370
+ }
3371
+
3372
+ $profile_li.fadeOut( 500 );
3373
+
3374
+ $.ajax( {
3375
+ url: ajaxurl,
3376
+ type: 'POST',
3377
+ dataType: 'text',
3378
+ cache: false,
3379
+ data: {
3380
+ action: 'wpmdb_delete_migration_profile',
3381
+ profile_id: $( this ).attr( 'data-profile-id' ),
3382
+ nonce: wpmdb_data.nonces.delete_migration_profile
3383
+ },
3384
+ error: function( jqXHR, textStatus, errorThrown ) {
3385
+ alert( wpmdb_strings.remove_profile_problem );
3386
+ },
3387
+ success: function( data ) {
3388
+ if ( '-1' === data ) {
3389
+ alert( wpmdb_strings.remove_profile_not_found );
3390
+ }
3391
+ }
3392
+ } );
3393
+
3394
+ } );
3395
+
3396
+ // deletes a profile from the main profile selection screen
3397
+ $( '.main-list-delete-profile-link' ).click( function() {
3398
+ var name = $( this ).prev().html();
3399
+ var answer = confirm( wpmdb_strings.remove_profile.replace( '{{profile}}', name ) );
3400
+
3401
+ if ( ! answer ) {
3402
+ return;
3403
+ }
3404
+
3405
+ $( this ).parent().fadeOut( 500 );
3406
+
3407
+ $.ajax( {
3408
+ url: ajaxurl,
3409
+ type: 'POST',
3410
+ dataType: 'text',
3411
+ cache: false,
3412
+ data: {
3413
+ action: 'wpmdb_delete_migration_profile',
3414
+ profile_id: $( this ).attr( 'data-profile-id' ),
3415
+ nonce: wpmdb_data.nonces.delete_migration_profile
3416
+ },
3417
+ error: function( jqXHR, textStatus, errorThrown ) {
3418
+ alert( wpmdb_strings.remove_profile_problem );
3419
+ }
3420
+ } );
3421
+
3422
+ } );
3423
+
3424
+ // warn the user when editing the connection info after a connection has been established
3425
+ $( 'body' ).on( 'click', '.temp-disabled', function() {
3426
+ var answer = confirm( wpmdb_strings.change_connection_info );
3427
+
3428
+ if ( ! answer ) {
3429
+ return;
3430
+ } else {
3431
+ $( '.ssl-notice' ).hide();
3432
+ $( '.different-plugin-version-notice' ).hide();
3433
+ $( '.migrate-db-button' ).show();
3434
+ $( '.temp-disabled' ).removeAttr( 'readonly' );
3435
+ $( '.temp-disabled' ).removeClass( 'temp-disabled' );
3436
+ $( '.connect-button' ).show();
3437
+ $( '.step-two' ).hide();
3438
+ $( '.connection-status' ).show().html( wpmdb_strings.enter_connection_info );
3439
+ connection_established = false;
3440
+ }
3441
+ } );
3442
+
3443
+ // ajax request for settings page when checking/unchecking setting radio buttons
3444
+ $( '.settings-tab input[type=checkbox]' ).change( function() {
3445
+ if ( 'plugin-compatibility' === $( this ).attr( 'id' ) ) {
3446
+ return;
3447
+ }
3448
+ var checked = $( this ).is( ':checked' );
3449
+ var setting = $( this ).attr( 'id' );
3450
+ var $status = $( this ).closest( 'td' ).next( 'td' ).find( '.setting-status' );
3451
+
3452
+ $( '.ajax-success-msg' ).remove();
3453
+ $status.after( ajax_spinner );
3454
+
3455
+ $.ajax( {
3456
+ url: ajaxurl,
3457
+ type: 'POST',
3458
+ dataType: 'text',
3459
+ cache: false,
3460
+ data: {
3461
+ action: 'wpmdb_save_setting',
3462
+ checked: checked,
3463
+ setting: setting,
3464
+ nonce: wpmdb_data.nonces.save_setting
3465
+ },
3466
+ error: function( jqXHR, textStatus, errorThrown ) {
3467
+ alert( wpmdb_strings.save_settings_problem );
3468
+ $( '.ajax-spinner' ).remove();
3469
+ },
3470
+ success: function( data ) {
3471
+ $( '.ajax-spinner' ).remove();
3472
+ $status.append( '<span class="ajax-success-msg">' + wpmdb_strings.saved + '</span>' );
3473
+ $( '.ajax-success-msg' ).fadeOut( 2000, function() {
3474
+ $( this ).remove();
3475
+ } );
3476
+ }
3477
+ } );
3478
+
3479
+ } );
3480
+
3481
+ // disable form submissions
3482
+ $( '.migrate-form' ).submit( function( e ) {
3483
+ e.preventDefault();
3484
+ } );
3485
+
3486
+ // fire connection_box_changed when the connect button is pressed
3487
+ $( '.connect-button' ).click( function( event ) {
3488
+ event.preventDefault();
3489
+ $( this ).blur();
3490
+ connection_box_changed();
3491
+ } );
3492
+
3493
+ // send paste even to connection_box_changed() function
3494
+ $( '.pull-push-connection-info' ).bind( 'paste', function( e ) {
3495
+ var $this = this;
3496
+ setTimeout( function() {
3497
+ connection_box_changed();
3498
+ }, 0 );
3499
+
3500
+ } );
3501
+
3502
+ $( 'body' ).on( 'click', '.try-again', function() {
3503
+ $( '.pull-push-connection-info' ).removeClass( 'temp-disabled' );
3504
+ connection_box_changed();
3505
+ } );
3506
+
3507
+ $( 'body' ).on( 'click', '.try-http', function() {
3508
+ var connection_info = $.trim( $( '.pull-push-connection-info' ).val() ).split( '\n' );
3509
+ var new_url = connection_info[ 0 ].replace( 'https', 'http' );
3510
+ var new_contents = new_url + '\n' + connection_info[ 1 ];
3511
+ $( '.pull-push-connection-info' ).val( new_contents );
3512
+ connection_box_changed();
3513
+ } );
3514
+
3515
+ $( '.create-new-profile' ).change( function() {
3516
+ profile_name_edited = true;
3517
+ } );
3518
+
3519
+ $( 'body' ).on( 'click', '.temporarily-disable-ssl', function() {
3520
+ var hash = '';
3521
+ if ( window.location.hash ) {
3522
+ hash = window.location.hash.substring( 1 );
3523
+ }
3524
+ $( this ).attr( 'href', $( this ).attr( 'href' ) + '&hash=' + hash );
3525
+ } );
3526
+
3527
+ // fired when the connection info box changes (e.g. gets pasted into)
3528
+ function connection_box_changed() {
3529
+ var $this = $( '.pull-push-connection-info' );
3530
+
3531
+ if ( ( doing_ajax || $( $this ).hasClass( 'temp-disabled' ) ) && false === wpmdb.force_reconnect ) {
3532
+ return;
3533
+ }
3534
+ wpmdb.force_reconnect = false;
3535
+ var data = $( '.pull-push-connection-info' ).val();
3536
+
3537
+ var connection_info = $.trim( data ).split( '\n' );
3538
+ var error = false;
3539
+ var error_message = '';
3540
+
3541
+ if ( '' === connection_info ) {
3542
+ error = true;
3543
+ error_message = wpmdb_strings.connection_info_missing;
3544
+ }
3545
+
3546
+ // attempt to format the connection info from a single line
3547
+ if ( 1 === connection_info.length && ! error ) {
3548
+ var connection_words = $.trim( data ).split( ' ' );
3549
+ if ( 2 === connection_words.length )
3550
+ {
3551
+ connection_info = connection_words;
3552
+ }
3553
+ }
3554
+
3555
+ if ( 2 !== connection_info.length && ! error ) {
3556
+ error = true;
3557
+ error_message = wpmdb_strings.connection_info_incorrect;
3558
+ }
3559
+
3560
+ if ( ! error && ! validate_url( connection_info[ 0 ] ) ) {
3561
+ error = true;
3562
+ error_message = wpmdb_strings.connection_info_url_invalid;
3563
+ }
3564
+
3565
+ var key_length = 0;
3566
+
3567
+ if ( 'undefined' !== typeof connection_info[ 1 ] ) {
3568
+ key_length = connection_info[ 1 ].length;
3569
+ }
3570
+
3571
+ if ( ! error && 32 !== key_length && 40 !== key_length ) {
3572
+ error = true;
3573
+ error_message = wpmdb_strings.connection_info_key_invalid;
3574
+ }
3575
+
3576
+ if ( ! error && connection_info[ 0 ] === wpmdb_data.connection_info[ 0 ] ) {
3577
+ error = true;
3578
+ error_message = wpmdb_strings.connection_info_local_url;
3579
+ }
3580
+
3581
+ if ( ! error && connection_info[ 1 ] === wpmdb_data.connection_info[ 1 ] ) {
3582
+ error = true;
3583
+ error_message = wpmdb_strings.connection_info_local_key;
3584
+ }
3585
+ if ( error ) {
3586
+ $( '.connection-status' ).html( error_message );
3587
+ $( '.connection-status' ).addClass( 'notification-message error-notice migration-error' );
3588
+ return;
3589
+ }
3590
+
3591
+ var new_connection_info_contents = connection_info[ 0 ] + '\n' + connection_info[ 1 ];
3592
+
3593
+ // If connection info is a single line
3594
+ if ( 1 === $.trim( data ).split( '\n' ).length ) {
3595
+
3596
+ // Repopulate the input with the info on two lines
3597
+ $( '.pull-push-connection-info' ).val( new_connection_info_contents );
3598
+ }
3599
+
3600
+ if ( false === wpmdb_data.openssl_available ) {
3601
+ connection_info[ 0 ] = connection_info[ 0 ].replace( 'https://', 'http://' );
3602
+ new_connection_info_contents = connection_info[ 0 ] + '\n' + connection_info[ 1 ];
3603
+ $( '.pull-push-connection-info' ).val( new_connection_info_contents );
3604
+ }
3605
+
3606
+ show_prefix_notice = false;
3607
+ doing_ajax = true;
3608
+ disable_export_type_controls();
3609
+
3610
+ if ( $( '.basic-access-auth-wrapper' ).is( ':visible' ) ) {
3611
+ connection_info[ 0 ] = connection_info[ 0 ].replace( /\/\/(.*)@/, '//' );
3612
+ connection_info[ 0 ] = connection_info[ 0 ].replace( '//', '//' + encodeURIComponent( $.trim( $( '.auth-username' ).val() ) ) + ':' + encodeURIComponent( $.trim( $( '.auth-password' ).val() ) ) + '@' );
3613
+ new_connection_info_contents = connection_info[ 0 ] + '\n' + connection_info[ 1 ];
3614
+ $( '.pull-push-connection-info' ).val( new_connection_info_contents );
3615
+ $( '.basic-access-auth-wrapper' ).hide();
3616
+ }
3617
+
3618
+ $( '.step-two' ).hide();
3619
+ $( '.ssl-notice' ).hide();
3620
+ $( '.prefix-notice' ).hide();
3621
+ $( '.connection-status' ).show();
3622
+
3623
+ $( '.connection-status' ).html( wpmdb_strings.establishing_remote_connection );
3624
+ $( '.connection-status' ).removeClass( 'notification-message error-notice migration-error' );
3625
+ $( '.connection-status' ).append( ajax_spinner );
3626
+
3627
+ var intent = wpmdb_migration_type();
3628
+
3629
+ profile_name_edited = false;
3630
+
3631
+ $.ajax( {
3632
+ url: ajaxurl,
3633
+ type: 'POST',
3634
+ dataType: 'json',
3635
+ cache: false,
3636
+ data: {
3637
+ action: 'wpmdb_verify_connection_to_remote_site',
3638
+ url: connection_info[ 0 ],
3639
+ key: connection_info[ 1 ],
3640
+ intent: intent,
3641
+ nonce: wpmdb_data.nonces.verify_connection_to_remote_site
3642
+ },
3643
+ error: function( jqXHR, textStatus, errorThrown ) {
3644
+ $( '.connection-status' ).html( get_ajax_errors( jqXHR.responseText, '(#100)', jqXHR ) );
3645
+ $( '.connection-status' ).addClass( 'notification-message error-notice migration-error' );
3646
+ $( '.ajax-spinner' ).remove();
3647
+ doing_ajax = false;
3648
+ enable_export_type_controls();
3649
+ },
3650
+ success: function( data ) {
3651
+ $( '.ajax-spinner' ).remove();
3652
+ doing_ajax = false;
3653
+ enable_export_type_controls();
3654
+
3655
+ if ( 'undefined' !== typeof data.wpmdb_error && 1 === data.wpmdb_error ) {
3656
+ $( '.connection-status' ).html( data.body );
3657
+ $( '.connection-status' ).addClass( 'notification-message error-notice migration-error' );
3658
+
3659
+ if ( data.body.indexOf( '401 Unauthorized' ) > -1 ) {
3660
+ $( '.basic-access-auth-wrapper' ).show();
3661
+ }
3662
+
3663
+ if ( ! $( '.pull-push-connection-info' ).hasClass( 'temp-disabled' ) && ! $( '.connect-button' ).is( ':visible' ) ) {
3664
+ $( '.pull-push-connection-info' ).removeAttr( 'readonly' );
3665
+ $( '.connect-button' ).show();
3666
+ }
3667
+
3668
+ return;
3669
+ }
3670
+
3671
+ maybe_show_ssl_warning( connection_info[ 0 ], connection_info[ 1 ], data.scheme );
3672
+
3673
+ var profile_name = get_domain_name( data.url );
3674
+ $( '.create-new-profile' ).val( profile_name );
3675
+
3676
+ $( '.pull-push-connection-info' ).addClass( 'temp-disabled' );
3677
+ $( '.pull-push-connection-info' ).attr( 'readonly', 'readonly' );
3678
+ $( '.connect-button' ).hide();
3679
+
3680
+ $( '.connection-status' ).hide();
3681
+ $( '.step-two' ).show();
3682
+
3683
+ maybe_show_prefix_notice( data.prefix );
3684
+
3685
+ connection_established = true;
3686
+ set_connection_data( data );
3687
+ move_connection_info_box();
3688
+ change_replace_values();
3689
+
3690
+ maybe_show_mixed_cased_table_name_warning();
3691
+
3692
+ refresh_table_selects();
3693
+
3694
+ $push_select_backup = $( $pull_select ).clone();
3695
+ $( $push_select_backup ).attr( {
3696
+ name: 'select_backup[]',
3697
+ id: 'select-backup'
3698
+ } );
3699
+
3700
+ var $post_type_select = document.createElement( 'select' );
3701
+ $( $post_type_select ).attr( {
3702
+ multiple: 'multiple',
3703
+ name: 'select_post_types[]',
3704
+ id: 'select-post-types',
3705
+ class: 'multiselect'
3706
+ } );
3707
+
3708
+ $.each( wpmdb.common.connection_data.post_types, function( index, value ) {
3709
+ $( $post_type_select ).append( '<option value="' + value + '">' + value + '</option>' );
3710
+ } );
3711
+
3712
+ $pull_post_type_select = $post_type_select;
3713
+
3714
+ $( '#new-path-missing-warning, #new-url-missing-warning' ).hide();
3715
+
3716
+ if ( 'pull' === wpmdb_migration_type() ) {
3717
+ $( '#new-url' ).val( remove_protocol( wpmdb_data.this_url ) );
3718
+ $( '#new-path' ).val( wpmdb_data.this_path );
3719
+ if ( 'true' === wpmdb_data.is_multisite ) {
3720
+ $( '#new-domain' ).val( wpmdb_data.this_domain );
3721
+ $( '.replace-row.pin .old-replace-col input[type="text"]' ).val( remove_protocol( data.url ) );
3722
+ }
3723
+ $( '#old-url' ).val( remove_protocol( data.url ) );
3724
+ $( '#old-path' ).val( data.path );
3725
+
3726
+ $.wpmdb.do_action( 'wpmdb_update_pull_table_select' );
3727
+ $( '#select-post-types' ).remove();
3728
+ $( '.exclude-post-types-warning' ).after( $pull_post_type_select );
3729
+ exclude_post_types_warning();
3730
+ $( '.table-prefix' ).html( data.prefix );
3731
+ $( '.backup-table-prefix' ).html( wpmdb_data.site_details.prefix );
3732
+ $( '.uploads-dir' ).html( wpmdb_data.this_uploads_dir );
3733
+ } else {
3734
+ $( '#new-url' ).val( remove_protocol( data.url ) );
3735
+ $( '#new-path' ).val( data.path );
3736
+
3737
+ if ( 'true' === wpmdb_data.is_multisite ) {
3738
+ $( '.replace-row.pin .old-replace-col input[type="text"]' ).val( remove_protocol( wpmdb_data.this_url ) );
3739
+ }
3740
+ $.wpmdb.do_action( 'wpmdb_update_push_table_select' );
3741
+ $( '#select-backup' ).remove();
3742
+ $( '.backup-tables-wrap' ).prepend( $push_select_backup );
3743
+ }
3744
+
3745
+ wpmdb.common.next_step_in_migration = {
3746
+ fn: $.wpmdb.do_action,
3747
+ args: [ 'verify_connection_to_remote_site', wpmdb.common.connection_data ]
3748
+ };
3749
+ wpmdb.functions.execute_next_step();
3750
+ }
3751
+
3752
+ } );
3753
+
3754
+ }
3755
+
3756
+ // Sets the initial Pause/Resume button event to Pause
3757
+ $( 'body' ).on( 'click', '.pause-resume', function( event ) {
3758
+ set_pause_resume_button( event );
3759
+ } );
3760
+
3761
+ function cancel_migration( event ) {
3762
+ migration_cancelled = true;
3763
+ cancelling_text = wpmdb_strings.cancelling_migration;
3764
+ $( '.migration-controls' ).css( { visibility: 'hidden' } );
3765
+
3766
+ if ( 'find_replace' === migration_intent ) {
3767
+ cancelling_text = wpmdb_strings.cancelling_find_replace;
3768
+ }
3769
+
3770
+ wpmdb.current_migration.setState( cancelling_text, wpmdb_strings.completing_current_request, 'cancelling' );
3771
+
3772
+ if ( true === migration_paused ) {
3773
+ migration_paused = false;
3774
+ wpmdb.functions.execute_next_step();
3775
+ }
3776
+ }
3777
+
3778
+ $( 'body' ).on( 'click', '.cancel', function( event ) {
3779
+ cancel_migration( event );
3780
+ } );
3781
+
3782
+ $( '.enter-licence' ).click( function() {
3783
+ $( '.settings' ).click();
3784
+ $( '.licence-input' ).focus();
3785
+ } );
3786
+
3787
+ wpmdb.functions.execute_next_step = function() {
3788
+
3789
+ // if delay is set, set a timeout for delay to recall this function, then return
3790
+ if ( 0 < delay_between_requests && false === flag_skip_delay ) {
3791
+ setTimeout( function() {
3792
+ flag_skip_delay = true;
3793
+ wpmdb.functions.execute_next_step();
3794
+ }, delay_between_requests );
3795
+ return;
3796
+ } else {
3797
+ flag_skip_delay = false;
3798
+ }
3799
+
3800
+ if ( true === migration_paused ) {
3801
+ $( '.migration-progress-ajax-spinner' ).hide();
3802
+
3803
+ // Pause the timer
3804
+ wpmdb.current_migration.pauseTimer();
3805
+
3806
+ var pause_text = '';
3807
+ if ( true === is_auto_pause_before_finalize ) {
3808
+ pause_text = wpmdb_strings.paused_before_finalize;
3809
+ is_auto_pause_before_finalize = false;
3810
+
3811
+ if ( 'find_replace' === wpmdb_migration_type() ) {
3812
+ pause_text = wpmdb_strings.find_replace_paused_before_finalize;
3813
+ }
3814
+ } else {
3815
+ pause_text = wpmdb_strings.paused;
3816
+ }
3817
+
3818
+ wpmdb.current_migration.setState( null, pause_text, 'paused' );
3819
+
3820
+ // Re-bind Pause/Resume button to Resume when we are finally Paused
3821
+ $( 'body' ).on( 'click', '.pause-resume', function( event ) {
3822
+ set_pause_resume_button( event );
3823
+ } );
3824
+ $( 'body' ).on( 'click', '.cancel', function( event ) {
3825
+ cancel_migration( event );
3826
+ } );
3827
+ $( '.pause-resume' ).html( wpmdb_strings.resume );
3828
+ return;
3829
+ } else if ( true === migration_cancelled ) {
3830
+ migration_intent = wpmdb_migration_type();
3831
+
3832
+ var progress_msg;
3833
+
3834
+ if ( 'savefile' === migration_intent ) {
3835
+ progress_msg = wpmdb_strings.removing_local_sql;
3836
+ } else if ( 'pull' === migration_intent ) {
3837
+ if ( 'backup' === stage ) {
3838
+ progress_msg = wpmdb_strings.removing_local_backup;
3839
+ } else {
3840
+ progress_msg = wpmdb_strings.removing_local_temp_tables;
3841
+ }
3842
+ } else if ( 'push' === migration_intent ) {
3843
+ if ( 'backup' === stage ) {
3844
+ progress_msg = wpmdb_strings.removing_remote_sql;
3845
+ } else {
3846
+ progress_msg = wpmdb_strings.removing_remote_temp_tables;
3847
+ }
3848
+ }
3849
+ wpmdb.current_migration.setText( progress_msg );
3850
+
3851
+ var request_data = {
3852
+ action: 'wpmdb_cancel_migration',
3853
+ migration_state_id: wpmdb.migration_state_id,
3854
+ nonce: wpmdb_data.nonces.cancel_migration
3855
+ };
3856
+
3857
+ doing_ajax = true;
3858
+
3859
+ $.ajax( {
3860
+ url: ajaxurl,
3861
+ type: 'POST',
3862
+ dataType: 'text',
3863
+ cache: false,
3864
+ data: request_data,
3865
+ error: function( jqXHR, textStatus, errorThrown ) {
3866
+ wpmdb.current_migration.setState( wpmdb_strings.migration_cancellation_failed, wpmdb_strings.manually_remove_temp_files + '<br /><br />' + wpmdb_strings.status + ': ' + jqXHR.status + ' ' + jqXHR.statusText + '<br /><br />' + wpmdb_strings.response + ':<br />' + jqXHR.responseText, 'error' );
3867
+ console.log( jqXHR );
3868
+ console.log( textStatus );
3869
+ console.log( errorThrown );
3870
+ doing_ajax = false;
3871
+ wpmdb.common.migration_error = true;
3872
+ wpmdb.functions.migration_complete_events();
3873
+ return;
3874
+ },
3875
+ success: function( data ) {
3876
+ doing_ajax = false;
3877
+ data = $.trim( data );
3878
+ if ( ( 'push' === migration_intent && '1' !== data ) || ( 'push' !== migration_intent && '' !== data ) ) {
3879
+ wpmdb.current_migration.setState( wpmdb_strings.migration_cancellation_failed, data, 'error' );
3880
+ wpmdb.common.migration_error = true;
3881
+ wpmdb.functions.migration_complete_events();
3882
+ return;
3883
+ }
3884
+
3885
+ completed_msg = wpmdb_strings.migration_cancelled;
3886
+
3887
+ if ( 'find_replace' === migration_intent ) {
3888
+ completed_msg = wpmdb_strings.find_replace_cancelled;
3889
+ }
3890
+
3891
+ wpmdb.functions.migration_complete_events();
3892
+ wpmdb.current_migration.setStatus( 'cancelled' );
3893
+ }
3894
+ } );
3895
+ } else {
3896
+ wpmdb.common.next_step_in_migration.fn.apply( null, wpmdb.common.next_step_in_migration.args );
3897
+ }
3898
+ };
3899
+
3900
+ $( 'body' ).on( 'click', '.copy-licence-to-remote-site', function() {
3901
+ $( '.connection-status' ).html( wpmdb_strings.copying_license );
3902
+ $( '.connection-status' ).removeClass( 'notification-message error-notice migration-error' );
3903
+ $( '.connection-status' ).append( ajax_spinner );
3904
+
3905
+ var connection_info = $.trim( $( '.pull-push-connection-info' ).val() ).split( '\n' );
3906
+
3907
+ doing_ajax = true;
3908
+ disable_export_type_controls();
3909
+
3910
+ $.ajax( {
3911
+ url: ajaxurl,
3912
+ type: 'POST',
3913
+ dataType: 'json',
3914
+ cache: false,
3915
+ data: {
3916
+ action: 'wpmdb_copy_licence_to_remote_site',
3917
+ url: connection_info[ 0 ],
3918
+ key: connection_info[ 1 ],
3919
+ nonce: wpmdb_data.nonces.copy_licence_to_remote_site
3920
+ },
3921
+ error: function( jqXHR, textStatus, errorThrown ) {
3922
+ $( '.connection-status' ).html( get_ajax_errors( jqXHR.responseText, '(#143)', jqXHR ) );
3923
+ $( '.connection-status' ).addClass( 'notification-message error-notice migration-error' );
3924
+ $( '.ajax-spinner' ).remove();
3925
+ doing_ajax = false;
3926
+ enable_export_type_controls();
3927
+ },
3928
+ success: function( data ) {
3929
+ $( '.ajax-spinner' ).remove();
3930
+ doing_ajax = false;
3931
+ enable_export_type_controls();
3932
+
3933
+ if ( 'undefined' !== typeof data.wpmdb_error && 1 === data.wpmdb_error ) {
3934
+ $( '.connection-status' ).html( data.body );
3935
+ $( '.connection-status' ).addClass( 'notification-message error-notice migration-error' );
3936
+
3937
+ if ( data.body.indexOf( '401 Unauthorized' ) > -1 ) {
3938
+ $( '.basic-access-auth-wrapper' ).show();
3939
+ }
3940
+
3941
+ return;
3942
+ }
3943
+ connection_box_changed();
3944
+ }
3945
+ } );
3946
+ } );
3947
+
3948
+ $( 'body' ).on( 'click', '.reactivate-licence', function( e ) {
3949
+ doing_ajax = true;
3950
+
3951
+ $( '.invalid-licence' ).empty().html( wpmdb_strings.attempting_to_activate_licence );
3952
+ $( '.invalid-licence' ).append( ajax_spinner );
3953
+
3954
+ $.ajax( {
3955
+ url: ajaxurl,
3956
+ type: 'POST',
3957
+ dataType: 'json',
3958
+ cache: false,
3959
+ data: {
3960
+ action: 'wpmdb_reactivate_licence',
3961
+ nonce: wpmdb_data.nonces.reactivate_licence
3962
+ },
3963
+ error: function( jqXHR, textStatus, errorThrown ) {
3964
+ $( '.invalid-licence' ).html( wpmdb_strings.activate_licence_problem );
3965
+ $( '.invalid-licence' ).append( '<br /><br />' + wpmdb_strings.status + ': ' + jqXHR.status + ' ' + jqXHR.statusText + '<br /><br />' + wpmdb_strings.response + '<br />' + jqXHR.responseText );
3966
+ $( '.ajax-spinner' ).remove();
3967
+ doing_ajax = false;
3968
+ },
3969
+ success: function( data ) {
3970
+ $( '.ajax-spinner' ).remove();
3971
+ doing_ajax = false;
3972
+
3973
+ if ( 'undefined' !== typeof data.wpmdb_error && 1 === data.wpmdb_error ) {
3974
+ $( '.invalid-licence' ).html( data.body );
3975
+ return;
3976
+ }
3977
+
3978
+ if ( 'undefined' !== typeof data.wpmdb_dbrains_api_down && 1 === data.wpmdb_dbrains_api_down ) {
3979
+ $( '.invalid-licence' ).html( wpmdb_strings.temporarily_activated_licence );
3980
+ $( '.invalid-licence' ).append( data.body );
3981
+ return;
3982
+ }
3983
+
3984
+ $( '.invalid-licence' ).empty().html( wpmdb_strings.licence_reactivated );
3985
+ location.reload();
3986
+ }
3987
+ } );
3988
+
3989
+ } );
3990
+
3991
+ $( 'input[name=table_migrate_option]' ).change( function() {
3992
+ maybe_show_mixed_cased_table_name_warning();
3993
+ $.wpmdb.do_action( 'wpmdb_tables_to_migrate_changed' );
3994
+ } );
3995
+
3996
+ $( 'body' ).on( 'change', '#select-tables', function() {
3997
+ maybe_show_mixed_cased_table_name_warning();
3998
+ $.wpmdb.do_action( 'wpmdb_tables_to_migrate_changed' );
3999
+ } );
4000
+
4001
+ $.wpmdb.add_filter( 'wpmdb_get_table_prefix', get_table_prefix );
4002
+ $.wpmdb.add_filter( 'wpmdb_get_tables_to_migrate', get_tables_to_migrate );
4003
+ $.wpmdb.add_action( 'wpmdb_lock_replace_url', lock_replace_url );
4004
+ $.wpmdb.add_action( 'move_connection_info_box', exclude_post_types_warning );
4005
+
4006
+ $.wpmdb.add_filter( 'wpmdb_before_migration_complete_hooks', function( hooks ) {
4007
+ pause_before_finalize = $( 'input[name=pause_before_finalize]:checked' ).length ? true : false;
4008
+ if ( true === pause_before_finalize && 'savefile' !== migration_intent ) {
4009
+ set_pause_resume_button( null ); // don't just set migration_paused to true, since `set_pause_resume_button` will get double bound to clicking resume
4010
+ is_auto_pause_before_finalize = true;
4011
+ }
4012
+ return hooks;
4013
+ } );
4014
+
4015
+ /**
4016
+ * Set checkbox
4017
+ *
4018
+ * @param string checkbox_wrap
4019
+ */
4020
+ function set_checkbox( checkbox_wrap ) {
4021
+ var $switch = $( '#' + checkbox_wrap );
4022
+ var $checkbox = $switch.find( 'input[type=checkbox]' );
4023
+
4024
+ $switch.toggleClass( 'on' ).find( 'span' ).toggleClass( 'checked' );
4025
+ var switch_on = $switch.find( 'span.on' ).hasClass( 'checked' );
4026
+ $checkbox.attr( 'checked', switch_on ).trigger( 'change' );
4027
+ }
4028
+
4029
+ $( '.wpmdb-switch' ).on( 'click', function( e ) {
4030
+ if ( ! $( this ).hasClass( 'disabled' ) ) {
4031
+ set_checkbox( $( this ).attr( 'id' ) );
4032
+ }
4033
+ } );
4034
+
4035
+ } );
4036
+
4037
+ })( jQuery, wpmdb );
4038
+
4039
+ },{"MigrationProgress-controller":1}]},{},[1,2,3,4,5,6,7]);
asset/dist/js/script-09.min.js ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ !function a(b,c,d){function e(g,h){if(!c[g]){if(!b[g]){var i="function"==typeof require&&require;if(!h&&i)return i(g,!0);if(f)return f(g,!0);var j=new Error("Cannot find module '"+g+"'");throw j.code="MODULE_NOT_FOUND",j}var k=c[g]={exports:{}};b[g][0].call(k.exports,function(a){var c=b[g][1][a];return e(c?c:a)},k,k.exports,a,b,c,d)}return c[g].exports}for(var f="function"==typeof require&&require,g=0;g<d.length;g++)e(d[g]);return e}({1:[function(a,b,c){var d=jQuery,e=a("MigrationProgress-model"),f=a("MigrationProgress-view"),g=d('<div id="overlay" class="hide"></div>'),h=d(".progress-content").clone().addClass("hide"),i=d(".pro-version").addClass("hide");g.append(i);var j={migration:{model:{},view:{},$progress:{},$wrapper:{},$overlay:{},status:"active",title:"",text:"",timerCount:0,elapsedInterval:0,currentStageNum:0,counterDisplay:!1,originalTitle:document.title,setTitle:function(a){this.$progress.find(".progress-title").html(a),this.title=a},setStatus:function(a){this.$progress.removeClass(this.status).addClass("error"===a?"wpmdb-error":a),"error"===a&&this.$progress.find(".progress-text").addClass("migration-error"),this.status=a,this.updateTitleElem()},setText:function(a){"string"!=typeof a&&(a=""),0>=a.indexOf("wpmdb_error")&&(a=this.decodeErrorObject(a)),this.$progress.find(".progress-text").html(a),this.text=a},setState:function(a,b,c){null!==a&&this.setTitle(a),null!==b&&this.setText(b),null!==c&&this.setStatus(c)},startTimer:function(){this.timerCount=0,this.counterDisplay=d(".timer"),this.elapsedInterval=setInterval(this.incrementTimer,1e3)},pauseTimer:function(){clearInterval(this.elapsedInterval)},resumeTimer:function(){this.elapsedInterval=setInterval(this.incrementTimer,1e3)},incrementTimer:function(){wpmdb.current_migration.timerCount=wpmdb.current_migration.timerCount+1,wpmdb.current_migration.displayCount()},displayCount:function(){var a=Math.floor(this.timerCount/3600)%24,b=Math.floor(this.timerCount/60)%60,c=this.timerCount%60,d=this.pad(a,2,0)+":"+this.pad(b,2,0)+":"+this.pad(c,2,0);this.counterDisplay.html(d)},updateTitleElem:function(){var a=this.model.get("activeStageName"),b=this.model.getStageModel(a),c=Math.max(0,b.getTotalProgressPercent()),d=this.model.get("stages").length,e=this.currentStageNum,f=this.status,g=wpmdb_strings.title_progress;"complete"===b.get("status")&&0===b.get("totalSize")&&(c=100),g=g.replace("%1$s",c+"%"),g=g.replace("%2$s",e),g=g.replace("%3$s",d),1===d&&(g=c+"%"),wpmdb_strings["title_"+f]&&(g=wpmdb_strings["title_"+f]),g=g+" - "+this.originalTitle,document.title=g},restoreTitleElem:function(){document.title=this.originalTitle},pad:function(a,b,c){return c=c||"0",a+="",a.length>=b?a:new Array(b-a.length+1).join(c)+a},decodeErrorObject:function(a){var b=a.replace(/\{&quot;/g,"{#q!#").replace(/\&quot;}/g,"#q!#}").replace(/,&quot;/g,",#q!#").replace(/&quot;:/g,"#q!#:").replace(/:&quot;/g,":#q!#").replace(/&quot;/g,'\\"').replace(/#q!#/g,'"').replace(/&gt;/g,">").replace(/&lt;/g,"<");try{b=JSON.parse(b)}catch(c){return a}return"object"==typeof b&&"undefined"!=typeof b.body?b:a},fixProgressStageWidthForScrollBar:function(){var a=Math.abs(this.$wrapper[0].offsetWidth-this.$wrapper[0].clientWidth),b=this.$wrapper.find(".active .progress-items"),c=parseInt(b.css("padding-left"),10),d=parseInt(b.css("padding-right"),10);(0!==a||0===a&&d!==c)&&b.css("padding-right",c-a+"px")}},newMigration:function(a){d("#overlay").remove(),d(".progress-content").remove(),this.migration.$overlay=g.clone(),d("#wpwrap").append(this.migration.$overlay),this.migration.model=new e(a),this.migration.view=new f({model:this.migration.model}),this.migration.$progress=h.clone(),this.migration.$wrapper=this.migration.view.$el,this.migration.$progress.find(".migration-progress-stages").replaceWith(this.migration.$wrapper),this.migration.$proVersion=this.migration.$overlay.find(".pro-version");var b=this.migration.$proVersion.find("iframe").remove().clone();this.migration.$overlay.prepend(this.migration.$progress);var c=this;return setTimeout(function(){c.migration.$overlay.add(c.migration.$progress).add(c.migration.$proVersion).removeClass("hide").addClass("show"),c.migration.$proVersion.length&&setTimeout(function(){c.migration.$proVersion.find(".iframe").append(b)},500)},0),this.migration.currentStageNum=0,this.migration.$proVersion.on("click",".close-pro-version",function(){c.migration.$proVersion.find("iframe").remove(),c.migration.$proVersion.addClass("hide remove"),setTimeout(function(){c.migration.$proVersion.remove()},500)}),this.migration.model.on("migrationComplete",function(){c.utils.updateProgTableVisibilitySetting(),c.utils.updatePauseBeforeFinalizeSetting(),c.migration.pauseTimer()}),d(window).on("resize",_.debounce(this.migration.fixProgressStageWidthForScrollBar.bind(this.migration),100)),this.migration.model.on("change:activeStage",this.migration.fixProgressStageWidthForScrollBar.bind(this.migration)),this.migration},utils:a("MigrationProgress-utils")};b.exports=j},{"MigrationProgress-model":2,"MigrationProgress-utils":3,"MigrationProgress-view":4}],2:[function(a,b,c){var d=a("MigrationProgressStage-model"),e=jQuery,f=Backbone.Model.extend({defaults:{_initialStages:null,stages:null,activeStageName:null,stageModels:null,localTableRows:null,localTableSizes:null,remoteTableRows:null,remoteTableSizes:null,migrationStatus:"active",migrationIntent:"savefile"},initialize:function(){this.set("stageModels",{}),this.set("_initialStages",this.get("stages")),this.set("stages",[]),_.each(this.get("_initialStages"),function(a,b,c){this.addStage(a.name,b,c)},this)},addStage:function(a,b,c,d){var f,g=[];return _.each(b,function(a){var b,d;"remote"===c?(b=this.get("remoteTableSizes")[a],d=this.get("remoteTableRows")[a]):(b=this.get("localTableSizes")[a],d=this.get("localTableRows")[a]),g.push({name:a,size:b,rows:d})},this),f={name:a,items:g,dataType:c},"object"==typeof d&&(f=e.extend(f,d)),this.addStageModel(f),this.trigger("stage:added",this.get("stageModels")[a]),this.get("stageModels")[a].on("change",function(){this.trigger("change")},this),this.getStageModel(f.name)},addStageItem:function(a,b,c,d){this.getStageModel(a).addItem(b,c,d)},addStageModel:function(a){var b=this.get("stages"),c=this.get("stageModels"),e=new d(a);b.push(a),c[a.name]=e,this.set("stages",b),this.set("stageModels",c)},getStageModel:function(a){return this.get("stageModels")[a]},getStageItems:function(a,b){var c=this.getStageModel(a),d=c.get("items");return void 0===b?d:d.map(function(a){return a[b]})},setActiveStage:function(a){this.setStageComplete(),this.set("activeStageName",a),this.getStageModel(a).set("status","active"),this.trigger("change:activeStage")},setStageComplete:function(a){a||(a=this.get("activeStageName")),null!==a&&this.getStageModel(a).set("status","complete"),wpmdb.current_migration.currentStageNum=wpmdb.current_migration.currentStageNum+1},setMigrationComplete:function(){var a=this.getStageModel(this.get("activeStageName"));this.setStageComplete(),this.trigger("migrationComplete"),this.set("migrationStatus","complete"),a.activateTab()}});b.exports=f},{"MigrationProgressStage-model":5}],3:[function(a,b,c){var d=jQuery;b.exports={updateProgTableVisibilitySetting:function(){wpmdb_data.prog_tables_visibility_changed&&(wpmdb_data.prog_tables_visibility_changed=!1,d.ajax({url:ajaxurl,type:"POST",dataType:"text",cache:!1,data:{action:"wpmdb_save_setting",nonce:wpmdb_data.nonces.save_setting,setting:"prog_tables_hidden",checked:Boolean(wpmdb_data.prog_tables_hidden)},error:function(a,b,c){console.log("Could not save progress item visibility setting",c)}}))},updatePauseBeforeFinalizeSetting:function(){wpmdb_data.pause_before_finalize_changed&&(wpmdb_data.pause_before_finalize_changed=!1,d.ajax({url:ajaxurl,type:"POST",dataType:"text",cache:!1,data:{action:"wpmdb_save_setting",nonce:wpmdb_data.nonces.save_setting,setting:"pause_before_finalize",checked:Boolean(wpmdb_data.pause_before_finalize)},error:function(a,b,c){console.log("Could not save pause before finalize setting",c)}}))}}},{}],4:[function(a,b,c){var d=a("./MigrationProgressStage-view.js"),e=(jQuery,Backbone.View.extend({tagName:"div",className:"migration-progress-stages",id:"migration-progress-stages",self:this,initialize:function(){this.$el.empty(),this.model.on("stage:added",function(a){this.addStageView(a)},this),_.each(this.model.get("stageModels"),this.addStageView,this)},addStageView:function(a){var b=new d({model:a});a.trigger("view:initialized",b),this.$el.append(b.$el),this.$el.parent().find(".stage-tabs").append(b.$tabElem)}}));b.exports=e},{"./MigrationProgressStage-view.js":6}],5:[function(a,b,c){var d=jQuery,e=Backbone.Model.extend({defaults:{status:"queued",_initialItems:null,items:null,lookupItems:null,totalSize:0,totalTransferred:0,dataType:"local",name:"",itemsComplete:0,strings:null},initialize:function(){this.initStrings(),this.set("_initialItems",this.get("items").slice()),this.set("items",[]),this.set("lookupItems",{}),_.each(this.get("_initialItems"),function(a){this.addItem(a.name,a.size,a.rows)},this),this.on("view:initialized",this.triggerItemViewInit),this.on("change",function(){wpmdb.current_migration.updateTitleElem()})},initStrings:function(){var a={stage_title:this.get("name"),migrated:wpmdb_strings.migrated,queued:wpmdb_strings.queued,active:wpmdb_strings.running,complete:wpmdb_strings.complete,hide:wpmdb_strings.hide,show:wpmdb_strings.show,itemsName:wpmdb_strings.tables},b=this.get("strings");b="object"==typeof b?b:{},b=d.extend(a,b),b.items_migrated=b.itemsName+" "+b.migrated,b.hide_items=b.hide+" "+b.itemsName,b.show_items=b.show+" "+b.itemsName,this.set("strings",b)},addItem:function(a,b,c){var d=this.get("items"),e={name:a,size:b||1,rows:c||b,stageName:this.get("name"),$el:null,transferred:0,rowsTransferred:0,complete:!1};d.push(e),this.get("lookupItems")[a]=d.length-1,this.set("totalSize",parseInt(this.get("totalSize"))+parseInt(b)),this.trigger("item:added",e)},triggerItemViewInit:function(){var a=this.get("items"),b=this;_.each(a,function(a){b.trigger("item:added",a)})},getTotalSizeTransferred:function(){return this.get("totalTransferred")},countItemsComplete:function(){return this.get("itemsComplete")},getTotalProgressPercent:function(){var a=this.getTotalSizeTransferred(),b=this.get("totalSize");return 0>=a||0>=b?0:Math.min(100,Math.floor(a/b*100))},activateTab:function(){this.trigger("activateTab"),wpmdb.current_migration.model.trigger("change:activeStage")},setItemComplete:function(a){var b=this.getItemByName(a),c=this.get("totalTransferred"),d=this.get("itemsComplete");this.set("itemsComplete",++d),c+=b.size-b.transferred,this.set("totalTransferred",c),b.transferred=b.size,b.complete=!0,b.rowsTransferred=b.rows,this.trigger("change change:items",b)},setItemRowsTransferred:function(a,b){var c,d,e=this.getItemByName(a),f=this.get("totalTransferred");return c=-1===parseInt(b)?1:Math.min(1,b/e.rows),1===c?void this.setItemComplete(a):(d=e.size*c,f+=d-e.transferred,this.set("totalTransferred",f),e.transferred=d,e.rowsTransferred=b,void this.trigger("change change:items",e))},getItemByName:function(a){var b=this.get("items")[this.get("lookupItems")[a]]||{};return a===b.name?b:this.determineItemByName(a)},determineItemByName:function(a){for(var b=this.get("items"),c=0;c<b.length;c++){var d=b[c];if(a===d.name)return this.get("lookupItems").itemName=c,d}}});b.exports=e},{}],6:[function(a,b,c){var d=jQuery,e=Backbone.View.extend({tagName:"div",className:"migration-progress-stage-container hide-tables",$totalProgressElem:null,$tabElem:null,$showHideTablesElem:null,$pauseBeforeFinalizeElem:null,$pauseBeforeFinalizeCheckbox:null,$itemsContainer:null,itemViews:null,maxDomNodes:100,visibleDomNodes:0,queuedElements:null,$truncationNotice:null,$truncationNoticeHiddenItems:null,initialize:function(){this.$el.empty(),this.$el.attr("data-stage",this.model.get("name")).addClass("queued "+this.model.get("name")),this.queuedElements=[],this.initTotalProgressElem(),wpmdb.current_migration.view.$el.parent().find(".stage-tabs").after(this.$totalProgressElem),this.$itemsContainer=d("<div class=progress-items />"),this.$el.append(this.$itemsContainer),this.initTabElem(),this.model.on("item:added",this.maybeAddElementToView,this),_.each(this.model.get("itemModels"),this.maybeAddElementToView,this),this.model.on("change",function(){this.updateProgressElem(),this.updateStageTotals()},this),this.model.on("change:status",function(a){this.$el.removeClass("queued active").addClass(this.model.get("status")),this.$totalProgressElem.removeClass("queued active").addClass(this.model.get("status")),this.$tabElem.removeClass("queued active").addClass(this.model.get("status")).find(".stage-status").text(this.model.get("strings")[this.model.get("status")])},this),this.model.on("change:items",function(a){a.name&&this.setItemProgress(a)},this),this.model.on("activateTab",function(){"complete"===wpmdb.current_migration.model.get("migrationStatus")&&(this.$totalProgressElem.addClass("active").siblings().removeClass("active"),this.$tabElem.addClass("active").siblings().removeClass("active"),this.$el.addClass("active").siblings().removeClass("active"))},this)},initTotalProgressElem:function(){this.initShowHideTablesElem(),this.initPauseBeforeFinalizeElem(),this.$totalProgressElem=d('<div class="stage-progress '+this.model.get("name")+'" />').append("<span class=percent-complete>0</span>% "+this.model.get("strings").complete+" ").append("(<span class=size-complete>0 MB</span> / <span class=size-total>0 MB</span>) ").append("<span class=tables-complete>0</span> <span class=lowercase >of</span> <span class=tables-total>0</span> "+this.model.get("strings").items_migrated).append(this.$showHideTablesElem).append("<div class=progress-bar-wrapper><div class=progress-bar /></div>"),this.updateStageTotals()},initShowHideTablesElem:function(){this.$showHideTablesElem=d("<a class=show-hide-tables/>").text(this.model.get("strings").show_items);var a=this;this.$showHideTablesElem.on("click show-hide-progress-tables",function(){var b;a.$el.hasClass("hide-tables")?(b=!1,a.$el.add(a.$el.siblings()).removeClass("hide-tables"),a.$showHideTablesElem.text(a.model.get("strings").hide_items)):(b=!0,a.$el.add(a.$el.siblings()).addClass("hide-tables"),a.$showHideTablesElem.text(a.model.get("strings").show_items)),Boolean(b)!==Boolean(wpmdb_data.prog_tables_hidden)&&(wpmdb_data.prog_tables_visibility_changed=!0,wpmdb_data.prog_tables_hidden=b)}),wpmdb_data.prog_tables_hidden||this.$showHideTablesElem.triggerHandler("show-hide-progress-tables"),this.model.on("change:status activateTab",function(){wpmdb_data.prog_tables_hidden?a.$showHideTablesElem.text(a.model.get("strings").show_items):a.$showHideTablesElem.text(a.model.get("strings").hide_items)})},initPauseBeforeFinalizeElem:function(){this.$pauseBeforeFinalizeElem=d(".pause-before-finalize"),this.$pauseBeforeFinalizeCheckbox=this.$pauseBeforeFinalizeElem.find("input[type=checkbox]");var a=this,b=!1,c=wpmdb.current_migration.model.get("migrationIntent");wpmdb_data.pause_before_finalize&&(b=!0),this.$pauseBeforeFinalizeCheckbox.prop("checked",b),-1!==d.inArray(c,["push","pull","find_replace"])?("find_replace"===c&&d("#pause-before-finalize-label").text(wpmdb_strings.pause_before_finalize_find_replace),this.$pauseBeforeFinalizeElem.show()):this.$pauseBeforeFinalizeElem.hide(),wpmdb.current_migration.model.on("change:activeStage",function(){"media"===wpmdb.current_migration.model.get("activeStageName")&&a.$pauseBeforeFinalizeElem.hide()}),this.$pauseBeforeFinalizeElem.on("click",function(){var b=Boolean(a.$pauseBeforeFinalizeCheckbox.is(":checked"));b!==Boolean(wpmdb_data.pause_before_finalize)&&(wpmdb_data.pause_before_finalize_changed=!0,wpmdb_data.pause_before_finalize=b)})},initTabElem:function(){var a=this;this.$tabElem=d("<a class=stage-tab>").append("<span class=stage-title>"+this.model.get("strings").stage_title+"</span> ").append("<span class=stage-status>"+this.model.get("strings").queued+"</span> ").on("click",function(){a.model.activateTab()})},updateProgressElem:function(){var a=Math.max(0,this.model.getTotalProgressPercent()),b=wpmdb.functions.convertKBSizeToHRFixed(Math.min(this.model.getTotalSizeTransferred(),this.model.get("totalSize"))),c=Math.min(this.model.countItemsComplete(),this.model.get("items").length);"complete"===this.model.get("status")&&0===this.model.get("totalSize")&&(a=100,this.$showHideTablesElem.fadeOut()),this.$totalProgressElem.find(".percent-complete").text(a),this.$totalProgressElem.find(".size-complete").text(b),this.$totalProgressElem.find(".tables-complete").text(wpmdb_add_commas(c)),this.$totalProgressElem.find(".progress-bar-wrapper .progress-bar").css({width:a+"%"})},updateStageTotals:function(){var a=this.model.get("items").length;this.$totalProgressElem.find(".tables-total").text(wpmdb_add_commas(a)),this.$totalProgressElem.find(".size-total").text(wpmdb.functions.convertKBSizeToHR(this.model.get("totalSize")))},initializeItemElement:function(a){var b=d('<div class="item-progress" />'),c=d('<div class="progress-bar"/>').css("width","0%"),e=d("<p>").addClass("item-info").append(d('<span class="name" />').text(a.name)).append(" ").append(d('<span class="size" />').text("("+wpmdb.functions.convertKBSizeToHRFixed(a.size)+")"));return b.append(e),b.append(c),b.append('<span class="dashicons dashicons-yes"/>'),b.attr("id","item-"+a.name),b.attr("data-stage",this.model.get("name")),a.$el=b,a.$progress=c,a.$title=e,a},maybeAddElementToView:function(a){this.visibleDomNodes<this.maxDomNodes?(++this.visibleDomNodes,this.$itemsContainer.append(this.initializeItemElement(a).$el)):(this.queuedElements.push(a),this.$truncationNotice?this.updateTruncationNotice():this.showTruncationNotice())},showTruncationNotice:function(){this.$truncationNotice||(this.$truncationNotice=d('<div class="truncation-notice" >'+wpmdb_strings.progress_items_truncated_msg.replace("%1$s",'<span class="hidden-items">'+wpmdb_add_commas(this.queuedElements.length)+"</span>")+"</div>"),this.$truncationNoticeHiddenItems=this.$truncationNotice.find(".hidden-items"),this.$itemsContainer.after(this.$truncationNotice))},updateTruncationNotice:function(){this.$truncationNoticeHiddenItems.text(wpmdb_add_commas(this.queuedElements.length))},getNextElementForView:function(a){var b;return this.queuedElements.length&&(a&&this.queuedElements.push(a),b=this.queuedElements.shift(),a=b instanceof d?b:this.initializeItemElement(b).$el),a},setItemProgress:function(a){var b=Math.min(100,Math.ceil(100*(a.transferred/a.size)));a.$progress.css("width",b+"%"),b>=100&&this.elemComplete(a)},elemComplete:function(a){var b=a.$el.addClass("complete");if(1!==this.model.get("items").length){var c=this.getNextElementForView(b),d=b.height(),e=b.css("margin-bottom"),f=c.clone().css({height:0,marginBottom:0}).addClass("clone");f.appendTo(this.$itemsContainer),b.css({height:d,marginBottom:e}),setTimeout(function(){b.css({height:0,marginBottom:0}),f.css({height:d,marginBottom:e}),setTimeout(function(){b.css({height:"auto",marginBottom:e}).remove(),f.remove(),this.$itemsContainer.find(".item-progress:not(.clone)").last().after(c.css({height:"auto",marginBottom:e}))}.bind(this),250)}.bind(this),1e3)}}});b.exports=e},{}],7:[function(a,b,c){!function(b,c){function d(a,b){var c,d,e=[],f={},g=b.length;for(c=0;g>c;c++)f[b[c]]=!0;for(g=a.length,c=0;g>c;c++)d=a[c],d in f&&e.push(d);return e}function e(a){a=a.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");var b=new RegExp("[\\?&]"+a+"=([^&#]*)"),c=b.exec(location.search);return null===c?"":decodeURIComponent(c[1].replace(/\+/g," "))}function f(a,c,d){var e=a.substr(0,a.indexOf(":"));return d!==e&&-1!==a.indexOf("https")?(b(".ssl-notice").show(),N=!0,a=a.replace("https","http"),void b(".pull-push-connection-info").val(a+"\n"+c)):void(N=!1)}function g(a){a!==wpmdb_data.this_prefix&&(b(".remote-prefix").html(a),M=!0,"pull"===wpmdb_migration_type()?b(".prefix-notice.pull").show():b(".prefix-notice.push").show())}function h(){if("undefined"!=typeof c.common.connection_data&&!1!==c.common.connection_data){var a=wpmdb_migration_type(),d=s(null,null);b(".mixed-case-table-name-notice").hide(),null!==d&&(d=d.join(""),d!==d.toLowerCase()&&("1"===c.common.connection_data.lower_case_table_names||"push"!==a&&"savefile"!==a)&&("1"!==wpmdb_data.lower_case_table_names&&"pull"===a||("push"===a||"savefile"===a?b(".mixed-case-table-name-notice.push").show():b(".mixed-case-table-name-notice.pull").show())))}}function i(a){var b=a,c=b.replace(/\/\/(.*)@/,"//").replace("http://","").replace("https://","").replace("www.","");return c}function j(a,b,c){var d=i(b);return"completed"===c?a.replace(/\%s\s?/,"<span class=domain-label>"+d+"</span>&nbsp;"):a.replace(/\%s(\S*)\s?/,"<span class=domain-label>"+d+"$1</span>&nbsp;")}function k(a,b,c){var d="",e="";switch(b){case"push":d=wpmdb_strings.push_migration_label_migrating,e=wpmdb_strings.push_migration_label_completed;break;case"pull":d=wpmdb_strings.pull_migration_label_migrating,e=wpmdb_strings.pull_migration_label_completed;break;case"find_replace":d=wpmdb_strings.find_replace_label_migrating,e=wpmdb_strings.find_replace_label_completed;break;case"savefile":d=wpmdb_strings.exporting_please_wait,e=wpmdb_strings.exporting_complete}var f=d;return"completed"===c&&(f=e),"push"!==b&&"pull"!==b||(f=j(f,a,c)),f}function l(a){return a.replace(/^https?:/i,"")}function m(){b(".option-group").each(function(a){b("input",this).attr("disabled","disabled"),b("label",this).css("cursor","default")})}function n(){b(".option-group").each(function(a){b("input",this).removeAttr("disabled"),b("label",this).css("cursor","pointer")})}function o(a,c,d,e){var f=c;void 0!==e&&(f=e),b(".slider",a).slider("value",parseInt(c)),b(".amount",a).html(wpmdb_add_commas(f)+" "+d)}function p(a){!0===U?(U=!1,F=!0,c.current_migration.setState(V,W,"active"),b(".pause-resume").html(wpmdb_strings.pause),c.current_migration.resumeTimer(),c.functions.execute_next_step()):(U=!0,F=!1,Z=wpmdb_strings.migration_paused,V=b(".progress-title").html(),W=b(".progress-text",".progress-wrapper-primary").html(),X=b(".progress-text",".progress-wrapper-secondary ").html(),"find_replace"===x&&(Z=wpmdb_strings.find_replace_paused),c.current_migration.setState(Z,wpmdb_strings.completing_current_request,null),b("body").off("click",".pause-resume"),b("body").off("click",".cancel"))}function q(a,c,d){var e=document.createElement("select");return b(e).attr({multiple:"multiple",name:"select_tables[]",id:"select-tables","class":"multiselect"}),0<a.length&&b.each(a,function(a,f){if(!b.wpmdb.apply_filters("wpmdb_exclude_table",!1,f)){var g=" ";void 0!==d&&null!==d&&0<d.length&&-1!==b.inArray(f,d)&&(g=' selected="selected" '),b(e).append("<option"+g+'value="'+f+'">'+f+" ("+c[f]+")</option>")}}),e}function r(a,b){var d=wpmdb_data.this_temp_prefix;return"pull"===wpmdb_migration_type()&&"undefined"!=typeof c.common.connection_data&&"undefined"!=typeof c.common.connection_data.temp_prefix&&(d=c.common.connection_data.temp_prefix),d===b.substring(0,d.length)?!0:a}function s(a,d){var e="",f=wpmdb_migration_type(),g=b("input[name=table_migrate_option]:checked").val();return"migrate_select"===g?e=b("#select-tables").val():("pull"!==f&&"undefined"!=typeof wpmdb_data.this_prefixed_tables&&(e=wpmdb_data.this_prefixed_tables),"pull"===f&&"undefined"!=typeof c.common.connection_data&&"undefined"!=typeof c.common.connection_data.prefixed_tables&&(e=c.common.connection_data.prefixed_tables)),e}function t(a,c){return b(".table-select-wrap .table-prefix").text()}function u(a){!0===a?(b('.replace-row.pin .replace-right-col input[type="text"]').attr("readonly","readonly"),b(".replace-row.pin .arrow-col").addClass("disabled")):(b('.replace-row.pin .replace-right-col input[type="text"]').removeAttr("readonly"),b(".replace-row.pin .arrow-col").removeClass("disabled"))}function v(a){c.common.previous_connection_data=c.common.connection_data,c.common.connection_data=a,b.wpmdb.do_action("wpmdb_connection_data_updated",a)}function w(a){var b={};return b.unit="MB",b.amount=(a/1024).toFixed(2),b}var x,y,z,A,B,C,D=!1,E="",F=!1,G=!1,H=!1,I=!1,J=!1,K=!1,L=!1,M=!1,N=!1,O=!1,P=!1,Q=!1,R="",S="",T="",U=!1,V="",W="",X="",Y="",Z="",$=!1,_=!1,aa=0,ba=400,ca=!1,da=!1;c.migration_progress_controller=a("MigrationProgress-controller"),c.current_migration=null,c.migration_selection=wpmdb_migration_type();var ea=ajaxurl.replace("/admin-ajax.php",""),fa=ea+"/images/spinner";2<window.devicePixelRatio&&(fa+="-2x"),fa+=".gif";var ga='<img src="'+fa+'" alt="" class="ajax-spinner general-spinner" />';window.onbeforeunload=function(a){return Q?(a=a||window.event,a&&(a.returnValue=wpmdb_strings.sure),wpmdb_strings.sure):void 0},b.wpmdb.add_filter("wpmdb_exclude_table",r),b(document).ready(function(){function a(a){var c=!G;L=!0,b.ajax({url:ajaxurl,type:"POST",dataType:"json",cache:!1,data:{action:"wpmdb_check_licence",licence:a,context:"all",nonce:wpmdb_data.nonces.check_licence},error:function(a,b,c){alert(wpmdb_strings.license_check_problem)},success:function(a){var d,e,f,g=b(".support-content"),h=b(".addons-content"),i=b(".licence-status:not(.notification-message)");if("undefined"!=typeof a.dbrains_api_down)e=a.dbrains_api_down+a.message,f=a.dbrains_api_down;else if("undefined"!=typeof a.errors){if("undefined"!=typeof a.errors.subscription_expired)d=a.errors.subscription_expired.licence,e=a.errors.subscription_expired.support,f=a.errors.subscription_expired.addons;else{var j="";for(var k in a.errors)j+=a.errors[k];e=j,f=j}"undefined"!=typeof a.addon_content&&(f+="\n"+a.addon_content)}else e=a.message,f=a.addon_content;c&&i.stop().fadeOut(ba,function(){"undefined"==typeof d&&(b(this).css({visibility:"hidden",display:"block"}).slideUp(),d=""),b(this).empty().html(d).stop().fadeIn(ba)}),g.stop().fadeOut(ba,function(){b(this).empty().html(e).stop().fadeIn(ba)}),h.stop().fadeOut(ba,function(){b(this).empty().html(f).stop().fadeIn(ba)})}})}function j(){void 0!==wpmdb_data&&void 0!==wpmdb_data.this_tables&&void 0!==wpmdb_data.this_table_sizes_hr&&(Aa=q(wpmdb_data.this_tables,wpmdb_data.this_table_sizes_hr,b(Aa).val())),void 0!==c.common.connection_data&&void 0!==c.common.connection_data.tables&&void 0!==c.common.connection_data.table_sizes_hr&&(Ba=q(c.common.connection_data.tables,c.common.connection_data.table_sizes_hr,b(Ba).val()))}function r(){b("#select-tables").remove(),b(".select-tables-wrap").prepend(Aa),b("#select-tables").change()}function V(){b("#select-tables").remove(),b(".select-tables-wrap").prepend(Ba),b("#select-tables").change()}function W(){b("#migrate-selected").parents(".option-section").children(".header-expand-collapse").children(".expand-collapse-arrow").removeClass("collapsed"),b(".table-select-wrap").show(),b("#migrate-only-with-prefix").prop("checked",!1),b("#migrate-selected").prop("checked",!0),b(".table-migrate-options").hide(),b(".select-tables-wrap").show()}function X(){b(".table-migrate-options").show()}function Z(){b("#select-tables").children("option").prop("selected",!0),b("#select-tables").change()}function ea(a,b){return l(wpmdb_data.this_url)}function ha(){var a=wpmdb_migration_type(),d=b.trim(b(".pull-push-connection-info").val()).split("\n");if("undefined"!=typeof wpmdb_default_profile&&!0!==wpmdb_default_profile&&"savefile"!==a&&"find_replace"!==a&&!F&&wpmdb_data.is_pro){F=!0,m(),b(".connection-status").html(wpmdb_strings.establishing_remote_connection),b(".connection-status").removeClass("notification-message error-notice migration-error"),b(".connection-status").append(ga);var e=wpmdb_migration_type();b.ajax({url:ajaxurl,type:"POST",dataType:"json",cache:!1,data:{action:"wpmdb_verify_connection_to_remote_site",url:d[0],key:d[1],intent:e,nonce:wpmdb_data.nonces.verify_connection_to_remote_site,convert_post_type_selection:wpmdb_convert_post_type_selection,profile:wpmdb_data.profile},error:function(a,c,d){b(".connection-status").html(pa(a.responseText,"(#102)",a)),b(".connection-status").addClass("notification-message error-notice migration-error"),b(".ajax-spinner").remove(),F=!1,n()},success:function(a){if(b(".ajax-spinner").remove(),F=!1,n(),"undefined"!=typeof a.wpmdb_error&&1===a.wpmdb_error)return b(".connection-status").html(a.body),b(".connection-status").addClass("notification-message error-notice migration-error"),void(a.body.indexOf("401 Unauthorized")>-1&&b(".basic-access-auth-wrapper").show());f(d[0],d[1],a.scheme),g(a.prefix),b(".pull-push-connection-info").addClass("temp-disabled"),b(".pull-push-connection-info").attr("readonly","readonly"),b(".connect-button").hide(),b(".connection-status").hide(),b(".step-two").show(),D=!0,v(a),na(),h();var e="";!1===wpmdb_default_profile&&"undefined"!=typeof wpmdb_loaded_tables&&(e=wpmdb_loaded_tables),Ba=q(c.common.connection_data.tables,c.common.connection_data.table_sizes_hr,e);var i="";!1===wpmdb_default_profile&&"undefined"!=typeof wpmdb_loaded_post_types&&("undefined"!=typeof a.select_post_types?(b("#exclude-post-types").attr("checked","checked"),b(".post-type-select-wrap").show(),i=a.select_post_types):i=wpmdb_loaded_post_types);var j=document.createElement("select");b(j).attr({multiple:"multiple",name:"select_post_types[]",id:"select-post-types","class":"multiselect"}),b.each(c.common.connection_data.post_types,function(a,c){var d=b.inArray(c,i);d=-1!==d||!0===wpmdb_convert_exclude_revisions&&"revision"!==c?' selected="selected" ':" ",b(j).append("<option"+d+'value="'+c+'">'+c+"</option>")}),Da=j;var k="";!1===wpmdb_default_profile&&"undefined"!=typeof wpmdb_loaded_tables_backup&&(k=wpmdb_loaded_tables_backup);var l=document.createElement("select");b(l).attr({multiple:"multiple",name:"select_backup[]",id:"select-backup","class":"multiselect"}),b.each(c.common.connection_data.tables,function(a,d){var e=b.inArray(d,k);e=-1!==e?' selected="selected" ':" ",b(l).append("<option"+e+'value="'+d+'">'+d+" ("+c.common.connection_data.table_sizes_hr[d]+")</option>")}),Ea=l,"pull"===wpmdb_migration_type()?(b.wpmdb.do_action("wpmdb_update_pull_table_select"),b("#select-post-types").remove(),b(".exclude-post-types-warning").after(Da),b("#select-backup").remove(),b(".backup-tables-wrap").prepend(Fa),b(".table-prefix").html(a.prefix),b(".uploads-dir").html(wpmdb_data.this_uploads_dir)):(b("#select-backup").remove(),b(".backup-tables-wrap").prepend(Ea)),b.wpmdb.do_action("verify_connection_to_remote_site",c.common.connection_data)}})}}function ia(c,d){b(".licence-input, .register-licence").remove(),b(".licence-not-entered").prepend(c.masked_licence),b(".support-content").empty().html("<p>"+wpmdb_strings.fetching_license+'<img src="'+fa+'" alt="" class="ajax-spinner general-spinner" /></p>'),a(d),b(".migrate-selection label").removeClass("disabled"),b(".migrate-selection input").removeAttr("disabled")}function ja(){b.ajax({url:ajaxurl,type:"POST",dataType:"text",cache:!1,data:{action:"wpmdb_get_log",nonce:wpmdb_data.nonces.get_log},error:function(a,b,c){alert(wpmdb_strings.update_log_problem)},success:function(a){b(".debug-log-textarea").val(a)}})}function ka(){var a=b("#select-post-types").val(),c="",d=b(".exclude-post-types-warning"),e=d.find(".migrate-msg"),f=d.find(".find-replace-msg");"find_replace"===wpmdb_migration_type()?(e.hide(),f.show()):(f.hide(),e.show()),a?(c="<code>"+a.join("</code>, <code>")+"</code>",b(".excluded-post-types").html(c),"0"===d.css("opacity")&&d.css({opacity:0}).slideDown(200).animate({opacity:1})):d.css({opacity:0}).slideUp(200).animate({opacity:0})}function la(){b("#overlay").removeClass("show").addClass("hide"),b("#overlay > div").removeClass("show").addClass("hide"),c.current_migration.$proVersion.find("iframe").remove(),setTimeout(function(){b("#overlay").remove()},500),P=!1}function ma(){var a;if(b(".save-settings-button").blur(),!I){if(b("#migrate-selected").is(":checked")&&null===b("#select-tables").val())return void alert(wpmdb_strings.please_select_one_table);if("savefile"!==wpmdb_migration_type()&&b("#backup-manual-select").is(":checked")&&null===b("#select-backup").val())return void alert(wpmdb_strings.please_select_one_table_backup);
2
+ var c=!1;b("#create_new").is(":checked")&&(c=!0);var d=b(".create-new-profile").val();I=!0,a=b(b("#migrate-form")[0].elements).not(".auth-credentials").serialize(),b(".save-settings-button").attr("disabled","disabled").after('<img src="'+fa+'" alt="" class="save-profile-ajax-spinner general-spinner" />'),F=!0,b.ajax({url:ajaxurl,type:"POST",dataType:"text",cache:!1,data:{action:"wpmdb_save_profile",profile:a,nonce:wpmdb_data.nonces.save_profile},error:function(a,c,d){F=!1,alert(wpmdb_strings.save_profile_problem),b(".save-settings-button").removeAttr("disabled"),b(".save-profile-ajax-spinner").remove(),b(".save-settings-button").after('<span class="ajax-success-msg">'+wpmdb_strings.saved+"</span>"),b(".ajax-success-msg").fadeOut(2e3,function(){b(this).remove()}),I=!1},success:function(a){var e=parseInt(b("#migrate-form input[name=save_migration_profile_option]:checked").val(),10)+1;if(F=!1,b(".save-settings-button").removeAttr("disabled"),b(".save-profile-ajax-spinner").remove(),b(".save-settings-button").after('<span class="ajax-success-msg">'+wpmdb_strings.saved+"</span>"),b(".ajax-success-msg").fadeOut(2e3,function(){b(this).remove()}),I=!1,b(".create-new-profile").val(""),c){var f=parseInt(a,10),g=f+1,h=b('<li><span class="delete-profile" data-profile-id="'+g+'"></span><label for="profile-'+g+'"><input id="profile-'+g+'" value="'+f+'" name="save_migration_profile_option" type="radio"></label></li>');h.find("label").append(document.createTextNode(" "+d)),e=g,b("#create_new").parents("li").before(h),b("#profile-"+g).attr("checked","checked")}var i=window.location.href.replace("#migrate","").replace(/&wpmdb-profile=-?\d+/,"")+"&wpmdb-profile="+e,j=b("#migrate-form input[name=save_migration_profile_option]:checked").parent().text().trim();if("function"==typeof window.history.pushState){if(b("#migrate-form .crumbs").length)b("#migrate-form .crumbs .crumb:last").text(j);else{var k=b('<div class="crumbs" />').append('<a class="crumb" href="'+wpmdb_data.this_plugin_base+'"> Saved Profiles </a>').append('<span class="crumb">'+j+"</span>");b("#migrate-form").prepend(k)}window.history.pushState({updated_profile_id:e},null,i)}}})}}function na(){b(".connection-status").hide(),b(".prefix-notice").hide(),b(".ssl-notice").hide(),b(".different-plugin-version-notice").hide(),b(".step-two").show(),b(".backup-options").show(),b(".keep-active-plugins").show(),b(".directory-permission-notice").hide(),b("#create-backup").removeAttr("disabled"),b("#create-backup-label").removeClass("disabled"),b(".backup-option-disabled").hide(),b(".compatibility-older-mysql").hide();var a,d=b.trim(b(".pull-push-connection-info").val()).split("\n");if(wpmdb_toggle_migration_action_text(),b.wpmdb.do_action("move_connection_info_box",{migration_type:wpmdb_migration_type(),last_migration_type:E}),"pull"===wpmdb_migration_type()){if(b(".pull-list li").append(Ga),Ga.show(function(){var a=b(this).find(".pull-push-connection-info");a.val()||a.focus()}),("push"===c.migration_selection||"savefile"===c.migration_selection)&&2===d.length)return c.force_reconnect=!0,b(".pull-list li").append(Ga),b(".pull-push-connection-info").removeClass("temp-disabled").attr("readonly","readonly"),b(".connect-button").hide(),void ta();D?(b(".connection-status").hide(),b(".step-two").show(),b(".table-prefix").html(c.common.connection_data.prefix),b(".backup-table-prefix").html(wpmdb_data.site_details.prefix),b(".uploads-dir").html(wpmdb_data.this_uploads_dir),!1===K&&(a=i(c.common.connection_data.url),b(".create-new-profile").val(a)),!0===M&&b(".prefix-notice.pull").show(),!0===N&&b(".ssl-notice").show(),!0===O&&(b(".different-plugin-version-notice").show(),b(".step-two").hide()),wpmdb_toggle_migration_action_text(),!1===wpmdb_data.write_permission&&(b("#create-backup").prop("checked",!1),b("#create-backup").attr("disabled","disabled"),b("#create-backup-label").addClass("disabled"),b(".backup-option-disabled").show(),b(".upload-directory-location").html(wpmdb_data.this_upload_dir_long))):(b(".connection-status").show(),b(".step-two").hide())}else if("push"===wpmdb_migration_type()){if(b(".push-list li").append(Ga),Ga.show(function(){var a=b(this).find(".pull-push-connection-info");a.val()||a.focus()}),("pull"===c.migration_selection||"savefile"===c.migration_selection)&&2===d.length)return c.force_reconnect=!0,b(".push-list li").append(Ga),b(".pull-push-connection-info").removeClass("temp-disabled").attr("readonly","readonly"),b(".connect-button").hide(),void ta();D?(b(".connection-status").hide(),b(".step-two").show(),b(".table-prefix").html(wpmdb_data.this_prefix),b(".backup-table-prefix").html(c.common.connection_data.prefix),b(".uploads-dir").html(c.common.connection_data.uploads_dir),!1===K&&(a=i(c.common.connection_data.url),b(".create-new-profile").val(a)),!0===M&&b(".prefix-notice.push").show(),!0===N&&b(".ssl-notice").show(),!0===O&&(b(".different-plugin-version-notice").show(),b(".step-two").hide()),wpmdb_toggle_migration_action_text(),"0"===c.common.connection_data.write_permissions&&(b("#create-backup").prop("checked",!1),b("#create-backup").attr("disabled","disabled"),b("#create-backup-label").addClass("disabled"),b(".backup-option-disabled").show(),b(".upload-directory-location").html(c.common.connection_data.upload_dir_long))):(b(".connection-status").show(),b(".step-two").hide())}else if(("savefile"===wpmdb_migration_type()||"find_replace"===wpmdb_migration_type())&&(b(".connection-status").hide(),b(".step-two").show(),b(".table-prefix").html(wpmdb_data.this_prefix),b(".compatibility-older-mysql").show(),!1===K&&b(".create-new-profile").val(""),"find_replace"!==wpmdb_migration_type()&&b(".backup-options").hide(),b(".keep-active-plugins").hide(),!1===wpmdb_data.write_permission&&(b(".directory-permission-notice").show(),b(".step-two").hide()),"find_replace"===wpmdb_migration_type()&&"true"===wpmdb_data.is_multisite)){var e=b(".old-replace-col").eq(1);e.parent().removeClass("pin").find(".replace-remove-row").show(),e.find("input").removeAttr("readonly")}h()}function oa(){var a=null,d=null;null!==c.common.previous_connection_data&&"object"==typeof c.common.previous_connection_data&&c.common.previous_connection_data.url!==c.common.connection_data.url&&(a=l(c.common.previous_connection_data.url),d=c.common.previous_connection_data.path),"push"===wpmdb_migration_type()||"savefile"===wpmdb_migration_type()?("pull"===E?b(".replace-row").each(function(){var a=b(".old-replace-col input",this).val();b(".old-replace-col input",this).val(b(".replace-right-col input",this).val()),b(".replace-right-col input",this).val(a)}):"push"===E&&"push"===wpmdb_migration_type()&&null!==a&&null!==d&&b(".replace-row").each(function(){var e=b(".replace-right-col input",this).val();e===d&&b(".replace-right-col input",this).val(c.common.connection_data.path),e===a&&b(".replace-right-col input",this).val(l(c.common.connection_data.url))}),b.wpmdb.do_action("wpmdb_update_push_table_select"),b("#select-post-types").remove(),b(".exclude-post-types-warning").after(Ca),ka(),b("#select-backup").remove(),b(".backup-tables-wrap").prepend(Ea)):"pull"===wpmdb_migration_type()&&(""===E||"push"===E||"savefile"===E?b(".replace-row").each(function(){var a=b(".old-replace-col input",this).val();b(".old-replace-col input",this).val(b(".replace-right-col input",this).val()),b(".replace-right-col input",this).val(a)}):"pull"===E&&"pull"===wpmdb_migration_type()&&null!==a&&null!==d&&b(".replace-row").each(function(){var e=b(".old-replace-col input",this).val();e===d&&b(".old-replace-col input",this).val(c.common.connection_data.path),e===a&&b(".old-replace-col input",this).val(l(c.common.connection_data.url))}),b.wpmdb.do_action("wpmdb_update_pull_table_select"),b("#select-post-types").remove(),b(".exclude-post-types-warning").after(Da),ka(),b("#select-backup").remove(),b(".backup-tables-wrap").prepend(Fa)),E=wpmdb_migration_type()}function pa(a,b,c){return wpmdbGetAjaxErrors(wpmdb_strings.connection_local_server_problem,b,a,c)}function qa(a){return/^([a-z]([a-z]|\d|\+|-|\.)*):(\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?((\[(|(v[\da-f]{1,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A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i.test(a)}function ra(c,d){b(".nav-tab").removeClass("nav-tab-active"),b(".nav-tab."+c).addClass("nav-tab-active"),b(".content-tab").hide(),b("."+c+"-tab").show(),"settings"===c&&!0===sa()&&(b("p.licence-status").append("Checking License... ").append(ga),a()),"help"===c&&(ja(),!0===sa()&&(b(".support-content p").append(ga),a())),"addons"===c&&!0!==d&&!0===sa()&&(b(".addons-content p").append(ga),a())}function sa(){return!1===L&&"1"===wpmdb_data.has_licence&&"true"===wpmdb_data.is_pro}function ta(){var a=b(".pull-push-connection-info");if(!F&&!b(a).hasClass("temp-disabled")||!1!==c.force_reconnect){c.force_reconnect=!1;var d=b(".pull-push-connection-info").val(),e=b.trim(d).split("\n"),k=!1,o="";if(""===e&&(k=!0,o=wpmdb_strings.connection_info_missing),1===e.length&&!k){var p=b.trim(d).split(" ");2===p.length&&(e=p)}2===e.length||k||(k=!0,o=wpmdb_strings.connection_info_incorrect),k||qa(e[0])||(k=!0,o=wpmdb_strings.connection_info_url_invalid);var q=0;if("undefined"!=typeof e[1]&&(q=e[1].length),k||32===q||40===q||(k=!0,o=wpmdb_strings.connection_info_key_invalid),k||e[0]!==wpmdb_data.connection_info[0]||(k=!0,o=wpmdb_strings.connection_info_local_url),k||e[1]!==wpmdb_data.connection_info[1]||(k=!0,o=wpmdb_strings.connection_info_local_key),k)return b(".connection-status").html(o),void b(".connection-status").addClass("notification-message error-notice migration-error");var r=e[0]+"\n"+e[1];1===b.trim(d).split("\n").length&&b(".pull-push-connection-info").val(r),!1===wpmdb_data.openssl_available&&(e[0]=e[0].replace("https://","http://"),r=e[0]+"\n"+e[1],b(".pull-push-connection-info").val(r)),M=!1,F=!0,m(),b(".basic-access-auth-wrapper").is(":visible")&&(e[0]=e[0].replace(/\/\/(.*)@/,"//"),e[0]=e[0].replace("//","//"+encodeURIComponent(b.trim(b(".auth-username").val()))+":"+encodeURIComponent(b.trim(b(".auth-password").val()))+"@"),r=e[0]+"\n"+e[1],b(".pull-push-connection-info").val(r),b(".basic-access-auth-wrapper").hide()),b(".step-two").hide(),b(".ssl-notice").hide(),b(".prefix-notice").hide(),b(".connection-status").show(),b(".connection-status").html(wpmdb_strings.establishing_remote_connection),b(".connection-status").removeClass("notification-message error-notice migration-error"),b(".connection-status").append(ga);var s=wpmdb_migration_type();K=!1,b.ajax({url:ajaxurl,type:"POST",dataType:"json",cache:!1,data:{action:"wpmdb_verify_connection_to_remote_site",url:e[0],key:e[1],intent:s,nonce:wpmdb_data.nonces.verify_connection_to_remote_site},error:function(a,c,d){b(".connection-status").html(pa(a.responseText,"(#100)",a)),b(".connection-status").addClass("notification-message error-notice migration-error"),b(".ajax-spinner").remove(),F=!1,n()},success:function(a){if(b(".ajax-spinner").remove(),F=!1,n(),"undefined"!=typeof a.wpmdb_error&&1===a.wpmdb_error)return b(".connection-status").html(a.body),b(".connection-status").addClass("notification-message error-notice migration-error"),a.body.indexOf("401 Unauthorized")>-1&&b(".basic-access-auth-wrapper").show(),void(b(".pull-push-connection-info").hasClass("temp-disabled")||b(".connect-button").is(":visible")||(b(".pull-push-connection-info").removeAttr("readonly"),b(".connect-button").show()));f(e[0],e[1],a.scheme);var d=i(a.url);b(".create-new-profile").val(d),b(".pull-push-connection-info").addClass("temp-disabled"),b(".pull-push-connection-info").attr("readonly","readonly"),b(".connect-button").hide(),b(".connection-status").hide(),b(".step-two").show(),g(a.prefix),D=!0,v(a),na(),oa(),h(),j(),Ea=b(Ba).clone(),b(Ea).attr({name:"select_backup[]",id:"select-backup"});var k=document.createElement("select");b(k).attr({multiple:"multiple",name:"select_post_types[]",id:"select-post-types","class":"multiselect"}),b.each(c.common.connection_data.post_types,function(a,c){b(k).append('<option value="'+c+'">'+c+"</option>")}),Da=k,b("#new-path-missing-warning, #new-url-missing-warning").hide(),"pull"===wpmdb_migration_type()?(b("#new-url").val(l(wpmdb_data.this_url)),b("#new-path").val(wpmdb_data.this_path),"true"===wpmdb_data.is_multisite&&(b("#new-domain").val(wpmdb_data.this_domain),b('.replace-row.pin .old-replace-col input[type="text"]').val(l(a.url))),b("#old-url").val(l(a.url)),b("#old-path").val(a.path),b.wpmdb.do_action("wpmdb_update_pull_table_select"),b("#select-post-types").remove(),b(".exclude-post-types-warning").after(Da),ka(),b(".table-prefix").html(a.prefix),b(".backup-table-prefix").html(wpmdb_data.site_details.prefix),b(".uploads-dir").html(wpmdb_data.this_uploads_dir)):(b("#new-url").val(l(a.url)),b("#new-path").val(a.path),"true"===wpmdb_data.is_multisite&&b('.replace-row.pin .old-replace-col input[type="text"]').val(l(wpmdb_data.this_url)),b.wpmdb.do_action("wpmdb_update_push_table_select"),b("#select-backup").remove(),b(".backup-tables-wrap").prepend(Ea)),c.common.next_step_in_migration={fn:b.wpmdb.do_action,args:["verify_connection_to_remote_site",c.common.connection_data]},c.functions.execute_next_step()}})}}function ua(a){$=!0,Y=wpmdb_strings.cancelling_migration,b(".migration-controls").css({visibility:"hidden"}),"find_replace"===x&&(Y=wpmdb_strings.cancelling_find_replace),c.current_migration.setState(Y,wpmdb_strings.completing_current_request,"cancelling"),!0===U&&(U=!1,c.functions.execute_next_step())}function va(a){var c=b("#"+a),d=c.find("input[type=checkbox]");c.toggleClass("on").find("span").toggleClass("checked");var e=c.find("span.on").hasClass("checked");d.attr("checked",e).trigger("change")}c.migration_state_id="",b("#plugin-compatibility").change(function(a){var c="1",d=b(this).closest("td").next("td").find(".setting-status");if(b(this).is(":checked")){var e=confirm(wpmdb_strings.mu_plugin_confirmation);if(!e)return void b(this).prop("checked",!1)}else c="0";b(".plugin-compatibility-wrap").toggle(),d.find(".ajax-success-msg").remove(),d.append(ga),b("#plugin-compatibility").attr("disabled","disabled"),b(".plugin-compatibility").addClass("disabled"),b.ajax({url:ajaxurl,type:"POST",dataType:"text",cache:!1,data:{action:"wpmdb_plugin_compatibility",install:c,nonce:wpmdb_data.nonces.plugin_compatibility},error:function(a,c,d){alert(wpmdb_strings.plugin_compatibility_settings_problem+"\r\n\r\n"+wpmdb_strings.status+" "+a.status+" "+a.statusText+"\r\n\r\n"+wpmdb_strings.response+"\r\n"+a.responseText),b(".ajax-spinner").remove(),b("#plugin-compatibility").removeAttr("disabled"),b(".plugin-compatibility").removeClass("disabled")},success:function(a){""!==b.trim(a)?alert(a):(d.append('<span class="ajax-success-msg">'+wpmdb_strings.saved+"</span>"),b(".ajax-success-msg").fadeOut(2e3,function(){b(this).remove()})),b(".ajax-spinner").remove(),b("#plugin-compatibility").removeAttr("disabled"),b(".plugin-compatibility").removeClass("disabled")}})}),b("#plugin-compatibility").is(":checked")&&b(".plugin-compatibility-wrap").show(),(0<=navigator.userAgent.indexOf("MSIE")||0<=navigator.userAgent.indexOf("Trident"))&&b(".ie-warning").show(),0===wpmdb_data.valid_licence&&b("#savefile").prop("checked",!0);var wa=b(".max-request-size"),xa=b(".slider",wa);xa.slider({range:"min",value:parseInt(wpmdb_data.max_request/1024),min:512,max:parseInt(wpmdb_data.bottleneck/1024),step:256,create:function(a,b){var c=w(wpmdb_data.max_request/1024);o(wa,wpmdb_data.max_request/1024,c.unit,c.amount)},slide:function(a,b){var c=w(b.value);o(wa,b.value,c.unit,c.amount)},stop:function(a,c){b(".slider-success-msg").remove(),b(".amount",wa).after('<img src="'+fa+'" alt="" class="slider-spinner general-spinner" />'),xa.slider("disable"),b.ajax({url:ajaxurl,type:"POST",cache:!1,data:{action:"wpmdb_update_max_request_size",max_request_size:parseInt(c.value),nonce:wpmdb_data.nonces.update_max_request_size},error:function(a,c,d){xa.slider("enable"),b(".slider-spinner",wa).remove(),alert(wpmdb_strings.max_request_size_problem);var e=w(wpmdb_data.max_request/1024);o(wa,wpmdb_data.max_request/1024,e.unit,e.amount),xa.slider("enable")},success:function(){xa.slider("enable"),b(".slider-label-wrapper",wa).append('<span class="slider-success-msg">'+wpmdb_strings.saved+"</span>"),b(".slider-success-msg",wa).fadeOut(2e3,function(){b(this).remove()}),b(".slider-spinner",wa).remove()}})}});var ya=b(".delay-between-requests"),za=b(".slider",ya);za.slider({range:"min",value:parseInt(wpmdb_data.delay_between_requests/1e3),min:0,max:10,step:1,create:function(a,b){o(ya,wpmdb_data.delay_between_requests/1e3,"s")},slide:function(a,b){o(ya,b.value,"s")},stop:function(a,c){b(".slider-success-msg").remove(),b(".amount",ya).after('<img src="'+fa+'" alt="" class="slider-spinner general-spinner" />'),za.slider("disable"),b.ajax({url:ajaxurl,type:"POST",cache:!1,data:{action:"wpmdb_update_delay_between_requests",delay_between_requests:parseInt(1e3*c.value),nonce:wpmdb_data.nonces.update_delay_between_requests},error:function(a,c,d){za.slider("enable"),b(".slider-spinner",ya).remove(),alert(wpmdb_strings.delay_between_requests_problem),o(ya,wpmdb_data.delay_between_requests/1e3,"s"),za.slider("enable")},success:function(){wpmdb_data.delay_between_requests=parseInt(1e3*c.value),za.slider("enable"),b(".slider-label-wrapper",ya).append('<span class="slider-success-msg">'+wpmdb_strings.saved+"</span>"),b(".slider-success-msg",ya).fadeOut(2e3,function(){b(this).remove()}),b(".slider-spinner",ya).remove()}})}});var Aa=b("#select-tables").clone(),Ba=b("#select-tables").clone(),Ca=b("#select-post-types").clone(),Da=b("#select-post-types").clone(),Ea=b("#select-backup").clone(),Fa=b("#select-backup").clone();b(".help-tab .video").each(function(){var a=b(this),c=b(".video-viewer");b("a",this).click(function(d){d.preventDefault(),c.attr("src","//www.youtube.com/embed/"+a.data("video-id")+"?autoplay=1"),c.show();var e=c.offset();b(window).scrollTop(e.top-50)})}),b(".backup-options").show(),b(".keep-active-plugins").show(),"savefile"===wpmdb_migration_type()&&(b(".backup-options").hide(),b(".keep-active-plugins").hide()),E=wpmdb_migration_type(),b(".content-tab").on("click",".check-my-licence-again",function(c){c.preventDefault(),L=!1,b(c.target).replaceWith("Checking... "+ga),a(null,"all")}),b.wpmdb.add_action("wpmdb_refresh_table_selects",j),b.wpmdb.add_action("wpmdb_update_push_table_select",r),b.wpmdb.add_action("wpmdb_update_pull_table_select",V),b.wpmdb.add_action("wpmdb_disable_table_migration_options",W),b.wpmdb.add_action("wpmdb_enable_table_migration_options",X),b.wpmdb.add_action("wpmdb_select_all_tables",Z),b.wpmdb.add_filter("wpmdb_base_old_url",ea),ha(),b("body").on("click",".js-action-link",function(a){a.preventDefault(),b(this).blur()}),b(".licence-input").keypress(function(a){13===a.which&&(a.preventDefault(),b(".register-licence").click())}),b("body").on("click",".register-licence",function(a){if(a.preventDefault(),!G){var c=b.trim(b(".licence-input").val()),d=b(".licence-status");if(d.removeClass("notification-message error-notice success-notice"),""===c)return void d.html('<div class="notification-message error-notice">'+wpmdb_strings.enter_license_key+"</div>");d.empty().removeClass("success"),G=!0,b(".button.register-licence").after('<img src="'+fa+'" alt="" class="register-licence-ajax-spinner general-spinner" />'),b.ajax({url:ajaxurl,type:"POST",dataType:"JSON",cache:!1,data:{action:"wpmdb_activate_licence",licence_key:c,nonce:wpmdb_data.nonces.activate_licence,context:"licence"},error:function(a,c,e){G=!1,b(".register-licence-ajax-spinner").remove(),d.html(wpmdb_strings.register_license_problem)},success:function(a){if(b(".register-licence-ajax-spinner").remove(),"undefined"!=typeof a.errors){var e="";for(var f in a.errors)e+=a.errors[f];d.html(e),"undefined"!=typeof a.masked_licence&&(ia(a,c),b(".migrate-tab .invalid-licence").hide())}else"undefined"!=typeof a.wpmdb_error&&"undefined"!=typeof a.body?d.html(a.body):(1===Number(a.is_first_activation)&&(wpmdb_strings.welcome_text=wpmdb_strings.welcome_text.replace("%1$s","https://deliciousbrains.com/wp-migrate-db-pro/doc/quick-start-guide/"),wpmdb_strings.welcome_text=wpmdb_strings.welcome_text.replace("%2$s","https://deliciousbrains.com/wp-migrate-db-pro/videos/"),d.after('<div id="welcome-wrap"><img id="welcome-img" src="'+wpmdb_data.this_plugin_url+'asset/dist/img/welcome.jpg" /><div class="welcome-text"><h3>'+wpmdb_strings.welcome_title+"</h3><p>"+wpmdb_strings.welcome_text+"</p></div></div>")),d.html(wpmdb_strings.license_registered).delay(5e3).fadeOut(1e3,function(){b(this).css({visibility:"hidden",display:"block"}).slideUp()}),d.addClass("success notification-message success-notice"),ia(a,c),b(".invalid-licence").hide());G=!1}})}}),b(".clear-log").click(function(){b(".ajax-spinner, .ajax-success-msg").remove(),b(this).after(ga),b(".debug-log-textarea").val(""),b.ajax({url:ajaxurl,type:"POST",dataType:"text",cache:!1,data:{action:"wpmdb_clear_log",nonce:wpmdb_data.nonces.clear_log},error:function(a,c,d){b(".ajax-spinner").remove(),alert(wpmdb_strings.clear_log_problem)},success:function(a){b(".ajax-spinner, .ajax-success-msg").remove(),ja(),b(".clear-log").after('<span class="ajax-success-msg">'+wpmdb_strings.clear_error_log+"</span>"),b(".ajax-success-msg").fadeOut(2e3,function(){b(this).remove()})}})}),b(".multiselect-select-all").click(function(){var a=b(this).parents(".select-wrap").children(".multiselect");b("option",a).prop("selected",1),b(a).focus().trigger("change")}),b(".multiselect-deselect-all").click(function(){var a=b(this).parents(".select-wrap").children(".multiselect");b("option",a).removeAttr("selected"),b(a).focus().trigger("change")}),b(".multiselect-invert-selection").click(function(){var a=b(this).parents(".select-wrap").children(".multiselect");b("option",a).each(function(){b(this).attr("selected",!b(this).attr("selected"))}),b(a).focus().trigger("change")}),b(".option-group input[type=radio]").change(function(){var a=b(this).closest(".option-group");b("ul",a).hide();var c=b(this).closest("li");b("ul",c).show()}),b(".option-group").each(function(){b(".option-group input[type=radio]").each(function(){if(b(this).is(":checked")){var a=b(this).closest("li");b("ul",a).show()}})}),b(".header-expand-collapse").click(function(){b(".expand-collapse-arrow",this).hasClass("collapsed")?(b(".expand-collapse-arrow",this).removeClass("collapsed"),b(this).next().show()):(b(".expand-collapse-arrow",this).addClass("collapsed"),b(this).next().hide())}),b(".checkbox-label input[type=checkbox]").change(function(){b(this).is(":checked")?b(this).parent().next().show():b(this).parent().next().hide()}),b(".select-post-types-wrap").on("change","#select-post-types",function(){ka()}),b("#exclude-post-types").is(":checked")&&b("#select-post-types").val()&&b(".exclude-post-types-warning").css({display:"block",opacity:1}),b("#save-migration-profile").change(function(){c.functions.update_migrate_button_text(),b(this).is(":checked")?b(".save-settings-button").show():b(".save-settings-button").hide()}),b("#save-migration-profile").is(":checked")&&b(".save-settings-button").show(),b(".create-new-profile").focus(function(){b("#create_new").prop("checked",!0)}),b(".checkbox-label input[type=checkbox]").each(function(){b(this).is(":checked")&&b(this).parent().next().show()}),b(".migrate-db-button").click(function(a){if(b(this).blur(),a.preventDefault(),c.migration_state_id="",!1!==b.wpmdb.apply_filters("wpmdb_migration_profile_ready",!0)){if(b("#migrate-selected").is(":checked")&&null===b("#select-tables").val())return void alert(wpmdb_strings.please_select_one_table);if("savefile"!==wpmdb_migration_type()&&b("#backup-manual-select").is(":checked")&&null===b("#select-backup").val())return void alert(wpmdb_strings.please_select_one_table_backup);var e=!1,f=!1;if(b("#new-url").length&&!b("#new-url").val()&&(b("#new-url-missing-warning").show(),b("#new-url").focus(),b("html,body").scrollTop(0),e=!0),b("#new-path").length&&!b("#new-path").val()&&(b("#new-path-missing-warning").show(),!1===e&&(b("#new-path").focus(),b("html,body").scrollTop(0)),f=!0),!0!==e&&!0!==f){b("#save-migration-profile").is(":checked")&&ma(),A=b(b("#migrate-form")[0].elements).not(".auth-credentials").serialize(),x=wpmdb_migration_type(),B="backup","savefile"===x&&(B="migrate"),!1===b("#create-backup").is(":checked")&&(B="migrate"),c.current_migration=c.migration_progress_controller.newMigration({localTableSizes:wpmdb_data.this_table_sizes,localTableRows:wpmdb_data.this_table_rows,remoteTableSizes:"undefined"!=typeof c.common.connection_data?c.common.connection_data.table_sizes:null,remoteTableRows:"undefined"!=typeof c.common.connection_data?c.common.connection_data.table_rows:null,migrationIntent:wpmdb_migration_type()});var g=b("input[name=backup_option]:checked").val(),h=b("input[name=table_migrate_option]:checked").val(),i="",j="";"backup"===B&&("migrate_only_with_prefix"===h&&"backup_selected"===g&&(g="backup_only_with_prefix"),"push"===x?(j="remote","backup_only_with_prefix"===g?T=c.common.connection_data.prefixed_tables:"backup_selected"===g?(i=b("#select-tables").val(),i=b.wpmdb.apply_filters("wpmdb_backup_selected_tables",i),T=d(i,c.common.connection_data.tables)):"backup_manual_select"===g&&(T=b("#select-backup").val())):(j="local","backup_only_with_prefix"===g?T=wpmdb_data.this_prefixed_tables:"backup_selected"===g?(i=b("#select-tables").val(),i=b.wpmdb.apply_filters("wpmdb_backup_selected_tables",i),T=d(i,wpmdb_data.this_tables)):"backup_manual_select"===g&&(T=b("#select-backup").val())),c.current_migration.model.addStage("backup",T,j,{strings:{migrated:wpmdb_strings.backed_up}})),j=-1!==b.inArray(x,["push","savefile","find_replace"])?"local":"remote","find_replace"===x?("backup"!==B&&(B="find_replace"),c.current_migration.model.addStage("find_replace",s(null,null),j,{strings:{migrated:wpmdb_strings.searched,stage_title:wpmdb_strings.migrate_button_find_replace}})):c.current_migration.model.addStage("migrate",s(null,null),j),b.wpmdb.do_action("wpmdb_add_migration_stages",{data_type:j,tables_to_migrate:s(null,null)});var l=(b("input[name=table_migrate_option]:checked").val(),b.trim(b(".pull-push-connection-info").val()).split("\n"));y=l[0],z=l[1];var m=k(y,x,"migrating");C=k(y,x,"completed"),T="find_replace"===B?c.current_migration.model.getStageItems("find_replace","name"):"backup"===B?c.current_migration.model.getStageItems("backup","name"):c.current_migration.model.getStageItems("migrate","name"),c.current_migration.model.setActiveStage(B),c.current_migration.setTitle(m),c.current_migration.startTimer(),Q=!0,c.current_migration.setStatus("active");var n={action:"wpmdb_initiate_migration",intent:x,url:y,key:z,form_data:A,stage:B,nonce:wpmdb_data.nonces.initiate_migration};n.site_details={local:wpmdb_data.site_details},-1===b.inArray(x,["savefile","find_replace"])&&(n.temp_prefix=c.common.connection_data.temp_prefix,n.site_details.remote=c.common.connection_data.site_details),n.site_details=JSON.stringify(n.site_details),F=!0,b.ajax({url:ajaxurl,type:"POST",dataType:"json",cache:!1,data:n,error:function(a,b,d){c.current_migration.setState(wpmdb_strings.migration_failed,pa(a.responseText,"(#112)",a),"error"),console.log(a),console.log(b),console.log(d),F=!1,c.common.migration_error=!0,c.functions.migration_complete_events()},success:function(a){if(F=!1,"undefined"!=typeof a&&"undefined"!=typeof a.wpmdb_error&&1===a.wpmdb_error)return c.common.migration_error=!0,c.functions.migration_complete_events(),void c.current_migration.setState(wpmdb_strings.migration_failed,a.body,"error");c.migration_state_id=a.migration_state_id;var d=0;aa=0,"savefile"!==x&&"undefined"!=typeof c.common.connection_data&&"undefined"!=typeof c.common.connection_data.delay_between_requests&&(aa=Math.max(parseInt(wpmdb_data.delay_between_requests),parseInt(c.common.connection_data.delay_between_requests))),c.functions.migrate_table_recursive=function(a,e){if(d>=T.length){if("backup"!==B)return b(".progress-label").removeClass("label-visible"),c.common.hooks=b.wpmdb.apply_filters("wpmdb_before_migration_complete_hooks",c.common.hooks),c.common.hooks.push(c.functions.migration_complete),c.common.hooks.push(c.functions.wpmdb_flush),c.common.hooks=b.wpmdb.apply_filters("wpmdb_after_migration_complete_hooks",c.common.hooks),c.common.hooks.push(c.functions.migration_complete_events),c.common.next_step_in_migration={fn:wpmdb_call_next_hook},void c.functions.execute_next_step();B="migrate","find_replace"===x&&(B="find_replace"),c.current_migration.model.setActiveStage(B),d=0,T=s(null,null)}var f=0;d===T.length-1&&(f=1);var g=0;"savefile"!==x&&"find_replace"!==x&&1===parseInt(c.common.connection_data.gzip)&&(g=1);var h={action:"wpmdb_migrate_table",migration_state_id:c.migration_state_id,table:T[d],stage:B,current_row:a,last_table:f,primary_keys:e,gzip:g,nonce:wpmdb_data.nonces.migrate_table};"savefile"!==x&&"find_replace"!==x&&(h.bottleneck=c.common.connection_data.bottleneck,h.prefix=c.common.connection_data.prefix),c.common.connection_data&&c.common.connection_data.path_current_site&&c.common.connection_data.domain&&(h.path_current_site=c.common.connection_data.path_current_site,h.domain_current_site=c.common.connection_data.domain),F=!0,b.ajax({url:ajaxurl,type:"POST",dataType:"text",cache:!1,timeout:0,data:h,error:function(a,b,e){var f=wpmdb_strings.table_process_problem+" "+T[d]+"<br /><br />"+wpmdb_strings.status+": "+a.status+" "+a.statusText+"<br /><br />"+wpmdb_strings.response+":<br />"+a.responseText;c.current_migration.setState(wpmdb_strings.migration_failed,f,"error"),F=!1,console.log(a),console.log(b),console.log(e),c.common.migration_error=!0,c.functions.migration_complete_events()},success:function(a){F=!1,a=b.trim(a);var e=wpmdb_parse_json(a),g="";return!1===e||null===e?(g=""===a||null===a?wpmdb_strings.table_process_problem_empty_response+" "+T[d]:pa(a,null,null),c.current_migration.setState(wpmdb_strings.migration_failed,g,"error"),c.common.migration_error=!0,void c.functions.migration_complete_events()):"undefined"!=typeof e.wpmdb_error&&1===e.wpmdb_error?(c.current_migration.setState(wpmdb_strings.migration_failed,e.body,"error"),c.common.migration_error=!0,void c.functions.migration_complete_events()):(c.current_migration.setText(),c.current_migration.model.getStageModel(B).setItemRowsTransferred(T[d],e.current_row),1===f&&"savefile"===x&&("undefined"!=typeof e.dump_filename&&(R=e.dump_filename),"undefined"!=typeof e.dump_path&&(S=e.dump_path)),-1===parseInt(e.current_row)&&(d++,e.current_row="",e.primary_keys=""),c.common.next_step_in_migration={fn:c.functions.migrate_table_recursive,args:[e.current_row,e.primary_keys]},void c.functions.execute_next_step())}})},c.common.next_step_in_migration={fn:c.functions.migrate_table_recursive,args:["-1",""]},c.functions.execute_next_step()}})}}}),
3
+ c.functions.migration_complete_events=function(){if(!1===c.common.migration_error)if(""===c.common.non_fatal_errors)if("savefile"!==x&&!0===b("#save_computer").is(":checked")&&c.current_migration.setText(),C+='&nbsp;<div class="dashicons dashicons-yes"></div>',!0===$){var a=wpmdb_strings.migration_cancelled_success;"find_replace"===x&&(a=wpmdb_strings.find_replace_cancelled_success),c.current_migration.setState(C,a,"cancelled")}else c.current_migration.setState(C,"","complete");else c.current_migration.setState(wpmdb_strings.completed_with_some_errors,c.common.non_fatal_errors,"error");b(".migration-controls").addClass("hidden"),c.common.hooks=[],c.common.call_stack=[],c.common.migration_error=!1,Q=!1,P=!0,U=!1,$=!1,F=!1,c.common.non_fatal_errors="",b(".progress-label").remove(),b(".migration-progress-ajax-spinner").remove(),b(".close-progress-content").show(),b("#overlay").css("cursor","pointer"),c.current_migration.model.setMigrationComplete()},c.functions.migration_complete=function(){if(b(".migration-controls").addClass("hidden"),"savefile"===x){Q=!1;var a=wpmdb_strings.migration_complete;if(b("#save_computer").is(":checked")){var d=wpmdb_data.this_download_url+encodeURIComponent(R);b("#gzip_file").is(":checked")&&(d+="&gzip=1"),window.location=d}else a=wpmdb_strings.completed_dump_located_at+" "+S;!1===c.common.migration_error&&(c.functions.migration_complete_events(),c.current_migration.setState(C,a,"complete"))}else{c.current_migration.setState(null,wpmdb_strings.finalizing_migration,"finalizing");var e={action:"wpmdb_finalize_migration",migration_state_id:c.migration_state_id,tables:T.join(","),nonce:wpmdb_data.nonces.finalize_migration};"find_replace"!==x&&(e.prefix=c.common.connection_data.prefix),F=!0,b.ajax({url:ajaxurl,type:"POST",dataType:"text",cache:!1,data:e,error:function(a,b,d){F=!1,c.current_migration.setState(wpmdb_strings.migration_failed,wpmdb_strings.finalize_tables_problem,"error"),alert(a+" : "+b+" : "+d),c.common.migration_error=!0,c.functions.migration_complete_events()},success:function(a){return F=!1,"1"!==b.trim(a)?(c.current_migration.setState(wpmdb_strings.migration_failed,a,"error"),c.common.migration_error=!0,void c.functions.migration_complete_events()):(c.common.next_step_in_migration={fn:wpmdb_call_next_hook},void c.functions.execute_next_step())}})}},c.functions.wpmdb_flush=function(){"savefile"!==x&&(c.current_migration.setText(wpmdb_strings.flushing),F=!0,b.ajax({url:ajaxurl,type:"POST",dataType:"text",cache:!1,data:{action:"wpmdb_flush",migration_state_id:c.migration_state_id,nonce:wpmdb_data.nonces.flush},error:function(a,b,d){F=!1,c.current_migration.setState(wpmdb_strings.migration_failed,wpmdb_strings.flush_problem,"error"),alert(a+" : "+b+" : "+d),c.common.migration_error=!0,c.functions.migration_complete_events()},success:function(a){return F=!1,"1"!==b.trim(a)?(c.current_migration.setState(wpmdb_strings.migration_failed,a,"error"),c.common.migration_error=!0,void c.functions.migration_complete_events()):(c.common.next_step_in_migration={fn:wpmdb_call_next_hook},void c.functions.execute_next_step())}}))},c.functions.update_migrate_button_text=function(){var a=wpmdb_migration_type(),c=b("#save-migration-profile").is(":checked")?"_save":"",d="migrate_button_"+("savefile"===a?"export":a)+c;b(".migrate-db .button-primary").val(wpmdb_strings[d])},c.functions.update_migrate_button_text(),b("body").on("click",".close-progress-content-button",function(a){la(),c.current_migration.restoreTitleElem()}),b("body").on("click","#overlay",function(a){!0===P&&a.target===this&&(la(),c.current_migration.restoreTitleElem())}),b(".save-settings-button").click(function(a){return a.preventDefault(),""===b.trim(b(".create-new-profile").val())&&b("#create_new").is(":checked")?(alert(wpmdb_strings.enter_name_for_profile),void b(".create-new-profile").focus()):void ma()});var Ga=b(".connection-info-wrapper");na(),b(".migrate-selection.option-group input[type=radio]").change(function(){na(),c.migration_selection=wpmdb_migration_type(),D&&oa(),c.functions.update_migrate_button_text()}),"pull"!==wpmdb_migration_type()&&"push"!==wpmdb_migration_type()||D||(b(".step-two").hide(),b(".connection-status").show()),b(".general-helper").click(function(a){a.preventDefault();var c=b(this),d=b(this).next();b(".helper-message").not(d).hide();var e=c.position();if(d.hasClass("bottom")){var f=1;b(this).is(":first-child")&&(f=3),d.css({left:e.left-d.width()/2-f+"px",top:e.top+c.height()+9+"px"})}else d.css({left:e.left+c.width()+9+"px",top:e.top+c.height()/2-18+"px"});d.toggle(),a.stopPropagation()}),b("body").click(function(){b(".helper-message").hide()}),b(".helper-message").click(function(a){a.stopPropagation()}),b("body").on("click",".show-errors-toggle",function(a){a.preventDefault(),b(this).next(".migration-php-errors").toggle()}),b(".nav-tab").click(function(){var a=b(this).attr("data-div-name");a=a.replace("-tab",""),window.location.hash=a,ra(a,!1)}),b("body").on("click",'a[href^="#"]',function(a){var c=b(a.target).attr("href"),d=c.substr(1);if(d){var e=b("."+d);1===e.length&&(e.trigger("click"),a.preventDefault())}}),b("body").on("click",".add-row",function(){var a=b(this).parents("tr");a.before(b(".original-repeatable-field").clone().removeClass("original-repeatable-field")),a.prev().find(".old-replace-col input").focus()}),b("body").on("click",".replace-remove-row",function(){b(this).parents("tr").remove(),2>=b(".replace-row").length&&b(".no-replaces-message").show();var a=b(this).prev().attr("id");"new-url"!==a&&"new-path"!==a||b("#"+a+"-missing-warning").hide()}),b("body").on("change","#new-url",function(){b("#new-url-missing-warning").hide()}).on("change","#new-path",function(){b("#new-path-missing-warning").hide()}),b("body").on("click",".arrow-col",function(){var a=this;if(!b(a).hasClass("disabled")){var c=b(a).prev("td").find("input").val(),d=b(a).next("td").find("input");d.val(c),"new-url"===d.prop("id")?b("#new-url-missing-warning").hide():"new-path"===d.prop("id")&&b("#new-path-missing-warning").hide()}}),b(".add-replace").click(function(){b(".replace-fields").prepend(b(".original-repeatable-field").clone().removeClass("original-repeatable-field")),b(".no-replaces-message").hide()}),b("#find-and-replace-sort tbody").sortable({items:"> tr:not(.pin)",handle:"td:first",start:function(){b(".sort-handle").css("cursor","-webkit-grabbing"),b(".sort-handle").css("cursor","-moz-grabbing")},stop:function(){b(".sort-handle").css("cursor","-webkit-grab"),b(".sort-handle").css("cursor","-moz-grab")}});var Ha="";window.location.hash&&(Ha=window.location.hash.substring(1),ra(Ha,!1)),""!==e("install-plugin")&&(Ha="addons",L=!0,ra(Ha,!0)),b(".notice-link").click(function(a){a.preventDefault(),b(this).closest(".inline-message").hide(),b.ajax({url:ajaxurl,type:"POST",dataType:"text",cache:!1,data:{action:"wpmdb_process_notice_link",nonce:wpmdb_data.nonces.process_notice_link,notice:b(this).data("notice"),type:b(this).data("type"),reminder:b(this).data("reminder")}})}),b("#connection_info").on("copy",function(a){var c=b(this),d=c.val().split("\n");if(2===d.length)try{a.originalEvent.clipboardData.setData("text/plain",d.join(" ")),a.preventDefault()}catch(e){}}),b(".reset-api-key").click(function(){var a=confirm(wpmdb_strings.reset_api_key);a&&!H&&(H=!0,b(".reset-api-key").after('<img src="'+fa+'" alt="" class="reset-api-key-ajax-spinner general-spinner" />'),b.ajax({url:ajaxurl,type:"POST",dataType:"text",cache:!1,data:{action:"wpmdb_reset_api_key",nonce:wpmdb_data.nonces.reset_api_key},error:function(a,c,d){alert(wpmdb_strings.reset_api_key_problem),b(".reset-api-key-ajax-spinner").remove(),H=!1},success:function(a){b(".reset-api-key-ajax-spinner").remove(),H=!1,b(".connection-info").html(a),wpmdb_data.connection_info=b.trim(a).split("\n")}}))}),b(".copy-api-key").click(function(){var a=b(this),c=b("#connection_info"),d=c.val(),e=d.replace("\n"," ");c.val(e),c.select();try{document.execCommand("copy"),c.blur(),a.css("color","transparent");var f=b(".copy-api-key-confirmation").show();setTimeout(function(){f.fadeOut("fast"),setTimeout(function(){a.css("color","")},200)},1e3)}catch(g){alert("please press Ctrl/Cmd+C to copy")}c.val(d)}),b("input.multiselect-toggle").change(function(){b(this).parents(".expandable-content").children(".select-wrap").toggle()}),b(".show-multiselect").each(function(){b(this).is(":checked")&&(b(this).parents(".option-section").children(".header-expand-collapse").children(".expand-collapse-arrow").removeClass("collapsed"),b(this).parents(".expandable-content").show(),b(this).parents(".expandable-content").children(".select-wrap").toggle())}),b("input[name=backup_option]").change(function(){b(".backup-tables-wrap").hide(),"backup_manual_select"===b(this).val()&&b(".backup-tables-wrap").show()}),b("#backup-manual-select").is(":checked")&&b(".backup-tables-wrap").show(),b(".plugin-compatibility-save").click(function(){if(!J){b(this).addClass("disabled");var a=b("#selected-plugins");b(a).attr("disabled","disabled"),b(".plugin-compatibility-success-msg").remove(),J=!0,b(this).after('<img src="'+fa+'" alt="" class="plugin-compatibility-spinner general-spinner" />'),b.ajax({url:ajaxurl,type:"POST",dataType:"text",cache:!1,data:{action:"wpmdb_blacklist_plugins",blacklist_plugins:b(a).val(),nonce:wpmdb_data.nonces.blacklist_plugins},error:function(c,d,e){alert(wpmdb_strings.blacklist_problem+"\r\n\r\n"+wpmdb_strings.status+" "+c.status+" "+c.statusText+"\r\n\r\n"+wpmdb_strings.response+"\r\n"+c.responseText),b(a).removeAttr("disabled"),b(".plugin-compatibility-save").removeClass("disabled"),J=!1,b(".plugin-compatibility-spinner").remove()},success:function(c){""!==b.trim(c)&&alert(c),b(a).removeAttr("disabled"),b(".plugin-compatibility-save").removeClass("disabled"),J=!1,b(".plugin-compatibility-spinner").remove(),b(".plugin-compatibility-save").after('<span class="plugin-compatibility-success-msg">'+wpmdb_strings.saved+"</span>"),b(".plugin-compatibility-success-msg").fadeOut(2e3)}})}}),b("body").on("click",".delete-profile",function(){var a=b(this).next().clone();b("input",a).remove(),a=b.trim(b(a).html());var c=confirm(wpmdb_strings.remove_profile.replace("{{profile}}",a));if(c){var d=b(this).parent();if(d.find("input:checked").length){var e=d.siblings().last();if(e.find("input[type=radio]").prop("checked","checked"),e.find("input[type=text]").focus(),b("#migrate-form .crumbs .crumb:last").text("New Profile"),"function"==typeof window.history.pushState){var f=window.location.href.replace("#migrate","").replace(/&wpmdb-profile=-?\d+/,"")+"&wpmdb-profile=-1";window.history.pushState({updated_profile_id:-1},null,f)}}d.fadeOut(500),b.ajax({url:ajaxurl,type:"POST",dataType:"text",cache:!1,data:{action:"wpmdb_delete_migration_profile",profile_id:b(this).attr("data-profile-id"),nonce:wpmdb_data.nonces.delete_migration_profile},error:function(a,b,c){alert(wpmdb_strings.remove_profile_problem)},success:function(a){"-1"===a&&alert(wpmdb_strings.remove_profile_not_found)}})}}),b(".main-list-delete-profile-link").click(function(){var a=b(this).prev().html(),c=confirm(wpmdb_strings.remove_profile.replace("{{profile}}",a));c&&(b(this).parent().fadeOut(500),b.ajax({url:ajaxurl,type:"POST",dataType:"text",cache:!1,data:{action:"wpmdb_delete_migration_profile",profile_id:b(this).attr("data-profile-id"),nonce:wpmdb_data.nonces.delete_migration_profile},error:function(a,b,c){alert(wpmdb_strings.remove_profile_problem)}}))}),b("body").on("click",".temp-disabled",function(){var a=confirm(wpmdb_strings.change_connection_info);a&&(b(".ssl-notice").hide(),b(".different-plugin-version-notice").hide(),b(".migrate-db-button").show(),b(".temp-disabled").removeAttr("readonly"),b(".temp-disabled").removeClass("temp-disabled"),b(".connect-button").show(),b(".step-two").hide(),b(".connection-status").show().html(wpmdb_strings.enter_connection_info),D=!1)}),b(".settings-tab input[type=checkbox]").change(function(){if("plugin-compatibility"!==b(this).attr("id")){var a=b(this).is(":checked"),c=b(this).attr("id"),d=b(this).closest("td").next("td").find(".setting-status");b(".ajax-success-msg").remove(),d.after(ga),b.ajax({url:ajaxurl,type:"POST",dataType:"text",cache:!1,data:{action:"wpmdb_save_setting",checked:a,setting:c,nonce:wpmdb_data.nonces.save_setting},error:function(a,c,d){alert(wpmdb_strings.save_settings_problem),b(".ajax-spinner").remove()},success:function(a){b(".ajax-spinner").remove(),d.append('<span class="ajax-success-msg">'+wpmdb_strings.saved+"</span>"),b(".ajax-success-msg").fadeOut(2e3,function(){b(this).remove()})}})}}),b(".migrate-form").submit(function(a){a.preventDefault()}),b(".connect-button").click(function(a){a.preventDefault(),b(this).blur(),ta()}),b(".pull-push-connection-info").bind("paste",function(a){setTimeout(function(){ta()},0)}),b("body").on("click",".try-again",function(){b(".pull-push-connection-info").removeClass("temp-disabled"),ta()}),b("body").on("click",".try-http",function(){var a=b.trim(b(".pull-push-connection-info").val()).split("\n"),c=a[0].replace("https","http"),d=c+"\n"+a[1];b(".pull-push-connection-info").val(d),ta()}),b(".create-new-profile").change(function(){K=!0}),b("body").on("click",".temporarily-disable-ssl",function(){var a="";window.location.hash&&(a=window.location.hash.substring(1)),b(this).attr("href",b(this).attr("href")+"&hash="+a)}),b("body").on("click",".pause-resume",function(a){p(a)}),b("body").on("click",".cancel",function(a){ua(a)}),b(".enter-licence").click(function(){b(".settings").click(),b(".licence-input").focus()}),c.functions.execute_next_step=function(){if(aa>0&&!1===_)return void setTimeout(function(){_=!0,c.functions.execute_next_step()},aa);if(_=!1,!0===U){b(".migration-progress-ajax-spinner").hide(),c.current_migration.pauseTimer();var a="";return!0===da?(a=wpmdb_strings.paused_before_finalize,da=!1,"find_replace"===wpmdb_migration_type()&&(a=wpmdb_strings.find_replace_paused_before_finalize)):a=wpmdb_strings.paused,c.current_migration.setState(null,a,"paused"),b("body").on("click",".pause-resume",function(a){p(a)}),b("body").on("click",".cancel",function(a){ua(a)}),void b(".pause-resume").html(wpmdb_strings.resume)}if(!0===$){x=wpmdb_migration_type();var d;"savefile"===x?d=wpmdb_strings.removing_local_sql:"pull"===x?d="backup"===B?wpmdb_strings.removing_local_backup:wpmdb_strings.removing_local_temp_tables:"push"===x&&(d="backup"===B?wpmdb_strings.removing_remote_sql:wpmdb_strings.removing_remote_temp_tables),c.current_migration.setText(d);var e={action:"wpmdb_cancel_migration",migration_state_id:c.migration_state_id,nonce:wpmdb_data.nonces.cancel_migration};F=!0,b.ajax({url:ajaxurl,type:"POST",dataType:"text",cache:!1,data:e,error:function(a,b,d){c.current_migration.setState(wpmdb_strings.migration_cancellation_failed,wpmdb_strings.manually_remove_temp_files+"<br /><br />"+wpmdb_strings.status+": "+a.status+" "+a.statusText+"<br /><br />"+wpmdb_strings.response+":<br />"+a.responseText,"error"),console.log(a),console.log(b),console.log(d),F=!1,c.common.migration_error=!0,c.functions.migration_complete_events()},success:function(a){return F=!1,a=b.trim(a),"push"===x&&"1"!==a||"push"!==x&&""!==a?(c.current_migration.setState(wpmdb_strings.migration_cancellation_failed,a,"error"),c.common.migration_error=!0,void c.functions.migration_complete_events()):(C=wpmdb_strings.migration_cancelled,"find_replace"===x&&(C=wpmdb_strings.find_replace_cancelled),c.functions.migration_complete_events(),void c.current_migration.setStatus("cancelled"))}})}else c.common.next_step_in_migration.fn.apply(null,c.common.next_step_in_migration.args)},b("body").on("click",".copy-licence-to-remote-site",function(){b(".connection-status").html(wpmdb_strings.copying_license),b(".connection-status").removeClass("notification-message error-notice migration-error"),b(".connection-status").append(ga);var a=b.trim(b(".pull-push-connection-info").val()).split("\n");F=!0,m(),b.ajax({url:ajaxurl,type:"POST",dataType:"json",cache:!1,data:{action:"wpmdb_copy_licence_to_remote_site",url:a[0],key:a[1],nonce:wpmdb_data.nonces.copy_licence_to_remote_site},error:function(a,c,d){b(".connection-status").html(pa(a.responseText,"(#143)",a)),b(".connection-status").addClass("notification-message error-notice migration-error"),b(".ajax-spinner").remove(),F=!1,n()},success:function(a){return b(".ajax-spinner").remove(),F=!1,n(),"undefined"!=typeof a.wpmdb_error&&1===a.wpmdb_error?(b(".connection-status").html(a.body),b(".connection-status").addClass("notification-message error-notice migration-error"),void(a.body.indexOf("401 Unauthorized")>-1&&b(".basic-access-auth-wrapper").show())):void ta()}})}),b("body").on("click",".reactivate-licence",function(a){F=!0,b(".invalid-licence").empty().html(wpmdb_strings.attempting_to_activate_licence),b(".invalid-licence").append(ga),b.ajax({url:ajaxurl,type:"POST",dataType:"json",cache:!1,data:{action:"wpmdb_reactivate_licence",nonce:wpmdb_data.nonces.reactivate_licence},error:function(a,c,d){b(".invalid-licence").html(wpmdb_strings.activate_licence_problem),b(".invalid-licence").append("<br /><br />"+wpmdb_strings.status+": "+a.status+" "+a.statusText+"<br /><br />"+wpmdb_strings.response+"<br />"+a.responseText),b(".ajax-spinner").remove(),F=!1},success:function(a){return b(".ajax-spinner").remove(),F=!1,"undefined"!=typeof a.wpmdb_error&&1===a.wpmdb_error?void b(".invalid-licence").html(a.body):"undefined"!=typeof a.wpmdb_dbrains_api_down&&1===a.wpmdb_dbrains_api_down?(b(".invalid-licence").html(wpmdb_strings.temporarily_activated_licence),void b(".invalid-licence").append(a.body)):(b(".invalid-licence").empty().html(wpmdb_strings.licence_reactivated),void location.reload())}})}),b("input[name=table_migrate_option]").change(function(){h(),b.wpmdb.do_action("wpmdb_tables_to_migrate_changed")}),b("body").on("change","#select-tables",function(){h(),b.wpmdb.do_action("wpmdb_tables_to_migrate_changed")}),b.wpmdb.add_filter("wpmdb_get_table_prefix",t),b.wpmdb.add_filter("wpmdb_get_tables_to_migrate",s),b.wpmdb.add_action("wpmdb_lock_replace_url",u),b.wpmdb.add_action("move_connection_info_box",ka),b.wpmdb.add_filter("wpmdb_before_migration_complete_hooks",function(a){return ca=!!b("input[name=pause_before_finalize]:checked").length,!0===ca&&"savefile"!==x&&(p(null),da=!0),a}),b(".wpmdb-switch").on("click",function(a){b(this).hasClass("disabled")||va(b(this).attr("id"))})})}(jQuery,wpmdb)},{"MigrationProgress-controller":1}]},{},[1,2,3,4,5,6,7]);
asset/dist/js/script.js DELETED
@@ -1,3706 +0,0 @@
1
- (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
2
- var $ = jQuery;
3
- var MigrationProgressModel = require( 'MigrationProgress-model' );
4
- var MigrationProgressView = require( 'MigrationProgress-view' );
5
- var $overlayOriginal = $( '<div id="overlay" class="hide"></div>' );
6
- var $progressContentOriginal = $( '.progress-content' ).clone().addClass( 'hide' );
7
- var $proVersion = $( '.pro-version' ).addClass( 'hide' );
8
-
9
- $overlayOriginal.append( $proVersion );
10
-
11
- var MigrationProgressController = {
12
- migration: {
13
- model: {},
14
- view: {},
15
- $progress: {},
16
- $wrapper: {},
17
- $overlay: {},
18
- status: 'active',
19
- title: '',
20
- text: '',
21
- timerCount: 0,
22
- elapsedInterval: 0,
23
- currentStageNum: 0,
24
- counterDisplay: false,
25
- originalTitle: document.title,
26
- setTitle: function( title ) {
27
- this.$progress.find( '.progress-title' ).html( title );
28
- this.title = title;
29
- },
30
- setStatus: function( status ) {
31
- this.$progress
32
- .removeClass( this.status )
33
- .addClass( ( 'error' === status ) ? 'wpmdb-error' : status );
34
-
35
- // Possible statuses include: 'error', 'paused', 'complete', 'cancelling'
36
- if ( 'error' === status ) {
37
- this.$progress.find( '.progress-text' ).addClass( 'migration-error' );
38
- }
39
-
40
- this.status = status;
41
-
42
- this.updateTitleElem();
43
- },
44
- setText: function( text ) {
45
- if ( 'string' !== typeof text ) {
46
- text = '';
47
- }
48
-
49
- if ( 0 >= text.indexOf( 'wpmdb_error' ) ) {
50
- text = this.decodeErrorObject( text );
51
- }
52
-
53
- this.$progress.find( '.progress-text' ).html( text );
54
- this.text = text;
55
- },
56
- setState: function( title, text, status ) {
57
- if ( null !== title ) {
58
- this.setTitle( title );
59
- }
60
- if ( null !== text ) {
61
- this.setText( text );
62
- }
63
- if ( null !== status ) {
64
- this.setStatus( status );
65
- }
66
- },
67
- startTimer: function() {
68
- this.timerCount = 0;
69
- this.counterDisplay = $( '.timer' );
70
- this.elapsedInterval = setInterval( this.incrementTimer, 1000 );
71
- },
72
- pauseTimer: function() {
73
- clearInterval( this.elapsedInterval );
74
- },
75
- resumeTimer: function() {
76
- this.elapsedInterval = setInterval( this.incrementTimer, 1000 );
77
- },
78
- incrementTimer: function() {
79
- wpmdb.current_migration.timerCount = wpmdb.current_migration.timerCount + 1;
80
- wpmdb.current_migration.displayCount();
81
- },
82
- displayCount: function() {
83
- var hours = Math.floor( this.timerCount / 3600 ) % 24;
84
- var minutes = Math.floor( this.timerCount / 60 ) % 60;
85
- var seconds = this.timerCount % 60;
86
- var display = this.pad( hours, 2, 0 ) + ':' + this.pad( minutes, 2, 0 ) + ':' + this.pad( seconds, 2, 0 );
87
- this.counterDisplay.html( display );
88
- },
89
- updateTitleElem: function() {
90
- var activeStage = this.model.get( 'activeStageName' );
91
- var stageModel = this.model.getStageModel( activeStage );
92
- var percentDone = Math.max( 0, stageModel.getTotalProgressPercent() );
93
- var numStages = this.model.get( 'stages' ).length;
94
- var currentStage = this.currentStageNum;
95
- var currentStatus = this.status;
96
- var progressText = wpmdb_strings.title_progress;
97
-
98
- if ( 'complete' === stageModel.get( 'status' ) && 0 === stageModel.get( 'totalSize' ) ) {
99
- percentDone = 100;
100
- }
101
-
102
- progressText = progressText.replace( '%1$s', percentDone + '%' );
103
- progressText = progressText.replace( '%2$s', currentStage );
104
- progressText = progressText.replace( '%3$s', numStages );
105
-
106
- if ( 1 === numStages ) {
107
- progressText = percentDone + '%';
108
- }
109
-
110
- if ( wpmdb_strings[ 'title_' + currentStatus ] ) {
111
- progressText = wpmdb_strings[ 'title_' + currentStatus ];
112
- }
113
-
114
- progressText = progressText + ' - ' + this.originalTitle;
115
-
116
- document.title = progressText;
117
- },
118
- restoreTitleElem: function() {
119
- document.title = this.originalTitle;
120
- },
121
- pad: function( num, width, padChar ) {
122
- padChar = padChar || '0';
123
- num = num + '';
124
- return num.length >= width ? num : new Array( width - num.length + 1 ).join( padChar ) + num;
125
- },
126
-
127
- // fixes error objects that have been mangled by html encoding
128
- decodeErrorObject: function( input ) {
129
- var inputDecoded = input
130
- .replace( /\{&quot;/g, '{#q!#' )
131
- .replace( /\&quot;}/g, '#q!#}' )
132
- .replace( /,&quot;/g, ',#q!#' )
133
- .replace( /&quot;:/g, '#q!#:' )
134
- .replace( /:&quot;/g, ':#q!#' )
135
- .replace( /&quot;/g, '\\"' )
136
- .replace( /#q!#/g, '"' )
137
- .replace( /&gt;/g, '>' )
138
- .replace( /&lt;/g, '<' );
139
- try {
140
- inputDecoded = JSON.parse( inputDecoded );
141
- } catch ( e ) {
142
- return input;
143
- }
144
- return ( 'object' === typeof inputDecoded && 'undefined' !== typeof inputDecoded.body ) ? inputDecoded : input;
145
- }
146
- },
147
- newMigration: function( settings ) {
148
- $( '#overlay' ).remove();
149
- $( '.progress-content' ).remove();
150
- this.migration.$overlay = $overlayOriginal.clone();
151
-
152
- $( '#wpwrap' ).append( this.migration.$overlay );
153
-
154
- this.migration.model = new MigrationProgressModel( settings );
155
- this.migration.view = new MigrationProgressView( {
156
- model: this.migration.model
157
- } );
158
-
159
- this.migration.$progress = $progressContentOriginal.clone();
160
- this.migration.$wrapper = this.migration.$progress.find( '.migration-progress-stages' );
161
- this.migration.$proVersion = this.migration.$overlay.find( '.pro-version' );
162
-
163
- var proVersionIFrame = this.migration.$proVersion.find( 'iframe' ).remove().clone();
164
-
165
- this.migration.$wrapper.replaceWith( this.migration.view.$el );
166
- this.migration.$overlay.prepend( this.migration.$progress );
167
-
168
- // timeout needed so class is added after elements are appended to dom and transition runs.
169
- var self = this;
170
- setTimeout( function() {
171
- self.migration.$overlay.add( self.migration.$progress ).add( self.migration.$proVersion ).removeClass( 'hide' ).addClass( 'show' );
172
- if ( self.migration.$proVersion.length ) {
173
- setTimeout( function() {
174
- self.migration.$proVersion.find( '.iframe' ).append( proVersionIFrame );
175
- }, 500 );
176
- }
177
- }, 0 );
178
-
179
- // Stick stage progress to top of container
180
- this.migration.$progress.find( '.migration-progress-stages' ).scroll( function() {
181
- $( this ).find( '.stage-progress' ).css( 'top', $( this ).scrollTop() );
182
- } );
183
-
184
- this.migration.currentStageNum = 0;
185
-
186
- this.migration.$proVersion.on( 'click', '.close-pro-version', function() {
187
- self.migration.$proVersion.find( 'iframe' ).remove();
188
- self.migration.$proVersion.addClass( 'hide remove' );
189
- setTimeout( function() {
190
- self.migration.$proVersion.remove();
191
- }, 500 );
192
- } );
193
-
194
- this.migration.model.on( 'migrationComplete', function() {
195
- self.utils.updateProgTableVisibilitySetting();
196
- self.utils.updatePauseBeforeFinalizeSetting();
197
- self.migration.pauseTimer();
198
- } );
199
-
200
- return this.migration;
201
- },
202
- utils: require( 'MigrationProgress-utils' )
203
- };
204
-
205
- module.exports = MigrationProgressController;
206
-
207
- },{"MigrationProgress-model":2,"MigrationProgress-utils":3,"MigrationProgress-view":4}],2:[function(require,module,exports){
208
- var MigrationProgressStageModel = require( 'MigrationProgressStage-model' );
209
- var $ = jQuery;
210
-
211
- var MigrationProgressModel = Backbone.Model.extend( {
212
- defaults: {
213
- _initialStages: null,
214
- stages: null,
215
- activeStageName: null,
216
- stageModels: null,
217
- localTableRows: null,
218
- localTableSizes: null,
219
- remoteTableRows: null,
220
- remoteTableSizes: null,
221
- migrationStatus: 'active',
222
- migrationIntent: 'savefile'
223
- },
224
- initialize: function() {
225
- this.set( 'stageModels', {} );
226
- this.set( '_initialStages', this.get( 'stages' ) );
227
- this.set( 'stages', [] );
228
- _.each( this.get( '_initialStages' ), function( stage, items, dataType ) {
229
- this.addStage( stage.name, items, dataType );
230
- }, this );
231
- },
232
- addStage: function( name, items, dataType, extend ) {
233
- var itemsArr = [];
234
- var stage;
235
-
236
- _.each( items, function( item ) {
237
- var size, rows;
238
-
239
- if ( 'remote' === dataType ) {
240
- size = this.get( 'remoteTableSizes' )[ item ];
241
- rows = this.get( 'remoteTableRows' )[ item ];
242
- } else {
243
- size = this.get( 'localTableSizes' )[ item ];
244
- rows = this.get( 'localTableRows' )[ item ];
245
- }
246
-
247
- itemsArr.push( {
248
- name: item,
249
- size: size,
250
- rows: rows
251
- } );
252
- }, this );
253
-
254
- stage = {
255
- name: name,
256
- items: itemsArr,
257
- dataType: dataType
258
- };
259
-
260
- if ( 'object' === typeof extend ) {
261
- stage = $.extend( stage, extend );
262
- }
263
-
264
- this.addStageModel( stage );
265
-
266
- this.trigger( 'stage:added', this.get( 'stageModels' )[ name ] );
267
- this.get( 'stageModels' )[ name ].on( 'change', function() {
268
- this.trigger( 'change' );
269
- }, this );
270
-
271
- return this.getStageModel( stage.name );
272
- },
273
- addStageItem: function( stage, name, size, rows ) {
274
- this.getStageModel( stage ).addItem( name, size, rows );
275
- },
276
- addStageModel: function( stage ) {
277
- var stages = this.get( 'stages' );
278
- var stageModels = this.get( 'stageModels' );
279
- var newStageModel = new MigrationProgressStageModel( stage );
280
-
281
- stages.push( stage );
282
- stageModels[ stage.name ] = newStageModel;
283
-
284
- this.set( 'stages', stages );
285
- this.set( 'stageModels', stageModels );
286
- },
287
- getStageModel: function( name ) {
288
- return this.get( 'stageModels' )[ name ];
289
- },
290
- getStageItems: function( stage, map ) {
291
- var stageModel = this.getStageModel( stage );
292
- var items = stageModel.get( 'items' );
293
-
294
- if ( undefined === map ) {
295
- return items;
296
- } else {
297
- return items.map( function( item ) {
298
- return item[ map ];
299
- } );
300
- }
301
- },
302
- setActiveStage: function( stage ) {
303
- this.setStageComplete();
304
- this.set( 'activeStageName', stage );
305
- this.getStageModel( stage ).set( 'status', 'active' );
306
- this.trigger( 'change:activeStage' );
307
- },
308
- setStageComplete: function( stage ) {
309
- if ( ! stage ) {
310
- stage = this.get( 'activeStageName' );
311
- }
312
- if ( null !== stage ) {
313
- this.getStageModel( stage ).set( 'status', 'complete' );
314
- }
315
-
316
- wpmdb.current_migration.currentStageNum = wpmdb.current_migration.currentStageNum + 1;
317
- },
318
- setMigrationComplete: function() {
319
- var lastStage = this.getStageModel( this.get( 'activeStageName' ) );
320
- this.setStageComplete();
321
- this.trigger( 'migrationComplete' );
322
- this.set( 'migrationStatus', 'complete' );
323
- lastStage.activateTab();
324
- }
325
- } );
326
-
327
- module.exports = MigrationProgressModel;
328
-
329
- },{"MigrationProgressStage-model":7}],3:[function(require,module,exports){
330
- var $ = jQuery;
331
-
332
- module.exports = {
333
- updateProgTableVisibilitySetting: function() {
334
- if ( ! wpmdb_data.prog_tables_visibility_changed ) {
335
- return;
336
- }
337
- wpmdb_data.prog_tables_visibility_changed = false;
338
-
339
- $.ajax( {
340
- url: ajaxurl,
341
- type: 'POST',
342
- dataType: 'text',
343
- cache: false,
344
- data: {
345
- action: 'wpmdb_save_setting',
346
- nonce: wpmdb_data.nonces.save_setting,
347
- setting: 'prog_tables_hidden',
348
- checked: Boolean( wpmdb_data.prog_tables_hidden )
349
- },
350
- error: function( jqXHR, textStatus, errorThrown ) {
351
- console.log( 'Could not save progress item visibility setting', errorThrown );
352
- }
353
- } );
354
- },
355
- updatePauseBeforeFinalizeSetting: function() {
356
- if ( ! wpmdb_data.pause_before_finalize_changed ) {
357
- return;
358
- }
359
- wpmdb_data.pause_before_finalize_changed = false;
360
-
361
- $.ajax( {
362
- url: ajaxurl,
363
- type: 'POST',
364
- dataType: 'text',
365
- cache: false,
366
- data: {
367
- action: 'wpmdb_save_setting',
368
- nonce: wpmdb_data.nonces.save_setting,
369
- setting: 'pause_before_finalize',
370
- checked: Boolean( wpmdb_data.pause_before_finalize )
371
- },
372
- error: function( jqXHR, textStatus, errorThrown ) {
373
- console.log( 'Could not save pause before finalize setting', errorThrown );
374
- }
375
- } );
376
- }
377
- };
378
-
379
- },{}],4:[function(require,module,exports){
380
- var MigrationProgressStageView = require( './MigrationProgressStage-view.js' );
381
- var $ = jQuery;
382
-
383
- var MigrationProgressView = Backbone.View.extend( {
384
- tagName: 'div',
385
- className: 'migration-progress-stages',
386
- id: 'migration-progress-stages',
387
- self: this,
388
- initialize: function() {
389
- this.$el.empty();
390
-
391
- this.model.on( 'stage:added', function( stageModel ) {
392
- this.addStageView( stageModel );
393
- }, this );
394
-
395
- _.each( this.model.get( 'stageModels' ), this.addStageView, this );
396
- },
397
- addStageView: function( stageModel ) {
398
- var newStageSubView = new MigrationProgressStageView( {
399
- model: stageModel
400
- } );
401
- this.$el.append( newStageSubView.$el );
402
- this.$el.parent().find( '.stage-tabs' ).append( newStageSubView.$tabElem );
403
- }
404
- } );
405
-
406
- module.exports = MigrationProgressView;
407
-
408
- },{"./MigrationProgressStage-view.js":8}],5:[function(require,module,exports){
409
- var MigrationProgressItem = Backbone.Model.extend( {
410
- defaults: {
411
- name: '',
412
- size: 0,
413
- transferred: 0,
414
- rows: 0,
415
- rowsTransferred: 0,
416
- stageName: '',
417
- started: false,
418
- done: false
419
- },
420
- getPercentDone: function() {
421
- return Math.min( 100, Math.ceil( 100 * ( this.get( 'transferred' ) / this.get( 'size' ) ) ) );
422
- },
423
- getTransferred: function() {
424
- return Math.min( this.get( 'size' ), this.get( 'transferred' ) );
425
- },
426
- getSizeHR: function() {
427
- return wpmdb.functions.convertKBSizeToHR( this.get( 'size' ) );
428
- },
429
- setComplete: function() {
430
- this.set( 'transferred', this.get( 'size' ) );
431
- this.set( 'rowsTransferred', this.get( 'rows' ) );
432
- },
433
- setRowsTransferred: function( numRows ) {
434
- var amtDone, estTransferred;
435
-
436
- if ( -1 === parseInt( numRows ) ) {
437
- amtDone = 1;
438
- } else {
439
- amtDone = Math.min( 1, numRows / this.get( 'rows' ) );
440
- }
441
-
442
- estTransferred = this.get( 'size' ) * amtDone;
443
-
444
- this.set( 'transferred', estTransferred );
445
- this.set( 'rowsTransferred', numRows );
446
- }
447
- } );
448
-
449
- module.exports = MigrationProgressItem;
450
-
451
- },{}],6:[function(require,module,exports){
452
- var $ = jQuery;
453
-
454
- var ItemProgressView = Backbone.View.extend( {
455
- tagName: 'div',
456
- className: 'item-progress',
457
- id: '',
458
- $progress: null,
459
- $info: null,
460
- initialize: function() {
461
- this.$progress = $( '<div />' ).addClass( 'progress-bar' );
462
- this.$title = $( '<p>' ).addClass( 'item-info' )
463
- .append( $( '<span class=name />' ).text( this.model.get( 'name' ) ) )
464
- .append( ' ' )
465
- .append( $( '<span class=size />' ).text( '(' + this.model.getSizeHR() + ')' ) );
466
-
467
- this.$el.append( this.$title );
468
- this.$el.append( this.$progress );
469
-
470
- this.$el.append( '<span class="dashicons dashicons-yes"/>' );
471
-
472
- this.$el.attr( 'id', 'item-' + this.model.get( 'name' ) );
473
- this.$el.attr( 'data-stage', this.model.get( 'stageName' ) );
474
-
475
- this.model.on( 'change:transferred', this.render, this );
476
- this.render();
477
- },
478
- render: function() {
479
- var percentDone = Math.max( 0, this.model.getPercentDone() );
480
- this.$progress.css( 'width', percentDone + '%' );
481
- if ( 100 <= percentDone ) {
482
- this.elemComplete();
483
- }
484
- },
485
- elemComplete: function() {
486
- var self = this;
487
- this.$el.addClass( 'complete' );
488
- setTimeout( function() {
489
- var height = self.$el.height();
490
- var marginBottom = self.$el.css( 'margin-bottom' );
491
- var clone = self.$el.clone().css( { height: 0, marginBottom: 0 } ).addClass( 'clone' );
492
- self.$el.animate( { height: 0, marginBottom: 0 }, 200, 'swing' );
493
- clone.appendTo( self.$el.parent() );
494
- clone.animate( { height: height, marginBottom: marginBottom }, 200, 'swing', function() {
495
- clone.replaceWith( self.$el.css( { height: 'auto', marginBottom: marginBottom } ) );
496
- } );
497
- }, 1000 );
498
- }
499
- } );
500
-
501
- module.exports = ItemProgressView;
502
-
503
- },{}],7:[function(require,module,exports){
504
- var MigrationProgressItemModel = require( 'MigrationProgressItem-model' );
505
- var $ = jQuery;
506
-
507
- var MigrationProgressStage = Backbone.Model.extend( {
508
- defaults: {
509
- status: 'queued',
510
- itemModels: null,
511
- _initialItems: null,
512
- items: null,
513
- totalSize: 0,
514
- dataType: 'local',
515
- name: '',
516
- strings: null
517
- },
518
- initialize: function() {
519
- this.initStrings();
520
-
521
- this.set( '_initialItems', this.get( 'items' ) );
522
- this.set( 'items', [] );
523
- this.set( 'itemModels', {} );
524
- _.each( this.get( '_initialItems' ), function( item ) {
525
- this.addItem( item.name, item.size, item.rows );
526
- }, this );
527
-
528
- this.on( 'change', function() {
529
- wpmdb.current_migration.updateTitleElem();
530
- } );
531
- },
532
- initStrings: function() {
533
- var default_strings = {
534
- stage_title: this.get( 'name' ),
535
- migrated: wpmdb_strings.migrated,
536
- queued: wpmdb_strings.queued,
537
- active: wpmdb_strings.running,
538
- complete: wpmdb_strings.complete,
539
- hide: wpmdb_strings.hide,
540
- show: wpmdb_strings.show,
541
- itemsName: wpmdb_strings.tables
542
- };
543
- var strings = this.get( 'strings' );
544
-
545
- strings = ( 'object' === typeof strings ) ? strings : {};
546
- strings = $.extend( default_strings, strings );
547
-
548
- strings.items_migrated = strings.itemsName + ' ' + strings.migrated;
549
- strings.hide_items = strings.hide + ' ' + strings.itemsName;
550
- strings.show_items = strings.show + ' ' + strings.itemsName;
551
-
552
- this.set( 'strings', strings );
553
- },
554
- addItem: function( name, size, rows ) {
555
- var item = {
556
- name: name,
557
- size: size,
558
- rows: rows || size,
559
- stageName: this.get( 'name' )
560
- };
561
-
562
- this.addItemModel( item );
563
- this.set( 'totalSize', parseInt( this.get( 'totalSize' ) ) + parseInt( size ) );
564
-
565
- this.trigger( 'item:added', this.get( 'itemModels' )[ name ] );
566
- this.get( 'itemModels' )[ name ].on( 'change', function() {
567
- this.trigger( 'change' );
568
- }, this );
569
- },
570
- addItemModel: function( item ) {
571
- var items = this.get( 'items' );
572
- var itemModels = this.get( 'itemModels' );
573
- var newItemModel = new MigrationProgressItemModel( item );
574
-
575
- items.push( item );
576
- itemModels[ item.name ] = newItemModel;
577
- this.set( 'items', items );
578
- this.set( 'itemModels', itemModels );
579
- },
580
- getItemModel: function( name ) {
581
- return this.get( 'itemModels' )[ name ];
582
- },
583
- setItemComplete: function( name ) {
584
- var itemModel = this.getItemModel( name );
585
- itemModel.set( 'transferred', itemModel.get( 'size' ) );
586
- },
587
- incrementItemProgress: function( name ) {
588
- var itemeModel = this.getItemModel( name );
589
- var transferred = itemeModel.getTransferred();
590
- var size = itemeModel.get( 'size' );
591
- var increment = transferred + ( ( size - transferred ) * 0.2 );
592
- itemeModel.set( 'transferred', increment );
593
- },
594
- setItemModelTransferred: function( name, transferred ) {
595
- this.getItemModel( name ).set( 'transferred', transferred );
596
- },
597
- getItemModelTransferred: function( name ) {
598
- var itemModel = this.getItemModel( name );
599
- return Math.max( itemModel.get( 'transferred' ), itemModel.get( 'size' ) );
600
- },
601
- setItemModelRowsTransferred: function( name, rowsTransferred ) {
602
- this.getItemModel( name ).setRowsTransferred( rowsTransferred );
603
- },
604
- setItemModelComplete: function( name ) {
605
- this.getItemModel( name ).setComplete();
606
- },
607
- recalculateTotalSize: function() {
608
- var size = 0;
609
- _.each( this.get( 'itemModels' ), function( itemModel ) {
610
- size += itemModel.get( 'size' );
611
- }, this );
612
- this.set( 'totalSize', size );
613
- return size;
614
- },
615
- getTotalSizeTransferred: function() {
616
- var transferred = 0;
617
- _.each( this.get( 'itemModels' ), function( itemModel ) {
618
- transferred += itemModel.getTransferred();
619
- }, this );
620
- return transferred;
621
- },
622
- getTotalProgressPercent: function() {
623
- var transferred = this.getTotalSizeTransferred();
624
- var total = this.get( 'totalSize' );
625
- if ( 0 >= transferred || 0 >= total ) {
626
- return 0;
627
- }
628
- return Math.min( 100, Math.round( ( transferred / total ) * 100 ) );
629
- },
630
- activateTab: function() {
631
- this.trigger( 'activateTab' );
632
- }
633
- } );
634
-
635
- module.exports = MigrationProgressStage;
636
-
637
- },{"MigrationProgressItem-model":5}],8:[function(require,module,exports){
638
- var MigrationProgressItemView = require( './MigrationProgressItem-view.js' );
639
- var $ = jQuery;
640
-
641
- var MigrationProgressStageView = Backbone.View.extend( {
642
- tagName: 'div',
643
- className: 'migration-progress-stage-container hide-tables',
644
- $totalProgressElem: null,
645
- $tabElem: null,
646
- $showHideTablesElem: null,
647
- $pauseBeforeFinalizeElem: null,
648
- $pauseBeforeFinalizeCheckbox: null,
649
- initialize: function() {
650
- this.$el.empty();
651
- this.$el.attr( 'data-stage', this.model.get( 'name' ) ).addClass( 'queued' );
652
-
653
- this.initTotalProgressElem();
654
- this.$el.prepend( this.$totalProgressElem );
655
-
656
- this.$el.append( '<div class=progress-items />' );
657
-
658
- this.initTabElem();
659
-
660
- this.model.on( 'item:added', function( itemModel ) {
661
- this.addItemView( itemModel );
662
- }, this );
663
- _.each( this.model.get( 'itemModels' ), this.addItemView, this );
664
- this.model.on( 'change', function() {
665
- this.updateProgressElem();
666
- }, this );
667
-
668
- this.model.on( 'change:status', function( e ) {
669
- this.$el.removeClass( 'queued active' ).addClass( this.model.get( 'status' ) );
670
- this.$tabElem.removeClass( 'queued active' ).addClass( this.model.get( 'status' ) )
671
- .find( '.stage-status' ).text( this.model.get( 'strings' )[ this.model.get( 'status' ) ] );
672
- }, this );
673
- },
674
- initTotalProgressElem: function() {
675
- this.initShowHideTablesElem();
676
- this.initPauseBeforeFinalizeElem();
677
-
678
- this.$totalProgressElem = $( '<div class=stage-progress />' )
679
- .append( '<span class=percent-complete>0</span>% ' + this.model.get( 'strings' ).complete + ' ' )
680
- .append( '(<span class=size-complete>0 MB</span> / <span class=size-total>0 MB</span>) ' )
681
- .append( '<span class=tables-complete>0</span> <span class=lowercase >of</span> <span class=tables-total>0</span> ' + this.model.get( 'strings' ).items_migrated )
682
- .append( this.$showHideTablesElem )
683
- .append( '<div class=progress-bar-wrapper><div class=progress-bar /></div>' );
684
- },
685
- initShowHideTablesElem: function() {
686
- this.$showHideTablesElem = $( '<a class=show-hide-tables/>' ).text( this.model.get( 'strings' ).show_items );
687
- var self = this;
688
- this.$showHideTablesElem.on( 'click show-hide-progress-tables', function() {
689
- var progTablesHidden;
690
- if ( self.$el.hasClass( 'hide-tables' ) ) { // show tables
691
- progTablesHidden = false;
692
- self.$el.add( self.$el.siblings() ).removeClass( 'hide-tables' );
693
- self.$showHideTablesElem.text( self.model.get( 'strings' ).hide_items );
694
- } else { // hide tables
695
- progTablesHidden = true;
696
- self.$el.add( self.$el.siblings() ).addClass( 'hide-tables' );
697
- self.$showHideTablesElem.text( self.model.get( 'strings' ).show_items );
698
- }
699
-
700
- if ( Boolean( progTablesHidden ) !== Boolean( wpmdb_data.prog_tables_hidden ) ) {
701
- wpmdb_data.prog_tables_visibility_changed = true;
702
- wpmdb_data.prog_tables_hidden = progTablesHidden;
703
- }
704
- } );
705
-
706
- // show progress tables on init if hidden is false
707
- if ( ! wpmdb_data.prog_tables_hidden ) {
708
- this.$showHideTablesElem.triggerHandler( 'show-hide-progress-tables' );
709
- }
710
-
711
- // make sure text reflects current state when showing
712
- this.model.on( 'change:status activateTab', function() {
713
- if ( wpmdb_data.prog_tables_hidden ) {
714
- self.$showHideTablesElem.text( self.model.get( 'strings' ).show_items );
715
- } else {
716
- self.$showHideTablesElem.text( self.model.get( 'strings' ).hide_items );
717
- }
718
- } );
719
-
720
- this.model.on( 'activateTab', function() {
721
- if ( 'complete' === wpmdb.current_migration.model.get( 'migrationStatus' ) ) {
722
- self.$tabElem.addClass( 'active' ).siblings().removeClass( 'active' );
723
- self.$el.addClass( 'active' ).siblings().removeClass( 'active' );
724
- }
725
- } );
726
- },
727
- initPauseBeforeFinalizeElem: function() {
728
- this.$pauseBeforeFinalizeElem = $( '.pause-before-finalize' );
729
- this.$pauseBeforeFinalizeCheckbox = this.$pauseBeforeFinalizeElem.find( 'input[type=checkbox]' );
730
- var self = this;
731
- var isChecked = false;
732
- var migrationIntent = wpmdb.current_migration.model.get( 'migrationIntent' );
733
-
734
- // make sure checkbox is checked based on current state
735
- if ( wpmdb_data.pause_before_finalize ) {
736
- isChecked = true;
737
- }
738
- this.$pauseBeforeFinalizeCheckbox.prop( 'checked', isChecked );
739
-
740
- // only display on pushes and pulls
741
- if ( 'push' === migrationIntent || 'pull' === migrationIntent ) {
742
- this.$pauseBeforeFinalizeElem.show();
743
- } else {
744
- this.$pauseBeforeFinalizeElem.hide();
745
- }
746
-
747
- // hide on media stage
748
- wpmdb.current_migration.model.on( 'change:activeStage', function() {
749
- if ( 'media' === wpmdb.current_migration.model.get( 'activeStageName' ) ) {
750
- self.$pauseBeforeFinalizeElem.hide();
751
- }
752
- } );
753
-
754
- this.$pauseBeforeFinalizeElem.on( 'click', function() {
755
- var pauseBeforeFinalizeValue = Boolean( self.$pauseBeforeFinalizeCheckbox.is( ':checked' ) );
756
- if ( pauseBeforeFinalizeValue !== Boolean( wpmdb_data.pause_before_finalize ) ) {
757
- wpmdb_data.pause_before_finalize_changed = true;
758
- wpmdb_data.pause_before_finalize = pauseBeforeFinalizeValue;
759
- }
760
- } );
761
- },
762
- initTabElem: function() {
763
- var self = this;
764
- this.$tabElem = $( '<a class=stage-tab>' )
765
- .append( '<span class=stage-title>' + this.model.get( 'strings' ).stage_title + '</span> ' )
766
- .append( '<span class=stage-status>' + this.model.get( 'strings' ).queued + '</span> ' )
767
- .on( 'click', function() {
768
- self.model.activateTab();
769
- } );
770
- },
771
- updateProgressElem: function() {
772
- var percentDone = Math.max( 0, this.model.getTotalProgressPercent() );
773
- var sizeDone = wpmdb.functions.convertKBSizeToHR( Math.min( this.model.getTotalSizeTransferred(), this.model.get( 'totalSize' ) ) );
774
- var tablesDone = Math.min( this.$el.find( '.complete' ).length, this.model.get( 'items' ).length );
775
-
776
- if ( 'complete' === this.model.get( 'status' ) && 0 === this.model.get( 'totalSize' ) ) {
777
- percentDone = 100;
778
- this.$showHideTablesElem.fadeOut();
779
- }
780
-
781
- this.$totalProgressElem.find( '.percent-complete' ).text( percentDone );
782
- this.$totalProgressElem.find( '.size-complete' ).text( sizeDone );
783
- this.$totalProgressElem.find( '.tables-complete' ).text( tablesDone );
784
- this.$totalProgressElem.find( '.progress-bar-wrapper .progress-bar' ).css( { width: percentDone + '%' } );
785
- },
786
- addItemView: function( itemModel ) {
787
- var newItemSubView = new MigrationProgressItemView( {
788
- model: itemModel
789
- } );
790
- this.$el.find( '.progress-items' ).append( newItemSubView.$el );
791
- this.$totalProgressElem.find( '.tables-total' ).text( this.model.get( 'items' ).length );
792
- this.$totalProgressElem.find( '.size-total' ).text( wpmdb.functions.convertKBSizeToHR( this.model.get( 'totalSize' ) ) );
793
- }
794
- } );
795
-
796
- module.exports = MigrationProgressStageView;
797
-
798
- },{"./MigrationProgressItem-view.js":6}],9:[function(require,module,exports){
799
- (function( $, wpmdb ) {
800
-
801
- var connection_established = false;
802
- var last_replace_switch = '';
803
- var doing_ajax = false;
804
- var doing_licence_registration_ajax = false;
805
- var doing_reset_api_key_ajax = false;
806
- var doing_save_profile = false;
807
- var doing_plugin_compatibility_ajax = false;
808
- var profile_name_edited = false;
809
- var checked_licence = false;
810
- var show_prefix_notice = false;
811
- var show_ssl_notice = false;
812
- var show_version_notice = false;
813
- var migration_completed = false;
814
- var currently_migrating = false;
815
- var dump_filename = '';
816
- var dump_path = '';
817
- var migration_intent;
818
- var remote_site;
819
- var secret_key;
820
- var form_data;
821
- var stage;
822
- var elapsed_interval;
823
- var completed_msg;
824
- var tables_to_migrate = '';
825
- var migration_paused = false;
826
- var previous_progress_title = '';
827
- var previous_progress_text_primary = '';
828
- var previous_progress_text_secondary = '';
829
- var migration_cancelled = false;
830
- var flag_skip_delay = false;
831
- var delay_between_requests = 0;
832
- var fade_duration = 400;
833
- var pause_before_finalize = false;
834
- var is_auto_pause_before_finalize = false;
835
-
836
- wpmdb.migration_progress_controller = require( 'MigrationProgress-controller' );
837
- wpmdb.current_migration = null;
838
-
839
- var admin_url = ajaxurl.replace( '/admin-ajax.php', '' ), spinner_url = admin_url + '/images/spinner';
840
-
841
- if ( 2 < window.devicePixelRatio ) {
842
- spinner_url += '-2x';
843
- }
844
- spinner_url += '.gif';
845
- var ajax_spinner = '<img src="' + spinner_url + '" alt="" class="ajax-spinner general-spinner" />';
846
-
847
- window.onbeforeunload = function( e ) {
848
- if ( currently_migrating ) {
849
- e = e || window.event;
850
-
851
- // For IE and Firefox prior to version 4
852
- if ( e ) {
853
- e.returnValue = wpmdb_strings.sure;
854
- }
855
-
856
- // For Safari
857
- return wpmdb_strings.sure;
858
- }
859
- };
860
-
861
- function pad( n, width, z ) {
862
- z = z || '0';
863
- n = n + '';
864
- return n.length >= width ? n : new Array( width - n.length + 1 ).join( z ) + n;
865
- }
866
-
867
- function is_int( n ) {
868
- n = parseInt( n );
869
- return 'number' === typeof n && 0 === n % 1;
870
- }
871
-
872
- function get_intersect( arr1, arr2 ) {
873
- var r = [], o = {}, l = arr2.length, i, v;
874
- for ( i = 0; i < l; i++ ) {
875
- o[ arr2[ i ] ] = true;
876
- }
877
- l = arr1.length;
878
- for ( i = 0; i < l; i++ ) {
879
- v = arr1[ i ];
880
- if ( v in o ) {
881
- r.push( v );
882
- }
883
- }
884
- return r;
885
- }
886
-
887
- function get_query_var( name ) {
888
- name = name.replace( /[\[]/, '\\[' ).replace( /[\]]/, '\\]' );
889
- var regex = new RegExp( '[\\?&]' + name + '=([^&#]*)' ),
890
- results = regex.exec( location.search );
891
- return null === results ? '' : decodeURIComponent( results[ 1 ].replace( /\+/g, ' ' ) );
892
- }
893
-
894
- function maybe_show_ssl_warning( url, key, remote_scheme ) {
895
- var scheme = url.substr( 0, url.indexOf( ':' ) );
896
- if ( remote_scheme !== scheme && url.indexOf( 'https' ) !== -1 ) {
897
- $( '.ssl-notice' ).show();
898
- show_ssl_notice = true;
899
- url = url.replace( 'https', 'http' );
900
- $( '.pull-push-connection-info' ).val( url + '\n' + key );
901
- return;
902
- }
903
- show_ssl_notice = false;
904
- return;
905
- }
906
-
907
- function maybe_show_prefix_notice( prefix ) {
908
- if ( prefix !== wpmdb_data.this_prefix ) {
909
- $( '.remote-prefix' ).html( prefix );
910
- show_prefix_notice = true;
911
- if ( 'pull' === wpmdb_migration_type() ) {
912
- $( '.prefix-notice.pull' ).show();
913
- } else {
914
- $( '.prefix-notice.push' ).show();
915
- }
916
- }
917
- }
918
-
919
- function maybe_show_mixed_cased_table_name_warning() {
920
- if ( 'undefined' === typeof wpmdb.common.connection_data || false === wpmdb.common.connection_data ) {
921
- return;
922
- }
923
-
924
- var migration_intent = wpmdb_migration_type();
925
- var tables_to_migrate = get_tables_to_migrate( null, null );
926
-
927
- $( '.mixed-case-table-name-notice' ).hide();
928
-
929
- if ( null === tables_to_migrate ) {
930
- return;
931
- }
932
-
933
- tables_to_migrate = tables_to_migrate.join( '' );
934
-
935
- // The table names are all lowercase, no need to display the warning.
936
- if ( tables_to_migrate === tables_to_migrate.toLowerCase() ) {
937
- return;
938
- }
939
-
940
- /*
941
- * Do not display the warning if the remote lower_case_table_names does not equal "1" (i.e the only problematic setting)
942
- * Applies to push/export migrations.
943
- */
944
- if ( '1' !== wpmdb.common.connection_data.lower_case_table_names && ( 'push' === migration_intent || 'savefile' === migration_intent ) ) {
945
- return;
946
- }
947
-
948
- /*
949
- * Do not display the warning if the local lower_case_table_names does not equal "1" (i.e the only problematic setting)
950
- * Only applies to pull migrations.
951
- */
952
- if ( '1' !== wpmdb_data.lower_case_table_names && 'pull' === migration_intent ) {
953
- return;
954
- }
955
-
956
- /*
957
- * At this stage we've determined:
958
- * 1. The source database contains at least one table that contains an uppercase character.
959
- * 2. The destination environment has lower_case_table_names set to 1.
960
- * 3. The source database table containing the uppercase letter will be converted to lowercase during the migration.
961
- */
962
-
963
- if ( 'push' === migration_intent || 'savefile' === migration_intent ) {
964
- $( '.mixed-case-table-name-notice.push' ).show();
965
- } else {
966
- $( '.mixed-case-table-name-notice.pull' ).show();
967
- }
968
- }
969
-
970
- function get_domain_name( url ) {
971
- var temp_url = url;
972
- var domain = temp_url.replace( /\/\/(.*)@/, '//' ).replace( 'http://', '' ).replace( 'https://', '' ).replace( 'www.', '' );
973
- return domain;
974
- }
975
-
976
- function get_migration_status_label( url, intent, stage ) {
977
- var domain = get_domain_name( url );
978
- var migrating_stage_label, completed_stage_label;
979
- if ( 'pull' === intent ) {
980
- migrating_stage_label = wpmdb_strings.pull_migration_label_migrating;
981
- completed_stage_label = wpmdb_strings.pull_migration_label_completed;
982
- } else {
983
- migrating_stage_label = wpmdb_strings.push_migration_label_migrating;
984
- completed_stage_label = wpmdb_strings.push_migration_label_completed;
985
- }
986
-
987
- migrating_stage_label = migrating_stage_label.replace( /\%s(\S*)\s?/, '<span class=domain-label>' + domain + '$1</span>&nbsp;' );
988
- completed_stage_label = completed_stage_label.replace( /\%s\s?/, '<span class=domain-label>' + domain + '</span>&nbsp;' );
989
-
990
- if ( 'migrating' === stage ) {
991
- return migrating_stage_label;
992
- } else {
993
- return completed_stage_label;
994
- }
995
- }
996
-
997
- function remove_protocol( url ) {
998
- return url.replace( /^https?:/i, '' );
999
- }
1000
-
1001
- function disable_export_type_controls() {
1002
- $( '.option-group' ).each( function( index ) {
1003
- $( 'input', this ).attr( 'disabled', 'disabled' );
1004
- $( 'label', this ).css( 'cursor', 'default' );
1005
- } );
1006
- }
1007
-
1008
- function enable_export_type_controls() {
1009
- $( '.option-group' ).each( function( index ) {
1010
- $( 'input', this ).removeAttr( 'disabled' );
1011
- $( 'label', this ).css( 'cursor', 'pointer' );
1012
- } );
1013
- }
1014
-
1015
- function set_slider_value( parent_selector, value, unit, display ) {
1016
- var display_value = value;
1017
-
1018
- if ( undefined !== display ) {
1019
- display_value = display;
1020
- }
1021
-
1022
- $( '.slider', parent_selector ).slider( 'value', parseInt( value ) );
1023
- $( '.amount', parent_selector ).html( wpmdb_add_commas( display_value ) + ' ' + unit );
1024
- }
1025
-
1026
- function set_pause_resume_button( event ) {
1027
- if ( true === migration_paused ) {
1028
- migration_paused = false;
1029
- doing_ajax = true;
1030
-
1031
- wpmdb.current_migration.setState( previous_progress_title, previous_progress_text_primary, 'active' );
1032
- $( '.pause-resume' ).html( wpmdb_strings.pause );
1033
-
1034
- // Resume the timer
1035
- wpmdb.current_migration.resumeTimer();
1036
-
1037
- wpmdb.functions.execute_next_step();
1038
- } else {
1039
- migration_paused = true;
1040
- doing_ajax = false;
1041
- previous_progress_title = $( '.progress-title' ).html();
1042
- previous_progress_text_primary = $( '.progress-text', '.progress-wrapper-primary' ).html();
1043
- previous_progress_text_secondary = $( '.progress-text', '.progress-wrapper-secondary ' ).html();
1044
-
1045
- wpmdb.current_migration.setState( wpmdb_strings.migration_paused, wpmdb_strings.completing_current_request, null );
1046
- $( 'body' ).off( 'click', '.pause-resume' ); // Is re-bound at execute_next_step when migration is finally paused
1047
- $( 'body' ).off( 'click', '.cancel' ); // Is re-bound at execute_next_step when migration is finally paused
1048
- }
1049
- }
1050
-
1051
- function create_table_select( tables, table_sizes_hr, selected_tables ) {
1052
- var $table_select = document.createElement( 'select' );
1053
- $( $table_select ).attr( {
1054
- multiple: 'multiple',
1055
- name: 'select_tables[]',
1056
- id: 'select-tables',
1057
- class: 'multiselect'
1058
- } );
1059
-
1060
- if ( 0 < tables.length ) {
1061
- $.each( tables, function( index, table ) {
1062
- if ( $.wpmdb.apply_filters( 'wpmdb_exclude_table', false, table ) ) {
1063
- return;
1064
- }
1065
-
1066
- var selected = ' ';
1067
- if ( undefined !== selected_tables && null !== selected_tables && 0 < selected_tables.length && -1 !== $.inArray( table, selected_tables ) ) {
1068
- selected = ' selected="selected" ';
1069
- }
1070
- $( $table_select ).append( '<option' + selected + 'value="' + table + '">' + table + ' (' + table_sizes_hr[ table ] + ')</option>' );
1071
- } );
1072
- }
1073
-
1074
- return $table_select;
1075
- }
1076
-
1077
- /**
1078
- * Returns tables selected for migration.
1079
- *
1080
- * @param value
1081
- * @param args
1082
- * @returns {string}
1083
- *
1084
- * Also handler for wpmdb_get_tables_to_migrate filter, disregards input values as it is the primary source.
1085
- */
1086
- function get_tables_to_migrate( value, args ) {
1087
- var tables = '';
1088
- var mig_type = wpmdb_migration_type();
1089
- var table_intent = $( 'input[name=table_migrate_option]:checked' ).val();
1090
-
1091
- // Grab tables as per what the user has selected from the multiselect box or all prefixed tables.
1092
- if ( 'migrate_select' === table_intent ) {
1093
- tables = $( '#select-tables' ).val();
1094
- } else {
1095
- if ( 'pull' !== mig_type && 'undefined' !== typeof wpmdb_data.this_prefixed_tables ) {
1096
- tables = wpmdb_data.this_prefixed_tables;
1097
- }
1098
- if ( 'pull' === mig_type && 'undefined' !== typeof wpmdb.common.connection_data && 'undefined' !== typeof wpmdb.common.connection_data.prefixed_tables ) {
1099
- tables = wpmdb.common.connection_data.prefixed_tables;
1100
- }
1101
- }
1102
-
1103
- return tables;
1104
- }
1105
-
1106
- function get_table_prefix( value, args ) {
1107
- return $( '.table-select-wrap .table-prefix' ).text();
1108
- }
1109
-
1110
- function lock_replace_url( lock ) {
1111
- if ( true === lock ) {
1112
- $( '.replace-row.pin .replace-right-col input[type="text"]' ).attr( 'readonly', 'readonly' );
1113
- $( '.replace-row.pin .arrow-col' ).addClass( 'disabled' );
1114
- } else {
1115
- $( '.replace-row.pin .replace-right-col input[type="text"]' ).removeAttr( 'readonly' );
1116
- $( '.replace-row.pin .arrow-col' ).removeClass( 'disabled' );
1117
- }
1118
- }
1119
-
1120
- function set_connection_data( data ) {
1121
- wpmdb.common.previous_connection_data = wpmdb.common.connection_data;
1122
- wpmdb.common.connection_data = data;
1123
- $.wpmdb.do_action( 'wpmdb_connection_data_updated', data );
1124
- }
1125
-
1126
- /**
1127
- * Returns formatted info for the Max Request Size slider.
1128
- *
1129
- * @param value
1130
- * @return object
1131
- */
1132
- function get_max_request_display_info( value ) {
1133
- var display_info = {};
1134
-
1135
- display_info.unit = 'MB';
1136
- display_info.amount = ( value / 1024 ).toFixed( 2 );
1137
-
1138
- return display_info;
1139
- }
1140
-
1141
- $( document ).ready( function() {
1142
- wpmdb.migration_state_id = '';
1143
-
1144
- $( '#plugin-compatibility' ).change( function( e ) {
1145
- var install = '1';
1146
- var $status = $( this ).closest( 'td' ).next( 'td' ).find( '.setting-status' );
1147
-
1148
- if ( $( this ).is( ':checked' ) ) {
1149
- var answer = confirm( wpmdb_strings.mu_plugin_confirmation );
1150
-
1151
- if ( !answer ) {
1152
- $( this ).prop( 'checked', false );
1153
- return;
1154
- }
1155
- } else {
1156
- install = '0';
1157
- }
1158
-
1159
- $( '.plugin-compatibility-wrap' ).toggle();
1160
-
1161
- $status.find( '.ajax-success-msg' ).remove();
1162
- $status.append( ajax_spinner );
1163
- $( '#plugin-compatibility' ).attr( 'disabled', 'disabled' );
1164
- $( '.plugin-compatibility' ).addClass( 'disabled' );
1165
-
1166
- $.ajax( {
1167
- url: ajaxurl,
1168
- type: 'POST',
1169
- dataType: 'text',
1170
- cache: false,
1171
- data: {
1172
- action: 'wpmdb_plugin_compatibility',
1173
- install: install
1174
- },
1175
- error: function( jqXHR, textStatus, errorThrown ) {
1176
- alert( wpmdb_strings.plugin_compatibility_settings_problem + '\r\n\r\n' + wpmdb_strings.status + ' ' + jqXHR.status + ' ' + jqXHR.statusText + '\r\n\r\n' + wpmdb_strings.response + '\r\n' + jqXHR.responseText );
1177
- $( '.ajax-spinner' ).remove();
1178
- $( '#plugin-compatibility' ).removeAttr( 'disabled' );
1179
- $( '.plugin-compatibility' ).removeClass( 'disabled' );
1180
- },
1181
- success: function( data ) {
1182
- if ( '' !== $.trim( data ) ) {
1183
- alert( data );
1184
- } else {
1185
- $status.append( '<span class="ajax-success-msg">' + wpmdb_strings.saved + '</span>' );
1186
- $( '.ajax-success-msg' ).fadeOut( 2000, function() {
1187
- $( this ).remove();
1188
- } );
1189
- }
1190
- $( '.ajax-spinner' ).remove();
1191
- $( '#plugin-compatibility' ).removeAttr( 'disabled' );
1192
- $( '.plugin-compatibility' ).removeClass( 'disabled' );
1193
- }
1194
- } );
1195
-
1196
- } );
1197
-
1198
- if ( $( '#plugin-compatibility' ).is( ':checked' ) ) {
1199
- $( '.plugin-compatibility-wrap' ).show();
1200
- }
1201
-
1202
- if ( 0 <= navigator.userAgent.indexOf( 'MSIE' ) || 0 <= navigator.userAgent.indexOf( 'Trident' ) ) {
1203
- $( '.ie-warning' ).show();
1204
- }
1205
-
1206
- if ( 0 === wpmdb_data.valid_licence ) {
1207
- $( '#savefile' ).prop( 'checked', true );
1208
- }
1209
- var max_request_size_container = $( '.max-request-size' );
1210
- var max_request_size_slider = $( '.slider', max_request_size_container );
1211
- max_request_size_slider.slider( {
1212
- range: 'min',
1213
- value: parseInt( wpmdb_data.max_request / 1024 ),
1214
- min: 512,
1215
- max: parseInt( wpmdb_data.bottleneck / 1024 ),
1216
- step: 256,
1217
- create: function( event, ui ) {
1218
- var display_info = get_max_request_display_info( wpmdb_data.max_request / 1024 );
1219
- set_slider_value( max_request_size_container, wpmdb_data.max_request / 1024, display_info.unit, display_info.amount );
1220
- },
1221
- slide: function( event, ui ) {
1222
- var display_info = get_max_request_display_info( ui.value );
1223
- set_slider_value( max_request_size_container, ui.value, display_info.unit, display_info.amount );
1224
- },
1225
- stop: function( event, ui ) {
1226
- $( '.slider-success-msg' ).remove();
1227
- $( '.amount', max_request_size_container ).after( '<img src="' + spinner_url + '" alt="" class="slider-spinner general-spinner" />' );
1228
- max_request_size_slider.slider( 'disable' );
1229
-
1230
- $.ajax( {
1231
- url: ajaxurl,
1232
- type: 'POST',
1233
- cache: false,
1234
- data: {
1235
- action: 'wpmdb_update_max_request_size',
1236
- max_request_size: parseInt( ui.value ),
1237
- nonce: wpmdb_data.nonces.update_max_request_size
1238
- },
1239
- error: function( jqXHR, textStatus, errorThrown ) {
1240
- max_request_size_slider.slider( 'enable' );
1241
- $( '.slider-spinner', max_request_size_container ).remove();
1242
- alert( wpmdb_strings.max_request_size_problem );
1243
- var display_info = get_max_request_display_info( wpmdb_data.max_request / 1024 );
1244
- set_slider_value( max_request_size_container, wpmdb_data.max_request / 1024, display_info.unit, display_info.amount );
1245
- max_request_size_slider.slider( 'enable' );
1246
- },
1247
- success: function() {
1248
- max_request_size_slider.slider( 'enable' );
1249
- $( '.slider-label-wrapper', max_request_size_container ).append( '<span class="slider-success-msg">' + wpmdb_strings.saved + '</span>' );
1250
- $( '.slider-success-msg', max_request_size_container ).fadeOut( 2000, function() {
1251
- $( this ).remove();
1252
- } );
1253
- $( '.slider-spinner', max_request_size_container ).remove();
1254
- }
1255
- } );
1256
- }
1257
- } );
1258
-
1259
- var delay_between_requests_container = $( '.delay-between-requests' );
1260
- var delay_between_requests_slider = $( '.slider', delay_between_requests_container );
1261
- delay_between_requests_slider.slider( {
1262
- range: 'min',
1263
- value: parseInt( wpmdb_data.delay_between_requests / 1000 ),
1264
- min: 0,
1265
- max: 10,
1266
- step: 1,
1267
- create: function( event, ui ) {
1268
- set_slider_value( delay_between_requests_container, wpmdb_data.delay_between_requests / 1000, 's' );
1269
- },
1270
- slide: function( event, ui ) {
1271
- set_slider_value( delay_between_requests_container, ui.value, 's' );
1272
- },
1273
- stop: function( event, ui ) {
1274
- $( '.slider-success-msg' ).remove();
1275
- $( '.amount', delay_between_requests_container ).after( '<img src="' + spinner_url + '" alt="" class="slider-spinner general-spinner" />' );
1276
- delay_between_requests_slider.slider( 'disable' );
1277
-
1278
- $.ajax( {
1279
- url: ajaxurl,
1280
- type: 'POST',
1281
- cache: false,
1282
- data: {
1283
- action: 'wpmdb_update_delay_between_requests',
1284
- delay_between_requests: parseInt( ui.value * 1000 ),
1285
- nonce: wpmdb_data.nonces.update_delay_between_requests
1286
- },
1287
- error: function( jqXHR, textStatus, errorThrown ) {
1288
- delay_between_requests_slider.slider( 'enable' );
1289
- $( '.slider-spinner', delay_between_requests_container ).remove();
1290
- alert( wpmdb_strings.delay_between_requests_problem );
1291
- set_slider_value( delay_between_requests_container, wpmdb_data.delay_between_requests / 1000, 's' );
1292
- delay_between_requests_slider.slider( 'enable' );
1293
- },
1294
- success: function() {
1295
- wpmdb_data.delay_between_requests = parseInt( ui.value * 1000 );
1296
- delay_between_requests_slider.slider( 'enable' );
1297
- $( '.slider-label-wrapper', delay_between_requests_container ).append( '<span class="slider-success-msg">' + wpmdb_strings.saved + '</span>' );
1298
- $( '.slider-success-msg', delay_between_requests_container ).fadeOut( 2000, function() {
1299
- $( this ).remove();
1300
- } );
1301
- $( '.slider-spinner', delay_between_requests_container ).remove();
1302
- }
1303
- } );
1304
- }
1305
- } );
1306
-
1307
- var $push_select = $( '#select-tables' ).clone();
1308
- var $pull_select = $( '#select-tables' ).clone();
1309
- var $push_post_type_select = $( '#select-post-types' ).clone();
1310
- var $pull_post_type_select = $( '#select-post-types' ).clone();
1311
- var $push_select_backup = $( '#select-backup' ).clone();
1312
- var $pull_select_backup = $( '#select-backup' ).clone();
1313
-
1314
- $( '.help-tab .video' ).each( function() {
1315
- var $container = $( this ),
1316
- $viewer = $( '.video-viewer' );
1317
-
1318
- $( 'a', this ).click( function( e ) {
1319
- e.preventDefault();
1320
-
1321
- $viewer.attr( 'src', '//www.youtube.com/embed/' + $container.data( 'video-id' ) + '?autoplay=1' );
1322
- $viewer.show();
1323
- var offset = $viewer.offset();
1324
- $( window ).scrollTop( offset.top - 50 );
1325
- } );
1326
- } );
1327
-
1328
- $( '.backup-options' ).show();
1329
- $( '.keep-active-plugins' ).show();
1330
- if ( 'savefile' === wpmdb_migration_type() ) {
1331
- $( '.backup-options' ).hide();
1332
- $( '.keep-active-plugins' ).hide();
1333
- }
1334
-
1335
- last_replace_switch = wpmdb_migration_type();
1336
-
1337
- function check_licence( licence ) {
1338
- checked_licence = true;
1339
- $.ajax( {
1340
- url: ajaxurl,
1341
- type: 'POST',
1342
- dataType: 'json',
1343
- cache: false,
1344
- data: {
1345
- action: 'wpmdb_check_licence',
1346
- licence: licence,
1347
- context: 'all',
1348
- nonce: wpmdb_data.nonces.check_licence
1349
- },
1350
- error: function( jqXHR, textStatus, errorThrown ) {
1351
- alert( wpmdb_strings.license_check_problem );
1352
- },
1353
- success: function( data ) {
1354
-
1355
- var $support_content = $( '.support-content' );
1356
- var $addons_content = $( '.addons-content' );
1357
- var $licence_content = $( '.licence-status:not(.notification-message)' );
1358
- var licence_msg, support_msg, addons_msg;
1359
-
1360
- if ( 'undefined' !== typeof data.dbrains_api_down ) {
1361
- support_msg = data.dbrains_api_down + data.message;
1362
- addons_msg = data.dbrains_api_down;
1363
- } else if ( 'undefined' !== typeof data.errors ) {
1364
-
1365
- if ( 'undefined' !== typeof data.errors.subscription_expired ) {
1366
- licence_msg = data.errors.subscription_expired.licence;
1367
- support_msg = data.errors.subscription_expired.support;
1368
- addons_msg = data.errors.subscription_expired.addons;
1369
- } else {
1370
- var msg = '';
1371
- for ( var key in data.errors ) {
1372
- msg += data.errors[ key ];
1373
- }
1374
- support_msg = msg;
1375
- addons_msg = msg;
1376
- }
1377
- if ( 'undefined' !== typeof data.addon_content ) {
1378
- addons_msg += '\n' + data.addon_content;
1379
- }
1380
- } else {
1381
- support_msg = data.message;
1382
- addons_msg = data.addon_content;
1383
- }
1384
-
1385
- $licence_content.stop().fadeOut( fade_duration, function() {
1386
- $( this )
1387
- .css( { visibility: 'hidden', display: 'block' } ).slideUp()
1388
- .empty()
1389
- .html( licence_msg )
1390
- .stop()
1391
- .fadeIn( fade_duration );
1392
- } );
1393
- $support_content.stop().fadeOut( fade_duration, function() {
1394
- $( this )
1395
- .empty()
1396
- .html( support_msg )
1397
- .stop()
1398
- .fadeIn( fade_duration );
1399
- } );
1400
- $addons_content.stop().fadeOut( fade_duration, function() {
1401
- $( this )
1402
- .empty()
1403
- .html( addons_msg )
1404
- .stop()
1405
- .fadeIn( fade_duration );
1406
- } );
1407
-
1408
- }
1409
- } );
1410
- }
1411
-
1412
- /**
1413
- * Handle 'Check License Again' functionality found in expired license messages.
1414
- */
1415
- $( '.content-tab' ).on( 'click', '.check-my-licence-again', function( e ) {
1416
- e.preventDefault();
1417
- checked_licence = false;
1418
- $( e.target ).replaceWith( 'Checking... ' + ajax_spinner );
1419
- check_licence( null, 'all' );
1420
- } );
1421
- function refresh_table_selects() {
1422
- if ( undefined !== wpmdb_data && undefined !== wpmdb_data.this_tables && undefined !== wpmdb_data.this_table_sizes_hr ) {
1423
- $push_select = create_table_select( wpmdb_data.this_tables, wpmdb_data.this_table_sizes_hr, $( $push_select ).val() );
1424
- }
1425
-
1426
- if ( undefined !== wpmdb.common.connection_data && undefined !== wpmdb.common.connection_data.tables && undefined !== wpmdb.common.connection_data.table_sizes_hr ) {
1427
- $pull_select = create_table_select( wpmdb.common.connection_data.tables, wpmdb.common.connection_data.table_sizes_hr, $( $pull_select ).val() );
1428
- }
1429
- }
1430
-
1431
- $.wpmdb.add_action( 'wpmdb_refresh_table_selects', refresh_table_selects );
1432
-
1433
- function update_push_table_select() {
1434
- $( '#select-tables' ).remove();
1435
- $( '.select-tables-wrap' ).prepend( $push_select );
1436
- $( '#select-tables' ).change();
1437
- }
1438
-
1439
- $.wpmdb.add_action( 'wpmdb_update_push_table_select', update_push_table_select );
1440
-
1441
- function update_pull_table_select() {
1442
- $( '#select-tables' ).remove();
1443
- $( '.select-tables-wrap' ).prepend( $pull_select );
1444
- $( '#select-tables' ).change();
1445
- }
1446
-
1447
- $.wpmdb.add_action( 'wpmdb_update_pull_table_select', update_pull_table_select );
1448
-
1449
- function disable_table_migration_options() {
1450
- $( '#migrate-selected' ).parents( '.option-section' ).children( '.header-expand-collapse' ).children( '.expand-collapse-arrow' ).removeClass( 'collapsed' );
1451
- $( '.table-select-wrap' ).show();
1452
- $( '#migrate-only-with-prefix' ).prop( 'checked', false );
1453
- $( '#migrate-selected' ).prop( 'checked', true );
1454
- $( '.table-migrate-options' ).hide();
1455
- $( '.select-tables-wrap' ).show();
1456
- }
1457
-
1458
- $.wpmdb.add_action( 'wpmdb_disable_table_migration_options', disable_table_migration_options );
1459
-
1460
- function enable_table_migration_options() {
1461
- $( '.table-migrate-options' ).show();
1462
- }
1463
-
1464
- $.wpmdb.add_action( 'wpmdb_enable_table_migration_options', enable_table_migration_options );
1465
-
1466
- function select_all_tables() {
1467
- $( '#select-tables' ).children( 'option' ).prop( 'selected', true );
1468
- $( '#select-tables' ).change();
1469
- }
1470
-
1471
- $.wpmdb.add_action( 'wpmdb_select_all_tables', select_all_tables );
1472
-
1473
- function base_old_url( value, args ) {
1474
- return remove_protocol( wpmdb_data.this_url );
1475
- }
1476
-
1477
- $.wpmdb.add_filter( 'wpmdb_base_old_url', base_old_url );
1478
-
1479
- function establish_remote_connection_from_saved_profile() {
1480
- var action = wpmdb_migration_type();
1481
- var connection_info = $.trim( $( '.pull-push-connection-info' ).val() ).split( '\n' );
1482
- if ( 'undefined' === typeof wpmdb_default_profile || true === wpmdb_default_profile || 'savefile' === action || doing_ajax || !wpmdb_data.is_pro ) {
1483
- return;
1484
- }
1485
-
1486
- doing_ajax = true;
1487
- disable_export_type_controls();
1488
-
1489
- $( '.connection-status' ).html( wpmdb_strings.establishing_remote_connection );
1490
- $( '.connection-status' ).removeClass( 'notification-message error-notice migration-error' );
1491
- $( '.connection-status' ).append( ajax_spinner );
1492
-
1493
- var intent = wpmdb_migration_type();
1494
-
1495
- $.ajax( {
1496
- url: ajaxurl,
1497
- type: 'POST',
1498
- dataType: 'json',
1499
- cache: false,
1500
- data: {
1501
- action: 'wpmdb_verify_connection_to_remote_site',
1502
- url: connection_info[ 0 ],
1503
- key: connection_info[ 1 ],
1504
- intent: intent,
1505
- nonce: wpmdb_data.nonces.verify_connection_to_remote_site,
1506
- convert_post_type_selection: wpmdb_convert_post_type_selection,
1507
- profile: wpmdb_data.profile
1508
- },
1509
- error: function( jqXHR, textStatus, errorThrown ) {
1510
- $( '.connection-status' ).html( get_ajax_errors( jqXHR.responseText, '(#102)', jqXHR ) );
1511
- $( '.connection-status' ).addClass( 'notification-message error-notice migration-error' );
1512
- $( '.ajax-spinner' ).remove();
1513
- doing_ajax = false;
1514
- enable_export_type_controls();
1515
- },
1516
- success: function( data ) {
1517
- $( '.ajax-spinner' ).remove();
1518
- doing_ajax = false;
1519
- enable_export_type_controls();
1520
-
1521
- if ( 'undefined' !== typeof data.wpmdb_error && 1 === data.wpmdb_error ) {
1522
- $( '.connection-status' ).html( data.body );
1523
- $( '.connection-status' ).addClass( 'notification-message error-notice migration-error' );
1524
-
1525
- if ( data.body.indexOf( '401 Unauthorized' ) > -1 ) {
1526
- $( '.basic-access-auth-wrapper' ).show();
1527
- }
1528
-
1529
- return;
1530
- }
1531
-
1532
- maybe_show_ssl_warning( connection_info[ 0 ], connection_info[ 1 ], data.scheme );
1533
- maybe_show_prefix_notice( data.prefix );
1534
-
1535
- $( '.pull-push-connection-info' ).addClass( 'temp-disabled' );
1536
- $( '.pull-push-connection-info' ).attr( 'readonly', 'readonly' );
1537
- $( '.connect-button' ).hide();
1538
-
1539
- $( '.connection-status' ).hide();
1540
- $( '.step-two' ).show();
1541
- connection_established = true;
1542
- set_connection_data( data );
1543
- move_connection_info_box();
1544
-
1545
- maybe_show_mixed_cased_table_name_warning();
1546
-
1547
- var loaded_tables = '';
1548
- if ( false === wpmdb_default_profile && 'undefined' !== typeof wpmdb_loaded_tables ) {
1549
- loaded_tables = wpmdb_loaded_tables;
1550
- }
1551
-
1552
- $pull_select = create_table_select( wpmdb.common.connection_data.tables, wpmdb.common.connection_data.table_sizes_hr, loaded_tables );
1553
-
1554
- var loaded_post_types = '';
1555
- if ( false === wpmdb_default_profile && 'undefined' !== typeof wpmdb_loaded_post_types ) {
1556
- if ( 'undefined' !== typeof data.select_post_types ) {
1557
- $( '#exclude-post-types' ).attr( 'checked', 'checked' );
1558
- $( '.post-type-select-wrap' ).show();
1559
- loaded_post_types = data.select_post_types;
1560
- } else {
1561
- loaded_post_types = wpmdb_loaded_post_types;
1562
- }
1563
- }
1564
-
1565
- var $post_type_select = document.createElement( 'select' );
1566
- $( $post_type_select ).attr( {
1567
- multiple: 'multiple',
1568
- name: 'select_post_types[]',
1569
- id: 'select-post-types',
1570
- class: 'multiselect'
1571
- } );
1572
-
1573
- $.each( wpmdb.common.connection_data.post_types, function( index, value ) {
1574
- var selected = $.inArray( value, loaded_post_types );
1575
- if ( -1 !== selected || ( true === wpmdb_convert_exclude_revisions && 'revision' !== value ) ) {
1576
- selected = ' selected="selected" ';
1577
- } else {
1578
- selected = ' ';
1579
- }
1580
- $( $post_type_select ).append( '<option' + selected + 'value="' + value + '">' + value + '</option>' );
1581
- } );
1582
-
1583
- $pull_post_type_select = $post_type_select;
1584
-
1585
- var loaded_tables_backup = '';
1586
- if ( false === wpmdb_default_profile && 'undefined' !== typeof wpmdb_loaded_tables_backup ) {
1587
- loaded_tables_backup = wpmdb_loaded_tables_backup;
1588
- }
1589
-
1590
- var $table_select_backup = document.createElement( 'select' );
1591
- $( $table_select_backup ).attr( {
1592
- multiple: 'multiple',
1593
- name: 'select_backup[]',
1594
- id: 'select-backup',
1595
- class: 'multiselect'
1596
- } );
1597
-
1598
- $.each( wpmdb.common.connection_data.tables, function( index, value ) {
1599
- var selected = $.inArray( value, loaded_tables_backup );
1600
- if ( -1 !== selected ) {
1601
- selected = ' selected="selected" ';
1602
- } else {
1603
- selected = ' ';
1604
- }
1605
- $( $table_select_backup ).append( '<option' + selected + 'value="' + value + '">' + value + ' (' + wpmdb.common.connection_data.table_sizes_hr[ value ] + ')</option>' );
1606
- } );
1607
-
1608
- $push_select_backup = $table_select_backup;
1609
-
1610
- if ( 'pull' === wpmdb_migration_type() ) {
1611
- $.wpmdb.do_action( 'wpmdb_update_pull_table_select' );
1612
- $( '#select-post-types' ).remove();
1613
- $( '.exclude-post-types-warning' ).after( $pull_post_type_select );
1614
- $( '#select-backup' ).remove();
1615
- $( '.backup-tables-wrap' ).prepend( $pull_select_backup );
1616
- $( '.table-prefix' ).html( data.prefix );
1617
- $( '.uploads-dir' ).html( wpmdb_data.this_uploads_dir );
1618
- } else {
1619
- $( '#select-backup' ).remove();
1620
- $( '.backup-tables-wrap' ).prepend( $push_select_backup );
1621
- }
1622
-
1623
- $.wpmdb.do_action( 'verify_connection_to_remote_site', wpmdb.common.connection_data );
1624
- }
1625
-
1626
- } );
1627
-
1628
- }
1629
-
1630
- // automatically validate connection info if we're loading a saved profile
1631
- establish_remote_connection_from_saved_profile();
1632
-
1633
- // add to <a> tags which act as JS event buttons, will not jump page to top and will deselect the button
1634
- $( 'body' ).on( 'click', '.js-action-link', function( e ) {
1635
- e.preventDefault();
1636
- $( this ).blur();
1637
- } );
1638
-
1639
- function enable_pro_licence( data, licence_key ) {
1640
- $( '.licence-input, .register-licence' ).remove();
1641
- $( '.licence-not-entered' ).prepend( data.masked_licence );
1642
- $( '.support-content' ).empty().html( '<p>' + wpmdb_strings.fetching_license + '<img src="' + spinner_url + '" alt="" class="ajax-spinner general-spinner" /></p>' );
1643
- check_licence( licence_key );
1644
-
1645
- $( '.migrate-selection label' ).removeClass( 'disabled' );
1646
- $( '.migrate-selection input' ).removeAttr( 'disabled' );
1647
- }
1648
-
1649
- $( '.licence-input' ).keypress( function( e ) {
1650
- if ( 13 === e.which ) {
1651
- e.preventDefault();
1652
- $( '.register-licence' ).click();
1653
- }
1654
- } );
1655
-
1656
- // registers your licence
1657
- $( 'body' ).on( 'click', '.register-licence', function( e ) {
1658
- e.preventDefault();
1659
-
1660
- if ( doing_licence_registration_ajax ) {
1661
- return;
1662
- }
1663
-
1664
- var licence_key = $.trim( $( '.licence-input' ).val() );
1665
- var $licence_status = $( '.licence-status' );
1666
-
1667
- $licence_status.removeClass( 'notification-message error-notice success-notice' );
1668
-
1669
- if ( '' === licence_key ) {
1670
- $licence_status.html( '<div class="notification-message error-notice">' + wpmdb_strings.enter_license_key + '</div>' );
1671
- return;
1672
- }
1673
-
1674
- $licence_status.empty().removeClass( 'success' );
1675
- doing_licence_registration_ajax = true;
1676
- $( '.button.register-licence' ).after( '<img src="' + spinner_url + '" alt="" class="register-licence-ajax-spinner general-spinner" />' );
1677
-
1678
- $.ajax( {
1679
- url: ajaxurl,
1680
- type: 'POST',
1681
- dataType: 'JSON',
1682
- cache: false,
1683
- data: {
1684
- action: 'wpmdb_activate_licence',
1685
- licence_key: licence_key,
1686
- nonce: wpmdb_data.nonces.activate_licence,
1687
- context: 'licence'
1688
- },
1689
- error: function( jqXHR, textStatus, errorThrown ) {
1690
- doing_licence_registration_ajax = false;
1691
- $( '.register-licence-ajax-spinner' ).remove();
1692
- $licence_status.html( wpmdb_strings.register_license_problem );
1693
- },
1694
- success: function( data ) {
1695
- doing_licence_registration_ajax = false;
1696
- $( '.register-licence-ajax-spinner' ).remove();
1697
-
1698
- if ( 'undefined' !== typeof data.errors ) {
1699
- var msg = '';
1700
- for ( var key in data.errors ) {
1701
- msg += data.errors[ key ];
1702
- }
1703
- $licence_status.html( msg );
1704
-
1705
- if ( 'undefined' !== typeof data.masked_licence ) {
1706
- enable_pro_licence( data, licence_key );
1707
- $( '.migrate-tab .invalid-licence' ).hide();
1708
- }
1709
- } else if ( 'undefined' !== typeof data.wpmdb_error && 'undefined' !== typeof data.body ) {
1710
- $licence_status.html( data.body );
1711
- } else {
1712
- if ( 1 === Number( data.is_first_activation ) ) {
1713
- wpmdb_strings.welcome_text = wpmdb_strings.welcome_text.replace( '%1$s', 'https://deliciousbrains.com/wp-migrate-db-pro/doc/quick-start-guide/' );
1714
- wpmdb_strings.welcome_text = wpmdb_strings.welcome_text.replace( '%2$s', 'https://deliciousbrains.com/wp-migrate-db-pro/videos/' );
1715
-
1716
- $licence_status.after(
1717
- '<div id="welcome-wrap">' +
1718
- '<img id="welcome-img" src="' + wpmdb_data.this_plugin_url + 'asset/dist/welcome.jpg" />' +
1719
- '<div class="welcome-text">' +
1720
- '<h3>' + wpmdb_strings.welcome_title + '</h3>' +
1721
- '<p>' + wpmdb_strings.welcome_text + '</p>' +
1722
- '</div>' +
1723
- '</div>'
1724
- );
1725
- }
1726
-
1727
- $licence_status.html( wpmdb_strings.license_registered ).delay( 5000 ).fadeOut( 1000, function() {
1728
- $( this ).css( { visibility: 'hidden', display: 'block' } ).slideUp();
1729
- } );
1730
- $licence_status.addClass( 'success notification-message success-notice' );
1731
- enable_pro_licence( data, licence_key );
1732
- $( '.invalid-licence' ).hide();
1733
- }
1734
- }
1735
- } );
1736
-
1737
- } );
1738
-
1739
- // clears the debug log
1740
- $( '.clear-log' ).click( function() {
1741
- $( '.debug-log-textarea' ).val( '' );
1742
- $.ajax( {
1743
- url: ajaxurl,
1744
- type: 'POST',
1745
- dataType: 'text',
1746
- cache: false,
1747
- data: {
1748
- action: 'wpmdb_clear_log',
1749
- nonce: wpmdb_data.nonces.clear_log
1750
- },
1751
- error: function( jqXHR, textStatus, errorThrown ) {
1752
- alert( wpmdb_strings.clear_log_problem );
1753
- },
1754
- success: function( data ) {
1755
- }
1756
- } );
1757
- } );
1758
-
1759
- // updates the debug log when the user switches to the help tab
1760
- function refresh_debug_log() {
1761
- $.ajax( {
1762
- url: ajaxurl,
1763
- type: 'POST',
1764
- dataType: 'text',
1765
- cache: false,
1766
- data: {
1767
- action: 'wpmdb_get_log',
1768
- nonce: wpmdb_data.nonces.get_log
1769
- },
1770
- error: function( jqXHR, textStatus, errorThrown ) {
1771
- alert( wpmdb_strings.update_log_problem );
1772
- },
1773
- success: function( data ) {
1774
- $( '.debug-log-textarea' ).val( data );
1775
- }
1776
- } );
1777
- }
1778
-
1779
- // select all tables
1780
- $( '.multiselect-select-all' ).click( function() {
1781
- var multiselect = $( this ).parents( '.select-wrap' ).children( '.multiselect' );
1782
- $( 'option', multiselect ).prop( 'selected', 1 );
1783
- $( multiselect ).focus().trigger( 'change' );
1784
- } );
1785
-
1786
- // deselect all tables
1787
- $( '.multiselect-deselect-all' ).click( function() {
1788
- var multiselect = $( this ).parents( '.select-wrap' ).children( '.multiselect' );
1789
- $( 'option', multiselect ).removeAttr( 'selected' );
1790
- $( multiselect ).focus().trigger( 'change' );
1791
- } );
1792
-
1793
- // invert table selection
1794
- $( '.multiselect-invert-selection' ).click( function() {
1795
- var multiselect = $( this ).parents( '.select-wrap' ).children( '.multiselect' );
1796
- $( 'option', multiselect ).each( function() {
1797
- $( this ).attr( 'selected', !$( this ).attr( 'selected' ) );
1798
- } );
1799
- $( multiselect ).focus().trigger( 'change' );
1800
- } );
1801
-
1802
- // on option select hide all "advanced" option divs and show the correct div for the option selected
1803
- $( '.option-group input[type=radio]' ).change( function() {
1804
- var group = $( this ).closest( '.option-group' );
1805
- $( 'ul', group ).hide();
1806
- var parent = $( this ).closest( 'li' );
1807
- $( 'ul', parent ).show();
1808
- } );
1809
-
1810
- // on page load, expand hidden divs for selected options (browser form cache)
1811
- $( '.option-group' ).each( function() {
1812
- $( '.option-group input[type=radio]' ).each( function() {
1813
- if ( $( this ).is( ':checked' ) ) {
1814
- var parent = $( this ).closest( 'li' );
1815
- $( 'ul', parent ).show();
1816
- }
1817
- } );
1818
- } );
1819
-
1820
- // expand and collapse content on click
1821
- $( '.header-expand-collapse' ).click( function() {
1822
- if ( $( '.expand-collapse-arrow', this ).hasClass( 'collapsed' ) ) {
1823
- $( '.expand-collapse-arrow', this ).removeClass( 'collapsed' );
1824
- $( this ).next().show();
1825
- } else {
1826
- $( '.expand-collapse-arrow', this ).addClass( 'collapsed' );
1827
- $( this ).next().hide();
1828
- }
1829
- } );
1830
-
1831
- $( '.checkbox-label input[type=checkbox]' ).change( function() {
1832
- if ( $( this ).is( ':checked' ) ) {
1833
- $( this ).parent().next().show();
1834
- } else {
1835
- $( this ).parent().next().hide();
1836
- }
1837
- } );
1838
-
1839
- // warning for excluding post types
1840
- $( '.select-post-types-wrap' ).on( 'change', '#select-post-types', function() {
1841
- exclude_post_types_warning();
1842
- } );
1843
-
1844
- function exclude_post_types_warning() {
1845
- var excluded_post_types = $( '#select-post-types' ).val();
1846
- var excluded_post_types_text = '';
1847
- var $exclude_post_types_warning = $( '.exclude-post-types-warning' );
1848
-
1849
- if ( excluded_post_types ) {
1850
- excluded_post_types_text = '<code>' + excluded_post_types.join( '</code>, <code>' ) + '</code>';
1851
- $( '.excluded-post-types' ).html( excluded_post_types_text );
1852
-
1853
- if ( '0' === $exclude_post_types_warning.css( 'opacity' ) ) {
1854
- $exclude_post_types_warning
1855
- .css( { opacity: 0 } )
1856
- .slideDown( 200 )
1857
- .animate( { opacity: 1 } );
1858
- }
1859
- } else {
1860
- $exclude_post_types_warning
1861
- .css( { opacity: 0 } )
1862
- .slideUp( 200 )
1863
- .animate( { opacity: 0 } );
1864
- }
1865
- }
1866
-
1867
- if ( $( '#exclude-post-types' ).is( ':checked' ) ) {
1868
- if ( $( '#select-post-types' ).val() ) {
1869
- $( '.exclude-post-types-warning' ).css( { display: 'block', opacity: 1 } );
1870
- }
1871
- }
1872
-
1873
- // special expand and collapse content on click for save migration profile
1874
- $( '#save-migration-profile' ).change( function() {
1875
- wpmdb.functions.update_migrate_button_text();
1876
- if ( $( this ).is( ':checked' ) ) {
1877
- $( '.save-settings-button' ).show();
1878
- } else {
1879
- $( '.save-settings-button' ).hide();
1880
- }
1881
- } );
1882
-
1883
- if ( $( '#save-migration-profile' ).is( ':checked' ) ) {
1884
- $( '.save-settings-button' ).show();
1885
- }
1886
-
1887
- $( '.create-new-profile' ).focus( function() {
1888
- $( '#create_new' ).prop( 'checked', true );
1889
- } );
1890
-
1891
- $( '.checkbox-label input[type=checkbox]' ).each( function() {
1892
- if ( $( this ).is( ':checked' ) ) {
1893
- $( this ).parent().next().show();
1894
- }
1895
- } );
1896
-
1897
- // AJAX migrate button
1898
- $( '.migrate-db-button' ).click( function( event ) {
1899
- $( this ).blur();
1900
- event.preventDefault();
1901
- wpmdb.migration_state_id = '';
1902
-
1903
- if ( false === $.wpmdb.apply_filters( 'wpmdb_migration_profile_ready', true ) ) {
1904
- return;
1905
- }
1906
-
1907
- // check that they've selected some tables to migrate
1908
- if ( $( '#migrate-selected' ).is( ':checked' ) && null === $( '#select-tables' ).val() ) {
1909
- alert( wpmdb_strings.please_select_one_table );
1910
- return;
1911
- }
1912
-
1913
- // check that they've selected some tables to backup
1914
- if ( 'savefile' !== wpmdb_migration_type() && $( '#backup-manual-select' ).is( ':checked' ) && null === $( '#select-backup' ).val() ) {
1915
- alert( wpmdb_strings.please_select_one_table_backup );
1916
- return;
1917
- }
1918
-
1919
- var new_url_missing = false;
1920
- var new_file_path_missing = false;
1921
- if ( $( '#new-url' ).length && !$( '#new-url' ).val() ) {
1922
- $( '#new-url-missing-warning' ).show();
1923
- $( '#new-url' ).focus();
1924
- $( 'html,body' ).scrollTop( 0 );
1925
- new_url_missing = true;
1926
- }
1927
-
1928
- if ( $( '#new-path' ).length && !$( '#new-path' ).val() ) {
1929
- $( '#new-path-missing-warning' ).show();
1930
- if ( false === new_url_missing ) {
1931
- $( '#new-path' ).focus();
1932
- $( 'html,body' ).scrollTop( 0 );
1933
- }
1934
- new_file_path_missing = true;
1935
- }
1936
-
1937
- if ( true === new_url_missing || true === new_file_path_missing ) {
1938
- return;
1939
- }
1940
-
1941
- // also save profile
1942
- if ( $( '#save-migration-profile' ).is( ':checked' ) ) {
1943
- save_active_profile();
1944
- }
1945
-
1946
- form_data = $( $( '#migrate-form' )[0].elements ).not( '.auth-credentials' ).serialize();
1947
-
1948
- migration_intent = wpmdb_migration_type();
1949
-
1950
- stage = 'backup';
1951
-
1952
- if ( 'savefile' === migration_intent ) {
1953
- stage = 'migrate';
1954
- }
1955
-
1956
- if ( false === $( '#create-backup' ).is( ':checked' ) ) {
1957
- stage = 'migrate';
1958
- }
1959
-
1960
- wpmdb.current_migration = wpmdb.migration_progress_controller.newMigration( {
1961
- 'localTableSizes': wpmdb_data.this_table_sizes,
1962
- 'localTableRows': wpmdb_data.this_table_rows,
1963
- 'remoteTableSizes': 'undefined' !== typeof wpmdb.common.connection_data ? wpmdb.common.connection_data.table_sizes : null,
1964
- 'remoteTableRows': 'undefined' !== typeof wpmdb.common.connection_data ? wpmdb.common.connection_data.table_rows : null,
1965
- 'migrationIntent': wpmdb_migration_type()
1966
- } );
1967
-
1968
- var backup_option = $( 'input[name=backup_option]:checked' ).val();
1969
- var table_option = $( 'input[name=table_migrate_option]:checked' ).val();
1970
- var selected_tables = '';
1971
- var data_type = '';
1972
-
1973
- // set up backup stage
1974
- if ( 'backup' === stage ) {
1975
- if ( 'migrate_only_with_prefix' === table_option && 'backup_selected' === backup_option ) {
1976
- backup_option = 'backup_only_with_prefix';
1977
- }
1978
- if ( 'push' === migration_intent ) {
1979
- data_type = 'remote';
1980
- if ( 'backup_only_with_prefix' === backup_option ) {
1981
- tables_to_migrate = wpmdb.common.connection_data.prefixed_tables;
1982
- } else if ( 'backup_selected' === backup_option ) {
1983
- selected_tables = $( '#select-tables' ).val();
1984
- selected_tables = $.wpmdb.apply_filters( 'wpmdb_backup_selected_tables', selected_tables );
1985
- tables_to_migrate = get_intersect( selected_tables, wpmdb.common.connection_data.tables );
1986
- } else if ( 'backup_manual_select' === backup_option ) {
1987
- tables_to_migrate = $( '#select-backup' ).val();
1988
- }
1989
- } else {
1990
- data_type = 'local';
1991
- if ( 'backup_only_with_prefix' === backup_option ) {
1992
- tables_to_migrate = wpmdb_data.this_prefixed_tables;
1993
- } else if ( 'backup_selected' === backup_option ) {
1994
- selected_tables = $( '#select-tables' ).val();
1995
- selected_tables = $.wpmdb.apply_filters( 'wpmdb_backup_selected_tables', selected_tables );
1996
- tables_to_migrate = get_intersect( selected_tables, wpmdb_data.this_tables );
1997
- } else if ( 'backup_manual_select' === backup_option ) {
1998
- tables_to_migrate = $( '#select-backup' ).val();
1999
- }
2000
- }
2001
-
2002
- wpmdb.current_migration.model.addStage( 'backup', tables_to_migrate, data_type, {
2003
- strings: {
2004
- migrated: wpmdb_strings.backed_up
2005
- }
2006
- } );
2007
- }
2008
-
2009
- // set up migration stage
2010
- if ( 'push' === migration_intent || 'savefile' === migration_intent ) {
2011
- data_type = 'local';
2012
- } else {
2013
- data_type = 'remote';
2014
- }
2015
- wpmdb.current_migration.model.addStage( 'migrate', get_tables_to_migrate( null, null ), data_type );
2016
-
2017
- // add any additional migration stages via hook
2018
- $.wpmdb.do_action( 'wpmdb_add_migration_stages', {
2019
- 'data_type': data_type,
2020
- 'tables_to_migrate': get_tables_to_migrate( null, null )
2021
- } );
2022
-
2023
- var table_intent = $( 'input[name=table_migrate_option]:checked' ).val();
2024
- var connection_info = $.trim( $( '.pull-push-connection-info' ).val() ).split( '\n' );
2025
- var table_rows = '';
2026
-
2027
- remote_site = connection_info[ 0 ];
2028
- secret_key = connection_info[ 1 ];
2029
-
2030
- var static_migration_label = '';
2031
-
2032
- completed_msg = wpmdb_strings.exporting_complete;
2033
-
2034
- if ( 'savefile' === migration_intent ) {
2035
- static_migration_label = wpmdb_strings.exporting_please_wait;
2036
- } else {
2037
- static_migration_label = get_migration_status_label( remote_site, migration_intent, 'migrating' );
2038
- completed_msg = get_migration_status_label( remote_site, migration_intent, 'completed' );
2039
- }
2040
-
2041
- if ( 'backup' === stage ) {
2042
- tables_to_migrate = wpmdb.current_migration.model.getStageItems( 'backup', 'name' );
2043
- } else {
2044
- tables_to_migrate = wpmdb.current_migration.model.getStageItems( 'migrate', 'name' );
2045
- }
2046
-
2047
- wpmdb.current_migration.model.setActiveStage( stage );
2048
-
2049
- wpmdb.current_migration.setTitle( static_migration_label );
2050
-
2051
- wpmdb.current_migration.startTimer();
2052
-
2053
- currently_migrating = true;
2054
- wpmdb.current_migration.setStatus( 'active' );
2055
-
2056
- var request_data = {
2057
- action: 'wpmdb_initiate_migration',
2058
- intent: migration_intent,
2059
- url: remote_site,
2060
- key: secret_key,
2061
- form_data: form_data,
2062
- stage: stage,
2063
- nonce: wpmdb_data.nonces.initiate_migration
2064
- };
2065
-
2066
- request_data.site_details = {
2067
- local: wpmdb_data.site_details
2068
- };
2069
-
2070
- if ( 'savefile' !== migration_intent ) {
2071
- request_data.temp_prefix = wpmdb.common.connection_data.temp_prefix;
2072
- request_data.site_details.remote = wpmdb.common.connection_data.site_details;
2073
- }
2074
-
2075
- // site_details can have a very large number of elements that blows out PHP's max_input_vars
2076
- // so we reduce it down to one variable for this one POST.
2077
- request_data.site_details = JSON.stringify( request_data.site_details );
2078
-
2079
- doing_ajax = true;
2080
-
2081
- $.ajax( {
2082
- url: ajaxurl,
2083
- type: 'POST',
2084
- dataType: 'json',
2085
- cache: false,
2086
- data: request_data,
2087
- error: function( jqXHR, textStatus, errorThrown ) {
2088
-
2089
- wpmdb.current_migration.setState( wpmdb_strings.migration_failed, get_ajax_errors( jqXHR.responseText, '(#112)', jqXHR ), 'error' );
2090
-
2091
- console.log( jqXHR );
2092
- console.log( textStatus );
2093
- console.log( errorThrown );
2094
- doing_ajax = false;
2095
- wpmdb.common.migration_error = true;
2096
- wpmdb.functions.migration_complete_events();
2097
- return;
2098
- },
2099
- success: function( data ) {
2100
- doing_ajax = false;
2101
- if ( 'undefined' !== typeof data && 'undefined' !== typeof data.wpmdb_error && 1 === data.wpmdb_error ) {
2102
- wpmdb.common.migration_error = true;
2103
- wpmdb.functions.migration_complete_events();
2104
- wpmdb.current_migration.setState( wpmdb_strings.migration_failed, data.body, 'error' );
2105
-
2106
- return;
2107
- }
2108
-
2109
- wpmdb.migration_state_id = data.migration_state_id;
2110
-
2111
- var i = 0;
2112
-
2113
- // Set delay between requests - use max of local/remote values, 0 if doing export
2114
- delay_between_requests = 0;
2115
- if ( 'savefile' !== migration_intent && 'undefined' !== typeof wpmdb.common.connection_data && 'undefined' !== typeof wpmdb.common.connection_data.delay_between_requests ) {
2116
- delay_between_requests = Math.max( parseInt( wpmdb_data.delay_between_requests ), parseInt( wpmdb.common.connection_data.delay_between_requests ) );
2117
- }
2118
-
2119
- wpmdb.functions.migrate_table_recursive = function( current_row, primary_keys ) {
2120
-
2121
- if ( i >= tables_to_migrate.length ) {
2122
- if ( 'backup' === stage ) {
2123
- wpmdb.current_migration.model.setActiveStage( 'migrate' );
2124
-
2125
- stage = 'migrate';
2126
- i = 0;
2127
-
2128
- // should get from model
2129
- tables_to_migrate = get_tables_to_migrate( null, null );
2130
-
2131
- } else {
2132
- $( '.progress-label' ).removeClass( 'label-visible' );
2133
-
2134
- wpmdb.common.hooks = $.wpmdb.apply_filters( 'wpmdb_before_migration_complete_hooks', wpmdb.common.hooks );
2135
- wpmdb.common.hooks.push( wpmdb.functions.migration_complete );
2136
- wpmdb.common.hooks.push( wpmdb.functions.wpmdb_flush );
2137
- wpmdb.common.hooks = $.wpmdb.apply_filters( 'wpmdb_after_migration_complete_hooks', wpmdb.common.hooks );
2138
- wpmdb.common.hooks.push( wpmdb.functions.migration_complete_events );
2139
- wpmdb.common.next_step_in_migration = { fn: wpmdb_call_next_hook };
2140
- wpmdb.functions.execute_next_step();
2141
- return;
2142
- }
2143
- }
2144
-
2145
- var last_table = 0;
2146
- if ( i === ( tables_to_migrate.length - 1 ) ) {
2147
- last_table = 1;
2148
- }
2149
-
2150
- var gzip = 0;
2151
- if ( 'savefile' !== migration_intent && 1 === parseInt( wpmdb.common.connection_data.gzip ) ) {
2152
- gzip = 1;
2153
- }
2154
-
2155
- var request_data = {
2156
- action: 'wpmdb_migrate_table',
2157
- migration_state_id: wpmdb.migration_state_id,
2158
- table: tables_to_migrate[ i ],
2159
- stage: stage,
2160
- current_row: current_row,
2161
- last_table: last_table,
2162
- primary_keys: primary_keys,
2163
- gzip: gzip,
2164
- nonce: wpmdb_data.nonces.migrate_table
2165
- };
2166
-
2167
- if ( 'savefile' !== migration_intent ) {
2168
- request_data.bottleneck = wpmdb.common.connection_data.bottleneck;
2169
- request_data.prefix = wpmdb.common.connection_data.prefix;
2170
- }
2171
-
2172
- if ( wpmdb.common.connection_data && wpmdb.common.connection_data.path_current_site && wpmdb.common.connection_data.domain ) {
2173
- request_data.path_current_site = wpmdb.common.connection_data.path_current_site;
2174
- request_data.domain_current_site = wpmdb.common.connection_data.domain;
2175
- }
2176
-
2177
- doing_ajax = true;
2178
-
2179
- $.ajax( {
2180
- url: ajaxurl,
2181
- type: 'POST',
2182
- dataType: 'text',
2183
- cache: false,
2184
- timeout: 0,
2185
- data: request_data,
2186
- error: function( jqXHR, textStatus, errorThrown ) {
2187
- var progress_text = wpmdb_strings.table_process_problem + ' ' + tables_to_migrate[ i ] + '<br /><br />' + wpmdb_strings.status + ': ' + jqXHR.status + ' ' + jqXHR.statusText + '<br /><br />' + wpmdb_strings.response + ':<br />' + jqXHR.responseText;
2188
- wpmdb.current_migration.setState( wpmdb_strings.migration_failed, progress_text, 'error' );
2189
-
2190
- doing_ajax = false;
2191
- console.log( jqXHR );
2192
- console.log( textStatus );
2193
- console.log( errorThrown );
2194
- wpmdb.common.migration_error = true;
2195
- wpmdb.functions.migration_complete_events();
2196
- return;
2197
- },
2198
- success: function( data ) {
2199
- doing_ajax = false;
2200
- data = $.trim( data );
2201
- var row_information = wpmdb_parse_json( data );
2202
- var error_text = '';
2203
-
2204
- if ( false === row_information || null === row_information ) {
2205
-
2206
- // should update model
2207
- if ( '' === data || null === data ) {
2208
- error_text = wpmdb_strings.table_process_problem_empty_response + ' ' + tables_to_migrate[ i ];
2209
- } else {
2210
- error_text = get_ajax_errors( data, null, null );
2211
- }
2212
-
2213
- wpmdb.current_migration.setState( wpmdb_strings.migration_failed, error_text, 'error' );
2214
- wpmdb.common.migration_error = true;
2215
- wpmdb.functions.migration_complete_events();
2216
- return;
2217
- }
2218
-
2219
- if ( 'undefined' !== typeof row_information.wpmdb_error && 1 === row_information.wpmdb_error ) {
2220
- wpmdb.current_migration.setState( wpmdb_strings.migration_failed, row_information.body, 'error' );
2221
- wpmdb.common.migration_error = true;
2222
- wpmdb.functions.migration_complete_events();
2223
- return;
2224
- }
2225
-
2226
- //successful iteration, update model
2227
- wpmdb.current_migration.setText();
2228
- wpmdb.current_migration.model.getStageModel( stage ).setItemModelRowsTransferred( tables_to_migrate[ i ], row_information.current_row );
2229
-
2230
- // We need the returned file name for delivery or display to the user.
2231
- if ( 1 === last_table && 'savefile' === migration_intent ) {
2232
- if ( 'undefined' !== typeof row_information.dump_filename ) {
2233
- dump_filename = row_information.dump_filename;
2234
- }
2235
- if ( 'undefined' !== typeof row_information.dump_path ) {
2236
- dump_path = row_information.dump_path;
2237
- }
2238
- }
2239
-
2240
- if ( -1 === parseInt( row_information.current_row ) ) {
2241
- i++;
2242
- row_information.current_row = '';
2243
- row_information.primary_keys = '';
2244
- }
2245
-
2246
- wpmdb.common.next_step_in_migration = {
2247
- fn: wpmdb.functions.migrate_table_recursive,
2248
- args: [ row_information.current_row, row_information.primary_keys ]
2249
- };
2250
- wpmdb.functions.execute_next_step();
2251
- }
2252
- } );
2253
-
2254
- };
2255
-
2256
- wpmdb.common.next_step_in_migration = {
2257
- fn: wpmdb.functions.migrate_table_recursive,
2258
- args: [ '-1', '' ]
2259
- };
2260
- wpmdb.functions.execute_next_step();
2261
-
2262
- }
2263
-
2264
- } ); // end ajax
2265
-
2266
- } );
2267
-
2268
- wpmdb.functions.migration_complete_events = function() {
2269
- if ( false === wpmdb.common.migration_error ) {
2270
- if ( '' === wpmdb.common.non_fatal_errors ) {
2271
- if ( 'savefile' !== migration_intent && true === $( '#save_computer' ).is( ':checked' ) ) {
2272
- wpmdb.current_migration.setText();
2273
- }
2274
-
2275
- if ( true === migration_cancelled ) {
2276
- wpmdb.current_migration.setState( completed_msg + '&nbsp;<div class="dashicons dashicons-yes"></div>', wpmdb_strings.migration_cancelled_success, 'cancelled' );
2277
- } else {
2278
- wpmdb.current_migration.setState( completed_msg + '&nbsp;<div class="dashicons dashicons-yes"></div>', '', 'complete' );
2279
- }
2280
-
2281
- } else {
2282
- wpmdb.current_migration.setState( wpmdb_strings.completed_with_some_errors, wpmdb.common.non_fatal_errors, 'error' );
2283
- }
2284
- }
2285
-
2286
- $( '.migration-controls' ).addClass( 'hidden' );
2287
-
2288
- // reset migration variables so consecutive migrations work correctly
2289
- wpmdb.common.hooks = [];
2290
- wpmdb.common.call_stack = [];
2291
- wpmdb.common.migration_error = false;
2292
- currently_migrating = false;
2293
- migration_completed = true;
2294
- migration_paused = false;
2295
- migration_cancelled = false;
2296
- doing_ajax = false;
2297
- wpmdb.common.non_fatal_errors = '';
2298
-
2299
- $( '.progress-label' ).remove();
2300
- $( '.migration-progress-ajax-spinner' ).remove();
2301
- $( '.close-progress-content' ).show();
2302
- $( '#overlay' ).css( 'cursor', 'pointer' );
2303
- wpmdb.current_migration.model.setMigrationComplete();
2304
- };
2305
-
2306
- wpmdb.functions.migration_complete = function() {
2307
-
2308
- $( '.migration-controls' ).addClass( 'hidden' );
2309
-
2310
- if ( 'savefile' === migration_intent ) {
2311
- currently_migrating = false;
2312
- var migrate_complete_text = wpmdb_strings.migration_complete;
2313
- if ( $( '#save_computer' ).is( ':checked' ) ) {
2314
- var url = wpmdb_data.this_download_url + encodeURIComponent( dump_filename );
2315
- if ( $( '#gzip_file' ).is( ':checked' ) ) {
2316
- url += '&gzip=1';
2317
- }
2318
- window.location = url;
2319
- } else {
2320
- migrate_complete_text = wpmdb_strings.completed_dump_located_at + ' ' + dump_path;
2321
- }
2322
-
2323
- if ( false === wpmdb.common.migration_error ) {
2324
-
2325
- wpmdb.functions.migration_complete_events();
2326
- wpmdb.current_migration.setState( completed_msg, migrate_complete_text, 'complete' );
2327
-
2328
- }
2329
-
2330
- } else { // rename temp tables, delete old tables
2331
-
2332
- wpmdb.current_migration.setState( null, wpmdb_strings.finalizing_migration, 'finalizing' );
2333
-
2334
- doing_ajax = true;
2335
- $.ajax( {
2336
- url: ajaxurl,
2337
- type: 'POST',
2338
- dataType: 'text',
2339
- cache: false,
2340
- data: {
2341
- action: 'wpmdb_finalize_migration',
2342
- migration_state_id: wpmdb.migration_state_id,
2343
- prefix: wpmdb.common.connection_data.prefix,
2344
- tables: tables_to_migrate.join( ',' ),
2345
- nonce: wpmdb_data.nonces.finalize_migration
2346
- },
2347
- error: function( jqXHR, textStatus, errorThrown ) {
2348
- doing_ajax = false;
2349
- wpmdb.current_migration.setState( wpmdb_strings.migration_failed, wpmdb_strings.finalize_tables_problem, 'error' );
2350
-
2351
- alert( jqXHR + ' : ' + textStatus + ' : ' + errorThrown );
2352
- wpmdb.common.migration_error = true;
2353
- wpmdb.functions.migration_complete_events();
2354
- return;
2355
- },
2356
- success: function( data ) {
2357
- doing_ajax = false;
2358
- if ( '1' !== $.trim( data ) ) {
2359
- wpmdb.current_migration.setState( wpmdb_strings.migration_failed, data, 'error' );
2360
-
2361
- wpmdb.common.migration_error = true;
2362
- wpmdb.functions.migration_complete_events();
2363
- return;
2364
- }
2365
- wpmdb.common.next_step_in_migration = { fn: wpmdb_call_next_hook };
2366
- wpmdb.functions.execute_next_step();
2367
- }
2368
- } );
2369
- }
2370
- };
2371
-
2372
- wpmdb.functions.wpmdb_flush = function() {
2373
- if ( 'savefile' !== migration_intent ) {
2374
- wpmdb.current_migration.setText( wpmdb_strings.flushing );
2375
- doing_ajax = true;
2376
- $.ajax( {
2377
- url: ajaxurl,
2378
- type: 'POST',
2379
- dataType: 'text',
2380
- cache: false,
2381
- data: {
2382
- action: 'wpmdb_flush',
2383
- migration_state_id: wpmdb.migration_state_id,
2384
- nonce: wpmdb_data.nonces.flush
2385
- },
2386
- error: function( jqXHR, textStatus, errorThrown ) {
2387
- doing_ajax = false;
2388
- wpmdb.current_migration.setState( wpmdb_strings.migration_failed, wpmdb_strings.flush_problem, 'error' );
2389
-
2390
- alert( jqXHR + ' : ' + textStatus + ' : ' + errorThrown );
2391
- wpmdb.common.migration_error = true;
2392
- wpmdb.functions.migration_complete_events();
2393
- return;
2394
- },
2395
- success: function( data ) {
2396
- doing_ajax = false;
2397
- if ( '1' !== $.trim( data ) ) {
2398
- wpmdb.current_migration.setState( wpmdb_strings.migration_failed, data, 'error' );
2399
-
2400
- wpmdb.common.migration_error = true;
2401
- wpmdb.functions.migration_complete_events();
2402
- return;
2403
- }
2404
- wpmdb.common.next_step_in_migration = { fn: wpmdb_call_next_hook };
2405
- wpmdb.functions.execute_next_step();
2406
- }
2407
- } );
2408
- }
2409
- };
2410
-
2411
- wpmdb.functions.update_migrate_button_text = function() {
2412
- var migration_intent = wpmdb_migration_type();
2413
- var save_string = ( $( '#save-migration-profile' ).is( ':checked' ) ) ? '_save' : '';
2414
- var migrate_string = 'migrate_button_' + ( ( 'savefile' === migration_intent ) ? 'export' : migration_intent ) + save_string;
2415
- $( '.migrate-db .button-primary' ).val( wpmdb_strings[ migrate_string ] );
2416
- };
2417
-
2418
- wpmdb.functions.update_migrate_button_text();
2419
-
2420
- // close progress pop up once migration is completed
2421
- $( 'body' ).on( 'click', '.close-progress-content-button', function( e ) {
2422
- hide_overlay();
2423
- wpmdb.current_migration.restoreTitleElem();
2424
- } );
2425
-
2426
- $( 'body' ).on( 'click', '#overlay', function( e ) {
2427
- if ( true === migration_completed && e.target === this ) {
2428
- hide_overlay();
2429
- wpmdb.current_migration.restoreTitleElem();
2430
- }
2431
- } );
2432
-
2433
- function hide_overlay() {
2434
- $( '#overlay' ).removeClass( 'show' ).addClass( 'hide' );
2435
- $( '#overlay > div' ).removeClass( 'show' ).addClass( 'hide' );
2436
- wpmdb.current_migration.$proVersion.find( 'iframe' ).remove();
2437
- setTimeout( function() {
2438
- $( '#overlay' ).remove();
2439
- }, 500 );
2440
- migration_completed = false;
2441
- }
2442
-
2443
- // AJAX save button profile
2444
- $( '.save-settings-button' ).click( function( event ) {
2445
- event.preventDefault();
2446
- if ( '' === $.trim( $( '.create-new-profile' ).val() ) && $( '#create_new' ).is( ':checked' ) ) {
2447
- alert( wpmdb_strings.enter_name_for_profile );
2448
- $( '.create-new-profile' ).focus();
2449
- return;
2450
- }
2451
- save_active_profile();
2452
- } );
2453
-
2454
- function save_active_profile() {
2455
- var profile;
2456
- $( '.save-settings-button' ).blur();
2457
-
2458
- if ( doing_save_profile ) {
2459
- return;
2460
- }
2461
-
2462
- // check that they've selected some tables to migrate
2463
- if ( $( '#migrate-selected' ).is( ':checked' ) && null === $( '#select-tables' ).val() ) {
2464
- alert( wpmdb_strings.please_select_one_table );
2465
- return;
2466
- }
2467
-
2468
- // check that they've selected some tables to backup
2469
- if ( 'savefile' !== wpmdb_migration_type() && $( '#backup-manual-select' ).is( ':checked' ) && null === $( '#select-backup' ).val() ) {
2470
- alert( wpmdb_strings.please_select_one_table_backup );
2471
- return;
2472
- }
2473
-
2474
- var create_new_profile = false;
2475
-
2476
- if ( $( '#create_new' ).is( ':checked' ) ) {
2477
- create_new_profile = true;
2478
- }
2479
- var profile_name = $( '.create-new-profile' ).val();
2480
-
2481
- doing_save_profile = true;
2482
- profile = $( $( '#migrate-form' )[0].elements ).not( '.auth-credentials' ).serialize();
2483
-
2484
- $( '.save-settings-button' ).attr( 'disabled', 'disabled' )
2485
- .after( '<img src="' + spinner_url + '" alt="" class="save-profile-ajax-spinner general-spinner" />' );
2486
-
2487
- doing_ajax = true;
2488
-
2489
- $.ajax( {
2490
- url: ajaxurl,
2491
- type: 'POST',
2492
- dataType: 'text',
2493
- cache: false,
2494
- data: {
2495
- action: 'wpmdb_save_profile',
2496
- profile: profile,
2497
- nonce: wpmdb_data.nonces.save_profile
2498
- },
2499
- error: function( jqXHR, textStatus, errorThrown ) {
2500
- doing_ajax = false;
2501
- alert( wpmdb_strings.save_profile_problem );
2502
- $( '.save-settings-button' ).removeAttr( 'disabled' );
2503
- $( '.save-profile-ajax-spinner' ).remove();
2504
- $( '.save-settings-button' ).after( '<span class="ajax-success-msg">' + wpmdb_strings.saved + '</span>' );
2505
- $( '.ajax-success-msg' ).fadeOut( 2000, function() {
2506
- $( this ).remove();
2507
- } );
2508
- doing_save_profile = false;
2509
- },
2510
- success: function( data ) {
2511
- var updated_profile_id = parseInt( $( '#migrate-form input[name=save_migration_profile_option]:checked' ).val(), 10 ) + 1;
2512
- doing_ajax = false;
2513
- $( '.save-settings-button' ).removeAttr( 'disabled' );
2514
- $( '.save-profile-ajax-spinner' ).remove();
2515
- $( '.save-settings-button' ).after( '<span class="ajax-success-msg">' + wpmdb_strings.saved + '</span>' );
2516
- $( '.ajax-success-msg' ).fadeOut( 2000, function() {
2517
- $( this ).remove();
2518
- } );
2519
- doing_save_profile = false;
2520
- $( '.create-new-profile' ).val( '' );
2521
-
2522
- if ( create_new_profile ) {
2523
- var new_profile_key = parseInt( data, 10 );
2524
- var new_profile_id = new_profile_key + 1;
2525
- var new_li = $( '<li><span class="delete-profile" data-profile-id="' + new_profile_id + '"></span><label for="profile-' + new_profile_id + '"><input id="profile-' + new_profile_id + '" value="' + new_profile_key + '" name="save_migration_profile_option" type="radio"></label></li>' );
2526
- new_li.find( 'label' ).append( document.createTextNode( ' ' + profile_name ) );
2527
- updated_profile_id = new_profile_id;
2528
-
2529
- $( '#create_new' ).parents( 'li' ).before( new_li );
2530
- $( '#profile-' + new_profile_id ).attr( 'checked', 'checked' );
2531
- }
2532
-
2533
- // Push updated profile id to history if available
2534
- var updated_url = window.location.href.replace( '#migrate', '' ).replace( /&wpmdb-profile=-?\d+/, '' ) + '&wpmdb-profile=' + updated_profile_id;
2535
- var updated_profile_name = $( '#migrate-form input[name=save_migration_profile_option]:checked' ).parent().text().trim();
2536
-
2537
- if ( 'function' === typeof window.history.pushState ) {
2538
- if ( $( '#migrate-form .crumbs' ).length ) {
2539
- $( '#migrate-form .crumbs .crumb:last' ).text( updated_profile_name );
2540
- } else {
2541
- var $crumbs = $( '<div class="crumbs" />' )
2542
- .append( '<a class="crumb" href="' + wpmdb_data.this_plugin_base + '"> Saved Profiles </a>' )
2543
- .append( '<span class="crumb">' + updated_profile_name + '</span>' );
2544
- $( '#migrate-form' ).prepend( $crumbs );
2545
- }
2546
- window.history.pushState( { updated_profile_id: updated_profile_id }, null, updated_url );
2547
- }
2548
- }
2549
- } );
2550
- }
2551
-
2552
- // save file (export) / push / pull special conditions
2553
- function move_connection_info_box() {
2554
- $( '.connection-status' ).hide();
2555
- $( '.prefix-notice' ).hide();
2556
- $( '.ssl-notice' ).hide();
2557
- $( '.different-plugin-version-notice' ).hide();
2558
- $( '.step-two' ).show();
2559
- $( '.backup-options' ).show();
2560
- $( '.keep-active-plugins' ).show();
2561
- $( '.directory-permission-notice' ).hide();
2562
- $( '#create-backup' ).removeAttr( 'disabled' );
2563
- $( '#create-backup-label' ).removeClass( 'disabled' );
2564
- $( '.backup-option-disabled' ).hide();
2565
- $( '.compatibility-older-mysql' ).hide();
2566
- var connection_info = $.trim( $( '.pull-push-connection-info' ).val() ).split( '\n' );
2567
- var profile_name;
2568
- wpmdb_toggle_migration_action_text();
2569
- if ( 'pull' === wpmdb_migration_type() ) {
2570
- $( '.pull-list li' ).append( $connection_info_box );
2571
- $connection_info_box.show( function() {
2572
- var connection_textarea = $( this ).find( '.pull-push-connection-info' );
2573
- if ( !connection_textarea.val() ) {
2574
- connection_textarea.focus();
2575
- }
2576
- } );
2577
- if ( connection_established ) {
2578
- $( '.connection-status' ).hide();
2579
- $( '.step-two' ).show();
2580
- $( '.table-prefix' ).html( wpmdb.common.connection_data.prefix );
2581
- $( '.uploads-dir' ).html( wpmdb_data.this_uploads_dir );
2582
- if ( false === profile_name_edited ) {
2583
- profile_name = get_domain_name( wpmdb.common.connection_data.url );
2584
- $( '.create-new-profile' ).val( profile_name );
2585
- }
2586
- if ( true === show_prefix_notice ) {
2587
- $( '.prefix-notice.pull' ).show();
2588
- }
2589
- if ( true === show_ssl_notice ) {
2590
- $( '.ssl-notice' ).show();
2591
- }
2592
- if ( true === show_version_notice ) {
2593
- $( '.different-plugin-version-notice' ).show();
2594
- $( '.step-two' ).hide();
2595
- }
2596
- wpmdb_toggle_migration_action_text();
2597
- if ( false === wpmdb_data.write_permission ) {
2598
- $( '#create-backup' ).prop( 'checked', false );
2599
- $( '#create-backup' ).attr( 'disabled', 'disabled' );
2600
- $( '#create-backup-label' ).addClass( 'disabled' );
2601
- $( '.backup-option-disabled' ).show();
2602
- $( '.upload-directory-location' ).html( wpmdb_data.this_upload_dir_long );
2603
- }
2604
- } else {
2605
- $( '.connection-status' ).show();
2606
- $( '.step-two' ).hide();
2607
- }
2608
- } else if ( 'push' === wpmdb_migration_type() ) {
2609
- $( '.push-list li' ).append( $connection_info_box );
2610
- $connection_info_box.show( function() {
2611
- var connection_textarea = $( this ).find( '.pull-push-connection-info' );
2612
- if ( !connection_textarea.val() ) {
2613
- connection_textarea.focus();
2614
- }
2615
- } );
2616
- if ( connection_established ) {
2617
- $( '.connection-status' ).hide();
2618
- $( '.step-two' ).show();
2619
- $( '.table-prefix' ).html( wpmdb_data.this_prefix );
2620
- $( '.uploads-dir' ).html( wpmdb.common.connection_data.uploads_dir );
2621
- if ( false === profile_name_edited ) {
2622
- profile_name = get_domain_name( wpmdb.common.connection_data.url );
2623
- $( '.create-new-profile' ).val( profile_name );
2624
- }
2625
- if ( true === show_prefix_notice ) {
2626
- $( '.prefix-notice.push' ).show();
2627
- }
2628
- if ( true === show_ssl_notice ) {
2629
- $( '.ssl-notice' ).show();
2630
- }
2631
- if ( true === show_version_notice ) {
2632
- $( '.different-plugin-version-notice' ).show();
2633
- $( '.step-two' ).hide();
2634
- }
2635
- wpmdb_toggle_migration_action_text();
2636
- if ( '0' === wpmdb.common.connection_data.write_permissions ) {
2637
- $( '#create-backup' ).prop( 'checked', false );
2638
- $( '#create-backup' ).attr( 'disabled', 'disabled' );
2639
- $( '#create-backup-label' ).addClass( 'disabled' );
2640
- $( '.backup-option-disabled' ).show();
2641
- $( '.upload-directory-location' ).html( wpmdb.common.connection_data.upload_dir_long );
2642
- }
2643
- } else {
2644
- $( '.connection-status' ).show();
2645
- $( '.step-two' ).hide();
2646
- }
2647
- } else if ( 'savefile' === wpmdb_migration_type() ) {
2648
- $( '.connection-status' ).hide();
2649
- $( '.step-two' ).show();
2650
- $( '.table-prefix' ).html( wpmdb_data.this_prefix );
2651
- $( '.compatibility-older-mysql' ).show();
2652
- if ( false === profile_name_edited ) {
2653
- $( '.create-new-profile' ).val( '' );
2654
- }
2655
- $( '.backup-options' ).hide();
2656
- $( '.keep-active-plugins' ).hide();
2657
- if ( false === wpmdb_data.write_permission ) {
2658
- $( '.directory-permission-notice' ).show();
2659
- $( '.step-two' ).hide();
2660
- }
2661
- }
2662
- maybe_show_mixed_cased_table_name_warning();
2663
- $.wpmdb.do_action( 'move_connection_info_box', {
2664
- 'migration_type': wpmdb_migration_type(),
2665
- 'last_migration_type': last_replace_switch
2666
- } );
2667
- }
2668
-
2669
- // move around textarea depending on whether or not the push/pull options are selected
2670
- var $connection_info_box = $( '.connection-info-wrapper' );
2671
- move_connection_info_box();
2672
-
2673
- $( '.migrate-selection.option-group input[type=radio]' ).change( function() {
2674
- move_connection_info_box();
2675
- if ( connection_established ) {
2676
- change_replace_values();
2677
- }
2678
- wpmdb.functions.update_migrate_button_text();
2679
- } );
2680
-
2681
- function change_replace_values() {
2682
- var old_url = null;
2683
- var old_path = null;
2684
- if ( null !== wpmdb.common.previous_connection_data && 'object' === typeof wpmdb.common.previous_connection_data && wpmdb.common.previous_connection_data.url !== wpmdb.common.connection_data.url ) {
2685
- old_url = remove_protocol( wpmdb.common.previous_connection_data.url );
2686
- old_path = wpmdb.common.previous_connection_data.path;
2687
- }
2688
-
2689
- if ( 'push' === wpmdb_migration_type() || 'savefile' === wpmdb_migration_type() ) {
2690
- if ( 'pull' === last_replace_switch ) {
2691
- $( '.replace-row' ).each( function() {
2692
- var old_val = $( '.old-replace-col input', this ).val();
2693
- $( '.old-replace-col input', this ).val( $( '.replace-right-col input', this ).val() );
2694
- $( '.replace-right-col input', this ).val( old_val );
2695
- } );
2696
- } else if ( 'push' === last_replace_switch && 'push' === wpmdb_migration_type() && null !== old_url && null !== old_path ) {
2697
- $( '.replace-row' ).each( function() {
2698
- var old_val = $( '.replace-right-col input', this ).val();
2699
- if ( old_val === old_path ) {
2700
- $( '.replace-right-col input', this ).val( wpmdb.common.connection_data.path );
2701
- }
2702
- if ( old_val === old_url ) {
2703
- $( '.replace-right-col input', this ).val( remove_protocol( wpmdb.common.connection_data.url ) );
2704
- }
2705
- } );
2706
- }
2707
- $.wpmdb.do_action( 'wpmdb_update_push_table_select' );
2708
- $( '#select-post-types' ).remove();
2709
- $( '.exclude-post-types-warning' ).after( $push_post_type_select );
2710
- exclude_post_types_warning();
2711
- $( '#select-backup' ).remove();
2712
- $( '.backup-tables-wrap' ).prepend( $push_select_backup );
2713
- } else if ( 'pull' === wpmdb_migration_type() ) {
2714
- if ( '' === last_replace_switch || 'push' === last_replace_switch || 'savefile' === last_replace_switch ) {
2715
- $( '.replace-row' ).each( function() {
2716
- var old_val = $( '.old-replace-col input', this ).val();
2717
- $( '.old-replace-col input', this ).val( $( '.replace-right-col input', this ).val() );
2718
- $( '.replace-right-col input', this ).val( old_val );
2719
- } );
2720
- } else if ( 'pull' === last_replace_switch && 'pull' === wpmdb_migration_type() && null !== old_url && null !== old_path ) {
2721
- $( '.replace-row' ).each( function() {
2722
- var old_val = $( '.old-replace-col input', this ).val();
2723
- if ( old_val === old_path ) {
2724
- $( '.old-replace-col input', this ).val( wpmdb.common.connection_data.path );
2725
- }
2726
- if ( old_val === old_url ) {
2727
- $( '.old-replace-col input', this ).val( remove_protocol( wpmdb.common.connection_data.url ) );
2728
- }
2729
- } );
2730
- }
2731
- $.wpmdb.do_action( 'wpmdb_update_pull_table_select' );
2732
- $( '#select-post-types' ).remove();
2733
- $( '.exclude-post-types-warning' ).after( $pull_post_type_select );
2734
- exclude_post_types_warning();
2735
- $( '#select-backup' ).remove();
2736
- $( '.backup-tables-wrap' ).prepend( $pull_select_backup );
2737
- }
2738
- last_replace_switch = wpmdb_migration_type();
2739
- }
2740
-
2741
- // hide second section if pull or push is selected with no connection established
2742
- if ( ( 'pull' === wpmdb_migration_type() || 'push' === wpmdb_migration_type() ) && !connection_established ) {
2743
- $( '.step-two' ).hide();
2744
- $( '.connection-status' ).show();
2745
- }
2746
-
2747
- // show / hide GUID helper description
2748
- $( '.general-helper' ).click( function( e ) {
2749
- e.preventDefault();
2750
- var icon = $( this ),
2751
- bubble = $( this ).next();
2752
-
2753
- // Close any that are already open
2754
- $( '.helper-message' ).not( bubble ).hide();
2755
-
2756
- var position = icon.position();
2757
- if ( bubble.hasClass( 'bottom' ) ) {
2758
- bubble.css( {
2759
- 'left': ( position.left - bubble.width() / 2 ) + 'px',
2760
- 'top': ( position.top + icon.height() + 9 ) + 'px'
2761
- } );
2762
- } else {
2763
- bubble.css( {
2764
- 'left': ( position.left + icon.width() + 9 ) + 'px',
2765
- 'top': ( position.top + icon.height() / 2 - 18 ) + 'px'
2766
- } );
2767
- }
2768
-
2769
- bubble.toggle();
2770
- e.stopPropagation();
2771
- } );
2772
-
2773
- $( 'body' ).click( function() {
2774
- $( '.helper-message' ).hide();
2775
- } );
2776
-
2777
- $( '.helper-message' ).click( function( e ) {
2778
- e.stopPropagation();
2779
- } );
2780
-
2781
- $( 'body' ).on( 'click', '.show-errors-toggle', function( e ) {
2782
- e.preventDefault();
2783
- $( this ).next( '.migration-php-errors' ).toggle();
2784
- } );
2785
-
2786
- /**
2787
- * Core plugin wrapper for the common AJAX error detecting method
2788
- *
2789
- * @param text
2790
- * @param code
2791
- * @param jqXHR
2792
- *
2793
- * @returns {string}
2794
- */
2795
- function get_ajax_errors( text, code, jqXHR ) {
2796
- return wpmdbGetAjaxErrors( wpmdb_strings.connection_local_server_problem, code, text, jqXHR );
2797
- }
2798
-
2799
- // migrate / settings tabs
2800
- $( '.nav-tab' ).click( function() {
2801
- var hash = $( this ).attr( 'data-div-name' );
2802
- hash = hash.replace( '-tab', '' );
2803
- window.location.hash = hash;
2804
- switch_to_plugin_tab( hash, false );
2805
- } );
2806
-
2807
- $( 'body' ).on( 'click', 'a[href^="#"]', function( event ) {
2808
- var href = $( event.target ).attr( 'href' );
2809
- var tab_name = href.substr( 1 );
2810
-
2811
- if ( tab_name ) {
2812
- var nav_tab = $( '.' + tab_name );
2813
- if ( 1 === nav_tab.length ) {
2814
- nav_tab.trigger( 'click' );
2815
- event.preventDefault();
2816
- }
2817
- }
2818
- } );
2819
-
2820
- // repeatable fields
2821
- $( 'body' ).on( 'click', '.add-row', function() {
2822
- var $parent_tr = $( this ).parents( 'tr' );
2823
- $parent_tr.before( $( '.original-repeatable-field' ).clone().removeClass( 'original-repeatable-field' ) );
2824
- $parent_tr.prev().find( '.old-replace-col input' ).focus();
2825
- } );
2826
-
2827
- // repeatable fields
2828
- $( 'body' ).on( 'click', '.replace-remove-row', function() {
2829
- $( this ).parents( 'tr' ).remove();
2830
- if ( 2 >= $( '.replace-row' ).length ) {
2831
- $( '.no-replaces-message' ).show();
2832
- }
2833
-
2834
- var prev_id = $( this ).prev().attr( 'id' );
2835
- if ( 'new-url' === prev_id || 'new-path' === prev_id ) {
2836
- $( '#' + prev_id + '-missing-warning' ).hide();
2837
- }
2838
- } );
2839
-
2840
- // Hide New URL & New Path Warnings on change.
2841
- $( 'body' )
2842
- .on( 'change', '#new-url', function() {
2843
- $( '#new-url-missing-warning' ).hide();
2844
- } )
2845
- .on( 'change', '#new-path', function() {
2846
- $( '#new-path-missing-warning' ).hide();
2847
- } );
2848
-
2849
- // Copy Find field to associated Replace field on arrow click.
2850
- $( 'body' ).on( 'click', '.arrow-col', function() {
2851
- var replace_row_arrow = this;
2852
-
2853
- if ( $( replace_row_arrow ).hasClass( 'disabled' ) ) {
2854
- return;
2855
- }
2856
-
2857
- var original_value = $( replace_row_arrow ).prev( 'td' ).find( 'input' ).val();
2858
- var new_value_input = $( replace_row_arrow ).next( 'td' ).find( 'input' );
2859
- new_value_input.val( original_value );
2860
-
2861
- // Hide New URL or New Path Warning if changed.
2862
- if ( 'new-url' === new_value_input.prop( 'id' ) ) {
2863
- $( '#new-url-missing-warning' ).hide();
2864
- } else if ( 'new-path' === new_value_input.prop( 'id' ) ) {
2865
- $( '#new-path-missing-warning' ).hide();
2866
- }
2867
- } );
2868
-
2869
- $( '.add-replace' ).click( function() {
2870
- $( '.replace-fields' ).prepend( $( '.original-repeatable-field' ).clone().removeClass( 'original-repeatable-field' ) );
2871
- $( '.no-replaces-message' ).hide();
2872
- } );
2873
-
2874
- $( '#find-and-replace-sort tbody' ).sortable( {
2875
- items: '> tr:not(.pin)',
2876
- handle: 'td:first',
2877
- start: function() {
2878
- $( '.sort-handle' ).css( 'cursor', '-webkit-grabbing' );
2879
- $( '.sort-handle' ).css( 'cursor', '-moz-grabbing' );
2880
- },
2881
- stop: function() {
2882
- $( '.sort-handle' ).css( 'cursor', '-webkit-grab' );
2883
- $( '.sort-handle' ).css( 'cursor', '-moz-grab' );
2884
- }
2885
- } );
2886
-
2887
- function validate_url( url ) {
2888
- return /^([a-z]([a-z]|\d|\+|-|\.)*):(\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?((\[(|(v[\da-f]{1,}\.(([a-z]|\d|-|\.|_|~)|[!\$&'\(\)\*\+,;=]|:)+))\])|((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=])*)(:\d*)?)(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*|(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)|((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)|((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)){0})(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i.test( url );
2889
- }
2890
-
2891
- function switch_to_plugin_tab( hash, skip_addons_check ) {
2892
- $( '.nav-tab' ).removeClass( 'nav-tab-active' );
2893
- $( '.nav-tab.' + hash ).addClass( 'nav-tab-active' );
2894
- $( '.content-tab' ).hide();
2895
- $( '.' + hash + '-tab' ).show();
2896
-
2897
- if ( 'settings' === hash ) {
2898
- if ( true === should_check_licence() ) {
2899
- $( 'p.licence-status' ).append( 'Checking License... ' ).append( ajax_spinner );
2900
- check_licence();
2901
- }
2902
- }
2903
-
2904
- if ( 'help' === hash ) {
2905
- refresh_debug_log();
2906
- if ( true === should_check_licence() ) {
2907
- $( '.support-content p' ).append( ajax_spinner );
2908
- check_licence();
2909
- }
2910
- }
2911
-
2912
- if ( 'addons' === hash && true !== skip_addons_check ) {
2913
- if ( true === should_check_licence() ) {
2914
- $( '.addons-content p' ).append( ajax_spinner );
2915
- check_licence();
2916
- }
2917
- }
2918
- }
2919
-
2920
- function should_check_licence() {
2921
- if ( false === checked_licence && '1' === wpmdb_data.has_licence && 'true' === wpmdb_data.is_pro ) {
2922
- return true;
2923
- }
2924
- return false;
2925
- }
2926
-
2927
- var hash = '';
2928
-
2929
- // check for hash in url (settings || migrate) switch tabs accordingly
2930
- if ( window.location.hash ) {
2931
- hash = window.location.hash.substring( 1 );
2932
- switch_to_plugin_tab( hash, false );
2933
- }
2934
-
2935
- if ( '' !== get_query_var( 'install-plugin' ) ) {
2936
- hash = 'addons';
2937
- checked_licence = true;
2938
- switch_to_plugin_tab( hash, true );
2939
- }
2940
-
2941
- // process notice links clicks, eg. dismiss, reminder
2942
- $( '.notice-link' ).click( function( e ) {
2943
- e.preventDefault();
2944
- $( this ).closest( '.inline-message' ).hide();
2945
- $.ajax( {
2946
- url: ajaxurl,
2947
- type: 'POST',
2948
- dataType: 'text',
2949
- cache: false,
2950
- data: {
2951
- action: 'wpmdb_process_notice_link',
2952
- nonce: wpmdb_data.nonces.process_notice_link,
2953
- notice: $( this ).data( 'notice' ),
2954
- type: $( this ).data( 'type' ),
2955
- reminder: $( this ).data( 'reminder' )
2956
- }
2957
- } );
2958
- } );
2959
-
2960
- // regenerates the saved secret key
2961
- $( '.reset-api-key' ).click( function() {
2962
- var answer = confirm( wpmdb_strings.reset_api_key );
2963
-
2964
- if ( !answer || doing_reset_api_key_ajax ) {
2965
- return;
2966
- }
2967
-
2968
- doing_reset_api_key_ajax = true;
2969
- $( '.reset-api-key' ).after( '<img src="' + spinner_url + '" alt="" class="reset-api-key-ajax-spinner general-spinner" />' );
2970
-
2971
- $.ajax( {
2972
- url: ajaxurl,
2973
- type: 'POST',
2974
- dataType: 'text',
2975
- cache: false,
2976
- data: {
2977
- action: 'wpmdb_reset_api_key',
2978
- nonce: wpmdb_data.nonces.reset_api_key
2979
- },
2980
- error: function( jqXHR, textStatus, errorThrown ) {
2981
- alert( wpmdb_strings.reset_api_key_problem );
2982
- $( '.reset-api-key-ajax-spinner' ).remove();
2983
- doing_reset_api_key_ajax = false;
2984
- },
2985
- success: function( data ) {
2986
- $( '.reset-api-key-ajax-spinner' ).remove();
2987
- doing_reset_api_key_ajax = false;
2988
- $( '.connection-info' ).html( data );
2989
- wpmdb_data.connection_info = $.trim( data ).split( '\n' );
2990
- }
2991
- } );
2992
-
2993
- } );
2994
-
2995
- // show / hide table select box when specific settings change
2996
- $( 'input.multiselect-toggle' ).change( function() {
2997
- $( this ).parents( '.expandable-content' ).children( '.select-wrap' ).toggle();
2998
- } );
2999
-
3000
- $( '.show-multiselect' ).each( function() {
3001
- if ( $( this ).is( ':checked' ) ) {
3002
- $( this ).parents( '.option-section' ).children( '.header-expand-collapse' ).children( '.expand-collapse-arrow' ).removeClass( 'collapsed' );
3003
- $( this ).parents( '.expandable-content' ).show();
3004
- $( this ).parents( '.expandable-content' ).children( '.select-wrap' ).toggle();
3005
- }
3006
- } );
3007
-
3008
- $( 'input[name=backup_option]' ).change( function() {
3009
- $( '.backup-tables-wrap' ).hide();
3010
- if ( 'backup_manual_select' === $( this ).val() ) {
3011
- $( '.backup-tables-wrap' ).show();
3012
- }
3013
- } );
3014
-
3015
- if ( $( '#backup-manual-select' ).is( ':checked' ) ) {
3016
- $( '.backup-tables-wrap' ).show();
3017
- }
3018
-
3019
- $( '.plugin-compatibility-save' ).click( function() {
3020
- if ( doing_plugin_compatibility_ajax ) {
3021
- return;
3022
- }
3023
- $( this ).addClass( 'disabled' );
3024
- var select_element = $( '#selected-plugins' );
3025
- $( select_element ).attr( 'disabled', 'disabled' );
3026
-
3027
- $( '.plugin-compatibility-success-msg' ).remove();
3028
-
3029
- doing_plugin_compatibility_ajax = true;
3030
- $( this ).after( '<img src="' + spinner_url + '" alt="" class="plugin-compatibility-spinner general-spinner" />' );
3031
-
3032
- $.ajax( {
3033
- url: ajaxurl,
3034
- type: 'POST',
3035
- dataType: 'text',
3036
- cache: false,
3037
- data: {
3038
- action: 'wpmdb_blacklist_plugins',
3039
- blacklist_plugins: $( select_element ).val()
3040
- },
3041
- error: function( jqXHR, textStatus, errorThrown ) {
3042
- alert( wpmdb_strings.blacklist_problem + '\r\n\r\n' + wpmdb_strings.status + ' ' + jqXHR.status + ' ' + jqXHR.statusText + '\r\n\r\n' + wpmdb_strings.response + '\r\n' + jqXHR.responseText );
3043
- $( select_element ).removeAttr( 'disabled' );
3044
- $( '.plugin-compatibility-save' ).removeClass( 'disabled' );
3045
- doing_plugin_compatibility_ajax = false;
3046
- $( '.plugin-compatibility-spinner' ).remove();
3047
- },
3048
- success: function( data ) {
3049
- if ( '' !== $.trim( data ) ) {
3050
- alert( data );
3051
- }
3052
- $( select_element ).removeAttr( 'disabled' );
3053
- $( '.plugin-compatibility-save' ).removeClass( 'disabled' );
3054
- doing_plugin_compatibility_ajax = false;
3055
- $( '.plugin-compatibility-spinner' ).remove();
3056
- $( '.plugin-compatibility-save' ).after( '<span class="plugin-compatibility-success-msg">' + wpmdb_strings.saved + '</span>' );
3057
- $( '.plugin-compatibility-success-msg' ).fadeOut( 2000 );
3058
- }
3059
- } );
3060
- } );
3061
-
3062
- // delete a profile from the migrate form area
3063
- $( 'body' ).on( 'click', '.delete-profile', function() {
3064
- var name = $( this ).next().clone();
3065
- $( 'input', name ).remove();
3066
- name = $.trim( $( name ).html() );
3067
- var answer = confirm( wpmdb_strings.remove_profile.replace( '{{profile}}', name ) );
3068
-
3069
- if ( !answer ) {
3070
- return;
3071
- }
3072
- var $profile_li = $( this ).parent();
3073
-
3074
- if ( $profile_li.find( 'input:checked' ).length ) {
3075
- var $new_profile_li = $profile_li.siblings().last();
3076
- $new_profile_li.find( 'input[type=radio]' ).prop( 'checked', 'checked' );
3077
- $new_profile_li.find( 'input[type=text]' ).focus();
3078
- $( '#migrate-form .crumbs .crumb:last' ).text( 'New Profile' );
3079
-
3080
- if ( 'function' === typeof window.history.pushState ) {
3081
- var updated_url = window.location.href.replace( '#migrate', '' ).replace( /&wpmdb-profile=-?\d+/, '' ) + '&wpmdb-profile=-1';
3082
- window.history.pushState( { updated_profile_id: -1 }, null, updated_url );
3083
- }
3084
- }
3085
-
3086
- $profile_li.fadeOut( 500 );
3087
-
3088
- $.ajax( {
3089
- url: ajaxurl,
3090
- type: 'POST',
3091
- dataType: 'text',
3092
- cache: false,
3093
- data: {
3094
- action: 'wpmdb_delete_migration_profile',
3095
- profile_id: $( this ).attr( 'data-profile-id' ),
3096
- nonce: wpmdb_data.nonces.delete_migration_profile
3097
- },
3098
- error: function( jqXHR, textStatus, errorThrown ) {
3099
- alert( wpmdb_strings.remove_profile_problem );
3100
- },
3101
- success: function( data ) {
3102
- if ( '-1' === data ) {
3103
- alert( wpmdb_strings.remove_profile_not_found );
3104
- }
3105
- }
3106
- } );
3107
-
3108
- } );
3109
-
3110
- // deletes a profile from the main profile selection screen
3111
- $( '.main-list-delete-profile-link' ).click( function() {
3112
- var name = $( this ).prev().html();
3113
- var answer = confirm( wpmdb_strings.remove_profile.replace( '{{profile}}', name ) );
3114
-
3115
- if ( !answer ) {
3116
- return;
3117
- }
3118
-
3119
- $( this ).parent().fadeOut( 500 );
3120
-
3121
- $.ajax( {
3122
- url: ajaxurl,
3123
- type: 'POST',
3124
- dataType: 'text',
3125
- cache: false,
3126
- data: {
3127
- action: 'wpmdb_delete_migration_profile',
3128
- profile_id: $( this ).attr( 'data-profile-id' ),
3129
- nonce: wpmdb_data.nonces.delete_migration_profile
3130
- },
3131
- error: function( jqXHR, textStatus, errorThrown ) {
3132
- alert( wpmdb_strings.remove_profile_problem );
3133
- }
3134
- } );
3135
-
3136
- } );
3137
-
3138
- // warn the user when editing the connection info after a connection has been established
3139
- $( 'body' ).on( 'click', '.temp-disabled', function() {
3140
- var answer = confirm( wpmdb_strings.change_connection_info );
3141
-
3142
- if ( !answer ) {
3143
- return;
3144
- } else {
3145
- $( '.ssl-notice' ).hide();
3146
- $( '.different-plugin-version-notice' ).hide();
3147
- $( '.migrate-db-button' ).show();
3148
- $( '.temp-disabled' ).removeAttr( 'readonly' );
3149
- $( '.temp-disabled' ).removeClass( 'temp-disabled' );
3150
- $( '.connect-button' ).show();
3151
- $( '.step-two' ).hide();
3152
- $( '.connection-status' ).show().html( wpmdb_strings.enter_connection_info );
3153
- connection_established = false;
3154
- }
3155
- } );
3156
-
3157
- // ajax request for settings page when checking/unchecking setting radio buttons
3158
- $( '.settings-tab input[type=checkbox]' ).change( function() {
3159
- if ( 'plugin-compatibility' === $( this ).attr( 'id' ) ) {
3160
- return;
3161
- }
3162
- var checked = $( this ).is( ':checked' );
3163
- var setting = $( this ).attr( 'id' );
3164
- var $status = $( this ).closest( 'td' ).next( 'td' ).find( '.setting-status' );
3165
-
3166
- $( '.ajax-success-msg' ).remove();
3167
- $status.after( ajax_spinner );
3168
-
3169
- $.ajax( {
3170
- url: ajaxurl,
3171
- type: 'POST',
3172
- dataType: 'text',
3173
- cache: false,
3174
- data: {
3175
- action: 'wpmdb_save_setting',
3176
- checked: checked,
3177
- setting: setting,
3178
- nonce: wpmdb_data.nonces.save_setting
3179
- },
3180
- error: function( jqXHR, textStatus, errorThrown ) {
3181
- alert( wpmdb_strings.save_settings_problem );
3182
- $( '.ajax-spinner' ).remove();
3183
- },
3184
- success: function( data ) {
3185
- $( '.ajax-spinner' ).remove();
3186
- $status.append( '<span class="ajax-success-msg">' + wpmdb_strings.saved + '</span>' );
3187
- $( '.ajax-success-msg' ).fadeOut( 2000, function() {
3188
- $( this ).remove();
3189
- } );
3190
- }
3191
- } );
3192
-
3193
- } );
3194
-
3195
- // disable form submissions
3196
- $( '.migrate-form' ).submit( function( e ) {
3197
- e.preventDefault();
3198
- } );
3199
-
3200
- // fire connection_box_changed when the connect button is pressed
3201
- $( '.connect-button' ).click( function( event ) {
3202
- event.preventDefault();
3203
- $( this ).blur();
3204
- connection_box_changed();
3205
- } );
3206
-
3207
- // send paste even to connection_box_changed() function
3208
- $( '.pull-push-connection-info' ).bind( 'paste', function( e ) {
3209
- var $this = this;
3210
- setTimeout( function() {
3211
- connection_box_changed();
3212
- }, 0 );
3213
-
3214
- } );
3215
-
3216
- $( 'body' ).on( 'click', '.try-again', function() {
3217
- connection_box_changed();
3218
- } );
3219
-
3220
- $( 'body' ).on( 'click', '.try-http', function() {
3221
- var connection_info = $.trim( $( '.pull-push-connection-info' ).val() ).split( '\n' );
3222
- var new_url = connection_info[ 0 ].replace( 'https', 'http' );
3223
- var new_contents = new_url + '\n' + connection_info[ 1 ];
3224
- $( '.pull-push-connection-info' ).val( new_contents );
3225
- connection_box_changed();
3226
- } );
3227
-
3228
- $( '.create-new-profile' ).change( function() {
3229
- profile_name_edited = true;
3230
- } );
3231
-
3232
- $( 'body' ).on( 'click', '.temporarily-disable-ssl', function() {
3233
- var hash = '';
3234
- if ( window.location.hash ) {
3235
- hash = window.location.hash.substring( 1 );
3236
- }
3237
- $( this ).attr( 'href', $( this ).attr( 'href' ) + '&hash=' + hash );
3238
- } );
3239
-
3240
- // fired when the connection info box changes (e.g. gets pasted into)
3241
- function connection_box_changed( data ) {
3242
- var $this = $( '.pull-push-connection-info' );
3243
-
3244
- if ( doing_ajax || $( $this ).hasClass( 'temp-disabled' ) ) {
3245
- return;
3246
- }
3247
-
3248
- data = $( '.pull-push-connection-info' ).val();
3249
-
3250
- var connection_info = $.trim( data ).split( '\n' );
3251
- var error = false;
3252
- var error_message = '';
3253
-
3254
- if ( '' === connection_info ) {
3255
- error = true;
3256
- error_message = wpmdb_strings.connection_info_missing;
3257
- }
3258
-
3259
- if ( 2 !== connection_info.length && !error ) {
3260
- error = true;
3261
- error_message = wpmdb_strings.connection_info_incorrect;
3262
- }
3263
-
3264
- if ( !error && !validate_url( connection_info[ 0 ] ) ) {
3265
- error = true;
3266
- error_message = wpmdb_strings.connection_info_url_invalid;
3267
- }
3268
-
3269
- if ( !error && 32 >= connection_info[ 1 ].length ) {
3270
- error = true;
3271
- error_message = wpmdb_strings.connection_info_key_invalid;
3272
- }
3273
-
3274
- if ( !error && connection_info[ 0 ] === wpmdb_data.connection_info[ 0 ] ) {
3275
- error = true;
3276
- error_message = wpmdb_strings.connection_info_local_url;
3277
- }
3278
-
3279
- if ( !error && connection_info[ 1 ] === wpmdb_data.connection_info[ 1 ] ) {
3280
- error = true;
3281
- error_message = wpmdb_strings.connection_info_local_key;
3282
- }
3283
-
3284
- if ( error ) {
3285
- $( '.connection-status' ).html( error_message );
3286
- $( '.connection-status' ).addClass( 'notification-message error-notice migration-error' );
3287
- return;
3288
- }
3289
-
3290
- var new_connection_info_contents = connection_info[ 0 ] + '\n' + connection_info[ 1 ];
3291
-
3292
- if ( false === wpmdb_data.openssl_available ) {
3293
- connection_info[ 0 ] = connection_info[ 0 ].replace( 'https://', 'http://' );
3294
- new_connection_info_contents = connection_info[ 0 ] + '\n' + connection_info[ 1 ];
3295
- $( '.pull-push-connection-info' ).val( new_connection_info_contents );
3296
- }
3297
-
3298
- show_prefix_notice = false;
3299
- doing_ajax = true;
3300
- disable_export_type_controls();
3301
-
3302
- if ( $( '.basic-access-auth-wrapper' ).is( ':visible' ) ) {
3303
- connection_info[ 0 ] = connection_info[ 0 ].replace( /\/\/(.*)@/, '//' );
3304
- connection_info[ 0 ] = connection_info[ 0 ].replace( '//', '//' + encodeURIComponent( $.trim( $( '.auth-username' ).val() ) ) + ':' + encodeURIComponent( $.trim( $( '.auth-password' ).val() ) ) + '@' );
3305
- new_connection_info_contents = connection_info[ 0 ] + '\n' + connection_info[ 1 ];
3306
- $( '.pull-push-connection-info' ).val( new_connection_info_contents );
3307
- $( '.basic-access-auth-wrapper' ).hide();
3308
- }
3309
-
3310
- $( '.step-two' ).hide();
3311
- $( '.ssl-notice' ).hide();
3312
- $( '.prefix-notice' ).hide();
3313
- $( '.connection-status' ).show();
3314
-
3315
- $( '.connection-status' ).html( wpmdb_strings.establishing_remote_connection );
3316
- $( '.connection-status' ).removeClass( 'notification-message error-notice migration-error' );
3317
- $( '.connection-status' ).append( ajax_spinner );
3318
-
3319
- var intent = wpmdb_migration_type();
3320
-
3321
- profile_name_edited = false;
3322
-
3323
- $.ajax( {
3324
- url: ajaxurl,
3325
- type: 'POST',
3326
- dataType: 'json',
3327
- cache: false,
3328
- data: {
3329
- action: 'wpmdb_verify_connection_to_remote_site',
3330
- url: connection_info[ 0 ],
3331
- key: connection_info[ 1 ],
3332
- intent: intent,
3333
- nonce: wpmdb_data.nonces.verify_connection_to_remote_site
3334
- },
3335
- error: function( jqXHR, textStatus, errorThrown ) {
3336
- $( '.connection-status' ).html( get_ajax_errors( jqXHR.responseText, '(#100)', jqXHR ) );
3337
- $( '.connection-status' ).addClass( 'notification-message error-notice migration-error' );
3338
- $( '.ajax-spinner' ).remove();
3339
- doing_ajax = false;
3340
- enable_export_type_controls();
3341
- },
3342
- success: function( data ) {
3343
- $( '.ajax-spinner' ).remove();
3344
- doing_ajax = false;
3345
- enable_export_type_controls();
3346
- maybe_show_ssl_warning( connection_info[ 0 ], connection_info[ 1 ], data.scheme );
3347
-
3348
- if ( 'undefined' !== typeof data.wpmdb_error && 1 === data.wpmdb_error ) {
3349
- $( '.connection-status' ).html( data.body );
3350
- $( '.connection-status' ).addClass( 'notification-message error-notice migration-error' );
3351
-
3352
- if ( data.body.indexOf( '401 Unauthorized' ) > -1 ) {
3353
- $( '.basic-access-auth-wrapper' ).show();
3354
- }
3355
-
3356
- return;
3357
- }
3358
-
3359
- var profile_name = get_domain_name( data.url );
3360
- $( '.create-new-profile' ).val( profile_name );
3361
-
3362
- $( '.pull-push-connection-info' ).addClass( 'temp-disabled' );
3363
- $( '.pull-push-connection-info' ).attr( 'readonly', 'readonly' );
3364
- $( '.connect-button' ).hide();
3365
-
3366
- $( '.connection-status' ).hide();
3367
- $( '.step-two' ).show();
3368
-
3369
- maybe_show_prefix_notice( data.prefix );
3370
-
3371
- connection_established = true;
3372
- set_connection_data( data );
3373
- move_connection_info_box();
3374
- change_replace_values();
3375
-
3376
- maybe_show_mixed_cased_table_name_warning();
3377
-
3378
- refresh_table_selects();
3379
-
3380
- $push_select_backup = $( $pull_select ).clone();
3381
- $( $push_select_backup ).attr( {
3382
- name: 'select_backup[]',
3383
- id: 'select-backup'
3384
- } );
3385
-
3386
- var $post_type_select = document.createElement( 'select' );
3387
- $( $post_type_select ).attr( {
3388
- multiple: 'multiple',
3389
- name: 'select_post_types[]',
3390
- id: 'select-post-types',
3391
- class: 'multiselect'
3392
- } );
3393
-
3394
- $.each( wpmdb.common.connection_data.post_types, function( index, value ) {
3395
- $( $post_type_select ).append( '<option value="' + value + '">' + value + '</option>' );
3396
- } );
3397
-
3398
- $pull_post_type_select = $post_type_select;
3399
-
3400
- $( '#new-path-missing-warning, #new-url-missing-warning' ).hide();
3401
-
3402
- if ( 'pull' === wpmdb_migration_type() ) {
3403
- $( '#new-url' ).val( remove_protocol( wpmdb_data.this_url ) );
3404
- $( '#new-path' ).val( wpmdb_data.this_path );
3405
- if ( 'true' === wpmdb_data.is_multisite ) {
3406
- $( '#new-domain' ).val( wpmdb_data.this_domain );
3407
- $( '.replace-row.pin .old-replace-col input[type="text"]' ).val( remove_protocol( data.url ) );
3408
- }
3409
- $( '#old-url' ).val( remove_protocol( data.url ) );
3410
- $( '#old-path' ).val( data.path );
3411
- $.wpmdb.do_action( 'wpmdb_update_pull_table_select' );
3412
- $( '#select-post-types' ).remove();
3413
- $( '.exclude-post-types-warning' ).after( $pull_post_type_select );
3414
- exclude_post_types_warning();
3415
- $( '.table-prefix' ).html( data.prefix );
3416
- $( '.uploads-dir' ).html( wpmdb_data.this_uploads_dir );
3417
- } else {
3418
- $( '#new-url' ).val( remove_protocol( data.url ) );
3419
- $( '#new-path' ).val( data.path );
3420
- if ( 'true' === wpmdb_data.is_multisite ) {
3421
- $( '.replace-row.pin .old-replace-col input[type="text"]' ).val( remove_protocol( wpmdb_data.this_url ) );
3422
- }
3423
- $.wpmdb.do_action( 'wpmdb_update_push_table_select' );
3424
- $( '#select-backup' ).remove();
3425
- $( '.backup-tables-wrap' ).prepend( $push_select_backup );
3426
- }
3427
-
3428
- wpmdb.common.next_step_in_migration = {
3429
- fn: $.wpmdb.do_action,
3430
- args: [ 'verify_connection_to_remote_site', wpmdb.common.connection_data ]
3431
- };
3432
- wpmdb.functions.execute_next_step();
3433
- }
3434
-
3435
- } );
3436
-
3437
- }
3438
-
3439
- // Sets the initial Pause/Resume button event to Pause
3440
- $( 'body' ).on( 'click', '.pause-resume', function( event ) {
3441
- set_pause_resume_button( event );
3442
- } );
3443
-
3444
- function cancel_migration( event ) {
3445
- migration_cancelled = true;
3446
- $( '.migration-controls' ).css( { visibility: 'hidden' } );
3447
-
3448
- wpmdb.current_migration.setState( wpmdb_strings.cancelling_migration, wpmdb_strings.completing_current_request, 'cancelling' );
3449
-
3450
- if ( true === migration_paused ) {
3451
- migration_paused = false;
3452
- wpmdb.functions.execute_next_step();
3453
- }
3454
- }
3455
-
3456
- $( 'body' ).on( 'click', '.cancel', function( event ) {
3457
- cancel_migration( event );
3458
- } );
3459
-
3460
- $( '.enter-licence' ).click( function() {
3461
- $( '.settings' ).click();
3462
- $( '.licence-input' ).focus();
3463
- } );
3464
-
3465
- wpmdb.functions.execute_next_step = function() {
3466
-
3467
- // if delay is set, set a timeout for delay to recall this function, then return
3468
- if ( 0 < delay_between_requests && false === flag_skip_delay ) {
3469
- setTimeout( function() {
3470
- flag_skip_delay = true;
3471
- wpmdb.functions.execute_next_step();
3472
- }, delay_between_requests );
3473
- return;
3474
- } else {
3475
- flag_skip_delay = false;
3476
- }
3477
-
3478
- if ( true === migration_paused ) {
3479
- $( '.migration-progress-ajax-spinner' ).hide();
3480
-
3481
- // Pause the timer
3482
- wpmdb.current_migration.pauseTimer();
3483
-
3484
- var pause_text = '';
3485
- if ( true === is_auto_pause_before_finalize ) {
3486
- pause_text = wpmdb_strings.paused_before_finalize;
3487
- is_auto_pause_before_finalize = false;
3488
- } else {
3489
- pause_text = wpmdb_strings.paused;
3490
- }
3491
-
3492
- wpmdb.current_migration.setState( null, pause_text, 'paused' );
3493
-
3494
- // Re-bind Pause/Resume button to Resume when we are finally Paused
3495
- $( 'body' ).on( 'click', '.pause-resume', function( event ) {
3496
- set_pause_resume_button( event );
3497
- } );
3498
- $( 'body' ).on( 'click', '.cancel', function( event ) {
3499
- cancel_migration( event );
3500
- } );
3501
- $( '.pause-resume' ).html( wpmdb_strings.resume );
3502
- return;
3503
- } else if ( true === migration_cancelled ) {
3504
- migration_intent = wpmdb_migration_type();
3505
-
3506
- var progress_msg;
3507
-
3508
- if ( 'savefile' === migration_intent ) {
3509
- progress_msg = wpmdb_strings.removing_local_sql;
3510
- } else if ( 'pull' === migration_intent ) {
3511
- if ( 'backup' === stage ) {
3512
- progress_msg = wpmdb_strings.removing_local_backup;
3513
- } else {
3514
- progress_msg = wpmdb_strings.removing_local_temp_tables;
3515
- }
3516
- } else if ( 'push' === migration_intent ) {
3517
- if ( 'backup' === stage ) {
3518
- progress_msg = wpmdb_strings.removing_remote_sql;
3519
- } else {
3520
- progress_msg = wpmdb_strings.removing_remote_temp_tables;
3521
- }
3522
- }
3523
- wpmdb.current_migration.setText( progress_msg );
3524
-
3525
- var request_data = {
3526
- action: 'wpmdb_cancel_migration',
3527
- migration_state_id: wpmdb.migration_state_id
3528
- };
3529
-
3530
- doing_ajax = true;
3531
-
3532
- $.ajax( {
3533
- url: ajaxurl,
3534
- type: 'POST',
3535
- dataType: 'text',
3536
- cache: false,
3537
- data: request_data,
3538
- error: function( jqXHR, textStatus, errorThrown ) {
3539
- wpmdb.current_migration.setState( wpmdb_strings.migration_cancellation_failed, wpmdb_strings.manually_remove_temp_files + '<br /><br />' + wpmdb_strings.status + ': ' + jqXHR.status + ' ' + jqXHR.statusText + '<br /><br />' + wpmdb_strings.response + ':<br />' + jqXHR.responseText, 'error' );
3540
- console.log( jqXHR );
3541
- console.log( textStatus );
3542
- console.log( errorThrown );
3543
- doing_ajax = false;
3544
- wpmdb.common.migration_error = true;
3545
- wpmdb.functions.migration_complete_events();
3546
- return;
3547
- },
3548
- success: function( data ) {
3549
- doing_ajax = false;
3550
- data = $.trim( data );
3551
- if ( ( 'push' === migration_intent && '1' !== data ) || ( 'push' !== migration_intent && '' !== data ) ) {
3552
- wpmdb.current_migration.setState( wpmdb_strings.migration_cancellation_failed, data, 'error' );
3553
- wpmdb.common.migration_error = true;
3554
- wpmdb.functions.migration_complete_events();
3555
- return;
3556
- }
3557
- completed_msg = wpmdb_strings.migration_cancelled;
3558
- wpmdb.functions.migration_complete_events();
3559
- wpmdb.current_migration.setStatus( 'cancelled' );
3560
- }
3561
- } );
3562
- } else {
3563
- wpmdb.common.next_step_in_migration.fn.apply( null, wpmdb.common.next_step_in_migration.args );
3564
- }
3565
- };
3566
-
3567
- $( 'body' ).on( 'click', '.copy-licence-to-remote-site', function() {
3568
- $( '.connection-status' ).html( wpmdb_strings.copying_license );
3569
- $( '.connection-status' ).removeClass( 'notification-message error-notice migration-error' );
3570
- $( '.connection-status' ).append( ajax_spinner );
3571
-
3572
- var connection_info = $.trim( $( '.pull-push-connection-info' ).val() ).split( '\n' );
3573
-
3574
- doing_ajax = true;
3575
- disable_export_type_controls();
3576
-
3577
- $.ajax( {
3578
- url: ajaxurl,
3579
- type: 'POST',
3580
- dataType: 'json',
3581
- cache: false,
3582
- data: {
3583
- action: 'wpmdb_copy_licence_to_remote_site',
3584
- url: connection_info[ 0 ],
3585
- key: connection_info[ 1 ],
3586
- nonce: wpmdb_data.nonces.copy_licence_to_remote_site
3587
- },
3588
- error: function( jqXHR, textStatus, errorThrown ) {
3589
- $( '.connection-status' ).html( get_ajax_errors( jqXHR.responseText, '(#143)', jqXHR ) );
3590
- $( '.connection-status' ).addClass( 'notification-message error-notice migration-error' );
3591
- $( '.ajax-spinner' ).remove();
3592
- doing_ajax = false;
3593
- enable_export_type_controls();
3594
- },
3595
- success: function( data ) {
3596
- $( '.ajax-spinner' ).remove();
3597
- doing_ajax = false;
3598
- enable_export_type_controls();
3599
-
3600
- if ( 'undefined' !== typeof data.wpmdb_error && 1 === data.wpmdb_error ) {
3601
- $( '.connection-status' ).html( data.body );
3602
- $( '.connection-status' ).addClass( 'notification-message error-notice migration-error' );
3603
-
3604
- if ( data.body.indexOf( '401 Unauthorized' ) > -1 ) {
3605
- $( '.basic-access-auth-wrapper' ).show();
3606
- }
3607
-
3608
- return;
3609
- }
3610
- connection_box_changed();
3611
- }
3612
- } );
3613
- } );
3614
-
3615
- $( 'body' ).on( 'click', '.reactivate-licence', function( e ) {
3616
- doing_ajax = true;
3617
-
3618
- $( '.invalid-licence' ).empty().html( wpmdb_strings.attempting_to_activate_licence );
3619
- $( '.invalid-licence' ).append( ajax_spinner );
3620
-
3621
- $.ajax( {
3622
- url: ajaxurl,
3623
- type: 'POST',
3624
- dataType: 'json',
3625
- cache: false,
3626
- data: {
3627
- action: 'wpmdb_reactivate_licence',
3628
- nonce: wpmdb_data.nonces.reactivate_licence
3629
- },
3630
- error: function( jqXHR, textStatus, errorThrown ) {
3631
- $( '.invalid-licence' ).html( wpmdb_strings.activate_licence_problem );
3632
- $( '.invalid-licence' ).append( '<br /><br />' + wpmdb_strings.status + ': ' + jqXHR.status + ' ' + jqXHR.statusText + '<br /><br />' + wpmdb_strings.response + '<br />' + jqXHR.responseText );
3633
- $( '.ajax-spinner' ).remove();
3634
- doing_ajax = false;
3635
- },
3636
- success: function( data ) {
3637
- $( '.ajax-spinner' ).remove();
3638
- doing_ajax = false;
3639
-
3640
- if ( 'undefined' !== typeof data.wpmdb_error && 1 === data.wpmdb_error ) {
3641
- $( '.invalid-licence' ).html( data.body );
3642
- return;
3643
- }
3644
-
3645
- if ( 'undefined' !== typeof data.wpmdb_dbrains_api_down && 1 === data.wpmdb_dbrains_api_down ) {
3646
- $( '.invalid-licence' ).html( wpmdb_strings.temporarily_activated_licence );
3647
- $( '.invalid-licence' ).append( data.body );
3648
- return;
3649
- }
3650
-
3651
- $( '.invalid-licence' ).empty().html( wpmdb_strings.licence_reactivated );
3652
- location.reload();
3653
- }
3654
- } );
3655
-
3656
- } );
3657
-
3658
- $( 'input[name=table_migrate_option]' ).change( function() {
3659
- maybe_show_mixed_cased_table_name_warning();
3660
- $.wpmdb.do_action( 'wpmdb_tables_to_migrate_changed' );
3661
- } );
3662
-
3663
- $( 'body' ).on( 'change', '#select-tables', function() {
3664
- maybe_show_mixed_cased_table_name_warning();
3665
- $.wpmdb.do_action( 'wpmdb_tables_to_migrate_changed' );
3666
- } );
3667
-
3668
- $.wpmdb.add_filter( 'wpmdb_get_table_prefix', get_table_prefix );
3669
- $.wpmdb.add_filter( 'wpmdb_get_tables_to_migrate', get_tables_to_migrate );
3670
- $.wpmdb.add_action( 'wpmdb_lock_replace_url', lock_replace_url );
3671
-
3672
- $.wpmdb.add_filter( 'wpmdb_before_migration_complete_hooks', function( hooks ) {
3673
- pause_before_finalize = $( 'input[name=pause_before_finalize]:checked' ).length ? true : false;
3674
- if ( true === pause_before_finalize && 'savefile' !== migration_intent ) {
3675
- set_pause_resume_button( null ); // don't just set migration_paused to true, since `set_pause_resume_button` will get double bound to clicking resume
3676
- is_auto_pause_before_finalize = true;
3677
- }
3678
- return hooks;
3679
- } );
3680
-
3681
- /**
3682
- * Set checkbox
3683
- *
3684
- * @param string checkbox_wrap
3685
- */
3686
- function set_checkbox( checkbox_wrap ) {
3687
- var $switch = $( '#' + checkbox_wrap );
3688
- var $checkbox = $switch.find( 'input[type=checkbox]' );
3689
-
3690
- $switch.toggleClass( 'on' ).find( 'span' ).toggleClass( 'checked' );
3691
- var switch_on = $switch.find( 'span.on' ).hasClass( 'checked' );
3692
- $checkbox.attr( 'checked', switch_on ).trigger( 'change' );
3693
- }
3694
-
3695
- $( '.wpmdb-switch' ).on( 'click', function( e ) {
3696
- if ( ! $( this ).hasClass( 'disabled' ) ) {
3697
- set_checkbox( $( this ).attr( 'id' ) );
3698
- }
3699
- } );
3700
-
3701
- } );
3702
-
3703
- })( jQuery, wpmdb );
3704
-
3705
- },{"MigrationProgress-controller":1}]},{},[1,2,3,4,5,6,7,8,9])
3706
- //# sourceMappingURL=data:application/json;charset:utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm5vZGVfbW9kdWxlcy9ncnVudC1icm93c2VyaWZ5L25vZGVfbW9kdWxlcy9icm93c2VyaWZ5L25vZGVfbW9kdWxlcy9icm93c2VyLXBhY2svX3ByZWx1ZGUuan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 
 
 
 
 
 
 
 
 
asset/dist/js/script.min.js DELETED
@@ -1,3 +0,0 @@
1
- !function a(b,c,d){function e(g,h){if(!c[g]){if(!b[g]){var i="function"==typeof require&&require;if(!h&&i)return i(g,!0);if(f)return f(g,!0);var j=new Error("Cannot find module '"+g+"'");throw j.code="MODULE_NOT_FOUND",j}var k=c[g]={exports:{}};b[g][0].call(k.exports,function(a){var c=b[g][1][a];return e(c?c:a)},k,k.exports,a,b,c,d)}return c[g].exports}for(var f="function"==typeof require&&require,g=0;g<d.length;g++)e(d[g]);return e}({1:[function(a,b,c){var d=jQuery,e=a("MigrationProgress-model"),f=a("MigrationProgress-view"),g=d('<div id="overlay" class="hide"></div>'),h=d(".progress-content").clone().addClass("hide"),i=d(".pro-version").addClass("hide");g.append(i);var j={migration:{model:{},view:{},$progress:{},$wrapper:{},$overlay:{},status:"active",title:"",text:"",timerCount:0,elapsedInterval:0,currentStageNum:0,counterDisplay:!1,originalTitle:document.title,setTitle:function(a){this.$progress.find(".progress-title").html(a),this.title=a},setStatus:function(a){this.$progress.removeClass(this.status).addClass("error"===a?"wpmdb-error":a),"error"===a&&this.$progress.find(".progress-text").addClass("migration-error"),this.status=a,this.updateTitleElem()},setText:function(a){"string"!=typeof a&&(a=""),0>=a.indexOf("wpmdb_error")&&(a=this.decodeErrorObject(a)),this.$progress.find(".progress-text").html(a),this.text=a},setState:function(a,b,c){null!==a&&this.setTitle(a),null!==b&&this.setText(b),null!==c&&this.setStatus(c)},startTimer:function(){this.timerCount=0,this.counterDisplay=d(".timer"),this.elapsedInterval=setInterval(this.incrementTimer,1e3)},pauseTimer:function(){clearInterval(this.elapsedInterval)},resumeTimer:function(){this.elapsedInterval=setInterval(this.incrementTimer,1e3)},incrementTimer:function(){wpmdb.current_migration.timerCount=wpmdb.current_migration.timerCount+1,wpmdb.current_migration.displayCount()},displayCount:function(){var a=Math.floor(this.timerCount/3600)%24,b=Math.floor(this.timerCount/60)%60,c=this.timerCount%60,d=this.pad(a,2,0)+":"+this.pad(b,2,0)+":"+this.pad(c,2,0);this.counterDisplay.html(d)},updateTitleElem:function(){var a=this.model.get("activeStageName"),b=this.model.getStageModel(a),c=Math.max(0,b.getTotalProgressPercent()),d=this.model.get("stages").length,e=this.currentStageNum,f=this.status,g=wpmdb_strings.title_progress;"complete"===b.get("status")&&0===b.get("totalSize")&&(c=100),g=g.replace("%1$s",c+"%"),g=g.replace("%2$s",e),g=g.replace("%3$s",d),1===d&&(g=c+"%"),wpmdb_strings["title_"+f]&&(g=wpmdb_strings["title_"+f]),g=g+" - "+this.originalTitle,document.title=g},restoreTitleElem:function(){document.title=this.originalTitle},pad:function(a,b,c){return c=c||"0",a+="",a.length>=b?a:new Array(b-a.length+1).join(c)+a},decodeErrorObject:function(a){var b=a.replace(/\{&quot;/g,"{#q!#").replace(/\&quot;}/g,"#q!#}").replace(/,&quot;/g,",#q!#").replace(/&quot;:/g,"#q!#:").replace(/:&quot;/g,":#q!#").replace(/&quot;/g,'\\"').replace(/#q!#/g,'"').replace(/&gt;/g,">").replace(/&lt;/g,"<");try{b=JSON.parse(b)}catch(c){return a}return"object"==typeof b&&"undefined"!=typeof b.body?b:a}},newMigration:function(a){d("#overlay").remove(),d(".progress-content").remove(),this.migration.$overlay=g.clone(),d("#wpwrap").append(this.migration.$overlay),this.migration.model=new e(a),this.migration.view=new f({model:this.migration.model}),this.migration.$progress=h.clone(),this.migration.$wrapper=this.migration.$progress.find(".migration-progress-stages"),this.migration.$proVersion=this.migration.$overlay.find(".pro-version");var b=this.migration.$proVersion.find("iframe").remove().clone();this.migration.$wrapper.replaceWith(this.migration.view.$el),this.migration.$overlay.prepend(this.migration.$progress);var c=this;return setTimeout(function(){c.migration.$overlay.add(c.migration.$progress).add(c.migration.$proVersion).removeClass("hide").addClass("show"),c.migration.$proVersion.length&&setTimeout(function(){c.migration.$proVersion.find(".iframe").append(b)},500)},0),this.migration.$progress.find(".migration-progress-stages").scroll(function(){d(this).find(".stage-progress").css("top",d(this).scrollTop())}),this.migration.currentStageNum=0,this.migration.$proVersion.on("click",".close-pro-version",function(){c.migration.$proVersion.find("iframe").remove(),c.migration.$proVersion.addClass("hide remove"),setTimeout(function(){c.migration.$proVersion.remove()},500)}),this.migration.model.on("migrationComplete",function(){c.utils.updateProgTableVisibilitySetting(),c.utils.updatePauseBeforeFinalizeSetting(),c.migration.pauseTimer()}),this.migration},utils:a("MigrationProgress-utils")};b.exports=j},{"MigrationProgress-model":2,"MigrationProgress-utils":3,"MigrationProgress-view":4}],2:[function(a,b,c){var d=a("MigrationProgressStage-model"),e=jQuery,f=Backbone.Model.extend({defaults:{_initialStages:null,stages:null,activeStageName:null,stageModels:null,localTableRows:null,localTableSizes:null,remoteTableRows:null,remoteTableSizes:null,migrationStatus:"active",migrationIntent:"savefile"},initialize:function(){this.set("stageModels",{}),this.set("_initialStages",this.get("stages")),this.set("stages",[]),_.each(this.get("_initialStages"),function(a,b,c){this.addStage(a.name,b,c)},this)},addStage:function(a,b,c,d){var f,g=[];return _.each(b,function(a){var b,d;"remote"===c?(b=this.get("remoteTableSizes")[a],d=this.get("remoteTableRows")[a]):(b=this.get("localTableSizes")[a],d=this.get("localTableRows")[a]),g.push({name:a,size:b,rows:d})},this),f={name:a,items:g,dataType:c},"object"==typeof d&&(f=e.extend(f,d)),this.addStageModel(f),this.trigger("stage:added",this.get("stageModels")[a]),this.get("stageModels")[a].on("change",function(){this.trigger("change")},this),this.getStageModel(f.name)},addStageItem:function(a,b,c,d){this.getStageModel(a).addItem(b,c,d)},addStageModel:function(a){var b=this.get("stages"),c=this.get("stageModels"),e=new d(a);b.push(a),c[a.name]=e,this.set("stages",b),this.set("stageModels",c)},getStageModel:function(a){return this.get("stageModels")[a]},getStageItems:function(a,b){var c=this.getStageModel(a),d=c.get("items");return void 0===b?d:d.map(function(a){return a[b]})},setActiveStage:function(a){this.setStageComplete(),this.set("activeStageName",a),this.getStageModel(a).set("status","active"),this.trigger("change:activeStage")},setStageComplete:function(a){a||(a=this.get("activeStageName")),null!==a&&this.getStageModel(a).set("status","complete"),wpmdb.current_migration.currentStageNum=wpmdb.current_migration.currentStageNum+1},setMigrationComplete:function(){var a=this.getStageModel(this.get("activeStageName"));this.setStageComplete(),this.trigger("migrationComplete"),this.set("migrationStatus","complete"),a.activateTab()}});b.exports=f},{"MigrationProgressStage-model":7}],3:[function(a,b,c){var d=jQuery;b.exports={updateProgTableVisibilitySetting:function(){wpmdb_data.prog_tables_visibility_changed&&(wpmdb_data.prog_tables_visibility_changed=!1,d.ajax({url:ajaxurl,type:"POST",dataType:"text",cache:!1,data:{action:"wpmdb_save_setting",nonce:wpmdb_data.nonces.save_setting,setting:"prog_tables_hidden",checked:Boolean(wpmdb_data.prog_tables_hidden)},error:function(a,b,c){console.log("Could not save progress item visibility setting",c)}}))},updatePauseBeforeFinalizeSetting:function(){wpmdb_data.pause_before_finalize_changed&&(wpmdb_data.pause_before_finalize_changed=!1,d.ajax({url:ajaxurl,type:"POST",dataType:"text",cache:!1,data:{action:"wpmdb_save_setting",nonce:wpmdb_data.nonces.save_setting,setting:"pause_before_finalize",checked:Boolean(wpmdb_data.pause_before_finalize)},error:function(a,b,c){console.log("Could not save pause before finalize setting",c)}}))}}},{}],4:[function(a,b,c){var d=a("./MigrationProgressStage-view.js"),e=(jQuery,Backbone.View.extend({tagName:"div",className:"migration-progress-stages",id:"migration-progress-stages",self:this,initialize:function(){this.$el.empty(),this.model.on("stage:added",function(a){this.addStageView(a)},this),_.each(this.model.get("stageModels"),this.addStageView,this)},addStageView:function(a){var b=new d({model:a});this.$el.append(b.$el),this.$el.parent().find(".stage-tabs").append(b.$tabElem)}}));b.exports=e},{"./MigrationProgressStage-view.js":8}],5:[function(a,b,c){var d=Backbone.Model.extend({defaults:{name:"",size:0,transferred:0,rows:0,rowsTransferred:0,stageName:"",started:!1,done:!1},getPercentDone:function(){return Math.min(100,Math.ceil(100*(this.get("transferred")/this.get("size"))))},getTransferred:function(){return Math.min(this.get("size"),this.get("transferred"))},getSizeHR:function(){return wpmdb.functions.convertKBSizeToHR(this.get("size"))},setComplete:function(){this.set("transferred",this.get("size")),this.set("rowsTransferred",this.get("rows"))},setRowsTransferred:function(a){var b,c;b=-1===parseInt(a)?1:Math.min(1,a/this.get("rows")),c=this.get("size")*b,this.set("transferred",c),this.set("rowsTransferred",a)}});b.exports=d},{}],6:[function(a,b,c){var d=jQuery,e=Backbone.View.extend({tagName:"div",className:"item-progress",id:"",$progress:null,$info:null,initialize:function(){this.$progress=d("<div />").addClass("progress-bar"),this.$title=d("<p>").addClass("item-info").append(d("<span class=name />").text(this.model.get("name"))).append(" ").append(d("<span class=size />").text("("+this.model.getSizeHR()+")")),this.$el.append(this.$title),this.$el.append(this.$progress),this.$el.append('<span class="dashicons dashicons-yes"/>'),this.$el.attr("id","item-"+this.model.get("name")),this.$el.attr("data-stage",this.model.get("stageName")),this.model.on("change:transferred",this.render,this),this.render()},render:function(){var a=Math.max(0,this.model.getPercentDone());this.$progress.css("width",a+"%"),a>=100&&this.elemComplete()},elemComplete:function(){var a=this;this.$el.addClass("complete"),setTimeout(function(){var b=a.$el.height(),c=a.$el.css("margin-bottom"),d=a.$el.clone().css({height:0,marginBottom:0}).addClass("clone");a.$el.animate({height:0,marginBottom:0},200,"swing"),d.appendTo(a.$el.parent()),d.animate({height:b,marginBottom:c},200,"swing",function(){d.replaceWith(a.$el.css({height:"auto",marginBottom:c}))})},1e3)}});b.exports=e},{}],7:[function(a,b,c){var d=a("MigrationProgressItem-model"),e=jQuery,f=Backbone.Model.extend({defaults:{status:"queued",itemModels:null,_initialItems:null,items:null,totalSize:0,dataType:"local",name:"",strings:null},initialize:function(){this.initStrings(),this.set("_initialItems",this.get("items")),this.set("items",[]),this.set("itemModels",{}),_.each(this.get("_initialItems"),function(a){this.addItem(a.name,a.size,a.rows)},this),this.on("change",function(){wpmdb.current_migration.updateTitleElem()})},initStrings:function(){var a={stage_title:this.get("name"),migrated:wpmdb_strings.migrated,queued:wpmdb_strings.queued,active:wpmdb_strings.running,complete:wpmdb_strings.complete,hide:wpmdb_strings.hide,show:wpmdb_strings.show,itemsName:wpmdb_strings.tables},b=this.get("strings");b="object"==typeof b?b:{},b=e.extend(a,b),b.items_migrated=b.itemsName+" "+b.migrated,b.hide_items=b.hide+" "+b.itemsName,b.show_items=b.show+" "+b.itemsName,this.set("strings",b)},addItem:function(a,b,c){var d={name:a,size:b,rows:c||b,stageName:this.get("name")};this.addItemModel(d),this.set("totalSize",parseInt(this.get("totalSize"))+parseInt(b)),this.trigger("item:added",this.get("itemModels")[a]),this.get("itemModels")[a].on("change",function(){this.trigger("change")},this)},addItemModel:function(a){var b=this.get("items"),c=this.get("itemModels"),e=new d(a);b.push(a),c[a.name]=e,this.set("items",b),this.set("itemModels",c)},getItemModel:function(a){return this.get("itemModels")[a]},setItemComplete:function(a){var b=this.getItemModel(a);b.set("transferred",b.get("size"))},incrementItemProgress:function(a){var b=this.getItemModel(a),c=b.getTransferred(),d=b.get("size"),e=c+.2*(d-c);b.set("transferred",e)},setItemModelTransferred:function(a,b){this.getItemModel(a).set("transferred",b)},getItemModelTransferred:function(a){var b=this.getItemModel(a);return Math.max(b.get("transferred"),b.get("size"))},setItemModelRowsTransferred:function(a,b){this.getItemModel(a).setRowsTransferred(b)},setItemModelComplete:function(a){this.getItemModel(a).setComplete()},recalculateTotalSize:function(){var a=0;return _.each(this.get("itemModels"),function(b){a+=b.get("size")},this),this.set("totalSize",a),a},getTotalSizeTransferred:function(){var a=0;return _.each(this.get("itemModels"),function(b){a+=b.getTransferred()},this),a},getTotalProgressPercent:function(){var a=this.getTotalSizeTransferred(),b=this.get("totalSize");return 0>=a||0>=b?0:Math.min(100,Math.round(a/b*100))},activateTab:function(){this.trigger("activateTab")}});b.exports=f},{"MigrationProgressItem-model":5}],8:[function(a,b,c){var d=a("./MigrationProgressItem-view.js"),e=jQuery,f=Backbone.View.extend({tagName:"div",className:"migration-progress-stage-container hide-tables",$totalProgressElem:null,$tabElem:null,$showHideTablesElem:null,$pauseBeforeFinalizeElem:null,$pauseBeforeFinalizeCheckbox:null,initialize:function(){this.$el.empty(),this.$el.attr("data-stage",this.model.get("name")).addClass("queued"),this.initTotalProgressElem(),this.$el.prepend(this.$totalProgressElem),this.$el.append("<div class=progress-items />"),this.initTabElem(),this.model.on("item:added",function(a){this.addItemView(a)},this),_.each(this.model.get("itemModels"),this.addItemView,this),this.model.on("change",function(){this.updateProgressElem()},this),this.model.on("change:status",function(a){this.$el.removeClass("queued active").addClass(this.model.get("status")),this.$tabElem.removeClass("queued active").addClass(this.model.get("status")).find(".stage-status").text(this.model.get("strings")[this.model.get("status")])},this)},initTotalProgressElem:function(){this.initShowHideTablesElem(),this.initPauseBeforeFinalizeElem(),this.$totalProgressElem=e("<div class=stage-progress />").append("<span class=percent-complete>0</span>% "+this.model.get("strings").complete+" ").append("(<span class=size-complete>0 MB</span> / <span class=size-total>0 MB</span>) ").append("<span class=tables-complete>0</span> <span class=lowercase >of</span> <span class=tables-total>0</span> "+this.model.get("strings").items_migrated).append(this.$showHideTablesElem).append("<div class=progress-bar-wrapper><div class=progress-bar /></div>")},initShowHideTablesElem:function(){this.$showHideTablesElem=e("<a class=show-hide-tables/>").text(this.model.get("strings").show_items);var a=this;this.$showHideTablesElem.on("click show-hide-progress-tables",function(){var b;a.$el.hasClass("hide-tables")?(b=!1,a.$el.add(a.$el.siblings()).removeClass("hide-tables"),a.$showHideTablesElem.text(a.model.get("strings").hide_items)):(b=!0,a.$el.add(a.$el.siblings()).addClass("hide-tables"),a.$showHideTablesElem.text(a.model.get("strings").show_items)),Boolean(b)!==Boolean(wpmdb_data.prog_tables_hidden)&&(wpmdb_data.prog_tables_visibility_changed=!0,wpmdb_data.prog_tables_hidden=b)}),wpmdb_data.prog_tables_hidden||this.$showHideTablesElem.triggerHandler("show-hide-progress-tables"),this.model.on("change:status activateTab",function(){wpmdb_data.prog_tables_hidden?a.$showHideTablesElem.text(a.model.get("strings").show_items):a.$showHideTablesElem.text(a.model.get("strings").hide_items)}),this.model.on("activateTab",function(){"complete"===wpmdb.current_migration.model.get("migrationStatus")&&(a.$tabElem.addClass("active").siblings().removeClass("active"),a.$el.addClass("active").siblings().removeClass("active"))})},initPauseBeforeFinalizeElem:function(){this.$pauseBeforeFinalizeElem=e(".pause-before-finalize"),this.$pauseBeforeFinalizeCheckbox=this.$pauseBeforeFinalizeElem.find("input[type=checkbox]");var a=this,b=!1,c=wpmdb.current_migration.model.get("migrationIntent");wpmdb_data.pause_before_finalize&&(b=!0),this.$pauseBeforeFinalizeCheckbox.prop("checked",b),"push"===c||"pull"===c?this.$pauseBeforeFinalizeElem.show():this.$pauseBeforeFinalizeElem.hide(),wpmdb.current_migration.model.on("change:activeStage",function(){"media"===wpmdb.current_migration.model.get("activeStageName")&&a.$pauseBeforeFinalizeElem.hide()}),this.$pauseBeforeFinalizeElem.on("click",function(){var b=Boolean(a.$pauseBeforeFinalizeCheckbox.is(":checked"));b!==Boolean(wpmdb_data.pause_before_finalize)&&(wpmdb_data.pause_before_finalize_changed=!0,wpmdb_data.pause_before_finalize=b)})},initTabElem:function(){var a=this;this.$tabElem=e("<a class=stage-tab>").append("<span class=stage-title>"+this.model.get("strings").stage_title+"</span> ").append("<span class=stage-status>"+this.model.get("strings").queued+"</span> ").on("click",function(){a.model.activateTab()})},updateProgressElem:function(){var a=Math.max(0,this.model.getTotalProgressPercent()),b=wpmdb.functions.convertKBSizeToHR(Math.min(this.model.getTotalSizeTransferred(),this.model.get("totalSize"))),c=Math.min(this.$el.find(".complete").length,this.model.get("items").length);"complete"===this.model.get("status")&&0===this.model.get("totalSize")&&(a=100,this.$showHideTablesElem.fadeOut()),this.$totalProgressElem.find(".percent-complete").text(a),this.$totalProgressElem.find(".size-complete").text(b),this.$totalProgressElem.find(".tables-complete").text(c),this.$totalProgressElem.find(".progress-bar-wrapper .progress-bar").css({width:a+"%"})},addItemView:function(a){var b=new d({model:a});this.$el.find(".progress-items").append(b.$el),this.$totalProgressElem.find(".tables-total").text(this.model.get("items").length),this.$totalProgressElem.find(".size-total").text(wpmdb.functions.convertKBSizeToHR(this.model.get("totalSize")))}});b.exports=f},{"./MigrationProgressItem-view.js":6}],9:[function(a,b,c){!function(b,c){function d(a,b){var c,d,e=[],f={},g=b.length;for(c=0;g>c;c++)f[b[c]]=!0;for(g=a.length,c=0;g>c;c++)d=a[c],d in f&&e.push(d);return e}function e(a){a=a.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");var b=new RegExp("[\\?&]"+a+"=([^&#]*)"),c=b.exec(location.search);return null===c?"":decodeURIComponent(c[1].replace(/\+/g," "))}function f(a,c,d){var e=a.substr(0,a.indexOf(":"));return d!==e&&-1!==a.indexOf("https")?(b(".ssl-notice").show(),L=!0,a=a.replace("https","http"),void b(".pull-push-connection-info").val(a+"\n"+c)):void(L=!1)}function g(a){a!==wpmdb_data.this_prefix&&(b(".remote-prefix").html(a),K=!0,"pull"===wpmdb_migration_type()?b(".prefix-notice.pull").show():b(".prefix-notice.push").show())}function h(){if("undefined"!=typeof c.common.connection_data&&!1!==c.common.connection_data){var a=wpmdb_migration_type(),d=q(null,null);b(".mixed-case-table-name-notice").hide(),null!==d&&(d=d.join(""),d!==d.toLowerCase()&&("1"===c.common.connection_data.lower_case_table_names||"push"!==a&&"savefile"!==a)&&("1"===wpmdb_data.lower_case_table_names||"pull"!==a)&&("push"===a||"savefile"===a?b(".mixed-case-table-name-notice.push").show():b(".mixed-case-table-name-notice.pull").show()))}}function i(a){var b=a,c=b.replace(/\/\/(.*)@/,"//").replace("http://","").replace("https://","").replace("www.","");return c}function j(a,b,c){var d,e,f=i(a);return"pull"===b?(d=wpmdb_strings.pull_migration_label_migrating,e=wpmdb_strings.pull_migration_label_completed):(d=wpmdb_strings.push_migration_label_migrating,e=wpmdb_strings.push_migration_label_completed),d=d.replace(/\%s(\S*)\s?/,"<span class=domain-label>"+f+"$1</span>&nbsp;"),e=e.replace(/\%s\s?/,"<span class=domain-label>"+f+"</span>&nbsp;"),"migrating"===c?d:e}function k(a){return a.replace(/^https?:/i,"")}function l(){b(".option-group").each(function(a){b("input",this).attr("disabled","disabled"),b("label",this).css("cursor","default")})}function m(){b(".option-group").each(function(a){b("input",this).removeAttr("disabled"),b("label",this).css("cursor","pointer")})}function n(a,c,d,e){var f=c;void 0!==e&&(f=e),b(".slider",a).slider("value",parseInt(c)),b(".amount",a).html(wpmdb_add_commas(f)+" "+d)}function o(a){!0===S?(S=!1,D=!0,c.current_migration.setState(T,U,"active"),b(".pause-resume").html(wpmdb_strings.pause),c.current_migration.resumeTimer(),c.functions.execute_next_step()):(S=!0,D=!1,T=b(".progress-title").html(),U=b(".progress-text",".progress-wrapper-primary").html(),V=b(".progress-text",".progress-wrapper-secondary ").html(),c.current_migration.setState(wpmdb_strings.migration_paused,wpmdb_strings.completing_current_request,null),b("body").off("click",".pause-resume"),b("body").off("click",".cancel"))}function p(a,c,d){var e=document.createElement("select");return b(e).attr({multiple:"multiple",name:"select_tables[]",id:"select-tables","class":"multiselect"}),0<a.length&&b.each(a,function(a,f){if(!b.wpmdb.apply_filters("wpmdb_exclude_table",!1,f)){var g=" ";void 0!==d&&null!==d&&0<d.length&&-1!==b.inArray(f,d)&&(g=' selected="selected" '),b(e).append("<option"+g+'value="'+f+'">'+f+" ("+c[f]+")</option>")}}),e}function q(a,d){var e="",f=wpmdb_migration_type(),g=b("input[name=table_migrate_option]:checked").val();return"migrate_select"===g?e=b("#select-tables").val():("pull"!==f&&"undefined"!=typeof wpmdb_data.this_prefixed_tables&&(e=wpmdb_data.this_prefixed_tables),"pull"===f&&"undefined"!=typeof c.common.connection_data&&"undefined"!=typeof c.common.connection_data.prefixed_tables&&(e=c.common.connection_data.prefixed_tables)),e}function r(a,c){return b(".table-select-wrap .table-prefix").text()}function s(a){!0===a?(b('.replace-row.pin .replace-right-col input[type="text"]').attr("readonly","readonly"),b(".replace-row.pin .arrow-col").addClass("disabled")):(b('.replace-row.pin .replace-right-col input[type="text"]').removeAttr("readonly"),b(".replace-row.pin .arrow-col").removeClass("disabled"))}function t(a){c.common.previous_connection_data=c.common.connection_data,c.common.connection_data=a,b.wpmdb.do_action("wpmdb_connection_data_updated",a)}function u(a){var b={};return b.unit="MB",b.amount=(a/1024).toFixed(2),b}var v,w,x,y,z,A,B=!1,C="",D=!1,E=!1,F=!1,G=!1,H=!1,I=!1,J=!1,K=!1,L=!1,M=!1,N=!1,O=!1,P="",Q="",R="",S=!1,T="",U="",V="",W=!1,X=!1,Y=0,Z=400,$=!1,_=!1;c.migration_progress_controller=a("MigrationProgress-controller"),c.current_migration=null;var aa=ajaxurl.replace("/admin-ajax.php",""),ba=aa+"/images/spinner";2<window.devicePixelRatio&&(ba+="-2x"),ba+=".gif";var ca='<img src="'+ba+'" alt="" class="ajax-spinner general-spinner" />';window.onbeforeunload=function(a){return O?(a=a||window.event,a&&(a.returnValue=wpmdb_strings.sure),wpmdb_strings.sure):void 0},b(document).ready(function(){function a(a){J=!0,b.ajax({url:ajaxurl,type:"POST",dataType:"json",cache:!1,data:{action:"wpmdb_check_licence",licence:a,context:"all",nonce:wpmdb_data.nonces.check_licence},error:function(a,b,c){alert(wpmdb_strings.license_check_problem)},success:function(a){var c,d,e,f=b(".support-content"),g=b(".addons-content"),h=b(".licence-status:not(.notification-message)");if("undefined"!=typeof a.dbrains_api_down)d=a.dbrains_api_down+a.message,e=a.dbrains_api_down;else if("undefined"!=typeof a.errors){if("undefined"!=typeof a.errors.subscription_expired)c=a.errors.subscription_expired.licence,d=a.errors.subscription_expired.support,e=a.errors.subscription_expired.addons;else{var i="";for(var j in a.errors)i+=a.errors[j];d=i,e=i}"undefined"!=typeof a.addon_content&&(e+="\n"+a.addon_content)}else d=a.message,e=a.addon_content;h.stop().fadeOut(Z,function(){b(this).css({visibility:"hidden",display:"block"}).slideUp().empty().html(c).stop().fadeIn(Z)}),f.stop().fadeOut(Z,function(){b(this).empty().html(d).stop().fadeIn(Z)}),g.stop().fadeOut(Z,function(){b(this).empty().html(e).stop().fadeIn(Z)})}})}function T(){void 0!==wpmdb_data&&void 0!==wpmdb_data.this_tables&&void 0!==wpmdb_data.this_table_sizes_hr&&(za=p(wpmdb_data.this_tables,wpmdb_data.this_table_sizes_hr,b(za).val())),void 0!==c.common.connection_data&&void 0!==c.common.connection_data.tables&&void 0!==c.common.connection_data.table_sizes_hr&&(Aa=p(c.common.connection_data.tables,c.common.connection_data.table_sizes_hr,b(Aa).val()))}function U(){b("#select-tables").remove(),b(".select-tables-wrap").prepend(za),b("#select-tables").change()}function V(){b("#select-tables").remove(),b(".select-tables-wrap").prepend(Aa),b("#select-tables").change()}function aa(){b("#migrate-selected").parents(".option-section").children(".header-expand-collapse").children(".expand-collapse-arrow").removeClass("collapsed"),b(".table-select-wrap").show(),b("#migrate-only-with-prefix").prop("checked",!1),b("#migrate-selected").prop("checked",!0),b(".table-migrate-options").hide(),b(".select-tables-wrap").show()}function da(){b(".table-migrate-options").show()}function ea(){b("#select-tables").children("option").prop("selected",!0),b("#select-tables").change()}function fa(a,b){return k(wpmdb_data.this_url)}function ga(){var a=wpmdb_migration_type(),d=b.trim(b(".pull-push-connection-info").val()).split("\n");if("undefined"!=typeof wpmdb_default_profile&&!0!==wpmdb_default_profile&&"savefile"!==a&&!D&&wpmdb_data.is_pro){D=!0,l(),b(".connection-status").html(wpmdb_strings.establishing_remote_connection),b(".connection-status").removeClass("notification-message error-notice migration-error"),b(".connection-status").append(ca);var e=wpmdb_migration_type();b.ajax({url:ajaxurl,type:"POST",dataType:"json",cache:!1,data:{action:"wpmdb_verify_connection_to_remote_site",url:d[0],key:d[1],intent:e,nonce:wpmdb_data.nonces.verify_connection_to_remote_site,convert_post_type_selection:wpmdb_convert_post_type_selection,profile:wpmdb_data.profile},error:function(a,c,d){b(".connection-status").html(oa(a.responseText,"(#102)",a)),b(".connection-status").addClass("notification-message error-notice migration-error"),b(".ajax-spinner").remove(),D=!1,m()},success:function(a){if(b(".ajax-spinner").remove(),D=!1,m(),"undefined"!=typeof a.wpmdb_error&&1===a.wpmdb_error)return b(".connection-status").html(a.body),b(".connection-status").addClass("notification-message error-notice migration-error"),void(a.body.indexOf("401 Unauthorized")>-1&&b(".basic-access-auth-wrapper").show());f(d[0],d[1],a.scheme),g(a.prefix),b(".pull-push-connection-info").addClass("temp-disabled"),b(".pull-push-connection-info").attr("readonly","readonly"),b(".connect-button").hide(),b(".connection-status").hide(),b(".step-two").show(),B=!0,t(a),ma(),h();var e="";!1===wpmdb_default_profile&&"undefined"!=typeof wpmdb_loaded_tables&&(e=wpmdb_loaded_tables),Aa=p(c.common.connection_data.tables,c.common.connection_data.table_sizes_hr,e);var i="";!1===wpmdb_default_profile&&"undefined"!=typeof wpmdb_loaded_post_types&&("undefined"!=typeof a.select_post_types?(b("#exclude-post-types").attr("checked","checked"),b(".post-type-select-wrap").show(),i=a.select_post_types):i=wpmdb_loaded_post_types);var j=document.createElement("select");b(j).attr({multiple:"multiple",name:"select_post_types[]",id:"select-post-types","class":"multiselect"}),b.each(c.common.connection_data.post_types,function(a,c){var d=b.inArray(c,i);d=-1!==d||!0===wpmdb_convert_exclude_revisions&&"revision"!==c?' selected="selected" ':" ",b(j).append("<option"+d+'value="'+c+'">'+c+"</option>")}),Ca=j;var k="";!1===wpmdb_default_profile&&"undefined"!=typeof wpmdb_loaded_tables_backup&&(k=wpmdb_loaded_tables_backup);var l=document.createElement("select");b(l).attr({multiple:"multiple",name:"select_backup[]",id:"select-backup","class":"multiselect"}),b.each(c.common.connection_data.tables,function(a,d){var e=b.inArray(d,k);e=-1!==e?' selected="selected" ':" ",b(l).append("<option"+e+'value="'+d+'">'+d+" ("+c.common.connection_data.table_sizes_hr[d]+")</option>")}),Da=l,"pull"===wpmdb_migration_type()?(b.wpmdb.do_action("wpmdb_update_pull_table_select"),b("#select-post-types").remove(),b(".exclude-post-types-warning").after(Ca),b("#select-backup").remove(),b(".backup-tables-wrap").prepend(Ea),b(".table-prefix").html(a.prefix),b(".uploads-dir").html(wpmdb_data.this_uploads_dir)):(b("#select-backup").remove(),b(".backup-tables-wrap").prepend(Da)),b.wpmdb.do_action("verify_connection_to_remote_site",c.common.connection_data)}})}}function ha(c,d){b(".licence-input, .register-licence").remove(),b(".licence-not-entered").prepend(c.masked_licence),b(".support-content").empty().html("<p>"+wpmdb_strings.fetching_license+'<img src="'+ba+'" alt="" class="ajax-spinner general-spinner" /></p>'),a(d),b(".migrate-selection label").removeClass("disabled"),b(".migrate-selection input").removeAttr("disabled")}function ia(){b.ajax({url:ajaxurl,type:"POST",dataType:"text",cache:!1,data:{action:"wpmdb_get_log",nonce:wpmdb_data.nonces.get_log},error:function(a,b,c){alert(wpmdb_strings.update_log_problem)},success:function(a){b(".debug-log-textarea").val(a)}})}function ja(){var a=b("#select-post-types").val(),c="",d=b(".exclude-post-types-warning");a?(c="<code>"+a.join("</code>, <code>")+"</code>",b(".excluded-post-types").html(c),"0"===d.css("opacity")&&d.css({opacity:0}).slideDown(200).animate({opacity:1})):d.css({opacity:0}).slideUp(200).animate({opacity:0})}function ka(){b("#overlay").removeClass("show").addClass("hide"),b("#overlay > div").removeClass("show").addClass("hide"),c.current_migration.$proVersion.find("iframe").remove(),setTimeout(function(){b("#overlay").remove()},500),N=!1}function la(){var a;if(b(".save-settings-button").blur(),!G){if(b("#migrate-selected").is(":checked")&&null===b("#select-tables").val())return void alert(wpmdb_strings.please_select_one_table);if("savefile"!==wpmdb_migration_type()&&b("#backup-manual-select").is(":checked")&&null===b("#select-backup").val())return void alert(wpmdb_strings.please_select_one_table_backup);var c=!1;b("#create_new").is(":checked")&&(c=!0);var d=b(".create-new-profile").val();G=!0,a=b(b("#migrate-form")[0].elements).not(".auth-credentials").serialize(),b(".save-settings-button").attr("disabled","disabled").after('<img src="'+ba+'" alt="" class="save-profile-ajax-spinner general-spinner" />'),D=!0,b.ajax({url:ajaxurl,type:"POST",dataType:"text",cache:!1,data:{action:"wpmdb_save_profile",profile:a,nonce:wpmdb_data.nonces.save_profile},error:function(a,c,d){D=!1,alert(wpmdb_strings.save_profile_problem),b(".save-settings-button").removeAttr("disabled"),b(".save-profile-ajax-spinner").remove(),b(".save-settings-button").after('<span class="ajax-success-msg">'+wpmdb_strings.saved+"</span>"),b(".ajax-success-msg").fadeOut(2e3,function(){b(this).remove()}),G=!1},success:function(a){var e=parseInt(b("#migrate-form input[name=save_migration_profile_option]:checked").val(),10)+1;if(D=!1,b(".save-settings-button").removeAttr("disabled"),b(".save-profile-ajax-spinner").remove(),b(".save-settings-button").after('<span class="ajax-success-msg">'+wpmdb_strings.saved+"</span>"),b(".ajax-success-msg").fadeOut(2e3,function(){b(this).remove()}),G=!1,b(".create-new-profile").val(""),c){var f=parseInt(a,10),g=f+1,h=b('<li><span class="delete-profile" data-profile-id="'+g+'"></span><label for="profile-'+g+'"><input id="profile-'+g+'" value="'+f+'" name="save_migration_profile_option" type="radio"></label></li>');h.find("label").append(document.createTextNode(" "+d)),e=g,b("#create_new").parents("li").before(h),b("#profile-"+g).attr("checked","checked")}var i=window.location.href.replace("#migrate","").replace(/&wpmdb-profile=-?\d+/,"")+"&wpmdb-profile="+e,j=b("#migrate-form input[name=save_migration_profile_option]:checked").parent().text().trim();if("function"==typeof window.history.pushState){if(b("#migrate-form .crumbs").length)b("#migrate-form .crumbs .crumb:last").text(j);else{var k=b('<div class="crumbs" />').append('<a class="crumb" href="'+wpmdb_data.this_plugin_base+'"> Saved Profiles </a>').append('<span class="crumb">'+j+"</span>");b("#migrate-form").prepend(k)}window.history.pushState({updated_profile_id:e},null,i)}}})}}function ma(){b(".connection-status").hide(),b(".prefix-notice").hide(),b(".ssl-notice").hide(),b(".different-plugin-version-notice").hide(),b(".step-two").show(),b(".backup-options").show(),b(".keep-active-plugins").show(),b(".directory-permission-notice").hide(),b("#create-backup").removeAttr("disabled"),b("#create-backup-label").removeClass("disabled"),
2
- b(".backup-option-disabled").hide(),b(".compatibility-older-mysql").hide();var a;b.trim(b(".pull-push-connection-info").val()).split("\n");wpmdb_toggle_migration_action_text(),"pull"===wpmdb_migration_type()?(b(".pull-list li").append(Fa),Fa.show(function(){var a=b(this).find(".pull-push-connection-info");a.val()||a.focus()}),B?(b(".connection-status").hide(),b(".step-two").show(),b(".table-prefix").html(c.common.connection_data.prefix),b(".uploads-dir").html(wpmdb_data.this_uploads_dir),!1===I&&(a=i(c.common.connection_data.url),b(".create-new-profile").val(a)),!0===K&&b(".prefix-notice.pull").show(),!0===L&&b(".ssl-notice").show(),!0===M&&(b(".different-plugin-version-notice").show(),b(".step-two").hide()),wpmdb_toggle_migration_action_text(),!1===wpmdb_data.write_permission&&(b("#create-backup").prop("checked",!1),b("#create-backup").attr("disabled","disabled"),b("#create-backup-label").addClass("disabled"),b(".backup-option-disabled").show(),b(".upload-directory-location").html(wpmdb_data.this_upload_dir_long))):(b(".connection-status").show(),b(".step-two").hide())):"push"===wpmdb_migration_type()?(b(".push-list li").append(Fa),Fa.show(function(){var a=b(this).find(".pull-push-connection-info");a.val()||a.focus()}),B?(b(".connection-status").hide(),b(".step-two").show(),b(".table-prefix").html(wpmdb_data.this_prefix),b(".uploads-dir").html(c.common.connection_data.uploads_dir),!1===I&&(a=i(c.common.connection_data.url),b(".create-new-profile").val(a)),!0===K&&b(".prefix-notice.push").show(),!0===L&&b(".ssl-notice").show(),!0===M&&(b(".different-plugin-version-notice").show(),b(".step-two").hide()),wpmdb_toggle_migration_action_text(),"0"===c.common.connection_data.write_permissions&&(b("#create-backup").prop("checked",!1),b("#create-backup").attr("disabled","disabled"),b("#create-backup-label").addClass("disabled"),b(".backup-option-disabled").show(),b(".upload-directory-location").html(c.common.connection_data.upload_dir_long))):(b(".connection-status").show(),b(".step-two").hide())):"savefile"===wpmdb_migration_type()&&(b(".connection-status").hide(),b(".step-two").show(),b(".table-prefix").html(wpmdb_data.this_prefix),b(".compatibility-older-mysql").show(),!1===I&&b(".create-new-profile").val(""),b(".backup-options").hide(),b(".keep-active-plugins").hide(),!1===wpmdb_data.write_permission&&(b(".directory-permission-notice").show(),b(".step-two").hide())),h(),b.wpmdb.do_action("move_connection_info_box",{migration_type:wpmdb_migration_type(),last_migration_type:C})}function na(){var a=null,d=null;null!==c.common.previous_connection_data&&"object"==typeof c.common.previous_connection_data&&c.common.previous_connection_data.url!==c.common.connection_data.url&&(a=k(c.common.previous_connection_data.url),d=c.common.previous_connection_data.path),"push"===wpmdb_migration_type()||"savefile"===wpmdb_migration_type()?("pull"===C?b(".replace-row").each(function(){var a=b(".old-replace-col input",this).val();b(".old-replace-col input",this).val(b(".replace-right-col input",this).val()),b(".replace-right-col input",this).val(a)}):"push"===C&&"push"===wpmdb_migration_type()&&null!==a&&null!==d&&b(".replace-row").each(function(){var e=b(".replace-right-col input",this).val();e===d&&b(".replace-right-col input",this).val(c.common.connection_data.path),e===a&&b(".replace-right-col input",this).val(k(c.common.connection_data.url))}),b.wpmdb.do_action("wpmdb_update_push_table_select"),b("#select-post-types").remove(),b(".exclude-post-types-warning").after(Ba),ja(),b("#select-backup").remove(),b(".backup-tables-wrap").prepend(Da)):"pull"===wpmdb_migration_type()&&(""===C||"push"===C||"savefile"===C?b(".replace-row").each(function(){var a=b(".old-replace-col input",this).val();b(".old-replace-col input",this).val(b(".replace-right-col input",this).val()),b(".replace-right-col input",this).val(a)}):"pull"===C&&"pull"===wpmdb_migration_type()&&null!==a&&null!==d&&b(".replace-row").each(function(){var e=b(".old-replace-col input",this).val();e===d&&b(".old-replace-col input",this).val(c.common.connection_data.path),e===a&&b(".old-replace-col input",this).val(k(c.common.connection_data.url))}),b.wpmdb.do_action("wpmdb_update_pull_table_select"),b("#select-post-types").remove(),b(".exclude-post-types-warning").after(Ca),ja(),b("#select-backup").remove(),b(".backup-tables-wrap").prepend(Ea)),C=wpmdb_migration_type()}function oa(a,b,c){return wpmdbGetAjaxErrors(wpmdb_strings.connection_local_server_problem,b,a,c)}function pa(a){return/^([a-z]([a-z]|\d|\+|-|\.)*):(\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$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]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i.test(a)}function qa(c,d){b(".nav-tab").removeClass("nav-tab-active"),b(".nav-tab."+c).addClass("nav-tab-active"),b(".content-tab").hide(),b("."+c+"-tab").show(),"settings"===c&&!0===ra()&&(b("p.licence-status").append("Checking License... ").append(ca),a()),"help"===c&&(ia(),!0===ra()&&(b(".support-content p").append(ca),a())),"addons"===c&&!0!==d&&!0===ra()&&(b(".addons-content p").append(ca),a())}function ra(){return!1===J&&"1"===wpmdb_data.has_licence&&"true"===wpmdb_data.is_pro?!0:!1}function sa(a){var d=b(".pull-push-connection-info");if(!D&&!b(d).hasClass("temp-disabled")){a=b(".pull-push-connection-info").val();var e=b.trim(a).split("\n"),j=!1,n="";if(""===e&&(j=!0,n=wpmdb_strings.connection_info_missing),2===e.length||j||(j=!0,n=wpmdb_strings.connection_info_incorrect),j||pa(e[0])||(j=!0,n=wpmdb_strings.connection_info_url_invalid),!j&&32>=e[1].length&&(j=!0,n=wpmdb_strings.connection_info_key_invalid),j||e[0]!==wpmdb_data.connection_info[0]||(j=!0,n=wpmdb_strings.connection_info_local_url),j||e[1]!==wpmdb_data.connection_info[1]||(j=!0,n=wpmdb_strings.connection_info_local_key),j)return b(".connection-status").html(n),void b(".connection-status").addClass("notification-message error-notice migration-error");var o=e[0]+"\n"+e[1];!1===wpmdb_data.openssl_available&&(e[0]=e[0].replace("https://","http://"),o=e[0]+"\n"+e[1],b(".pull-push-connection-info").val(o)),K=!1,D=!0,l(),b(".basic-access-auth-wrapper").is(":visible")&&(e[0]=e[0].replace(/\/\/(.*)@/,"//"),e[0]=e[0].replace("//","//"+encodeURIComponent(b.trim(b(".auth-username").val()))+":"+encodeURIComponent(b.trim(b(".auth-password").val()))+"@"),o=e[0]+"\n"+e[1],b(".pull-push-connection-info").val(o),b(".basic-access-auth-wrapper").hide()),b(".step-two").hide(),b(".ssl-notice").hide(),b(".prefix-notice").hide(),b(".connection-status").show(),b(".connection-status").html(wpmdb_strings.establishing_remote_connection),b(".connection-status").removeClass("notification-message error-notice migration-error"),b(".connection-status").append(ca);var p=wpmdb_migration_type();I=!1,b.ajax({url:ajaxurl,type:"POST",dataType:"json",cache:!1,data:{action:"wpmdb_verify_connection_to_remote_site",url:e[0],key:e[1],intent:p,nonce:wpmdb_data.nonces.verify_connection_to_remote_site},error:function(a,c,d){b(".connection-status").html(oa(a.responseText,"(#100)",a)),b(".connection-status").addClass("notification-message error-notice migration-error"),b(".ajax-spinner").remove(),D=!1,m()},success:function(a){if(b(".ajax-spinner").remove(),D=!1,m(),f(e[0],e[1],a.scheme),"undefined"!=typeof a.wpmdb_error&&1===a.wpmdb_error)return b(".connection-status").html(a.body),b(".connection-status").addClass("notification-message error-notice migration-error"),void(a.body.indexOf("401 Unauthorized")>-1&&b(".basic-access-auth-wrapper").show());var d=i(a.url);b(".create-new-profile").val(d),b(".pull-push-connection-info").addClass("temp-disabled"),b(".pull-push-connection-info").attr("readonly","readonly"),b(".connect-button").hide(),b(".connection-status").hide(),b(".step-two").show(),g(a.prefix),B=!0,t(a),ma(),na(),h(),T(),Da=b(Aa).clone(),b(Da).attr({name:"select_backup[]",id:"select-backup"});var j=document.createElement("select");b(j).attr({multiple:"multiple",name:"select_post_types[]",id:"select-post-types","class":"multiselect"}),b.each(c.common.connection_data.post_types,function(a,c){b(j).append('<option value="'+c+'">'+c+"</option>")}),Ca=j,b("#new-path-missing-warning, #new-url-missing-warning").hide(),"pull"===wpmdb_migration_type()?(b("#new-url").val(k(wpmdb_data.this_url)),b("#new-path").val(wpmdb_data.this_path),"true"===wpmdb_data.is_multisite&&(b("#new-domain").val(wpmdb_data.this_domain),b('.replace-row.pin .old-replace-col input[type="text"]').val(k(a.url))),b("#old-url").val(k(a.url)),b("#old-path").val(a.path),b.wpmdb.do_action("wpmdb_update_pull_table_select"),b("#select-post-types").remove(),b(".exclude-post-types-warning").after(Ca),ja(),b(".table-prefix").html(a.prefix),b(".uploads-dir").html(wpmdb_data.this_uploads_dir)):(b("#new-url").val(k(a.url)),b("#new-path").val(a.path),"true"===wpmdb_data.is_multisite&&b('.replace-row.pin .old-replace-col input[type="text"]').val(k(wpmdb_data.this_url)),b.wpmdb.do_action("wpmdb_update_push_table_select"),b("#select-backup").remove(),b(".backup-tables-wrap").prepend(Da)),c.common.next_step_in_migration={fn:b.wpmdb.do_action,args:["verify_connection_to_remote_site",c.common.connection_data]},c.functions.execute_next_step()}})}}function ta(a){W=!0,b(".migration-controls").css({visibility:"hidden"}),c.current_migration.setState(wpmdb_strings.cancelling_migration,wpmdb_strings.completing_current_request,"cancelling"),!0===S&&(S=!1,c.functions.execute_next_step())}function ua(a){var c=b("#"+a),d=c.find("input[type=checkbox]");c.toggleClass("on").find("span").toggleClass("checked");var e=c.find("span.on").hasClass("checked");d.attr("checked",e).trigger("change")}c.migration_state_id="",b("#plugin-compatibility").change(function(a){var c="1",d=b(this).closest("td").next("td").find(".setting-status");if(b(this).is(":checked")){var e=confirm(wpmdb_strings.mu_plugin_confirmation);if(!e)return void b(this).prop("checked",!1)}else c="0";b(".plugin-compatibility-wrap").toggle(),d.find(".ajax-success-msg").remove(),d.append(ca),b("#plugin-compatibility").attr("disabled","disabled"),b(".plugin-compatibility").addClass("disabled"),b.ajax({url:ajaxurl,type:"POST",dataType:"text",cache:!1,data:{action:"wpmdb_plugin_compatibility",install:c},error:function(a,c,d){alert(wpmdb_strings.plugin_compatibility_settings_problem+"\r\n\r\n"+wpmdb_strings.status+" "+a.status+" "+a.statusText+"\r\n\r\n"+wpmdb_strings.response+"\r\n"+a.responseText),b(".ajax-spinner").remove(),b("#plugin-compatibility").removeAttr("disabled"),b(".plugin-compatibility").removeClass("disabled")},success:function(a){""!==b.trim(a)?alert(a):(d.append('<span class="ajax-success-msg">'+wpmdb_strings.saved+"</span>"),b(".ajax-success-msg").fadeOut(2e3,function(){b(this).remove()})),b(".ajax-spinner").remove(),b("#plugin-compatibility").removeAttr("disabled"),b(".plugin-compatibility").removeClass("disabled")}})}),b("#plugin-compatibility").is(":checked")&&b(".plugin-compatibility-wrap").show(),(0<=navigator.userAgent.indexOf("MSIE")||0<=navigator.userAgent.indexOf("Trident"))&&b(".ie-warning").show(),0===wpmdb_data.valid_licence&&b("#savefile").prop("checked",!0);var va=b(".max-request-size"),wa=b(".slider",va);wa.slider({range:"min",value:parseInt(wpmdb_data.max_request/1024),min:512,max:parseInt(wpmdb_data.bottleneck/1024),step:256,create:function(a,b){var c=u(wpmdb_data.max_request/1024);n(va,wpmdb_data.max_request/1024,c.unit,c.amount)},slide:function(a,b){var c=u(b.value);n(va,b.value,c.unit,c.amount)},stop:function(a,c){b(".slider-success-msg").remove(),b(".amount",va).after('<img src="'+ba+'" alt="" class="slider-spinner general-spinner" />'),wa.slider("disable"),b.ajax({url:ajaxurl,type:"POST",cache:!1,data:{action:"wpmdb_update_max_request_size",max_request_size:parseInt(c.value),nonce:wpmdb_data.nonces.update_max_request_size},error:function(a,c,d){wa.slider("enable"),b(".slider-spinner",va).remove(),alert(wpmdb_strings.max_request_size_problem);var e=u(wpmdb_data.max_request/1024);n(va,wpmdb_data.max_request/1024,e.unit,e.amount),wa.slider("enable")},success:function(){wa.slider("enable"),b(".slider-label-wrapper",va).append('<span class="slider-success-msg">'+wpmdb_strings.saved+"</span>"),b(".slider-success-msg",va).fadeOut(2e3,function(){b(this).remove()}),b(".slider-spinner",va).remove()}})}});var xa=b(".delay-between-requests"),ya=b(".slider",xa);ya.slider({range:"min",value:parseInt(wpmdb_data.delay_between_requests/1e3),min:0,max:10,step:1,create:function(a,b){n(xa,wpmdb_data.delay_between_requests/1e3,"s")},slide:function(a,b){n(xa,b.value,"s")},stop:function(a,c){b(".slider-success-msg").remove(),b(".amount",xa).after('<img src="'+ba+'" alt="" class="slider-spinner general-spinner" />'),ya.slider("disable"),b.ajax({url:ajaxurl,type:"POST",cache:!1,data:{action:"wpmdb_update_delay_between_requests",delay_between_requests:parseInt(1e3*c.value),nonce:wpmdb_data.nonces.update_delay_between_requests},error:function(a,c,d){ya.slider("enable"),b(".slider-spinner",xa).remove(),alert(wpmdb_strings.delay_between_requests_problem),n(xa,wpmdb_data.delay_between_requests/1e3,"s"),ya.slider("enable")},success:function(){wpmdb_data.delay_between_requests=parseInt(1e3*c.value),ya.slider("enable"),b(".slider-label-wrapper",xa).append('<span class="slider-success-msg">'+wpmdb_strings.saved+"</span>"),b(".slider-success-msg",xa).fadeOut(2e3,function(){b(this).remove()}),b(".slider-spinner",xa).remove()}})}});var za=b("#select-tables").clone(),Aa=b("#select-tables").clone(),Ba=b("#select-post-types").clone(),Ca=b("#select-post-types").clone(),Da=b("#select-backup").clone(),Ea=b("#select-backup").clone();b(".help-tab .video").each(function(){var a=b(this),c=b(".video-viewer");b("a",this).click(function(d){d.preventDefault(),c.attr("src","//www.youtube.com/embed/"+a.data("video-id")+"?autoplay=1"),c.show();var e=c.offset();b(window).scrollTop(e.top-50)})}),b(".backup-options").show(),b(".keep-active-plugins").show(),"savefile"===wpmdb_migration_type()&&(b(".backup-options").hide(),b(".keep-active-plugins").hide()),C=wpmdb_migration_type(),b(".content-tab").on("click",".check-my-licence-again",function(c){c.preventDefault(),J=!1,b(c.target).replaceWith("Checking... "+ca),a(null,"all")}),b.wpmdb.add_action("wpmdb_refresh_table_selects",T),b.wpmdb.add_action("wpmdb_update_push_table_select",U),b.wpmdb.add_action("wpmdb_update_pull_table_select",V),b.wpmdb.add_action("wpmdb_disable_table_migration_options",aa),b.wpmdb.add_action("wpmdb_enable_table_migration_options",da),b.wpmdb.add_action("wpmdb_select_all_tables",ea),b.wpmdb.add_filter("wpmdb_base_old_url",fa),ga(),b("body").on("click",".js-action-link",function(a){a.preventDefault(),b(this).blur()}),b(".licence-input").keypress(function(a){13===a.which&&(a.preventDefault(),b(".register-licence").click())}),b("body").on("click",".register-licence",function(a){if(a.preventDefault(),!E){var c=b.trim(b(".licence-input").val()),d=b(".licence-status");if(d.removeClass("notification-message error-notice success-notice"),""===c)return void d.html('<div class="notification-message error-notice">'+wpmdb_strings.enter_license_key+"</div>");d.empty().removeClass("success"),E=!0,b(".button.register-licence").after('<img src="'+ba+'" alt="" class="register-licence-ajax-spinner general-spinner" />'),b.ajax({url:ajaxurl,type:"POST",dataType:"JSON",cache:!1,data:{action:"wpmdb_activate_licence",licence_key:c,nonce:wpmdb_data.nonces.activate_licence,context:"licence"},error:function(a,c,e){E=!1,b(".register-licence-ajax-spinner").remove(),d.html(wpmdb_strings.register_license_problem)},success:function(a){if(E=!1,b(".register-licence-ajax-spinner").remove(),"undefined"!=typeof a.errors){var e="";for(var f in a.errors)e+=a.errors[f];d.html(e),"undefined"!=typeof a.masked_licence&&(ha(a,c),b(".migrate-tab .invalid-licence").hide())}else"undefined"!=typeof a.wpmdb_error&&"undefined"!=typeof a.body?d.html(a.body):(1===Number(a.is_first_activation)&&(wpmdb_strings.welcome_text=wpmdb_strings.welcome_text.replace("%1$s","https://deliciousbrains.com/wp-migrate-db-pro/doc/quick-start-guide/"),wpmdb_strings.welcome_text=wpmdb_strings.welcome_text.replace("%2$s","https://deliciousbrains.com/wp-migrate-db-pro/videos/"),d.after('<div id="welcome-wrap"><img id="welcome-img" src="'+wpmdb_data.this_plugin_url+'asset/dist/welcome.jpg" /><div class="welcome-text"><h3>'+wpmdb_strings.welcome_title+"</h3><p>"+wpmdb_strings.welcome_text+"</p></div></div>")),d.html(wpmdb_strings.license_registered).delay(5e3).fadeOut(1e3,function(){b(this).css({visibility:"hidden",display:"block"}).slideUp()}),d.addClass("success notification-message success-notice"),ha(a,c),b(".invalid-licence").hide())}})}}),b(".clear-log").click(function(){b(".debug-log-textarea").val(""),b.ajax({url:ajaxurl,type:"POST",dataType:"text",cache:!1,data:{action:"wpmdb_clear_log",nonce:wpmdb_data.nonces.clear_log},error:function(a,b,c){alert(wpmdb_strings.clear_log_problem)},success:function(a){}})}),b(".multiselect-select-all").click(function(){var a=b(this).parents(".select-wrap").children(".multiselect");b("option",a).prop("selected",1),b(a).focus().trigger("change")}),b(".multiselect-deselect-all").click(function(){var a=b(this).parents(".select-wrap").children(".multiselect");b("option",a).removeAttr("selected"),b(a).focus().trigger("change")}),b(".multiselect-invert-selection").click(function(){var a=b(this).parents(".select-wrap").children(".multiselect");b("option",a).each(function(){b(this).attr("selected",!b(this).attr("selected"))}),b(a).focus().trigger("change")}),b(".option-group input[type=radio]").change(function(){var a=b(this).closest(".option-group");b("ul",a).hide();var c=b(this).closest("li");b("ul",c).show()}),b(".option-group").each(function(){b(".option-group input[type=radio]").each(function(){if(b(this).is(":checked")){var a=b(this).closest("li");b("ul",a).show()}})}),b(".header-expand-collapse").click(function(){b(".expand-collapse-arrow",this).hasClass("collapsed")?(b(".expand-collapse-arrow",this).removeClass("collapsed"),b(this).next().show()):(b(".expand-collapse-arrow",this).addClass("collapsed"),b(this).next().hide())}),b(".checkbox-label input[type=checkbox]").change(function(){b(this).is(":checked")?b(this).parent().next().show():b(this).parent().next().hide()}),b(".select-post-types-wrap").on("change","#select-post-types",function(){ja()}),b("#exclude-post-types").is(":checked")&&b("#select-post-types").val()&&b(".exclude-post-types-warning").css({display:"block",opacity:1}),b("#save-migration-profile").change(function(){c.functions.update_migrate_button_text(),b(this).is(":checked")?b(".save-settings-button").show():b(".save-settings-button").hide()}),b("#save-migration-profile").is(":checked")&&b(".save-settings-button").show(),b(".create-new-profile").focus(function(){b("#create_new").prop("checked",!0)}),b(".checkbox-label input[type=checkbox]").each(function(){b(this).is(":checked")&&b(this).parent().next().show()}),b(".migrate-db-button").click(function(a){if(b(this).blur(),a.preventDefault(),c.migration_state_id="",!1!==b.wpmdb.apply_filters("wpmdb_migration_profile_ready",!0)){if(b("#migrate-selected").is(":checked")&&null===b("#select-tables").val())return void alert(wpmdb_strings.please_select_one_table);if("savefile"!==wpmdb_migration_type()&&b("#backup-manual-select").is(":checked")&&null===b("#select-backup").val())return void alert(wpmdb_strings.please_select_one_table_backup);var e=!1,f=!1;if(b("#new-url").length&&!b("#new-url").val()&&(b("#new-url-missing-warning").show(),b("#new-url").focus(),b("html,body").scrollTop(0),e=!0),b("#new-path").length&&!b("#new-path").val()&&(b("#new-path-missing-warning").show(),!1===e&&(b("#new-path").focus(),b("html,body").scrollTop(0)),f=!0),!0!==e&&!0!==f){b("#save-migration-profile").is(":checked")&&la(),y=b(b("#migrate-form")[0].elements).not(".auth-credentials").serialize(),v=wpmdb_migration_type(),z="backup","savefile"===v&&(z="migrate"),!1===b("#create-backup").is(":checked")&&(z="migrate"),c.current_migration=c.migration_progress_controller.newMigration({localTableSizes:wpmdb_data.this_table_sizes,localTableRows:wpmdb_data.this_table_rows,remoteTableSizes:"undefined"!=typeof c.common.connection_data?c.common.connection_data.table_sizes:null,remoteTableRows:"undefined"!=typeof c.common.connection_data?c.common.connection_data.table_rows:null,migrationIntent:wpmdb_migration_type()});var g=b("input[name=backup_option]:checked").val(),h=b("input[name=table_migrate_option]:checked").val(),i="",k="";"backup"===z&&("migrate_only_with_prefix"===h&&"backup_selected"===g&&(g="backup_only_with_prefix"),"push"===v?(k="remote","backup_only_with_prefix"===g?R=c.common.connection_data.prefixed_tables:"backup_selected"===g?(i=b("#select-tables").val(),i=b.wpmdb.apply_filters("wpmdb_backup_selected_tables",i),R=d(i,c.common.connection_data.tables)):"backup_manual_select"===g&&(R=b("#select-backup").val())):(k="local","backup_only_with_prefix"===g?R=wpmdb_data.this_prefixed_tables:"backup_selected"===g?(i=b("#select-tables").val(),i=b.wpmdb.apply_filters("wpmdb_backup_selected_tables",i),R=d(i,wpmdb_data.this_tables)):"backup_manual_select"===g&&(R=b("#select-backup").val())),c.current_migration.model.addStage("backup",R,k,{strings:{migrated:wpmdb_strings.backed_up}})),k="push"===v||"savefile"===v?"local":"remote",c.current_migration.model.addStage("migrate",q(null,null),k),b.wpmdb.do_action("wpmdb_add_migration_stages",{data_type:k,tables_to_migrate:q(null,null)});var l=(b("input[name=table_migrate_option]:checked").val(),b.trim(b(".pull-push-connection-info").val()).split("\n"));w=l[0],x=l[1];var m="";A=wpmdb_strings.exporting_complete,"savefile"===v?m=wpmdb_strings.exporting_please_wait:(m=j(w,v,"migrating"),A=j(w,v,"completed")),R="backup"===z?c.current_migration.model.getStageItems("backup","name"):c.current_migration.model.getStageItems("migrate","name"),c.current_migration.model.setActiveStage(z),c.current_migration.setTitle(m),c.current_migration.startTimer(),O=!0,c.current_migration.setStatus("active");var n={action:"wpmdb_initiate_migration",intent:v,url:w,key:x,form_data:y,stage:z,nonce:wpmdb_data.nonces.initiate_migration};n.site_details={local:wpmdb_data.site_details},"savefile"!==v&&(n.temp_prefix=c.common.connection_data.temp_prefix,n.site_details.remote=c.common.connection_data.site_details),n.site_details=JSON.stringify(n.site_details),D=!0,b.ajax({url:ajaxurl,type:"POST",dataType:"json",cache:!1,data:n,error:function(a,b,d){c.current_migration.setState(wpmdb_strings.migration_failed,oa(a.responseText,"(#112)",a),"error"),console.log(a),console.log(b),console.log(d),D=!1,c.common.migration_error=!0,c.functions.migration_complete_events()},success:function(a){if(D=!1,"undefined"!=typeof a&&"undefined"!=typeof a.wpmdb_error&&1===a.wpmdb_error)return c.common.migration_error=!0,c.functions.migration_complete_events(),void c.current_migration.setState(wpmdb_strings.migration_failed,a.body,"error");c.migration_state_id=a.migration_state_id;var d=0;Y=0,"savefile"!==v&&"undefined"!=typeof c.common.connection_data&&"undefined"!=typeof c.common.connection_data.delay_between_requests&&(Y=Math.max(parseInt(wpmdb_data.delay_between_requests),parseInt(c.common.connection_data.delay_between_requests))),c.functions.migrate_table_recursive=function(a,e){if(d>=R.length){if("backup"!==z)return b(".progress-label").removeClass("label-visible"),c.common.hooks=b.wpmdb.apply_filters("wpmdb_before_migration_complete_hooks",c.common.hooks),c.common.hooks.push(c.functions.migration_complete),c.common.hooks.push(c.functions.wpmdb_flush),c.common.hooks=b.wpmdb.apply_filters("wpmdb_after_migration_complete_hooks",c.common.hooks),c.common.hooks.push(c.functions.migration_complete_events),c.common.next_step_in_migration={fn:wpmdb_call_next_hook},void c.functions.execute_next_step();c.current_migration.model.setActiveStage("migrate"),z="migrate",d=0,R=q(null,null)}var f=0;d===R.length-1&&(f=1);var g=0;"savefile"!==v&&1===parseInt(c.common.connection_data.gzip)&&(g=1);var h={action:"wpmdb_migrate_table",migration_state_id:c.migration_state_id,table:R[d],stage:z,current_row:a,last_table:f,primary_keys:e,gzip:g,nonce:wpmdb_data.nonces.migrate_table};"savefile"!==v&&(h.bottleneck=c.common.connection_data.bottleneck,h.prefix=c.common.connection_data.prefix),c.common.connection_data&&c.common.connection_data.path_current_site&&c.common.connection_data.domain&&(h.path_current_site=c.common.connection_data.path_current_site,h.domain_current_site=c.common.connection_data.domain),D=!0,b.ajax({url:ajaxurl,type:"POST",dataType:"text",cache:!1,timeout:0,data:h,error:function(a,b,e){var f=wpmdb_strings.table_process_problem+" "+R[d]+"<br /><br />"+wpmdb_strings.status+": "+a.status+" "+a.statusText+"<br /><br />"+wpmdb_strings.response+":<br />"+a.responseText;c.current_migration.setState(wpmdb_strings.migration_failed,f,"error"),D=!1,console.log(a),console.log(b),console.log(e),c.common.migration_error=!0,c.functions.migration_complete_events()},success:function(a){D=!1,a=b.trim(a);var e=wpmdb_parse_json(a),g="";return!1===e||null===e?(g=""===a||null===a?wpmdb_strings.table_process_problem_empty_response+" "+R[d]:oa(a,null,null),c.current_migration.setState(wpmdb_strings.migration_failed,g,"error"),c.common.migration_error=!0,void c.functions.migration_complete_events()):"undefined"!=typeof e.wpmdb_error&&1===e.wpmdb_error?(c.current_migration.setState(wpmdb_strings.migration_failed,e.body,"error"),c.common.migration_error=!0,void c.functions.migration_complete_events()):(c.current_migration.setText(),c.current_migration.model.getStageModel(z).setItemModelRowsTransferred(R[d],e.current_row),1===f&&"savefile"===v&&("undefined"!=typeof e.dump_filename&&(P=e.dump_filename),"undefined"!=typeof e.dump_path&&(Q=e.dump_path)),-1===parseInt(e.current_row)&&(d++,e.current_row="",e.primary_keys=""),c.common.next_step_in_migration={fn:c.functions.migrate_table_recursive,args:[e.current_row,e.primary_keys]},void c.functions.execute_next_step())}})},c.common.next_step_in_migration={fn:c.functions.migrate_table_recursive,args:["-1",""]},c.functions.execute_next_step()}})}}}),c.functions.migration_complete_events=function(){!1===c.common.migration_error&&(""===c.common.non_fatal_errors?("savefile"!==v&&!0===b("#save_computer").is(":checked")&&c.current_migration.setText(),!0===W?c.current_migration.setState(A+'&nbsp;<div class="dashicons dashicons-yes"></div>',wpmdb_strings.migration_cancelled_success,"cancelled"):c.current_migration.setState(A+'&nbsp;<div class="dashicons dashicons-yes"></div>',"","complete")):c.current_migration.setState(wpmdb_strings.completed_with_some_errors,c.common.non_fatal_errors,"error")),b(".migration-controls").addClass("hidden"),c.common.hooks=[],c.common.call_stack=[],c.common.migration_error=!1,O=!1,N=!0,S=!1,W=!1,D=!1,c.common.non_fatal_errors="",b(".progress-label").remove(),b(".migration-progress-ajax-spinner").remove(),b(".close-progress-content").show(),b("#overlay").css("cursor","pointer"),c.current_migration.model.setMigrationComplete()},c.functions.migration_complete=function(){if(b(".migration-controls").addClass("hidden"),"savefile"===v){O=!1;var a=wpmdb_strings.migration_complete;if(b("#save_computer").is(":checked")){var d=wpmdb_data.this_download_url+encodeURIComponent(P);b("#gzip_file").is(":checked")&&(d+="&gzip=1"),window.location=d}else a=wpmdb_strings.completed_dump_located_at+" "+Q;!1===c.common.migration_error&&(c.functions.migration_complete_events(),c.current_migration.setState(A,a,"complete"))}else c.current_migration.setState(null,wpmdb_strings.finalizing_migration,"finalizing"),D=!0,b.ajax({url:ajaxurl,type:"POST",dataType:"text",cache:!1,data:{action:"wpmdb_finalize_migration",migration_state_id:c.migration_state_id,prefix:c.common.connection_data.prefix,tables:R.join(","),nonce:wpmdb_data.nonces.finalize_migration},error:function(a,b,d){D=!1,c.current_migration.setState(wpmdb_strings.migration_failed,wpmdb_strings.finalize_tables_problem,"error"),alert(a+" : "+b+" : "+d),c.common.migration_error=!0,c.functions.migration_complete_events()},success:function(a){return D=!1,"1"!==b.trim(a)?(c.current_migration.setState(wpmdb_strings.migration_failed,a,"error"),c.common.migration_error=!0,void c.functions.migration_complete_events()):(c.common.next_step_in_migration={fn:wpmdb_call_next_hook},void c.functions.execute_next_step())}})},c.functions.wpmdb_flush=function(){"savefile"!==v&&(c.current_migration.setText(wpmdb_strings.flushing),D=!0,b.ajax({url:ajaxurl,type:"POST",dataType:"text",cache:!1,data:{action:"wpmdb_flush",migration_state_id:c.migration_state_id,nonce:wpmdb_data.nonces.flush},error:function(a,b,d){D=!1,c.current_migration.setState(wpmdb_strings.migration_failed,wpmdb_strings.flush_problem,"error"),alert(a+" : "+b+" : "+d),c.common.migration_error=!0,c.functions.migration_complete_events()},success:function(a){return D=!1,"1"!==b.trim(a)?(c.current_migration.setState(wpmdb_strings.migration_failed,a,"error"),c.common.migration_error=!0,void c.functions.migration_complete_events()):(c.common.next_step_in_migration={fn:wpmdb_call_next_hook},void c.functions.execute_next_step())}}))},c.functions.update_migrate_button_text=function(){var a=wpmdb_migration_type(),c=b("#save-migration-profile").is(":checked")?"_save":"",d="migrate_button_"+("savefile"===a?"export":a)+c;b(".migrate-db .button-primary").val(wpmdb_strings[d])},c.functions.update_migrate_button_text(),b("body").on("click",".close-progress-content-button",function(a){ka(),c.current_migration.restoreTitleElem()}),b("body").on("click","#overlay",function(a){!0===N&&a.target===this&&(ka(),c.current_migration.restoreTitleElem())}),b(".save-settings-button").click(function(a){return a.preventDefault(),""===b.trim(b(".create-new-profile").val())&&b("#create_new").is(":checked")?(alert(wpmdb_strings.enter_name_for_profile),void b(".create-new-profile").focus()):void la()});var Fa=b(".connection-info-wrapper");ma(),b(".migrate-selection.option-group input[type=radio]").change(function(){ma(),B&&na(),c.functions.update_migrate_button_text()}),"pull"!==wpmdb_migration_type()&&"push"!==wpmdb_migration_type()||B||(b(".step-two").hide(),b(".connection-status").show()),b(".general-helper").click(function(a){a.preventDefault();var c=b(this),d=b(this).next();b(".helper-message").not(d).hide();var e=c.position();d.hasClass("bottom")?d.css({left:e.left-d.width()/2+"px",top:e.top+c.height()+9+"px"}):d.css({left:e.left+c.width()+9+"px",top:e.top+c.height()/2-18+"px"}),d.toggle(),a.stopPropagation()}),b("body").click(function(){b(".helper-message").hide()}),b(".helper-message").click(function(a){a.stopPropagation()}),b("body").on("click",".show-errors-toggle",function(a){a.preventDefault(),b(this).next(".migration-php-errors").toggle()}),b(".nav-tab").click(function(){var a=b(this).attr("data-div-name");a=a.replace("-tab",""),
3
- window.location.hash=a,qa(a,!1)}),b("body").on("click",'a[href^="#"]',function(a){var c=b(a.target).attr("href"),d=c.substr(1);if(d){var e=b("."+d);1===e.length&&(e.trigger("click"),a.preventDefault())}}),b("body").on("click",".add-row",function(){var a=b(this).parents("tr");a.before(b(".original-repeatable-field").clone().removeClass("original-repeatable-field")),a.prev().find(".old-replace-col input").focus()}),b("body").on("click",".replace-remove-row",function(){b(this).parents("tr").remove(),2>=b(".replace-row").length&&b(".no-replaces-message").show();var a=b(this).prev().attr("id");("new-url"===a||"new-path"===a)&&b("#"+a+"-missing-warning").hide()}),b("body").on("change","#new-url",function(){b("#new-url-missing-warning").hide()}).on("change","#new-path",function(){b("#new-path-missing-warning").hide()}),b("body").on("click",".arrow-col",function(){var a=this;if(!b(a).hasClass("disabled")){var c=b(a).prev("td").find("input").val(),d=b(a).next("td").find("input");d.val(c),"new-url"===d.prop("id")?b("#new-url-missing-warning").hide():"new-path"===d.prop("id")&&b("#new-path-missing-warning").hide()}}),b(".add-replace").click(function(){b(".replace-fields").prepend(b(".original-repeatable-field").clone().removeClass("original-repeatable-field")),b(".no-replaces-message").hide()}),b("#find-and-replace-sort tbody").sortable({items:"> tr:not(.pin)",handle:"td:first",start:function(){b(".sort-handle").css("cursor","-webkit-grabbing"),b(".sort-handle").css("cursor","-moz-grabbing")},stop:function(){b(".sort-handle").css("cursor","-webkit-grab"),b(".sort-handle").css("cursor","-moz-grab")}});var Ga="";window.location.hash&&(Ga=window.location.hash.substring(1),qa(Ga,!1)),""!==e("install-plugin")&&(Ga="addons",J=!0,qa(Ga,!0)),b(".notice-link").click(function(a){a.preventDefault(),b(this).closest(".inline-message").hide(),b.ajax({url:ajaxurl,type:"POST",dataType:"text",cache:!1,data:{action:"wpmdb_process_notice_link",nonce:wpmdb_data.nonces.process_notice_link,notice:b(this).data("notice"),type:b(this).data("type"),reminder:b(this).data("reminder")}})}),b(".reset-api-key").click(function(){var a=confirm(wpmdb_strings.reset_api_key);a&&!F&&(F=!0,b(".reset-api-key").after('<img src="'+ba+'" alt="" class="reset-api-key-ajax-spinner general-spinner" />'),b.ajax({url:ajaxurl,type:"POST",dataType:"text",cache:!1,data:{action:"wpmdb_reset_api_key",nonce:wpmdb_data.nonces.reset_api_key},error:function(a,c,d){alert(wpmdb_strings.reset_api_key_problem),b(".reset-api-key-ajax-spinner").remove(),F=!1},success:function(a){b(".reset-api-key-ajax-spinner").remove(),F=!1,b(".connection-info").html(a),wpmdb_data.connection_info=b.trim(a).split("\n")}}))}),b("input.multiselect-toggle").change(function(){b(this).parents(".expandable-content").children(".select-wrap").toggle()}),b(".show-multiselect").each(function(){b(this).is(":checked")&&(b(this).parents(".option-section").children(".header-expand-collapse").children(".expand-collapse-arrow").removeClass("collapsed"),b(this).parents(".expandable-content").show(),b(this).parents(".expandable-content").children(".select-wrap").toggle())}),b("input[name=backup_option]").change(function(){b(".backup-tables-wrap").hide(),"backup_manual_select"===b(this).val()&&b(".backup-tables-wrap").show()}),b("#backup-manual-select").is(":checked")&&b(".backup-tables-wrap").show(),b(".plugin-compatibility-save").click(function(){if(!H){b(this).addClass("disabled");var a=b("#selected-plugins");b(a).attr("disabled","disabled"),b(".plugin-compatibility-success-msg").remove(),H=!0,b(this).after('<img src="'+ba+'" alt="" class="plugin-compatibility-spinner general-spinner" />'),b.ajax({url:ajaxurl,type:"POST",dataType:"text",cache:!1,data:{action:"wpmdb_blacklist_plugins",blacklist_plugins:b(a).val()},error:function(c,d,e){alert(wpmdb_strings.blacklist_problem+"\r\n\r\n"+wpmdb_strings.status+" "+c.status+" "+c.statusText+"\r\n\r\n"+wpmdb_strings.response+"\r\n"+c.responseText),b(a).removeAttr("disabled"),b(".plugin-compatibility-save").removeClass("disabled"),H=!1,b(".plugin-compatibility-spinner").remove()},success:function(c){""!==b.trim(c)&&alert(c),b(a).removeAttr("disabled"),b(".plugin-compatibility-save").removeClass("disabled"),H=!1,b(".plugin-compatibility-spinner").remove(),b(".plugin-compatibility-save").after('<span class="plugin-compatibility-success-msg">'+wpmdb_strings.saved+"</span>"),b(".plugin-compatibility-success-msg").fadeOut(2e3)}})}}),b("body").on("click",".delete-profile",function(){var a=b(this).next().clone();b("input",a).remove(),a=b.trim(b(a).html());var c=confirm(wpmdb_strings.remove_profile.replace("{{profile}}",a));if(c){var d=b(this).parent();if(d.find("input:checked").length){var e=d.siblings().last();if(e.find("input[type=radio]").prop("checked","checked"),e.find("input[type=text]").focus(),b("#migrate-form .crumbs .crumb:last").text("New Profile"),"function"==typeof window.history.pushState){var f=window.location.href.replace("#migrate","").replace(/&wpmdb-profile=-?\d+/,"")+"&wpmdb-profile=-1";window.history.pushState({updated_profile_id:-1},null,f)}}d.fadeOut(500),b.ajax({url:ajaxurl,type:"POST",dataType:"text",cache:!1,data:{action:"wpmdb_delete_migration_profile",profile_id:b(this).attr("data-profile-id"),nonce:wpmdb_data.nonces.delete_migration_profile},error:function(a,b,c){alert(wpmdb_strings.remove_profile_problem)},success:function(a){"-1"===a&&alert(wpmdb_strings.remove_profile_not_found)}})}}),b(".main-list-delete-profile-link").click(function(){var a=b(this).prev().html(),c=confirm(wpmdb_strings.remove_profile.replace("{{profile}}",a));c&&(b(this).parent().fadeOut(500),b.ajax({url:ajaxurl,type:"POST",dataType:"text",cache:!1,data:{action:"wpmdb_delete_migration_profile",profile_id:b(this).attr("data-profile-id"),nonce:wpmdb_data.nonces.delete_migration_profile},error:function(a,b,c){alert(wpmdb_strings.remove_profile_problem)}}))}),b("body").on("click",".temp-disabled",function(){var a=confirm(wpmdb_strings.change_connection_info);a&&(b(".ssl-notice").hide(),b(".different-plugin-version-notice").hide(),b(".migrate-db-button").show(),b(".temp-disabled").removeAttr("readonly"),b(".temp-disabled").removeClass("temp-disabled"),b(".connect-button").show(),b(".step-two").hide(),b(".connection-status").show().html(wpmdb_strings.enter_connection_info),B=!1)}),b(".settings-tab input[type=checkbox]").change(function(){if("plugin-compatibility"!==b(this).attr("id")){var a=b(this).is(":checked"),c=b(this).attr("id"),d=b(this).closest("td").next("td").find(".setting-status");b(".ajax-success-msg").remove(),d.after(ca),b.ajax({url:ajaxurl,type:"POST",dataType:"text",cache:!1,data:{action:"wpmdb_save_setting",checked:a,setting:c,nonce:wpmdb_data.nonces.save_setting},error:function(a,c,d){alert(wpmdb_strings.save_settings_problem),b(".ajax-spinner").remove()},success:function(a){b(".ajax-spinner").remove(),d.append('<span class="ajax-success-msg">'+wpmdb_strings.saved+"</span>"),b(".ajax-success-msg").fadeOut(2e3,function(){b(this).remove()})}})}}),b(".migrate-form").submit(function(a){a.preventDefault()}),b(".connect-button").click(function(a){a.preventDefault(),b(this).blur(),sa()}),b(".pull-push-connection-info").bind("paste",function(a){setTimeout(function(){sa()},0)}),b("body").on("click",".try-again",function(){sa()}),b("body").on("click",".try-http",function(){var a=b.trim(b(".pull-push-connection-info").val()).split("\n"),c=a[0].replace("https","http"),d=c+"\n"+a[1];b(".pull-push-connection-info").val(d),sa()}),b(".create-new-profile").change(function(){I=!0}),b("body").on("click",".temporarily-disable-ssl",function(){var a="";window.location.hash&&(a=window.location.hash.substring(1)),b(this).attr("href",b(this).attr("href")+"&hash="+a)}),b("body").on("click",".pause-resume",function(a){o(a)}),b("body").on("click",".cancel",function(a){ta(a)}),b(".enter-licence").click(function(){b(".settings").click(),b(".licence-input").focus()}),c.functions.execute_next_step=function(){if(Y>0&&!1===X)return void setTimeout(function(){X=!0,c.functions.execute_next_step()},Y);if(X=!1,!0===S){b(".migration-progress-ajax-spinner").hide(),c.current_migration.pauseTimer();var a="";return!0===_?(a=wpmdb_strings.paused_before_finalize,_=!1):a=wpmdb_strings.paused,c.current_migration.setState(null,a,"paused"),b("body").on("click",".pause-resume",function(a){o(a)}),b("body").on("click",".cancel",function(a){ta(a)}),void b(".pause-resume").html(wpmdb_strings.resume)}if(!0===W){v=wpmdb_migration_type();var d;"savefile"===v?d=wpmdb_strings.removing_local_sql:"pull"===v?d="backup"===z?wpmdb_strings.removing_local_backup:wpmdb_strings.removing_local_temp_tables:"push"===v&&(d="backup"===z?wpmdb_strings.removing_remote_sql:wpmdb_strings.removing_remote_temp_tables),c.current_migration.setText(d);var e={action:"wpmdb_cancel_migration",migration_state_id:c.migration_state_id};D=!0,b.ajax({url:ajaxurl,type:"POST",dataType:"text",cache:!1,data:e,error:function(a,b,d){c.current_migration.setState(wpmdb_strings.migration_cancellation_failed,wpmdb_strings.manually_remove_temp_files+"<br /><br />"+wpmdb_strings.status+": "+a.status+" "+a.statusText+"<br /><br />"+wpmdb_strings.response+":<br />"+a.responseText,"error"),console.log(a),console.log(b),console.log(d),D=!1,c.common.migration_error=!0,c.functions.migration_complete_events()},success:function(a){return D=!1,a=b.trim(a),"push"===v&&"1"!==a||"push"!==v&&""!==a?(c.current_migration.setState(wpmdb_strings.migration_cancellation_failed,a,"error"),c.common.migration_error=!0,void c.functions.migration_complete_events()):(A=wpmdb_strings.migration_cancelled,c.functions.migration_complete_events(),void c.current_migration.setStatus("cancelled"))}})}else c.common.next_step_in_migration.fn.apply(null,c.common.next_step_in_migration.args)},b("body").on("click",".copy-licence-to-remote-site",function(){b(".connection-status").html(wpmdb_strings.copying_license),b(".connection-status").removeClass("notification-message error-notice migration-error"),b(".connection-status").append(ca);var a=b.trim(b(".pull-push-connection-info").val()).split("\n");D=!0,l(),b.ajax({url:ajaxurl,type:"POST",dataType:"json",cache:!1,data:{action:"wpmdb_copy_licence_to_remote_site",url:a[0],key:a[1],nonce:wpmdb_data.nonces.copy_licence_to_remote_site},error:function(a,c,d){b(".connection-status").html(oa(a.responseText,"(#143)",a)),b(".connection-status").addClass("notification-message error-notice migration-error"),b(".ajax-spinner").remove(),D=!1,m()},success:function(a){return b(".ajax-spinner").remove(),D=!1,m(),"undefined"!=typeof a.wpmdb_error&&1===a.wpmdb_error?(b(".connection-status").html(a.body),b(".connection-status").addClass("notification-message error-notice migration-error"),void(a.body.indexOf("401 Unauthorized")>-1&&b(".basic-access-auth-wrapper").show())):void sa()}})}),b("body").on("click",".reactivate-licence",function(a){D=!0,b(".invalid-licence").empty().html(wpmdb_strings.attempting_to_activate_licence),b(".invalid-licence").append(ca),b.ajax({url:ajaxurl,type:"POST",dataType:"json",cache:!1,data:{action:"wpmdb_reactivate_licence",nonce:wpmdb_data.nonces.reactivate_licence},error:function(a,c,d){b(".invalid-licence").html(wpmdb_strings.activate_licence_problem),b(".invalid-licence").append("<br /><br />"+wpmdb_strings.status+": "+a.status+" "+a.statusText+"<br /><br />"+wpmdb_strings.response+"<br />"+a.responseText),b(".ajax-spinner").remove(),D=!1},success:function(a){return b(".ajax-spinner").remove(),D=!1,"undefined"!=typeof a.wpmdb_error&&1===a.wpmdb_error?void b(".invalid-licence").html(a.body):"undefined"!=typeof a.wpmdb_dbrains_api_down&&1===a.wpmdb_dbrains_api_down?(b(".invalid-licence").html(wpmdb_strings.temporarily_activated_licence),void b(".invalid-licence").append(a.body)):(b(".invalid-licence").empty().html(wpmdb_strings.licence_reactivated),void location.reload())}})}),b("input[name=table_migrate_option]").change(function(){h(),b.wpmdb.do_action("wpmdb_tables_to_migrate_changed")}),b("body").on("change","#select-tables",function(){h(),b.wpmdb.do_action("wpmdb_tables_to_migrate_changed")}),b.wpmdb.add_filter("wpmdb_get_table_prefix",r),b.wpmdb.add_filter("wpmdb_get_tables_to_migrate",q),b.wpmdb.add_action("wpmdb_lock_replace_url",s),b.wpmdb.add_filter("wpmdb_before_migration_complete_hooks",function(a){return $=b("input[name=pause_before_finalize]:checked").length?!0:!1,!0===$&&"savefile"!==v&&(o(null),_=!0),a}),b(".wpmdb-switch").on("click",function(a){b(this).hasClass("disabled")||ua(b(this).attr("id"))})})}(jQuery,wpmdb)},{"MigrationProgress-controller":1}]},{},[1,2,3,4,5,6,7,8,9]);
 
 
 
class/wpmdb-base.php CHANGED
@@ -157,16 +157,16 @@ class WPMDB_Base {
157
  $this->addons = array(
158
  'wp-migrate-db-pro-media-files/wp-migrate-db-pro-media-files.php' => array(
159
  'name' => 'Media Files',
160
- 'required_version' => '1.4.4',
161
  ),
162
  'wp-migrate-db-pro-cli/wp-migrate-db-pro-cli.php' => array(
163
  'name' => 'CLI',
164
- 'required_version' => '1.2.4',
165
  ),
166
  'wp-migrate-db-pro-multisite-tools/wp-migrate-db-pro-multisite-tools.php' => array(
167
  'name' => 'Multisite Tools',
168
- 'required_version' => '1.1.2',
169
- )
170
  );
171
 
172
  $this->invalid_content_verification_error = __( 'Invalid content verification signature, please verify the connection information on the remote site and try again.', 'wp-migrate-db' );
@@ -380,6 +380,10 @@ class WPMDB_Base {
380
  if ( ! defined( 'WP_ACCESSIBLE_HOSTS' ) || ( defined( 'WP_ACCESSIBLE_HOSTS' ) && ! in_array( $host, explode( ',', WP_ACCESSIBLE_HOSTS ) ) ) ) {
381
  $this->error = sprintf( __( 'We\'ve detected that <code>WP_HTTP_BLOCK_EXTERNAL</code> is enabled and the host <strong>%1$s</strong> has not been added to <code>WP_ACCESSIBLE_HOSTS</code>. Please disable <code>WP_HTTP_BLOCK_EXTERNAL</code> or add <strong>%1$s</strong> to <code>WP_ACCESSIBLE_HOSTS</code> to continue. <a href="%2$s" target="_blank">More information</a>. (#147 - scope: %3$s)', 'wp-migrate-db' ), esc_attr( $host ), 'https://deliciousbrains.com/wp-migrate-db-pro/doc/wp_http_block_external/', $scope );
382
  }
 
 
 
 
383
  } else {
384
  $this->error = sprintf( __( 'The connection failed, an unexpected error occurred, please contact support. (#121 - scope: %s)', 'wp-migrate-db' ), $scope );
385
  }
@@ -388,13 +392,13 @@ class WPMDB_Base {
388
 
389
  return false;
390
  } elseif ( 200 > (int) $response['response']['code'] || 399 < (int) $response['response']['code'] ) {
391
- if ( 0 === strpos( $url, 'https://' ) && 'ajax_verify_connection_to_remote_site' == $scope ) {
392
- return $this->retry_remote_post( $url, $data, $scope, $args, $expecting_serial );
393
- } elseif ( '401' == $response['response']['code'] ) {
394
  $this->error = __( 'The remote site is protected with Basic Authentication. Please enter the username and password above to continue. (401 Unauthorized)', 'wp-migrate-db' );
395
  $this->log_error( $this->error, $response );
396
 
397
  return false;
 
 
398
  } else {
399
  $this->error = sprintf( __( 'Unable to connect to the remote server, please check the connection details - %1$s %2$s (#129 - scope: %3$s)', 'wp-migrate-db' ), $response['response']['code'], $response['response']['message'], $scope );
400
  $this->log_error( $this->error, $response );
@@ -422,14 +426,16 @@ class WPMDB_Base {
422
  $this->log_error( $this->error, $response );
423
 
424
  return false;
425
- } elseif ( $expecting_serial && true == is_serialized( $response['body'] ) && 'ajax_verify_connection_to_remote_site' == $scope ) {
426
- $unserialized_response = unserialize( $response['body'] );
427
- if ( isset( $unserialized_response['error'] ) && '1' == $unserialized_response['error'] && 0 === strpos( $url, 'https://' ) ) {
428
- return $this->retry_remote_post( $url, $data, $scope, $args, $expecting_serial );
 
 
429
  }
430
  }
431
 
432
- return $response['body'];
433
  }
434
 
435
  function retry_remote_post( $url, $data, $scope, $args = array(), $expecting_serial = false ) {
@@ -501,6 +507,29 @@ class WPMDB_Base {
501
 
502
  $this->load_error_log();
503
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
504
  if ( isset( $this->error_log ) ) {
505
  $this->error_log .= $error;
506
  } else {
@@ -1213,6 +1242,7 @@ class WPMDB_Base {
1213
  } elseif ( 'all' === $context ) {
1214
  $message = $contextual_messages;
1215
  }
 
1216
  } elseif ( isset( $errors['no_activations_left'] ) ) {
1217
  $message = sprintf( __( '<strong>No Activations Left</strong> &mdash; Please visit <a href="%s" target="_blank">My Account</a> to upgrade your license or deactivate a previous activation and enable push and pull.', 'wp-migrate-db' ), 'https://deliciousbrains.com/my-account/' );
1218
  $message .= sprintf( ' <a href="%s" class="check-my-licence-again">%s</a>', $check_licence_again_url, __( 'Check my license again', 'wp-migrate-db' ) );
@@ -1744,10 +1774,16 @@ class WPMDB_Base {
1744
  return $subsites;
1745
  }
1746
 
1747
- $sites = wp_get_sites( array( 'limit' => 0 ) );
 
 
 
 
 
1748
 
1749
  if ( ! empty( $sites ) ) {
1750
- foreach ( $sites as $subsite ) {
 
1751
  $subsites[ $subsite['blog_id'] ] = $this->simple_site_url( get_blogaddress_by_id( $subsite['blog_id'] ) );
1752
  }
1753
  }
@@ -1797,13 +1833,18 @@ class WPMDB_Base {
1797
  return $subsites;
1798
  }
1799
 
1800
- $sites = wp_get_sites( array( 'limit' => 0 ) );
 
 
 
 
1801
 
1802
  if ( ! empty( $sites ) ) {
1803
  // We to fix up the urls in uploads as they all use primary site's base!
1804
  $primary_url = site_url();
1805
 
1806
  foreach ( $sites as $subsite ) {
 
1807
  $subsites[ $subsite['blog_id'] ]['site_url'] = get_site_url( $subsite['blog_id'] );
1808
  $subsites[ $subsite['blog_id'] ]['uploads'] = $this->uploads_info( $subsite['blog_id'] );
1809
 
157
  $this->addons = array(
158
  'wp-migrate-db-pro-media-files/wp-migrate-db-pro-media-files.php' => array(
159
  'name' => 'Media Files',
160
+ 'required_version' => '1.4.5',
161
  ),
162
  'wp-migrate-db-pro-cli/wp-migrate-db-pro-cli.php' => array(
163
  'name' => 'CLI',
164
+ 'required_version' => '1.2.5',
165
  ),
166
  'wp-migrate-db-pro-multisite-tools/wp-migrate-db-pro-multisite-tools.php' => array(
167
  'name' => 'Multisite Tools',
168
+ 'required_version' => '1.1.3',
169
+ ),
170
  );
171
 
172
  $this->invalid_content_verification_error = __( 'Invalid content verification signature, please verify the connection information on the remote site and try again.', 'wp-migrate-db' );
380
  if ( ! defined( 'WP_ACCESSIBLE_HOSTS' ) || ( defined( 'WP_ACCESSIBLE_HOSTS' ) && ! in_array( $host, explode( ',', WP_ACCESSIBLE_HOSTS ) ) ) ) {
381
  $this->error = sprintf( __( 'We\'ve detected that <code>WP_HTTP_BLOCK_EXTERNAL</code> is enabled and the host <strong>%1$s</strong> has not been added to <code>WP_ACCESSIBLE_HOSTS</code>. Please disable <code>WP_HTTP_BLOCK_EXTERNAL</code> or add <strong>%1$s</strong> to <code>WP_ACCESSIBLE_HOSTS</code> to continue. <a href="%2$s" target="_blank">More information</a>. (#147 - scope: %3$s)', 'wp-migrate-db' ), esc_attr( $host ), 'https://deliciousbrains.com/wp-migrate-db-pro/doc/wp_http_block_external/', $scope );
382
  }
383
+ } elseif ( isset( $response->errors['http_request_failed'][0] ) && strstr( $response->errors['http_request_failed'][0], 'port 443: Connection refused' ) ) {
384
+ $this->error = sprintf( __( 'Couldn\'t connect over HTTPS. You might want to try regular HTTP instead. (#121 - scope: %s)', 'wp-migrate-db' ), $scope );
385
+ } elseif ( isset( $response->errors['http_request_failed'][0] ) && strstr( $response->errors['http_request_failed'][0], 'SSL' ) ) { // OpenSSL/cURL/MAMP Error
386
+ $this->error = sprintf( __( '<strong>SSL Connection error:</strong> (#121 - scope: %s) This typically means that the version of SSL that your local site is using to connect to the remote is incompatible or, more likely, being rejected by the remote server because it\'s insecure. <a href="%s" target="_blank">See our documentation</a> for possible solutions.', 'wp-migrate-db' ), $scope, 'https://deliciousbrains.com/wp-migrate-db-pro/doc/ssl-errors/' );
387
  } else {
388
  $this->error = sprintf( __( 'The connection failed, an unexpected error occurred, please contact support. (#121 - scope: %s)', 'wp-migrate-db' ), $scope );
389
  }
392
 
393
  return false;
394
  } elseif ( 200 > (int) $response['response']['code'] || 399 < (int) $response['response']['code'] ) {
395
+ if ( 401 === (int) $response['response']['code'] ) {
 
 
396
  $this->error = __( 'The remote site is protected with Basic Authentication. Please enter the username and password above to continue. (401 Unauthorized)', 'wp-migrate-db' );
397
  $this->log_error( $this->error, $response );
398
 
399
  return false;
400
+ } elseif ( 0 === strpos( $url, 'https://' ) && 'ajax_verify_connection_to_remote_site' == $scope ) {
401
+ return $this->retry_remote_post( $url, $data, $scope, $args, $expecting_serial );
402
  } else {
403
  $this->error = sprintf( __( 'Unable to connect to the remote server, please check the connection details - %1$s %2$s (#129 - scope: %3$s)', 'wp-migrate-db' ), $response['response']['code'], $response['response']['message'], $scope );
404
  $this->log_error( $this->error, $response );
426
  $this->log_error( $this->error, $response );
427
 
428
  return false;
429
+ } elseif ( $expecting_serial && 'ajax_verify_connection_to_remote_site' == $scope ) {
430
+ $unserialized_response = WPMDB_Utils::unserialize( $response['body'], __METHOD__ );
431
+ if ( false !== $unserialized_response && isset( $unserialized_response['error'] ) && '1' == $unserialized_response['error'] && 0 === strpos( $url, 'https://' ) ) {
432
+ if ( 0 === strpos( $unserialized_response, '(#122)' ) ) {
433
+ return $this->retry_remote_post( $url, $data, $scope, $args, $expecting_serial );
434
+ }
435
  }
436
  }
437
 
438
+ return trim( $response['body'] );
439
  }
440
 
441
  function retry_remote_post( $url, $data, $scope, $args = array(), $expecting_serial = false ) {
507
 
508
  $this->load_error_log();
509
 
510
+ // Error log length in bytes (default 1Mb)
511
+ $max_log_length = apply_filters( 'wpmdb_max_error_log_length', 1000000 );
512
+ $max_individual_log_length = apply_filters( 'wpmdb_max_individual_error_log_length', $max_log_length / 2.2 );
513
+
514
+ // If error is longer than max individual log length, trim and add notice of doing so
515
+ if ( strlen( $error ) > $max_individual_log_length ) {
516
+ $length_trimmed = strlen( $error ) - $max_individual_log_length;
517
+ $error = substr( $error, 0, $max_individual_log_length );
518
+ $error .= "\n[$length_trimmed bytes were truncated from this error]\n\n";
519
+ }
520
+
521
+ // Trim existing log to accommodate new error if needed
522
+ $existing_log_max_length = $max_log_length - strlen( $error );
523
+ if ( strlen( $this->error_log ) > $existing_log_max_length ) {
524
+ $this->error_log = substr( $this->error_log, -( $existing_log_max_length ) );
525
+
526
+ // Crop at first log header
527
+ $first_header_pos = strpos( $this->error_log, substr( $error_header, 0, strpos( $error_header, ' ' ) ) );
528
+ if ( $first_header_pos ) {
529
+ $this->error_log = substr( $this->error_log, $first_header_pos );
530
+ }
531
+ }
532
+
533
  if ( isset( $this->error_log ) ) {
534
  $this->error_log .= $error;
535
  } else {
1242
  } elseif ( 'all' === $context ) {
1243
  $message = $contextual_messages;
1244
  }
1245
+
1246
  } elseif ( isset( $errors['no_activations_left'] ) ) {
1247
  $message = sprintf( __( '<strong>No Activations Left</strong> &mdash; Please visit <a href="%s" target="_blank">My Account</a> to upgrade your license or deactivate a previous activation and enable push and pull.', 'wp-migrate-db' ), 'https://deliciousbrains.com/my-account/' );
1248
  $message .= sprintf( ' <a href="%s" class="check-my-licence-again">%s</a>', $check_licence_again_url, __( 'Check my license again', 'wp-migrate-db' ) );
1774
  return $subsites;
1775
  }
1776
 
1777
+
1778
+ if ( version_compare( $GLOBALS['wp_version'], '4.6', '>=' ) ) {
1779
+ $sites = get_sites( array( 'limit' => 0 ) );
1780
+ } else {
1781
+ $sites = wp_get_sites( array( 'limit' => 0 ) );
1782
+ }
1783
 
1784
  if ( ! empty( $sites ) ) {
1785
+ foreach ( (array) $sites as $subsite ) {
1786
+ $subsite = (array) $subsite;
1787
  $subsites[ $subsite['blog_id'] ] = $this->simple_site_url( get_blogaddress_by_id( $subsite['blog_id'] ) );
1788
  }
1789
  }
1833
  return $subsites;
1834
  }
1835
 
1836
+ if ( version_compare( $GLOBALS['wp_version'], '4.6', '>=' ) ) {
1837
+ $sites = get_sites( array( 'limit' => 0 ) );
1838
+ } else {
1839
+ $sites = wp_get_sites( array( 'limit' => 0 ) );
1840
+ }
1841
 
1842
  if ( ! empty( $sites ) ) {
1843
  // We to fix up the urls in uploads as they all use primary site's base!
1844
  $primary_url = site_url();
1845
 
1846
  foreach ( $sites as $subsite ) {
1847
+ $subsite = (array) $subsite;
1848
  $subsites[ $subsite['blog_id'] ]['site_url'] = get_site_url( $subsite['blog_id'] );
1849
  $subsites[ $subsite['blog_id'] ]['uploads'] = $this->uploads_info( $subsite['blog_id'] );
1850
 
class/wpmdb-cli.php CHANGED
@@ -46,6 +46,8 @@ class WPMDB_CLI extends WPMDB_Base {
46
 
47
  global $wpmdb;
48
  $this->wpmdb = $wpmdb;
 
 
49
  }
50
 
51
  /**
@@ -63,18 +65,15 @@ class WPMDB_CLI extends WPMDB_Base {
63
  if ( is_array( $profile ) ) {
64
  $query_str = http_build_query( $profile );
65
  $profile = $this->wpmdb->parse_migration_form_data( $query_str );
66
- $profile = wp_parse_args(
67
- $profile,
68
- array(
69
- 'save_computer' => '0',
70
- 'gzip_file' => '0',
71
- 'replace_guids' => '0',
72
- 'exclude_transients' => '0',
73
- 'exclude_spam' => '0',
74
- 'keep_active_plugins' => '0',
75
- 'compatibility_older_mysql' => '0',
76
- )
77
- );
78
  }
79
 
80
  $this->profile = $profile = apply_filters( 'wpmdb_cli_profile_before_migration', $profile );
@@ -117,6 +116,10 @@ class WPMDB_CLI extends WPMDB_Base {
117
  }
118
  }
119
 
 
 
 
 
120
  // Ensure local site_details available.
121
  $this->post_data['site_details']['local'] = $this->site_details();
122
 
@@ -146,7 +149,9 @@ class WPMDB_CLI extends WPMDB_Base {
146
  return $this->profile;
147
  }
148
 
 
149
  $this->migration = $this->cli_initiate_migration();
 
150
  if ( is_wp_error( $this->migration ) ) {
151
  return $this->migration;
152
  }
@@ -246,6 +251,11 @@ class WPMDB_CLI extends WPMDB_Base {
246
  $migration_args['stage'] = 'migrate';
247
  $migration_args['site_details']['local'] = $this->site_details();
248
 
 
 
 
 
 
249
  $this->post_data = apply_filters( 'wpmdb_cli_initiate_migration_args', $migration_args, $this->profile );
250
 
251
  $this->post_data['site_details'] = json_encode( $this->post_data['site_details'] );
@@ -283,6 +293,10 @@ class WPMDB_CLI extends WPMDB_Base {
283
 
284
  $progress_label = __( 'Exporting tables', 'wp-migrate-db-cli' );
285
 
 
 
 
 
286
  $progress_label = apply_filters( 'wpmdb_cli_progress_label', $progress_label, $stage, $tables );
287
 
288
  $progress_label = str_pad( $progress_label, 20, ' ' );
@@ -343,7 +357,10 @@ class WPMDB_CLI extends WPMDB_Base {
343
  $tables = $tables_to_migrate;
344
  $stage_iterator = 2;
345
 
346
- $filtered_vars = apply_filters( 'wpmdb_cli_filter_before_migrate_tables', array( 'tables' => $tables, 'stage_iterator' => $stage_iterator ) );
 
 
 
347
  if ( ! is_array( $filtered_vars ) ) {
348
  return $filtered_vars;
349
  } else {
@@ -401,14 +418,14 @@ class WPMDB_CLI extends WPMDB_Base {
401
  $migration_progress += $table_rows[ $table ];
402
  } else {
403
  if ( 0 === $table_progress_last ) {
404
- $table_progress_last = $current_row;
405
- $table_progress = $table_progress_last;
406
- $migration_progress += $table_progress_last;
407
  } else {
408
- $iteration_progress = $current_row - $table_progress_last;
409
- $table_progress_last = $current_row;
410
- $table_progress += $iteration_progress;
411
- $migration_progress += $iteration_progress;
412
  }
413
  }
414
 
@@ -496,6 +513,23 @@ class WPMDB_CLI extends WPMDB_Base {
496
  return $response;
497
  }
498
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
499
  /**
500
  * Finalize Export by moving file to specified destination
501
  *
@@ -517,6 +551,152 @@ class WPMDB_CLI extends WPMDB_Base {
517
 
518
  return $response;
519
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
520
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
521
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
522
  }
46
 
47
  global $wpmdb;
48
  $this->wpmdb = $wpmdb;
49
+
50
+ add_filter( 'wpmdb_cli_finalize_migration_response', array( $this, 'finalize_ajax' ), 10, 1 );
51
  }
52
 
53
  /**
65
  if ( is_array( $profile ) ) {
66
  $query_str = http_build_query( $profile );
67
  $profile = $this->wpmdb->parse_migration_form_data( $query_str );
68
+ $profile = wp_parse_args( $profile, array(
69
+ 'save_computer' => '0',
70
+ 'gzip_file' => '0',
71
+ 'replace_guids' => '0',
72
+ 'exclude_transients' => '0',
73
+ 'exclude_spam' => '0',
74
+ 'keep_active_plugins' => '0',
75
+ 'compatibility_older_mysql' => '0',
76
+ ) );
 
 
 
77
  }
78
 
79
  $this->profile = $profile = apply_filters( 'wpmdb_cli_profile_before_migration', $profile );
116
  }
117
  }
118
 
119
+ if ( 'find_replace' === $this->profile['action'] ) {
120
+ $this->post_data['intent'] = 'find_replace';
121
+ }
122
+
123
  // Ensure local site_details available.
124
  $this->post_data['site_details']['local'] = $this->site_details();
125
 
149
  return $this->profile;
150
  }
151
 
152
+ do_action( 'wpmdb_cli_before_migration', $this->post_data, $this->profile );
153
  $this->migration = $this->cli_initiate_migration();
154
+
155
  if ( is_wp_error( $this->migration ) ) {
156
  return $this->migration;
157
  }
251
  $migration_args['stage'] = 'migrate';
252
  $migration_args['site_details']['local'] = $this->site_details();
253
 
254
+ if ( 'find_replace' === $this->profile['action'] ) {
255
+ $migration_args['stage'] = 'find_replace';
256
+
257
+ }
258
+
259
  $this->post_data = apply_filters( 'wpmdb_cli_initiate_migration_args', $migration_args, $this->profile );
260
 
261
  $this->post_data['site_details'] = json_encode( $this->post_data['site_details'] );
293
 
294
  $progress_label = __( 'Exporting tables', 'wp-migrate-db-cli' );
295
 
296
+ if ( 'find_replace' === $this->profile['action'] ) {
297
+ $progress_label = __( 'Running find & replace', 'wp-migrate-db-cli' );
298
+ }
299
+
300
  $progress_label = apply_filters( 'wpmdb_cli_progress_label', $progress_label, $stage, $tables );
301
 
302
  $progress_label = str_pad( $progress_label, 20, ' ' );
357
  $tables = $tables_to_migrate;
358
  $stage_iterator = 2;
359
 
360
+ $filtered_vars = apply_filters( 'wpmdb_cli_filter_before_migrate_tables', array(
361
+ 'tables' => $tables,
362
+ 'stage_iterator' => $stage_iterator,
363
+ ) );
364
  if ( ! is_array( $filtered_vars ) ) {
365
  return $filtered_vars;
366
  } else {
418
  $migration_progress += $table_rows[ $table ];
419
  } else {
420
  if ( 0 === $table_progress_last ) {
421
+ $table_progress_last = $current_row;
422
+ $table_progress = $table_progress_last;
423
+ $migration_progress += $table_progress_last;
424
  } else {
425
+ $iteration_progress = $current_row - $table_progress_last;
426
+ $table_progress_last = $current_row;
427
+ $table_progress += $iteration_progress;
428
+ $migration_progress += $iteration_progress;
429
  }
430
  }
431
 
513
  return $response;
514
  }
515
 
516
+ /**
517
+ * Stub for ajax_finalize_migration()
518
+ * hooks on: wpmdb_cli_finalize_migration_response
519
+ *
520
+ * @param string $response
521
+ *
522
+ * @return string
523
+ */
524
+ function finalize_ajax( $response ) {
525
+ // don't send redundant POST variables
526
+ $args = $this->filter_post_elements( $this->post_data, array( 'action', 'migration_state_id', 'prefix', 'tables' ) );
527
+ $_POST = $args;
528
+ $response = $this->wpmdb->ajax_finalize_migration();
529
+
530
+ return trim( $response );
531
+ }
532
+
533
  /**
534
  * Finalize Export by moving file to specified destination
535
  *
551
 
552
  return $response;
553
  }
554
+ /**
555
+ * Returns array of CLI options that are unknown to plugin and addons.
556
+ *
557
+ * @param array $assoc_args
558
+ *
559
+ * @return array
560
+ */
561
+ public function get_unknown_args( $assoc_args = array() ) {
562
+ $unknown_args = array();
563
+
564
+ if ( empty( $assoc_args ) ) {
565
+ return $unknown_args;
566
+ }
567
+
568
+ $known_args = array(
569
+ 'action',
570
+ 'export_dest',
571
+ 'find',
572
+ 'replace',
573
+ 'exclude-spam',
574
+ 'gzip-file',
575
+ 'exclude-post-revisions',
576
+ 'skip-replace-guids',
577
+ 'include-transients',
578
+ );
579
+
580
+ $known_args = apply_filters( 'wpmdb_cli_filter_get_extra_args', $known_args );
581
+ $unknown_args = array_diff( array_keys( $assoc_args ), $known_args );
582
+
583
+ return $unknown_args;
584
+ }
585
+
586
+ /**
587
+ * Get profile data from CLI args.
588
+ *
589
+ * @param array $args
590
+ * @param array $assoc_args
591
+ *
592
+ * @return array|WP_Error
593
+ */
594
+ public function get_profile_data_from_args( $args, $assoc_args ) {
595
 
596
+ //load correct cli class
597
+ if ( function_exists( 'wp_migrate_db_pro_cli_addon' ) ) {
598
+ $wpmdb_cli = wp_migrate_db_pro_cli_addon();
599
+ } elseif ( function_exists( 'wpmdb_pro_cli' ) ) {
600
+ $wpmdb_cli = wpmdb_pro_cli();
601
+ } else {
602
+ $wpmdb_cli = wpmdb_cli();
603
+ }
604
+
605
+ $unknown_args = $this->get_unknown_args( $assoc_args );
606
+
607
+ if ( ! empty( $unknown_args ) ) {
608
+ $message = __( 'Parameter errors: ', 'wp-migrate-db-cli' );
609
+ foreach ( $unknown_args as $unknown_arg ) {
610
+ $message .= "\n " . sprintf( __( 'unknown %s parameter', 'wp-migrate-db-cli' ), '--' . $unknown_arg );
611
+ }
612
 
613
+ if ( is_a( $wpmdb_cli, 'WPMDBPro_CLI' ) ) {
614
+ $message .= "\n" . __( 'Please make sure that you have activated the appropriate addons for WP Migrate DB Pro.', 'wp-migrate-db-cli' );
615
+ }
616
+
617
+ return $wpmdb_cli->cli_error( $message );
618
+ }
619
+
620
+ if ( empty( $assoc_args['action'] ) ) {
621
+ return $wpmdb_cli->cli_error( __( 'Missing action parameter', 'wp-migrate-db-cli' ) );
622
+ }
623
+
624
+ if ( 'savefile' === $assoc_args['action'] && ! empty( $assoc_args['export_dest'] ) ) {
625
+ $export_dest = $assoc_args['export_dest'];
626
+ }
627
+
628
+ $action = $assoc_args['action'];
629
+
630
+ // --find=<old> and --replace=<new>
631
+ $replace_old = array();
632
+ $replace_new = array();
633
+ if ( ! empty( $assoc_args['find'] ) ) {
634
+ $replace_old = str_getcsv( $assoc_args['find'] );
635
+ } else {
636
+ if ( 'find_replace' === $assoc_args['action'] ) {
637
+ return $wpmdb_cli->cli_error( __( 'Missing find and replace values.', 'wp-migrate-db-cli' ) );
638
+ }
639
+ }
640
+ if ( ! empty( $assoc_args['replace'] ) ) {
641
+ $replace_new = str_getcsv( $assoc_args['replace'] );
642
+ }
643
+ if ( count( $replace_old ) !== count( $replace_new ) ) {
644
+ return $wpmdb_cli->cli_error( sprintf( __( '%1$s and %2$s must contain the same number of values', 'wp-migrate-db-cli' ), '--find', '--replace' ) );
645
+ }
646
+ array_unshift( $replace_old, '' );
647
+ array_unshift( $replace_new, '' );
648
+
649
+ // --exclude-spam
650
+ $exclude_spam = intval( isset( $assoc_args['exclude-spam'] ) );
651
+
652
+ // --gzip-file
653
+ $gzip_file = intval( isset( $assoc_args['gzip-file'] ) );
654
+
655
+ $select_post_types = array();
656
+
657
+ // --exclude-post-revisions
658
+ if ( ! empty( $assoc_args['exclude-post-revisions'] ) ) {
659
+ $select_post_types[] = 'revision';
660
+ }
661
+
662
+ $exclude_post_types = count( $select_post_types ) > 0 ? 1 : 0;
663
+
664
+ // --skip-replace-guids
665
+ $replace_guids = 1;
666
+ if ( isset( $assoc_args['skip-replace-guids'] ) ) {
667
+ $replace_guids = 0;
668
+ }
669
+
670
+ $select_tables = array();
671
+ $table_migrate_option = 'migrate_only_with_prefix';
672
+
673
+ // --include-transients.
674
+ $exclude_transients = intval( ! isset( $assoc_args['include-transients'] ) );
675
+
676
+ //cleanup filename for exports
677
+ if ( ! empty( $export_dest ) ) {
678
+ if ( $gzip_file ) {
679
+ if ( 'gz' !== pathinfo( $export_dest, PATHINFO_EXTENSION ) ) {
680
+ if ( 'sql' === pathinfo( $export_dest, PATHINFO_EXTENSION ) ) {
681
+ $export_dest .= '.gz';
682
+ } else {
683
+ $export_dest .= '.sql.gz';
684
+ }
685
+ }
686
+ } elseif ( 'sql' !== pathinfo( $export_dest, PATHINFO_EXTENSION ) ) {
687
+ $export_dest = preg_replace( '/(\.sql)?(\.gz)?$/i', '', $export_dest ) . '.sql';
688
+ }
689
+
690
+ // ensure export destination is writable
691
+ if ( ! @touch( $export_dest ) ) {
692
+ return $wpmdb_cli->cli_error( sprintf( __( 'Cannot write to file "%1$s". Please ensure that the specified directory exists and is writable.', 'wp-migrate-db-cli' ), $export_dest ) );
693
+ }
694
+ }
695
+
696
+ $profile = compact( 'action', 'replace_old', 'table_migrate_option', 'replace_new', 'select_tables', 'exclude_post_types', 'select_post_types', 'replace_guids', 'exclude_spam', 'gzip_file', 'exclude_transients', 'export_dest' );
697
+
698
+ $profile = apply_filters( 'wpmdb_cli_filter_get_profile_data_from_args', $profile, $args, $assoc_args );
699
+
700
+ return $profile;
701
+ }
702
  }
class/wpmdb-command.php CHANGED
@@ -76,36 +76,63 @@ class WPMDB_Command extends WP_CLI_Command {
76
  }
77
 
78
  /**
79
- * Returns array of CLI options that are unknown to plugin and addons.
80
  *
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
81
  * @param array $assoc_args
82
  *
83
- * @return array
84
  */
85
- private function _get_unknown_args( $assoc_args = array() ) {
86
- $unknown_args = array();
87
 
88
- if ( empty( $assoc_args ) ) {
89
- return $unknown_args;
90
- }
91
 
92
- $known_args = array(
93
- 'action',
94
- 'export_dest',
95
- 'find',
96
- 'replace',
97
- 'exclude-spam',
98
- 'gzip-file',
99
- 'exclude-post-revisions',
100
- 'skip-replace-guids',
101
- 'include-transients',
102
- );
103
-
104
- $known_args = apply_filters( 'wpmdb_cli_filter_get_extra_args', $known_args );
105
 
106
- $unknown_args = array_diff( array_keys( $assoc_args ), $known_args );
 
 
107
 
108
- return $unknown_args;
109
  }
110
 
111
  /**
@@ -117,124 +144,20 @@ class WPMDB_Command extends WP_CLI_Command {
117
  * @return array|WP_Error
118
  */
119
  protected function _get_profile_data_from_args( $args, $assoc_args ) {
120
-
121
- //load correct cli class
122
- if ( function_exists( 'wp_migrate_db_pro_cli_addon' ) ) {
123
- $wpmdb_cli = wp_migrate_db_pro_cli_addon();
124
- } elseif ( function_exists( 'wpmdb_pro_cli' ) ) {
125
- $wpmdb_cli = wpmdb_pro_cli();
 
126
  } else {
127
  $wpmdb_cli = wpmdb_cli();
128
  }
129
 
130
- $unknown_args = $this->_get_unknown_args( $assoc_args );
131
-
132
- if ( ! empty( $unknown_args ) ) {
133
- $message = __( 'Parameter errors: ', 'wp-migrate-db-cli' );
134
- foreach ( $unknown_args as $unknown_arg ) {
135
- $message .= "\n " . sprintf( __( 'unknown %s parameter', 'wp-migrate-db-cli' ), '--' . $unknown_arg );
136
- }
137
-
138
- if ( is_a( $wpmdb_cli, 'WPMDBPro_CLI' ) ) {
139
- $message .= "\n" . __( 'Please make sure that you have activated the appropriate addons for WP Migrate DB Pro.', 'wp-migrate-db-cli' );
140
- }
141
-
142
- return $wpmdb_cli->cli_error( $message );
143
- }
144
-
145
- if ( empty( $assoc_args['action'] ) ) {
146
- return $wpmdb_cli->cli_error( __( 'Missing action parameter', 'wp-migrate-db-cli' ) );
147
- }
148
-
149
- if ( 'savefile' === $assoc_args['action'] && ! empty( $assoc_args['export_dest'] ) ) {
150
- $export_dest = $assoc_args['export_dest'];
151
- }
152
-
153
- $action = $assoc_args['action'];
154
-
155
- // --find=<old> and --replace=<new>
156
- $replace_old = array();
157
- $replace_new = array();
158
- if ( ! empty( $assoc_args['find'] ) ) {
159
- $replace_old = str_getcsv( $assoc_args['find'] );
160
- }
161
- if ( ! empty( $assoc_args['replace'] ) ) {
162
- $replace_new = str_getcsv( $assoc_args['replace'] );
163
- }
164
- if ( count( $replace_old ) !== count( $replace_new ) ) {
165
- return $wpmdb_cli->cli_error( sprintf( __( '%1$s and %2$s must contain the same number of values', 'wp-migrate-db-cli' ), '--find', '--replace' ) );
166
- }
167
- array_unshift( $replace_old, '' );
168
- array_unshift( $replace_new, '' );
169
-
170
- // --exclude-spam
171
- $exclude_spam = intval( isset( $assoc_args['exclude-spam'] ) );
172
-
173
- // --gzip-file
174
- $gzip_file = intval( isset( $assoc_args['gzip-file'] ) );
175
-
176
- $select_post_types = array();
177
-
178
- // --exclude-post-revisions
179
- if ( ! empty( $assoc_args['exclude-post-revisions'] ) ) {
180
- $select_post_types[] = 'revision';
181
- }
182
-
183
- $exclude_post_types = count( $select_post_types ) > 0 ? 1 : 0;
184
-
185
- // --skip-replace-guids
186
- $replace_guids = 1;
187
- if ( isset( $assoc_args['skip-replace-guids'] ) ) {
188
- $replace_guids = 0;
189
- }
190
-
191
- $select_tables = array();
192
- $table_migrate_option = 'migrate_only_with_prefix';
193
-
194
- // --include-transients.
195
- $exclude_transients = intval( ! isset( $assoc_args['include-transients'] ) );
196
-
197
- //cleanup filename for exports
198
- if ( ! empty( $export_dest ) ) {
199
- if ( $gzip_file ) {
200
- if ( 'gz' !== pathinfo( $export_dest, PATHINFO_EXTENSION ) ) {
201
- if ( 'sql' === pathinfo( $export_dest, PATHINFO_EXTENSION ) ) {
202
- $export_dest .= '.gz';
203
- } else {
204
- $export_dest .= '.sql.gz';
205
- }
206
- }
207
- } elseif ( 'sql' !== pathinfo( $export_dest, PATHINFO_EXTENSION ) ) {
208
- $export_dest = preg_replace( '/(\.sql)?(\.gz)?$/i', '', $export_dest ) . '.sql';
209
- }
210
-
211
- // ensure export destination is writable
212
- if ( ! @touch( $export_dest ) ) {
213
- return $wpmdb_cli->cli_error( sprintf( __( 'Cannot write to file "%1$s". Please ensure that the specified directory exists and is writable.', 'wp-migrate-db-cli' ), $export_dest ) );
214
- }
215
- }
216
-
217
- $profile = compact(
218
- 'action',
219
- 'replace_old',
220
- 'table_migrate_option',
221
- 'replace_new',
222
- 'select_tables',
223
- 'exclude_post_types',
224
- 'select_post_types',
225
- 'replace_guids',
226
- 'exclude_spam',
227
- 'gzip_file',
228
- 'exclude_transients',
229
- 'export_dest'
230
- );
231
-
232
- $profile = apply_filters( 'wpmdb_cli_filter_get_profile_data_from_args', $profile, $args, $assoc_args );
233
-
234
- return $profile;
235
  }
236
 
237
-
238
  /**
239
  * Perform CLI migration.
240
  *
@@ -254,13 +177,20 @@ class WPMDB_Command extends WP_CLI_Command {
254
 
255
  if ( empty( $wpmdb_cli ) ) {
256
  WP_CLI::error( __( 'WP Migrate DB CLI class not available.', 'wp-migrate-db-cli' ) );
 
257
  return;
258
  }
259
 
260
  $result = $wpmdb_cli->cli_migration( $profile );
261
 
262
  if ( ! is_wp_error( $result ) ) {
263
- WP_CLI::success( sprintf( __( 'Export saved to: %s', 'wp-migrate-db-cli' ), $result ) );
 
 
 
 
 
 
264
  } elseif ( is_wp_error( $result ) ) {
265
  WP_CLI::error( WPMDB_CLI::cleanup_message( $result->get_error_message() ) );
266
  }
76
  }
77
 
78
  /**
79
+ * Run a find/replace on the database.
80
  *
81
+ * ## OPTIONS
82
+ *
83
+ * [--find=<strings>]
84
+ * : A comma separated list of strings to find when performing a string find
85
+ * and replace across the database.
86
+ *
87
+ * Table names should be quoted as needed, i.e. when using a comma in the
88
+ * find/replace string.
89
+ *
90
+ * The --replace=<strings> argument should be used in conjunction to specify
91
+ * the replace values for the strings found using this argument. The number
92
+ * of strings specified in this argument should match the number passed into
93
+ * --replace=<strings> argument.
94
+ *
95
+ * [--replace=<strings>]
96
+ * : A comma separated list of replace value strings to implement when
97
+ * performing a string find & replace across the database.
98
+ *
99
+ * Should be used in conjunction with the --find=<strings> argument, see it's
100
+ * documentation for further explanation of the find & replace functionality.
101
+ *
102
+ * [--exclude-post-revisions]
103
+ * : Exclude post revisions from the find & replace.
104
+ *
105
+ * [--skip-replace-guids]
106
+ * : Do not perform a find & replace on the guid column in the wp_posts table.
107
+ *
108
+ * [--exclude-spam]
109
+ * : Exclude spam comments.
110
+ *
111
+ * [--include-transients]
112
+ * : Include transients (temporary cached data).
113
+ *
114
+ * ## EXAMPLES
115
+ *
116
+ * wp migratedb find-replace
117
+ * --find=http://dev.bradt.ca,/Users/bradt/home/bradt.ca
118
+ * --replace=http://bradt.ca,/home/bradt.ca
119
+ *
120
+ * @param array $args
121
  * @param array $assoc_args
122
  *
123
+ * @subcommand find-replace
124
  */
125
+ public function find_replace( $args, $assoc_args ) {
 
126
 
127
+ $assoc_args['action'] = 'find_replace';
 
 
128
 
129
+ $profile = $this->_get_profile_data_from_args( $args, $assoc_args );
 
 
 
 
 
 
 
 
 
 
 
 
130
 
131
+ if ( is_wp_error( $profile ) ) {
132
+ WP_CLI::error( $profile );
133
+ }
134
 
135
+ $this->_perform_cli_migration( $profile );
136
  }
137
 
138
  /**
144
  * @return array|WP_Error
145
  */
146
  protected function _get_profile_data_from_args( $args, $assoc_args ) {
147
+ // Load the correct CLI class
148
+ if ( function_exists( 'wpmdb_pro_cli' ) ) {
149
+ if ( function_exists( 'wp_migrate_db_pro_cli_addon' ) ) {
150
+ $wpmdb_cli = wp_migrate_db_pro_cli_addon();
151
+ } else {
152
+ $wpmdb_cli = wpmdb_pro_cli();
153
+ }
154
  } else {
155
  $wpmdb_cli = wpmdb_cli();
156
  }
157
 
158
+ return $wpmdb_cli->get_profile_data_from_args( $args, $assoc_args );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
159
  }
160
 
 
161
  /**
162
  * Perform CLI migration.
163
  *
177
 
178
  if ( empty( $wpmdb_cli ) ) {
179
  WP_CLI::error( __( 'WP Migrate DB CLI class not available.', 'wp-migrate-db-cli' ) );
180
+
181
  return;
182
  }
183
 
184
  $result = $wpmdb_cli->cli_migration( $profile );
185
 
186
  if ( ! is_wp_error( $result ) ) {
187
+ $success_msg = sprintf( __( 'Export saved to: %s', 'wp-migrate-db-cli' ), $result );
188
+
189
+ if ( 'find_replace' === $profile['action'] ) {
190
+ $success_msg = __( 'Find & Replace complete', 'wp-migrate-db-cli' );
191
+ }
192
+
193
+ WP_CLI::success( $success_msg );
194
  } elseif ( is_wp_error( $result ) ) {
195
  WP_CLI::error( WPMDB_CLI::cleanup_message( $result->get_error_message() ) );
196
  }
class/wpmdb-replace.php CHANGED
@@ -8,13 +8,18 @@ final class WPMDB_Replace {
8
  protected $intent;
9
  protected $base_domain;
10
  protected $site_domain;
 
 
 
 
 
11
 
12
  private $table;
13
  private $column;
14
  private $row;
15
 
16
  function __construct( $args ) {
17
- $keys = array( 'table', 'search', 'replace', 'intent', 'base_domain', 'site_domain', 'wpmdb' );
18
 
19
  if ( ! is_array( $args ) ) {
20
  throw new InvalidArgumentException( 'WPMDB_Replace constructor expects the argument to be an array' );
@@ -26,13 +31,17 @@ final class WPMDB_Replace {
26
  }
27
  }
28
 
29
- $this->table = $args['table'];
30
- $this->search = $args['search'];
31
- $this->replace = $args['replace'];
32
- $this->intent = $args['intent'];
33
- $this->base_domain = $args['base_domain'];
34
- $this->site_domain = $args['site_domain'];
35
- $this->wpmdb = $args['wpmdb'];
 
 
 
 
36
  }
37
 
38
  /**
@@ -42,12 +51,29 @@ final class WPMDB_Replace {
42
  */
43
  function is_subdomain_replaces_on() {
44
  if ( ! isset( $this->subdomain_replaces_on ) ) {
45
- $this->subdomain_replaces_on = ( is_multisite() && is_subdomain_install() && apply_filters( 'wpmdb_subdomain_replace', true ) );
46
  }
47
 
48
  return $this->subdomain_replaces_on;
49
  }
50
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
51
  /**
52
  * Automatically replace URLs for subdomain based multisite installations
53
  * e.g. //site1.example.com -> //site1.example.local for site with domain example.com
@@ -69,6 +95,83 @@ final class WPMDB_Replace {
69
  return $new;
70
  }
71
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
72
  /**
73
  * Applies find/replace pairs to a given string.
74
  *
@@ -82,6 +185,10 @@ final class WPMDB_Replace {
82
  $new = $this->subdomain_replaces( $new );
83
  }
84
 
 
 
 
 
85
  return $new;
86
  }
87
 
@@ -114,7 +221,7 @@ final class WPMDB_Replace {
114
 
115
  // some unserialized data cannot be re-serialized eg. SimpleXMLElements
116
  try {
117
- if ( is_string( $data ) && ( $unserialized = @unserialize( $data ) ) !== false ) {
118
  // PHP currently has a bug that doesn't allow you to clone the DateInterval / DatePeriod classes.
119
  // We skip them here as they probably won't need data to be replaced anyway
120
  if ( is_object( $unserialized ) ) {
8
  protected $intent;
9
  protected $base_domain;
10
  protected $site_domain;
11
+ protected $site_details;
12
+ protected $source_protocol;
13
+ protected $destination_protocol;
14
+ protected $destination_url;
15
+ protected $is_protocol_mismatch = false;
16
 
17
  private $table;
18
  private $column;
19
  private $row;
20
 
21
  function __construct( $args ) {
22
+ $keys = array( 'table', 'search', 'replace', 'intent', 'base_domain', 'site_domain', 'wpmdb', 'site_details' );
23
 
24
  if ( ! is_array( $args ) ) {
25
  throw new InvalidArgumentException( 'WPMDB_Replace constructor expects the argument to be an array' );
31
  }
32
  }
33
 
34
+ $this->table = $args['table'];
35
+ $this->search = $args['search'];
36
+ $this->replace = $args['replace'];
37
+ $this->intent = $args['intent'];
38
+ $this->base_domain = $args['base_domain'];
39
+ $this->site_domain = $args['site_domain'];
40
+ $this->wpmdb = $args['wpmdb'];
41
+ $this->site_details = $args['site_details'];
42
+
43
+ // Detect a protocol mismatch between the remote and local sites involved in the migration
44
+ $this->detect_protocol_mismatch();
45
  }
46
 
47
  /**
51
  */
52
  function is_subdomain_replaces_on() {
53
  if ( ! isset( $this->subdomain_replaces_on ) ) {
54
+ $this->subdomain_replaces_on = ( is_multisite() && is_subdomain_install() && ! $this->has_same_base_domain() && apply_filters( 'wpmdb_subdomain_replace', true ) );
55
  }
56
 
57
  return $this->subdomain_replaces_on;
58
  }
59
 
60
+
61
+ /**
62
+ * Determine if the replacement has the same base domain as the search. Produces doubled replacement strings
63
+ * otherwise.
64
+ *
65
+ * @return bool
66
+ */
67
+ function has_same_base_domain() {
68
+ $destination_url = isset( $this->destination_url ) ? $this->destination_url : $this->site_details['local']['site_url'];
69
+ if ( stripos( $destination_url, $this->site_domain ) ) {
70
+ return true;
71
+ }
72
+
73
+ return false;
74
+ }
75
+
76
+
77
  /**
78
  * Automatically replace URLs for subdomain based multisite installations
79
  * e.g. //site1.example.com -> //site1.example.local for site with domain example.com
95
  return $new;
96
  }
97
 
98
+ /**
99
+ * Detect a protocol mismatch between the remote and local sites involved in the migration
100
+ *
101
+ * @return bool
102
+ */
103
+ function detect_protocol_mismatch() {
104
+ if ( ! isset( $this->site_details['remote'] ) ) {
105
+ return false;
106
+ }
107
+
108
+ /**
109
+ * Filters the site_urls used to check if there is a protocol mismatch.
110
+ *
111
+ * @param array
112
+ */
113
+ $wpmdb_site_urls = apply_filters( 'wpmdb_replace_site_urls', array(
114
+ 'local' => $this->site_details['local']['site_url'],
115
+ 'remote' => $this->site_details['remote']['site_url'],
116
+ )
117
+ );
118
+
119
+ $local_url_is_https = false === stripos( $wpmdb_site_urls['local'], 'https' ) ? false : true;
120
+ $remote_url_is_https = false === stripos( $wpmdb_site_urls['remote'], 'https' ) ? false : true;
121
+ $local_protocol = $local_url_is_https ? 'https' : 'http';
122
+ $remote_protocol = $remote_url_is_https ? 'https' : 'http';
123
+
124
+ if ( ( $local_url_is_https && ! $remote_url_is_https ) || ( ! $local_url_is_https && $remote_url_is_https ) ) {
125
+ $this->is_protocol_mismatch = true;
126
+ }
127
+
128
+ if ( 'push' === $this->intent ) {
129
+ $this->destination_protocol = $remote_protocol;
130
+ $this->source_protocol = $local_protocol;
131
+ $this->destination_url = $wpmdb_site_urls['remote'];
132
+ } else {
133
+ $this->destination_protocol = $local_protocol;
134
+ $this->source_protocol = $remote_protocol;
135
+ $this->destination_url = $wpmdb_site_urls['local'];
136
+ }
137
+
138
+ return $this->is_protocol_mismatch;
139
+ }
140
+
141
+ /**
142
+ *
143
+ * Handles replacing the protocol if the local and destination don't have matching protocols (http > https and
144
+ * vice-versa).
145
+ *
146
+ * Can be filtered to disable entirely.
147
+ *
148
+ * @param $new
149
+ *
150
+ * @return mixed
151
+ */
152
+ function do_protocol_replace( $new ) {
153
+ /**
154
+ * Filters $do_protocol_replace, return false to prevent protocol replacement.
155
+ *
156
+ * @param bool true If the replace should be skipped.
157
+ * @param string $this->destination_url The URL of the target site.
158
+ */
159
+ $do_protocol_replace = apply_filters( 'wpmdb_replace_destination_protocol', true, $this->destination_url );
160
+
161
+ if ( true !== $do_protocol_replace ) {
162
+ return $new;
163
+ }
164
+
165
+ $parsed_destination = wp_parse_url( $this->destination_url );
166
+ unset( $parsed_destination['scheme'] );
167
+
168
+ $protocol_search = $this->source_protocol . '://' . implode( '', $parsed_destination );
169
+ $protocol_replace = $this->destination_url;
170
+ $new = str_ireplace( $protocol_search, $protocol_replace, $new, $count );
171
+
172
+ return $new;
173
+ }
174
+
175
  /**
176
  * Applies find/replace pairs to a given string.
177
  *
185
  $new = $this->subdomain_replaces( $new );
186
  }
187
 
188
+ if ( true === $this->is_protocol_mismatch ) {
189
+ $new = $this->do_protocol_replace( $new );
190
+ }
191
+
192
  return $new;
193
  }
194
 
221
 
222
  // some unserialized data cannot be re-serialized eg. SimpleXMLElements
223
  try {
224
+ if ( is_string( $data ) && ( $unserialized = WPMDB_Utils::unserialize( $data, __METHOD__ ) ) !== false ) {
225
  // PHP currently has a bug that doesn't allow you to clone the DateInterval / DatePeriod classes.
226
  // We skip them here as they probably won't need data to be replaced anyway
227
  if ( is_object( $unserialized ) ) {
class/wpmdb-utils.php CHANGED
@@ -61,6 +61,33 @@ class WPMDB_Utils {
61
  }
62
  }
63
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
64
 
65
  /**
66
  * Use wp_unslash if available, otherwise fall back to stripslashes_deep
61
  }
62
  }
63
  }
64
+
65
+ /**
66
+ * Return unserialized object or array
67
+ *
68
+ * @param string $serialized_string Serialized string.
69
+ * @param string $method The name of the caller method.
70
+ *
71
+ * @return mixed, false on failure
72
+ */
73
+ public static function unserialize( $serialized_string, $method = '' ) {
74
+ if ( ! is_serialized( $serialized_string ) ) {
75
+ return false;
76
+ }
77
+
78
+ $serialized_string = trim( $serialized_string );
79
+ $unserialized_string = @unserialize( $serialized_string );
80
+
81
+ if ( false === $unserialized_string ) {
82
+ $wpmdb = function_exists( 'wp_migrate_db_pro' ) ? wp_migrate_db_pro() : wp_migrate_db();
83
+ $scope = $method ? sprintf( __( 'Scope: %s().', 'wp-migrate-db' ), $method ) : false;
84
+ $wpmdb->log_error( __( 'Data cannot be unserialized.', 'wp-migrate-db' ), $scope );
85
+
86
+ return false;
87
+ }
88
+
89
+ return $unserialized_string;
90
+ }
91
 
92
  /**
93
  * Use wp_unslash if available, otherwise fall back to stripslashes_deep
class/wpmdb.php CHANGED
@@ -21,6 +21,11 @@ class WPMDB extends WPMDB_Base {
21
  protected $domain_replace;
22
  protected $checkbox_options;
23
  protected $find_replace_pairs = array();
 
 
 
 
 
24
 
25
  function __construct( $plugin_file_path ) {
26
  parent::__construct( $plugin_file_path );
@@ -35,6 +40,7 @@ class WPMDB extends WPMDB_Base {
35
  // internal AJAX handlers
36
  add_action( 'wp_ajax_wpmdb_delete_migration_profile', array( $this, 'ajax_delete_migration_profile' ) );
37
  add_action( 'wp_ajax_wpmdb_save_profile', array( $this, 'ajax_save_profile' ) );
 
38
  add_action( 'wp_ajax_wpmdb_initiate_migration', array( $this, 'ajax_initiate_migration' ) );
39
  add_action( 'wp_ajax_wpmdb_migrate_table', array( $this, 'ajax_migrate_table' ) );
40
  add_action( 'wp_ajax_wpmdb_clear_log', array( $this, 'ajax_clear_log' ) );
@@ -44,6 +50,9 @@ class WPMDB extends WPMDB_Base {
44
  add_action( 'wp_ajax_wpmdb_update_max_request_size', array( $this, 'ajax_update_max_request_size' ) );
45
  add_action( 'wp_ajax_wpmdb_update_delay_between_requests', array( $this, 'ajax_update_delay_between_requests' ) );
46
  add_action( 'wp_ajax_wpmdb_cancel_migration', array( $this, 'ajax_cancel_migration' ) );
 
 
 
47
 
48
  $this->accepted_fields = array(
49
  'action',
@@ -117,6 +126,7 @@ class WPMDB extends WPMDB_Base {
117
 
118
  if ( is_multisite() ) {
119
  add_action( 'network_admin_menu', array( $this, 'network_admin_menu' ) );
 
120
  /*
121
  * The URL find & replace is locked down (delete & reorder disabled) on multisite installations as we require the URL
122
  * of the remote site for export migrations. This URL is parsed into its various components and
@@ -153,6 +163,8 @@ class WPMDB extends WPMDB_Base {
153
  * Handler for ajax request to turn on or off Compatibility Mode.
154
  */
155
  function ajax_plugin_compatibility() {
 
 
156
  $key_rules = array(
157
  'action' => 'key',
158
  'install' => 'numeric',
@@ -168,13 +180,13 @@ class WPMDB extends WPMDB_Base {
168
  exit;
169
  }
170
 
171
- if ( ! copy( $source, $dest ) ) {
172
  printf( esc_html__( 'Could not copy the compatibility plugin from %1$s to %2$s', 'wp-migrate-db' ), $source, $dest );
173
  exit;
174
  }
175
  } else { // uninstall MU plugin
176
  // TODO: Use WP_Filesystem API.
177
- if ( file_exists( $dest ) && ! unlink( $dest ) ) {
178
  printf( esc_html__( 'Could not remove the compatibility plugin from %s', 'wp-migrate-db' ), $dest );
179
  exit;
180
  }
@@ -186,6 +198,8 @@ class WPMDB extends WPMDB_Base {
186
  * Handler for updating the plugins that are not to be loaded during a request (Compatibility Mode).
187
  */
188
  function ajax_blacklist_plugins() {
 
 
189
  $key_rules = array(
190
  'action' => 'key',
191
  'blacklist_plugins' => 'array',
@@ -371,7 +385,32 @@ class WPMDB extends WPMDB_Base {
371
  echo 'WordPress: ';
372
  echo bloginfo( 'version' );
373
  if ( is_multisite() ) {
374
- echo ' Multisite';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
375
  }
376
  echo "\r\n";
377
 
@@ -558,6 +597,8 @@ class WPMDB extends WPMDB_Base {
558
  foreach ( $mu_plugins as $mu_plugin ) {
559
  $this->print_plugin_details( $mu_plugin );
560
  }
 
 
561
  }
562
  }
563
 
@@ -578,11 +619,15 @@ class WPMDB extends WPMDB_Base {
578
 
579
  function get_alter_queries() {
580
  global $wpdb;
 
581
  $alter_table_name = $this->get_alter_table_name();
 
582
  $sql = '';
583
- $alter_queries = $wpdb->get_results( "SELECT * FROM `{$alter_table_name}`", ARRAY_A );
584
 
585
- $alter_queries = apply_filters( 'wpmdb_get_alter_queries', $alter_queries );
 
 
 
586
 
587
  if ( ! empty( $alter_queries ) ) {
588
  foreach ( $alter_queries as $alter_query ) {
@@ -703,32 +748,30 @@ class WPMDB extends WPMDB_Base {
703
  return $result;
704
  }
705
 
706
- // Pull and push need to be handled differently for obvious reasons, trigger different code depending on the migration intent (push or pull)
707
- if ( $this->state_data['intent'] == 'push' || $this->state_data['intent'] == 'savefile' ) {
 
708
  $this->maximum_chunk_size = $this->get_bottleneck();
709
 
710
  if ( isset( $this->state_data['bottleneck'] ) ) {
711
  $this->maximum_chunk_size = (int) $this->state_data['bottleneck'];
712
  }
713
 
714
- $sql_dump_file_name = $this->get_upload_info( 'path' ) . DIRECTORY_SEPARATOR;
715
- $sql_dump_file_name .= $this->format_dump_name( $this->state_data['dump_filename'] );
716
-
717
- if ( $this->state_data['intent'] == 'savefile' ) {
718
  $this->fp = $this->open( $sql_dump_file_name );
719
  }
720
 
721
- $db_version = '';
722
  if ( ! empty( $this->state_data['db_version'] ) ) {
723
- $db_version = $this->state_data['db_version'];
724
-
725
  if ( 'push' == $this->state_data['intent'] ) {
726
- // $db_version has been set to remote database's version.
727
  add_filter( 'wpmdb_create_table_query', array( $this, 'mysql_compat_filter' ), 10, 5 );
728
  } elseif ( 'savefile' == $this->state_data['intent'] && ! empty( $this->form_data['compatibility_older_mysql'] ) ) {
729
  // compatibility_older_mysql is currently a checkbox meaning pre-5.5 compatibility (we play safe and target 5.1),
730
  // this may change in the future to be a dropdown or radiobox returning the version to be compatible with.
731
- $db_version = '5.1';
732
  add_filter( 'wpmdb_create_table_query', array( $this, 'mysql_compat_filter' ), 10, 5 );
733
  }
734
  }
@@ -738,7 +781,7 @@ class WPMDB extends WPMDB_Base {
738
  }
739
 
740
  ob_start();
741
- $result = $this->export_table( $this->state_data['table'], $db_version );
742
 
743
  if ( $this->state_data['intent'] == 'savefile' && isset( $this->fp ) ) {
744
  $this->close( $this->fp );
@@ -873,39 +916,42 @@ class WPMDB extends WPMDB_Base {
873
  // A little bit of house keeping.
874
  WPMDB_Migration_State::cleanup();
875
 
876
- if ( $this->state_data['intent'] == 'savefile' ) {
877
  $return = array(
878
  'code' => 200,
879
  'message' => 'OK',
880
  'body' => json_encode( array( 'error' => 0 ) ),
881
  );
882
 
883
- $return['dump_path'] = $this->get_sql_dump_info( 'migrate', 'path' );
884
- $return['dump_filename'] = basename( $return['dump_path'] );
885
- $return['dump_url'] = $this->get_sql_dump_info( 'migrate', 'url' );
886
- $dump_filename_no_extension = substr( $return['dump_filename'], 0, -4 );
 
887
 
888
- $create_alter_table_query = $this->get_create_alter_table_query();
889
- // sets up our table to store 'ALTER' queries
890
- $process_chunk_result = $this->process_chunk( $create_alter_table_query );
891
 
892
- if ( true !== $process_chunk_result ) {
893
- $result = $this->end_ajax( $process_chunk_result );
894
 
895
- return $result;
896
- }
897
 
898
- if ( $this->gzip() && isset( $this->form_data['gzip_file'] ) && $this->form_data['gzip_file'] ) {
899
- $return['dump_path'] .= '.gz';
900
- $return['dump_filename'] .= '.gz';
901
- $return['dump_url'] .= '.gz';
902
- }
903
 
904
- $this->fp = $this->open( $this->get_upload_info( 'path' ) . DIRECTORY_SEPARATOR . $return['dump_filename'] );
905
- $this->db_backup_header();
906
- $this->close( $this->fp );
 
 
 
907
 
908
- $return['dump_filename'] = $dump_filename_no_extension;
909
  } else { // does one last check that our verification string is valid
910
  $data = array(
911
  'action' => 'wpmdb_remote_initiate_migration',
@@ -928,7 +974,7 @@ class WPMDB extends WPMDB_Base {
928
  return $result;
929
  }
930
 
931
- $return = @unserialize( trim( $response ) );
932
 
933
  if ( false === $return ) {
934
  $error_msg = __( 'Failed attempting to unserialize the response from the remote server. Please contact support.', 'wp-migrate-db' );
@@ -988,6 +1034,360 @@ class WPMDB extends WPMDB_Base {
988
  return $result;
989
  }
990
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
991
  /**
992
  * Handler for the ajax request to save a migration profile.
993
  *
@@ -1055,6 +1455,29 @@ class WPMDB extends WPMDB_Base {
1055
  return $result;
1056
  }
1057
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1058
  function format_table_sizes( $size ) {
1059
  $size *= 1024;
1060
 
@@ -1070,7 +1493,7 @@ class WPMDB extends WPMDB_Base {
1070
  global $wpdb;
1071
 
1072
  if ( is_multisite() ) {
1073
- $tables = $this->get_tables();
1074
  $sql = "SELECT `post_type` FROM `{$wpdb->base_prefix}posts` ";
1075
  $prefix_escaped = preg_quote( $wpdb->base_prefix, '/' );
1076
 
@@ -1193,6 +1616,14 @@ class WPMDB extends WPMDB_Base {
1193
  function options_page() {
1194
  $this->template( 'options' );
1195
  }
 
 
 
 
 
 
 
 
1196
 
1197
  /**
1198
  * Get the remote site's base domain for subdomain multisite search/replace.
@@ -1320,148 +1751,192 @@ class WPMDB extends WPMDB_Base {
1320
  }
1321
 
1322
  /**
1323
- * Taken partially from phpMyAdmin and partially from
1324
- * Alain Wolf, Zurich - Switzerland
1325
- * Website: http://restkultur.ch/personal/wolf/scripts/db_backup/
1326
- * Modified by Scott Merrill (http://www.skippy.net/)
1327
- * to use the WordPress $wpdb object
1328
  *
1329
  * @param string $table
1330
- * @param string $db_version
1331
  *
1332
  * @return mixed
1333
  */
1334
- function export_table( $table, $db_version = '' ) {
1335
  global $wpdb;
1336
- $this->set_time_limit();
1337
- $this->set_post_data();
1338
-
1339
- if ( empty( $this->form_data ) ) {
1340
- $this->form_data = $this->parse_migration_form_data( $this->state_data['form_data'] );
1341
- }
1342
 
1343
- $temp_prefix = ( isset( $this->state_data['temp_prefix'] ) ? $this->state_data['temp_prefix'] : $this->temp_prefix );
 
1344
 
1345
- $table_structure = $wpdb->get_results( 'DESCRIBE ' . $this->backquote( $table ) );
1346
-
1347
- if ( ! $table_structure ) {
1348
- $this->error = __( 'Failed to retrieve table structure, please ensure your database is online. (#125)', 'wp-migrate-db' );
1349
-
1350
- return false;
1351
- }
1352
-
1353
- $table_name = $table;
1354
  $site_details = empty( $this->state_data['site_details'] ) ? array() : $this->state_data['site_details'];
1355
- $target_table_name = apply_filters( 'wpmdb_target_table_name', $table_name, $this->form_data['action'], $this->state_data['stage'], $site_details );
1356
- $table_name = $target_table_name;
1357
-
1358
- if ( 'savefile' !== $this->form_data['action'] && 'backup' !== $this->state_data['stage'] ) {
1359
- $table_name = $temp_prefix . $table_name;
1360
- }
1361
-
1362
- $current_row = -1;
1363
 
1364
- if ( ! empty( $this->state_data['current_row'] ) ) {
1365
- $temp_current_row = trim( $this->state_data['current_row'] );
1366
- if ( ! empty( $temp_current_row ) ) {
1367
- $current_row = (int) $temp_current_row;
1368
- }
1369
  }
1370
 
1371
- if ( $current_row == -1 ) {
1372
- // Don't stow data until after `wpmdb_create_table_query` filter is applied as mysql_compat_filter() can return an error
1373
- $stow = '';
1374
 
1375
- // Add SQL statement to drop existing table
1376
- if ( $this->form_data['action'] == 'savefile' || $this->state_data['stage'] == 'backup' ) {
1377
- $stow .= ( "\n\n" );
1378
- $stow .= ( "#\n" );
1379
- $stow .= ( '# ' . sprintf( __( 'Delete any existing table %s', 'wp-migrate-db' ), $this->backquote( $table_name ) ) . "\n" );
1380
- $stow .= ( "#\n" );
1381
- $stow .= ( "\n" );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1382
  }
1383
- $stow .= ( 'DROP TABLE IF EXISTS ' . $this->backquote( $table_name ) . ";\n" );
1384
 
1385
- // Table structure
1386
- // Comment in SQL-file
1387
- if ( $this->form_data['action'] == 'savefile' || $this->state_data['stage'] == 'backup' ) {
1388
- $stow .= ( "\n\n" );
1389
- $stow .= ( "#\n" );
1390
- $stow .= ( '# ' . sprintf( __( 'Table structure of table %s', 'wp-migrate-db' ), $this->backquote( $table_name ) ) . "\n" );
1391
- $stow .= ( "#\n" );
1392
- $stow .= ( "\n" );
1393
- }
1394
 
1395
- $create_table = $wpdb->get_results( 'SHOW CREATE TABLE ' . $this->backquote( $table ), ARRAY_N );
1396
 
1397
- if ( false === $create_table ) {
1398
- $this->error = __( 'Failed to generate the create table query, please ensure your database is online. (#126)', 'wp-migrate-db' );
 
 
1399
 
1400
- return false;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1401
  }
1402
- $create_table[0][1] = str_replace( 'CREATE TABLE `' . $table . '`', 'CREATE TABLE `' . $table_name . '`', $create_table[0][1] );
1403
 
1404
- $create_table[0][1] = str_replace( 'TYPE=', 'ENGINE=', $create_table[0][1] );
 
1405
 
1406
- $alter_table_query = '';
1407
- $create_table[0][1] = $this->process_sql_constraint( $create_table[0][1], $target_table_name, $alter_table_query );
1408
 
1409
- $create_table[0][1] = apply_filters( 'wpmdb_create_table_query', $create_table[0][1], $table_name, $db_version, $this->form_data['action'], $this->state_data['stage'] );
1410
- $stow .= ( $create_table[0][1] . ";\n" );
 
 
 
 
 
 
 
 
 
 
1411
 
1412
- $this->stow( $stow );
 
 
 
 
 
1413
 
1414
- if ( ! empty( $alter_table_query ) ) {
1415
- $alter_table_name = $this->get_alter_table_name();
1416
- $insert = sprintf( "INSERT INTO %s ( `query` ) VALUES ( '%s' );\n", $this->backquote( $alter_table_name ), esc_sql( $alter_table_query ) );
1417
- if ( $this->form_data['action'] == 'savefile' || $this->state_data['stage'] == 'backup' ) {
1418
- $process_chunk_result = $this->process_chunk( $insert );
1419
- if ( true !== $process_chunk_result ) {
1420
- $result = $this->end_ajax( $process_chunk_result );
1421
 
1422
- return $result;
1423
- }
1424
- } else {
1425
- $this->stow( $insert );
1426
- }
 
 
 
 
 
 
 
1427
  }
 
1428
 
1429
- $alter_data_queries = array();
1430
- $alter_data_queries = apply_filters( 'wpmdb_alter_data_queries', $alter_data_queries, $table_name, $this->form_data['action'], $this->state_data['stage'] );
1431
 
1432
- if ( ! empty( $alter_data_queries ) ) {
1433
- $alter_table_name = $this->get_alter_table_name();
1434
- $insert = '';
1435
- foreach ( $alter_data_queries as $alter_data_query ) {
1436
- $insert .= sprintf( "INSERT INTO %s ( `query` ) VALUES ( '%s' );\n", $this->backquote( $alter_table_name ), esc_sql( $alter_data_query ) );
1437
- }
1438
- if ( 'savefile' == $this->form_data['action'] || 'backup' == $this->state_data['stage'] ) {
1439
- $process_chunk_result = $this->process_chunk( $insert );
1440
- if ( true !== $process_chunk_result ) {
1441
- $result = $this->end_ajax( $process_chunk_result );
1442
 
1443
- return $result;
1444
- }
1445
- } else {
1446
- $this->stow( $insert );
1447
- }
1448
- }
 
 
 
1449
 
1450
- // Comment in SQL-file
1451
- if ( $this->form_data['action'] == 'savefile' || $this->state_data['stage'] == 'backup' ) {
1452
- $this->stow( "\n\n" );
1453
- $this->stow( "#\n" );
1454
- $this->stow( '# ' . sprintf( __( 'Data contents of table %s', 'wp-migrate-db' ), $this->backquote( $table_name ) ) . "\n" );
1455
- $this->stow( "#\n" );
1456
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1457
  }
1458
 
1459
  // $defs = mysql defaults, looks up the default for that particular column, used later on to prevent empty inserts values for that column
1460
  // $ints = holds a list of the possible integer types so as to not wrap them in quotation marks later in the insert statements
1461
- $defs = array();
1462
- $ints = array();
1463
- $bins = array();
1464
- $bits = array();
 
 
 
 
1465
  foreach ( $table_structure as $struct ) {
1466
  if ( ( 0 === strpos( $struct->Type, 'tinyint' ) ) ||
1467
  ( 0 === strpos( strtolower( $struct->Type ), 'smallint' ) ) ||
@@ -1476,382 +1951,635 @@ class WPMDB extends WPMDB_Base {
1476
  } elseif ( 0 === strpos( $struct->Type, 'bit' ) ) {
1477
  $bits[ strtolower( $struct->Field ) ] = '1';
1478
  }
1479
- }
1480
 
1481
- // Batch by $row_inc
1482
-
1483
- $row_inc = $this->rows_per_segment;
1484
- $row_start = 0;
1485
- if ( $current_row != -1 ) {
1486
- $row_start = $current_row;
1487
- }
1488
 
1489
- $this->row_tracker = $row_start;
1490
-
1491
- // \x08\\x09, not required
1492
- $multibyte_search = array( "\x00", "\x0a", "\x0d", "\x1a" );
1493
- $multibyte_replace = array( '\0', '\n', '\r', '\Z' );
1494
-
1495
- $query_size = 0;
1496
-
1497
- $this->primary_keys = array();
1498
- $field_set = array();
1499
- $use_primary_keys = true;
1500
-
1501
- foreach ( $table_structure as $col ) {
1502
- $field_set[] = $this->backquote( $col->Field );
1503
- if ( $col->Key == 'PRI' && true == $use_primary_keys ) {
1504
- if ( false === strpos( $col->Type, 'int' ) ) {
1505
  $use_primary_keys = false;
1506
  $this->primary_keys = array();
1507
  continue;
1508
  }
1509
- $this->primary_keys[ $col->Field ] = 0;
1510
  }
1511
  }
1512
 
1513
- $first_select = true;
1514
  if ( ! empty( $this->state_data['primary_keys'] ) ) {
1515
  $this->state_data['primary_keys'] = trim( $this->state_data['primary_keys'] );
1516
- if ( ! empty( $this->state_data['primary_keys'] ) && is_serialized( $this->state_data['primary_keys'] ) ) {
1517
- $this->primary_keys = unserialize( stripslashes( $this->state_data['primary_keys'] ) );
1518
- $first_select = false;
1519
  }
1520
  }
1521
 
1522
- $fields = implode( ', ', $field_set );
 
 
 
 
 
 
1523
 
1524
- $insert_buffer = $insert_query_template = 'INSERT INTO ' . $this->backquote( $table_name ) . ' ( ' . $fields . ") VALUES\n";
 
1525
 
1526
- do {
1527
- $join = array();
1528
- $where = 'WHERE 1=1';
1529
- $order_by = '';
1530
- // We need ORDER BY here because with LIMIT, sometimes it will return
1531
- // the same results from the previous query and we'll have duplicate insert statements
1532
- if ( 'backup' != $this->state_data['stage'] && false === empty( $this->form_data['exclude_spam'] ) ) {
1533
- if ( $this->table_is( 'comments', $table ) ) {
1534
- $where .= ' AND comment_approved != "spam"';
1535
- } elseif ( $this->table_is( 'commentmeta', $table ) ) {
1536
- $tables = $this->get_ms_compat_table_names( array( 'commentmeta', 'comments' ), $table );
1537
- $join[] = sprintf( 'INNER JOIN %1$s ON %1$s.comment_ID = %2$s.comment_id', $this->backquote( $tables['comments_table'] ), $this->backquote( $tables['commentmeta_table'] ) );
1538
- $where .= sprintf( ' AND %1$s.comment_approved != \'spam\'', $this->backquote( $tables['comments_table'] ) );
 
 
 
 
 
 
1539
  }
1540
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1541
 
1542
- if ( 'backup' != $this->state_data['stage'] && isset( $this->form_data['exclude_post_types'] ) && ! empty( $this->form_data['select_post_types'] ) ) {
1543
- $post_types = '\'' . implode( '\', \'', $this->form_data['select_post_types'] ) . '\'';
1544
- if ( $this->table_is( 'posts', $table ) ) {
1545
- $where .= ' AND `post_type` NOT IN ( ' . $post_types . ' )';
1546
- } elseif ( $this->table_is( 'postmeta', $table ) ) {
1547
- $tables = $this->get_ms_compat_table_names( array( 'postmeta', 'posts' ), $table );
1548
- $join[] = sprintf( 'INNER JOIN %1$s ON %1$s.ID = %2$s.post_id', $this->backquote( $tables['posts_table'] ), $this->backquote( $tables['postmeta_table'] ) );
1549
- $where .= sprintf( ' AND %1$s.post_type NOT IN ( ' . $post_types . ' )', $this->backquote( $tables['posts_table'] ) );
1550
- } elseif ( $this->table_is( 'comments', $table ) ) {
1551
- $tables = $this->get_ms_compat_table_names( array( 'comments', 'posts' ), $table );
1552
- $join[] = sprintf( 'INNER JOIN %1$s ON %1$s.ID = %2$s.comment_post_ID', $this->backquote( $tables['posts_table'] ), $this->backquote( $tables['comments_table'] ) );
1553
- $where .= sprintf( ' AND %1$s.post_type NOT IN ( ' . $post_types . ' )', $this->backquote( $tables['posts_table'] ) );
1554
- } elseif ( $this->table_is( 'commentmeta', $table ) ) {
1555
- $tables = $this->get_ms_compat_table_names( array( 'commentmeta', 'posts', 'comments' ), $table );
1556
- $join[] = sprintf( 'INNER JOIN %1$s ON %1$s.comment_ID = %2$s.comment_id', $this->backquote( $tables['comments_table'] ), $this->backquote( $tables['commentmeta_table'] ) );
1557
- $join[] = sprintf( 'INNER JOIN %2$s ON %2$s.ID = %1$s.comment_post_ID', $this->backquote( $tables['comments_table'] ), $this->backquote( $tables['posts_table'] ) );
1558
- $where .= sprintf( ' AND %1$s.post_type NOT IN ( ' . $post_types . ' )', $this->backquote( $tables['posts_table'] ) );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1559
  }
 
 
1560
  }
 
1561
 
1562
- if ( 'backup' != $this->state_data['stage'] && true === apply_filters( 'wpmdb_exclude_transients', true ) && isset( $this->form_data['exclude_transients'] ) && '1' === $this->form_data['exclude_transients'] && ( $this->table_is( 'options', $table ) || ( isset( $wpdb->sitemeta ) && $wpdb->sitemeta == $table ) ) ) {
1563
- $col_name = 'option_name';
1564
 
1565
- if ( isset( $wpdb->sitemeta ) && $wpdb->sitemeta == $table ) {
1566
- $col_name = 'meta_key';
1567
- }
 
 
 
 
 
 
 
1568
 
1569
- $where .= " AND `{$col_name}` NOT LIKE '\_transient\_%' AND `{$col_name}` NOT LIKE '\_site\_transient\_%'";
 
 
 
1570
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1571
 
1572
- // don't export/migrate wpmdb specific option rows unless we're performing a backup
1573
- if ( 'backup' != $this->state_data['stage'] && ( $this->table_is( 'options', $table ) || ( isset( $wpdb->sitemeta ) && $wpdb->sitemeta == $table ) ) ) {
1574
- $col_name = 'option_name';
1575
 
1576
- if ( isset( $wpdb->sitemeta ) && $wpdb->sitemeta == $table ) {
1577
- $col_name = 'meta_key';
 
 
 
 
 
 
1578
  }
 
 
 
1579
 
1580
- $where .= " AND `{$col_name}` != 'wpmdb_settings'";
1581
- $where .= " AND `{$col_name}` != 'wpmdb_error_log'";
1582
- $where .= " AND `{$col_name}` != 'wpmdb_schema_version'";
1583
- $where .= " AND `{$col_name}` NOT LIKE 'wpmdb_state_%'";
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1584
  }
 
1585
 
1586
- $limit = "LIMIT {$row_start}, {$row_inc}";
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1587
 
1588
- if ( ! empty( $this->primary_keys ) ) {
1589
- $primary_keys_keys = array_keys( $this->primary_keys );
1590
- $primary_keys_keys = array_map( array( $this, 'backquote' ), $primary_keys_keys );
1591
 
1592
- $order_by = 'ORDER BY ' . implode( ',', $primary_keys_keys );
1593
- $limit = "LIMIT $row_inc";
 
1594
 
1595
- if ( false == $first_select ) {
1596
- $where .= ' AND ';
1597
 
1598
- $temp_primary_keys = $this->primary_keys;
1599
- $primary_key_count = count( $temp_primary_keys );
 
1600
 
1601
- // build a list of clauses, iteratively reducing the number of fields compared in the compound key
1602
- // e.g. (a = 1 AND b = 2 AND c > 3) OR (a = 1 AND b > 2) OR (a > 1)
1603
- $clauses = array();
1604
- for ( $j = 0; $j < $primary_key_count; $j++ ) {
1605
- // build a subclause for each field in the compound index
1606
- $subclauses = array();
1607
- $i = 0;
1608
- foreach ( $temp_primary_keys as $primary_key => $value ) {
1609
- // only the last field in the key should be different in this subclause
1610
- $operator = ( count( $temp_primary_keys ) - 1 == $i ? '>' : '=' );
1611
- $subclauses[] = sprintf( '%s %s %s', $this->backquote( $primary_key ), $operator, $wpdb->prepare( '%s', $value ) );
1612
- ++$i;
1613
- }
 
 
1614
 
1615
- // remove last field from array to reduce fields in next clause
1616
- array_pop( $temp_primary_keys );
1617
 
1618
- // join subclauses into a single clause
1619
- // NB: AND needs to be wrapped in () as it has higher precedence than OR
1620
- $clauses[] = '( ' . implode( ' AND ', $subclauses ) . ' )';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1621
  }
1622
- // join clauses into a single clause
1623
- // NB: OR needs to be wrapped in () as it has lower precedence than AND
1624
- $where .= '( ' . implode( ' OR ', $clauses ) . ' )';
1625
- }
1626
 
1627
- $first_select = false;
1628
- }
1629
 
1630
- $sel = $this->backquote( $table ) . '.*';
1631
- if ( ! empty( $bins ) ) {
1632
- foreach ( $bins as $key => $bin ) {
1633
- $hex_key = strtolower( $key ) . '__hex';
1634
- $sel .= ', HEX(' . $this->backquote( $key ) . ') as ' . $this->backquote( $hex_key );
1635
  }
 
 
 
1636
  }
1637
- if ( ! empty( $bits ) ) {
1638
- foreach ( $bits as $key => $bit ) {
1639
- $bit_key = strtolower( $key ) . '__bit';
1640
- $sel .= ', ' . $this->backquote( $key ) . '+0 as ' . $this->backquote( $bit_key );
1641
- }
1642
- }
1643
- $join = implode( ' ', array_unique( $join ) );
1644
- $join = apply_filters( 'wpmdb_rows_join', $join, $table );
1645
- $where = apply_filters( 'wpmdb_rows_where', $where, $table );
1646
- $order_by = apply_filters( 'wpmdb_rows_order_by', $order_by, $table );
1647
- $limit = apply_filters( 'wpmdb_rows_limit', $limit, $table );
1648
-
1649
- $sql = 'SELECT ' . $sel . ' FROM ' . $this->backquote( $table ) . " $join $where $order_by $limit";
1650
- $sql = apply_filters( 'wpmdb_rows_sql', $sql, $table );
1651
-
1652
- $table_data = $wpdb->get_results( $sql );
1653
-
1654
- if ( $table_data ) {
1655
- $to_search = isset( $this->find_replace_pairs['replace_old'] ) ? $this->find_replace_pairs['replace_old'] : '';
1656
- $to_replace = isset( $this->find_replace_pairs['replace_new'] ) ? $this->find_replace_pairs['replace_new'] : '';
1657
- $replacer = new WPMDB_Replace( array(
1658
- 'table' => $table,
1659
- 'search' => $to_search,
1660
- 'replace' => $to_replace,
1661
- 'intent' => $this->state_data['intent'],
1662
- 'base_domain' => $this->get_domain_replace(),
1663
- 'site_domain' => $this->get_domain_current_site(),
1664
- 'wpmdb' => $this,
1665
- ) );
1666
-
1667
- foreach ( $table_data as $row ) {
1668
- $skip_row = false;
1669
-
1670
- if ( ! apply_filters( 'wpmdb_table_row', $row, $table, $this->form_data['action'], $this->state_data['stage'] ) ) {
1671
- $skip_row = true;
1672
- }
1673
 
1674
- if ( ! $skip_row ) {
1675
- $replacer->set_row( $row );
1676
- $values = array();
1677
 
1678
- foreach ( $row as $key => $value ) {
1679
- $replacer->set_column( $key );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1680
 
1681
- if ( isset( $ints[ strtolower( $key ) ] ) && $ints[ strtolower( $key ) ] ) {
1682
- // make sure there are no blank spots in the insert syntax,
1683
- // yet try to avoid quotation marks around integers
1684
- $value = ( null === $value || '' === $value ) ? $defs[ strtolower( $key ) ] : $value;
1685
- $values[] = ( '' === $value ) ? "''" : $value;
1686
- continue;
1687
- }
1688
 
1689
- if ( null === $value ) {
1690
- $values[] = 'NULL';
1691
- continue;
1692
- }
1693
 
1694
- // If we have binary data, substitute in hex encoded version and remove hex encoded version from row.
1695
- $hex_key = strtolower( $key ) . '__hex';
1696
- if ( isset( $bins[ strtolower( $key ) ] ) && $bins[ strtolower( $key ) ] && isset( $row->$hex_key ) ) {
1697
- $value = "UNHEX('" . $row->$hex_key . "')";
1698
- $values[] = $value;
1699
- unset( $row->$hex_key );
1700
- continue;
1701
- }
 
 
 
 
1702
 
1703
- // If we have bit data, substitute in properly bit encoded version.
1704
- $bit_key = strtolower( $key ) . '__bit';
1705
- if ( isset( $bits[ strtolower( $key ) ] ) && $bits[ strtolower( $key ) ] && isset( $row->$bit_key ) ) {
1706
- $value = "b'" . $row->$bit_key . "'";
1707
- $values[] = $value;
1708
- unset( $row->$bit_key );
1709
- continue;
1710
- }
1711
 
1712
- if ( is_multisite() && 'path' == $key && $this->state_data['stage'] != 'backup' && ( $wpdb->site == $table || $wpdb->blogs == $table ) ) {
1713
- $old_path_current_site = $this->get_path_current_site();
1714
- $new_path_current_site = '';
1715
 
1716
- if ( ! empty( $this->state_data['path_current_site'] ) ) {
1717
- $new_path_current_site = $this->state_data['path_current_site'];
1718
- } elseif ( ! empty ( $this->form_data['replace_new'][1] ) ) {
1719
- $new_path_current_site = $this->get_path_from_url( $this->form_data['replace_new'][1] );
1720
- }
1721
 
1722
- $new_path_current_site = apply_filters( 'wpmdb_new_path_current_site', $new_path_current_site );
 
1723
 
1724
- if ( ! empty( $new_path_current_site ) && $old_path_current_site != $new_path_current_site ) {
1725
- $pos = strpos( $value, $old_path_current_site );
1726
- $value = substr_replace( $value, $new_path_current_site, $pos, strlen( $old_path_current_site ) );
1727
- }
1728
- }
1729
 
1730
- if ( is_multisite() && 'domain' == $key && $this->state_data['stage'] != 'backup' && ( $wpdb->site == $table || $wpdb->blogs == $table ) ) {
1731
- if ( ! empty( $this->state_data['domain_current_site'] ) ) {
1732
- $main_domain_replace = $this->state_data['domain_current_site'];
1733
- } elseif ( ! empty ( $this->form_data['replace_new'][1] ) ) {
1734
- $url = $this->parse_url( $this->form_data['replace_new'][1] );
1735
- $main_domain_replace = $url['host'];
1736
- }
1737
 
1738
- $domain_replaces = array();
1739
- $main_domain_find = sprintf( '/%s/', preg_quote( $this->get_domain_current_site(), '/' ) );
1740
- if ( isset( $main_domain_replace ) ) {
1741
- $domain_replaces[ $main_domain_find ] = $main_domain_replace;
1742
- }
 
 
1743
 
1744
- $domain_replaces = apply_filters( 'wpmdb_domain_replaces', $domain_replaces );
 
 
 
1745
 
1746
- $value = preg_replace( array_keys( $domain_replaces ), array_values( $domain_replaces ), $value );
1747
- }
 
 
 
 
 
 
1748
 
1749
- if ( 'guid' != $key || ( false === empty( $this->form_data['replace_guids'] ) && $this->table_is( 'posts', $table ) ) ) {
1750
- if ( $this->state_data['stage'] != 'backup' ) {
1751
- $value = $replacer->recursive_unserialize_replace( $value );
1752
- }
1753
- }
 
 
 
1754
 
1755
- $value = $this->sql_addslashes( $value );
1756
- $value = str_replace( $multibyte_search, $multibyte_replace, $value );
1757
 
1758
- $values[] = "'" . $value . "'";
1759
- }
1760
 
1761
- $insert_line = '(' . implode( ', ', $values ) . '),';
1762
- $insert_line .= "\n";
1763
- } else {
1764
- $insert_line = '';
1765
- }
1766
 
1767
- if ( ( strlen( $this->current_chunk ) + strlen( $insert_line ) + strlen( $insert_buffer ) + 30 ) > $this->maximum_chunk_size ) {
1768
- if ( $insert_buffer == $insert_query_template ) {
1769
- $insert_buffer .= $insert_line;
 
 
1770
 
1771
- ++$this->row_tracker;
1772
 
1773
- if ( ! empty( $this->primary_keys ) ) {
1774
- foreach ( $this->primary_keys as $primary_key => $value ) {
1775
- $this->primary_keys[ $primary_key ] = $row->$primary_key;
1776
- }
1777
  }
1778
  }
1779
 
1780
- $insert_buffer = rtrim( $insert_buffer, "\n," );
1781
- $insert_buffer .= " ;\n";
1782
- $this->stow( $insert_buffer );
1783
- $insert_buffer = $insert_query_template;
1784
- $query_size = 0;
 
 
1785
 
1786
- return $this->transfer_chunk();
1787
- }
 
 
 
1788
 
1789
- if ( ( $query_size + strlen( $insert_line ) ) > $this->max_insert_string_len && $insert_buffer != $insert_query_template ) {
1790
- $insert_buffer = rtrim( $insert_buffer, "\n," );
1791
- $insert_buffer .= " ;\n";
1792
- $this->stow( $insert_buffer );
1793
- $insert_buffer = $insert_query_template;
1794
- $query_size = 0;
1795
  }
 
1796
 
1797
- $insert_buffer .= $insert_line;
1798
- $query_size += strlen( $insert_line );
 
 
 
1799
 
1800
- ++$this->row_tracker;
 
 
1801
 
1802
- if ( ! empty( $this->primary_keys ) ) {
1803
- foreach ( $this->primary_keys as $primary_key => $value ) {
1804
- $this->primary_keys[ $primary_key ] = $row->$primary_key;
1805
- }
1806
  }
 
 
 
 
 
 
 
1807
  }
1808
 
1809
- $row_start += $row_inc;
 
1810
 
1811
- if ( $insert_buffer != $insert_query_template ) {
1812
- $insert_buffer = rtrim( $insert_buffer, "\n," );
1813
- $insert_buffer .= " ;\n";
1814
- $this->stow( $insert_buffer );
1815
- $insert_buffer = $insert_query_template;
1816
- $query_size = 0;
1817
  }
 
 
1818
  }
1819
- } while ( count( $table_data ) > 0 );
1820
 
1821
- // Create footer/closing comment in SQL-file
1822
- if ( 'savefile' == $this->form_data['action'] || 'backup' == $this->state_data['stage'] ) {
1823
- $this->stow( "\n" );
1824
- $this->stow( "#\n" );
1825
- $this->stow( '# ' . sprintf( __( 'End of data contents of table %s', 'wp-migrate-db' ), $this->backquote( $table_name ) ) . "\n" );
1826
- $this->stow( "# --------------------------------------------------------\n" );
1827
- $this->stow( "\n" );
1828
-
1829
- if ( $this->state_data['last_table'] == '1' ) {
1830
- $this->stow( "#\n" );
1831
- $this->stow( "# Add constraints back in and apply any alter data queries.\n" );
1832
- $this->stow( "#\n\n" );
1833
- $this->stow( $this->get_alter_queries() );
1834
- $alter_table_name = $this->get_alter_table_name();
1835
-
1836
- $wpdb->query( 'DROP TABLE IF EXISTS ' . $this->backquote( $alter_table_name ) . ';' );
1837
-
1838
- if ( 'backup' == $this->state_data['stage'] ) {
1839
- // Re-create our table to store 'ALTER' queries so we don't get duplicates.
1840
- $create_alter_table_query = $this->get_create_alter_table_query();
1841
- $process_chunk_result = $this->process_chunk( $create_alter_table_query );
1842
- if ( true !== $process_chunk_result ) {
1843
- $result = $this->end_ajax( $process_chunk_result );
1844
-
1845
- return $result;
1846
  }
1847
  }
1848
  }
 
 
 
1849
  }
1850
 
1851
- $this->row_tracker = -1;
 
 
1852
 
1853
- return $this->transfer_chunk();
1854
- } // end export_table()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1855
 
1856
  /**
1857
  * Check that the given table is of the desired type,
@@ -2033,6 +2761,8 @@ class WPMDB extends WPMDB_Base {
2033
  }
2034
  } elseif ( $this->state_data['intent'] == 'pull' ) {
2035
  echo apply_filters( 'wpmdb_before_response', $query_line );
 
 
2036
  }
2037
  }
2038
 
@@ -2044,8 +2774,13 @@ class WPMDB extends WPMDB_Base {
2044
  function transfer_chunk() {
2045
  $this->set_post_data();
2046
 
2047
- if ( $this->state_data['intent'] == 'savefile' || $this->state_data['stage'] == 'backup' ) {
2048
- $this->close( $this->fp );
 
 
 
 
 
2049
 
2050
  $result = array(
2051
  'current_row' => $this->row_tracker,
@@ -2171,6 +2906,20 @@ class WPMDB extends WPMDB_Base {
2171
  array( $this, 'options_page' ) );
2172
  $this->after_admin_menu( $hook_suffix );
2173
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2174
 
2175
  function admin_menu() {
2176
  $title = ( $this->is_pro ) ? __( 'Migrate DB Pro', 'wp-migrate-db' ) : __( 'Migrate DB', 'wp-migrate-db' );
@@ -2327,23 +3076,24 @@ class WPMDB extends WPMDB_Base {
2327
 
2328
  $plugins_url = trailingslashit( plugins_url( $this->plugin_folder_name ) );
2329
  $version = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? time() : $this->plugin_version;
 
2330
  $min = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
2331
 
2332
  $src = $plugins_url . 'asset/dist/css/styles.css';
2333
  wp_enqueue_style( 'wp-migrate-db-pro-styles', $src, array(), $version );
2334
 
2335
- $src = $plugins_url . "asset/dist/js/common$min.js";
2336
  wp_enqueue_script( 'wp-migrate-db-pro-common', $src, null, $version, true );
2337
 
2338
- $src = $plugins_url . "asset/dist/js/hook$min.js";
2339
  wp_enqueue_script( 'wp-migrate-db-pro-hook', $src, null, $version, true );
2340
 
2341
- $src = $plugins_url . "asset/dist/js/multisite$min.js";
2342
  wp_enqueue_script( 'wp-migrate-db-pro-multisite', $src, array( 'jquery' ), $version, true );
2343
 
2344
  do_action( 'wpmdb_load_assets' );
2345
 
2346
- $src = $plugins_url . "asset/dist/js/script$min.js";
2347
  wp_enqueue_script( 'wp-migrate-db-pro-script', $src, array( 'jquery', 'backbone' ), $version, true );
2348
 
2349
  wp_localize_script( 'wp-migrate-db-pro-script',
@@ -2391,17 +3141,21 @@ class WPMDB extends WPMDB_Base {
2391
  'connection_info_missing' => __( 'The connection information appears to be missing, please enter it to continue.', 'wp-migrate-db' ),
2392
  'connection_info_incorrect' => __( "The connection information appears to be incorrect, it should consist of two lines. The first being the remote server's URL and the second being the secret key.", 'wp-migrate-db' ),
2393
  'connection_info_url_invalid' => __( 'The URL on the first line appears to be invalid, please check it and try again.', 'wp-migrate-db' ),
2394
- 'connection_info_key_invalid' => __( 'The secret key on the second line appears to be invalid. It should be a 32 character string that consists of letters, numbers and special characters only.', 'wp-migrate-db' ),
2395
  'connection_info_local_url' => __( "It appears you've entered the URL for this website, you need to provide the URL of the remote website instead.", 'wp-migrate-db' ),
2396
  'connection_info_local_key' => __( 'Looks like your remote secret key is the same as the secret key for this site. To fix this, go to the <a href="#settings">Settings tab</a> and click "Reset Secret Key"', 'wp-migrate-db' ),
2397
  'time_elapsed' => __( 'Time Elapsed:', 'wp-migrate-db' ),
2398
  'pause' => _x( 'Pause', 'Temporarily stop migrating', 'wp-migrate-db' ),
2399
  'migration_paused' => _x( 'Migration Paused', 'The migration has been temporarily stopped', 'wp-migrate-db' ),
 
2400
  'resume' => _x( 'Resume', 'Restart migrating after it was paused', 'wp-migrate-db' ),
2401
  'completing_current_request' => __( 'Completing current request', 'wp-migrate-db' ),
2402
  'cancelling_migration' => _x( 'Cancelling migration', 'The migration is being cancelled', 'wp-migrate-db' ),
 
2403
  'paused' => _x( 'Paused', 'The migration has been temporarily stopped', 'wp-migrate-db' ),
 
2404
  'paused_before_finalize' => __( 'Automatically paused before migrated tables are replaced. Click "Resume" or "Cancel" when ready.', 'wp-migrate-db' ),
 
2405
  'removing_local_sql' => __( 'Removing the local MySQL export file', 'wp-migrate-db' ),
2406
  'removing_local_backup' => __( 'Removing the local backup MySQL export file', 'wp-migrate-db' ),
2407
  'removing_local_temp_tables' => __( 'Removing the local temporary tables', 'wp-migrate-db' ),
@@ -2411,6 +3165,8 @@ class WPMDB extends WPMDB_Base {
2411
  'manually_remove_temp_files' => __( 'A problem occurred while cancelling the migration, you may have to manually delete some temporary files / tables.', 'wp-migrate-db' ),
2412
  'migration_cancelled' => _x( 'Migration cancelled', 'The migration has been cancelled', 'wp-migrate-db' ),
2413
  'migration_cancelled_success' => __( 'The migration has been stopped and all temporary files and data have been cleaned up.', 'wp-migrate-db' ),
 
 
2414
  'migration_complete' => _x( 'Migration complete', 'The migration completed successfully', 'wp-migrate-db' ),
2415
  'finalizing_migration' => _x( 'Finalizing migration', 'The migration is in the last stages', 'wp-migrate-db' ),
2416
  'flushing' => _x( 'Flushing caches and rewrite rules', 'The caches and rewrite rules for the target are being flushed', 'wp-migrate-db' ),
@@ -2422,6 +3178,8 @@ class WPMDB extends WPMDB_Base {
2422
  'pull_migration_label_completed' => __( 'Pull from %s complete', 'wp-migrate-db' ),
2423
  'push_migration_label_migrating' => __( 'Pushing to %s…', 'wp-migrate-db' ),
2424
  'push_migration_label_completed' => __( 'Push to %s complete', 'wp-migrate-db' ),
 
 
2425
  'copying_license' => __( 'Copying license to the remote site, please wait', 'wp-migrate-db' ),
2426
  'attempting_to_activate_licence' => __( 'Attempting to activate your license, please wait…', 'wp-migrate-db' ),
2427
  'licence_reactivated' => __( 'License successfully activated, please wait…', 'wp-migrate-db' ),
@@ -2439,10 +3197,13 @@ class WPMDB extends WPMDB_Base {
2439
  'migrate_button_pull_save' => _x( 'Pull &amp; Save', 'Transfer the remote database to this site and save migration profile', 'wp-migrate-db' ),
2440
  'migrate_button_export' => _x( 'Export', 'Download a copy of the database', 'wp-migrate-db' ),
2441
  'migrate_button_export_save' => _x( 'Export &amp; Save', 'Download a copy of the database and save migration profile', 'wp-migrate-db' ),
 
 
2442
  'tables' => _x( 'Tables', 'database tables', 'wp-migrate-db'),
2443
  'files' => __( 'Files', 'wp-migrate-db'),
2444
  'migrated' => _x( 'Migrated', 'Transferred', 'wp-migrate-db' ),
2445
  'backed_up' => __( 'Backed Up', 'wp-migrate-db' ),
 
2446
  'hide' => _x( 'Hide', 'Obscure from view', 'wp-migrate-db' ),
2447
  'show' => _x( 'Show', 'Reveal', 'wp-migrate-db' ),
2448
  'welcome_title' => __( 'Welcome to WP Migrate DB Pro! &#127881;', 'wp-migrate-db' ),
@@ -2454,6 +3215,8 @@ class WPMDB extends WPMDB_Base {
2454
  'title_finalizing' => __( 'Finalizing', 'wp-migrate-db' ),
2455
  'title_complete' => __( 'Complete', 'wp-migrate-db' ),
2456
  'title_error' => __( 'Failed', 'wp-migrate-db' ),
 
 
2457
  )
2458
  );
2459
 
@@ -2520,6 +3283,9 @@ class WPMDB extends WPMDB_Base {
2520
  'reactivate_licence' => wp_create_nonce( 'reactivate-licence' ),
2521
  'process_notice_link' => wp_create_nonce( 'process-notice-link' ),
2522
  'flush' => wp_create_nonce( 'flush' ),
 
 
 
2523
  ) );
2524
 
2525
  $data = apply_filters( 'wpmdb_data', array(
@@ -2539,6 +3305,7 @@ class WPMDB extends WPMDB_Base {
2539
  'this_website_name' => sanitize_title_with_dashes( DB_NAME ),
2540
  'this_download_url' => network_admin_url( $this->plugin_base . '&download=' ),
2541
  'this_prefix' => $site_details['prefix'], // TODO: Remove backwards compatibility.
 
2542
  'this_plugin_base' => esc_html( $this->plugin_base ),
2543
  'is_multisite' => $site_details['is_multisite'], // TODO: Remove backwards compatibility.
2544
  'openssl_available' => esc_html( $this->open_ssl_enabled() ? 'true' : 'false' ),
@@ -2622,6 +3389,8 @@ class WPMDB extends WPMDB_Base {
2622
  * Called to cancel an in-progress migration.
2623
  */
2624
  function ajax_cancel_migration() {
 
 
2625
  $key_rules = array(
2626
  'action' => 'key',
2627
  'migration_state_id' => 'key',
@@ -2666,6 +3435,9 @@ class WPMDB extends WPMDB_Base {
2666
  $this->delete_temporary_tables( $this->state_data['temp_prefix'] );
2667
  }
2668
  break;
 
 
 
2669
  default:
2670
  break;
2671
  }
@@ -2812,6 +3584,13 @@ class WPMDB extends WPMDB_Base {
2812
  return $create_table;
2813
  }
2814
 
 
 
 
 
 
 
 
2815
  if ( version_compare( $db_version, '5.5.3', '<' ) ) {
2816
  // Remove index comments introduced in MySQL 5.5.3.
2817
  // Following regex matches any PRIMARY KEY or KEY statement on a table definition that has a COMMENT statement attached.
21
  protected $domain_replace;
22
  protected $checkbox_options;
23
  protected $find_replace_pairs = array();
24
+ protected $query_buffer = '';
25
+ protected $query_template = '';
26
+ protected $query_size = 0;
27
+ protected $first_select = true;
28
+ public $target_db_version = '';
29
 
30
  function __construct( $plugin_file_path ) {
31
  parent::__construct( $plugin_file_path );
40
  // internal AJAX handlers
41
  add_action( 'wp_ajax_wpmdb_delete_migration_profile', array( $this, 'ajax_delete_migration_profile' ) );
42
  add_action( 'wp_ajax_wpmdb_save_profile', array( $this, 'ajax_save_profile' ) );
43
+ add_action( 'wp_ajax_wpmdb_save_setting', array( $this, 'ajax_save_setting' ) );
44
  add_action( 'wp_ajax_wpmdb_initiate_migration', array( $this, 'ajax_initiate_migration' ) );
45
  add_action( 'wp_ajax_wpmdb_migrate_table', array( $this, 'ajax_migrate_table' ) );
46
  add_action( 'wp_ajax_wpmdb_clear_log', array( $this, 'ajax_clear_log' ) );
50
  add_action( 'wp_ajax_wpmdb_update_max_request_size', array( $this, 'ajax_update_max_request_size' ) );
51
  add_action( 'wp_ajax_wpmdb_update_delay_between_requests', array( $this, 'ajax_update_delay_between_requests' ) );
52
  add_action( 'wp_ajax_wpmdb_cancel_migration', array( $this, 'ajax_cancel_migration' ) );
53
+ add_action( 'wp_ajax_wpmdb_finalize_migration', array( $this, 'ajax_finalize_migration' ) );
54
+ add_action( 'wp_ajax_wpmdb_flush', array( $this, 'ajax_flush' ) );
55
+ add_action( 'wp_ajax_nopriv_wpmdb_flush', array( $this, 'ajax_nopriv_flush', ) );
56
 
57
  $this->accepted_fields = array(
58
  'action',
126
 
127
  if ( is_multisite() ) {
128
  add_action( 'network_admin_menu', array( $this, 'network_admin_menu' ) );
129
+ add_action( 'admin_menu', array( $this, 'network_tools_admin_menu' ) );
130
  /*
131
  * The URL find & replace is locked down (delete & reorder disabled) on multisite installations as we require the URL
132
  * of the remote site for export migrations. This URL is parsed into its various components and
163
  * Handler for ajax request to turn on or off Compatibility Mode.
164
  */
165
  function ajax_plugin_compatibility() {
166
+ $this->check_ajax_referer( 'plugin_compatibility' );
167
+
168
  $key_rules = array(
169
  'action' => 'key',
170
  'install' => 'numeric',
180
  exit;
181
  }
182
 
183
+ if ( ! @copy( $source, $dest ) ) {
184
  printf( esc_html__( 'Could not copy the compatibility plugin from %1$s to %2$s', 'wp-migrate-db' ), $source, $dest );
185
  exit;
186
  }
187
  } else { // uninstall MU plugin
188
  // TODO: Use WP_Filesystem API.
189
+ if ( file_exists( $dest ) && ! @unlink( $dest ) ) {
190
  printf( esc_html__( 'Could not remove the compatibility plugin from %s', 'wp-migrate-db' ), $dest );
191
  exit;
192
  }
198
  * Handler for updating the plugins that are not to be loaded during a request (Compatibility Mode).
199
  */
200
  function ajax_blacklist_plugins() {
201
+ $this->check_ajax_referer( 'blacklist_plugins' );
202
+
203
  $key_rules = array(
204
  'action' => 'key',
205
  'blacklist_plugins' => 'array',
385
  echo 'WordPress: ';
386
  echo bloginfo( 'version' );
387
  if ( is_multisite() ) {
388
+ $multisite_type = defined( 'SUBDOMAIN_INSTALL' ) && SUBDOMAIN_INSTALL ? 'Sub-domain' : 'Sub-directory';
389
+ echo ' Multisite (' . $multisite_type . ')';
390
+ echo "\r\n";
391
+
392
+ if ( defined( 'DOMAIN_CURRENT_SITE' ) ) {
393
+ echo 'Domain Current Site: ';
394
+ echo DOMAIN_CURRENT_SITE;
395
+ echo "\r\n";
396
+ }
397
+
398
+ if ( defined( 'PATH_CURRENT_SITE' ) ) {
399
+ echo 'Path Current Site: ';
400
+ echo PATH_CURRENT_SITE;
401
+ echo "\r\n";
402
+ }
403
+
404
+ if ( defined( 'SITE_ID_CURRENT_SITE' ) ) {
405
+ echo 'Site ID Current Site: ';
406
+ echo SITE_ID_CURRENT_SITE;
407
+ echo "\r\n";
408
+ }
409
+
410
+ if ( defined( 'BLOG_ID_CURRENT_SITE' ) ) {
411
+ echo 'Blog ID Current Site: ';
412
+ echo BLOG_ID_CURRENT_SITE;
413
+ }
414
  }
415
  echo "\r\n";
416
 
597
  foreach ( $mu_plugins as $mu_plugin ) {
598
  $this->print_plugin_details( $mu_plugin );
599
  }
600
+
601
+ echo "\r\n";
602
  }
603
  }
604
 
619
 
620
  function get_alter_queries() {
621
  global $wpdb;
622
+
623
  $alter_table_name = $this->get_alter_table_name();
624
+ $alter_queries = array();
625
  $sql = '';
 
626
 
627
+ if ( $alter_table_name === $wpdb->get_var( "SHOW TABLES LIKE '$alter_table_name'" ) ) {
628
+ $alter_queries = $wpdb->get_results( "SELECT * FROM `{$alter_table_name}`", ARRAY_A );
629
+ $alter_queries = apply_filters( 'wpmdb_get_alter_queries', $alter_queries );
630
+ }
631
 
632
  if ( ! empty( $alter_queries ) ) {
633
  foreach ( $alter_queries as $alter_query ) {
748
  return $result;
749
  }
750
 
751
+ // Pull and push need to be handled differently for obvious reasons,
752
+ // and trigger different code depending on the migration intent (push or pull).
753
+ if ( in_array( $this->state_data['intent'], array( 'push', 'savefile', 'find_replace' ) ) ) {
754
  $this->maximum_chunk_size = $this->get_bottleneck();
755
 
756
  if ( isset( $this->state_data['bottleneck'] ) ) {
757
  $this->maximum_chunk_size = (int) $this->state_data['bottleneck'];
758
  }
759
 
760
+ if ( 'savefile' === $this->state_data['intent'] ) {
761
+ $sql_dump_file_name = $this->get_upload_info( 'path' ) . DIRECTORY_SEPARATOR;
762
+ $sql_dump_file_name .= $this->format_dump_name( $this->state_data['dump_filename'] );
 
763
  $this->fp = $this->open( $sql_dump_file_name );
764
  }
765
 
 
766
  if ( ! empty( $this->state_data['db_version'] ) ) {
767
+ $this->target_db_version = $this->state_data['db_version'];
 
768
  if ( 'push' == $this->state_data['intent'] ) {
769
+ // $this->target_db_version has been set to remote database's version.
770
  add_filter( 'wpmdb_create_table_query', array( $this, 'mysql_compat_filter' ), 10, 5 );
771
  } elseif ( 'savefile' == $this->state_data['intent'] && ! empty( $this->form_data['compatibility_older_mysql'] ) ) {
772
  // compatibility_older_mysql is currently a checkbox meaning pre-5.5 compatibility (we play safe and target 5.1),
773
  // this may change in the future to be a dropdown or radiobox returning the version to be compatible with.
774
+ $this->target_db_version = '5.1';
775
  add_filter( 'wpmdb_create_table_query', array( $this, 'mysql_compat_filter' ), 10, 5 );
776
  }
777
  }
781
  }
782
 
783
  ob_start();
784
+ $result = $this->process_table( $this->state_data['table'] );
785
 
786
  if ( $this->state_data['intent'] == 'savefile' && isset( $this->fp ) ) {
787
  $this->close( $this->fp );
916
  // A little bit of house keeping.
917
  WPMDB_Migration_State::cleanup();
918
 
919
+ if ( 'savefile' === $this->state_data['intent'] || 'find_replace' === $this->state_data['intent'] ) {
920
  $return = array(
921
  'code' => 200,
922
  'message' => 'OK',
923
  'body' => json_encode( array( 'error' => 0 ) ),
924
  );
925
 
926
+ if ( 'find_replace' !== $this->state_data['intent'] || 'backup' === $this->state_data['stage'] ) {
927
+ $return['dump_path'] = $this->get_sql_dump_info( 'migrate', 'path' );
928
+ $return['dump_filename'] = basename( $return['dump_path'] );
929
+ $return['dump_url'] = $this->get_sql_dump_info( 'migrate', 'url' );
930
+ $dump_filename_no_extension = substr( $return['dump_filename'], 0, -4 );
931
 
932
+ $create_alter_table_query = $this->get_create_alter_table_query();
933
+ // sets up our table to store 'ALTER' queries
934
+ $process_chunk_result = $this->process_chunk( $create_alter_table_query );
935
 
936
+ if ( true !== $process_chunk_result ) {
937
+ $result = $this->end_ajax( $process_chunk_result );
938
 
939
+ return $result;
940
+ }
941
 
942
+ if ( 'savefile' === $this->state_data['intent'] && $this->gzip() && isset( $this->form_data['gzip_file'] ) && $this->form_data['gzip_file'] ) {
943
+ $return['dump_path'] .= '.gz';
944
+ $return['dump_filename'] .= '.gz';
945
+ $return['dump_url'] .= '.gz';
946
+ }
947
 
948
+ $this->fp = $this->open( $this->get_upload_info( 'path' ) . DIRECTORY_SEPARATOR . $return['dump_filename'] );
949
+ $this->db_backup_header();
950
+ $this->close( $this->fp );
951
+
952
+ $return['dump_filename'] = $dump_filename_no_extension;
953
+ }
954
 
 
955
  } else { // does one last check that our verification string is valid
956
  $data = array(
957
  'action' => 'wpmdb_remote_initiate_migration',
974
  return $result;
975
  }
976
 
977
+ $return = WPMDB_Utils::unserialize( $response, __METHOD__ );
978
 
979
  if ( false === $return ) {
980
  $error_msg = __( 'Failed attempting to unserialize the response from the remote server. Please contact support.', 'wp-migrate-db' );
1034
  return $result;
1035
  }
1036
 
1037
+ /**
1038
+ * After table migration, delete old tables and rename new tables removing the temporarily prefix.
1039
+ *
1040
+ * @return mixed
1041
+ */
1042
+ function ajax_finalize_migration() {
1043
+ $this->check_ajax_referer( 'finalize-migration' );
1044
+
1045
+ $key_rules = array(
1046
+ 'action' => 'key',
1047
+ 'migration_state_id' => 'key',
1048
+ 'prefix' => 'string',
1049
+ 'tables' => 'string',
1050
+ 'nonce' => 'key',
1051
+ );
1052
+ $this->set_post_data( $key_rules );
1053
+
1054
+ if ( 'savefile' === $this->state_data['intent'] ) {
1055
+ return true;
1056
+ }
1057
+
1058
+ $this->form_data = $this->parse_migration_form_data( $this->state_data['form_data'] );
1059
+
1060
+ global $wpdb;
1061
+
1062
+ if ( 'push' === $this->state_data['intent'] ) {
1063
+ do_action( 'wpmdb_migration_complete', 'push', $this->state_data['url'] );
1064
+ $data = $this->filter_post_elements(
1065
+ $this->state_data,
1066
+ array(
1067
+ 'remote_state_id',
1068
+ 'url',
1069
+ 'form_data',
1070
+ 'tables',
1071
+ 'temp_prefix',
1072
+ )
1073
+ );
1074
+
1075
+ $data['action'] = 'wpmdb_remote_finalize_migration';
1076
+ $data['intent'] = 'pull';
1077
+ $data['prefix'] = $wpdb->base_prefix;
1078
+ $data['type'] = 'push';
1079
+ $data['location'] = home_url();
1080
+ $data['sig'] = $this->create_signature( $data, $this->state_data['key'] );
1081
+ $ajax_url = $this->ajax_url();
1082
+ $response = $this->remote_post( $ajax_url, $data, __FUNCTION__ );
1083
+ ob_start();
1084
+ echo esc_html( $response );
1085
+ $this->display_errors();
1086
+ $return = ob_get_clean();
1087
+ } else {
1088
+ $return = $this->finalize_migration();
1089
+ }
1090
+
1091
+ $result = $this->end_ajax( $return );
1092
+
1093
+ return $result;
1094
+ }
1095
+
1096
+ /**
1097
+ * Internal function for finalizing a migration.
1098
+ *
1099
+ * @return bool|null
1100
+ */
1101
+ function finalize_migration() {
1102
+ $this->set_post_data();
1103
+ $tables = explode( ',', $this->state_data['tables'] );
1104
+ $temp_prefix = ( isset( $this->state_data['temp_prefix'] ) ) ? $this->state_data['temp_prefix'] : $this->temp_prefix;
1105
+ $temp_tables = array();
1106
+ $type = $this->state_data['intent'];
1107
+
1108
+ if ( isset( $this->state_data['type'] ) && 'push' === $this->state_data['type'] ) {
1109
+ $type = 'push';
1110
+ }
1111
+
1112
+ if ( 'find_replace' === $this->state_data['intent'] ) {
1113
+ $location = home_url();
1114
+ } else {
1115
+ $location = ( isset( $this->state_data['location'] ) ) ? $this->state_data['location'] : $this->state_data['url'];
1116
+ }
1117
+
1118
+ foreach ( $tables as $table ) {
1119
+ $temp_tables[] = $temp_prefix . apply_filters(
1120
+ 'wpmdb_finalize_target_table_name',
1121
+ $table,
1122
+ $type,
1123
+ $this->state_data['site_details']
1124
+ );
1125
+ }
1126
+
1127
+ $sql = "SET FOREIGN_KEY_CHECKS=0;\n";
1128
+
1129
+ $sql .= $this->get_preserved_options_queries( $temp_tables, $type );
1130
+
1131
+ foreach ( $temp_tables as $table ) {
1132
+ $sql .= 'DROP TABLE IF EXISTS ' . $this->backquote( substr( $table, strlen( $temp_prefix ) ) ) . ';';
1133
+ $sql .= "\n";
1134
+ $sql .= 'RENAME TABLE ' . $this->backquote( $table ) . ' TO ' . $this->backquote( substr( $table, strlen( $temp_prefix ) ) ) . ';';
1135
+ $sql .= "\n";
1136
+ }
1137
+
1138
+ $alter_table_name = $this->get_alter_table_name();
1139
+ $sql .= $this->get_alter_queries();
1140
+ $sql .= 'DROP TABLE IF EXISTS ' . $this->backquote( $alter_table_name ) . ";\n";
1141
+
1142
+ $process_chunk_result = $this->process_chunk( $sql );
1143
+ if ( true !== $process_chunk_result ) {
1144
+ $result = $this->end_ajax( $process_chunk_result );
1145
+
1146
+ return $result;
1147
+ }
1148
+
1149
+ if ( ! isset( $this->state_data['location'] ) && 'find_replace' !== $this->state_data['intent'] ) {
1150
+ $data = array();
1151
+ $data['action'] = 'wpmdb_fire_migration_complete';
1152
+ $data['url'] = home_url();
1153
+ $data['sig'] = $this->create_signature( $data, $this->state_data['key'] );
1154
+ $ajax_url = $this->ajax_url();
1155
+ $response = $this->remote_post( $ajax_url, $data, __FUNCTION__ );
1156
+ ob_start();
1157
+ echo esc_html( $response );
1158
+ $this->display_errors();
1159
+ $maybe_errors = trim( ob_get_clean() );
1160
+ if ( false === empty( $maybe_errors ) && '1' !== $maybe_errors ) {
1161
+ $maybe_errors = array( 'wpmdb_error' => 1, 'body' => $maybe_errors );
1162
+ $result = $this->end_ajax( json_encode( $maybe_errors ) );
1163
+
1164
+ return $result;
1165
+ }
1166
+ }
1167
+
1168
+ do_action( 'wpmdb_migration_complete', $type, $location );
1169
+
1170
+ return true;
1171
+ }
1172
+
1173
+ /**
1174
+ * Returns SQL queries used to preserve options in the
1175
+ * wp_options or wp_sitemeta tables during a migration.
1176
+ *
1177
+ * @param array $temp_tables
1178
+ * @param string $intent
1179
+ *
1180
+ * @return string DELETE and INSERT SQL queries separated by a newline character (\n).
1181
+ */
1182
+ function get_preserved_options_queries( $temp_tables, $intent = '' ) {
1183
+ $this->set_post_data();
1184
+ global $wpdb;
1185
+
1186
+ $sql = '';
1187
+ $sitemeta_table_name = '';
1188
+ $options_table_names = array();
1189
+
1190
+ $temp_prefix = isset( $this->state_data['temp_prefix'] ) ? $this->state_data['temp_prefix'] : $this->temp_prefix;
1191
+ $table_prefix = isset( $this->state_data['prefix'] ) ? $this->state_data['prefix'] : $wpdb->base_prefix;
1192
+ $prefix = esc_sql( $temp_prefix . $table_prefix );
1193
+
1194
+ foreach ( $temp_tables as $temp_table ) {
1195
+ $table = $wpdb->base_prefix . str_replace( $prefix, '', $temp_table );
1196
+
1197
+ // Get sitemeta table
1198
+ if ( is_multisite() && $this->table_is( 'sitemeta', $table ) ) {
1199
+ $sitemeta_table_name = $temp_table;
1200
+ }
1201
+
1202
+ // Get array of options tables
1203
+ if ( $this->table_is( 'options', $table ) ) {
1204
+ $options_table_names[] = $temp_table;
1205
+ }
1206
+ }
1207
+
1208
+ // Return if multisite but sitemeta and option tables not in migration scope
1209
+ if ( is_multisite() && true === empty( $sitemeta_table_name ) && true === empty( $options_table_names ) ) {
1210
+ return $sql;
1211
+ }
1212
+
1213
+ // Return if options tables not in migration scope for non-multisite.
1214
+ if ( ! is_multisite() && true === empty( $options_table_names ) ) {
1215
+ return $sql;
1216
+ }
1217
+
1218
+ $preserved_options = array(
1219
+ 'wpmdb_settings',
1220
+ 'wpmdb_error_log',
1221
+ 'wpmdb_schema_version',
1222
+ 'upload_path',
1223
+ 'upload_url_path',
1224
+ );
1225
+
1226
+ $preserved_sitemeta_options = $preserved_options;
1227
+
1228
+ $this->form_data = $this->parse_migration_form_data( $this->state_data['form_data'] );
1229
+
1230
+ if ( false === empty( $this->form_data['keep_active_plugins'] ) ) {
1231
+ $preserved_options[] = 'active_plugins';
1232
+ $preserved_sitemeta_options[] = 'active_sitewide_plugins';
1233
+ }
1234
+
1235
+ if ( is_multisite() ) {
1236
+ // Get preserved data in site meta table if being replaced.
1237
+ if ( ! empty( $sitemeta_table_name ) ) {
1238
+ $table = $wpdb->base_prefix . str_replace( $prefix, '', $sitemeta_table_name );
1239
+
1240
+ $preserved_migration_state_options = $wpdb->get_results(
1241
+ "SELECT `meta_key` FROM `{$table}` WHERE `meta_key` LIKE '" . WPMDB_Migration_State::OPTION_PREFIX . "%'",
1242
+ OBJECT_K
1243
+ );
1244
+
1245
+ if ( ! empty( $preserved_migration_state_options ) ) {
1246
+ $preserved_sitemeta_options = array_merge( $preserved_sitemeta_options, array_keys( $preserved_migration_state_options ) );
1247
+ }
1248
+
1249
+ $preserved_sitemeta_options = apply_filters( 'wpmdb_preserved_sitemeta_options', $preserved_sitemeta_options, $intent );
1250
+ $preserved_sitemeta_options_escaped = esc_sql( $preserved_sitemeta_options );
1251
+
1252
+ $preserved_sitemeta_options_data = $wpdb->get_results(
1253
+ sprintf(
1254
+ "SELECT * FROM `{$table}` WHERE `meta_key` IN ('%s')",
1255
+ implode( "','", $preserved_sitemeta_options_escaped )
1256
+ ),
1257
+ ARRAY_A
1258
+ );
1259
+
1260
+ $preserved_sitemeta_options_data = apply_filters( 'wpmdb_preserved_sitemeta_options_data', $preserved_sitemeta_options_data, $intent );
1261
+
1262
+ // Create preserved data queries for site meta table
1263
+ foreach ( $preserved_sitemeta_options_data as $option ) {
1264
+ $sql .= $wpdb->prepare( "DELETE FROM `{$sitemeta_table_name}` WHERE `meta_key` = %s;\n", $option['meta_key'] );
1265
+ $sql .= $wpdb->prepare(
1266
+ "INSERT INTO `{$sitemeta_table_name}` ( `meta_id`, `site_id`, `meta_key`, `meta_value` ) VALUES ( NULL , %s, %s, %s );\n",
1267
+ $option['site_id'],
1268
+ $option['meta_key'],
1269
+ $option['meta_value']
1270
+ );
1271
+ }
1272
+ }
1273
+ } else {
1274
+ $preserved_migration_state_options = $wpdb->get_results(
1275
+ "SELECT `option_name` FROM `{$wpdb->options}` WHERE `option_name` LIKE '" . WPMDB_Migration_State::OPTION_PREFIX . "%'",
1276
+ OBJECT_K
1277
+ );
1278
+
1279
+ if ( ! empty( $preserved_migration_state_options ) ) {
1280
+ $preserved_options = array_merge( $preserved_options, array_keys( $preserved_migration_state_options ) );
1281
+ }
1282
+ }
1283
+
1284
+ // Get preserved data in options tables if being replaced.
1285
+ if ( ! empty( $options_table_names ) ) {
1286
+ $preserved_options = apply_filters( 'wpmdb_preserved_options', $preserved_options, $intent );
1287
+ $preserved_options_escaped = esc_sql( $preserved_options );
1288
+
1289
+ $preserved_options_data = array();
1290
+
1291
+ // Get preserved data in options tables
1292
+ foreach ( $options_table_names as $option_table ) {
1293
+ $table = $wpdb->base_prefix . str_replace( $prefix, '', $option_table );
1294
+
1295
+ $preserved_options_data[ $option_table ] = $wpdb->get_results(
1296
+ sprintf(
1297
+ "SELECT * FROM `{$table}` WHERE `option_name` IN ('%s')",
1298
+ implode( "','", $preserved_options_escaped )
1299
+ ),
1300
+ ARRAY_A
1301
+ );
1302
+ }
1303
+
1304
+ $preserved_options_data = apply_filters( 'wpmdb_preserved_options_data', $preserved_options_data, $intent );
1305
+
1306
+ // Create preserved data queries for options tables
1307
+ foreach ( $preserved_options_data as $key => $value ) {
1308
+ if ( false === empty( $value ) ) {
1309
+ foreach ( $value as $option ) {
1310
+ $sql .= $wpdb->prepare(
1311
+ "DELETE FROM `{$key}` WHERE `option_name` = %s;\n",
1312
+ $option['option_name']
1313
+ );
1314
+
1315
+ $sql .= $wpdb->prepare(
1316
+ "INSERT INTO `{$key}` ( `option_id`, `option_name`, `option_value`, `autoload` ) VALUES ( NULL , %s, %s, %s );\n",
1317
+ $option['option_name'],
1318
+ $option['option_value'],
1319
+ $option['autoload']
1320
+ );
1321
+ }
1322
+ }
1323
+ }
1324
+ }
1325
+
1326
+ return $sql;
1327
+ }
1328
+
1329
+ /**
1330
+ * Handles the request to flush caches and cleanup migration when pushing or not migrating user tables.
1331
+ *
1332
+ * @return bool|null
1333
+ */
1334
+ function ajax_flush() {
1335
+ $this->check_ajax_referer( 'flush' );
1336
+
1337
+ return $this->ajax_nopriv_flush();
1338
+ }
1339
+
1340
+ /**
1341
+ * Handles the request to flush caches and cleanup migration when pulling with user tables being migrated.
1342
+ *
1343
+ * @return bool|null
1344
+ */
1345
+ function ajax_nopriv_flush() {
1346
+ $key_rules = array(
1347
+ 'action' => 'key',
1348
+ 'migration_state_id' => 'key',
1349
+ );
1350
+ $this->set_post_data( $key_rules );
1351
+
1352
+
1353
+ if ( 'push' === $this->state_data['intent'] ) {
1354
+ $data = array();
1355
+ $data['action'] = 'wpmdb_remote_flush';
1356
+ $data['sig'] = $this->create_signature( $data, $this->state_data['key'] );
1357
+ $ajax_url = $this->ajax_url();
1358
+ $response = $this->remote_post( $ajax_url, $data, __FUNCTION__ );
1359
+ ob_start();
1360
+ echo esc_html( $response );
1361
+ $this->display_errors();
1362
+ $return = ob_get_clean();
1363
+ } else {
1364
+ $return = $this->flush();
1365
+ }
1366
+
1367
+ if ( ! $this->migration_state->delete() ) {
1368
+ $this->log_error( 'Could not delete migration state.' );
1369
+ }
1370
+
1371
+ $result = $this->end_ajax( $return );
1372
+
1373
+ return $result;
1374
+ }
1375
+
1376
+ /**
1377
+ * Flushes the cache and rewrite rules.
1378
+ *
1379
+ * @return bool
1380
+ */
1381
+ function flush() {
1382
+ // flush rewrite rules to prevent 404s and other oddities
1383
+ wp_cache_flush();
1384
+ global $wp_rewrite;
1385
+ $wp_rewrite->init();
1386
+ flush_rewrite_rules( true ); // true = hard refresh, recreates the .htaccess file
1387
+
1388
+ return true;
1389
+ }
1390
+
1391
  /**
1392
  * Handler for the ajax request to save a migration profile.
1393
  *
1455
  return $result;
1456
  }
1457
 
1458
+ /**
1459
+ * Handler for ajax request to save a setting, e.g. accept pull/push requests setting.
1460
+ *
1461
+ * @return bool|null
1462
+ */
1463
+ function ajax_save_setting() {
1464
+ $this->check_ajax_referer( 'save-setting' );
1465
+
1466
+ $key_rules = array(
1467
+ 'action' => 'key',
1468
+ 'checked' => 'bool',
1469
+ 'setting' => 'key',
1470
+ 'nonce' => 'key',
1471
+ );
1472
+ $this->set_post_data( $key_rules );
1473
+
1474
+ $this->settings[ $this->state_data['setting'] ] = ( $this->state_data['checked'] == 'false' ) ? false : true;
1475
+ update_site_option( 'wpmdb_settings', $this->settings );
1476
+ $result = $this->end_ajax();
1477
+
1478
+ return $result;
1479
+ }
1480
+
1481
  function format_table_sizes( $size ) {
1482
  $size *= 1024;
1483
 
1493
  global $wpdb;
1494
 
1495
  if ( is_multisite() ) {
1496
+ $tables = $this->get_tables( 'prefix' );
1497
  $sql = "SELECT `post_type` FROM `{$wpdb->base_prefix}posts` ";
1498
  $prefix_escaped = preg_quote( $wpdb->base_prefix, '/' );
1499
 
1616
  function options_page() {
1617
  $this->template( 'options' );
1618
  }
1619
+
1620
+ /**
1621
+ * Load Tools HTML template for tools menu on sites in a Network to help users find WPMDB in Multisite
1622
+ *
1623
+ */
1624
+ function subsite_tools_options_page() {
1625
+ $this->template( 'options-tools-subsite' );
1626
+ }
1627
 
1628
  /**
1629
  * Get the remote site's base domain for subdomain multisite search/replace.
1751
  }
1752
 
1753
  /**
1754
+ * Loops over data in the provided table to perform a migration.
 
 
 
 
1755
  *
1756
  * @param string $table
 
1757
  *
1758
  * @return mixed
1759
  */
1760
+ function process_table( $table ) {
1761
  global $wpdb;
 
 
 
 
 
 
1762
 
1763
+ // Setup form data
1764
+ $this->setup_form_data();
1765
 
1766
+ $temp_prefix = ( isset( $this->state_data['temp_prefix'] ) ? $this->state_data['temp_prefix'] : $this->temp_prefix );
 
 
 
 
 
 
 
 
1767
  $site_details = empty( $this->state_data['site_details'] ) ? array() : $this->state_data['site_details'];
1768
+ $target_table_name = apply_filters( 'wpmdb_target_table_name', $table, $this->form_data['action'], $this->state_data['stage'], $site_details );
1769
+ $temp_table_name = $temp_prefix . $target_table_name;
1770
+ $structure_info = $this->get_structure_info( $table );
1771
+ $row_start = $this->get_current_row();
1772
+ $this->row_tracker = $row_start;
 
 
 
1773
 
1774
+ if ( ! is_array ( $structure_info ) ) {
1775
+ return $structure_info;
 
 
 
1776
  }
1777
 
1778
+ $this->pre_process_data( $table, $target_table_name, $temp_table_name );
 
 
1779
 
1780
+ do {
1781
+ // Build and run the query
1782
+ $select_sql = $this->build_select_query( $table, $row_start, $structure_info );
1783
+ $table_data = $wpdb->get_results( $select_sql );
1784
+
1785
+ if ( ! is_array( $table_data ) ) continue;
1786
+
1787
+ $to_search = isset( $this->find_replace_pairs['replace_old'] ) ? $this->find_replace_pairs['replace_old'] : '';
1788
+ $to_replace = isset( $this->find_replace_pairs['replace_new'] ) ? $this->find_replace_pairs['replace_new'] : '';
1789
+ $replacer = new WPMDB_Replace( array(
1790
+ 'table' => ( 'find_replace' === $this->state_data['stage'] ) ? $temp_table_name : $table,
1791
+ 'search' => $to_search,
1792
+ 'replace' => $to_replace,
1793
+ 'intent' => $this->state_data['intent'],
1794
+ 'base_domain' => $this->get_domain_replace(),
1795
+ 'site_domain' => $this->get_domain_current_site(),
1796
+ 'wpmdb' => $this,
1797
+ 'site_details' => $site_details,
1798
+ ) );
1799
+
1800
+ $this->start_query_buffer( $target_table_name, $temp_table_name, $structure_info );
1801
+
1802
+ // Loop over the results
1803
+ foreach ( $table_data as $row ) {
1804
+ $result = $this->process_row( $table, $replacer, $row, $structure_info );
1805
+ if ( ! is_bool( $result ) ) {
1806
+ return $result;
1807
+ }
1808
  }
 
1809
 
1810
+ $this->stow_query_buffer();
1811
+ $row_start += $this->rows_per_segment;
 
 
 
 
 
 
 
1812
 
1813
+ } while ( count( $table_data ) > 0 );
1814
 
1815
+ // Finalize and return.
1816
+ $this->post_process_data( $table, $target_table_name );
1817
+ return $this->transfer_chunk();
1818
+ }
1819
 
1820
+ /**
1821
+ * Initializes the query buffer and template.
1822
+ *
1823
+ * @param $target_table_name
1824
+ * @param $temp_table_name
1825
+ * @param $structure_info
1826
+ *
1827
+ * @return null
1828
+ */
1829
+ function start_query_buffer( $target_table_name, $temp_table_name, $structure_info ) {
1830
+ if ( 'find_replace' !== $this->state_data['stage'] ) {
1831
+ $fields = implode( ', ', $structure_info['field_set'] );
1832
+ $table_to_insert = $temp_table_name;
1833
+
1834
+ if ( 'savefile' === $this->form_data['action'] || 'backup' === $this->state_data['stage'] ) {
1835
+ $table_to_insert = $target_table_name;
1836
  }
 
1837
 
1838
+ $this->query_template = 'INSERT INTO ' . $this->backquote( $table_to_insert ) . ' ( ' . $fields . ") VALUES\n";
1839
+ }
1840
 
1841
+ $this->query_buffer = $this->query_template;
1842
+ }
1843
 
1844
+ /**
1845
+ * Responsible for stowing a chunk of processed data.
1846
+ */
1847
+ function stow_query_buffer() {
1848
+ if ( $this->query_buffer !== $this->query_template ) {
1849
+ $this->query_buffer = rtrim( $this->query_buffer, "\n," );
1850
+ $this->query_buffer .= " ;\n";
1851
+ $this->stow( $this->query_buffer );
1852
+ $this->query_buffer = $this->query_template;
1853
+ $this->query_size = 0;
1854
+ }
1855
+ }
1856
 
1857
+ /**
1858
+ * Sets up the form data for the migration.
1859
+ */
1860
+ function setup_form_data() {
1861
+ $this->set_time_limit();
1862
+ $this->set_post_data();
1863
 
1864
+ if ( empty( $this->form_data ) ) {
1865
+ $this->form_data = $this->parse_migration_form_data( $this->state_data['form_data'] );
1866
+ }
1867
+ }
 
 
 
1868
 
1869
+ /**
1870
+ * Returns the current row, checking the state data.
1871
+ *
1872
+ * @return int
1873
+ */
1874
+ function get_current_row() {
1875
+ $current_row = 0;
1876
+
1877
+ if ( ! empty( $this->state_data['current_row'] ) ) {
1878
+ $temp_current_row = trim( $this->state_data['current_row'] );
1879
+ if ( ! empty( $temp_current_row ) ) {
1880
+ $current_row = (int) $temp_current_row;
1881
  }
1882
+ }
1883
 
1884
+ $current_row = ( 0 > $current_row ) ? 0 : $current_row;
 
1885
 
1886
+ return $current_row;
1887
+ }
 
 
 
 
 
 
 
 
1888
 
1889
+ /**
1890
+ * Returns the table structure for the provided table.
1891
+ *
1892
+ * @param string $table
1893
+ *
1894
+ * @return array|bool
1895
+ */
1896
+ function get_table_structure( $table ) {
1897
+ global $wpdb;
1898
 
1899
+ $table_structure = false;
1900
+
1901
+ if ( $this->table_exists( $table ) ) {
1902
+ $table_structure = $wpdb->get_results( 'DESCRIBE ' . $this->backquote( $table ) );
1903
+ }
1904
+
1905
+ if ( ! $table_structure ) {
1906
+ $this->error = __( 'Failed to retrieve table structure, please ensure your database is online. (#125)', 'wp-migrate-db' );
1907
+ }
1908
+
1909
+ return $table_structure;
1910
+ }
1911
+
1912
+ /**
1913
+ * Parses the provided table structure.
1914
+ *
1915
+ * @param array $table_structure
1916
+ *
1917
+ * @return array
1918
+ */
1919
+ function get_structure_info( $table, $table_structure = array() ) {
1920
+ if ( empty( $table_structure ) ) {
1921
+ $table_structure = $this->get_table_structure( $table );
1922
+ }
1923
+
1924
+ if ( ! is_array( $table_structure ) ) {
1925
+ $return = array( 'wpmdb_error' => 1, 'body' => __( 'Failed to get table structure.', 'wpmdb' ) );
1926
+ $result = $this->end_ajax( json_encode( $return ) );
1927
+ return $result;
1928
  }
1929
 
1930
  // $defs = mysql defaults, looks up the default for that particular column, used later on to prevent empty inserts values for that column
1931
  // $ints = holds a list of the possible integer types so as to not wrap them in quotation marks later in the insert statements
1932
+ $defs = array();
1933
+ $ints = array();
1934
+ $bins = array();
1935
+ $bits = array();
1936
+ $field_set = array();
1937
+ $this->primary_keys = array();
1938
+ $use_primary_keys = true;
1939
+
1940
  foreach ( $table_structure as $struct ) {
1941
  if ( ( 0 === strpos( $struct->Type, 'tinyint' ) ) ||
1942
  ( 0 === strpos( strtolower( $struct->Type ), 'smallint' ) ) ||
1951
  } elseif ( 0 === strpos( $struct->Type, 'bit' ) ) {
1952
  $bits[ strtolower( $struct->Field ) ] = '1';
1953
  }
 
1954
 
1955
+ $field_set[] = $this->backquote( $struct->Field );
 
 
 
 
 
 
1956
 
1957
+ if ( 'PRI' === $struct->Key && true === $use_primary_keys ) {
1958
+ if ( false === strpos( $struct->Type, 'int' ) ) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1959
  $use_primary_keys = false;
1960
  $this->primary_keys = array();
1961
  continue;
1962
  }
1963
+ $this->primary_keys[ $struct->Field ] = 0;
1964
  }
1965
  }
1966
 
 
1967
  if ( ! empty( $this->state_data['primary_keys'] ) ) {
1968
  $this->state_data['primary_keys'] = trim( $this->state_data['primary_keys'] );
1969
+ $this->primary_keys = WPMDB_Utils::unserialize( stripslashes( $this->state_data['primary_keys'] ), __METHOD__ );
1970
+ if ( false !== $this->primary_keys && ! empty( $this->state_data['primary_keys'] ) ) {
1971
+ $this->first_select = false;
1972
  }
1973
  }
1974
 
1975
+ $return = array(
1976
+ 'defs' => $defs,
1977
+ 'ints' => $ints,
1978
+ 'bins' => $bins,
1979
+ 'bits' => $bits,
1980
+ 'field_set' => $field_set,
1981
+ );
1982
 
1983
+ return $return;
1984
+ }
1985
 
1986
+ /**
1987
+ * Runs before processing the data in a table.
1988
+ *
1989
+ * @param string $table
1990
+ * @param string $target_table_name
1991
+ * @param string $temp_table_name
1992
+ */
1993
+ function pre_process_data( $table, $target_table_name, $temp_table_name ) {
1994
+ if ( 0 !== $this->row_tracker ) return;
1995
+
1996
+ if ( 'find_replace' === $this->form_data['action'] ) {
1997
+ if ( 'backup' === $this->state_data['stage'] ) {
1998
+ $this->build_table_header( $table, $target_table_name, $temp_table_name );
1999
+ } else {
2000
+ $create = $this->create_temp_table( $table );
2001
+
2002
+ if ( true !== $create ) {
2003
+ $message = sprintf( __( 'Error creating temporary table. Table "%s" does not exist.', 'wp-migrate-db' ), esc_html( $table ) );
2004
+ return $this->end_ajax( json_encode( array( 'wpmdb_error', 1, 'body' => $message ) ) );
2005
  }
2006
  }
2007
+ } else {
2008
+ $this->build_table_header( $table, $target_table_name, $temp_table_name );
2009
+ }
2010
+
2011
+ /**
2012
+ * Fires just before processing the data for a table.
2013
+ *
2014
+ * @param string $table
2015
+ * @param string $target_table_name
2016
+ * @param string $temp_table_name
2017
+ */
2018
+ do_action( 'wpmdb_pre_process_table_data', $table, $target_table_name, $temp_table_name );
2019
+ }
2020
+
2021
+ /**
2022
+ * Creates a temporary table with a copy of the existing table's data.
2023
+ *
2024
+ * @param $table
2025
+ *
2026
+ * @return bool|mixed
2027
+ */
2028
+ function create_temp_table( $table ) {
2029
+ if ( $this->table_exists( $table ) ) {
2030
+ $src_table = $this->backquote( $table );
2031
+ $temp_table = $this->backquote( $this->temp_prefix . $table );
2032
+ $query = "DROP TABLE IF EXISTS {$temp_table};\n";
2033
+ $query .= "CREATE TABLE {$temp_table} LIKE {$src_table};\n";
2034
+ $query .= "INSERT INTO {$temp_table} SELECT * FROM {$src_table};";
2035
 
2036
+ return $this->process_chunk( $query );
2037
+ }
2038
+
2039
+ return false;
2040
+ }
2041
+
2042
+ /**
2043
+ * Checks if a given table exists.
2044
+ *
2045
+ * @param $table
2046
+ *
2047
+ * @return bool
2048
+ */
2049
+ function table_exists( $table ) {
2050
+ global $wpdb;
2051
+
2052
+ $table = esc_sql( $table );
2053
+
2054
+ if ( $wpdb->get_var( "SHOW TABLES LIKE '$table'" ) ) {
2055
+ return true;
2056
+ }
2057
+
2058
+ return false;
2059
+ }
2060
+
2061
+ /**
2062
+ * Runs after processing data in a table.
2063
+ *
2064
+ * @param string $table
2065
+ * @param string $target_table_name
2066
+ */
2067
+ function post_process_data( $table, $target_table_name ) {
2068
+ if ( 'savefile' == $this->form_data['action'] || 'backup' == $this->state_data['stage'] ) {
2069
+ $this->build_table_footer( $table, $target_table_name );
2070
+ }
2071
+
2072
+ /**
2073
+ * Fires just after processing the data for a table.
2074
+ *
2075
+ * @param string $table
2076
+ * @param string $target_table_name
2077
+ */
2078
+ do_action( 'wpmdb_post_process_table_data', $table, $target_table_name );
2079
+
2080
+ $this->row_tracker = -1;
2081
+ }
2082
+
2083
+ /**
2084
+ * Creates the header for a table in a SQL file.
2085
+ *
2086
+ * @param string $table
2087
+ * @param string $target_table_name
2088
+ * @param string $temp_table_name
2089
+ *
2090
+ * @return null|bool
2091
+ */
2092
+ function build_table_header( $table, $target_table_name, $temp_table_name ) {
2093
+ global $wpdb;
2094
+
2095
+ // Don't stow data until after `wpmdb_create_table_query` filter is applied as mysql_compat_filter() can return an error
2096
+ $stow = '';
2097
+ $is_backup = false;
2098
+ $table_to_stow = $temp_table_name;
2099
+
2100
+ if ( 'savefile' === $this->form_data['action'] || 'backup' === $this->state_data['stage'] ) {
2101
+ $is_backup = true;
2102
+ $table_to_stow = $target_table_name;
2103
+ }
2104
+
2105
+ // Add SQL statement to drop existing table
2106
+ if ( $is_backup ) {
2107
+ $stow .= ( "\n\n" );
2108
+ $stow .= ( "#\n" );
2109
+ $stow .= ( '# ' . sprintf( __( 'Delete any existing table %s', 'wp-migrate-db' ), $this->backquote( $table_to_stow ) ) . "\n" );
2110
+ $stow .= ( "#\n" );
2111
+ $stow .= ( "\n" );
2112
+ }
2113
+ $stow .= ( 'DROP TABLE IF EXISTS ' . $this->backquote( $table_to_stow ) . ";\n" );
2114
+
2115
+ // Table structure
2116
+ // Comment in SQL-file
2117
+ if ( $is_backup ) {
2118
+ $stow .= ( "\n\n" );
2119
+ $stow .= ( "#\n" );
2120
+ $stow .= ( '# ' . sprintf( __( 'Table structure of table %s', 'wp-migrate-db' ), $this->backquote( $table_to_stow ) ) . "\n" );
2121
+ $stow .= ( "#\n" );
2122
+ $stow .= ( "\n" );
2123
+ }
2124
+
2125
+ $create_table = $wpdb->get_results( 'SHOW CREATE TABLE ' . $this->backquote( $table ), ARRAY_N );
2126
+
2127
+ if ( false === $create_table ) {
2128
+ $this->error = __( 'Failed to generate the create table query, please ensure your database is online. (#126)', 'wp-migrate-db' );
2129
+
2130
+ return false;
2131
+ }
2132
+ $create_table[0][1] = str_replace( 'CREATE TABLE `' . $table . '`', 'CREATE TABLE `' . $table_to_stow . '`', $create_table[0][1] );
2133
+ $create_table[0][1] = str_replace( 'TYPE=', 'ENGINE=', $create_table[0][1] );
2134
+
2135
+ $alter_table_query = '';
2136
+ $create_table[0][1] = $this->process_sql_constraint( $create_table[0][1], $target_table_name, $alter_table_query );
2137
+
2138
+ $create_table[0][1] = apply_filters( 'wpmdb_create_table_query', $create_table[0][1], $table_to_stow, $this->target_db_version, $this->form_data['action'], $this->state_data['stage'] );
2139
+ $stow .= ( $create_table[0][1] . ";\n" );
2140
+
2141
+ $this->stow( $stow );
2142
+
2143
+ if ( ! empty( $alter_table_query ) ) {
2144
+ $alter_table_name = $this->get_alter_table_name();
2145
+ $insert = sprintf( "INSERT INTO %s ( `query` ) VALUES ( '%s' );\n", $this->backquote( $alter_table_name ), esc_sql( $alter_table_query ) );
2146
+
2147
+ if ( $is_backup ) {
2148
+ $process_chunk_result = $this->process_chunk( $insert );
2149
+ if ( true !== $process_chunk_result ) {
2150
+ $result = $this->end_ajax( $process_chunk_result );
2151
+
2152
+ return $result;
2153
  }
2154
+ } else {
2155
+ $this->stow( $insert );
2156
  }
2157
+ }
2158
 
2159
+ $alter_data_queries = array();
2160
+ $alter_data_queries = apply_filters( 'wpmdb_alter_data_queries', $alter_data_queries, $table_to_stow, $this->form_data['action'], $this->state_data['stage'] );
2161
 
2162
+ if ( ! empty( $alter_data_queries ) ) {
2163
+ $alter_table_name = $this->get_alter_table_name();
2164
+ $insert = '';
2165
+ foreach ( $alter_data_queries as $alter_data_query ) {
2166
+ $insert .= sprintf( "INSERT INTO %s ( `query` ) VALUES ( '%s' );\n", $this->backquote( $alter_table_name ), esc_sql( $alter_data_query ) );
2167
+ }
2168
+ if ( $is_backup ) {
2169
+ $process_chunk_result = $this->process_chunk( $insert );
2170
+ if ( true !== $process_chunk_result ) {
2171
+ $result = $this->end_ajax( $process_chunk_result );
2172
 
2173
+ return $result;
2174
+ }
2175
+ } else {
2176
+ $this->stow( $insert );
2177
  }
2178
+ }
2179
+
2180
+ // Comment in SQL-file
2181
+ if ( $is_backup ) {
2182
+ $this->stow( "\n\n" );
2183
+ $this->stow( "#\n" );
2184
+ $this->stow( '# ' . sprintf( __( 'Data contents of table %s', 'wp-migrate-db' ), $this->backquote( $table_to_stow ) ) . "\n" );
2185
+ $this->stow( "#\n" );
2186
+ }
2187
+ }
2188
+
2189
+ /**
2190
+ * Creates the footer for a table in a SQL file.
2191
+ *
2192
+ * @param $table
2193
+ * @param $target_table_name
2194
+ *
2195
+ * @return null
2196
+ */
2197
+ function build_table_footer( $table, $target_table_name ) {
2198
+ global $wpdb;
2199
+
2200
+ $this->stow( "\n" );
2201
+ $this->stow( "#\n" );
2202
+ $this->stow( '# ' . sprintf( __( 'End of data contents of table %s', 'wp-migrate-db' ), $this->backquote( $target_table_name ) ) . "\n" );
2203
+ $this->stow( "# --------------------------------------------------------\n" );
2204
+ $this->stow( "\n" );
2205
+
2206
+ if ( $this->state_data['last_table'] == '1' ) {
2207
+ $this->stow( "#\n" );
2208
+ $this->stow( "# Add constraints back in and apply any alter data queries.\n" );
2209
+ $this->stow( "#\n\n" );
2210
+ $this->stow( $this->get_alter_queries() );
2211
+ $alter_table_name = $this->get_alter_table_name();
2212
 
2213
+ $wpdb->query( 'DROP TABLE IF EXISTS ' . $this->backquote( $alter_table_name ) . ';' );
 
 
2214
 
2215
+ if ( 'backup' == $this->state_data['stage'] ) {
2216
+ // Re-create our table to store 'ALTER' queries so we don't get duplicates.
2217
+ $create_alter_table_query = $this->get_create_alter_table_query();
2218
+ $process_chunk_result = $this->process_chunk( $create_alter_table_query );
2219
+ if ( true !== $process_chunk_result ) {
2220
+ $result = $this->end_ajax( $process_chunk_result );
2221
+
2222
+ return $result;
2223
  }
2224
+ }
2225
+ }
2226
+ }
2227
 
2228
+ /**
2229
+ * Builds the SELECT query to get data to migrate.
2230
+ *
2231
+ * @param string $table
2232
+ * @param int $row_start
2233
+ * @param array $structure_info
2234
+ *
2235
+ * @return string
2236
+ */
2237
+ function build_select_query( $table, $row_start, $structure_info ) {
2238
+ global $wpdb;
2239
+
2240
+ $join = array();
2241
+ $where = 'WHERE 1=1';
2242
+ $order_by = '';
2243
+
2244
+ // We need ORDER BY here because with LIMIT, sometimes it will return
2245
+ // the same results from the previous query and we'll have duplicate insert statements
2246
+ if ( 'backup' != $this->state_data['stage'] && false === empty( $this->form_data['exclude_spam'] ) ) {
2247
+ if ( $this->table_is( 'comments', $table ) ) {
2248
+ $where .= ' AND comment_approved != "spam"';
2249
+ } elseif ( $this->table_is( 'commentmeta', $table ) ) {
2250
+ $tables = $this->get_ms_compat_table_names( array( 'commentmeta', 'comments' ), $table );
2251
+ $join[] = sprintf( 'INNER JOIN %1$s ON %1$s.comment_ID = %2$s.comment_id', $this->backquote( $tables['comments_table'] ), $this->backquote( $tables['commentmeta_table'] ) );
2252
+ $where .= sprintf( ' AND %1$s.comment_approved != \'spam\'', $this->backquote( $tables['comments_table'] ) );
2253
  }
2254
+ }
2255
 
2256
+ if ( 'backup' != $this->state_data['stage'] && isset( $this->form_data['exclude_post_types'] ) && ! empty( $this->form_data['select_post_types'] ) ) {
2257
+ $post_types = '\'' . implode( '\', \'', $this->form_data['select_post_types'] ) . '\'';
2258
+ if ( $this->table_is( 'posts', $table ) ) {
2259
+ $where .= ' AND `post_type` NOT IN ( ' . $post_types . ' )';
2260
+ } elseif ( $this->table_is( 'postmeta', $table ) ) {
2261
+ $tables = $this->get_ms_compat_table_names( array( 'postmeta', 'posts' ), $table );
2262
+ $join[] = sprintf( 'INNER JOIN %1$s ON %1$s.ID = %2$s.post_id', $this->backquote( $tables['posts_table'] ), $this->backquote( $tables['postmeta_table'] ) );
2263
+ $where .= sprintf( ' AND %1$s.post_type NOT IN ( ' . $post_types . ' )', $this->backquote( $tables['posts_table'] ) );
2264
+ } elseif ( $this->table_is( 'comments', $table ) ) {
2265
+ $tables = $this->get_ms_compat_table_names( array( 'comments', 'posts' ), $table );
2266
+ $join[] = sprintf( 'INNER JOIN %1$s ON %1$s.ID = %2$s.comment_post_ID', $this->backquote( $tables['posts_table'] ), $this->backquote( $tables['comments_table'] ) );
2267
+ $where .= sprintf( ' AND %1$s.post_type NOT IN ( ' . $post_types . ' )', $this->backquote( $tables['posts_table'] ) );
2268
+ } elseif ( $this->table_is( 'commentmeta', $table ) ) {
2269
+ $tables = $this->get_ms_compat_table_names( array( 'commentmeta', 'posts', 'comments' ), $table );
2270
+ $join[] = sprintf( 'INNER JOIN %1$s ON %1$s.comment_ID = %2$s.comment_id', $this->backquote( $tables['comments_table'] ), $this->backquote( $tables['commentmeta_table'] ) );
2271
+ $join[] = sprintf( 'INNER JOIN %2$s ON %2$s.ID = %1$s.comment_post_ID', $this->backquote( $tables['comments_table'] ), $this->backquote( $tables['posts_table'] ) );
2272
+ $where .= sprintf( ' AND %1$s.post_type NOT IN ( ' . $post_types . ' )', $this->backquote( $tables['posts_table'] ) );
2273
+ }
2274
+ }
2275
 
2276
+ if ( 'backup' != $this->state_data['stage'] && true === apply_filters( 'wpmdb_exclude_transients', true ) && isset( $this->form_data['exclude_transients'] ) && '1' === $this->form_data['exclude_transients'] && ( $this->table_is( 'options', $table ) || ( isset( $wpdb->sitemeta ) && $wpdb->sitemeta == $table ) ) ) {
2277
+ $col_name = 'option_name';
 
2278
 
2279
+ if ( isset( $wpdb->sitemeta ) && $wpdb->sitemeta == $table ) {
2280
+ $col_name = 'meta_key';
2281
+ }
2282
 
2283
+ $where .= " AND `{$col_name}` NOT LIKE '\_transient\_%' AND `{$col_name}` NOT LIKE '\_site\_transient\_%'";
2284
+ }
2285
 
2286
+ // don't export/migrate wpmdb specific option rows unless we're performing a backup
2287
+ if ( 'backup' != $this->state_data['stage'] && ( $this->table_is( 'options', $table ) || ( isset( $wpdb->sitemeta ) && $wpdb->sitemeta == $table ) ) ) {
2288
+ $col_name = 'option_name';
2289
 
2290
+ if ( isset( $wpdb->sitemeta ) && $wpdb->sitemeta == $table ) {
2291
+ $col_name = 'meta_key';
2292
+ }
2293
+
2294
+ $where .= " AND `{$col_name}` != 'wpmdb_settings'";
2295
+ $where .= " AND `{$col_name}` != 'wpmdb_error_log'";
2296
+ $where .= " AND `{$col_name}` != 'wpmdb_schema_version'";
2297
+ $where .= " AND `{$col_name}` NOT LIKE 'wpmdb_state_%'";
2298
+ }
2299
+
2300
+ $limit = "LIMIT {$row_start}, {$this->rows_per_segment}";
2301
+
2302
+ if ( ! empty( $this->primary_keys ) ) {
2303
+ $primary_keys_keys = array_keys( $this->primary_keys );
2304
+ $primary_keys_keys = array_map( array( $this, 'backquote' ), $primary_keys_keys );
2305
 
2306
+ $order_by = 'ORDER BY ' . implode( ',', $primary_keys_keys );
2307
+ $limit = "LIMIT {$this->rows_per_segment}";
2308
 
2309
+ if ( false === $this->first_select ) {
2310
+ $where .= ' AND ';
2311
+
2312
+ $temp_primary_keys = $this->primary_keys;
2313
+ $primary_key_count = count( $temp_primary_keys );
2314
+
2315
+ // build a list of clauses, iteratively reducing the number of fields compared in the compound key
2316
+ // e.g. (a = 1 AND b = 2 AND c > 3) OR (a = 1 AND b > 2) OR (a > 1)
2317
+ $clauses = array();
2318
+ for ( $j = 0; $j < $primary_key_count; $j++ ) {
2319
+ // build a subclause for each field in the compound index
2320
+ $subclauses = array();
2321
+ $i = 0;
2322
+ foreach ( $temp_primary_keys as $primary_key => $value ) {
2323
+ // only the last field in the key should be different in this subclause
2324
+ $operator = ( count( $temp_primary_keys ) - 1 == $i ? '>' : '=' );
2325
+ $subclauses[] = sprintf( '%s %s %s', $this->backquote( $primary_key ), $operator, $wpdb->prepare( '%s', $value ) );
2326
+ ++$i;
2327
  }
 
 
 
 
2328
 
2329
+ // remove last field from array to reduce fields in next clause
2330
+ array_pop( $temp_primary_keys );
2331
 
2332
+ // join subclauses into a single clause
2333
+ // NB: AND needs to be wrapped in () as it has higher precedence than OR
2334
+ $clauses[] = '( ' . implode( ' AND ', $subclauses ) . ' )';
 
 
2335
  }
2336
+ // join clauses into a single clause
2337
+ // NB: OR needs to be wrapped in () as it has lower precedence than AND
2338
+ $where .= '( ' . implode( ' OR ', $clauses ) . ' )';
2339
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2340
 
2341
+ $this->first_select = false;
2342
+ }
 
2343
 
2344
+ $sel = $this->backquote( $table ) . '.*';
2345
+ if ( ! empty( $structure_info['bins'] ) ) {
2346
+ foreach ( $structure_info['bins'] as $key => $bin ) {
2347
+ $hex_key = strtolower( $key ) . '__hex';
2348
+ $sel .= ', HEX(' . $this->backquote( $key ) . ') as ' . $this->backquote( $hex_key );
2349
+ }
2350
+ }
2351
+ if ( ! empty( $structure_info['bits'] ) ) {
2352
+ foreach ( $structure_info['bits'] as $key => $bit ) {
2353
+ $bit_key = strtolower( $key ) . '__bit';
2354
+ $sel .= ', ' . $this->backquote( $key ) . '+0 as ' . $this->backquote( $bit_key );
2355
+ }
2356
+ }
2357
+ $join = implode( ' ', array_unique( $join ) );
2358
+ $join = apply_filters( 'wpmdb_rows_join', $join, $table );
2359
+ $where = apply_filters( 'wpmdb_rows_where', $where, $table );
2360
+ $order_by = apply_filters( 'wpmdb_rows_order_by', $order_by, $table );
2361
+ $limit = apply_filters( 'wpmdb_rows_limit', $limit, $table );
2362
 
2363
+ $sql = 'SELECT ' . $sel . ' FROM ' . $this->backquote( $table ) . " $join $where $order_by $limit";
2364
+ $sql = apply_filters( 'wpmdb_rows_sql', $sql, $table );
 
 
 
 
 
2365
 
2366
+ return $sql;
2367
+ }
 
 
2368
 
2369
+ /**
2370
+ * Processes the data in a given row.
2371
+ *
2372
+ * @param string $table
2373
+ * @param object $replacer
2374
+ * @param array $row
2375
+ * @param array $structure_info
2376
+ *
2377
+ * @return array|void
2378
+ */
2379
+ function process_row( $table, $replacer, $row, $structure_info ) {
2380
+ global $wpdb;
2381
 
2382
+ $skip_row = false;
2383
+ $updates_pending = false;
2384
+ $update_sql = array();
2385
+ $where_sql = array();
2386
+ $values = array();
2387
+ $query = '';
 
 
2388
 
2389
+ if ( ! apply_filters( 'wpmdb_table_row', $row, $table, $this->form_data['action'], $this->state_data['stage'] ) ) {
2390
+ $skip_row = true;
2391
+ }
2392
 
2393
+ if ( ! $skip_row ) {
 
 
 
 
2394
 
2395
+ foreach ( $row as $key => $value ) {
2396
+ $data_to_fix = $value;
2397
 
2398
+ if ( 'find_replace' === $this->state_data['stage'] && in_array( $key, array_keys( $this->primary_keys ) ) ) {
2399
+ $where_sql[] = $this->backquote( $key ) . ' = "' . $this->mysql_escape_mimic( $data_to_fix ) . '"';
2400
+ continue;
2401
+ }
 
2402
 
2403
+ $replacer->set_column( $key );
 
 
 
 
 
 
2404
 
2405
+ if ( isset( $structure_info['ints'][ strtolower( $key ) ] ) && $structure_info['ints'][ strtolower( $key ) ] ) {
2406
+ // make sure there are no blank spots in the insert syntax,
2407
+ // yet try to avoid quotation marks around integers
2408
+ $value = ( null === $value || '' === $value ) ? $structure_info['defs'][ strtolower( $key ) ] : $value;
2409
+ $values[] = ( '' === $value ) ? "''" : $value;
2410
+ continue;
2411
+ }
2412
 
2413
+ if ( null === $value ) {
2414
+ $values[] = 'NULL';
2415
+ continue;
2416
+ }
2417
 
2418
+ // If we have binary data, substitute in hex encoded version and remove hex encoded version from row.
2419
+ $hex_key = strtolower( $key ) . '__hex';
2420
+ if ( isset( $structure_info['bins'][ strtolower( $key ) ] ) && $structure_info['bins'][ strtolower( $key ) ] && isset( $row->$hex_key ) ) {
2421
+ $value = "UNHEX('" . $row->$hex_key . "')";
2422
+ $values[] = $value;
2423
+ unset( $row->$hex_key );
2424
+ continue;
2425
+ }
2426
 
2427
+ // If we have bit data, substitute in properly bit encoded version.
2428
+ $bit_key = strtolower( $key ) . '__bit';
2429
+ if ( isset( $structure_info['bits'][ strtolower( $key ) ] ) && $structure_info['bits'][ strtolower( $key ) ] && isset( $row->$bit_key ) ) {
2430
+ $value = "b'" . $row->$bit_key . "'";
2431
+ $values[] = $value;
2432
+ unset( $row->$bit_key );
2433
+ continue;
2434
+ }
2435
 
2436
+ if ( is_multisite() && ( $wpdb->site == $table || $wpdb->blogs == $table ) ) {
 
2437
 
2438
+ if ( ! in_array( $this->state_data['stage'], array( 'backup', 'find_replace' ) ) ) {
 
2439
 
2440
+ if ( 'path' == $key ) {
2441
+ $old_path_current_site = $this->get_path_current_site();
2442
+ $new_path_current_site = '';
 
 
2443
 
2444
+ if ( ! empty( $this->state_data['path_current_site'] ) ) {
2445
+ $new_path_current_site = $this->state_data['path_current_site'];
2446
+ } elseif ( ! empty ( $this->form_data['replace_new'][1] ) ) {
2447
+ $new_path_current_site = $this->get_path_from_url( $this->form_data['replace_new'][1] );
2448
+ }
2449
 
2450
+ $new_path_current_site = apply_filters( 'wpmdb_new_path_current_site', $new_path_current_site );
2451
 
2452
+ if ( ! empty( $new_path_current_site ) && $old_path_current_site != $new_path_current_site ) {
2453
+ $pos = strpos( $value, $old_path_current_site );
2454
+ $value = substr_replace( $value, $new_path_current_site, $pos, strlen( $old_path_current_site ) );
 
2455
  }
2456
  }
2457
 
2458
+ if ( 'domain' == $key ) {
2459
+ if ( ! empty( $this->state_data['domain_current_site'] ) ) {
2460
+ $main_domain_replace = $this->state_data['domain_current_site'];
2461
+ } elseif ( ! empty ( $this->form_data['replace_new'][1] ) ) {
2462
+ $url = $this->parse_url( $this->form_data['replace_new'][1] );
2463
+ $main_domain_replace = $url['host'];
2464
+ }
2465
 
2466
+ $domain_replaces = array();
2467
+ $main_domain_find = sprintf( '/%s/', preg_quote( $this->get_domain_current_site(), '/' ) );
2468
+ if ( isset( $main_domain_replace ) ) {
2469
+ $domain_replaces[ $main_domain_find ] = $main_domain_replace;
2470
+ }
2471
 
2472
+ $domain_replaces = apply_filters( 'wpmdb_domain_replaces', $domain_replaces );
2473
+
2474
+ $value = preg_replace( array_keys( $domain_replaces ), array_values( $domain_replaces ), $value );
2475
+ }
 
 
2476
  }
2477
+ }
2478
 
2479
+ if ( 'guid' != $key || ( false === empty( $this->form_data['replace_guids'] ) && $this->table_is( 'posts', $table ) ) ) {
2480
+ if ( $this->state_data['stage'] != 'backup' ) {
2481
+ $value = $replacer->recursive_unserialize_replace( $value );
2482
+ }
2483
+ }
2484
 
2485
+ if ( 'find_replace' === $this->state_data['stage'] ) {
2486
+ $value = $this->mysql_escape_mimic( $value );
2487
+ $data_to_fix = $this->mysql_escape_mimic( $data_to_fix );
2488
 
2489
+ if ( $value !== $data_to_fix ) {
2490
+ $update_sql[] = $this->backquote( $key ) . ' = "' . $value . '"';
2491
+ $updates_pending = true;
 
2492
  }
2493
+ } else {
2494
+ // \x08\\x09, not required
2495
+ $multibyte_search = array( "\x00", "\x0a", "\x0d", "\x1a" );
2496
+ $multibyte_replace = array( '\0', '\n', '\r', '\Z' );
2497
+
2498
+ $value = $this->sql_addslashes( $value );
2499
+ $value = str_replace( $multibyte_search, $multibyte_replace, $value );
2500
  }
2501
 
2502
+ $values[] = "'" . $value . "'";
2503
+ }
2504
 
2505
+ // Determine what to do with updates.
2506
+ if ( 'find_replace' === $this->state_data['stage'] ) {
2507
+ if ( $updates_pending && ! empty( $where_sql ) ) {
2508
+ $table_to_update = $this->backquote( $this->temp_prefix . $table );
2509
+ $query .= 'UPDATE ' . $table_to_update . ' SET ' . implode( ', ', $update_sql ) . ' WHERE ' . implode( ' AND ', array_filter( $where_sql ) ) . ";\n";
 
2510
  }
2511
+ } else {
2512
+ $query .= '(' . implode( ', ', $values ) . '),' . "\n";
2513
  }
2514
+ }
2515
 
2516
+ if ( ( strlen( $this->current_chunk ) + strlen( $query ) + strlen( $this->query_buffer ) + 30 ) > $this->maximum_chunk_size ) {
2517
+ if ( $this->query_buffer == $this->query_template ) {
2518
+ $this->query_buffer .= $query;
2519
+
2520
+ ++$this->row_tracker;
2521
+
2522
+ if ( ! empty( $this->primary_keys ) ) {
2523
+ foreach ( $this->primary_keys as $primary_key => $value ) {
2524
+ $this->primary_keys[ $primary_key ] = $row->$primary_key;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2525
  }
2526
  }
2527
  }
2528
+
2529
+ $this->stow_query_buffer();
2530
+ return $this->transfer_chunk();
2531
  }
2532
 
2533
+ if ( ( $this->query_size + strlen( $query ) ) > $this->max_insert_string_len ) {
2534
+ $this->stow_query_buffer();
2535
+ }
2536
 
2537
+ $this->query_buffer .= $query;
2538
+ $this->query_size += strlen( $query );
2539
+
2540
+ ++$this->row_tracker;
2541
+
2542
+ if ( ! empty( $this->primary_keys ) ) {
2543
+ foreach ( $this->primary_keys as $primary_key => $value ) {
2544
+ $this->primary_keys[ $primary_key ] = $row->$primary_key;
2545
+ }
2546
+ }
2547
+
2548
+ return true;
2549
+ }
2550
+
2551
+ function delete_temporary_tables( $prefix ) {
2552
+ $tables = $this->get_tables();
2553
+ $delete_queries = '';
2554
+
2555
+ foreach ( $tables as $table ) {
2556
+ if ( 0 !== strpos( $table, $prefix ) ) {
2557
+ continue;
2558
+ }
2559
+ $delete_queries .= sprintf( "DROP TABLE %s;\n", $this->backquote( $table ) );
2560
+ }
2561
+
2562
+ $this->process_chunk( $delete_queries );
2563
+ }
2564
+
2565
+ /**
2566
+ * Mimics the mysql_real_escape_string function. Adapted from a post by 'feedr' on php.net.
2567
+ *
2568
+ * @link http://php.net/manual/en/function.mysql-real-escape-string.php#101248
2569
+ * @param string $input The string to escape.
2570
+ *
2571
+ * @return string
2572
+ */
2573
+ function mysql_escape_mimic( $input ) {
2574
+ if ( is_array( $input ) ) {
2575
+ return array_map( __METHOD__, $input );
2576
+ }
2577
+ if ( ! empty( $input ) && is_string( $input ) ) {
2578
+ return str_replace( array( '\\', "\0", "\n", "\r", "'", '"', "\x1a" ), array( '\\\\', '\\0', '\\n', '\\r', "\\'", '\\"', '\\Z' ), $input );
2579
+ }
2580
+
2581
+ return $input;
2582
+ }
2583
 
2584
  /**
2585
  * Check that the given table is of the desired type,
2761
  }
2762
  } elseif ( $this->state_data['intent'] == 'pull' ) {
2763
  echo apply_filters( 'wpmdb_before_response', $query_line );
2764
+ } elseif ( 'find_replace' === $this->state_data['stage'] ) {
2765
+ return $this->process_chunk( $query_line );
2766
  }
2767
  }
2768
 
2774
  function transfer_chunk() {
2775
  $this->set_post_data();
2776
 
2777
+ if ( 'savefile' === $this->state_data['intent'] || 'find_replace' === $this->state_data['intent'] || 'backup' === $this->state_data['stage'] ) {
2778
+
2779
+ if ( 'find_replace' === $this->state_data['stage'] ) {
2780
+ $this->process_chunk( $this->query_buffer );
2781
+ } else {
2782
+ $this->close( $this->fp );
2783
+ }
2784
 
2785
  $result = array(
2786
  'current_row' => $this->row_tracker,
2906
  array( $this, 'options_page' ) );
2907
  $this->after_admin_menu( $hook_suffix );
2908
  }
2909
+
2910
+ /**
2911
+ * Add a tools menu item to sites on a Multisite network
2912
+ *
2913
+ */
2914
+ function network_tools_admin_menu() {
2915
+ add_management_page(
2916
+ $this->get_plugin_title(),
2917
+ $this->get_plugin_title(),
2918
+ 'manage_network_options',
2919
+ $this->core_slug,
2920
+ array( $this, 'subsite_tools_options_page' )
2921
+ );
2922
+ }
2923
 
2924
  function admin_menu() {
2925
  $title = ( $this->is_pro ) ? __( 'Migrate DB Pro', 'wp-migrate-db' ) : __( 'Migrate DB', 'wp-migrate-db' );
3076
 
3077
  $plugins_url = trailingslashit( plugins_url( $this->plugin_folder_name ) );
3078
  $version = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? time() : $this->plugin_version;
3079
+ $ver_string = '-' . str_replace( '.', '', $this->plugin_version );
3080
  $min = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
3081
 
3082
  $src = $plugins_url . 'asset/dist/css/styles.css';
3083
  wp_enqueue_style( 'wp-migrate-db-pro-styles', $src, array(), $version );
3084
 
3085
+ $src = $plugins_url . "asset/dist/js/common{$ver_string}{$min}.js";
3086
  wp_enqueue_script( 'wp-migrate-db-pro-common', $src, null, $version, true );
3087
 
3088
+ $src = $plugins_url . "asset/dist/js/hook{$ver_string}{$min}.js";
3089
  wp_enqueue_script( 'wp-migrate-db-pro-hook', $src, null, $version, true );
3090
 
3091
+ $src = $plugins_url . "asset/dist/js/multisite{$ver_string}{$min}.js";
3092
  wp_enqueue_script( 'wp-migrate-db-pro-multisite', $src, array( 'jquery' ), $version, true );
3093
 
3094
  do_action( 'wpmdb_load_assets' );
3095
 
3096
+ $src = $plugins_url . "asset/dist/js/script{$ver_string}{$min}.js";
3097
  wp_enqueue_script( 'wp-migrate-db-pro-script', $src, array( 'jquery', 'backbone' ), $version, true );
3098
 
3099
  wp_localize_script( 'wp-migrate-db-pro-script',
3141
  'connection_info_missing' => __( 'The connection information appears to be missing, please enter it to continue.', 'wp-migrate-db' ),
3142
  'connection_info_incorrect' => __( "The connection information appears to be incorrect, it should consist of two lines. The first being the remote server's URL and the second being the secret key.", 'wp-migrate-db' ),
3143
  'connection_info_url_invalid' => __( 'The URL on the first line appears to be invalid, please check it and try again.', 'wp-migrate-db' ),
3144
+ 'connection_info_key_invalid' => __( 'The secret key on the second line appears to be invalid. It should be a 40 character string that consists of letters, numbers and special characters only.', 'wp-migrate-db' ),
3145
  'connection_info_local_url' => __( "It appears you've entered the URL for this website, you need to provide the URL of the remote website instead.", 'wp-migrate-db' ),
3146
  'connection_info_local_key' => __( 'Looks like your remote secret key is the same as the secret key for this site. To fix this, go to the <a href="#settings">Settings tab</a> and click "Reset Secret Key"', 'wp-migrate-db' ),
3147
  'time_elapsed' => __( 'Time Elapsed:', 'wp-migrate-db' ),
3148
  'pause' => _x( 'Pause', 'Temporarily stop migrating', 'wp-migrate-db' ),
3149
  'migration_paused' => _x( 'Migration Paused', 'The migration has been temporarily stopped', 'wp-migrate-db' ),
3150
+ 'find_replace_paused' => _x( 'Find &amp; Replace Paused', 'The find & replace has been temporarily stopped', 'wp-migrate-db' ),
3151
  'resume' => _x( 'Resume', 'Restart migrating after it was paused', 'wp-migrate-db' ),
3152
  'completing_current_request' => __( 'Completing current request', 'wp-migrate-db' ),
3153
  'cancelling_migration' => _x( 'Cancelling migration', 'The migration is being cancelled', 'wp-migrate-db' ),
3154
+ 'cancelling_find_replace' => _x( 'Cancelling find &amp; replace', 'The find & replace is being cancelled', 'wp-migrate-db' ),
3155
  'paused' => _x( 'Paused', 'The migration has been temporarily stopped', 'wp-migrate-db' ),
3156
+ 'pause_before_finalize_find_replace' => __( 'Pause before finalizing the updates', 'wp-migrate-db' ),
3157
  'paused_before_finalize' => __( 'Automatically paused before migrated tables are replaced. Click "Resume" or "Cancel" when ready.', 'wp-migrate-db' ),
3158
+ 'find_replace_paused_before_finalize' => __( 'Automatically paused before the find &amp; replace was finalized. Click "Resume" or "Cancel" when ready.', 'wp-migrate-db-pro' ),
3159
  'removing_local_sql' => __( 'Removing the local MySQL export file', 'wp-migrate-db' ),
3160
  'removing_local_backup' => __( 'Removing the local backup MySQL export file', 'wp-migrate-db' ),
3161
  'removing_local_temp_tables' => __( 'Removing the local temporary tables', 'wp-migrate-db' ),
3165
  'manually_remove_temp_files' => __( 'A problem occurred while cancelling the migration, you may have to manually delete some temporary files / tables.', 'wp-migrate-db' ),
3166
  'migration_cancelled' => _x( 'Migration cancelled', 'The migration has been cancelled', 'wp-migrate-db' ),
3167
  'migration_cancelled_success' => __( 'The migration has been stopped and all temporary files and data have been cleaned up.', 'wp-migrate-db' ),
3168
+ 'find_replace_cancelled' => _x( 'Find &amp; replace cancelled', 'The migration has been cancelled', 'wp-migrate-db' ),
3169
+ 'find_replace_cancelled_success' => __( 'The find &amp; replace has been cancelled and all temporary data has been cleaned up.', 'wp-migrate-db' ),
3170
  'migration_complete' => _x( 'Migration complete', 'The migration completed successfully', 'wp-migrate-db' ),
3171
  'finalizing_migration' => _x( 'Finalizing migration', 'The migration is in the last stages', 'wp-migrate-db' ),
3172
  'flushing' => _x( 'Flushing caches and rewrite rules', 'The caches and rewrite rules for the target are being flushed', 'wp-migrate-db' ),
3178
  'pull_migration_label_completed' => __( 'Pull from %s complete', 'wp-migrate-db' ),
3179
  'push_migration_label_migrating' => __( 'Pushing to %s…', 'wp-migrate-db' ),
3180
  'push_migration_label_completed' => __( 'Push to %s complete', 'wp-migrate-db' ),
3181
+ 'find_replace_label_migrating' => __( 'Running Find & Replace…', 'wp-migrate-db' ),
3182
+ 'find_replace_label_completed' => __( 'Find & Replace complete', 'wp-migrate-db' ),
3183
  'copying_license' => __( 'Copying license to the remote site, please wait', 'wp-migrate-db' ),
3184
  'attempting_to_activate_licence' => __( 'Attempting to activate your license, please wait…', 'wp-migrate-db' ),
3185
  'licence_reactivated' => __( 'License successfully activated, please wait…', 'wp-migrate-db' ),
3197
  'migrate_button_pull_save' => _x( 'Pull &amp; Save', 'Transfer the remote database to this site and save migration profile', 'wp-migrate-db' ),
3198
  'migrate_button_export' => _x( 'Export', 'Download a copy of the database', 'wp-migrate-db' ),
3199
  'migrate_button_export_save' => _x( 'Export &amp; Save', 'Download a copy of the database and save migration profile', 'wp-migrate-db' ),
3200
+ 'migrate_button_find_replace' => _x( 'Find &amp; Replace', 'Run a find and replace on the database', 'wp-migrate-db' ),
3201
+ 'migrate_button_find_replace_save' => _x( 'Find &amp; Replace &amp; Save', 'Run a find and replace and save migration profile', 'wp-migrate-db' ),
3202
  'tables' => _x( 'Tables', 'database tables', 'wp-migrate-db'),
3203
  'files' => __( 'Files', 'wp-migrate-db'),
3204
  'migrated' => _x( 'Migrated', 'Transferred', 'wp-migrate-db' ),
3205
  'backed_up' => __( 'Backed Up', 'wp-migrate-db' ),
3206
+ 'searched' => __( 'Searched', 'wp-migrate-db' ),
3207
  'hide' => _x( 'Hide', 'Obscure from view', 'wp-migrate-db' ),
3208
  'show' => _x( 'Show', 'Reveal', 'wp-migrate-db' ),
3209
  'welcome_title' => __( 'Welcome to WP Migrate DB Pro! &#127881;', 'wp-migrate-db' ),
3215
  'title_finalizing' => __( 'Finalizing', 'wp-migrate-db' ),
3216
  'title_complete' => __( 'Complete', 'wp-migrate-db' ),
3217
  'title_error' => __( 'Failed', 'wp-migrate-db' ),
3218
+ 'progress_items_truncated_msg' => __( '%1$s items are not shown to maintain browser performance', 'wp-migrate-db' ),
3219
+ 'clear_error_log' => _x( 'Cleared', 'Error log emptied', 'wp-migrate-db' ),
3220
  )
3221
  );
3222
 
3283
  'reactivate_licence' => wp_create_nonce( 'reactivate-licence' ),
3284
  'process_notice_link' => wp_create_nonce( 'process-notice-link' ),
3285
  'flush' => wp_create_nonce( 'flush' ),
3286
+ 'plugin_compatibility' => wp_create_nonce( 'plugin_compatibility' ),
3287
+ 'blacklist_plugins' => wp_create_nonce( 'blacklist_plugins' ),
3288
+ 'cancel_migration' => wp_create_nonce( 'cancel_migration' )
3289
  ) );
3290
 
3291
  $data = apply_filters( 'wpmdb_data', array(
3305
  'this_website_name' => sanitize_title_with_dashes( DB_NAME ),
3306
  'this_download_url' => network_admin_url( $this->plugin_base . '&download=' ),
3307
  'this_prefix' => $site_details['prefix'], // TODO: Remove backwards compatibility.
3308
+ 'this_temp_prefix' => $this->temp_prefix,
3309
  'this_plugin_base' => esc_html( $this->plugin_base ),
3310
  'is_multisite' => $site_details['is_multisite'], // TODO: Remove backwards compatibility.
3311
  'openssl_available' => esc_html( $this->open_ssl_enabled() ? 'true' : 'false' ),
3389
  * Called to cancel an in-progress migration.
3390
  */
3391
  function ajax_cancel_migration() {
3392
+ $this->check_ajax_referer( 'cancel_migration' );
3393
+
3394
  $key_rules = array(
3395
  'action' => 'key',
3396
  'migration_state_id' => 'key',
3435
  $this->delete_temporary_tables( $this->state_data['temp_prefix'] );
3436
  }
3437
  break;
3438
+ case 'find_replace' :
3439
+ $this->delete_temporary_tables( $this->temp_prefix );
3440
+ break;
3441
  default:
3442
  break;
3443
  }
3584
  return $create_table;
3585
  }
3586
 
3587
+ if ( version_compare( $db_version, '5.6', '<' ) ) {
3588
+ // Convert utf8m4_unicode_520_ci collation to utf8mb4_unicode_ci if less than mysql 5.6
3589
+ $create_table = str_replace( 'utf8mb4_unicode_520_ci', 'utf8mb4_unicode_ci', $create_table );
3590
+ } elseif ( apply_filters( 'wpmdb_convert_to_520', true ) ) {
3591
+ $create_table = str_replace( 'utf8mb4_unicode_ci', 'utf8mb4_unicode_520_ci', $create_table );
3592
+ }
3593
+
3594
  if ( version_compare( $db_version, '5.5.3', '<' ) ) {
3595
  // Remove index comments introduced in MySQL 5.5.3.
3596
  // Following regex matches any PRIMARY KEY or KEY statement on a table definition that has a COMMENT statement attached.
languages/wp-migrate-db-en.pot CHANGED
@@ -1,6 +1,6 @@
1
  # SOME DESCRIPTIVE TITLE.
2
  # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
3
- # This file is distributed under the same license as the PACKAGE package.
4
  # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
5
  #
6
  #, fuzzy
@@ -8,7 +8,7 @@ msgid ""
8
  msgstr ""
9
  "Project-Id-Version: wp-migrate-db\n"
10
  "Report-Msgid-Bugs-To: nom@deliciousbrains.com\n"
11
- "POT-Creation-Date: 2016-04-12 11:48-0700\n"
12
  "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
13
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
14
  "Language-Team: LANGUAGE <LL@li.org>\n"
@@ -64,50 +64,67 @@ msgstr ""
64
  #: class/wpmdb-base.php:384
65
  #, php-format
66
  msgid ""
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
67
  "The connection failed, an unexpected error occurred, please contact support. "
68
  "(#121 - scope: %s)"
69
  msgstr ""
70
 
71
- #: class/wpmdb-base.php:394
72
  msgid ""
73
  "The remote site is protected with Basic Authentication. Please enter the "
74
  "username and password above to continue. (401 Unauthorized)"
75
  msgstr ""
76
 
77
- #: class/wpmdb-base.php:399
78
  #, php-format
79
  msgid ""
80
  "Unable to connect to the remote server, please check the connection details "
81
  "- %1$s %2$s (#129 - scope: %3$s)"
82
  msgstr ""
83
 
84
- #: class/wpmdb-base.php:409
85
  #, php-format
86
  msgid ""
87
  "WP Migrate DB Pro does not seem to be installed or active on the remote "
88
  "site. (#131 - scope: %s)"
89
  msgstr ""
90
 
91
- #: class/wpmdb-base.php:412
92
  #, php-format
93
  msgid ""
94
  "A response was expected from the remote, instead we got nothing. (#146 - "
95
  "scope: %1$s) Please review %2$s for possible solutions."
96
  msgstr ""
97
 
98
- #: class/wpmdb-base.php:412
99
- #: class/wpmdb.php:2842
100
  msgid "our documentation"
101
  msgstr ""
102
 
103
- #: class/wpmdb-base.php:421
104
  msgid ""
105
  "There was a problem with the AJAX request, we were expecting a serialized "
106
  "response, instead we received:<br />"
107
  msgstr ""
108
 
109
- #: class/wpmdb-base.php:718
110
- #: class/wpmdb-base.php:1179
111
  #, php-format
112
  msgid ""
113
  "<strong>Could not connect to api.deliciousbrains.com</strong> &mdash; You "
@@ -118,13 +135,13 @@ msgid ""
118
  "can:%2$s"
119
  msgstr ""
120
 
121
- #: class/wpmdb-base.php:718
122
- #: class/wpmdb-base.php:1179
123
  msgid "Temporarily disable SSL for connections to api.deliciousbrains.com"
124
  msgstr ""
125
 
126
- #: class/wpmdb-base.php:726
127
- #: class/wpmdb-base.php:1185
128
  #, php-format
129
  msgid ""
130
  "We've detected that <code>WP_HTTP_BLOCK_EXTERNAL</code> is enabled and the "
@@ -134,43 +151,43 @@ msgid ""
134
  "\" target=\"_blank\">More information</a>."
135
  msgstr ""
136
 
137
- #: class/wpmdb-base.php:771
138
  msgid ""
139
  "<strong>Delicious Brains API is Down — </strong>Unfortunately we're "
140
  "experiencing some problems with our server."
141
  msgstr ""
142
 
143
- #: class/wpmdb-base.php:775
144
  #, php-format
145
  msgctxt "ex. 2 hours ago"
146
  msgid "%s ago"
147
  msgstr ""
148
 
149
- #: class/wpmdb-base.php:780
150
  msgid "Here's the most recent update on its status"
151
  msgstr ""
152
 
153
- #: class/wpmdb-base.php:807
154
  #, php-format
155
  msgid ""
156
  "Error retrieving download from deliciousbrain.com. Please try again or "
157
  "download manually from <a href=\"%1$s\">%2$s</a>."
158
  msgstr ""
159
 
160
- #: class/wpmdb-base.php:807
161
  msgctxt "Delicious Brains account"
162
  msgid "My Account"
163
  msgstr ""
164
 
165
- #: class/wpmdb-base.php:866
166
- #: class/wpmdb.php:104
167
- #: class/wpmdb.php:300
168
- #: class/wpmdbpro.php:1949
169
  msgctxt "Plugin configuration and preferences"
170
  msgid "Settings"
171
  msgstr ""
172
 
173
- #: class/wpmdb-base.php:867
174
  #, php-format
175
  msgid ""
176
  "To finish activating WP Migrate DB Pro, please go to %1$s and enter your "
@@ -178,31 +195,31 @@ msgid ""
178
  "\">purchase one</a>."
179
  msgstr ""
180
 
181
- #: class/wpmdb-base.php:1098
182
- #: class/wpmdb-base.php:1108
183
  msgctxt "A new version of the plugin is available"
184
  msgid "Update Available"
185
  msgstr ""
186
 
187
- #: class/wpmdb-base.php:1099
188
  #, php-format
189
  msgid "A new version of %1$s is now available. %2$s"
190
  msgstr ""
191
 
192
- #: class/wpmdb-base.php:1099
193
- #: class/wpmdb-base.php:1109
194
  msgctxt "Download and install a new version of the plugin"
195
  msgid "Update Now"
196
  msgstr ""
197
 
198
- #: class/wpmdb-base.php:1109
199
  #, php-format
200
  msgid ""
201
  "%1$s %2$s is now available. You currently have %3$s installed. <a href=\"%4$s"
202
  "\">%5$s</a>"
203
  msgstr ""
204
 
205
- #: class/wpmdb-base.php:1153
206
  #, php-format
207
  msgid ""
208
  "<strong>Activate Your License</strong> &mdash; Please <a href=\"%s\" class="
@@ -210,13 +227,13 @@ msgid ""
210
  "priority support and plugin updates."
211
  msgstr ""
212
 
213
- #: class/wpmdb-base.php:1170
214
  msgid ""
215
  "<strong>We've temporarily activated your license and will complete the "
216
  "activation once the Delicious Brains API is available again.</strong>"
217
  msgstr ""
218
 
219
- #: class/wpmdb-base.php:1192
220
  #, php-format
221
  msgid ""
222
  "<strong>Your License Was Cancelled</strong> &mdash; Please visit <a href=\"%s"
@@ -224,43 +241,43 @@ msgid ""
224
  "enable push and pull."
225
  msgstr ""
226
 
227
- #: class/wpmdb-base.php:1193
228
- #: class/wpmdb-base.php:1198
229
- #: class/wpmdb-base.php:1218
230
  #: class/wpmdb-base.php:1222
231
- #: class/wpmdbpro.php:1032
232
- #: class/wpmdbpro.php:1956
 
 
 
233
  msgid "Check my license again"
234
  msgstr ""
235
 
236
- #: class/wpmdb-base.php:1196
237
  msgid "Your License Has Expired"
238
  msgstr ""
239
 
240
- #: class/wpmdb-base.php:1197
241
  #, php-format
242
  msgid "Login to <a href=\"%s\">My Account</a> to renew. "
243
  msgstr ""
244
 
245
- #: class/wpmdb-base.php:1202
246
  msgid "Updates are only available to those with an active license. "
247
  msgstr ""
248
 
249
- #: class/wpmdb-base.php:1203
250
  msgid "Only active licenses can download and install addons. "
251
  msgstr ""
252
 
253
- #: class/wpmdb-base.php:1204
254
  msgid "Only active licenses can submit support requests. "
255
  msgstr ""
256
 
257
- #: class/wpmdb-base.php:1205
258
  msgid ""
259
  "All features will continue to work, but you won't be able to receive updates "
260
  "or email support. "
261
  msgstr ""
262
 
263
- #: class/wpmdb-base.php:1217
264
  #, php-format
265
  msgid ""
266
  "<strong>No Activations Left</strong> &mdash; Please visit <a href=\"%s\" "
@@ -268,7 +285,7 @@ msgid ""
268
  "previous activation and enable push and pull."
269
  msgstr ""
270
 
271
- #: class/wpmdb-base.php:1221
272
  #, php-format
273
  msgid ""
274
  "<strong>Your License Was Not Found</strong> &mdash; Perhaps you made a typo "
@@ -277,142 +294,155 @@ msgid ""
277
  "license key."
278
  msgstr ""
279
 
280
- #: class/wpmdb-base.php:1225
281
  msgid "<strong>Your License Was Not Found</strong> &mdash; "
282
  msgstr ""
283
 
284
- #: class/wpmdb-base.php:1229
285
  msgid "Your License Is Inactive"
286
  msgstr ""
287
 
288
- #: class/wpmdb-base.php:1230
289
  msgid "Your license has been deactivated for this install."
290
  msgstr ""
291
 
292
- #: class/wpmdb-base.php:1230
293
  msgid "Reactivate License"
294
  msgstr ""
295
 
296
- #: class/wpmdb-base.php:1233
297
  #, php-format
298
  msgid ""
299
  "<strong>An Unexpected Error Occurred</strong> &mdash; Please contact us at "
300
  "<a href=\"%1$s\">%2$s</a> and quote the following:"
301
  msgstr ""
302
 
303
- #: class/wpmdb-base.php:1272
304
  #, php-format
305
  msgid "Invalid nonce for: %s"
306
  msgstr ""
307
 
308
- #: class/wpmdb-base.php:1280
309
  #, php-format
310
  msgid "Access denied for: %s"
311
  msgstr ""
312
 
313
- #: class/wpmdb-base.php:1486
314
  msgctxt "dismiss notice permanently"
315
  msgid "Dismiss"
316
  msgstr ""
317
 
318
- #: class/wpmdb-base.php:1495
319
  msgid "Remind Me Later"
320
  msgstr ""
321
 
322
- #: class/wpmdb-base.php:1597
323
  msgid "Failed to save migration state. Please contact support."
324
  msgstr ""
325
 
326
- #: class/wpmdb-base.php:1620
327
  msgid "Failed to retrieve migration state. Please contact support."
328
  msgstr ""
329
 
330
- #: class/wpmdb-cli.php:60
331
  #, php-format
332
  msgid "CLI addon requires PHP %1$s+"
333
  msgstr ""
334
 
335
- #: class/wpmdb-cli.php:104
336
  msgid "Profile not found or unable to be generated from params."
337
  msgstr ""
338
 
339
- #: class/wpmdb-cli.php:139
340
  #, php-format
341
  msgid "The following table(s) do not exist in the %1$s database: %2$s"
342
  msgstr ""
343
 
344
- #: class/wpmdb-cli.php:186
345
  #, php-format
346
  msgid ""
347
  "We were expecting a JSON response, instead we received: %2$s (function name: "
348
  "%1$s)"
349
  msgstr ""
350
 
351
- #: class/wpmdb-cli.php:242
352
  msgid "Initiating migration..."
353
  msgstr ""
354
 
355
- #: class/wpmdb-cli.php:284
356
  msgid "Exporting tables"
357
  msgstr ""
358
 
359
- #: class/wpmdb-cli.php:354
 
 
 
 
360
  msgid "No tables selected for migration."
361
  msgstr ""
362
 
363
- #: class/wpmdb-cli.php:447
364
  msgid "Cleaning up..."
365
  msgstr ""
366
 
367
- #: class/wpmdb-cli.php:514
368
  msgid "Unable to move exported file."
369
  msgstr ""
370
 
371
- #: class/wpmdb-command.php:66
372
- msgid "You must provide a destination filename."
373
- msgstr ""
374
-
375
- #: class/wpmdb-command.php:133
376
  msgid "Parameter errors: "
377
  msgstr ""
378
 
379
- #: class/wpmdb-command.php:135
380
  #, php-format
381
  msgid "unknown %s parameter"
382
  msgstr ""
383
 
384
- #: class/wpmdb-command.php:139
385
  msgid ""
386
  "Please make sure that you have activated the appropriate addons for WP "
387
  "Migrate DB Pro."
388
  msgstr ""
389
 
390
- #: class/wpmdb-command.php:146
391
  msgid "Missing action parameter"
392
  msgstr ""
393
 
394
- #: class/wpmdb-command.php:165
 
 
 
 
395
  #, php-format
396
  msgid "%1$s and %2$s must contain the same number of values"
397
  msgstr ""
398
 
399
- #: class/wpmdb-command.php:213
400
  #, php-format
401
  msgid ""
402
  "Cannot write to file \"%1$s\". Please ensure that the specified directory "
403
  "exists and is writable."
404
  msgstr ""
405
 
406
- #: class/wpmdb-command.php:256
 
 
 
 
407
  msgid "WP Migrate DB CLI class not available."
408
  msgstr ""
409
 
410
- #: class/wpmdb-command.php:263
411
  #, php-format
412
  msgid "Export saved to: %s"
413
  msgstr ""
414
 
415
- #: class/wpmdb-replace.php:174
 
 
 
 
 
416
  msgid ""
417
  "Failed attempting to do the recursive unserialize replace. Please contact "
418
  "support."
@@ -501,292 +531,310 @@ msgstr ""
501
  msgid "Unknown sanitization rule \"%1$s\" supplied by %2$s"
502
  msgstr ""
503
 
504
- #: class/wpmdb.php:103
 
 
 
 
 
 
 
 
 
505
  msgctxt "Configure a migration or export"
506
  msgid "Migrate"
507
  msgstr ""
508
 
509
- #: class/wpmdb.php:105
510
  msgctxt "Plugin extensions"
511
  msgid "Addons"
512
  msgstr ""
513
 
514
- #: class/wpmdb.php:106
515
  msgctxt "Get help or contact support"
516
  msgid "Help"
517
  msgstr ""
518
 
519
- #: class/wpmdb.php:167
520
  #, php-format
521
  msgid "The following directory could not be created: %s"
522
  msgstr ""
523
 
524
- #: class/wpmdb.php:172
525
  #, php-format
526
  msgid "Could not copy the compatibility plugin from %1$s to %2$s"
527
  msgstr ""
528
 
529
- #: class/wpmdb.php:178
530
  #, php-format
531
  msgid "Could not remove the compatibility plugin from %s"
532
  msgstr ""
533
 
534
- #: class/wpmdb.php:934
535
- #: class/wpmdbpro.php:331
536
- #: class/wpmdbpro.php:1796
537
  msgid ""
538
  "Failed attempting to unserialize the response from the remote server. Please "
539
  "contact support."
540
  msgstr ""
541
 
542
- #: class/wpmdb.php:1348
543
  msgid ""
544
  "Failed to retrieve table structure, please ensure your database is online. "
545
  "(#125)"
546
  msgstr ""
547
 
548
- #: class/wpmdb.php:1379
 
 
 
 
 
 
 
 
 
549
  #, php-format
550
  msgid "Delete any existing table %s"
551
  msgstr ""
552
 
553
- #: class/wpmdb.php:1390
554
  #, php-format
555
  msgid "Table structure of table %s"
556
  msgstr ""
557
 
558
- #: class/wpmdb.php:1398
559
  msgid ""
560
  "Failed to generate the create table query, please ensure your database is "
561
  "online. (#126)"
562
  msgstr ""
563
 
564
- #: class/wpmdb.php:1454
565
  #, php-format
566
  msgid "Data contents of table %s"
567
  msgstr ""
568
 
569
- #: class/wpmdb.php:1825
570
  #, php-format
571
  msgid "End of data contents of table %s"
572
  msgstr ""
573
 
574
- #: class/wpmdb.php:1965
575
  msgid "WordPress MySQL database migration"
576
  msgstr ""
577
 
578
- #: class/wpmdb.php:1967
579
  #, php-format
580
  msgid "Generated: %s"
581
  msgstr ""
582
 
583
- #: class/wpmdb.php:1968
584
  #, php-format
585
  msgid "Hostname: %s"
586
  msgstr ""
587
 
588
- #: class/wpmdb.php:1969
589
  #, php-format
590
  msgid "Database: %s"
591
  msgstr ""
592
 
593
- #: class/wpmdb.php:2022
594
  msgid "Failed to write the gzipped SQL data to the file. (#127)"
595
  msgstr ""
596
 
597
- #: class/wpmdb.php:2029
598
  msgid "Failed to write the SQL data to the file. (#128)"
599
  msgstr ""
600
 
601
- #: class/wpmdb.php:2165
602
- #: class/wpmdb.php:2176
603
- #: class/wpmdbpro.php:1756
604
  msgid "Migrate DB Pro"
605
  msgstr ""
606
 
607
- #: class/wpmdb.php:2165
608
- #: class/wpmdb.php:2176
609
- #: class/wpmdb.php:2756
610
  msgid "Migrate DB"
611
  msgstr ""
612
 
613
- #: class/wpmdb.php:2352
614
  msgid ""
615
  "A problem occurred when trying to change the maximum request size, please "
616
  "try again."
617
  msgstr ""
618
 
619
- #: class/wpmdb.php:2353
620
- #: class/wpmdbpro.php:1032
621
  msgid "A problem occurred when trying to check the license, please try again."
622
  msgstr ""
623
 
624
- #: class/wpmdb.php:2354
625
  msgid "Establishing connection to remote server, please wait"
626
  msgstr ""
627
 
628
- #: class/wpmdb.php:2355
629
  msgid ""
630
  "A problem occurred when attempting to connect to the local server, please "
631
  "check the details and try again."
632
  msgstr ""
633
 
634
- #: class/wpmdb.php:2356
635
  msgid "Please enter your license key."
636
  msgstr ""
637
 
638
- #: class/wpmdb.php:2357
639
  msgid ""
640
  "A problem occurred when trying to register the license, please try again."
641
  msgstr ""
642
 
643
- #: class/wpmdb.php:2358
644
  msgid ""
645
  "Your license has been activated. You will now receive automatic updates and "
646
  "access to email support."
647
  msgstr ""
648
 
649
- #: class/wpmdb.php:2359
650
  msgid "Fetching license details, please wait…"
651
  msgstr ""
652
 
653
- #: class/wpmdb.php:2360
654
  msgid ""
655
  "An error occurred when trying to clear the debug log. Please contact "
656
  "support. (#132)"
657
  msgstr ""
658
 
659
- #: class/wpmdb.php:2361
660
  msgid ""
661
  "An error occurred when trying to update the debug log. Please contact "
662
  "support. (#133)"
663
  msgstr ""
664
 
665
- #: class/wpmdb.php:2362
666
  msgid "Please select at least one table to migrate."
667
  msgstr ""
668
 
669
- #: class/wpmdb.php:2363
670
  msgid "Please select at least one table for backup."
671
  msgstr ""
672
 
673
- #: class/wpmdb.php:2364
674
  msgid "Please enter a name for your migration profile."
675
  msgstr ""
676
 
677
- #: class/wpmdb.php:2365
678
  msgid ""
679
  "An error occurred when attempting to save the migration profile. Please see "
680
  "the Help tab for details on how to request support. (#118)"
681
  msgstr ""
682
 
683
- #: class/wpmdb.php:2366
684
  msgctxt "Data has been successfully exported"
685
  msgid "Export complete"
686
  msgstr ""
687
 
688
- #: class/wpmdb.php:2367
689
  msgid "Exporting, please wait…"
690
  msgstr ""
691
 
692
- #: class/wpmdb.php:2368
693
  msgid "please wait…"
694
  msgstr ""
695
 
696
- #: class/wpmdb.php:2369
697
  msgctxt "Finished successfully"
698
  msgid "complete"
699
  msgstr ""
700
 
701
- #: class/wpmdb.php:2370
702
  msgctxt "Copy of data between servers did not complete"
703
  msgid "Migration failed"
704
  msgstr ""
705
 
706
- #: class/wpmdb.php:2371
707
  msgctxt "Saving a copy of the data before import"
708
  msgid "Backing up"
709
  msgstr ""
710
 
711
- #: class/wpmdb.php:2372
712
  msgctxt "In line to be processed"
713
  msgid "Queued"
714
  msgstr ""
715
 
716
- #: class/wpmdb.php:2373
717
  msgctxt "Copying data between servers"
718
  msgid "Migrating"
719
  msgstr ""
720
 
721
- #: class/wpmdb.php:2374
722
  msgctxt "Process is active"
723
  msgid "Running"
724
  msgstr ""
725
 
726
- #: class/wpmdb.php:2375
727
  msgctxt "Current request status"
728
  msgid "Status"
729
  msgstr ""
730
 
731
- #: class/wpmdb.php:2376
732
  msgctxt "The message the server responded with"
733
  msgid "Response"
734
  msgstr ""
735
 
736
- #: class/wpmdb.php:2377
737
  msgid ""
738
  "A problem occurred when attempting to process the following table (#113)"
739
  msgstr ""
740
 
741
- #: class/wpmdb.php:2378
742
  msgid ""
743
  "A problem occurred when processing the following table. We were expecting a "
744
  "response in JSON format but instead received an empty response."
745
  msgstr ""
746
 
747
- #: class/wpmdb.php:2379
748
  msgid "Migration completed with some errors"
749
  msgstr ""
750
 
751
- #: class/wpmdb.php:2380
752
  msgid "Migration complete, your backup is located at:"
753
  msgstr ""
754
 
755
- #: class/wpmdb.php:2381
756
  msgid "A problem occurred when finalizing the backup. (#140)"
757
  msgstr ""
758
 
759
- #: class/wpmdb.php:2382
760
  msgctxt "The settings were saved successfully"
761
  msgid "Saved"
762
  msgstr ""
763
 
764
- #: class/wpmdb.php:2383
765
  msgid ""
766
  "Any sites setup to use the current secret key will no longer be able to "
767
  "connect. You will need to update those sites with the newly generated secret "
768
  "key. Do you wish to continue?"
769
  msgstr ""
770
 
771
- #: class/wpmdb.php:2384
772
  msgid ""
773
  "An error occurred when trying to generate the secret key. Please see the "
774
  "Help tab for details on how to request support. (#105)"
775
  msgstr ""
776
 
777
- #: class/wpmdb.php:2385
778
  msgid ""
779
  "You are about to remove the migration profile \"{{profile}}\". This cannot "
780
  "be undone. Do you wish to continue?"
781
  msgstr ""
782
 
783
- #: class/wpmdb.php:2386
784
  msgid ""
785
  "An error occurred when trying to delete the profile. Please see the Help tab "
786
  "for details on how to request support. (#106)"
787
  msgstr ""
788
 
789
- #: class/wpmdb.php:2387
790
  msgid ""
791
  "The selected migration profile could not be deleted because it was not "
792
  "found.\n"
@@ -794,230 +842,265 @@ msgid ""
794
  "migration profiles."
795
  msgstr ""
796
 
797
- #: class/wpmdb.php:2388
798
  msgid ""
799
  "If you change the connection details, you will lose any replaces and table "
800
  "selections you have made below. Do you wish to continue?"
801
  msgstr ""
802
 
803
- #: class/wpmdb.php:2389
804
- #: template/migrate.php:113
805
  msgid "Please enter the connection information above to continue."
806
  msgstr ""
807
 
808
- #: class/wpmdb.php:2390
809
  msgid ""
810
  "An error occurred when trying to save the settings. Please try again. If the "
811
  "problem persists, please see the Help tab for details on how to request "
812
  "support. (#108)"
813
  msgstr ""
814
 
815
- #: class/wpmdb.php:2391
816
  msgid ""
817
  "The connection information appears to be missing, please enter it to "
818
  "continue."
819
  msgstr ""
820
 
821
- #: class/wpmdb.php:2392
822
  msgid ""
823
  "The connection information appears to be incorrect, it should consist of two "
824
  "lines. The first being the remote server's URL and the second being the "
825
  "secret key."
826
  msgstr ""
827
 
828
- #: class/wpmdb.php:2393
829
  msgid ""
830
  "The URL on the first line appears to be invalid, please check it and try "
831
  "again."
832
  msgstr ""
833
 
834
- #: class/wpmdb.php:2394
835
  msgid ""
836
- "The secret key on the second line appears to be invalid. It should be a 32 "
837
  "character string that consists of letters, numbers and special characters "
838
  "only."
839
  msgstr ""
840
 
841
- #: class/wpmdb.php:2395
842
  msgid ""
843
  "It appears you've entered the URL for this website, you need to provide the "
844
  "URL of the remote website instead."
845
  msgstr ""
846
 
847
- #: class/wpmdb.php:2396
848
  msgid ""
849
  "Looks like your remote secret key is the same as the secret key for this "
850
  "site. To fix this, go to the <a href=\"#settings\">Settings tab</a> and "
851
  "click \"Reset Secret Key\""
852
  msgstr ""
853
 
854
- #: class/wpmdb.php:2397
855
  msgid "Time Elapsed:"
856
  msgstr ""
857
 
858
- #: class/wpmdb.php:2398
859
  #: template/migrate-progress.php:17
860
  msgctxt "Temporarily stop migrating"
861
  msgid "Pause"
862
  msgstr ""
863
 
864
- #: class/wpmdb.php:2399
865
  msgctxt "The migration has been temporarily stopped"
866
  msgid "Migration Paused"
867
  msgstr ""
868
 
869
- #: class/wpmdb.php:2400
 
 
 
 
 
870
  msgctxt "Restart migrating after it was paused"
871
  msgid "Resume"
872
  msgstr ""
873
 
874
- #: class/wpmdb.php:2401
875
  msgid "Completing current request"
876
  msgstr ""
877
 
878
- #: class/wpmdb.php:2402
879
  msgctxt "The migration is being cancelled"
880
  msgid "Cancelling migration"
881
  msgstr ""
882
 
883
- #: class/wpmdb.php:2403
 
 
 
 
 
884
  msgctxt "The migration has been temporarily stopped"
885
  msgid "Paused"
886
  msgstr ""
887
 
888
- #: class/wpmdb.php:2404
 
 
 
 
889
  msgid ""
890
  "Automatically paused before migrated tables are replaced. Click \"Resume\" "
891
  "or \"Cancel\" when ready."
892
  msgstr ""
893
 
894
- #: class/wpmdb.php:2405
 
 
 
 
 
 
895
  msgid "Removing the local MySQL export file"
896
  msgstr ""
897
 
898
- #: class/wpmdb.php:2406
899
  msgid "Removing the local backup MySQL export file"
900
  msgstr ""
901
 
902
- #: class/wpmdb.php:2407
903
  msgid "Removing the local temporary tables"
904
  msgstr ""
905
 
906
- #: class/wpmdb.php:2408
907
  msgid "Removing the remote backup MySQL export file"
908
  msgstr ""
909
 
910
- #: class/wpmdb.php:2409
911
  msgid "Removing the remote temporary tables"
912
  msgstr ""
913
 
914
- #: class/wpmdb.php:2410
915
  msgid "Migration cancellation failed"
916
  msgstr ""
917
 
918
- #: class/wpmdb.php:2411
919
  msgid ""
920
  "A problem occurred while cancelling the migration, you may have to manually "
921
  "delete some temporary files / tables."
922
  msgstr ""
923
 
924
- #: class/wpmdb.php:2412
925
  msgctxt "The migration has been cancelled"
926
  msgid "Migration cancelled"
927
  msgstr ""
928
 
929
- #: class/wpmdb.php:2413
930
  msgid ""
931
  "The migration has been stopped and all temporary files and data have been "
932
  "cleaned up."
933
  msgstr ""
934
 
935
- #: class/wpmdb.php:2414
 
 
 
 
 
 
 
 
 
 
 
936
  msgctxt "The migration completed successfully"
937
  msgid "Migration complete"
938
  msgstr ""
939
 
940
- #: class/wpmdb.php:2415
941
  msgctxt "The migration is in the last stages"
942
  msgid "Finalizing migration"
943
  msgstr ""
944
 
945
- #: class/wpmdb.php:2416
946
  msgctxt "The caches and rewrite rules for the target are being flushed"
947
  msgid "Flushing caches and rewrite rules"
948
  msgstr ""
949
 
950
- #: class/wpmdb.php:2417
951
  msgid "A problem occurred when trying to add plugins to backlist."
952
  msgstr ""
953
 
954
- #: class/wpmdb.php:2418
955
  msgid ""
956
  "If confirmed we will install an additional WordPress 'Must Use' plugin. This "
957
  "plugin will allow us to control which plugins are loaded during WP Migrate "
958
  "DB Pro specific operations. Do you wish to continue?"
959
  msgstr ""
960
 
961
- #: class/wpmdb.php:2419
962
  msgid ""
963
  "A problem occurred when trying to change the plugin compatibility setting."
964
  msgstr ""
965
 
966
- #: class/wpmdb.php:2420
967
  msgctxt "Confirmation required"
968
  msgid "Sure?"
969
  msgstr ""
970
 
971
- #: class/wpmdb.php:2421
972
  #, php-format
973
  msgid "Pulling from %s…"
974
  msgstr ""
975
 
976
- #: class/wpmdb.php:2422
977
  #, php-format
978
  msgid "Pull from %s complete"
979
  msgstr ""
980
 
981
- #: class/wpmdb.php:2423
982
  #, php-format
983
  msgid "Pushing to %s…"
984
  msgstr ""
985
 
986
- #: class/wpmdb.php:2424
987
  #, php-format
988
  msgid "Push to %s complete"
989
  msgstr ""
990
 
991
- #: class/wpmdb.php:2425
 
 
 
 
992
  msgid "Copying license to the remote site, please wait"
993
  msgstr ""
994
 
995
- #: class/wpmdb.php:2426
996
  msgid "Attempting to activate your license, please wait…"
997
  msgstr ""
998
 
999
- #: class/wpmdb.php:2427
1000
  msgid "License successfully activated, please wait…"
1001
  msgstr ""
1002
 
1003
- #: class/wpmdb.php:2428
1004
  msgid ""
1005
  "An error occurred when trying to reactivate your license. Please provide the "
1006
  "following information when requesting support:"
1007
  msgstr ""
1008
 
1009
- #: class/wpmdb.php:2429
1010
  msgid ""
1011
  "<strong>We've temporarily activated your licence and will complete the "
1012
  "activation once the Delicious Brains API is available again.</strong><br /"
1013
  ">Please refresh this page to continue."
1014
  msgstr ""
1015
 
1016
- #: class/wpmdb.php:2430
1017
  msgid "JSON Decoding Failure"
1018
  msgstr ""
1019
 
1020
- #: class/wpmdb.php:2431
1021
  msgid ""
1022
  "Our AJAX request was expecting JSON but we received something else. Often "
1023
  "this is caused by your theme and/or plugins spitting out PHP errors. If you "
@@ -1026,89 +1109,103 @@ msgid ""
1026
  "disable errors from showing up."
1027
  msgstr ""
1028
 
1029
- #: class/wpmdb.php:2432
1030
  msgid "View error messages"
1031
  msgstr ""
1032
 
1033
- #: class/wpmdb.php:2433
1034
  #, php-format
1035
  msgid "Waiting %s seconds before executing next step"
1036
  msgstr ""
1037
 
1038
- #: class/wpmdb.php:2434
1039
  msgid ""
1040
  "A problem occurred when trying to change the delay between requests, please "
1041
  "try again."
1042
  msgstr ""
1043
 
1044
- #: class/wpmdb.php:2435
1045
  msgid "A problem occurred when flushing caches and rewrite rules. (#145)"
1046
  msgstr ""
1047
 
1048
- #: class/wpmdb.php:2436
1049
  msgctxt "Transfer this database to the remote site"
1050
  msgid "Push"
1051
  msgstr ""
1052
 
1053
- #: class/wpmdb.php:2437
1054
  msgctxt "Transfer this database to the remote site and save migration profile"
1055
  msgid "Push &amp; Save"
1056
  msgstr ""
1057
 
1058
- #: class/wpmdb.php:2438
1059
  msgctxt "Transfer the remote database to this site"
1060
  msgid "Pull"
1061
  msgstr ""
1062
 
1063
- #: class/wpmdb.php:2439
1064
  msgctxt "Transfer the remote database to this site and save migration profile"
1065
  msgid "Pull &amp; Save"
1066
  msgstr ""
1067
 
1068
- #: class/wpmdb.php:2440
1069
- #: template/migrate.php:347
1070
  msgctxt "Download a copy of the database"
1071
  msgid "Export"
1072
  msgstr ""
1073
 
1074
- #: class/wpmdb.php:2441
1075
  msgctxt "Download a copy of the database and save migration profile"
1076
  msgid "Export &amp; Save"
1077
  msgstr ""
1078
 
1079
- #: class/wpmdb.php:2442
 
 
 
 
 
 
 
 
 
 
1080
  msgctxt "database tables"
1081
  msgid "Tables"
1082
  msgstr ""
1083
 
1084
- #: class/wpmdb.php:2443
1085
  msgid "Files"
1086
  msgstr ""
1087
 
1088
- #: class/wpmdb.php:2444
1089
  msgctxt "Transferred"
1090
  msgid "Migrated"
1091
  msgstr ""
1092
 
1093
- #: class/wpmdb.php:2445
1094
  msgid "Backed Up"
1095
  msgstr ""
1096
 
1097
- #: class/wpmdb.php:2446
 
 
 
 
1098
  msgctxt "Obscure from view"
1099
  msgid "Hide"
1100
  msgstr ""
1101
 
1102
- #: class/wpmdb.php:2447
1103
  msgctxt "Reveal"
1104
  msgid "Show"
1105
  msgstr ""
1106
 
1107
- #: class/wpmdb.php:2448
1108
  msgid "Welcome to WP Migrate DB Pro! &#127881;"
1109
  msgstr ""
1110
 
1111
- #: class/wpmdb.php:2449
1112
  #, php-format
1113
  msgid ""
1114
  "Hey, this is the first time activating your license, nice! Your migrations "
@@ -1118,60 +1215,70 @@ msgid ""
1118
  "submit a support request."
1119
  msgstr ""
1120
 
1121
- #: class/wpmdb.php:2450
1122
  #, php-format
1123
  msgid "%1$s Stage %2$s of %3$s"
1124
  msgstr ""
1125
 
1126
- #: class/wpmdb.php:2451
1127
  msgid "Paused"
1128
  msgstr ""
1129
 
1130
- #: class/wpmdb.php:2452
1131
  msgid "Cancelling"
1132
  msgstr ""
1133
 
1134
- #: class/wpmdb.php:2453
1135
  msgid "Cancelled"
1136
  msgstr ""
1137
 
1138
- #: class/wpmdb.php:2454
1139
  msgid "Finalizing"
1140
  msgstr ""
1141
 
1142
- #: class/wpmdb.php:2455
1143
  msgid "Complete"
1144
  msgstr ""
1145
 
1146
- #: class/wpmdb.php:2456
1147
  msgid "Failed"
1148
  msgstr ""
1149
 
1150
- #: class/wpmdb.php:2492
 
 
 
 
 
 
 
 
 
 
1151
  msgid "Could not find the file to download:"
1152
  msgstr ""
1153
 
1154
- #: class/wpmdb.php:2690
1155
  msgid "MySQL export file not found."
1156
  msgstr ""
1157
 
1158
- #: class/wpmdb.php:2696
1159
  msgid "Could not delete the MySQL export file."
1160
  msgstr ""
1161
 
1162
- #: class/wpmdb.php:2762
1163
  msgid ""
1164
  "WP Migrate DB and WP Migrate DB Pro cannot both be active. We've "
1165
  "automatically deactivated WP Migrate DB."
1166
  msgstr ""
1167
 
1168
- #: class/wpmdb.php:2764
1169
  msgid ""
1170
  "WP Migrate DB and WP Migrate DB Pro cannot both be active. We've "
1171
  "automatically deactivated WP Migrate DB Pro."
1172
  msgstr ""
1173
 
1174
- #: class/wpmdb.php:2842
1175
  #, php-format
1176
  msgid ""
1177
  "The source site supports utf8mb4 data but the target does not, aborting "
@@ -1179,29 +1286,29 @@ msgid ""
1179
  "information. (#148)"
1180
  msgstr ""
1181
 
1182
- #: class/wpmdb.php:2893
1183
  msgid "Warning: Mixed Case Table Names"
1184
  msgstr ""
1185
 
1186
- #: class/wpmdb.php:2896
1187
  msgid ""
1188
  "Whoa! We've detected that your <b>local</b> site has the MySQL setting "
1189
  "<code>lower_case_table_names</code> set to <code>1</code>."
1190
  msgstr ""
1191
 
1192
- #: class/wpmdb.php:2898
1193
  msgid ""
1194
  "Whoa! We've detected that your <b>remote</b> site has the MySQL setting "
1195
  "<code>lower_case_table_names</code> set to <code>1</code>."
1196
  msgstr ""
1197
 
1198
- #: class/wpmdb.php:2901
1199
  msgid ""
1200
  "As a result, uppercase characters in table names will be converted to "
1201
  "lowercase during the migration."
1202
  msgstr ""
1203
 
1204
- #: class/wpmdb.php:2903
1205
  #, php-format
1206
  msgid ""
1207
  "You can read more about this in <a href=\"%s\">our documentation</a>, "
@@ -1216,73 +1323,73 @@ msgid ""
1216
  "Now</a></strong>"
1217
  msgstr ""
1218
 
1219
- #: class/wpmdbpro.php:177
1220
  msgid "UI Walkthrough"
1221
  msgstr ""
1222
 
1223
- #: class/wpmdbpro.php:178
1224
  msgid ""
1225
  "A brief walkthrough of the WP Migrate DB plugin showing all of the different "
1226
  "options and explaining them."
1227
  msgstr ""
1228
 
1229
- #: class/wpmdbpro.php:181
1230
  msgid "Pulling Live Data Into Your Local Development&nbsp;Environment"
1231
  msgstr ""
1232
 
1233
- #: class/wpmdbpro.php:182
1234
  msgid ""
1235
  "This screencast demonstrates how you can pull data from a remote, live "
1236
  "WordPress install and update the data in your local development environment."
1237
  msgstr ""
1238
 
1239
- #: class/wpmdbpro.php:185
1240
  msgid "Pushing Local Development Data to a Staging&nbsp;Environment"
1241
  msgstr ""
1242
 
1243
- #: class/wpmdbpro.php:186
1244
  msgid ""
1245
  "This screencast demonstrates how you can push a local WordPress database "
1246
  "you've been using for development to a staging environment."
1247
  msgstr ""
1248
 
1249
- #: class/wpmdbpro.php:189
1250
  msgid "WP Migrate DB Pro Media Files Addon 1.3 and CLI Addon 1.1"
1251
  msgstr ""
1252
 
1253
- #: class/wpmdbpro.php:190
1254
  msgid ""
1255
  "A demonstration of what's new in WP Migrate DB Pro Media Files Addon 1.3 and "
1256
  "CLI Addon 1.1."
1257
  msgstr ""
1258
 
1259
- #: class/wpmdbpro.php:297
1260
  msgid ""
1261
  "Please activate your license before attempting a pull or push migration."
1262
  msgstr ""
1263
 
1264
- #: class/wpmdbpro.php:597
1265
  msgid ""
1266
  "The connection succeeded but the remote site is configured to reject pull "
1267
  "connections. You can change this in the \"settings\" tab on the remote site. "
1268
  "(#141)"
1269
  msgstr ""
1270
 
1271
- #: class/wpmdbpro.php:660
1272
  msgid ""
1273
  "The connection succeeded but the remote site is configured to reject pull "
1274
  "connections. You can change this in the \"settings\" tab on the remote site. "
1275
  "(#110)"
1276
  msgstr ""
1277
 
1278
- #: class/wpmdbpro.php:662
1279
  msgid ""
1280
  "The connection succeeded but the remote site is configured to reject push "
1281
  "connections. You can change this in the \"settings\" tab on the remote site. "
1282
  "(#110)"
1283
  msgstr ""
1284
 
1285
- #: class/wpmdbpro.php:741
1286
  #, php-format
1287
  msgid ""
1288
  "<b>Version Mismatch</b> &mdash; We've detected you have version %1$s of WP "
@@ -1290,7 +1397,7 @@ msgid ""
1290
  "the Plugins page on both installs and check for updates."
1291
  msgstr ""
1292
 
1293
- #: class/wpmdbpro.php:743
1294
  #, php-format
1295
  msgid ""
1296
  "<b>Version Mismatch</b> &mdash; We've detected you have version %1$s of WP "
@@ -1298,138 +1405,138 @@ msgid ""
1298
  "\"%4$s\">Plugins page</a> on both installs and check for updates."
1299
  msgstr ""
1300
 
1301
- #: class/wpmdbpro.php:757
1302
  msgctxt "Asking to try and connect to remote server after verification error"
1303
  msgid "Try again?"
1304
  msgstr ""
1305
 
1306
- #: class/wpmdbpro.php:770
1307
  #, php-format
1308
  msgid ""
1309
  "Activate remote license &mdash; Looks like you don't have a WP Migrate DB "
1310
  "Pro license active at %s."
1311
  msgstr ""
1312
 
1313
- #: class/wpmdbpro.php:772
1314
  #, php-format
1315
  msgid "Copy %1$s license key to %2$s and activate it"
1316
  msgstr ""
1317
 
1318
- #: class/wpmdbpro.php:783
1319
  msgid ""
1320
  "The connection succeeded but the remote site is configured to reject pull "
1321
  "connections. You can change this in the \"settings\" tab on the remote site. "
1322
  "(#122)"
1323
  msgstr ""
1324
 
1325
- #: class/wpmdbpro.php:785
1326
  msgid ""
1327
  "The connection succeeded but the remote site is configured to reject push "
1328
  "connections. You can change this in the \"settings\" tab on the remote site. "
1329
  "(#122)"
1330
  msgstr ""
1331
 
1332
- #: class/wpmdbpro.php:787
1333
  msgctxt "Attempt to connect to the remote server again"
1334
  msgid "Try again?"
1335
  msgstr ""
1336
 
1337
- #: class/wpmdbpro.php:935
1338
  msgctxt "Delete license"
1339
  msgid "Remove"
1340
  msgstr ""
1341
 
1342
- #: class/wpmdbpro.php:1119
1343
  msgid ""
1344
  "If you have an <strong>active license</strong>, you may send an email to the "
1345
  "following address."
1346
  msgstr ""
1347
 
1348
- #: class/wpmdbpro.php:1121
1349
  msgid ""
1350
  "Please copy the Diagnostic Info &amp; Error Log info below into a text file "
1351
  "and attach it to your email. Do the same for any other site involved in your "
1352
  "email."
1353
  msgstr ""
1354
 
1355
- #: class/wpmdbpro.php:1152
1356
  msgctxt "License does not allow use of addons"
1357
  msgid "Addons Unavailable"
1358
  msgstr ""
1359
 
1360
- #: class/wpmdbpro.php:1152
1361
  #, php-format
1362
  msgid ""
1363
  "Addons are not included with the Personal license. Visit <a href=\"%s\" "
1364
  "target=\"_blank\">My Account</a> to upgrade in just a few clicks."
1365
  msgstr ""
1366
 
1367
- #: class/wpmdbpro.php:1167
1368
  msgctxt "Installed on website but not activated"
1369
  msgid "Installed"
1370
  msgstr ""
1371
 
1372
- #: class/wpmdbpro.php:1169
1373
  msgctxt "Installed and activated on website"
1374
  msgid "Activated"
1375
  msgstr ""
1376
 
1377
- #: class/wpmdbpro.php:1172
1378
  msgctxt "Enable addon so it may be used"
1379
  msgid "Activate"
1380
  msgstr ""
1381
 
1382
- #: class/wpmdbpro.php:1176
1383
  msgctxt "Download and activate addon"
1384
  msgid "Install"
1385
  msgstr ""
1386
 
1387
- #: class/wpmdbpro.php:1182
1388
  #: template/common/debug-info.php:4
1389
  msgctxt "Download to your computer"
1390
  msgid "Download"
1391
  msgstr ""
1392
 
1393
- #: class/wpmdbpro.php:1648
1394
  msgid "Could not upload the SQL to the server. (#135)"
1395
  msgstr ""
1396
 
1397
- #: class/wpmdbpro.php:1654
1398
  msgid "Could not read the SQL file we uploaded to the server. (#136)"
1399
  msgstr ""
1400
 
1401
- #: class/wpmdbpro.php:1673
1402
  msgid ""
1403
  "The connection succeeded but the remote site is configured to reject push "
1404
  "connections. You can change this in the \"settings\" tab on the remote site. "
1405
  "(#139)"
1406
  msgstr ""
1407
 
1408
- #: class/wpmdbpro.php:1939
1409
  #, php-format
1410
  msgid "There is a new version of %s available."
1411
  msgstr ""
1412
 
1413
- #: class/wpmdbpro.php:1941
1414
  #, php-format
1415
  msgid "View version %s details"
1416
  msgstr ""
1417
 
1418
- #: class/wpmdbpro.php:1951
1419
  #, php-format
1420
  msgid ""
1421
  "To update, go to %1$s and enter your license key. If you don't have a "
1422
  "license key, you may <a href=\"%2$s\">purchase one</a>."
1423
  msgstr ""
1424
 
1425
- #: class/wpmdbpro.php:1953
1426
  #, php-format
1427
  msgid ""
1428
  "To finish activating %1$s, please go to %2$s and enter your license key. If "
1429
  "you don't have a license key, you may <a href=\"%3$s\">purchase one</a>."
1430
  msgstr ""
1431
 
1432
- #: class/wpmdbpro.php:2027
1433
  msgid "Could not retrieve version details. Please try again."
1434
  msgstr ""
1435
 
@@ -1529,23 +1636,23 @@ msgid ""
1529
  msgstr ""
1530
 
1531
  #: template/common/compatibility.php:35
1532
- #: template/pro/backup.php:44
1533
- #: template/pro/exclude-post-types.php:31
1534
- #: template/pro/select-tables.php:42
1535
  msgid "Select All"
1536
  msgstr ""
1537
 
1538
  #: template/common/compatibility.php:37
1539
- #: template/pro/backup.php:46
1540
- #: template/pro/exclude-post-types.php:33
1541
- #: template/pro/select-tables.php:44
1542
  msgid "Deselect All"
1543
  msgstr ""
1544
 
1545
  #: template/common/compatibility.php:39
1546
- #: template/pro/backup.php:48
1547
- #: template/pro/exclude-post-types.php:35
1548
- #: template/pro/select-tables.php:46
1549
  msgid "Invert Selection"
1550
  msgstr ""
1551
 
@@ -1590,59 +1697,85 @@ msgctxt "Stop the migration"
1590
  msgid "Cancel"
1591
  msgstr ""
1592
 
1593
- #: template/migrate-progress.php:19
1594
  msgid "Pause before replacing migrated tables"
1595
  msgstr ""
1596
 
1597
- #: template/migrate.php:72
1598
  msgid "Export File"
1599
  msgstr ""
1600
 
1601
- #: template/migrate.php:78
1602
  msgid "Save as file to your computer"
1603
  msgstr ""
1604
 
1605
- #: template/migrate.php:85
1606
  msgid "Compress file with gzip"
1607
  msgstr ""
1608
 
1609
- #: template/migrate.php:95
 
 
 
 
 
 
 
 
1610
  msgid "Connection Info - Site URL &amp; Secret Key"
1611
  msgstr ""
1612
 
1613
- #: template/migrate.php:106
1614
  msgid "SSL Disabled"
1615
  msgstr ""
1616
 
1617
- #: template/migrate.php:106
1618
  msgid ""
1619
  "We couldn't connect over SSL but regular http (no SSL) appears to be working "
1620
  "so we've switched to that. If you run a push or pull, your data will be "
1621
  "transmitted unencrypted. Most people are fine with this, but just a heads up."
1622
  msgstr ""
1623
 
1624
- #: template/migrate.php:116
1625
  msgid "Cannot Access Uploads Directory"
1626
  msgstr ""
1627
 
1628
- #: template/migrate.php:118
1629
  msgid ""
1630
  "We require write permissions to the standard WordPress uploads directory. "
1631
  "Without this permission exports are unavailable. Please grant 755 "
1632
  "permissions on the following directory:"
1633
  msgstr ""
1634
 
1635
- #: template/migrate.php:129
1636
  msgctxt "Source text to be replaced"
1637
  msgid "Find"
1638
  msgstr ""
1639
 
1640
- #: template/migrate.php:130
1641
  msgctxt "Text to replace in source"
1642
  msgid "Replace"
1643
  msgstr ""
1644
 
1645
- #: template/migrate.php:217
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1646
  #, php-format
1647
  msgid ""
1648
  "<strong>New URL Missing</strong> &mdash; Please enter the protocol-relative "
@@ -1652,7 +1785,7 @@ msgid ""
1652
  "fields."
1653
  msgstr ""
1654
 
1655
- #: template/migrate.php:219
1656
  #, php-format
1657
  msgid ""
1658
  "<strong>New URL Missing</strong> &mdash; Please enter the protocol-relative "
@@ -1661,7 +1794,7 @@ msgid ""
1661
  "documentation</a> on find and replace fields."
1662
  msgstr ""
1663
 
1664
- #: template/migrate.php:223
1665
  #, php-format
1666
  msgid ""
1667
  "<strong>New File Path Missing</strong> &mdash; Please enter the root file "
@@ -1671,15 +1804,15 @@ msgid ""
1671
  "find and replace fields."
1672
  msgstr ""
1673
 
1674
- #: template/migrate.php:232
1675
  msgid "Advanced Options"
1676
  msgstr ""
1677
 
1678
- #: template/migrate.php:241
1679
  msgid "Replace GUIDs"
1680
  msgstr ""
1681
 
1682
- #: template/migrate.php:247
1683
  #, php-format
1684
  msgid ""
1685
  "Although the <a href=\"%s\" target=\"_blank\">WordPress Codex emphasizes</a> "
@@ -1689,38 +1822,38 @@ msgid ""
1689
  "want to migrate the site live to somedomain.com."
1690
  msgstr ""
1691
 
1692
- #: template/migrate.php:253
1693
  msgid "Exclude spam comments"
1694
  msgstr ""
1695
 
1696
- #: template/migrate.php:259
1697
  msgid ""
1698
  "Do not migrate the 'active_plugins' setting (i.e. which plugins are "
1699
  "activated/deactivated)"
1700
  msgstr ""
1701
 
1702
- #: template/migrate.php:271
1703
  msgid "Compatible with older versions of MySQL (pre-5.5)"
1704
  msgstr ""
1705
 
1706
- #: template/migrate.php:287
1707
  msgid "Save Migration Profile"
1708
  msgstr ""
1709
 
1710
- #: template/migrate.php:287
1711
  msgid "Save the above settings for the next time you do a similiar migration"
1712
  msgstr ""
1713
 
1714
- #: template/migrate.php:309
1715
  msgid "Create new profile"
1716
  msgstr ""
1717
 
1718
- #: template/migrate.php:318
1719
- #: template/migrate.php:328
1720
  msgid "Warning: Different Table Prefixes"
1721
  msgstr ""
1722
 
1723
- #: template/migrate.php:320
1724
  msgid ""
1725
  "Whoa! We've detected that the database table prefix differs between "
1726
  "installations. Clicking the Migrate button below will create new database "
@@ -1728,7 +1861,7 @@ msgid ""
1728
  "span>\"."
1729
  msgstr ""
1730
 
1731
- #: template/migrate.php:322
1732
  #, php-format
1733
  msgid ""
1734
  "However, your local install is configured to use table prefix \"%1$s\" and "
@@ -1737,13 +1870,13 @@ msgid ""
1737
  "variable to \"<span class=\"remote-prefix\"></span>\"."
1738
  msgstr ""
1739
 
1740
- #: template/migrate.php:324
1741
  msgid ""
1742
  "This will allow your local install the use the migrated tables. Once you do "
1743
  "this, you shouldn't have to do it again."
1744
  msgstr ""
1745
 
1746
- #: template/migrate.php:330
1747
  #, php-format
1748
  msgid ""
1749
  "Whoa! We've detected that the database table prefix differs between "
@@ -1751,7 +1884,7 @@ msgid ""
1751
  "tables in the remote database with prefix \"%s\"."
1752
  msgstr ""
1753
 
1754
- #: template/migrate.php:332
1755
  #, php-format
1756
  msgid ""
1757
  "However, your remote install is configured to use table prefix \"<span class="
@@ -1761,17 +1894,24 @@ msgid ""
1761
  "span>\" variable to \"%s\"."
1762
  msgstr ""
1763
 
1764
- #: template/migrate.php:334
1765
  msgid ""
1766
  "This will allow your remote install the use the migrated tables. Once you do "
1767
  "this, you shouldn't have to do it again."
1768
  msgstr ""
1769
 
1770
- #: template/migrate.php:348
1771
  msgctxt "Save current migration settings"
1772
  msgid "Save Profile"
1773
  msgstr ""
1774
 
 
 
 
 
 
 
 
1775
  #: template/options.php:22
1776
  msgid ""
1777
  "<strong>PHP Safe Mode Enabled</strong> &mdash; We do not officially support "
@@ -1814,23 +1954,27 @@ msgstr ""
1814
  msgid "Backup the remote database before replacing it"
1815
  msgstr ""
1816
 
1817
- #: template/pro/backup.php:7
 
 
 
 
1818
  msgid "An SQL file will be saved to"
1819
  msgstr ""
1820
 
1821
- #: template/pro/backup.php:15
1822
  msgid "Backup all tables with prefix"
1823
  msgstr ""
1824
 
1825
- #: template/pro/backup.php:21
1826
  msgid "Backup only tables selected for migration"
1827
  msgstr ""
1828
 
1829
- #: template/pro/backup.php:27
1830
  msgid "Backup only selected tables below"
1831
  msgstr ""
1832
 
1833
- #: template/pro/backup.php:51
1834
  #, php-format
1835
  msgid ""
1836
  "The backup option has been disabled as your local uploads directory is "
@@ -1861,7 +2005,15 @@ msgstr ""
1861
  msgid "Connection Info"
1862
  msgstr ""
1863
 
1864
- #: template/pro/connection-info.php:8
 
 
 
 
 
 
 
 
1865
  msgid "Reset Secret Key"
1866
  msgstr ""
1867
 
@@ -1875,6 +2027,12 @@ msgid ""
1875
  "posts table after migration:"
1876
  msgstr ""
1877
 
 
 
 
 
 
 
1878
  #: template/pro/licence-info.php:2
1879
  msgid "Email Support"
1880
  msgstr ""
1
  # SOME DESCRIPTIVE TITLE.
2
  # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
3
+ # This file is distributed under the same license as the wp-migrate-db package.
4
  # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
5
  #
6
  #, fuzzy
8
  msgstr ""
9
  "Project-Id-Version: wp-migrate-db\n"
10
  "Report-Msgid-Bugs-To: nom@deliciousbrains.com\n"
11
+ "POT-Creation-Date: 2016-10-20 10:51-0400\n"
12
  "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
13
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
14
  "Language-Team: LANGUAGE <LL@li.org>\n"
64
  #: class/wpmdb-base.php:384
65
  #, php-format
66
  msgid ""
67
+ "Couldn't connect over HTTPS. You might want to try regular HTTP instead. "
68
+ "(#121 - scope: %s)"
69
+ msgstr ""
70
+
71
+ #: class/wpmdb-base.php:386
72
+ #, php-format
73
+ msgid ""
74
+ "<strong>SSL Connection error:</strong> (#121 - scope: %s) This typically "
75
+ "means that the version of SSL that your local site is using to connect to "
76
+ "the remote is incompatible or, more likely, being rejected by the remote "
77
+ "server because it's insecure. <a href=\"%s\" target=\"_blank\">See our "
78
+ "documentation</a> for possible solutions."
79
+ msgstr ""
80
+
81
+ #: class/wpmdb-base.php:388
82
+ #, php-format
83
+ msgid ""
84
  "The connection failed, an unexpected error occurred, please contact support. "
85
  "(#121 - scope: %s)"
86
  msgstr ""
87
 
88
+ #: class/wpmdb-base.php:396
89
  msgid ""
90
  "The remote site is protected with Basic Authentication. Please enter the "
91
  "username and password above to continue. (401 Unauthorized)"
92
  msgstr ""
93
 
94
+ #: class/wpmdb-base.php:403
95
  #, php-format
96
  msgid ""
97
  "Unable to connect to the remote server, please check the connection details "
98
  "- %1$s %2$s (#129 - scope: %3$s)"
99
  msgstr ""
100
 
101
+ #: class/wpmdb-base.php:413
102
  #, php-format
103
  msgid ""
104
  "WP Migrate DB Pro does not seem to be installed or active on the remote "
105
  "site. (#131 - scope: %s)"
106
  msgstr ""
107
 
108
+ #: class/wpmdb-base.php:416
109
  #, php-format
110
  msgid ""
111
  "A response was expected from the remote, instead we got nothing. (#146 - "
112
  "scope: %1$s) Please review %2$s for possible solutions."
113
  msgstr ""
114
 
115
+ #: class/wpmdb-base.php:416
116
+ #: class/wpmdb.php:3621
117
  msgid "our documentation"
118
  msgstr ""
119
 
120
+ #: class/wpmdb-base.php:425
121
  msgid ""
122
  "There was a problem with the AJAX request, we were expecting a serialized "
123
  "response, instead we received:<br />"
124
  msgstr ""
125
 
126
+ #: class/wpmdb-base.php:747
127
+ #: class/wpmdb-base.php:1208
128
  #, php-format
129
  msgid ""
130
  "<strong>Could not connect to api.deliciousbrains.com</strong> &mdash; You "
135
  "can:%2$s"
136
  msgstr ""
137
 
138
+ #: class/wpmdb-base.php:747
139
+ #: class/wpmdb-base.php:1208
140
  msgid "Temporarily disable SSL for connections to api.deliciousbrains.com"
141
  msgstr ""
142
 
143
+ #: class/wpmdb-base.php:755
144
+ #: class/wpmdb-base.php:1214
145
  #, php-format
146
  msgid ""
147
  "We've detected that <code>WP_HTTP_BLOCK_EXTERNAL</code> is enabled and the "
151
  "\" target=\"_blank\">More information</a>."
152
  msgstr ""
153
 
154
+ #: class/wpmdb-base.php:800
155
  msgid ""
156
  "<strong>Delicious Brains API is Down — </strong>Unfortunately we're "
157
  "experiencing some problems with our server."
158
  msgstr ""
159
 
160
+ #: class/wpmdb-base.php:804
161
  #, php-format
162
  msgctxt "ex. 2 hours ago"
163
  msgid "%s ago"
164
  msgstr ""
165
 
166
+ #: class/wpmdb-base.php:809
167
  msgid "Here's the most recent update on its status"
168
  msgstr ""
169
 
170
+ #: class/wpmdb-base.php:836
171
  #, php-format
172
  msgid ""
173
  "Error retrieving download from deliciousbrain.com. Please try again or "
174
  "download manually from <a href=\"%1$s\">%2$s</a>."
175
  msgstr ""
176
 
177
+ #: class/wpmdb-base.php:836
178
  msgctxt "Delicious Brains account"
179
  msgid "My Account"
180
  msgstr ""
181
 
182
+ #: class/wpmdb-base.php:895
183
+ #: class/wpmdb.php:113
184
+ #: class/wpmdb.php:314
185
+ #: class/wpmdbpro.php:1571
186
  msgctxt "Plugin configuration and preferences"
187
  msgid "Settings"
188
  msgstr ""
189
 
190
+ #: class/wpmdb-base.php:896
191
  #, php-format
192
  msgid ""
193
  "To finish activating WP Migrate DB Pro, please go to %1$s and enter your "
195
  "\">purchase one</a>."
196
  msgstr ""
197
 
198
+ #: class/wpmdb-base.php:1127
199
+ #: class/wpmdb-base.php:1137
200
  msgctxt "A new version of the plugin is available"
201
  msgid "Update Available"
202
  msgstr ""
203
 
204
+ #: class/wpmdb-base.php:1128
205
  #, php-format
206
  msgid "A new version of %1$s is now available. %2$s"
207
  msgstr ""
208
 
209
+ #: class/wpmdb-base.php:1128
210
+ #: class/wpmdb-base.php:1138
211
  msgctxt "Download and install a new version of the plugin"
212
  msgid "Update Now"
213
  msgstr ""
214
 
215
+ #: class/wpmdb-base.php:1138
216
  #, php-format
217
  msgid ""
218
  "%1$s %2$s is now available. You currently have %3$s installed. <a href=\"%4$s"
219
  "\">%5$s</a>"
220
  msgstr ""
221
 
222
+ #: class/wpmdb-base.php:1182
223
  #, php-format
224
  msgid ""
225
  "<strong>Activate Your License</strong> &mdash; Please <a href=\"%s\" class="
227
  "priority support and plugin updates."
228
  msgstr ""
229
 
230
+ #: class/wpmdb-base.php:1199
231
  msgid ""
232
  "<strong>We've temporarily activated your license and will complete the "
233
  "activation once the Delicious Brains API is available again.</strong>"
234
  msgstr ""
235
 
236
+ #: class/wpmdb-base.php:1221
237
  #, php-format
238
  msgid ""
239
  "<strong>Your License Was Cancelled</strong> &mdash; Please visit <a href=\"%s"
241
  "enable push and pull."
242
  msgstr ""
243
 
 
 
 
244
  #: class/wpmdb-base.php:1222
245
+ #: class/wpmdb-base.php:1227
246
+ #: class/wpmdb-base.php:1248
247
+ #: class/wpmdb-base.php:1252
248
+ #: class/wpmdbpro.php:1028
249
+ #: class/wpmdbpro.php:1578
250
  msgid "Check my license again"
251
  msgstr ""
252
 
253
+ #: class/wpmdb-base.php:1225
254
  msgid "Your License Has Expired"
255
  msgstr ""
256
 
257
+ #: class/wpmdb-base.php:1226
258
  #, php-format
259
  msgid "Login to <a href=\"%s\">My Account</a> to renew. "
260
  msgstr ""
261
 
262
+ #: class/wpmdb-base.php:1231
263
  msgid "Updates are only available to those with an active license. "
264
  msgstr ""
265
 
266
+ #: class/wpmdb-base.php:1232
267
  msgid "Only active licenses can download and install addons. "
268
  msgstr ""
269
 
270
+ #: class/wpmdb-base.php:1233
271
  msgid "Only active licenses can submit support requests. "
272
  msgstr ""
273
 
274
+ #: class/wpmdb-base.php:1234
275
  msgid ""
276
  "All features will continue to work, but you won't be able to receive updates "
277
  "or email support. "
278
  msgstr ""
279
 
280
+ #: class/wpmdb-base.php:1247
281
  #, php-format
282
  msgid ""
283
  "<strong>No Activations Left</strong> &mdash; Please visit <a href=\"%s\" "
285
  "previous activation and enable push and pull."
286
  msgstr ""
287
 
288
+ #: class/wpmdb-base.php:1251
289
  #, php-format
290
  msgid ""
291
  "<strong>Your License Was Not Found</strong> &mdash; Perhaps you made a typo "
294
  "license key."
295
  msgstr ""
296
 
297
+ #: class/wpmdb-base.php:1255
298
  msgid "<strong>Your License Was Not Found</strong> &mdash; "
299
  msgstr ""
300
 
301
+ #: class/wpmdb-base.php:1259
302
  msgid "Your License Is Inactive"
303
  msgstr ""
304
 
305
+ #: class/wpmdb-base.php:1260
306
  msgid "Your license has been deactivated for this install."
307
  msgstr ""
308
 
309
+ #: class/wpmdb-base.php:1260
310
  msgid "Reactivate License"
311
  msgstr ""
312
 
313
+ #: class/wpmdb-base.php:1263
314
  #, php-format
315
  msgid ""
316
  "<strong>An Unexpected Error Occurred</strong> &mdash; Please contact us at "
317
  "<a href=\"%1$s\">%2$s</a> and quote the following:"
318
  msgstr ""
319
 
320
+ #: class/wpmdb-base.php:1302
321
  #, php-format
322
  msgid "Invalid nonce for: %s"
323
  msgstr ""
324
 
325
+ #: class/wpmdb-base.php:1310
326
  #, php-format
327
  msgid "Access denied for: %s"
328
  msgstr ""
329
 
330
+ #: class/wpmdb-base.php:1516
331
  msgctxt "dismiss notice permanently"
332
  msgid "Dismiss"
333
  msgstr ""
334
 
335
+ #: class/wpmdb-base.php:1525
336
  msgid "Remind Me Later"
337
  msgstr ""
338
 
339
+ #: class/wpmdb-base.php:1627
340
  msgid "Failed to save migration state. Please contact support."
341
  msgstr ""
342
 
343
+ #: class/wpmdb-base.php:1650
344
  msgid "Failed to retrieve migration state. Please contact support."
345
  msgstr ""
346
 
347
+ #: class/wpmdb-cli.php:62
348
  #, php-format
349
  msgid "CLI addon requires PHP %1$s+"
350
  msgstr ""
351
 
352
+ #: class/wpmdb-cli.php:103
353
  msgid "Profile not found or unable to be generated from params."
354
  msgstr ""
355
 
356
+ #: class/wpmdb-cli.php:142
357
  #, php-format
358
  msgid "The following table(s) do not exist in the %1$s database: %2$s"
359
  msgstr ""
360
 
361
+ #: class/wpmdb-cli.php:191
362
  #, php-format
363
  msgid ""
364
  "We were expecting a JSON response, instead we received: %2$s (function name: "
365
  "%1$s)"
366
  msgstr ""
367
 
368
+ #: class/wpmdb-cli.php:247
369
  msgid "Initiating migration..."
370
  msgstr ""
371
 
372
+ #: class/wpmdb-cli.php:294
373
  msgid "Exporting tables"
374
  msgstr ""
375
 
376
+ #: class/wpmdb-cli.php:297
377
+ msgid "Running find & replace"
378
+ msgstr ""
379
+
380
+ #: class/wpmdb-cli.php:371
381
  msgid "No tables selected for migration."
382
  msgstr ""
383
 
384
+ #: class/wpmdb-cli.php:464
385
  msgid "Cleaning up..."
386
  msgstr ""
387
 
388
+ #: class/wpmdb-cli.php:548
389
  msgid "Unable to move exported file."
390
  msgstr ""
391
 
392
+ #: class/wpmdb-cli.php:608
 
 
 
 
393
  msgid "Parameter errors: "
394
  msgstr ""
395
 
396
+ #: class/wpmdb-cli.php:610
397
  #, php-format
398
  msgid "unknown %s parameter"
399
  msgstr ""
400
 
401
+ #: class/wpmdb-cli.php:614
402
  msgid ""
403
  "Please make sure that you have activated the appropriate addons for WP "
404
  "Migrate DB Pro."
405
  msgstr ""
406
 
407
+ #: class/wpmdb-cli.php:621
408
  msgid "Missing action parameter"
409
  msgstr ""
410
 
411
+ #: class/wpmdb-cli.php:637
412
+ msgid "Missing find and replace values."
413
+ msgstr ""
414
+
415
+ #: class/wpmdb-cli.php:644
416
  #, php-format
417
  msgid "%1$s and %2$s must contain the same number of values"
418
  msgstr ""
419
 
420
+ #: class/wpmdb-cli.php:692
421
  #, php-format
422
  msgid ""
423
  "Cannot write to file \"%1$s\". Please ensure that the specified directory "
424
  "exists and is writable."
425
  msgstr ""
426
 
427
+ #: class/wpmdb-command.php:66
428
+ msgid "You must provide a destination filename."
429
+ msgstr ""
430
+
431
+ #: class/wpmdb-command.php:179
432
  msgid "WP Migrate DB CLI class not available."
433
  msgstr ""
434
 
435
+ #: class/wpmdb-command.php:187
436
  #, php-format
437
  msgid "Export saved to: %s"
438
  msgstr ""
439
 
440
+ #: class/wpmdb-command.php:190
441
+ #: class/wpmdb.php:3182
442
+ msgid "Find & Replace complete"
443
+ msgstr ""
444
+
445
+ #: class/wpmdb-replace.php:281
446
  msgid ""
447
  "Failed attempting to do the recursive unserialize replace. Please contact "
448
  "support."
531
  msgid "Unknown sanitization rule \"%1$s\" supplied by %2$s"
532
  msgstr ""
533
 
534
+ #: class/wpmdb-utils.php:83
535
+ #, php-format
536
+ msgid "Scope: %s()."
537
+ msgstr ""
538
+
539
+ #: class/wpmdb-utils.php:84
540
+ msgid "Data cannot be unserialized."
541
+ msgstr ""
542
+
543
+ #: class/wpmdb.php:112
544
  msgctxt "Configure a migration or export"
545
  msgid "Migrate"
546
  msgstr ""
547
 
548
+ #: class/wpmdb.php:114
549
  msgctxt "Plugin extensions"
550
  msgid "Addons"
551
  msgstr ""
552
 
553
+ #: class/wpmdb.php:115
554
  msgctxt "Get help or contact support"
555
  msgid "Help"
556
  msgstr ""
557
 
558
+ #: class/wpmdb.php:179
559
  #, php-format
560
  msgid "The following directory could not be created: %s"
561
  msgstr ""
562
 
563
+ #: class/wpmdb.php:184
564
  #, php-format
565
  msgid "Could not copy the compatibility plugin from %1$s to %2$s"
566
  msgstr ""
567
 
568
+ #: class/wpmdb.php:190
569
  #, php-format
570
  msgid "Could not remove the compatibility plugin from %s"
571
  msgstr ""
572
 
573
+ #: class/wpmdb.php:980
574
+ #: class/wpmdbpro.php:328
575
+ #: class/wpmdbpro.php:1415
576
  msgid ""
577
  "Failed attempting to unserialize the response from the remote server. Please "
578
  "contact support."
579
  msgstr ""
580
 
581
+ #: class/wpmdb.php:1906
582
  msgid ""
583
  "Failed to retrieve table structure, please ensure your database is online. "
584
  "(#125)"
585
  msgstr ""
586
 
587
+ #: class/wpmdb.php:1925
588
+ msgid "Failed to get table structure."
589
+ msgstr ""
590
+
591
+ #: class/wpmdb.php:2003
592
+ #, php-format
593
+ msgid "Error creating temporary table. Table \"%s\" does not exist."
594
+ msgstr ""
595
+
596
+ #: class/wpmdb.php:2109
597
  #, php-format
598
  msgid "Delete any existing table %s"
599
  msgstr ""
600
 
601
+ #: class/wpmdb.php:2120
602
  #, php-format
603
  msgid "Table structure of table %s"
604
  msgstr ""
605
 
606
+ #: class/wpmdb.php:2128
607
  msgid ""
608
  "Failed to generate the create table query, please ensure your database is "
609
  "online. (#126)"
610
  msgstr ""
611
 
612
+ #: class/wpmdb.php:2184
613
  #, php-format
614
  msgid "Data contents of table %s"
615
  msgstr ""
616
 
617
+ #: class/wpmdb.php:2202
618
  #, php-format
619
  msgid "End of data contents of table %s"
620
  msgstr ""
621
 
622
+ #: class/wpmdb.php:2693
623
  msgid "WordPress MySQL database migration"
624
  msgstr ""
625
 
626
+ #: class/wpmdb.php:2695
627
  #, php-format
628
  msgid "Generated: %s"
629
  msgstr ""
630
 
631
+ #: class/wpmdb.php:2696
632
  #, php-format
633
  msgid "Hostname: %s"
634
  msgstr ""
635
 
636
+ #: class/wpmdb.php:2697
637
  #, php-format
638
  msgid "Database: %s"
639
  msgstr ""
640
 
641
+ #: class/wpmdb.php:2750
642
  msgid "Failed to write the gzipped SQL data to the file. (#127)"
643
  msgstr ""
644
 
645
+ #: class/wpmdb.php:2757
646
  msgid "Failed to write the SQL data to the file. (#128)"
647
  msgstr ""
648
 
649
+ #: class/wpmdb.php:2900
650
+ #: class/wpmdb.php:2925
651
+ #: class/wpmdbpro.php:1375
652
  msgid "Migrate DB Pro"
653
  msgstr ""
654
 
655
+ #: class/wpmdb.php:2900
656
+ #: class/wpmdb.php:2925
657
+ #: class/wpmdb.php:3528
658
  msgid "Migrate DB"
659
  msgstr ""
660
 
661
+ #: class/wpmdb.php:3102
662
  msgid ""
663
  "A problem occurred when trying to change the maximum request size, please "
664
  "try again."
665
  msgstr ""
666
 
667
+ #: class/wpmdb.php:3103
668
+ #: class/wpmdbpro.php:1028
669
  msgid "A problem occurred when trying to check the license, please try again."
670
  msgstr ""
671
 
672
+ #: class/wpmdb.php:3104
673
  msgid "Establishing connection to remote server, please wait"
674
  msgstr ""
675
 
676
+ #: class/wpmdb.php:3105
677
  msgid ""
678
  "A problem occurred when attempting to connect to the local server, please "
679
  "check the details and try again."
680
  msgstr ""
681
 
682
+ #: class/wpmdb.php:3106
683
  msgid "Please enter your license key."
684
  msgstr ""
685
 
686
+ #: class/wpmdb.php:3107
687
  msgid ""
688
  "A problem occurred when trying to register the license, please try again."
689
  msgstr ""
690
 
691
+ #: class/wpmdb.php:3108
692
  msgid ""
693
  "Your license has been activated. You will now receive automatic updates and "
694
  "access to email support."
695
  msgstr ""
696
 
697
+ #: class/wpmdb.php:3109
698
  msgid "Fetching license details, please wait…"
699
  msgstr ""
700
 
701
+ #: class/wpmdb.php:3110
702
  msgid ""
703
  "An error occurred when trying to clear the debug log. Please contact "
704
  "support. (#132)"
705
  msgstr ""
706
 
707
+ #: class/wpmdb.php:3111
708
  msgid ""
709
  "An error occurred when trying to update the debug log. Please contact "
710
  "support. (#133)"
711
  msgstr ""
712
 
713
+ #: class/wpmdb.php:3112
714
  msgid "Please select at least one table to migrate."
715
  msgstr ""
716
 
717
+ #: class/wpmdb.php:3113
718
  msgid "Please select at least one table for backup."
719
  msgstr ""
720
 
721
+ #: class/wpmdb.php:3114
722
  msgid "Please enter a name for your migration profile."
723
  msgstr ""
724
 
725
+ #: class/wpmdb.php:3115
726
  msgid ""
727
  "An error occurred when attempting to save the migration profile. Please see "
728
  "the Help tab for details on how to request support. (#118)"
729
  msgstr ""
730
 
731
+ #: class/wpmdb.php:3116
732
  msgctxt "Data has been successfully exported"
733
  msgid "Export complete"
734
  msgstr ""
735
 
736
+ #: class/wpmdb.php:3117
737
  msgid "Exporting, please wait…"
738
  msgstr ""
739
 
740
+ #: class/wpmdb.php:3118
741
  msgid "please wait…"
742
  msgstr ""
743
 
744
+ #: class/wpmdb.php:3119
745
  msgctxt "Finished successfully"
746
  msgid "complete"
747
  msgstr ""
748
 
749
+ #: class/wpmdb.php:3120
750
  msgctxt "Copy of data between servers did not complete"
751
  msgid "Migration failed"
752
  msgstr ""
753
 
754
+ #: class/wpmdb.php:3121
755
  msgctxt "Saving a copy of the data before import"
756
  msgid "Backing up"
757
  msgstr ""
758
 
759
+ #: class/wpmdb.php:3122
760
  msgctxt "In line to be processed"
761
  msgid "Queued"
762
  msgstr ""
763
 
764
+ #: class/wpmdb.php:3123
765
  msgctxt "Copying data between servers"
766
  msgid "Migrating"
767
  msgstr ""
768
 
769
+ #: class/wpmdb.php:3124
770
  msgctxt "Process is active"
771
  msgid "Running"
772
  msgstr ""
773
 
774
+ #: class/wpmdb.php:3125
775
  msgctxt "Current request status"
776
  msgid "Status"
777
  msgstr ""
778
 
779
+ #: class/wpmdb.php:3126
780
  msgctxt "The message the server responded with"
781
  msgid "Response"
782
  msgstr ""
783
 
784
+ #: class/wpmdb.php:3127
785
  msgid ""
786
  "A problem occurred when attempting to process the following table (#113)"
787
  msgstr ""
788
 
789
+ #: class/wpmdb.php:3128
790
  msgid ""
791
  "A problem occurred when processing the following table. We were expecting a "
792
  "response in JSON format but instead received an empty response."
793
  msgstr ""
794
 
795
+ #: class/wpmdb.php:3129
796
  msgid "Migration completed with some errors"
797
  msgstr ""
798
 
799
+ #: class/wpmdb.php:3130
800
  msgid "Migration complete, your backup is located at:"
801
  msgstr ""
802
 
803
+ #: class/wpmdb.php:3131
804
  msgid "A problem occurred when finalizing the backup. (#140)"
805
  msgstr ""
806
 
807
+ #: class/wpmdb.php:3132
808
  msgctxt "The settings were saved successfully"
809
  msgid "Saved"
810
  msgstr ""
811
 
812
+ #: class/wpmdb.php:3133
813
  msgid ""
814
  "Any sites setup to use the current secret key will no longer be able to "
815
  "connect. You will need to update those sites with the newly generated secret "
816
  "key. Do you wish to continue?"
817
  msgstr ""
818
 
819
+ #: class/wpmdb.php:3134
820
  msgid ""
821
  "An error occurred when trying to generate the secret key. Please see the "
822
  "Help tab for details on how to request support. (#105)"
823
  msgstr ""
824
 
825
+ #: class/wpmdb.php:3135
826
  msgid ""
827
  "You are about to remove the migration profile \"{{profile}}\". This cannot "
828
  "be undone. Do you wish to continue?"
829
  msgstr ""
830
 
831
+ #: class/wpmdb.php:3136
832
  msgid ""
833
  "An error occurred when trying to delete the profile. Please see the Help tab "
834
  "for details on how to request support. (#106)"
835
  msgstr ""
836
 
837
+ #: class/wpmdb.php:3137
838
  msgid ""
839
  "The selected migration profile could not be deleted because it was not "
840
  "found.\n"
842
  "migration profiles."
843
  msgstr ""
844
 
845
+ #: class/wpmdb.php:3138
846
  msgid ""
847
  "If you change the connection details, you will lose any replaces and table "
848
  "selections you have made below. Do you wish to continue?"
849
  msgstr ""
850
 
851
+ #: class/wpmdb.php:3139
852
+ #: template/migrate.php:118
853
  msgid "Please enter the connection information above to continue."
854
  msgstr ""
855
 
856
+ #: class/wpmdb.php:3140
857
  msgid ""
858
  "An error occurred when trying to save the settings. Please try again. If the "
859
  "problem persists, please see the Help tab for details on how to request "
860
  "support. (#108)"
861
  msgstr ""
862
 
863
+ #: class/wpmdb.php:3141
864
  msgid ""
865
  "The connection information appears to be missing, please enter it to "
866
  "continue."
867
  msgstr ""
868
 
869
+ #: class/wpmdb.php:3142
870
  msgid ""
871
  "The connection information appears to be incorrect, it should consist of two "
872
  "lines. The first being the remote server's URL and the second being the "
873
  "secret key."
874
  msgstr ""
875
 
876
+ #: class/wpmdb.php:3143
877
  msgid ""
878
  "The URL on the first line appears to be invalid, please check it and try "
879
  "again."
880
  msgstr ""
881
 
882
+ #: class/wpmdb.php:3144
883
  msgid ""
884
+ "The secret key on the second line appears to be invalid. It should be a 40 "
885
  "character string that consists of letters, numbers and special characters "
886
  "only."
887
  msgstr ""
888
 
889
+ #: class/wpmdb.php:3145
890
  msgid ""
891
  "It appears you've entered the URL for this website, you need to provide the "
892
  "URL of the remote website instead."
893
  msgstr ""
894
 
895
+ #: class/wpmdb.php:3146
896
  msgid ""
897
  "Looks like your remote secret key is the same as the secret key for this "
898
  "site. To fix this, go to the <a href=\"#settings\">Settings tab</a> and "
899
  "click \"Reset Secret Key\""
900
  msgstr ""
901
 
902
+ #: class/wpmdb.php:3147
903
  msgid "Time Elapsed:"
904
  msgstr ""
905
 
906
+ #: class/wpmdb.php:3148
907
  #: template/migrate-progress.php:17
908
  msgctxt "Temporarily stop migrating"
909
  msgid "Pause"
910
  msgstr ""
911
 
912
+ #: class/wpmdb.php:3149
913
  msgctxt "The migration has been temporarily stopped"
914
  msgid "Migration Paused"
915
  msgstr ""
916
 
917
+ #: class/wpmdb.php:3150
918
+ msgctxt "The find & replace has been temporarily stopped"
919
+ msgid "Find &amp; Replace Paused"
920
+ msgstr ""
921
+
922
+ #: class/wpmdb.php:3151
923
  msgctxt "Restart migrating after it was paused"
924
  msgid "Resume"
925
  msgstr ""
926
 
927
+ #: class/wpmdb.php:3152
928
  msgid "Completing current request"
929
  msgstr ""
930
 
931
+ #: class/wpmdb.php:3153
932
  msgctxt "The migration is being cancelled"
933
  msgid "Cancelling migration"
934
  msgstr ""
935
 
936
+ #: class/wpmdb.php:3154
937
+ msgctxt "The find & replace is being cancelled"
938
+ msgid "Cancelling find &amp; replace"
939
+ msgstr ""
940
+
941
+ #: class/wpmdb.php:3155
942
  msgctxt "The migration has been temporarily stopped"
943
  msgid "Paused"
944
  msgstr ""
945
 
946
+ #: class/wpmdb.php:3156
947
+ msgid "Pause before finalizing the updates"
948
+ msgstr ""
949
+
950
+ #: class/wpmdb.php:3157
951
  msgid ""
952
  "Automatically paused before migrated tables are replaced. Click \"Resume\" "
953
  "or \"Cancel\" when ready."
954
  msgstr ""
955
 
956
+ #: class/wpmdb.php:3158
957
+ msgid ""
958
+ "Automatically paused before the find &amp; replace was finalized. Click "
959
+ "\"Resume\" or \"Cancel\" when ready."
960
+ msgstr ""
961
+
962
+ #: class/wpmdb.php:3159
963
  msgid "Removing the local MySQL export file"
964
  msgstr ""
965
 
966
+ #: class/wpmdb.php:3160
967
  msgid "Removing the local backup MySQL export file"
968
  msgstr ""
969
 
970
+ #: class/wpmdb.php:3161
971
  msgid "Removing the local temporary tables"
972
  msgstr ""
973
 
974
+ #: class/wpmdb.php:3162
975
  msgid "Removing the remote backup MySQL export file"
976
  msgstr ""
977
 
978
+ #: class/wpmdb.php:3163
979
  msgid "Removing the remote temporary tables"
980
  msgstr ""
981
 
982
+ #: class/wpmdb.php:3164
983
  msgid "Migration cancellation failed"
984
  msgstr ""
985
 
986
+ #: class/wpmdb.php:3165
987
  msgid ""
988
  "A problem occurred while cancelling the migration, you may have to manually "
989
  "delete some temporary files / tables."
990
  msgstr ""
991
 
992
+ #: class/wpmdb.php:3166
993
  msgctxt "The migration has been cancelled"
994
  msgid "Migration cancelled"
995
  msgstr ""
996
 
997
+ #: class/wpmdb.php:3167
998
  msgid ""
999
  "The migration has been stopped and all temporary files and data have been "
1000
  "cleaned up."
1001
  msgstr ""
1002
 
1003
+ #: class/wpmdb.php:3168
1004
+ msgctxt "The migration has been cancelled"
1005
+ msgid "Find &amp; replace cancelled"
1006
+ msgstr ""
1007
+
1008
+ #: class/wpmdb.php:3169
1009
+ msgid ""
1010
+ "The find &amp; replace has been cancelled and all temporary data has been "
1011
+ "cleaned up."
1012
+ msgstr ""
1013
+
1014
+ #: class/wpmdb.php:3170
1015
  msgctxt "The migration completed successfully"
1016
  msgid "Migration complete"
1017
  msgstr ""
1018
 
1019
+ #: class/wpmdb.php:3171
1020
  msgctxt "The migration is in the last stages"
1021
  msgid "Finalizing migration"
1022
  msgstr ""
1023
 
1024
+ #: class/wpmdb.php:3172
1025
  msgctxt "The caches and rewrite rules for the target are being flushed"
1026
  msgid "Flushing caches and rewrite rules"
1027
  msgstr ""
1028
 
1029
+ #: class/wpmdb.php:3173
1030
  msgid "A problem occurred when trying to add plugins to backlist."
1031
  msgstr ""
1032
 
1033
+ #: class/wpmdb.php:3174
1034
  msgid ""
1035
  "If confirmed we will install an additional WordPress 'Must Use' plugin. This "
1036
  "plugin will allow us to control which plugins are loaded during WP Migrate "
1037
  "DB Pro specific operations. Do you wish to continue?"
1038
  msgstr ""
1039
 
1040
+ #: class/wpmdb.php:3175
1041
  msgid ""
1042
  "A problem occurred when trying to change the plugin compatibility setting."
1043
  msgstr ""
1044
 
1045
+ #: class/wpmdb.php:3176
1046
  msgctxt "Confirmation required"
1047
  msgid "Sure?"
1048
  msgstr ""
1049
 
1050
+ #: class/wpmdb.php:3177
1051
  #, php-format
1052
  msgid "Pulling from %s…"
1053
  msgstr ""
1054
 
1055
+ #: class/wpmdb.php:3178
1056
  #, php-format
1057
  msgid "Pull from %s complete"
1058
  msgstr ""
1059
 
1060
+ #: class/wpmdb.php:3179
1061
  #, php-format
1062
  msgid "Pushing to %s…"
1063
  msgstr ""
1064
 
1065
+ #: class/wpmdb.php:3180
1066
  #, php-format
1067
  msgid "Push to %s complete"
1068
  msgstr ""
1069
 
1070
+ #: class/wpmdb.php:3181
1071
+ msgid "Running Find & Replace…"
1072
+ msgstr ""
1073
+
1074
+ #: class/wpmdb.php:3183
1075
  msgid "Copying license to the remote site, please wait"
1076
  msgstr ""
1077
 
1078
+ #: class/wpmdb.php:3184
1079
  msgid "Attempting to activate your license, please wait…"
1080
  msgstr ""
1081
 
1082
+ #: class/wpmdb.php:3185
1083
  msgid "License successfully activated, please wait…"
1084
  msgstr ""
1085
 
1086
+ #: class/wpmdb.php:3186
1087
  msgid ""
1088
  "An error occurred when trying to reactivate your license. Please provide the "
1089
  "following information when requesting support:"
1090
  msgstr ""
1091
 
1092
+ #: class/wpmdb.php:3187
1093
  msgid ""
1094
  "<strong>We've temporarily activated your licence and will complete the "
1095
  "activation once the Delicious Brains API is available again.</strong><br /"
1096
  ">Please refresh this page to continue."
1097
  msgstr ""
1098
 
1099
+ #: class/wpmdb.php:3188
1100
  msgid "JSON Decoding Failure"
1101
  msgstr ""
1102
 
1103
+ #: class/wpmdb.php:3189
1104
  msgid ""
1105
  "Our AJAX request was expecting JSON but we received something else. Often "
1106
  "this is caused by your theme and/or plugins spitting out PHP errors. If you "
1109
  "disable errors from showing up."
1110
  msgstr ""
1111
 
1112
+ #: class/wpmdb.php:3190
1113
  msgid "View error messages"
1114
  msgstr ""
1115
 
1116
+ #: class/wpmdb.php:3191
1117
  #, php-format
1118
  msgid "Waiting %s seconds before executing next step"
1119
  msgstr ""
1120
 
1121
+ #: class/wpmdb.php:3192
1122
  msgid ""
1123
  "A problem occurred when trying to change the delay between requests, please "
1124
  "try again."
1125
  msgstr ""
1126
 
1127
+ #: class/wpmdb.php:3193
1128
  msgid "A problem occurred when flushing caches and rewrite rules. (#145)"
1129
  msgstr ""
1130
 
1131
+ #: class/wpmdb.php:3194
1132
  msgctxt "Transfer this database to the remote site"
1133
  msgid "Push"
1134
  msgstr ""
1135
 
1136
+ #: class/wpmdb.php:3195
1137
  msgctxt "Transfer this database to the remote site and save migration profile"
1138
  msgid "Push &amp; Save"
1139
  msgstr ""
1140
 
1141
+ #: class/wpmdb.php:3196
1142
  msgctxt "Transfer the remote database to this site"
1143
  msgid "Pull"
1144
  msgstr ""
1145
 
1146
+ #: class/wpmdb.php:3197
1147
  msgctxt "Transfer the remote database to this site and save migration profile"
1148
  msgid "Pull &amp; Save"
1149
  msgstr ""
1150
 
1151
+ #: class/wpmdb.php:3198
1152
+ #: template/migrate.php:368
1153
  msgctxt "Download a copy of the database"
1154
  msgid "Export"
1155
  msgstr ""
1156
 
1157
+ #: class/wpmdb.php:3199
1158
  msgctxt "Download a copy of the database and save migration profile"
1159
  msgid "Export &amp; Save"
1160
  msgstr ""
1161
 
1162
+ #: class/wpmdb.php:3200
1163
+ msgctxt "Run a find and replace on the database"
1164
+ msgid "Find &amp; Replace"
1165
+ msgstr ""
1166
+
1167
+ #: class/wpmdb.php:3201
1168
+ msgctxt "Run a find and replace and save migration profile"
1169
+ msgid "Find &amp; Replace &amp; Save"
1170
+ msgstr ""
1171
+
1172
+ #: class/wpmdb.php:3202
1173
  msgctxt "database tables"
1174
  msgid "Tables"
1175
  msgstr ""
1176
 
1177
+ #: class/wpmdb.php:3203
1178
  msgid "Files"
1179
  msgstr ""
1180
 
1181
+ #: class/wpmdb.php:3204
1182
  msgctxt "Transferred"
1183
  msgid "Migrated"
1184
  msgstr ""
1185
 
1186
+ #: class/wpmdb.php:3205
1187
  msgid "Backed Up"
1188
  msgstr ""
1189
 
1190
+ #: class/wpmdb.php:3206
1191
+ msgid "Searched"
1192
+ msgstr ""
1193
+
1194
+ #: class/wpmdb.php:3207
1195
  msgctxt "Obscure from view"
1196
  msgid "Hide"
1197
  msgstr ""
1198
 
1199
+ #: class/wpmdb.php:3208
1200
  msgctxt "Reveal"
1201
  msgid "Show"
1202
  msgstr ""
1203
 
1204
+ #: class/wpmdb.php:3209
1205
  msgid "Welcome to WP Migrate DB Pro! &#127881;"
1206
  msgstr ""
1207
 
1208
+ #: class/wpmdb.php:3210
1209
  #, php-format
1210
  msgid ""
1211
  "Hey, this is the first time activating your license, nice! Your migrations "
1215
  "submit a support request."
1216
  msgstr ""
1217
 
1218
+ #: class/wpmdb.php:3211
1219
  #, php-format
1220
  msgid "%1$s Stage %2$s of %3$s"
1221
  msgstr ""
1222
 
1223
+ #: class/wpmdb.php:3212
1224
  msgid "Paused"
1225
  msgstr ""
1226
 
1227
+ #: class/wpmdb.php:3213
1228
  msgid "Cancelling"
1229
  msgstr ""
1230
 
1231
+ #: class/wpmdb.php:3214
1232
  msgid "Cancelled"
1233
  msgstr ""
1234
 
1235
+ #: class/wpmdb.php:3215
1236
  msgid "Finalizing"
1237
  msgstr ""
1238
 
1239
+ #: class/wpmdb.php:3216
1240
  msgid "Complete"
1241
  msgstr ""
1242
 
1243
+ #: class/wpmdb.php:3217
1244
  msgid "Failed"
1245
  msgstr ""
1246
 
1247
+ #: class/wpmdb.php:3218
1248
+ #, php-format
1249
+ msgid "%1$s items are not shown to maintain browser performance"
1250
+ msgstr ""
1251
+
1252
+ #: class/wpmdb.php:3219
1253
+ msgctxt "Error log emptied"
1254
+ msgid "Cleared"
1255
+ msgstr ""
1256
+
1257
+ #: class/wpmdb.php:3255
1258
  msgid "Could not find the file to download:"
1259
  msgstr ""
1260
 
1261
+ #: class/wpmdb.php:3462
1262
  msgid "MySQL export file not found."
1263
  msgstr ""
1264
 
1265
+ #: class/wpmdb.php:3468
1266
  msgid "Could not delete the MySQL export file."
1267
  msgstr ""
1268
 
1269
+ #: class/wpmdb.php:3534
1270
  msgid ""
1271
  "WP Migrate DB and WP Migrate DB Pro cannot both be active. We've "
1272
  "automatically deactivated WP Migrate DB."
1273
  msgstr ""
1274
 
1275
+ #: class/wpmdb.php:3536
1276
  msgid ""
1277
  "WP Migrate DB and WP Migrate DB Pro cannot both be active. We've "
1278
  "automatically deactivated WP Migrate DB Pro."
1279
  msgstr ""
1280
 
1281
+ #: class/wpmdb.php:3621
1282
  #, php-format
1283
  msgid ""
1284
  "The source site supports utf8mb4 data but the target does not, aborting "
1286
  "information. (#148)"
1287
  msgstr ""
1288
 
1289
+ #: class/wpmdb.php:3672
1290
  msgid "Warning: Mixed Case Table Names"
1291
  msgstr ""
1292
 
1293
+ #: class/wpmdb.php:3675
1294
  msgid ""
1295
  "Whoa! We've detected that your <b>local</b> site has the MySQL setting "
1296
  "<code>lower_case_table_names</code> set to <code>1</code>."
1297
  msgstr ""
1298
 
1299
+ #: class/wpmdb.php:3677
1300
  msgid ""
1301
  "Whoa! We've detected that your <b>remote</b> site has the MySQL setting "
1302
  "<code>lower_case_table_names</code> set to <code>1</code>."
1303
  msgstr ""
1304
 
1305
+ #: class/wpmdb.php:3680
1306
  msgid ""
1307
  "As a result, uppercase characters in table names will be converted to "
1308
  "lowercase during the migration."
1309
  msgstr ""
1310
 
1311
+ #: class/wpmdb.php:3682
1312
  #, php-format
1313
  msgid ""
1314
  "You can read more about this in <a href=\"%s\">our documentation</a>, "
1323
  "Now</a></strong>"
1324
  msgstr ""
1325
 
1326
+ #: class/wpmdbpro.php:174
1327
  msgid "UI Walkthrough"
1328
  msgstr ""
1329
 
1330
+ #: class/wpmdbpro.php:175
1331
  msgid ""
1332
  "A brief walkthrough of the WP Migrate DB plugin showing all of the different "
1333
  "options and explaining them."
1334
  msgstr ""
1335
 
1336
+ #: class/wpmdbpro.php:178
1337
  msgid "Pulling Live Data Into Your Local Development&nbsp;Environment"
1338
  msgstr ""
1339
 
1340
+ #: class/wpmdbpro.php:179
1341
  msgid ""
1342
  "This screencast demonstrates how you can pull data from a remote, live "
1343
  "WordPress install and update the data in your local development environment."
1344
  msgstr ""
1345
 
1346
+ #: class/wpmdbpro.php:182
1347
  msgid "Pushing Local Development Data to a Staging&nbsp;Environment"
1348
  msgstr ""
1349
 
1350
+ #: class/wpmdbpro.php:183
1351
  msgid ""
1352
  "This screencast demonstrates how you can push a local WordPress database "
1353
  "you've been using for development to a staging environment."
1354
  msgstr ""
1355
 
1356
+ #: class/wpmdbpro.php:186
1357
  msgid "WP Migrate DB Pro Media Files Addon 1.3 and CLI Addon 1.1"
1358
  msgstr ""
1359
 
1360
+ #: class/wpmdbpro.php:187
1361
  msgid ""
1362
  "A demonstration of what's new in WP Migrate DB Pro Media Files Addon 1.3 and "
1363
  "CLI Addon 1.1."
1364
  msgstr ""
1365
 
1366
+ #: class/wpmdbpro.php:294
1367
  msgid ""
1368
  "Please activate your license before attempting a pull or push migration."
1369
  msgstr ""
1370
 
1371
+ #: class/wpmdbpro.php:594
1372
  msgid ""
1373
  "The connection succeeded but the remote site is configured to reject pull "
1374
  "connections. You can change this in the \"settings\" tab on the remote site. "
1375
  "(#141)"
1376
  msgstr ""
1377
 
1378
+ #: class/wpmdbpro.php:656
1379
  msgid ""
1380
  "The connection succeeded but the remote site is configured to reject pull "
1381
  "connections. You can change this in the \"settings\" tab on the remote site. "
1382
  "(#110)"
1383
  msgstr ""
1384
 
1385
+ #: class/wpmdbpro.php:658
1386
  msgid ""
1387
  "The connection succeeded but the remote site is configured to reject push "
1388
  "connections. You can change this in the \"settings\" tab on the remote site. "
1389
  "(#110)"
1390
  msgstr ""
1391
 
1392
+ #: class/wpmdbpro.php:737
1393
  #, php-format
1394
  msgid ""
1395
  "<b>Version Mismatch</b> &mdash; We've detected you have version %1$s of WP "
1397
  "the Plugins page on both installs and check for updates."
1398
  msgstr ""
1399
 
1400
+ #: class/wpmdbpro.php:739
1401
  #, php-format
1402
  msgid ""
1403
  "<b>Version Mismatch</b> &mdash; We've detected you have version %1$s of WP "
1405
  "\"%4$s\">Plugins page</a> on both installs and check for updates."
1406
  msgstr ""
1407
 
1408
+ #: class/wpmdbpro.php:753
1409
  msgctxt "Asking to try and connect to remote server after verification error"
1410
  msgid "Try again?"
1411
  msgstr ""
1412
 
1413
+ #: class/wpmdbpro.php:766
1414
  #, php-format
1415
  msgid ""
1416
  "Activate remote license &mdash; Looks like you don't have a WP Migrate DB "
1417
  "Pro license active at %s."
1418
  msgstr ""
1419
 
1420
+ #: class/wpmdbpro.php:768
1421
  #, php-format
1422
  msgid "Copy %1$s license key to %2$s and activate it"
1423
  msgstr ""
1424
 
1425
+ #: class/wpmdbpro.php:779
1426
  msgid ""
1427
  "The connection succeeded but the remote site is configured to reject pull "
1428
  "connections. You can change this in the \"settings\" tab on the remote site. "
1429
  "(#122)"
1430
  msgstr ""
1431
 
1432
+ #: class/wpmdbpro.php:781
1433
  msgid ""
1434
  "The connection succeeded but the remote site is configured to reject push "
1435
  "connections. You can change this in the \"settings\" tab on the remote site. "
1436
  "(#122)"
1437
  msgstr ""
1438
 
1439
+ #: class/wpmdbpro.php:783
1440
  msgctxt "Attempt to connect to the remote server again"
1441
  msgid "Try again?"
1442
  msgstr ""
1443
 
1444
+ #: class/wpmdbpro.php:931
1445
  msgctxt "Delete license"
1446
  msgid "Remove"
1447
  msgstr ""
1448
 
1449
+ #: class/wpmdbpro.php:1115
1450
  msgid ""
1451
  "If you have an <strong>active license</strong>, you may send an email to the "
1452
  "following address."
1453
  msgstr ""
1454
 
1455
+ #: class/wpmdbpro.php:1117
1456
  msgid ""
1457
  "Please copy the Diagnostic Info &amp; Error Log info below into a text file "
1458
  "and attach it to your email. Do the same for any other site involved in your "
1459
  "email."
1460
  msgstr ""
1461
 
1462
+ #: class/wpmdbpro.php:1148
1463
  msgctxt "License does not allow use of addons"
1464
  msgid "Addons Unavailable"
1465
  msgstr ""
1466
 
1467
+ #: class/wpmdbpro.php:1148
1468
  #, php-format
1469
  msgid ""
1470
  "Addons are not included with the Personal license. Visit <a href=\"%s\" "
1471
  "target=\"_blank\">My Account</a> to upgrade in just a few clicks."
1472
  msgstr ""
1473
 
1474
+ #: class/wpmdbpro.php:1163
1475
  msgctxt "Installed on website but not activated"
1476
  msgid "Installed"
1477
  msgstr ""
1478
 
1479
+ #: class/wpmdbpro.php:1165
1480
  msgctxt "Installed and activated on website"
1481
  msgid "Activated"
1482
  msgstr ""
1483
 
1484
+ #: class/wpmdbpro.php:1168
1485
  msgctxt "Enable addon so it may be used"
1486
  msgid "Activate"
1487
  msgstr ""
1488
 
1489
+ #: class/wpmdbpro.php:1172
1490
  msgctxt "Download and activate addon"
1491
  msgid "Install"
1492
  msgstr ""
1493
 
1494
+ #: class/wpmdbpro.php:1178
1495
  #: template/common/debug-info.php:4
1496
  msgctxt "Download to your computer"
1497
  msgid "Download"
1498
  msgstr ""
1499
 
1500
+ #: class/wpmdbpro.php:1304
1501
  msgid "Could not upload the SQL to the server. (#135)"
1502
  msgstr ""
1503
 
1504
+ #: class/wpmdbpro.php:1310
1505
  msgid "Could not read the SQL file we uploaded to the server. (#136)"
1506
  msgstr ""
1507
 
1508
+ #: class/wpmdbpro.php:1329
1509
  msgid ""
1510
  "The connection succeeded but the remote site is configured to reject push "
1511
  "connections. You can change this in the \"settings\" tab on the remote site. "
1512
  "(#139)"
1513
  msgstr ""
1514
 
1515
+ #: class/wpmdbpro.php:1561
1516
  #, php-format
1517
  msgid "There is a new version of %s available."
1518
  msgstr ""
1519
 
1520
+ #: class/wpmdbpro.php:1563
1521
  #, php-format
1522
  msgid "View version %s details"
1523
  msgstr ""
1524
 
1525
+ #: class/wpmdbpro.php:1573
1526
  #, php-format
1527
  msgid ""
1528
  "To update, go to %1$s and enter your license key. If you don't have a "
1529
  "license key, you may <a href=\"%2$s\">purchase one</a>."
1530
  msgstr ""
1531
 
1532
+ #: class/wpmdbpro.php:1575
1533
  #, php-format
1534
  msgid ""
1535
  "To finish activating %1$s, please go to %2$s and enter your license key. If "
1536
  "you don't have a license key, you may <a href=\"%3$s\">purchase one</a>."
1537
  msgstr ""
1538
 
1539
+ #: class/wpmdbpro.php:1651
1540
  msgid "Could not retrieve version details. Please try again."
1541
  msgstr ""
1542
 
1636
  msgstr ""
1637
 
1638
  #: template/common/compatibility.php:35
1639
+ #: template/pro/backup.php:45
1640
+ #: template/pro/exclude-post-types.php:33
1641
+ #: template/pro/select-tables.php:43
1642
  msgid "Select All"
1643
  msgstr ""
1644
 
1645
  #: template/common/compatibility.php:37
1646
+ #: template/pro/backup.php:47
1647
+ #: template/pro/exclude-post-types.php:35
1648
+ #: template/pro/select-tables.php:45
1649
  msgid "Deselect All"
1650
  msgstr ""
1651
 
1652
  #: template/common/compatibility.php:39
1653
+ #: template/pro/backup.php:49
1654
+ #: template/pro/exclude-post-types.php:37
1655
+ #: template/pro/select-tables.php:47
1656
  msgid "Invert Selection"
1657
  msgstr ""
1658
 
1697
  msgid "Cancel"
1698
  msgstr ""
1699
 
1700
+ #: template/migrate-progress.php:22
1701
  msgid "Pause before replacing migrated tables"
1702
  msgstr ""
1703
 
1704
+ #: template/migrate.php:71
1705
  msgid "Export File"
1706
  msgstr ""
1707
 
1708
+ #: template/migrate.php:77
1709
  msgid "Save as file to your computer"
1710
  msgstr ""
1711
 
1712
+ #: template/migrate.php:84
1713
  msgid "Compress file with gzip"
1714
  msgstr ""
1715
 
1716
+ #: template/migrate.php:94
1717
+ msgid "Find & Replace"
1718
+ msgstr ""
1719
+
1720
+ #: template/migrate.php:94
1721
+ msgid "Run a find & replace on this site's db"
1722
+ msgstr ""
1723
+
1724
+ #: template/migrate.php:100
1725
  msgid "Connection Info - Site URL &amp; Secret Key"
1726
  msgstr ""
1727
 
1728
+ #: template/migrate.php:111
1729
  msgid "SSL Disabled"
1730
  msgstr ""
1731
 
1732
+ #: template/migrate.php:111
1733
  msgid ""
1734
  "We couldn't connect over SSL but regular http (no SSL) appears to be working "
1735
  "so we've switched to that. If you run a push or pull, your data will be "
1736
  "transmitted unencrypted. Most people are fine with this, but just a heads up."
1737
  msgstr ""
1738
 
1739
+ #: template/migrate.php:121
1740
  msgid "Cannot Access Uploads Directory"
1741
  msgstr ""
1742
 
1743
+ #: template/migrate.php:123
1744
  msgid ""
1745
  "We require write permissions to the standard WordPress uploads directory. "
1746
  "Without this permission exports are unavailable. Please grant 755 "
1747
  "permissions on the following directory:"
1748
  msgstr ""
1749
 
1750
+ #: template/migrate.php:134
1751
  msgctxt "Source text to be replaced"
1752
  msgid "Find"
1753
  msgstr ""
1754
 
1755
+ #: template/migrate.php:135
1756
  msgctxt "Text to replace in source"
1757
  msgid "Replace"
1758
  msgstr ""
1759
 
1760
+ #: template/migrate.php:177
1761
+ #, php-format
1762
+ msgid ""
1763
+ "This find & replace will find the domain name of your remote site and "
1764
+ "replace it with the domain name of this site. We've left out the protocol so "
1765
+ "that both http:// and https:// will be found and replaced. <a href=\"%s\" "
1766
+ "target=\"_blank\">Find & Replace Documentation</a>"
1767
+ msgstr ""
1768
+
1769
+ #: template/migrate.php:198
1770
+ #, php-format
1771
+ msgid ""
1772
+ "This find and replace is mostly for 3rd party plugins that store the "
1773
+ "website’s root file path in the database. This set of fields will ensure "
1774
+ "that these values are updated to the correct root file path during the "
1775
+ "migration. <a href=\"%s\" target=\"_blank\">Find & Replace Documentation</a>"
1776
+ msgstr ""
1777
+
1778
+ #: template/migrate.php:238
1779
  #, php-format
1780
  msgid ""
1781
  "<strong>New URL Missing</strong> &mdash; Please enter the protocol-relative "
1785
  "fields."
1786
  msgstr ""
1787
 
1788
+ #: template/migrate.php:240
1789
  #, php-format
1790
  msgid ""
1791
  "<strong>New URL Missing</strong> &mdash; Please enter the protocol-relative "
1794
  "documentation</a> on find and replace fields."
1795
  msgstr ""
1796
 
1797
+ #: template/migrate.php:244
1798
  #, php-format
1799
  msgid ""
1800
  "<strong>New File Path Missing</strong> &mdash; Please enter the root file "
1804
  "find and replace fields."
1805
  msgstr ""
1806
 
1807
+ #: template/migrate.php:253
1808
  msgid "Advanced Options"
1809
  msgstr ""
1810
 
1811
+ #: template/migrate.php:262
1812
  msgid "Replace GUIDs"
1813
  msgstr ""
1814
 
1815
+ #: template/migrate.php:268
1816
  #, php-format
1817
  msgid ""
1818
  "Although the <a href=\"%s\" target=\"_blank\">WordPress Codex emphasizes</a> "
1822
  "want to migrate the site live to somedomain.com."
1823
  msgstr ""
1824
 
1825
+ #: template/migrate.php:274
1826
  msgid "Exclude spam comments"
1827
  msgstr ""
1828
 
1829
+ #: template/migrate.php:280
1830
  msgid ""
1831
  "Do not migrate the 'active_plugins' setting (i.e. which plugins are "
1832
  "activated/deactivated)"
1833
  msgstr ""
1834
 
1835
+ #: template/migrate.php:292
1836
  msgid "Compatible with older versions of MySQL (pre-5.5)"
1837
  msgstr ""
1838
 
1839
+ #: template/migrate.php:308
1840
  msgid "Save Migration Profile"
1841
  msgstr ""
1842
 
1843
+ #: template/migrate.php:308
1844
  msgid "Save the above settings for the next time you do a similiar migration"
1845
  msgstr ""
1846
 
1847
+ #: template/migrate.php:330
1848
  msgid "Create new profile"
1849
  msgstr ""
1850
 
1851
+ #: template/migrate.php:339
1852
+ #: template/migrate.php:349
1853
  msgid "Warning: Different Table Prefixes"
1854
  msgstr ""
1855
 
1856
+ #: template/migrate.php:341
1857
  msgid ""
1858
  "Whoa! We've detected that the database table prefix differs between "
1859
  "installations. Clicking the Migrate button below will create new database "
1861
  "span>\"."
1862
  msgstr ""
1863
 
1864
+ #: template/migrate.php:343
1865
  #, php-format
1866
  msgid ""
1867
  "However, your local install is configured to use table prefix \"%1$s\" and "
1870
  "variable to \"<span class=\"remote-prefix\"></span>\"."
1871
  msgstr ""
1872
 
1873
+ #: template/migrate.php:345
1874
  msgid ""
1875
  "This will allow your local install the use the migrated tables. Once you do "
1876
  "this, you shouldn't have to do it again."
1877
  msgstr ""
1878
 
1879
+ #: template/migrate.php:351
1880
  #, php-format
1881
  msgid ""
1882
  "Whoa! We've detected that the database table prefix differs between "
1884
  "tables in the remote database with prefix \"%s\"."
1885
  msgstr ""
1886
 
1887
+ #: template/migrate.php:353
1888
  #, php-format
1889
  msgid ""
1890
  "However, your remote install is configured to use table prefix \"<span class="
1894
  "span>\" variable to \"%s\"."
1895
  msgstr ""
1896
 
1897
+ #: template/migrate.php:355
1898
  msgid ""
1899
  "This will allow your remote install the use the migrated tables. Once you do "
1900
  "this, you shouldn't have to do it again."
1901
  msgstr ""
1902
 
1903
+ #: template/migrate.php:369
1904
  msgctxt "Save current migration settings"
1905
  msgid "Save Profile"
1906
  msgstr ""
1907
 
1908
+ #: template/options-tools-subsite.php:8
1909
+ #, php-format
1910
+ msgid ""
1911
+ "%1$s only runs at the Network Admin level. As there is no Tools menu in the "
1912
+ "Network Admin, the %2$s menu item is located under Settings."
1913
+ msgstr ""
1914
+
1915
  #: template/options.php:22
1916
  msgid ""
1917
  "<strong>PHP Safe Mode Enabled</strong> &mdash; We do not officially support "
1954
  msgid "Backup the remote database before replacing it"
1955
  msgstr ""
1956
 
1957
+ #: template/pro/backup.php:6
1958
+ msgid "Backup the database before running the find &amp; replace"
1959
+ msgstr ""
1960
+
1961
+ #: template/pro/backup.php:8
1962
  msgid "An SQL file will be saved to"
1963
  msgstr ""
1964
 
1965
+ #: template/pro/backup.php:16
1966
  msgid "Backup all tables with prefix"
1967
  msgstr ""
1968
 
1969
+ #: template/pro/backup.php:22
1970
  msgid "Backup only tables selected for migration"
1971
  msgstr ""
1972
 
1973
+ #: template/pro/backup.php:28
1974
  msgid "Backup only selected tables below"
1975
  msgstr ""
1976
 
1977
+ #: template/pro/backup.php:52
1978
  #, php-format
1979
  msgid ""
1980
  "The backup option has been disabled as your local uploads directory is "
2005
  msgid "Connection Info"
2006
  msgstr ""
2007
 
2008
+ #: template/pro/connection-info.php:10
2009
+ msgid "Copy to Clipboard"
2010
+ msgstr ""
2011
+
2012
+ #: template/pro/connection-info.php:11
2013
+ msgid "Copied"
2014
+ msgstr ""
2015
+
2016
+ #: template/pro/connection-info.php:13
2017
  msgid "Reset Secret Key"
2018
  msgstr ""
2019
 
2027
  "posts table after migration:"
2028
  msgstr ""
2029
 
2030
+ #: template/pro/exclude-post-types.php:12
2031
+ msgid ""
2032
+ "WARNING: The following post types will not be included in the find &amp; "
2033
+ "replace:"
2034
+ msgstr ""
2035
+
2036
  #: template/pro/licence-info.php:2
2037
  msgid "Email Support"
2038
  msgstr ""
readme.txt CHANGED
@@ -1,10 +1,10 @@
1
  === WP Migrate DB ===
2
- Contributors: bradt
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=5VPMGLLK94XJC
4
  Tags: migrate, migration, export, data dump, backup, database, mysql
5
  Requires at least: 3.6
6
- Tested up to: 4.6
7
- Stable tag: 0.8
8
  License: GPLv2
9
 
10
  Migrates your database by running find & replace on URLs and file paths, handling serialized data, and saving an SQL file.
@@ -87,6 +87,20 @@ If you upgrade to [WP Migrate DB Pro](http://deliciousbrains.com/wp-migrate-db-p
87
 
88
  == Changelog ==
89
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
90
  = WP Migrate DB 0.8 - 2016-04-12 =
91
 
92
  * New: Migration progress UI
1
  === WP Migrate DB ===
2
+ Contributors: bradt, deliciousbrains
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=5VPMGLLK94XJC
4
  Tags: migrate, migration, export, data dump, backup, database, mysql
5
  Requires at least: 3.6
6
+ Tested up to: 4.7
7
+ Stable tag: 0.9
8
  License: GPLv2
9
 
10
  Migrates your database by running find & replace on URLs and file paths, handling serialized data, and saving an SQL file.
87
 
88
  == Changelog ==
89
 
90
+ = WP Migrate DB 0.9 - 2016-10-20 =
91
+
92
+ * New: In-place Find &amp; Replace functionality added - a find and replace can now be run on a site's own database
93
+ * New: CLI [find-replace](https://deliciousbrains.com/wp-migrate-db-pro/doc/cli-find-replace-subcommand/) subcommand added
94
+ * Improvement: Removed `font-family` declarations from stylesheets
95
+ * Improvement: Truncate WP Migrate DB Pro diagnostic log to always be < 1MB, to help with memory exhaustion errors
96
+ * Improvement: Added help tooltips for the default find and replace fields
97
+ * Improvement: Added multisite specific constants to the diagnostic log
98
+ * Improvement: "Clear Error Log" button only removes error messages and updates any changed diagnostic values
99
+ * Improvement: Total stage progress now remains visible when scrolling migration item progress
100
+ * Improvement: Show/Hide Tables setting does not persist between sessions.
101
+ * Improvement: Progress bar animations now reflect paused migration state
102
+ * Improvement: JS files now include a version number to better avoid cache issues
103
+
104
  = WP Migrate DB 0.8 - 2016-04-12 =
105
 
106
  * New: Migration progress UI
template/migrate-progress.php CHANGED
@@ -16,6 +16,11 @@
16
  <div class="migration-controls">
17
  <span class="pause-resume button"><?php _ex( 'Pause', 'Temporarily stop migrating', 'wp-migrate-db' ); ?></span>
18
  <span class="cancel button"><?php _ex( 'Cancel', 'Stop the migration', 'wp-migrate-db' ); ?></span>
19
- <span class="pause-before-finalize"><label><input id="pause-before-finalize" type="checkbox" name="pause_before_finalize" value="1" /> <?php _e( 'Pause before replacing migrated tables', 'wp-migrate-db' ); ?></label></span>
 
 
 
 
 
20
  </div>
21
  </div> <!-- end .progress-content -->
16
  <div class="migration-controls">
17
  <span class="pause-resume button"><?php _ex( 'Pause', 'Temporarily stop migrating', 'wp-migrate-db' ); ?></span>
18
  <span class="cancel button"><?php _ex( 'Cancel', 'Stop the migration', 'wp-migrate-db' ); ?></span>
19
+ <span class="pause-before-finalize">
20
+ <input id="pause-before-finalize" type="checkbox" name="pause_before_finalize" value="1" />
21
+ <label id="pause-before-finalize-label" for="pause-before-finalize">
22
+ <?php _e( 'Pause before replacing migrated tables', 'wp-migrate-db' ); ?>
23
+ </label>
24
+ </span>
25
  </div>
26
  </div> <!-- end .progress-content -->
template/migrate.php CHANGED
@@ -66,8 +66,7 @@ $breadcrumbs_params = array(
66
 
67
  <ul class="option-group migrate-selection">
68
  <li>
69
- <?php $savefile_style = ( true == $this->is_pro ) ? '' : ' style="display: none;"'; ?>
70
- <label for="savefile"<?php echo $savefile_style; ?>>
71
  <input id="savefile" type="radio" value="savefile" name="action"<?php echo ( $loaded_profile['action'] == 'savefile' || ! $this->is_pro ) ? ' checked="checked"' : ''; ?> />
72
  <?php _e( 'Export File', 'wp-migrate-db' ); ?>
73
  </label>
@@ -89,6 +88,12 @@ $breadcrumbs_params = array(
89
  </ul>
90
  </li>
91
  <?php $this->template_part( array( 'pull_push_radio_buttons' ), $loaded_profile ); ?>
 
 
 
 
 
 
92
  </ul>
93
 
94
  <div class="connection-info-wrapper clearfix">
@@ -144,6 +149,9 @@ $breadcrumbs_params = array(
144
  </td>
145
  <td class="replace-right-col">
146
  <input type="text" size="40" name="replace_new[]" class="code" placeholder="New value" autocomplete="off" />
 
 
 
147
  <span class="replace-remove-row" data-profile-id="0"></span>
148
  </td>
149
  </tr>
@@ -160,9 +168,14 @@ $breadcrumbs_params = array(
160
  </td>
161
  <td class="replace-right-col">
162
  <input type="text" size="40" name="replace_new[]" class="code" id="new-url" placeholder="New URL" autocomplete="off" />
163
- <?php if ( ! $this->lock_url_find_replace_row ) : ?>
164
- <span class="replace-remove-row" data-profile-id="0"></span>
165
- <?php endif; ?>
 
 
 
 
 
166
  </td>
167
  </tr>
168
  <tr class="replace-row">
@@ -177,7 +190,13 @@ $breadcrumbs_params = array(
177
  </td>
178
  <td class="replace-right-col">
179
  <input type="text" size="40" name="replace_new[]" class="code" id="new-path" placeholder="New file path" autocomplete="off" />
 
 
180
  <span class="replace-remove-row" data-profile-id="0"></span>
 
 
 
 
181
  </td>
182
  </tr>
183
  <?php else :
@@ -198,8 +217,10 @@ $breadcrumbs_params = array(
198
  </td>
199
  <td class="replace-right-col">
200
  <input type="text" size="40" name="replace_new[]" class="code" placeholder="New value" value="<?php echo esc_attr( $replace_new ); ?>" autocomplete="off" />
 
 
201
  <?php if ( ! $this->lock_url_find_replace_row || ( $this->lock_url_find_replace_row && $i != 1 ) ) : ?>
202
- <span class="replace-remove-row" data-profile-id="0"></span>
203
  <?php endif; ?>
204
  </td>
205
  </tr>
66
 
67
  <ul class="option-group migrate-selection">
68
  <li>
69
+ <label for="savefile">
 
70
  <input id="savefile" type="radio" value="savefile" name="action"<?php echo ( $loaded_profile['action'] == 'savefile' || ! $this->is_pro ) ? ' checked="checked"' : ''; ?> />
71
  <?php _e( 'Export File', 'wp-migrate-db' ); ?>
72
  </label>
88
  </ul>
89
  </li>
90
  <?php $this->template_part( array( 'pull_push_radio_buttons' ), $loaded_profile ); ?>
91
+ <li>
92
+ <label for="find_replace">
93
+ <input id="find_replace" type="radio" value="find_replace" name="action"<?php echo ( 'find_replace' === $loaded_profile['action'] ) ? ' checked="checked"' : ''; ?> />
94
+ <?php _e( 'Find & Replace', 'wp-migrate-db' ); ?><span class="option-description"><?php _e( 'Run a find & replace on this site\'s db', 'wp-migrate-db' ); ?></span>
95
+ </label>
96
+ </li>
97
  </ul>
98
 
99
  <div class="connection-info-wrapper clearfix">
149
  </td>
150
  <td class="replace-right-col">
151
  <input type="text" size="40" name="replace_new[]" class="code" placeholder="New value" autocomplete="off" />
152
+
153
+ </td>
154
+ <td class="row-action-buttons">
155
  <span class="replace-remove-row" data-profile-id="0"></span>
156
  </td>
157
  </tr>
168
  </td>
169
  <td class="replace-right-col">
170
  <input type="text" size="40" name="replace_new[]" class="code" id="new-url" placeholder="New URL" autocomplete="off" />
171
+ </td>
172
+ <td class="row-action-buttons">
173
+ <?php $style = $this->lock_url_find_replace_row ? 'display: none;' : ''; ?>
174
+ <span class="replace-remove-row" data-profile-id="0" style="<?php echo $style; ?>"></span>
175
+ <a href="#" class="general-helper domain-replace-helper js-action-link"></a>
176
+ <div class="domain-replace-info helper-message bottom">
177
+ <?php printf( __( 'This find & replace will find the domain name of your remote site and replace it with the domain name of this site. We\'ve left out the protocol so that both http:// and https:// will be found and replaced. <a href="%s" target="_blank">Find & Replace Documentation</a>', 'wp-migrate-db' ), 'https://deliciousbrains.com/wp-migrate-db-pro/doc/find-and-replace/' ); ?>
178
+ </div>
179
  </td>
180
  </tr>
181
  <tr class="replace-row">
190
  </td>
191
  <td class="replace-right-col">
192
  <input type="text" size="40" name="replace_new[]" class="code" id="new-path" placeholder="New file path" autocomplete="off" />
193
+ </td>
194
+ <td class="row-action-buttons">
195
  <span class="replace-remove-row" data-profile-id="0"></span>
196
+ <a href="#" class="general-helper path-replace-helper js-action-link"></a>
197
+ <div class="path-replace-info helper-message bottom">
198
+ <?php printf( __( 'This find and replace is mostly for 3rd party plugins that store the website’s root file path in the database. This set of fields will ensure that these values are updated to the correct root file path during the migration. <a href="%s" target="_blank">Find & Replace Documentation</a>', 'wp-migrate-db' ), 'https://deliciousbrains.com/wp-migrate-db-pro/doc/find-and-replace/' ); ?>
199
+ </div>
200
  </td>
201
  </tr>
202
  <?php else :
217
  </td>
218
  <td class="replace-right-col">
219
  <input type="text" size="40" name="replace_new[]" class="code" placeholder="New value" value="<?php echo esc_attr( $replace_new ); ?>" autocomplete="off" />
220
+ </td>
221
+ <td class="row-action-buttons">
222
  <?php if ( ! $this->lock_url_find_replace_row || ( $this->lock_url_find_replace_row && $i != 1 ) ) : ?>
223
+ <span class="replace-remove-row" data-profile-id="0"></span>
224
  <?php endif; ?>
225
  </td>
226
  </tr>
template/options-tools-subsite.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <div class="wrap wpmdb">
2
+
3
+ <?php /* This is a hack to get sitewide notices to appear above the visible title. https://github.com/deliciousbrains/wp-migrate-db-pro/issues/1436 */ ?>
4
+ <h1 style="display:none;"></h1>
5
+
6
+ <h1><?php echo esc_html( $this->get_plugin_title() ); ?></h1>
7
+
8
+ <p><?php printf( esc_html__( '%1$s only runs at the Network Admin level. As there is no Tools menu in the Network Admin, the %2$s menu item is located under Settings.', 'wp-migrate-db' ), esc_html( $this->get_plugin_title() ), sprintf( '"<a href="%s">%s</a>"', esc_url( network_admin_url( 'settings.php?page=' . $this->core_slug ) ), esc_html( $this->get_plugin_title() ) ) ); ?></p>
9
+ </div>
wp-migrate-db.php CHANGED
@@ -4,7 +4,7 @@ Plugin Name: WP Migrate DB
4
  Plugin URI: http://wordpress.org/plugins/wp-migrate-db/
5
  Description: Exports your database as a MySQL data dump (much like phpMyAdmin), does a find and replace on URLs and file paths, then allows you to save it to your computer.
6
  Author: Delicious Brains
7
- Version: 0.8
8
  Author URI: http://deliciousbrains.com
9
  Network: True
10
  Text Domain: wp-migrate-db
@@ -22,16 +22,16 @@ Domain Path: /languages/
22
  // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
23
  // **********************************************************************
24
 
25
- $GLOBALS['wpmdb_meta']['wp-migrate-db']['version'] = '0.8';
26
 
27
  if ( ! class_exists( 'WPMDB_Utils' ) ) {
28
  require dirname( __FILE__ ) . '/class/wpmdb-utils.php';
29
  }
30
 
31
  function wp_migrate_db_loaded() {
32
- // exit quickly unless: standalone admin; multisite network admin; one of our AJAX calls
33
- if ( ! is_admin() || ( is_multisite() && ! is_network_admin() && ! WPMDB_Utils::is_ajax() ) ) {
34
- return;
35
  }
36
  wp_migrate_db();
37
  }
4
  Plugin URI: http://wordpress.org/plugins/wp-migrate-db/
5
  Description: Exports your database as a MySQL data dump (much like phpMyAdmin), does a find and replace on URLs and file paths, then allows you to save it to your computer.
6
  Author: Delicious Brains
7
+ Version: 0.9
8
  Author URI: http://deliciousbrains.com
9
  Network: True
10
  Text Domain: wp-migrate-db
22
  // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
23
  // **********************************************************************
24
 
25
+ $GLOBALS['wpmdb_meta']['wp-migrate-db']['version'] = '0.9';
26
 
27
  if ( ! class_exists( 'WPMDB_Utils' ) ) {
28
  require dirname( __FILE__ ) . '/class/wpmdb-utils.php';
29
  }
30
 
31
  function wp_migrate_db_loaded() {
32
+ // exit quickly unless: standalone admin; one of our AJAX calls
33
+ if ( ! is_admin() || ( is_multisite() && ! current_user_can( 'manage_network_options' ) && ! WPMDB_Utils::is_ajax() ) ) {
34
+ return false;
35
  }
36
  wp_migrate_db();
37
  }