WP Migrate DB - Version 0.8

Version Description

Download this release

Release Info

Developer bradt
Plugin Icon 128x128 WP Migrate DB
Version 0.8
Comparing to
See all releases

Code changes from version 0.7.2 to 0.8

asset/css/plugin-update-styles.css DELETED
@@ -1 +0,0 @@
1
- .check-licence-spinner{left:5px;position:relative;top:2px;margin-bottom:-2px;width:16px;height:16px}.wpmdb-original-update-row{display:none}.plugin-update-tr.wpmdbpro-custom-visible .update-message{padding-left:40px}.plugin-update-tr.wpmdbpro-custom-visible .update-message::before{margin-left:-30px}.plugin-update-tr.wpmdbpro-custom-visible .update-message span{display:inline-block}
 
asset/css/styles.css DELETED
@@ -1 +0,0 @@
1
- #wpmdb-main{width:742px;position:relative;min-height:950px}#overlay{background-color:rgba(255,255,255,0.9)}.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}.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 .multiselect{min-width:420px;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;border:1px solid #ccc;border-radius:3px;background-color:#fff;position:absolute;width:500px;z-index:9999;display:none;box-shadow:0px 0px 5px 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:before{content:'';border-bottom:8px solid transparent;border-right:8px solid #aaa;border-top:8px solid transparent;display:block;height:0;left:-8px;position:absolute;top:11px;width:0}.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 .migrate-db .ajax-success-msg{font-weight:bold;margin:3px 0 0 9px;display:inline-block}.wpmdb p img.save-profile-ajax-spinner{margin-left: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;text-align:right;float:left}.wpmdb .settings-tab .slider-spinner{position:absolute;right:-35px;bottom:-13px}.wpmdb .settings-tab .slider-success-msg{display:none;right:-53px;bottom:-13px;position:absolute;font-weight:bold}.wpmdb .settings-tab .ui-slider{border:1px solid #dfdfdf;height:10px;border-radius:2px;position:relative}.wpmdb .settings-tab .ui-slider-handle{width:7px;height:20px;background-color:#aaa;display:block;position:absolute;top:-5px;outline:none}.wpmdb .settings-tab .ui-slider-handle:active{background-color:#999}.wpmdb .settings-tab .ui-slider-range{background-color:#eee;height:100%}.wpmdb .settings-tab .option-section label{font-weight:normal;position:relative}.wpmdb .settings-tab .option-section li{margin-bottom:5px}.wpmdb .settings-tab .option-section li:last-child{margin-bottom:0px}.wpmdb .settings-tab .option-section.allow-remote-requests-wrap .ajax-spinner,.wpmdb .settings-tab .option-section.plugin-compatibility-section .ajax-spinner{right:-23px;left:inherit;top:0px;position:absolute}.wpmdb .settings-tab .option-section .ajax-success-msg{right:-42px;left:inherit;top:0px;position:absolute;font-weight:bold}.wpmdb .settings-tab .option-section .bubble .ajax-spinner{right:-45px}.wpmdb .settings-tab .option-section .bubble .ajax-success-msg{right:-65px}.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 24px;background-color:#e6e6e6;margin-left:0}.wpmdb .plugin-compatibility-wrap p:last-of-type{margin-bottom: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;display:none}.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}.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-content{display:none;position:relative;margin:0 auto;background-color:#fff;padding:50px;box-shadow:0 0 10px #ccc;cursor:default;width:80%;z-index:99999;position:fixed;left:50%;margin-left:-40%;box-sizing:border-box;max-height:100%;overflow-y:auto}.progress-content .progress-bar{height:10px;background-color:#8cc1e9;margin-bottom:5px;background-image:url('data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4gPHN2ZyB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PGRlZnM+PGxpbmVhckdyYWRpZW50IGlkPSJncmFkIiBncmFkaWVudFVuaXRzPSJvYmplY3RCb3VuZGluZ0JveCIgeDE9IjAuNSIgeTE9IjEuMCIgeDI9IjAuNSIgeTI9IjAuMCI+PHN0b3Agb2Zmc2V0PSIwJSIgc3RvcC1jb2xvcj0iIzcyYTdjZiIvPjxzdG9wIG9mZnNldD0iMTAwJSIgc3RvcC1jb2xvcj0iIzhjYzFlOSIvPjwvbGluZWFyR3JhZGllbnQ+PC9kZWZzPjxyZWN0IHg9IjAiIHk9IjAiIHdpZHRoPSIxMDAlIiBoZWlnaHQ9IjEwMCUiIGZpbGw9InVybCgjZ3JhZCkiIC8+PC9zdmc+IA==');background-size:100%;background-image:-webkit-gradient(linear, 50% 100%, 50% 0%, color-stop(0%, #72a7cf),color-stop(100%, #8cc1e9));background-image:-webkit-linear-gradient(bottom, #72a7cf,#8cc1e9);background-image:-webkit-linear-gradient(bottom, #72a7cf, #8cc1e9);background-image:linear-gradient(to top, #72a7cf,#8cc1e9)}.progress-content .progress-title{font-size:18px;font-family:"HelveticaNeue-Light", "Helvetica Neue Light", "Helvetica Neue", sans-serif;font-weight:normal;float:left}.progress-content .progress-bar{width:0%}.progress-content .progress-info-wrapper{margin-bottom:10px}.progress-content .progress-text{clear:left;float:left;width:100%}.progress-content .timer{float:right}.progress-content .progress-tables{overflow:hidden;margin-bottom:2px;padding:0 0 20px 0}.progress-content .progress-bar-wrapper{position:relative}.progress-content .progress-bar-wrapper:before{content:'';display:block;height:5px;width:1px;background-color:#ccc;position:absolute;top:15px;left:0px}.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:#999999;cursor:pointer;font-family:"Times New Roman",serif;font-size:26px;font-weight:200;position:absolute;right:20px;top:20px;padding:5px;display:none}.progress-content .close-progress-content:hover{color:#666;border-color:#aaa}.progress-content .migration-controls{display:block;margin-top:45px;overflow:hidden}.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 .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}@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}}.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:#ccc;background-color:#fff}body.mp6 .wpmdb .settings-tab .ui-slider-range{background-color:#d8fcd1}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 .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 .progress-content{font-size:14px;box-shadow:0 0 10px rgba(0,0,0,0.5);background-color:#eee}body.mp6 .progress-content .progress-title{font-family:'Open Sans', sans-serif;font-weight:normal;font-size:22px}body.mp6 .progress-content .dashicons-yes{font-size:42px;line-height:0.5em}body.mp6 .progress-content .progress-bar{background-image:none;background-color:#0074a2}body.mp6 #overlay{background-color:rgba(0,0,0,0.5)}body.mp6 .migration-progress-ajax-spinner{top:20px}
 
asset/dist/css/styles.css ADDED
@@ -0,0 +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}
asset/dist/img/icon-cli.svg ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <!-- Generator: Adobe Illustrator 16.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
3
+ <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
4
+ <svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
5
+ width="412px" height="365px" viewBox="0 0 412 365" enable-background="new 0 0 412 365" xml:space="preserve">
6
+ <path id="window-command-icon" fill="#dddddd" d="M0,0v365h412V0H0z M362,315H50V97h312V315z M191.458,206.895l-75.999,76.397
7
+ L87.998,255.96l48.801-49.065L87.93,157.761l27.461-27.329L191.458,206.895z M326,244.027H212.5v38H326V244.027z"/>
8
+ </svg>
asset/dist/img/icon-media-files.svg ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <!-- Generator: Adobe Illustrator 16.0.4, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
3
+ <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
4
+ <svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
5
+ width="412px" height="318.25px" viewBox="0 0 412 318.25" enable-background="new 0 0 412 318.25" xml:space="preserve">
6
+ <path id="photo-camera-4-icon" fill="#FFFFFF" d="M289.652,180.604c0,29.392-23.909,53.3-53.3,53.3
7
+ c-29.39,0-53.297-23.908-53.297-53.3c0-29.389,23.909-53.296,53.297-53.296C265.742,127.307,289.652,151.215,289.652,180.604z
8
+ M412,51.25v267H0v-267h113.219c11.253,0,21.56-6.297,26.694-16.31L157.832,0h153.665l19.819,35.785
9
+ c5.284,9.543,15.335,15.465,26.242,15.465H412z M104.831,109.5c0-11.322-9.178-20.5-20.5-20.5c-11.322,0-20.5,9.178-20.5,20.5
10
+ s9.178,20.5,20.5,20.5C95.653,130,104.831,120.822,104.831,109.5z M335.5,180.604c0-54.667-44.477-96.854-99.146-96.854
11
+ c-54.667,0-99.146,42.185-99.146,96.854c0,54.671,44.477,99.146,99.146,99.146C291.023,279.75,335.5,235.273,335.5,180.604z
12
+ M92.331,7.75h-65.5v27h65.5V7.75z"/>
13
+ </svg>
asset/{img → dist/img}/icon-multisite-tools.svg RENAMED
File without changes
asset/dist/img/mor10.png ADDED
Binary file
asset/dist/img/mor10@2x.png ADDED
Binary file
asset/dist/img/welcome.jpg ADDED
Binary file
asset/{img → dist/img}/wp-migrate-db-pro.jpg RENAMED
File without changes
asset/{img → dist/img}/wp-migrate-db-pro@2x.jpg RENAMED
File without changes
asset/{js → dist/js}/common.js RENAMED
@@ -157,6 +157,24 @@ wpmdb.subsite_for_table = function( table_prefix, table_name ) {
157
  }
158
  };
159
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
160
  (function( $ ) {
161
 
162
  // jQuery code here
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
asset/{js → dist/js}/common.min.js RENAMED
@@ -1 +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(){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]},function(a){}(jQuery);
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/{js → dist/js}/hook.js RENAMED
File without changes
asset/{js → dist/js}/hook.min.js RENAMED
File without changes
asset/{js → dist/js}/multisite.js RENAMED
File without changes
asset/{js → dist/js}/multisite.min.js RENAMED
File without changes
asset/dist/js/script.js ADDED
@@ -0,0 +1,3706 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 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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
+ },
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,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm5vZGVfbW9kdWxlcy9ncnVudC1icm93c2VyaWZ5L25vZGVfbW9kdWxlcy9icm93c2VyaWZ5L25vZGVfbW9kdWxlcy9icm93c2VyLXBhY2svX3ByZWx1ZGUuanMiLCJzcmMvd3AtbWlncmF0ZS1kYi1wcm8vYXNzZXQvc3JjL2pzL21vZHVsZXMvTWlncmF0aW9uUHJvZ3Jlc3MtY29udHJvbGxlci5qcyIsInNyYy93cC1taWdyYXRlLWRiLXByby9hc3NldC9zcmMvanMvbW9kdWxlcy9NaWdyYXRpb25Qcm9ncmVzcy1tb2RlbC5qcyIsInNyYy93cC1taWdyYXRlLWRiLXByby9hc3NldC9zcmMvanMvbW9kdWxlcy9NaWdyYXRpb25Qcm9ncmVzcy11dGlscy5qcyIsInNyYy93cC1taWdyYXRlLWRiLXByby9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bicgKS50b2dnbGVDbGFzcyggJ2NoZWNrZWQnICk7XG5cdFx0XHR2YXIgc3dpdGNoX29uID0gJHN3aXRjaC5maW5kKCAnc3Bhbi5vbicgKS5oYXNDbGFzcyggJ2NoZWNrZWQnICk7XG5cdFx0XHQkY2hlY2tib3guYXR0ciggJ2NoZWNrZWQnLCBzd2l0Y2hfb24gKS50cmlnZ2VyKCAnY2hhbmdlJyApO1xuXHRcdH1cblxuXHRcdCQoICcud3BtZGItc3dpdGNoJyApLm9uKCAnY2xpY2snLCBmdW5jdGlvbiggZSApIHtcblx0XHRcdGlmICggISAkKCB0aGlzICkuaGFzQ2xhc3MoICdkaXNhYmxlZCcgKSApIHtcblx0XHRcdFx0c2V0X2NoZWNrYm94KCAkKCB0aGlzICkuYXR0ciggJ2lkJyApICk7XG5cdFx0XHR9XG5cdFx0fSApO1xuXG5cdH0gKTtcblxufSkoIGpRdWVyeSwgd3BtZGIgKTtcbiJdfQ==
asset/dist/js/script.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}},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})|[!\$&'\(\)\*\+,;=]|:)*@)?((\[(|(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(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]);
asset/js/script.js DELETED
@@ -1,2889 +0,0 @@
1
- (function( $, wpmdb ) {
2
-
3
- var connection_established = false;
4
- var last_replace_switch = '';
5
- var doing_ajax = false;
6
- var doing_licence_registration_ajax = false;
7
- var doing_reset_api_key_ajax = false;
8
- var doing_save_profile = false;
9
- var doing_plugin_compatibility_ajax = false;
10
- var profile_name_edited = false;
11
- var checked_licence = false;
12
- var show_prefix_notice = false;
13
- var show_ssl_notice = false;
14
- var show_version_notice = false;
15
- var migration_completed = false;
16
- var currently_migrating = false;
17
- var dump_filename = '';
18
- var dump_path = '';
19
- var migration_intent;
20
- var remote_site;
21
- var secret_key;
22
- var form_data;
23
- var stage;
24
- var elapsed_interval;
25
- var completed_msg;
26
- var tables_to_migrate = '';
27
- var migration_paused = false;
28
- var previous_progress_title = '';
29
- var previous_progress_text_primary = '';
30
- var previous_progress_text_secondary = '';
31
- var timer_count = 0;
32
- var overall_percent = 0;
33
- var migration_cancelled = false;
34
- var counter_display = false;
35
- var counter_label = '';
36
- var flag_skip_delay = false;
37
- var delay_between_requests = 0;
38
- var fade_duration = 400;
39
- var pause_before_finalize = false;
40
- var is_auto_pause_before_finalize = false;
41
-
42
- var admin_url = ajaxurl.replace( '/admin-ajax.php', '' ), spinner_url = admin_url + '/images/spinner';
43
-
44
- if ( 2 < window.devicePixelRatio ) {
45
- spinner_url += '-2x';
46
- }
47
- spinner_url += '.gif';
48
- var ajax_spinner = '<img src="' + spinner_url + '" alt="" class="ajax-spinner general-spinner" />';
49
-
50
- window.onbeforeunload = function( e ) {
51
- if ( currently_migrating ) {
52
- e = e || window.event;
53
-
54
- // For IE and Firefox prior to version 4
55
- if ( e ) {
56
- e.returnValue = wpmdb_strings.sure;
57
- }
58
-
59
- // For Safari
60
- return wpmdb_strings.sure;
61
- }
62
- };
63
-
64
- function pad( n, width, z ) {
65
- z = z || '0';
66
- n = n + '';
67
- return n.length >= width ? n : new Array( width - n.length + 1 ).join( z ) + n;
68
- }
69
-
70
- function is_int( n ) {
71
- n = parseInt( n );
72
- return 'number' === typeof n && 0 === n % 1;
73
- }
74
-
75
- function setup_counter() {
76
- timer_count = 0;
77
- counter_display = $( '.timer' );
78
- counter_label = wpmdb_strings.time_elapsed + ' ';
79
-
80
- elapsed_interval = setInterval( count, 1000 );
81
- }
82
-
83
- function display_count() {
84
- var hours = Math.floor( timer_count / 3600 ) % 24;
85
- var minutes = Math.floor( timer_count / 60 ) % 60;
86
- var seconds = timer_count % 60;
87
- var display = counter_label + pad( hours, 2, 0 ) + ':' + pad( minutes, 2, 0 ) + ':' + pad( seconds, 2, 0 );
88
- counter_display.html( display );
89
- }
90
-
91
- function count() {
92
- timer_count = timer_count + 1;
93
- display_count();
94
- }
95
-
96
- function get_intersect( arr1, arr2 ) {
97
- var r = [], o = {}, l = arr2.length, i, v;
98
- for ( i = 0; i < l; i++ ) {
99
- o[ arr2[ i ] ] = true;
100
- }
101
- l = arr1.length;
102
- for ( i = 0; i < l; i++ ) {
103
- v = arr1[ i ];
104
- if ( v in o ) {
105
- r.push( v );
106
- }
107
- }
108
- return r;
109
- }
110
-
111
- function get_query_var( name ) {
112
- name = name.replace( /[\[]/, '\\[' ).replace( /[\]]/, '\\]' );
113
- var regex = new RegExp( '[\\?&]' + name + '=([^&#]*)' ),
114
- results = regex.exec( location.search );
115
- return null === results ? '' : decodeURIComponent( results[ 1 ].replace( /\+/g, ' ' ) );
116
- }
117
-
118
- function maybe_show_ssl_warning( url, key, remote_scheme ) {
119
- var scheme = url.substr( 0, url.indexOf( ':' ) );
120
- if ( remote_scheme !== scheme && url.indexOf( 'https' ) !== -1 ) {
121
- $( '.ssl-notice' ).show();
122
- show_ssl_notice = true;
123
- url = url.replace( 'https', 'http' );
124
- $( '.pull-push-connection-info' ).val( url + '\n' + key );
125
- return;
126
- }
127
- show_ssl_notice = false;
128
- return;
129
- }
130
-
131
- function maybe_show_prefix_notice( prefix ) {
132
- if ( prefix !== wpmdb_data.this_prefix ) {
133
- $( '.remote-prefix' ).html( prefix );
134
- show_prefix_notice = true;
135
- if ( 'pull' === wpmdb_migration_type() ) {
136
- $( '.prefix-notice.pull' ).show();
137
- } else {
138
- $( '.prefix-notice.push' ).show();
139
- }
140
- }
141
- }
142
-
143
- function maybe_show_mixed_cased_table_name_warning() {
144
- if ( 'undefined' === typeof wpmdb.common.connection_data || false === wpmdb.common.connection_data ) {
145
- return;
146
- }
147
-
148
- var migration_intent = wpmdb_migration_type();
149
- var tables_to_migrate = get_tables_to_migrate( null, null );
150
-
151
- $( '.mixed-case-table-name-notice' ).hide();
152
-
153
- if ( null === tables_to_migrate ) {
154
- return;
155
- }
156
-
157
- tables_to_migrate = tables_to_migrate.join( '' );
158
-
159
- // The table names are all lowercase, no need to display the warning.
160
- if ( tables_to_migrate === tables_to_migrate.toLowerCase() ) {
161
- return;
162
- }
163
-
164
- /*
165
- * Do not display the warning if the remote lower_case_table_names does not equal "1" (i.e the only problematic setting)
166
- * Applies to push/export migrations.
167
- */
168
- if ( '1' !== wpmdb.common.connection_data.lower_case_table_names && ( 'push' === migration_intent || 'savefile' === migration_intent ) ) {
169
- return;
170
- }
171
-
172
- /*
173
- * Do not display the warning if the local lower_case_table_names does not equal "1" (i.e the only problematic setting)
174
- * Only applies to pull migrations.
175
- */
176
- if ( '1' !== wpmdb_data.lower_case_table_names && 'pull' === migration_intent ) {
177
- return;
178
- }
179
-
180
- /*
181
- * At this stage we've determined:
182
- * 1. The source database contains at least one table that contains an uppercase character.
183
- * 2. The destination environment has lower_case_table_names set to 1.
184
- * 3. The source database table containing the uppercase letter will be converted to lowercase during the migration.
185
- */
186
-
187
- if ( 'push' === migration_intent || 'savefile' === migration_intent ) {
188
- $( '.mixed-case-table-name-notice.push' ).show();
189
- } else {
190
- $( '.mixed-case-table-name-notice.pull' ).show();
191
- }
192
- }
193
-
194
- function get_domain_name( url ) {
195
- var temp_url = url;
196
- var domain = temp_url.replace( /\/\/(.*)@/, '//' ).replace( 'http://', '' ).replace( 'https://', '' ).replace( 'www.', '' );
197
- return domain;
198
- }
199
-
200
- function get_migration_status_label( url, intent, stage ) {
201
- var domain = get_domain_name( url );
202
- var migrating_stage_label, completed_stage_label;
203
- if ( 'pull' === intent ) {
204
- migrating_stage_label = wpmdb_strings.pull_migration_label_migrating;
205
- completed_stage_label = wpmdb_strings.pull_migration_label_completed;
206
- } else {
207
- migrating_stage_label = wpmdb_strings.push_migration_label_migrating;
208
- completed_stage_label = wpmdb_strings.push_migration_label_completed;
209
- }
210
-
211
- migrating_stage_label = migrating_stage_label.replace( '%s', domain );
212
- completed_stage_label = completed_stage_label.replace( '%s', domain );
213
-
214
- if ( 'migrating' === stage ) {
215
- return migrating_stage_label;
216
- } else {
217
- return completed_stage_label;
218
- }
219
- }
220
-
221
- function remove_protocol( url ) {
222
- return url.replace( /^https?:/i, '' );
223
- }
224
-
225
- function disable_export_type_controls() {
226
- $( '.option-group' ).each( function( index ) {
227
- $( 'input', this ).attr( 'disabled', 'disabled' );
228
- $( 'label', this ).css( 'cursor', 'default' );
229
- } );
230
- }
231
-
232
- function enable_export_type_controls() {
233
- $( '.option-group' ).each( function( index ) {
234
- $( 'input', this ).removeAttr( 'disabled' );
235
- $( 'label', this ).css( 'cursor', 'pointer' );
236
- } );
237
- }
238
-
239
- function set_slider_value( parent_selector, value, unit ) {
240
- $( '.slider', parent_selector ).slider( 'value', value );
241
- $( '.amount', parent_selector ).html( wpmdb_add_commas( value ) + ' ' + unit );
242
- }
243
-
244
- function set_pause_resume_button( event ) {
245
- if ( true === migration_paused ) {
246
- migration_paused = false;
247
- doing_ajax = true;
248
- $( '.progress-title' ).html( previous_progress_title );
249
- $( '.progress-text', '.progress-wrapper-primary' ).html( previous_progress_text_primary );
250
- $( '.progress-text', '.progress-wrapper-secondary' ).html( previous_progress_text_secondary );
251
- $( '.migration-progress-ajax-spinner' ).show();
252
- $( '.pause-resume' ).html( wpmdb_strings.pause );
253
-
254
- // Resume the timer
255
- elapsed_interval = setInterval( count, 1000 );
256
- wpmdb.functions.execute_next_step();
257
- } else {
258
- migration_paused = true;
259
- doing_ajax = false;
260
- previous_progress_title = $( '.progress-title' ).html();
261
- previous_progress_text_primary = $( '.progress-text', '.progress-wrapper-primary' ).html();
262
- previous_progress_text_secondary = $( '.progress-text', '.progress-wrapper-secondary ' ).html();
263
- $( '.progress-title' ).html( wpmdb_strings.migration_paused );
264
- $( '.progress-text' ).html( wpmdb_strings.completing_current_request );
265
- $( 'body' ).off( 'click', '.pause-resume' ); // Is re-bound at execute_next_step when migration is finally paused
266
- $( 'body' ).off( 'click', '.cancel' ); // Is re-bound at execute_next_step when migration is finally paused
267
- }
268
- }
269
-
270
- function create_table_select( tables, table_sizes_hr, selected_tables ) {
271
- var $table_select = document.createElement( 'select' );
272
- $( $table_select ).attr( {
273
- multiple: 'multiple',
274
- name: 'select_tables[]',
275
- id: 'select-tables',
276
- class: 'multiselect'
277
- } );
278
-
279
- if ( 0 < tables.length ) {
280
- $.each( tables, function( index, table ) {
281
- if ( $.wpmdb.apply_filters( 'wpmdb_exclude_table', false, table ) ) {
282
- return;
283
- }
284
-
285
- var selected = ' ';
286
- if ( undefined !== selected_tables && null !== selected_tables && 0 < selected_tables.length && -1 !== $.inArray( table, selected_tables ) ) {
287
- selected = ' selected="selected" ';
288
- }
289
- $( $table_select ).append( '<option' + selected + 'value="' + table + '">' + table + ' (' + table_sizes_hr[ table ] + ')</option>' );
290
- } );
291
- }
292
-
293
- return $table_select;
294
- }
295
-
296
- /**
297
- * Returns tables selected for migration.
298
- *
299
- * @param value
300
- * @param args
301
- * @returns {string}
302
- *
303
- * Also handler for wpmdb_get_tables_to_migrate filter, disregards input values as it is the primary source.
304
- */
305
- function get_tables_to_migrate( value, args ) {
306
- var tables = '';
307
- var mig_type = wpmdb_migration_type();
308
- var table_intent = $( 'input[name=table_migrate_option]:checked' ).val();
309
-
310
- // Grab tables as per what the user has selected from the multiselect box or all prefixed tables.
311
- if ( 'migrate_select' === table_intent ) {
312
- tables = $( '#select-tables' ).val();
313
- } else {
314
- if ( 'push' === mig_type || 'savefile' === mig_type ) {
315
- tables = wpmdb_data.this_prefixed_tables;
316
- } else {
317
- tables = wpmdb.common.connection_data.prefixed_tables;
318
- }
319
- }
320
-
321
- return tables;
322
- }
323
-
324
- function get_table_prefix( value, args ) {
325
- return $( '.table-select-wrap .table-prefix' ).text();
326
- }
327
-
328
- $( document ).ready( function() {
329
- wpmdb.migration_state_id = '';
330
-
331
- $( '#plugin-compatibility' ).change( function( e ) {
332
- var install = '1';
333
- if ( $( this ).is( ':checked' ) ) {
334
- var answer = confirm( wpmdb_strings.mu_plugin_confirmation );
335
-
336
- if ( !answer ) {
337
- $( this ).prop( 'checked', false );
338
- return;
339
- }
340
- } else {
341
- install = '0';
342
- }
343
-
344
- $( '.plugin-compatibility-wrap' ).toggle();
345
-
346
- $( this ).parent().append( ajax_spinner );
347
- $( '#plugin-compatibility' ).attr( 'disabled', 'disabled' );
348
- $( '.plugin-compatibility' ).addClass( 'disabled' );
349
-
350
- $.ajax( {
351
- url: ajaxurl,
352
- type: 'POST',
353
- dataType: 'text',
354
- cache: false,
355
- data: {
356
- action: 'wpmdb_plugin_compatibility',
357
- install: install
358
- },
359
- error: function( jqXHR, textStatus, errorThrown ) {
360
- 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 );
361
- $( '.ajax-spinner' ).remove();
362
- $( '#plugin-compatibility' ).removeAttr( 'disabled' );
363
- $( '.plugin-compatibility' ).removeClass( 'disabled' );
364
- },
365
- success: function( data ) {
366
- if ( '' !== $.trim( data ) ) {
367
- alert( data );
368
- } else {
369
- $( '.plugin-compatibility' ).append( '<span class="ajax-success-msg">' + wpmdb_strings.saved + '</span>' );
370
- $( '.ajax-success-msg' ).fadeOut( 2000, function() {
371
- $( this ).remove();
372
- } );
373
- }
374
- $( '.ajax-spinner' ).remove();
375
- $( '#plugin-compatibility' ).removeAttr( 'disabled' );
376
- $( '.plugin-compatibility' ).removeClass( 'disabled' );
377
- }
378
- } );
379
-
380
- } );
381
-
382
- if ( $( '#plugin-compatibility' ).is( ':checked' ) ) {
383
- $( '.plugin-compatibility-wrap' ).show();
384
- }
385
-
386
- if ( 0 <= navigator.userAgent.indexOf( 'MSIE' ) || 0 <= navigator.userAgent.indexOf( 'Trident' ) ) {
387
- $( '.ie-warning' ).show();
388
- }
389
-
390
- if ( 0 === wpmdb_data.valid_licence ) {
391
- $( '#savefile' ).prop( 'checked', true );
392
- }
393
- var max_request_size_container = $( '.max-request-size' );
394
- var max_request_size_slider = $( '.slider', max_request_size_container );
395
- max_request_size_slider.slider( {
396
- range: 'min',
397
- value: parseInt( wpmdb_data.max_request / 1024 ),
398
- min: 512,
399
- max: parseInt( wpmdb_data.bottleneck / 1024 ),
400
- step: 1,
401
- create: function( event, ui ) {
402
- set_slider_value( max_request_size_container, wpmdb_data.max_request / 1024, 'kB' );
403
- },
404
- slide: function( event, ui ) {
405
- set_slider_value( max_request_size_container, ui.value, 'kB' );
406
- },
407
- stop: function( event, ui ) {
408
- $( '.amount', max_request_size_container ).after( '<img src="' + spinner_url + '" alt="" class="slider-spinner general-spinner" />' );
409
- max_request_size_slider.slider( 'disable' );
410
-
411
- $.ajax( {
412
- url: ajaxurl,
413
- type: 'POST',
414
- cache: false,
415
- data: {
416
- action: 'wpmdb_update_max_request_size',
417
- max_request_size: parseInt( ui.value ),
418
- nonce: wpmdb_data.nonces.update_max_request_size
419
- },
420
- error: function( jqXHR, textStatus, errorThrown ) {
421
- max_request_size_slider.slider( 'enable' );
422
- $( '.slider-spinner', max_request_size_container ).remove();
423
- alert( wpmdb_strings.max_request_size_problem );
424
- set_slider_value( max_request_size_container, wpmdb_data.max_request / 1024, 'kB' );
425
- max_request_size_slider.slider( 'enable' );
426
- },
427
- success: function() {
428
- max_request_size_slider.slider( 'enable' );
429
- $( '.slider-success-msg', max_request_size_container ).show();
430
- $( '.slider-success-msg', max_request_size_container ).fadeOut( 2000, function() {
431
- $( this ).hide();
432
- } );
433
- $( '.slider-spinner', max_request_size_container ).remove();
434
- }
435
- } );
436
- }
437
- } );
438
-
439
- var delay_between_requests_container = $( '.delay-between-requests' );
440
- var delay_between_requests_slider = $( '.slider', delay_between_requests_container );
441
- delay_between_requests_slider.slider( {
442
- range: 'min',
443
- value: parseInt( wpmdb_data.delay_between_requests / 1000 ),
444
- min: 0,
445
- max: 10,
446
- step: 1,
447
- create: function( event, ui ) {
448
- set_slider_value( delay_between_requests_container, wpmdb_data.delay_between_requests / 1000, 's' );
449
- },
450
- slide: function( event, ui ) {
451
- set_slider_value( delay_between_requests_container, ui.value, 's' );
452
- },
453
- stop: function( event, ui ) {
454
- $( '.amount', delay_between_requests_container ).after( '<img src="' + spinner_url + '" alt="" class="slider-spinner general-spinner" />' );
455
- delay_between_requests_slider.slider( 'disable' );
456
-
457
- $.ajax( {
458
- url: ajaxurl,
459
- type: 'POST',
460
- cache: false,
461
- data: {
462
- action: 'wpmdb_update_delay_between_requests',
463
- delay_between_requests: parseInt( ui.value * 1000 ),
464
- nonce: wpmdb_data.nonces.update_delay_between_requests
465
- },
466
- error: function( jqXHR, textStatus, errorThrown ) {
467
- delay_between_requests_slider.slider( 'enable' );
468
- $( '.slider-spinner', delay_between_requests_container ).remove();
469
- alert( wpmdb_strings.delay_between_requests_problem );
470
- set_slider_value( delay_between_requests_container, wpmdb_data.delay_between_requests / 1000, 's' );
471
- delay_between_requests_slider.slider( 'enable' );
472
- },
473
- success: function() {
474
- wpmdb_data.delay_between_requests = parseInt( ui.value * 1000 );
475
- delay_between_requests_slider.slider( 'enable' );
476
- $( '.slider-success-msg', delay_between_requests_container ).show();
477
- $( '.slider-success-msg', delay_between_requests_container ).fadeOut( 2000, function() {
478
- $( this ).hide();
479
- } );
480
- $( '.slider-spinner', delay_between_requests_container ).remove();
481
- }
482
- } );
483
- }
484
- } );
485
-
486
- var $progress_content_original = $( '.progress-content' ).clone();
487
- $( '.progress-content' ).remove();
488
-
489
- var $push_select = $( '#select-tables' ).clone();
490
- var $pull_select = $( '#select-tables' ).clone();
491
- var $push_post_type_select = $( '#select-post-types' ).clone();
492
- var $pull_post_type_select = $( '#select-post-types' ).clone();
493
- var $push_select_backup = $( '#select-backup' ).clone();
494
- var $pull_select_backup = $( '#select-backup' ).clone();
495
-
496
- $( '.help-tab .video' ).each( function() {
497
- var $container = $( this ),
498
- $viewer = $( '.video-viewer' );
499
-
500
- $( 'a', this ).click( function( e ) {
501
- e.preventDefault();
502
-
503
- $viewer.attr( 'src', '//www.youtube.com/embed/' + $container.data( 'video-id' ) + '?autoplay=1' );
504
- $viewer.show();
505
- var offset = $viewer.offset();
506
- $( window ).scrollTop( offset.top - 50 );
507
- } );
508
- } );
509
-
510
- $( '.backup-options' ).show();
511
- $( '.keep-active-plugins' ).show();
512
- if ( 'savefile' === wpmdb_migration_type() ) {
513
- $( '.backup-options' ).hide();
514
- $( '.keep-active-plugins' ).hide();
515
- }
516
-
517
- last_replace_switch = wpmdb_migration_type();
518
-
519
- function check_licence( licence ) {
520
- checked_licence = true;
521
- $.ajax( {
522
- url: ajaxurl,
523
- type: 'POST',
524
- dataType: 'json',
525
- cache: false,
526
- data: {
527
- action: 'wpmdb_check_licence',
528
- licence: licence,
529
- context: 'all',
530
- nonce: wpmdb_data.nonces.check_licence
531
- },
532
- error: function( jqXHR, textStatus, errorThrown ) {
533
- alert( wpmdb_strings.license_check_problem );
534
- },
535
- success: function( data ) {
536
-
537
- var $support_content = $( '.support-content' );
538
- var $addons_content = $( '.addons-content' );
539
- var $licence_content = $( '.licence-status:not(.notification-message)' );
540
- var licence_msg, support_msg, addons_msg;
541
-
542
- if ( 'undefined' !== typeof data.dbrains_api_down ) {
543
- support_msg = data.dbrains_api_down + data.message;
544
- addons_msg = data.dbrains_api_down;
545
- } else if ( 'undefined' !== typeof data.errors ) {
546
-
547
- if ( 'undefined' !== typeof data.errors.subscription_expired ) {
548
- licence_msg = data.errors.subscription_expired.licence;
549
- support_msg = data.errors.subscription_expired.support;
550
- addons_msg = data.errors.subscription_expired.addons;
551
- } else {
552
- var msg = '';
553
- for ( var key in data.errors ) {
554
- msg += data.errors[ key ];
555
- }
556
- support_msg = msg;
557
- addons_msg = msg;
558
- }
559
- if ( 'undefined' !== typeof data.addon_content ) {
560
- addons_msg += '\n' + data.addon_content;
561
- }
562
- } else {
563
- support_msg = data.message;
564
- addons_msg = data.addon_content;
565
- }
566
-
567
- $licence_content.stop().fadeOut( fade_duration, function() {
568
- $( this )
569
- .empty()
570
- .html( licence_msg )
571
- .stop()
572
- .fadeIn( fade_duration );
573
- } );
574
- $support_content.stop().fadeOut( fade_duration, function() {
575
- $( this )
576
- .empty()
577
- .html( support_msg )
578
- .stop()
579
- .fadeIn( fade_duration );
580
- } );
581
- $addons_content.stop().fadeOut( fade_duration, function() {
582
- $( this )
583
- .empty()
584
- .html( addons_msg )
585
- .stop()
586
- .fadeIn( fade_duration );
587
- } );
588
-
589
- }
590
- } );
591
- }
592
-
593
- /**
594
- * Handle 'Check License Again' functionality found in expired license messages.
595
- */
596
- $( '.content-tab' ).on( 'click', '.check-my-licence-again', function( e ) {
597
- e.preventDefault();
598
- checked_licence = false;
599
- $( e.target ).replaceWith( 'Checking... ' + ajax_spinner );
600
- check_licence( null, 'all' );
601
- } );
602
- function refresh_table_selects() {
603
- if ( undefined !== wpmdb_data && undefined !== wpmdb_data.this_tables && undefined !== wpmdb_data.this_table_sizes_hr ) {
604
- $push_select = create_table_select( wpmdb_data.this_tables, wpmdb_data.this_table_sizes_hr, $( $push_select ).val() );
605
- }
606
-
607
- if ( undefined !== wpmdb.common.connection_data && undefined !== wpmdb.common.connection_data.tables && undefined !== wpmdb.common.connection_data.table_sizes_hr ) {
608
- $pull_select = create_table_select( wpmdb.common.connection_data.tables, wpmdb.common.connection_data.table_sizes_hr, $( $pull_select ).val() );
609
- }
610
- }
611
-
612
- $.wpmdb.add_action( 'wpmdb_refresh_table_selects', refresh_table_selects );
613
-
614
- function update_push_table_select() {
615
- $( '#select-tables' ).remove();
616
- $( '.select-tables-wrap' ).prepend( $push_select );
617
- }
618
-
619
- $.wpmdb.add_action( 'wpmdb_update_push_table_select', update_push_table_select );
620
-
621
- function update_pull_table_select() {
622
- $( '#select-tables' ).remove();
623
- $( '.select-tables-wrap' ).prepend( $pull_select );
624
- }
625
-
626
- $.wpmdb.add_action( 'wpmdb_update_pull_table_select', update_pull_table_select );
627
-
628
- function disable_table_migration_options() {
629
- $( '#migrate-selected' ).parents( '.option-section' ).children( '.header-expand-collapse' ).children( '.expand-collapse-arrow' ).removeClass( 'collapsed' );
630
- $( '.table-select-wrap' ).show();
631
- $( '#migrate-only-with-prefix' ).prop( 'checked', false );
632
- $( '#migrate-selected' ).prop( 'checked', true );
633
- $( '.table-migrate-options' ).hide();
634
- $( '.select-tables-wrap' ).show();
635
- }
636
-
637
- $.wpmdb.add_action( 'wpmdb_disable_table_migration_options', disable_table_migration_options );
638
-
639
- function enable_table_migration_options() {
640
- $( '.table-migrate-options' ).show();
641
- }
642
-
643
- $.wpmdb.add_action( 'wpmdb_enable_table_migration_options', enable_table_migration_options );
644
-
645
- function select_all_tables() {
646
- $( '#select-tables' ).children( 'option' ).prop( 'selected', true );
647
- }
648
-
649
- $.wpmdb.add_action( 'wpmdb_select_all_tables', select_all_tables );
650
-
651
- function base_old_url( value, args ) {
652
- return remove_protocol( wpmdb_data.this_url );
653
- }
654
-
655
- $.wpmdb.add_filter( 'wpmdb_base_old_url', base_old_url );
656
-
657
- function establish_remote_connection_from_saved_profile() {
658
- var action = wpmdb_migration_type();
659
- var connection_info = $.trim( $( '.pull-push-connection-info' ).val() ).split( '\n' );
660
- if ( 'undefined' === typeof wpmdb_default_profile || true === wpmdb_default_profile || 'savefile' === action || doing_ajax || !wpmdb_data.is_pro ) {
661
- return;
662
- }
663
-
664
- doing_ajax = true;
665
- disable_export_type_controls();
666
-
667
- $( '.connection-status' ).html( wpmdb_strings.establishing_remote_connection );
668
- $( '.connection-status' ).removeClass( 'notification-message error-notice migration-error' );
669
- $( '.connection-status' ).append( ajax_spinner );
670
-
671
- var intent = wpmdb_migration_type();
672
-
673
- $.ajax( {
674
- url: ajaxurl,
675
- type: 'POST',
676
- dataType: 'json',
677
- cache: false,
678
- data: {
679
- action: 'wpmdb_verify_connection_to_remote_site',
680
- url: connection_info[ 0 ],
681
- key: connection_info[ 1 ],
682
- intent: intent,
683
- nonce: wpmdb_data.nonces.verify_connection_to_remote_site,
684
- convert_post_type_selection: wpmdb_convert_post_type_selection,
685
- profile: wpmdb_data.profile
686
- },
687
- error: function( jqXHR, textStatus, errorThrown ) {
688
- $( '.connection-status' ).html( getAjaxErrors( jqXHR.responseText, '(#102)', jqXHR ) );
689
- $( '.connection-status' ).addClass( 'notification-message error-notice migration-error' );
690
- $( '.ajax-spinner' ).remove();
691
- doing_ajax = false;
692
- enable_export_type_controls();
693
- },
694
- success: function( data ) {
695
- $( '.ajax-spinner' ).remove();
696
- doing_ajax = false;
697
- enable_export_type_controls();
698
-
699
- if ( 'undefined' !== typeof data.wpmdb_error && 1 === data.wpmdb_error ) {
700
- $( '.connection-status' ).html( data.body );
701
- $( '.connection-status' ).addClass( 'notification-message error-notice migration-error' );
702
-
703
- if ( data.body.indexOf( '401 Unauthorized' ) > -1 ) {
704
- $( '.basic-access-auth-wrapper' ).show();
705
- }
706
-
707
- return;
708
- }
709
-
710
- maybe_show_ssl_warning( connection_info[ 0 ], connection_info[ 1 ], data.scheme );
711
- maybe_show_prefix_notice( data.prefix );
712
-
713
- $( '.pull-push-connection-info' ).addClass( 'temp-disabled' );
714
- $( '.pull-push-connection-info' ).attr( 'readonly', 'readonly' );
715
- $( '.connect-button' ).hide();
716
-
717
- $( '.connection-status' ).hide();
718
- $( '.step-two' ).show();
719
- connection_established = true;
720
- wpmdb.common.connection_data = data;
721
- move_connection_info_box();
722
-
723
- maybe_show_mixed_cased_table_name_warning();
724
-
725
- var loaded_tables = '';
726
- if ( false === wpmdb_default_profile && 'undefined' !== typeof wpmdb_loaded_tables ) {
727
- loaded_tables = wpmdb_loaded_tables;
728
- }
729
-
730
- $pull_select = create_table_select( wpmdb.common.connection_data.tables, wpmdb.common.connection_data.table_sizes_hr, loaded_tables );
731
-
732
- var loaded_post_types = '';
733
- if ( false === wpmdb_default_profile && 'undefined' !== typeof wpmdb_loaded_post_types ) {
734
- if ( 'undefined' !== typeof data.select_post_types ) {
735
- $( '#exclude-post-types' ).attr( 'checked', 'checked' );
736
- $( '.post-type-select-wrap' ).show();
737
- loaded_post_types = data.select_post_types;
738
- } else {
739
- loaded_post_types = wpmdb_loaded_post_types;
740
- }
741
- }
742
-
743
- var $post_type_select = document.createElement( 'select' );
744
- $( $post_type_select ).attr( {
745
- multiple: 'multiple',
746
- name: 'select_post_types[]',
747
- id: 'select-post-types',
748
- class: 'multiselect'
749
- } );
750
-
751
- $.each( wpmdb.common.connection_data.post_types, function( index, value ) {
752
- var selected = $.inArray( value, loaded_post_types );
753
- if ( -1 !== selected || ( true === wpmdb_convert_exclude_revisions && 'revision' !== value ) ) {
754
- selected = ' selected="selected" ';
755
- } else {
756
- selected = ' ';
757
- }
758
- $( $post_type_select ).append( '<option' + selected + 'value="' + value + '">' + value + '</option>' );
759
- } );
760
-
761
- $pull_post_type_select = $post_type_select;
762
-
763
- var loaded_tables_backup = '';
764
- if ( false === wpmdb_default_profile && 'undefined' !== typeof wpmdb_loaded_tables_backup ) {
765
- loaded_tables_backup = wpmdb_loaded_tables_backup;
766
- }
767
-
768
- var $table_select_backup = document.createElement( 'select' );
769
- $( $table_select_backup ).attr( {
770
- multiple: 'multiple',
771
- name: 'select_backup[]',
772
- id: 'select-backup',
773
- class: 'multiselect'
774
- } );
775
-
776
- $.each( wpmdb.common.connection_data.tables, function( index, value ) {
777
- var selected = $.inArray( value, loaded_tables_backup );
778
- if ( -1 !== selected ) {
779
- selected = ' selected="selected" ';
780
- } else {
781
- selected = ' ';
782
- }
783
- $( $table_select_backup ).append( '<option' + selected + 'value="' + value + '">' + value + ' (' + wpmdb.common.connection_data.table_sizes_hr[ value ] + ')</option>' );
784
- } );
785
-
786
- $push_select_backup = $table_select_backup;
787
-
788
- if ( 'pull' === wpmdb_migration_type() ) {
789
- $.wpmdb.do_action( 'wpmdb_update_pull_table_select' );
790
- $( '#select-post-types' ).remove();
791
- $( '.select-post-types-wrap' ).prepend( $pull_post_type_select );
792
- $( '#select-backup' ).remove();
793
- $( '.backup-tables-wrap' ).prepend( $pull_select_backup );
794
- $( '.table-prefix' ).html( data.prefix );
795
- $( '.uploads-dir' ).html( wpmdb_data.this_uploads_dir );
796
- } else {
797
- $( '#select-backup' ).remove();
798
- $( '.backup-tables-wrap' ).prepend( $push_select_backup );
799
- }
800
-
801
- $.wpmdb.do_action( 'verify_connection_to_remote_site', wpmdb.common.connection_data );
802
- }
803
-
804
- } );
805
-
806
- }
807
-
808
- // automatically validate connection info if we're loading a saved profile
809
- establish_remote_connection_from_saved_profile();
810
-
811
- // add to <a> tags which act as JS event buttons, will not jump page to top and will deselect the button
812
- $( 'body' ).on( 'click', '.js-action-link', function( e ) {
813
- e.preventDefault();
814
- $( this ).blur();
815
- } );
816
-
817
- function enable_pro_licence( data, licence_key ) {
818
- $( '.licence-input, .register-licence' ).remove();
819
- $( '.licence-not-entered' ).prepend( data.masked_licence );
820
- $( '.support-content' ).empty().html( '<p>' + wpmdb_strings.fetching_license + '<img src="' + spinner_url + '" alt="" class="ajax-spinner general-spinner" /></p>' );
821
- check_licence( licence_key );
822
-
823
- $( '.migrate-selection label' ).removeClass( 'disabled' );
824
- $( '.migrate-selection input' ).removeAttr( 'disabled' );
825
- }
826
-
827
- // registers your licence
828
- $( '.licence-form' ).submit( function( e ) {
829
- e.preventDefault();
830
-
831
- if ( doing_licence_registration_ajax ) {
832
- return;
833
- }
834
-
835
- $( '.licence-status' ).removeClass( 'notification-message error-notice success-notice' );
836
-
837
- var licence_key = $.trim( $( '.licence-input' ).val() );
838
-
839
- if ( '' === licence_key ) {
840
- $( '.licence-status' ).addClass( 'notification-message error-notice' );
841
- $( '.licence-status' ).html( wpmdb_strings.enter_license_key );
842
- return;
843
- }
844
-
845
- $( '.licence-status' ).empty().removeClass( 'success' );
846
- doing_licence_registration_ajax = true;
847
- $( '.button.register-licence' ).after( '<img src="' + spinner_url + '" alt="" class="register-licence-ajax-spinner general-spinner" />' );
848
-
849
- $.ajax( {
850
- url: ajaxurl,
851
- type: 'POST',
852
- dataType: 'JSON',
853
- cache: false,
854
- data: {
855
- action: 'wpmdb_activate_licence',
856
- licence_key: licence_key,
857
- nonce: wpmdb_data.nonces.activate_licence,
858
- context: 'licence'
859
- },
860
- error: function( jqXHR, textStatus, errorThrown ) {
861
- doing_licence_registration_ajax = false;
862
- $( '.register-licence-ajax-spinner' ).remove();
863
- $( '.licence-status' ).html( wpmdb_strings.register_license_problem );
864
- },
865
- success: function( data ) {
866
- doing_licence_registration_ajax = false;
867
- $( '.register-licence-ajax-spinner' ).remove();
868
-
869
- if ( 'undefined' !== typeof data.errors ) {
870
- var msg = '';
871
- for ( var key in data.errors ) {
872
- msg += data.errors[ key ];
873
- }
874
- $( '.licence-status' ).html( msg );
875
-
876
- if ( 'undefined' !== typeof data.masked_licence ) {
877
- enable_pro_licence( data, licence_key );
878
- $( '.migrate-tab .invalid-licence' ).hide();
879
- }
880
- } else if ( 'undefined' !== typeof data.wpmdb_error && 'undefined' !== typeof data.body ) {
881
- $( '.licence-status' ).html( data.body );
882
- } else {
883
- $( '.licence-status' ).html( wpmdb_strings.license_registered ).delay( 5000 ).fadeOut( 1000 );
884
- $( '.licence-status' ).addClass( 'success notification-message success-notice' );
885
- enable_pro_licence( data, licence_key );
886
- $( '.invalid-licence' ).hide();
887
- }
888
- }
889
- } );
890
-
891
- } );
892
-
893
- // clears the debug log
894
- $( '.clear-log' ).click( function() {
895
- $( '.debug-log-textarea' ).val( '' );
896
- $.ajax( {
897
- url: ajaxurl,
898
- type: 'POST',
899
- dataType: 'text',
900
- cache: false,
901
- data: {
902
- action: 'wpmdb_clear_log',
903
- nonce: wpmdb_data.nonces.clear_log
904
- },
905
- error: function( jqXHR, textStatus, errorThrown ) {
906
- alert( wpmdb_strings.clear_log_problem );
907
- },
908
- success: function( data ) {
909
- }
910
- } );
911
- } );
912
-
913
- // updates the debug log when the user switches to the help tab
914
- function refresh_debug_log() {
915
- $.ajax( {
916
- url: ajaxurl,
917
- type: 'POST',
918
- dataType: 'text',
919
- cache: false,
920
- data: {
921
- action: 'wpmdb_get_log',
922
- nonce: wpmdb_data.nonces.get_log
923
- },
924
- error: function( jqXHR, textStatus, errorThrown ) {
925
- alert( wpmdb_strings.update_log_problem );
926
- },
927
- success: function( data ) {
928
- $( '.debug-log-textarea' ).val( data );
929
- }
930
- } );
931
- }
932
-
933
- // select all tables
934
- $( '.multiselect-select-all' ).click( function() {
935
- var multiselect = $( this ).parents( '.select-wrap' ).children( '.multiselect' );
936
- $( 'option', multiselect ).prop( 'selected', 1 );
937
- $( multiselect ).focus().trigger( 'change' );
938
- } );
939
-
940
- // deselect all tables
941
- $( '.multiselect-deselect-all' ).click( function() {
942
- var multiselect = $( this ).parents( '.select-wrap' ).children( '.multiselect' );
943
- $( 'option', multiselect ).removeAttr( 'selected' );
944
- $( multiselect ).focus().trigger( 'change' );
945
- } );
946
-
947
- // invert table selection
948
- $( '.multiselect-invert-selection' ).click( function() {
949
- var multiselect = $( this ).parents( '.select-wrap' ).children( '.multiselect' );
950
- $( 'option', multiselect ).each( function() {
951
- $( this ).attr( 'selected', !$( this ).attr( 'selected' ) );
952
- } );
953
- $( multiselect ).focus().trigger( 'change' );
954
- } );
955
-
956
- // on option select hide all "advanced" option divs and show the correct div for the option selected
957
- $( '.option-group input[type=radio]' ).change( function() {
958
- var group = $( this ).closest( '.option-group' );
959
- $( 'ul', group ).hide();
960
- var parent = $( this ).closest( 'li' );
961
- $( 'ul', parent ).show();
962
- } );
963
-
964
- // on page load, expand hidden divs for selected options (browser form cache)
965
- $( '.option-group' ).each( function() {
966
- $( '.option-group input[type=radio]' ).each( function() {
967
- if ( $( this ).is( ':checked' ) ) {
968
- var parent = $( this ).closest( 'li' );
969
- $( 'ul', parent ).show();
970
- }
971
- } );
972
- } );
973
-
974
- // expand and collapse content on click
975
- $( '.header-expand-collapse' ).click( function() {
976
- if ( $( '.expand-collapse-arrow', this ).hasClass( 'collapsed' ) ) {
977
- $( '.expand-collapse-arrow', this ).removeClass( 'collapsed' );
978
- $( this ).next().show();
979
- } else {
980
- $( '.expand-collapse-arrow', this ).addClass( 'collapsed' );
981
- $( this ).next().hide();
982
- }
983
- } );
984
-
985
- $( '.checkbox-label input[type=checkbox]' ).change( function() {
986
- if ( $( this ).is( ':checked' ) ) {
987
- $( this ).parent().next().show();
988
- } else {
989
- $( this ).parent().next().hide();
990
- }
991
- } );
992
-
993
- // special expand and collapse content on click for save migration profile
994
- $( '#save-migration-profile' ).change( function() {
995
- wpmdb.functions.update_migrate_button_text();
996
- if ( $( this ).is( ':checked' ) ) {
997
- $( '.save-settings-button' ).show();
998
- } else {
999
- $( '.save-settings-button' ).hide();
1000
- }
1001
- } );
1002
-
1003
- if ( $( '#save-migration-profile' ).is( ':checked' ) ) {
1004
- $( '.save-settings-button' ).show();
1005
- }
1006
-
1007
- $( '.create-new-profile' ).focus( function() {
1008
- $( '#create_new' ).prop( 'checked', true );
1009
- } );
1010
-
1011
- $( '.checkbox-label input[type=checkbox]' ).each( function() {
1012
- if ( $( this ).is( ':checked' ) ) {
1013
- $( this ).parent().next().show();
1014
- }
1015
- } );
1016
-
1017
- // AJAX migrate button
1018
- $( '.migrate-db-button' ).click( function( event ) {
1019
- $( this ).blur();
1020
- event.preventDefault();
1021
- wpmdb.migration_state_id = '';
1022
-
1023
- if ( false === $.wpmdb.apply_filters( 'wpmdb_migration_profile_ready', true ) ) {
1024
- return;
1025
- }
1026
-
1027
- // check that they've selected some tables to migrate
1028
- if ( $( '#migrate-selected' ).is( ':checked' ) && null === $( '#select-tables' ).val() ) {
1029
- alert( wpmdb_strings.please_select_one_table );
1030
- return;
1031
- }
1032
-
1033
- // check that they've selected some tables to backup
1034
- if ( 'savefile' !== wpmdb_migration_type() && $( '#backup-manual-select' ).is( ':checked' ) && null === $( '#select-backup' ).val() ) {
1035
- alert( wpmdb_strings.please_select_one_table_backup );
1036
- return;
1037
- }
1038
-
1039
- var new_url_missing = false;
1040
- var new_file_path_missing = false;
1041
- if ( $( '#new-url' ).length && !$( '#new-url' ).val() ) {
1042
- $( '#new-url-missing-warning' ).show();
1043
- $( '#new-url' ).focus();
1044
- $( 'html,body' ).scrollTop( 0 );
1045
- new_url_missing = true;
1046
- }
1047
-
1048
- if ( $( '#new-path' ).length && !$( '#new-path' ).val() ) {
1049
- $( '#new-path-missing-warning' ).show();
1050
- if ( false === new_url_missing ) {
1051
- $( '#new-path' ).focus();
1052
- $( 'html,body' ).scrollTop( 0 );
1053
- }
1054
- new_file_path_missing = true;
1055
- }
1056
-
1057
- if ( true === new_url_missing || true === new_file_path_missing ) {
1058
- return;
1059
- }
1060
-
1061
- // also save profile
1062
- if ( $( '#save-migration-profile' ).is( ':checked' ) ) {
1063
- save_active_profile();
1064
- }
1065
-
1066
- form_data = $( '#migrate-form' ).serialize();
1067
-
1068
- var doc_height = $( document ).height();
1069
-
1070
- $( 'body' ).append( '<div id="overlay"></div>' );
1071
-
1072
- $( '#overlay' )
1073
- .height( doc_height )
1074
- .css( {
1075
- 'position': 'fixed',
1076
- 'top': 0,
1077
- 'left': 0,
1078
- 'width': '100%',
1079
- 'z-index': 99999,
1080
- 'display': 'none'
1081
- } );
1082
-
1083
- var $progress_content = $progress_content_original.clone();
1084
- migration_intent = wpmdb_migration_type();
1085
-
1086
- stage = 'backup';
1087
-
1088
- if ( 'savefile' === migration_intent ) {
1089
- stage = 'migrate';
1090
- }
1091
-
1092
- if ( false === $( '#create-backup' ).is( ':checked' ) ) {
1093
- stage = 'migrate';
1094
- }
1095
-
1096
- var table_intent = $( 'input[name=table_migrate_option]:checked' ).val();
1097
- var connection_info = $.trim( $( '.pull-push-connection-info' ).val() ).split( '\n' );
1098
- var table_rows = '';
1099
-
1100
- remote_site = connection_info[ 0 ];
1101
- secret_key = connection_info[ 1 ];
1102
-
1103
- var static_migration_label = '';
1104
-
1105
- $( '#overlay' ).after( $progress_content );
1106
-
1107
- completed_msg = wpmdb_strings.exporting_complete;
1108
-
1109
- if ( 'savefile' === migration_intent ) {
1110
- static_migration_label = wpmdb_strings.exporting_please_wait;
1111
- } else {
1112
- static_migration_label = get_migration_status_label( remote_site, migration_intent, 'migrating' );
1113
- completed_msg = get_migration_status_label( remote_site, migration_intent, 'completed' );
1114
- }
1115
-
1116
- $( '.progress-title' ).html( static_migration_label );
1117
-
1118
- $( '#overlay' ).show();
1119
- var backup_option = $( 'input[name=backup_option]:checked' ).val();
1120
- var table_option = $( 'input[name=table_migrate_option]:checked' ).val();
1121
- var selected_tables = '';
1122
-
1123
- if ( 'backup' === stage ) {
1124
- if ( 'migrate_only_with_prefix' === table_option && 'backup_selected' === backup_option ) {
1125
- backup_option = 'backup_only_with_prefix';
1126
- }
1127
- if ( 'push' === migration_intent ) {
1128
- table_rows = wpmdb.common.connection_data.table_rows;
1129
- if ( 'backup_only_with_prefix' === backup_option ) {
1130
- tables_to_migrate = wpmdb.common.connection_data.prefixed_tables;
1131
- } else if ( 'backup_selected' === backup_option ) {
1132
- selected_tables = $( '#select-tables' ).val();
1133
- tables_to_migrate = get_intersect( selected_tables, wpmdb.common.connection_data.tables );
1134
- } else if ( 'backup_manual_select' === backup_option ) {
1135
- tables_to_migrate = $( '#select-backup' ).val();
1136
- }
1137
- } else {
1138
- table_rows = wpmdb_data.this_table_rows;
1139
- if ( 'backup_only_with_prefix' === backup_option ) {
1140
- tables_to_migrate = wpmdb_data.this_prefixed_tables;
1141
- } else if ( 'backup_selected' === backup_option ) {
1142
- selected_tables = $( '#select-tables' ).val();
1143
- tables_to_migrate = get_intersect( selected_tables, wpmdb_data.this_tables );
1144
- } else if ( 'backup_manual_select' === backup_option ) {
1145
- tables_to_migrate = $( '#select-backup' ).val();
1146
- }
1147
- }
1148
- } else {
1149
- tables_to_migrate = get_tables_to_migrate( null, null );
1150
-
1151
- // User is pushing or exporting
1152
- if ( 'push' === migration_intent || 'savefile' === migration_intent ) {
1153
-
1154
- // Default value, assuming we're not backing up
1155
- table_rows = wpmdb_data.this_table_rows;
1156
- } else {
1157
- table_rows = wpmdb.common.connection_data.table_rows;
1158
- }
1159
- }
1160
-
1161
- function decide_tables_to_display_rows( tables_to_migrate, orig_table_rows ) {
1162
- var total_size = 0;
1163
- var table_rows = JSON.parse( JSON.stringify( orig_table_rows ) );
1164
-
1165
- $.each( tables_to_migrate, function( index, value ) {
1166
- total_size += parseInt( table_rows[ value ] );
1167
- } );
1168
-
1169
- var max_percent = 0;
1170
- var total_percent = 0;
1171
- var table_widths = [];
1172
- $.each( tables_to_migrate, function( index, value ) {
1173
- var percent = Math.round( ( table_rows[ value ] / total_size ) * 100 );
1174
- table_widths[ value ] = percent;
1175
-
1176
- if ( percent > max_percent ) {
1177
- max_percent = percent;
1178
- }
1179
- total_percent += percent;
1180
- } );
1181
-
1182
- var last_element = '';
1183
- var percent_diff = 100 - total_percent;
1184
- $.each( tables_to_migrate, function( index, value ) {
1185
- var percent = table_widths[ value ];
1186
-
1187
- if ( 0 !== percent_diff && percent === max_percent ) {
1188
- percent += percent_diff;
1189
- percent_diff = 0;
1190
- }
1191
-
1192
- $( '.progress-tables' ).append( '<div class="progress-chunk ' + value + '_chunk" style="width: ' + percent + '%;" title="' + value + '"><span>' + value + '</span></div>' );
1193
- $( '.progress-tables-hover-boxes' ).append( '<div class="progress-chunk-hover" data-table="' + value + '" style="width: ' + percent + '%;"></div>' );
1194
- last_element = value;
1195
- } );
1196
-
1197
- // Only enumerate progress-chunk classed elements from core
1198
- $( '.progress-tables', '.progress-wrapper-primary' ).find( '.progress-chunk' ).each( function( index ) {
1199
- if ( 1 > $( this ).width() ) {
1200
- $( this ).hide();
1201
- $( '.progress-chunk-hover[data-table=' + tables_to_migrate[ index ] + ']' ).hide();
1202
- table_rows[ last_element ] = Number( table_rows[ last_element ] );
1203
- table_rows[ last_element ] += Number( table_rows[ tables_to_migrate[ index ] ] );
1204
- table_rows[ tables_to_migrate[ index ] ] = 0;
1205
- }
1206
-
1207
- var element = this;
1208
- setTimeout( function() {
1209
- hide_overflowing_elements( element );
1210
- }, 0 );
1211
-
1212
- function hide_overflowing_elements( element ) {
1213
- if ( $( 'span', element ).innerWidth() > $( element ).width() ) {
1214
- $( 'span', element ).hide();
1215
- }
1216
- }
1217
- } );
1218
-
1219
- var return_vals = [ table_rows, total_size ];
1220
-
1221
- return return_vals;
1222
-
1223
- }
1224
-
1225
- var table_details = decide_tables_to_display_rows( tables_to_migrate, table_rows );
1226
- table_rows = table_details[ 0 ];
1227
- var total_size = table_details[ 1 ];
1228
-
1229
- $( '.progress-title' ).after( '<img src="' + spinner_url + '" alt="" class="migration-progress-ajax-spinner general-spinner" />' );
1230
-
1231
- var height = $( '.progress-content' ).outerHeight();
1232
- $( '.progress-content' ).css( 'top', '-' + height + 'px' ).show().animate( { 'top': '0px' } );
1233
-
1234
- setup_counter();
1235
- currently_migrating = true;
1236
-
1237
- var request_data = {
1238
- action: 'wpmdb_initiate_migration',
1239
- intent: migration_intent,
1240
- url: remote_site,
1241
- key: secret_key,
1242
- form_data: form_data,
1243
- stage: stage,
1244
- nonce: wpmdb_data.nonces.initiate_migration
1245
- };
1246
-
1247
- if ( 'savefile' !== migration_intent ) {
1248
- request_data.temp_prefix = wpmdb.common.connection_data.temp_prefix;
1249
- }
1250
-
1251
- doing_ajax = true;
1252
-
1253
- $.ajax( {
1254
- url: ajaxurl,
1255
- type: 'POST',
1256
- dataType: 'json',
1257
- cache: false,
1258
- data: request_data,
1259
- error: function( jqXHR, textStatus, errorThrown ) {
1260
- $( '.progress-title' ).html( wpmdb_strings.migration_failed );
1261
- $( '.progress-text' ).html( getAjaxErrors( jqXHR.responseText, '(#112)', jqXHR ) );
1262
- $( '.progress-text' ).addClass( 'migration-error' );
1263
- console.log( jqXHR );
1264
- console.log( textStatus );
1265
- console.log( errorThrown );
1266
- doing_ajax = false;
1267
- wpmdb.common.migration_error = true;
1268
- wpmdb.functions.migration_complete_events();
1269
- return;
1270
- },
1271
- success: function( data ) {
1272
- doing_ajax = false;
1273
- if ( 'undefined' !== typeof data && 'undefined' !== typeof data.wpmdb_error && 1 === data.wpmdb_error ) {
1274
- wpmdb.common.migration_error = true;
1275
- wpmdb.functions.migration_complete_events();
1276
- $( '.progress-title' ).html( wpmdb_strings.migration_failed );
1277
- $( '.progress-text' ).addClass( 'migration-error' );
1278
- $( '.progress-text' ).html( data.body );
1279
- return;
1280
- }
1281
-
1282
- wpmdb.migration_state_id = data.migration_state_id;
1283
-
1284
- var i = 0;
1285
- var progress_size = 0;
1286
- overall_percent = 0;
1287
- var table_progress = 0;
1288
- var temp_progress = 0;
1289
- var last_progress = 0;
1290
- var overall_table_progress = 0;
1291
-
1292
- // Set delay between requests - use max of local/remote values, 0 if doing export
1293
- delay_between_requests = 0;
1294
- if ( 'savefile' !== migration_intent && 'undefined' !== typeof wpmdb.common.connection_data && 'undefined' !== typeof wpmdb.common.connection_data.delay_between_requests ) {
1295
- delay_between_requests = Math.max( parseInt( wpmdb_data.delay_between_requests ), parseInt( wpmdb.common.connection_data.delay_between_requests ) );
1296
- }
1297
-
1298
- wpmdb.functions.migrate_table_recursive = function( current_row, primary_keys ) {
1299
-
1300
- if ( i >= tables_to_migrate.length ) {
1301
- if ( 'backup' === stage ) {
1302
- stage = 'migrate';
1303
- i = 0;
1304
- progress_size = 0;
1305
- overall_percent = 0;
1306
- $( '.progress-bar' ).width( '0px' );
1307
-
1308
- tables_to_migrate = get_tables_to_migrate( null, null );
1309
-
1310
- // User is pushing or exporting
1311
- if ( 'push' === migration_intent || 'savefile' === migration_intent ) {
1312
-
1313
- // Default value, assuming we're not backing up
1314
- table_rows = wpmdb_data.this_table_rows;
1315
- } else {
1316
- table_rows = wpmdb.common.connection_data.table_rows;
1317
- }
1318
-
1319
- $( '.progress-tables' ).empty();
1320
- $( '.progress-tables-hover-boxes' ).empty();
1321
-
1322
- table_details = decide_tables_to_display_rows( tables_to_migrate, table_rows );
1323
- table_rows = table_details[ 0 ];
1324
- total_size = table_details[ 1 ];
1325
-
1326
- } else {
1327
- $( '.progress-label' ).removeClass( 'label-visible' );
1328
-
1329
- wpmdb.common.hooks = $.wpmdb.apply_filters( 'wpmdb_before_migration_complete_hooks', wpmdb.common.hooks );
1330
- wpmdb.common.hooks.push( wpmdb.functions.migration_complete );
1331
- wpmdb.common.hooks.push( wpmdb.functions.wpmdb_flush );
1332
- wpmdb.common.hooks = $.wpmdb.apply_filters( 'wpmdb_after_migration_complete_hooks', wpmdb.common.hooks );
1333
- wpmdb.common.hooks.push( wpmdb.functions.migration_complete_events );
1334
- wpmdb.common.next_step_in_migration = { fn: wpmdb_call_next_hook };
1335
- wpmdb.functions.execute_next_step();
1336
- return;
1337
- }
1338
- }
1339
-
1340
- if ( 'backup' === stage ) {
1341
- $( '.progress-text' ).html( overall_percent + '% - ' + wpmdb_strings.backing_up + ' "' + tables_to_migrate[ i ] + '"' );
1342
- } else {
1343
- $( '.progress-text' ).html( overall_percent + '% - ' + wpmdb_strings.migrating + ' "' + tables_to_migrate[ i ] + '"' );
1344
- }
1345
-
1346
- var last_table = 0;
1347
- if ( i === ( tables_to_migrate.length - 1 ) ) {
1348
- last_table = 1;
1349
- }
1350
-
1351
- var gzip = 0;
1352
- if ( 'savefile' !== migration_intent && 1 === parseInt( wpmdb.common.connection_data.gzip ) ) {
1353
- gzip = 1;
1354
- }
1355
-
1356
- var request_data = {
1357
- action: 'wpmdb_migrate_table',
1358
- migration_state_id: wpmdb.migration_state_id,
1359
- table: tables_to_migrate[ i ],
1360
- stage: stage,
1361
- current_row: current_row,
1362
- last_table: last_table,
1363
- primary_keys: primary_keys,
1364
- gzip: gzip,
1365
- nonce: wpmdb_data.nonces.migrate_table
1366
- };
1367
-
1368
- if ( 'savefile' !== migration_intent ) {
1369
- request_data.bottleneck = wpmdb.common.connection_data.bottleneck;
1370
- request_data.prefix = wpmdb.common.connection_data.prefix;
1371
- }
1372
-
1373
- if ( wpmdb.common.connection_data && wpmdb.common.connection_data.path_current_site && wpmdb.common.connection_data.domain ) {
1374
- request_data.path_current_site = wpmdb.common.connection_data.path_current_site;
1375
- request_data.domain_current_site = wpmdb.common.connection_data.domain;
1376
- }
1377
-
1378
- doing_ajax = true;
1379
-
1380
- $.ajax( {
1381
- url: ajaxurl,
1382
- type: 'POST',
1383
- dataType: 'text',
1384
- cache: false,
1385
- timeout: 0,
1386
- data: request_data,
1387
- error: function( jqXHR, textStatus, errorThrown ) {
1388
- $( '.progress-title' ).html( wpmdb_strings.migration_failed );
1389
- $( '.progress-text' ).html( wpmdb_strings.table_process_problem + ' ' + tables_to_migrate[ i ] );
1390
- $( '.progress-text' ).append( '<br /><br />' + wpmdb_strings.status + ': ' + jqXHR.status + ' ' + jqXHR.statusText + '<br /><br />' + wpmdb_strings.response + ':<br />' + jqXHR.responseText );
1391
- $( '.progress-text' ).addClass( 'migration-error' );
1392
- doing_ajax = false;
1393
- console.log( jqXHR );
1394
- console.log( textStatus );
1395
- console.log( errorThrown );
1396
- wpmdb.common.migration_error = true;
1397
- wpmdb.functions.migration_complete_events();
1398
- return;
1399
- },
1400
- success: function( data ) {
1401
- doing_ajax = false;
1402
- data = $.trim( data );
1403
- var row_information = wpmdb_parse_json( data );
1404
- if ( false === row_information || null === row_information ) {
1405
- $( '.progress-title' ).html( wpmdb_strings.migration_failed );
1406
- if ( '' === data || null === data ) {
1407
- $( '.progress-text' ).html( wpmdb_strings.table_process_problem_empty_response + ' ' + tables_to_migrate[ i ] );
1408
- } else {
1409
- $( '.progress-text' ).html( getAjaxErrors( data, null, null ) );
1410
- }
1411
- $( '.progress-text' ).addClass( 'migration-error' );
1412
- wpmdb.common.migration_error = true;
1413
- wpmdb.functions.migration_complete_events();
1414
- return;
1415
- }
1416
-
1417
- if ( 'undefined' !== typeof row_information.wpmdb_error && 1 === row_information.wpmdb_error ) {
1418
- $( '.progress-title' ).html( wpmdb_strings.migration_failed );
1419
- $( '.progress-text' ).addClass( 'migration-error' );
1420
- $( '.progress-text' ).html( row_information.body );
1421
- wpmdb.common.migration_error = true;
1422
- wpmdb.functions.migration_complete_events();
1423
- return;
1424
- }
1425
-
1426
- // We need the returned file name for delivery or display to the user.
1427
- if ( 1 === last_table && 'savefile' === migration_intent ) {
1428
- if ( 'undefined' !== typeof row_information.dump_filename ) {
1429
- dump_filename = row_information.dump_filename;
1430
- }
1431
- if ( 'undefined' !== typeof row_information.dump_path ) {
1432
- dump_path = row_information.dump_path;
1433
- }
1434
- }
1435
-
1436
- if ( -1 === row_information.current_row || '-1' === row_information.current_row ) {
1437
- progress_size -= overall_table_progress;
1438
- overall_table_progress = 0;
1439
- last_progress = 0;
1440
- progress_size += parseInt( table_rows[ tables_to_migrate[ i ] ] );
1441
- i++;
1442
- row_information.current_row = '';
1443
- row_information.primary_keys = '';
1444
- } else {
1445
- temp_progress = parseInt( row_information.current_row );
1446
- table_progress = temp_progress - last_progress;
1447
- last_progress = temp_progress;
1448
- progress_size += table_progress;
1449
- overall_table_progress += table_progress;
1450
- }
1451
- overall_percent = Math.floor( ( progress_size / total_size ) * 100 );
1452
- $( '.progress-bar' ).width( overall_percent + '%' );
1453
- wpmdb.common.next_step_in_migration = {
1454
- fn: wpmdb.functions.migrate_table_recursive,
1455
- args: [ row_information.current_row, row_information.primary_keys ]
1456
- };
1457
- wpmdb.functions.execute_next_step();
1458
- }
1459
- } );
1460
-
1461
- };
1462
-
1463
- wpmdb.common.next_step_in_migration = {
1464
- fn: wpmdb.functions.migrate_table_recursive,
1465
- args: [ '-1', '' ]
1466
- };
1467
- wpmdb.functions.execute_next_step();
1468
-
1469
- }
1470
-
1471
- } ); // end ajax
1472
-
1473
- } );
1474
-
1475
- wpmdb.functions.migration_complete_events = function() {
1476
- if ( false === wpmdb.common.migration_error ) {
1477
- if ( '' === wpmdb.common.non_fatal_errors ) {
1478
- if ( 'savefile' !== migration_intent && true === $( '#save_computer' ).is( ':checked' ) ) {
1479
- $( '.progress-text' ).css( 'visibility', 'hidden' );
1480
- }
1481
- $( '.progress-title' ).html( completed_msg ).append( '<div class="dashicons dashicons-yes"></div>' );
1482
- } else {
1483
- $( '.progress-text' ).html( wpmdb.common.non_fatal_errors );
1484
- $( '.progress-text' ).addClass( 'migration-error' );
1485
- $( '.progress-title' ).html( wpmdb_strings.completed_with_some_errors );
1486
- }
1487
-
1488
- $( '.progress-bar-wrapper' ).hide();
1489
- }
1490
-
1491
- $( '.migration-controls' ).hide();
1492
-
1493
- // reset migration variables so consecutive migrations work correctly
1494
- wpmdb.common.hooks = [];
1495
- wpmdb.common.call_stack = [];
1496
- wpmdb.common.migration_error = false;
1497
- currently_migrating = false;
1498
- migration_completed = true;
1499
- migration_paused = false;
1500
- migration_cancelled = false;
1501
- doing_ajax = false;
1502
- wpmdb.common.non_fatal_errors = '';
1503
-
1504
- $( '.progress-label' ).remove();
1505
- $( '.migration-progress-ajax-spinner' ).remove();
1506
- $( '.close-progress-content' ).show();
1507
- $( '#overlay' ).css( 'cursor', 'pointer' );
1508
- clearInterval( elapsed_interval );
1509
- };
1510
-
1511
- wpmdb.functions.migration_complete = function() {
1512
-
1513
- $( '.migration-controls' ).fadeOut();
1514
-
1515
- if ( 'savefile' === migration_intent ) {
1516
- currently_migrating = false;
1517
- var migrate_complete_text = wpmdb_strings.migration_complete;
1518
- if ( $( '#save_computer' ).is( ':checked' ) ) {
1519
- var url = wpmdb_data.this_download_url + encodeURIComponent( dump_filename );
1520
- if ( $( '#gzip_file' ).is( ':checked' ) ) {
1521
- url += '&gzip=1';
1522
- }
1523
- window.location = url;
1524
- } else {
1525
- migrate_complete_text = wpmdb_strings.completed_dump_located_at + ' ' + dump_path;
1526
- }
1527
-
1528
- if ( false === wpmdb.common.migration_error ) {
1529
- $( '.progress-text' ).html( migrate_complete_text );
1530
- wpmdb.functions.migration_complete_events();
1531
- $( '.progress-title' ).html( completed_msg );
1532
- }
1533
-
1534
- } else { // rename temp tables, delete old tables
1535
- $( '.progress-text' ).html( wpmdb_strings.finalizing_migration );
1536
- doing_ajax = true;
1537
- $.ajax( {
1538
- url: ajaxurl,
1539
- type: 'POST',
1540
- dataType: 'text',
1541
- cache: false,
1542
- data: {
1543
- action: 'wpmdb_finalize_migration',
1544
- migration_state_id: wpmdb.migration_state_id,
1545
- prefix: wpmdb.common.connection_data.prefix,
1546
- tables: tables_to_migrate.join( ',' ),
1547
- nonce: wpmdb_data.nonces.finalize_migration
1548
- },
1549
- error: function( jqXHR, textStatus, errorThrown ) {
1550
- doing_ajax = false;
1551
- $( '.progress-title' ).html( wpmdb_strings.migration_failed );
1552
- $( '.progress-text' ).html( wpmdb_strings.finalize_tables_problem );
1553
- $( '.progress-text' ).addClass( 'migration-error' );
1554
- alert( jqXHR + ' : ' + textStatus + ' : ' + errorThrown );
1555
- wpmdb.common.migration_error = true;
1556
- wpmdb.functions.migration_complete_events();
1557
- return;
1558
- },
1559
- success: function( data ) {
1560
- doing_ajax = false;
1561
- if ( '1' !== $.trim( data ) ) {
1562
- $( '.progress-title' ).html( wpmdb_strings.migration_failed );
1563
- $( '.progress-text' ).html( data );
1564
- $( '.progress-text' ).addClass( 'migration-error' );
1565
- wpmdb.common.migration_error = true;
1566
- wpmdb.functions.migration_complete_events();
1567
- return;
1568
- }
1569
- wpmdb.common.next_step_in_migration = { fn: wpmdb_call_next_hook };
1570
- wpmdb.functions.execute_next_step();
1571
- }
1572
- } );
1573
- }
1574
- };
1575
-
1576
- wpmdb.functions.wpmdb_flush = function() {
1577
- if ( 'savefile' !== migration_intent ) {
1578
- $( '.progress-text' ).html( wpmdb_strings.flushing );
1579
- doing_ajax = true;
1580
- $.ajax( {
1581
- url: ajaxurl,
1582
- type: 'POST',
1583
- dataType: 'text',
1584
- cache: false,
1585
- data: {
1586
- action: 'wpmdb_flush',
1587
- migration_state_id: wpmdb.migration_state_id,
1588
- nonce: wpmdb_data.nonces.flush
1589
- },
1590
- error: function( jqXHR, textStatus, errorThrown ) {
1591
- doing_ajax = false;
1592
- $( '.progress-title' ).html( wpmdb_strings.migration_failed );
1593
- $( '.progress-text' ).html( wpmdb_strings.flush_problem );
1594
- $( '.progress-text' ).addClass( 'migration-error' );
1595
- alert( jqXHR + ' : ' + textStatus + ' : ' + errorThrown );
1596
- wpmdb.common.migration_error = true;
1597
- wpmdb.functions.migration_complete_events();
1598
- return;
1599
- },
1600
- success: function( data ) {
1601
- doing_ajax = false;
1602
- if ( '1' !== $.trim( data ) ) {
1603
- $( '.progress-title' ).html( wpmdb_strings.migration_failed );
1604
- $( '.progress-text' ).html( data );
1605
- $( '.progress-text' ).addClass( 'migration-error' );
1606
- wpmdb.common.migration_error = true;
1607
- wpmdb.functions.migration_complete_events();
1608
- return;
1609
- }
1610
- wpmdb.common.next_step_in_migration = { fn: wpmdb_call_next_hook };
1611
- wpmdb.functions.execute_next_step();
1612
- }
1613
- } );
1614
- }
1615
- };
1616
-
1617
- wpmdb.functions.update_migrate_button_text = function() {
1618
- var migration_intent = wpmdb_migration_type();
1619
- var save_string = ( $( '#save-migration-profile' ).is( ':checked' ) ) ? '_save' : '';
1620
- var migrate_string = 'migrate_button_' + ( ( 'savefile' === migration_intent ) ? 'export' : migration_intent ) + save_string;
1621
- $( '.migrate-db .button-primary' ).val( wpmdb_strings[ migrate_string ] );
1622
- };
1623
-
1624
- wpmdb.functions.update_migrate_button_text();
1625
-
1626
- // close progress pop up once migration is completed
1627
- $( 'body' ).on( 'click', '.close-progress-content-button', function( e ) {
1628
- hide_overlay();
1629
- } );
1630
-
1631
- $( 'body' ).on( 'click', '#overlay', function() {
1632
- if ( true === migration_completed ) {
1633
- hide_overlay();
1634
- }
1635
- } );
1636
-
1637
- function hide_overlay() {
1638
- var height = $( '.progress-content' ).outerHeight();
1639
- $( '.progress-content' ).animate( { 'top': '-' + height + 'px' }, 400, 'swing', function() {
1640
- $( '#overlay' ).remove();
1641
- $( '.progress-content' ).remove();
1642
- } );
1643
- migration_completed = false;
1644
- }
1645
-
1646
- // AJAX save button profile
1647
- $( '.save-settings-button' ).click( function( event ) {
1648
- event.preventDefault();
1649
- if ( '' === $.trim( $( '.create-new-profile' ).val() ) && $( '#create_new' ).is( ':checked' ) ) {
1650
- alert( wpmdb_strings.enter_name_for_profile );
1651
- $( '.create-new-profile' ).focus();
1652
- return;
1653
- }
1654
- save_active_profile();
1655
- } );
1656
-
1657
- function save_active_profile() {
1658
- var profile;
1659
- $( '.save-settings-button' ).blur();
1660
-
1661
- if ( doing_save_profile ) {
1662
- return;
1663
- }
1664
-
1665
- // check that they've selected some tables to migrate
1666
- if ( $( '#migrate-selected' ).is( ':checked' ) && null === $( '#select-tables' ).val() ) {
1667
- alert( wpmdb_strings.please_select_one_table );
1668
- return;
1669
- }
1670
-
1671
- // check that they've selected some tables to backup
1672
- if ( 'savefile' !== wpmdb_migration_type() && $( '#backup-manual-select' ).is( ':checked' ) && null === $( '#select-backup' ).val() ) {
1673
- alert( wpmdb_strings.please_select_one_table_backup );
1674
- return;
1675
- }
1676
-
1677
- var create_new_profile = false;
1678
-
1679
- if ( $( '#create_new' ).is( ':checked' ) ) {
1680
- create_new_profile = true;
1681
- }
1682
- var profile_name = $( '.create-new-profile' ).val();
1683
-
1684
- doing_save_profile = true;
1685
- profile = $( '#migrate-form' ).serialize();
1686
-
1687
- $( '.save-settings-button' ).attr( 'disabled', 'disabled' )
1688
- .after( '<img src="' + spinner_url + '" alt="" class="save-profile-ajax-spinner general-spinner" />' );
1689
-
1690
- doing_ajax = true;
1691
-
1692
- $.ajax( {
1693
- url: ajaxurl,
1694
- type: 'POST',
1695
- dataType: 'text',
1696
- cache: false,
1697
- data: {
1698
- action: 'wpmdb_save_profile',
1699
- profile: profile,
1700
- nonce: wpmdb_data.nonces.save_profile
1701
- },
1702
- error: function( jqXHR, textStatus, errorThrown ) {
1703
- doing_ajax = false;
1704
- alert( wpmdb_strings.save_profile_problem );
1705
- $( '.save-settings-button' ).removeAttr( 'disabled' );
1706
- $( '.save-profile-ajax-spinner' ).remove();
1707
- $( '.save-settings-button' ).after( '<span class="ajax-success-msg">' + wpmdb_strings.saved + '</span>' );
1708
- $( '.ajax-success-msg' ).fadeOut( 2000, function() {
1709
- $( this ).remove();
1710
- } );
1711
- doing_save_profile = false;
1712
- },
1713
- success: function( data ) {
1714
- var updated_profile_id = parseInt( $( '#migrate-form input[name=save_migration_profile_option]:checked' ).val(), 10 ) + 1;
1715
- doing_ajax = false;
1716
- $( '.save-settings-button' ).removeAttr( 'disabled' );
1717
- $( '.save-profile-ajax-spinner' ).remove();
1718
- $( '.save-settings-button' ).after( '<span class="ajax-success-msg">' + wpmdb_strings.saved + '</span>' );
1719
- $( '.ajax-success-msg' ).fadeOut( 2000, function() {
1720
- $( this ).remove();
1721
- } );
1722
- doing_save_profile = false;
1723
- $( '.create-new-profile' ).val( '' );
1724
-
1725
- if ( create_new_profile ) {
1726
- var new_profile_key = parseInt( data, 10 );
1727
- var new_profile_id = new_profile_key + 1;
1728
- 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>' );
1729
- new_li.find( 'label' ).append( document.createTextNode( ' ' + profile_name ) );
1730
- updated_profile_id = new_profile_id;
1731
-
1732
- $( '#create_new' ).parents( 'li' ).before( new_li );
1733
- $( '#profile-' + new_profile_id ).attr( 'checked', 'checked' );
1734
- }
1735
-
1736
- // Push updated profile id to history if available
1737
- var updatedURL = window.location.href.replace( '#migrate', '' ).replace( /&wpmdb-profile=-?\d+/, '' ) + '&wpmdb-profile=' + updated_profile_id;
1738
- var updated_profile_name = $( '#migrate-form input[name=save_migration_profile_option]:checked' ).parent().text().trim();
1739
-
1740
- if ( 'function' === typeof window.history.pushState ) {
1741
- if ( $( '#migrate-form .crumbs' ).length ) {
1742
- $( '#migrate-form .crumbs .crumb:last' ).text( updated_profile_name );
1743
- } else {
1744
- var $crumbs = $( '<div class="crumbs" />' )
1745
- .append( '<a class="crumb" href="' + wpmdb_data.this_plugin_base + '"> Saved Profiles </a>' )
1746
- .append( '<span class="crumb">' + updated_profile_name + '</span>' );
1747
- $( '#migrate-form' ).prepend( $crumbs );
1748
- }
1749
- window.history.pushState( { updated_profile_id: updated_profile_id }, null, updatedURL );
1750
- }
1751
- }
1752
- } );
1753
- }
1754
-
1755
- // progress label updating
1756
- $( 'body' ).on( 'mousemove', '.progress-chunk-hover', function( e ) {
1757
- var mX = e.pageX;
1758
- var offset = $( '.progress-bar-wrapper' ).offset();
1759
- var label_offset = $( '.progress-label' ).outerWidth() / 2;
1760
- mX = ( mX - offset.left ) - label_offset;
1761
- $( '.progress-label' ).css( 'left', mX + 'px' );
1762
- $( '.progress-label' ).html( $( this ).attr( 'data-table' ) );
1763
- } );
1764
-
1765
- // show / hide progress lavel on hover
1766
- $( 'body' ).on( 'mouseenter mouseleave', '.progress-chunk-hover', function( event ) {
1767
- if ( 'mouseenter' === event.type ) {
1768
- $( '.progress-label' ).addClass( 'label-visible' );
1769
- } else {
1770
- $( '.progress-label' ).removeClass( 'label-visible' );
1771
- }
1772
- } );
1773
-
1774
- // save file (export) / push / pull special conditions
1775
- function move_connection_info_box() {
1776
- $( '.connection-status' ).hide();
1777
- $( '.prefix-notice' ).hide();
1778
- $( '.ssl-notice' ).hide();
1779
- $( '.different-plugin-version-notice' ).hide();
1780
- $( '.step-two' ).show();
1781
- $( '.backup-options' ).show();
1782
- $( '.keep-active-plugins' ).show();
1783
- $( '.directory-permission-notice' ).hide();
1784
- $( '#create-backup' ).removeAttr( 'disabled' );
1785
- $( '#create-backup-label' ).removeClass( 'disabled' );
1786
- $( '.backup-option-disabled' ).hide();
1787
- $( '.compatibility-older-mysql' ).hide();
1788
- $( '.pause-before-finalize' ).show();
1789
- var connection_info = $.trim( $( '.pull-push-connection-info' ).val() ).split( '\n' );
1790
- var profile_name;
1791
- wpmdb_toggle_migration_action_text();
1792
- if ( 'pull' === wpmdb_migration_type() ) {
1793
- $( '.pull-list li' ).append( $connection_info_box );
1794
- $connection_info_box.show( function() {
1795
- var connection_textarea = $( this ).find( '.pull-push-connection-info' );
1796
- if ( !connection_textarea.val() ) {
1797
- connection_textarea.focus();
1798
- }
1799
- } );
1800
- if ( connection_established ) {
1801
- $( '.connection-status' ).hide();
1802
- $( '.step-two' ).show();
1803
- $( '.table-prefix' ).html( wpmdb.common.connection_data.prefix );
1804
- $( '.uploads-dir' ).html( wpmdb_data.this_uploads_dir );
1805
- if ( false === profile_name_edited ) {
1806
- profile_name = get_domain_name( wpmdb.common.connection_data.url );
1807
- $( '.create-new-profile' ).val( profile_name );
1808
- }
1809
- if ( true === show_prefix_notice ) {
1810
- $( '.prefix-notice.pull' ).show();
1811
- }
1812
- if ( true === show_ssl_notice ) {
1813
- $( '.ssl-notice' ).show();
1814
- }
1815
- if ( true === show_version_notice ) {
1816
- $( '.different-plugin-version-notice' ).show();
1817
- $( '.step-two' ).hide();
1818
- }
1819
- wpmdb_toggle_migration_action_text();
1820
- if ( false === wpmdb_data.write_permission ) {
1821
- $( '#create-backup' ).prop( 'checked', false );
1822
- $( '#create-backup' ).attr( 'disabled', 'disabled' );
1823
- $( '#create-backup-label' ).addClass( 'disabled' );
1824
- $( '.backup-option-disabled' ).show();
1825
- $( '.upload-directory-location' ).html( wpmdb_data.this_upload_dir_long );
1826
- }
1827
- } else {
1828
- $( '.connection-status' ).show();
1829
- $( '.step-two' ).hide();
1830
- }
1831
- } else if ( 'push' === wpmdb_migration_type() ) {
1832
- $( '.push-list li' ).append( $connection_info_box );
1833
- $connection_info_box.show( function() {
1834
- var connection_textarea = $( this ).find( '.pull-push-connection-info' );
1835
- if ( !connection_textarea.val() ) {
1836
- connection_textarea.focus();
1837
- }
1838
- } );
1839
- if ( connection_established ) {
1840
- $( '.connection-status' ).hide();
1841
- $( '.step-two' ).show();
1842
- $( '.table-prefix' ).html( wpmdb_data.this_prefix );
1843
- $( '.uploads-dir' ).html( wpmdb.common.connection_data.uploads_dir );
1844
- if ( false === profile_name_edited ) {
1845
- profile_name = get_domain_name( wpmdb.common.connection_data.url );
1846
- $( '.create-new-profile' ).val( profile_name );
1847
- }
1848
- if ( true === show_prefix_notice ) {
1849
- $( '.prefix-notice.push' ).show();
1850
- }
1851
- if ( true === show_ssl_notice ) {
1852
- $( '.ssl-notice' ).show();
1853
- }
1854
- if ( true === show_version_notice ) {
1855
- $( '.different-plugin-version-notice' ).show();
1856
- $( '.step-two' ).hide();
1857
- }
1858
- wpmdb_toggle_migration_action_text();
1859
- if ( '0' === wpmdb.common.connection_data.write_permissions ) {
1860
- $( '#create-backup' ).prop( 'checked', false );
1861
- $( '#create-backup' ).attr( 'disabled', 'disabled' );
1862
- $( '#create-backup-label' ).addClass( 'disabled' );
1863
- $( '.backup-option-disabled' ).show();
1864
- $( '.upload-directory-location' ).html( wpmdb.common.connection_data.upload_dir_long );
1865
- }
1866
- } else {
1867
- $( '.connection-status' ).show();
1868
- $( '.step-two' ).hide();
1869
- }
1870
- } else if ( 'savefile' === wpmdb_migration_type() ) {
1871
- $( '.connection-status' ).hide();
1872
- $( '.step-two' ).show();
1873
- $( '.table-prefix' ).html( wpmdb_data.this_prefix );
1874
- $( '.compatibility-older-mysql' ).show();
1875
- if ( false === profile_name_edited ) {
1876
- $( '.create-new-profile' ).val( '' );
1877
- }
1878
- $( '.backup-options' ).hide();
1879
- $( '.keep-active-plugins' ).hide();
1880
- $( '.pause-before-finalize' ).hide();
1881
- if ( false === wpmdb_data.write_permission ) {
1882
- $( '.directory-permission-notice' ).show();
1883
- $( '.step-two' ).hide();
1884
- }
1885
- }
1886
- maybe_show_mixed_cased_table_name_warning();
1887
- $.wpmdb.do_action( 'move_connection_info_box', {
1888
- 'migration_type': wpmdb_migration_type(),
1889
- 'last_migration_type': last_replace_switch
1890
- } );
1891
- }
1892
-
1893
- // move around textarea depending on whether or not the push/pull options are selected
1894
- var $connection_info_box = $( '.connection-info-wrapper' );
1895
- move_connection_info_box();
1896
-
1897
- $( '.migrate-selection.option-group input[type=radio]' ).change( function() {
1898
- move_connection_info_box();
1899
- if ( connection_established ) {
1900
- change_replace_values();
1901
- }
1902
- wpmdb.functions.update_migrate_button_text();
1903
- } );
1904
-
1905
- function change_replace_values() {
1906
- var old_url = null;
1907
- var old_path = null;
1908
- 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 ) {
1909
- old_url = remove_protocol( wpmdb.common.previous_connection_data.url );
1910
- old_path = wpmdb.common.previous_connection_data.path;
1911
- }
1912
-
1913
- if ( 'push' === wpmdb_migration_type() || 'savefile' === wpmdb_migration_type() ) {
1914
- if ( 'pull' === last_replace_switch ) {
1915
- $( '.replace-row' ).each( function() {
1916
- var old_val = $( '.old-replace-col input', this ).val();
1917
- $( '.old-replace-col input', this ).val( $( '.replace-right-col input', this ).val() );
1918
- $( '.replace-right-col input', this ).val( old_val );
1919
- } );
1920
- } else if ( 'push' === last_replace_switch && 'push' === wpmdb_migration_type() && null !== old_url && null !== old_path ) {
1921
- $( '.replace-row' ).each( function() {
1922
- var old_val = $( '.replace-right-col input', this ).val();
1923
- if ( old_val === old_path ) {
1924
- $( '.replace-right-col input', this ).val( wpmdb.common.connection_data.path );
1925
- }
1926
- if ( old_val === old_url ) {
1927
- $( '.replace-right-col input', this ).val( remove_protocol( wpmdb.common.connection_data.url ) );
1928
- }
1929
- } );
1930
- }
1931
- $.wpmdb.do_action( 'wpmdb_update_push_table_select' );
1932
- $( '#select-post-types' ).remove();
1933
- $( '.select-post-types-wrap' ).prepend( $push_post_type_select );
1934
- $( '#select-backup' ).remove();
1935
- $( '.backup-tables-wrap' ).prepend( $push_select_backup );
1936
- } else if ( 'pull' === wpmdb_migration_type() ) {
1937
- if ( '' === last_replace_switch || 'push' === last_replace_switch || 'savefile' === last_replace_switch ) {
1938
- $( '.replace-row' ).each( function() {
1939
- var old_val = $( '.old-replace-col input', this ).val();
1940
- $( '.old-replace-col input', this ).val( $( '.replace-right-col input', this ).val() );
1941
- $( '.replace-right-col input', this ).val( old_val );
1942
- } );
1943
- } else if ( 'pull' === last_replace_switch && 'pull' === wpmdb_migration_type() && null !== old_url && null !== old_path ) {
1944
- $( '.replace-row' ).each( function() {
1945
- var old_val = $( '.old-replace-col input', this ).val();
1946
- if ( old_val === old_path ) {
1947
- $( '.old-replace-col input', this ).val( wpmdb.common.connection_data.path );
1948
- }
1949
- if ( old_val === old_url ) {
1950
- $( '.old-replace-col input', this ).val( remove_protocol( wpmdb.common.connection_data.url ) );
1951
- }
1952
- } );
1953
- }
1954
- $.wpmdb.do_action( 'wpmdb_update_pull_table_select' );
1955
- $( '#select-post-types' ).remove();
1956
- $( '.select-post-types-wrap' ).prepend( $pull_post_type_select );
1957
- $( '#select-backup' ).remove();
1958
- $( '.backup-tables-wrap' ).prepend( $pull_select_backup );
1959
- }
1960
- last_replace_switch = wpmdb_migration_type();
1961
- }
1962
-
1963
- // hide second section if pull or push is selected with no connection established
1964
- if ( ( 'pull' === wpmdb_migration_type() || 'push' === wpmdb_migration_type() ) && !connection_established ) {
1965
- $( '.step-two' ).hide();
1966
- $( '.connection-status' ).show();
1967
- }
1968
-
1969
- // show / hide GUID helper description
1970
- $( '.general-helper' ).click( function( e ) {
1971
- e.preventDefault();
1972
- var icon = $( this ),
1973
- bubble = $( this ).next();
1974
-
1975
- // Close any that are already open
1976
- $( '.helper-message' ).not( bubble ).hide();
1977
-
1978
- var position = icon.position();
1979
- if ( bubble.hasClass( 'bottom' ) ) {
1980
- bubble.css( {
1981
- 'left': ( position.left - bubble.width() / 2 ) + 'px',
1982
- 'top': ( position.top + icon.height() + 9 ) + 'px'
1983
- } );
1984
- } else {
1985
- bubble.css( {
1986
- 'left': ( position.left + icon.width() + 9 ) + 'px',
1987
- 'top': ( position.top + icon.height() / 2 - 18 ) + 'px'
1988
- } );
1989
- }
1990
-
1991
- bubble.toggle();
1992
- e.stopPropagation();
1993
- } );
1994
-
1995
- $( 'body' ).click( function() {
1996
- $( '.helper-message' ).hide();
1997
- } );
1998
-
1999
- $( '.helper-message' ).click( function( e ) {
2000
- e.stopPropagation();
2001
- } );
2002
-
2003
- $( 'body' ).on( 'click', '.show-errors-toggle', function( e ) {
2004
- e.preventDefault();
2005
- $( this ).next( '.migration-php-errors' ).toggle();
2006
- } );
2007
-
2008
- /**
2009
- * Core plugin wrapper for the common AJAX error detecting method
2010
- *
2011
- * @param text
2012
- * @param code
2013
- * @param jqXHR
2014
- *
2015
- * @returns {string}
2016
- */
2017
- function getAjaxErrors( text, code, jqXHR ) {
2018
- return wpmdbGetAjaxErrors( wpmdb_strings.connection_local_server_problem, code, text, jqXHR );
2019
- }
2020
-
2021
- // migrate / settings tabs
2022
- $( '.nav-tab' ).click( function() {
2023
- var hash = $( this ).attr( 'data-div-name' );
2024
- hash = hash.replace( '-tab', '' );
2025
- window.location.hash = hash;
2026
- switch_to_plugin_tab( hash, false );
2027
- } );
2028
-
2029
- $( 'body' ).on( 'click', 'a[href^="#"]', function( event ) {
2030
- var href = $( event.target ).attr( 'href' );
2031
- var tab_name = href.substr( 1 );
2032
-
2033
- if ( tab_name ) {
2034
- var nav_tab = $( '.' + tab_name );
2035
- if ( 1 === nav_tab.length ) {
2036
- nav_tab.trigger( 'click' );
2037
- event.preventDefault();
2038
- }
2039
- }
2040
- } );
2041
-
2042
- // repeatable fields
2043
- $( 'body' ).on( 'click', '.add-row', function() {
2044
- $( this ).parents( 'tr' ).before( $( '.original-repeatable-field' ).clone().removeClass( 'original-repeatable-field' ) );
2045
- } );
2046
-
2047
- // repeatable fields
2048
- $( 'body' ).on( 'click', '.replace-remove-row', function() {
2049
- $( this ).parents( 'tr' ).remove();
2050
- if ( 2 >= $( '.replace-row' ).length ) {
2051
- $( '.no-replaces-message' ).show();
2052
- }
2053
-
2054
- var prev_id = $( this ).prev().attr( 'id' );
2055
- if ( 'new-url' === prev_id || 'new-path' === prev_id ) {
2056
- $( '#' + prev_id + '-missing-warning' ).hide();
2057
- }
2058
- } );
2059
-
2060
- // Hide New URL & New Path Warnings on change.
2061
- $( 'body' )
2062
- .on( 'change', '#new-url', function() {
2063
- $( '#new-url-missing-warning' ).hide();
2064
- } )
2065
- .on( 'change', '#new-path', function() {
2066
- $( '#new-path-missing-warning' ).hide();
2067
- } );
2068
-
2069
- // Copy Find field to associated Replace field on arrow click.
2070
- $( 'body' ).on( 'click', '.arrow-col', function() {
2071
- var replace_row_arrow = this;
2072
- var original_value = $( replace_row_arrow ).prev( 'td' ).find( 'input' ).val();
2073
- var new_value_input = $( replace_row_arrow ).next( 'td' ).find( 'input' );
2074
- new_value_input.val( original_value );
2075
-
2076
- // Hide New URL or New Path Warning if changed.
2077
- if ( 'new-url' === new_value_input.prop( 'id' ) ) {
2078
- $( '#new-url-missing-warning' ).hide();
2079
- } else if ( 'new-path' === new_value_input.prop( 'id' ) ) {
2080
- $( '#new-path-missing-warning' ).hide();
2081
- }
2082
- } );
2083
-
2084
- $( '.add-replace' ).click( function() {
2085
- $( '.replace-fields' ).prepend( $( '.original-repeatable-field' ).clone().removeClass( 'original-repeatable-field' ) );
2086
- $( '.no-replaces-message' ).hide();
2087
- } );
2088
-
2089
- $( '#find-and-replace-sort tbody' ).sortable( {
2090
- items: '> tr:not(.pin)',
2091
- handle: 'td:first',
2092
- start: function() {
2093
- $( '.sort-handle' ).css( 'cursor', '-webkit-grabbing' );
2094
- $( '.sort-handle' ).css( 'cursor', '-moz-grabbing' );
2095
- },
2096
- stop: function() {
2097
- $( '.sort-handle' ).css( 'cursor', '-webkit-grab' );
2098
- $( '.sort-handle' ).css( 'cursor', '-moz-grab' );
2099
- }
2100
- } );
2101
-
2102
- function validate_url( url ) {
2103
- 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 );
2104
- }
2105
-
2106
- function switch_to_plugin_tab( hash, skip_addons_check ) {
2107
- $( '.nav-tab' ).removeClass( 'nav-tab-active' );
2108
- $( '.nav-tab.' + hash ).addClass( 'nav-tab-active' );
2109
- $( '.content-tab' ).hide();
2110
- $( '.' + hash + '-tab' ).show();
2111
-
2112
- if ( 'settings' === hash ) {
2113
- if ( false === checked_licence && '1' === wpmdb_data.has_licence ) {
2114
- $( 'p.licence-status' ).append( 'Checking License... ' ).append( ajax_spinner );
2115
- check_licence();
2116
- }
2117
- }
2118
-
2119
- if ( 'help' === hash ) {
2120
- refresh_debug_log();
2121
- if ( false === checked_licence && '1' === wpmdb_data.has_licence ) {
2122
- $( '.support-content p' ).append( ajax_spinner );
2123
- check_licence();
2124
- }
2125
- }
2126
-
2127
- if ( 'addons' === hash && true !== skip_addons_check ) {
2128
- if ( false === checked_licence && '1' === wpmdb_data.has_licence ) {
2129
- $( '.addons-content p' ).append( ajax_spinner );
2130
- check_licence();
2131
- }
2132
- }
2133
- }
2134
-
2135
- var hash = '';
2136
-
2137
- // check for hash in url (settings || migrate) switch tabs accordingly
2138
- if ( window.location.hash ) {
2139
- hash = window.location.hash.substring( 1 );
2140
- switch_to_plugin_tab( hash, false );
2141
- }
2142
-
2143
- if ( '' !== get_query_var( 'install-plugin' ) ) {
2144
- hash = 'addons';
2145
- checked_licence = true;
2146
- switch_to_plugin_tab( hash, true );
2147
- }
2148
-
2149
- // process notice links clicks, eg. dismiss, reminder
2150
- $( '.notice-link' ).click( function( e ) {
2151
- e.preventDefault();
2152
- $( this ).closest( '.inline-message' ).hide();
2153
- $.ajax( {
2154
- url: ajaxurl,
2155
- type: 'POST',
2156
- dataType: 'text',
2157
- cache: false,
2158
- data: {
2159
- action: 'wpmdb_process_notice_link',
2160
- nonce: wpmdb_data.nonces.process_notice_link,
2161
- notice: $( this ).data( 'notice' ),
2162
- type: $( this ).data( 'type' ),
2163
- reminder: $( this ).data( 'reminder' )
2164
- }
2165
- } );
2166
- } );
2167
-
2168
- // regenerates the saved secret key
2169
- $( '.reset-api-key' ).click( function() {
2170
- var answer = confirm( wpmdb_strings.reset_api_key );
2171
-
2172
- if ( !answer || doing_reset_api_key_ajax ) {
2173
- return;
2174
- }
2175
-
2176
- doing_reset_api_key_ajax = true;
2177
- $( '.reset-api-key' ).after( '<img src="' + spinner_url + '" alt="" class="reset-api-key-ajax-spinner general-spinner" />' );
2178
-
2179
- $.ajax( {
2180
- url: ajaxurl,
2181
- type: 'POST',
2182
- dataType: 'text',
2183
- cache: false,
2184
- data: {
2185
- action: 'wpmdb_reset_api_key',
2186
- nonce: wpmdb_data.nonces.reset_api_key
2187
- },
2188
- error: function( jqXHR, textStatus, errorThrown ) {
2189
- alert( wpmdb_strings.reset_api_key_problem );
2190
- $( '.reset-api-key-ajax-spinner' ).remove();
2191
- doing_reset_api_key_ajax = false;
2192
- },
2193
- success: function( data ) {
2194
- $( '.reset-api-key-ajax-spinner' ).remove();
2195
- doing_reset_api_key_ajax = false;
2196
- $( '.connection-info' ).html( data );
2197
- wpmdb_data.connection_info = $.trim( data ).split( '\n' );
2198
- }
2199
- } );
2200
-
2201
- } );
2202
-
2203
- // show / hide table select box when specific settings change
2204
- $( 'input.multiselect-toggle' ).change( function() {
2205
- $( this ).parents( '.expandable-content' ).children( '.select-wrap' ).toggle();
2206
- } );
2207
-
2208
- $( '.show-multiselect' ).each( function() {
2209
- if ( $( this ).is( ':checked' ) ) {
2210
- $( this ).parents( '.option-section' ).children( '.header-expand-collapse' ).children( '.expand-collapse-arrow' ).removeClass( 'collapsed' );
2211
- $( this ).parents( '.expandable-content' ).show();
2212
- $( this ).parents( '.expandable-content' ).children( '.select-wrap' ).toggle();
2213
- }
2214
- } );
2215
-
2216
- $( 'input[name=backup_option]' ).change( function() {
2217
- $( '.backup-tables-wrap' ).hide();
2218
- if ( 'backup_manual_select' === $( this ).val() ) {
2219
- $( '.backup-tables-wrap' ).show();
2220
- }
2221
- } );
2222
-
2223
- if ( $( '#backup-manual-select' ).is( ':checked' ) ) {
2224
- $( '.backup-tables-wrap' ).show();
2225
- }
2226
-
2227
- $( '.plugin-compatibility-save' ).click( function() {
2228
- if ( doing_plugin_compatibility_ajax ) {
2229
- return;
2230
- }
2231
- $( this ).addClass( 'disabled' );
2232
- var select_element = $( '#selected-plugins' );
2233
- $( select_element ).attr( 'disabled', 'disabled' );
2234
-
2235
- doing_plugin_compatibility_ajax = true;
2236
- $( this ).after( '<img src="' + spinner_url + '" alt="" class="plugin-compatibility-spinner general-spinner" />' );
2237
-
2238
- $.ajax( {
2239
- url: ajaxurl,
2240
- type: 'POST',
2241
- dataType: 'text',
2242
- cache: false,
2243
- data: {
2244
- action: 'wpmdb_blacklist_plugins',
2245
- blacklist_plugins: $( select_element ).val()
2246
- },
2247
- error: function( jqXHR, textStatus, errorThrown ) {
2248
- 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 );
2249
- $( select_element ).removeAttr( 'disabled' );
2250
- $( '.plugin-compatibility-save' ).removeClass( 'disabled' );
2251
- doing_plugin_compatibility_ajax = false;
2252
- $( '.plugin-compatibility-spinner' ).remove();
2253
- $( '.plugin-compatibility-success-msg' ).show().fadeOut( 2000 );
2254
- },
2255
- success: function( data ) {
2256
- if ( '' !== $.trim( data ) ) {
2257
- alert( data );
2258
- }
2259
- $( select_element ).removeAttr( 'disabled' );
2260
- $( '.plugin-compatibility-save' ).removeClass( 'disabled' );
2261
- doing_plugin_compatibility_ajax = false;
2262
- $( '.plugin-compatibility-spinner' ).remove();
2263
- $( '.plugin-compatibility-success-msg' ).show().fadeOut( 2000 );
2264
- }
2265
- } );
2266
- } );
2267
-
2268
- // delete a profile from the migrate form area
2269
- $( 'body' ).on( 'click', '.delete-profile', function() {
2270
- var name = $( this ).next().clone();
2271
- $( 'input', name ).remove();
2272
- name = $.trim( $( name ).html() );
2273
- var answer = confirm( wpmdb_strings.remove_profile.replace( '{{profile}}', name ) );
2274
-
2275
- if ( !answer ) {
2276
- return;
2277
- }
2278
- var $profile_li = $( this ).parent();
2279
-
2280
- if ( $profile_li.find( 'input:checked' ).length ) {
2281
- var $new_profile_li = $profile_li.siblings().last();
2282
- $new_profile_li.find( 'input[type=radio]' ).prop( 'checked', 'checked' );
2283
- $new_profile_li.find( 'input[type=text]' ).focus();
2284
- $( '#migrate-form .crumbs .crumb:last' ).text( 'New Profile' );
2285
-
2286
- if ( 'function' === typeof window.history.pushState ) {
2287
- var updatedURL = window.location.href.replace( '#migrate', '' ).replace( /&wpmdb-profile=-?\d+/, '' ) + '&wpmdb-profile=-1';
2288
- window.history.pushState( { updated_profile_id: -1 }, null, updatedURL );
2289
- }
2290
- }
2291
-
2292
- $profile_li.fadeOut( 500 );
2293
-
2294
- $.ajax( {
2295
- url: ajaxurl,
2296
- type: 'POST',
2297
- dataType: 'text',
2298
- cache: false,
2299
- data: {
2300
- action: 'wpmdb_delete_migration_profile',
2301
- profile_id: $( this ).attr( 'data-profile-id' ),
2302
- nonce: wpmdb_data.nonces.delete_migration_profile
2303
- },
2304
- error: function( jqXHR, textStatus, errorThrown ) {
2305
- alert( wpmdb_strings.remove_profile_problem );
2306
- },
2307
- success: function( data ) {
2308
- if ( '-1' === data ) {
2309
- alert( wpmdb_strings.remove_profile_not_found );
2310
- }
2311
- }
2312
- } );
2313
-
2314
- } );
2315
-
2316
- // deletes a profile from the main profile selection screen
2317
- $( '.main-list-delete-profile-link' ).click( function() {
2318
- var name = $( this ).prev().html();
2319
- var answer = confirm( wpmdb_strings.remove_profile.replace( '{{profile}}', name ) );
2320
-
2321
- if ( !answer ) {
2322
- return;
2323
- }
2324
-
2325
- $( this ).parent().fadeOut( 500 );
2326
-
2327
- $.ajax( {
2328
- url: ajaxurl,
2329
- type: 'POST',
2330
- dataType: 'text',
2331
- cache: false,
2332
- data: {
2333
- action: 'wpmdb_delete_migration_profile',
2334
- profile_id: $( this ).attr( 'data-profile-id' ),
2335
- nonce: wpmdb_data.nonces.delete_migration_profile
2336
- },
2337
- error: function( jqXHR, textStatus, errorThrown ) {
2338
- alert( wpmdb_strings.remove_profile_problem );
2339
- }
2340
- } );
2341
-
2342
- } );
2343
-
2344
- // warn the user when editing the connection info after a connection has been established
2345
- $( 'body' ).on( 'click', '.temp-disabled', function() {
2346
- var answer = confirm( wpmdb_strings.change_connection_info );
2347
-
2348
- if ( !answer ) {
2349
- return;
2350
- } else {
2351
- $( '.ssl-notice' ).hide();
2352
- $( '.different-plugin-version-notice' ).hide();
2353
- $( '.migrate-db-button' ).show();
2354
- $( '.temp-disabled' ).removeAttr( 'readonly' );
2355
- $( '.temp-disabled' ).removeClass( 'temp-disabled' );
2356
- $( '.connect-button' ).show();
2357
- $( '.step-two' ).hide();
2358
- $( '.connection-status' ).show().html( wpmdb_strings.enter_connection_info );
2359
- connection_established = false;
2360
- }
2361
- } );
2362
-
2363
- // ajax request for settings page when checking/unchecking setting radio buttons
2364
- $( '.settings-tab input[type=checkbox]' ).change( function() {
2365
- if ( 'plugin-compatibility' === $( this ).attr( 'id' ) ) {
2366
- return;
2367
- }
2368
- var checked = $( this ).is( ':checked' );
2369
- var setting = $( this ).attr( 'id' );
2370
-
2371
- $( this ).parent().append( ajax_spinner );
2372
- var $label = $( this ).parent();
2373
-
2374
- $.ajax( {
2375
- url: ajaxurl,
2376
- type: 'POST',
2377
- dataType: 'text',
2378
- cache: false,
2379
- data: {
2380
- action: 'wpmdb_save_setting',
2381
- checked: checked,
2382
- setting: setting,
2383
- nonce: wpmdb_data.nonces.save_setting
2384
- },
2385
- error: function( jqXHR, textStatus, errorThrown ) {
2386
- alert( wpmdb_strings.save_settings_problem );
2387
- $( '.ajax-spinner' ).remove();
2388
- },
2389
- success: function( data ) {
2390
- $( '.ajax-spinner' ).remove();
2391
- $( $label ).append( '<span class="ajax-success-msg">' + wpmdb_strings.saved + '</span>' );
2392
- $( '.ajax-success-msg' ).fadeOut( 2000, function() {
2393
- $( this ).remove();
2394
- } );
2395
- }
2396
- } );
2397
-
2398
- } );
2399
-
2400
- // disable form submissions
2401
- $( '.migrate-form' ).submit( function( e ) {
2402
- e.preventDefault();
2403
- } );
2404
-
2405
- // fire connection_box_changed when the connect button is pressed
2406
- $( '.connect-button' ).click( function( event ) {
2407
- event.preventDefault();
2408
- $( this ).blur();
2409
- connection_box_changed();
2410
- } );
2411
-
2412
- // send paste even to connection_box_changed() function
2413
- $( '.pull-push-connection-info' ).bind( 'paste', function( e ) {
2414
- var $this = this;
2415
- setTimeout( function() {
2416
- connection_box_changed();
2417
- }, 0 );
2418
-
2419
- } );
2420
-
2421
- $( 'body' ).on( 'click', '.try-again', function() {
2422
- connection_box_changed();
2423
- } );
2424
-
2425
- $( 'body' ).on( 'click', '.try-http', function() {
2426
- var connection_info = $.trim( $( '.pull-push-connection-info' ).val() ).split( '\n' );
2427
- var new_url = connection_info[ 0 ].replace( 'https', 'http' );
2428
- var new_contents = new_url + '\n' + connection_info[ 1 ];
2429
- $( '.pull-push-connection-info' ).val( new_contents );
2430
- connection_box_changed();
2431
- } );
2432
-
2433
- $( '.create-new-profile' ).change( function() {
2434
- profile_name_edited = true;
2435
- } );
2436
-
2437
- $( 'body' ).on( 'click', '.temporarily-disable-ssl', function() {
2438
- var hash = '';
2439
- if ( window.location.hash ) {
2440
- hash = window.location.hash.substring( 1 );
2441
- }
2442
- $( this ).attr( 'href', $( this ).attr( 'href' ) + '&hash=' + hash );
2443
- } );
2444
-
2445
- // fired when the connection info box changes (e.g. gets pasted into)
2446
- function connection_box_changed( data ) {
2447
- var $this = $( '.pull-push-connection-info' );
2448
-
2449
- if ( doing_ajax || $( $this ).hasClass( 'temp-disabled' ) ) {
2450
- return;
2451
- }
2452
-
2453
- data = $( '.pull-push-connection-info' ).val();
2454
-
2455
- var connection_info = $.trim( data ).split( '\n' );
2456
- var error = false;
2457
- var error_message = '';
2458
-
2459
- if ( '' === connection_info ) {
2460
- error = true;
2461
- error_message = wpmdb_strings.connection_info_missing;
2462
- }
2463
-
2464
- if ( 2 !== connection_info.length && !error ) {
2465
- error = true;
2466
- error_message = wpmdb_strings.connection_info_incorrect;
2467
- }
2468
-
2469
- if ( !error && !validate_url( connection_info[ 0 ] ) ) {
2470
- error = true;
2471
- error_message = wpmdb_strings.connection_info_url_invalid;
2472
- }
2473
-
2474
- if ( !error && 32 >= connection_info[ 1 ].length ) {
2475
- error = true;
2476
- error_message = wpmdb_strings.connection_info_key_invalid;
2477
- }
2478
-
2479
- if ( !error && connection_info[ 0 ] === wpmdb_data.connection_info[ 0 ] ) {
2480
- error = true;
2481
- error_message = wpmdb_strings.connection_info_local_url;
2482
- }
2483
-
2484
- if ( !error && connection_info[ 1 ] === wpmdb_data.connection_info[ 1 ] ) {
2485
- error = true;
2486
- error_message = wpmdb_strings.connection_info_local_key;
2487
- }
2488
-
2489
- if ( error ) {
2490
- $( '.connection-status' ).html( error_message );
2491
- $( '.connection-status' ).addClass( 'notification-message error-notice migration-error' );
2492
- return;
2493
- }
2494
-
2495
- var new_connection_info_contents = connection_info[ 0 ] + '\n' + connection_info[ 1 ];
2496
-
2497
- if ( false === wpmdb_data.openssl_available ) {
2498
- connection_info[ 0 ] = connection_info[ 0 ].replace( 'https://', 'http://' );
2499
- new_connection_info_contents = connection_info[ 0 ] + '\n' + connection_info[ 1 ];
2500
- $( '.pull-push-connection-info' ).val( new_connection_info_contents );
2501
- }
2502
-
2503
- show_prefix_notice = false;
2504
- doing_ajax = true;
2505
- disable_export_type_controls();
2506
-
2507
- if ( $( '.basic-access-auth-wrapper' ).is( ':visible' ) ) {
2508
- connection_info[ 0 ] = connection_info[ 0 ].replace( /\/\/(.*)@/, '//' );
2509
- connection_info[ 0 ] = connection_info[ 0 ].replace( '//', '//' + encodeURIComponent( $.trim( $( '.auth-username' ).val() ) ) + ':' + encodeURIComponent( $.trim( $( '.auth-password' ).val() ) ) + '@' );
2510
- new_connection_info_contents = connection_info[ 0 ] + '\n' + connection_info[ 1 ];
2511
- $( '.pull-push-connection-info' ).val( new_connection_info_contents );
2512
- $( '.basic-access-auth-wrapper' ).hide();
2513
- }
2514
-
2515
- $( '.step-two' ).hide();
2516
- $( '.ssl-notice' ).hide();
2517
- $( '.prefix-notice' ).hide();
2518
- $( '.connection-status' ).show();
2519
-
2520
- $( '.connection-status' ).html( wpmdb_strings.establishing_remote_connection );
2521
- $( '.connection-status' ).removeClass( 'notification-message error-notice migration-error' );
2522
- $( '.connection-status' ).append( ajax_spinner );
2523
-
2524
- var intent = wpmdb_migration_type();
2525
-
2526
- profile_name_edited = false;
2527
-
2528
- $.ajax( {
2529
- url: ajaxurl,
2530
- type: 'POST',
2531
- dataType: 'json',
2532
- cache: false,
2533
- data: {
2534
- action: 'wpmdb_verify_connection_to_remote_site',
2535
- url: connection_info[ 0 ],
2536
- key: connection_info[ 1 ],
2537
- intent: intent,
2538
- nonce: wpmdb_data.nonces.verify_connection_to_remote_site
2539
- },
2540
- error: function( jqXHR, textStatus, errorThrown ) {
2541
- $( '.connection-status' ).html( getAjaxErrors( jqXHR.responseText, '(#100)', jqXHR ) );
2542
- $( '.connection-status' ).addClass( 'notification-message error-notice migration-error' );
2543
- $( '.ajax-spinner' ).remove();
2544
- doing_ajax = false;
2545
- enable_export_type_controls();
2546
- },
2547
- success: function( data ) {
2548
- $( '.ajax-spinner' ).remove();
2549
- doing_ajax = false;
2550
- enable_export_type_controls();
2551
- maybe_show_ssl_warning( connection_info[ 0 ], connection_info[ 1 ], data.scheme );
2552
-
2553
- if ( 'undefined' !== typeof data.wpmdb_error && 1 === data.wpmdb_error ) {
2554
- $( '.connection-status' ).html( data.body );
2555
- $( '.connection-status' ).addClass( 'notification-message error-notice migration-error' );
2556
-
2557
- if ( data.body.indexOf( '401 Unauthorized' ) > -1 ) {
2558
- $( '.basic-access-auth-wrapper' ).show();
2559
- }
2560
-
2561
- return;
2562
- }
2563
-
2564
- var profile_name = get_domain_name( data.url );
2565
- $( '.create-new-profile' ).val( profile_name );
2566
-
2567
- $( '.pull-push-connection-info' ).addClass( 'temp-disabled' );
2568
- $( '.pull-push-connection-info' ).attr( 'readonly', 'readonly' );
2569
- $( '.connect-button' ).hide();
2570
-
2571
- $( '.connection-status' ).hide();
2572
- $( '.step-two' ).show();
2573
-
2574
- maybe_show_prefix_notice( data.prefix );
2575
-
2576
- connection_established = true;
2577
- wpmdb.common.previous_connection_data = wpmdb.common.connection_data;
2578
- wpmdb.common.connection_data = data;
2579
- move_connection_info_box();
2580
- change_replace_values();
2581
-
2582
- maybe_show_mixed_cased_table_name_warning();
2583
-
2584
- refresh_table_selects();
2585
-
2586
- $push_select_backup = $( $pull_select ).clone();
2587
- $( $push_select_backup ).attr( {
2588
- name: 'select_backup[]',
2589
- id: 'select-backup'
2590
- } );
2591
-
2592
- var $post_type_select = document.createElement( 'select' );
2593
- $( $post_type_select ).attr( {
2594
- multiple: 'multiple',
2595
- name: 'select_post_types[]',
2596
- id: 'select-post-types',
2597
- class: 'multiselect'
2598
- } );
2599
-
2600
- $.each( wpmdb.common.connection_data.post_types, function( index, value ) {
2601
- $( $post_type_select ).append( '<option value="' + value + '">' + value + '</option>' );
2602
- } );
2603
-
2604
- $pull_post_type_select = $post_type_select;
2605
-
2606
- $( '#new-path-missing-warning, #new-url-missing-warning' ).hide();
2607
-
2608
- if ( 'pull' === wpmdb_migration_type() ) {
2609
- $( '#new-url' ).val( remove_protocol( wpmdb_data.this_url ) );
2610
- $( '#new-path' ).val( wpmdb_data.this_path );
2611
- if ( 'true' === wpmdb_data.is_multisite ) {
2612
- $( '#new-domain' ).val( wpmdb_data.this_domain );
2613
- $( '.replace-row.pin .old-replace-col input[type="text"]' ).val( remove_protocol( data.url ) );
2614
- }
2615
- $( '#old-url' ).val( remove_protocol( data.url ) );
2616
- $( '#old-path' ).val( data.path );
2617
- $.wpmdb.do_action( 'wpmdb_update_pull_table_select' );
2618
- $( '#select-post-types' ).remove();
2619
- $( '.select-post-types-wrap' ).prepend( $pull_post_type_select );
2620
- $( '.table-prefix' ).html( data.prefix );
2621
- $( '.uploads-dir' ).html( wpmdb_data.this_uploads_dir );
2622
- } else {
2623
- $( '#new-url' ).val( remove_protocol( data.url ) );
2624
- $( '#new-path' ).val( data.path );
2625
- if ( 'true' === wpmdb_data.is_multisite ) {
2626
- $( '.replace-row.pin .old-replace-col input[type="text"]' ).val( remove_protocol( wpmdb_data.this_url ) );
2627
- }
2628
- $.wpmdb.do_action( 'wpmdb_update_push_table_select' );
2629
- $( '#select-backup' ).remove();
2630
- $( '.backup-tables-wrap' ).prepend( $push_select_backup );
2631
- }
2632
-
2633
- wpmdb.common.next_step_in_migration = {
2634
- fn: $.wpmdb.do_action,
2635
- args: [ 'verify_connection_to_remote_site', wpmdb.common.connection_data ]
2636
- };
2637
- wpmdb.functions.execute_next_step();
2638
- }
2639
-
2640
- } );
2641
-
2642
- }
2643
-
2644
- // Sets the initial Pause/Resume button event to Pause
2645
- $( 'body' ).on( 'click', '.pause-resume', function( event ) {
2646
- set_pause_resume_button( event );
2647
- } );
2648
-
2649
- function cancel_migration( event ) {
2650
- migration_cancelled = true;
2651
- $( '.progress-text' ).html( wpmdb_strings.completing_current_request );
2652
- $( '.progress-title' ).html( wpmdb_strings.cancelling_migration );
2653
- $( '.migration-controls' ).fadeOut();
2654
- $( '.migration-progress-ajax-spinner' ).show();
2655
-
2656
- if ( true === migration_paused ) {
2657
- migration_paused = false;
2658
- wpmdb.functions.execute_next_step();
2659
- }
2660
- }
2661
-
2662
- $( 'body' ).on( 'click', '.cancel', function( event ) {
2663
- cancel_migration( event );
2664
- } );
2665
-
2666
- $( '.enter-licence' ).click( function() {
2667
- $( '.settings' ).click();
2668
- $( '.licence-input' ).focus();
2669
- } );
2670
-
2671
- wpmdb.functions.execute_next_step = function() {
2672
-
2673
- // if delay is set, set a timeout for delay to recall this function, then return
2674
- if ( 0 < delay_between_requests && false === flag_skip_delay ) {
2675
- setTimeout( function() {
2676
- flag_skip_delay = true;
2677
- wpmdb.functions.execute_next_step();
2678
- }, delay_between_requests );
2679
- return;
2680
- } else {
2681
- flag_skip_delay = false;
2682
- }
2683
-
2684
- if ( true === migration_paused ) {
2685
- $( '.migration-progress-ajax-spinner' ).hide();
2686
-
2687
- // Pause the timer
2688
- clearInterval( elapsed_interval );
2689
-
2690
- if ( true === is_auto_pause_before_finalize ) {
2691
- $( '.progress-text' ).html( wpmdb_strings.paused_before_finalize );
2692
- is_auto_pause_before_finalize = false;
2693
- } else {
2694
- $( '.progress-text' ).html( wpmdb_strings.paused );
2695
- }
2696
-
2697
- // Re-bind Pause/Resume button to Resume when we are finally Paused
2698
- $( 'body' ).on( 'click', '.pause-resume', function( event ) {
2699
- set_pause_resume_button( event );
2700
- } );
2701
- $( 'body' ).on( 'click', '.cancel', function( event ) {
2702
- cancel_migration( event );
2703
- } );
2704
- $( '.pause-resume' ).html( wpmdb_strings.resume );
2705
- return;
2706
- } else if ( true === migration_cancelled ) {
2707
- migration_intent = wpmdb_migration_type();
2708
-
2709
- var progress_msg;
2710
-
2711
- if ( 'savefile' === migration_intent ) {
2712
- progress_msg = wpmdb_strings.removing_local_sql;
2713
- } else if ( 'pull' === migration_intent ) {
2714
- if ( 'backup' === stage ) {
2715
- progress_msg = wpmdb_strings.removing_local_backup;
2716
- } else {
2717
- progress_msg = wpmdb_strings.removing_local_temp_tables;
2718
- }
2719
- } else if ( 'push' === migration_intent ) {
2720
- if ( 'backup' === stage ) {
2721
- progress_msg = wpmdb_strings.removing_remote_sql;
2722
- } else {
2723
- progress_msg = wpmdb_strings.removing_remote_temp_tables;
2724
- }
2725
- }
2726
- $( '.progress-text' ).html( progress_msg );
2727
-
2728
- var request_data = {
2729
- action: 'wpmdb_cancel_migration',
2730
- migration_state_id: wpmdb.migration_state_id
2731
- };
2732
-
2733
- doing_ajax = true;
2734
-
2735
- $.ajax( {
2736
- url: ajaxurl,
2737
- type: 'POST',
2738
- dataType: 'text',
2739
- cache: false,
2740
- data: request_data,
2741
- error: function( jqXHR, textStatus, errorThrown ) {
2742
- $( '.progress-title' ).html( wpmdb_strings.migration_cancellation_failed );
2743
- $( '.progress-text' ).html( wpmdb_strings.manually_remove_temp_files );
2744
- $( '.progress-text' ).append( '<br /><br />' + wpmdb_strings.status + ': ' + jqXHR.status + ' ' + jqXHR.statusText + '<br /><br />' + wpmdb_strings.response + ':<br />' + jqXHR.responseText );
2745
- $( '.progress-text' ).addClass( 'migration-error' );
2746
- console.log( jqXHR );
2747
- console.log( textStatus );
2748
- console.log( errorThrown );
2749
- doing_ajax = false;
2750
- wpmdb.common.migration_error = true;
2751
- wpmdb.functions.migration_complete_events();
2752
- return;
2753
- },
2754
- success: function( data ) {
2755
- doing_ajax = false;
2756
- data = $.trim( data );
2757
- if ( ( 'push' === migration_intent && '1' !== data ) || ( 'push' !== migration_intent && '' !== data ) ) {
2758
- $( '.progress-title' ).html( wpmdb_strings.migration_cancellation_failed );
2759
- $( '.progress-text' ).html( data );
2760
- $( '.progress-text' ).addClass( 'migration-error' );
2761
- wpmdb.common.migration_error = true;
2762
- wpmdb.functions.migration_complete_events();
2763
- return;
2764
- }
2765
- completed_msg = wpmdb_strings.migration_cancelled;
2766
- $( '.progress-text' ).hide();
2767
- wpmdb.functions.migration_complete_events();
2768
- }
2769
- } );
2770
- } else {
2771
- wpmdb.common.next_step_in_migration.fn.apply( null, wpmdb.common.next_step_in_migration.args );
2772
- }
2773
- };
2774
-
2775
- $( 'body' ).on( 'click', '.copy-licence-to-remote-site', function() {
2776
- $( '.connection-status' ).html( wpmdb_strings.copying_license );
2777
- $( '.connection-status' ).removeClass( 'notification-message error-notice migration-error' );
2778
- $( '.connection-status' ).append( ajax_spinner );
2779
-
2780
- var connection_info = $.trim( $( '.pull-push-connection-info' ).val() ).split( '\n' );
2781
-
2782
- doing_ajax = true;
2783
- disable_export_type_controls();
2784
-
2785
- $.ajax( {
2786
- url: ajaxurl,
2787
- type: 'POST',
2788
- dataType: 'json',
2789
- cache: false,
2790
- data: {
2791
- action: 'wpmdb_copy_licence_to_remote_site',
2792
- url: connection_info[ 0 ],
2793
- key: connection_info[ 1 ],
2794
- nonce: wpmdb_data.nonces.copy_licence_to_remote_site
2795
- },
2796
- error: function( jqXHR, textStatus, errorThrown ) {
2797
- $( '.connection-status' ).html( getAjaxErrors( jqXHR.responseText, '(#143)', jqXHR ) );
2798
- $( '.connection-status' ).addClass( 'notification-message error-notice migration-error' );
2799
- $( '.ajax-spinner' ).remove();
2800
- doing_ajax = false;
2801
- enable_export_type_controls();
2802
- },
2803
- success: function( data ) {
2804
- $( '.ajax-spinner' ).remove();
2805
- doing_ajax = false;
2806
- enable_export_type_controls();
2807
-
2808
- if ( 'undefined' !== typeof data.wpmdb_error && 1 === data.wpmdb_error ) {
2809
- $( '.connection-status' ).html( data.body );
2810
- $( '.connection-status' ).addClass( 'notification-message error-notice migration-error' );
2811
-
2812
- if ( data.body.indexOf( '401 Unauthorized' ) > -1 ) {
2813
- $( '.basic-access-auth-wrapper' ).show();
2814
- }
2815
-
2816
- return;
2817
- }
2818
- connection_box_changed();
2819
- }
2820
- } );
2821
- } );
2822
-
2823
- $( 'body' ).on( 'click', '.reactivate-licence', function( e ) {
2824
- doing_ajax = true;
2825
-
2826
- $( '.invalid-licence' ).empty().html( wpmdb_strings.attempting_to_activate_licence );
2827
- $( '.invalid-licence' ).append( ajax_spinner );
2828
-
2829
- $.ajax( {
2830
- url: ajaxurl,
2831
- type: 'POST',
2832
- dataType: 'json',
2833
- cache: false,
2834
- data: {
2835
- action: 'wpmdb_reactivate_licence',
2836
- nonce: wpmdb_data.nonces.reactivate_licence
2837
- },
2838
- error: function( jqXHR, textStatus, errorThrown ) {
2839
- $( '.invalid-licence' ).html( wpmdb_strings.activate_licence_problem );
2840
- $( '.invalid-licence' ).append( '<br /><br />' + wpmdb_strings.status + ': ' + jqXHR.status + ' ' + jqXHR.statusText + '<br /><br />' + wpmdb_strings.response + '<br />' + jqXHR.responseText );
2841
- $( '.ajax-spinner' ).remove();
2842
- doing_ajax = false;
2843
- },
2844
- success: function( data ) {
2845
- $( '.ajax-spinner' ).remove();
2846
- doing_ajax = false;
2847
-
2848
- if ( 'undefined' !== typeof data.wpmdb_error && 1 === data.wpmdb_error ) {
2849
- $( '.invalid-licence' ).html( data.body );
2850
- return;
2851
- }
2852
-
2853
- if ( 'undefined' !== typeof data.wpmdb_dbrains_api_down && 1 === data.wpmdb_dbrains_api_down ) {
2854
- $( '.invalid-licence' ).html( wpmdb_strings.temporarily_activated_licence );
2855
- $( '.invalid-licence' ).append( data.body );
2856
- return;
2857
- }
2858
-
2859
- $( '.invalid-licence' ).empty().html( wpmdb_strings.licence_reactivated );
2860
- location.reload();
2861
- }
2862
- } );
2863
-
2864
- } );
2865
-
2866
- $( 'input[name=table_migrate_option]' ).change( function() {
2867
- maybe_show_mixed_cased_table_name_warning();
2868
- $.wpmdb.do_action( 'wpmdb_tables_to_migrate_changed' );
2869
- } );
2870
-
2871
- $( 'body' ).on( 'change', '#select-tables', function() {
2872
- maybe_show_mixed_cased_table_name_warning();
2873
- $.wpmdb.do_action( 'wpmdb_tables_to_migrate_changed' );
2874
- } );
2875
-
2876
- $.wpmdb.add_filter( 'wpmdb_get_table_prefix', get_table_prefix );
2877
- $.wpmdb.add_filter( 'wpmdb_get_tables_to_migrate', get_tables_to_migrate );
2878
-
2879
- $.wpmdb.add_filter( 'wpmdb_before_migration_complete_hooks', function( hooks ) {
2880
- pause_before_finalize = $( 'input[name=pause_before_finalize]:checked' ).length ? true : false;
2881
- if ( true === pause_before_finalize && 'savefile' !== migration_intent ) {
2882
- 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
2883
- is_auto_pause_before_finalize = true;
2884
- }
2885
- return hooks;
2886
- } );
2887
- } );
2888
-
2889
- })( jQuery, wpmdb );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
asset/js/script.min.js DELETED
@@ -1,2 +0,0 @@
1
- !function(a,b){function c(a,b,c){return c=c||"0",a+="",a.length>=b?a:new Array(b-a.length+1).join(c)+a}function d(){X=0,$=a(".timer"),_=wpmdb_strings.time_elapsed+" ",A=setInterval(f,1e3)}function e(){var a=Math.floor(X/3600)%24,b=Math.floor(X/60)%60,d=X%60,e=_+c(a,2,0)+":"+c(b,2,0)+":"+c(d,2,0);$.html(e)}function f(){X+=1,e()}function g(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 h(a){a=a.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");var b=new RegExp("[\\?&]"+a+"=([^&#]*)"),c=b.exec(location.search);return null===c?"":decodeURIComponent(c[1].replace(/\+/g," "))}function i(b,c,d){var e=b.substr(0,b.indexOf(":"));return d!==e&&-1!==b.indexOf("https")?(a(".ssl-notice").show(),M=!0,b=b.replace("https","http"),void a(".pull-push-connection-info").val(b+"\n"+c)):void(M=!1)}function j(b){b!==wpmdb_data.this_prefix&&(a(".remote-prefix").html(b),L=!0,"pull"===wpmdb_migration_type()?a(".prefix-notice.pull").show():a(".prefix-notice.push").show())}function k(){if("undefined"!=typeof b.common.connection_data&&!1!==b.common.connection_data){var c=wpmdb_migration_type(),d=t(null,null);a(".mixed-case-table-name-notice").hide(),null!==d&&(d=d.join(""),d!==d.toLowerCase()&&("1"===b.common.connection_data.lower_case_table_names||"push"!==c&&"savefile"!==c)&&("1"===wpmdb_data.lower_case_table_names||"pull"!==c)&&("push"===c||"savefile"===c?a(".mixed-case-table-name-notice.push").show():a(".mixed-case-table-name-notice.pull").show()))}}function l(a){var b=a,c=b.replace(/\/\/(.*)@/,"//").replace("http://","").replace("https://","").replace("www.","");return c}function m(a,b,c){var d,e,f=l(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",f),e=e.replace("%s",f),"migrating"===c?d:e}function n(a){return a.replace(/^https?:/i,"")}function o(){a(".option-group").each(function(b){a("input",this).attr("disabled","disabled"),a("label",this).css("cursor","default")})}function p(){a(".option-group").each(function(b){a("input",this).removeAttr("disabled"),a("label",this).css("cursor","pointer")})}function q(b,c,d){a(".slider",b).slider("value",c),a(".amount",b).html(wpmdb_add_commas(c)+" "+d)}function r(c){!0===T?(T=!1,E=!0,a(".progress-title").html(U),a(".progress-text",".progress-wrapper-primary").html(V),a(".progress-text",".progress-wrapper-secondary").html(W),a(".migration-progress-ajax-spinner").show(),a(".pause-resume").html(wpmdb_strings.pause),A=setInterval(f,1e3),b.functions.execute_next_step()):(T=!0,E=!1,U=a(".progress-title").html(),V=a(".progress-text",".progress-wrapper-primary").html(),W=a(".progress-text",".progress-wrapper-secondary ").html(),a(".progress-title").html(wpmdb_strings.migration_paused),a(".progress-text").html(wpmdb_strings.completing_current_request),a("body").off("click",".pause-resume"),a("body").off("click",".cancel"))}function s(b,c,d){var e=document.createElement("select");return a(e).attr({multiple:"multiple",name:"select_tables[]",id:"select-tables","class":"multiselect"}),0<b.length&&a.each(b,function(b,f){if(!a.wpmdb.apply_filters("wpmdb_exclude_table",!1,f)){var g=" ";void 0!==d&&null!==d&&0<d.length&&-1!==a.inArray(f,d)&&(g=' selected="selected" '),a(e).append("<option"+g+'value="'+f+'">'+f+" ("+c[f]+")</option>")}}),e}function t(c,d){var e="",f=wpmdb_migration_type(),g=a("input[name=table_migrate_option]:checked").val();return e="migrate_select"===g?a("#select-tables").val():"push"===f||"savefile"===f?wpmdb_data.this_prefixed_tables:b.common.connection_data.prefixed_tables}function u(b,c){return a(".table-select-wrap .table-prefix").text()}var v,w,x,y,z,A,B,C=!1,D="",E=!1,F=!1,G=!1,H=!1,I=!1,J=!1,K=!1,L=!1,M=!1,N=!1,O=!1,P=!1,Q="",R="",S="",T=!1,U="",V="",W="",X=0,Y=0,Z=!1,$=!1,_="",aa=!1,ba=0,ca=400,da=!1,ea=!1,fa=ajaxurl.replace("/admin-ajax.php",""),ga=fa+"/images/spinner";2<window.devicePixelRatio&&(ga+="-2x"),ga+=".gif";var ha='<img src="'+ga+'" alt="" class="ajax-spinner general-spinner" />';window.onbeforeunload=function(a){return P?(a=a||window.event,a&&(a.returnValue=wpmdb_strings.sure),wpmdb_strings.sure):void 0},a(document).ready(function(){function c(b){K=!0,a.ajax({url:ajaxurl,type:"POST",dataType:"json",cache:!1,data:{action:"wpmdb_check_licence",licence:b,context:"all",nonce:wpmdb_data.nonces.check_licence},error:function(a,b,c){alert(wpmdb_strings.license_check_problem)},success:function(b){var c,d,e,f=a(".support-content"),g=a(".addons-content"),h=a(".licence-status:not(.notification-message)");if("undefined"!=typeof b.dbrains_api_down)d=b.dbrains_api_down+b.message,e=b.dbrains_api_down;else if("undefined"!=typeof b.errors){if("undefined"!=typeof b.errors.subscription_expired)c=b.errors.subscription_expired.licence,d=b.errors.subscription_expired.support,e=b.errors.subscription_expired.addons;else{var i="";for(var j in b.errors)i+=b.errors[j];d=i,e=i}"undefined"!=typeof b.addon_content&&(e+="\n"+b.addon_content)}else d=b.message,e=b.addon_content;h.stop().fadeOut(ca,function(){a(this).empty().html(c).stop().fadeIn(ca)}),f.stop().fadeOut(ca,function(){a(this).empty().html(d).stop().fadeIn(ca)}),g.stop().fadeOut(ca,function(){a(this).empty().html(e).stop().fadeIn(ca)})}})}function e(){void 0!==wpmdb_data&&void 0!==wpmdb_data.this_tables&&void 0!==wpmdb_data.this_table_sizes_hr&&(xa=s(wpmdb_data.this_tables,wpmdb_data.this_table_sizes_hr,a(xa).val())),void 0!==b.common.connection_data&&void 0!==b.common.connection_data.tables&&void 0!==b.common.connection_data.table_sizes_hr&&(ya=s(b.common.connection_data.tables,b.common.connection_data.table_sizes_hr,a(ya).val()))}function f(){a("#select-tables").remove(),a(".select-tables-wrap").prepend(xa)}function U(){a("#select-tables").remove(),a(".select-tables-wrap").prepend(ya)}function V(){a("#migrate-selected").parents(".option-section").children(".header-expand-collapse").children(".expand-collapse-arrow").removeClass("collapsed"),a(".table-select-wrap").show(),a("#migrate-only-with-prefix").prop("checked",!1),a("#migrate-selected").prop("checked",!0),a(".table-migrate-options").hide(),a(".select-tables-wrap").show()}function W(){a(".table-migrate-options").show()}function X(){a("#select-tables").children("option").prop("selected",!0)}function $(a,b){return n(wpmdb_data.this_url)}function _(){var c=wpmdb_migration_type(),d=a.trim(a(".pull-push-connection-info").val()).split("\n");if("undefined"!=typeof wpmdb_default_profile&&!0!==wpmdb_default_profile&&"savefile"!==c&&!E&&wpmdb_data.is_pro){E=!0,o(),a(".connection-status").html(wpmdb_strings.establishing_remote_connection),a(".connection-status").removeClass("notification-message error-notice migration-error"),a(".connection-status").append(ha);var e=wpmdb_migration_type();a.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(b,c,d){a(".connection-status").html(na(b.responseText,"(#102)",b)),a(".connection-status").addClass("notification-message error-notice migration-error"),a(".ajax-spinner").remove(),E=!1,p()},success:function(c){if(a(".ajax-spinner").remove(),E=!1,p(),"undefined"!=typeof c.wpmdb_error&&1===c.wpmdb_error)return a(".connection-status").html(c.body),a(".connection-status").addClass("notification-message error-notice migration-error"),void(c.body.indexOf("401 Unauthorized")>-1&&a(".basic-access-auth-wrapper").show());i(d[0],d[1],c.scheme),j(c.prefix),a(".pull-push-connection-info").addClass("temp-disabled"),a(".pull-push-connection-info").attr("readonly","readonly"),a(".connect-button").hide(),a(".connection-status").hide(),a(".step-two").show(),C=!0,b.common.connection_data=c,la(),k();var e="";!1===wpmdb_default_profile&&"undefined"!=typeof wpmdb_loaded_tables&&(e=wpmdb_loaded_tables),ya=s(b.common.connection_data.tables,b.common.connection_data.table_sizes_hr,e);var f="";!1===wpmdb_default_profile&&"undefined"!=typeof wpmdb_loaded_post_types&&("undefined"!=typeof c.select_post_types?(a("#exclude-post-types").attr("checked","checked"),a(".post-type-select-wrap").show(),f=c.select_post_types):f=wpmdb_loaded_post_types);var g=document.createElement("select");a(g).attr({multiple:"multiple",name:"select_post_types[]",id:"select-post-types","class":"multiselect"}),a.each(b.common.connection_data.post_types,function(b,c){var d=a.inArray(c,f);d=-1!==d||!0===wpmdb_convert_exclude_revisions&&"revision"!==c?' selected="selected" ':" ",a(g).append("<option"+d+'value="'+c+'">'+c+"</option>")}),Aa=g;var h="";!1===wpmdb_default_profile&&"undefined"!=typeof wpmdb_loaded_tables_backup&&(h=wpmdb_loaded_tables_backup);var l=document.createElement("select");a(l).attr({multiple:"multiple",name:"select_backup[]",id:"select-backup","class":"multiselect"}),a.each(b.common.connection_data.tables,function(c,d){var e=a.inArray(d,h);e=-1!==e?' selected="selected" ':" ",a(l).append("<option"+e+'value="'+d+'">'+d+" ("+b.common.connection_data.table_sizes_hr[d]+")</option>")}),Ba=l,"pull"===wpmdb_migration_type()?(a.wpmdb.do_action("wpmdb_update_pull_table_select"),a("#select-post-types").remove(),a(".select-post-types-wrap").prepend(Aa),a("#select-backup").remove(),a(".backup-tables-wrap").prepend(Ca),a(".table-prefix").html(c.prefix),a(".uploads-dir").html(wpmdb_data.this_uploads_dir)):(a("#select-backup").remove(),a(".backup-tables-wrap").prepend(Ba)),a.wpmdb.do_action("verify_connection_to_remote_site",b.common.connection_data)}})}}function fa(b,d){a(".licence-input, .register-licence").remove(),a(".licence-not-entered").prepend(b.masked_licence),a(".support-content").empty().html("<p>"+wpmdb_strings.fetching_license+'<img src="'+ga+'" alt="" class="ajax-spinner general-spinner" /></p>'),c(d),a(".migrate-selection label").removeClass("disabled"),a(".migrate-selection input").removeAttr("disabled")}function ia(){a.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(b){a(".debug-log-textarea").val(b)}})}function ja(){var b=a(".progress-content").outerHeight();a(".progress-content").animate({top:"-"+b+"px"},400,"swing",function(){a("#overlay").remove(),a(".progress-content").remove()}),O=!1}function ka(){var b;if(a(".save-settings-button").blur(),!H){if(a("#migrate-selected").is(":checked")&&null===a("#select-tables").val())return void alert(wpmdb_strings.please_select_one_table);if("savefile"!==wpmdb_migration_type()&&a("#backup-manual-select").is(":checked")&&null===a("#select-backup").val())return void alert(wpmdb_strings.please_select_one_table_backup);var c=!1;a("#create_new").is(":checked")&&(c=!0);var d=a(".create-new-profile").val();H=!0,b=a("#migrate-form").serialize(),a(".save-settings-button").attr("disabled","disabled").after('<img src="'+ga+'" alt="" class="save-profile-ajax-spinner general-spinner" />'),E=!0,a.ajax({url:ajaxurl,type:"POST",dataType:"text",cache:!1,data:{action:"wpmdb_save_profile",profile:b,nonce:wpmdb_data.nonces.save_profile},error:function(b,c,d){E=!1,alert(wpmdb_strings.save_profile_problem),a(".save-settings-button").removeAttr("disabled"),a(".save-profile-ajax-spinner").remove(),a(".save-settings-button").after('<span class="ajax-success-msg">'+wpmdb_strings.saved+"</span>"),a(".ajax-success-msg").fadeOut(2e3,function(){a(this).remove()}),H=!1},success:function(b){var e=parseInt(a("#migrate-form input[name=save_migration_profile_option]:checked").val(),10)+1;if(E=!1,a(".save-settings-button").removeAttr("disabled"),a(".save-profile-ajax-spinner").remove(),a(".save-settings-button").after('<span class="ajax-success-msg">'+wpmdb_strings.saved+"</span>"),a(".ajax-success-msg").fadeOut(2e3,function(){a(this).remove()}),H=!1,a(".create-new-profile").val(""),c){var f=parseInt(b,10),g=f+1,h=a('<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,a("#create_new").parents("li").before(h),a("#profile-"+g).attr("checked","checked")}var i=window.location.href.replace("#migrate","").replace(/&wpmdb-profile=-?\d+/,"")+"&wpmdb-profile="+e,j=a("#migrate-form input[name=save_migration_profile_option]:checked").parent().text().trim();if("function"==typeof window.history.pushState){if(a("#migrate-form .crumbs").length)a("#migrate-form .crumbs .crumb:last").text(j);else{var k=a('<div class="crumbs" />').append('<a class="crumb" href="'+wpmdb_data.this_plugin_base+'"> Saved Profiles </a>').append('<span class="crumb">'+j+"</span>");a("#migrate-form").prepend(k)}window.history.pushState({updated_profile_id:e},null,i)}}})}}function la(){a(".connection-status").hide(),a(".prefix-notice").hide(),a(".ssl-notice").hide(),a(".different-plugin-version-notice").hide(),a(".step-two").show(),a(".backup-options").show(),a(".keep-active-plugins").show(),a(".directory-permission-notice").hide(),a("#create-backup").removeAttr("disabled"),a("#create-backup-label").removeClass("disabled"),a(".backup-option-disabled").hide(),a(".compatibility-older-mysql").hide(),a(".pause-before-finalize").show();var c;a.trim(a(".pull-push-connection-info").val()).split("\n");wpmdb_toggle_migration_action_text(),"pull"===wpmdb_migration_type()?(a(".pull-list li").append(Da),Da.show(function(){var b=a(this).find(".pull-push-connection-info");b.val()||b.focus()}),C?(a(".connection-status").hide(),a(".step-two").show(),a(".table-prefix").html(b.common.connection_data.prefix),a(".uploads-dir").html(wpmdb_data.this_uploads_dir),!1===J&&(c=l(b.common.connection_data.url),a(".create-new-profile").val(c)),!0===L&&a(".prefix-notice.pull").show(),!0===M&&a(".ssl-notice").show(),!0===N&&(a(".different-plugin-version-notice").show(),a(".step-two").hide()),wpmdb_toggle_migration_action_text(),!1===wpmdb_data.write_permission&&(a("#create-backup").prop("checked",!1),a("#create-backup").attr("disabled","disabled"),a("#create-backup-label").addClass("disabled"),a(".backup-option-disabled").show(),a(".upload-directory-location").html(wpmdb_data.this_upload_dir_long))):(a(".connection-status").show(),a(".step-two").hide())):"push"===wpmdb_migration_type()?(a(".push-list li").append(Da),Da.show(function(){var b=a(this).find(".pull-push-connection-info");b.val()||b.focus()}),C?(a(".connection-status").hide(),a(".step-two").show(),a(".table-prefix").html(wpmdb_data.this_prefix),a(".uploads-dir").html(b.common.connection_data.uploads_dir),!1===J&&(c=l(b.common.connection_data.url),a(".create-new-profile").val(c)),!0===L&&a(".prefix-notice.push").show(),!0===M&&a(".ssl-notice").show(),!0===N&&(a(".different-plugin-version-notice").show(),a(".step-two").hide()),wpmdb_toggle_migration_action_text(),"0"===b.common.connection_data.write_permissions&&(a("#create-backup").prop("checked",!1),a("#create-backup").attr("disabled","disabled"),a("#create-backup-label").addClass("disabled"),a(".backup-option-disabled").show(),a(".upload-directory-location").html(b.common.connection_data.upload_dir_long))):(a(".connection-status").show(),a(".step-two").hide())):"savefile"===wpmdb_migration_type()&&(a(".connection-status").hide(),a(".step-two").show(),a(".table-prefix").html(wpmdb_data.this_prefix),a(".compatibility-older-mysql").show(),!1===J&&a(".create-new-profile").val(""),a(".backup-options").hide(),a(".keep-active-plugins").hide(),a(".pause-before-finalize").hide(),!1===wpmdb_data.write_permission&&(a(".directory-permission-notice").show(),a(".step-two").hide())),k(),a.wpmdb.do_action("move_connection_info_box",{migration_type:wpmdb_migration_type(),last_migration_type:D})}function ma(){var c=null,d=null;null!==b.common.previous_connection_data&&"object"==typeof b.common.previous_connection_data&&b.common.previous_connection_data.url!==b.common.connection_data.url&&(c=n(b.common.previous_connection_data.url),d=b.common.previous_connection_data.path),"push"===wpmdb_migration_type()||"savefile"===wpmdb_migration_type()?("pull"===D?a(".replace-row").each(function(){var b=a(".old-replace-col input",this).val();a(".old-replace-col input",this).val(a(".replace-right-col input",this).val()),a(".replace-right-col input",this).val(b)}):"push"===D&&"push"===wpmdb_migration_type()&&null!==c&&null!==d&&a(".replace-row").each(function(){var e=a(".replace-right-col input",this).val();e===d&&a(".replace-right-col input",this).val(b.common.connection_data.path),e===c&&a(".replace-right-col input",this).val(n(b.common.connection_data.url))}),a.wpmdb.do_action("wpmdb_update_push_table_select"),a("#select-post-types").remove(),a(".select-post-types-wrap").prepend(za),a("#select-backup").remove(),a(".backup-tables-wrap").prepend(Ba)):"pull"===wpmdb_migration_type()&&(""===D||"push"===D||"savefile"===D?a(".replace-row").each(function(){var b=a(".old-replace-col input",this).val();a(".old-replace-col input",this).val(a(".replace-right-col input",this).val()),a(".replace-right-col input",this).val(b)}):"pull"===D&&"pull"===wpmdb_migration_type()&&null!==c&&null!==d&&a(".replace-row").each(function(){var e=a(".old-replace-col input",this).val();e===d&&a(".old-replace-col input",this).val(b.common.connection_data.path),e===c&&a(".old-replace-col input",this).val(n(b.common.connection_data.url))}),a.wpmdb.do_action("wpmdb_update_pull_table_select"),a("#select-post-types").remove(),a(".select-post-types-wrap").prepend(Aa),a("#select-backup").remove(),a(".backup-tables-wrap").prepend(Ca)),D=wpmdb_migration_type()}function na(a,b,c){return wpmdbGetAjaxErrors(wpmdb_strings.connection_local_server_problem,b,a,c)}function oa(a){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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?)*)?$/i.test(a)}function pa(b,d){a(".nav-tab").removeClass("nav-tab-active"),a(".nav-tab."+b).addClass("nav-tab-active"),a(".content-tab").hide(),a("."+b+"-tab").show(),"settings"===b&&!1===K&&"1"===wpmdb_data.has_licence&&(a("p.licence-status").append("Checking License... ").append(ha),c()),"help"===b&&(ia(),!1===K&&"1"===wpmdb_data.has_licence&&(a(".support-content p").append(ha),c())),"addons"===b&&!0!==d&&!1===K&&"1"===wpmdb_data.has_licence&&(a(".addons-content p").append(ha),c())}function qa(c){var d=a(".pull-push-connection-info");if(!E&&!a(d).hasClass("temp-disabled")){c=a(".pull-push-connection-info").val();var f=a.trim(c).split("\n"),g=!1,h="";if(""===f&&(g=!0,h=wpmdb_strings.connection_info_missing),2===f.length||g||(g=!0,h=wpmdb_strings.connection_info_incorrect),g||oa(f[0])||(g=!0,h=wpmdb_strings.connection_info_url_invalid),!g&&32>=f[1].length&&(g=!0,h=wpmdb_strings.connection_info_key_invalid),g||f[0]!==wpmdb_data.connection_info[0]||(g=!0,h=wpmdb_strings.connection_info_local_url),g||f[1]!==wpmdb_data.connection_info[1]||(g=!0,h=wpmdb_strings.connection_info_local_key),g)return a(".connection-status").html(h),void a(".connection-status").addClass("notification-message error-notice migration-error");var m=f[0]+"\n"+f[1];!1===wpmdb_data.openssl_available&&(f[0]=f[0].replace("https://","http://"),m=f[0]+"\n"+f[1],a(".pull-push-connection-info").val(m)),L=!1,E=!0,o(),a(".basic-access-auth-wrapper").is(":visible")&&(f[0]=f[0].replace(/\/\/(.*)@/,"//"),f[0]=f[0].replace("//","//"+encodeURIComponent(a.trim(a(".auth-username").val()))+":"+encodeURIComponent(a.trim(a(".auth-password").val()))+"@"),m=f[0]+"\n"+f[1],a(".pull-push-connection-info").val(m),a(".basic-access-auth-wrapper").hide()),a(".step-two").hide(),a(".ssl-notice").hide(),a(".prefix-notice").hide(),a(".connection-status").show(),a(".connection-status").html(wpmdb_strings.establishing_remote_connection),a(".connection-status").removeClass("notification-message error-notice migration-error"),a(".connection-status").append(ha);var q=wpmdb_migration_type();J=!1,a.ajax({url:ajaxurl,type:"POST",dataType:"json",cache:!1,data:{action:"wpmdb_verify_connection_to_remote_site",url:f[0],key:f[1],intent:q,nonce:wpmdb_data.nonces.verify_connection_to_remote_site},error:function(b,c,d){a(".connection-status").html(na(b.responseText,"(#100)",b)),a(".connection-status").addClass("notification-message error-notice migration-error"),a(".ajax-spinner").remove(),E=!1,p()},success:function(c){if(a(".ajax-spinner").remove(),E=!1,p(),i(f[0],f[1],c.scheme),"undefined"!=typeof c.wpmdb_error&&1===c.wpmdb_error)return a(".connection-status").html(c.body),a(".connection-status").addClass("notification-message error-notice migration-error"),void(c.body.indexOf("401 Unauthorized")>-1&&a(".basic-access-auth-wrapper").show());var d=l(c.url);a(".create-new-profile").val(d),a(".pull-push-connection-info").addClass("temp-disabled"),a(".pull-push-connection-info").attr("readonly","readonly"),a(".connect-button").hide(),a(".connection-status").hide(),a(".step-two").show(),j(c.prefix),C=!0,b.common.previous_connection_data=b.common.connection_data,b.common.connection_data=c,la(),ma(),k(),e(),Ba=a(ya).clone(),a(Ba).attr({name:"select_backup[]",id:"select-backup"});var g=document.createElement("select");a(g).attr({multiple:"multiple",name:"select_post_types[]",id:"select-post-types","class":"multiselect"}),a.each(b.common.connection_data.post_types,function(b,c){a(g).append('<option value="'+c+'">'+c+"</option>")}),Aa=g,a("#new-path-missing-warning, #new-url-missing-warning").hide(),"pull"===wpmdb_migration_type()?(a("#new-url").val(n(wpmdb_data.this_url)),a("#new-path").val(wpmdb_data.this_path),"true"===wpmdb_data.is_multisite&&(a("#new-domain").val(wpmdb_data.this_domain),a('.replace-row.pin .old-replace-col input[type="text"]').val(n(c.url))),a("#old-url").val(n(c.url)),a("#old-path").val(c.path),a.wpmdb.do_action("wpmdb_update_pull_table_select"),a("#select-post-types").remove(),a(".select-post-types-wrap").prepend(Aa),a(".table-prefix").html(c.prefix),a(".uploads-dir").html(wpmdb_data.this_uploads_dir)):(a("#new-url").val(n(c.url)),a("#new-path").val(c.path),"true"===wpmdb_data.is_multisite&&a('.replace-row.pin .old-replace-col input[type="text"]').val(n(wpmdb_data.this_url)),a.wpmdb.do_action("wpmdb_update_push_table_select"),a("#select-backup").remove(),a(".backup-tables-wrap").prepend(Ba)),b.common.next_step_in_migration={fn:a.wpmdb.do_action,args:["verify_connection_to_remote_site",b.common.connection_data]},b.functions.execute_next_step()}})}}function ra(c){Z=!0,a(".progress-text").html(wpmdb_strings.completing_current_request),a(".progress-title").html(wpmdb_strings.cancelling_migration),a(".migration-controls").fadeOut(),a(".migration-progress-ajax-spinner").show(),!0===T&&(T=!1,b.functions.execute_next_step())}b.migration_state_id="",a("#plugin-compatibility").change(function(b){var c="1";if(a(this).is(":checked")){var d=confirm(wpmdb_strings.mu_plugin_confirmation);if(!d)return void a(this).prop("checked",!1)}else c="0";a(".plugin-compatibility-wrap").toggle(),a(this).parent().append(ha),a("#plugin-compatibility").attr("disabled","disabled"),a(".plugin-compatibility").addClass("disabled"),a.ajax({url:ajaxurl,type:"POST",dataType:"text",cache:!1,data:{action:"wpmdb_plugin_compatibility",install:c},error:function(b,c,d){alert(wpmdb_strings.plugin_compatibility_settings_problem+"\r\n\r\n"+wpmdb_strings.status+" "+b.status+" "+b.statusText+"\r\n\r\n"+wpmdb_strings.response+"\r\n"+b.responseText),a(".ajax-spinner").remove(),a("#plugin-compatibility").removeAttr("disabled"),a(".plugin-compatibility").removeClass("disabled")},success:function(b){""!==a.trim(b)?alert(b):(a(".plugin-compatibility").append('<span class="ajax-success-msg">'+wpmdb_strings.saved+"</span>"),a(".ajax-success-msg").fadeOut(2e3,function(){a(this).remove()})),a(".ajax-spinner").remove(),a("#plugin-compatibility").removeAttr("disabled"),a(".plugin-compatibility").removeClass("disabled")}})}),a("#plugin-compatibility").is(":checked")&&a(".plugin-compatibility-wrap").show(),(0<=navigator.userAgent.indexOf("MSIE")||0<=navigator.userAgent.indexOf("Trident"))&&a(".ie-warning").show(),0===wpmdb_data.valid_licence&&a("#savefile").prop("checked",!0);var sa=a(".max-request-size"),ta=a(".slider",sa);ta.slider({range:"min",value:parseInt(wpmdb_data.max_request/1024),min:512,max:parseInt(wpmdb_data.bottleneck/1024),step:1,create:function(a,b){q(sa,wpmdb_data.max_request/1024,"kB")},slide:function(a,b){q(sa,b.value,"kB")},stop:function(b,c){a(".amount",sa).after('<img src="'+ga+'" alt="" class="slider-spinner general-spinner" />'),ta.slider("disable"),a.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(b,c,d){ta.slider("enable"),a(".slider-spinner",sa).remove(),alert(wpmdb_strings.max_request_size_problem),q(sa,wpmdb_data.max_request/1024,"kB"),ta.slider("enable")},success:function(){ta.slider("enable"),a(".slider-success-msg",sa).show(),a(".slider-success-msg",sa).fadeOut(2e3,function(){a(this).hide()}),a(".slider-spinner",sa).remove()}})}});var ua=a(".delay-between-requests"),va=a(".slider",ua);va.slider({range:"min",value:parseInt(wpmdb_data.delay_between_requests/1e3),min:0,max:10,step:1,create:function(a,b){q(ua,wpmdb_data.delay_between_requests/1e3,"s")},slide:function(a,b){q(ua,b.value,"s")},stop:function(b,c){a(".amount",ua).after('<img src="'+ga+'" alt="" class="slider-spinner general-spinner" />'),va.slider("disable"),a.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(b,c,d){va.slider("enable"),a(".slider-spinner",ua).remove(),alert(wpmdb_strings.delay_between_requests_problem),q(ua,wpmdb_data.delay_between_requests/1e3,"s"),va.slider("enable")},success:function(){wpmdb_data.delay_between_requests=parseInt(1e3*c.value),va.slider("enable"),a(".slider-success-msg",ua).show(),a(".slider-success-msg",ua).fadeOut(2e3,function(){a(this).hide()}),a(".slider-spinner",ua).remove()}})}});var wa=a(".progress-content").clone();a(".progress-content").remove();var xa=a("#select-tables").clone(),ya=a("#select-tables").clone(),za=a("#select-post-types").clone(),Aa=a("#select-post-types").clone(),Ba=a("#select-backup").clone(),Ca=a("#select-backup").clone();a(".help-tab .video").each(function(){var b=a(this),c=a(".video-viewer");a("a",this).click(function(d){d.preventDefault(),c.attr("src","//www.youtube.com/embed/"+b.data("video-id")+"?autoplay=1"),c.show();var e=c.offset();a(window).scrollTop(e.top-50)})}),a(".backup-options").show(),a(".keep-active-plugins").show(),"savefile"===wpmdb_migration_type()&&(a(".backup-options").hide(),a(".keep-active-plugins").hide()),D=wpmdb_migration_type(),a(".content-tab").on("click",".check-my-licence-again",function(b){b.preventDefault(),K=!1,a(b.target).replaceWith("Checking... "+ha),c(null,"all")}),a.wpmdb.add_action("wpmdb_refresh_table_selects",e),a.wpmdb.add_action("wpmdb_update_push_table_select",f),a.wpmdb.add_action("wpmdb_update_pull_table_select",U),a.wpmdb.add_action("wpmdb_disable_table_migration_options",V),a.wpmdb.add_action("wpmdb_enable_table_migration_options",W),a.wpmdb.add_action("wpmdb_select_all_tables",X),a.wpmdb.add_filter("wpmdb_base_old_url",$),_(),a("body").on("click",".js-action-link",function(b){b.preventDefault(),a(this).blur()}),a(".licence-form").submit(function(b){if(b.preventDefault(),!F){a(".licence-status").removeClass("notification-message error-notice success-notice");var c=a.trim(a(".licence-input").val());if(""===c)return a(".licence-status").addClass("notification-message error-notice"),void a(".licence-status").html(wpmdb_strings.enter_license_key);a(".licence-status").empty().removeClass("success"),F=!0,a(".button.register-licence").after('<img src="'+ga+'" alt="" class="register-licence-ajax-spinner general-spinner" />'),a.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(b,c,d){F=!1,a(".register-licence-ajax-spinner").remove(),a(".licence-status").html(wpmdb_strings.register_license_problem)},success:function(b){if(F=!1,a(".register-licence-ajax-spinner").remove(),"undefined"!=typeof b.errors){var d="";for(var e in b.errors)d+=b.errors[e];a(".licence-status").html(d),"undefined"!=typeof b.masked_licence&&(fa(b,c),a(".migrate-tab .invalid-licence").hide())}else"undefined"!=typeof b.wpmdb_error&&"undefined"!=typeof b.body?a(".licence-status").html(b.body):(a(".licence-status").html(wpmdb_strings.license_registered).delay(5e3).fadeOut(1e3),a(".licence-status").addClass("success notification-message success-notice"),fa(b,c),a(".invalid-licence").hide())}})}}),a(".clear-log").click(function(){a(".debug-log-textarea").val(""),a.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){}})}),a(".multiselect-select-all").click(function(){var b=a(this).parents(".select-wrap").children(".multiselect");a("option",b).prop("selected",1),a(b).focus().trigger("change")}),a(".multiselect-deselect-all").click(function(){var b=a(this).parents(".select-wrap").children(".multiselect");a("option",b).removeAttr("selected"),a(b).focus().trigger("change")}),a(".multiselect-invert-selection").click(function(){var b=a(this).parents(".select-wrap").children(".multiselect");a("option",b).each(function(){a(this).attr("selected",!a(this).attr("selected"))}),a(b).focus().trigger("change")}),a(".option-group input[type=radio]").change(function(){var b=a(this).closest(".option-group");a("ul",b).hide();var c=a(this).closest("li");a("ul",c).show()}),a(".option-group").each(function(){a(".option-group input[type=radio]").each(function(){if(a(this).is(":checked")){var b=a(this).closest("li");a("ul",b).show()}})}),a(".header-expand-collapse").click(function(){a(".expand-collapse-arrow",this).hasClass("collapsed")?(a(".expand-collapse-arrow",this).removeClass("collapsed"),a(this).next().show()):(a(".expand-collapse-arrow",this).addClass("collapsed"),a(this).next().hide())}),a(".checkbox-label input[type=checkbox]").change(function(){a(this).is(":checked")?a(this).parent().next().show():a(this).parent().next().hide()}),a("#save-migration-profile").change(function(){b.functions.update_migrate_button_text(),a(this).is(":checked")?a(".save-settings-button").show():a(".save-settings-button").hide();
2
- }),a("#save-migration-profile").is(":checked")&&a(".save-settings-button").show(),a(".create-new-profile").focus(function(){a("#create_new").prop("checked",!0)}),a(".checkbox-label input[type=checkbox]").each(function(){a(this).is(":checked")&&a(this).parent().next().show()}),a(".migrate-db-button").click(function(c){function e(b,c){var d=0,e=JSON.parse(JSON.stringify(c));a.each(b,function(a,b){d+=parseInt(e[b])});var f=0,g=0,h=[];a.each(b,function(a,b){var c=Math.round(e[b]/d*100);h[b]=c,c>f&&(f=c),g+=c});var i="",j=100-g;a.each(b,function(b,c){var d=h[c];0!==j&&d===f&&(d+=j,j=0),a(".progress-tables").append('<div class="progress-chunk '+c+'_chunk" style="width: '+d+'%;" title="'+c+'"><span>'+c+"</span></div>"),a(".progress-tables-hover-boxes").append('<div class="progress-chunk-hover" data-table="'+c+'" style="width: '+d+'%;"></div>'),i=c}),a(".progress-tables",".progress-wrapper-primary").find(".progress-chunk").each(function(c){function d(b){a("span",b).innerWidth()>a(b).width()&&a("span",b).hide()}1>a(this).width()&&(a(this).hide(),a(".progress-chunk-hover[data-table="+b[c]+"]").hide(),e[i]=Number(e[i]),e[i]+=Number(e[b[c]]),e[b[c]]=0);var f=this;setTimeout(function(){d(f)},0)});var k=[e,d];return k}if(a(this).blur(),c.preventDefault(),b.migration_state_id="",!1!==a.wpmdb.apply_filters("wpmdb_migration_profile_ready",!0)){if(a("#migrate-selected").is(":checked")&&null===a("#select-tables").val())return void alert(wpmdb_strings.please_select_one_table);if("savefile"!==wpmdb_migration_type()&&a("#backup-manual-select").is(":checked")&&null===a("#select-backup").val())return void alert(wpmdb_strings.please_select_one_table_backup);var f=!1,h=!1;if(a("#new-url").length&&!a("#new-url").val()&&(a("#new-url-missing-warning").show(),a("#new-url").focus(),a("html,body").scrollTop(0),f=!0),a("#new-path").length&&!a("#new-path").val()&&(a("#new-path-missing-warning").show(),!1===f&&(a("#new-path").focus(),a("html,body").scrollTop(0)),h=!0),!0!==f&&!0!==h){a("#save-migration-profile").is(":checked")&&ka(),y=a("#migrate-form").serialize();var i=a(document).height();a("body").append('<div id="overlay"></div>'),a("#overlay").height(i).css({position:"fixed",top:0,left:0,width:"100%","z-index":99999,display:"none"});var j=wa.clone();v=wpmdb_migration_type(),z="backup","savefile"===v&&(z="migrate"),!1===a("#create-backup").is(":checked")&&(z="migrate");var k=(a("input[name=table_migrate_option]:checked").val(),a.trim(a(".pull-push-connection-info").val()).split("\n")),l="";w=k[0],x=k[1];var n="";a("#overlay").after(j),B=wpmdb_strings.exporting_complete,"savefile"===v?n=wpmdb_strings.exporting_please_wait:(n=m(w,v,"migrating"),B=m(w,v,"completed")),a(".progress-title").html(n),a("#overlay").show();var o=a("input[name=backup_option]:checked").val(),p=a("input[name=table_migrate_option]:checked").val(),q="";"backup"===z?("migrate_only_with_prefix"===p&&"backup_selected"===o&&(o="backup_only_with_prefix"),"push"===v?(l=b.common.connection_data.table_rows,"backup_only_with_prefix"===o?S=b.common.connection_data.prefixed_tables:"backup_selected"===o?(q=a("#select-tables").val(),S=g(q,b.common.connection_data.tables)):"backup_manual_select"===o&&(S=a("#select-backup").val())):(l=wpmdb_data.this_table_rows,"backup_only_with_prefix"===o?S=wpmdb_data.this_prefixed_tables:"backup_selected"===o?(q=a("#select-tables").val(),S=g(q,wpmdb_data.this_tables)):"backup_manual_select"===o&&(S=a("#select-backup").val()))):(S=t(null,null),l="push"===v||"savefile"===v?wpmdb_data.this_table_rows:b.common.connection_data.table_rows);var r=e(S,l);l=r[0];var s=r[1];a(".progress-title").after('<img src="'+ga+'" alt="" class="migration-progress-ajax-spinner general-spinner" />');var u=a(".progress-content").outerHeight();a(".progress-content").css("top","-"+u+"px").show().animate({top:"0px"}),d(),P=!0;var A={action:"wpmdb_initiate_migration",intent:v,url:w,key:x,form_data:y,stage:z,nonce:wpmdb_data.nonces.initiate_migration};"savefile"!==v&&(A.temp_prefix=b.common.connection_data.temp_prefix),E=!0,a.ajax({url:ajaxurl,type:"POST",dataType:"json",cache:!1,data:A,error:function(c,d,e){a(".progress-title").html(wpmdb_strings.migration_failed),a(".progress-text").html(na(c.responseText,"(#112)",c)),a(".progress-text").addClass("migration-error"),console.log(c),console.log(d),console.log(e),E=!1,b.common.migration_error=!0,b.functions.migration_complete_events()},success:function(c){if(E=!1,"undefined"!=typeof c&&"undefined"!=typeof c.wpmdb_error&&1===c.wpmdb_error)return b.common.migration_error=!0,b.functions.migration_complete_events(),a(".progress-title").html(wpmdb_strings.migration_failed),a(".progress-text").addClass("migration-error"),void a(".progress-text").html(c.body);b.migration_state_id=c.migration_state_id;var d=0,f=0;Y=0;var g=0,h=0,i=0,j=0;ba=0,"savefile"!==v&&"undefined"!=typeof b.common.connection_data&&"undefined"!=typeof b.common.connection_data.delay_between_requests&&(ba=Math.max(parseInt(wpmdb_data.delay_between_requests),parseInt(b.common.connection_data.delay_between_requests))),b.functions.migrate_table_recursive=function(c,k){if(d>=S.length){if("backup"!==z)return a(".progress-label").removeClass("label-visible"),b.common.hooks=a.wpmdb.apply_filters("wpmdb_before_migration_complete_hooks",b.common.hooks),b.common.hooks.push(b.functions.migration_complete),b.common.hooks.push(b.functions.wpmdb_flush),b.common.hooks=a.wpmdb.apply_filters("wpmdb_after_migration_complete_hooks",b.common.hooks),b.common.hooks.push(b.functions.migration_complete_events),b.common.next_step_in_migration={fn:wpmdb_call_next_hook},void b.functions.execute_next_step();z="migrate",d=0,f=0,Y=0,a(".progress-bar").width("0px"),S=t(null,null),l="push"===v||"savefile"===v?wpmdb_data.this_table_rows:b.common.connection_data.table_rows,a(".progress-tables").empty(),a(".progress-tables-hover-boxes").empty(),r=e(S,l),l=r[0],s=r[1]}"backup"===z?a(".progress-text").html(Y+"% - "+wpmdb_strings.backing_up+' "'+S[d]+'"'):a(".progress-text").html(Y+"% - "+wpmdb_strings.migrating+' "'+S[d]+'"');var m=0;d===S.length-1&&(m=1);var n=0;"savefile"!==v&&1===parseInt(b.common.connection_data.gzip)&&(n=1);var o={action:"wpmdb_migrate_table",migration_state_id:b.migration_state_id,table:S[d],stage:z,current_row:c,last_table:m,primary_keys:k,gzip:n,nonce:wpmdb_data.nonces.migrate_table};"savefile"!==v&&(o.bottleneck=b.common.connection_data.bottleneck,o.prefix=b.common.connection_data.prefix),b.common.connection_data&&b.common.connection_data.path_current_site&&b.common.connection_data.domain&&(o.path_current_site=b.common.connection_data.path_current_site,o.domain_current_site=b.common.connection_data.domain),E=!0,a.ajax({url:ajaxurl,type:"POST",dataType:"text",cache:!1,timeout:0,data:o,error:function(c,e,f){a(".progress-title").html(wpmdb_strings.migration_failed),a(".progress-text").html(wpmdb_strings.table_process_problem+" "+S[d]),a(".progress-text").append("<br /><br />"+wpmdb_strings.status+": "+c.status+" "+c.statusText+"<br /><br />"+wpmdb_strings.response+":<br />"+c.responseText),a(".progress-text").addClass("migration-error"),E=!1,console.log(c),console.log(e),console.log(f),b.common.migration_error=!0,b.functions.migration_complete_events()},success:function(c){E=!1,c=a.trim(c);var e=wpmdb_parse_json(c);return!1===e||null===e?(a(".progress-title").html(wpmdb_strings.migration_failed),""===c||null===c?a(".progress-text").html(wpmdb_strings.table_process_problem_empty_response+" "+S[d]):a(".progress-text").html(na(c,null,null)),a(".progress-text").addClass("migration-error"),b.common.migration_error=!0,void b.functions.migration_complete_events()):"undefined"!=typeof e.wpmdb_error&&1===e.wpmdb_error?(a(".progress-title").html(wpmdb_strings.migration_failed),a(".progress-text").addClass("migration-error"),a(".progress-text").html(e.body),b.common.migration_error=!0,void b.functions.migration_complete_events()):(1===m&&"savefile"===v&&("undefined"!=typeof e.dump_filename&&(Q=e.dump_filename),"undefined"!=typeof e.dump_path&&(R=e.dump_path)),-1===e.current_row||"-1"===e.current_row?(f-=j,j=0,i=0,f+=parseInt(l[S[d]]),d++,e.current_row="",e.primary_keys=""):(h=parseInt(e.current_row),g=h-i,i=h,f+=g,j+=g),Y=Math.floor(f/s*100),a(".progress-bar").width(Y+"%"),b.common.next_step_in_migration={fn:b.functions.migrate_table_recursive,args:[e.current_row,e.primary_keys]},void b.functions.execute_next_step())}})},b.common.next_step_in_migration={fn:b.functions.migrate_table_recursive,args:["-1",""]},b.functions.execute_next_step()}})}}}),b.functions.migration_complete_events=function(){!1===b.common.migration_error&&(""===b.common.non_fatal_errors?("savefile"!==v&&!0===a("#save_computer").is(":checked")&&a(".progress-text").css("visibility","hidden"),a(".progress-title").html(B).append('<div class="dashicons dashicons-yes"></div>')):(a(".progress-text").html(b.common.non_fatal_errors),a(".progress-text").addClass("migration-error"),a(".progress-title").html(wpmdb_strings.completed_with_some_errors)),a(".progress-bar-wrapper").hide()),a(".migration-controls").hide(),b.common.hooks=[],b.common.call_stack=[],b.common.migration_error=!1,P=!1,O=!0,T=!1,Z=!1,E=!1,b.common.non_fatal_errors="",a(".progress-label").remove(),a(".migration-progress-ajax-spinner").remove(),a(".close-progress-content").show(),a("#overlay").css("cursor","pointer"),clearInterval(A)},b.functions.migration_complete=function(){if(a(".migration-controls").fadeOut(),"savefile"===v){P=!1;var c=wpmdb_strings.migration_complete;if(a("#save_computer").is(":checked")){var d=wpmdb_data.this_download_url+encodeURIComponent(Q);a("#gzip_file").is(":checked")&&(d+="&gzip=1"),window.location=d}else c=wpmdb_strings.completed_dump_located_at+" "+R;!1===b.common.migration_error&&(a(".progress-text").html(c),b.functions.migration_complete_events(),a(".progress-title").html(B))}else a(".progress-text").html(wpmdb_strings.finalizing_migration),E=!0,a.ajax({url:ajaxurl,type:"POST",dataType:"text",cache:!1,data:{action:"wpmdb_finalize_migration",migration_state_id:b.migration_state_id,prefix:b.common.connection_data.prefix,tables:S.join(","),nonce:wpmdb_data.nonces.finalize_migration},error:function(c,d,e){E=!1,a(".progress-title").html(wpmdb_strings.migration_failed),a(".progress-text").html(wpmdb_strings.finalize_tables_problem),a(".progress-text").addClass("migration-error"),alert(c+" : "+d+" : "+e),b.common.migration_error=!0,b.functions.migration_complete_events()},success:function(c){return E=!1,"1"!==a.trim(c)?(a(".progress-title").html(wpmdb_strings.migration_failed),a(".progress-text").html(c),a(".progress-text").addClass("migration-error"),b.common.migration_error=!0,void b.functions.migration_complete_events()):(b.common.next_step_in_migration={fn:wpmdb_call_next_hook},void b.functions.execute_next_step())}})},b.functions.wpmdb_flush=function(){"savefile"!==v&&(a(".progress-text").html(wpmdb_strings.flushing),E=!0,a.ajax({url:ajaxurl,type:"POST",dataType:"text",cache:!1,data:{action:"wpmdb_flush",migration_state_id:b.migration_state_id,nonce:wpmdb_data.nonces.flush},error:function(c,d,e){E=!1,a(".progress-title").html(wpmdb_strings.migration_failed),a(".progress-text").html(wpmdb_strings.flush_problem),a(".progress-text").addClass("migration-error"),alert(c+" : "+d+" : "+e),b.common.migration_error=!0,b.functions.migration_complete_events()},success:function(c){return E=!1,"1"!==a.trim(c)?(a(".progress-title").html(wpmdb_strings.migration_failed),a(".progress-text").html(c),a(".progress-text").addClass("migration-error"),b.common.migration_error=!0,void b.functions.migration_complete_events()):(b.common.next_step_in_migration={fn:wpmdb_call_next_hook},void b.functions.execute_next_step())}}))},b.functions.update_migrate_button_text=function(){var b=wpmdb_migration_type(),c=a("#save-migration-profile").is(":checked")?"_save":"",d="migrate_button_"+("savefile"===b?"export":b)+c;a(".migrate-db .button-primary").val(wpmdb_strings[d])},b.functions.update_migrate_button_text(),a("body").on("click",".close-progress-content-button",function(a){ja()}),a("body").on("click","#overlay",function(){!0===O&&ja()}),a(".save-settings-button").click(function(b){return b.preventDefault(),""===a.trim(a(".create-new-profile").val())&&a("#create_new").is(":checked")?(alert(wpmdb_strings.enter_name_for_profile),void a(".create-new-profile").focus()):void ka()}),a("body").on("mousemove",".progress-chunk-hover",function(b){var c=b.pageX,d=a(".progress-bar-wrapper").offset(),e=a(".progress-label").outerWidth()/2;c=c-d.left-e,a(".progress-label").css("left",c+"px"),a(".progress-label").html(a(this).attr("data-table"))}),a("body").on("mouseenter mouseleave",".progress-chunk-hover",function(b){"mouseenter"===b.type?a(".progress-label").addClass("label-visible"):a(".progress-label").removeClass("label-visible")});var Da=a(".connection-info-wrapper");la(),a(".migrate-selection.option-group input[type=radio]").change(function(){la(),C&&ma(),b.functions.update_migrate_button_text()}),"pull"!==wpmdb_migration_type()&&"push"!==wpmdb_migration_type()||C||(a(".step-two").hide(),a(".connection-status").show()),a(".general-helper").click(function(b){b.preventDefault();var c=a(this),d=a(this).next();a(".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(),b.stopPropagation()}),a("body").click(function(){a(".helper-message").hide()}),a(".helper-message").click(function(a){a.stopPropagation()}),a("body").on("click",".show-errors-toggle",function(b){b.preventDefault(),a(this).next(".migration-php-errors").toggle()}),a(".nav-tab").click(function(){var b=a(this).attr("data-div-name");b=b.replace("-tab",""),window.location.hash=b,pa(b,!1)}),a("body").on("click",'a[href^="#"]',function(b){var c=a(b.target).attr("href"),d=c.substr(1);if(d){var e=a("."+d);1===e.length&&(e.trigger("click"),b.preventDefault())}}),a("body").on("click",".add-row",function(){a(this).parents("tr").before(a(".original-repeatable-field").clone().removeClass("original-repeatable-field"))}),a("body").on("click",".replace-remove-row",function(){a(this).parents("tr").remove(),2>=a(".replace-row").length&&a(".no-replaces-message").show();var b=a(this).prev().attr("id");("new-url"===b||"new-path"===b)&&a("#"+b+"-missing-warning").hide()}),a("body").on("change","#new-url",function(){a("#new-url-missing-warning").hide()}).on("change","#new-path",function(){a("#new-path-missing-warning").hide()}),a("body").on("click",".arrow-col",function(){var b=this,c=a(b).prev("td").find("input").val(),d=a(b).next("td").find("input");d.val(c),"new-url"===d.prop("id")?a("#new-url-missing-warning").hide():"new-path"===d.prop("id")&&a("#new-path-missing-warning").hide()}),a(".add-replace").click(function(){a(".replace-fields").prepend(a(".original-repeatable-field").clone().removeClass("original-repeatable-field")),a(".no-replaces-message").hide()}),a("#find-and-replace-sort tbody").sortable({items:"> tr:not(.pin)",handle:"td:first",start:function(){a(".sort-handle").css("cursor","-webkit-grabbing"),a(".sort-handle").css("cursor","-moz-grabbing")},stop:function(){a(".sort-handle").css("cursor","-webkit-grab"),a(".sort-handle").css("cursor","-moz-grab")}});var Ea="";window.location.hash&&(Ea=window.location.hash.substring(1),pa(Ea,!1)),""!==h("install-plugin")&&(Ea="addons",K=!0,pa(Ea,!0)),a(".notice-link").click(function(b){b.preventDefault(),a(this).closest(".inline-message").hide(),a.ajax({url:ajaxurl,type:"POST",dataType:"text",cache:!1,data:{action:"wpmdb_process_notice_link",nonce:wpmdb_data.nonces.process_notice_link,notice:a(this).data("notice"),type:a(this).data("type"),reminder:a(this).data("reminder")}})}),a(".reset-api-key").click(function(){var b=confirm(wpmdb_strings.reset_api_key);b&&!G&&(G=!0,a(".reset-api-key").after('<img src="'+ga+'" alt="" class="reset-api-key-ajax-spinner general-spinner" />'),a.ajax({url:ajaxurl,type:"POST",dataType:"text",cache:!1,data:{action:"wpmdb_reset_api_key",nonce:wpmdb_data.nonces.reset_api_key},error:function(b,c,d){alert(wpmdb_strings.reset_api_key_problem),a(".reset-api-key-ajax-spinner").remove(),G=!1},success:function(b){a(".reset-api-key-ajax-spinner").remove(),G=!1,a(".connection-info").html(b),wpmdb_data.connection_info=a.trim(b).split("\n")}}))}),a("input.multiselect-toggle").change(function(){a(this).parents(".expandable-content").children(".select-wrap").toggle()}),a(".show-multiselect").each(function(){a(this).is(":checked")&&(a(this).parents(".option-section").children(".header-expand-collapse").children(".expand-collapse-arrow").removeClass("collapsed"),a(this).parents(".expandable-content").show(),a(this).parents(".expandable-content").children(".select-wrap").toggle())}),a("input[name=backup_option]").change(function(){a(".backup-tables-wrap").hide(),"backup_manual_select"===a(this).val()&&a(".backup-tables-wrap").show()}),a("#backup-manual-select").is(":checked")&&a(".backup-tables-wrap").show(),a(".plugin-compatibility-save").click(function(){if(!I){a(this).addClass("disabled");var b=a("#selected-plugins");a(b).attr("disabled","disabled"),I=!0,a(this).after('<img src="'+ga+'" alt="" class="plugin-compatibility-spinner general-spinner" />'),a.ajax({url:ajaxurl,type:"POST",dataType:"text",cache:!1,data:{action:"wpmdb_blacklist_plugins",blacklist_plugins:a(b).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),a(b).removeAttr("disabled"),a(".plugin-compatibility-save").removeClass("disabled"),I=!1,a(".plugin-compatibility-spinner").remove(),a(".plugin-compatibility-success-msg").show().fadeOut(2e3)},success:function(c){""!==a.trim(c)&&alert(c),a(b).removeAttr("disabled"),a(".plugin-compatibility-save").removeClass("disabled"),I=!1,a(".plugin-compatibility-spinner").remove(),a(".plugin-compatibility-success-msg").show().fadeOut(2e3)}})}}),a("body").on("click",".delete-profile",function(){var b=a(this).next().clone();a("input",b).remove(),b=a.trim(a(b).html());var c=confirm(wpmdb_strings.remove_profile.replace("{{profile}}",b));if(c){var d=a(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(),a("#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),a.ajax({url:ajaxurl,type:"POST",dataType:"text",cache:!1,data:{action:"wpmdb_delete_migration_profile",profile_id:a(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)}})}}),a(".main-list-delete-profile-link").click(function(){var b=a(this).prev().html(),c=confirm(wpmdb_strings.remove_profile.replace("{{profile}}",b));c&&(a(this).parent().fadeOut(500),a.ajax({url:ajaxurl,type:"POST",dataType:"text",cache:!1,data:{action:"wpmdb_delete_migration_profile",profile_id:a(this).attr("data-profile-id"),nonce:wpmdb_data.nonces.delete_migration_profile},error:function(a,b,c){alert(wpmdb_strings.remove_profile_problem)}}))}),a("body").on("click",".temp-disabled",function(){var b=confirm(wpmdb_strings.change_connection_info);b&&(a(".ssl-notice").hide(),a(".different-plugin-version-notice").hide(),a(".migrate-db-button").show(),a(".temp-disabled").removeAttr("readonly"),a(".temp-disabled").removeClass("temp-disabled"),a(".connect-button").show(),a(".step-two").hide(),a(".connection-status").show().html(wpmdb_strings.enter_connection_info),C=!1)}),a(".settings-tab input[type=checkbox]").change(function(){if("plugin-compatibility"!==a(this).attr("id")){var b=a(this).is(":checked"),c=a(this).attr("id");a(this).parent().append(ha);var d=a(this).parent();a.ajax({url:ajaxurl,type:"POST",dataType:"text",cache:!1,data:{action:"wpmdb_save_setting",checked:b,setting:c,nonce:wpmdb_data.nonces.save_setting},error:function(b,c,d){alert(wpmdb_strings.save_settings_problem),a(".ajax-spinner").remove()},success:function(b){a(".ajax-spinner").remove(),a(d).append('<span class="ajax-success-msg">'+wpmdb_strings.saved+"</span>"),a(".ajax-success-msg").fadeOut(2e3,function(){a(this).remove()})}})}}),a(".migrate-form").submit(function(a){a.preventDefault()}),a(".connect-button").click(function(b){b.preventDefault(),a(this).blur(),qa()}),a(".pull-push-connection-info").bind("paste",function(a){setTimeout(function(){qa()},0)}),a("body").on("click",".try-again",function(){qa()}),a("body").on("click",".try-http",function(){var b=a.trim(a(".pull-push-connection-info").val()).split("\n"),c=b[0].replace("https","http"),d=c+"\n"+b[1];a(".pull-push-connection-info").val(d),qa()}),a(".create-new-profile").change(function(){J=!0}),a("body").on("click",".temporarily-disable-ssl",function(){var b="";window.location.hash&&(b=window.location.hash.substring(1)),a(this).attr("href",a(this).attr("href")+"&hash="+b)}),a("body").on("click",".pause-resume",function(a){r(a)}),a("body").on("click",".cancel",function(a){ra(a)}),a(".enter-licence").click(function(){a(".settings").click(),a(".licence-input").focus()}),b.functions.execute_next_step=function(){if(ba>0&&!1===aa)return void setTimeout(function(){aa=!0,b.functions.execute_next_step()},ba);if(aa=!1,!0===T)return a(".migration-progress-ajax-spinner").hide(),clearInterval(A),!0===ea?(a(".progress-text").html(wpmdb_strings.paused_before_finalize),ea=!1):a(".progress-text").html(wpmdb_strings.paused),a("body").on("click",".pause-resume",function(a){r(a)}),a("body").on("click",".cancel",function(a){ra(a)}),void a(".pause-resume").html(wpmdb_strings.resume);if(!0===Z){v=wpmdb_migration_type();var c;"savefile"===v?c=wpmdb_strings.removing_local_sql:"pull"===v?c="backup"===z?wpmdb_strings.removing_local_backup:wpmdb_strings.removing_local_temp_tables:"push"===v&&(c="backup"===z?wpmdb_strings.removing_remote_sql:wpmdb_strings.removing_remote_temp_tables),a(".progress-text").html(c);var d={action:"wpmdb_cancel_migration",migration_state_id:b.migration_state_id};E=!0,a.ajax({url:ajaxurl,type:"POST",dataType:"text",cache:!1,data:d,error:function(c,d,e){a(".progress-title").html(wpmdb_strings.migration_cancellation_failed),a(".progress-text").html(wpmdb_strings.manually_remove_temp_files),a(".progress-text").append("<br /><br />"+wpmdb_strings.status+": "+c.status+" "+c.statusText+"<br /><br />"+wpmdb_strings.response+":<br />"+c.responseText),a(".progress-text").addClass("migration-error"),console.log(c),console.log(d),console.log(e),E=!1,b.common.migration_error=!0,b.functions.migration_complete_events()},success:function(c){return E=!1,c=a.trim(c),"push"===v&&"1"!==c||"push"!==v&&""!==c?(a(".progress-title").html(wpmdb_strings.migration_cancellation_failed),a(".progress-text").html(c),a(".progress-text").addClass("migration-error"),b.common.migration_error=!0,void b.functions.migration_complete_events()):(B=wpmdb_strings.migration_cancelled,a(".progress-text").hide(),void b.functions.migration_complete_events())}})}else b.common.next_step_in_migration.fn.apply(null,b.common.next_step_in_migration.args)},a("body").on("click",".copy-licence-to-remote-site",function(){a(".connection-status").html(wpmdb_strings.copying_license),a(".connection-status").removeClass("notification-message error-notice migration-error"),a(".connection-status").append(ha);var b=a.trim(a(".pull-push-connection-info").val()).split("\n");E=!0,o(),a.ajax({url:ajaxurl,type:"POST",dataType:"json",cache:!1,data:{action:"wpmdb_copy_licence_to_remote_site",url:b[0],key:b[1],nonce:wpmdb_data.nonces.copy_licence_to_remote_site},error:function(b,c,d){a(".connection-status").html(na(b.responseText,"(#143)",b)),a(".connection-status").addClass("notification-message error-notice migration-error"),a(".ajax-spinner").remove(),E=!1,p()},success:function(b){return a(".ajax-spinner").remove(),E=!1,p(),"undefined"!=typeof b.wpmdb_error&&1===b.wpmdb_error?(a(".connection-status").html(b.body),a(".connection-status").addClass("notification-message error-notice migration-error"),void(b.body.indexOf("401 Unauthorized")>-1&&a(".basic-access-auth-wrapper").show())):void qa()}})}),a("body").on("click",".reactivate-licence",function(b){E=!0,a(".invalid-licence").empty().html(wpmdb_strings.attempting_to_activate_licence),a(".invalid-licence").append(ha),a.ajax({url:ajaxurl,type:"POST",dataType:"json",cache:!1,data:{action:"wpmdb_reactivate_licence",nonce:wpmdb_data.nonces.reactivate_licence},error:function(b,c,d){a(".invalid-licence").html(wpmdb_strings.activate_licence_problem),a(".invalid-licence").append("<br /><br />"+wpmdb_strings.status+": "+b.status+" "+b.statusText+"<br /><br />"+wpmdb_strings.response+"<br />"+b.responseText),a(".ajax-spinner").remove(),E=!1},success:function(b){return a(".ajax-spinner").remove(),E=!1,"undefined"!=typeof b.wpmdb_error&&1===b.wpmdb_error?void a(".invalid-licence").html(b.body):"undefined"!=typeof b.wpmdb_dbrains_api_down&&1===b.wpmdb_dbrains_api_down?(a(".invalid-licence").html(wpmdb_strings.temporarily_activated_licence),void a(".invalid-licence").append(b.body)):(a(".invalid-licence").empty().html(wpmdb_strings.licence_reactivated),void location.reload())}})}),a("input[name=table_migrate_option]").change(function(){k(),a.wpmdb.do_action("wpmdb_tables_to_migrate_changed")}),a("body").on("change","#select-tables",function(){k(),a.wpmdb.do_action("wpmdb_tables_to_migrate_changed")}),a.wpmdb.add_filter("wpmdb_get_table_prefix",u),a.wpmdb.add_filter("wpmdb_get_tables_to_migrate",t),a.wpmdb.add_filter("wpmdb_before_migration_complete_hooks",function(b){return da=a("input[name=pause_before_finalize]:checked").length?!0:!1,!0===da&&"savefile"!==v&&(r(null),ea=!0),b})})}(jQuery,wpmdb);
 
 
class/wpmdb-base.php CHANGED
@@ -14,7 +14,7 @@ class WPMDB_Base {
14
  protected $dbrains_api_url;
15
  protected $transient_timeout;
16
  protected $transient_retry_timeout;
17
- protected $dbrains_api_base = 'https://deliciousbrains.com';
18
  protected $dbrains_api_status_url = 'http://s3.amazonaws.com/cdn.deliciousbrains.com/status.json';
19
  protected $multipart_boundary = 'bWH4JVmYCnf6GfXacrcc';
20
  protected $attempting_to_connect_to;
@@ -100,6 +100,8 @@ class WPMDB_Base {
100
  * @param array $key_rules An optional associative array of expected keys and their sanitization rule(s).
101
  * @param string $state_key The key in $_POST that contains the migration state id (defaults to 'migration_state_id').
102
  * @param string $context The method that is specifying the sanitization rules. Defaults to calling method.
 
 
103
  */
104
  function set_post_data( $key_rules = array(), $state_key = 'migration_state_id', $context = '' ) {
105
  if ( defined( 'DOING_WPMDB_TESTS' ) || $this->doing_cli_migration ) {
@@ -107,11 +109,20 @@ class WPMDB_Base {
107
  } elseif ( is_null( $this->state_data ) ) {
108
  $this->state_data = WPMDB_Utils::safe_wp_unslash( $_POST );
109
  } else {
110
- return;
 
 
 
 
 
 
 
111
  }
112
 
113
  // Sanitize the new state data.
114
  if ( ! empty( $key_rules ) ) {
 
 
115
  $context = empty( $context ) ? $this->get_caller_function() : trim( $context );
116
  $this->state_data = WPMDB_Sanitize::sanitize_data( $this->state_data, $key_rules, $context );
117
 
@@ -128,6 +139,8 @@ class WPMDB_Base {
128
  if ( true !== $this->get_migration_state( $migration_state_id ) ) {
129
  exit;
130
  }
 
 
131
  }
132
 
133
  function load_plugin_textdomain() {
@@ -144,15 +157,15 @@ class WPMDB_Base {
144
  $this->addons = array(
145
  'wp-migrate-db-pro-media-files/wp-migrate-db-pro-media-files.php' => array(
146
  'name' => 'Media Files',
147
- 'required_version' => '1.4',
148
  ),
149
  'wp-migrate-db-pro-cli/wp-migrate-db-pro-cli.php' => array(
150
  'name' => 'CLI',
151
- 'required_version' => '1.2.2',
152
  ),
153
  'wp-migrate-db-pro-multisite-tools/wp-migrate-db-pro-multisite-tools.php' => array(
154
  'name' => 'Multisite Tools',
155
- 'required_version' => '1.0.2',
156
  )
157
  );
158
 
@@ -213,6 +226,8 @@ class WPMDB_Base {
213
  'blacklist_plugins' => array(),
214
  'max_request' => min( 1024 * 1024, $this->get_bottleneck( 'max' ) ),
215
  'delay_between_requests' => 0,
 
 
216
  );
217
 
218
  // if we still don't have settings exist this must be a fresh install, set up some default settings
@@ -347,7 +362,7 @@ class WPMDB_Base {
347
  return $this->retry_remote_post( $url, $data, $scope, $args, $expecting_serial );
348
  } elseif ( isset( $response->errors['http_request_failed'][0] ) && strstr( $response->errors['http_request_failed'][0], 'timed out' ) ) {
349
  $this->error = sprintf( __( 'The connection to the remote server has timed out, no changes have been committed. (#134 - scope: %s)', 'wp-migrate-db' ), $scope );
350
- } elseif ( isset( $response->errors['http_request_failed'][0] ) && ( strstr( $response->errors['http_request_failed'][0], 'Could not resolve host' ) || strstr( $response->errors['http_request_failed'][0], "couldn't connect to host" ) ) ) {
351
  $this->error = sprintf( __( 'We could not find: %s. Are you sure this is the correct URL?', 'wp-migrate-db' ), $this->state_data['url'] );
352
  $url_bits = $this->parse_url( $this->state_data['url'] );
353
  if ( strstr( $this->state_data['url'], 'dev.' ) || strstr( $this->state_data['url'], '.dev' ) || ! strstr( $url_bits['host'], '.' ) ) {
@@ -362,7 +377,7 @@ class WPMDB_Base {
362
  if ( defined( 'WP_HTTP_BLOCK_EXTERNAL' ) && WP_HTTP_BLOCK_EXTERNAL ) {
363
  $url_parts = $this->parse_url( $url );
364
  $host = $url_parts['host'];
365
- if ( ! defined( 'WP_ACCESSIBLE_HOSTS' ) || strpos( WP_ACCESSIBLE_HOSTS, $host ) === false ) {
366
  $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 );
367
  }
368
  } else {
@@ -569,7 +584,7 @@ class WPMDB_Base {
569
  }
570
 
571
  /**
572
- * Determines, sets up, and returns folder information for storying files.
573
  *
574
  * By default, the folder created will be `wp-migrate-db` and will be stored
575
  * inside of the `uploads` folder in WordPress' current `WP_CONTENT_DIR`,
@@ -700,7 +715,7 @@ class WPMDB_Base {
700
 
701
  $disable_ssl_url = network_admin_url( $this->plugin_base . '&nonce=' . wp_create_nonce( 'wpmdb-disable-ssl' ) . '&wpmdb-disable-ssl=1' );
702
  $connection_failed_message = '<div class="updated warning inline-message">';
703
- $connection_failed_message .= sprintf( __( '<strong>Could not connect to deliciousbrains.com</strong> &mdash; You will not receive update notifications or be able to activate your license until this is fixed. This issue is often caused by an improperly configured SSL server (https). We recommend <a href="%1$s" target="_blank">fixing the SSL configuration on your server</a>, but if you need a quick fix you can:%2$s', 'wp-migrate-db' ), 'https://deliciousbrains.com/wp-migrate-db-pro/doc/could-not-connect-deliciousbrains-com/', sprintf( '<p><a href="%1$s" class="temporarily-disable-ssl button">%2$s</a></p>', $disable_ssl_url, __( 'Temporarily disable SSL for connections to deliciousbrains.com', 'wp-migrate-db' ) ) );
704
  $connection_failed_message .= '</div>';
705
 
706
  if ( defined( 'WP_HTTP_BLOCK_EXTERNAL' ) && WP_HTTP_BLOCK_EXTERNAL ) {
@@ -1161,7 +1176,7 @@ class WPMDB_Base {
1161
 
1162
  if ( isset( $errors['connection_failed'] ) ) {
1163
  $disable_ssl_url = network_admin_url( $this->plugin_base . '&nonce=' . wp_create_nonce( 'wpmdb-disable-ssl' ) . '&wpmdb-disable-ssl=1' );
1164
- $message = sprintf( __( '<strong>Could not connect to deliciousbrains.com</strong> &mdash; You will not receive update notifications or be able to activate your license until this is fixed. This issue is often caused by an improperly configured SSL server (https). We recommend <a href="%1$s" target="_blank">fixing the SSL configuration on your server</a>, but if you need a quick fix you can:%2$s', 'wp-migrate-db' ), 'https://deliciousbrains.com/wp-migrate-db-pro/doc/could-not-connect-deliciousbrains-com/', sprintf( '<p><a href="%1$s" class="temporarily-disable-ssl button">%2$s</a></p>', $disable_ssl_url, __( 'Temporarily disable SSL for connections to deliciousbrains.com', 'wp-migrate-db' ) ) );
1165
 
1166
  if ( defined( 'WP_HTTP_BLOCK_EXTERNAL' ) && WP_HTTP_BLOCK_EXTERNAL ) {
1167
  $url_parts = $this->parse_url( $this->dbrains_api_base );
@@ -1355,7 +1370,9 @@ class WPMDB_Base {
1355
  * @return int
1356
  */
1357
  function get_post_max_size() {
1358
- return $this->return_bytes( trim( ini_get( 'post_max_size' ) ) );
 
 
1359
  }
1360
 
1361
  /**
@@ -1738,6 +1755,66 @@ class WPMDB_Base {
1738
  return $subsites;
1739
  }
1740
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1741
  /**
1742
  * Returns validated and sanitized form data.
1743
  *
@@ -1841,4 +1918,76 @@ class WPMDB_Base {
1841
 
1842
  return $subsites;
1843
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1844
  }
14
  protected $dbrains_api_url;
15
  protected $transient_timeout;
16
  protected $transient_retry_timeout;
17
+ protected $dbrains_api_base = 'https://api.deliciousbrains.com';
18
  protected $dbrains_api_status_url = 'http://s3.amazonaws.com/cdn.deliciousbrains.com/status.json';
19
  protected $multipart_boundary = 'bWH4JVmYCnf6GfXacrcc';
20
  protected $attempting_to_connect_to;
100
  * @param array $key_rules An optional associative array of expected keys and their sanitization rule(s).
101
  * @param string $state_key The key in $_POST that contains the migration state id (defaults to 'migration_state_id').
102
  * @param string $context The method that is specifying the sanitization rules. Defaults to calling method.
103
+ *
104
+ * @return array
105
  */
106
  function set_post_data( $key_rules = array(), $state_key = 'migration_state_id', $context = '' ) {
107
  if ( defined( 'DOING_WPMDB_TESTS' ) || $this->doing_cli_migration ) {
109
  } elseif ( is_null( $this->state_data ) ) {
110
  $this->state_data = WPMDB_Utils::safe_wp_unslash( $_POST );
111
  } else {
112
+ return $this->state_data;
113
+ }
114
+
115
+ // From this point on we're handling data originating from $_POST, so original $key_rules apply.
116
+ global $wpmdb_key_rules;
117
+
118
+ if ( empty( $key_rules ) && ! empty( $wpmdb_key_rules ) ) {
119
+ $key_rules = $wpmdb_key_rules;
120
  }
121
 
122
  // Sanitize the new state data.
123
  if ( ! empty( $key_rules ) ) {
124
+ $wpmdb_key_rules = $key_rules;
125
+
126
  $context = empty( $context ) ? $this->get_caller_function() : trim( $context );
127
  $this->state_data = WPMDB_Sanitize::sanitize_data( $this->state_data, $key_rules, $context );
128
 
139
  if ( true !== $this->get_migration_state( $migration_state_id ) ) {
140
  exit;
141
  }
142
+
143
+ return $this->state_data;
144
  }
145
 
146
  function load_plugin_textdomain() {
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
 
226
  'blacklist_plugins' => array(),
227
  'max_request' => min( 1024 * 1024, $this->get_bottleneck( 'max' ) ),
228
  'delay_between_requests' => 0,
229
+ 'prog_tables_hidden' => true,
230
+ 'pause_before_finalize' => false,
231
  );
232
 
233
  // if we still don't have settings exist this must be a fresh install, set up some default settings
362
  return $this->retry_remote_post( $url, $data, $scope, $args, $expecting_serial );
363
  } elseif ( isset( $response->errors['http_request_failed'][0] ) && strstr( $response->errors['http_request_failed'][0], 'timed out' ) ) {
364
  $this->error = sprintf( __( 'The connection to the remote server has timed out, no changes have been committed. (#134 - scope: %s)', 'wp-migrate-db' ), $scope );
365
+ } elseif ( isset( $response->errors['http_request_failed'][0] ) && ( strstr( $response->errors['http_request_failed'][0], 'Could not resolve host' ) || strstr( $response->errors['http_request_failed'][0], "Couldn't resolve host" ) || strstr( $response->errors['http_request_failed'][0], "couldn't connect to host" ) ) ) {
366
  $this->error = sprintf( __( 'We could not find: %s. Are you sure this is the correct URL?', 'wp-migrate-db' ), $this->state_data['url'] );
367
  $url_bits = $this->parse_url( $this->state_data['url'] );
368
  if ( strstr( $this->state_data['url'], 'dev.' ) || strstr( $this->state_data['url'], '.dev' ) || ! strstr( $url_bits['host'], '.' ) ) {
377
  if ( defined( 'WP_HTTP_BLOCK_EXTERNAL' ) && WP_HTTP_BLOCK_EXTERNAL ) {
378
  $url_parts = $this->parse_url( $url );
379
  $host = $url_parts['host'];
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 {
584
  }
585
 
586
  /**
587
+ * Determines, sets up, and returns folder information for storing files.
588
  *
589
  * By default, the folder created will be `wp-migrate-db` and will be stored
590
  * inside of the `uploads` folder in WordPress' current `WP_CONTENT_DIR`,
715
 
716
  $disable_ssl_url = network_admin_url( $this->plugin_base . '&nonce=' . wp_create_nonce( 'wpmdb-disable-ssl' ) . '&wpmdb-disable-ssl=1' );
717
  $connection_failed_message = '<div class="updated warning inline-message">';
718
+ $connection_failed_message .= sprintf( __( '<strong>Could not connect to api.deliciousbrains.com</strong> &mdash; You will not receive update notifications or be able to activate your license until this is fixed. This issue is often caused by an improperly configured SSL server (https). We recommend <a href="%1$s" target="_blank">fixing the SSL configuration on your server</a>, but if you need a quick fix you can:%2$s', 'wp-migrate-db' ), 'https://deliciousbrains.com/wp-migrate-db-pro/doc/could-not-connect-deliciousbrains-com/', sprintf( '<p><a href="%1$s" class="temporarily-disable-ssl button">%2$s</a></p>', $disable_ssl_url, __( 'Temporarily disable SSL for connections to api.deliciousbrains.com', 'wp-migrate-db' ) ) );
719
  $connection_failed_message .= '</div>';
720
 
721
  if ( defined( 'WP_HTTP_BLOCK_EXTERNAL' ) && WP_HTTP_BLOCK_EXTERNAL ) {
1176
 
1177
  if ( isset( $errors['connection_failed'] ) ) {
1178
  $disable_ssl_url = network_admin_url( $this->plugin_base . '&nonce=' . wp_create_nonce( 'wpmdb-disable-ssl' ) . '&wpmdb-disable-ssl=1' );
1179
+ $message = sprintf( __( '<strong>Could not connect to api.deliciousbrains.com</strong> &mdash; You will not receive update notifications or be able to activate your license until this is fixed. This issue is often caused by an improperly configured SSL server (https). We recommend <a href="%1$s" target="_blank">fixing the SSL configuration on your server</a>, but if you need a quick fix you can:%2$s', 'wp-migrate-db' ), 'https://deliciousbrains.com/wp-migrate-db-pro/doc/could-not-connect-deliciousbrains-com/', sprintf( '<p><a href="%1$s" class="temporarily-disable-ssl button">%2$s</a></p>', $disable_ssl_url, __( 'Temporarily disable SSL for connections to api.deliciousbrains.com', 'wp-migrate-db' ) ) );
1180
 
1181
  if ( defined( 'WP_HTTP_BLOCK_EXTERNAL' ) && WP_HTTP_BLOCK_EXTERNAL ) {
1182
  $url_parts = $this->parse_url( $this->dbrains_api_base );
1370
  * @return int
1371
  */
1372
  function get_post_max_size() {
1373
+ $bytes = max( wp_convert_hr_to_bytes( trim( ini_get( 'post_max_size' ) ) ), wp_convert_hr_to_bytes( trim( ini_get( 'hhvm.server.max_post_size' ) ) ) );
1374
+
1375
+ return $bytes;
1376
  }
1377
 
1378
  /**
1755
  return $subsites;
1756
  }
1757
 
1758
+ /**
1759
+ * Returns uploads info for given subsite or primary site.
1760
+ *
1761
+ * @param int $blog_id Optional, defaults to primary.
1762
+ *
1763
+ * @return array
1764
+ *
1765
+ * NOTE: Must be run from primary site.
1766
+ */
1767
+ public function uploads_info( $blog_id = 0 ) {
1768
+ static $primary_uploads = array();
1769
+
1770
+ if ( ! empty( $blog_id ) && is_multisite() ) {
1771
+ switch_to_blog( $blog_id );
1772
+ }
1773
+
1774
+ $uploads = wp_upload_dir();
1775
+
1776
+ if ( ! empty( $blog_id ) && is_multisite() ) {
1777
+ restore_current_blog();
1778
+
1779
+ if ( empty( $primary_uploads ) ) {
1780
+ $primary_uploads = $this->uploads_info();
1781
+ }
1782
+ $uploads['short_basedir'] = str_replace( trailingslashit( $primary_uploads['basedir'] ), '', trailingslashit( $uploads['basedir'] ) );
1783
+ }
1784
+
1785
+ return $uploads;
1786
+ }
1787
+
1788
+ /**
1789
+ * Get array of subsite info keyed by their ID.
1790
+ *
1791
+ * @return array
1792
+ */
1793
+ public function subsites_info() {
1794
+ $subsites = array();
1795
+
1796
+ if ( ! is_multisite() ) {
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
+
1810
+ $subsites[ $subsite['blog_id'] ]['uploads']['url'] = substr_replace( $subsites[ $subsite['blog_id'] ]['uploads']['url'], $subsites[ $subsite['blog_id'] ]['site_url'], 0, strlen( $primary_url ) );
1811
+ $subsites[ $subsite['blog_id'] ]['uploads']['baseurl'] = substr_replace( $subsites[ $subsite['blog_id'] ]['uploads']['baseurl'], $subsites[ $subsite['blog_id'] ]['site_url'], 0, strlen( $primary_url ) );
1812
+ }
1813
+ }
1814
+
1815
+ return $subsites;
1816
+ }
1817
+
1818
  /**
1819
  * Returns validated and sanitized form data.
1820
  *
1918
 
1919
  return $subsites;
1920
  }
1921
+
1922
+ /**
1923
+ * Returns an associative array of html escaped useful information about the site.
1924
+ *
1925
+ * @return array
1926
+ */
1927
+ public function site_details() {
1928
+ global $wpdb;
1929
+ $table_prefix = $wpdb->base_prefix;
1930
+ $uploads = wp_upload_dir();
1931
+
1932
+ $site_details = array(
1933
+ 'is_multisite' => esc_html( is_multisite() ? 'true' : 'false' ),
1934
+ 'site_url' => esc_html( addslashes( site_url() ) ),
1935
+ 'prefix' => esc_html( $table_prefix ),
1936
+ 'uploads_baseurl' => esc_html( addslashes( trailingslashit( $uploads['baseurl'] ) ) ),
1937
+ 'uploads' => $this->uploads_info(),
1938
+ 'uploads_dir' => esc_html( addslashes( $this->get_short_uploads_dir() ) ),
1939
+ 'subsites' => $this->subsites_list(),
1940
+ 'subsites_info' => $this->subsites_info(),
1941
+ );
1942
+
1943
+ return $site_details;
1944
+ }
1945
+
1946
+ /**
1947
+ * Returns an uploads dir without leading path to site.
1948
+ *
1949
+ * @return string
1950
+ */
1951
+ public function get_short_uploads_dir() {
1952
+ $short_path = str_replace( $this->get_absolute_root_file_path(), '', $this->get_upload_info( 'path' ) );
1953
+
1954
+ return trailingslashit( substr( str_replace( '\\', '/', $short_path ), 1 ) );
1955
+ }
1956
+
1957
+ /**
1958
+ * Returns max upload size in bytes, defaults to 25M if no limits set.
1959
+ *
1960
+ * @return int
1961
+ */
1962
+ public function get_max_upload_size() {
1963
+ $bytes = wp_max_upload_size();
1964
+
1965
+ if ( 1 > (int) $bytes ) {
1966
+ $p_bytes = wp_convert_hr_to_bytes( ini_get( 'post_max_size' ) );
1967
+ $u_bytes = wp_convert_hr_to_bytes( ini_get( 'upload_max_filesize' ) );
1968
+
1969
+ // If HHVM bug not returning either value, try its own settings.
1970
+ // If HHVM not involved, will drop through to default value.
1971
+ if ( empty( $p_bytes ) && empty( $u_bytes ) ) {
1972
+ $p_bytes = wp_convert_hr_to_bytes( ini_get( 'hhvm.server.max_post_size' ) );
1973
+ $u_bytes = wp_convert_hr_to_bytes( ini_get( 'hhvm.server.upload.upload_max_file_size' ) );
1974
+
1975
+ $bytes = min( $p_bytes, $u_bytes );
1976
+
1977
+ if ( 0 < (int) $bytes ) {
1978
+ return $bytes;
1979
+ }
1980
+ }
1981
+
1982
+ if ( 0 < (int) $p_bytes ) {
1983
+ $bytes = $p_bytes;
1984
+ } elseif ( 0 < (int) $u_bytes ) {
1985
+ $bytes = $u_bytes;
1986
+ } else {
1987
+ $bytes = wp_convert_hr_to_bytes( '25M' );
1988
+ }
1989
+ }
1990
+
1991
+ return $bytes;
1992
+ }
1993
  }
class/wpmdb-cli.php CHANGED
@@ -117,6 +117,9 @@ class WPMDB_CLI extends WPMDB_Base {
117
  }
118
  }
119
 
 
 
 
120
  // Check for tables specified in migration profile that do not exist in the source database
121
  if ( ! empty( $this->profile['select_tables'] ) ) {
122
  $source_tables = apply_filters( 'wpmdb_cli_filter_source_tables', $this->get_tables() );
@@ -238,10 +241,14 @@ class WPMDB_CLI extends WPMDB_Base {
238
 
239
  WP_CLI::log( __( 'Initiating migration...', 'wp-migrate-db-cli' ) );
240
 
241
- $migration_args = $this->post_data;
242
- $migration_args['form_data'] = http_build_query( $this->profile );
243
- $migration_args['stage'] = 'migrate';
244
- $this->post_data = apply_filters( 'wpmdb_cli_initiate_migration_args', $migration_args, $this->profile );
 
 
 
 
245
 
246
  $response = $this->initiate_migration( $this->post_data );
247
 
117
  }
118
  }
119
 
120
+ // Ensure local site_details available.
121
+ $this->post_data['site_details']['local'] = $this->site_details();
122
+
123
  // Check for tables specified in migration profile that do not exist in the source database
124
  if ( ! empty( $this->profile['select_tables'] ) ) {
125
  $source_tables = apply_filters( 'wpmdb_cli_filter_source_tables', $this->get_tables() );
241
 
242
  WP_CLI::log( __( 'Initiating migration...', 'wp-migrate-db-cli' ) );
243
 
244
+ $migration_args = $this->post_data;
245
+ $migration_args['form_data'] = http_build_query( $this->profile );
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'] );
252
 
253
  $response = $this->initiate_migration( $this->post_data );
254
 
class/wpmdb-command.php CHANGED
@@ -75,6 +75,38 @@ class WPMDB_Command extends WP_CLI_Command {
75
  $this->_perform_cli_migration( $profile );
76
  }
77
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
78
 
79
  /**
80
  * Get profile data from CLI args.
@@ -87,15 +119,29 @@ class WPMDB_Command extends WP_CLI_Command {
87
  protected function _get_profile_data_from_args( $args, $assoc_args ) {
88
 
89
  //load correct cli class
90
- if ( function_exists( 'wp_migrate_db_pro_cli_addon' ) ){
91
  $wpmdb_cli = wp_migrate_db_pro_cli_addon();
92
- }
93
- elseif ( function_exists( 'wpmdb_pro_cli' ) ) {
94
  $wpmdb_cli = wpmdb_pro_cli();
95
  } else {
96
  $wpmdb_cli = wpmdb_cli();
97
  }
98
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
99
  if ( empty( $assoc_args['action'] ) ) {
100
  return $wpmdb_cli->cli_error( __( 'Missing action parameter', 'wp-migrate-db-cli' ) );
101
  }
@@ -166,7 +212,6 @@ class WPMDB_Command extends WP_CLI_Command {
166
  if ( ! @touch( $export_dest ) ) {
167
  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 ) );
168
  }
169
-
170
  }
171
 
172
  $profile = compact(
75
  $this->_perform_cli_migration( $profile );
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
  /**
112
  * Get profile data from CLI args.
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
  }
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(
class/wpmdb-filesystem.php CHANGED
@@ -104,19 +104,21 @@ class WPMDB_Filesystem {
104
  * @return bool
105
  */
106
  public function touch( $abs_path, $time = 0, $atime = 0 ) {
107
- $abs_path = $this->get_sanitized_path( $abs_path );
108
- if ( $this->use_filesystem ) {
109
- return $this->wp_filesystem->touch( $abs_path, $time, $atime );
110
- } else {
111
- if ( 0 == $time ) {
112
- $time = time();
113
- }
114
- if ( 0 == $atime ) {
115
- $atime = time();
116
- }
117
 
118
- return @touch( $abs_path, $time, $atime );
 
 
 
 
119
  }
 
 
120
  }
121
 
122
  /**
@@ -128,16 +130,15 @@ class WPMDB_Filesystem {
128
  * @return bool
129
  */
130
  public function put_contents( $abs_path, $contents ) {
131
- $abs_path = $this->get_sanitized_path( $abs_path );
132
-
133
- if ( $this->use_filesystem ) {
134
- return $this->wp_filesystem->put_contents( $abs_path, $contents, $this->chmod_file );
135
- } else {
136
- $return = @file_put_contents( $abs_path, $contents );
137
- $this->chmod( $abs_path );
138
 
139
- return (bool) $return;
 
 
140
  }
 
 
141
  }
142
 
143
  /**
@@ -148,13 +149,14 @@ class WPMDB_Filesystem {
148
  * @return bool
149
  */
150
  public function file_exists( $abs_path ) {
151
- $abs_path = $this->get_sanitized_path( $abs_path );
152
 
153
- if ( $this->use_filesystem ) {
154
- return $this->wp_filesystem->exists( $abs_path );
155
- } else {
156
- return file_exists( $abs_path );
157
  }
 
 
158
  }
159
 
160
  /**
@@ -165,13 +167,14 @@ class WPMDB_Filesystem {
165
  * @return int
166
  */
167
  public function filesize( $abs_path ) {
168
- $abs_path = $this->get_sanitized_path( $abs_path );
169
 
170
- if ( $this->use_filesystem ) {
171
- return $this->wp_filesystem->size( $abs_path );
172
- } else {
173
- return filesize( $abs_path );
174
  }
 
 
175
  }
176
 
177
  /**
@@ -182,13 +185,14 @@ class WPMDB_Filesystem {
182
  * @return string
183
  */
184
  public function get_contents( $abs_path ) {
185
- $abs_path = $this->get_sanitized_path( $abs_path );
186
 
187
- if ( $this->use_filesystem ) {
188
- return $this->wp_filesystem->get_contents( $abs_path );
189
- } else {
190
- return @file_get_contents( $abs_path );
191
  }
 
 
192
  }
193
 
194
  /**
@@ -199,13 +203,14 @@ class WPMDB_Filesystem {
199
  * @return bool
200
  */
201
  public function unlink( $abs_path ) {
202
- $abs_path = $this->get_sanitized_path( $abs_path );
203
 
204
- if ( $this->use_filesystem ) {
205
- return $this->wp_filesystem->delete( $abs_path, false, false );
206
- } else {
207
- return @unlink( $abs_path );
208
  }
 
 
209
  }
210
 
211
  /**
@@ -219,17 +224,18 @@ class WPMDB_Filesystem {
219
  * Leave $perms blank to use $this->chmod_file/DIR or pass value like 0777
220
  */
221
  public function chmod( $abs_path, $perms = null ) {
222
- $abs_path = $this->get_sanitized_path( $abs_path );
223
-
224
  if ( is_null( $perms ) ) {
225
  $perms = $this->is_file( $abs_path ) ? $this->chmod_file : $this->chmod_dir;
226
  }
227
 
228
- if ( $this->use_filesystem ) {
229
- return $this->wp_filesystem->chmod( $abs_path, $perms, false );
230
- } else {
231
- return @chmod( $abs_path, $perms );
 
232
  }
 
 
233
  }
234
 
235
  /**
@@ -240,13 +246,14 @@ class WPMDB_Filesystem {
240
  * @return bool
241
  */
242
  public function is_dir( $abs_path ) {
243
- $abs_path = $this->get_sanitized_path( $abs_path );
244
 
245
- if ( $this->use_filesystem ) {
246
- return $this->wp_filesystem->is_dir( $abs_path );
247
- } else {
248
- return is_dir( $abs_path );
249
  }
 
 
250
  }
251
 
252
  /**
@@ -257,13 +264,14 @@ class WPMDB_Filesystem {
257
  * @return bool
258
  */
259
  public function is_file( $abs_path ) {
260
- $abs_path = $this->get_sanitized_path( $abs_path );
261
 
262
- if ( $this->use_filesystem ) {
263
- return $this->wp_filesystem->is_file( $abs_path );
264
- } else {
265
- return is_file( $abs_path );
266
  }
 
 
267
  }
268
 
269
  /**
@@ -274,13 +282,14 @@ class WPMDB_Filesystem {
274
  * @return bool
275
  */
276
  public function is_readable( $abs_path ) {
277
- $abs_path = $this->get_sanitized_path( $abs_path );
278
 
279
- if ( $this->use_filesystem ) {
280
- return $this->wp_filesystem->is_readable( $abs_path );
281
- } else {
282
- return is_readable( $abs_path );
283
  }
 
 
284
  }
285
 
286
  /**
@@ -291,13 +300,14 @@ class WPMDB_Filesystem {
291
  * @return bool
292
  */
293
  public function is_writable( $abs_path ) {
294
- $abs_path = $this->get_sanitized_path( $abs_path );
295
 
296
- if ( $this->use_filesystem ) {
297
- return $this->wp_filesystem->is_writable( $abs_path );
298
- } else {
299
- return is_writable( $abs_path );
300
  }
 
 
301
  }
302
 
303
  /**
@@ -309,38 +319,58 @@ class WPMDB_Filesystem {
309
  * @return bool
310
  */
311
  public function mkdir( $abs_path, $perms = null ) {
312
- $abs_path = $this->get_sanitized_path( $abs_path );
313
-
314
  if ( is_null( $perms ) ) {
315
  $perms = $this->chmod_dir;
316
  }
317
 
318
  if ( $this->is_dir( $abs_path ) ) {
 
 
319
  return true;
320
- } else {
321
- if ( $this->use_filesystem ) {
322
- // WP_Filesystem doesn't offer a recursive mkdir()
323
- $abs_path = str_replace( '//', '/', $abs_path );
324
- $abs_path = rtrim( $abs_path, '/' );
325
- if ( empty( $abs_path ) ) {
326
- $abs_path = '/';
327
- }
328
 
329
- $dirs = explode( '/', ltrim( $abs_path, '/' ) );
330
- $current_dir = '';
 
 
 
331
 
332
- foreach ( $dirs as $dir ) {
333
- $current_dir .= '/' . $dir;
334
- if ( ! $this->is_dir( $current_dir ) ) {
335
- $this->wp_filesystem->mkdir( $current_dir, $perms );
336
- }
337
- }
338
 
339
- return $this->is_dir( $abs_path );
340
- } else {
341
- return @mkdir( $abs_path, $perms, true );
 
 
 
 
 
 
 
342
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
343
  }
 
 
344
  }
345
 
346
  /**
@@ -352,45 +382,44 @@ class WPMDB_Filesystem {
352
  * @return bool
353
  */
354
  public function rmdir( $abs_path, $recursive = false ) {
355
- $abs_path = $this->get_sanitized_path( $abs_path );
356
-
357
  if ( ! $this->is_dir( $abs_path ) ) {
358
  return false;
359
  }
360
 
361
- if ( $this->use_filesystem ) {
362
- return $this->wp_filesystem->rmdir( $abs_path, $recursive );
 
363
  } else {
364
 
365
- // taken from WP_Filesystem_Direct
366
- if ( ! $recursive ) {
367
- return @rmdir( $abs_path );
368
- }
369
-
370
  // At this point it's a folder, and we're in recursive mode
371
  $abs_path = trailingslashit( $abs_path );
372
  $filelist = $this->scandir( $abs_path );
373
 
374
- $retval = true;
375
  if ( is_array( $filelist ) ) {
376
  foreach ( $filelist as $filename => $fileinfo ) {
377
 
378
  if ( 'd' === $fileinfo['type'] ) {
379
- $retval = $this->rmdir( $abs_path . $filename, $recursive );
380
  } else {
381
- $retval = $this->unlink( $abs_path . $filename );
382
  }
383
  }
384
  }
385
 
386
  if ( file_exists( $abs_path ) && ! @rmdir( $abs_path ) ) {
387
- $retval = false;
388
  }
 
389
 
390
- return $retval;
 
 
 
391
  }
392
 
393
- return false;
 
394
  }
395
 
396
  /**
@@ -401,30 +430,33 @@ class WPMDB_Filesystem {
401
  * @return array|bool
402
  */
403
  public function scandir( $abs_path ) {
404
- $abs_path = $this->get_sanitized_path( $abs_path );
405
 
406
- if ( $this->use_filesystem ) {
407
- return $this->wp_filesystem->dirlist( $abs_path, true, false );
408
- } else {
409
- $dirlist = @scandir( $abs_path );
410
- if ( false === $dirlist ) {
411
- return false;
412
- }
413
- $return = array();
414
 
415
- // normalize return to look somewhat like the return value for WP_Filesystem::dirlist
416
- foreach ( $dirlist as $entry ) {
417
- if ( '.' === $entry || '..' === $entry ) {
418
- continue;
419
- }
420
- $return[ $entry ] = array(
421
- 'name' => $entry,
422
- 'type' => $this->is_dir( $abs_path . '/' . $entry ) ? 'd' : 'f',
423
- );
424
  }
425
 
426
- return $return;
 
 
 
 
 
 
 
 
 
 
 
 
 
427
  }
 
 
 
428
  }
429
 
430
  /**
@@ -460,29 +492,29 @@ class WPMDB_Filesystem {
460
  *
461
  * Taken from WP_Filesystem_Direct
462
  */
463
- public function copy( $source_abs_path, $destination_abs_path, $overwrite = false, $perms = false ) {
464
- $source_abs_path = $this->get_sanitized_path( $source_abs_path );
465
- $destination_abs_path = $this->get_sanitized_path( $destination_abs_path );
466
 
467
  // error if source file doesn't exist
468
  if ( ! $this->file_exists( $source_abs_path ) ) {
469
  return false;
470
  }
471
 
472
- if ( $this->use_filesystem ) {
473
- return $this->wp_filesystem->copy( $source_abs_path, $destination_abs_path, $overwrite, $perms );
474
- } else {
475
- if ( ! $overwrite && $this->file_exists( $destination_abs_path ) ) {
476
- return false;
477
- }
478
 
479
- $rtval = copy( $source_abs_path, $destination_abs_path );
480
- if ( $perms ) {
481
- $this->chmod( $destination_abs_path, $perms );
482
- }
483
 
484
- return $rtval;
 
 
 
485
  }
 
 
486
  }
487
 
488
  /**
@@ -494,34 +526,36 @@ class WPMDB_Filesystem {
494
  *
495
  * @return bool
496
  */
497
- public function move( $source_abs_path, $destination_abs_path, $overwrite = false ) {
498
- $source_abs_path = $this->get_sanitized_path( $source_abs_path );
499
- $destination_abs_path = $this->get_sanitized_path( $destination_abs_path );
500
 
501
  // error if source file doesn't exist
502
  if ( ! $this->file_exists( $source_abs_path ) ) {
503
  return false;
504
  }
505
 
506
- if ( $this->use_filesystem ) {
507
- return $this->wp_filesystem->move( $source_abs_path, $destination_abs_path, $overwrite );
 
 
 
 
508
  } else {
 
 
509
 
510
- // Try using rename first. if that fails (for example, source is read only) try copy.
511
- // Taken in part from WP_Filesystem_Direct
512
- if ( ! $overwrite && $this->file_exists( $destination_abs_path ) ) {
513
- return false;
514
- } elseif ( @rename( $source_abs_path, $destination_abs_path ) ) {
515
  return true;
516
  } else {
517
- if ( $this->copy( $source_abs_path, $destination_abs_path, $overwrite ) && $this->exists( $destination_abs_path ) ) {
518
- $this->unlink( $source_abs_path );
519
-
520
- return true;
521
- } else {
522
- return false;
523
- }
524
  }
525
  }
 
 
 
 
 
 
 
 
 
526
  }
527
  }
104
  * @return bool
105
  */
106
  public function touch( $abs_path, $time = 0, $atime = 0 ) {
107
+ if ( 0 == $time ) {
108
+ $time = time();
109
+ }
110
+ if ( 0 == $atime ) {
111
+ $atime = time();
112
+ }
 
 
 
 
113
 
114
+ $return = @touch( $abs_path, $time, $atime );
115
+
116
+ if ( ! $return && $this->use_filesystem ) {
117
+ $abs_path = $this->get_sanitized_path( $abs_path );
118
+ $return = $this->wp_filesystem->touch( $abs_path, $time, $atime );
119
  }
120
+
121
+ return $return;
122
  }
123
 
124
  /**
130
  * @return bool
131
  */
132
  public function put_contents( $abs_path, $contents ) {
133
+ $return = @file_put_contents( $abs_path, $contents );
134
+ $this->chmod( $abs_path );
 
 
 
 
 
135
 
136
+ if ( ! $return && $this->use_filesystem ) {
137
+ $abs_path = $this->get_sanitized_path( $abs_path );
138
+ $return = $this->wp_filesystem->put_contents( $abs_path, $contents, $this->chmod_file );
139
  }
140
+
141
+ return (bool) $return;
142
  }
143
 
144
  /**
149
  * @return bool
150
  */
151
  public function file_exists( $abs_path ) {
152
+ $return = file_exists( $abs_path );
153
 
154
+ if ( ! $return && $this->use_filesystem ) {
155
+ $abs_path = $this->get_sanitized_path( $abs_path );
156
+ $return = $this->wp_filesystem->exists( $abs_path );
 
157
  }
158
+
159
+ return (bool) $return;
160
  }
161
 
162
  /**
167
  * @return int
168
  */
169
  public function filesize( $abs_path ) {
170
+ $return = filesize( $abs_path );
171
 
172
+ if ( ! $return && $this->use_filesystem ) {
173
+ $abs_path = $this->get_sanitized_path( $abs_path );
174
+ $return = $this->wp_filesystem->size( $abs_path );
 
175
  }
176
+
177
+ return $return;
178
  }
179
 
180
  /**
185
  * @return string
186
  */
187
  public function get_contents( $abs_path ) {
188
+ $return = @file_get_contents( $abs_path );
189
 
190
+ if ( ! $return && $this->use_filesystem ) {
191
+ $abs_path = $this->get_sanitized_path( $abs_path );
192
+ $return = $this->wp_filesystem->get_contents( $abs_path );
 
193
  }
194
+
195
+ return $return;
196
  }
197
 
198
  /**
203
  * @return bool
204
  */
205
  public function unlink( $abs_path ) {
206
+ $return = @unlink( $abs_path );
207
 
208
+ if ( ! $return && $this->use_filesystem ) {
209
+ $abs_path = $this->get_sanitized_path( $abs_path );
210
+ $return = $this->wp_filesystem->delete( $abs_path, false, false );
 
211
  }
212
+
213
+ return $return;
214
  }
215
 
216
  /**
224
  * Leave $perms blank to use $this->chmod_file/DIR or pass value like 0777
225
  */
226
  public function chmod( $abs_path, $perms = null ) {
 
 
227
  if ( is_null( $perms ) ) {
228
  $perms = $this->is_file( $abs_path ) ? $this->chmod_file : $this->chmod_dir;
229
  }
230
 
231
+ $return = @chmod( $abs_path, $perms );
232
+
233
+ if ( ! $return && $this->use_filesystem ) {
234
+ $abs_path = $this->get_sanitized_path( $abs_path );
235
+ $return = $this->wp_filesystem->chmod( $abs_path, $perms, false );
236
  }
237
+
238
+ return $return;
239
  }
240
 
241
  /**
246
  * @return bool
247
  */
248
  public function is_dir( $abs_path ) {
249
+ $return = is_dir( $abs_path );
250
 
251
+ if ( ! $return && $this->use_filesystem ) {
252
+ $abs_path = $this->get_sanitized_path( $abs_path );
253
+ $return = $this->wp_filesystem->is_dir( $abs_path );
 
254
  }
255
+
256
+ return $return;
257
  }
258
 
259
  /**
264
  * @return bool
265
  */
266
  public function is_file( $abs_path ) {
267
+ $return = is_file( $abs_path );
268
 
269
+ if ( ! $return && $this->use_filesystem ) {
270
+ $abs_path = $this->get_sanitized_path( $abs_path );
271
+ $return = $this->wp_filesystem->is_file( $abs_path );
 
272
  }
273
+
274
+ return $return;
275
  }
276
 
277
  /**
282
  * @return bool
283
  */
284
  public function is_readable( $abs_path ) {
285
+ $return = is_readable( $abs_path );
286
 
287
+ if ( ! $return && $this->use_filesystem ) {
288
+ $abs_path = $this->get_sanitized_path( $abs_path );
289
+ $return = $this->wp_filesystem->is_readable( $abs_path );
 
290
  }
291
+
292
+ return $return;
293
  }
294
 
295
  /**
300
  * @return bool
301
  */
302
  public function is_writable( $abs_path ) {
303
+ $return = is_writable( $abs_path );
304
 
305
+ if ( ! $return && $this->use_filesystem ) {
306
+ $abs_path = $this->get_sanitized_path( $abs_path );
307
+ $return = $this->wp_filesystem->is_writable( $abs_path );
 
308
  }
309
+
310
+ return $return;
311
  }
312
 
313
  /**
319
  * @return bool
320
  */
321
  public function mkdir( $abs_path, $perms = null ) {
 
 
322
  if ( is_null( $perms ) ) {
323
  $perms = $this->chmod_dir;
324
  }
325
 
326
  if ( $this->is_dir( $abs_path ) ) {
327
+ $this->chmod( $perms );
328
+
329
  return true;
330
+ }
 
 
 
 
 
 
 
331
 
332
+ try {
333
+ $mkdirp = wp_mkdir_p( $abs_path );
334
+ } catch ( Exception $e ) {
335
+ $mkdirp = false;
336
+ }
337
 
338
+ if ( $mkdirp ) {
339
+ $this->chmod( $perms );
 
 
 
 
340
 
341
+ return true;
342
+ }
343
+
344
+ $return = @mkdir( $abs_path, $perms, true );
345
+
346
+ if ( ! $return && $this->use_filesystem ) {
347
+ $abs_path = $this->get_sanitized_path( $abs_path );
348
+
349
+ if ( $this->is_dir( $abs_path ) ) {
350
+ return true;
351
  }
352
+
353
+ // WP_Filesystem doesn't offer a recursive mkdir()
354
+ $abs_path = str_replace( '//', '/', $abs_path );
355
+ $abs_path = rtrim( $abs_path, '/' );
356
+ if ( empty( $abs_path ) ) {
357
+ $abs_path = '/';
358
+ }
359
+
360
+ $dirs = explode( '/', ltrim( $abs_path, '/' ) );
361
+ $current_dir = '';
362
+
363
+ foreach ( $dirs as $dir ) {
364
+ $current_dir .= '/' . $dir;
365
+ if ( ! $this->is_dir( $current_dir ) ) {
366
+ $this->wp_filesystem->mkdir( $current_dir, $perms );
367
+ }
368
+ }
369
+
370
+ $return = $this->is_dir( $abs_path );
371
  }
372
+
373
+ return $return;
374
  }
375
 
376
  /**
382
  * @return bool
383
  */
384
  public function rmdir( $abs_path, $recursive = false ) {
 
 
385
  if ( ! $this->is_dir( $abs_path ) ) {
386
  return false;
387
  }
388
 
389
+ // taken from WP_Filesystem_Direct
390
+ if ( ! $recursive ) {
391
+ $return = @rmdir( $abs_path );
392
  } else {
393
 
 
 
 
 
 
394
  // At this point it's a folder, and we're in recursive mode
395
  $abs_path = trailingslashit( $abs_path );
396
  $filelist = $this->scandir( $abs_path );
397
 
398
+ $return = true;
399
  if ( is_array( $filelist ) ) {
400
  foreach ( $filelist as $filename => $fileinfo ) {
401
 
402
  if ( 'd' === $fileinfo['type'] ) {
403
+ $return = $this->rmdir( $abs_path . $filename, $recursive );
404
  } else {
405
+ $return = $this->unlink( $abs_path . $filename );
406
  }
407
  }
408
  }
409
 
410
  if ( file_exists( $abs_path ) && ! @rmdir( $abs_path ) ) {
411
+ $return = false;
412
  }
413
+ }
414
 
415
+ if ( ! $return && $this->use_filesystem ) {
416
+ $abs_path = $this->get_sanitized_path( $abs_path );
417
+
418
+ return $this->wp_filesystem->rmdir( $abs_path, $recursive );
419
  }
420
 
421
+ return $return;
422
+
423
  }
424
 
425
  /**
430
  * @return array|bool
431
  */
432
  public function scandir( $abs_path ) {
 
433
 
434
+ $dirlist = @scandir( $abs_path );
435
+ if ( false === $dirlist ) {
436
+ if ( $this->use_filesystem ) {
437
+ $abs_path = $this->get_sanitized_path( $abs_path );
 
 
 
 
438
 
439
+ return $this->wp_filesystem->dirlist( $abs_path, true, false );
 
 
 
 
 
 
 
 
440
  }
441
 
442
+ return false;
443
+ }
444
+
445
+ $return = array();
446
+
447
+ // normalize return to look somewhat like the return value for WP_Filesystem::dirlist
448
+ foreach ( $dirlist as $entry ) {
449
+ if ( '.' === $entry || '..' === $entry ) {
450
+ continue;
451
+ }
452
+ $return[ $entry ] = array(
453
+ 'name' => $entry,
454
+ 'type' => $this->is_dir( $abs_path . '/' . $entry ) ? 'd' : 'f',
455
+ );
456
  }
457
+
458
+ return $return;
459
+
460
  }
461
 
462
  /**
492
  *
493
  * Taken from WP_Filesystem_Direct
494
  */
495
+ public function copy( $source_abs_path, $destination_abs_path, $overwrite = true, $perms = false ) {
 
 
496
 
497
  // error if source file doesn't exist
498
  if ( ! $this->file_exists( $source_abs_path ) ) {
499
  return false;
500
  }
501
 
502
+ if ( ! $overwrite && $this->file_exists( $destination_abs_path ) ) {
503
+ return false;
504
+ }
 
 
 
505
 
506
+ $return = copy( $source_abs_path, $destination_abs_path );
507
+ if ( $perms && $return ) {
508
+ $this->chmod( $destination_abs_path, $perms );
509
+ }
510
 
511
+ if ( ! $return && $this->use_filesystem ) {
512
+ $source_abs_path = $this->get_sanitized_path( $source_abs_path );
513
+ $destination_abs_path = $this->get_sanitized_path( $destination_abs_path );
514
+ $return = $this->wp_filesystem->copy( $source_abs_path, $destination_abs_path, $overwrite, $perms );
515
  }
516
+
517
+ return $return;
518
  }
519
 
520
  /**
526
  *
527
  * @return bool
528
  */
529
+ public function move( $source_abs_path, $destination_abs_path, $overwrite = true ) {
 
 
530
 
531
  // error if source file doesn't exist
532
  if ( ! $this->file_exists( $source_abs_path ) ) {
533
  return false;
534
  }
535
 
536
+ // Try using rename first. if that fails (for example, source is read only) try copy.
537
+ // Taken in part from WP_Filesystem_Direct
538
+ if ( ! $overwrite && $this->file_exists( $destination_abs_path ) ) {
539
+ return false;
540
+ } elseif ( @rename( $source_abs_path, $destination_abs_path ) ) {
541
+ return true;
542
  } else {
543
+ if ( $this->copy( $source_abs_path, $destination_abs_path, $overwrite ) && $this->file_exists( $destination_abs_path ) ) {
544
+ $this->unlink( $source_abs_path );
545
 
 
 
 
 
 
546
  return true;
547
  } else {
548
+ $return = false;
 
 
 
 
 
 
549
  }
550
  }
551
+
552
+ if ( ! $return && $this->use_filesystem ) {
553
+ $source_abs_path = $this->get_sanitized_path( $source_abs_path );
554
+ $destination_abs_path = $this->get_sanitized_path( $destination_abs_path );
555
+
556
+ $return = $this->wp_filesystem->move( $source_abs_path, $destination_abs_path, $overwrite );
557
+ }
558
+
559
+ return $return;
560
  }
561
  }
class/wpmdb-sanitize.php CHANGED
@@ -4,9 +4,9 @@ class WPMDB_Sanitize {
4
  /**
5
  * Sanitize and validate data.
6
  *
7
- * @param string|array $data The data to the sanitized.
8
  * @param string|array $key_rules The keys in the data (if data is an array) and the sanitization rule(s) to apply for each key.
9
- * @param string $context Additional context data for messages etc.
10
  *
11
  * @return mixed The sanitized data, the data if no key rules supplied or `false` if an unrecognized rule supplied.
12
  */
@@ -21,10 +21,10 @@ class WPMDB_Sanitize {
21
  /**
22
  * Sanitize and validate data.
23
  *
24
- * @param string|array $data The data to the sanitized.
25
- * @param string|array $key_rules The keys in the data (if data is an array) and the sanitization rule(s) to apply for each key.
26
- * @param string $context Additional context data for messages etc.
27
- * @param int $recursion_level How deep in the recursion are we? Optional, defaults to 0.
28
  *
29
  * @return mixed The sanitized data, the data if no key rules supplied or `false` if an unrecognized rule supplied.
30
  */
@@ -87,6 +87,19 @@ class WPMDB_Sanitize {
87
  if ( ! is_string( $data ) || ! is_serialized( $data ) ) {
88
  wp_die( sprintf( __( '%1$s was expecting serialized data but got something else: "%2$s"', 'wp-db-migrate-pro' ), $context, $data ) );
89
 
 
 
 
 
 
 
 
 
 
 
 
 
 
90
  return false;
91
  }
92
  } elseif ( 'numeric' == $key_rules ) {
4
  /**
5
  * Sanitize and validate data.
6
  *
7
+ * @param string|array $data The data to the sanitized.
8
  * @param string|array $key_rules The keys in the data (if data is an array) and the sanitization rule(s) to apply for each key.
9
+ * @param string $context Additional context data for messages etc.
10
  *
11
  * @return mixed The sanitized data, the data if no key rules supplied or `false` if an unrecognized rule supplied.
12
  */
21
  /**
22
  * Sanitize and validate data.
23
  *
24
+ * @param string|array $data The data to the sanitized.
25
+ * @param string|array $key_rules The keys in the data (if data is an array) and the sanitization rule(s) to apply for each key.
26
+ * @param string $context Additional context data for messages etc.
27
+ * @param int $recursion_level How deep in the recursion are we? Optional, defaults to 0.
28
  *
29
  * @return mixed The sanitized data, the data if no key rules supplied or `false` if an unrecognized rule supplied.
30
  */
87
  if ( ! is_string( $data ) || ! is_serialized( $data ) ) {
88
  wp_die( sprintf( __( '%1$s was expecting serialized data but got something else: "%2$s"', 'wp-db-migrate-pro' ), $context, $data ) );
89
 
90
+ return false;
91
+ }
92
+ } elseif ( 'json_array' == $key_rules ) {
93
+ if ( ! is_string( $data ) || ! WPMDB::is_json( $data ) ) {
94
+ wp_die( sprintf( __( '%1$s was expecting JSON data but got something else: "%2$s"', 'wp-db-migrate-pro' ), $context, $data ) );
95
+
96
+ return false;
97
+ }
98
+ $data = json_decode( $data, true );
99
+ } elseif ( 'json' == $key_rules ) {
100
+ if ( ! is_string( $data ) || ! WPMDB::is_json( $data ) ) {
101
+ wp_die( sprintf( __( '%1$s was expecting JSON data but got something else: "%2$s"', 'wp-db-migrate-pro' ), $context, $data ) );
102
+
103
  return false;
104
  }
105
  } elseif ( 'numeric' == $key_rules ) {
class/wpmdb.php CHANGED
@@ -2,7 +2,6 @@
2
 
3
  class WPMDB extends WPMDB_Base {
4
  protected $fp;
5
- protected $absolute_root_file_path;
6
  protected $form_defaults;
7
  protected $accepted_fields;
8
  protected $default_profile;
@@ -38,20 +37,14 @@ class WPMDB extends WPMDB_Base {
38
  add_action( 'wp_ajax_wpmdb_save_profile', array( $this, 'ajax_save_profile' ) );
39
  add_action( 'wp_ajax_wpmdb_initiate_migration', array( $this, 'ajax_initiate_migration' ) );
40
  add_action( 'wp_ajax_wpmdb_migrate_table', array( $this, 'ajax_migrate_table' ) );
41
- add_action( 'wp_ajax_wpmdb_finalize_migration', array( $this, 'ajax_finalize_migration' ) );
42
- add_action( 'wp_ajax_wpmdb_flush', array( $this, 'ajax_flush' ) );
43
- add_action( 'wp_ajax_nopriv_wpmdb_flush', array( $this, 'ajax_nopriv_flush' ) ); // Required for Pull if user tables being updated.
44
  add_action( 'wp_ajax_wpmdb_clear_log', array( $this, 'ajax_clear_log' ) );
45
  add_action( 'wp_ajax_wpmdb_get_log', array( $this, 'ajax_get_log' ) );
46
- add_action( 'wp_ajax_wpmdb_fire_migration_complete', array( $this, 'fire_migration_complete' ) );
47
  add_action( 'wp_ajax_wpmdb_plugin_compatibility', array( $this, 'ajax_plugin_compatibility' ) );
48
  add_action( 'wp_ajax_wpmdb_blacklist_plugins', array( $this, 'ajax_blacklist_plugins' ) );
49
  add_action( 'wp_ajax_wpmdb_update_max_request_size', array( $this, 'ajax_update_max_request_size' ) );
50
  add_action( 'wp_ajax_wpmdb_update_delay_between_requests', array( $this, 'ajax_update_delay_between_requests' ) );
51
  add_action( 'wp_ajax_wpmdb_cancel_migration', array( $this, 'ajax_cancel_migration' ) );
52
 
53
- $this->absolute_root_file_path = $this->get_absolute_root_file_path();
54
-
55
  $this->accepted_fields = array(
56
  'action',
57
  'save_computer',
@@ -77,7 +70,6 @@ class WPMDB extends WPMDB_Base {
77
  'exclude_post_revisions',
78
  'compatibility_older_mysql',
79
  'export_dest',
80
- 'pause_before_finalize',
81
  );
82
 
83
  $this->default_profile = array(
@@ -103,13 +95,14 @@ class WPMDB extends WPMDB_Base {
103
  'keep_active_plugins' => '0',
104
  'create_backup' => '0',
105
  'exclude_post_types' => '0',
 
106
  'compatibility_older_mysql' => '0',
107
- 'pause_before_finalize' => '0',
108
  );
109
 
110
  $this->plugin_tabs = array(
111
  '<a href="#" class="nav-tab nav-tab-active js-action-link migrate" data-div-name="migrate-tab">' . esc_html( _x( 'Migrate', 'Configure a migration or export', 'wp-migrate-db' ) ) . '</a>',
112
  '<a href="#" class="nav-tab js-action-link settings" data-div-name="settings-tab">' . esc_html( _x( 'Settings', 'Plugin configuration and preferences', 'wp-migrate-db' ) ) . '</a>',
 
113
  '<a href="#" class="nav-tab js-action-link help" data-div-name="help-tab">' . esc_html( _x( 'Help', 'Get help or contact support', 'wp-migrate-db' ) ) . '</a>',
114
  );
115
 
@@ -156,12 +149,6 @@ class WPMDB extends WPMDB_Base {
156
  return $this->create_alter_table_query;
157
  }
158
 
159
- function get_short_uploads_dir() {
160
- $short_path = str_replace( $this->absolute_root_file_path, '', $this->get_upload_info( 'path' ) );
161
-
162
- return trailingslashit( substr( str_replace( '\\', '/', $short_path ), 1 ) );
163
- }
164
-
165
  /**
166
  * Handler for ajax request to turn on or off Compatibility Mode.
167
  */
@@ -250,7 +237,7 @@ class WPMDB extends WPMDB_Base {
250
  $this->end_ajax( $result );
251
  }
252
 
253
- function is_json( $string, $strict = false ) {
254
  $json = @json_decode( $string, true );
255
  if ( $strict == true && ! is_array( $json ) ) {
256
  return false;
@@ -594,6 +581,9 @@ class WPMDB extends WPMDB_Base {
594
  $alter_table_name = $this->get_alter_table_name();
595
  $sql = '';
596
  $alter_queries = $wpdb->get_results( "SELECT * FROM `{$alter_table_name}`", ARRAY_A );
 
 
 
597
  if ( ! empty( $alter_queries ) ) {
598
  foreach ( $alter_queries as $alter_query ) {
599
  $sql .= $alter_query['query'] . "\n";
@@ -865,14 +855,16 @@ class WPMDB extends WPMDB_Base {
865
  $this->check_ajax_referer( 'initiate-migration' );
866
 
867
  $key_rules = array(
868
- 'action' => 'key',
869
- 'intent' => 'key',
870
- 'url' => 'url',
871
- 'key' => 'string',
872
- 'form_data' => 'string',
873
- 'stage' => 'key',
874
- 'nonce' => 'key',
875
- 'temp_prefix' => 'string',
 
 
876
  );
877
  $this->set_post_data( $key_rules );
878
 
@@ -916,14 +908,18 @@ class WPMDB extends WPMDB_Base {
916
  $return['dump_filename'] = $dump_filename_no_extension;
917
  } else { // does one last check that our verification string is valid
918
  $data = array(
919
- 'action' => 'wpmdb_remote_initiate_migration',
920
- 'intent' => $this->state_data['intent'],
921
- 'form_data' => $this->state_data['form_data'],
 
922
  );
923
 
924
- $data['sig'] = $this->create_signature( $data, $this->state_data['key'] );
925
- $ajax_url = $this->ajax_url();
926
- $response = $this->remote_post( $ajax_url, $data, __FUNCTION__ );
 
 
 
927
 
928
  if ( false === $response ) {
929
  $return = array( 'wpmdb_error' => 1, 'body' => $this->error );
@@ -1354,12 +1350,13 @@ class WPMDB extends WPMDB_Base {
1354
  return false;
1355
  }
1356
 
1357
- $table_name = $table;
1358
- $target_table_name = apply_filters( 'wpmdb_target_table_name', $table_name, $this->form_data['action'], $this->state_data['stage'] );
1359
- $table_name = $target_table_name;
 
1360
 
1361
  if ( 'savefile' !== $this->form_data['action'] && 'backup' !== $this->state_data['stage'] ) {
1362
- $table_name = $temp_prefix . $table;
1363
  }
1364
 
1365
  $current_row = -1;
@@ -2332,22 +2329,22 @@ class WPMDB extends WPMDB_Base {
2332
  $version = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? time() : $this->plugin_version;
2333
  $min = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
2334
 
2335
- $src = $plugins_url . 'asset/css/styles.css';
2336
  wp_enqueue_style( 'wp-migrate-db-pro-styles', $src, array(), $version );
2337
 
2338
- $src = $plugins_url . "asset/js/common$min.js";
2339
  wp_enqueue_script( 'wp-migrate-db-pro-common', $src, null, $version, true );
2340
 
2341
- $src = $plugins_url . "asset/js/hook$min.js";
2342
  wp_enqueue_script( 'wp-migrate-db-pro-hook', $src, null, $version, true );
2343
 
2344
- $src = $plugins_url . "asset/js/multisite$min.js";
2345
  wp_enqueue_script( 'wp-migrate-db-pro-multisite', $src, array( 'jquery' ), $version, true );
2346
 
2347
  do_action( 'wpmdb_load_assets' );
2348
 
2349
- $src = $plugins_url . "asset/js/script$min.js";
2350
- wp_enqueue_script( 'wp-migrate-db-pro-script', $src, array( 'jquery' ), $version, true );
2351
 
2352
  wp_localize_script( 'wp-migrate-db-pro-script',
2353
  'wpmdb_strings',
@@ -2359,20 +2356,22 @@ class WPMDB extends WPMDB_Base {
2359
  'enter_license_key' => __( 'Please enter your license key.', 'wp-migrate-db' ),
2360
  'register_license_problem' => __( 'A problem occurred when trying to register the license, please try again.', 'wp-migrate-db' ),
2361
  'license_registered' => __( 'Your license has been activated. You will now receive automatic updates and access to email support.', 'wp-migrate-db' ),
2362
- 'fetching_license' => __( 'Fetching license details, please wait...', 'wp-migrate-db' ),
2363
  'clear_log_problem' => __( 'An error occurred when trying to clear the debug log. Please contact support. (#132)', 'wp-migrate-db' ),
2364
  'update_log_problem' => __( 'An error occurred when trying to update the debug log. Please contact support. (#133)', 'wp-migrate-db' ),
2365
  'please_select_one_table' => __( 'Please select at least one table to migrate.', 'wp-migrate-db' ),
2366
  'please_select_one_table_backup' => __( 'Please select at least one table for backup.', 'wp-migrate-db' ),
2367
  'enter_name_for_profile' => __( 'Please enter a name for your migration profile.', 'wp-migrate-db' ),
2368
  'save_profile_problem' => __( 'An error occurred when attempting to save the migration profile. Please see the Help tab for details on how to request support. (#118)', 'wp-migrate-db' ),
2369
- 'exporting_complete' => _x( 'Exporting complete', 'Data has been successfully exported', 'wp-migrate-db' ),
2370
- 'exporting_please_wait' => __( 'Exporting, please wait...', 'wp-migrate-db' ),
2371
- 'please_wait' => __( 'please wait...', 'wp-migrate-db' ),
2372
  'complete' => _x( 'complete', 'Finished successfully', 'wp-migrate-db' ),
2373
  'migration_failed' => _x( 'Migration failed', 'Copy of data between servers did not complete', 'wp-migrate-db' ),
2374
  'backing_up' => _x( 'Backing up', 'Saving a copy of the data before import', 'wp-migrate-db' ),
 
2375
  'migrating' => _x( 'Migrating', 'Copying data between servers', 'wp-migrate-db' ),
 
2376
  'status' => _x( 'Status', 'Current request status', 'wp-migrate-db' ),
2377
  'response' => _x( 'Response', 'The message the server responded with', 'wp-migrate-db' ),
2378
  'table_process_problem' => __( 'A problem occurred when attempting to process the following table (#113)', 'wp-migrate-db' ),
@@ -2411,6 +2410,7 @@ class WPMDB extends WPMDB_Base {
2411
  'migration_cancellation_failed' => __( 'Migration cancellation failed', 'wp-migrate-db' ),
2412
  'manually_remove_temp_files' => __( 'A problem occurred while cancelling the migration, you may have to manually delete some temporary files / tables.', 'wp-migrate-db' ),
2413
  'migration_cancelled' => _x( 'Migration cancelled', 'The migration has been cancelled', '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' ),
@@ -2418,13 +2418,13 @@ class WPMDB extends WPMDB_Base {
2418
  'mu_plugin_confirmation' => __( "If confirmed we will install an additional WordPress 'Must Use' plugin. This plugin will allow us to control which plugins are loaded during WP Migrate DB Pro specific operations. Do you wish to continue?", 'wp-migrate-db' ),
2419
  'plugin_compatibility_settings_problem' => __( 'A problem occurred when trying to change the plugin compatibility setting.', 'wp-migrate-db' ),
2420
  'sure' => _x( 'Sure?', 'Confirmation required', 'wp-migrate-db' ),
2421
- 'pull_migration_label_migrating' => __( 'Pulling from %s, please wait...', 'wp-migrate-db' ),
2422
- 'pull_migration_label_completed' => __( 'Pulling from %s complete', 'wp-migrate-db' ),
2423
- 'push_migration_label_migrating' => __( 'Pushing to %s, please wait...', 'wp-migrate-db' ),
2424
- 'push_migration_label_completed' => __( 'Pushing 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' ),
2428
  'activate_licence_problem' => __( 'An error occurred when trying to reactivate your license. Please provide the following information when requesting support:', 'wp-migrate-db' ),
2429
  'temporarily_activated_licence' => __( "<strong>We've temporarily activated your licence and will complete the activation once the Delicious Brains API is available again.</strong><br />Please refresh this page to continue.", 'wp-migrate-db' ),
2430
  'ajax_json_message' => __( 'JSON Decoding Failure', 'wp-migrate-db' ),
@@ -2439,6 +2439,21 @@ 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
  )
2443
  );
2444
 
@@ -2484,8 +2499,7 @@ class WPMDB extends WPMDB_Base {
2484
  * @return void
2485
  */
2486
  function admin_head_connection_info() {
2487
- global $wpdb;
2488
- $table_prefix = $wpdb->base_prefix;
2489
 
2490
  $nonces = apply_filters( 'wpmdb_nonces', array(
2491
  'update_max_request_size' => wp_create_nonce( 'update-max-request-size' ),
@@ -2511,7 +2525,7 @@ class WPMDB extends WPMDB_Base {
2511
  $data = apply_filters( 'wpmdb_data', array(
2512
  'connection_info' => array( site_url( '', 'https' ), $this->settings['key'] ),
2513
  'this_url' => esc_html( addslashes( home_url() ) ),
2514
- 'this_path' => esc_html( addslashes( $this->absolute_root_file_path ) ),
2515
  'this_domain' => esc_html( $this->get_domain_current_site() ),
2516
  'this_tables' => $this->get_tables(),
2517
  'this_prefixed_tables' => $this->get_tables( 'prefix' ),
@@ -2520,15 +2534,18 @@ class WPMDB extends WPMDB_Base {
2520
  'this_table_rows' => $this->get_table_row_count(),
2521
  'this_upload_url' => esc_html( addslashes( trailingslashit( $this->get_upload_info( 'url' ) ) ) ),
2522
  'this_upload_dir_long' => esc_html( addslashes( trailingslashit( $this->get_upload_info( 'path' ) ) ) ),
2523
- 'this_uploads_dir' => esc_html( addslashes( $this->get_short_uploads_dir() ) ),
 
2524
  'this_website_name' => sanitize_title_with_dashes( DB_NAME ),
2525
  'this_download_url' => network_admin_url( $this->plugin_base . '&download=' ),
2526
- 'this_prefix' => esc_html( $table_prefix ),
2527
  'this_plugin_base' => esc_html( $this->plugin_base ),
2528
- 'is_multisite' => esc_html( is_multisite() ? 'true' : 'false' ),
2529
  'openssl_available' => esc_html( $this->open_ssl_enabled() ? 'true' : 'false' ),
2530
  'max_request' => esc_html( $this->settings['max_request'] ),
2531
  'delay_between_requests' => esc_html( $this->settings['delay_between_requests'] ),
 
 
2532
  'bottleneck' => esc_html( $this->get_bottleneck( 'max' ) ),
2533
  'has_licence' => esc_html( $this->get_licence_key() == '' ? '0' : '1' ),
2534
  // TODO: Use WP_Filesystem API.
@@ -2538,7 +2555,8 @@ class WPMDB extends WPMDB_Base {
2538
  'profile' => isset( $_GET['wpmdb-profile'] ) ? $_GET['wpmdb-profile'] : '-1',
2539
  'is_pro' => esc_html( ( $this->is_pro ) ? 'true' : 'false' ),
2540
  'lower_case_table_names' => esc_html( $this->get_lower_case_table_names_setting() ),
2541
- 'subsites' => $this->subsites_list(),
 
2542
  ) );
2543
 
2544
  wp_localize_script( 'wp-migrate-db-pro-script', 'wpmdb_data', $data );
@@ -2686,7 +2704,7 @@ class WPMDB extends WPMDB_Base {
2686
 
2687
  function template_compatibility() {
2688
  $args = array(
2689
- 'plugin_compatibility_checked' => ( isset( $GLOBALS['wpmdb_compatibility'] ) ? ' checked="checked"' : '' ),
2690
  );
2691
  $this->template( 'compatibility', 'common', $args );
2692
  }
2
 
3
  class WPMDB extends WPMDB_Base {
4
  protected $fp;
 
5
  protected $form_defaults;
6
  protected $accepted_fields;
7
  protected $default_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' ) );
41
  add_action( 'wp_ajax_wpmdb_get_log', array( $this, 'ajax_get_log' ) );
 
42
  add_action( 'wp_ajax_wpmdb_plugin_compatibility', array( $this, 'ajax_plugin_compatibility' ) );
43
  add_action( 'wp_ajax_wpmdb_blacklist_plugins', array( $this, 'ajax_blacklist_plugins' ) );
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',
50
  'save_computer',
70
  'exclude_post_revisions',
71
  'compatibility_older_mysql',
72
  'export_dest',
 
73
  );
74
 
75
  $this->default_profile = array(
95
  'keep_active_plugins' => '0',
96
  'create_backup' => '0',
97
  'exclude_post_types' => '0',
98
+ 'exclude_transients' => '0',
99
  'compatibility_older_mysql' => '0',
 
100
  );
101
 
102
  $this->plugin_tabs = array(
103
  '<a href="#" class="nav-tab nav-tab-active js-action-link migrate" data-div-name="migrate-tab">' . esc_html( _x( 'Migrate', 'Configure a migration or export', 'wp-migrate-db' ) ) . '</a>',
104
  '<a href="#" class="nav-tab js-action-link settings" data-div-name="settings-tab">' . esc_html( _x( 'Settings', 'Plugin configuration and preferences', 'wp-migrate-db' ) ) . '</a>',
105
+ '<a href="#" class="nav-tab js-action-link addons" data-div-name="addons-tab">' . esc_html( _x( 'Addons', 'Plugin extensions', 'wp-migrate-db' ) ) . '</a>',
106
  '<a href="#" class="nav-tab js-action-link help" data-div-name="help-tab">' . esc_html( _x( 'Help', 'Get help or contact support', 'wp-migrate-db' ) ) . '</a>',
107
  );
108
 
149
  return $this->create_alter_table_query;
150
  }
151
 
 
 
 
 
 
 
152
  /**
153
  * Handler for ajax request to turn on or off Compatibility Mode.
154
  */
237
  $this->end_ajax( $result );
238
  }
239
 
240
+ static function is_json( $string, $strict = false ) {
241
  $json = @json_decode( $string, true );
242
  if ( $strict == true && ! is_array( $json ) ) {
243
  return false;
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 ) {
589
  $sql .= $alter_query['query'] . "\n";
855
  $this->check_ajax_referer( 'initiate-migration' );
856
 
857
  $key_rules = array(
858
+ 'action' => 'key',
859
+ 'intent' => 'key',
860
+ 'url' => 'url',
861
+ 'key' => 'string',
862
+ 'form_data' => 'string',
863
+ 'stage' => 'key',
864
+ 'nonce' => 'key',
865
+ 'temp_prefix' => 'string',
866
+ 'site_details' => 'json_array',
867
+ 'export_dest' => 'string',
868
  );
869
  $this->set_post_data( $key_rules );
870
 
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',
912
+ 'intent' => $this->state_data['intent'],
913
+ 'form_data' => $this->state_data['form_data'],
914
+ 'site_details' => $this->state_data['site_details'],
915
  );
916
 
917
+ $data['site_details'] = serialize( $data['site_details'] );
918
+
919
+ $data['sig'] = $this->create_signature( $data, $this->state_data['key'] );
920
+ $data['site_details'] = addslashes( $data['site_details'] );
921
+ $ajax_url = $this->ajax_url();
922
+ $response = $this->remote_post( $ajax_url, $data, __FUNCTION__ );
923
 
924
  if ( false === $response ) {
925
  $return = array( 'wpmdb_error' => 1, 'body' => $this->error );
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;
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',
2350
  'wpmdb_strings',
2356
  'enter_license_key' => __( 'Please enter your license key.', 'wp-migrate-db' ),
2357
  'register_license_problem' => __( 'A problem occurred when trying to register the license, please try again.', 'wp-migrate-db' ),
2358
  'license_registered' => __( 'Your license has been activated. You will now receive automatic updates and access to email support.', 'wp-migrate-db' ),
2359
+ 'fetching_license' => __( 'Fetching license details, please wait', 'wp-migrate-db' ),
2360
  'clear_log_problem' => __( 'An error occurred when trying to clear the debug log. Please contact support. (#132)', 'wp-migrate-db' ),
2361
  'update_log_problem' => __( 'An error occurred when trying to update the debug log. Please contact support. (#133)', 'wp-migrate-db' ),
2362
  'please_select_one_table' => __( 'Please select at least one table to migrate.', 'wp-migrate-db' ),
2363
  'please_select_one_table_backup' => __( 'Please select at least one table for backup.', 'wp-migrate-db' ),
2364
  'enter_name_for_profile' => __( 'Please enter a name for your migration profile.', 'wp-migrate-db' ),
2365
  'save_profile_problem' => __( 'An error occurred when attempting to save the migration profile. Please see the Help tab for details on how to request support. (#118)', 'wp-migrate-db' ),
2366
+ 'exporting_complete' => _x( 'Export complete', 'Data has been successfully exported', 'wp-migrate-db' ),
2367
+ 'exporting_please_wait' => __( 'Exporting, please wait', 'wp-migrate-db' ),
2368
+ 'please_wait' => __( 'please wait', 'wp-migrate-db' ),
2369
  'complete' => _x( 'complete', 'Finished successfully', 'wp-migrate-db' ),
2370
  'migration_failed' => _x( 'Migration failed', 'Copy of data between servers did not complete', 'wp-migrate-db' ),
2371
  'backing_up' => _x( 'Backing up', 'Saving a copy of the data before import', 'wp-migrate-db' ),
2372
+ 'queued' => _x( 'Queued', 'In line to be processed', 'wp-migrate-db' ),
2373
  'migrating' => _x( 'Migrating', 'Copying data between servers', 'wp-migrate-db' ),
2374
+ 'running' => _x( 'Running', 'Process is active', 'wp-migrate-db'),
2375
  'status' => _x( 'Status', 'Current request status', 'wp-migrate-db' ),
2376
  'response' => _x( 'Response', 'The message the server responded with', 'wp-migrate-db' ),
2377
  'table_process_problem' => __( 'A problem occurred when attempting to process the following table (#113)', 'wp-migrate-db' ),
2410
  'migration_cancellation_failed' => __( 'Migration cancellation failed', 'wp-migrate-db' ),
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' ),
2418
  'mu_plugin_confirmation' => __( "If confirmed we will install an additional WordPress 'Must Use' plugin. This plugin will allow us to control which plugins are loaded during WP Migrate DB Pro specific operations. Do you wish to continue?", 'wp-migrate-db' ),
2419
  'plugin_compatibility_settings_problem' => __( 'A problem occurred when trying to change the plugin compatibility setting.', 'wp-migrate-db' ),
2420
  'sure' => _x( 'Sure?', 'Confirmation required', 'wp-migrate-db' ),
2421
+ 'pull_migration_label_migrating' => __( 'Pulling from %s', 'wp-migrate-db' ),
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' ),
2428
  'activate_licence_problem' => __( 'An error occurred when trying to reactivate your license. Please provide the following information when requesting support:', 'wp-migrate-db' ),
2429
  'temporarily_activated_licence' => __( "<strong>We've temporarily activated your licence and will complete the activation once the Delicious Brains API is available again.</strong><br />Please refresh this page to continue.", 'wp-migrate-db' ),
2430
  'ajax_json_message' => __( 'JSON Decoding Failure', 'wp-migrate-db' ),
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' ),
2449
+ 'welcome_text' => __( 'Hey, this is the first time activating your license, nice! Your migrations are about to get awesome! If you haven’t already, you should check out our <a href="%1$s">Quick Start Guide</a> and <a href="%2$s">Videos</a>. If you run into any trouble at all, use the <strong>Help tab</strong> above to submit a support request.', 'wp-migrate-db' ),
2450
+ 'title_progress' => __( '%1$s Stage %2$s of %3$s', 'wp-migrate-db' ),
2451
+ 'title_paused' => __( 'Paused', 'wp-migrate-db' ),
2452
+ 'title_cancelling' => __( 'Cancelling', 'wp-migrate-db' ),
2453
+ 'title_cancelled' => __( 'Cancelled', 'wp-migrate-db' ),
2454
+ 'title_finalizing' => __( 'Finalizing', 'wp-migrate-db' ),
2455
+ 'title_complete' => __( 'Complete', 'wp-migrate-db' ),
2456
+ 'title_error' => __( 'Failed', 'wp-migrate-db' ),
2457
  )
2458
  );
2459
 
2499
  * @return void
2500
  */
2501
  function admin_head_connection_info() {
2502
+ $site_details = $this->site_details();
 
2503
 
2504
  $nonces = apply_filters( 'wpmdb_nonces', array(
2505
  'update_max_request_size' => wp_create_nonce( 'update-max-request-size' ),
2525
  $data = apply_filters( 'wpmdb_data', array(
2526
  'connection_info' => array( site_url( '', 'https' ), $this->settings['key'] ),
2527
  'this_url' => esc_html( addslashes( home_url() ) ),
2528
+ 'this_path' => esc_html( addslashes( $this->get_absolute_root_file_path() ) ),
2529
  'this_domain' => esc_html( $this->get_domain_current_site() ),
2530
  'this_tables' => $this->get_tables(),
2531
  'this_prefixed_tables' => $this->get_tables( 'prefix' ),
2534
  'this_table_rows' => $this->get_table_row_count(),
2535
  'this_upload_url' => esc_html( addslashes( trailingslashit( $this->get_upload_info( 'url' ) ) ) ),
2536
  'this_upload_dir_long' => esc_html( addslashes( trailingslashit( $this->get_upload_info( 'path' ) ) ) ),
2537
+ 'this_uploads_dir' => $site_details['uploads_dir'], // TODO: Remove backwards compatibility.
2538
+ 'this_plugin_url' => trailingslashit( plugins_url( $this->plugin_folder_name ) ),
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' ),
2545
  'max_request' => esc_html( $this->settings['max_request'] ),
2546
  'delay_between_requests' => esc_html( $this->settings['delay_between_requests'] ),
2547
+ 'prog_tables_hidden' => ( bool ) $this->settings['prog_tables_hidden'],
2548
+ 'pause_before_finalize' => ( bool ) $this->settings['pause_before_finalize'],
2549
  'bottleneck' => esc_html( $this->get_bottleneck( 'max' ) ),
2550
  'has_licence' => esc_html( $this->get_licence_key() == '' ? '0' : '1' ),
2551
  // TODO: Use WP_Filesystem API.
2555
  'profile' => isset( $_GET['wpmdb-profile'] ) ? $_GET['wpmdb-profile'] : '-1',
2556
  'is_pro' => esc_html( ( $this->is_pro ) ? 'true' : 'false' ),
2557
  'lower_case_table_names' => esc_html( $this->get_lower_case_table_names_setting() ),
2558
+ 'subsites' => $site_details['subsites'], // TODO: Remove backwards compatibility.
2559
+ 'site_details' => $this->site_details(),
2560
  ) );
2561
 
2562
  wp_localize_script( 'wp-migrate-db-pro-script', 'wpmdb_data', $data );
2704
 
2705
  function template_compatibility() {
2706
  $args = array(
2707
+ 'plugin_compatibility_checked' => ( isset( $GLOBALS['wpmdb_compatibility'] ) ? true : false ),
2708
  );
2709
  $this->template( 'compatibility', 'common', $args );
2710
  }
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 wp-migrate-db 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: 2015-12-06 10:37+1300\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"
@@ -17,25 +17,25 @@ msgstr ""
17
  "Content-Type: text/plain; charset=UTF-8\n"
18
  "Content-Transfer-Encoding: 8bit\n"
19
 
20
- #: class/wpmdb-base.php:159
21
  msgid ""
22
  "Invalid content verification signature, please verify the connection "
23
  "information on the remote site and try again."
24
  msgstr ""
25
 
26
- #: class/wpmdb-base.php:349
27
  #, php-format
28
  msgid ""
29
  "The connection to the remote server has timed out, no changes have been "
30
  "committed. (#134 - scope: %s)"
31
  msgstr ""
32
 
33
- #: class/wpmdb-base.php:351
34
  #, php-format
35
  msgid "We could not find: %s. Are you sure this is the correct URL?"
36
  msgstr ""
37
 
38
- #: class/wpmdb-base.php:356
39
  msgid ""
40
  "It appears that you might be trying to pull from a local environment. This "
41
  "will not work if <u>this</u> website happens to be located on a remote "
@@ -43,7 +43,7 @@ msgid ""
43
  "environment."
44
  msgstr ""
45
 
46
- #: class/wpmdb-base.php:358
47
  msgid ""
48
  "It appears that you might be trying to push to a local environment. This "
49
  "will not work if <u>this</u> website happens to be located on a remote "
@@ -51,7 +51,7 @@ msgid ""
51
  "environment."
52
  msgstr ""
53
 
54
- #: class/wpmdb-base.php:366
55
  #, php-format
56
  msgid ""
57
  "We've detected that <code>WP_HTTP_BLOCK_EXTERNAL</code> is enabled and the "
@@ -61,70 +61,70 @@ msgid ""
61
  "\" target=\"_blank\">More information</a>. (#147 - scope: %3$s)"
62
  msgstr ""
63
 
64
- #: class/wpmdb-base.php:369
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:379
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:384
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:394
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:397
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:397
99
- #: class/wpmdb.php:2824
100
  msgid "our documentation"
101
  msgstr ""
102
 
103
- #: class/wpmdb-base.php:406
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:703
110
- #: class/wpmdb-base.php:1164
111
  #, php-format
112
  msgid ""
113
- "<strong>Could not connect to deliciousbrains.com</strong> &mdash; You will "
114
- "not receive update notifications or be able to activate your license until "
115
- "this is fixed. This issue is often caused by an improperly configured SSL "
116
- "server (https). We recommend <a href=\"%1$s\" target=\"_blank\">fixing the "
117
- "SSL configuration on your server</a>, but if you need a quick fix you can:"
118
- "%2$s"
119
  msgstr ""
120
 
121
- #: class/wpmdb-base.php:703
122
- #: class/wpmdb-base.php:1164
123
- msgid "Temporarily disable SSL for connections to deliciousbrains.com"
124
  msgstr ""
125
 
126
- #: class/wpmdb-base.php:711
127
- #: class/wpmdb-base.php:1170
128
  #, php-format
129
  msgid ""
130
  "We've detected that <code>WP_HTTP_BLOCK_EXTERNAL</code> is enabled and the "
@@ -134,43 +134,43 @@ msgid ""
134
  "\" target=\"_blank\">More information</a>."
135
  msgstr ""
136
 
137
- #: class/wpmdb-base.php:756
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:760
144
  #, php-format
145
  msgctxt "ex. 2 hours ago"
146
  msgid "%s ago"
147
  msgstr ""
148
 
149
- #: class/wpmdb-base.php:765
150
  msgid "Here's the most recent update on its status"
151
  msgstr ""
152
 
153
- #: class/wpmdb-base.php:792
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:792
161
  msgctxt "Delicious Brains account"
162
  msgid "My Account"
163
  msgstr ""
164
 
165
- #: class/wpmdb-base.php:851
166
- #: class/wpmdb.php:112
167
- #: class/wpmdb.php:313
168
- #: class/wpmdbpro.php:1916
169
  msgctxt "Plugin configuration and preferences"
170
  msgid "Settings"
171
  msgstr ""
172
 
173
- #: class/wpmdb-base.php:852
174
  #, php-format
175
  msgid ""
176
  "To finish activating WP Migrate DB Pro, please go to %1$s and enter your "
@@ -178,31 +178,31 @@ msgid ""
178
  "\">purchase one</a>."
179
  msgstr ""
180
 
181
- #: class/wpmdb-base.php:1083
182
- #: class/wpmdb-base.php:1093
183
  msgctxt "A new version of the plugin is available"
184
  msgid "Update Available"
185
  msgstr ""
186
 
187
- #: class/wpmdb-base.php:1084
188
  #, php-format
189
  msgid "A new version of %1$s is now available. %2$s"
190
  msgstr ""
191
 
192
- #: class/wpmdb-base.php:1084
193
- #: class/wpmdb-base.php:1094
194
  msgctxt "Download and install a new version of the plugin"
195
  msgid "Update Now"
196
  msgstr ""
197
 
198
- #: class/wpmdb-base.php:1094
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:1138
206
  #, php-format
207
  msgid ""
208
  "<strong>Activate Your License</strong> &mdash; Please <a href=\"%s\" class="
@@ -210,13 +210,13 @@ msgid ""
210
  "priority support and plugin updates."
211
  msgstr ""
212
 
213
- #: class/wpmdb-base.php:1155
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:1177
220
  #, php-format
221
  msgid ""
222
  "<strong>Your License Was Cancelled</strong> &mdash; Please visit <a href=\"%s"
@@ -224,43 +224,43 @@ msgid ""
224
  "enable push and pull."
225
  msgstr ""
226
 
227
- #: class/wpmdb-base.php:1178
228
- #: class/wpmdb-base.php:1183
229
- #: class/wpmdb-base.php:1203
230
- #: class/wpmdb-base.php:1207
231
- #: class/wpmdbpro.php:1017
232
- #: class/wpmdbpro.php:1923
233
  msgid "Check my license again"
234
  msgstr ""
235
 
236
- #: class/wpmdb-base.php:1181
237
  msgid "Your License Has Expired"
238
  msgstr ""
239
 
240
- #: class/wpmdb-base.php:1182
241
  #, php-format
242
  msgid "Login to <a href=\"%s\">My Account</a> to renew. "
243
  msgstr ""
244
 
245
- #: class/wpmdb-base.php:1187
246
  msgid "Updates are only available to those with an active license. "
247
  msgstr ""
248
 
249
- #: class/wpmdb-base.php:1188
250
  msgid "Only active licenses can download and install addons. "
251
  msgstr ""
252
 
253
- #: class/wpmdb-base.php:1189
254
  msgid "Only active licenses can submit support requests. "
255
  msgstr ""
256
 
257
- #: class/wpmdb-base.php:1190
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:1202
264
  #, php-format
265
  msgid ""
266
  "<strong>No Activations Left</strong> &mdash; Please visit <a href=\"%s\" "
@@ -268,7 +268,7 @@ msgid ""
268
  "previous activation and enable push and pull."
269
  msgstr ""
270
 
271
- #: class/wpmdb-base.php:1206
272
  #, php-format
273
  msgid ""
274
  "<strong>Your License Was Not Found</strong> &mdash; Perhaps you made a typo "
@@ -277,53 +277,53 @@ msgid ""
277
  "license key."
278
  msgstr ""
279
 
280
- #: class/wpmdb-base.php:1210
281
  msgid "<strong>Your License Was Not Found</strong> &mdash; "
282
  msgstr ""
283
 
284
- #: class/wpmdb-base.php:1214
285
  msgid "Your License Is Inactive"
286
  msgstr ""
287
 
288
- #: class/wpmdb-base.php:1215
289
  msgid "Your license has been deactivated for this install."
290
  msgstr ""
291
 
292
- #: class/wpmdb-base.php:1215
293
  msgid "Reactivate License"
294
  msgstr ""
295
 
296
- #: class/wpmdb-base.php:1218
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:1257
304
  #, php-format
305
  msgid "Invalid nonce for: %s"
306
  msgstr ""
307
 
308
- #: class/wpmdb-base.php:1265
309
  #, php-format
310
  msgid "Access denied for: %s"
311
  msgstr ""
312
 
313
- #: class/wpmdb-base.php:1469
314
  msgctxt "dismiss notice permanently"
315
  msgid "Dismiss"
316
  msgstr ""
317
 
318
- #: class/wpmdb-base.php:1478
319
  msgid "Remind Me Later"
320
  msgstr ""
321
 
322
- #: class/wpmdb-base.php:1580
323
  msgid "Failed to save migration state. Please contact support."
324
  msgstr ""
325
 
326
- #: class/wpmdb-base.php:1603
327
  msgid "Failed to retrieve migration state. Please contact support."
328
  msgstr ""
329
 
@@ -336,35 +336,35 @@ msgstr ""
336
  msgid "Profile not found or unable to be generated from params."
337
  msgstr ""
338
 
339
- #: class/wpmdb-cli.php:136
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:183
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:239
352
  msgid "Initiating migration..."
353
  msgstr ""
354
 
355
- #: class/wpmdb-cli.php:277
356
  msgid "Exporting tables"
357
  msgstr ""
358
 
359
- #: class/wpmdb-cli.php:347
360
  msgid "No tables selected for migration."
361
  msgstr ""
362
 
363
- #: class/wpmdb-cli.php:440
364
  msgid "Cleaning up..."
365
  msgstr ""
366
 
367
- #: class/wpmdb-cli.php:507
368
  msgid "Unable to move exported file."
369
  msgstr ""
370
 
@@ -372,27 +372,42 @@ msgstr ""
372
  msgid "You must provide a destination filename."
373
  msgstr ""
374
 
375
- #: class/wpmdb-command.php:100
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
376
  msgid "Missing action parameter"
377
  msgstr ""
378
 
379
- #: class/wpmdb-command.php:119
380
  #, php-format
381
  msgid "%1$s and %2$s must contain the same number of values"
382
  msgstr ""
383
 
384
- #: class/wpmdb-command.php:167
385
  #, php-format
386
  msgid ""
387
  "Cannot write to file \"%1$s\". Please ensure that the specified directory "
388
  "exists and is writable."
389
  msgstr ""
390
 
391
- #: class/wpmdb-command.php:211
392
  msgid "WP Migrate DB CLI class not available."
393
  msgstr ""
394
 
395
- #: class/wpmdb-command.php:218
396
  #, php-format
397
  msgid "Export saved to: %s"
398
  msgstr ""
@@ -434,327 +449,344 @@ msgid "%1$s was expecting serialized data but got something else: \"%2$s\""
434
  msgstr ""
435
 
436
  #: class/wpmdb-sanitize.php:94
 
 
 
 
 
 
437
  #, php-format
438
  msgid "%1$s was expecting a valid numeric but got something else: \"%2$s\""
439
  msgstr ""
440
 
441
- #: class/wpmdb-sanitize.php:101
442
  #, php-format
443
  msgid "%1$s was expecting an integer but got something else: \"%2$s\""
444
  msgstr ""
445
 
446
- #: class/wpmdb-sanitize.php:108
447
  #, php-format
448
  msgid ""
449
  "%1$s was expecting a positive number (int) but got something else: \"%2$s\""
450
  msgstr ""
451
 
452
- #: class/wpmdb-sanitize.php:115
453
  #, php-format
454
  msgid ""
455
  "%1$s was expecting a negative number (int) but got something else: \"%2$s\""
456
  msgstr ""
457
 
458
- #: class/wpmdb-sanitize.php:122
459
  #, php-format
460
  msgid "%1$s was expecting 0 (int) but got something else: \"%2$s\""
461
  msgstr ""
462
 
463
- #: class/wpmdb-sanitize.php:129
464
  #, php-format
465
  msgid "%1$s was expecting an empty value but got something else: \"%2$s\""
466
  msgstr ""
467
 
468
- #: class/wpmdb-sanitize.php:136
469
  #, php-format
470
  msgid "%1$s was expecting a URL but got something else: \"%2$s\""
471
  msgstr ""
472
 
473
- #: class/wpmdb-sanitize.php:144
474
  #, php-format
475
  msgid "%1$s was expecting a bool but got something else: \"%2$s\""
476
  msgstr ""
477
 
478
- #: class/wpmdb-sanitize.php:150
479
  #, php-format
480
  msgid "Unknown sanitization rule \"%1$s\" supplied by %2$s"
481
  msgstr ""
482
 
483
- #: class/wpmdb.php:111
484
  msgctxt "Configure a migration or export"
485
  msgid "Migrate"
486
  msgstr ""
487
 
488
- #: class/wpmdb.php:113
 
 
 
 
 
489
  msgctxt "Get help or contact support"
490
  msgid "Help"
491
  msgstr ""
492
 
493
- #: class/wpmdb.php:180
494
  #, php-format
495
  msgid "The following directory could not be created: %s"
496
  msgstr ""
497
 
498
- #: class/wpmdb.php:185
499
  #, php-format
500
  msgid "Could not copy the compatibility plugin from %1$s to %2$s"
501
  msgstr ""
502
 
503
- #: class/wpmdb.php:191
504
  #, php-format
505
  msgid "Could not remove the compatibility plugin from %s"
506
  msgstr ""
507
 
508
- #: class/wpmdb.php:938
509
- #: class/wpmdbpro.php:333
510
- #: class/wpmdbpro.php:1763
511
  msgid ""
512
  "Failed attempting to unserialize the response from the remote server. Please "
513
  "contact support."
514
  msgstr ""
515
 
516
- #: class/wpmdb.php:1352
517
  msgid ""
518
  "Failed to retrieve table structure, please ensure your database is online. "
519
  "(#125)"
520
  msgstr ""
521
 
522
- #: class/wpmdb.php:1382
523
  #, php-format
524
  msgid "Delete any existing table %s"
525
  msgstr ""
526
 
527
- #: class/wpmdb.php:1393
528
  #, php-format
529
  msgid "Table structure of table %s"
530
  msgstr ""
531
 
532
- #: class/wpmdb.php:1401
533
  msgid ""
534
  "Failed to generate the create table query, please ensure your database is "
535
  "online. (#126)"
536
  msgstr ""
537
 
538
- #: class/wpmdb.php:1457
539
  #, php-format
540
  msgid "Data contents of table %s"
541
  msgstr ""
542
 
543
- #: class/wpmdb.php:1828
544
  #, php-format
545
  msgid "End of data contents of table %s"
546
  msgstr ""
547
 
548
- #: class/wpmdb.php:1968
549
  msgid "WordPress MySQL database migration"
550
  msgstr ""
551
 
552
- #: class/wpmdb.php:1970
553
  #, php-format
554
  msgid "Generated: %s"
555
  msgstr ""
556
 
557
- #: class/wpmdb.php:1971
558
  #, php-format
559
  msgid "Hostname: %s"
560
  msgstr ""
561
 
562
- #: class/wpmdb.php:1972
563
  #, php-format
564
  msgid "Database: %s"
565
  msgstr ""
566
 
567
- #: class/wpmdb.php:2025
568
  msgid "Failed to write the gzipped SQL data to the file. (#127)"
569
  msgstr ""
570
 
571
- #: class/wpmdb.php:2032
572
  msgid "Failed to write the SQL data to the file. (#128)"
573
  msgstr ""
574
 
575
- #: class/wpmdb.php:2168
576
- #: class/wpmdb.php:2179
577
- #: class/wpmdbpro.php:1723
578
  msgid "Migrate DB Pro"
579
  msgstr ""
580
 
581
- #: class/wpmdb.php:2168
582
- #: class/wpmdb.php:2179
583
- #: class/wpmdb.php:2738
584
  msgid "Migrate DB"
585
  msgstr ""
586
 
587
- #: class/wpmdb.php:2355
588
  msgid ""
589
  "A problem occurred when trying to change the maximum request size, please "
590
  "try again."
591
  msgstr ""
592
 
593
- #: class/wpmdb.php:2356
594
- #: class/wpmdbpro.php:1017
595
  msgid "A problem occurred when trying to check the license, please try again."
596
  msgstr ""
597
 
598
- #: class/wpmdb.php:2357
599
  msgid "Establishing connection to remote server, please wait"
600
  msgstr ""
601
 
602
- #: class/wpmdb.php:2358
603
  msgid ""
604
  "A problem occurred when attempting to connect to the local server, please "
605
  "check the details and try again."
606
  msgstr ""
607
 
608
- #: class/wpmdb.php:2359
609
  msgid "Please enter your license key."
610
  msgstr ""
611
 
612
- #: class/wpmdb.php:2360
613
  msgid ""
614
  "A problem occurred when trying to register the license, please try again."
615
  msgstr ""
616
 
617
- #: class/wpmdb.php:2361
618
  msgid ""
619
  "Your license has been activated. You will now receive automatic updates and "
620
  "access to email support."
621
  msgstr ""
622
 
623
- #: class/wpmdb.php:2362
624
- #: template/pro/licence-info.php:6
625
- msgid "Fetching license details, please wait..."
626
  msgstr ""
627
 
628
- #: class/wpmdb.php:2363
629
  msgid ""
630
  "An error occurred when trying to clear the debug log. Please contact "
631
  "support. (#132)"
632
  msgstr ""
633
 
634
- #: class/wpmdb.php:2364
635
  msgid ""
636
  "An error occurred when trying to update the debug log. Please contact "
637
  "support. (#133)"
638
  msgstr ""
639
 
640
- #: class/wpmdb.php:2365
641
  msgid "Please select at least one table to migrate."
642
  msgstr ""
643
 
644
- #: class/wpmdb.php:2366
645
  msgid "Please select at least one table for backup."
646
  msgstr ""
647
 
648
- #: class/wpmdb.php:2367
649
  msgid "Please enter a name for your migration profile."
650
  msgstr ""
651
 
652
- #: class/wpmdb.php:2368
653
  msgid ""
654
  "An error occurred when attempting to save the migration profile. Please see "
655
  "the Help tab for details on how to request support. (#118)"
656
  msgstr ""
657
 
658
- #: class/wpmdb.php:2369
659
  msgctxt "Data has been successfully exported"
660
- msgid "Exporting complete"
661
  msgstr ""
662
 
663
- #: class/wpmdb.php:2370
664
- msgid "Exporting, please wait..."
665
  msgstr ""
666
 
667
- #: class/wpmdb.php:2371
668
- msgid "please wait..."
669
  msgstr ""
670
 
671
- #: class/wpmdb.php:2372
672
  msgctxt "Finished successfully"
673
  msgid "complete"
674
  msgstr ""
675
 
676
- #: class/wpmdb.php:2373
677
  msgctxt "Copy of data between servers did not complete"
678
  msgid "Migration failed"
679
  msgstr ""
680
 
681
- #: class/wpmdb.php:2374
682
  msgctxt "Saving a copy of the data before import"
683
  msgid "Backing up"
684
  msgstr ""
685
 
686
- #: class/wpmdb.php:2375
 
 
 
 
 
687
  msgctxt "Copying data between servers"
688
  msgid "Migrating"
689
  msgstr ""
690
 
691
- #: class/wpmdb.php:2376
 
 
 
 
 
692
  msgctxt "Current request status"
693
  msgid "Status"
694
  msgstr ""
695
 
696
- #: class/wpmdb.php:2377
697
  msgctxt "The message the server responded with"
698
  msgid "Response"
699
  msgstr ""
700
 
701
- #: class/wpmdb.php:2378
702
  msgid ""
703
  "A problem occurred when attempting to process the following table (#113)"
704
  msgstr ""
705
 
706
- #: class/wpmdb.php:2379
707
  msgid ""
708
  "A problem occurred when processing the following table. We were expecting a "
709
  "response in JSON format but instead received an empty response."
710
  msgstr ""
711
 
712
- #: class/wpmdb.php:2380
713
  msgid "Migration completed with some errors"
714
  msgstr ""
715
 
716
- #: class/wpmdb.php:2381
717
  msgid "Migration complete, your backup is located at:"
718
  msgstr ""
719
 
720
- #: class/wpmdb.php:2382
721
  msgid "A problem occurred when finalizing the backup. (#140)"
722
  msgstr ""
723
 
724
- #: class/wpmdb.php:2383
725
- #: template/common/compatibility.php:34
726
- #: template/common/max-request-size.php:11
727
- #: template/pro/delay-between-requests.php:11
728
  msgctxt "The settings were saved successfully"
729
  msgid "Saved"
730
  msgstr ""
731
 
732
- #: class/wpmdb.php:2384
733
  msgid ""
734
  "Any sites setup to use the current secret key will no longer be able to "
735
  "connect. You will need to update those sites with the newly generated secret "
736
  "key. Do you wish to continue?"
737
  msgstr ""
738
 
739
- #: class/wpmdb.php:2385
740
  msgid ""
741
  "An error occurred when trying to generate the secret key. Please see the "
742
  "Help tab for details on how to request support. (#105)"
743
  msgstr ""
744
 
745
- #: class/wpmdb.php:2386
746
  msgid ""
747
  "You are about to remove the migration profile \"{{profile}}\". This cannot "
748
  "be undone. Do you wish to continue?"
749
  msgstr ""
750
 
751
- #: class/wpmdb.php:2387
752
  msgid ""
753
  "An error occurred when trying to delete the profile. Please see the Help tab "
754
  "for details on how to request support. (#106)"
755
  msgstr ""
756
 
757
- #: class/wpmdb.php:2388
758
  msgid ""
759
  "The selected migration profile could not be deleted because it was not "
760
  "found.\n"
@@ -762,139 +794,144 @@ msgid ""
762
  "migration profiles."
763
  msgstr ""
764
 
765
- #: class/wpmdb.php:2389
766
  msgid ""
767
  "If you change the connection details, you will lose any replaces and table "
768
  "selections you have made below. Do you wish to continue?"
769
  msgstr ""
770
 
771
- #: class/wpmdb.php:2390
772
  #: template/migrate.php:113
773
  msgid "Please enter the connection information above to continue."
774
  msgstr ""
775
 
776
- #: class/wpmdb.php:2391
777
  msgid ""
778
  "An error occurred when trying to save the settings. Please try again. If the "
779
  "problem persists, please see the Help tab for details on how to request "
780
  "support. (#108)"
781
  msgstr ""
782
 
783
- #: class/wpmdb.php:2392
784
  msgid ""
785
  "The connection information appears to be missing, please enter it to "
786
  "continue."
787
  msgstr ""
788
 
789
- #: class/wpmdb.php:2393
790
  msgid ""
791
  "The connection information appears to be incorrect, it should consist of two "
792
  "lines. The first being the remote server's URL and the second being the "
793
  "secret key."
794
  msgstr ""
795
 
796
- #: class/wpmdb.php:2394
797
  msgid ""
798
  "The URL on the first line appears to be invalid, please check it and try "
799
  "again."
800
  msgstr ""
801
 
802
- #: class/wpmdb.php:2395
803
  msgid ""
804
  "The secret key on the second line appears to be invalid. It should be a 32 "
805
  "character string that consists of letters, numbers and special characters "
806
  "only."
807
  msgstr ""
808
 
809
- #: class/wpmdb.php:2396
810
  msgid ""
811
  "It appears you've entered the URL for this website, you need to provide the "
812
  "URL of the remote website instead."
813
  msgstr ""
814
 
815
- #: class/wpmdb.php:2397
816
  msgid ""
817
  "Looks like your remote secret key is the same as the secret key for this "
818
  "site. To fix this, go to the <a href=\"#settings\">Settings tab</a> and "
819
  "click \"Reset Secret Key\""
820
  msgstr ""
821
 
822
- #: class/wpmdb.php:2398
823
- #: template/migrate-progress.php:11
824
  msgid "Time Elapsed:"
825
  msgstr ""
826
 
827
- #: class/wpmdb.php:2399
828
- #: template/migrate-progress.php:25
829
  msgctxt "Temporarily stop migrating"
830
  msgid "Pause"
831
  msgstr ""
832
 
833
- #: class/wpmdb.php:2400
834
  msgctxt "The migration has been temporarily stopped"
835
  msgid "Migration Paused"
836
  msgstr ""
837
 
838
- #: class/wpmdb.php:2401
839
  msgctxt "Restart migrating after it was paused"
840
  msgid "Resume"
841
  msgstr ""
842
 
843
- #: class/wpmdb.php:2402
844
  msgid "Completing current request"
845
  msgstr ""
846
 
847
- #: class/wpmdb.php:2403
848
  msgctxt "The migration is being cancelled"
849
  msgid "Cancelling migration"
850
  msgstr ""
851
 
852
- #: class/wpmdb.php:2404
853
  msgctxt "The migration has been temporarily stopped"
854
  msgid "Paused"
855
  msgstr ""
856
 
857
- #: class/wpmdb.php:2405
858
  msgid ""
859
  "Automatically paused before migrated tables are replaced. Click \"Resume\" "
860
  "or \"Cancel\" when ready."
861
  msgstr ""
862
 
863
- #: class/wpmdb.php:2406
864
  msgid "Removing the local MySQL export file"
865
  msgstr ""
866
 
867
- #: class/wpmdb.php:2407
868
  msgid "Removing the local backup MySQL export file"
869
  msgstr ""
870
 
871
- #: class/wpmdb.php:2408
872
  msgid "Removing the local temporary tables"
873
  msgstr ""
874
 
875
- #: class/wpmdb.php:2409
876
  msgid "Removing the remote backup MySQL export file"
877
  msgstr ""
878
 
879
- #: class/wpmdb.php:2410
880
  msgid "Removing the remote temporary tables"
881
  msgstr ""
882
 
883
- #: class/wpmdb.php:2411
884
  msgid "Migration cancellation failed"
885
  msgstr ""
886
 
887
- #: class/wpmdb.php:2412
888
  msgid ""
889
  "A problem occurred while cancelling the migration, you may have to manually "
890
  "delete some temporary files / tables."
891
  msgstr ""
892
 
893
- #: class/wpmdb.php:2413
894
  msgctxt "The migration has been cancelled"
895
  msgid "Migration cancelled"
896
  msgstr ""
897
 
 
 
 
 
 
 
898
  #: class/wpmdb.php:2414
899
  msgctxt "The migration completed successfully"
900
  msgid "Migration complete"
@@ -933,22 +970,22 @@ msgstr ""
933
 
934
  #: class/wpmdb.php:2421
935
  #, php-format
936
- msgid "Pulling from %s, please wait..."
937
  msgstr ""
938
 
939
  #: class/wpmdb.php:2422
940
  #, php-format
941
- msgid "Pulling from %s complete"
942
  msgstr ""
943
 
944
  #: class/wpmdb.php:2423
945
  #, php-format
946
- msgid "Pushing to %s, please wait..."
947
  msgstr ""
948
 
949
  #: class/wpmdb.php:2424
950
  #, php-format
951
- msgid "Pushing to %s complete"
952
  msgstr ""
953
 
954
  #: class/wpmdb.php:2425
@@ -956,11 +993,11 @@ msgid "Copying license to the remote site, please wait"
956
  msgstr ""
957
 
958
  #: class/wpmdb.php:2426
959
- msgid "Attempting to activate your license, please wait..."
960
  msgstr ""
961
 
962
  #: class/wpmdb.php:2427
963
- msgid "License successfully activated, please wait..."
964
  msgstr ""
965
 
966
  #: class/wpmdb.php:2428
@@ -1029,7 +1066,7 @@ msgid "Pull &amp; Save"
1029
  msgstr ""
1030
 
1031
  #: class/wpmdb.php:2440
1032
- #: template/migrate.php:353
1033
  msgctxt "Download a copy of the database"
1034
  msgid "Export"
1035
  msgstr ""
@@ -1039,31 +1076,102 @@ msgctxt "Download a copy of the database and save migration profile"
1039
  msgid "Export &amp; Save"
1040
  msgstr ""
1041
 
1042
- #: class/wpmdb.php:2477
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1043
  msgid "Could not find the file to download:"
1044
  msgstr ""
1045
 
1046
- #: class/wpmdb.php:2672
1047
  msgid "MySQL export file not found."
1048
  msgstr ""
1049
 
1050
- #: class/wpmdb.php:2678
1051
  msgid "Could not delete the MySQL export file."
1052
  msgstr ""
1053
 
1054
- #: class/wpmdb.php:2744
1055
  msgid ""
1056
  "WP Migrate DB and WP Migrate DB Pro cannot both be active. We've "
1057
  "automatically deactivated WP Migrate DB."
1058
  msgstr ""
1059
 
1060
- #: class/wpmdb.php:2746
1061
  msgid ""
1062
  "WP Migrate DB and WP Migrate DB Pro cannot both be active. We've "
1063
  "automatically deactivated WP Migrate DB Pro."
1064
  msgstr ""
1065
 
1066
- #: class/wpmdb.php:2824
1067
  #, php-format
1068
  msgid ""
1069
  "The source site supports utf8mb4 data but the target does not, aborting "
@@ -1071,29 +1179,29 @@ msgid ""
1071
  "information. (#148)"
1072
  msgstr ""
1073
 
1074
- #: class/wpmdb.php:2875
1075
  msgid "Warning: Mixed Case Table Names"
1076
  msgstr ""
1077
 
1078
- #: class/wpmdb.php:2878
1079
  msgid ""
1080
  "Whoa! We've detected that your <b>local</b> site has the MySQL setting "
1081
  "<code>lower_case_table_names</code> set to <code>1</code>."
1082
  msgstr ""
1083
 
1084
- #: class/wpmdb.php:2880
1085
  msgid ""
1086
  "Whoa! We've detected that your <b>remote</b> site has the MySQL setting "
1087
  "<code>lower_case_table_names</code> set to <code>1</code>."
1088
  msgstr ""
1089
 
1090
- #: class/wpmdb.php:2883
1091
  msgid ""
1092
  "As a result, uppercase characters in table names will be converted to "
1093
  "lowercase during the migration."
1094
  msgstr ""
1095
 
1096
- #: class/wpmdb.php:2885
1097
  #, php-format
1098
  msgid ""
1099
  "You can read more about this in <a href=\"%s\">our documentation</a>, "
@@ -1108,79 +1216,47 @@ msgid ""
1108
  "Now</a></strong>"
1109
  msgstr ""
1110
 
1111
- #: class/wpmdbpro-cli-export.php:62
1112
- msgid ""
1113
- "The installation must be a Multisite network to make use of the subsite "
1114
- "option"
1115
- msgstr ""
1116
-
1117
- #: class/wpmdbpro-cli-export.php:65
1118
- msgid ""
1119
- "The Multisite Tools addon needs to be installed and activated to make use of "
1120
- "the subsite option"
1121
- msgstr ""
1122
-
1123
- #: class/wpmdbpro-cli-export.php:68
1124
- #: class/wpmdbpro-cli-export.php:73
1125
- msgid ""
1126
- "A valid Blog ID or Subsite URL must be supplied to make use of the subsite "
1127
- "option"
1128
- msgstr ""
1129
-
1130
- #: class/wpmdbpro-cli-export.php:84
1131
- msgid "A new table name prefix may only be specified for subsite exports."
1132
- msgstr ""
1133
-
1134
- #: class/wpmdbpro-cli-export.php:87
1135
- msgid "A valid prefix must be supplied to make use of the prefix option"
1136
- msgstr ""
1137
-
1138
- #: class/wpmdbpro.php:108
1139
- msgctxt "Plugin extensions"
1140
- msgid "Addons"
1141
- msgstr ""
1142
-
1143
- #: class/wpmdbpro.php:179
1144
  msgid "UI Walkthrough"
1145
  msgstr ""
1146
 
1147
- #: class/wpmdbpro.php:180
1148
  msgid ""
1149
  "A brief walkthrough of the WP Migrate DB plugin showing all of the different "
1150
  "options and explaining them."
1151
  msgstr ""
1152
 
1153
- #: class/wpmdbpro.php:183
1154
  msgid "Pulling Live Data Into Your Local Development&nbsp;Environment"
1155
  msgstr ""
1156
 
1157
- #: class/wpmdbpro.php:184
1158
  msgid ""
1159
  "This screencast demonstrates how you can pull data from a remote, live "
1160
  "WordPress install and update the data in your local development environment."
1161
  msgstr ""
1162
 
1163
- #: class/wpmdbpro.php:187
1164
  msgid "Pushing Local Development Data to a Staging&nbsp;Environment"
1165
  msgstr ""
1166
 
1167
- #: class/wpmdbpro.php:188
1168
  msgid ""
1169
  "This screencast demonstrates how you can push a local WordPress database "
1170
  "you've been using for development to a staging environment."
1171
  msgstr ""
1172
 
1173
- #: class/wpmdbpro.php:191
1174
  msgid "WP Migrate DB Pro Media Files Addon 1.3 and CLI Addon 1.1"
1175
  msgstr ""
1176
 
1177
- #: class/wpmdbpro.php:192
1178
  msgid ""
1179
  "A demonstration of what's new in WP Migrate DB Pro Media Files Addon 1.3 and "
1180
  "CLI Addon 1.1."
1181
  msgstr ""
1182
 
1183
- #: class/wpmdbpro.php:299
1184
  msgid ""
1185
  "Please activate your license before attempting a pull or push migration."
1186
  msgstr ""
@@ -1192,21 +1268,21 @@ msgid ""
1192
  "(#141)"
1193
  msgstr ""
1194
 
1195
- #: class/wpmdbpro.php:648
1196
  msgid ""
1197
  "The connection succeeded but the remote site is configured to reject pull "
1198
  "connections. You can change this in the \"settings\" tab on the remote site. "
1199
  "(#110)"
1200
  msgstr ""
1201
 
1202
- #: class/wpmdbpro.php:650
1203
  msgid ""
1204
  "The connection succeeded but the remote site is configured to reject push "
1205
  "connections. You can change this in the \"settings\" tab on the remote site. "
1206
  "(#110)"
1207
  msgstr ""
1208
 
1209
- #: class/wpmdbpro.php:729
1210
  #, php-format
1211
  msgid ""
1212
  "<b>Version Mismatch</b> &mdash; We've detected you have version %1$s of WP "
@@ -1214,7 +1290,7 @@ msgid ""
1214
  "the Plugins page on both installs and check for updates."
1215
  msgstr ""
1216
 
1217
- #: class/wpmdbpro.php:731
1218
  #, php-format
1219
  msgid ""
1220
  "<b>Version Mismatch</b> &mdash; We've detected you have version %1$s of WP "
@@ -1222,138 +1298,138 @@ msgid ""
1222
  "\"%4$s\">Plugins page</a> on both installs and check for updates."
1223
  msgstr ""
1224
 
1225
- #: class/wpmdbpro.php:745
1226
  msgctxt "Asking to try and connect to remote server after verification error"
1227
  msgid "Try again?"
1228
  msgstr ""
1229
 
1230
- #: class/wpmdbpro.php:758
1231
  #, php-format
1232
  msgid ""
1233
  "Activate remote license &mdash; Looks like you don't have a WP Migrate DB "
1234
  "Pro license active at %s."
1235
  msgstr ""
1236
 
1237
- #: class/wpmdbpro.php:760
1238
  #, php-format
1239
  msgid "Copy %1$s license key to %2$s and activate it"
1240
  msgstr ""
1241
 
1242
- #: class/wpmdbpro.php:771
1243
  msgid ""
1244
  "The connection succeeded but the remote site is configured to reject pull "
1245
  "connections. You can change this in the \"settings\" tab on the remote site. "
1246
  "(#122)"
1247
  msgstr ""
1248
 
1249
- #: class/wpmdbpro.php:773
1250
  msgid ""
1251
  "The connection succeeded but the remote site is configured to reject push "
1252
  "connections. You can change this in the \"settings\" tab on the remote site. "
1253
  "(#122)"
1254
  msgstr ""
1255
 
1256
- #: class/wpmdbpro.php:775
1257
  msgctxt "Attempt to connect to the remote server again"
1258
  msgid "Try again?"
1259
  msgstr ""
1260
 
1261
- #: class/wpmdbpro.php:920
1262
  msgctxt "Delete license"
1263
  msgid "Remove"
1264
  msgstr ""
1265
 
1266
- #: class/wpmdbpro.php:1104
1267
  msgid ""
1268
  "If you have an <strong>active license</strong>, you may send an email to the "
1269
  "following address."
1270
  msgstr ""
1271
 
1272
- #: class/wpmdbpro.php:1106
1273
  msgid ""
1274
  "Please copy the Diagnostic Info &amp; Error Log info below into a text file "
1275
  "and attach it to your email. Do the same for any other site involved in your "
1276
  "email."
1277
  msgstr ""
1278
 
1279
- #: class/wpmdbpro.php:1137
1280
  msgctxt "License does not allow use of addons"
1281
  msgid "Addons Unavailable"
1282
  msgstr ""
1283
 
1284
- #: class/wpmdbpro.php:1137
1285
  #, php-format
1286
  msgid ""
1287
  "Addons are not included with the Personal license. Visit <a href=\"%s\" "
1288
  "target=\"_blank\">My Account</a> to upgrade in just a few clicks."
1289
  msgstr ""
1290
 
1291
- #: class/wpmdbpro.php:1152
1292
  msgctxt "Installed on website but not activated"
1293
  msgid "Installed"
1294
  msgstr ""
1295
 
1296
- #: class/wpmdbpro.php:1154
1297
  msgctxt "Installed and activated on website"
1298
  msgid "Activated"
1299
  msgstr ""
1300
 
1301
- #: class/wpmdbpro.php:1157
1302
  msgctxt "Enable addon so it may be used"
1303
  msgid "Activate"
1304
  msgstr ""
1305
 
1306
- #: class/wpmdbpro.php:1161
1307
  msgctxt "Download and activate addon"
1308
  msgid "Install"
1309
  msgstr ""
1310
 
1311
- #: class/wpmdbpro.php:1167
1312
  #: template/common/debug-info.php:4
1313
  msgctxt "Download to your computer"
1314
  msgid "Download"
1315
  msgstr ""
1316
 
1317
- #: class/wpmdbpro.php:1615
1318
  msgid "Could not upload the SQL to the server. (#135)"
1319
  msgstr ""
1320
 
1321
- #: class/wpmdbpro.php:1621
1322
  msgid "Could not read the SQL file we uploaded to the server. (#136)"
1323
  msgstr ""
1324
 
1325
- #: class/wpmdbpro.php:1640
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
  "(#139)"
1330
  msgstr ""
1331
 
1332
- #: class/wpmdbpro.php:1906
1333
  #, php-format
1334
  msgid "There is a new version of %s available."
1335
  msgstr ""
1336
 
1337
- #: class/wpmdbpro.php:1908
1338
  #, php-format
1339
  msgid "View version %s details"
1340
  msgstr ""
1341
 
1342
- #: class/wpmdbpro.php:1918
1343
  #, php-format
1344
  msgid ""
1345
  "To update, go to %1$s and enter your license key. If you don't have a "
1346
  "license key, you may <a href=\"%2$s\">purchase one</a>."
1347
  msgstr ""
1348
 
1349
- #: class/wpmdbpro.php:1920
1350
  #, php-format
1351
  msgid ""
1352
  "To finish activating %1$s, please go to %2$s and enter your license key. If "
1353
  "you don't have a license key, you may <a href=\"%3$s\">purchase one</a>."
1354
  msgstr ""
1355
 
1356
- #: class/wpmdbpro.php:1988
1357
  msgid "Could not retrieve version details. Please try again."
1358
  msgstr ""
1359
 
@@ -1361,15 +1437,64 @@ msgstr ""
1361
  msgid "Fetching addon details, please wait..."
1362
  msgstr ""
1363
 
1364
- #: template/addons.php:9
1365
- #: template/pro/licence-info.php:8
 
 
 
 
1366
  msgid ""
1367
- "We couldn't find your license information. Please switch to the settings tab "
1368
- "and enter your license."
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1369
  msgstr ""
1370
 
1371
- #: template/addons.php:10
1372
- msgid "Once completed, you may visit this tab to view the available addons."
 
 
 
 
 
 
 
1373
  msgstr ""
1374
 
1375
  #: template/common/breadcrumbs.php:3
@@ -1381,13 +1506,15 @@ msgstr ""
1381
  msgid "Saved Profiles"
1382
  msgstr ""
1383
 
1384
- #: template/common/compatibility.php:4
1385
- msgid ""
1386
- "Improve performance and reliability by not loading the following plugins for "
1387
- "migration requests"
1388
  msgstr ""
1389
 
1390
  #: template/common/compatibility.php:9
 
 
 
 
1391
  msgid ""
1392
  "Some plugins add a lot of overhead to each request, requiring extra memory "
1393
  "and CPU. And some plugins even interfere with migrations and cause them to "
@@ -1395,28 +1522,34 @@ msgid ""
1395
  "example a plugin that hooks into WP Migrate DB."
1396
  msgstr ""
1397
 
1398
- #: template/common/compatibility.php:26
 
 
 
 
 
 
1399
  #: template/pro/backup.php:44
1400
- #: template/pro/exclude-post-types.php:19
1401
  #: template/pro/select-tables.php:42
1402
  msgid "Select All"
1403
  msgstr ""
1404
 
1405
- #: template/common/compatibility.php:28
1406
  #: template/pro/backup.php:46
1407
- #: template/pro/exclude-post-types.php:21
1408
  #: template/pro/select-tables.php:44
1409
  msgid "Deselect All"
1410
  msgstr ""
1411
 
1412
- #: template/common/compatibility.php:30
1413
  #: template/pro/backup.php:48
1414
- #: template/pro/exclude-post-types.php:23
1415
  #: template/pro/select-tables.php:46
1416
  msgid "Invert Selection"
1417
  msgstr ""
1418
 
1419
- #: template/common/compatibility.php:33
1420
  msgid "Save Changes"
1421
  msgstr ""
1422
 
@@ -1428,11 +1561,13 @@ msgstr ""
1428
  msgid "Clear Error Log"
1429
  msgstr ""
1430
 
1431
- #: template/common/max-request-size.php:3
 
1432
  msgid "Maximum Request Size"
1433
  msgstr ""
1434
 
1435
- #: template/common/max-request-size.php:7
 
1436
  #, php-format
1437
  msgid ""
1438
  "We've detected that your server supports requests up to %s, but it's "
@@ -1442,19 +1577,23 @@ msgid ""
1442
  "with time outs, try throttling this setting down."
1443
  msgstr ""
1444
 
1445
- #: template/migrate-progress.php:5
1446
- msgid "Please wait while migration is running..."
1447
  msgstr ""
1448
 
1449
- #: template/migrate-progress.php:10
1450
  msgid "Establishing Connection"
1451
  msgstr ""
1452
 
1453
- #: template/migrate-progress.php:26
1454
  msgctxt "Stop the migration"
1455
  msgid "Cancel"
1456
  msgstr ""
1457
 
 
 
 
 
1458
  #: template/migrate.php:72
1459
  msgid "Export File"
1460
  msgstr ""
@@ -1564,28 +1703,24 @@ msgstr ""
1564
  msgid "Compatible with older versions of MySQL (pre-5.5)"
1565
  msgstr ""
1566
 
1567
- #: template/migrate.php:277
1568
- msgid "Pause before replacing migrated tables"
1569
- msgstr ""
1570
-
1571
- #: template/migrate.php:293
1572
  msgid "Save Migration Profile"
1573
  msgstr ""
1574
 
1575
- #: template/migrate.php:293
1576
  msgid "Save the above settings for the next time you do a similiar migration"
1577
  msgstr ""
1578
 
1579
- #: template/migrate.php:315
1580
  msgid "Create new profile"
1581
  msgstr ""
1582
 
1583
- #: template/migrate.php:324
1584
- #: template/migrate.php:334
1585
  msgid "Warning: Different Table Prefixes"
1586
  msgstr ""
1587
 
1588
- #: template/migrate.php:326
1589
  msgid ""
1590
  "Whoa! We've detected that the database table prefix differs between "
1591
  "installations. Clicking the Migrate button below will create new database "
@@ -1593,7 +1728,7 @@ msgid ""
1593
  "span>\"."
1594
  msgstr ""
1595
 
1596
- #: template/migrate.php:328
1597
  #, php-format
1598
  msgid ""
1599
  "However, your local install is configured to use table prefix \"%1$s\" and "
@@ -1602,13 +1737,13 @@ msgid ""
1602
  "variable to \"<span class=\"remote-prefix\"></span>\"."
1603
  msgstr ""
1604
 
1605
- #: template/migrate.php:330
1606
  msgid ""
1607
  "This will allow your local install the use the migrated tables. Once you do "
1608
  "this, you shouldn't have to do it again."
1609
  msgstr ""
1610
 
1611
- #: template/migrate.php:336
1612
  #, php-format
1613
  msgid ""
1614
  "Whoa! We've detected that the database table prefix differs between "
@@ -1616,7 +1751,7 @@ msgid ""
1616
  "tables in the remote database with prefix \"%s\"."
1617
  msgstr ""
1618
 
1619
- #: template/migrate.php:338
1620
  #, php-format
1621
  msgid ""
1622
  "However, your remote install is configured to use table prefix \"<span class="
@@ -1626,13 +1761,13 @@ msgid ""
1626
  "span>\" variable to \"%s\"."
1627
  msgstr ""
1628
 
1629
- #: template/migrate.php:340
1630
  msgid ""
1631
  "This will allow your remote install the use the migrated tables. Once you do "
1632
  "this, you shouldn't have to do it again."
1633
  msgstr ""
1634
 
1635
- #: template/migrate.php:354
1636
  msgctxt "Save current migration settings"
1637
  msgid "Save Profile"
1638
  msgstr ""
@@ -1710,9 +1845,9 @@ msgid ""
1710
  "will prevent WP Migrate DB Pro from functioning properly. You should either "
1711
  "disable <code>WP_HTTP_BLOCK_EXTERNAL</code> or add any sites that you'd like "
1712
  "to migrate to or from with WP Migrate DB Pro to <code>WP_ACCESSIBLE_HOSTS</"
1713
- "code> (deliciousbrains.com must be added to <code>WP_ACCESSIBLE_HOSTS</code> "
1714
- "for the API to work). More information on this can be found <a href=\"%s\" "
1715
- "target=\"_blank\">here</a>."
1716
  msgstr ""
1717
 
1718
  #. translators: 1: Remind Me Later, 2: Dismiss
@@ -1726,29 +1861,34 @@ msgstr ""
1726
  msgid "Connection Info"
1727
  msgstr ""
1728
 
1729
- #: template/pro/connection-info.php:5
1730
  msgid "Reset Secret Key"
1731
  msgstr ""
1732
 
1733
- #: template/pro/delay-between-requests.php:3
1734
- msgid "Delay Between Requests"
1735
  msgstr ""
1736
 
1737
- #: template/pro/delay-between-requests.php:7
1738
  msgid ""
1739
- "Some servers have rate limits which the plugin can hit when performing "
1740
- "migrations. If you're experiencing migration failures due to server rate "
1741
- "limits, you should set this to one or more seconds to alleviate the problem."
1742
- msgstr ""
1743
-
1744
- #: template/pro/exclude-post-types.php:4
1745
- msgid "Exclude Post Types"
1746
  msgstr ""
1747
 
1748
  #: template/pro/licence-info.php:2
1749
  msgid "Email Support"
1750
  msgstr ""
1751
 
 
 
 
 
 
 
 
 
 
 
1752
  #: template/pro/licence-info.php:9
1753
  msgid "Once completed, you may visit this tab to view your support details."
1754
  msgstr ""
@@ -1757,11 +1897,11 @@ msgstr ""
1757
  msgid "Your License"
1758
  msgstr ""
1759
 
1760
- #: template/pro/licence.php:5
1761
  msgid "The license key is currently defined in wp-config.php."
1762
  msgstr ""
1763
 
1764
- #: template/pro/licence.php:15
1765
  msgid "Activate License"
1766
  msgstr ""
1767
 
@@ -1790,6 +1930,38 @@ msgstr ""
1790
  msgid "Replace remote db with this site's db"
1791
  msgstr ""
1792
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1793
  #: template/pro/secret-key-warning.php:2
1794
  msgid "Improve Security"
1795
  msgstr ""
@@ -1822,26 +1994,24 @@ msgstr ""
1822
  msgid "Migrate only selected tables below"
1823
  msgstr ""
1824
 
1825
- #: template/pro/toggle-remote-requests.php:6
1826
- msgid ""
1827
- "Accept <b>pull</b> requests allow this database to be exported and downloaded"
1828
  msgstr ""
1829
 
1830
- #: template/pro/toggle-remote-requests.php:12
1831
- msgid "Accept <b>push</b> requests allow this database to be overwritten"
1832
  msgstr ""
1833
 
1834
- #: template/pro/toggle-remote-requests.php:18
1835
- msgid "Enable SSL verification"
1836
  msgstr ""
1837
 
1838
- #: template/pro/toggle-remote-requests.php:23
1839
- msgid ""
1840
- "We disable SSL verification by default because a lot of people's "
1841
- "environments are not setup for it to work. For example, with XAMPP, you have "
1842
- "to manually enable OpenSSL by editing the php.ini. Without SSL verification, "
1843
- "an HTTPS connection is vulnerable to a man-in-the-middle attack, so we do "
1844
- "recommend you configure your environment and enable this."
1845
  msgstr ""
1846
 
1847
  #: template/pro/videos.php:2
@@ -1862,7 +2032,7 @@ msgid "Exclude post revisions"
1862
  msgstr ""
1863
 
1864
  #: template/wpmdb/progress-upgrade.php:3
1865
- msgid "Seen the PRO version?"
1866
  msgstr ""
1867
 
1868
  #: template/wpmdb/progress-upgrade.php:5
@@ -1879,11 +2049,13 @@ msgstr ""
1879
  msgid "Run migrations from the command&nbsp;line"
1880
  msgstr ""
1881
 
1882
- #: template/wpmdb/progress-upgrade.php:11
1883
- msgid "Within a few hours WP Migrate DB Pro has paid for itself!"
 
 
1884
  msgstr ""
1885
 
1886
- #: template/wpmdb/progress-upgrade.php:17
1887
  msgid "More About The Pro Version"
1888
  msgstr ""
1889
 
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
  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"
17
  "Content-Type: text/plain; charset=UTF-8\n"
18
  "Content-Transfer-Encoding: 8bit\n"
19
 
20
+ #: class/wpmdb-base.php:172
21
  msgid ""
22
  "Invalid content verification signature, please verify the connection "
23
  "information on the remote site and try again."
24
  msgstr ""
25
 
26
+ #: class/wpmdb-base.php:364
27
  #, php-format
28
  msgid ""
29
  "The connection to the remote server has timed out, no changes have been "
30
  "committed. (#134 - scope: %s)"
31
  msgstr ""
32
 
33
+ #: class/wpmdb-base.php:366
34
  #, php-format
35
  msgid "We could not find: %s. Are you sure this is the correct URL?"
36
  msgstr ""
37
 
38
+ #: class/wpmdb-base.php:371
39
  msgid ""
40
  "It appears that you might be trying to pull from a local environment. This "
41
  "will not work if <u>this</u> website happens to be located on a remote "
43
  "environment."
44
  msgstr ""
45
 
46
+ #: class/wpmdb-base.php:373
47
  msgid ""
48
  "It appears that you might be trying to push to a local environment. This "
49
  "will not work if <u>this</u> website happens to be located on a remote "
51
  "environment."
52
  msgstr ""
53
 
54
+ #: class/wpmdb-base.php:381
55
  #, php-format
56
  msgid ""
57
  "We've detected that <code>WP_HTTP_BLOCK_EXTERNAL</code> is enabled and the "
61
  "\" target=\"_blank\">More information</a>. (#147 - scope: %3$s)"
62
  msgstr ""
63
 
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 "
114
+ "will not receive update notifications or be able to activate your license "
115
+ "until this is fixed. This issue is often caused by an improperly configured "
116
+ "SSL server (https). We recommend <a href=\"%1$s\" target=\"_blank\">fixing "
117
+ "the SSL configuration on your server</a>, but if you need a quick fix you "
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
  "\" 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
  "\">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
  "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
  "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
  "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
  "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
 
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
 
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 ""
449
  msgstr ""
450
 
451
  #: class/wpmdb-sanitize.php:94
452
+ #: class/wpmdb-sanitize.php:101
453
+ #, php-format
454
+ msgid "%1$s was expecting JSON data but got something else: \"%2$s\""
455
+ msgstr ""
456
+
457
+ #: class/wpmdb-sanitize.php:107
458
  #, php-format
459
  msgid "%1$s was expecting a valid numeric but got something else: \"%2$s\""
460
  msgstr ""
461
 
462
+ #: class/wpmdb-sanitize.php:114
463
  #, php-format
464
  msgid "%1$s was expecting an integer but got something else: \"%2$s\""
465
  msgstr ""
466
 
467
+ #: class/wpmdb-sanitize.php:121
468
  #, php-format
469
  msgid ""
470
  "%1$s was expecting a positive number (int) but got something else: \"%2$s\""
471
  msgstr ""
472
 
473
+ #: class/wpmdb-sanitize.php:128
474
  #, php-format
475
  msgid ""
476
  "%1$s was expecting a negative number (int) but got something else: \"%2$s\""
477
  msgstr ""
478
 
479
+ #: class/wpmdb-sanitize.php:135
480
  #, php-format
481
  msgid "%1$s was expecting 0 (int) but got something else: \"%2$s\""
482
  msgstr ""
483
 
484
+ #: class/wpmdb-sanitize.php:142
485
  #, php-format
486
  msgid "%1$s was expecting an empty value but got something else: \"%2$s\""
487
  msgstr ""
488
 
489
+ #: class/wpmdb-sanitize.php:149
490
  #, php-format
491
  msgid "%1$s was expecting a URL but got something else: \"%2$s\""
492
  msgstr ""
493
 
494
+ #: class/wpmdb-sanitize.php:157
495
  #, php-format
496
  msgid "%1$s was expecting a bool but got something else: \"%2$s\""
497
  msgstr ""
498
 
499
+ #: class/wpmdb-sanitize.php:163
500
  #, php-format
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
  "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"
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
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
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 ""
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 "
1115
+ "are about to get awesome! If you haven’t already, you should check out our "
1116
+ "<a href=\"%1$s\">Quick Start Guide</a> and <a href=\"%2$s\">Videos</a>. If "
1117
+ "you run into any trouble at all, use the <strong>Help tab</strong> above to "
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
  "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
  "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 ""
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
  "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
  "\"%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
 
1437
  msgid "Fetching addon details, please wait..."
1438
  msgstr ""
1439
 
1440
+ #: template/addons.php:12
1441
+ msgctxt "License must be activated to use addons"
1442
+ msgid "Activate Your License"
1443
+ msgstr ""
1444
+
1445
+ #: template/addons.php:12
1446
  msgid ""
1447
+ "Please switch to the Settings tab and activate your license. If your license "
1448
+ "includes the addons below, you will be able to install them from here with "
1449
+ "one-click."
1450
+ msgstr ""
1451
+
1452
+ #: template/addons.php:16
1453
+ msgctxt "Addons are available with a developer license and better"
1454
+ msgid "Get Addons"
1455
+ msgstr ""
1456
+
1457
+ #: template/addons.php:16
1458
+ #, php-format
1459
+ msgid ""
1460
+ "The following addons are available with the WP Migrate DB Pro Developer "
1461
+ "license and better. Visit <a href=\"%s\" target=\"_blank\">deliciousbrains."
1462
+ "com</a> to purchase in just a few clicks."
1463
+ msgstr ""
1464
+
1465
+ #: template/addons.php:22
1466
+ msgid "Media Files"
1467
+ msgstr ""
1468
+
1469
+ #: template/addons.php:23
1470
+ #, php-format
1471
+ msgid ""
1472
+ "Allows you to push and pull your files in the Media Library between two "
1473
+ "WordPress installs. It can compare both libraries and only migrate those "
1474
+ "missing or updated, or it can do a complete copy of one site's library to "
1475
+ "another. <a href=\"%s\">More Details &rarr;</a>"
1476
+ msgstr ""
1477
+
1478
+ #: template/addons.php:29
1479
+ msgid "CLI"
1480
+ msgstr ""
1481
+
1482
+ #: template/addons.php:30
1483
+ #, php-format
1484
+ msgid ""
1485
+ "Integrates WP Migrate DB Pro with WP-CLI allowing you to run migrations from "
1486
+ "the command line: %s <a href=\"%s\">More Details &rarr;</a>"
1487
  msgstr ""
1488
 
1489
+ #: template/addons.php:36
1490
+ msgid "Multisite Tools"
1491
+ msgstr ""
1492
+
1493
+ #: template/addons.php:37
1494
+ #, php-format
1495
+ msgid ""
1496
+ "Export a subsite as an SQL file that can then be imported as a single site "
1497
+ "install. <a href=\"%s\">More Details &rarr;</a>"
1498
  msgstr ""
1499
 
1500
  #: template/common/breadcrumbs.php:3
1506
  msgid "Saved Profiles"
1507
  msgstr ""
1508
 
1509
+ #: template/common/compatibility.php:2
1510
+ msgid "Compatibility"
 
 
1511
  msgstr ""
1512
 
1513
  #: template/common/compatibility.php:9
1514
+ msgid "Plugin Compatibility Mode"
1515
+ msgstr ""
1516
+
1517
+ #: template/common/compatibility.php:11
1518
  msgid ""
1519
  "Some plugins add a lot of overhead to each request, requiring extra memory "
1520
  "and CPU. And some plugins even interfere with migrations and cause them to "
1522
  "example a plugin that hooks into WP Migrate DB."
1523
  msgstr ""
1524
 
1525
+ #: template/common/compatibility.php:15
1526
+ msgid ""
1527
+ "Avoid plugin conflicts and improve performance by not loading plugins for "
1528
+ "migration requests."
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
 
1552
+ #: template/common/compatibility.php:42
1553
  msgid "Save Changes"
1554
  msgstr ""
1555
 
1561
  msgid "Clear Error Log"
1562
  msgstr ""
1563
 
1564
+ #: template/common/max-request-size.php:6
1565
+ #: template/pro/request-settings.php:24
1566
  msgid "Maximum Request Size"
1567
  msgstr ""
1568
 
1569
+ #: template/common/max-request-size.php:10
1570
+ #: template/pro/request-settings.php:28
1571
  #, php-format
1572
  msgid ""
1573
  "We've detected that your server supports requests up to %s, but it's "
1577
  "with time outs, try throttling this setting down."
1578
  msgstr ""
1579
 
1580
+ #: template/migrate-progress.php:6
1581
+ msgid "Please wait while migration is running"
1582
  msgstr ""
1583
 
1584
+ #: template/migrate-progress.php:7
1585
  msgid "Establishing Connection"
1586
  msgstr ""
1587
 
1588
+ #: template/migrate-progress.php:18
1589
  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 ""
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
  "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
  "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
  "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
  "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 ""
1845
  "will prevent WP Migrate DB Pro from functioning properly. You should either "
1846
  "disable <code>WP_HTTP_BLOCK_EXTERNAL</code> or add any sites that you'd like "
1847
  "to migrate to or from with WP Migrate DB Pro to <code>WP_ACCESSIBLE_HOSTS</"
1848
+ "code> (api.deliciousbrains.com must be added to <code>WP_ACCESSIBLE_HOSTS</"
1849
+ "code> for the API to work). More information on this can be found <a href="
1850
+ "\"%s\" target=\"_blank\">here</a>."
1851
  msgstr ""
1852
 
1853
  #. translators: 1: Remind Me Later, 2: Dismiss
1861
  msgid "Connection Info"
1862
  msgstr ""
1863
 
1864
+ #: template/pro/connection-info.php:8
1865
  msgid "Reset Secret Key"
1866
  msgstr ""
1867
 
1868
+ #: template/pro/exclude-post-types.php:4
1869
+ msgid "Exclude Post Types"
1870
  msgstr ""
1871
 
1872
+ #: template/pro/exclude-post-types.php:11
1873
  msgid ""
1874
+ "WARNING: All of the following post types will be absent in the destination "
1875
+ "posts table after migration:"
 
 
 
 
 
1876
  msgstr ""
1877
 
1878
  #: template/pro/licence-info.php:2
1879
  msgid "Email Support"
1880
  msgstr ""
1881
 
1882
+ #: template/pro/licence-info.php:6
1883
+ msgid "Fetching license details, please wait..."
1884
+ msgstr ""
1885
+
1886
+ #: template/pro/licence-info.php:8
1887
+ msgid ""
1888
+ "We couldn't find your license information. Please switch to the settings tab "
1889
+ "and enter your license."
1890
+ msgstr ""
1891
+
1892
  #: template/pro/licence-info.php:9
1893
  msgid "Once completed, you may visit this tab to view your support details."
1894
  msgstr ""
1897
  msgid "Your License"
1898
  msgstr ""
1899
 
1900
+ #: template/pro/licence.php:8
1901
  msgid "The license key is currently defined in wp-config.php."
1902
  msgstr ""
1903
 
1904
+ #: template/pro/licence.php:18
1905
  msgid "Activate License"
1906
  msgstr ""
1907
 
1930
  msgid "Replace remote db with this site's db"
1931
  msgstr ""
1932
 
1933
+ #: template/pro/request-settings.php:2
1934
+ msgid "Request Settings"
1935
+ msgstr ""
1936
+
1937
+ #: template/pro/request-settings.php:10
1938
+ msgid "Certificate Verification"
1939
+ msgstr ""
1940
+
1941
+ #: template/pro/request-settings.php:12
1942
+ msgid ""
1943
+ "We disable SSL verification by default because a lot of people's "
1944
+ "environments are not setup for it to work. For example, with XAMPP, you have "
1945
+ "to manually enable OpenSSL by editing the php.ini. Without SSL verification, "
1946
+ "an HTTPS connection is vulnerable to a man-in-the-middle attack, so we do "
1947
+ "recommend you configure your environment and enable this."
1948
+ msgstr ""
1949
+
1950
+ #: template/pro/request-settings.php:16
1951
+ msgid "Verify the authenticity of the remote server’s TLS certificate. "
1952
+ msgstr ""
1953
+
1954
+ #: template/pro/request-settings.php:42
1955
+ msgid "Delay Between Requests"
1956
+ msgstr ""
1957
+
1958
+ #: template/pro/request-settings.php:46
1959
+ msgid ""
1960
+ "Some servers have rate limits which the plugin can hit when performing "
1961
+ "migrations. If you're experiencing migration failures due to server rate "
1962
+ "limits, you should set this to one or more seconds to alleviate the problem."
1963
+ msgstr ""
1964
+
1965
  #: template/pro/secret-key-warning.php:2
1966
  msgid "Improve Security"
1967
  msgstr ""
1994
  msgid "Migrate only selected tables below"
1995
  msgstr ""
1996
 
1997
+ #: template/pro/toggle-remote-requests.php:2
1998
+ msgid "Permissions"
 
1999
  msgstr ""
2000
 
2001
+ #: template/pro/toggle-remote-requests.php:8
2002
+ msgid "Pull"
2003
  msgstr ""
2004
 
2005
+ #: template/pro/toggle-remote-requests.php:9
2006
+ msgid "Process requests to pull data from this install, copying it elsewhere."
2007
  msgstr ""
2008
 
2009
+ #: template/pro/toggle-remote-requests.php:16
2010
+ msgid "Push"
2011
+ msgstr ""
2012
+
2013
+ #: template/pro/toggle-remote-requests.php:17
2014
+ msgid "Process requests to push data to this install, overwriting its data."
 
2015
  msgstr ""
2016
 
2017
  #: template/pro/videos.php:2
2032
  msgstr ""
2033
 
2034
  #: template/wpmdb/progress-upgrade.php:3
2035
+ msgid "Seen the PRO version yet?"
2036
  msgstr ""
2037
 
2038
  #: template/wpmdb/progress-upgrade.php:5
2049
  msgid "Run migrations from the command&nbsp;line"
2050
  msgstr ""
2051
 
2052
+ #: template/wpmdb/progress-upgrade.php:15
2053
+ msgid ""
2054
+ "Even though I've been using it for a long time the push/pull functionality "
2055
+ "in @dliciousbrains WP&nbsp;Migrate&nbsp;DB&nbsp;Pro continues to impress me."
2056
  msgstr ""
2057
 
2058
+ #: template/wpmdb/progress-upgrade.php:24
2059
  msgid "More About The Pro Version"
2060
  msgstr ""
2061
 
readme.txt CHANGED
@@ -2,9 +2,9 @@
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.0
6
- Tested up to: 4.5
7
- Stable tag: 0.7.2
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,15 @@ If you upgrade to [WP Migrate DB Pro](http://deliciousbrains.com/wp-migrate-db-p
87
 
88
  == Changelog ==
89
 
 
 
 
 
 
 
 
 
 
90
  = WP Migrate DB 0.7.2 - 2015-12-03 =
91
 
92
  * Improvement: "Migrate" button renamed to "Export"
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
 
88
  == Changelog ==
89
 
90
+ = WP Migrate DB 0.8 - 2016-04-12 =
91
+
92
+ * New: Migration progress UI
93
+ * New: Individual table migration progress
94
+ * New: Migration progress shown in title bar
95
+ * New: Settings tab UI
96
+ * Improvement: Adding a new find/replace row now automatically adds focus to the new "find" input
97
+ * Improvement: Compatibility with WordPress 4.5
98
+
99
  = WP Migrate DB 0.7.2 - 2015-12-03 =
100
 
101
  * Improvement: "Migrate" button renamed to "Export"
template/addons.php CHANGED
@@ -3,11 +3,41 @@
3
  ?>
4
  <div class="addons-tab content-tab">
5
  <div class="addons-content">
6
- <?php if ( ! empty( $licence ) ) : ?>
7
  <p><?php _e( 'Fetching addon details, please wait...', 'wp-migrate-db' ); ?></p>
8
  <?php else : ?>
9
- <p><?php _e( 'We couldn\'t find your license information. Please switch to the settings tab and enter your license.', 'wp-migrate-db' ); ?></p>
10
- <p><?php _e( 'Once completed, you may visit this tab to view the available addons.', 'wp-migrate-db' ); ?></p>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11
  <?php endif; ?>
12
  </div>
13
  </div>
3
  ?>
4
  <div class="addons-tab content-tab">
5
  <div class="addons-content">
6
+ <?php if ( ! empty( $licence ) && $this->is_pro ) : ?>
7
  <p><?php _e( 'Fetching addon details, please wait...', 'wp-migrate-db' ); ?></p>
8
  <?php else : ?>
9
+
10
+ <?php if ( $this->is_pro ) : ?>
11
+ <p class="inline-message warning">
12
+ <strong><?php _ex( 'Activate Your License', 'License must be activated to use addons', 'wp-migrate-db' ); ?></strong> &ndash; <?php _e( 'Please switch to the Settings tab and activate your license. If your license includes the addons below, you will be able to install them from here with one-click.', 'wp-migrate-db' ); ?>
13
+ </p>
14
+ <?php else: ?>
15
+ <p class="inline-message warning">
16
+ <strong><?php _ex( 'Get Addons', 'Addons are available with a developer license and better', 'wp-migrate-db' ); ?></strong> &ndash; <?php printf( __( 'The following addons are available with the WP Migrate DB Pro Developer license and better. Visit <a href="%s" target="_blank">deliciousbrains.com</a> to purchase in just a few clicks.', 'wp-migrate-db' ), 'https://deliciousbrains.com/wp-migrate-db-pro/?utm_source=insideplugin&utm_medium=web&utm_content=addons-tab&utm_campaign=freeplugin' ); ?>
17
+ </p>
18
+ <?php endif; ?>
19
+
20
+ <article class="addon wp-migrate-db-pro-media-files">
21
+ <div class="desc">
22
+ <h1><?php _e( 'Media Files', 'wp-migrate-db' ); ?></h1>
23
+ <p><?php printf( __( 'Allows you to push and pull your files in the Media Library between two WordPress installs. It can compare both libraries and only migrate those missing or updated, or it can do a complete copy of one site\'s library to another. <a href="%s">More Details &rarr;</a>', 'wp-migrate-db' ), 'https://deliciousbrains.com/wp-migrate-db-pro/doc/media-files-addon/' ); ?></p>
24
+ </div>
25
+ </article>
26
+
27
+ <article class="addon wp-migrate-db-pro-cli">
28
+ <div class="desc">
29
+ <h1><?php _e( 'CLI', 'wp-migrate-db' ); ?></h1>
30
+ <p><?php printf( __( 'Integrates WP Migrate DB Pro with WP-CLI allowing you to run migrations from the command line: %s <a href="%s">More Details &rarr;</a>', 'wp-migrate-db' ), '<code>wp migratedb &lt;push|pull&gt; &lt;url&gt; &lt;secret-key&gt;</code> <code>[--find=&lt;strings&gt;] [--replace=&lt;strings&gt;] ...</code>', 'https://deliciousbrains.com/wp-migrate-db-pro/doc/cli-addon/' ); ?></p>
31
+ </div>
32
+ </article>
33
+
34
+ <article class="addon wp-migrate-db-pro-multisite-tools">
35
+ <div class="desc">
36
+ <h1><?php _e( 'Multisite Tools', 'wp-migrate-db' ); ?></h1>
37
+ <p><?php printf( __( 'Export a subsite as an SQL file that can then be imported as a single site install. <a href="%s">More Details &rarr;</a>', 'wp-migrate-db' ), 'https://deliciousbrains.com/wp-migrate-db-pro/doc/multisite-tools-addon/' ); ?></p>
38
+ </div>
39
+ </article>
40
+
41
  <?php endif; ?>
42
  </div>
43
  </div>
template/common/checkbox.php ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $value = ( isset( $value ) ) ? $value : $this->settings[$key];
3
+ $class = ( isset( $class ) ) ? 'class="' . $class . '"' : '';
4
+ $disabled = ( isset( $disabled ) && $disabled ) ? ' disabled' : '';
5
+ ?>
6
+ <div id="<?php echo $key; ?>-wrap" data-checkbox="<?php echo $key; ?>" class="wpmdb-switch<?php echo $disabled . $value ? ' on' : ''; ?>">
7
+ <span class="on <?php echo $value ? 'checked' : ''; ?>">ON</span>
8
+ <span class="off <?php echo ! $value ? 'checked' : ''; ?>">OFF</span>
9
+ <input type="hidden" name="<?php echo $key; ?>" value="0" />
10
+ <input type="checkbox" name="<?php echo $key; ?>" value="1" id="<?php echo $key; ?>" <?php checked( $value ); ?> <?php echo $class ?>/>
11
+ </div>
template/common/compatibility.php CHANGED
@@ -1,37 +1,46 @@
1
- <div class="option-section plugin-compatibility-section">
2
- <label for="plugin-compatibility" class="plugin-compatibility bubble">
3
- <input id="plugin-compatibility" type="checkbox" name="plugin_compatibility"<?php echo $plugin_compatibility_checked; ?> autocomplete="off"<?php echo $plugin_compatibility_checked; ?> />
4
- <?php _e( 'Improve performance and reliability by not loading the following plugins for migration requests', 'wp-migrate-db' ); ?>
5
- </label>
6
- <a href="#" class="general-helper plugin-compatibility-helper js-action-link"></a>
7
 
8
- <div class="plugin-compatibility-message helper-message bottom">
9
- <?php _e( 'Some plugins add a lot of overhead to each request, requiring extra memory and CPU. And some plugins even interfere with migrations and cause them to fail. We recommend only loading plugins that affect migration requests, for example a plugin that hooks into WP Migrate DB.', 'wp-migrate-db' ); ?></br>
10
- </div>
 
 
 
 
 
 
 
 
 
 
11
 
12
- <div class="indent-wrap expandable-content plugin-compatibility-wrap select-wrap">
13
- <select autocomplete="off" class="multiselect" id="selected-plugins" name="selected_plugins[]" multiple="multiple">
14
- <?php
15
- $blacklist = array_flip( (array) $this->settings['blacklist_plugins'] );
16
- foreach ( get_plugins() as $key => $plugin ) {
17
- if ( 0 === strpos( $key, 'wp-migrate-db' ) ) {
18
- continue;
 
 
 
 
 
19
  }
20
- $selected = ( isset( $blacklist[ $key ] ) ) ? ' selected' : '';
21
- printf( '<option value="%s"%s>%s</option>', $key, $selected, $plugin['Name'] );
22
- }
23
- ?>
24
- </select>
25
- <br>
26
- <a class="multiselect-select-all js-action-link" href="#"><?php _e( 'Select All', 'wp-migrate-db' ); ?></a>
27
- <span class="select-deselect-divider">/</span>
28
- <a class="multiselect-deselect-all js-action-link" href="#"><?php _e( 'Deselect All', 'wp-migrate-db' ); ?></a>
29
- <span class="select-deselect-divider">/</span>
30
- <a class="multiselect-invert-selection js-action-link" href="#"><?php _e( 'Invert Selection', 'wp-migrate-db' ); ?></a>
31
 
32
- <p>
33
- <span class="button plugin-compatibility-save"><?php _e( 'Save Changes', 'wp-migrate-db' ); ?></span>
34
- <span class="plugin-compatibility-success-msg"><?php _ex( 'Saved', 'The settings were saved successfully', 'wp-migrate-db' ); ?></span>
35
- </p>
36
- </div>
37
- </div>
1
+ <tr class="wpmdb-setting-title">
2
+ <td colspan="2"><h3><?php _e( 'Compatibility', 'wp-migrate-db' ); ?></h3></td>
3
+ </tr>
 
 
 
4
 
5
+ <tr>
6
+ <td><?php $this->template( 'checkbox', 'common', array( 'key' => 'plugin-compatibility', 'value' => $plugin_compatibility_checked ) ); ?></td>
7
+ <td>
8
+ <h4>
9
+ <?php _e( 'Plugin Compatibility Mode', 'wp-migrate-db' ); ?> <a href="#" class="general-helper plugin-compatibility-helper js-action-link"></a>
10
+ <div class="plugin-compatibility-message helper-message bottom">
11
+ <?php _e( 'Some plugins add a lot of overhead to each request, requiring extra memory and CPU. And some plugins even interfere with migrations and cause them to fail. We recommend only loading plugins that affect migration requests, for example a plugin that hooks into WP Migrate DB.', 'wp-migrate-db' ); ?></br>
12
+ </div>
13
+ <span class="setting-status"></span>
14
+ </h4>
15
+ <p><?php _e( 'Avoid plugin conflicts and improve performance by not loading plugins for migration requests.', 'wp-migrate-db' ); ?></p>
16
+ </td>
17
+ </tr>
18
 
19
+ <tr class="plugin-compatibility-section">
20
+ <td colspan="2">
21
+ <div class="indent-wrap expandable-content plugin-compatibility-wrap select-wrap">
22
+ <select autocomplete="off" class="multiselect" id="selected-plugins" name="selected_plugins[]" multiple="multiple">
23
+ <?php
24
+ $blacklist = array_flip( (array) $this->settings['blacklist_plugins'] );
25
+ foreach ( get_plugins() as $key => $plugin ) {
26
+ if ( 0 === strpos( $key, 'wp-migrate-db' ) ) {
27
+ continue;
28
+ }
29
+ $selected = ( isset( $blacklist[ $key ] ) ) ? ' selected' : '';
30
+ printf( '<option value="%s"%s>%s</option>', $key, $selected, $plugin['Name'] );
31
  }
32
+ ?>
33
+ </select>
34
+ <br>
35
+ <a class="multiselect-select-all js-action-link" href="#"><?php _e( 'Select All', 'wp-migrate-db' ); ?></a>
36
+ <span class="select-deselect-divider">/</span>
37
+ <a class="multiselect-deselect-all js-action-link" href="#"><?php _e( 'Deselect All', 'wp-migrate-db' ); ?></a>
38
+ <span class="select-deselect-divider">/</span>
39
+ <a class="multiselect-invert-selection js-action-link" href="#"><?php _e( 'Invert Selection', 'wp-migrate-db' ); ?></a>
 
 
 
40
 
41
+ <p>
42
+ <span class="button plugin-compatibility-save"><?php _e( 'Save Changes', 'wp-migrate-db' ); ?></span>
43
+ </p>
44
+ </div>
45
+ </td>
46
+ </tr>
template/common/max-request-size.php CHANGED
@@ -1,14 +1,17 @@
1
- <div class="option-section slider-outer-wrapper max-request-size">
2
- <div class="clearfix slider-label-wrapper">
3
- <div class="slider-label"><span><?php _e( 'Maximum Request Size', 'wp-migrate-db' ); ?></span>
4
- <a class="general-helper slider-helper js-action-link" href="#"></a>
5
 
6
- <div class="slider-message helper-message">
7
- <?php printf( __( 'We\'ve detected that your server supports requests up to %s, but it\'s possible that your server has limitations that we could not detect. To be on the safe side, we set the default to 1 MB, but you can try throttling it up to get better performance. If you\'re getting a 413 error or having trouble with time outs, try throttling this setting down.', 'wp-migrate-db' ), size_format( $this->get_bottleneck( 'max' ) ) ); ?>
 
 
 
 
 
 
 
8
  </div>
 
9
  </div>
10
- <div class="amount"></div>
11
- <span class="slider-success-msg"><?php _ex( 'Saved', 'The settings were saved successfully', 'wp-migrate-db' ); ?></span>
12
- </div>
13
- <div class="slider"></div>
14
- </div>
1
+ <?php if ( $this->is_pro ) return; ?>
 
 
 
2
 
3
+ <tr class="option-section slider-outer-wrapper max-request-size">
4
+ <td colspan="2">
5
+ <div class="clearfix slider-label-wrapper">
6
+ <div class="slider-label"><span><?php _e( 'Maximum Request Size', 'wp-migrate-db' ); ?></span>
7
+ <a class="general-helper slider-helper js-action-link" href="#"></a>
8
+
9
+ <div class="slider-message helper-message">
10
+ <?php printf( __( 'We\'ve detected that your server supports requests up to %s, but it\'s possible that your server has limitations that we could not detect. To be on the safe side, we set the default to 1 MB, but you can try throttling it up to get better performance. If you\'re getting a 413 error or having trouble with time outs, try throttling this setting down.', 'wp-migrate-db' ), size_format( $this->get_bottleneck( 'max' ) ) ); ?>
11
+ </div>
12
  </div>
13
+ <div class="amount"></div>
14
  </div>
15
+ <div class="slider"></div>
16
+ </td>
17
+ </tr>
 
 
template/migrate-progress.php CHANGED
@@ -1,31 +1,21 @@
1
- <div class="progress-content">
2
  <span class="close-progress-content close-progress-content-button">&times;</span>
3
 
4
- <div>
5
- <h2 class="progress-title"><?php _e( 'Please wait while migration is running...', 'wp-migrate-db' ); ?></h2>
6
- </div>
7
-
8
  <div class="progress-wrapper-primary">
9
  <div class="progress-info-wrapper clearfix">
 
10
  <div class="progress-text"><?php _e( 'Establishing Connection', 'wp-migrate-db' ); ?></div>
11
- <span class="timer"><?php echo __( 'Time Elapsed:', 'wp-migrate-db' ) . ' 00:00:00'; ?></span>
12
- </div>
13
- <div class="clearfix"></div>
14
- <div class="progress-bar-wrapper">
15
- <div class="progress-tables-hover-boxes"></div>
16
- <div class="progress-label">wp_options</div>
17
- <div class="progress-bar"></div>
18
- <div class="progress-tables"></div>
19
  </div>
 
20
  </div>
21
 
22
- <?php do_action( 'wpmdb_template_progress_after_bar' ); ?>
 
23
 
24
  <div class="migration-controls">
25
  <span class="pause-resume button"><?php _ex( 'Pause', 'Temporarily stop migrating', 'wp-migrate-db' ); ?></span>
26
  <span class="cancel button"><?php _ex( 'Cancel', 'Stop the migration', 'wp-migrate-db' ); ?></span>
 
27
  </div>
28
-
29
- <?php $this->template_part( array( 'progress_upgrade' ) ); ?>
30
-
31
  </div> <!-- end .progress-content -->
1
+ <div class="progress-content progress-overlay-container">
2
  <span class="close-progress-content close-progress-content-button">&times;</span>
3
 
 
 
 
 
4
  <div class="progress-wrapper-primary">
5
  <div class="progress-info-wrapper clearfix">
6
+ <h2 class="progress-title"><?php _e( 'Please wait while migration is running…', 'wp-migrate-db' ); ?></h2>
7
  <div class="progress-text"><?php _e( 'Establishing Connection', 'wp-migrate-db' ); ?></div>
8
+ <span class="timer">00:00:00</span>
 
 
 
 
 
 
 
9
  </div>
10
+
11
  </div>
12
 
13
+ <div class="stage-tabs"></div>
14
+ <div class="migration-progress-stages"></div>
15
 
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 -->
template/migrate.php CHANGED
@@ -170,7 +170,7 @@ $breadcrumbs_params = array(
170
  <span class="sort-handle"></span>
171
  </td>
172
  <td class="old-replace-col">
173
- <input type="text" size="40" name="replace_old[]" class="code" id="old-path" placeholder="Old file path" value="<?php echo esc_attr( $this->absolute_root_file_path ); ?>" autocomplete="off" />
174
  </td>
175
  <td class="arrow-col" title="Copy Find to Replace">
176
  <span class="right-arrow">&rarr;</span>
@@ -271,12 +271,6 @@ $breadcrumbs_params = array(
271
  <?php _e( 'Compatible with older versions of MySQL (pre-5.5)', 'wp-migrate-db' ); ?>
272
  </label>
273
  </li>
274
- <li class="pause-before-finalize">
275
- <label for="pause-before-finalize">
276
- <input id="pause-before-finalize" type="checkbox" value="1" autocomplete="off" name="pause_before_finalize"<?php $this->maybe_checked( $loaded_profile['pause_before_finalize'] ); ?> />
277
- <?php _e( 'Pause before replacing migrated tables', 'wp-migrate-db' ); ?>
278
- </label>
279
- </li>
280
  <?php $this->template_part( array( 'exclude_post_revisions' ), $loaded_profile ); ?>
281
  </ul>
282
 
@@ -359,4 +353,6 @@ $breadcrumbs_params = array(
359
  </form>
360
  <?php $this->template( 'migrate-progress' ); ?>
361
 
 
 
362
  </div> <!-- end .migrate-tab -->
170
  <span class="sort-handle"></span>
171
  </td>
172
  <td class="old-replace-col">
173
+ <input type="text" size="40" name="replace_old[]" class="code" id="old-path" placeholder="Old file path" value="<?php echo esc_attr( $this->get_absolute_root_file_path() ); ?>" autocomplete="off" />
174
  </td>
175
  <td class="arrow-col" title="Copy Find to Replace">
176
  <span class="right-arrow">&rarr;</span>
271
  <?php _e( 'Compatible with older versions of MySQL (pre-5.5)', 'wp-migrate-db' ); ?>
272
  </label>
273
  </li>
 
 
 
 
 
 
274
  <?php $this->template_part( array( 'exclude_post_revisions' ), $loaded_profile ); ?>
275
  </ul>
276
 
353
  </form>
354
  <?php $this->template( 'migrate-progress' ); ?>
355
 
356
+ <?php $this->template_part( array( 'progress_upgrade' ) ); ?>
357
+
358
  </div> <!-- end .migrate-tab -->
template/settings.php CHANGED
@@ -1,6 +1,7 @@
1
  <div class="settings-tab content-tab">
2
  <form method="post" id="settings-form" action="#settings" autocomplete="off">
3
- <?php $this->template_part( array( 'toggle_remote_requests', 'connection_info', 'compatibility', 'max_request_size', 'delay_between_requests' ) ); ?>
 
 
4
  </form>
5
- <?php $this->template_part( array( 'licence' ) ); ?>
6
  </div> <!-- end .settings-tab -->
1
  <div class="settings-tab content-tab">
2
  <form method="post" id="settings-form" action="#settings" autocomplete="off">
3
+ <table class="form-table">
4
+ <?php $this->template_part( array( 'connection_info', 'toggle_remote_requests', 'licence', 'request_settings', 'compatibility', 'max_request_size' ) ); ?>
5
+ </table>
6
  </form>
 
7
  </div> <!-- end .settings-tab -->
template/wpmdb/progress-upgrade.php CHANGED
@@ -1,21 +1,27 @@
1
- <div class="pro-version">
2
  <div class="pro-version-content">
3
- <h1><?php _e( 'Seen the PRO version?', 'wp-migrate-db' ); ?></h1>
4
  <ul>
5
- <li><?php _e( 'One-click in your WordPress dashboard to push your database up to staging/production or pull it down to&nbsp;dev', 'wp-migrate-db' ); ?></li>
6
- <li><?php _e( 'Sync the Media Libraries of two&nbsp;sites', 'wp-migrate-db' ); ?></li>
7
- <li><?php _e( 'Run migrations from the command&nbsp;line', 'wp-migrate-db' ); ?></li>
8
  </ul>
9
 
10
- <p class="pro-quote">
11
- <strong>&#8220;<?php _e( 'Within a few hours WP Migrate DB Pro has paid for itself!', 'wp-migrate-db' ); ?> &#8221;</strong>
12
- <span class="pro-quote-author">
13
- &mdash; Eric Wagner <span class="dashicons dashicons-star-filled"></span><span class="dashicons dashicons-star-filled"></span><span class="dashicons dashicons-star-filled"></span><span class="dashicons dashicons-star-filled"></span><span class="dashicons dashicons-star-filled"></span>
14
- </span>
15
- </p>
 
 
 
16
 
17
- <a class="button" href="https://deliciousbrains.com/wp-migrate-db-pro/?utm_source=insideplugin&utm_medium=web&utm_content=progress-bar&utm_campaign=freeplugin" target="_blank"><?php _e( 'More About The Pro Version', 'wp-migrate-db' ); ?> &rarr;</a>
 
18
  </div>
 
 
 
19
 
20
- <iframe width="419" height="265" src="//www.youtube.com/embed/fHFcH4bCzmU?rel=0&showinfo=0&autoplay=0&wmode=transparent&theme=light" frameborder="0" allowfullscreen></iframe>
21
- </div>
1
+ <div class="pro-version progress-overlay-container">
2
  <div class="pro-version-content">
3
+ <h1><?php _e( 'Seen the PRO version yet?', 'wp-migrate-db' ); ?></h1>
4
  <ul>
5
+ <li><span class="dashicons dashicons-yes"></span><?php _e( 'One-click in your WordPress dashboard to push your database up to staging/production or pull it down to&nbsp;dev', 'wp-migrate-db' ); ?></li>
6
+ <li><span class="dashicons dashicons-yes"></span><?php _e( 'Sync the Media Libraries of two&nbsp;sites', 'wp-migrate-db' ); ?></li>
7
+ <li><span class="dashicons dashicons-yes"></span><?php _e( 'Run migrations from the command&nbsp;line', 'wp-migrate-db' ); ?></li>
8
  </ul>
9
 
10
+ <div class="pro-quote">
11
+ <p class="pro-quote-author">
12
+ MortenRandHendriksen @mor10
13
+ <a href="https://twitter.com/mor10/status/568514947241488384" title="View on Twitter.com" target="_blank" class="dashicons dashicons-twitter" ></a>
14
+ </p>
15
+ <p>&#8220;<?php _e( 'Even though I\'ve been using it for a long time the push/pull functionality in @dliciousbrains WP&nbsp;Migrate&nbsp;DB&nbsp;Pro continues to impress me.', 'wp-migrate-db' ); ?> &#8221;</p>
16
+ <div class="stars"><span class="dashicons dashicons-star-filled"></span><span class="dashicons dashicons-star-filled"></span><span class="dashicons dashicons-star-filled"></span><span class="dashicons dashicons-star-filled"></span><span class="dashicons dashicons-star-filled"></span></div>
17
+ </div>
18
+ </div>
19
 
20
+ <div class="iframe">
21
+ <iframe width="515" height="289" src="//www.youtube.com/embed/fHFcH4bCzmU?rel=0&showinfo=0&autoplay=0&wmode=transparent&theme=light" frameborder="0" allowfullscreen></iframe>
22
  </div>
23
+
24
+ <a class="button" href="https://deliciousbrains.com/wp-migrate-db-pro/?utm_source=insideplugin&utm_medium=web&utm_content=progress-bar&utm_campaign=freeplugin" target="_blank"><?php _e( 'More About The Pro Version', 'wp-migrate-db' ); ?> &rarr;</a>
25
+ <span class="close-pro-version close-pro-version-button" >×</span>
26
 
27
+ </div>
 
template/wpmdb/sidebar.php CHANGED
@@ -1,6 +1,6 @@
1
  <div id="wpmdb-sidebar">
2
 
3
- <a class="wpmdb-banner" target="_blank" href="https://deliciousbrains.com/wp-migrate-db-pro/?utm_source=insideplugin&utm_medium=web&utm_content=sidebar&utm_campaign=freeplugin"><img src="<?php echo plugins_url( 'asset/img/wp-migrate-db-pro.jpg', $this->plugin_file_path ); ?>" width="292" height="292" alt="<?php _e( 'WP Migrate DB Pro &mdash; Push and pull your database from one WordPress install to another in 1-click.', 'wp-migrate-db' ); ?>" /></a>
4
 
5
  <form method="post" action="https://deliciousbrains.com/email-subscribe/" target="_blank" class="subscribe block">
6
  <h2><?php _e( 'Get 20% Off!', 'wp-migrate-db' ); ?></h2>
1
  <div id="wpmdb-sidebar">
2
 
3
+ <a class="wpmdb-banner" target="_blank" href="https://deliciousbrains.com/wp-migrate-db-pro/?utm_source=insideplugin&utm_medium=web&utm_content=sidebar&utm_campaign=freeplugin"><img src="<?php echo plugins_url( 'asset/dist/img/wp-migrate-db-pro.jpg', $this->plugin_file_path ); ?>" width="292" height="292" alt="<?php _e( 'WP Migrate DB Pro &mdash; Push and pull your database from one WordPress install to another in 1-click.', 'wp-migrate-db' ); ?>" /></a>
4
 
5
  <form method="post" action="https://deliciousbrains.com/email-subscribe/" target="_blank" class="subscribe block">
6
  <h2><?php _e( 'Get 20% Off!', 'wp-migrate-db' ); ?></h2>
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.7.2
8
  Author URI: http://deliciousbrains.com
9
  Network: True
10
  Text Domain: wp-migrate-db
@@ -22,7 +22,7 @@ Domain Path: /languages/
22
  // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
23
  // **********************************************************************
24
 
25
- $GLOBALS['wpmdb_meta']['wp-migrate-db']['version'] = '0.7.2';
26
 
27
  if ( ! class_exists( 'WPMDB_Utils' ) ) {
28
  require dirname( __FILE__ ) . '/class/wpmdb-utils.php';
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
  // 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';