Version Description
2015-06-12 =
New: WP-CLI export subcommand
New: Quick copy find textbox value to replace textbox by clicking arrow icon in between (hat tip Jonathan Perlman)
New: Added filters to hook into find & replace routine and deal with encoded data (example)
Improvement: Greatly reduced data passed through each HTTP request for better security and reliability
Improvement: Massive overhaul of input sanitization for better security
Improvement: Add
_mig_
prefix to wpmdb_alter_statements tableImprovement: Cleanup wpmdb_alter_statements tables from failed migrations
Improvement: Show dimmed remove icons in find & replace rows to indicate they can be removed
Improvement: Dim remove icons next to saved profiles
Improvement: Better error message when empty response received from remote server
Improvement: Added diagnostic info to facilitate debugging and decrease time to resolution for support requests
Improvement: Warning notice when
WP_HTTP_BLOCK_EXTERNAL
constant is set to trueImprovement: Leave it to WordPress core to convert tables to utf8mb4
Improvement: Workaround to fix issues with Siteground's staging environments
Bug fix: Connection URL with space(s) in beginning failing
Bug fix: Cancelling a gzipped Export does not remove file
Bug fix: Unusual table names causing regular expressions to fail
Bug fix: Preserving options not working when default subsite is not 1
Bug fix: NAN% shown at beginning of a migration
Bug fix: Migration progress bar is overflowing the scale, passing 100%
Bug fix: Custom post type links broken after migration with Compatibility Mode enabled
Bug fix: Saving a new profile does not change the URL to that saved profile URL
Release Info
Developer | bradt |
Plugin | WP Migrate DB |
Version | 0.7 |
Comparing to | |
See all releases |
Code changes from version 0.6.1 to 0.7
- asset/css/plugin-manager-styles.css +1 -0
- asset/css/plugin-update-styles.css +1 -0
- asset/css/styles.css +1 -1
- asset/img/icon-multisite-tools.svg +28 -0
- asset/js/common.js +38 -12
- asset/js/common.min.js +1 -1
- asset/js/hook.js +17 -16
- asset/js/hook.min.js +1 -1
- asset/js/script.js +1782 -1495
- asset/js/script.min.js +2 -2
- class/wpmdb-base.php +487 -167
- class/wpmdb-cli.php +508 -0
- class/wpmdb-command.php +226 -0
- class/wpmdb-migration-state.php +299 -0
- class/wpmdb-replace.php +71 -27
- class/wpmdb-sanitize.php +158 -0
- class/wpmdb.php +769 -402
- compatibility/wp-migrate-db-pro-compatibility.php +62 -17
- languages/wp-migrate-db-en.pot +790 -335
- readme.txt +28 -3
- template/common/compatibility.php +2 -2
- template/common/max-request-size.php +1 -1
- template/migrate-progress.php +1 -0
- template/migrate.php +14 -12
- template/settings.php +1 -1
- template/wpmdb/progress-upgrade.php +1 -1
- template/wpmdb/sidebar.php +13 -6
- template/wpmdb/wordpress-org-support.php +2 -2
- wp-migrate-db.php +35 -2
@@ -0,0 +1 @@
|
|
|
1 |
+
.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}
|
@@ -0,0 +1 @@
|
|
|
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}
|
@@ -1 +1 @@
|
|
1 |
-
#wpmdb-main{width:742px;position:relative;min-height:950px}#overlay{background-color:rgba(255,255,255,0.9)}.wpmdb .updated{clear:both}.wpmdb div.updated.warning{max-width:742px;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;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{-moz-transform:scale(1) rotate(-90deg) translateX(0px) translateY(0px) skewX(0deg) skewY(0deg);-webkit-transform:scale(1) rotate(-90deg) translateX(0px) translateY(0px) skewX(0deg) skewY(0deg);-o-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:none;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 .ajax-spinner{top:2px}.wpmdb .help-tab .video-viewer{margin-bottom:30px}.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}.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;-webkit-border-radius:64px;-moz-border-radius:64px;-ms-border-radius:64px;-o-border-radius: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;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;color:#fff;margin-bottom: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}.wpmdb .addons-tab .addon p{font-size:16px;line-height:1.2em;clear:both;padding-top:15px;margin:0}.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:#e6db74}.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 p a{text-decoration:underline;color:#e6db74}.wpmdb .addons-tab .addon.wp-migrate-db-pro-cli p a:hover{color:#eee69f}.wpmdb .addons-tab .addon.wp-migrate-db-pro-cli code{color:#66d9ef;white-space:nowrap;margin:0;padding:0}.wpmdb .addons-tab .addon.wp-migrate-db-pro-cli code .var{color:#f92772}.wpmdb .addons-tab .addon.wp-migrate-db-pro-cli code .bracket{color:#fff}.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:scroll;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%;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;box-sizing:border-box;max-height:100%;overflow-y:auto}.progress-content .progress-bar{height:10px;background-color:#8cc1e9;margin-bottom:5px;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:-moz-linear-gradient(bottom, #72a7cf,#8cc1e9);background-image:-o-linear-gradient(bottom, #72a7cf,#8cc1e9);background-image:linear-gradient(bottom, #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{-moz-box-sizing:border-box;-webkit-box-sizing:border-box;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;-moz-transition:opacity 200ms ease-in-out;-ms-transition:opacity 200ms ease-in-out;-o-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), (-o-min-device-pixel-ratio: 2.6 / 2), (-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 h2{float:left}body.mp6 .wpmdb .content-tab{padding-top:20px}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}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 .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 .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}
|
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;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;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{-moz-transform:scale(1) rotate(-90deg) translateX(0px) translateY(0px) skewX(0deg) skewY(0deg);-webkit-transform:scale(1) rotate(-90deg) translateX(0px) translateY(0px) skewX(0deg) skewY(0deg);-o-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;-webkit-border-radius:64px;-moz-border-radius:64px;-ms-border-radius:64px;-o-border-radius: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;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;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}.wpmdb .addons-tab .addon p{font-size:16px;line-height:1.2em;clear:both;padding-top:15px;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%;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;box-sizing:border-box;max-height:100%;overflow-y:auto}.progress-content .progress-bar{height:10px;background-color:#8cc1e9;margin-bottom:5px;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:-moz-linear-gradient(bottom, #72a7cf,#8cc1e9);background-image:-o-linear-gradient(bottom, #72a7cf,#8cc1e9);background-image:linear-gradient(bottom, #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{-moz-box-sizing:border-box;-webkit-box-sizing:border-box;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;-moz-transition:opacity 200ms ease-in-out;-ms-transition:opacity 200ms ease-in-out;-o-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), (-o-min-device-pixel-ratio: 2.6 / 2), (-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 h2{float:left}body.mp6 .wpmdb .content-tab{padding-top:20px}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}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 .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}
|
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="utf-8"?>
|
2 |
+
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
3 |
+
<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"
|
4 |
+
width="14em" height="15em" viewBox="64.684 51 382.628 410" enable-background="new 64.684 51 382.628 410"
|
5 |
+
xml:space="preserve">
|
6 |
+
<path id="network-6-icon" fill="#ffffff" d="M225.741,122.262c-10.096-4.89-19.027-8.84-27.496-12.287C211.636,74.43,230.974,51,256.001,51
|
7 |
+
c24.381,0,43.363,22.232,56.707,56.239c-8.562,3.61-17.354,7.632-27.344,12.62C275.139,93.088,263.473,81,256.001,81
|
8 |
+
C248.31,81,236.177,93.811,225.741,122.262z M256.001,431c-7.471,0-19.135-12.088-29.361-38.859
|
9 |
+
c-10.084,5.035-18.803,9.016-27.346,12.62C212.64,438.767,231.62,461,256.001,461c25.028,0,44.365-23.43,57.758-58.974
|
10 |
+
c-8.438-3.437-17.34-7.367-27.495-12.288C275.827,418.19,263.691,431,256.001,431z M174.112,393.154
|
11 |
+
c-33.35,12.045-83.111,23.779-102.887-5.42c-9.77-14.428-13.416-42.164,24.695-92.377c10.111-13.321,21.816-26.407,33.689-38.418
|
12 |
+
c26.635-26.545,56.641-52.097,95.738-78.553c-18.822-10.192-39.367-19.936-59.412-27.187c-20.52-7.424-38.586-11.535-52.428-11.535
|
13 |
+
c-8.842,0-15.404,1.843-17.553,4.93c-2.285,3.281-2.398,13.373,7.744,31.476c1.201-0.132,2.418-0.206,3.652-0.206
|
14 |
+
c18.225,0,33,14.775,33,33c0,18.227-14.775,33-33,33s-33-14.773-33-33c0-5.902,1.559-11.439,4.273-16.233
|
15 |
+
c-19.311-33.481-15.328-53.631-7.291-65.177c5.648-8.115,17.551-17.789,42.174-17.789c43.723,0,102.635,28.356,140.564,50.322
|
16 |
+
C292.58,136.708,353.492,106,398.49,106c24.723,0,36.639,9.932,42.281,18.264c9.77,14.428,13.416,42.164-24.693,92.377
|
17 |
+
C362.44,287.316,255.792,363.652,174.112,393.154z M392.185,198.504c26.183-34.497,26.984-52.643,23.75-57.418
|
18 |
+
c-2.188-3.232-8.545-5.086-17.44-5.086c-33.951,0-85.664,24.93-115.436,41.803c21.981,14.287,42.518,29.346,61.239,44.701
|
19 |
+
c-7.084,7.058-14.51,13.981-22.102,20.68c-20.783-16.807-43.886-33.264-67.833-48.011c-27.5,17.708-55.186,38.509-80.055,60.672
|
20 |
+
c18.705,16.243,40.973,33.295,64.725,49.076c-9.086,5.654-18.26,11.073-28.729,16.744c-0.004-0.003-0.006-0.005-0.01-0.007
|
21 |
+
c-0.078-0.055-0.154-0.109-0.232-0.164c-19.885-13.854-39.51-29.055-57.662-44.965c-49.02,49.168-62.828,84.795-56.336,94.383
|
22 |
+
c2.189,3.232,8.549,5.088,17.443,5.088c40.871,0,105.748-34.459,144.129-59.173C304.759,286.484,358.495,242.895,392.185,198.504z
|
23 |
+
M433.524,319.63c2.44-4.604,3.829-9.854,3.829-15.432c0-18.226-14.774-33-33-33c-18.225,0-33,14.774-33,33
|
24 |
+
c0,18.227,14.775,33,33,33c1.521,0,3.017-0.112,4.48-0.312c9.611,17.505,9.453,27.296,7.209,30.519
|
25 |
+
c-2.148,3.087-8.709,4.93-17.551,4.93c-27.856,0-66.664-16.141-91.65-28.324c-8.357,5.84-18.73,12.77-28.846,19.122
|
26 |
+
c33.494,17.718,82.752,39.202,120.496,39.202c24.621,0,36.522-9.674,42.172-17.788C448.683,373.029,452.663,352.955,433.524,319.63z
|
27 |
+
"/>
|
28 |
+
</svg>
|
@@ -6,8 +6,33 @@ var migration_error = false;
|
|
6 |
var connection_data;
|
7 |
var next_step_in_migration;
|
8 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
9 |
function wpmdb_call_next_hook() {
|
10 |
-
if( !
|
11 |
call_stack = hooks;
|
12 |
}
|
13 |
|
@@ -18,21 +43,22 @@ function wpmdb_call_next_hook() {
|
|
18 |
|
19 |
function wpmdb_add_commas( number_string ) {
|
20 |
number_string += '';
|
21 |
-
x = number_string.split('.');
|
22 |
-
x1 = x[0];
|
23 |
-
x2 = x.length > 1 ? '.' + x[1] : '';
|
24 |
var rgx = /(\d+)(\d{3})/;
|
25 |
-
while (rgx.test(x1)) {
|
26 |
-
x1 = x1.replace(rgx, '$1' + ',' + '$2');
|
27 |
}
|
28 |
return x1 + x2;
|
29 |
}
|
30 |
|
31 |
function wpmdb_parse_json( maybe_json ) {
|
|
|
32 |
try {
|
33 |
-
|
34 |
}
|
35 |
-
catch(e){
|
36 |
// we simply return false here because the json data itself will never just contain a value of "false"
|
37 |
return false;
|
38 |
}
|
@@ -70,13 +96,13 @@ function wpmdbGetAjaxErrors( title, code, text, jqXHR ) {
|
|
70 |
}
|
71 |
|
72 |
// Only add extra error details if not php errors (#144) and jqXHR has been provided
|
73 |
-
if ( !
|
74 |
html += wpmdb_strings.status + ': ' + jqXHR.status + ' ' + jqXHR.statusText;
|
75 |
html += '<br /><br />' + wpmdb_strings.response + ':<br />';
|
76 |
}
|
77 |
|
78 |
// Add code to the end of the error text if not json errors
|
79 |
-
if ( !
|
80 |
text += ' ' + code;
|
81 |
}
|
82 |
|
@@ -86,6 +112,6 @@ function wpmdbGetAjaxErrors( title, code, text, jqXHR ) {
|
|
86 |
return html;
|
87 |
}
|
88 |
|
89 |
-
(function($) {
|
90 |
// jQuery code here
|
91 |
-
})(jQuery);
|
6 |
var connection_data;
|
7 |
var next_step_in_migration;
|
8 |
|
9 |
+
/**
|
10 |
+
* Toggle proper translated strings based on migration type selected.
|
11 |
+
*
|
12 |
+
* To show the properly translated strings for the selected push or pull
|
13 |
+
* migration type, we need to hide all strings then show the right
|
14 |
+
* translated strings based on the migration type selected.
|
15 |
+
*
|
16 |
+
* @see https://github.com/deliciousbrains/wp-migrate-db-pro/issues/764
|
17 |
+
*
|
18 |
+
* @return void
|
19 |
+
*/
|
20 |
+
function wpmdb_toggle_migration_action_text() {
|
21 |
+
jQuery( '.action-text' ).hide();
|
22 |
+
jQuery( '.action-text.' + jQuery( 'input[name=action]:checked' ).val() ).show();
|
23 |
+
}
|
24 |
+
|
25 |
+
/**
|
26 |
+
* Return the currently selected migration type selected.
|
27 |
+
*
|
28 |
+
* @return string Will return `push`, `pull`, or `savefile` for exporting as a file.
|
29 |
+
*/
|
30 |
+
function wpmdb_migration_type() {
|
31 |
+
return jQuery( 'input[name=action]:checked' ).val();
|
32 |
+
}
|
33 |
+
|
34 |
function wpmdb_call_next_hook() {
|
35 |
+
if ( !call_stack.length ) {
|
36 |
call_stack = hooks;
|
37 |
}
|
38 |
|
43 |
|
44 |
function wpmdb_add_commas( number_string ) {
|
45 |
number_string += '';
|
46 |
+
var x = number_string.split( '.' );
|
47 |
+
var x1 = x[0];
|
48 |
+
var x2 = x.length > 1 ? '.' + x[1] : '';
|
49 |
var rgx = /(\d+)(\d{3})/;
|
50 |
+
while ( rgx.test( x1 ) ) {
|
51 |
+
x1 = x1.replace( rgx, '$1' + ',' + '$2' );
|
52 |
}
|
53 |
return x1 + x2;
|
54 |
}
|
55 |
|
56 |
function wpmdb_parse_json( maybe_json ) {
|
57 |
+
var json_object = {};
|
58 |
try {
|
59 |
+
json_object = jQuery.parseJSON( maybe_json );
|
60 |
}
|
61 |
+
catch ( e ) {
|
62 |
// we simply return false here because the json data itself will never just contain a value of "false"
|
63 |
return false;
|
64 |
}
|
96 |
}
|
97 |
|
98 |
// Only add extra error details if not php errors (#144) and jqXHR has been provided
|
99 |
+
if ( !jsonErrors && jqXHR !== undefined ) {
|
100 |
html += wpmdb_strings.status + ': ' + jqXHR.status + ' ' + jqXHR.statusText;
|
101 |
html += '<br /><br />' + wpmdb_strings.response + ':<br />';
|
102 |
}
|
103 |
|
104 |
// Add code to the end of the error text if not json errors
|
105 |
+
if ( !jsonErrors ) {
|
106 |
text += ' ' + code;
|
107 |
}
|
108 |
|
112 |
return html;
|
113 |
}
|
114 |
|
115 |
+
(function( $ ) {
|
116 |
// jQuery code here
|
117 |
+
})( jQuery );
|
@@ -1 +1 @@
|
|
1 |
-
function wpmdb_call_next_hook(){call_stack.length||(call_stack=hooks);var a=call_stack[0];call_stack.shift(),window[a]()}function wpmdb_add_commas(a){a+=""
|
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(){call_stack.length||(call_stack=hooks);var a=call_stack[0];call_stack.shift(),window[a]()}function wpmdb_add_commas(a){a+="";for(var b=a.split("."),c=b[0],d=b.length>1?"."+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||void 0!==d)&&(f+="<strong>"+a+"</strong> — "),e||void 0===d||(f+=wpmdb_strings.status+": "+d.status+" "+d.statusText,f+="<br /><br />"+wpmdb_strings.response+":<br />"),e||(c+=" "+b),f+=c}var hooks=[],call_stack=[],non_fatal_errors="",migration_error=!1,connection_data,next_step_in_migration;!function(){}(jQuery);
|
@@ -1,4 +1,4 @@
|
|
1 |
-
(function($) {
|
2 |
|
3 |
$.wpmdb = {
|
4 |
/**
|
@@ -25,39 +25,40 @@
|
|
25 |
jQuery.wpmdb.remove_hook( 'filter', action, tag );
|
26 |
},
|
27 |
add_hook: function( hook_type, action, callable, tag ) {
|
28 |
-
if ( undefined
|
29 |
jQuery.wpmdb.hooks[hook_type][action] = [];
|
30 |
}
|
31 |
var hooks = jQuery.wpmdb.hooks[hook_type][action];
|
32 |
-
if ( undefined
|
33 |
tag = action + '_' + hooks.length;
|
34 |
}
|
35 |
-
jQuery.wpmdb.hooks[hook_type][action].push( { tag:tag, callable:callable } );
|
36 |
},
|
37 |
do_hook: function( hook_type, action, value, args ) {
|
38 |
-
if ( undefined
|
39 |
var hooks = jQuery.wpmdb.hooks[hook_type][action];
|
40 |
-
for( var i=0; i<hooks.length; i++) {
|
41 |
-
if ( 'action'
|
42 |
-
hooks[i].callable(args);
|
43 |
} else {
|
44 |
-
value = hooks[i].callable(value, args);
|
45 |
}
|
46 |
}
|
47 |
}
|
48 |
-
if ( 'filter'
|
49 |
return value;
|
50 |
}
|
51 |
},
|
52 |
remove_hook: function( hook_type, action, tag ) {
|
53 |
-
if ( undefined
|
54 |
var hooks = jQuery.wpmdb.hooks[hook_type][action];
|
55 |
-
for( var i=hooks.length-1; i>=0; i--) {
|
56 |
-
if (undefined
|
57 |
-
hooks.splice(i,1);
|
58 |
}
|
|
|
59 |
}
|
60 |
}
|
61 |
-
}
|
62 |
|
63 |
-
})(jQuery);
|
1 |
+
(function( $ ) {
|
2 |
|
3 |
$.wpmdb = {
|
4 |
/**
|
25 |
jQuery.wpmdb.remove_hook( 'filter', action, tag );
|
26 |
},
|
27 |
add_hook: function( hook_type, action, callable, tag ) {
|
28 |
+
if ( undefined === jQuery.wpmdb.hooks[hook_type][action] ) {
|
29 |
jQuery.wpmdb.hooks[hook_type][action] = [];
|
30 |
}
|
31 |
var hooks = jQuery.wpmdb.hooks[hook_type][action];
|
32 |
+
if ( undefined === tag ) {
|
33 |
tag = action + '_' + hooks.length;
|
34 |
}
|
35 |
+
jQuery.wpmdb.hooks[hook_type][action].push( { tag: tag, callable: callable } );
|
36 |
},
|
37 |
do_hook: function( hook_type, action, value, args ) {
|
38 |
+
if ( undefined !== jQuery.wpmdb.hooks[hook_type][action] ) {
|
39 |
var hooks = jQuery.wpmdb.hooks[hook_type][action];
|
40 |
+
for ( var i = 0; i < hooks.length; i++ ) {
|
41 |
+
if ( 'action' === hook_type ) {
|
42 |
+
hooks[i].callable( args );
|
43 |
} else {
|
44 |
+
value = hooks[i].callable( value, args );
|
45 |
}
|
46 |
}
|
47 |
}
|
48 |
+
if ( 'filter' === hook_type ) {
|
49 |
return value;
|
50 |
}
|
51 |
},
|
52 |
remove_hook: function( hook_type, action, tag ) {
|
53 |
+
if ( undefined !== jQuery.wpmdb.hooks[hook_type][action] ) {
|
54 |
var hooks = jQuery.wpmdb.hooks[hook_type][action];
|
55 |
+
for ( var i = hooks.length - 1; i >= 0; i-- ) {
|
56 |
+
if ( undefined === tag || tag === hooks[i].tag ) {
|
57 |
+
hooks.splice( i, 1 );
|
58 |
}
|
59 |
+
}
|
60 |
}
|
61 |
}
|
62 |
+
};
|
63 |
|
64 |
+
})( jQuery );
|
@@ -1 +1 @@
|
|
1 |
-
!function(a){a.wpmdb={hooks:{action:{},filter:{}},add_action:function(a,b,c){jQuery.wpmdb.add_hook("action",a,b,c)},add_filter:function(a,b,c){jQuery.wpmdb.add_hook("filter",a,b,c)},do_action:function(a,b){jQuery.wpmdb.do_hook("action",a,null,b)},apply_filters:function(a,b,c){return jQuery.wpmdb.do_hook("filter",a,b,c)},remove_action:function(a,b){jQuery.wpmdb.remove_hook("action",a,b)},remove_filter:function(a,b){jQuery.wpmdb.remove_hook("filter",a,b)},add_hook:function(a,b,c,d){void 0
|
1 |
+
!function(a){a.wpmdb={hooks:{action:{},filter:{}},add_action:function(a,b,c){jQuery.wpmdb.add_hook("action",a,b,c)},add_filter:function(a,b,c){jQuery.wpmdb.add_hook("filter",a,b,c)},do_action:function(a,b){jQuery.wpmdb.do_hook("action",a,null,b)},apply_filters:function(a,b,c){return jQuery.wpmdb.do_hook("filter",a,b,c)},remove_action:function(a,b){jQuery.wpmdb.remove_hook("action",a,b)},remove_filter:function(a,b){jQuery.wpmdb.remove_hook("filter",a,b)},add_hook:function(a,b,c,d){void 0===jQuery.wpmdb.hooks[a][b]&&(jQuery.wpmdb.hooks[a][b]=[]);var e=jQuery.wpmdb.hooks[a][b];void 0===d&&(d=b+"_"+e.length),jQuery.wpmdb.hooks[a][b].push({tag:d,callable:c})},do_hook:function(a,b,c,d){if(void 0!==jQuery.wpmdb.hooks[a][b])for(var e=jQuery.wpmdb.hooks[a][b],f=0;f<e.length;f++)"action"===a?e[f].callable(d):c=e[f].callable(c,d);return"filter"===a?c:void 0},remove_hook:function(a,b,c){if(void 0!==jQuery.wpmdb.hooks[a][b])for(var d=jQuery.wpmdb.hooks[a][b],e=d.length-1;e>=0;e--)(void 0===c||c===d[e].tag)&&d.splice(e,1)}}}(jQuery);
|
@@ -3,9 +3,11 @@ var migration_complete;
|
|
3 |
var migration_complete_events;
|
4 |
var migrate_table_recursive;
|
5 |
var execute_next_step;
|
|
|
6 |
|
7 |
-
(function($) {
|
8 |
|
|
|
9 |
var connection_established = false;
|
10 |
var last_replace_switch = '';
|
11 |
var doing_ajax = false;
|
@@ -21,8 +23,7 @@ var execute_next_step;
|
|
21 |
var migration_completed = false;
|
22 |
var currently_migrating = false;
|
23 |
var dump_filename = '';
|
24 |
-
var
|
25 |
-
var db_version = '';
|
26 |
var migration_intent;
|
27 |
var remote_site;
|
28 |
var secret_key;
|
@@ -32,28 +33,31 @@ var execute_next_step;
|
|
32 |
var completed_msg;
|
33 |
var tables_to_migrate = '';
|
34 |
var migration_paused = false;
|
35 |
-
var previous_progress_title;
|
36 |
-
var previous_progress_text;
|
37 |
-
var timer_count;
|
38 |
-
var overall_percent;
|
39 |
var migration_cancelled = false;
|
40 |
-
var
|
41 |
-
var
|
|
|
|
|
|
|
42 |
|
43 |
var admin_url = ajaxurl.replace( '/admin-ajax.php', '' ), spinner_url = admin_url + '/images/spinner';
|
44 |
|
45 |
-
if( window.devicePixelRatio >= 2 ){
|
46 |
spinner_url += '-2x';
|
47 |
}
|
48 |
-
|
49 |
spinner_url += '.gif';
|
|
|
50 |
|
51 |
-
window.onbeforeunload = function
|
52 |
-
if( currently_migrating ){
|
53 |
e = e || window.event;
|
54 |
|
55 |
// For IE and Firefox prior to version 4
|
56 |
-
if (e) {
|
57 |
e.returnValue = wpmdb_strings.sure;
|
58 |
}
|
59 |
|
@@ -62,31 +66,31 @@ var execute_next_step;
|
|
62 |
}
|
63 |
};
|
64 |
|
65 |
-
function pad(n, width, z) {
|
66 |
z = z || '0';
|
67 |
n = n + '';
|
68 |
-
return n.length >= width ? n : new Array(width - n.length + 1).join(z) + n;
|
69 |
}
|
70 |
|
71 |
-
function is_int(n) {
|
72 |
-
n = parseInt(n);
|
73 |
-
return typeof n === 'number' && n % 1
|
74 |
}
|
75 |
|
76 |
function setup_counter() {
|
77 |
-
timer_count = 0
|
78 |
-
counter_display = $('.timer')
|
79 |
-
|
80 |
|
81 |
-
elapsed_interval = setInterval(count,1000);
|
82 |
}
|
83 |
|
84 |
function display_count() {
|
85 |
-
hours = Math.floor( timer_count / 3600 ) % 24;
|
86 |
-
minutes = Math.floor( timer_count / 60 ) % 60;
|
87 |
-
seconds = timer_count % 60;
|
88 |
-
var display =
|
89 |
-
counter_display.html(display);
|
90 |
}
|
91 |
|
92 |
function count() {
|
@@ -94,35 +98,35 @@ var execute_next_step;
|
|
94 |
display_count();
|
95 |
}
|
96 |
|
97 |
-
function get_intersect(arr1, arr2) {
|
98 |
var r = [], o = {}, l = arr2.length, i, v;
|
99 |
-
for (i = 0; i < l; i++) {
|
100 |
-
o[arr2[i]] = true;
|
101 |
}
|
102 |
l = arr1.length;
|
103 |
-
for (i = 0; i < l; i++) {
|
104 |
-
v = arr1[i];
|
105 |
-
if (v in o) {
|
106 |
-
r.push(v);
|
107 |
}
|
108 |
}
|
109 |
return r;
|
110 |
}
|
111 |
|
112 |
-
function get_query_var( name ){
|
113 |
-
name = name.replace(/[\[]/, "
|
114 |
-
var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"),
|
115 |
-
results = regex.exec(location.search);
|
116 |
-
return results
|
117 |
}
|
118 |
|
119 |
function maybe_show_ssl_warning( url, key, remote_scheme ) {
|
120 |
-
var scheme = url.substr(0, url.indexOf(':'));
|
121 |
-
if( remote_scheme
|
122 |
-
$('.ssl-notice').show();
|
123 |
show_ssl_notice = true;
|
124 |
-
url = url.replace('https','http');
|
125 |
-
$('.pull-push-connection-info').val( url + "\n" + key );
|
126 |
return;
|
127 |
}
|
128 |
show_ssl_notice = false;
|
@@ -130,34 +134,34 @@ var execute_next_step;
|
|
130 |
}
|
131 |
|
132 |
function maybe_show_prefix_notice( prefix ) {
|
133 |
-
if( prefix
|
134 |
-
$('.remote-prefix').html( prefix );
|
135 |
show_prefix_notice = true;
|
136 |
-
if(
|
137 |
-
$('.prefix-notice.pull').show();
|
138 |
}
|
139 |
else {
|
140 |
-
$('.prefix-notice.push').show();
|
141 |
}
|
142 |
}
|
143 |
}
|
144 |
|
145 |
function maybe_show_mixed_cased_table_name_warning() {
|
146 |
-
if ( 'undefined'
|
147 |
return;
|
148 |
}
|
149 |
|
150 |
-
var migration_intent =
|
151 |
var table_intent = $( 'input[name=table_migrate_option]:checked' ).val();
|
152 |
var tables_to_migrate;
|
153 |
|
154 |
$( '.mixed-case-table-name-notice' ).hide();
|
155 |
|
156 |
-
if ( 'migrate_select'
|
157 |
tables_to_migrate = $( '#select-tables' ).val();
|
158 |
} else {
|
159 |
-
if ( 'push'
|
160 |
-
tables_to_migrate =
|
161 |
} else {
|
162 |
tables_to_migrate = connection_data.prefixed_tables;
|
163 |
}
|
@@ -170,7 +174,7 @@ var execute_next_step;
|
|
170 |
tables_to_migrate = tables_to_migrate.join( '' );
|
171 |
|
172 |
// The table names are all lowercase, no need to display the warning.
|
173 |
-
if ( tables_to_migrate
|
174 |
return;
|
175 |
}
|
176 |
|
@@ -178,7 +182,7 @@ var execute_next_step;
|
|
178 |
* Do not display the warning if the remote lower_case_table_names does not equal "1" (i.e the only problematic setting)
|
179 |
* Applies to push/export migrations.
|
180 |
*/
|
181 |
-
if ( '1'
|
182 |
return;
|
183 |
}
|
184 |
|
@@ -186,7 +190,7 @@ var execute_next_step;
|
|
186 |
* Do not display the warning if the local lower_case_table_names does not equal "1" (i.e the only problematic setting)
|
187 |
* Only applies to pull migrations.
|
188 |
*/
|
189 |
-
if ( '1'
|
190 |
return;
|
191 |
}
|
192 |
|
@@ -197,23 +201,23 @@ var execute_next_step;
|
|
197 |
* 3. The source database table containing the uppercase letter will be converted to lowercase during the migration.
|
198 |
*/
|
199 |
|
200 |
-
if ( 'push'
|
201 |
$( '.mixed-case-table-name-notice.push' ).show();
|
202 |
} else {
|
203 |
$( '.mixed-case-table-name-notice.pull' ).show();
|
204 |
}
|
205 |
}
|
206 |
|
207 |
-
function get_domain_name( url ){
|
208 |
var temp_url = url;
|
209 |
-
var domain = temp_url.replace( /\/\/(.*)@/, '//' ).replace('http://','').replace('https://','').replace('www.','');
|
210 |
return domain;
|
211 |
}
|
212 |
|
213 |
-
function get_migration_status_label( url, intent, stage ){
|
214 |
-
var domain = get_domain_name(url);
|
215 |
var migrating_stage_label, completed_stage_label;
|
216 |
-
if ( intent
|
217 |
migrating_stage_label = wpmdb_strings.pull_migration_label_migrating;
|
218 |
completed_stage_label = wpmdb_strings.pull_migration_label_completed;
|
219 |
} else {
|
@@ -224,7 +228,7 @@ var execute_next_step;
|
|
224 |
migrating_stage_label = migrating_stage_label.replace( '%s', domain );
|
225 |
completed_stage_label = completed_stage_label.replace( '%s', domain );
|
226 |
|
227 |
-
if ( 'migrating'
|
228 |
return migrating_stage_label;
|
229 |
} else {
|
230 |
return completed_stage_label;
|
@@ -232,32 +236,86 @@ var execute_next_step;
|
|
232 |
}
|
233 |
|
234 |
function remove_protocol( url ) {
|
235 |
-
return url.replace(/^https?:/i, "");
|
236 |
}
|
237 |
|
238 |
function disable_export_type_controls() {
|
239 |
-
$('.option-group').each(function(index){
|
240 |
-
$('input', this).attr('disabled','disabled');
|
241 |
-
$('label', this).css('cursor','default');
|
242 |
-
});
|
243 |
}
|
244 |
|
245 |
function enable_export_type_controls() {
|
246 |
-
$('.option-group').each(function(index){
|
247 |
-
$('input', this).removeAttr('disabled');
|
248 |
-
$('label', this).css('cursor','pointer');
|
249 |
-
});
|
|
|
|
|
|
|
|
|
|
|
250 |
}
|
251 |
|
252 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
253 |
|
254 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
255 |
var install = '1';
|
256 |
-
if ( $(this).is(':checked') ) {
|
257 |
var answer = confirm( wpmdb_strings.mu_plugin_confirmation );
|
258 |
|
259 |
-
if( ! answer ){
|
260 |
-
$(this).prop('checked',false);
|
261 |
return;
|
262 |
}
|
263 |
}
|
@@ -265,230 +323,384 @@ var execute_next_step;
|
|
265 |
install = '0';
|
266 |
}
|
267 |
|
268 |
-
$('.plugin-compatibility-wrap').toggle();
|
269 |
|
270 |
-
$(this).parent().append(
|
271 |
-
$('#plugin-compatibility').attr('disabled','disabled');
|
272 |
-
$('.plugin-compatibility').addClass('disabled');
|
273 |
|
274 |
-
$.ajax({
|
275 |
-
url:
|
276 |
-
type:
|
277 |
-
dataType:
|
278 |
-
cache:
|
279 |
data: {
|
280 |
-
action
|
281 |
-
install
|
282 |
},
|
283 |
-
error: function(jqXHR, textStatus, errorThrown){
|
284 |
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 );
|
285 |
-
$('.ajax-spinner').remove();
|
286 |
-
$('#plugin-compatibility').removeAttr('disabled');
|
287 |
-
$('.plugin-compatibility').removeClass('disabled');
|
288 |
},
|
289 |
-
success: function(data){
|
290 |
-
if( ''
|
291 |
alert( data );
|
292 |
}
|
293 |
else {
|
294 |
-
$('.plugin-compatibility').append('<span class="ajax-success-msg">' + wpmdb_strings.saved + '</span>');
|
295 |
-
$('.ajax-success-msg').fadeOut(2000,function(){
|
296 |
-
$(this).remove();
|
297 |
-
});
|
298 |
}
|
299 |
-
$('.ajax-spinner').remove();
|
300 |
-
$('#plugin-compatibility').removeAttr('disabled');
|
301 |
-
$('.plugin-compatibility').removeClass('disabled');
|
302 |
}
|
303 |
-
});
|
304 |
|
305 |
-
});
|
306 |
|
307 |
-
if ( $('#plugin-compatibility').is(':checked') ){
|
308 |
-
$('.plugin-compatibility-wrap').show();
|
309 |
}
|
310 |
|
311 |
-
if ( navigator.userAgent.indexOf('MSIE') > 0 || navigator.userAgent.indexOf('Trident') > 0 ) {
|
312 |
-
$('.ie-warning').show();
|
313 |
}
|
314 |
|
315 |
-
if ( 0
|
316 |
-
$('#savefile').prop("checked", true);
|
317 |
}
|
318 |
-
|
319 |
-
$('.slider')
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
|
|
|
|
|
|
|
|
|
325 |
slide: function( event, ui ) {
|
326 |
-
|
327 |
},
|
328 |
-
|
329 |
-
$('.amount').after( '<img src="' + spinner_url + '" alt="" class="slider-spinner general-spinner" />' );
|
330 |
-
|
331 |
-
|
332 |
-
|
333 |
-
|
334 |
-
|
335 |
-
cache:
|
336 |
data: {
|
337 |
-
action
|
338 |
-
max_request_size
|
339 |
-
nonce
|
340 |
},
|
341 |
-
error: function(jqXHR, textStatus, errorThrown){
|
342 |
-
|
343 |
-
$('.slider-spinner').remove();
|
344 |
alert( wpmdb_strings.max_request_size_problem );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
345 |
},
|
346 |
-
success: function(
|
347 |
-
|
348 |
-
|
349 |
-
$('.slider-success-msg').show();
|
350 |
-
$('.slider-success-msg').fadeOut(2000,function(){
|
351 |
-
$(this).hide();
|
352 |
-
});
|
|
|
353 |
}
|
354 |
-
});
|
355 |
}
|
356 |
-
});
|
357 |
-
$('.amount').html( wpmdb_add_commas( $('.slider').slider('value') ) + ' kB' );
|
358 |
|
359 |
-
var progress_content_original = $('.progress-content').clone();
|
360 |
-
$('.progress-content').remove();
|
361 |
|
362 |
-
var push_select = $('#select-tables').clone();
|
363 |
-
var pull_select = $('#select-tables').clone();
|
364 |
-
var push_post_type_select = $('#select-post-types').clone();
|
365 |
-
var pull_post_type_select = $('#select-post-types').clone();
|
366 |
-
var push_select_backup = $('#select-backup').clone();
|
367 |
-
var pull_select_backup = $('#select-backup').clone();
|
368 |
|
369 |
-
$('.help-tab .video').each(function() {
|
370 |
-
var $container = $(this),
|
371 |
-
$viewer = $('.video-viewer');
|
372 |
|
373 |
-
$('a', this).click(function(e) {
|
374 |
e.preventDefault();
|
375 |
|
376 |
-
$viewer.attr('src', '//www.youtube.com/embed/' + $container.data('video-id') + '?autoplay=1');
|
377 |
$viewer.show();
|
378 |
var offset = $viewer.offset();
|
379 |
-
$(window).scrollTop(offset.top - 50);
|
380 |
-
});
|
381 |
-
});
|
382 |
-
|
383 |
-
$('.backup-options').show();
|
384 |
-
$('.keep-active-plugins').show();
|
385 |
-
if(
|
386 |
-
$('.backup-options').hide();
|
387 |
-
$('.keep-active-plugins').hide();
|
388 |
}
|
389 |
|
390 |
-
|
391 |
-
|
392 |
-
|
393 |
-
|
394 |
-
|
395 |
-
|
|
|
|
|
|
|
396 |
data: {
|
397 |
-
action
|
398 |
-
licence
|
399 |
-
|
|
|
400 |
},
|
401 |
-
error: function(jqXHR, textStatus, errorThrown){
|
402 |
alert( wpmdb_strings.license_check_problem );
|
403 |
},
|
404 |
-
success: function(data){
|
405 |
-
|
406 |
-
|
407 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
408 |
}
|
409 |
-
else if ( typeof data.errors
|
410 |
-
|
411 |
-
|
412 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
413 |
}
|
414 |
-
$('.support-content').empty().html( msg );
|
415 |
-
$('.addons-content').empty().html( msg );
|
416 |
}
|
417 |
else {
|
418 |
-
|
419 |
-
|
420 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
421 |
}
|
422 |
-
});
|
423 |
}
|
424 |
|
425 |
-
|
426 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
427 |
|
428 |
-
|
429 |
-
|
430 |
-
var connection_info = $.trim( $('.pull-push-connection-info').val() ).split("\n");
|
431 |
-
if( typeof wpmdb_default_profile == 'undefined' || wpmdb_default_profile == true || action == 'savefile' || doing_ajax || ! wpmdb_is_pro ){
|
432 |
-
return;
|
433 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
434 |
|
435 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
436 |
|
437 |
doing_ajax = true;
|
438 |
disable_export_type_controls();
|
439 |
|
440 |
-
$('.connection-status').html( wpmdb_strings.establishing_remote_connection );
|
441 |
-
$('.connection-status').removeClass( 'notification-message error-notice migration-error' );
|
442 |
-
$('.connection-status').append(
|
443 |
|
444 |
-
var intent =
|
445 |
|
446 |
-
$.ajax({
|
447 |
-
url:
|
448 |
-
type:
|
449 |
-
dataType:
|
450 |
-
cache:
|
451 |
data: {
|
452 |
-
action
|
453 |
-
url
|
454 |
-
key
|
455 |
-
intent
|
456 |
-
nonce
|
457 |
-
convert_post_type_selection
|
458 |
-
profile
|
459 |
},
|
460 |
-
error: function(jqXHR, textStatus, errorThrown){
|
461 |
-
$('.connection-status').html( getAjaxErrors( jqXHR.responseText, '(#102)', jqXHR ) );
|
462 |
-
$('.connection-status').addClass( 'notification-message error-notice migration-error' );
|
463 |
-
$('.ajax-spinner').remove();
|
464 |
doing_ajax = false;
|
465 |
enable_export_type_controls();
|
466 |
},
|
467 |
-
success: function(data){
|
468 |
-
$('.ajax-spinner').remove();
|
469 |
doing_ajax = false;
|
470 |
enable_export_type_controls();
|
471 |
|
472 |
-
if( typeof data.wpmdb_error
|
473 |
-
$('.connection-status').html( data.body );
|
474 |
-
$('.connection-status').addClass( 'notification-message error-notice migration-error' );
|
475 |
|
476 |
-
if( data.body.indexOf( '401 Unauthorized' ) > -1 ) {
|
477 |
-
$('.basic-access-auth-wrapper').show();
|
478 |
}
|
479 |
|
480 |
return;
|
481 |
}
|
482 |
|
483 |
-
maybe_show_ssl_warning( connection_info[0], connection_info[1], data.scheme );
|
484 |
maybe_show_prefix_notice( data.prefix );
|
485 |
|
486 |
-
$('.pull-push-connection-info').addClass('temp-disabled');
|
487 |
-
$('.pull-push-connection-info').attr('readonly','readonly');
|
488 |
-
$('.connect-button').hide();
|
489 |
|
490 |
-
$('.connection-status').hide();
|
491 |
-
$('.step-two').show();
|
492 |
connection_established = true;
|
493 |
connection_data = data;
|
494 |
move_connection_info_box();
|
@@ -496,626 +708,606 @@ var execute_next_step;
|
|
496 |
maybe_show_mixed_cased_table_name_warning();
|
497 |
|
498 |
var loaded_tables = '';
|
499 |
-
if( wpmdb_default_profile
|
500 |
loaded_tables = wpmdb_loaded_tables;
|
501 |
}
|
502 |
|
503 |
-
|
504 |
-
$(table_select).attr({
|
505 |
-
multiple : 'multiple',
|
506 |
-
name : 'select_tables[]',
|
507 |
-
id : 'select-tables',
|
508 |
-
class : 'multiselect'
|
509 |
-
});
|
510 |
-
|
511 |
-
$.each(connection_data.tables, function(index, value) {
|
512 |
-
var selected = $.inArray( value, loaded_tables );
|
513 |
-
if( selected != -1 ){
|
514 |
-
selected = ' selected="selected" ';
|
515 |
-
}
|
516 |
-
else{
|
517 |
-
selected = ' ';
|
518 |
-
}
|
519 |
-
$(table_select).append('<option' + selected + 'value="' + value + '">' + value + ' (' + connection_data.table_sizes_hr[value] + ')</option>');
|
520 |
-
});
|
521 |
-
|
522 |
-
pull_select = table_select;
|
523 |
|
524 |
var loaded_post_types = '';
|
525 |
-
if( wpmdb_default_profile
|
526 |
-
if ( typeof data.select_post_types
|
527 |
-
$('#exclude-post-types').attr('checked','checked');
|
528 |
-
$('.post-type-select-wrap').show();
|
529 |
loaded_post_types = data.select_post_types;
|
530 |
-
|
531 |
else {
|
532 |
loaded_post_types = wpmdb_loaded_post_types;
|
533 |
}
|
534 |
}
|
535 |
|
536 |
-
var post_type_select = document.createElement('select');
|
537 |
-
$(post_type_select).attr({
|
538 |
-
multiple
|
539 |
-
name
|
540 |
-
id
|
541 |
-
class
|
542 |
-
});
|
543 |
|
544 |
-
$.each(connection_data.post_types, function(index, value) {
|
545 |
var selected = $.inArray( value, loaded_post_types );
|
546 |
-
if( selected
|
547 |
selected = ' selected="selected" ';
|
548 |
}
|
549 |
-
else{
|
550 |
selected = ' ';
|
551 |
}
|
552 |
-
$(post_type_select).append('<option' + selected + 'value="' + value
|
553 |
-
});
|
554 |
|
555 |
-
pull_post_type_select = post_type_select;
|
556 |
|
557 |
var loaded_tables_backup = '';
|
558 |
-
if( wpmdb_default_profile
|
559 |
loaded_tables_backup = wpmdb_loaded_tables_backup;
|
560 |
}
|
561 |
|
562 |
-
var table_select_backup = document.createElement('select');
|
563 |
-
$(table_select_backup).attr({
|
564 |
-
multiple
|
565 |
-
name
|
566 |
-
id
|
567 |
-
class
|
568 |
-
});
|
569 |
|
570 |
-
$.each(connection_data.tables, function(index, value) {
|
571 |
var selected = $.inArray( value, loaded_tables_backup );
|
572 |
-
if( selected
|
573 |
selected = ' selected="selected" ';
|
574 |
}
|
575 |
-
else{
|
576 |
selected = ' ';
|
577 |
}
|
578 |
-
$(table_select_backup).append('<option' + selected + 'value="' + value
|
579 |
-
});
|
580 |
-
|
581 |
-
push_select_backup = table_select_backup;
|
582 |
-
|
583 |
-
if(
|
584 |
-
|
585 |
-
$('
|
586 |
-
$('
|
587 |
-
$('
|
588 |
-
$('
|
589 |
-
$('.
|
590 |
-
$('.
|
591 |
-
$('.uploads-dir').html(wpmdb_this_uploads_dir);
|
592 |
}
|
593 |
else {
|
594 |
-
$('#select-backup').remove();
|
595 |
-
$('.backup-tables-wrap').prepend(push_select_backup);
|
596 |
}
|
597 |
|
598 |
$.wpmdb.do_action( 'verify_connection_to_remote_site', connection_data );
|
599 |
}
|
600 |
|
601 |
-
});
|
602 |
|
603 |
}
|
604 |
|
|
|
|
|
|
|
605 |
// add to <a> tags which act as JS event buttons, will not jump page to top and will deselect the button
|
606 |
-
$('body').on('click','.js-action-link',function(e){
|
607 |
e.preventDefault();
|
608 |
-
$(this).blur();
|
609 |
-
});
|
610 |
|
611 |
|
612 |
function enable_pro_licence( data, licence_key ) {
|
613 |
-
$('.licence-input, .register-licence').remove();
|
614 |
-
$('.licence-not-entered').prepend( data.masked_licence );
|
615 |
-
$('.support-content').empty().html('<p>' + wpmdb_strings.fetching_license + '<img src="' + spinner_url + '" alt="" class="ajax-spinner general-spinner" /></p>');
|
616 |
check_licence( licence_key );
|
617 |
|
618 |
-
$('.migrate-selection label').removeClass('disabled');
|
619 |
-
$('.migrate-selection input').removeAttr('disabled');
|
620 |
}
|
621 |
|
622 |
// registers your licence
|
623 |
-
$('.licence-form').submit(function(e){
|
624 |
e.preventDefault();
|
625 |
|
626 |
-
if( doing_licence_registration_ajax ){
|
627 |
return;
|
628 |
}
|
629 |
|
630 |
-
$('.licence-status').removeClass( 'notification-message error-notice success-notice' );
|
631 |
|
632 |
-
var licence_key = $.trim( $('.licence-input').val() );
|
633 |
|
634 |
-
if( licence_key
|
635 |
-
$('.licence-status').addClass( 'notification-message error-notice' );
|
636 |
-
$('.licence-status').html( wpmdb_strings.enter_license_key );
|
637 |
return;
|
638 |
}
|
639 |
|
640 |
-
$('.licence-status').empty().removeClass('success');
|
641 |
doing_licence_registration_ajax = true;
|
642 |
-
$('.button.register-licence').after( '<img src="' + spinner_url + '" alt="" class="register-licence-ajax-spinner general-spinner" />' );
|
643 |
|
644 |
-
$.ajax({
|
645 |
-
url:
|
646 |
-
type:
|
647 |
-
dataType:
|
648 |
-
cache:
|
649 |
data: {
|
650 |
-
action
|
651 |
-
licence_key
|
652 |
-
nonce
|
|
|
653 |
},
|
654 |
-
error: function(jqXHR, textStatus, errorThrown){
|
655 |
doing_licence_registration_ajax = false;
|
656 |
-
$('.register-licence-ajax-spinner').remove();
|
657 |
-
$('.licence-status').html( wpmdb_strings.register_license_problem );
|
658 |
},
|
659 |
-
success: function(data){
|
660 |
doing_licence_registration_ajax = false;
|
661 |
-
$('.register-licence-ajax-spinner').remove();
|
662 |
|
663 |
if ( typeof data.errors !== 'undefined' ) {
|
664 |
var msg = '';
|
665 |
-
for (var key in data.errors) {
|
666 |
-
msg += data.errors[key];
|
667 |
}
|
668 |
-
$('.licence-status').html(msg);
|
669 |
|
670 |
if ( typeof data.masked_licence !== 'undefined' ) {
|
671 |
enable_pro_licence( data, licence_key );
|
672 |
-
$('.migrate-tab .invalid-licence').hide();
|
673 |
}
|
674 |
}
|
675 |
else if ( typeof data.wpmdb_error !== 'undefined' && typeof data.body !== 'undefined' ) {
|
676 |
-
$('.licence-status').html( data.body );
|
677 |
}
|
678 |
else {
|
679 |
-
$('.licence-status').html( wpmdb_strings.license_registered ).delay(5000).fadeOut(1000);
|
680 |
-
$('.licence-status').addClass('success notification-message success-notice');
|
681 |
enable_pro_licence( data, licence_key );
|
682 |
-
$('.invalid-licence').hide();
|
683 |
}
|
684 |
}
|
685 |
-
});
|
686 |
|
687 |
-
});
|
688 |
|
689 |
// clears the debug log
|
690 |
-
$('.clear-log').click(function(){
|
691 |
-
$('.debug-log-textarea').val('');
|
692 |
-
$.ajax({
|
693 |
-
url:
|
694 |
-
type:
|
695 |
-
dataType:
|
696 |
-
cache:
|
697 |
data: {
|
698 |
-
action
|
699 |
-
nonce
|
700 |
},
|
701 |
-
error: function(jqXHR, textStatus, errorThrown){
|
702 |
alert( wpmdb_strings.clear_log_problem );
|
703 |
},
|
704 |
-
success: function(data){
|
705 |
}
|
706 |
-
});
|
707 |
-
});
|
708 |
|
709 |
// updates the debug log when the user switches to the help tab
|
710 |
-
function refresh_debug_log(){
|
711 |
-
$.ajax({
|
712 |
-
url:
|
713 |
-
type:
|
714 |
-
dataType:
|
715 |
-
cache:
|
716 |
data: {
|
717 |
-
action
|
718 |
-
nonce
|
719 |
},
|
720 |
-
error: function(jqXHR, textStatus, errorThrown){
|
721 |
alert( wpmdb_strings.update_log_problem );
|
722 |
},
|
723 |
-
success: function(data){
|
724 |
-
$('.debug-log-textarea').val(data);
|
725 |
}
|
726 |
-
});
|
727 |
}
|
728 |
|
729 |
// select all tables
|
730 |
-
$('.multiselect-select-all').click(function(){
|
731 |
-
var multiselect = $(this).parents('.select-wrap').children('.multiselect');
|
732 |
-
$('option', multiselect).attr('selected',1);
|
733 |
-
$(multiselect).focus().trigger('change');
|
734 |
-
});
|
735 |
|
736 |
// deselect all tables
|
737 |
-
$('.multiselect-deselect-all').click(function(){
|
738 |
-
var multiselect = $(this).parents('.select-wrap').children('.multiselect');
|
739 |
-
$('option', multiselect).removeAttr('selected');
|
740 |
-
$(multiselect).focus().trigger('change');
|
741 |
-
});
|
742 |
|
743 |
// invert table selection
|
744 |
-
$('.multiselect-invert-selection').click(function(){
|
745 |
-
var multiselect = $(this).parents('.select-wrap').children('.multiselect');
|
746 |
-
$('option', multiselect).each(function(){
|
747 |
-
$(this).attr('selected',
|
748 |
-
});
|
749 |
-
$(multiselect).focus().trigger('change');
|
750 |
-
});
|
751 |
|
752 |
// on option select hide all "advanced" option divs and show the correct div for the option selected
|
753 |
-
$('.option-group input[type=radio]').change(function() {
|
754 |
-
group = $(this).closest('.option-group');
|
755 |
-
$('ul', group).hide();
|
756 |
-
parent = $(this).closest('li');
|
757 |
-
$('ul', parent).show();
|
758 |
-
});
|
759 |
|
760 |
// on page load, expand hidden divs for selected options (browser form cache)
|
761 |
-
$('.option-group').each(function(){
|
762 |
-
$('.option-group input[type=radio]').each(function(){
|
763 |
-
if( $(this).is(':checked') ){
|
764 |
-
parent = $(this).closest('li');
|
765 |
-
$('ul', parent).show();
|
766 |
}
|
767 |
-
});
|
768 |
-
});
|
769 |
|
770 |
// expand and collapse content on click
|
771 |
-
$('.header-expand-collapse').click(function(){
|
772 |
-
if( $('.expand-collapse-arrow', this).hasClass('collapsed') ){
|
773 |
-
$('.expand-collapse-arrow', this).removeClass('collapsed');
|
774 |
-
$(this).next().show();
|
775 |
}
|
776 |
-
else{
|
777 |
-
$('.expand-collapse-arrow', this).addClass('collapsed');
|
778 |
-
$(this).next().hide();
|
779 |
}
|
780 |
-
});
|
781 |
|
782 |
-
$('.checkbox-label input[type=checkbox]').change(function() {
|
783 |
-
if( $(this).is(':checked') ){
|
784 |
-
$(this).parent().next().show();
|
785 |
}
|
786 |
else {
|
787 |
-
$(this).parent().next().hide();
|
788 |
}
|
789 |
-
});
|
790 |
|
791 |
// special expand and collapse content on click for save migration profile
|
792 |
-
$('#save-migration-profile').change(function() {
|
793 |
-
if( $(this).is(':checked') ){
|
794 |
-
$('.save-settings-button').show();
|
795 |
-
$('.migrate-db .button-primary').val(wpmdb_strings.migrate_db_save);
|
796 |
}
|
797 |
-
else{
|
798 |
-
$('.save-settings-button').hide();
|
799 |
-
$('.migrate-db .button-primary').val(wpmdb_strings.migrate_db);
|
800 |
}
|
801 |
-
});
|
802 |
|
803 |
-
$('.create-new-profile').focus(function() {
|
804 |
-
$('#create_new').prop('checked', true);
|
805 |
-
});
|
806 |
|
807 |
-
if( $('#save-migration-profile').is(':checked') ){
|
808 |
-
$('.save-settings-button').show();
|
809 |
-
$('.migrate-db .button-primary').val(wpmdb_strings.migrate_db_save);
|
810 |
-
}
|
811 |
|
812 |
-
$('.checkbox-label input[type=checkbox]').each(function(){
|
813 |
-
if( $(this).is(':checked') ){
|
814 |
-
$(this).parent().next().show();
|
815 |
}
|
816 |
-
});
|
817 |
-
|
818 |
-
$('#new-url').change(function(){
|
819 |
-
$('#new-url-missing-warning').hide();
|
820 |
-
});
|
821 |
-
|
822 |
-
$('#new-path').change(function(){
|
823 |
-
$('#new-path-missing-warning').hide();
|
824 |
-
});
|
825 |
|
826 |
// AJAX migrate button
|
827 |
-
$('.migrate-db-button').click(function(event){
|
828 |
-
$(this).blur();
|
829 |
event.preventDefault();
|
|
|
|
|
|
|
|
|
|
|
830 |
|
831 |
// check that they've selected some tables to migrate
|
832 |
-
if( $('#migrate-selected').is(':checked') && $('#select-tables').val()
|
833 |
alert( wpmdb_strings.please_select_one_table );
|
834 |
return;
|
835 |
}
|
836 |
|
837 |
-
new_url_missing = false;
|
838 |
-
new_file_path_missing = false;
|
839 |
-
if ( $('#new-url').length && !$('#new-url').val() ) {
|
840 |
-
$('#new-url-missing-warning').show();
|
841 |
-
$('#new-url').focus();
|
842 |
-
$('html,body').scrollTop(0);
|
843 |
new_url_missing = true;
|
844 |
}
|
845 |
|
846 |
-
if ( $('#new-path').length && !$('#new-path').val() ) {
|
847 |
-
$('#new-path-missing-warning').show();
|
848 |
-
if ( false
|
849 |
-
$('#new-path').focus();
|
850 |
-
$('html,body').scrollTop(0);
|
851 |
}
|
852 |
new_file_path_missing = true;
|
853 |
}
|
854 |
|
855 |
-
if ( true
|
|
|
|
|
856 |
|
857 |
// also save profile
|
858 |
-
if( $('#save-migration-profile').is(':checked') ){
|
859 |
-
|
860 |
-
if( $.trim( $('.create-new-profile').val() ) == '' && $('#create_new').is(':checked') ){
|
861 |
-
alert( wpmdb_strings.enter_name_for_profile );
|
862 |
-
$('.create-new-profile').focus();
|
863 |
-
return;
|
864 |
-
}
|
865 |
-
|
866 |
-
var create_new_profile = false;
|
867 |
-
|
868 |
-
if( $('#create_new').is(':checked') ){
|
869 |
-
create_new_profile = true;
|
870 |
-
}
|
871 |
-
var profile_name = $('.create-new-profile').val();
|
872 |
-
|
873 |
-
profile = $('#migrate-form').serialize();
|
874 |
-
|
875 |
-
$.ajax({
|
876 |
-
url: ajaxurl,
|
877 |
-
type: 'POST',
|
878 |
-
dataType: 'text',
|
879 |
-
cache: false,
|
880 |
-
data: {
|
881 |
-
action : 'wpmdb_save_profile',
|
882 |
-
profile : profile,
|
883 |
-
nonce : wpmdb_nonces.save_profile,
|
884 |
-
},
|
885 |
-
error: function(jqXHR, textStatus, errorThrown){
|
886 |
-
alert( wpmdb_strings.save_profile_problem );
|
887 |
-
},
|
888 |
-
success: function(data){
|
889 |
-
if(create_new_profile){
|
890 |
-
var new_profile_key = parseInt(data, 10);
|
891 |
-
var new_profile_id = new_profile_key + 1;
|
892 |
-
var new_li = '<li><span style="display: none;" 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"> ' + profile_name + '</label></li>';
|
893 |
-
$('#create_new').parents('li').before(new_li);
|
894 |
-
$('#profile-' + new_profile_id).attr('checked','checked');
|
895 |
-
$('.create-new-profile').val('');
|
896 |
-
}
|
897 |
-
}
|
898 |
-
});
|
899 |
}
|
900 |
|
901 |
-
form_data = $('#migrate-form').serialize();
|
902 |
|
903 |
-
var doc_height = $(document).height();
|
904 |
|
905 |
-
$('body').append('<div id="overlay"></div>');
|
906 |
|
907 |
-
$('#overlay')
|
908 |
-
.height(doc_height)
|
909 |
-
.css({
|
910 |
-
|
911 |
-
|
912 |
-
|
913 |
-
|
914 |
-
|
915 |
-
|
916 |
-
|
917 |
|
918 |
-
$progress_content = progress_content_original.clone();
|
919 |
-
migration_intent =
|
920 |
|
921 |
stage = 'backup';
|
922 |
|
923 |
-
if( migration_intent
|
924 |
stage = 'migrate';
|
925 |
}
|
926 |
|
927 |
-
if( $('#create-backup').is(':checked')
|
928 |
stage = 'migrate';
|
929 |
}
|
930 |
|
931 |
-
var table_intent = $('input[name=table_migrate_option]:checked').val();
|
932 |
-
var connection_info = $.trim( $('.pull-push-connection-info').val() ).split("\n");
|
933 |
var table_rows = '';
|
934 |
|
935 |
-
remote_site = connection_info[0];
|
936 |
-
secret_key = connection_info[1];
|
937 |
|
938 |
var static_migration_label = '';
|
939 |
|
940 |
-
$('#overlay').after($progress_content);
|
941 |
|
942 |
completed_msg = wpmdb_strings.exporting_complete;
|
943 |
|
944 |
-
if( migration_intent
|
945 |
static_migration_label = wpmdb_strings.exporting_please_wait;
|
946 |
}
|
947 |
-
else{
|
948 |
-
static_migration_label = get_migration_status_label(remote_site, migration_intent, 'migrating');
|
949 |
-
completed_msg = get_migration_status_label(remote_site, migration_intent, 'completed');
|
950 |
}
|
951 |
|
952 |
-
$('.progress-title').html(static_migration_label);
|
953 |
|
954 |
-
$('#overlay').show();
|
955 |
-
backup_option = $('input[name=backup_option]:checked').val();
|
956 |
-
table_option = $('input[name=table_migrate_option]:checked').val();
|
|
|
957 |
|
958 |
-
if( stage
|
959 |
-
if( table_option
|
960 |
backup_option = 'backup_only_with_prefix';
|
961 |
}
|
962 |
-
if( migration_intent
|
963 |
table_rows = connection_data.table_rows;
|
964 |
-
if( backup_option
|
965 |
tables_to_migrate = connection_data.prefixed_tables;
|
966 |
}
|
967 |
-
else if( backup_option
|
968 |
-
selected_tables = $('#select-tables').val();
|
969 |
tables_to_migrate = get_intersect( selected_tables, connection_data.tables );
|
970 |
}
|
971 |
-
else if( backup_option
|
972 |
-
tables_to_migrate = $('#select-backup').val();
|
973 |
}
|
974 |
}
|
975 |
-
else{
|
976 |
-
table_rows =
|
977 |
-
if( backup_option
|
978 |
-
tables_to_migrate =
|
979 |
}
|
980 |
-
else if( backup_option
|
981 |
-
selected_tables = $('#select-tables').val();
|
982 |
-
tables_to_migrate = get_intersect( selected_tables,
|
983 |
}
|
984 |
-
else if( backup_option
|
985 |
-
tables_to_migrate = $('#select-backup').val();
|
986 |
}
|
987 |
}
|
988 |
}
|
989 |
else {
|
990 |
-
if( table_intent
|
991 |
// grab tables as per what the user has selected from the multiselect box
|
992 |
-
tables_to_migrate = $('#select-tables').val();
|
993 |
// user is pushing or exporting
|
994 |
-
if( migration_intent
|
995 |
// default value, assuming we're not backing up
|
996 |
-
table_rows =
|
997 |
}
|
998 |
-
else{
|
999 |
table_rows = connection_data.table_rows;
|
1000 |
}
|
1001 |
}
|
1002 |
-
else{
|
1003 |
-
if( migration_intent
|
1004 |
-
tables_to_migrate =
|
1005 |
-
table_rows =
|
1006 |
}
|
1007 |
-
else{
|
1008 |
tables_to_migrate = connection_data.prefixed_tables;
|
1009 |
table_rows = connection_data.table_rows;
|
1010 |
}
|
1011 |
}
|
1012 |
}
|
1013 |
|
1014 |
-
function decide_tables_to_display_rows( tables_to_migrate,
|
1015 |
-
|
1016 |
var total_size = 0;
|
1017 |
-
|
1018 |
-
|
1019 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1020 |
|
1021 |
var last_element = '';
|
1022 |
-
|
1023 |
-
|
1024 |
-
var
|
1025 |
-
|
1026 |
-
|
1027 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1028 |
last_element = value;
|
1029 |
-
});
|
1030 |
-
|
1031 |
-
|
1032 |
-
|
1033 |
-
|
1034 |
-
|
1035 |
-
|
1036 |
-
|
1037 |
-
|
|
|
|
|
|
|
|
|
1038 |
}
|
|
|
1039 |
var element = this;
|
1040 |
-
setTimeout(function(){
|
1041 |
-
hide_overflowing_elements(element);
|
1042 |
-
}, 0);
|
1043 |
|
1044 |
-
function hide_overflowing_elements(element){
|
1045 |
-
if( $('span', element).innerWidth() > $(element).width() ){
|
1046 |
-
$('span', element).hide();
|
1047 |
}
|
1048 |
}
|
|
|
1049 |
|
1050 |
-
|
1051 |
-
|
1052 |
-
|
1053 |
-
if( table_rows[last_element] != 0 ){
|
1054 |
-
var percent = table_rows[last_element] / total_size * 100;
|
1055 |
-
var percent_rounded = Math.round(percent*1000)/1000;
|
1056 |
}
|
1057 |
-
$('.progress-tables .progress-chunk:last').css('width',
|
1058 |
-
$('.progress-chunk-hover:last').css('width',
|
1059 |
|
1060 |
-
var return_vals = [table_rows,total_size];
|
1061 |
|
1062 |
return return_vals;
|
1063 |
|
1064 |
}
|
1065 |
|
1066 |
-
table_details = decide_tables_to_display_rows( tables_to_migrate, table_rows );
|
1067 |
-
table_rows = table_details[0];
|
1068 |
-
total_size = table_details[1];
|
1069 |
|
1070 |
-
$('.progress-title').after( '<img src="' + spinner_url + '" alt="" class="migration-progress-ajax-spinner general-spinner" />' );
|
1071 |
|
1072 |
-
var height = $('.progress-content').outerHeight();
|
1073 |
-
$('.progress-content').css('top', '-' + height + 'px').show().animate({'top': '0px'});
|
1074 |
|
1075 |
setup_counter();
|
1076 |
currently_migrating = true;
|
1077 |
|
1078 |
-
|
1079 |
-
|
1080 |
-
|
1081 |
-
|
1082 |
-
|
1083 |
-
|
1084 |
-
|
1085 |
-
|
1086 |
-
|
1087 |
-
|
1088 |
-
|
1089 |
-
|
1090 |
-
|
1091 |
-
|
1092 |
-
|
1093 |
-
|
1094 |
-
|
1095 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1096 |
console.log( jqXHR );
|
1097 |
console.log( textStatus );
|
1098 |
console.log( errorThrown );
|
|
|
1099 |
migration_error = true;
|
1100 |
migration_complete_events();
|
1101 |
return;
|
1102 |
},
|
1103 |
-
success: function(data){
|
1104 |
-
|
|
|
1105 |
migration_error = true;
|
1106 |
migration_complete_events();
|
1107 |
-
$('.progress-title').html( wpmdb_strings.migration_failed );
|
1108 |
-
$('.progress-text').addClass( 'migration-error' );
|
1109 |
-
$('.progress-text').html( data.body );
|
1110 |
return;
|
1111 |
}
|
1112 |
|
1113 |
-
|
1114 |
-
dump_path = data.dump_path;
|
1115 |
-
dump_filename = data.dump_filename;
|
1116 |
-
db_version = data.db_version;
|
1117 |
-
site_url = data.site_url;
|
1118 |
-
find_replace_pairs = data.find_replace_pairs;
|
1119 |
|
1120 |
var i = 0;
|
1121 |
var progress_size = 0;
|
@@ -1125,48 +1317,56 @@ var execute_next_step;
|
|
1125 |
var last_progress = 0;
|
1126 |
var overall_table_progress = 0;
|
1127 |
|
1128 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
1129 |
|
1130 |
-
if( i >= tables_to_migrate.length ){
|
1131 |
-
if( stage
|
1132 |
stage = 'migrate';
|
1133 |
i = 0;
|
1134 |
progress_size = 0;
|
1135 |
-
|
|
|
1136 |
|
1137 |
-
if( table_intent
|
1138 |
-
tables_to_migrate = $('#select-tables').val();
|
1139 |
-
if( migration_intent
|
1140 |
-
table_rows =
|
1141 |
}
|
1142 |
-
else{
|
1143 |
table_rows = connection_data.table_rows;
|
1144 |
}
|
1145 |
}
|
1146 |
-
else{
|
1147 |
-
if( migration_intent
|
1148 |
-
tables_to_migrate =
|
1149 |
-
table_rows =
|
1150 |
}
|
1151 |
-
else{
|
1152 |
tables_to_migrate = connection_data.prefixed_tables;
|
1153 |
table_rows = connection_data.table_rows;
|
1154 |
}
|
1155 |
}
|
1156 |
|
1157 |
-
$('.progress-tables').empty();
|
1158 |
-
$('.progress-tables-hover-boxes').empty();
|
1159 |
|
1160 |
table_details = decide_tables_to_display_rows( tables_to_migrate, table_rows );
|
1161 |
-
table_rows = table_details[0];
|
1162 |
-
total_size = table_details[1];
|
1163 |
|
1164 |
}
|
1165 |
else {
|
1166 |
-
$('.progress-label').removeClass('label-visible');
|
1167 |
|
1168 |
hooks = $.wpmdb.apply_filters( 'wpmdb_before_migration_complete_hooks', hooks );
|
1169 |
hooks.push( 'migration_complete' );
|
|
|
1170 |
hooks = $.wpmdb.apply_filters( 'wpmdb_after_migration_complete_hooks', hooks );
|
1171 |
hooks.push( 'migration_complete_events' );
|
1172 |
next_step_in_migration = { fn: wpmdb_call_next_hook };
|
@@ -1175,66 +1375,59 @@ var execute_next_step;
|
|
1175 |
}
|
1176 |
}
|
1177 |
|
1178 |
-
if( stage
|
1179 |
-
$('.progress-text').html( overall_percent + '% - ' + wpmdb_strings.backing_up + ' "' + tables_to_migrate[i] + '"' );
|
1180 |
}
|
1181 |
-
else{
|
1182 |
-
$('.progress-text').html( overall_percent + '% - ' + wpmdb_strings.migrating + ' "' + tables_to_migrate[i] + '"');
|
1183 |
}
|
1184 |
|
1185 |
-
last_table = 0;
|
1186 |
-
if( i
|
1187 |
last_table = 1;
|
1188 |
}
|
1189 |
|
1190 |
-
gzip = 0;
|
1191 |
-
if( migration_intent
|
1192 |
gzip = 1;
|
1193 |
}
|
1194 |
|
1195 |
-
var request_data =
|
1196 |
-
action
|
1197 |
-
|
1198 |
-
|
1199 |
-
|
1200 |
-
|
1201 |
-
|
1202 |
-
|
1203 |
-
|
1204 |
-
|
1205 |
-
dump_filename : dump_filename,
|
1206 |
-
last_table : last_table,
|
1207 |
-
primary_keys : primary_keys,
|
1208 |
-
gzip : gzip,
|
1209 |
-
nonce : wpmdb_nonces.migrate_table,
|
1210 |
-
site_url : site_url,
|
1211 |
-
find_replace_pairs : find_replace_pairs
|
1212 |
};
|
1213 |
|
1214 |
-
if( migration_intent
|
1215 |
request_data.bottleneck = connection_data.bottleneck;
|
1216 |
request_data.prefix = connection_data.prefix;
|
1217 |
}
|
1218 |
|
1219 |
-
if( connection_data && connection_data.path_current_site && connection_data.domain ) {
|
1220 |
request_data.path_current_site = connection_data.path_current_site;
|
1221 |
request_data.domain_current_site = connection_data.domain;
|
1222 |
}
|
1223 |
|
1224 |
doing_ajax = true;
|
1225 |
|
1226 |
-
$.ajax({
|
1227 |
-
url:
|
1228 |
-
type:
|
1229 |
-
dataType:
|
1230 |
-
cache:
|
1231 |
-
timeout:
|
1232 |
-
data:
|
1233 |
-
error: function(jqXHR, textStatus, errorThrown){
|
1234 |
-
$('.progress-title').html(wpmdb_strings.migration_failed);
|
1235 |
-
$('.progress-text').html( wpmdb_strings.table_process_problem + ' ' + tables_to_migrate[i] );
|
1236 |
-
$('.progress-text').append( '<br /><br />' + wpmdb_strings.status + ': ' + jqXHR.status + ' ' + jqXHR.statusText + '<br /><br />' + wpmdb_strings.response + ':<br />' + jqXHR.responseText );
|
1237 |
-
$('.progress-text').addClass( 'migration-error' );
|
1238 |
doing_ajax = false;
|
1239 |
console.log( jqXHR );
|
1240 |
console.log( textStatus );
|
@@ -1243,38 +1436,48 @@ var execute_next_step;
|
|
1243 |
migration_complete_events();
|
1244 |
return;
|
1245 |
},
|
1246 |
-
success: function(data){
|
1247 |
doing_ajax = false;
|
1248 |
data = $.trim( data );
|
1249 |
-
row_information = wpmdb_parse_json( data );
|
1250 |
-
if( false
|
1251 |
-
$('.progress-title').html(wpmdb_strings.migration_failed);
|
1252 |
-
if( ''
|
1253 |
-
$('.progress-text').html( wpmdb_strings.table_process_problem_empty_response + ' ' + tables_to_migrate[i] );
|
1254 |
}
|
1255 |
else {
|
1256 |
-
$('.progress-text').html( getAjaxErrors( data ) );
|
1257 |
}
|
1258 |
-
$('.progress-text').addClass('migration-error');
|
1259 |
migration_error = true;
|
1260 |
migration_complete_events();
|
1261 |
return;
|
1262 |
}
|
1263 |
|
1264 |
-
if( typeof row_information.wpmdb_error
|
1265 |
-
$('.progress-title').html(wpmdb_strings.migration_failed);
|
1266 |
-
$('.progress-text').addClass( 'migration-error' );
|
1267 |
-
$('.progress-text').html( row_information.body );
|
1268 |
migration_error = true;
|
1269 |
migration_complete_events();
|
1270 |
return;
|
1271 |
}
|
1272 |
|
1273 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1274 |
progress_size -= overall_table_progress;
|
1275 |
overall_table_progress = 0;
|
1276 |
last_progress = 0;
|
1277 |
-
progress_size += parseInt(table_rows[tables_to_migrate[i]]);
|
1278 |
i++;
|
1279 |
row_information.current_row = '';
|
1280 |
row_information.primary_keys = '';
|
@@ -1286,43 +1489,45 @@ var execute_next_step;
|
|
1286 |
progress_size += table_progress;
|
1287 |
overall_table_progress += table_progress;
|
1288 |
}
|
1289 |
-
|
1290 |
-
$('.progress-bar').width(
|
1291 |
-
|
1292 |
-
|
|
|
|
|
1293 |
execute_next_step();
|
1294 |
}
|
1295 |
-
});
|
1296 |
|
1297 |
-
}
|
1298 |
|
1299 |
next_step_in_migration = { fn: migrate_table_recursive, args: [ '-1', '' ] };
|
1300 |
execute_next_step();
|
1301 |
|
1302 |
}
|
1303 |
|
1304 |
-
}); // end ajax
|
1305 |
|
1306 |
-
});
|
1307 |
|
1308 |
migration_complete_events = function() {
|
1309 |
-
if( false
|
1310 |
-
if( non_fatal_errors
|
1311 |
-
if( 'savefile'
|
1312 |
-
|
1313 |
}
|
1314 |
-
$('.progress-title').html(completed_msg).append('<div class="dashicons dashicons-yes"></div>');
|
1315 |
}
|
1316 |
else {
|
1317 |
-
$('.progress-text').html(non_fatal_errors);
|
1318 |
-
$('.progress-text').addClass('migration-error');
|
1319 |
-
$('.progress-title').html( wpmdb_strings.completed_with_some_errors );
|
1320 |
}
|
1321 |
|
1322 |
-
$('.progress-bar-wrapper').hide();
|
1323 |
}
|
1324 |
|
1325 |
-
$('.migration-controls').hide();
|
1326 |
|
1327 |
// reset migration variables so consecutive migrations work correctly
|
1328 |
hooks = [];
|
@@ -1335,68 +1540,67 @@ var execute_next_step;
|
|
1335 |
doing_ajax = false;
|
1336 |
non_fatal_errors = '';
|
1337 |
|
1338 |
-
$('.progress-label').remove();
|
1339 |
-
$('.migration-progress-ajax-spinner').remove();
|
1340 |
-
$('.close-progress-content').show();
|
1341 |
-
$('#overlay').css('cursor','pointer');
|
1342 |
clearInterval( elapsed_interval );
|
1343 |
-
}
|
1344 |
|
1345 |
migration_complete = function() {
|
1346 |
-
$('.migration-controls').fadeOut();
|
1347 |
-
if( migration_intent
|
1348 |
currently_migrating = false;
|
1349 |
var migrate_complete_text = wpmdb_strings.migration_complete;
|
1350 |
-
if( $('#save_computer').is(':checked') ){
|
1351 |
-
var url =
|
1352 |
-
if( $('#gzip_file').is(':checked') ){
|
1353 |
url += '&gzip=1';
|
1354 |
}
|
1355 |
window.location = url;
|
1356 |
}
|
1357 |
-
else{
|
1358 |
migrate_complete_text = wpmdb_strings.completed_dump_located_at + ' ' + dump_path;
|
1359 |
}
|
1360 |
|
1361 |
-
if( migration_error
|
1362 |
-
$('.progress-text').html(migrate_complete_text);
|
1363 |
migration_complete_events();
|
1364 |
-
$('.progress-title').html(completed_msg);
|
1365 |
}
|
1366 |
|
1367 |
}
|
1368 |
-
else{ // rename temp tables, delete old tables
|
1369 |
-
$('.progress-text').html( wpmdb_strings.finalizing_migration );
|
1370 |
-
|
1371 |
-
|
1372 |
-
|
1373 |
-
|
1374 |
-
|
|
|
1375 |
data: {
|
1376 |
-
action
|
1377 |
-
|
1378 |
-
|
1379 |
-
|
1380 |
-
|
1381 |
-
prefix : connection_data.prefix,
|
1382 |
-
temp_prefix : connection_data.temp_prefix,
|
1383 |
-
tables : tables_to_migrate.join(','),
|
1384 |
-
nonce : wpmdb_nonces.finalize_migration,
|
1385 |
},
|
1386 |
-
error: function(jqXHR, textStatus, errorThrown){
|
1387 |
-
|
1388 |
-
$('.progress-
|
1389 |
-
$('.progress-text').
|
|
|
1390 |
alert( jqXHR + ' : ' + textStatus + ' : ' + errorThrown );
|
1391 |
migration_error = true;
|
1392 |
migration_complete_events();
|
1393 |
return;
|
1394 |
},
|
1395 |
-
success: function(data){
|
1396 |
-
|
1397 |
-
|
1398 |
-
$('.progress-
|
1399 |
-
$('.progress-text').
|
|
|
1400 |
migration_error = true;
|
1401 |
migration_complete_events();
|
1402 |
return;
|
@@ -1404,326 +1608,402 @@ var execute_next_step;
|
|
1404 |
next_step_in_migration = { fn: wpmdb_call_next_hook };
|
1405 |
execute_next_step();
|
1406 |
}
|
1407 |
-
});
|
1408 |
}
|
|
|
1409 |
|
1410 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1411 |
|
1412 |
// close progress pop up once migration is completed
|
1413 |
-
$('body').on('click', '.close-progress-content-button', function(e){
|
1414 |
hide_overlay();
|
1415 |
-
});
|
1416 |
|
1417 |
-
$('body').on('click', '#overlay', function(){
|
1418 |
-
if( migration_completed
|
1419 |
hide_overlay();
|
1420 |
}
|
1421 |
-
});
|
1422 |
|
1423 |
-
function hide_overlay(){
|
1424 |
-
var height = $('.progress-content').outerHeight();
|
1425 |
-
$('.progress-content').animate({'top'
|
|
|
|
|
|
|
1426 |
migration_completed = false;
|
1427 |
}
|
1428 |
|
1429 |
// AJAX save button profile
|
1430 |
-
$('.save-settings-button').click(function(event){
|
1431 |
-
var profile;
|
1432 |
-
$(this).blur();
|
1433 |
event.preventDefault();
|
1434 |
-
|
1435 |
-
|
|
|
1436 |
return;
|
1437 |
}
|
|
|
|
|
1438 |
|
1439 |
-
|
1440 |
-
|
1441 |
-
|
|
|
|
|
|
|
1442 |
return;
|
1443 |
}
|
1444 |
|
1445 |
-
|
1446 |
-
|
1447 |
-
|
1448 |
return;
|
1449 |
}
|
1450 |
|
1451 |
var create_new_profile = false;
|
1452 |
|
1453 |
-
if( $('#create_new').is(':checked') ){
|
1454 |
create_new_profile = true;
|
1455 |
}
|
1456 |
-
var profile_name = $('.create-new-profile').val();
|
1457 |
|
1458 |
doing_save_profile = true;
|
1459 |
-
profile = $('#migrate-form').serialize();
|
1460 |
|
1461 |
-
$('.save-settings-button').
|
1462 |
-
|
1463 |
|
1464 |
-
|
1465 |
-
|
1466 |
-
|
1467 |
-
|
1468 |
-
|
|
|
|
|
1469 |
data: {
|
1470 |
-
action
|
1471 |
-
profile
|
1472 |
-
nonce
|
1473 |
},
|
1474 |
-
error: function(jqXHR, textStatus, errorThrown){
|
|
|
1475 |
alert( wpmdb_strings.save_profile_problem );
|
1476 |
-
$('.save-settings-button').removeAttr('disabled');
|
1477 |
-
$('.save-profile-ajax-spinner').remove();
|
1478 |
-
$('.save-settings-button').after('<span class="ajax-success-msg">' + wpmdb_strings.saved + '</span>');
|
1479 |
-
$('.ajax-success-msg').fadeOut(2000,function(){
|
1480 |
-
$(this).remove();
|
1481 |
-
});
|
1482 |
doing_save_profile = false;
|
1483 |
},
|
1484 |
-
success: function(data){
|
1485 |
-
$('
|
1486 |
-
|
1487 |
-
$('.save-settings-button').
|
1488 |
-
$('.ajax-
|
1489 |
-
|
1490 |
-
|
|
|
|
|
1491 |
doing_save_profile = false;
|
1492 |
-
$('.create-new-profile').val('');
|
1493 |
|
1494 |
-
if(create_new_profile){
|
1495 |
-
var new_profile_key = parseInt(data, 10);
|
1496 |
var new_profile_id = new_profile_key + 1;
|
1497 |
-
var new_li = $('<li><span
|
1498 |
-
new_li.find("label").append( document.createTextNode( " " + profile_name ) );
|
|
|
1499 |
|
1500 |
-
$('#create_new').parents('li').before(new_li);
|
1501 |
-
$('#profile-' + new_profile_id).attr('checked','checked');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1502 |
}
|
1503 |
-
|
1504 |
}
|
1505 |
-
});
|
1506 |
-
|
1507 |
-
});
|
1508 |
|
1509 |
// progress label updating
|
1510 |
-
$('body').on('mousemove', '.progress-chunk-hover', function(e) {
|
1511 |
-
mX = e.pageX;
|
1512 |
-
offset = $('.progress-bar-wrapper').offset();
|
1513 |
-
label_offset = $('.progress-label').outerWidth() / 2;
|
1514 |
mX = ( mX - offset.left ) - label_offset;
|
1515 |
-
$('.progress-label').css('left', mX + 'px');
|
1516 |
-
$('.progress-label').html($(this).attr('data-table'));
|
1517 |
-
});
|
1518 |
|
1519 |
// show / hide progress lavel on hover
|
1520 |
-
$('body').on('mouseenter mouseleave', '.progress-chunk-hover', function(event) {
|
1521 |
-
if( event.type === 'mouseenter' ){
|
1522 |
-
$('.progress-label').addClass('label-visible');
|
1523 |
-
}
|
1524 |
-
else{
|
1525 |
-
$('.progress-label').removeClass('label-visible');
|
1526 |
}
|
1527 |
-
|
1528 |
-
|
1529 |
-
// move around textarea depending on whether or not the push/pull options are selected
|
1530 |
-
connection_info_box = $('.connection-info-wrapper');
|
1531 |
-
move_connection_info_box();
|
1532 |
-
|
1533 |
-
$('.migrate-selection.option-group input[type=radio]').change(function() {
|
1534 |
-
move_connection_info_box();
|
1535 |
-
if( connection_established ){
|
1536 |
-
change_replace_values();
|
1537 |
}
|
1538 |
-
});
|
1539 |
|
1540 |
// save file (export) / push / pull special conditions
|
1541 |
-
function move_connection_info_box(){
|
1542 |
-
$('.connection-status').hide();
|
1543 |
-
$('.prefix-notice').hide();
|
1544 |
-
$('.ssl-notice').hide();
|
1545 |
-
$('.different-plugin-version-notice').hide();
|
1546 |
-
$('.step-two').show();
|
1547 |
-
$('.backup-options').show();
|
1548 |
-
$('.keep-active-plugins').show();
|
1549 |
-
$('.directory-permission-notice').hide();
|
1550 |
-
$('#create-backup').removeAttr('disabled');
|
1551 |
-
$('#create-backup-label').removeClass('disabled');
|
1552 |
-
$('.backup-option-disabled').hide();
|
1553 |
-
$('.
|
1554 |
-
$('.
|
1555 |
-
var
|
1556 |
-
|
1557 |
-
|
1558 |
-
|
1559 |
-
|
1560 |
-
$('.connection-
|
1561 |
-
|
1562 |
-
|
1563 |
-
$('.uploads-dir').html(wpmdb_this_uploads_dir);
|
1564 |
-
if( profile_name_edited == false ){
|
1565 |
-
var profile_name = get_domain_name( connection_data.url );
|
1566 |
-
$('.create-new-profile').val(profile_name);
|
1567 |
}
|
1568 |
-
|
1569 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1570 |
}
|
1571 |
-
if(
|
1572 |
-
$('.
|
1573 |
}
|
1574 |
-
if(
|
1575 |
-
$('.
|
1576 |
-
$('.step-two').hide();
|
1577 |
}
|
1578 |
-
|
1579 |
-
|
1580 |
-
$('
|
1581 |
-
|
1582 |
-
|
1583 |
-
|
1584 |
-
$('
|
|
|
|
|
|
|
|
|
1585 |
}
|
1586 |
}
|
1587 |
-
else{
|
1588 |
-
$('.connection-status').show();
|
1589 |
-
$('.step-two').hide();
|
1590 |
}
|
1591 |
}
|
1592 |
-
else if(
|
1593 |
-
$('.push-list li').append( connection_info_box );
|
1594 |
-
connection_info_box.show()
|
1595 |
-
|
1596 |
-
|
1597 |
-
|
1598 |
-
|
1599 |
-
|
1600 |
-
|
1601 |
-
|
1602 |
-
|
|
|
|
|
|
|
|
|
|
|
1603 |
}
|
1604 |
-
if( show_prefix_notice
|
1605 |
-
$('.prefix-notice.push').show();
|
1606 |
}
|
1607 |
-
if( show_ssl_notice
|
1608 |
-
$('.ssl-notice').show();
|
1609 |
}
|
1610 |
-
if( show_version_notice
|
1611 |
-
$('.different-plugin-version-notice').show();
|
1612 |
-
$('.step-two').hide();
|
1613 |
}
|
1614 |
-
|
1615 |
-
if( '0'
|
1616 |
-
$('#create-backup').prop('checked',false);
|
1617 |
-
$('#create-backup').attr('disabled','disabled');
|
1618 |
-
$('#create-backup-label').addClass('disabled');
|
1619 |
-
$('.backup-option-disabled').show();
|
1620 |
-
$('.upload-directory-location').html(connection_data.upload_dir_long);
|
1621 |
}
|
1622 |
}
|
1623 |
-
else{
|
1624 |
-
$('.connection-status').show();
|
1625 |
-
$('.step-two').hide();
|
1626 |
}
|
1627 |
}
|
1628 |
-
else if(
|
1629 |
-
$('.connection-status').hide();
|
1630 |
-
$('.step-two').show();
|
1631 |
-
$('.table-prefix').html(
|
1632 |
-
$('.compatibility-older-mysql').show();
|
1633 |
-
if( profile_name_edited
|
1634 |
-
$('.create-new-profile').val('');
|
1635 |
}
|
1636 |
-
$('.backup-options').hide();
|
1637 |
-
$('.keep-active-plugins').hide();
|
1638 |
-
if( false
|
1639 |
-
$('.directory-permission-notice').show();
|
1640 |
-
$('.step-two').hide();
|
1641 |
}
|
1642 |
}
|
1643 |
maybe_show_mixed_cased_table_name_warning();
|
1644 |
-
$.wpmdb.do_action( 'move_connection_info_box'
|
|
|
|
|
|
|
1645 |
}
|
1646 |
|
1647 |
-
|
1648 |
-
|
1649 |
-
|
1650 |
-
|
1651 |
-
|
1652 |
-
|
1653 |
-
|
1654 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1655 |
}
|
1656 |
-
|
1657 |
-
$('
|
1658 |
-
$('
|
1659 |
-
$('
|
1660 |
-
$('
|
1661 |
-
|
1662 |
-
|
1663 |
-
|
1664 |
-
|
1665 |
-
|
1666 |
-
|
1667 |
-
|
1668 |
-
|
1669 |
-
$('.replace-right-col input', this).val( old_val );
|
1670 |
-
});
|
1671 |
}
|
1672 |
-
|
1673 |
-
$('
|
1674 |
-
$('
|
1675 |
-
$('
|
1676 |
-
$('
|
1677 |
-
$('.backup-tables-wrap').prepend(pull_select_backup);
|
1678 |
-
last_replace_switch = 'pull';
|
1679 |
}
|
1680 |
-
|
1681 |
}
|
1682 |
|
1683 |
// hide second section if pull or push is selected with no connection established
|
1684 |
-
if( (
|
1685 |
-
$('.step-two').hide();
|
1686 |
-
$('.connection-status').show();
|
1687 |
}
|
1688 |
|
1689 |
// show / hide GUID helper description
|
1690 |
-
$('.general-helper').click(function(e){
|
1691 |
e.preventDefault();
|
1692 |
-
var icon = $(this),
|
1693 |
-
bubble = $(this).next();
|
1694 |
|
1695 |
// Close any that are already open
|
1696 |
-
$('.helper-message').not(bubble).hide();
|
1697 |
|
1698 |
var position = icon.position();
|
1699 |
-
if( bubble.hasClass('bottom') ) {
|
1700 |
-
bubble.css({
|
1701 |
-
'left': (position.left - bubble.width()/2) + 'px',
|
1702 |
'top': (position.top + icon.height() + 9) + 'px'
|
1703 |
-
});
|
1704 |
} else {
|
1705 |
-
bubble.css({
|
1706 |
'left': (position.left + icon.width() + 9) + 'px',
|
1707 |
-
'top': (position.top + icon.height()/2 - 18) + 'px'
|
1708 |
-
});
|
1709 |
}
|
1710 |
|
1711 |
bubble.toggle();
|
1712 |
e.stopPropagation();
|
1713 |
-
});
|
1714 |
|
1715 |
-
$('body').click(function(){
|
1716 |
-
$('.helper-message').hide();
|
1717 |
-
});
|
1718 |
|
1719 |
-
$('.helper-message').click(function(e){
|
1720 |
e.stopPropagation();
|
1721 |
-
});
|
1722 |
|
1723 |
-
$('body').on('click', '.show-errors-toggle', function
|
1724 |
e.preventDefault();
|
1725 |
-
$(this).next('.migration-php-errors').toggle();
|
1726 |
-
});
|
1727 |
|
1728 |
/**
|
1729 |
* Core plugin wrapper for the common AJAX error detecting method
|
@@ -1739,849 +2019,856 @@ var execute_next_step;
|
|
1739 |
}
|
1740 |
|
1741 |
// migrate / settings tabs
|
1742 |
-
$('.nav-tab').click(function(){
|
1743 |
-
$(
|
1744 |
-
|
1745 |
-
$('.content-tab').hide();
|
1746 |
-
$('.' + $(this).attr('data-div-name')).show();
|
1747 |
-
|
1748 |
-
var hash = $(this).attr('data-div-name');
|
1749 |
-
hash = hash.replace('-tab','');
|
1750 |
window.location.hash = hash;
|
|
|
|
|
1751 |
|
1752 |
-
|
1753 |
-
|
1754 |
-
|
1755 |
-
$('.support-content p').append( '<img src="' + spinner_url + '" alt="" class="ajax-spinner general-spinner" />' );
|
1756 |
-
check_licence();
|
1757 |
-
checked_licence = true;
|
1758 |
-
}
|
1759 |
-
}
|
1760 |
-
|
1761 |
-
if( $(this).hasClass('addons') ) {
|
1762 |
-
if( checked_licence == false && wpmdb_has_licence == '1' ) {
|
1763 |
-
$('.addons-content p').append( '<img src="' + spinner_url + '" alt="" class="ajax-spinner general-spinner" />' );
|
1764 |
-
check_licence();
|
1765 |
-
checked_licence = true;
|
1766 |
-
}
|
1767 |
-
}
|
1768 |
-
|
1769 |
-
});
|
1770 |
|
1771 |
-
|
1772 |
-
|
1773 |
-
|
1774 |
-
|
1775 |
-
if (tab_name) {
|
1776 |
-
var nav_tab = $('.' + tab_name);
|
1777 |
-
if (nav_tab.length === 1) {
|
1778 |
-
nav_tab.trigger('click');
|
1779 |
event.preventDefault();
|
1780 |
}
|
1781 |
}
|
1782 |
-
});
|
1783 |
|
1784 |
// repeatable fields
|
1785 |
-
$('body').on('click', '.add-row', function() {
|
1786 |
-
$(this).parents('tr').before( $('.original-repeatable-field').clone().removeClass('original-repeatable-field') );
|
1787 |
-
});
|
1788 |
|
1789 |
// repeatable fields
|
1790 |
-
$('body').on('click', '.replace-remove-row', function() {
|
1791 |
-
$(this).parents('tr').remove();
|
1792 |
-
if( $('.replace-row').length < 2 ){
|
1793 |
-
$('.no-replaces-message').show();
|
1794 |
-
}
|
1795 |
-
|
1796 |
-
prev_id = $(this).prev().attr('id');
|
1797 |
-
if ( 'new-url'
|
1798 |
-
$('#' + prev_id + '-missing-warning').hide();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1799 |
}
|
1800 |
-
});
|
1801 |
|
1802 |
-
|
1803 |
-
|
1804 |
-
|
1805 |
-
});
|
1806 |
-
|
1807 |
-
$
|
1808 |
|
1809 |
-
|
1810 |
-
|
1811 |
-
|
1812 |
-
|
1813 |
-
|
1814 |
-
|
|
|
|
|
|
|
|
|
|
|
1815 |
}
|
1816 |
-
});
|
1817 |
|
1818 |
-
|
1819 |
-
|
1820 |
-
|
1821 |
-
|
1822 |
-
|
1823 |
-
$('.sort-handle').css('cursor', '-moz-grabbing');
|
1824 |
-
},
|
1825 |
-
stop: function () {
|
1826 |
-
$('.sort-handle').css('cursor', '-webkit-grab');
|
1827 |
-
$('.sort-handle').css('cursor', '-moz-grab');
|
1828 |
}
|
1829 |
-
});
|
1830 |
-
|
1831 |
-
// delete saved profiles
|
1832 |
-
$('body').on('mouseenter mouseleave', '.save-migration-profile-wrap li', function(event) {
|
1833 |
-
if( event.type === 'mouseenter' ){
|
1834 |
-
$('.delete-profile', this).show();
|
1835 |
}
|
1836 |
-
else{
|
1837 |
-
$('.delete-profile', this).hide();
|
1838 |
-
}
|
1839 |
-
});
|
1840 |
|
1841 |
-
|
1842 |
-
|
|
|
|
|
|
|
|
|
1843 |
}
|
1844 |
|
|
|
|
|
1845 |
// check for hash in url (settings || migrate) switch tabs accordingly
|
1846 |
-
if(window.location.hash) {
|
1847 |
-
|
1848 |
-
switch_to_plugin_tab(hash, false);
|
1849 |
}
|
1850 |
|
1851 |
-
if( get_query_var( 'install-plugin' )
|
1852 |
hash = 'addons';
|
1853 |
checked_licence = true;
|
1854 |
-
switch_to_plugin_tab(hash, true);
|
1855 |
-
}
|
1856 |
-
|
1857 |
-
function switch_to_plugin_tab( hash, skip_addons_check ) {
|
1858 |
-
$('.nav-tab').removeClass('nav-tab-active');
|
1859 |
-
$('.nav-tab.' + hash).addClass('nav-tab-active');
|
1860 |
-
$('.content-tab').hide();
|
1861 |
-
$('.' + hash + '-tab').show();
|
1862 |
-
|
1863 |
-
if ( hash == 'help' ) {
|
1864 |
-
refresh_debug_log();
|
1865 |
-
if( wpmdb_has_licence == '1' ) {
|
1866 |
-
$('.support-content p').append( '<img src="' + spinner_url + '" alt="" class="ajax-spinner general-spinner" />' );
|
1867 |
-
check_licence();
|
1868 |
-
checked_licence = true;
|
1869 |
-
}
|
1870 |
-
}
|
1871 |
-
|
1872 |
-
if ( hash == 'addons' && true != skip_addons_check ) {
|
1873 |
-
if( wpmdb_has_licence == '1' ) {
|
1874 |
-
$('.addons-content p').append( '<img src="' + spinner_url + '" alt="" class="ajax-spinner general-spinner" />' );
|
1875 |
-
check_licence();
|
1876 |
-
checked_licence = true;
|
1877 |
-
}
|
1878 |
-
}
|
1879 |
}
|
1880 |
|
1881 |
// process notice links clicks, eg. dismiss, reminder
|
1882 |
-
$('.notice-link').click(function
|
1883 |
e.preventDefault();
|
1884 |
-
$(this).closest('.inline-message').hide()
|
1885 |
-
$.ajax({
|
1886 |
-
url
|
1887 |
-
type
|
1888 |
dataType: 'text',
|
1889 |
-
cache
|
1890 |
-
data
|
1891 |
-
action
|
1892 |
-
nonce
|
1893 |
-
notice
|
1894 |
-
type
|
1895 |
-
reminder: $(this).data('reminder')
|
1896 |
}
|
1897 |
-
});
|
1898 |
-
});
|
1899 |
|
1900 |
// regenerates the saved secret key
|
1901 |
-
$('.reset-api-key').click(function(){
|
1902 |
var answer = confirm( wpmdb_strings.reset_api_key );
|
1903 |
|
1904 |
-
if( ! answer || doing_reset_api_key_ajax ){
|
1905 |
return;
|
1906 |
}
|
1907 |
|
1908 |
doing_reset_api_key_ajax = true;
|
1909 |
-
$('.reset-api-key').after( '<img src="' + spinner_url + '" alt="" class="reset-api-key-ajax-spinner general-spinner" />' );
|
1910 |
|
1911 |
-
$.ajax({
|
1912 |
-
url:
|
1913 |
-
type:
|
1914 |
-
dataType:
|
1915 |
-
cache:
|
1916 |
data: {
|
1917 |
-
action
|
1918 |
-
nonce
|
1919 |
},
|
1920 |
-
error: function(jqXHR, textStatus, errorThrown){
|
1921 |
alert( wpmdb_strings.reset_api_key_problem );
|
1922 |
-
$('.reset-api-key-ajax-spinner').remove();
|
1923 |
doing_reset_api_key_ajax = false;
|
1924 |
},
|
1925 |
-
success: function(data){
|
1926 |
-
$('.reset-api-key-ajax-spinner').remove();
|
1927 |
doing_reset_api_key_ajax = false;
|
1928 |
-
$('.connection-info').html(data);
|
|
|
1929 |
}
|
1930 |
-
});
|
1931 |
|
1932 |
-
});
|
1933 |
|
1934 |
// show / hide table select box when specific settings change
|
1935 |
-
$('input.multiselect-toggle').change(function(){
|
1936 |
-
$(this).parents('.expandable-content').children('.select-wrap').toggle();
|
1937 |
-
});
|
1938 |
|
1939 |
-
$('.show-multiselect').each(function(){
|
1940 |
-
if( $(this).is(':checked') ){
|
1941 |
-
$(this).parents('.option-section').children('.header-expand-collapse').children('.expand-collapse-arrow').removeClass('collapsed');
|
1942 |
-
$(this).parents('.expandable-content').show();
|
1943 |
-
$(this).parents('.expandable-content').children('.select-wrap').toggle();
|
1944 |
}
|
1945 |
-
});
|
1946 |
|
1947 |
-
$('input[name=backup_option]').change(function(){
|
1948 |
-
$('.backup-tables-wrap').hide();
|
1949 |
-
if( $(this).val()
|
1950 |
-
$('.backup-tables-wrap').show();
|
1951 |
}
|
1952 |
-
});
|
1953 |
|
1954 |
-
if( $('#backup-manual-select').is(':checked') ) {
|
1955 |
-
$('.backup-tables-wrap').show();
|
1956 |
}
|
1957 |
|
1958 |
-
$('.plugin-compatibility-save').click(function(){
|
1959 |
-
if( doing_plugin_compatibility_ajax ) {
|
1960 |
return;
|
1961 |
}
|
1962 |
-
$(this).addClass('disabled');
|
1963 |
-
select_element = $('#selected-plugins');
|
1964 |
-
$(select_element).attr('disabled','disabled');
|
1965 |
|
1966 |
doing_plugin_compatibility_ajax = true;
|
1967 |
-
$(this).after( '<img src="' + spinner_url + '" alt="" class="plugin-compatibility-spinner general-spinner" />' );
|
1968 |
|
1969 |
-
$.ajax({
|
1970 |
-
url:
|
1971 |
-
type:
|
1972 |
-
dataType:
|
1973 |
-
cache:
|
1974 |
data: {
|
1975 |
-
action
|
1976 |
-
blacklist_plugins
|
1977 |
},
|
1978 |
-
error: function(jqXHR, textStatus, errorThrown){
|
1979 |
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 );
|
1980 |
-
$(select_element).removeAttr('disabled');
|
1981 |
-
$('.plugin-compatibility-save').removeClass('disabled');
|
1982 |
doing_plugin_compatibility_ajax = false;
|
1983 |
-
$('.plugin-compatibility-spinner').remove();
|
1984 |
-
$('.plugin-compatibility-success-msg').show().fadeOut(2000);
|
1985 |
},
|
1986 |
-
success: function(data){
|
1987 |
-
if( ''
|
1988 |
alert( data );
|
1989 |
}
|
1990 |
-
$(select_element).removeAttr('disabled');
|
1991 |
-
$('.plugin-compatibility-save').removeClass('disabled');
|
1992 |
doing_plugin_compatibility_ajax = false;
|
1993 |
-
$('.plugin-compatibility-spinner').remove();
|
1994 |
-
$('.plugin-compatibility-success-msg').show().fadeOut(2000);
|
1995 |
}
|
1996 |
-
});
|
1997 |
-
});
|
1998 |
|
1999 |
// delete a profile from the migrate form area
|
2000 |
-
$('body').on('click', '.delete-profile', function(){
|
2001 |
-
var name = $(this).next().clone();
|
2002 |
-
$('input',name).remove();
|
2003 |
-
|
2004 |
-
var answer = confirm( wpmdb_strings.remove_profile
|
2005 |
|
2006 |
-
if(!answer){
|
2007 |
return;
|
2008 |
}
|
|
|
2009 |
|
2010 |
-
$
|
|
|
|
|
|
|
|
|
2011 |
|
2012 |
-
|
2013 |
-
|
2014 |
-
|
2015 |
-
|
2016 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017 |
data: {
|
2018 |
-
action
|
2019 |
-
profile_id
|
2020 |
-
nonce
|
2021 |
},
|
2022 |
-
error: function(jqXHR, textStatus, errorThrown){
|
2023 |
alert( wpmdb_strings.remove_profile_problem );
|
2024 |
},
|
2025 |
-
success: function(data){
|
2026 |
-
if( data
|
2027 |
alert( wpmdb_strings.remove_profile_not_found );
|
2028 |
}
|
2029 |
}
|
2030 |
-
});
|
2031 |
|
2032 |
-
});
|
2033 |
|
2034 |
// deletes a profile from the main profile selection screen
|
2035 |
-
$('.main-list-delete-profile-link').click(function(){
|
2036 |
-
var name = $(this).prev().html();
|
2037 |
-
var answer = confirm( wpmdb_strings.remove_profile
|
2038 |
|
2039 |
-
if(!answer){
|
2040 |
return;
|
2041 |
}
|
2042 |
|
2043 |
-
$(this).parent().fadeOut(500);
|
2044 |
|
2045 |
-
$.ajax({
|
2046 |
-
url:
|
2047 |
-
type:
|
2048 |
-
dataType:
|
2049 |
-
cache:
|
2050 |
data: {
|
2051 |
-
action
|
2052 |
-
profile_id
|
2053 |
-
nonce
|
2054 |
},
|
2055 |
-
error: function(jqXHR, textStatus, errorThrown){
|
2056 |
alert( wpmdb_strings.remove_profile_problem );
|
2057 |
}
|
2058 |
-
});
|
2059 |
|
2060 |
-
});
|
2061 |
|
2062 |
// warn the user when editing the connection info after a connection has been established
|
2063 |
-
$('body').on('click', '.temp-disabled', function() {
|
2064 |
var answer = confirm( wpmdb_strings.change_connection_info );
|
2065 |
|
2066 |
-
if( ! answer ){
|
2067 |
return;
|
2068 |
}
|
2069 |
-
else{
|
2070 |
-
$('.ssl-notice').hide();
|
2071 |
-
$('.different-plugin-version-notice').hide();
|
2072 |
-
$('.migrate-db-button').show();
|
2073 |
-
$('.temp-disabled').removeAttr('readonly');
|
2074 |
-
$('.temp-disabled').removeClass('temp-disabled');
|
2075 |
-
$('.connect-button').show();
|
2076 |
-
$('.step-two').hide();
|
2077 |
-
$('.connection-status').show().html( wpmdb_strings.enter_connection_info );
|
2078 |
connection_established = false;
|
2079 |
}
|
2080 |
-
});
|
2081 |
|
2082 |
// ajax request for settings page when checking/unchecking setting radio buttons
|
2083 |
-
$('.settings-tab input[type=checkbox]').change(function(){
|
2084 |
-
if ( 'plugin-compatibility'
|
2085 |
-
|
2086 |
-
|
2087 |
-
|
2088 |
-
$(this).
|
2089 |
-
|
2090 |
-
|
2091 |
-
|
2092 |
-
|
2093 |
-
|
2094 |
-
|
2095 |
-
|
|
|
|
|
2096 |
data: {
|
2097 |
-
action
|
2098 |
-
checked
|
2099 |
-
setting
|
2100 |
-
nonce
|
2101 |
},
|
2102 |
-
error: function(jqXHR, textStatus, errorThrown){
|
2103 |
alert( wpmdb_strings.save_settings_problem );
|
2104 |
-
$('.ajax-spinner').remove();
|
2105 |
},
|
2106 |
-
success: function(data){
|
2107 |
-
$('.ajax-spinner').remove();
|
2108 |
-
$($label).append('<span class="ajax-success-msg">' + wpmdb_strings.saved + '</span>');
|
2109 |
-
$('.ajax-success-msg').fadeOut(2000,function(){
|
2110 |
-
$(this).remove();
|
2111 |
-
});
|
2112 |
}
|
2113 |
-
});
|
2114 |
|
2115 |
-
});
|
2116 |
|
2117 |
// disable form submissions
|
2118 |
-
$('.migrate-form').submit(function(e){
|
2119 |
e.preventDefault();
|
2120 |
-
});
|
2121 |
|
2122 |
// fire connection_box_changed when the connect button is pressed
|
2123 |
-
$('.connect-button').click(function(event){
|
2124 |
event.preventDefault();
|
2125 |
-
$(this).blur();
|
2126 |
connection_box_changed();
|
2127 |
-
});
|
2128 |
|
2129 |
// send paste even to connection_box_changed() function
|
2130 |
-
$('.pull-push-connection-info').bind('paste', function(e) {
|
2131 |
var $this = this;
|
2132 |
-
setTimeout(function
|
2133 |
connection_box_changed();
|
2134 |
-
}, 0);
|
2135 |
|
2136 |
-
});
|
2137 |
|
2138 |
-
$('body').on('click', '.try-again', function(){
|
2139 |
connection_box_changed();
|
2140 |
-
});
|
2141 |
|
2142 |
-
$('body').on('click', '.try-http', function(){
|
2143 |
-
var connection_info = $.trim( $('.pull-push-connection-info').val() ).split("\n");
|
2144 |
-
var new_url = connection_info[0].replace( 'https', 'http' );
|
2145 |
-
var new_contents = new_url + "\n" + connection_info[1];
|
2146 |
-
$('.pull-push-connection-info').val( new_contents );
|
2147 |
connection_box_changed();
|
2148 |
-
});
|
2149 |
|
2150 |
-
$('.create-new-profile').change(function(){
|
2151 |
profile_name_edited = true;
|
2152 |
-
});
|
2153 |
|
2154 |
-
$('body').on('click', '.temporarily-disable-ssl', function(){
|
2155 |
-
|
2156 |
-
|
|
|
2157 |
}
|
2158 |
-
$(this).attr('href', $(this).attr('href') + '&hash=' + hash );
|
2159 |
-
});
|
2160 |
|
2161 |
// fired when the connection info box changes (e.g. gets pasted into)
|
2162 |
-
function connection_box_changed(data){
|
2163 |
-
var $this = $('.pull-push-connection-info');
|
2164 |
|
2165 |
-
if( doing_ajax || $($this).hasClass('temp-disabled') ){
|
2166 |
return;
|
2167 |
}
|
2168 |
|
2169 |
-
|
2170 |
|
2171 |
-
var connection_info = $.trim(data).split("\n");
|
2172 |
var error = false;
|
2173 |
var error_message = '';
|
2174 |
|
2175 |
-
if( connection_info
|
2176 |
error = true;
|
2177 |
error_message = wpmdb_strings.connection_info_missing;
|
2178 |
}
|
2179 |
|
2180 |
-
if( connection_info.length
|
2181 |
error = true;
|
2182 |
error_message = wpmdb_strings.connection_info_incorrect;
|
2183 |
}
|
2184 |
|
2185 |
-
if( ! error && ! validate_url( connection_info[0] ) ){
|
2186 |
error = true;
|
2187 |
error_message = wpmdb_strings.connection_info_url_invalid;
|
2188 |
}
|
2189 |
|
2190 |
-
if( ! error && connection_info[1].length < 32 ){
|
2191 |
error = true;
|
2192 |
error_message = wpmdb_strings.connection_info_key_invalid;
|
2193 |
}
|
2194 |
|
2195 |
-
if( ! error && connection_info[0]
|
2196 |
error = true;
|
2197 |
error_message = wpmdb_strings.connection_info_local_url;
|
2198 |
}
|
2199 |
|
2200 |
-
if( ! error && connection_info[1]
|
2201 |
error = true;
|
2202 |
error_message = wpmdb_strings.connection_info_local_key;
|
2203 |
}
|
2204 |
|
2205 |
-
if( error ){
|
2206 |
-
$('.connection-status').html( error_message );
|
2207 |
-
$('.connection-status').addClass( 'notification-message error-notice migration-error' );
|
2208 |
return;
|
2209 |
}
|
2210 |
|
2211 |
-
|
2212 |
-
|
2213 |
-
|
2214 |
-
|
|
|
|
|
2215 |
}
|
2216 |
|
2217 |
show_prefix_notice = false;
|
2218 |
doing_ajax = true;
|
2219 |
disable_export_type_controls();
|
2220 |
|
2221 |
-
if( $('.basic-access-auth-wrapper').is(':visible') ) {
|
2222 |
-
connection_info[0] = connection_info[0].replace( /\/\/(.*)@/, '//' );
|
2223 |
-
connection_info[0] = connection_info[0].replace( '//', '//' + encodeURIComponent( $.trim( $('.auth-username').val() ) ) + ':' + encodeURIComponent( $.trim( $('.auth-password').val() ) ) + '@' );
|
2224 |
-
|
2225 |
-
$('.pull-push-connection-info').val(new_connection_info_contents);
|
2226 |
-
$('.basic-access-auth-wrapper').hide();
|
2227 |
}
|
2228 |
|
2229 |
-
$('.step-two').hide();
|
2230 |
-
$('.ssl-notice').hide();
|
2231 |
-
$('.prefix-notice').hide();
|
2232 |
-
$('.connection-status').show();
|
2233 |
|
2234 |
-
$('.connection-status').html( wpmdb_strings.establishing_remote_connection );
|
2235 |
-
$('.connection-status').removeClass( 'notification-message error-notice migration-error' );
|
2236 |
-
$('.connection-status').append(
|
2237 |
|
2238 |
-
var intent =
|
2239 |
|
2240 |
profile_name_edited = false;
|
2241 |
|
2242 |
-
$.ajax({
|
2243 |
-
url:
|
2244 |
-
type:
|
2245 |
-
dataType:
|
2246 |
-
cache:
|
2247 |
data: {
|
2248 |
-
action
|
2249 |
-
url
|
2250 |
-
key
|
2251 |
-
intent
|
2252 |
-
nonce
|
2253 |
},
|
2254 |
-
error: function(jqXHR, textStatus, errorThrown){
|
2255 |
-
$('.connection-status').html( getAjaxErrors( jqXHR.responseText, '(#100)', jqXHR ) );
|
2256 |
-
$('.connection-status').addClass( 'notification-message error-notice migration-error' );
|
2257 |
-
$('.ajax-spinner').remove();
|
2258 |
doing_ajax = false;
|
2259 |
enable_export_type_controls();
|
2260 |
},
|
2261 |
-
success: function(data){
|
2262 |
-
$('.ajax-spinner').remove();
|
2263 |
doing_ajax = false;
|
2264 |
enable_export_type_controls();
|
|
|
2265 |
|
2266 |
-
if( typeof data.wpmdb_error
|
2267 |
-
$('.connection-status').html( data.body );
|
2268 |
-
$('.connection-status').addClass( 'notification-message error-notice migration-error' );
|
2269 |
|
2270 |
-
if( data.body.indexOf( '401 Unauthorized' ) > -1 ) {
|
2271 |
-
$('.basic-access-auth-wrapper').show();
|
2272 |
}
|
2273 |
|
2274 |
return;
|
2275 |
}
|
2276 |
|
2277 |
var profile_name = get_domain_name( data.url );
|
2278 |
-
$('.create-new-profile').val(profile_name);
|
2279 |
|
2280 |
-
$('.pull-push-connection-info').addClass('temp-disabled');
|
2281 |
-
$('.pull-push-connection-info').attr('readonly','readonly');
|
2282 |
-
$('.connect-button').hide();
|
2283 |
|
2284 |
-
$('.connection-status').hide();
|
2285 |
-
$('.step-two').show();
|
2286 |
|
2287 |
-
maybe_show_ssl_warning( connection_info[0], connection_info[1], data.scheme );
|
2288 |
maybe_show_prefix_notice( data.prefix );
|
2289 |
|
2290 |
connection_established = true;
|
2291 |
connection_data = data;
|
2292 |
move_connection_info_box();
|
|
|
2293 |
|
2294 |
maybe_show_mixed_cased_table_name_warning();
|
2295 |
|
2296 |
-
|
2297 |
-
|
2298 |
-
|
2299 |
-
|
2300 |
-
|
2301 |
-
|
2302 |
-
});
|
2303 |
-
|
2304 |
-
|
2305 |
-
|
2306 |
-
|
2307 |
-
|
2308 |
-
|
2309 |
-
|
2310 |
-
|
2311 |
-
|
2312 |
-
|
2313 |
-
|
2314 |
-
|
2315 |
-
|
2316 |
-
$
|
2317 |
-
|
2318 |
-
|
2319 |
-
|
2320 |
-
|
2321 |
-
|
2322 |
-
|
2323 |
-
|
2324 |
-
|
2325 |
-
|
2326 |
-
|
2327 |
-
pull_post_type_select = post_type_select;
|
2328 |
-
|
2329 |
-
if( $('#pull').is(':checked') ){
|
2330 |
-
$('#new-url').val( remove_protocol( wpmdb_this_url ) );
|
2331 |
-
$('#new-path').val( wpmdb_this_path );
|
2332 |
-
if( wpmdb_is_multisite == true ) {
|
2333 |
-
$('#new-domain').val( wpmdb_this_domain );
|
2334 |
}
|
2335 |
-
$('#old-url').val( remove_protocol( data.url ) );
|
2336 |
-
$('#old-path').val( data.path );
|
2337 |
-
|
2338 |
-
$('
|
2339 |
-
$('
|
2340 |
-
$('.
|
2341 |
-
$('.
|
2342 |
-
$('.uploads-dir').html(wpmdb_this_uploads_dir);
|
2343 |
}
|
2344 |
-
else{
|
2345 |
-
$('#
|
2346 |
-
$('
|
2347 |
-
|
2348 |
-
|
|
|
|
|
|
|
|
|
2349 |
}
|
2350 |
|
2351 |
-
next_step_in_migration = {
|
|
|
|
|
|
|
2352 |
execute_next_step();
|
2353 |
}
|
2354 |
|
2355 |
-
});
|
2356 |
|
2357 |
}
|
2358 |
|
2359 |
-
|
2360 |
-
|
2361 |
-
|
2362 |
-
|
2363 |
-
$('.progress-title').html(previous_progress_title);
|
2364 |
-
$('.progress-text').html(previous_progress_text);
|
2365 |
-
$('.migration-progress-ajax-spinner').show();
|
2366 |
-
$('.pause-resume').html(wpmdb_strings.pause);
|
2367 |
-
// resume the timer
|
2368 |
-
elapsed_interval = setInterval(count,1000);
|
2369 |
-
execute_next_step();
|
2370 |
-
}
|
2371 |
-
else {
|
2372 |
-
migration_paused = true;
|
2373 |
-
doing_ajax = false;
|
2374 |
-
previous_progress_title = $('.progress-title').html();
|
2375 |
-
previous_progress_text = $('.progress-text').html();
|
2376 |
-
$('.progress-title').html(wpmdb_strings.migration_paused);
|
2377 |
-
$('.pause-resume').html(wpmdb_strings.resume);
|
2378 |
-
$('.progress-text').html(wpmdb_strings.completing_current_request);
|
2379 |
-
}
|
2380 |
-
});
|
2381 |
|
2382 |
-
|
2383 |
migration_cancelled = true;
|
2384 |
-
|
2385 |
-
$('.progress-
|
2386 |
-
$('.
|
2387 |
-
$('.migration-
|
2388 |
-
$('.migration-progress-ajax-spinner').show();
|
2389 |
|
2390 |
-
if(
|
|
|
2391 |
execute_next_step();
|
2392 |
}
|
2393 |
-
}
|
2394 |
|
2395 |
-
$('
|
2396 |
-
|
2397 |
-
|
2398 |
-
|
|
|
|
|
|
|
|
|
2399 |
|
2400 |
execute_next_step = function() {
|
2401 |
-
|
2402 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2403 |
// pause the timer
|
2404 |
clearInterval( elapsed_interval );
|
2405 |
-
$('.progress-text').html(wpmdb_strings.paused);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2406 |
return;
|
2407 |
}
|
2408 |
-
else if( true
|
2409 |
-
migration_intent =
|
|
|
|
|
2410 |
|
2411 |
-
if( 'savefile'
|
2412 |
progress_msg = wpmdb_strings.removing_local_sql;
|
2413 |
}
|
2414 |
-
else if( 'pull'
|
2415 |
-
if( 'backup'
|
2416 |
progress_msg = wpmdb_strings.removing_local_backup;
|
2417 |
}
|
2418 |
else {
|
2419 |
progress_msg = wpmdb_strings.removing_local_temp_tables;
|
2420 |
}
|
2421 |
}
|
2422 |
-
else if( 'push'
|
2423 |
-
if( 'backup'
|
2424 |
progress_msg = wpmdb_strings.removing_remote_sql;
|
2425 |
}
|
2426 |
else {
|
2427 |
progress_msg = wpmdb_strings.removing_remote_temp_tables;
|
2428 |
}
|
2429 |
}
|
2430 |
-
$('.progress-text').html(progress_msg);
|
2431 |
-
|
2432 |
-
var request_data =
|
2433 |
-
action
|
2434 |
-
|
2435 |
-
url : remote_site,
|
2436 |
-
key : secret_key,
|
2437 |
-
stage : stage,
|
2438 |
-
dump_filename : dump_filename,
|
2439 |
-
form_data : form_data,
|
2440 |
};
|
2441 |
|
2442 |
-
|
2443 |
-
request_data.temp_prefix = connection_data.temp_prefix;
|
2444 |
-
}
|
2445 |
|
2446 |
-
$.ajax({
|
2447 |
-
url:
|
2448 |
-
type:
|
2449 |
-
dataType:
|
2450 |
-
cache:
|
2451 |
-
data:
|
2452 |
-
error: function(jqXHR, textStatus, errorThrown){
|
2453 |
-
$('.progress-title').html(wpmdb_strings.migration_cancellation_failed);
|
2454 |
-
$('.progress-text').html(wpmdb_strings.manually_remove_temp_files);
|
2455 |
-
$('.progress-text').append( '<br /><br />' + wpmdb_strings.status + ': ' + jqXHR.status + ' ' + jqXHR.statusText + '<br /><br />' + wpmdb_strings.response + ':<br />' + jqXHR.responseText );
|
2456 |
-
$('.progress-text').addClass( 'migration-error' );
|
2457 |
console.log( jqXHR );
|
2458 |
console.log( textStatus );
|
2459 |
console.log( errorThrown );
|
|
|
2460 |
migration_error = true;
|
2461 |
migration_complete_events();
|
2462 |
return;
|
2463 |
},
|
2464 |
-
success: function(data){
|
2465 |
doing_ajax = false;
|
2466 |
data = $.trim( data );
|
2467 |
-
if( data
|
2468 |
-
$('.progress-title').html(wpmdb_strings.migration_cancellation_failed);
|
2469 |
-
$('.progress-text').html(data);
|
2470 |
-
$('.progress-text').addClass('migration-error');
|
2471 |
migration_error = true;
|
2472 |
migration_complete_events();
|
2473 |
return;
|
2474 |
}
|
2475 |
completed_msg = wpmdb_strings.migration_cancelled;
|
2476 |
-
$('.progress-text').hide();
|
2477 |
migration_complete_events();
|
2478 |
}
|
2479 |
-
});
|
2480 |
}
|
2481 |
else {
|
2482 |
next_step_in_migration.fn.apply( null, next_step_in_migration.args );
|
2483 |
}
|
2484 |
-
}
|
2485 |
|
2486 |
-
$('body').on('click','.copy-licence-to-remote-site',function(){
|
2487 |
-
$('.connection-status').html( wpmdb_strings.copying_license );
|
2488 |
-
$('.connection-status').removeClass( 'notification-message error-notice migration-error' );
|
2489 |
-
$('.connection-status').append(
|
2490 |
|
2491 |
-
var connection_info = $.trim( $('.pull-push-connection-info').val() ).split("\n");
|
2492 |
|
2493 |
doing_ajax = true;
|
2494 |
disable_export_type_controls();
|
2495 |
|
2496 |
-
$.ajax({
|
2497 |
-
url:
|
2498 |
-
type:
|
2499 |
-
dataType:
|
2500 |
-
cache:
|
2501 |
data: {
|
2502 |
-
action
|
2503 |
-
url
|
2504 |
-
key
|
2505 |
-
nonce
|
2506 |
},
|
2507 |
-
error: function(jqXHR, textStatus, errorThrown){
|
2508 |
-
$('.connection-status').html( getAjaxErrors( jqXHR.responseText, '(#143)', jqXHR ) );
|
2509 |
-
$('.connection-status').addClass( 'notification-message error-notice migration-error' );
|
2510 |
-
$('.ajax-spinner').remove();
|
2511 |
doing_ajax = false;
|
2512 |
enable_export_type_controls();
|
2513 |
},
|
2514 |
-
success: function(data){
|
2515 |
-
$('.ajax-spinner').remove();
|
2516 |
doing_ajax = false;
|
2517 |
enable_export_type_controls();
|
2518 |
|
2519 |
-
if( typeof data.wpmdb_error
|
2520 |
-
$('.connection-status').html( data.body );
|
2521 |
-
$('.connection-status').addClass( 'notification-message error-notice migration-error' );
|
2522 |
|
2523 |
-
if( data.body.indexOf( '401 Unauthorized' ) > -1 ) {
|
2524 |
-
$('.basic-access-auth-wrapper').show();
|
2525 |
}
|
2526 |
|
2527 |
return;
|
2528 |
}
|
2529 |
connection_box_changed();
|
2530 |
}
|
2531 |
-
});
|
2532 |
-
});
|
2533 |
|
2534 |
-
$('body').on('click', '.reactivate-licence', function(e){
|
2535 |
doing_ajax = true;
|
2536 |
|
2537 |
-
$('.invalid-licence').empty().html(wpmdb_strings.attempting_to_activate_licence);
|
2538 |
-
$('.invalid-licence').append(
|
2539 |
|
2540 |
-
$.ajax({
|
2541 |
-
url:
|
2542 |
-
type:
|
2543 |
-
dataType:
|
2544 |
-
cache:
|
2545 |
data: {
|
2546 |
-
action
|
2547 |
-
nonce
|
2548 |
},
|
2549 |
-
error: function(jqXHR, textStatus, errorThrown){
|
2550 |
-
$('.invalid-licence').html( wpmdb_strings.activate_licence_problem );
|
2551 |
-
$('.invalid-licence').append( '<br /><br />' + wpmdb_strings.status + ': ' + jqXHR.status + ' ' + jqXHR.statusText + '<br /><br />' + wpmdb_strings.response + '<br />' + jqXHR.responseText );
|
2552 |
-
$('.ajax-spinner').remove();
|
2553 |
doing_ajax = false;
|
2554 |
},
|
2555 |
-
success: function(data){
|
2556 |
-
$('.ajax-spinner').remove();
|
2557 |
doing_ajax = false;
|
2558 |
|
2559 |
-
if( typeof data.wpmdb_error
|
2560 |
-
$('.invalid-licence').html( data.body );
|
2561 |
return;
|
2562 |
}
|
2563 |
|
2564 |
-
if( typeof data.wpmdb_dbrains_api_down
|
2565 |
-
$('.invalid-licence').html( wpmdb_strings.temporarily_activated_licence );
|
2566 |
-
$('.invalid-licence').append( data.body );
|
2567 |
return;
|
2568 |
}
|
2569 |
|
2570 |
-
$('.invalid-licence').empty().html(wpmdb_strings.licence_reactivated);
|
2571 |
location.reload();
|
2572 |
}
|
2573 |
-
});
|
2574 |
|
2575 |
-
});
|
2576 |
|
2577 |
-
$('input[name=table_migrate_option]').change(function(){
|
2578 |
maybe_show_mixed_cased_table_name_warning();
|
2579 |
-
});
|
2580 |
|
2581 |
-
$('body').on('change','#select-tables',function(){
|
2582 |
maybe_show_mixed_cased_table_name_warning();
|
2583 |
-
});
|
2584 |
-
|
2585 |
-
});
|
2586 |
|
2587 |
-
})(jQuery);
|
3 |
var migration_complete_events;
|
4 |
var migrate_table_recursive;
|
5 |
var execute_next_step;
|
6 |
+
var wpmdb_flush;
|
7 |
|
8 |
+
(function( $ ) {
|
9 |
|
10 |
+
var migration_state_id = '';
|
11 |
var connection_established = false;
|
12 |
var last_replace_switch = '';
|
13 |
var doing_ajax = false;
|
23 |
var migration_completed = false;
|
24 |
var currently_migrating = false;
|
25 |
var dump_filename = '';
|
26 |
+
var dump_path = '';
|
|
|
27 |
var migration_intent;
|
28 |
var remote_site;
|
29 |
var secret_key;
|
33 |
var completed_msg;
|
34 |
var tables_to_migrate = '';
|
35 |
var migration_paused = false;
|
36 |
+
var previous_progress_title = '';
|
37 |
+
var previous_progress_text = '';
|
38 |
+
var timer_count = 0;
|
39 |
+
var overall_percent = 0;
|
40 |
var migration_cancelled = false;
|
41 |
+
var counter_display = false;
|
42 |
+
var counter_label = '';
|
43 |
+
var flag_skip_delay = false;
|
44 |
+
var delay_between_requests = 0;
|
45 |
+
var fade_duration = 400;
|
46 |
|
47 |
var admin_url = ajaxurl.replace( '/admin-ajax.php', '' ), spinner_url = admin_url + '/images/spinner';
|
48 |
|
49 |
+
if ( window.devicePixelRatio >= 2 ) {
|
50 |
spinner_url += '-2x';
|
51 |
}
|
|
|
52 |
spinner_url += '.gif';
|
53 |
+
var ajax_spinner = '<img src="' + spinner_url + '" alt="" class="ajax-spinner general-spinner" />';
|
54 |
|
55 |
+
window.onbeforeunload = function( e ) {
|
56 |
+
if ( currently_migrating ) {
|
57 |
e = e || window.event;
|
58 |
|
59 |
// For IE and Firefox prior to version 4
|
60 |
+
if ( e ) {
|
61 |
e.returnValue = wpmdb_strings.sure;
|
62 |
}
|
63 |
|
66 |
}
|
67 |
};
|
68 |
|
69 |
+
function pad( n, width, z ) {
|
70 |
z = z || '0';
|
71 |
n = n + '';
|
72 |
+
return n.length >= width ? n : new Array( width - n.length + 1 ).join( z ) + n;
|
73 |
}
|
74 |
|
75 |
+
function is_int( n ) {
|
76 |
+
n = parseInt( n );
|
77 |
+
return typeof n === 'number' && n % 1 === 0;
|
78 |
}
|
79 |
|
80 |
function setup_counter() {
|
81 |
+
timer_count = 0;
|
82 |
+
counter_display = $( '.timer' );
|
83 |
+
counter_label = wpmdb_strings.time_elapsed + ' ';
|
84 |
|
85 |
+
elapsed_interval = setInterval( count, 1000 );
|
86 |
}
|
87 |
|
88 |
function display_count() {
|
89 |
+
var hours = Math.floor( timer_count / 3600 ) % 24;
|
90 |
+
var minutes = Math.floor( timer_count / 60 ) % 60;
|
91 |
+
var seconds = timer_count % 60;
|
92 |
+
var display = counter_label + pad( hours, 2, 0 ) + ':' + pad( minutes, 2, 0 ) + ':' + pad( seconds, 2, 0 );
|
93 |
+
counter_display.html( display );
|
94 |
}
|
95 |
|
96 |
function count() {
|
98 |
display_count();
|
99 |
}
|
100 |
|
101 |
+
function get_intersect( arr1, arr2 ) {
|
102 |
var r = [], o = {}, l = arr2.length, i, v;
|
103 |
+
for ( i = 0; i < l; i++ ) {
|
104 |
+
o[ arr2[ i ] ] = true;
|
105 |
}
|
106 |
l = arr1.length;
|
107 |
+
for ( i = 0; i < l; i++ ) {
|
108 |
+
v = arr1[ i ];
|
109 |
+
if ( v in o ) {
|
110 |
+
r.push( v );
|
111 |
}
|
112 |
}
|
113 |
return r;
|
114 |
}
|
115 |
|
116 |
+
function get_query_var( name ) {
|
117 |
+
name = name.replace( /[\[]/, "\\[" ).replace( /[\]]/, "\\]" );
|
118 |
+
var regex = new RegExp( "[\\?&]" + name + "=([^&#]*)" ),
|
119 |
+
results = regex.exec( location.search );
|
120 |
+
return results === null ? "" : decodeURIComponent( results[ 1 ].replace( /\+/g, " " ) );
|
121 |
}
|
122 |
|
123 |
function maybe_show_ssl_warning( url, key, remote_scheme ) {
|
124 |
+
var scheme = url.substr( 0, url.indexOf( ':' ) );
|
125 |
+
if ( remote_scheme !== scheme && url.indexOf( 'https' ) !== -1 ) {
|
126 |
+
$( '.ssl-notice' ).show();
|
127 |
show_ssl_notice = true;
|
128 |
+
url = url.replace( 'https', 'http' );
|
129 |
+
$( '.pull-push-connection-info' ).val( url + "\n" + key );
|
130 |
return;
|
131 |
}
|
132 |
show_ssl_notice = false;
|
134 |
}
|
135 |
|
136 |
function maybe_show_prefix_notice( prefix ) {
|
137 |
+
if ( prefix !== wpmdb_data.this_prefix ) {
|
138 |
+
$( '.remote-prefix' ).html( prefix );
|
139 |
show_prefix_notice = true;
|
140 |
+
if ( 'pull' === wpmdb_migration_type() ) {
|
141 |
+
$( '.prefix-notice.pull' ).show();
|
142 |
}
|
143 |
else {
|
144 |
+
$( '.prefix-notice.push' ).show();
|
145 |
}
|
146 |
}
|
147 |
}
|
148 |
|
149 |
function maybe_show_mixed_cased_table_name_warning() {
|
150 |
+
if ( 'undefined' === typeof connection_data || false === connection_data ) {
|
151 |
return;
|
152 |
}
|
153 |
|
154 |
+
var migration_intent = wpmdb_migration_type();
|
155 |
var table_intent = $( 'input[name=table_migrate_option]:checked' ).val();
|
156 |
var tables_to_migrate;
|
157 |
|
158 |
$( '.mixed-case-table-name-notice' ).hide();
|
159 |
|
160 |
+
if ( 'migrate_select' === table_intent ) {
|
161 |
tables_to_migrate = $( '#select-tables' ).val();
|
162 |
} else {
|
163 |
+
if ( 'push' === migration_intent || 'savefile' === migration_intent ) {
|
164 |
+
tables_to_migrate = wpmdb_data.this_prefixed_tables;
|
165 |
} else {
|
166 |
tables_to_migrate = connection_data.prefixed_tables;
|
167 |
}
|
174 |
tables_to_migrate = tables_to_migrate.join( '' );
|
175 |
|
176 |
// The table names are all lowercase, no need to display the warning.
|
177 |
+
if ( tables_to_migrate === tables_to_migrate.toLowerCase() ) {
|
178 |
return;
|
179 |
}
|
180 |
|
182 |
* Do not display the warning if the remote lower_case_table_names does not equal "1" (i.e the only problematic setting)
|
183 |
* Applies to push/export migrations.
|
184 |
*/
|
185 |
+
if ( '1' !== connection_data.lower_case_table_names && ( 'push' === migration_intent || 'savefile' === migration_intent ) ) {
|
186 |
return;
|
187 |
}
|
188 |
|
190 |
* Do not display the warning if the local lower_case_table_names does not equal "1" (i.e the only problematic setting)
|
191 |
* Only applies to pull migrations.
|
192 |
*/
|
193 |
+
if ( '1' !== wpmdb_data.lower_case_table_names && 'pull' === migration_intent ) {
|
194 |
return;
|
195 |
}
|
196 |
|
201 |
* 3. The source database table containing the uppercase letter will be converted to lowercase during the migration.
|
202 |
*/
|
203 |
|
204 |
+
if ( 'push' === migration_intent || 'savefile' === migration_intent ) {
|
205 |
$( '.mixed-case-table-name-notice.push' ).show();
|
206 |
} else {
|
207 |
$( '.mixed-case-table-name-notice.pull' ).show();
|
208 |
}
|
209 |
}
|
210 |
|
211 |
+
function get_domain_name( url ) {
|
212 |
var temp_url = url;
|
213 |
+
var domain = temp_url.replace( /\/\/(.*)@/, '//' ).replace( 'http://', '' ).replace( 'https://', '' ).replace( 'www.', '' );
|
214 |
return domain;
|
215 |
}
|
216 |
|
217 |
+
function get_migration_status_label( url, intent, stage ) {
|
218 |
+
var domain = get_domain_name( url );
|
219 |
var migrating_stage_label, completed_stage_label;
|
220 |
+
if ( intent === 'pull' ) {
|
221 |
migrating_stage_label = wpmdb_strings.pull_migration_label_migrating;
|
222 |
completed_stage_label = wpmdb_strings.pull_migration_label_completed;
|
223 |
} else {
|
228 |
migrating_stage_label = migrating_stage_label.replace( '%s', domain );
|
229 |
completed_stage_label = completed_stage_label.replace( '%s', domain );
|
230 |
|
231 |
+
if ( 'migrating' === stage ) {
|
232 |
return migrating_stage_label;
|
233 |
} else {
|
234 |
return completed_stage_label;
|
236 |
}
|
237 |
|
238 |
function remove_protocol( url ) {
|
239 |
+
return url.replace( /^https?:/i, "" );
|
240 |
}
|
241 |
|
242 |
function disable_export_type_controls() {
|
243 |
+
$( '.option-group' ).each( function( index ) {
|
244 |
+
$( 'input', this ).attr( 'disabled', 'disabled' );
|
245 |
+
$( 'label', this ).css( 'cursor', 'default' );
|
246 |
+
} );
|
247 |
}
|
248 |
|
249 |
function enable_export_type_controls() {
|
250 |
+
$( '.option-group' ).each( function( index ) {
|
251 |
+
$( 'input', this ).removeAttr( 'disabled' );
|
252 |
+
$( 'label', this ).css( 'cursor', 'pointer' );
|
253 |
+
} );
|
254 |
+
}
|
255 |
+
|
256 |
+
function set_slider_value( parent_selector, value, unit ) {
|
257 |
+
$( '.slider', parent_selector ).slider( 'value', value );
|
258 |
+
$( '.amount', parent_selector ).html( wpmdb_add_commas( value ) + ' ' + unit );
|
259 |
}
|
260 |
|
261 |
+
function set_pause_resume_button( event ) {
|
262 |
+
if ( true === migration_paused ) {
|
263 |
+
migration_paused = false;
|
264 |
+
doing_ajax = true;
|
265 |
+
$( '.progress-title' ).html( previous_progress_title );
|
266 |
+
$( '.progress-text' ).html( previous_progress_text );
|
267 |
+
$( '.migration-progress-ajax-spinner' ).show();
|
268 |
+
$( '.pause-resume' ).html( wpmdb_strings.pause );
|
269 |
+
// resume the timer
|
270 |
+
elapsed_interval = setInterval( count, 1000 );
|
271 |
+
execute_next_step();
|
272 |
+
} else {
|
273 |
+
migration_paused = true;
|
274 |
+
doing_ajax = false;
|
275 |
+
previous_progress_title = $( '.progress-title' ).html();
|
276 |
+
previous_progress_text = $( '.progress-text' ).html();
|
277 |
+
$( '.progress-title' ).html( wpmdb_strings.migration_paused );
|
278 |
+
$( '.progress-text' ).html( wpmdb_strings.completing_current_request );
|
279 |
+
$( 'body' ).off( 'click', '.pause-resume' ); // Is re-bound at execute_next_step when migration is finally paused
|
280 |
+
$( 'body' ).off( 'click', '.cancel' ); // Is re-bound at execute_next_step when migration is finally paused
|
281 |
+
}
|
282 |
+
}
|
283 |
|
284 |
+
function create_table_select( tables, table_sizes_hr, selected_tables ) {
|
285 |
+
var $table_select = document.createElement( 'select' );
|
286 |
+
$( $table_select ).attr( {
|
287 |
+
multiple: 'multiple',
|
288 |
+
name: 'select_tables[]',
|
289 |
+
id: 'select-tables',
|
290 |
+
class: 'multiselect'
|
291 |
+
} );
|
292 |
+
|
293 |
+
if ( 0 < tables.length ) {
|
294 |
+
$.each( tables, function( index, table ) {
|
295 |
+
if ( $.wpmdb.apply_filters( 'wpmdb_exclude_table', false, table ) ) {
|
296 |
+
return;
|
297 |
+
}
|
298 |
+
|
299 |
+
var selected = ' ';
|
300 |
+
if ( undefined !== selected_tables && null !== selected_tables && 0 < selected_tables.length && -1 !== $.inArray( table, selected_tables ) ) {
|
301 |
+
selected = ' selected="selected" ';
|
302 |
+
}
|
303 |
+
$( $table_select ).append( '<option' + selected + 'value="' + table + '">' + table + ' (' + table_sizes_hr[ table ] + ')</option>' );
|
304 |
+
} );
|
305 |
+
}
|
306 |
+
|
307 |
+
return $table_select;
|
308 |
+
}
|
309 |
+
|
310 |
+
$( document ).ready( function() {
|
311 |
+
|
312 |
+
$( '#plugin-compatibility' ).change( function( e ) {
|
313 |
var install = '1';
|
314 |
+
if ( $( this ).is( ':checked' ) ) {
|
315 |
var answer = confirm( wpmdb_strings.mu_plugin_confirmation );
|
316 |
|
317 |
+
if ( ! answer ) {
|
318 |
+
$( this ).prop( 'checked', false );
|
319 |
return;
|
320 |
}
|
321 |
}
|
323 |
install = '0';
|
324 |
}
|
325 |
|
326 |
+
$( '.plugin-compatibility-wrap' ).toggle();
|
327 |
|
328 |
+
$( this ).parent().append( ajax_spinner );
|
329 |
+
$( '#plugin-compatibility' ).attr( 'disabled', 'disabled' );
|
330 |
+
$( '.plugin-compatibility' ).addClass( 'disabled' );
|
331 |
|
332 |
+
$.ajax( {
|
333 |
+
url: ajaxurl,
|
334 |
+
type: 'POST',
|
335 |
+
dataType: 'text',
|
336 |
+
cache: false,
|
337 |
data: {
|
338 |
+
action: 'wpmdb_plugin_compatibility',
|
339 |
+
install: install
|
340 |
},
|
341 |
+
error: function( jqXHR, textStatus, errorThrown ) {
|
342 |
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 );
|
343 |
+
$( '.ajax-spinner' ).remove();
|
344 |
+
$( '#plugin-compatibility' ).removeAttr( 'disabled' );
|
345 |
+
$( '.plugin-compatibility' ).removeClass( 'disabled' );
|
346 |
},
|
347 |
+
success: function( data ) {
|
348 |
+
if ( '' !== $.trim( data ) ) {
|
349 |
alert( data );
|
350 |
}
|
351 |
else {
|
352 |
+
$( '.plugin-compatibility' ).append( '<span class="ajax-success-msg">' + wpmdb_strings.saved + '</span>' );
|
353 |
+
$( '.ajax-success-msg' ).fadeOut( 2000, function() {
|
354 |
+
$( this ).remove();
|
355 |
+
} );
|
356 |
}
|
357 |
+
$( '.ajax-spinner' ).remove();
|
358 |
+
$( '#plugin-compatibility' ).removeAttr( 'disabled' );
|
359 |
+
$( '.plugin-compatibility' ).removeClass( 'disabled' );
|
360 |
}
|
361 |
+
} );
|
362 |
|
363 |
+
} );
|
364 |
|
365 |
+
if ( $( '#plugin-compatibility' ).is( ':checked' ) ) {
|
366 |
+
$( '.plugin-compatibility-wrap' ).show();
|
367 |
}
|
368 |
|
369 |
+
if ( navigator.userAgent.indexOf( 'MSIE' ) > 0 || navigator.userAgent.indexOf( 'Trident' ) > 0 ) {
|
370 |
+
$( '.ie-warning' ).show();
|
371 |
}
|
372 |
|
373 |
+
if ( 0 === wpmdb_data.valid_licence ) {
|
374 |
+
$( '#savefile' ).prop( "checked", true );
|
375 |
}
|
376 |
+
var max_request_size_container = $( '.max-request-size' );
|
377 |
+
var max_request_size_slider = $( '.slider', max_request_size_container );
|
378 |
+
max_request_size_slider.slider( {
|
379 |
+
range: 'min',
|
380 |
+
value: parseInt( wpmdb_data.max_request / 1024 ),
|
381 |
+
min: 512,
|
382 |
+
max: parseInt( wpmdb_data.bottleneck / 1024 ),
|
383 |
+
step: 1,
|
384 |
+
create: function( event, ui ) {
|
385 |
+
set_slider_value( max_request_size_container, wpmdb_data.max_request / 1024, 'kB' );
|
386 |
+
},
|
387 |
slide: function( event, ui ) {
|
388 |
+
set_slider_value( max_request_size_container, ui.value, 'kB' );
|
389 |
},
|
390 |
+
stop: function( event, ui ) {
|
391 |
+
$( '.amount', max_request_size_container ).after( '<img src="' + spinner_url + '" alt="" class="slider-spinner general-spinner" />' );
|
392 |
+
max_request_size_slider.slider( 'disable' );
|
393 |
+
|
394 |
+
$.ajax( {
|
395 |
+
url: ajaxurl,
|
396 |
+
type: 'POST',
|
397 |
+
cache: false,
|
398 |
data: {
|
399 |
+
action: 'wpmdb_update_max_request_size',
|
400 |
+
max_request_size: parseInt( ui.value ),
|
401 |
+
nonce: wpmdb_data.nonces.update_max_request_size
|
402 |
},
|
403 |
+
error: function( jqXHR, textStatus, errorThrown ) {
|
404 |
+
max_request_size_slider.slider( 'enable' );
|
405 |
+
$( '.slider-spinner', max_request_size_container ).remove();
|
406 |
alert( wpmdb_strings.max_request_size_problem );
|
407 |
+
set_slider_value( max_request_size_container, wpmdb_data.max_request / 1024, 'kB' );
|
408 |
+
max_request_size_slider.slider( 'enable' );
|
409 |
+
},
|
410 |
+
success: function() {
|
411 |
+
max_request_size_slider.slider( 'enable' );
|
412 |
+
$( '.slider-success-msg', max_request_size_container ).show();
|
413 |
+
$( '.slider-success-msg', max_request_size_container ).fadeOut( 2000, function() {
|
414 |
+
$( this ).hide();
|
415 |
+
} );
|
416 |
+
$( '.slider-spinner', max_request_size_container ).remove();
|
417 |
+
}
|
418 |
+
} );
|
419 |
+
}
|
420 |
+
} );
|
421 |
+
|
422 |
+
var delay_between_requests_container = $( '.delay-between-requests' );
|
423 |
+
var delay_between_requests_slider = $( '.slider', delay_between_requests_container );
|
424 |
+
delay_between_requests_slider.slider( {
|
425 |
+
range: 'min',
|
426 |
+
value: parseInt( wpmdb_data.delay_between_requests / 1000 ),
|
427 |
+
min: 0,
|
428 |
+
max: 10,
|
429 |
+
step: 1,
|
430 |
+
create: function( event, ui ) {
|
431 |
+
set_slider_value( delay_between_requests_container, wpmdb_data.delay_between_requests / 1000, 's' );
|
432 |
+
},
|
433 |
+
slide: function( event, ui ) {
|
434 |
+
set_slider_value( delay_between_requests_container, ui.value, 's' );
|
435 |
+
},
|
436 |
+
stop: function( event, ui ) {
|
437 |
+
$( '.amount', delay_between_requests_container ).after( '<img src="' + spinner_url + '" alt="" class="slider-spinner general-spinner" />' );
|
438 |
+
delay_between_requests_slider.slider( 'disable' );
|
439 |
+
|
440 |
+
$.ajax( {
|
441 |
+
url: ajaxurl,
|
442 |
+
type: 'POST',
|
443 |
+
cache: false,
|
444 |
+
data: {
|
445 |
+
action: 'wpmdb_update_delay_between_requests',
|
446 |
+
delay_between_requests: parseInt( ui.value * 1000 ),
|
447 |
+
nonce: wpmdb_data.nonces.update_delay_between_requests
|
448 |
+
},
|
449 |
+
error: function( jqXHR, textStatus, errorThrown ) {
|
450 |
+
delay_between_requests_slider.slider( 'enable' );
|
451 |
+
$( '.slider-spinner', delay_between_requests_container ).remove();
|
452 |
+
alert( wpmdb_strings.delay_between_requests_problem );
|
453 |
+
set_slider_value( delay_between_requests_container, wpmdb_data.delay_between_requests / 1000, 's' );
|
454 |
+
delay_between_requests_slider.slider( 'enable' );
|
455 |
},
|
456 |
+
success: function() {
|
457 |
+
wpmdb_data.delay_between_requests = parseInt( ui.value * 1000 );
|
458 |
+
delay_between_requests_slider.slider( 'enable' );
|
459 |
+
$( '.slider-success-msg', delay_between_requests_container ).show();
|
460 |
+
$( '.slider-success-msg', delay_between_requests_container ).fadeOut( 2000, function() {
|
461 |
+
$( this ).hide();
|
462 |
+
} );
|
463 |
+
$( '.slider-spinner', delay_between_requests_container ).remove();
|
464 |
}
|
465 |
+
} );
|
466 |
}
|
467 |
+
} );
|
|
|
468 |
|
469 |
+
var $progress_content_original = $( '.progress-content' ).clone();
|
470 |
+
$( '.progress-content' ).remove();
|
471 |
|
472 |
+
var $push_select = $( '#select-tables' ).clone();
|
473 |
+
var $pull_select = $( '#select-tables' ).clone();
|
474 |
+
var $push_post_type_select = $( '#select-post-types' ).clone();
|
475 |
+
var $pull_post_type_select = $( '#select-post-types' ).clone();
|
476 |
+
var $push_select_backup = $( '#select-backup' ).clone();
|
477 |
+
var $pull_select_backup = $( '#select-backup' ).clone();
|
478 |
|
479 |
+
$( '.help-tab .video' ).each( function() {
|
480 |
+
var $container = $( this ),
|
481 |
+
$viewer = $( '.video-viewer' );
|
482 |
|
483 |
+
$( 'a', this ).click( function( e ) {
|
484 |
e.preventDefault();
|
485 |
|
486 |
+
$viewer.attr( 'src', '//www.youtube.com/embed/' + $container.data( 'video-id' ) + '?autoplay=1' );
|
487 |
$viewer.show();
|
488 |
var offset = $viewer.offset();
|
489 |
+
$( window ).scrollTop( offset.top - 50 );
|
490 |
+
} );
|
491 |
+
} );
|
492 |
+
|
493 |
+
$( '.backup-options' ).show();
|
494 |
+
$( '.keep-active-plugins' ).show();
|
495 |
+
if ( 'savefile' === wpmdb_migration_type() ) {
|
496 |
+
$( '.backup-options' ).hide();
|
497 |
+
$( '.keep-active-plugins' ).hide();
|
498 |
}
|
499 |
|
500 |
+
last_replace_switch = wpmdb_migration_type();
|
501 |
+
|
502 |
+
function check_licence( licence ) {
|
503 |
+
checked_licence = true;
|
504 |
+
$.ajax( {
|
505 |
+
url: ajaxurl,
|
506 |
+
type: 'POST',
|
507 |
+
dataType: 'json',
|
508 |
+
cache: false,
|
509 |
data: {
|
510 |
+
action: 'wpmdb_check_licence',
|
511 |
+
licence: licence,
|
512 |
+
context: 'all',
|
513 |
+
nonce: wpmdb_data.nonces.check_licence
|
514 |
},
|
515 |
+
error: function( jqXHR, textStatus, errorThrown ) {
|
516 |
alert( wpmdb_strings.license_check_problem );
|
517 |
},
|
518 |
+
success: function( data ) {
|
519 |
+
|
520 |
+
var $support_content = $( '.support-content' );
|
521 |
+
var $addons_content = $( '.addons-content' );
|
522 |
+
var $licence_content = $( '.licence-status:not(.notification-message)' );
|
523 |
+
var licence_msg, support_msg, addons_msg;
|
524 |
+
|
525 |
+
if ( 'undefined' !== typeof data.dbrains_api_down ) {
|
526 |
+
support_msg = data.dbrains_api_down + data.message;
|
527 |
+
addons_msg = data.dbrains_api_down;
|
528 |
}
|
529 |
+
else if ( 'undefined' !== typeof data.errors ) {
|
530 |
+
|
531 |
+
if ( 'undefined' !== typeof data.errors.subscription_expired ) {
|
532 |
+
licence_msg = data.errors.subscription_expired.licence;
|
533 |
+
support_msg = data.errors.subscription_expired.support;
|
534 |
+
addons_msg = data.errors.subscription_expired.addons;
|
535 |
+
} else {
|
536 |
+
var msg = '';
|
537 |
+
for ( var key in data.errors ) {
|
538 |
+
msg += data.errors[ key ];
|
539 |
+
}
|
540 |
+
support_msg = msg;
|
541 |
+
addons_msg = msg;
|
542 |
+
}
|
543 |
+
if ( 'undefined' !== typeof data.addon_content ) {
|
544 |
+
addons_msg += "\n" + data.addon_content;
|
545 |
}
|
|
|
|
|
546 |
}
|
547 |
else {
|
548 |
+
support_msg = data.message;
|
549 |
+
addons_msg = data.addon_content;
|
550 |
}
|
551 |
+
|
552 |
+
$licence_content.stop().fadeOut( fade_duration, function() {
|
553 |
+
$( this )
|
554 |
+
.empty()
|
555 |
+
.html( licence_msg )
|
556 |
+
.stop()
|
557 |
+
.fadeIn( fade_duration );
|
558 |
+
} );
|
559 |
+
$support_content.stop().fadeOut( fade_duration, function() {
|
560 |
+
$( this )
|
561 |
+
.empty()
|
562 |
+
.html( support_msg )
|
563 |
+
.stop()
|
564 |
+
.fadeIn( fade_duration );
|
565 |
+
} );
|
566 |
+
$addons_content.stop().fadeOut( fade_duration, function() {
|
567 |
+
$( this )
|
568 |
+
.empty()
|
569 |
+
.html( addons_msg )
|
570 |
+
.stop()
|
571 |
+
.fadeIn( fade_duration );
|
572 |
+
} );
|
573 |
+
|
574 |
}
|
575 |
+
} );
|
576 |
}
|
577 |
|
578 |
+
/**
|
579 |
+
* Handle 'Check License Again' functionality found in expired license messages.
|
580 |
+
*/
|
581 |
+
$( '.content-tab' ).on( 'click', '.check-my-licence-again', function( e ) {
|
582 |
+
e.preventDefault();
|
583 |
+
checked_licence = false;
|
584 |
+
$( e.target ).replaceWith( 'Checking... ' + ajax_spinner );
|
585 |
+
check_licence( null, 'all' );
|
586 |
+
} );
|
587 |
+
function refresh_table_selects() {
|
588 |
+
if ( undefined !== wpmdb_data && undefined !== wpmdb_data.this_tables && undefined !== wpmdb_data.this_table_sizes ) {
|
589 |
+
$push_select = create_table_select( wpmdb_data.this_tables, wpmdb_data.this_table_sizes, $( $push_select ).val() );
|
590 |
+
}
|
591 |
|
592 |
+
if ( undefined !== connection_data && undefined !== connection_data.tables && undefined !== connection_data.table_sizes_hr ) {
|
593 |
+
$pull_select = create_table_select( connection_data.tables, connection_data.table_sizes_hr, $( $pull_select ).val() );
|
|
|
|
|
|
|
594 |
}
|
595 |
+
}
|
596 |
+
|
597 |
+
$.wpmdb.add_action( 'wpmdb_refresh_table_selects', refresh_table_selects );
|
598 |
+
|
599 |
+
function update_push_table_select() {
|
600 |
+
$( '#select-tables' ).remove();
|
601 |
+
$( '.select-tables-wrap' ).prepend( $push_select );
|
602 |
+
}
|
603 |
+
|
604 |
+
$.wpmdb.add_action( 'wpmdb_update_push_table_select', update_push_table_select );
|
605 |
+
|
606 |
+
function update_pull_table_select() {
|
607 |
+
$( '#select-tables' ).remove();
|
608 |
+
$( '.select-tables-wrap' ).prepend( $pull_select );
|
609 |
+
}
|
610 |
+
|
611 |
+
$.wpmdb.add_action( 'wpmdb_update_pull_table_select', update_pull_table_select );
|
612 |
+
|
613 |
+
function disable_table_migration_options() {
|
614 |
+
$( '#migrate-selected' ).parents( '.option-section' ).children( '.header-expand-collapse' ).children( '.expand-collapse-arrow' ).removeClass( 'collapsed' );
|
615 |
+
$( '.table-select-wrap' ).show();
|
616 |
+
$( '#migrate-only-with-prefix' ).prop( 'checked', false );
|
617 |
+
$( '#migrate-selected' ).prop( 'checked', true );
|
618 |
+
$( '.table-migrate-options' ).hide();
|
619 |
+
$( '.select-tables-wrap' ).show();
|
620 |
+
}
|
621 |
+
|
622 |
+
$.wpmdb.add_action( 'wpmdb_disable_table_migration_options', disable_table_migration_options );
|
623 |
+
|
624 |
+
function enable_table_migration_options() {
|
625 |
+
$( '.table-migrate-options' ).show();
|
626 |
+
}
|
627 |
|
628 |
+
$.wpmdb.add_action( 'wpmdb_enable_table_migration_options', enable_table_migration_options );
|
629 |
+
|
630 |
+
function select_all_tables() {
|
631 |
+
$( '#select-tables' ).children( 'option' ).prop( 'selected', true );
|
632 |
+
}
|
633 |
+
|
634 |
+
$.wpmdb.add_action( 'wpmdb_select_all_tables', select_all_tables );
|
635 |
+
|
636 |
+
function base_old_url( value, args ) {
|
637 |
+
return remove_protocol( wpmdb_data.this_url );
|
638 |
+
}
|
639 |
+
|
640 |
+
$.wpmdb.add_filter( 'wpmdb_base_old_url', base_old_url );
|
641 |
+
|
642 |
+
function establish_remote_connection_from_saved_profile() {
|
643 |
+
var action = wpmdb_migration_type();
|
644 |
+
var connection_info = $.trim( $( '.pull-push-connection-info' ).val() ).split( "\n" );
|
645 |
+
if ( 'undefined' === typeof wpmdb_default_profile || true === wpmdb_default_profile || 'savefile' === action || doing_ajax || ! wpmdb_data.is_pro ) {
|
646 |
+
return;
|
647 |
+
}
|
648 |
|
649 |
doing_ajax = true;
|
650 |
disable_export_type_controls();
|
651 |
|
652 |
+
$( '.connection-status' ).html( wpmdb_strings.establishing_remote_connection );
|
653 |
+
$( '.connection-status' ).removeClass( 'notification-message error-notice migration-error' );
|
654 |
+
$( '.connection-status' ).append( ajax_spinner );
|
655 |
|
656 |
+
var intent = wpmdb_migration_type();
|
657 |
|
658 |
+
$.ajax( {
|
659 |
+
url: ajaxurl,
|
660 |
+
type: 'POST',
|
661 |
+
dataType: 'json',
|
662 |
+
cache: false,
|
663 |
data: {
|
664 |
+
action: 'wpmdb_verify_connection_to_remote_site',
|
665 |
+
url: connection_info[ 0 ],
|
666 |
+
key: connection_info[ 1 ],
|
667 |
+
intent: intent,
|
668 |
+
nonce: wpmdb_data.nonces.verify_connection_to_remote_site,
|
669 |
+
convert_post_type_selection: wpmdb_convert_post_type_selection,
|
670 |
+
profile: wpmdb_data.profile
|
671 |
},
|
672 |
+
error: function( jqXHR, textStatus, errorThrown ) {
|
673 |
+
$( '.connection-status' ).html( getAjaxErrors( jqXHR.responseText, '(#102)', jqXHR ) );
|
674 |
+
$( '.connection-status' ).addClass( 'notification-message error-notice migration-error' );
|
675 |
+
$( '.ajax-spinner' ).remove();
|
676 |
doing_ajax = false;
|
677 |
enable_export_type_controls();
|
678 |
},
|
679 |
+
success: function( data ) {
|
680 |
+
$( '.ajax-spinner' ).remove();
|
681 |
doing_ajax = false;
|
682 |
enable_export_type_controls();
|
683 |
|
684 |
+
if ( typeof data.wpmdb_error !== 'undefined' && data.wpmdb_error === 1 ) {
|
685 |
+
$( '.connection-status' ).html( data.body );
|
686 |
+
$( '.connection-status' ).addClass( 'notification-message error-notice migration-error' );
|
687 |
|
688 |
+
if ( data.body.indexOf( '401 Unauthorized' ) > -1 ) {
|
689 |
+
$( '.basic-access-auth-wrapper' ).show();
|
690 |
}
|
691 |
|
692 |
return;
|
693 |
}
|
694 |
|
695 |
+
maybe_show_ssl_warning( connection_info[ 0 ], connection_info[ 1 ], data.scheme );
|
696 |
maybe_show_prefix_notice( data.prefix );
|
697 |
|
698 |
+
$( '.pull-push-connection-info' ).addClass( 'temp-disabled' );
|
699 |
+
$( '.pull-push-connection-info' ).attr( 'readonly', 'readonly' );
|
700 |
+
$( '.connect-button' ).hide();
|
701 |
|
702 |
+
$( '.connection-status' ).hide();
|
703 |
+
$( '.step-two' ).show();
|
704 |
connection_established = true;
|
705 |
connection_data = data;
|
706 |
move_connection_info_box();
|
708 |
maybe_show_mixed_cased_table_name_warning();
|
709 |
|
710 |
var loaded_tables = '';
|
711 |
+
if ( wpmdb_default_profile === false && typeof wpmdb_loaded_tables !== 'undefined' ) {
|
712 |
loaded_tables = wpmdb_loaded_tables;
|
713 |
}
|
714 |
|
715 |
+
$pull_select = create_table_select( connection_data.tables, connection_data.table_sizes_hr, loaded_tables );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
716 |
|
717 |
var loaded_post_types = '';
|
718 |
+
if ( wpmdb_default_profile === false && typeof wpmdb_loaded_post_types !== 'undefined' ) {
|
719 |
+
if ( typeof data.select_post_types !== 'undefined' ) {
|
720 |
+
$( '#exclude-post-types' ).attr( 'checked', 'checked' );
|
721 |
+
$( '.post-type-select-wrap' ).show();
|
722 |
loaded_post_types = data.select_post_types;
|
723 |
+
}
|
724 |
else {
|
725 |
loaded_post_types = wpmdb_loaded_post_types;
|
726 |
}
|
727 |
}
|
728 |
|
729 |
+
var $post_type_select = document.createElement( 'select' );
|
730 |
+
$( $post_type_select ).attr( {
|
731 |
+
multiple: 'multiple',
|
732 |
+
name: 'select_post_types[]',
|
733 |
+
id: 'select-post-types',
|
734 |
+
class: 'multiselect'
|
735 |
+
} );
|
736 |
|
737 |
+
$.each( connection_data.post_types, function( index, value ) {
|
738 |
var selected = $.inArray( value, loaded_post_types );
|
739 |
+
if ( selected !== -1 || ( wpmdb_convert_exclude_revisions === true && value !== 'revision' ) ) {
|
740 |
selected = ' selected="selected" ';
|
741 |
}
|
742 |
+
else {
|
743 |
selected = ' ';
|
744 |
}
|
745 |
+
$( $post_type_select ).append( '<option' + selected + 'value="' + value + '">' + value + '</option>' );
|
746 |
+
} );
|
747 |
|
748 |
+
$pull_post_type_select = $post_type_select;
|
749 |
|
750 |
var loaded_tables_backup = '';
|
751 |
+
if ( wpmdb_default_profile === false && typeof wpmdb_loaded_tables_backup !== 'undefined' ) {
|
752 |
loaded_tables_backup = wpmdb_loaded_tables_backup;
|
753 |
}
|
754 |
|
755 |
+
var $table_select_backup = document.createElement( 'select' );
|
756 |
+
$( $table_select_backup ).attr( {
|
757 |
+
multiple: 'multiple',
|
758 |
+
name: 'select_backup[]',
|
759 |
+
id: 'select-backup',
|
760 |
+
class: 'multiselect'
|
761 |
+
} );
|
762 |
|
763 |
+
$.each( connection_data.tables, function( index, value ) {
|
764 |
var selected = $.inArray( value, loaded_tables_backup );
|
765 |
+
if ( selected !== -1 ) {
|
766 |
selected = ' selected="selected" ';
|
767 |
}
|
768 |
+
else {
|
769 |
selected = ' ';
|
770 |
}
|
771 |
+
$( $table_select_backup ).append( '<option' + selected + 'value="' + value + '">' + value + ' (' + connection_data.table_sizes_hr[ value ] + ')</option>' );
|
772 |
+
} );
|
773 |
+
|
774 |
+
$push_select_backup = $table_select_backup;
|
775 |
+
|
776 |
+
if ( 'pull' === wpmdb_migration_type() ) {
|
777 |
+
$.wpmdb.do_action( 'wpmdb_update_pull_table_select' );
|
778 |
+
$( '#select-post-types' ).remove();
|
779 |
+
$( '.select-post-types-wrap' ).prepend( $pull_post_type_select );
|
780 |
+
$( '#select-backup' ).remove();
|
781 |
+
$( '.backup-tables-wrap' ).prepend( $pull_select_backup );
|
782 |
+
$( '.table-prefix' ).html( data.prefix );
|
783 |
+
$( '.uploads-dir' ).html( wpmdb_data.this_uploads_dir );
|
|
|
784 |
}
|
785 |
else {
|
786 |
+
$( '#select-backup' ).remove();
|
787 |
+
$( '.backup-tables-wrap' ).prepend( $push_select_backup );
|
788 |
}
|
789 |
|
790 |
$.wpmdb.do_action( 'verify_connection_to_remote_site', connection_data );
|
791 |
}
|
792 |
|
793 |
+
} );
|
794 |
|
795 |
}
|
796 |
|
797 |
+
// automatically validate connection info if we're loading a saved profile
|
798 |
+
establish_remote_connection_from_saved_profile();
|
799 |
+
|
800 |
// add to <a> tags which act as JS event buttons, will not jump page to top and will deselect the button
|
801 |
+
$( 'body' ).on( 'click', '.js-action-link', function( e ) {
|
802 |
e.preventDefault();
|
803 |
+
$( this ).blur();
|
804 |
+
} );
|
805 |
|
806 |
|
807 |
function enable_pro_licence( data, licence_key ) {
|
808 |
+
$( '.licence-input, .register-licence' ).remove();
|
809 |
+
$( '.licence-not-entered' ).prepend( data.masked_licence );
|
810 |
+
$( '.support-content' ).empty().html( '<p>' + wpmdb_strings.fetching_license + '<img src="' + spinner_url + '" alt="" class="ajax-spinner general-spinner" /></p>' );
|
811 |
check_licence( licence_key );
|
812 |
|
813 |
+
$( '.migrate-selection label' ).removeClass( 'disabled' );
|
814 |
+
$( '.migrate-selection input' ).removeAttr( 'disabled' );
|
815 |
}
|
816 |
|
817 |
// registers your licence
|
818 |
+
$( '.licence-form' ).submit( function( e ) {
|
819 |
e.preventDefault();
|
820 |
|
821 |
+
if ( doing_licence_registration_ajax ) {
|
822 |
return;
|
823 |
}
|
824 |
|
825 |
+
$( '.licence-status' ).removeClass( 'notification-message error-notice success-notice' );
|
826 |
|
827 |
+
var licence_key = $.trim( $( '.licence-input' ).val() );
|
828 |
|
829 |
+
if ( licence_key === '' ) {
|
830 |
+
$( '.licence-status' ).addClass( 'notification-message error-notice' );
|
831 |
+
$( '.licence-status' ).html( wpmdb_strings.enter_license_key );
|
832 |
return;
|
833 |
}
|
834 |
|
835 |
+
$( '.licence-status' ).empty().removeClass( 'success' );
|
836 |
doing_licence_registration_ajax = true;
|
837 |
+
$( '.button.register-licence' ).after( '<img src="' + spinner_url + '" alt="" class="register-licence-ajax-spinner general-spinner" />' );
|
838 |
|
839 |
+
$.ajax( {
|
840 |
+
url: ajaxurl,
|
841 |
+
type: 'POST',
|
842 |
+
dataType: 'JSON',
|
843 |
+
cache: false,
|
844 |
data: {
|
845 |
+
action: 'wpmdb_activate_licence',
|
846 |
+
licence_key: licence_key,
|
847 |
+
nonce: wpmdb_data.nonces.activate_licence,
|
848 |
+
context: 'licence'
|
849 |
},
|
850 |
+
error: function( jqXHR, textStatus, errorThrown ) {
|
851 |
doing_licence_registration_ajax = false;
|
852 |
+
$( '.register-licence-ajax-spinner' ).remove();
|
853 |
+
$( '.licence-status' ).html( wpmdb_strings.register_license_problem );
|
854 |
},
|
855 |
+
success: function( data ) {
|
856 |
doing_licence_registration_ajax = false;
|
857 |
+
$( '.register-licence-ajax-spinner' ).remove();
|
858 |
|
859 |
if ( typeof data.errors !== 'undefined' ) {
|
860 |
var msg = '';
|
861 |
+
for ( var key in data.errors ) {
|
862 |
+
msg += data.errors[ key ];
|
863 |
}
|
864 |
+
$( '.licence-status' ).html( msg );
|
865 |
|
866 |
if ( typeof data.masked_licence !== 'undefined' ) {
|
867 |
enable_pro_licence( data, licence_key );
|
868 |
+
$( '.migrate-tab .invalid-licence' ).hide();
|
869 |
}
|
870 |
}
|
871 |
else if ( typeof data.wpmdb_error !== 'undefined' && typeof data.body !== 'undefined' ) {
|
872 |
+
$( '.licence-status' ).html( data.body );
|
873 |
}
|
874 |
else {
|
875 |
+
$( '.licence-status' ).html( wpmdb_strings.license_registered ).delay( 5000 ).fadeOut( 1000 );
|
876 |
+
$( '.licence-status' ).addClass( 'success notification-message success-notice' );
|
877 |
enable_pro_licence( data, licence_key );
|
878 |
+
$( '.invalid-licence' ).hide();
|
879 |
}
|
880 |
}
|
881 |
+
} );
|
882 |
|
883 |
+
} );
|
884 |
|
885 |
// clears the debug log
|
886 |
+
$( '.clear-log' ).click( function() {
|
887 |
+
$( '.debug-log-textarea' ).val( '' );
|
888 |
+
$.ajax( {
|
889 |
+
url: ajaxurl,
|
890 |
+
type: 'POST',
|
891 |
+
dataType: 'text',
|
892 |
+
cache: false,
|
893 |
data: {
|
894 |
+
action: 'wpmdb_clear_log',
|
895 |
+
nonce: wpmdb_data.nonces.clear_log
|
896 |
},
|
897 |
+
error: function( jqXHR, textStatus, errorThrown ) {
|
898 |
alert( wpmdb_strings.clear_log_problem );
|
899 |
},
|
900 |
+
success: function( data ) {
|
901 |
}
|
902 |
+
} );
|
903 |
+
} );
|
904 |
|
905 |
// updates the debug log when the user switches to the help tab
|
906 |
+
function refresh_debug_log() {
|
907 |
+
$.ajax( {
|
908 |
+
url: ajaxurl,
|
909 |
+
type: 'POST',
|
910 |
+
dataType: 'text',
|
911 |
+
cache: false,
|
912 |
data: {
|
913 |
+
action: 'wpmdb_get_log',
|
914 |
+
nonce: wpmdb_data.nonces.get_log
|
915 |
},
|
916 |
+
error: function( jqXHR, textStatus, errorThrown ) {
|
917 |
alert( wpmdb_strings.update_log_problem );
|
918 |
},
|
919 |
+
success: function( data ) {
|
920 |
+
$( '.debug-log-textarea' ).val( data );
|
921 |
}
|
922 |
+
} );
|
923 |
}
|
924 |
|
925 |
// select all tables
|
926 |
+
$( '.multiselect-select-all' ).click( function() {
|
927 |
+
var multiselect = $( this ).parents( '.select-wrap' ).children( '.multiselect' );
|
928 |
+
$( 'option', multiselect ).attr( 'selected', 1 );
|
929 |
+
$( multiselect ).focus().trigger( 'change' );
|
930 |
+
} );
|
931 |
|
932 |
// deselect all tables
|
933 |
+
$( '.multiselect-deselect-all' ).click( function() {
|
934 |
+
var multiselect = $( this ).parents( '.select-wrap' ).children( '.multiselect' );
|
935 |
+
$( 'option', multiselect ).removeAttr( 'selected' );
|
936 |
+
$( multiselect ).focus().trigger( 'change' );
|
937 |
+
} );
|
938 |
|
939 |
// invert table selection
|
940 |
+
$( '.multiselect-invert-selection' ).click( function() {
|
941 |
+
var multiselect = $( this ).parents( '.select-wrap' ).children( '.multiselect' );
|
942 |
+
$( 'option', multiselect ).each( function() {
|
943 |
+
$( this ).attr( 'selected', !$( this ).attr( 'selected' ) );
|
944 |
+
} );
|
945 |
+
$( multiselect ).focus().trigger( 'change' );
|
946 |
+
} );
|
947 |
|
948 |
// on option select hide all "advanced" option divs and show the correct div for the option selected
|
949 |
+
$( '.option-group input[type=radio]' ).change( function() {
|
950 |
+
var group = $( this ).closest( '.option-group' );
|
951 |
+
$( 'ul', group ).hide();
|
952 |
+
var parent = $( this ).closest( 'li' );
|
953 |
+
$( 'ul', parent ).show();
|
954 |
+
} );
|
955 |
|
956 |
// on page load, expand hidden divs for selected options (browser form cache)
|
957 |
+
$( '.option-group' ).each( function() {
|
958 |
+
$( '.option-group input[type=radio]' ).each( function() {
|
959 |
+
if ( $( this ).is( ':checked' ) ) {
|
960 |
+
var parent = $( this ).closest( 'li' );
|
961 |
+
$( 'ul', parent ).show();
|
962 |
}
|
963 |
+
} );
|
964 |
+
} );
|
965 |
|
966 |
// expand and collapse content on click
|
967 |
+
$( '.header-expand-collapse' ).click( function() {
|
968 |
+
if ( $( '.expand-collapse-arrow', this ).hasClass( 'collapsed' ) ) {
|
969 |
+
$( '.expand-collapse-arrow', this ).removeClass( 'collapsed' );
|
970 |
+
$( this ).next().show();
|
971 |
}
|
972 |
+
else {
|
973 |
+
$( '.expand-collapse-arrow', this ).addClass( 'collapsed' );
|
974 |
+
$( this ).next().hide();
|
975 |
}
|
976 |
+
} );
|
977 |
|
978 |
+
$( '.checkbox-label input[type=checkbox]' ).change( function() {
|
979 |
+
if ( $( this ).is( ':checked' ) ) {
|
980 |
+
$( this ).parent().next().show();
|
981 |
}
|
982 |
else {
|
983 |
+
$( this ).parent().next().hide();
|
984 |
}
|
985 |
+
} );
|
986 |
|
987 |
// special expand and collapse content on click for save migration profile
|
988 |
+
$( '#save-migration-profile' ).change( function() {
|
989 |
+
if ( $( this ).is( ':checked' ) ) {
|
990 |
+
$( '.save-settings-button' ).show();
|
991 |
+
$( '.migrate-db .button-primary' ).val( wpmdb_strings.migrate_db_save );
|
992 |
}
|
993 |
+
else {
|
994 |
+
$( '.save-settings-button' ).hide();
|
995 |
+
$( '.migrate-db .button-primary' ).val( wpmdb_strings.migrate_db );
|
996 |
}
|
997 |
+
} );
|
998 |
|
999 |
+
$( '.create-new-profile' ).focus( function() {
|
1000 |
+
$( '#create_new' ).prop( 'checked', true );
|
1001 |
+
} );
|
1002 |
|
1003 |
+
if ( $( '#save-migration-profile' ).is( ':checked' ) ) {
|
1004 |
+
$( '.save-settings-button' ).show();
|
1005 |
+
$( '.migrate-db .button-primary' ).val( wpmdb_strings.migrate_db_save );
|
1006 |
+
}
|
1007 |
|
1008 |
+
$( '.checkbox-label input[type=checkbox]' ).each( function() {
|
1009 |
+
if ( $( this ).is( ':checked' ) ) {
|
1010 |
+
$( this ).parent().next().show();
|
1011 |
}
|
1012 |
+
} );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1013 |
|
1014 |
// AJAX migrate button
|
1015 |
+
$( '.migrate-db-button' ).click( function( event ) {
|
1016 |
+
$( this ).blur();
|
1017 |
event.preventDefault();
|
1018 |
+
migration_state_id = '';
|
1019 |
+
|
1020 |
+
if ( false === $.wpmdb.apply_filters( 'wpmdb_migration_profile_ready', true ) ) {
|
1021 |
+
return;
|
1022 |
+
}
|
1023 |
|
1024 |
// check that they've selected some tables to migrate
|
1025 |
+
if ( $( '#migrate-selected' ).is( ':checked' ) && $( '#select-tables' ).val() === null ) {
|
1026 |
alert( wpmdb_strings.please_select_one_table );
|
1027 |
return;
|
1028 |
}
|
1029 |
|
1030 |
+
var new_url_missing = false;
|
1031 |
+
var new_file_path_missing = false;
|
1032 |
+
if ( $( '#new-url' ).length && !$( '#new-url' ).val() ) {
|
1033 |
+
$( '#new-url-missing-warning' ).show();
|
1034 |
+
$( '#new-url' ).focus();
|
1035 |
+
$( 'html,body' ).scrollTop( 0 );
|
1036 |
new_url_missing = true;
|
1037 |
}
|
1038 |
|
1039 |
+
if ( $( '#new-path' ).length && !$( '#new-path' ).val() ) {
|
1040 |
+
$( '#new-path-missing-warning' ).show();
|
1041 |
+
if ( false === new_url_missing ) {
|
1042 |
+
$( '#new-path' ).focus();
|
1043 |
+
$( 'html,body' ).scrollTop( 0 );
|
1044 |
}
|
1045 |
new_file_path_missing = true;
|
1046 |
}
|
1047 |
|
1048 |
+
if ( true === new_url_missing || true === new_file_path_missing ) {
|
1049 |
+
return;
|
1050 |
+
}
|
1051 |
|
1052 |
// also save profile
|
1053 |
+
if ( $( '#save-migration-profile' ).is( ':checked' ) ) {
|
1054 |
+
save_active_profile();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1055 |
}
|
1056 |
|
1057 |
+
form_data = $( '#migrate-form' ).serialize();
|
1058 |
|
1059 |
+
var doc_height = $( document ).height();
|
1060 |
|
1061 |
+
$( 'body' ).append( '<div id="overlay"></div>' );
|
1062 |
|
1063 |
+
$( '#overlay' )
|
1064 |
+
.height( doc_height )
|
1065 |
+
.css( {
|
1066 |
+
'position': 'fixed',
|
1067 |
+
'top': 0,
|
1068 |
+
'left': 0,
|
1069 |
+
'width': '100%',
|
1070 |
+
'z-index': 99999,
|
1071 |
+
'display': 'none'
|
1072 |
+
} );
|
1073 |
|
1074 |
+
var $progress_content = $progress_content_original.clone();
|
1075 |
+
migration_intent = wpmdb_migration_type();
|
1076 |
|
1077 |
stage = 'backup';
|
1078 |
|
1079 |
+
if ( migration_intent === 'savefile' ) {
|
1080 |
stage = 'migrate';
|
1081 |
}
|
1082 |
|
1083 |
+
if ( $( '#create-backup' ).is( ':checked' ) === false ) {
|
1084 |
stage = 'migrate';
|
1085 |
}
|
1086 |
|
1087 |
+
var table_intent = $( 'input[name=table_migrate_option]:checked' ).val();
|
1088 |
+
var connection_info = $.trim( $( '.pull-push-connection-info' ).val() ).split( "\n" );
|
1089 |
var table_rows = '';
|
1090 |
|
1091 |
+
remote_site = connection_info[ 0 ];
|
1092 |
+
secret_key = connection_info[ 1 ];
|
1093 |
|
1094 |
var static_migration_label = '';
|
1095 |
|
1096 |
+
$( '#overlay' ).after( $progress_content );
|
1097 |
|
1098 |
completed_msg = wpmdb_strings.exporting_complete;
|
1099 |
|
1100 |
+
if ( migration_intent === 'savefile' ) {
|
1101 |
static_migration_label = wpmdb_strings.exporting_please_wait;
|
1102 |
}
|
1103 |
+
else {
|
1104 |
+
static_migration_label = get_migration_status_label( remote_site, migration_intent, 'migrating' );
|
1105 |
+
completed_msg = get_migration_status_label( remote_site, migration_intent, 'completed' );
|
1106 |
}
|
1107 |
|
1108 |
+
$( '.progress-title' ).html( static_migration_label );
|
1109 |
|
1110 |
+
$( '#overlay' ).show();
|
1111 |
+
var backup_option = $( 'input[name=backup_option]:checked' ).val();
|
1112 |
+
var table_option = $( 'input[name=table_migrate_option]:checked' ).val();
|
1113 |
+
var selected_tables = '';
|
1114 |
|
1115 |
+
if ( stage === 'backup' ) {
|
1116 |
+
if ( table_option === 'migrate_only_with_prefix' && backup_option === 'backup_selected' ) {
|
1117 |
backup_option = 'backup_only_with_prefix';
|
1118 |
}
|
1119 |
+
if ( migration_intent === 'push' ) {
|
1120 |
table_rows = connection_data.table_rows;
|
1121 |
+
if ( backup_option === 'backup_only_with_prefix' ) {
|
1122 |
tables_to_migrate = connection_data.prefixed_tables;
|
1123 |
}
|
1124 |
+
else if ( backup_option === 'backup_selected' ) {
|
1125 |
+
selected_tables = $( '#select-tables' ).val();
|
1126 |
tables_to_migrate = get_intersect( selected_tables, connection_data.tables );
|
1127 |
}
|
1128 |
+
else if ( backup_option === 'backup_manual_select' ) {
|
1129 |
+
tables_to_migrate = $( '#select-backup' ).val();
|
1130 |
}
|
1131 |
}
|
1132 |
+
else {
|
1133 |
+
table_rows = wpmdb_data.this_table_rows;
|
1134 |
+
if ( backup_option === 'backup_only_with_prefix' ) {
|
1135 |
+
tables_to_migrate = wpmdb_data.this_prefixed_tables;
|
1136 |
}
|
1137 |
+
else if ( backup_option === 'backup_selected' ) {
|
1138 |
+
selected_tables = $( '#select-tables' ).val();
|
1139 |
+
tables_to_migrate = get_intersect( selected_tables, wpmdb_data.this_tables );
|
1140 |
}
|
1141 |
+
else if ( backup_option === 'backup_manual_select' ) {
|
1142 |
+
tables_to_migrate = $( '#select-backup' ).val();
|
1143 |
}
|
1144 |
}
|
1145 |
}
|
1146 |
else {
|
1147 |
+
if ( table_intent === 'migrate_select' ) { // user has elected to migrate only certain tables
|
1148 |
// grab tables as per what the user has selected from the multiselect box
|
1149 |
+
tables_to_migrate = $( '#select-tables' ).val();
|
1150 |
// user is pushing or exporting
|
1151 |
+
if ( migration_intent === 'push' || migration_intent === 'savefile' ) {
|
1152 |
// default value, assuming we're not backing up
|
1153 |
+
table_rows = wpmdb_data.this_table_rows;
|
1154 |
}
|
1155 |
+
else {
|
1156 |
table_rows = connection_data.table_rows;
|
1157 |
}
|
1158 |
}
|
1159 |
+
else {
|
1160 |
+
if ( migration_intent === 'push' || migration_intent === 'savefile' ) {
|
1161 |
+
tables_to_migrate = wpmdb_data.this_prefixed_tables;
|
1162 |
+
table_rows = wpmdb_data.this_table_rows;
|
1163 |
}
|
1164 |
+
else {
|
1165 |
tables_to_migrate = connection_data.prefixed_tables;
|
1166 |
table_rows = connection_data.table_rows;
|
1167 |
}
|
1168 |
}
|
1169 |
}
|
1170 |
|
1171 |
+
function decide_tables_to_display_rows( tables_to_migrate, orig_table_rows ) {
|
|
|
1172 |
var total_size = 0;
|
1173 |
+
var table_rows = JSON.parse( JSON.stringify( orig_table_rows ) );
|
1174 |
+
|
1175 |
+
$.each( tables_to_migrate, function( index, value ) {
|
1176 |
+
total_size += parseInt( table_rows[ value ] );
|
1177 |
+
} );
|
1178 |
+
|
1179 |
+
var max_percent = 0;
|
1180 |
+
var total_percent = 0;
|
1181 |
+
var table_widths = [];
|
1182 |
+
$.each( tables_to_migrate, function( index, value ) {
|
1183 |
+
var percent = Math.round( ( table_rows[ value ] / total_size ) * 100 );
|
1184 |
+
table_widths[ value ] = percent;
|
1185 |
+
|
1186 |
+
if ( percent > max_percent ) {
|
1187 |
+
max_percent = percent;
|
1188 |
+
}
|
1189 |
+
total_percent += percent;
|
1190 |
+
} );
|
1191 |
|
1192 |
var last_element = '';
|
1193 |
+
var percent_diff = 100 - total_percent;
|
1194 |
+
$.each( tables_to_migrate, function( index, value ) {
|
1195 |
+
var percent = table_widths[ value ];
|
1196 |
+
|
1197 |
+
if ( 0 !== percent_diff && percent === max_percent ) {
|
1198 |
+
percent += percent_diff;
|
1199 |
+
|
1200 |
+
if ( 0 > percent ) {
|
1201 |
+
// If there is another element with max_percent might be able to correct.
|
1202 |
+
// It's likely if we're getting this error that there are a lot of small tables.
|
1203 |
+
percent_diff = 0 - percent;
|
1204 |
+
percent = 0;
|
1205 |
+
} else {
|
1206 |
+
percent_diff = 0;
|
1207 |
+
}
|
1208 |
+
}
|
1209 |
+
|
1210 |
+
$( '.progress-tables' ).append( '<div class="progress-chunk ' + value + '_chunk" style="width: ' + percent + '%;" title="' + value + '"><span>' + value + '</span></div>' );
|
1211 |
+
$( '.progress-tables-hover-boxes' ).append( '<div class="progress-chunk-hover" data-table="' + value + '" style="width: ' + percent + '%;"></div>' );
|
1212 |
last_element = value;
|
1213 |
+
} );
|
1214 |
+
|
1215 |
+
total_percent = 0;
|
1216 |
+
|
1217 |
+
// Only enumerate progress-chunk classed elements from core
|
1218 |
+
$( '.progress-tables' ).not( '.media' ).find( '.progress-chunk' ).each( function( index ) {
|
1219 |
+
total_percent += $( this ).width();
|
1220 |
+
if ( 1 > $( this ).width() && tables_to_migrate[ index ] !== last_element ) {
|
1221 |
+
$( this ).hide();
|
1222 |
+
$( '.progress-chunk-hover[data-table=' + tables_to_migrate[ index ] + ']' ).hide();
|
1223 |
+
table_rows[ last_element ] = Number( table_rows[ last_element ] );
|
1224 |
+
table_rows[ last_element ] += Number( table_rows[ tables_to_migrate[ index ] ] );
|
1225 |
+
table_rows[ tables_to_migrate[ index ] ] = 0;
|
1226 |
}
|
1227 |
+
|
1228 |
var element = this;
|
1229 |
+
setTimeout( function() {
|
1230 |
+
hide_overflowing_elements( element );
|
1231 |
+
}, 0 );
|
1232 |
|
1233 |
+
function hide_overflowing_elements( element ) {
|
1234 |
+
if ( $( 'span', element ).innerWidth() > $( element ).width() ) {
|
1235 |
+
$( 'span', element ).hide();
|
1236 |
}
|
1237 |
}
|
1238 |
+
} );
|
1239 |
|
1240 |
+
var percent = 0;
|
1241 |
+
if ( 0 !== table_rows[ last_element ] && 100 > total_percent ) {
|
1242 |
+
percent = Math.round( ( table_rows[ last_element ] / total_size ) * 100 );
|
|
|
|
|
|
|
1243 |
}
|
1244 |
+
$( '.progress-tables .progress-chunk:last' ).css( 'width', percent + '%' );
|
1245 |
+
$( '.progress-chunk-hover:last' ).css( 'width', percent + '%' );
|
1246 |
|
1247 |
+
var return_vals = [ table_rows, total_size ];
|
1248 |
|
1249 |
return return_vals;
|
1250 |
|
1251 |
}
|
1252 |
|
1253 |
+
var table_details = decide_tables_to_display_rows( tables_to_migrate, table_rows );
|
1254 |
+
table_rows = table_details[ 0 ];
|
1255 |
+
var total_size = table_details[ 1 ];
|
1256 |
|
1257 |
+
$( '.progress-title' ).after( '<img src="' + spinner_url + '" alt="" class="migration-progress-ajax-spinner general-spinner" />' );
|
1258 |
|
1259 |
+
var height = $( '.progress-content' ).outerHeight();
|
1260 |
+
$( '.progress-content' ).css( 'top', '-' + height + 'px' ).show().animate( { 'top': '0px' } );
|
1261 |
|
1262 |
setup_counter();
|
1263 |
currently_migrating = true;
|
1264 |
|
1265 |
+
var request_data = {
|
1266 |
+
action: 'wpmdb_initiate_migration',
|
1267 |
+
intent: migration_intent,
|
1268 |
+
url: remote_site,
|
1269 |
+
key: secret_key,
|
1270 |
+
form_data: form_data,
|
1271 |
+
stage: stage,
|
1272 |
+
nonce: wpmdb_data.nonces.initiate_migration
|
1273 |
+
};
|
1274 |
+
|
1275 |
+
if ( migration_intent !== 'savefile' ) {
|
1276 |
+
request_data.temp_prefix = connection_data.temp_prefix;
|
1277 |
+
}
|
1278 |
+
|
1279 |
+
doing_ajax = true;
|
1280 |
+
|
1281 |
+
$.ajax( {
|
1282 |
+
url: ajaxurl,
|
1283 |
+
type: 'POST',
|
1284 |
+
dataType: 'json',
|
1285 |
+
cache: false,
|
1286 |
+
data: request_data,
|
1287 |
+
error: function( jqXHR, textStatus, errorThrown ) {
|
1288 |
+
$( '.progress-title' ).html( wpmdb_strings.migration_failed );
|
1289 |
+
$( '.progress-text' ).html( getAjaxErrors( jqXHR.responseText, '(#112)', jqXHR ) );
|
1290 |
+
$( '.progress-text' ).addClass( 'migration-error' );
|
1291 |
console.log( jqXHR );
|
1292 |
console.log( textStatus );
|
1293 |
console.log( errorThrown );
|
1294 |
+
doing_ajax = false;
|
1295 |
migration_error = true;
|
1296 |
migration_complete_events();
|
1297 |
return;
|
1298 |
},
|
1299 |
+
success: function( data ) {
|
1300 |
+
doing_ajax = false;
|
1301 |
+
if ( typeof data !== 'undefined' && typeof data.wpmdb_error !== 'undefined' && data.wpmdb_error === 1 ) {
|
1302 |
migration_error = true;
|
1303 |
migration_complete_events();
|
1304 |
+
$( '.progress-title' ).html( wpmdb_strings.migration_failed );
|
1305 |
+
$( '.progress-text' ).addClass( 'migration-error' );
|
1306 |
+
$( '.progress-text' ).html( data.body );
|
1307 |
return;
|
1308 |
}
|
1309 |
|
1310 |
+
migration_state_id = data.migration_state_id;
|
|
|
|
|
|
|
|
|
|
|
1311 |
|
1312 |
var i = 0;
|
1313 |
var progress_size = 0;
|
1317 |
var last_progress = 0;
|
1318 |
var overall_table_progress = 0;
|
1319 |
|
1320 |
+
// Set delay between requests - use max of local/remote values, 0 if doing export
|
1321 |
+
delay_between_requests = 0;
|
1322 |
+
if ( 'savefile' !== migration_intent && 'undefined' !== typeof connection_data && 'undefined' !== typeof connection_data.delay_between_requests ) {
|
1323 |
+
delay_between_requests = Math.max( parseInt( wpmdb_data.delay_between_requests ), parseInt( connection_data.delay_between_requests ) );
|
1324 |
+
}
|
1325 |
+
|
1326 |
+
migrate_table_recursive = function( current_row, primary_keys ) {
|
1327 |
|
1328 |
+
if ( i >= tables_to_migrate.length ) {
|
1329 |
+
if ( stage === 'backup' ) {
|
1330 |
stage = 'migrate';
|
1331 |
i = 0;
|
1332 |
progress_size = 0;
|
1333 |
+
overall_percent = 0;
|
1334 |
+
$( '.progress-bar' ).width( '0px' );
|
1335 |
|
1336 |
+
if ( table_intent === 'migrate_select' ) {
|
1337 |
+
tables_to_migrate = $( '#select-tables' ).val();
|
1338 |
+
if ( migration_intent === 'push' || migration_intent === 'savefile' ) {
|
1339 |
+
table_rows = wpmdb_data.this_table_rows;
|
1340 |
}
|
1341 |
+
else {
|
1342 |
table_rows = connection_data.table_rows;
|
1343 |
}
|
1344 |
}
|
1345 |
+
else {
|
1346 |
+
if ( migration_intent === 'push' || migration_intent === 'savefile' ) {
|
1347 |
+
tables_to_migrate = wpmdb_data.this_prefixed_tables;
|
1348 |
+
table_rows = wpmdb_data.this_table_rows;
|
1349 |
}
|
1350 |
+
else {
|
1351 |
tables_to_migrate = connection_data.prefixed_tables;
|
1352 |
table_rows = connection_data.table_rows;
|
1353 |
}
|
1354 |
}
|
1355 |
|
1356 |
+
$( '.progress-tables' ).empty();
|
1357 |
+
$( '.progress-tables-hover-boxes' ).empty();
|
1358 |
|
1359 |
table_details = decide_tables_to_display_rows( tables_to_migrate, table_rows );
|
1360 |
+
table_rows = table_details[ 0 ];
|
1361 |
+
total_size = table_details[ 1 ];
|
1362 |
|
1363 |
}
|
1364 |
else {
|
1365 |
+
$( '.progress-label' ).removeClass( 'label-visible' );
|
1366 |
|
1367 |
hooks = $.wpmdb.apply_filters( 'wpmdb_before_migration_complete_hooks', hooks );
|
1368 |
hooks.push( 'migration_complete' );
|
1369 |
+
hooks.push( 'wpmdb_flush' );
|
1370 |
hooks = $.wpmdb.apply_filters( 'wpmdb_after_migration_complete_hooks', hooks );
|
1371 |
hooks.push( 'migration_complete_events' );
|
1372 |
next_step_in_migration = { fn: wpmdb_call_next_hook };
|
1375 |
}
|
1376 |
}
|
1377 |
|
1378 |
+
if ( stage === 'backup' ) {
|
1379 |
+
$( '.progress-text' ).html( overall_percent + '% - ' + wpmdb_strings.backing_up + ' "' + tables_to_migrate[ i ] + '"' );
|
1380 |
}
|
1381 |
+
else {
|
1382 |
+
$( '.progress-text' ).html( overall_percent + '% - ' + wpmdb_strings.migrating + ' "' + tables_to_migrate[ i ] + '"' );
|
1383 |
}
|
1384 |
|
1385 |
+
var last_table = 0;
|
1386 |
+
if ( i === ( tables_to_migrate.length - 1 ) ) {
|
1387 |
last_table = 1;
|
1388 |
}
|
1389 |
|
1390 |
+
var gzip = 0;
|
1391 |
+
if ( migration_intent !== 'savefile' && parseInt( connection_data.gzip ) === 1 ) {
|
1392 |
gzip = 1;
|
1393 |
}
|
1394 |
|
1395 |
+
var request_data = {
|
1396 |
+
action: 'wpmdb_migrate_table',
|
1397 |
+
migration_state_id: migration_state_id,
|
1398 |
+
table: tables_to_migrate[ i ],
|
1399 |
+
stage: stage,
|
1400 |
+
current_row: current_row,
|
1401 |
+
last_table: last_table,
|
1402 |
+
primary_keys: primary_keys,
|
1403 |
+
gzip: gzip,
|
1404 |
+
nonce: wpmdb_data.nonces.migrate_table
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1405 |
};
|
1406 |
|
1407 |
+
if ( migration_intent !== 'savefile' ) {
|
1408 |
request_data.bottleneck = connection_data.bottleneck;
|
1409 |
request_data.prefix = connection_data.prefix;
|
1410 |
}
|
1411 |
|
1412 |
+
if ( connection_data && connection_data.path_current_site && connection_data.domain ) {
|
1413 |
request_data.path_current_site = connection_data.path_current_site;
|
1414 |
request_data.domain_current_site = connection_data.domain;
|
1415 |
}
|
1416 |
|
1417 |
doing_ajax = true;
|
1418 |
|
1419 |
+
$.ajax( {
|
1420 |
+
url: ajaxurl,
|
1421 |
+
type: 'POST',
|
1422 |
+
dataType: 'text',
|
1423 |
+
cache: false,
|
1424 |
+
timeout: 0,
|
1425 |
+
data: request_data,
|
1426 |
+
error: function( jqXHR, textStatus, errorThrown ) {
|
1427 |
+
$( '.progress-title' ).html( wpmdb_strings.migration_failed );
|
1428 |
+
$( '.progress-text' ).html( wpmdb_strings.table_process_problem + ' ' + tables_to_migrate[ i ] );
|
1429 |
+
$( '.progress-text' ).append( '<br /><br />' + wpmdb_strings.status + ': ' + jqXHR.status + ' ' + jqXHR.statusText + '<br /><br />' + wpmdb_strings.response + ':<br />' + jqXHR.responseText );
|
1430 |
+
$( '.progress-text' ).addClass( 'migration-error' );
|
1431 |
doing_ajax = false;
|
1432 |
console.log( jqXHR );
|
1433 |
console.log( textStatus );
|
1436 |
migration_complete_events();
|
1437 |
return;
|
1438 |
},
|
1439 |
+
success: function( data ) {
|
1440 |
doing_ajax = false;
|
1441 |
data = $.trim( data );
|
1442 |
+
var row_information = wpmdb_parse_json( data );
|
1443 |
+
if ( false === row_information || null === row_information ) {
|
1444 |
+
$( '.progress-title' ).html( wpmdb_strings.migration_failed );
|
1445 |
+
if ( '' === data || null === data ) {
|
1446 |
+
$( '.progress-text' ).html( wpmdb_strings.table_process_problem_empty_response + ' ' + tables_to_migrate[ i ] );
|
1447 |
}
|
1448 |
else {
|
1449 |
+
$( '.progress-text' ).html( getAjaxErrors( data, null, null ) );
|
1450 |
}
|
1451 |
+
$( '.progress-text' ).addClass( 'migration-error' );
|
1452 |
migration_error = true;
|
1453 |
migration_complete_events();
|
1454 |
return;
|
1455 |
}
|
1456 |
|
1457 |
+
if ( typeof row_information.wpmdb_error !== 'undefined' && row_information.wpmdb_error === 1 ) {
|
1458 |
+
$( '.progress-title' ).html( wpmdb_strings.migration_failed );
|
1459 |
+
$( '.progress-text' ).addClass( 'migration-error' );
|
1460 |
+
$( '.progress-text' ).html( row_information.body );
|
1461 |
migration_error = true;
|
1462 |
migration_complete_events();
|
1463 |
return;
|
1464 |
}
|
1465 |
|
1466 |
+
// We need the returned file name for delivery or display to the user.
|
1467 |
+
if ( 1 === last_table && 'savefile' === migration_intent ) {
|
1468 |
+
if ( typeof row_information.dump_filename !== 'undefined' ) {
|
1469 |
+
dump_filename = row_information.dump_filename;
|
1470 |
+
}
|
1471 |
+
if ( typeof row_information.dump_path !== 'undefined' ) {
|
1472 |
+
dump_path = row_information.dump_path;
|
1473 |
+
}
|
1474 |
+
}
|
1475 |
+
|
1476 |
+
if ( row_information.current_row === -1 || row_information.current_row === '-1' ) {
|
1477 |
progress_size -= overall_table_progress;
|
1478 |
overall_table_progress = 0;
|
1479 |
last_progress = 0;
|
1480 |
+
progress_size += parseInt( table_rows[ tables_to_migrate[ i ] ] );
|
1481 |
i++;
|
1482 |
row_information.current_row = '';
|
1483 |
row_information.primary_keys = '';
|
1489 |
progress_size += table_progress;
|
1490 |
overall_table_progress += table_progress;
|
1491 |
}
|
1492 |
+
overall_percent = Math.floor( ( progress_size / total_size ) * 100 );
|
1493 |
+
$( '.progress-bar' ).width( overall_percent + '%' );
|
1494 |
+
next_step_in_migration = {
|
1495 |
+
fn: migrate_table_recursive,
|
1496 |
+
args: [ row_information.current_row, row_information.primary_keys ]
|
1497 |
+
};
|
1498 |
execute_next_step();
|
1499 |
}
|
1500 |
+
} );
|
1501 |
|
1502 |
+
};
|
1503 |
|
1504 |
next_step_in_migration = { fn: migrate_table_recursive, args: [ '-1', '' ] };
|
1505 |
execute_next_step();
|
1506 |
|
1507 |
}
|
1508 |
|
1509 |
+
} ); // end ajax
|
1510 |
|
1511 |
+
} );
|
1512 |
|
1513 |
migration_complete_events = function() {
|
1514 |
+
if ( false === migration_error ) {
|
1515 |
+
if ( non_fatal_errors === '' ) {
|
1516 |
+
if ( 'savefile' !== migration_intent && true === $( '#save_computer' ).is( ':checked' ) ) {
|
1517 |
+
$( '.progress-text' ).css( 'visibility', 'hidden' );
|
1518 |
}
|
1519 |
+
$( '.progress-title' ).html( completed_msg ).append( '<div class="dashicons dashicons-yes"></div>' );
|
1520 |
}
|
1521 |
else {
|
1522 |
+
$( '.progress-text' ).html( non_fatal_errors );
|
1523 |
+
$( '.progress-text' ).addClass( 'migration-error' );
|
1524 |
+
$( '.progress-title' ).html( wpmdb_strings.completed_with_some_errors );
|
1525 |
}
|
1526 |
|
1527 |
+
$( '.progress-bar-wrapper' ).hide();
|
1528 |
}
|
1529 |
|
1530 |
+
$( '.migration-controls' ).hide();
|
1531 |
|
1532 |
// reset migration variables so consecutive migrations work correctly
|
1533 |
hooks = [];
|
1540 |
doing_ajax = false;
|
1541 |
non_fatal_errors = '';
|
1542 |
|
1543 |
+
$( '.progress-label' ).remove();
|
1544 |
+
$( '.migration-progress-ajax-spinner' ).remove();
|
1545 |
+
$( '.close-progress-content' ).show();
|
1546 |
+
$( '#overlay' ).css( 'cursor', 'pointer' );
|
1547 |
clearInterval( elapsed_interval );
|
1548 |
+
};
|
1549 |
|
1550 |
migration_complete = function() {
|
1551 |
+
$( '.migration-controls' ).fadeOut();
|
1552 |
+
if ( migration_intent === 'savefile' ) {
|
1553 |
currently_migrating = false;
|
1554 |
var migrate_complete_text = wpmdb_strings.migration_complete;
|
1555 |
+
if ( $( '#save_computer' ).is( ':checked' ) ) {
|
1556 |
+
var url = wpmdb_data.this_download_url + encodeURIComponent( dump_filename );
|
1557 |
+
if ( $( '#gzip_file' ).is( ':checked' ) ) {
|
1558 |
url += '&gzip=1';
|
1559 |
}
|
1560 |
window.location = url;
|
1561 |
}
|
1562 |
+
else {
|
1563 |
migrate_complete_text = wpmdb_strings.completed_dump_located_at + ' ' + dump_path;
|
1564 |
}
|
1565 |
|
1566 |
+
if ( migration_error === false ) {
|
1567 |
+
$( '.progress-text' ).html( migrate_complete_text );
|
1568 |
migration_complete_events();
|
1569 |
+
$( '.progress-title' ).html( completed_msg );
|
1570 |
}
|
1571 |
|
1572 |
}
|
1573 |
+
else { // rename temp tables, delete old tables
|
1574 |
+
$( '.progress-text' ).html( wpmdb_strings.finalizing_migration );
|
1575 |
+
doing_ajax = true;
|
1576 |
+
$.ajax( {
|
1577 |
+
url: ajaxurl,
|
1578 |
+
type: 'POST',
|
1579 |
+
dataType: 'text',
|
1580 |
+
cache: false,
|
1581 |
data: {
|
1582 |
+
action: 'wpmdb_finalize_migration',
|
1583 |
+
migration_state_id: migration_state_id,
|
1584 |
+
prefix: connection_data.prefix,
|
1585 |
+
tables: tables_to_migrate.join( ',' ),
|
1586 |
+
nonce: wpmdb_data.nonces.finalize_migration
|
|
|
|
|
|
|
|
|
1587 |
},
|
1588 |
+
error: function( jqXHR, textStatus, errorThrown ) {
|
1589 |
+
doing_ajax = false;
|
1590 |
+
$( '.progress-title' ).html( wpmdb_strings.migration_failed );
|
1591 |
+
$( '.progress-text' ).html( wpmdb_strings.finalize_tables_problem );
|
1592 |
+
$( '.progress-text' ).addClass( 'migration-error' );
|
1593 |
alert( jqXHR + ' : ' + textStatus + ' : ' + errorThrown );
|
1594 |
migration_error = true;
|
1595 |
migration_complete_events();
|
1596 |
return;
|
1597 |
},
|
1598 |
+
success: function( data ) {
|
1599 |
+
doing_ajax = false;
|
1600 |
+
if ( '1' !== $.trim( data ) ) {
|
1601 |
+
$( '.progress-title' ).html( wpmdb_strings.migration_failed );
|
1602 |
+
$( '.progress-text' ).html( data );
|
1603 |
+
$( '.progress-text' ).addClass( 'migration-error' );
|
1604 |
migration_error = true;
|
1605 |
migration_complete_events();
|
1606 |
return;
|
1608 |
next_step_in_migration = { fn: wpmdb_call_next_hook };
|
1609 |
execute_next_step();
|
1610 |
}
|
1611 |
+
} );
|
1612 |
}
|
1613 |
+
};
|
1614 |
|
1615 |
+
wpmdb_flush = function() {
|
1616 |
+
if ( migration_intent !== 'savefile' ) {
|
1617 |
+
$( '.progress-text' ).html( wpmdb_strings.flushing );
|
1618 |
+
doing_ajax = true;
|
1619 |
+
$.ajax( {
|
1620 |
+
url: ajaxurl,
|
1621 |
+
type: 'POST',
|
1622 |
+
dataType: 'text',
|
1623 |
+
cache: false,
|
1624 |
+
data: {
|
1625 |
+
action: 'wpmdb_flush',
|
1626 |
+
migration_state_id: migration_state_id,
|
1627 |
+
nonce: wpmdb_data.nonces.flush
|
1628 |
+
},
|
1629 |
+
error: function( jqXHR, textStatus, errorThrown ) {
|
1630 |
+
doing_ajax = false;
|
1631 |
+
$( '.progress-title' ).html( wpmdb_strings.migration_failed );
|
1632 |
+
$( '.progress-text' ).html( wpmdb_strings.flush_problem );
|
1633 |
+
$( '.progress-text' ).addClass( 'migration-error' );
|
1634 |
+
alert( jqXHR + ' : ' + textStatus + ' : ' + errorThrown );
|
1635 |
+
migration_error = true;
|
1636 |
+
migration_complete_events();
|
1637 |
+
return;
|
1638 |
+
},
|
1639 |
+
success: function( data ) {
|
1640 |
+
doing_ajax = false;
|
1641 |
+
if ( '1' !== $.trim( data ) ) {
|
1642 |
+
$( '.progress-title' ).html( wpmdb_strings.migration_failed );
|
1643 |
+
$( '.progress-text' ).html( data );
|
1644 |
+
$( '.progress-text' ).addClass( 'migration-error' );
|
1645 |
+
migration_error = true;
|
1646 |
+
migration_complete_events();
|
1647 |
+
return;
|
1648 |
+
}
|
1649 |
+
next_step_in_migration = { fn: wpmdb_call_next_hook };
|
1650 |
+
execute_next_step();
|
1651 |
+
}
|
1652 |
+
} );
|
1653 |
+
}
|
1654 |
+
};
|
1655 |
|
1656 |
// close progress pop up once migration is completed
|
1657 |
+
$( 'body' ).on( 'click', '.close-progress-content-button', function( e ) {
|
1658 |
hide_overlay();
|
1659 |
+
} );
|
1660 |
|
1661 |
+
$( 'body' ).on( 'click', '#overlay', function() {
|
1662 |
+
if ( migration_completed === true ) {
|
1663 |
hide_overlay();
|
1664 |
}
|
1665 |
+
} );
|
1666 |
|
1667 |
+
function hide_overlay() {
|
1668 |
+
var height = $( '.progress-content' ).outerHeight();
|
1669 |
+
$( '.progress-content' ).animate( { 'top': '-' + height + 'px' }, 400, 'swing', function() {
|
1670 |
+
$( '#overlay' ).remove();
|
1671 |
+
$( '.progress-content' ).remove();
|
1672 |
+
} );
|
1673 |
migration_completed = false;
|
1674 |
}
|
1675 |
|
1676 |
// AJAX save button profile
|
1677 |
+
$( '.save-settings-button' ).click( function( event ) {
|
|
|
|
|
1678 |
event.preventDefault();
|
1679 |
+
if ( $.trim( $( '.create-new-profile' ).val() ) === '' && $( '#create_new' ).is( ':checked' ) ) {
|
1680 |
+
alert( wpmdb_strings.enter_name_for_profile );
|
1681 |
+
$( '.create-new-profile' ).focus();
|
1682 |
return;
|
1683 |
}
|
1684 |
+
save_active_profile();
|
1685 |
+
} );
|
1686 |
|
1687 |
+
function save_active_profile() {
|
1688 |
+
var profile;
|
1689 |
+
$( '.save-settings-button' ).blur();
|
1690 |
+
|
1691 |
+
|
1692 |
+
if ( doing_save_profile ) {
|
1693 |
return;
|
1694 |
}
|
1695 |
|
1696 |
+
// check that they've selected some tables to migrate
|
1697 |
+
if ( $( '#migrate-selected' ).is( ':checked' ) && $( '#select-tables' ).val() === null ) {
|
1698 |
+
alert( wpmdb_strings.please_select_one_table );
|
1699 |
return;
|
1700 |
}
|
1701 |
|
1702 |
var create_new_profile = false;
|
1703 |
|
1704 |
+
if ( $( '#create_new' ).is( ':checked' ) ) {
|
1705 |
create_new_profile = true;
|
1706 |
}
|
1707 |
+
var profile_name = $( '.create-new-profile' ).val();
|
1708 |
|
1709 |
doing_save_profile = true;
|
1710 |
+
profile = $( '#migrate-form' ).serialize();
|
1711 |
|
1712 |
+
$( '.save-settings-button' ).attr( 'disabled', 'disabled' )
|
1713 |
+
.after( '<img src="' + spinner_url + '" alt="" class="save-profile-ajax-spinner general-spinner" />' );
|
1714 |
|
1715 |
+
doing_ajax = true;
|
1716 |
+
|
1717 |
+
$.ajax( {
|
1718 |
+
url: ajaxurl,
|
1719 |
+
type: 'POST',
|
1720 |
+
dataType: 'text',
|
1721 |
+
cache: false,
|
1722 |
data: {
|
1723 |
+
action: 'wpmdb_save_profile',
|
1724 |
+
profile: profile,
|
1725 |
+
nonce: wpmdb_data.nonces.save_profile
|
1726 |
},
|
1727 |
+
error: function( jqXHR, textStatus, errorThrown ) {
|
1728 |
+
doing_ajax = false;
|
1729 |
alert( wpmdb_strings.save_profile_problem );
|
1730 |
+
$( '.save-settings-button' ).removeAttr( 'disabled' );
|
1731 |
+
$( '.save-profile-ajax-spinner' ).remove();
|
1732 |
+
$( '.save-settings-button' ).after( '<span class="ajax-success-msg">' + wpmdb_strings.saved + '</span>' );
|
1733 |
+
$( '.ajax-success-msg' ).fadeOut( 2000, function() {
|
1734 |
+
$( this ).remove();
|
1735 |
+
} );
|
1736 |
doing_save_profile = false;
|
1737 |
},
|
1738 |
+
success: function( data ) {
|
1739 |
+
var updated_profile_id = parseInt( $( '#migrate-form input[name=save_migration_profile_option]:checked' ).val(), 10 ) + 1;
|
1740 |
+
doing_ajax = false;
|
1741 |
+
$( '.save-settings-button' ).removeAttr( 'disabled' );
|
1742 |
+
$( '.save-profile-ajax-spinner' ).remove();
|
1743 |
+
$( '.save-settings-button' ).after( '<span class="ajax-success-msg">' + wpmdb_strings.saved + '</span>' );
|
1744 |
+
$( '.ajax-success-msg' ).fadeOut( 2000, function() {
|
1745 |
+
$( this ).remove();
|
1746 |
+
} );
|
1747 |
doing_save_profile = false;
|
1748 |
+
$( '.create-new-profile' ).val( '' );
|
1749 |
|
1750 |
+
if ( create_new_profile ) {
|
1751 |
+
var new_profile_key = parseInt( data, 10 );
|
1752 |
var new_profile_id = new_profile_key + 1;
|
1753 |
+
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>' );
|
1754 |
+
new_li.find( "label" ).append( document.createTextNode( " " + profile_name ) );
|
1755 |
+
updated_profile_id = new_profile_id;
|
1756 |
|
1757 |
+
$( '#create_new' ).parents( 'li' ).before( new_li );
|
1758 |
+
$( '#profile-' + new_profile_id ).attr( 'checked', 'checked' );
|
1759 |
+
}
|
1760 |
+
// push updated profile id to history if available
|
1761 |
+
var updatedURL = window.location.href.replace( '#migrate', '' ).replace( /&wpmdb-profile=-?\d+/, '' ) + '&wpmdb-profile=' + updated_profile_id;
|
1762 |
+
var updated_profile_name = $( '#migrate-form input[name=save_migration_profile_option]:checked' ).parent().text().trim();
|
1763 |
+
|
1764 |
+
if ( 'function' === typeof window.history.pushState ) {
|
1765 |
+
if ( $( '#migrate-form .crumbs' ).length ) {
|
1766 |
+
$( '#migrate-form .crumbs .crumb:last' ).text( updated_profile_name );
|
1767 |
+
} else {
|
1768 |
+
var $crumbs = $( '<div class="crumbs" />' )
|
1769 |
+
.append( '<a class="crumb" href="tools.php?page=wp-migrate-db-pro"> Saved Profiles </a>' )
|
1770 |
+
.append( '<span class="crumb">' + updated_profile_name + '</span>' );
|
1771 |
+
$( '#migrate-form' ).prepend( $crumbs );
|
1772 |
+
}
|
1773 |
+
window.history.pushState( { updated_profile_id: updated_profile_id }, null, updatedURL );
|
1774 |
}
|
|
|
1775 |
}
|
1776 |
+
} );
|
1777 |
+
}
|
|
|
1778 |
|
1779 |
// progress label updating
|
1780 |
+
$( 'body' ).on( 'mousemove', '.progress-chunk-hover', function( e ) {
|
1781 |
+
var mX = e.pageX;
|
1782 |
+
var offset = $( '.progress-bar-wrapper' ).offset();
|
1783 |
+
var label_offset = $( '.progress-label' ).outerWidth() / 2;
|
1784 |
mX = ( mX - offset.left ) - label_offset;
|
1785 |
+
$( '.progress-label' ).css( 'left', mX + 'px' );
|
1786 |
+
$( '.progress-label' ).html( $( this ).attr( 'data-table' ) );
|
1787 |
+
} );
|
1788 |
|
1789 |
// show / hide progress lavel on hover
|
1790 |
+
$( 'body' ).on( 'mouseenter mouseleave', '.progress-chunk-hover', function( event ) {
|
1791 |
+
if ( event.type === 'mouseenter' ) {
|
1792 |
+
$( '.progress-label' ).addClass( 'label-visible' );
|
|
|
|
|
|
|
1793 |
}
|
1794 |
+
else {
|
1795 |
+
$( '.progress-label' ).removeClass( 'label-visible' );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1796 |
}
|
1797 |
+
} );
|
1798 |
|
1799 |
// save file (export) / push / pull special conditions
|
1800 |
+
function move_connection_info_box() {
|
1801 |
+
$( '.connection-status' ).hide();
|
1802 |
+
$( '.prefix-notice' ).hide();
|
1803 |
+
$( '.ssl-notice' ).hide();
|
1804 |
+
$( '.different-plugin-version-notice' ).hide();
|
1805 |
+
$( '.step-two' ).show();
|
1806 |
+
$( '.backup-options' ).show();
|
1807 |
+
$( '.keep-active-plugins' ).show();
|
1808 |
+
$( '.directory-permission-notice' ).hide();
|
1809 |
+
$( '#create-backup' ).removeAttr( 'disabled' );
|
1810 |
+
$( '#create-backup-label' ).removeClass( 'disabled' );
|
1811 |
+
$( '.backup-option-disabled' ).hide();
|
1812 |
+
$( '.compatibility-older-mysql' ).hide();
|
1813 |
+
var connection_info = $.trim( $( '.pull-push-connection-info' ).val() ).split( "\n" );
|
1814 |
+
var profile_name;
|
1815 |
+
wpmdb_toggle_migration_action_text();
|
1816 |
+
if ( 'pull' === wpmdb_migration_type() ) {
|
1817 |
+
$( '.pull-list li' ).append( $connection_info_box );
|
1818 |
+
$connection_info_box.show( function() {
|
1819 |
+
var connection_textarea = $( this ).find( '.pull-push-connection-info' );
|
1820 |
+
if ( ! connection_textarea.val() ) {
|
1821 |
+
connection_textarea.focus();
|
|
|
|
|
|
|
|
|
1822 |
}
|
1823 |
+
} );
|
1824 |
+
if ( connection_established ) {
|
1825 |
+
$( '.connection-status' ).hide();
|
1826 |
+
$( '.step-two' ).show();
|
1827 |
+
$( '.table-prefix' ).html( connection_data.prefix );
|
1828 |
+
$( '.uploads-dir' ).html( wpmdb_data.this_uploads_dir );
|
1829 |
+
if ( profile_name_edited === false ) {
|
1830 |
+
profile_name = get_domain_name( connection_data.url );
|
1831 |
+
$( '.create-new-profile' ).val( profile_name );
|
1832 |
}
|
1833 |
+
if ( show_prefix_notice === true ) {
|
1834 |
+
$( '.prefix-notice.pull' ).show();
|
1835 |
}
|
1836 |
+
if ( show_ssl_notice === true ) {
|
1837 |
+
$( '.ssl-notice' ).show();
|
|
|
1838 |
}
|
1839 |
+
if ( show_version_notice === true ) {
|
1840 |
+
$( '.different-plugin-version-notice' ).show();
|
1841 |
+
$( '.step-two' ).hide();
|
1842 |
+
}
|
1843 |
+
wpmdb_toggle_migration_action_text();
|
1844 |
+
if ( false === wpmdb_data.write_permission ) {
|
1845 |
+
$( '#create-backup' ).prop( 'checked', false );
|
1846 |
+
$( '#create-backup' ).attr( 'disabled', 'disabled' );
|
1847 |
+
$( '#create-backup-label' ).addClass( 'disabled' );
|
1848 |
+
$( '.backup-option-disabled' ).show();
|
1849 |
+
$( '.upload-directory-location' ).html( wpmdb_data.this_upload_dir_long );
|
1850 |
}
|
1851 |
}
|
1852 |
+
else {
|
1853 |
+
$( '.connection-status' ).show();
|
1854 |
+
$( '.step-two' ).hide();
|
1855 |
}
|
1856 |
}
|
1857 |
+
else if ( 'push' === wpmdb_migration_type() ) {
|
1858 |
+
$( '.push-list li' ).append( $connection_info_box );
|
1859 |
+
$connection_info_box.show( function() {
|
1860 |
+
var connection_textarea = $( this ).find( '.pull-push-connection-info' );
|
1861 |
+
if ( ! connection_textarea.val() ) {
|
1862 |
+
connection_textarea.focus();
|
1863 |
+
}
|
1864 |
+
} );
|
1865 |
+
if ( connection_established ) {
|
1866 |
+
$( '.connection-status' ).hide();
|
1867 |
+
$( '.step-two' ).show();
|
1868 |
+
$( '.table-prefix' ).html( wpmdb_data.this_prefix );
|
1869 |
+
$( '.uploads-dir' ).html( connection_data.uploads_dir );
|
1870 |
+
if ( profile_name_edited === false ) {
|
1871 |
+
profile_name = get_domain_name( connection_data.url );
|
1872 |
+
$( '.create-new-profile' ).val( profile_name );
|
1873 |
}
|
1874 |
+
if ( show_prefix_notice === true ) {
|
1875 |
+
$( '.prefix-notice.push' ).show();
|
1876 |
}
|
1877 |
+
if ( show_ssl_notice === true ) {
|
1878 |
+
$( '.ssl-notice' ).show();
|
1879 |
}
|
1880 |
+
if ( show_version_notice === true ) {
|
1881 |
+
$( '.different-plugin-version-notice' ).show();
|
1882 |
+
$( '.step-two' ).hide();
|
1883 |
}
|
1884 |
+
wpmdb_toggle_migration_action_text();
|
1885 |
+
if ( '0' === connection_data.write_permissions ) {
|
1886 |
+
$( '#create-backup' ).prop( 'checked', false );
|
1887 |
+
$( '#create-backup' ).attr( 'disabled', 'disabled' );
|
1888 |
+
$( '#create-backup-label' ).addClass( 'disabled' );
|
1889 |
+
$( '.backup-option-disabled' ).show();
|
1890 |
+
$( '.upload-directory-location' ).html( connection_data.upload_dir_long );
|
1891 |
}
|
1892 |
}
|
1893 |
+
else {
|
1894 |
+
$( '.connection-status' ).show();
|
1895 |
+
$( '.step-two' ).hide();
|
1896 |
}
|
1897 |
}
|
1898 |
+
else if ( 'savefile' === wpmdb_migration_type() ) {
|
1899 |
+
$( '.connection-status' ).hide();
|
1900 |
+
$( '.step-two' ).show();
|
1901 |
+
$( '.table-prefix' ).html( wpmdb_data.this_prefix );
|
1902 |
+
$( '.compatibility-older-mysql' ).show();
|
1903 |
+
if ( profile_name_edited === false ) {
|
1904 |
+
$( '.create-new-profile' ).val( '' );
|
1905 |
}
|
1906 |
+
$( '.backup-options' ).hide();
|
1907 |
+
$( '.keep-active-plugins' ).hide();
|
1908 |
+
if ( false === wpmdb_data.write_permission ) {
|
1909 |
+
$( '.directory-permission-notice' ).show();
|
1910 |
+
$( '.step-two' ).hide();
|
1911 |
}
|
1912 |
}
|
1913 |
maybe_show_mixed_cased_table_name_warning();
|
1914 |
+
$.wpmdb.do_action( 'move_connection_info_box', {
|
1915 |
+
'migration_type': wpmdb_migration_type(),
|
1916 |
+
'last_migration_type': last_replace_switch
|
1917 |
+
} );
|
1918 |
}
|
1919 |
|
1920 |
+
// move around textarea depending on whether or not the push/pull options are selected
|
1921 |
+
var $connection_info_box = $( '.connection-info-wrapper' );
|
1922 |
+
move_connection_info_box();
|
1923 |
+
|
1924 |
+
$( '.migrate-selection.option-group input[type=radio]' ).change( function() {
|
1925 |
+
move_connection_info_box();
|
1926 |
+
if ( connection_established ) {
|
1927 |
+
change_replace_values();
|
1928 |
+
}
|
1929 |
+
} );
|
1930 |
+
|
1931 |
+
function change_replace_values() {
|
1932 |
+
if ( 'push' === wpmdb_migration_type() || 'savefile' === wpmdb_migration_type() ) {
|
1933 |
+
if ( 'pull' === last_replace_switch ) {
|
1934 |
+
$( '.replace-row' ).each( function() {
|
1935 |
+
var old_val = $( '.old-replace-col input', this ).val();
|
1936 |
+
$( '.old-replace-col input', this ).val( $( '.replace-right-col input', this ).val() );
|
1937 |
+
$( '.replace-right-col input', this ).val( old_val );
|
1938 |
+
} );
|
1939 |
}
|
1940 |
+
$.wpmdb.do_action( 'wpmdb_update_push_table_select' );
|
1941 |
+
$( '#select-post-types' ).remove();
|
1942 |
+
$( '.select-post-types-wrap' ).prepend( $push_post_type_select );
|
1943 |
+
$( '#select-backup' ).remove();
|
1944 |
+
$( '.backup-tables-wrap' ).prepend( $push_select_backup );
|
1945 |
+
}
|
1946 |
+
else if ( 'pull' === wpmdb_migration_type() ) {
|
1947 |
+
if ( '' === last_replace_switch || 'push' === last_replace_switch || 'savefile' === last_replace_switch ) {
|
1948 |
+
$( '.replace-row' ).each( function() {
|
1949 |
+
var old_val = $( '.old-replace-col input', this ).val();
|
1950 |
+
$( '.old-replace-col input', this ).val( $( '.replace-right-col input', this ).val() );
|
1951 |
+
$( '.replace-right-col input', this ).val( old_val );
|
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
|
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 ( nav_tab.length === 1 ) {
|
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 ( $( '.replace-row' ).length < 2 ) {
|
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 ( hash === 'help' ) {
|
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 ( hash === 'addons' && 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 ( $( this ).val() === 'backup_manual_select' ) {
|
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 ( data === '-1' ) {
|
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 |
}
|
2351 |
+
else {
|
2352 |
+
$( '.ssl-notice' ).hide();
|
2353 |
+
$( '.different-plugin-version-notice' ).hide();
|
2354 |
+
$( '.migrate-db-button' ).show();
|
2355 |
+
$( '.temp-disabled' ).removeAttr( 'readonly' );
|
2356 |
+
$( '.temp-disabled' ).removeClass( 'temp-disabled' );
|
2357 |
+
$( '.connect-button' ).show();
|
2358 |
+
$( '.step-two' ).hide();
|
2359 |
+
$( '.connection-status' ).show().html( wpmdb_strings.enter_connection_info );
|
2360 |
connection_established = false;
|
2361 |
}
|
2362 |
+
} );
|
2363 |
|
2364 |
// ajax request for settings page when checking/unchecking setting radio buttons
|
2365 |
+
$( '.settings-tab input[type=checkbox]' ).change( function() {
|
2366 |
+
if ( 'plugin-compatibility' === $( this ).attr( 'id' ) ) {
|
2367 |
+
return;
|
2368 |
+
}
|
2369 |
+
var checked = $( this ).is( ':checked' );
|
2370 |
+
var setting = $( this ).attr( 'id' );
|
2371 |
+
|
2372 |
+
$( this ).parent().append( ajax_spinner );
|
2373 |
+
var $label = $( this ).parent();
|
2374 |
+
|
2375 |
+
$.ajax( {
|
2376 |
+
url: ajaxurl,
|
2377 |
+
type: 'POST',
|
2378 |
+
dataType: 'text',
|
2379 |
+
cache: false,
|
2380 |
data: {
|
2381 |
+
action: 'wpmdb_save_setting',
|
2382 |
+
checked: checked,
|
2383 |
+
setting: setting,
|
2384 |
+
nonce: wpmdb_data.nonces.save_setting
|
2385 |
},
|
2386 |
+
error: function( jqXHR, textStatus, errorThrown ) {
|
2387 |
alert( wpmdb_strings.save_settings_problem );
|
2388 |
+
$( '.ajax-spinner' ).remove();
|
2389 |
},
|
2390 |
+
success: function( data ) {
|
2391 |
+
$( '.ajax-spinner' ).remove();
|
2392 |
+
$( $label ).append( '<span class="ajax-success-msg">' + wpmdb_strings.saved + '</span>' );
|
2393 |
+
$( '.ajax-success-msg' ).fadeOut( 2000, function() {
|
2394 |
+
$( this ).remove();
|
2395 |
+
} );
|
2396 |
}
|
2397 |
+
} );
|
2398 |
|
2399 |
+
} );
|
2400 |
|
2401 |
// disable form submissions
|
2402 |
+
$( '.migrate-form' ).submit( function( e ) {
|
2403 |
e.preventDefault();
|
2404 |
+
} );
|
2405 |
|
2406 |
// fire connection_box_changed when the connect button is pressed
|
2407 |
+
$( '.connect-button' ).click( function( event ) {
|
2408 |
event.preventDefault();
|
2409 |
+
$( this ).blur();
|
2410 |
connection_box_changed();
|
2411 |
+
} );
|
2412 |
|
2413 |
// send paste even to connection_box_changed() function
|
2414 |
+
$( '.pull-push-connection-info' ).bind( 'paste', function( e ) {
|
2415 |
var $this = this;
|
2416 |
+
setTimeout( function() {
|
2417 |
connection_box_changed();
|
2418 |
+
}, 0 );
|
2419 |
|
2420 |
+
} );
|
2421 |
|
2422 |
+
$( 'body' ).on( 'click', '.try-again', function() {
|
2423 |
connection_box_changed();
|
2424 |
+
} );
|
2425 |
|
2426 |
+
$( 'body' ).on( 'click', '.try-http', function() {
|
2427 |
+
var connection_info = $.trim( $( '.pull-push-connection-info' ).val() ).split( "\n" );
|
2428 |
+
var new_url = connection_info[ 0 ].replace( 'https', 'http' );
|
2429 |
+
var new_contents = new_url + "\n" + connection_info[ 1 ];
|
2430 |
+
$( '.pull-push-connection-info' ).val( new_contents );
|
2431 |
connection_box_changed();
|
2432 |
+
} );
|
2433 |
|
2434 |
+
$( '.create-new-profile' ).change( function() {
|
2435 |
profile_name_edited = true;
|
2436 |
+
} );
|
2437 |
|
2438 |
+
$( 'body' ).on( 'click', '.temporarily-disable-ssl', function() {
|
2439 |
+
var hash = '';
|
2440 |
+
if ( window.location.hash ) {
|
2441 |
+
hash = window.location.hash.substring( 1 );
|
2442 |
}
|
2443 |
+
$( this ).attr( 'href', $( this ).attr( 'href' ) + '&hash=' + hash );
|
2444 |
+
} );
|
2445 |
|
2446 |
// fired when the connection info box changes (e.g. gets pasted into)
|
2447 |
+
function connection_box_changed( data ) {
|
2448 |
+
var $this = $( '.pull-push-connection-info' );
|
2449 |
|
2450 |
+
if ( doing_ajax || $( $this ).hasClass( 'temp-disabled' ) ) {
|
2451 |
return;
|
2452 |
}
|
2453 |
|
2454 |
+
data = $( '.pull-push-connection-info' ).val();
|
2455 |
|
2456 |
+
var connection_info = $.trim( data ).split( "\n" );
|
2457 |
var error = false;
|
2458 |
var error_message = '';
|
2459 |
|
2460 |
+
if ( connection_info === '' ) {
|
2461 |
error = true;
|
2462 |
error_message = wpmdb_strings.connection_info_missing;
|
2463 |
}
|
2464 |
|
2465 |
+
if ( connection_info.length !== 2 && ! error ) {
|
2466 |
error = true;
|
2467 |
error_message = wpmdb_strings.connection_info_incorrect;
|
2468 |
}
|
2469 |
|
2470 |
+
if ( ! error && ! validate_url( connection_info[ 0 ] ) ) {
|
2471 |
error = true;
|
2472 |
error_message = wpmdb_strings.connection_info_url_invalid;
|
2473 |
}
|
2474 |
|
2475 |
+
if ( ! error && connection_info[ 1 ].length < 32 ) {
|
2476 |
error = true;
|
2477 |
error_message = wpmdb_strings.connection_info_key_invalid;
|
2478 |
}
|
2479 |
|
2480 |
+
if ( ! error && connection_info[ 0 ] === wpmdb_data.connection_info[ 0 ] ) {
|
2481 |
error = true;
|
2482 |
error_message = wpmdb_strings.connection_info_local_url;
|
2483 |
}
|
2484 |
|
2485 |
+
if ( ! error && connection_info[ 1 ] === wpmdb_data.connection_info[ 1 ] ) {
|
2486 |
error = true;
|
2487 |
error_message = wpmdb_strings.connection_info_local_key;
|
2488 |
}
|
2489 |
|
2490 |
+
if ( error ) {
|
2491 |
+
$( '.connection-status' ).html( error_message );
|
2492 |
+
$( '.connection-status' ).addClass( 'notification-message error-notice migration-error' );
|
2493 |
return;
|
2494 |
}
|
2495 |
|
2496 |
+
var new_connection_info_contents = connection_info[ 0 ] + "\n" + connection_info[ 1 ];
|
2497 |
+
|
2498 |
+
if ( false === wpmdb_data.openssl_available ) {
|
2499 |
+
connection_info[ 0 ] = connection_info[ 0 ].replace( 'https://', 'http://' );
|
2500 |
+
new_connection_info_contents = connection_info[ 0 ] + "\n" + connection_info[ 1 ];
|
2501 |
+
$( '.pull-push-connection-info' ).val( new_connection_info_contents );
|
2502 |
}
|
2503 |
|
2504 |
show_prefix_notice = false;
|
2505 |
doing_ajax = true;
|
2506 |
disable_export_type_controls();
|
2507 |
|
2508 |
+
if ( $( '.basic-access-auth-wrapper' ).is( ':visible' ) ) {
|
2509 |
+
connection_info[ 0 ] = connection_info[ 0 ].replace( /\/\/(.*)@/, '//' );
|
2510 |
+
connection_info[ 0 ] = connection_info[ 0 ].replace( '//', '//' + encodeURIComponent( $.trim( $( '.auth-username' ).val() ) ) + ':' + encodeURIComponent( $.trim( $( '.auth-password' ).val() ) ) + '@' );
|
2511 |
+
new_connection_info_contents = connection_info[ 0 ] + "\n" + connection_info[ 1 ];
|
2512 |
+
$( '.pull-push-connection-info' ).val( new_connection_info_contents );
|
2513 |
+
$( '.basic-access-auth-wrapper' ).hide();
|
2514 |
}
|
2515 |
|
2516 |
+
$( '.step-two' ).hide();
|
2517 |
+
$( '.ssl-notice' ).hide();
|
2518 |
+
$( '.prefix-notice' ).hide();
|
2519 |
+
$( '.connection-status' ).show();
|
2520 |
|
2521 |
+
$( '.connection-status' ).html( wpmdb_strings.establishing_remote_connection );
|
2522 |
+
$( '.connection-status' ).removeClass( 'notification-message error-notice migration-error' );
|
2523 |
+
$( '.connection-status' ).append( ajax_spinner );
|
2524 |
|
2525 |
+
var intent = wpmdb_migration_type();
|
2526 |
|
2527 |
profile_name_edited = false;
|
2528 |
|
2529 |
+
$.ajax( {
|
2530 |
+
url: ajaxurl,
|
2531 |
+
type: 'POST',
|
2532 |
+
dataType: 'json',
|
2533 |
+
cache: false,
|
2534 |
data: {
|
2535 |
+
action: 'wpmdb_verify_connection_to_remote_site',
|
2536 |
+
url: connection_info[ 0 ],
|
2537 |
+
key: connection_info[ 1 ],
|
2538 |
+
intent: intent,
|
2539 |
+
nonce: wpmdb_data.nonces.verify_connection_to_remote_site
|
2540 |
},
|
2541 |
+
error: function( jqXHR, textStatus, errorThrown ) {
|
2542 |
+
$( '.connection-status' ).html( getAjaxErrors( jqXHR.responseText, '(#100)', jqXHR ) );
|
2543 |
+
$( '.connection-status' ).addClass( 'notification-message error-notice migration-error' );
|
2544 |
+
$( '.ajax-spinner' ).remove();
|
2545 |
doing_ajax = false;
|
2546 |
enable_export_type_controls();
|
2547 |
},
|
2548 |
+
success: function( data ) {
|
2549 |
+
$( '.ajax-spinner' ).remove();
|
2550 |
doing_ajax = false;
|
2551 |
enable_export_type_controls();
|
2552 |
+
maybe_show_ssl_warning( connection_info[ 0 ], connection_info[ 1 ], data.scheme );
|
2553 |
|
2554 |
+
if ( typeof data.wpmdb_error !== 'undefined' && data.wpmdb_error === 1 ) {
|
2555 |
+
$( '.connection-status' ).html( data.body );
|
2556 |
+
$( '.connection-status' ).addClass( 'notification-message error-notice migration-error' );
|
2557 |
|
2558 |
+
if ( data.body.indexOf( '401 Unauthorized' ) > -1 ) {
|
2559 |
+
$( '.basic-access-auth-wrapper' ).show();
|
2560 |
}
|
2561 |
|
2562 |
return;
|
2563 |
}
|
2564 |
|
2565 |
var profile_name = get_domain_name( data.url );
|
2566 |
+
$( '.create-new-profile' ).val( profile_name );
|
2567 |
|
2568 |
+
$( '.pull-push-connection-info' ).addClass( 'temp-disabled' );
|
2569 |
+
$( '.pull-push-connection-info' ).attr( 'readonly', 'readonly' );
|
2570 |
+
$( '.connect-button' ).hide();
|
2571 |
|
2572 |
+
$( '.connection-status' ).hide();
|
2573 |
+
$( '.step-two' ).show();
|
2574 |
|
|
|
2575 |
maybe_show_prefix_notice( data.prefix );
|
2576 |
|
2577 |
connection_established = true;
|
2578 |
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( 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 |
}
|
2623 |
+
else {
|
2624 |
+
$( '#new-url' ).val( remove_protocol( data.url ) );
|
2625 |
+
$( '#new-path' ).val( data.path );
|
2626 |
+
if ( 'true' === wpmdb_data.is_multisite ) {
|
2627 |
+
$( '.replace-row.pin .old-replace-col input[type="text"]' ).val( remove_protocol( wpmdb_data.this_url ) );
|
2628 |
+
}
|
2629 |
+
$.wpmdb.do_action( 'wpmdb_update_push_table_select' );
|
2630 |
+
$( '#select-backup' ).remove();
|
2631 |
+
$( '.backup-tables-wrap' ).prepend( $push_select_backup );
|
2632 |
}
|
2633 |
|
2634 |
+
next_step_in_migration = {
|
2635 |
+
fn: $.wpmdb.do_action,
|
2636 |
+
args: [ 'verify_connection_to_remote_site', connection_data ]
|
2637 |
+
};
|
2638 |
execute_next_step();
|
2639 |
}
|
2640 |
|
2641 |
+
} );
|
2642 |
|
2643 |
}
|
2644 |
|
2645 |
+
// Sets the initial Pause/Resume button event to Pause
|
2646 |
+
$( 'body' ).on( 'click', '.pause-resume', function( event ) {
|
2647 |
+
set_pause_resume_button( event );
|
2648 |
+
} );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2649 |
|
2650 |
+
function cancel_migration( event ) {
|
2651 |
migration_cancelled = true;
|
2652 |
+
$( '.progress-text' ).html( wpmdb_strings.completing_current_request );
|
2653 |
+
$( '.progress-title' ).html( wpmdb_strings.cancelling_migration );
|
2654 |
+
$( '.migration-controls' ).fadeOut();
|
2655 |
+
$( '.migration-progress-ajax-spinner' ).show();
|
|
|
2656 |
|
2657 |
+
if ( true === migration_paused ) {
|
2658 |
+
migration_paused = false;
|
2659 |
execute_next_step();
|
2660 |
}
|
2661 |
+
}
|
2662 |
|
2663 |
+
$( 'body' ).on( 'click', '.cancel', function( event ) {
|
2664 |
+
cancel_migration( event );
|
2665 |
+
} );
|
2666 |
+
|
2667 |
+
$( '.enter-licence' ).click( function() {
|
2668 |
+
$( '.settings' ).click();
|
2669 |
+
$( '.licence-input' ).focus();
|
2670 |
+
} );
|
2671 |
|
2672 |
execute_next_step = function() {
|
2673 |
+
|
2674 |
+
// if delay is set, set a timeout for delay to recall this function, then return
|
2675 |
+
if ( 0 < delay_between_requests && false === flag_skip_delay ) {
|
2676 |
+
setTimeout( function() {
|
2677 |
+
flag_skip_delay = true;
|
2678 |
+
execute_next_step();
|
2679 |
+
}, delay_between_requests );
|
2680 |
+
return;
|
2681 |
+
} else {
|
2682 |
+
flag_skip_delay = false;
|
2683 |
+
}
|
2684 |
+
|
2685 |
+
if ( true === migration_paused ) {
|
2686 |
+
$( '.migration-progress-ajax-spinner' ).hide();
|
2687 |
// pause the timer
|
2688 |
clearInterval( elapsed_interval );
|
2689 |
+
$( '.progress-text' ).html( wpmdb_strings.paused );
|
2690 |
+
// Re-bind Pause/Resume button to Resume when we are finally Paused
|
2691 |
+
$( 'body' ).on( 'click', '.pause-resume', function( event ) {
|
2692 |
+
set_pause_resume_button( event );
|
2693 |
+
} );
|
2694 |
+
$( 'body' ).on( 'click', '.cancel', function( event ) {
|
2695 |
+
cancel_migration( event );
|
2696 |
+
} );
|
2697 |
+
$( '.pause-resume' ).html( wpmdb_strings.resume );
|
2698 |
return;
|
2699 |
}
|
2700 |
+
else if ( true === migration_cancelled ) {
|
2701 |
+
migration_intent = wpmdb_migration_type();
|
2702 |
+
|
2703 |
+
var progress_msg;
|
2704 |
|
2705 |
+
if ( 'savefile' === migration_intent ) {
|
2706 |
progress_msg = wpmdb_strings.removing_local_sql;
|
2707 |
}
|
2708 |
+
else if ( 'pull' === migration_intent ) {
|
2709 |
+
if ( 'backup' === stage ) {
|
2710 |
progress_msg = wpmdb_strings.removing_local_backup;
|
2711 |
}
|
2712 |
else {
|
2713 |
progress_msg = wpmdb_strings.removing_local_temp_tables;
|
2714 |
}
|
2715 |
}
|
2716 |
+
else if ( 'push' === migration_intent ) {
|
2717 |
+
if ( 'backup' === stage ) {
|
2718 |
progress_msg = wpmdb_strings.removing_remote_sql;
|
2719 |
}
|
2720 |
else {
|
2721 |
progress_msg = wpmdb_strings.removing_remote_temp_tables;
|
2722 |
}
|
2723 |
}
|
2724 |
+
$( '.progress-text' ).html( progress_msg );
|
2725 |
+
|
2726 |
+
var request_data = {
|
2727 |
+
action: 'wpmdb_cancel_migration',
|
2728 |
+
migration_state_id: migration_state_id
|
|
|
|
|
|
|
|
|
|
|
2729 |
};
|
2730 |
|
2731 |
+
doing_ajax = true;
|
|
|
|
|
2732 |
|
2733 |
+
$.ajax( {
|
2734 |
+
url: ajaxurl,
|
2735 |
+
type: 'POST',
|
2736 |
+
dataType: 'text',
|
2737 |
+
cache: false,
|
2738 |
+
data: request_data,
|
2739 |
+
error: function( jqXHR, textStatus, errorThrown ) {
|
2740 |
+
$( '.progress-title' ).html( wpmdb_strings.migration_cancellation_failed );
|
2741 |
+
$( '.progress-text' ).html( wpmdb_strings.manually_remove_temp_files );
|
2742 |
+
$( '.progress-text' ).append( '<br /><br />' + wpmdb_strings.status + ': ' + jqXHR.status + ' ' + jqXHR.statusText + '<br /><br />' + wpmdb_strings.response + ':<br />' + jqXHR.responseText );
|
2743 |
+
$( '.progress-text' ).addClass( 'migration-error' );
|
2744 |
console.log( jqXHR );
|
2745 |
console.log( textStatus );
|
2746 |
console.log( errorThrown );
|
2747 |
+
doing_ajax = false;
|
2748 |
migration_error = true;
|
2749 |
migration_complete_events();
|
2750 |
return;
|
2751 |
},
|
2752 |
+
success: function( data ) {
|
2753 |
doing_ajax = false;
|
2754 |
data = $.trim( data );
|
2755 |
+
if ( ( 'push' === migration_intent && '1' !== data ) || ( 'push' !== migration_intent && '' !== data ) ) {
|
2756 |
+
$( '.progress-title' ).html( wpmdb_strings.migration_cancellation_failed );
|
2757 |
+
$( '.progress-text' ).html( data );
|
2758 |
+
$( '.progress-text' ).addClass( 'migration-error' );
|
2759 |
migration_error = true;
|
2760 |
migration_complete_events();
|
2761 |
return;
|
2762 |
}
|
2763 |
completed_msg = wpmdb_strings.migration_cancelled;
|
2764 |
+
$( '.progress-text' ).hide();
|
2765 |
migration_complete_events();
|
2766 |
}
|
2767 |
+
} );
|
2768 |
}
|
2769 |
else {
|
2770 |
next_step_in_migration.fn.apply( null, next_step_in_migration.args );
|
2771 |
}
|
2772 |
+
};
|
2773 |
|
2774 |
+
$( 'body' ).on( 'click', '.copy-licence-to-remote-site', function() {
|
2775 |
+
$( '.connection-status' ).html( wpmdb_strings.copying_license );
|
2776 |
+
$( '.connection-status' ).removeClass( 'notification-message error-notice migration-error' );
|
2777 |
+
$( '.connection-status' ).append( ajax_spinner );
|
2778 |
|
2779 |
+
var connection_info = $.trim( $( '.pull-push-connection-info' ).val() ).split( "\n" );
|
2780 |
|
2781 |
doing_ajax = true;
|
2782 |
disable_export_type_controls();
|
2783 |
|
2784 |
+
$.ajax( {
|
2785 |
+
url: ajaxurl,
|
2786 |
+
type: 'POST',
|
2787 |
+
dataType: 'json',
|
2788 |
+
cache: false,
|
2789 |
data: {
|
2790 |
+
action: 'wpmdb_copy_licence_to_remote_site',
|
2791 |
+
url: connection_info[ 0 ],
|
2792 |
+
key: connection_info[ 1 ],
|
2793 |
+
nonce: wpmdb_data.nonces.copy_licence_to_remote_site
|
2794 |
},
|
2795 |
+
error: function( jqXHR, textStatus, errorThrown ) {
|
2796 |
+
$( '.connection-status' ).html( getAjaxErrors( jqXHR.responseText, '(#143)', jqXHR ) );
|
2797 |
+
$( '.connection-status' ).addClass( 'notification-message error-notice migration-error' );
|
2798 |
+
$( '.ajax-spinner' ).remove();
|
2799 |
doing_ajax = false;
|
2800 |
enable_export_type_controls();
|
2801 |
},
|
2802 |
+
success: function( data ) {
|
2803 |
+
$( '.ajax-spinner' ).remove();
|
2804 |
doing_ajax = false;
|
2805 |
enable_export_type_controls();
|
2806 |
|
2807 |
+
if ( typeof data.wpmdb_error !== 'undefined' && data.wpmdb_error === 1 ) {
|
2808 |
+
$( '.connection-status' ).html( data.body );
|
2809 |
+
$( '.connection-status' ).addClass( 'notification-message error-notice migration-error' );
|
2810 |
|
2811 |
+
if ( data.body.indexOf( '401 Unauthorized' ) > -1 ) {
|
2812 |
+
$( '.basic-access-auth-wrapper' ).show();
|
2813 |
}
|
2814 |
|
2815 |
return;
|
2816 |
}
|
2817 |
connection_box_changed();
|
2818 |
}
|
2819 |
+
} );
|
2820 |
+
} );
|
2821 |
|
2822 |
+
$( 'body' ).on( 'click', '.reactivate-licence', function( e ) {
|
2823 |
doing_ajax = true;
|
2824 |
|
2825 |
+
$( '.invalid-licence' ).empty().html( wpmdb_strings.attempting_to_activate_licence );
|
2826 |
+
$( '.invalid-licence' ).append( ajax_spinner );
|
2827 |
|
2828 |
+
$.ajax( {
|
2829 |
+
url: ajaxurl,
|
2830 |
+
type: 'POST',
|
2831 |
+
dataType: 'json',
|
2832 |
+
cache: false,
|
2833 |
data: {
|
2834 |
+
action: 'wpmdb_reactivate_licence',
|
2835 |
+
nonce: wpmdb_data.nonces.reactivate_licence
|
2836 |
},
|
2837 |
+
error: function( jqXHR, textStatus, errorThrown ) {
|
2838 |
+
$( '.invalid-licence' ).html( wpmdb_strings.activate_licence_problem );
|
2839 |
+
$( '.invalid-licence' ).append( '<br /><br />' + wpmdb_strings.status + ': ' + jqXHR.status + ' ' + jqXHR.statusText + '<br /><br />' + wpmdb_strings.response + '<br />' + jqXHR.responseText );
|
2840 |
+
$( '.ajax-spinner' ).remove();
|
2841 |
doing_ajax = false;
|
2842 |
},
|
2843 |
+
success: function( data ) {
|
2844 |
+
$( '.ajax-spinner' ).remove();
|
2845 |
doing_ajax = false;
|
2846 |
|
2847 |
+
if ( typeof data.wpmdb_error !== 'undefined' && data.wpmdb_error === 1 ) {
|
2848 |
+
$( '.invalid-licence' ).html( data.body );
|
2849 |
return;
|
2850 |
}
|
2851 |
|
2852 |
+
if ( typeof data.wpmdb_dbrains_api_down !== 'undefined' && data.wpmdb_dbrains_api_down === 1 ) {
|
2853 |
+
$( '.invalid-licence' ).html( wpmdb_strings.temporarily_activated_licence );
|
2854 |
+
$( '.invalid-licence' ).append( data.body );
|
2855 |
return;
|
2856 |
}
|
2857 |
|
2858 |
+
$( '.invalid-licence' ).empty().html( wpmdb_strings.licence_reactivated );
|
2859 |
location.reload();
|
2860 |
}
|
2861 |
+
} );
|
2862 |
|
2863 |
+
} );
|
2864 |
|
2865 |
+
$( 'input[name=table_migrate_option]' ).change( function() {
|
2866 |
maybe_show_mixed_cased_table_name_warning();
|
2867 |
+
} );
|
2868 |
|
2869 |
+
$( 'body' ).on( 'change', '#select-tables', function() {
|
2870 |
maybe_show_mixed_cased_table_name_warning();
|
2871 |
+
} );
|
2872 |
+
} );
|
|
|
2873 |
|
2874 |
+
})( jQuery );
|
@@ -1,2 +1,2 @@
|
|
1 |
-
var migration_complete,migration_complete_events,migrate_table_recursive,execute_next_step;!function(a){function b(a,b,c){return c=c||"0",a+="",a.length>=b?a:new Array(b-a.length+1).join(c)+a}function c(){y=0,counter_display=a(".timer"),label=wpmdb_strings.time_elapsed+" ",u=setInterval(e,1e3)}function d(){hours=Math.floor(y/3600)%24,minutes=Math.floor(y/60)%60,seconds=y%60;var a=label+b(hours,2,0)+":"+b(minutes,2,0)+":"+b(seconds,2,0);counter_display.html(a)}function e(){y+=1,d()}function f(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 g(a){a=a.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");var b=new RegExp("[\\?&]"+a+"=([^&#]*)"),c=b.exec(location.search);return null==c?"":decodeURIComponent(c[1].replace(/\+/g," "))}function h(b,c,d){var e=b.substr(0,b.indexOf(":"));return d!=e&&-1!=b.indexOf("https")?(a(".ssl-notice").show(),L=!0,b=b.replace("https","http"),void a(".pull-push-connection-info").val(b+"\n"+c)):void(L=!1)}function i(b){b!=wpmdb_this_prefix&&(a(".remote-prefix").html(b),K=!0,a("#pull").is(":checked")?a(".prefix-notice.pull").show():a(".prefix-notice.push").show())}function j(){if("undefined"!=typeof connection_data&&0!=connection_data){var b,c=a("input[name=action]:checked").val(),d=a("input[name=table_migrate_option]:checked").val();a(".mixed-case-table-name-notice").hide(),b="migrate_select"==d?a("#select-tables").val():"push"==c||"savefile"==c?wpmdb_this_prefixed_tables:connection_data.prefixed_tables,null!==b&&(b=b.join(""),b!=b.toLowerCase()&&("1"==connection_data.lower_case_table_names||"push"!=c&&"savefile"!=c)&&("1"==wpmdb_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 k(a){var b=a,c=b.replace(/\/\/(.*)@/,"//").replace("http://","").replace("https://","").replace("www.","");return c}function l(a,b,c){var d,e,f=k(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 m(a){return a.replace(/^https?:/i,"")}function n(){a(".option-group").each(function(){a("input",this).attr("disabled","disabled"),a("label",this).css("cursor","default")})}function o(){a(".option-group").each(function(){a("input",this).removeAttr("disabled"),a("label",this).css("cursor","pointer")})}var p,q,r,s,t,u,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="",T=!1,U=!1,V="",W=ajaxurl.replace("/admin-ajax.php",""),X=W+"/images/spinner";window.devicePixelRatio>=2&&(X+="-2x"),X+=".gif",window.onbeforeunload=function(a){return O?(a=a||window.event,a&&(a.returnValue=wpmdb_strings.sure),wpmdb_strings.sure):void 0},a(document).ready(function(){function b(b){a.ajax({url:ajaxurl,type:"POST",dataType:"json",cache:!1,data:{action:"wpmdb_check_licence",licence:b,nonce:wpmdb_nonces.check_licence},error:function(){alert(wpmdb_strings.license_check_problem)},success:function(b){if("undefined"!=typeof b.dbrains_api_down)a(".support-content").empty().html(b.dbrains_api_down+b.message),a(".addons-content").empty().html(b.dbrains_api_down);else if("undefined"!=typeof b.errors){var c="";for(var d in b.errors)c+=b.errors[d];a(".support-content").empty().html(c),a(".addons-content").empty().html(c)}else a(".support-content").empty().html(b.message),a(".addons-content").empty().html(b.addon_content)}})}function d(){var b=a("input[name=action]:checked").val(),c=a.trim(a(".pull-push-connection-info").val()).split("\n");if("undefined"!=typeof wpmdb_default_profile&&1!=wpmdb_default_profile&&"savefile"!=b&&!D&&wpmdb_is_pro){C=b,D=!0,n(),a(".connection-status").html(wpmdb_strings.establishing_remote_connection),a(".connection-status").removeClass("notification-message error-notice migration-error"),a(".connection-status").append('<img src="'+X+'" alt="" class="ajax-spinner general-spinner" />');var d=a("input[name=action]:checked").val();a.ajax({url:ajaxurl,type:"POST",dataType:"json",cache:!1,data:{action:"wpmdb_verify_connection_to_remote_site",url:c[0],key:c[1],intent:d,nonce:wpmdb_nonces.verify_connection_to_remote_site,convert_post_type_selection:wpmdb_convert_post_type_selection,profile:wpmdb_profile},error:function(b){a(".connection-status").html(_(b.responseText,"(#102)",b)),a(".connection-status").addClass("notification-message error-notice migration-error"),a(".ajax-spinner").remove(),D=!1,o()},success:function(b){if(a(".ajax-spinner").remove(),D=!1,o(),"undefined"!=typeof b.wpmdb_error&&1==b.wpmdb_error)return 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());h(c[0],c[1],b.scheme),i(b.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(),B=!0,connection_data=b,Z(),j();var d="";0==wpmdb_default_profile&&"undefined"!=typeof wpmdb_loaded_tables&&(d=wpmdb_loaded_tables);var e=document.createElement("select");a(e).attr({multiple:"multiple",name:"select_tables[]",id:"select-tables","class":"multiselect"}),a.each(connection_data.tables,function(b,c){var f=a.inArray(c,d);f=-1!=f?' selected="selected" ':" ",a(e).append("<option"+f+'value="'+c+'">'+c+" ("+connection_data.table_sizes_hr[c]+")</option>")}),fb=e;var f="";0==wpmdb_default_profile&&"undefined"!=typeof wpmdb_loaded_post_types&&("undefined"!=typeof b.select_post_types?(a("#exclude-post-types").attr("checked","checked"),a(".post-type-select-wrap").show(),f=b.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(connection_data.post_types,function(b,c){var d=a.inArray(c,f);d=-1!=d||1==wpmdb_convert_exclude_revisions&&"revision"!=c?' selected="selected" ':" ",a(g).append("<option"+d+'value="'+c+'">'+c+"</option>")}),hb=g;var k="";0==wpmdb_default_profile&&"undefined"!=typeof wpmdb_loaded_tables_backup&&(k=wpmdb_loaded_tables_backup);var l=document.createElement("select");a(l).attr({multiple:"multiple",name:"select_backup[]",id:"select-backup","class":"multiselect"}),a.each(connection_data.tables,function(b,c){var d=a.inArray(c,k);d=-1!=d?' selected="selected" ':" ",a(l).append("<option"+d+'value="'+c+'">'+c+" ("+connection_data.table_sizes_hr[c]+")</option>")}),ib=l,a("#pull").is(":checked")?(a("#select-tables").remove(),a(".select-tables-wrap").prepend(fb),a("#select-post-types").remove(),a(".select-post-types-wrap").prepend(hb),a("#select-backup").remove(),a(".backup-tables-wrap").prepend(jb),a(".table-prefix").html(b.prefix),a(".uploads-dir").html(wpmdb_this_uploads_dir)):(a("#select-backup").remove(),a(".backup-tables-wrap").prepend(ib)),a.wpmdb.do_action("verify_connection_to_remote_site",connection_data)}})}}function y(c,d){a(".licence-input, .register-licence").remove(),a(".licence-not-entered").prepend(c.masked_licence),a(".support-content").empty().html("<p>"+wpmdb_strings.fetching_license+'<img src="'+X+'" alt="" class="ajax-spinner general-spinner" /></p>'),b(d),a(".migrate-selection label").removeClass("disabled"),a(".migrate-selection input").removeAttr("disabled")}function W(){a.ajax({url:ajaxurl,type:"POST",dataType:"text",cache:!1,data:{action:"wpmdb_get_log",nonce:wpmdb_nonces.get_log},error:function(){alert(wpmdb_strings.update_log_problem)},success:function(b){a(".debug-log-textarea").val(b)}})}function Y(){var b=a(".progress-content").outerHeight();a(".progress-content").animate({top:"-"+b+"px"},400,"swing",function(){a("#overlay").remove(),a(".progress-content").remove()}),N=!1}function Z(){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(".directory-scope").hide(),a(".compatibility-older-mysql").hide();a.trim(a(".pull-push-connection-info").val()).split("\n");if(a("#pull").is(":checked"))if(a(".pull-list li").append(connection_info_box),connection_info_box.show(),B){if(a(".connection-status").hide(),a(".step-two").show(),a(".table-prefix").html(connection_data.prefix),a(".uploads-dir").html(wpmdb_this_uploads_dir),0==I){var b=k(connection_data.url);a(".create-new-profile").val(b)}1==K&&a(".prefix-notice.pull").show(),1==L&&a(".ssl-notice").show(),1==M&&(a(".different-plugin-version-notice").show(),a(".step-two").hide()),a(".directory-scope.pull").show(),0==wpmdb_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_this_upload_dir_long))}else a(".connection-status").show(),a(".step-two").hide();else if(a("#push").is(":checked"))if(a(".push-list li").append(connection_info_box),connection_info_box.show(),B){if(a(".connection-status").hide(),a(".step-two").show(),a(".table-prefix").html(wpmdb_this_prefix),a(".uploads-dir").html(connection_data.uploads_dir),0==I){var b=k(connection_data.url);a(".create-new-profile").val(b)}1==K&&a(".prefix-notice.push").show(),1==L&&a(".ssl-notice").show(),1==M&&(a(".different-plugin-version-notice").show(),a(".step-two").hide()),a(".directory-scope.push").show(),"0"==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(connection_data.upload_dir_long))}else a(".connection-status").show(),a(".step-two").hide();else a("#savefile").is(":checked")&&(a(".connection-status").hide(),a(".step-two").show(),a(".table-prefix").html(wpmdb_this_prefix),a(".compatibility-older-mysql").show(),0==I&&a(".create-new-profile").val(""),a(".backup-options").hide(),a(".keep-active-plugins").hide(),0==wpmdb_write_permission&&(a(".directory-permission-notice").show(),a(".step-two").hide()));j(),a.wpmdb.do_action("move_connection_info_box")}function $(){a("#push").is(":checked")||a("#savefile").is(":checked")?((""==C||"pull"==C)&&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)}),a("#select-tables").remove(),a(".select-tables-wrap").prepend(eb),a("#select-post-types").remove(),a(".select-post-types-wrap").prepend(gb),a("#select-backup").remove(),a(".backup-tables-wrap").prepend(ib),C="push"):a("#pull").is(":checked")&&((""==C||"push"==C)&&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)}),a("#select-tables").remove(),a(".select-tables-wrap").prepend(fb),a("#select-post-types").remove(),a(".select-post-types-wrap").prepend(hb),a("#select-backup").remove(),a(".backup-tables-wrap").prepend(jb),C="pull")}function _(a,b,c){return wpmdbGetAjaxErrors(wpmdb_strings.connection_local_server_problem,b,a,c)}function ab(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 bb(c,d){a(".nav-tab").removeClass("nav-tab-active"),a(".nav-tab."+c).addClass("nav-tab-active"),a(".content-tab").hide(),a("."+c+"-tab").show(),"help"==c&&(W(),"1"==wpmdb_has_licence&&(a(".support-content p").append('<img src="'+X+'" alt="" class="ajax-spinner general-spinner" />'),b(),J=!0)),"addons"==c&&1!=d&&"1"==wpmdb_has_licence&&(a(".addons-content p").append('<img src="'+X+'" alt="" class="ajax-spinner general-spinner" />'),b(),J=!0)}function cb(b){var c=a(".pull-push-connection-info");if(!D&&!a(c).hasClass("temp-disabled")){var b=a(".pull-push-connection-info").val(),d=a.trim(b).split("\n"),e=!1,f="";if(""==d&&(e=!0,f=wpmdb_strings.connection_info_missing),2==d.length||e||(e=!0,f=wpmdb_strings.connection_info_incorrect),e||ab(d[0])||(e=!0,f=wpmdb_strings.connection_info_url_invalid),!e&&d[1].length<32&&(e=!0,f=wpmdb_strings.connection_info_key_invalid),e||d[0]!=wpmdb_connection_info[0]||(e=!0,f=wpmdb_strings.connection_info_local_url),e||d[1]!=wpmdb_connection_info[1]||(e=!0,f=wpmdb_strings.connection_info_local_key),e)return a(".connection-status").html(f),void a(".connection-status").addClass("notification-message error-notice migration-error");if(0==wpmdb_openssl_available){d[0]=d[0].replace("https://","http://");var g=d[0]+"\n"+d[1];a(".pull-push-connection-info").val(g)}if(K=!1,D=!0,n(),a(".basic-access-auth-wrapper").is(":visible")){d[0]=d[0].replace(/\/\/(.*)@/,"//"),d[0]=d[0].replace("//","//"+encodeURIComponent(a.trim(a(".auth-username").val()))+":"+encodeURIComponent(a.trim(a(".auth-password").val()))+"@");var g=d[0]+"\n"+d[1];a(".pull-push-connection-info").val(g),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('<img src="'+X+'" alt="" class="ajax-spinner general-spinner" />');var l=a("input[name=action]:checked").val();I=!1,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:l,nonce:wpmdb_nonces.verify_connection_to_remote_site},error:function(b){a(".connection-status").html(_(b.responseText,"(#100)",b)),a(".connection-status").addClass("notification-message error-notice migration-error"),a(".ajax-spinner").remove(),D=!1,o()},success:function(b){if(a(".ajax-spinner").remove(),D=!1,o(),"undefined"!=typeof b.wpmdb_error&&1==b.wpmdb_error)return 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());var c=k(b.url);a(".create-new-profile").val(c),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(),h(d[0],d[1],b.scheme),i(b.prefix),B=!0,connection_data=b,Z(),j();var e=document.createElement("select");a(e).attr({multiple:"multiple",name:"select_tables[]",id:"select-tables","class":"multiselect"}),a.each(connection_data.tables,function(b,c){a(e).append('<option value="'+c+'">'+c+" ("+connection_data.table_sizes_hr[c]+")</option>")}),fb=e,ib=a(e).clone(),a(ib).attr({name:"select_backup[]",id:"select-backup"});var f=document.createElement("select");a(f).attr({multiple:"multiple",name:"select_post_types[]",id:"select-post-types","class":"multiselect"}),a.each(connection_data.post_types,function(b,c){a(f).append('<option value="'+c+'">'+c+"</option>")}),hb=f,a("#pull").is(":checked")?(a("#new-url").val(m(wpmdb_this_url)),a("#new-path").val(wpmdb_this_path),1==wpmdb_is_multisite&&a("#new-domain").val(wpmdb_this_domain),a("#old-url").val(m(b.url)),a("#old-path").val(b.path),a("#select-tables").remove(),a(".select-tables-wrap").prepend(fb),a("#select-post-types").remove(),a(".select-post-types-wrap").prepend(hb),a(".table-prefix").html(b.prefix),a(".uploads-dir").html(wpmdb_this_uploads_dir)):(a("#select-backup").remove(),a(".backup-tables-wrap").prepend(ib),a("#new-url").val(m(b.url)),a("#new-path").val(b.path)),next_step_in_migration={fn:a.wpmdb.do_action,args:["verify_connection_to_remote_site",connection_data]},execute_next_step()}})}}a("#plugin-compatibility").change(function(){var b="1";if(a(this).is(":checked")){var c=confirm(wpmdb_strings.mu_plugin_confirmation);if(!c)return void a(this).prop("checked",!1)}else b="0";a(".plugin-compatibility-wrap").toggle(),a(this).parent().append('<img src="'+X+'" alt="" class="ajax-spinner general-spinner" />'),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:b},error:function(b){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(),(navigator.userAgent.indexOf("MSIE")>0||navigator.userAgent.indexOf("Trident")>0)&&a(".ie-warning").show(),0==wpmdb_valid_licence&&a("#savefile").prop("checked",!0),a(".slider").slider({range:"min",value:wpmdb_max_request/1024,min:512,max:wpmdb_bottleneck/1024,step:512,slide:function(b,c){a(".amount").html(wpmdb_add_commas(c.value)+" kB")},change:function(b,c){a(".amount").after('<img src="'+X+'" alt="" class="slider-spinner general-spinner" />'),a(".slider").slider("disable"),a.ajax({url:ajaxurl,type:"POST",dataType:"json",cache:!1,data:{action:"wpmdb_update_max_request_size",max_request_size:parseInt(c.value),nonce:wpmdb_nonces.update_max_request_size},error:function(){a(".slider").slider("enable"),a(".slider-spinner").remove(),alert(wpmdb_strings.max_request_size_problem)},success:function(){a(".slider").slider("enable"),a(".slider-spinner").remove(),a(".slider-success-msg").show(),a(".slider-success-msg").fadeOut(2e3,function(){a(this).hide()})}})}}),a(".amount").html(wpmdb_add_commas(a(".slider").slider("value"))+" kB");var db=a(".progress-content").clone();a(".progress-content").remove();var eb=a("#select-tables").clone(),fb=a("#select-tables").clone(),gb=a("#select-post-types").clone(),hb=a("#select-post-types").clone(),ib=a("#select-backup").clone(),jb=a("#select-backup").clone();if(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(),a("#savefile").is(":checked")&&(a(".backup-options").hide(),a(".keep-active-plugins").hide()),d(),a("body").on("click",".js-action-link",function(b){b.preventDefault(),a(this).blur()}),a(".licence-form").submit(function(b){if(b.preventDefault(),!E){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"),E=!0,a(".button.register-licence").after('<img src="'+X+'" 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_nonces.activate_licence},error:function(){E=!1,a(".register-licence-ajax-spinner").remove(),a(".licence-status").html(wpmdb_strings.register_license_problem)},success:function(b){if(E=!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&&(y(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"),y(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_nonces.clear_log},error:function(){alert(wpmdb_strings.clear_log_problem)},success:function(){}})}),a(".multiselect-select-all").click(function(){var b=a(this).parents(".select-wrap").children(".multiselect");a("option",b).attr("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(){group=a(this).closest(".option-group"),a("ul",group).hide(),parent=a(this).closest("li"),a("ul",parent).show()}),a(".option-group").each(function(){a(".option-group input[type=radio]").each(function(){a(this).is(":checked")&&(parent=a(this).closest("li"),a("ul",parent).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(){a(this).is(":checked")?(a(".save-settings-button").show(),a(".migrate-db .button-primary").val(wpmdb_strings.migrate_db_save)):(a(".save-settings-button").hide(),a(".migrate-db .button-primary").val(wpmdb_strings.migrate_db))}),a(".create-new-profile").focus(function(){a("#create_new").prop("checked",!0)}),a("#save-migration-profile").is(":checked")&&(a(".save-settings-button").show(),a(".migrate-db .button-primary").val(wpmdb_strings.migrate_db_save)),a(".checkbox-label input[type=checkbox]").each(function(){a(this).is(":checked")&&a(this).parent().next().show()}),a("#new-url").change(function(){a("#new-url-missing-warning").hide()}),a("#new-path").change(function(){a("#new-path-missing-warning").hide()}),a(".migrate-db-button").click(function(b){function d(b,c){var d=0;a.each(b,function(a,b){d+=parseInt(c[b])});var e="";if(a.each(b,function(b,f){var g=c[f]/d*100,h=Math.round(1e3*g)/1e3;a(".progress-tables").append('<div class="progress-chunk '+f+'_chunk" style="width: '+h+'%;" title="'+f+'"><span>'+f+"</span></div>"),a(".progress-tables-hover-boxes").append('<div class="progress-chunk-hover" data-table="'+f+'" style="width: '+h+'%;"></div>');a(".progress-tables .progress-chunk:last span");e=f}),a(".progress-chunk").each(function(d){function f(b){a("span",b).innerWidth()>a(b).width()&&a("span",b).hide()}a(this).width()<1&&b[d]!=e&&(a(this).hide(),a(".progress-chunk-hover[data-table="+b[d]+"]").hide(),c[e]=Number(c[e]),c[e]+=Number(c[b[d]]),c[b[d]]=0);var g=this;setTimeout(function(){f(g)},0)}),g=0,0!=c[e])var f=c[e]/d*100,g=Math.round(1e3*f)/1e3;a(".progress-tables .progress-chunk:last").css("width",g+"%"),a(".progress-chunk-hover:last").css("width",g+"%");var h=[c,d];return h}if(a(this).blur(),b.preventDefault(),a("#migrate-selected").is(":checked")&&null==a("#select-tables").val())return void alert(wpmdb_strings.please_select_one_table);if(new_url_missing=!1,new_file_path_missing=!1,a("#new-url").length&&!a("#new-url").val()&&(a("#new-url-missing-warning").show(),a("#new-url").focus(),a("html,body").scrollTop(0),new_url_missing=!0),a("#new-path").length&&!a("#new-path").val()&&(a("#new-path-missing-warning").show(),0==new_url_missing&&(a("#new-path").focus(),a("html,body").scrollTop(0)),new_file_path_missing=!0),1!=new_url_missing&&1!=new_file_path_missing){if(a("#save-migration-profile").is(":checked")){if(""==a.trim(a(".create-new-profile").val())&&a("#create_new").is(":checked"))return alert(wpmdb_strings.enter_name_for_profile),void a(".create-new-profile").focus();var e=!1;a("#create_new").is(":checked")&&(e=!0);var g=a(".create-new-profile").val();profile=a("#migrate-form").serialize(),a.ajax({url:ajaxurl,type:"POST",dataType:"text",cache:!1,data:{action:"wpmdb_save_profile",profile:profile,nonce:wpmdb_nonces.save_profile},error:function(){alert(wpmdb_strings.save_profile_problem)},success:function(b){if(e){var c=parseInt(b,10),d=c+1,f='<li><span style="display: none;" class="delete-profile" data-profile-id="'+d+'"></span><label for="profile-'+d+'"><input id="profile-'+d+'" value="'+c+'" name="save_migration_profile_option" type="radio"> '+g+"</label></li>";a("#create_new").parents("li").before(f),a("#profile-"+d).attr("checked","checked"),a(".create-new-profile").val("")}}})}s=a("#migrate-form").serialize();var h=a(document).height();a("body").append('<div id="overlay"></div>'),a("#overlay").height(h).css({position:"fixed",top:0,left:0,width:"100%","z-index":99999,display:"none"}),$progress_content=db.clone(),p=a("input[name=action]:checked").val(),t="backup","savefile"==p&&(t="migrate"),0==a("#create-backup").is(":checked")&&(t="migrate");var i=a("input[name=table_migrate_option]:checked").val(),j=a.trim(a(".pull-push-connection-info").val()).split("\n"),k="";q=j[0],r=j[1];var m="";a("#overlay").after($progress_content),v=wpmdb_strings.exporting_complete,"savefile"==p?m=wpmdb_strings.exporting_please_wait:(m=l(q,p,"migrating"),v=l(q,p,"completed")),a(".progress-title").html(m),a("#overlay").show(),backup_option=a("input[name=backup_option]:checked").val(),table_option=a("input[name=table_migrate_option]:checked").val(),"backup"==t?("migrate_only_with_prefix"==table_option&&"backup_selected"==backup_option&&(backup_option="backup_only_with_prefix"),"push"==p?(k=connection_data.table_rows,"backup_only_with_prefix"==backup_option?S=connection_data.prefixed_tables:"backup_selected"==backup_option?(selected_tables=a("#select-tables").val(),S=f(selected_tables,connection_data.tables)):"backup_manual_select"==backup_option&&(S=a("#select-backup").val())):(k=wpmdb_this_table_rows,"backup_only_with_prefix"==backup_option?S=wpmdb_this_prefixed_tables:"backup_selected"==backup_option?(selected_tables=a("#select-tables").val(),S=f(selected_tables,wpmdb_this_tables)):"backup_manual_select"==backup_option&&(S=a("#select-backup").val()))):"migrate_select"==i?(S=a("#select-tables").val(),k="push"==p||"savefile"==p?wpmdb_this_table_rows:connection_data.table_rows):"push"==p||"savefile"==p?(S=wpmdb_this_prefixed_tables,k=wpmdb_this_table_rows):(S=connection_data.prefixed_tables,k=connection_data.table_rows),table_details=d(S,k),k=table_details[0],total_size=table_details[1],a(".progress-title").after('<img src="'+X+'" alt="" class="migration-progress-ajax-spinner general-spinner" />');var n=a(".progress-content").outerHeight();a(".progress-content").css("top","-"+n+"px").show().animate({top:"0px"}),c(),O=!0,a.ajax({url:ajaxurl,type:"POST",dataType:"json",cache:!1,data:{action:"wpmdb_initiate_migration",intent:p,url:q,key:r,form_data:s,stage:t,nonce:wpmdb_nonces.initiate_migration},error:function(b,c,d){a(".progress-title").html(wpmdb_strings.migration_failed),a(".progress-text").html(_(b.responseText,"(#112)",b)),a(".progress-text").addClass("migration-error"),console.log(b),console.log(c),console.log(d),migration_error=!0,migration_complete_events()},success:function(b){if("undefined"!=typeof b.wpmdb_error&&1==b.wpmdb_error)return migration_error=!0,migration_complete_events(),a(".progress-title").html(wpmdb_strings.migration_failed),a(".progress-text").addClass("migration-error"),void a(".progress-text").html(b.body);Q=b.dump_url,dump_path=b.dump_path,P=b.dump_filename,R=b.db_version,V=b.site_url,A=b.find_replace_pairs;var c=0,e=0;z=0;var f=0,g=0,h=0,j=0;migrate_table_recursive=function(b,l){if(c>=S.length){if("backup"!=t)return a(".progress-label").removeClass("label-visible"),hooks=a.wpmdb.apply_filters("wpmdb_before_migration_complete_hooks",hooks),hooks.push("migration_complete"),hooks=a.wpmdb.apply_filters("wpmdb_after_migration_complete_hooks",hooks),hooks.push("migration_complete_events"),next_step_in_migration={fn:wpmdb_call_next_hook},void execute_next_step();t="migrate",c=0,e=0,a(".progress-bar").width("0px"),"migrate_select"==i?(S=a("#select-tables").val(),k="push"==p||"savefile"==p?wpmdb_this_table_rows:connection_data.table_rows):"push"==p||"savefile"==p?(S=wpmdb_this_prefixed_tables,k=wpmdb_this_table_rows):(S=connection_data.prefixed_tables,k=connection_data.table_rows),a(".progress-tables").empty(),a(".progress-tables-hover-boxes").empty(),table_details=d(S,k),k=table_details[0],total_size=table_details[1]}a(".progress-text").html("backup"==t?z+"% - "+wpmdb_strings.backing_up+' "'+S[c]+'"':z+"% - "+wpmdb_strings.migrating+' "'+S[c]+'"'),last_table=0,c==S.length-1&&(last_table=1),gzip=0,"savefile"!=p&&1==parseInt(connection_data.gzip)&&(gzip=1);var m={action:"wpmdb_migrate_table",intent:p,url:q,key:r,table:S[c],db_version:R,form_data:s,stage:t,current_row:b,dump_filename:P,last_table:last_table,primary_keys:l,gzip:gzip,nonce:wpmdb_nonces.migrate_table,site_url:V,find_replace_pairs:A};"savefile"!=p&&(m.bottleneck=connection_data.bottleneck,m.prefix=connection_data.prefix),connection_data&&connection_data.path_current_site&&connection_data.domain&&(m.path_current_site=connection_data.path_current_site,m.domain_current_site=connection_data.domain),D=!0,a.ajax({url:ajaxurl,type:"POST",dataType:"text",cache:!1,timeout:0,data:m,error:function(b,d,e){a(".progress-title").html(wpmdb_strings.migration_failed),a(".progress-text").html(wpmdb_strings.table_process_problem+" "+S[c]),a(".progress-text").append("<br /><br />"+wpmdb_strings.status+": "+b.status+" "+b.statusText+"<br /><br />"+wpmdb_strings.response+":<br />"+b.responseText),a(".progress-text").addClass("migration-error"),D=!1,console.log(b),console.log(d),console.log(e),migration_error=!0,migration_complete_events()},success:function(b){if(D=!1,b=a.trim(b),row_information=wpmdb_parse_json(b),0==row_information||null==row_information)return a(".progress-title").html(wpmdb_strings.migration_failed),a(".progress-text").html(""==b||null==b?wpmdb_strings.table_process_problem_empty_response+" "+S[c]:_(b)),a(".progress-text").addClass("migration-error"),migration_error=!0,void migration_complete_events();
|
2 |
-
if("undefined"!=typeof row_information.wpmdb_error&&1==row_information.wpmdb_error)return a(".progress-title").html(wpmdb_strings.migration_failed),a(".progress-text").addClass("migration-error"),a(".progress-text").html(row_information.body),migration_error=!0,void migration_complete_events();"-1"==row_information.current_row?(e-=j,j=0,h=0,e+=parseInt(k[S[c]]),c++,row_information.current_row="",row_information.primary_keys=""):(g=parseInt(row_information.current_row),f=g-h,h=g,e+=f,j+=f);var d=100*e/total_size;a(".progress-bar").width(d+"%"),z=Math.floor(d),next_step_in_migration={fn:migrate_table_recursive,args:[row_information.current_row,row_information.primary_keys]},execute_next_step()}})},next_step_in_migration={fn:migrate_table_recursive,args:["-1",""]},execute_next_step()}})}}),migration_complete_events=function(){0==migration_error&&(""==non_fatal_errors?("savefile"!=p&&1==a("#save_computer").is(":checked")&&a(".progress-text").css("visibility","hidden"),a(".progress-title").html(v).append('<div class="dashicons dashicons-yes"></div>')):(a(".progress-text").html(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(),hooks=[],call_stack=[],migration_error=!1,O=!1,N=!0,T=!1,U=!1,D=!1,non_fatal_errors="",a(".progress-label").remove(),a(".migration-progress-ajax-spinner").remove(),a(".close-progress-content").show(),a("#overlay").css("cursor","pointer"),clearInterval(u)},migration_complete=function(){if(a(".migration-controls").fadeOut(),"savefile"==p){O=!1;var b=wpmdb_strings.migration_complete;if(a("#save_computer").is(":checked")){var c=wpmdb_this_download_url+encodeURIComponent(P);a("#gzip_file").is(":checked")&&(c+="&gzip=1"),window.location=c}else b=wpmdb_strings.completed_dump_located_at+" "+dump_path;0==migration_error&&(a(".progress-text").html(b),migration_complete_events(),a(".progress-title").html(v))}else a(".progress-text").html(wpmdb_strings.finalizing_migration),a.ajax({url:ajaxurl,type:"POST",dataType:"text",cache:!1,data:{action:"wpmdb_finalize_migration",intent:p,url:q,key:r,form_data:s,prefix:connection_data.prefix,temp_prefix:connection_data.temp_prefix,tables:S.join(","),nonce:wpmdb_nonces.finalize_migration},error:function(b,c,d){a(".progress-title").html(wpmdb_strings.migration_failed),a(".progress-text").html(wpmdb_strings.finalize_tables_problem),a(".progress-text").addClass("migration-error"),alert(b+" : "+c+" : "+d),migration_error=!0,migration_complete_events()},success:function(b){return""!=a.trim(b)?(a(".progress-title").html(wpmdb_strings.migration_failed),a(".progress-text").html(b),a(".progress-text").addClass("migration-error"),migration_error=!0,void migration_complete_events()):(next_step_in_migration={fn:wpmdb_call_next_hook},void execute_next_step())}})},a("body").on("click",".close-progress-content-button",function(){Y()}),a("body").on("click","#overlay",function(){1==N&&Y()}),a(".save-settings-button").click(function(b){var c;if(a(this).blur(),b.preventDefault(),!G){if(a("#migrate-selected").is(":checked")&&null==a("#select-tables").val())return void alert(wpmdb_strings.please_select_one_table);if(""==a.trim(a(".create-new-profile").val())&&a("#create_new").is(":checked"))return alert(wpmdb_strings.enter_name_for_profile),void a(".create-new-profile").focus();var d=!1;a("#create_new").is(":checked")&&(d=!0);var e=a(".create-new-profile").val();G=!0,c=a("#migrate-form").serialize(),a(".save-settings-button").after('<img src="'+X+'" alt="" class="save-profile-ajax-spinner general-spinner" />'),a(this).attr("disabled","disabled"),a.ajax({url:ajaxurl,type:"POST",dataType:"text",cache:!1,data:{action:"wpmdb_save_profile",profile:c,nonce:wpmdb_nonces.save_profile},error:function(){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()}),G=!1},success:function(b){if(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()}),G=!1,a(".create-new-profile").val(""),d){var c=parseInt(b,10),f=c+1,g=a('<li><span style="display: none;" class="delete-profile" data-profile-id="'+f+'"></span><label for="profile-'+f+'"><input id="profile-'+f+'" value="'+c+'" name="save_migration_profile_option" type="radio"></label></li>');g.find("label").append(document.createTextNode(" "+e)),a("#create_new").parents("li").before(g),a("#profile-"+f).attr("checked","checked")}}})}}),a("body").on("mousemove",".progress-chunk-hover",function(b){mX=b.pageX,offset=a(".progress-bar-wrapper").offset(),label_offset=a(".progress-label").outerWidth()/2,mX=mX-offset.left-label_offset,a(".progress-label").css("left",mX+"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")}),connection_info_box=a(".connection-info-wrapper"),Z(),a(".migrate-selection.option-group input[type=radio]").change(function(){Z(),B&&$()}),!a("#pull").is(":checked")&&!a("#push").is(":checked")||B||(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.css(d.hasClass("bottom")?{left:e.left-d.width()/2+"px",top:e.top+c.height()+9+"px"}:{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(){a(".nav-tab").removeClass("nav-tab-active"),a(this).addClass("nav-tab-active"),a(".content-tab").hide(),a("."+a(this).attr("data-div-name")).show();var c=a(this).attr("data-div-name");c=c.replace("-tab",""),window.location.hash=c,a(this).hasClass("help")&&(W(),0==J&&"1"==wpmdb_has_licence&&(a(".support-content p").append('<img src="'+X+'" alt="" class="ajax-spinner general-spinner" />'),b(),J=!0)),a(this).hasClass("addons")&&0==J&&"1"==wpmdb_has_licence&&(a(".addons-content p").append('<img src="'+X+'" alt="" class="ajax-spinner general-spinner" />'),b(),J=!0)}),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(),a(".replace-row").length<2&&a(".no-replaces-message").show(),prev_id=a(this).prev().attr("id"),("new-url"==prev_id||"new-path"==prev_id)&&a("#"+prev_id+"-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("body").on("mouseenter mouseleave","#find-and-replace-sort tbody tr.replace-row",function(b){"mouseenter"===b.type?a(".replace-remove-row",this).show():a(".replace-remove-row",this).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")}}),a("body").on("mouseenter mouseleave",".save-migration-profile-wrap li",function(b){"mouseenter"===b.type?a(".delete-profile",this).show():a(".delete-profile",this).hide()}),window.location.hash){var kb=window.location.hash.substring(1);bb(kb,!1)}""!=g("install-plugin")&&(kb="addons",J=!0,bb(kb,!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_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&&!F&&(F=!0,a(".reset-api-key").after('<img src="'+X+'" 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_nonces.reset_api_key},error:function(){alert(wpmdb_strings.reset_api_key_problem),a(".reset-api-key-ajax-spinner").remove(),F=!1},success:function(b){a(".reset-api-key-ajax-spinner").remove(),F=!1,a(".connection-info").html(b)}}))}),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(){H||(a(this).addClass("disabled"),select_element=a("#selected-plugins"),a(select_element).attr("disabled","disabled"),H=!0,a(this).after('<img src="'+X+'" 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(select_element).val()},error:function(b){alert(wpmdb_strings.blacklist_problem+"\r\n\r\n"+wpmdb_strings.status+" "+b.status+" "+b.statusText+"\r\n\r\n"+wpmdb_strings.response+"\r\n"+b.responseText),a(select_element).removeAttr("disabled"),a(".plugin-compatibility-save").removeClass("disabled"),H=!1,a(".plugin-compatibility-spinner").remove(),a(".plugin-compatibility-success-msg").show().fadeOut(2e3)},success:function(b){""!=a.trim(b)&&alert(b),a(select_element).removeAttr("disabled"),a(".plugin-compatibility-save").removeClass("disabled"),H=!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();var b=a.trim(a(b).html()),c=confirm(wpmdb_strings.remove_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_nonces.delete_migration_profile},error:function(){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+' "'+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_nonces.delete_migration_profile},error:function(){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),B=!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('<img src="'+X+'" alt="" class="ajax-spinner general-spinner" />');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_nonces.save_setting},error:function(){alert(wpmdb_strings.save_settings_problem),a(".ajax-spinner").remove()},success:function(){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(),cb()}),a(".pull-push-connection-info").bind("paste",function(){setTimeout(function(){cb()},0)}),a("body").on("click",".try-again",function(){cb()}),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),cb()}),a(".create-new-profile").change(function(){I=!0}),a("body").on("click",".temporarily-disable-ssl",function(){if(window.location.hash)var b=window.location.hash.substring(1);a(this).attr("href",a(this).attr("href")+"&hash="+b)}),a("body").on("click",".pause-resume",function(){1==T?(T=!1,D=!0,a(".progress-title").html(w),a(".progress-text").html(x),a(".migration-progress-ajax-spinner").show(),a(".pause-resume").html(wpmdb_strings.pause),u=setInterval(e,1e3),execute_next_step()):(T=!0,D=!1,w=a(".progress-title").html(),x=a(".progress-text").html(),a(".progress-title").html(wpmdb_strings.migration_paused),a(".pause-resume").html(wpmdb_strings.resume),a(".progress-text").html(wpmdb_strings.completing_current_request))}),a("body").on("click",".cancel",function(){U=!0,T=!1,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==D&&execute_next_step()}),a(".enter-licence").click(function(){a(".settings").click(),a(".licence-input").focus()}),execute_next_step=function(){if(1==T)return a(".migration-progress-ajax-spinner").hide(),clearInterval(u),void a(".progress-text").html(wpmdb_strings.paused);if(1==U){p=a("input[name=action]:checked").val(),"savefile"==p?progress_msg=wpmdb_strings.removing_local_sql:"pull"==p?progress_msg="backup"==t?wpmdb_strings.removing_local_backup:wpmdb_strings.removing_local_temp_tables:"push"==p&&(progress_msg="backup"==t?wpmdb_strings.removing_remote_sql:wpmdb_strings.removing_remote_temp_tables),a(".progress-text").html(progress_msg);var b={action:"wpmdb_cancel_migration",intent:p,url:q,key:r,stage:t,dump_filename:P,form_data:s};"undefined"!=typeof connection_data&&(b.temp_prefix=connection_data.temp_prefix),a.ajax({url:ajaxurl,type:"POST",dataType:"text",cache:!1,data:b,error:function(b,c,d){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+": "+b.status+" "+b.statusText+"<br /><br />"+wpmdb_strings.response+":<br />"+b.responseText),a(".progress-text").addClass("migration-error"),console.log(b),console.log(c),console.log(d),migration_error=!0,migration_complete_events()},success:function(b){return D=!1,b=a.trim(b),""!=b?(a(".progress-title").html(wpmdb_strings.migration_cancellation_failed),a(".progress-text").html(b),a(".progress-text").addClass("migration-error"),migration_error=!0,void migration_complete_events()):(v=wpmdb_strings.migration_cancelled,a(".progress-text").hide(),void migration_complete_events())}})}else next_step_in_migration.fn.apply(null,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('<img src="'+X+'" alt="" class="ajax-spinner general-spinner" />');var b=a.trim(a(".pull-push-connection-info").val()).split("\n");D=!0,n(),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_nonces.copy_licence_to_remote_site},error:function(b){a(".connection-status").html(_(b.responseText,"(#143)",b)),a(".connection-status").addClass("notification-message error-notice migration-error"),a(".ajax-spinner").remove(),D=!1,o()},success:function(b){return a(".ajax-spinner").remove(),D=!1,o(),"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 cb()}})}),a("body").on("click",".reactivate-licence",function(){D=!0,a(".invalid-licence").empty().html(wpmdb_strings.attempting_to_activate_licence),a(".invalid-licence").append('<img src="'+X+'" alt="" class="ajax-spinner general-spinner" />'),a.ajax({url:ajaxurl,type:"POST",dataType:"json",cache:!1,data:{action:"wpmdb_reactivate_licence",nonce:wpmdb_nonces.reactivate_licence},error:function(b){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(),D=!1},success:function(b){return a(".ajax-spinner").remove(),D=!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(){j()}),a("body").on("change","#select-tables",function(){j()})})}(jQuery);
|
1 |
+
var migration_complete,migration_complete_events,migrate_table_recursive,execute_next_step,wpmdb_flush;!function(a){function b(a,b,c){return c=c||"0",a+="",a.length>=b?a:new Array(b-a.length+1).join(c)+a}function c(){U=0,X=a(".timer"),Y=wpmdb_strings.time_elapsed+" ",x=setInterval(e,1e3)}function d(){var a=Math.floor(U/3600)%24,c=Math.floor(U/60)%60,d=U%60,e=Y+b(a,2,0)+":"+b(c,2,0)+":"+b(d,2,0);X.html(e)}function e(){U+=1,d()}function f(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 g(a){a=a.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");var b=new RegExp("[\\?&]"+a+"=([^&#]*)"),c=b.exec(location.search);return null===c?"":decodeURIComponent(c[1].replace(/\+/g," "))}function h(b,c,d){var e=b.substr(0,b.indexOf(":"));return d!==e&&-1!==b.indexOf("https")?(a(".ssl-notice").show(),K=!0,b=b.replace("https","http"),void a(".pull-push-connection-info").val(b+"\n"+c)):void(K=!1)}function i(b){b!==wpmdb_data.this_prefix&&(a(".remote-prefix").html(b),J=!0,"pull"===wpmdb_migration_type()?a(".prefix-notice.pull").show():a(".prefix-notice.push").show())}function j(){if("undefined"!=typeof connection_data&&!1!==connection_data){var b,c=wpmdb_migration_type(),d=a("input[name=table_migrate_option]:checked").val();a(".mixed-case-table-name-notice").hide(),b="migrate_select"===d?a("#select-tables").val():"push"===c||"savefile"===c?wpmdb_data.this_prefixed_tables:connection_data.prefixed_tables,null!==b&&(b=b.join(""),b!==b.toLowerCase()&&("1"===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 k(a){var b=a,c=b.replace(/\/\/(.*)@/,"//").replace("http://","").replace("https://","").replace("www.","");return c}function l(a,b,c){var d,e,f=k(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 m(a){return a.replace(/^https?:/i,"")}function n(){a(".option-group").each(function(){a("input",this).attr("disabled","disabled"),a("label",this).css("cursor","default")})}function o(){a(".option-group").each(function(){a("input",this).removeAttr("disabled"),a("label",this).css("cursor","pointer")})}function p(b,c,d){a(".slider",b).slider("value",c),a(".amount",b).html(wpmdb_add_commas(c)+" "+d)}function q(){!0===R?(R=!1,C=!0,a(".progress-title").html(S),a(".progress-text").html(T),a(".migration-progress-ajax-spinner").show(),a(".pause-resume").html(wpmdb_strings.pause),x=setInterval(e,1e3),execute_next_step()):(R=!0,C=!1,S=a(".progress-title").html(),T=a(".progress-text").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 r(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}var s,t,u,v,w,x,y,z="",A=!1,B="",C=!1,D=!1,E=!1,F=!1,G=!1,H=!1,I=!1,J=!1,K=!1,L=!1,M=!1,N=!1,O="",P="",Q="",R=!1,S="",T="",U=0,V=0,W=!1,X=!1,Y="",Z=!1,$=0,_=400,ab=ajaxurl.replace("/admin-ajax.php",""),bb=ab+"/images/spinner";window.devicePixelRatio>=2&&(bb+="-2x"),bb+=".gif";var cb='<img src="'+bb+'" alt="" class="ajax-spinner general-spinner" />';window.onbeforeunload=function(a){return N?(a=a||window.event,a&&(a.returnValue=wpmdb_strings.sure),wpmdb_strings.sure):void 0},a(document).ready(function(){function b(b){I=!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(){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(_,function(){a(this).empty().html(c).stop().fadeIn(_)}),f.stop().fadeOut(_,function(){a(this).empty().html(d).stop().fadeIn(_)}),g.stop().fadeOut(_,function(){a(this).empty().html(e).stop().fadeIn(_)})}})}function d(){void 0!==wpmdb_data&&void 0!==wpmdb_data.this_tables&&void 0!==wpmdb_data.this_table_sizes&&(tb=r(wpmdb_data.this_tables,wpmdb_data.this_table_sizes,a(tb).val())),void 0!==connection_data&&void 0!==connection_data.tables&&void 0!==connection_data.table_sizes_hr&&(ub=r(connection_data.tables,connection_data.table_sizes_hr,a(ub).val()))}function e(){a("#select-tables").remove(),a(".select-tables-wrap").prepend(tb)}function S(){a("#select-tables").remove(),a(".select-tables-wrap").prepend(ub)}function T(){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 U(){a(".table-migrate-options").show()}function X(){a("#select-tables").children("option").prop("selected",!0)}function Y(){return m(wpmdb_data.this_url)}function ab(){var b=wpmdb_migration_type(),c=a.trim(a(".pull-push-connection-info").val()).split("\n");if("undefined"!=typeof wpmdb_default_profile&&!0!==wpmdb_default_profile&&"savefile"!==b&&!C&&wpmdb_data.is_pro){C=!0,n(),a(".connection-status").html(wpmdb_strings.establishing_remote_connection),a(".connection-status").removeClass("notification-message error-notice migration-error"),a(".connection-status").append(cb);var d=wpmdb_migration_type();a.ajax({url:ajaxurl,type:"POST",dataType:"json",cache:!1,data:{action:"wpmdb_verify_connection_to_remote_site",url:c[0],key:c[1],intent:d,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){a(".connection-status").html(jb(b.responseText,"(#102)",b)),a(".connection-status").addClass("notification-message error-notice migration-error"),a(".ajax-spinner").remove(),C=!1,o()},success:function(b){if(a(".ajax-spinner").remove(),C=!1,o(),"undefined"!=typeof b.wpmdb_error&&1===b.wpmdb_error)return 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());h(c[0],c[1],b.scheme),i(b.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(),A=!0,connection_data=b,hb(),j();var d="";wpmdb_default_profile===!1&&"undefined"!=typeof wpmdb_loaded_tables&&(d=wpmdb_loaded_tables),ub=r(connection_data.tables,connection_data.table_sizes_hr,d);var e="";wpmdb_default_profile===!1&&"undefined"!=typeof wpmdb_loaded_post_types&&("undefined"!=typeof b.select_post_types?(a("#exclude-post-types").attr("checked","checked"),a(".post-type-select-wrap").show(),e=b.select_post_types):e=wpmdb_loaded_post_types);var f=document.createElement("select");a(f).attr({multiple:"multiple",name:"select_post_types[]",id:"select-post-types","class":"multiselect"}),a.each(connection_data.post_types,function(b,c){var d=a.inArray(c,e);d=-1!==d||wpmdb_convert_exclude_revisions===!0&&"revision"!==c?' selected="selected" ':" ",a(f).append("<option"+d+'value="'+c+'">'+c+"</option>")}),wb=f;var g="";wpmdb_default_profile===!1&&"undefined"!=typeof wpmdb_loaded_tables_backup&&(g=wpmdb_loaded_tables_backup);var k=document.createElement("select");a(k).attr({multiple:"multiple",name:"select_backup[]",id:"select-backup","class":"multiselect"}),a.each(connection_data.tables,function(b,c){var d=a.inArray(c,g);d=-1!==d?' selected="selected" ':" ",a(k).append("<option"+d+'value="'+c+'">'+c+" ("+connection_data.table_sizes_hr[c]+")</option>")}),xb=k,"pull"===wpmdb_migration_type()?(a.wpmdb.do_action("wpmdb_update_pull_table_select"),a("#select-post-types").remove(),a(".select-post-types-wrap").prepend(wb),a("#select-backup").remove(),a(".backup-tables-wrap").prepend(yb),a(".table-prefix").html(b.prefix),a(".uploads-dir").html(wpmdb_data.this_uploads_dir)):(a("#select-backup").remove(),a(".backup-tables-wrap").prepend(xb)),a.wpmdb.do_action("verify_connection_to_remote_site",connection_data)}})}}function db(c,d){a(".licence-input, .register-licence").remove(),a(".licence-not-entered").prepend(c.masked_licence),a(".support-content").empty().html("<p>"+wpmdb_strings.fetching_license+'<img src="'+bb+'" alt="" class="ajax-spinner general-spinner" /></p>'),b(d),a(".migrate-selection label").removeClass("disabled"),a(".migrate-selection input").removeAttr("disabled")}function eb(){a.ajax({url:ajaxurl,type:"POST",dataType:"text",cache:!1,data:{action:"wpmdb_get_log",nonce:wpmdb_data.nonces.get_log},error:function(){alert(wpmdb_strings.update_log_problem)},success:function(b){a(".debug-log-textarea").val(b)}})}function fb(){var b=a(".progress-content").outerHeight();a(".progress-content").animate({top:"-"+b+"px"},400,"swing",function(){a("#overlay").remove(),a(".progress-content").remove()}),M=!1}function gb(){var b;if(a(".save-settings-button").blur(),!F){if(a("#migrate-selected").is(":checked")&&null===a("#select-tables").val())return void alert(wpmdb_strings.please_select_one_table);var c=!1;a("#create_new").is(":checked")&&(c=!0);var d=a(".create-new-profile").val();F=!0,b=a("#migrate-form").serialize(),a(".save-settings-button").attr("disabled","disabled").after('<img src="'+bb+'" alt="" class="save-profile-ajax-spinner general-spinner" />'),C=!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(){C=!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()}),F=!1},success:function(b){var e=parseInt(a("#migrate-form input[name=save_migration_profile_option]:checked").val(),10)+1;if(C=!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()}),F=!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="tools.php?page=wp-migrate-db-pro"> Saved Profiles </a>').append('<span class="crumb">'+j+"</span>");a("#migrate-form").prepend(k)}window.history.pushState({updated_profile_id:e},null,i)}}})}}function hb(){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();{var b;a.trim(a(".pull-push-connection-info").val()).split("\n")}wpmdb_toggle_migration_action_text(),"pull"===wpmdb_migration_type()?(a(".pull-list li").append(zb),zb.show(function(){var b=a(this).find(".pull-push-connection-info");b.val()||b.focus()}),A?(a(".connection-status").hide(),a(".step-two").show(),a(".table-prefix").html(connection_data.prefix),a(".uploads-dir").html(wpmdb_data.this_uploads_dir),H===!1&&(b=k(connection_data.url),a(".create-new-profile").val(b)),J===!0&&a(".prefix-notice.pull").show(),K===!0&&a(".ssl-notice").show(),L===!0&&(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(zb),zb.show(function(){var b=a(this).find(".pull-push-connection-info");b.val()||b.focus()}),A?(a(".connection-status").hide(),a(".step-two").show(),a(".table-prefix").html(wpmdb_data.this_prefix),a(".uploads-dir").html(connection_data.uploads_dir),H===!1&&(b=k(connection_data.url),a(".create-new-profile").val(b)),J===!0&&a(".prefix-notice.push").show(),K===!0&&a(".ssl-notice").show(),L===!0&&(a(".different-plugin-version-notice").show(),a(".step-two").hide()),wpmdb_toggle_migration_action_text(),"0"===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(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(),H===!1&&a(".create-new-profile").val(""),a(".backup-options").hide(),a(".keep-active-plugins").hide(),!1===wpmdb_data.write_permission&&(a(".directory-permission-notice").show(),a(".step-two").hide())),j(),a.wpmdb.do_action("move_connection_info_box",{migration_type:wpmdb_migration_type(),last_migration_type:B})}function ib(){"push"===wpmdb_migration_type()||"savefile"===wpmdb_migration_type()?("pull"===B&&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)}),a.wpmdb.do_action("wpmdb_update_push_table_select"),a("#select-post-types").remove(),a(".select-post-types-wrap").prepend(vb),a("#select-backup").remove(),a(".backup-tables-wrap").prepend(xb)):"pull"===wpmdb_migration_type()&&((""===B||"push"===B||"savefile"===B)&&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)}),a.wpmdb.do_action("wpmdb_update_pull_table_select"),a("#select-post-types").remove(),a(".select-post-types-wrap").prepend(wb),a("#select-backup").remove(),a(".backup-tables-wrap").prepend(yb)),B=wpmdb_migration_type()}function jb(a,b,c){return wpmdbGetAjaxErrors(wpmdb_strings.connection_local_server_problem,b,a,c)}function kb(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 lb(c,d){a(".nav-tab").removeClass("nav-tab-active"),a(".nav-tab."+c).addClass("nav-tab-active"),a(".content-tab").hide(),a("."+c+"-tab").show(),"settings"===c&&!1===I&&"1"===wpmdb_data.has_licence&&(a("p.licence-status").append("Checking License... ").append(cb),b()),"help"===c&&(eb(),!1===I&&"1"===wpmdb_data.has_licence&&(a(".support-content p").append(cb),b())),"addons"===c&&!0!==d&&!1===I&&"1"===wpmdb_data.has_licence&&(a(".addons-content p").append(cb),b())}function mb(b){var c=a(".pull-push-connection-info");if(!C&&!a(c).hasClass("temp-disabled")){b=a(".pull-push-connection-info").val();var e=a.trim(b).split("\n"),f=!1,g="";if(""===e&&(f=!0,g=wpmdb_strings.connection_info_missing),2===e.length||f||(f=!0,g=wpmdb_strings.connection_info_incorrect),f||kb(e[0])||(f=!0,g=wpmdb_strings.connection_info_url_invalid),!f&&e[1].length<32&&(f=!0,g=wpmdb_strings.connection_info_key_invalid),f||e[0]!==wpmdb_data.connection_info[0]||(f=!0,g=wpmdb_strings.connection_info_local_url),f||e[1]!==wpmdb_data.connection_info[1]||(f=!0,g=wpmdb_strings.connection_info_local_key),f)return a(".connection-status").html(g),void a(".connection-status").addClass("notification-message error-notice migration-error");var l=e[0]+"\n"+e[1];!1===wpmdb_data.openssl_available&&(e[0]=e[0].replace("https://","http://"),l=e[0]+"\n"+e[1],a(".pull-push-connection-info").val(l)),J=!1,C=!0,n(),a(".basic-access-auth-wrapper").is(":visible")&&(e[0]=e[0].replace(/\/\/(.*)@/,"//"),e[0]=e[0].replace("//","//"+encodeURIComponent(a.trim(a(".auth-username").val()))+":"+encodeURIComponent(a.trim(a(".auth-password").val()))+"@"),l=e[0]+"\n"+e[1],a(".pull-push-connection-info").val(l),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(cb);var p=wpmdb_migration_type();H=!1,a.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(b){a(".connection-status").html(jb(b.responseText,"(#100)",b)),a(".connection-status").addClass("notification-message error-notice migration-error"),a(".ajax-spinner").remove(),C=!1,o()},success:function(b){if(a(".ajax-spinner").remove(),C=!1,o(),h(e[0],e[1],b.scheme),"undefined"!=typeof b.wpmdb_error&&1===b.wpmdb_error)return 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());var c=k(b.url);a(".create-new-profile").val(c),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(),i(b.prefix),A=!0,connection_data=b,hb(),ib(),j(),d(),xb=a(ub).clone(),a(xb).attr({name:"select_backup[]",id:"select-backup"});var f=document.createElement("select");a(f).attr({multiple:"multiple",name:"select_post_types[]",id:"select-post-types","class":"multiselect"}),a.each(connection_data.post_types,function(b,c){a(f).append('<option value="'+c+'">'+c+"</option>")}),wb=f,a("#new-path-missing-warning, #new-url-missing-warning").hide(),"pull"===wpmdb_migration_type()?(a("#new-url").val(m(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(m(b.url))),a("#old-url").val(m(b.url)),a("#old-path").val(b.path),a.wpmdb.do_action("wpmdb_update_pull_table_select"),a("#select-post-types").remove(),a(".select-post-types-wrap").prepend(wb),a(".table-prefix").html(b.prefix),a(".uploads-dir").html(wpmdb_data.this_uploads_dir)):(a("#new-url").val(m(b.url)),a("#new-path").val(b.path),"true"===wpmdb_data.is_multisite&&a('.replace-row.pin .old-replace-col input[type="text"]').val(m(wpmdb_data.this_url)),a.wpmdb.do_action("wpmdb_update_push_table_select"),a("#select-backup").remove(),a(".backup-tables-wrap").prepend(xb)),next_step_in_migration={fn:a.wpmdb.do_action,args:["verify_connection_to_remote_site",connection_data]},execute_next_step()}})}}function nb(){W=!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===R&&(R=!1,execute_next_step())}a("#plugin-compatibility").change(function(){var b="1";if(a(this).is(":checked")){var c=confirm(wpmdb_strings.mu_plugin_confirmation);if(!c)return void a(this).prop("checked",!1)}else b="0";a(".plugin-compatibility-wrap").toggle(),a(this).parent().append(cb),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:b},error:function(b){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(),(navigator.userAgent.indexOf("MSIE")>0||navigator.userAgent.indexOf("Trident")>0)&&a(".ie-warning").show(),0===wpmdb_data.valid_licence&&a("#savefile").prop("checked",!0);var ob=a(".max-request-size"),pb=a(".slider",ob);pb.slider({range:"min",value:parseInt(wpmdb_data.max_request/1024),min:512,max:parseInt(wpmdb_data.bottleneck/1024),step:1,create:function(){p(ob,wpmdb_data.max_request/1024,"kB")},slide:function(a,b){p(ob,b.value,"kB")},stop:function(b,c){a(".amount",ob).after('<img src="'+bb+'" alt="" class="slider-spinner general-spinner" />'),pb.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(){pb.slider("enable"),a(".slider-spinner",ob).remove(),alert(wpmdb_strings.max_request_size_problem),p(ob,wpmdb_data.max_request/1024,"kB"),pb.slider("enable")},success:function(){pb.slider("enable"),a(".slider-success-msg",ob).show(),a(".slider-success-msg",ob).fadeOut(2e3,function(){a(this).hide()}),a(".slider-spinner",ob).remove()}})}});var qb=a(".delay-between-requests"),rb=a(".slider",qb);rb.slider({range:"min",value:parseInt(wpmdb_data.delay_between_requests/1e3),min:0,max:10,step:1,create:function(){p(qb,wpmdb_data.delay_between_requests/1e3,"s")},slide:function(a,b){p(qb,b.value,"s")},stop:function(b,c){a(".amount",qb).after('<img src="'+bb+'" alt="" class="slider-spinner general-spinner" />'),rb.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(){rb.slider("enable"),a(".slider-spinner",qb).remove(),alert(wpmdb_strings.delay_between_requests_problem),p(qb,wpmdb_data.delay_between_requests/1e3,"s"),rb.slider("enable")},success:function(){wpmdb_data.delay_between_requests=parseInt(1e3*c.value),rb.slider("enable"),a(".slider-success-msg",qb).show(),a(".slider-success-msg",qb).fadeOut(2e3,function(){a(this).hide()}),a(".slider-spinner",qb).remove()}})}});var sb=a(".progress-content").clone();a(".progress-content").remove();var tb=a("#select-tables").clone(),ub=a("#select-tables").clone(),vb=a("#select-post-types").clone(),wb=a("#select-post-types").clone(),xb=a("#select-backup").clone(),yb=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()),B=wpmdb_migration_type(),a(".content-tab").on("click",".check-my-licence-again",function(c){c.preventDefault(),I=!1,a(c.target).replaceWith("Checking... "+cb),b(null,"all")}),a.wpmdb.add_action("wpmdb_refresh_table_selects",d),a.wpmdb.add_action("wpmdb_update_push_table_select",e),a.wpmdb.add_action("wpmdb_update_pull_table_select",S),a.wpmdb.add_action("wpmdb_disable_table_migration_options",T),a.wpmdb.add_action("wpmdb_enable_table_migration_options",U),a.wpmdb.add_action("wpmdb_select_all_tables",X),a.wpmdb.add_filter("wpmdb_base_old_url",Y),ab(),a("body").on("click",".js-action-link",function(b){b.preventDefault(),a(this).blur()}),a(".licence-form").submit(function(b){if(b.preventDefault(),!D){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"),D=!0,a(".button.register-licence").after('<img src="'+bb+'" 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(){D=!1,a(".register-licence-ajax-spinner").remove(),a(".licence-status").html(wpmdb_strings.register_license_problem)},success:function(b){if(D=!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&&(db(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"),db(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(){alert(wpmdb_strings.clear_log_problem)},success:function(){}})}),a(".multiselect-select-all").click(function(){var b=a(this).parents(".select-wrap").children(".multiselect");a("option",b).attr("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(){a(this).is(":checked")?(a(".save-settings-button").show(),a(".migrate-db .button-primary").val(wpmdb_strings.migrate_db_save)):(a(".save-settings-button").hide(),a(".migrate-db .button-primary").val(wpmdb_strings.migrate_db))}),a(".create-new-profile").focus(function(){a("#create_new").prop("checked",!0)}),a("#save-migration-profile").is(":checked")&&(a(".save-settings-button").show(),a(".migrate-db .button-primary").val(wpmdb_strings.migrate_db_save)),a(".checkbox-label input[type=checkbox]").each(function(){a(this).is(":checked")&&a(this).parent().next().show()}),a(".migrate-db-button").click(function(b){function d(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,0>d?(j=0-d,d=0):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}),g=0,a(".progress-tables").not(".media").find(".progress-chunk").each(function(c){function d(b){a("span",b).innerWidth()>a(b).width()&&a("span",b).hide()}g+=a(this).width(),1>a(this).width()&&b[c]!==i&&(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=0;0!==e[i]&&100>g&&(k=Math.round(e[i]/d*100)),a(".progress-tables .progress-chunk:last").css("width",k+"%"),a(".progress-chunk-hover:last").css("width",k+"%");var l=[e,d];return l}if(a(this).blur(),b.preventDefault(),z="",!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);
|
2 |
+
var e=!1,g=!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),e=!0),a("#new-path").length&&!a("#new-path").val()&&(a("#new-path-missing-warning").show(),!1===e&&(a("#new-path").focus(),a("html,body").scrollTop(0)),g=!0),!0!==e&&!0!==g){a("#save-migration-profile").is(":checked")&&gb(),v=a("#migrate-form").serialize();var h=a(document).height();a("body").append('<div id="overlay"></div>'),a("#overlay").height(h).css({position:"fixed",top:0,left:0,width:"100%","z-index":99999,display:"none"});var i=sb.clone();s=wpmdb_migration_type(),w="backup","savefile"===s&&(w="migrate"),a("#create-backup").is(":checked")===!1&&(w="migrate");var j=a("input[name=table_migrate_option]:checked").val(),k=a.trim(a(".pull-push-connection-info").val()).split("\n"),m="";t=k[0],u=k[1];var n="";a("#overlay").after(i),y=wpmdb_strings.exporting_complete,"savefile"===s?n=wpmdb_strings.exporting_please_wait:(n=l(t,s,"migrating"),y=l(t,s,"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"===w?("migrate_only_with_prefix"===p&&"backup_selected"===o&&(o="backup_only_with_prefix"),"push"===s?(m=connection_data.table_rows,"backup_only_with_prefix"===o?Q=connection_data.prefixed_tables:"backup_selected"===o?(q=a("#select-tables").val(),Q=f(q,connection_data.tables)):"backup_manual_select"===o&&(Q=a("#select-backup").val())):(m=wpmdb_data.this_table_rows,"backup_only_with_prefix"===o?Q=wpmdb_data.this_prefixed_tables:"backup_selected"===o?(q=a("#select-tables").val(),Q=f(q,wpmdb_data.this_tables)):"backup_manual_select"===o&&(Q=a("#select-backup").val()))):"migrate_select"===j?(Q=a("#select-tables").val(),m="push"===s||"savefile"===s?wpmdb_data.this_table_rows:connection_data.table_rows):"push"===s||"savefile"===s?(Q=wpmdb_data.this_prefixed_tables,m=wpmdb_data.this_table_rows):(Q=connection_data.prefixed_tables,m=connection_data.table_rows);var r=d(Q,m);m=r[0];var x=r[1];a(".progress-title").after('<img src="'+bb+'" alt="" class="migration-progress-ajax-spinner general-spinner" />');var A=a(".progress-content").outerHeight();a(".progress-content").css("top","-"+A+"px").show().animate({top:"0px"}),c(),N=!0;var B={action:"wpmdb_initiate_migration",intent:s,url:t,key:u,form_data:v,stage:w,nonce:wpmdb_data.nonces.initiate_migration};"savefile"!==s&&(B.temp_prefix=connection_data.temp_prefix),C=!0,a.ajax({url:ajaxurl,type:"POST",dataType:"json",cache:!1,data:B,error:function(b,c,d){a(".progress-title").html(wpmdb_strings.migration_failed),a(".progress-text").html(jb(b.responseText,"(#112)",b)),a(".progress-text").addClass("migration-error"),console.log(b),console.log(c),console.log(d),C=!1,migration_error=!0,migration_complete_events()},success:function(b){if(C=!1,"undefined"!=typeof b&&"undefined"!=typeof b.wpmdb_error&&1===b.wpmdb_error)return migration_error=!0,migration_complete_events(),a(".progress-title").html(wpmdb_strings.migration_failed),a(".progress-text").addClass("migration-error"),void a(".progress-text").html(b.body);z=b.migration_state_id;var c=0,e=0;V=0;var f=0,g=0,h=0,i=0;$=0,"savefile"!==s&&"undefined"!=typeof connection_data&&"undefined"!=typeof connection_data.delay_between_requests&&($=Math.max(parseInt(wpmdb_data.delay_between_requests),parseInt(connection_data.delay_between_requests))),migrate_table_recursive=function(b,k){if(c>=Q.length){if("backup"!==w)return a(".progress-label").removeClass("label-visible"),hooks=a.wpmdb.apply_filters("wpmdb_before_migration_complete_hooks",hooks),hooks.push("migration_complete"),hooks.push("wpmdb_flush"),hooks=a.wpmdb.apply_filters("wpmdb_after_migration_complete_hooks",hooks),hooks.push("migration_complete_events"),next_step_in_migration={fn:wpmdb_call_next_hook},void execute_next_step();w="migrate",c=0,e=0,V=0,a(".progress-bar").width("0px"),"migrate_select"===j?(Q=a("#select-tables").val(),m="push"===s||"savefile"===s?wpmdb_data.this_table_rows:connection_data.table_rows):"push"===s||"savefile"===s?(Q=wpmdb_data.this_prefixed_tables,m=wpmdb_data.this_table_rows):(Q=connection_data.prefixed_tables,m=connection_data.table_rows),a(".progress-tables").empty(),a(".progress-tables-hover-boxes").empty(),r=d(Q,m),m=r[0],x=r[1]}a(".progress-text").html("backup"===w?V+"% - "+wpmdb_strings.backing_up+' "'+Q[c]+'"':V+"% - "+wpmdb_strings.migrating+' "'+Q[c]+'"');var l=0;c===Q.length-1&&(l=1);var n=0;"savefile"!==s&&1===parseInt(connection_data.gzip)&&(n=1);var o={action:"wpmdb_migrate_table",migration_state_id:z,table:Q[c],stage:w,current_row:b,last_table:l,primary_keys:k,gzip:n,nonce:wpmdb_data.nonces.migrate_table};"savefile"!==s&&(o.bottleneck=connection_data.bottleneck,o.prefix=connection_data.prefix),connection_data&&connection_data.path_current_site&&connection_data.domain&&(o.path_current_site=connection_data.path_current_site,o.domain_current_site=connection_data.domain),C=!0,a.ajax({url:ajaxurl,type:"POST",dataType:"text",cache:!1,timeout:0,data:o,error:function(b,d,e){a(".progress-title").html(wpmdb_strings.migration_failed),a(".progress-text").html(wpmdb_strings.table_process_problem+" "+Q[c]),a(".progress-text").append("<br /><br />"+wpmdb_strings.status+": "+b.status+" "+b.statusText+"<br /><br />"+wpmdb_strings.response+":<br />"+b.responseText),a(".progress-text").addClass("migration-error"),C=!1,console.log(b),console.log(d),console.log(e),migration_error=!0,migration_complete_events()},success:function(b){C=!1,b=a.trim(b);var d=wpmdb_parse_json(b);return!1===d||null===d?(a(".progress-title").html(wpmdb_strings.migration_failed),a(".progress-text").html(""===b||null===b?wpmdb_strings.table_process_problem_empty_response+" "+Q[c]:jb(b,null,null)),a(".progress-text").addClass("migration-error"),migration_error=!0,void migration_complete_events()):"undefined"!=typeof d.wpmdb_error&&1===d.wpmdb_error?(a(".progress-title").html(wpmdb_strings.migration_failed),a(".progress-text").addClass("migration-error"),a(".progress-text").html(d.body),migration_error=!0,void migration_complete_events()):(1===l&&"savefile"===s&&("undefined"!=typeof d.dump_filename&&(O=d.dump_filename),"undefined"!=typeof d.dump_path&&(P=d.dump_path)),-1===d.current_row||"-1"===d.current_row?(e-=i,i=0,h=0,e+=parseInt(m[Q[c]]),c++,d.current_row="",d.primary_keys=""):(g=parseInt(d.current_row),f=g-h,h=g,e+=f,i+=f),V=Math.floor(e/x*100),a(".progress-bar").width(V+"%"),next_step_in_migration={fn:migrate_table_recursive,args:[d.current_row,d.primary_keys]},void execute_next_step())}})},next_step_in_migration={fn:migrate_table_recursive,args:["-1",""]},execute_next_step()}})}}}),migration_complete_events=function(){!1===migration_error&&(""===non_fatal_errors?("savefile"!==s&&!0===a("#save_computer").is(":checked")&&a(".progress-text").css("visibility","hidden"),a(".progress-title").html(y).append('<div class="dashicons dashicons-yes"></div>')):(a(".progress-text").html(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(),hooks=[],call_stack=[],migration_error=!1,N=!1,M=!0,R=!1,W=!1,C=!1,non_fatal_errors="",a(".progress-label").remove(),a(".migration-progress-ajax-spinner").remove(),a(".close-progress-content").show(),a("#overlay").css("cursor","pointer"),clearInterval(x)},migration_complete=function(){if(a(".migration-controls").fadeOut(),"savefile"===s){N=!1;var b=wpmdb_strings.migration_complete;if(a("#save_computer").is(":checked")){var c=wpmdb_data.this_download_url+encodeURIComponent(O);a("#gzip_file").is(":checked")&&(c+="&gzip=1"),window.location=c}else b=wpmdb_strings.completed_dump_located_at+" "+P;migration_error===!1&&(a(".progress-text").html(b),migration_complete_events(),a(".progress-title").html(y))}else a(".progress-text").html(wpmdb_strings.finalizing_migration),C=!0,a.ajax({url:ajaxurl,type:"POST",dataType:"text",cache:!1,data:{action:"wpmdb_finalize_migration",migration_state_id:z,prefix:connection_data.prefix,tables:Q.join(","),nonce:wpmdb_data.nonces.finalize_migration},error:function(b,c,d){C=!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(b+" : "+c+" : "+d),migration_error=!0,migration_complete_events()},success:function(b){return C=!1,"1"!==a.trim(b)?(a(".progress-title").html(wpmdb_strings.migration_failed),a(".progress-text").html(b),a(".progress-text").addClass("migration-error"),migration_error=!0,void migration_complete_events()):(next_step_in_migration={fn:wpmdb_call_next_hook},void execute_next_step())}})},wpmdb_flush=function(){"savefile"!==s&&(a(".progress-text").html(wpmdb_strings.flushing),C=!0,a.ajax({url:ajaxurl,type:"POST",dataType:"text",cache:!1,data:{action:"wpmdb_flush",migration_state_id:z,nonce:wpmdb_data.nonces.flush},error:function(b,c,d){C=!1,a(".progress-title").html(wpmdb_strings.migration_failed),a(".progress-text").html(wpmdb_strings.flush_problem),a(".progress-text").addClass("migration-error"),alert(b+" : "+c+" : "+d),migration_error=!0,migration_complete_events()},success:function(b){return C=!1,"1"!==a.trim(b)?(a(".progress-title").html(wpmdb_strings.migration_failed),a(".progress-text").html(b),a(".progress-text").addClass("migration-error"),migration_error=!0,void migration_complete_events()):(next_step_in_migration={fn:wpmdb_call_next_hook},void execute_next_step())}}))},a("body").on("click",".close-progress-content-button",function(){fb()}),a("body").on("click","#overlay",function(){M===!0&&fb()}),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 gb()}),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 zb=a(".connection-info-wrapper");hb(),a(".migrate-selection.option-group input[type=radio]").change(function(){hb(),A&&ib()}),"pull"!==wpmdb_migration_type()&&"push"!==wpmdb_migration_type()||A||(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.css(d.hasClass("bottom")?{left:e.left-d.width()/2+"px",top:e.top+c.height()+9+"px"}:{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,lb(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(),a(".replace-row").length<2&&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 Ab="";window.location.hash&&(Ab=window.location.hash.substring(1),lb(Ab,!1)),""!==g("install-plugin")&&(Ab="addons",I=!0,lb(Ab,!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&&!E&&(E=!0,a(".reset-api-key").after('<img src="'+bb+'" 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(){alert(wpmdb_strings.reset_api_key_problem),a(".reset-api-key-ajax-spinner").remove(),E=!1},success:function(b){a(".reset-api-key-ajax-spinner").remove(),E=!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(!G){a(this).addClass("disabled");var b=a("#selected-plugins");a(b).attr("disabled","disabled"),G=!0,a(this).after('<img src="'+bb+'" 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){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"),G=!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"),G=!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(){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(){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),A=!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(cb);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(){alert(wpmdb_strings.save_settings_problem),a(".ajax-spinner").remove()},success:function(){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(),mb()}),a(".pull-push-connection-info").bind("paste",function(){setTimeout(function(){mb()},0)}),a("body").on("click",".try-again",function(){mb()}),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),mb()}),a(".create-new-profile").change(function(){H=!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){q(a)}),a("body").on("click",".cancel",function(a){nb(a)}),a(".enter-licence").click(function(){a(".settings").click(),a(".licence-input").focus()}),execute_next_step=function(){if($>0&&!1===Z)return void setTimeout(function(){Z=!0,execute_next_step()},$);if(Z=!1,!0===R)return a(".migration-progress-ajax-spinner").hide(),clearInterval(x),a(".progress-text").html(wpmdb_strings.paused),a("body").on("click",".pause-resume",function(a){q(a)}),a("body").on("click",".cancel",function(a){nb(a)}),void a(".pause-resume").html(wpmdb_strings.resume);if(!0===W){s=wpmdb_migration_type();var b;"savefile"===s?b=wpmdb_strings.removing_local_sql:"pull"===s?b="backup"===w?wpmdb_strings.removing_local_backup:wpmdb_strings.removing_local_temp_tables:"push"===s&&(b="backup"===w?wpmdb_strings.removing_remote_sql:wpmdb_strings.removing_remote_temp_tables),a(".progress-text").html(b);var c={action:"wpmdb_cancel_migration",migration_state_id:z};C=!0,a.ajax({url:ajaxurl,type:"POST",dataType:"text",cache:!1,data:c,error:function(b,c,d){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+": "+b.status+" "+b.statusText+"<br /><br />"+wpmdb_strings.response+":<br />"+b.responseText),a(".progress-text").addClass("migration-error"),console.log(b),console.log(c),console.log(d),C=!1,migration_error=!0,migration_complete_events()},success:function(b){return C=!1,b=a.trim(b),"push"===s&&"1"!==b||"push"!==s&&""!==b?(a(".progress-title").html(wpmdb_strings.migration_cancellation_failed),a(".progress-text").html(b),a(".progress-text").addClass("migration-error"),migration_error=!0,void migration_complete_events()):(y=wpmdb_strings.migration_cancelled,a(".progress-text").hide(),void migration_complete_events())}})}else next_step_in_migration.fn.apply(null,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(cb);var b=a.trim(a(".pull-push-connection-info").val()).split("\n");C=!0,n(),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){a(".connection-status").html(jb(b.responseText,"(#143)",b)),a(".connection-status").addClass("notification-message error-notice migration-error"),a(".ajax-spinner").remove(),C=!1,o()},success:function(b){return a(".ajax-spinner").remove(),C=!1,o(),"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 mb()}})}),a("body").on("click",".reactivate-licence",function(){C=!0,a(".invalid-licence").empty().html(wpmdb_strings.attempting_to_activate_licence),a(".invalid-licence").append(cb),a.ajax({url:ajaxurl,type:"POST",dataType:"json",cache:!1,data:{action:"wpmdb_reactivate_licence",nonce:wpmdb_data.nonces.reactivate_licence},error:function(b){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(),C=!1},success:function(b){return a(".ajax-spinner").remove(),C=!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(){j()}),a("body").on("change","#select-tables",function(){j()})})}(jQuery);
|
@@ -27,7 +27,8 @@ class WPMDB_Base {
|
|
27 |
protected $is_addon = false;
|
28 |
protected $core_slug;
|
29 |
protected $error_log;
|
30 |
-
protected $
|
|
|
31 |
|
32 |
function __construct( $plugin_file_path ) {
|
33 |
$this->load_settings();
|
@@ -64,13 +65,58 @@ class WPMDB_Base {
|
|
64 |
}
|
65 |
|
66 |
/**
|
67 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
68 |
*/
|
69 |
-
function
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
70 |
if ( defined( 'DOING_WPMDB_TESTS' ) || $this->doing_cli_migration ) {
|
71 |
-
$this->
|
72 |
-
} elseif ( is_null( $this->
|
73 |
-
$this->
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
74 |
}
|
75 |
}
|
76 |
|
@@ -80,12 +126,16 @@ class WPMDB_Base {
|
|
80 |
|
81 |
function pro_addon_construct() {
|
82 |
$this->addons = array(
|
83 |
-
'wp-migrate-db-pro-media-files/wp-migrate-db-pro-media-files.php'
|
84 |
'name' => 'Media Files',
|
85 |
-
'required_version' => '1.
|
86 |
),
|
87 |
-
'wp-migrate-db-pro-cli/wp-migrate-db-pro-cli.php'
|
88 |
'name' => 'CLI',
|
|
|
|
|
|
|
|
|
89 |
'required_version' => '1.0',
|
90 |
)
|
91 |
);
|
@@ -108,12 +158,6 @@ class WPMDB_Base {
|
|
108 |
// allow developers to change the temporary prefix applied to the tables
|
109 |
$this->temp_prefix = apply_filters( 'wpmdb_temporary_prefix', $this->temp_prefix );
|
110 |
|
111 |
-
// Seen when the user clicks "view details" on the plugin listing page
|
112 |
-
add_action( 'install_plugins_pre_plugin-information', array( $this, 'plugin_update_popup' ) );
|
113 |
-
|
114 |
-
// Add an extra row to the plugin screen
|
115 |
-
add_action( 'after_plugin_row_' . $this->plugin_basename, array( $this, 'plugin_row' ), 11 );
|
116 |
-
|
117 |
// Adds a custom error message to the plugin install page if required (licence expired / invalid)
|
118 |
add_filter( 'http_response', array( $this, 'verify_download' ), 10, 3 );
|
119 |
|
@@ -144,14 +188,15 @@ class WPMDB_Base {
|
|
144 |
}
|
145 |
|
146 |
$default_settings = array(
|
147 |
-
'key'
|
148 |
-
'allow_pull'
|
149 |
-
'allow_push'
|
150 |
-
'profiles'
|
151 |
-
'licence'
|
152 |
-
'verify_ssl'
|
153 |
-
'blacklist_plugins'
|
154 |
-
'max_request'
|
|
|
155 |
);
|
156 |
|
157 |
// if we still don't have settings exist this must be a fresh install, set up some default settings
|
@@ -221,11 +266,22 @@ class WPMDB_Base {
|
|
221 |
}
|
222 |
}
|
223 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
224 |
function remote_post( $url, $data, $scope, $args = array(), $expecting_serial = false ) {
|
225 |
$this->set_time_limit();
|
226 |
$this->set_post_data();
|
227 |
|
228 |
-
if ( function_exists( 'fsockopen' ) && strpos( $url, 'https://' )
|
229 |
$url_parts = $this->parse_url( $url );
|
230 |
$host = $url_parts['host'];
|
231 |
if ( $pf = @fsockopen( $host, 443, $err, $err_string, 1 ) ) {
|
@@ -237,7 +293,7 @@ class WPMDB_Base {
|
|
237 |
}
|
238 |
}
|
239 |
|
240 |
-
$sslverify = ( $this->settings['verify_ssl']
|
241 |
|
242 |
$default_remote_post_timeout = apply_filters( 'wpmdb_default_remote_post_timeout', 60 * 20 );
|
243 |
|
@@ -259,38 +315,51 @@ class WPMDB_Base {
|
|
259 |
|
260 |
$this->attempting_to_connect_to = $url;
|
261 |
|
|
|
|
|
262 |
$response = wp_remote_post( $url, $args );
|
263 |
|
264 |
if ( ! is_wp_error( $response ) ) {
|
265 |
-
|
|
|
|
|
|
|
266 |
}
|
267 |
|
268 |
if ( is_wp_error( $response ) ) {
|
269 |
-
if ( strpos( $url, 'https://' )
|
270 |
return $this->retry_remote_post( $url, $data, $scope, $args, $expecting_serial );
|
271 |
} elseif ( isset( $response->errors['http_request_failed'][0] ) && strstr( $response->errors['http_request_failed'][0], 'timed out' ) ) {
|
272 |
$this->error = sprintf( __( 'The connection to the remote server has timed out, no changes have been committed. (#134 - scope: %s)', 'wp-migrate-db' ), $scope );
|
273 |
} 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" ) ) ) {
|
274 |
-
$this->error = sprintf( __( 'We could not find: %s. Are you sure this is the correct URL?', 'wp-migrate-db' ), $this->
|
275 |
-
$url_bits
|
276 |
-
if ( strstr( $this->
|
277 |
$this->error .= '<br />';
|
278 |
-
if ( $this->
|
279 |
$this->error .= __( 'It appears that you might be trying to pull from a local environment. This will not work if <u>this</u> website happens to be located on a remote server, it would be impossible for this server to contact your local environment.', 'wp-migrate-db' );
|
280 |
} else {
|
281 |
$this->error .= __( 'It appears that you might be trying to push to a local environment. This will not work if <u>this</u> website happens to be located on a remote server, it would be impossible for this server to contact your local environment.', 'wp-migrate-db' );
|
282 |
}
|
283 |
}
|
284 |
} else {
|
285 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
286 |
}
|
287 |
$this->log_error( $this->error, $response );
|
288 |
|
289 |
return false;
|
290 |
-
} elseif ( (int) $response['response']['code']
|
291 |
-
if ( strpos( $url, 'https://' )
|
292 |
return $this->retry_remote_post( $url, $data, $scope, $args, $expecting_serial );
|
293 |
-
} elseif ( $response['response']['code']
|
294 |
$this->error = __( 'The remote site is protected with Basic Authentication. Please enter the username and password above to continue. (401 Unauthorized)', 'wp-migrate-db' );
|
295 |
$this->log_error( $this->error, $response );
|
296 |
|
@@ -301,25 +370,30 @@ class WPMDB_Base {
|
|
301 |
|
302 |
return false;
|
303 |
}
|
304 |
-
} elseif (
|
305 |
-
if ( strpos( $url, 'https://' )
|
306 |
return $this->retry_remote_post( $url, $data, $scope, $args, $expecting_serial );
|
307 |
}
|
308 |
-
$this->error = __( '
|
|
|
|
|
|
|
|
|
|
|
309 |
$this->log_error( $this->error, $response );
|
310 |
|
311 |
return false;
|
312 |
-
} elseif ( $response['body']
|
313 |
-
if ( strpos( $url, 'https://' )
|
314 |
return $this->retry_remote_post( $url, $data, $scope, $args, $expecting_serial );
|
315 |
}
|
316 |
-
$this->error =
|
317 |
$this->log_error( $this->error, $response );
|
318 |
|
319 |
return false;
|
320 |
-
} elseif ( $expecting_serial && is_serialized( $response['body'] )
|
321 |
$unserialized_response = unserialize( $response['body'] );
|
322 |
-
if ( isset( $unserialized_response['error'] ) && '1' == $unserialized_response['error'] && strpos( $url, 'https://' )
|
323 |
return $this->retry_remote_post( $url, $data, $scope, $args, $expecting_serial );
|
324 |
}
|
325 |
}
|
@@ -469,6 +543,94 @@ class WPMDB_Base {
|
|
469 |
return $url;
|
470 |
}
|
471 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
472 |
/**
|
473 |
* Main function for communicating with the Delicious Brains API.
|
474 |
*
|
@@ -513,9 +675,22 @@ class WPMDB_Base {
|
|
513 |
|
514 |
$disable_ssl_url = network_admin_url( $this->plugin_base . '&nonce=' . wp_create_nonce( 'wpmdb-disable-ssl' ) . '&wpmdb-disable-ssl=1' );
|
515 |
$connection_failed_message = '<div class="updated warning inline-message">';
|
516 |
-
$connection_failed_message .= sprintf( __( '<strong>Could not connect to deliciousbrains.com</strong> — 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, __(
|
517 |
$connection_failed_message .= '</div>';
|
518 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
519 |
return json_encode( array( 'errors' => array( 'connection_failed' => $connection_failed_message ) ) );
|
520 |
}
|
521 |
|
@@ -574,105 +749,6 @@ class WPMDB_Base {
|
|
574 |
return true;
|
575 |
}
|
576 |
|
577 |
-
function plugin_update_popup() {
|
578 |
-
if ( $this->plugin_slug != $_GET['plugin'] ) {
|
579 |
-
return;
|
580 |
-
}
|
581 |
-
|
582 |
-
$filename = $this->plugin_slug;
|
583 |
-
$latest_version = $this->get_latest_version( $this->plugin_slug );
|
584 |
-
|
585 |
-
if ( $this->is_beta_version( $latest_version ) ) {
|
586 |
-
$filename .= '-beta';
|
587 |
-
}
|
588 |
-
|
589 |
-
$url = $this->dbrains_api_base . '/content/themes/delicious-brains/update-popup/' . $filename . '.html';
|
590 |
-
$data = wp_remote_get( $url, array( 'timeout' => 30 ) );
|
591 |
-
|
592 |
-
if ( is_wp_error( $data ) || 200 != $data['response']['code'] ) {
|
593 |
-
echo '<p>' . __( 'Could not retrieve version details. Please try again.', 'wp-migrate-db' ) . '</p>';
|
594 |
-
} else {
|
595 |
-
echo $data['body'];
|
596 |
-
}
|
597 |
-
|
598 |
-
exit;
|
599 |
-
}
|
600 |
-
|
601 |
-
/*
|
602 |
-
* Shows a message below the plugin on the plugins page when:
|
603 |
-
* 1. the license hasn't been activated
|
604 |
-
* 2. when there's an update available but the license is expired
|
605 |
-
*
|
606 |
-
* TODO: Implement "Check my license again" link
|
607 |
-
*/
|
608 |
-
function plugin_row() {
|
609 |
-
$licence = $this->get_licence_key();
|
610 |
-
$licence_response = $this->is_licence_expired();
|
611 |
-
$licence_problem = isset( $licence_response['errors'] );
|
612 |
-
|
613 |
-
if ( ! isset( $GLOBALS['wpmdb_meta'][ $this->plugin_slug ]['version'] ) ) {
|
614 |
-
$installed_version = '0';
|
615 |
-
} else {
|
616 |
-
$installed_version = $GLOBALS['wpmdb_meta'][ $this->plugin_slug ]['version'];
|
617 |
-
}
|
618 |
-
|
619 |
-
$latest_version = $this->get_latest_version( $this->plugin_slug );
|
620 |
-
|
621 |
-
$new_version = '';
|
622 |
-
if ( version_compare( $installed_version, $latest_version, '<' ) ) {
|
623 |
-
$new_version = sprintf( __( 'There is a new version of %s available.', 'wp-migrate-db' ), $this->plugin_title );
|
624 |
-
$new_version .= ' <a class="thickbox" title="' . $this->plugin_title . '" href="plugin-install.php?tab=plugin-information&plugin=' . rawurlencode( $this->plugin_slug ) . '&TB_iframe=true&width=640&height=808">';
|
625 |
-
$new_version .= sprintf( __( 'View version %s details', 'wp-migrate-db' ), $latest_version ) . '</a>.';
|
626 |
-
}
|
627 |
-
|
628 |
-
if ( ! $new_version && ! empty( $licence ) ) {
|
629 |
-
return;
|
630 |
-
}
|
631 |
-
|
632 |
-
if ( empty( $licence ) ) {
|
633 |
-
$settings_link = sprintf( '<a href="%s">%s</a>',
|
634 |
-
network_admin_url( $this->plugin_base ) . '#settings',
|
635 |
-
_x( 'Settings', 'Plugin configuration and preferences', 'wp-migrate-db' ) );
|
636 |
-
if ( $new_version ) {
|
637 |
-
$message = sprintf( __( 'To update, go to %1$s and enter your license key. If you don\'t have a license key, you may <a href="%2$s">purchase one</a>.', 'wp-migrate-db' ), $settings_link, 'http://deliciousbrains.com/wp-migrate-db-pro/pricing/' );
|
638 |
-
} else {
|
639 |
-
$message = sprintf( __( 'To finish activating %1$s, please go to %2$s and enter your license key. If you don\'t have a license key, you may <a href="%3$s">purchase one</a>.', 'wp-migrate-db' ), $this->plugin_title, $settings_link, 'http://deliciousbrains.com/wp-migrate-db-pro/pricing/' );
|
640 |
-
}
|
641 |
-
} elseif ( $licence_problem ) {
|
642 |
-
$message = array_shift( $licence_response['errors'] ) . sprintf( ' <a href="#" class="check-my-licence-again">%s</a>',
|
643 |
-
__( 'Check my license again', 'wp-migrate-db' ) );
|
644 |
-
} else {
|
645 |
-
return;
|
646 |
-
} ?>
|
647 |
-
|
648 |
-
<tr class="plugin-update-tr wpmdbpro-custom">
|
649 |
-
<td colspan="3" class="plugin-update">
|
650 |
-
<div class="update-message"><span class="wpmdb-new-version-notice"><?php echo esc_html( $new_version ); ?></span> <span class="wpmdb-licence-error-notice"><?php echo $message; ?></span></div>
|
651 |
-
</td>
|
652 |
-
</tr>
|
653 |
-
|
654 |
-
<?php if ( $new_version ) { // removes the built-in plugin update message ?>
|
655 |
-
<script type="text/javascript">
|
656 |
-
(function ($) {
|
657 |
-
var wpmdb_row = jQuery('#<?php echo $this->plugin_slug; ?>'),
|
658 |
-
next_row = wpmdb_row.next();
|
659 |
-
|
660 |
-
// If there's a plugin update row - need to keep the original update row available so we can switch it out
|
661 |
-
// if the user has a successful response from the 'check my license again' link
|
662 |
-
if (next_row.hasClass('plugin-update-tr') && !next_row.hasClass('wpmdbpro-custom')) {
|
663 |
-
var original = next_row.clone();
|
664 |
-
original.add
|
665 |
-
next_row.html(next_row.next().html()).addClass('wpmdbpro-custom-visible');
|
666 |
-
next_row.next().remove();
|
667 |
-
next_row.after(original);
|
668 |
-
original.addClass('wpmdb-original-update-row');
|
669 |
-
}
|
670 |
-
})(jQuery);
|
671 |
-
</script>
|
672 |
-
<?php
|
673 |
-
}
|
674 |
-
}
|
675 |
-
|
676 |
function verify_download( $response, $args, $url ) {
|
677 |
if ( is_wp_error( $response ) ) {
|
678 |
return $response;
|
@@ -748,7 +824,8 @@ class WPMDB_Base {
|
|
748 |
|
749 |
if ( empty( $licence ) ) {
|
750 |
$settings_link = sprintf( '<a href="%s">%s</a>', network_admin_url( $this->plugin_base ) . '#settings', _x( 'Settings', 'Plugin configuration and preferences', 'wp-migrate-db' ) );
|
751 |
-
$message
|
|
|
752 |
return array( 'errors' => array( 'no_licence' => $message ) );
|
753 |
}
|
754 |
|
@@ -816,9 +893,9 @@ class WPMDB_Base {
|
|
816 |
// Return the latest beta version if the installed version is beta
|
817 |
// and the API returned a beta version and it's newer than the latest stable version
|
818 |
if ( $installed_version
|
819 |
-
|
820 |
-
|
821 |
-
|
822 |
) {
|
823 |
return $data[ $slug ]['beta_version'];
|
824 |
}
|
@@ -930,7 +1007,13 @@ class WPMDB_Base {
|
|
930 |
return get_object_vars( $this );
|
931 |
}
|
932 |
|
933 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
934 |
function get_tables( $scope = 'regular' ) {
|
935 |
global $wpdb;
|
936 |
$prefix = ( $scope == 'temp' ? $this->temp_prefix : $wpdb->prefix );
|
@@ -941,6 +1024,9 @@ class WPMDB_Base {
|
|
941 |
if ( ( ( $scope == 'temp' || $scope == 'prefix' ) && 0 !== strpos( $table[0], $prefix ) ) || $table[1] == 'VIEW' ) {
|
942 |
continue;
|
943 |
}
|
|
|
|
|
|
|
944 |
$clean_tables[] = $table[0];
|
945 |
}
|
946 |
|
@@ -972,7 +1058,7 @@ class WPMDB_Base {
|
|
972 |
<strong><?php _ex( 'Update Available', 'A new version of the plugin is available', 'wp-migrate-db' ); ?></strong> —
|
973 |
<?php printf( __( 'A new version of %1$s is now available. %2$s', 'wp-migrate-db' ), $this->plugin_title, sprintf( '<a href="%s">%s</a>', $update_url, _x( 'Update Now', 'Download and install a new version of the plugin', 'wp-migrate-db' ) ) ); ?>
|
974 |
</div>
|
975 |
-
|
976 |
} else {
|
977 |
$installed_version = $GLOBALS['wpmdb_meta'][ $this->plugin_slug ]['version'];
|
978 |
$latest_version = $this->get_latest_version( $this->plugin_slug );
|
@@ -980,9 +1066,9 @@ class WPMDB_Base {
|
|
980 |
if ( version_compare( $installed_version, $latest_version, '<' ) ) { ?>
|
981 |
<div style="display: block;" class="updated warning inline-message">
|
982 |
<strong><?php _ex( 'Update Available', 'A new version of the plugin is available', 'wp-migrate-db' ); ?></strong> —
|
983 |
-
|
984 |
</div>
|
985 |
-
|
986 |
}
|
987 |
}
|
988 |
}
|
@@ -1015,15 +1101,17 @@ class WPMDB_Base {
|
|
1015 |
* Returns a formatted message dependant on the status of the licence.
|
1016 |
*
|
1017 |
* @param bool $trans
|
|
|
1018 |
*
|
1019 |
-
* @return string|void
|
1020 |
*/
|
1021 |
-
function get_licence_status_message( $trans = false ) {
|
1022 |
$licence = $this->get_licence_key();
|
1023 |
$api_response_provided = true;
|
1024 |
|
1025 |
if ( empty( $licence ) && ! $trans ) {
|
1026 |
-
$message = sprintf( __( '<strong>Activate Your License</strong> — Please <a href="
|
|
|
1027 |
return $message;
|
1028 |
}
|
1029 |
|
@@ -1034,7 +1122,7 @@ class WPMDB_Base {
|
|
1034 |
$trans = $this->check_licence( $licence );
|
1035 |
}
|
1036 |
|
1037 |
-
$trans
|
1038 |
$api_response_provided = false;
|
1039 |
}
|
1040 |
|
@@ -1048,20 +1136,50 @@ class WPMDB_Base {
|
|
1048 |
|
1049 |
if ( isset( $errors['connection_failed'] ) ) {
|
1050 |
$disable_ssl_url = network_admin_url( $this->plugin_base . '&nonce=' . wp_create_nonce( 'wpmdb-disable-ssl' ) . '&wpmdb-disable-ssl=1' );
|
1051 |
-
$message
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1052 |
} elseif ( isset( $errors['subscription_cancelled'] ) ) {
|
1053 |
$message = sprintf( __( '<strong>Your License Was Cancelled</strong> — Please visit <a href="%s" target="_blank">My Account</a> to renew or upgrade your license and enable push and pull.', 'wp-migrate-db' ), 'https://deliciousbrains.com/my-account/' );
|
1054 |
-
$message .= sprintf( '<br /><a href="%s">%s</a>', $check_licence_again_url, __( 'Check my license again', 'wp-migrate-db' ) );
|
1055 |
} elseif ( isset( $errors['subscription_expired'] ) ) {
|
1056 |
-
|
1057 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1058 |
} elseif ( isset( $errors['no_activations_left'] ) ) {
|
1059 |
$message = sprintf( __( '<strong>No Activations Left</strong> — Please visit <a href="%s" target="_blank">My Account</a> to upgrade your license or deactivate a previous activation and enable push and pull.', 'wp-migrate-db' ), 'https://deliciousbrains.com/my-account/' );
|
1060 |
-
$message .= sprintf( ' <a href="%s">%s</a>', $check_licence_again_url, __( 'Check my license again', 'wp-migrate-db' ) );
|
1061 |
} elseif ( isset( $errors['licence_not_found'] ) ) {
|
1062 |
if ( ! $api_response_provided ) {
|
1063 |
$message = sprintf( __( '<strong>Your License Was Not Found</strong> — Perhaps you made a typo when defining your WPMDB_LICENCE constant in your wp-config.php? Please visit <a href="%s" target="_blank">My Account</a> to double check your license key.', 'wp-migrate-db' ), 'https://deliciousbrains.com/my-account/' );
|
1064 |
-
$message .= sprintf( ' <a href="%s">%s</a>', $check_licence_again_url, __( 'Check my license again', 'wp-migrate-db' ) );
|
1065 |
} else {
|
1066 |
$error = reset( $errors );
|
1067 |
$message = __( '<strong>Your License Was Not Found</strong> — ', 'wp-migrate-db' );
|
@@ -1071,7 +1189,7 @@ class WPMDB_Base {
|
|
1071 |
$message = sprintf( '<strong>%s</strong> — ', __( 'Your License Is Inactive', 'wp-migrate-db' ) );
|
1072 |
$message .= sprintf( '%s <a href="#" class="js-action-link reactivate-licence">%s</a>', __( 'Your license has been deactivated for this install.', 'wp-migrate-db' ), __( 'Reactivate License', 'wp-migrate-db' ) );
|
1073 |
} else {
|
1074 |
-
$error
|
1075 |
$message = sprintf( __( '<strong>An Unexpected Error Occurred</strong> — Please contact us at <a href="%1$s">%2$s</a> and quote the following:', 'wp-migrate-db' ), 'mailto:nom@deliciousbrains.com', 'nom@deliciousbrains.com' );
|
1076 |
$message .= sprintf( '<p>%s</p>', $error );
|
1077 |
}
|
@@ -1083,8 +1201,19 @@ class WPMDB_Base {
|
|
1083 |
$this->doing_cli_migration = true;
|
1084 |
}
|
1085 |
|
|
|
|
|
|
|
|
|
|
|
1086 |
function end_ajax( $return = false ) {
|
|
|
|
|
1087 |
if ( defined( 'DOING_WPMDB_TESTS' ) || $this->doing_cli_migration ) {
|
|
|
|
|
|
|
|
|
1088 |
return ( false === $return ) ? null : $return;
|
1089 |
}
|
1090 |
|
@@ -1243,13 +1372,34 @@ class WPMDB_Base {
|
|
1243 |
}
|
1244 |
|
1245 |
/**
|
1246 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1247 |
*
|
1248 |
* @param $url string The url to parse.
|
1249 |
*
|
1250 |
* @return array|false The parsed components or false on error.
|
1251 |
*/
|
1252 |
function parse_url( $url ) {
|
|
|
1253 |
if ( 0 === strpos( $url, '//' ) ) {
|
1254 |
$url = 'http:' . $url;
|
1255 |
$no_scheme = true;
|
@@ -1269,8 +1419,8 @@ class WPMDB_Base {
|
|
1269 |
* Standard notice display check
|
1270 |
* Returns dismiss and reminder links html for templates where necessary
|
1271 |
*
|
1272 |
-
* @param string
|
1273 |
-
* @param bool
|
1274 |
* @param bool|int $reminder If the notice has a reminder link, this will be the number of seconds
|
1275 |
*
|
1276 |
* @return array|bool
|
@@ -1306,7 +1456,7 @@ class WPMDB_Base {
|
|
1306 |
*/
|
1307 |
function maybe_schema_update() {
|
1308 |
$schema_version = get_site_option( 'wpmdb_schema_version' );
|
1309 |
-
$update_schema
|
1310 |
|
1311 |
/*
|
1312 |
* Upgrade this option to a network wide option if the site has been upgraded
|
@@ -1332,7 +1482,7 @@ class WPMDB_Base {
|
|
1332 |
add_option( 'wpmdb_error_log', $error_log, '', 'no' );
|
1333 |
}
|
1334 |
|
1335 |
-
$update_schema
|
1336 |
$schema_version = 1;
|
1337 |
}
|
1338 |
|
@@ -1351,4 +1501,174 @@ class WPMDB_Base {
|
|
1351 |
function slash_one_direction( $path ) {
|
1352 |
return str_replace( array( '/', '\\' ), DIRECTORY_SEPARATOR, $path );
|
1353 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1354 |
}
|
27 |
protected $is_addon = false;
|
28 |
protected $core_slug;
|
29 |
protected $error_log;
|
30 |
+
protected $state_data;
|
31 |
+
protected $migration_state;
|
32 |
|
33 |
function __construct( $plugin_file_path ) {
|
34 |
$this->load_settings();
|
65 |
}
|
66 |
|
67 |
/**
|
68 |
+
* Get the URL to wp-admin/admin-ajax.php for the intended WordPress site.
|
69 |
+
*
|
70 |
+
* The intended WordPress site URL is sent via Ajax, so to get a properly
|
71 |
+
* formatted URL to wp-admin/admin-ajax.php we can't count on the site
|
72 |
+
* URL being sent with a trailing slash.
|
73 |
+
*
|
74 |
+
* @return string URL to wp-admin/admin-ajax.php, e.g. http://example.com/wp-admin/admin-ajax.php
|
75 |
*/
|
76 |
+
function ajax_url() {
|
77 |
+
static $ajax_url;
|
78 |
+
|
79 |
+
if ( ! empty( $ajax_url ) ) {
|
80 |
+
return $ajax_url;
|
81 |
+
}
|
82 |
+
|
83 |
+
$ajax_url = trailingslashit( $this->state_data['url'] ) . 'wp-admin/admin-ajax.php';
|
84 |
+
|
85 |
+
return $ajax_url;
|
86 |
+
}
|
87 |
+
|
88 |
+
/**
|
89 |
+
* Sets $this->state_data from $_POST, potentially un-slashed and sanitized.
|
90 |
+
*
|
91 |
+
* @param array $key_rules An optional associative array of expected keys and their sanitization rule(s).
|
92 |
+
* @param string $context The method that is specifying the sanitization rules. Defaults to calling method.
|
93 |
+
*/
|
94 |
+
function set_post_data( $key_rules = array(), $context = '' ) {
|
95 |
if ( defined( 'DOING_WPMDB_TESTS' ) || $this->doing_cli_migration ) {
|
96 |
+
$this->state_data = $_POST;
|
97 |
+
} elseif ( is_null( $this->state_data ) ) {
|
98 |
+
$this->state_data = wp_unslash( $_POST );
|
99 |
+
} else {
|
100 |
+
return;
|
101 |
+
}
|
102 |
+
|
103 |
+
// Sanitize the new state data.
|
104 |
+
if ( ! empty( $key_rules ) ) {
|
105 |
+
$context = empty( $context ) ? $this->get_caller_function() : trim( $context );
|
106 |
+
$this->state_data = WPMDB_Sanitize::sanitize_data( $this->state_data, $key_rules, $context );
|
107 |
+
|
108 |
+
if ( false === $this->state_data ) {
|
109 |
+
exit;
|
110 |
+
}
|
111 |
+
}
|
112 |
+
|
113 |
+
$migration_state_id = null;
|
114 |
+
if ( ! empty( $this->state_data['migration_state_id'] ) ) {
|
115 |
+
$migration_state_id = $this->state_data['migration_state_id'];
|
116 |
+
}
|
117 |
+
|
118 |
+
if ( true !== $this->get_migration_state( $migration_state_id ) ) {
|
119 |
+
exit;
|
120 |
}
|
121 |
}
|
122 |
|
126 |
|
127 |
function pro_addon_construct() {
|
128 |
$this->addons = array(
|
129 |
+
'wp-migrate-db-pro-media-files/wp-migrate-db-pro-media-files.php' => array(
|
130 |
'name' => 'Media Files',
|
131 |
+
'required_version' => '1.3.2',
|
132 |
),
|
133 |
+
'wp-migrate-db-pro-cli/wp-migrate-db-pro-cli.php' => array(
|
134 |
'name' => 'CLI',
|
135 |
+
'required_version' => '1.2',
|
136 |
+
),
|
137 |
+
'wp-migrate-db-pro-multisite-tools/wp-migrate-db-pro-multisite-tools.php' => array(
|
138 |
+
'name' => 'Multisite Tools',
|
139 |
'required_version' => '1.0',
|
140 |
)
|
141 |
);
|
158 |
// allow developers to change the temporary prefix applied to the tables
|
159 |
$this->temp_prefix = apply_filters( 'wpmdb_temporary_prefix', $this->temp_prefix );
|
160 |
|
|
|
|
|
|
|
|
|
|
|
|
|
161 |
// Adds a custom error message to the plugin install page if required (licence expired / invalid)
|
162 |
add_filter( 'http_response', array( $this, 'verify_download' ), 10, 3 );
|
163 |
|
188 |
}
|
189 |
|
190 |
$default_settings = array(
|
191 |
+
'key' => $this->generate_key(),
|
192 |
+
'allow_pull' => false,
|
193 |
+
'allow_push' => false,
|
194 |
+
'profiles' => array(),
|
195 |
+
'licence' => '',
|
196 |
+
'verify_ssl' => false,
|
197 |
+
'blacklist_plugins' => array(),
|
198 |
+
'max_request' => min( 1024 * 1024, $this->get_bottleneck( 'max' ) ),
|
199 |
+
'delay_between_requests' => 0,
|
200 |
);
|
201 |
|
202 |
// if we still don't have settings exist this must be a fresh install, set up some default settings
|
266 |
}
|
267 |
}
|
268 |
|
269 |
+
/**
|
270 |
+
* Post data to a remote site with WP Migrate DB Pro and check the response.
|
271 |
+
*
|
272 |
+
* @param string $url The URL to post to.
|
273 |
+
* @param array $data The associative array of data to be posted to the remote.
|
274 |
+
* @param string $scope A string to be used in error messages defining the function that initiated the remote post.
|
275 |
+
* @param array $args An optional array of args to alter the timeout, blocking and sslverify options.
|
276 |
+
* @param bool $expecting_serial Verify that the response is a serialized string (defaults to false).
|
277 |
+
*
|
278 |
+
* @return bool|string
|
279 |
+
*/
|
280 |
function remote_post( $url, $data, $scope, $args = array(), $expecting_serial = false ) {
|
281 |
$this->set_time_limit();
|
282 |
$this->set_post_data();
|
283 |
|
284 |
+
if ( function_exists( 'fsockopen' ) && 0 === strpos( $url, 'https://' ) && 'ajax_verify_connection_to_remote_site' == $scope ) {
|
285 |
$url_parts = $this->parse_url( $url );
|
286 |
$host = $url_parts['host'];
|
287 |
if ( $pf = @fsockopen( $host, 443, $err, $err_string, 1 ) ) {
|
293 |
}
|
294 |
}
|
295 |
|
296 |
+
$sslverify = ( 1 == $this->settings['verify_ssl'] ? true : false );
|
297 |
|
298 |
$default_remote_post_timeout = apply_filters( 'wpmdb_default_remote_post_timeout', 60 * 20 );
|
299 |
|
315 |
|
316 |
$this->attempting_to_connect_to = $url;
|
317 |
|
318 |
+
do_action( 'wpmdb_before_remote_post' );
|
319 |
+
|
320 |
$response = wp_remote_post( $url, $args );
|
321 |
|
322 |
if ( ! is_wp_error( $response ) ) {
|
323 |
+
// Every response should be scrambled, but other processes may have been applied too so we use a filter.
|
324 |
+
add_filter( 'wpmdb_after_response', array( $this, 'unscramble' ) );
|
325 |
+
$response['body'] = apply_filters( 'wpmdb_after_response', trim( $response['body'], "\xef\xbb\xbf" ) );
|
326 |
+
remove_filter( 'wpmdb_after_response', array( $this, 'unscramble' ) );
|
327 |
}
|
328 |
|
329 |
if ( is_wp_error( $response ) ) {
|
330 |
+
if ( 0 === strpos( $url, 'https://' ) && 'ajax_verify_connection_to_remote_site' == $scope ) {
|
331 |
return $this->retry_remote_post( $url, $data, $scope, $args, $expecting_serial );
|
332 |
} elseif ( isset( $response->errors['http_request_failed'][0] ) && strstr( $response->errors['http_request_failed'][0], 'timed out' ) ) {
|
333 |
$this->error = sprintf( __( 'The connection to the remote server has timed out, no changes have been committed. (#134 - scope: %s)', 'wp-migrate-db' ), $scope );
|
334 |
} 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" ) ) ) {
|
335 |
+
$this->error = sprintf( __( 'We could not find: %s. Are you sure this is the correct URL?', 'wp-migrate-db' ), $this->state_data['url'] );
|
336 |
+
$url_bits = $this->parse_url( $this->state_data['url'] );
|
337 |
+
if ( strstr( $this->state_data['url'], 'dev.' ) || strstr( $this->state_data['url'], '.dev' ) || ! strstr( $url_bits['host'], '.' ) ) {
|
338 |
$this->error .= '<br />';
|
339 |
+
if ( 'pull' == $this->state_data['intent'] ) {
|
340 |
$this->error .= __( 'It appears that you might be trying to pull from a local environment. This will not work if <u>this</u> website happens to be located on a remote server, it would be impossible for this server to contact your local environment.', 'wp-migrate-db' );
|
341 |
} else {
|
342 |
$this->error .= __( 'It appears that you might be trying to push to a local environment. This will not work if <u>this</u> website happens to be located on a remote server, it would be impossible for this server to contact your local environment.', 'wp-migrate-db' );
|
343 |
}
|
344 |
}
|
345 |
} else {
|
346 |
+
if ( defined( 'WP_HTTP_BLOCK_EXTERNAL' ) && WP_HTTP_BLOCK_EXTERNAL ) {
|
347 |
+
$url_parts = $this->parse_url( $url );
|
348 |
+
$host = $url_parts['host'];
|
349 |
+
if ( ! defined( 'WP_ACCESSIBLE_HOSTS' ) || strpos( WP_ACCESSIBLE_HOSTS, $host ) === false ) {
|
350 |
+
$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 );
|
351 |
+
}
|
352 |
+
} else {
|
353 |
+
$this->error = sprintf( __( 'The connection failed, an unexpected error occurred, please contact support. (#121 - scope: %s)', 'wp-migrate-db' ), $scope );
|
354 |
+
}
|
355 |
}
|
356 |
$this->log_error( $this->error, $response );
|
357 |
|
358 |
return false;
|
359 |
+
} elseif ( 200 > (int) $response['response']['code'] || 399 < (int) $response['response']['code'] ) {
|
360 |
+
if ( 0 === strpos( $url, 'https://' ) && 'ajax_verify_connection_to_remote_site' == $scope ) {
|
361 |
return $this->retry_remote_post( $url, $data, $scope, $args, $expecting_serial );
|
362 |
+
} elseif ( '401' == $response['response']['code'] ) {
|
363 |
$this->error = __( 'The remote site is protected with Basic Authentication. Please enter the username and password above to continue. (401 Unauthorized)', 'wp-migrate-db' );
|
364 |
$this->log_error( $this->error, $response );
|
365 |
|
370 |
|
371 |
return false;
|
372 |
}
|
373 |
+
} elseif ( '0' === $response['body'] ) {
|
374 |
+
if ( 0 === strpos( $url, 'https://' ) && 'ajax_verify_connection_to_remote_site' == $scope ) {
|
375 |
return $this->retry_remote_post( $url, $data, $scope, $args, $expecting_serial );
|
376 |
}
|
377 |
+
$this->error = sprintf( __( 'WP Migrate DB Pro does not seem to be installed or active on the remote site. (#131 - scope: %s)', 'wp-migrate-db' ), $scope );
|
378 |
+
$this->log_error( $this->error, $response );
|
379 |
+
|
380 |
+
return false;
|
381 |
+
} elseif ( empty( $response['body'] ) ) {
|
382 |
+
$this->error = sprintf( __( 'A response was expected from the remote, instead we got nothing. (#146 - scope: %1$s) Please review %2$s for possible solutions.', 'wp-migrate-db' ), $scope, sprintf( '<a href="https://deliciousbrains.com/wp-migrate-db-pro/doc/a-response-was-expected-from-the-remote/" target="_blank">%1$s</a>', __( 'our documentation', 'wp-migrate-db' ) ) );
|
383 |
$this->log_error( $this->error, $response );
|
384 |
|
385 |
return false;
|
386 |
+
} elseif ( $expecting_serial && false == is_serialized( $response['body'] ) ) {
|
387 |
+
if ( 0 === strpos( $url, 'https://' ) && 'ajax_verify_connection_to_remote_site' == $scope ) {
|
388 |
return $this->retry_remote_post( $url, $data, $scope, $args, $expecting_serial );
|
389 |
}
|
390 |
+
$this->error = __( 'There was a problem with the AJAX request, we were expecting a serialized response, instead we received:<br />', 'wp-migrate-db' ) . esc_html( $response['body'] );
|
391 |
$this->log_error( $this->error, $response );
|
392 |
|
393 |
return false;
|
394 |
+
} elseif ( $expecting_serial && true == is_serialized( $response['body'] ) && 'ajax_verify_connection_to_remote_site' == $scope ) {
|
395 |
$unserialized_response = unserialize( $response['body'] );
|
396 |
+
if ( isset( $unserialized_response['error'] ) && '1' == $unserialized_response['error'] && 0 === strpos( $url, 'https://' ) ) {
|
397 |
return $this->retry_remote_post( $url, $data, $scope, $args, $expecting_serial );
|
398 |
}
|
399 |
}
|
543 |
return $url;
|
544 |
}
|
545 |
|
546 |
+
/**
|
547 |
+
* Determines, sets up, and returns folder information for storying files.
|
548 |
+
*
|
549 |
+
* By default, the folder created will be `wp-migrate-db` and will be stored
|
550 |
+
* inside of the `uploads` folder in WordPress' current `WP_CONTENT_DIR`,
|
551 |
+
* usually `wp-content/uploads`
|
552 |
+
*
|
553 |
+
* To change the folder name of `wp-migrate-db` to something else, you can use
|
554 |
+
* the `wpmdb_upload_dir_name` filter to change it. e.g.:
|
555 |
+
*
|
556 |
+
* function upload_dir_name() {
|
557 |
+
* return 'database-dumps';
|
558 |
+
* }
|
559 |
+
*
|
560 |
+
* add_filter( 'wpmdb_upload_dir_name', 'upload_dir_name' );
|
561 |
+
*
|
562 |
+
* If `WP_CONTENT_DIR` was set to `wp-content` in this example,
|
563 |
+
* this would change the folder to `wp-content/uploads/database-dumps`.
|
564 |
+
*
|
565 |
+
* To change the entire path, for example to store these files outside of
|
566 |
+
* WordPress' `WP_CONTENT_DIR`, use the `wpmdb_upload_info` filter to do so. e.g.:
|
567 |
+
*
|
568 |
+
* function upload_info() {
|
569 |
+
* // The returned data needs to be in a very specific format, see below for example
|
570 |
+
* return array(
|
571 |
+
* 'path' => '/path/to/custom/uploads/directory', // note missing end trailing slash
|
572 |
+
* 'url' => 'http://yourwebsite.com/custom/uploads/directory' // note missing end trailing slash
|
573 |
+
* );
|
574 |
+
* }
|
575 |
+
*
|
576 |
+
* add_filter( 'wpmdb_upload_info', 'upload_info' );
|
577 |
+
*
|
578 |
+
* This would store files in `/path/to/custom/uploads/directory` with a
|
579 |
+
* URL to access files via `http://yourwebsite.com/custom/uploads/directory`
|
580 |
+
*
|
581 |
+
* @link https://github.com/deliciousbrains/wp-migrate-db-pro-tweaks
|
582 |
+
*
|
583 |
+
* @param string $type Either `path` or `url`.
|
584 |
+
*
|
585 |
+
* @return string The Path or the URL to the folder being used.
|
586 |
+
*/
|
587 |
+
function get_upload_info( $type = 'path' ) {
|
588 |
+
$upload_info = apply_filters( 'wpmdb_upload_info', array() );
|
589 |
+
|
590 |
+
// No need to create the directory structure since it should already exist.
|
591 |
+
if ( ! empty( $upload_info ) ) {
|
592 |
+
return $upload_info[ $type ];
|
593 |
+
}
|
594 |
+
|
595 |
+
$upload_dir = wp_upload_dir();
|
596 |
+
|
597 |
+
$upload_info['path'] = $upload_dir['basedir'];
|
598 |
+
$upload_info['url'] = $upload_dir['baseurl'];
|
599 |
+
|
600 |
+
$upload_dir_name = apply_filters( 'wpmdb_upload_dir_name', 'wp-migrate-db' );
|
601 |
+
|
602 |
+
if ( ! file_exists( $upload_dir['basedir'] . DIRECTORY_SEPARATOR . $upload_dir_name ) ) {
|
603 |
+
$url = wp_nonce_url( $this->plugin_base, 'wp-migrate-db-pro-nonce' );
|
604 |
+
|
605 |
+
// Create the directory.
|
606 |
+
// TODO: Do not silence errors, use wp_mkdir_p?
|
607 |
+
if ( false === @mkdir( $upload_dir['basedir'] . DIRECTORY_SEPARATOR . $upload_dir_name, 0755 ) ) {
|
608 |
+
return $upload_info[ $type ];
|
609 |
+
}
|
610 |
+
|
611 |
+
// Protect from directory listings by making sure an index file exists.
|
612 |
+
$filename = $upload_dir['basedir'] . DIRECTORY_SEPARATOR . $upload_dir_name . DIRECTORY_SEPARATOR . 'index.php';
|
613 |
+
// TODO: Do not silence errors, use WP_Filesystem API?
|
614 |
+
if ( false === @file_put_contents( $filename, "<?php\r\n// Silence is golden\r\n?>" ) ) {
|
615 |
+
return $upload_info[ $type ];
|
616 |
+
}
|
617 |
+
}
|
618 |
+
|
619 |
+
// Protect from directory listings by ensuring this folder does not allow Indexes if using Apache.
|
620 |
+
$htaccess = $upload_dir['basedir'] . DIRECTORY_SEPARATOR . $upload_dir_name . DIRECTORY_SEPARATOR . '.htaccess';
|
621 |
+
if ( ! file_exists( $htaccess ) ) {
|
622 |
+
// TODO: Do not silence errors, use WP_Filesystem API?
|
623 |
+
if ( false === @file_put_contents( $htaccess, "Options -Indexes\r\nDeny from all" ) ) {
|
624 |
+
return $upload_info[ $type ];
|
625 |
+
}
|
626 |
+
}
|
627 |
+
|
628 |
+
$upload_info['path'] .= DIRECTORY_SEPARATOR . $upload_dir_name;
|
629 |
+
$upload_info['url'] .= '/' . $upload_dir_name;
|
630 |
+
|
631 |
+
return $upload_info[ $type ];
|
632 |
+
}
|
633 |
+
|
634 |
/**
|
635 |
* Main function for communicating with the Delicious Brains API.
|
636 |
*
|
675 |
|
676 |
$disable_ssl_url = network_admin_url( $this->plugin_base . '&nonce=' . wp_create_nonce( 'wpmdb-disable-ssl' ) . '&wpmdb-disable-ssl=1' );
|
677 |
$connection_failed_message = '<div class="updated warning inline-message">';
|
678 |
+
$connection_failed_message .= sprintf( __( '<strong>Could not connect to deliciousbrains.com</strong> — 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' ) ) );
|
679 |
$connection_failed_message .= '</div>';
|
680 |
|
681 |
+
if ( defined( 'WP_HTTP_BLOCK_EXTERNAL' ) && WP_HTTP_BLOCK_EXTERNAL ) {
|
682 |
+
$url_parts = $this->parse_url( $url );
|
683 |
+
$host = $url_parts['host'];
|
684 |
+
if ( ! defined( 'WP_ACCESSIBLE_HOSTS' ) || strpos( WP_ACCESSIBLE_HOSTS, $host ) === false ) {
|
685 |
+
$connection_failed_message = '<div class="updated warning inline-message">';
|
686 |
+
$connection_failed_message .= 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>.', 'wp-migrate-db' ), esc_attr( $host ), 'https://deliciousbrains.com/wp-migrate-db-pro/doc/wp_http_block_external/' );
|
687 |
+
$connection_failed_message .= '</div>';
|
688 |
+
}
|
689 |
+
}
|
690 |
+
|
691 |
+
// Don't cache the license response so we can try again
|
692 |
+
delete_site_transient( 'wpmdb_licence_response' );
|
693 |
+
|
694 |
return json_encode( array( 'errors' => array( 'connection_failed' => $connection_failed_message ) ) );
|
695 |
}
|
696 |
|
749 |
return true;
|
750 |
}
|
751 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
752 |
function verify_download( $response, $args, $url ) {
|
753 |
if ( is_wp_error( $response ) ) {
|
754 |
return $response;
|
824 |
|
825 |
if ( empty( $licence ) ) {
|
826 |
$settings_link = sprintf( '<a href="%s">%s</a>', network_admin_url( $this->plugin_base ) . '#settings', _x( 'Settings', 'Plugin configuration and preferences', 'wp-migrate-db' ) );
|
827 |
+
$message = sprintf( __( 'To finish activating WP Migrate DB Pro, please go to %1$s and enter your license key. If you don\'t have a license key, you may <a href="%2$s">purchase one</a>.', 'wp-migrate-db' ), $settings_link, 'http://deliciousbrains.com/wp-migrate-db-pro/pricing/' );
|
828 |
+
|
829 |
return array( 'errors' => array( 'no_licence' => $message ) );
|
830 |
}
|
831 |
|
893 |
// Return the latest beta version if the installed version is beta
|
894 |
// and the API returned a beta version and it's newer than the latest stable version
|
895 |
if ( $installed_version
|
896 |
+
&& ( $this->is_beta_version( $installed_version ) || $this->is_beta_version( $required_version ) )
|
897 |
+
&& isset( $data[ $slug ]['beta_version'] )
|
898 |
+
&& version_compare( $data[ $slug ]['version'], $data[ $slug ]['beta_version'], '<' )
|
899 |
) {
|
900 |
return $data[ $slug ]['beta_version'];
|
901 |
}
|
1007 |
return get_object_vars( $this );
|
1008 |
}
|
1009 |
|
1010 |
+
/**
|
1011 |
+
* Get only the tables beginning with our DB prefix or temporary prefix, also skip views and legacy wpmdb_alter_statements table.
|
1012 |
+
*
|
1013 |
+
* @param string $scope
|
1014 |
+
*
|
1015 |
+
* @return array
|
1016 |
+
*/
|
1017 |
function get_tables( $scope = 'regular' ) {
|
1018 |
global $wpdb;
|
1019 |
$prefix = ( $scope == 'temp' ? $this->temp_prefix : $wpdb->prefix );
|
1024 |
if ( ( ( $scope == 'temp' || $scope == 'prefix' ) && 0 !== strpos( $table[0], $prefix ) ) || $table[1] == 'VIEW' ) {
|
1025 |
continue;
|
1026 |
}
|
1027 |
+
if ( $this->get_legacy_alter_table_name() == $table[0] ) {
|
1028 |
+
continue;
|
1029 |
+
}
|
1030 |
$clean_tables[] = $table[0];
|
1031 |
}
|
1032 |
|
1058 |
<strong><?php _ex( 'Update Available', 'A new version of the plugin is available', 'wp-migrate-db' ); ?></strong> —
|
1059 |
<?php printf( __( 'A new version of %1$s is now available. %2$s', 'wp-migrate-db' ), $this->plugin_title, sprintf( '<a href="%s">%s</a>', $update_url, _x( 'Update Now', 'Download and install a new version of the plugin', 'wp-migrate-db' ) ) ); ?>
|
1060 |
</div>
|
1061 |
+
<?php
|
1062 |
} else {
|
1063 |
$installed_version = $GLOBALS['wpmdb_meta'][ $this->plugin_slug ]['version'];
|
1064 |
$latest_version = $this->get_latest_version( $this->plugin_slug );
|
1066 |
if ( version_compare( $installed_version, $latest_version, '<' ) ) { ?>
|
1067 |
<div style="display: block;" class="updated warning inline-message">
|
1068 |
<strong><?php _ex( 'Update Available', 'A new version of the plugin is available', 'wp-migrate-db' ); ?></strong> —
|
1069 |
+
<?php printf( __( '%1$s %2$s is now available. You currently have %3$s installed. <a href="%4$s">%5$s</a>', 'wp-migrate-db' ), $this->plugin_title, $latest_version, $installed_version, $update_url, _x( 'Update Now', 'Download and install a new version of the plugin', 'wp-migrate-db' ) ); ?>
|
1070 |
</div>
|
1071 |
+
<?php
|
1072 |
}
|
1073 |
}
|
1074 |
}
|
1101 |
* Returns a formatted message dependant on the status of the licence.
|
1102 |
*
|
1103 |
* @param bool $trans
|
1104 |
+
* @param string $context
|
1105 |
*
|
1106 |
+
* @return array|string|void
|
1107 |
*/
|
1108 |
+
function get_licence_status_message( $trans = false, $context = null ) {
|
1109 |
$licence = $this->get_licence_key();
|
1110 |
$api_response_provided = true;
|
1111 |
|
1112 |
if ( empty( $licence ) && ! $trans ) {
|
1113 |
+
$message = sprintf( __( '<strong>Activate Your License</strong> — Please <a href="%s" class="%s">enter your license key</a> to enable push and pull functionality, priority support and plugin updates.', 'wp-migrate-db' ), network_admin_url( $this->plugin_base . '#settings' ), 'js-action-link enter-licence' );
|
1114 |
+
|
1115 |
return $message;
|
1116 |
}
|
1117 |
|
1122 |
$trans = $this->check_licence( $licence );
|
1123 |
}
|
1124 |
|
1125 |
+
$trans = json_decode( $trans, true );
|
1126 |
$api_response_provided = false;
|
1127 |
}
|
1128 |
|
1136 |
|
1137 |
if ( isset( $errors['connection_failed'] ) ) {
|
1138 |
$disable_ssl_url = network_admin_url( $this->plugin_base . '&nonce=' . wp_create_nonce( 'wpmdb-disable-ssl' ) . '&wpmdb-disable-ssl=1' );
|
1139 |
+
$message = sprintf( __( '<strong>Could not connect to deliciousbrains.com</strong> — 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' ) ) );
|
1140 |
+
|
1141 |
+
if ( defined( 'WP_HTTP_BLOCK_EXTERNAL' ) && WP_HTTP_BLOCK_EXTERNAL ) {
|
1142 |
+
$url_parts = $this->parse_url( $this->dbrains_api_base );
|
1143 |
+
$host = $url_parts['host'];
|
1144 |
+
if ( ! defined( 'WP_ACCESSIBLE_HOSTS' ) || strpos( WP_ACCESSIBLE_HOSTS, $host ) === false ) {
|
1145 |
+
$message = 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>.', 'wp-migrate-db' ), esc_attr( $host ), 'https://deliciousbrains.com/wp-migrate-db-pro/doc/wp_http_block_external/' );
|
1146 |
+
}
|
1147 |
+
}
|
1148 |
+
|
1149 |
+
// Don't cache the license response so we can try again
|
1150 |
+
delete_site_transient( 'wpmdb_licence_response' );
|
1151 |
} elseif ( isset( $errors['subscription_cancelled'] ) ) {
|
1152 |
$message = sprintf( __( '<strong>Your License Was Cancelled</strong> — Please visit <a href="%s" target="_blank">My Account</a> to renew or upgrade your license and enable push and pull.', 'wp-migrate-db' ), 'https://deliciousbrains.com/my-account/' );
|
1153 |
+
$message .= sprintf( '<br /><a href="%s" class="check-my-licence-again" >%s</a>', $check_licence_again_url, __( 'Check my license again', 'wp-migrate-db' ) );
|
1154 |
} elseif ( isset( $errors['subscription_expired'] ) ) {
|
1155 |
+
|
1156 |
+
$message_base = sprintf( '<strong>%s</strong> — ', __( 'Your License Has Expired', 'wp-migrate-db' ) );
|
1157 |
+
$message_end = sprintf( __( 'Login to <a href="%s">My Account</a> to renew. ', 'wp-migrate-db' ), 'https://deliciousbrains.com/my-account/' );
|
1158 |
+
$message_end .= sprintf( ' <a href="%s" class="check-my-licence-again">%s</a>', $check_licence_again_url, __( 'Check my license again', 'wp-migrate-db' ) );
|
1159 |
+
|
1160 |
+
$contextual_messages = array(
|
1161 |
+
'default' => $message_base . $message_end,
|
1162 |
+
'update' => $message_base . __( 'Updates are only available to those with an active license. ', 'wp-migrate-db' ) . $message_end,
|
1163 |
+
'addons' => $message_base . __( 'Only active licenses can download and install addons. ', 'wp-migrate-db' ) . $message_end,
|
1164 |
+
'support' => $message_base . __( 'Only active licenses can submit support requests. ', 'wp-migrate-db' ) . $message_end,
|
1165 |
+
'licence' => $message_base . __( "All features will continue to work, but you won't be able to receive updates or email support. ", 'wp-migrate-db' ) . $message_end,
|
1166 |
+
);
|
1167 |
+
|
1168 |
+
if ( empty( $context ) ) {
|
1169 |
+
$context = 'default';
|
1170 |
+
}
|
1171 |
+
if ( ! empty( $contextual_messages[ $context ] ) ) {
|
1172 |
+
$message = $contextual_messages[ $context ];
|
1173 |
+
} elseif ( 'all' === $context ) {
|
1174 |
+
$message = $contextual_messages;
|
1175 |
+
}
|
1176 |
} elseif ( isset( $errors['no_activations_left'] ) ) {
|
1177 |
$message = sprintf( __( '<strong>No Activations Left</strong> — Please visit <a href="%s" target="_blank">My Account</a> to upgrade your license or deactivate a previous activation and enable push and pull.', 'wp-migrate-db' ), 'https://deliciousbrains.com/my-account/' );
|
1178 |
+
$message .= sprintf( ' <a href="%s" class="check-my-licence-again">%s</a>', $check_licence_again_url, __( 'Check my license again', 'wp-migrate-db' ) );
|
1179 |
} elseif ( isset( $errors['licence_not_found'] ) ) {
|
1180 |
if ( ! $api_response_provided ) {
|
1181 |
$message = sprintf( __( '<strong>Your License Was Not Found</strong> — Perhaps you made a typo when defining your WPMDB_LICENCE constant in your wp-config.php? Please visit <a href="%s" target="_blank">My Account</a> to double check your license key.', 'wp-migrate-db' ), 'https://deliciousbrains.com/my-account/' );
|
1182 |
+
$message .= sprintf( ' <a href="%s" class="check-my-licence-again">%s</a>', $check_licence_again_url, __( 'Check my license again', 'wp-migrate-db' ) );
|
1183 |
} else {
|
1184 |
$error = reset( $errors );
|
1185 |
$message = __( '<strong>Your License Was Not Found</strong> — ', 'wp-migrate-db' );
|
1189 |
$message = sprintf( '<strong>%s</strong> — ', __( 'Your License Is Inactive', 'wp-migrate-db' ) );
|
1190 |
$message .= sprintf( '%s <a href="#" class="js-action-link reactivate-licence">%s</a>', __( 'Your license has been deactivated for this install.', 'wp-migrate-db' ), __( 'Reactivate License', 'wp-migrate-db' ) );
|
1191 |
} else {
|
1192 |
+
$error = reset( $errors );
|
1193 |
$message = sprintf( __( '<strong>An Unexpected Error Occurred</strong> — Please contact us at <a href="%1$s">%2$s</a> and quote the following:', 'wp-migrate-db' ), 'mailto:nom@deliciousbrains.com', 'nom@deliciousbrains.com' );
|
1194 |
$message .= sprintf( '<p>%s</p>', $error );
|
1195 |
}
|
1201 |
$this->doing_cli_migration = true;
|
1202 |
}
|
1203 |
|
1204 |
+
/**
|
1205 |
+
* @param mixed $return Value to be returned as response.
|
1206 |
+
*
|
1207 |
+
* @return null
|
1208 |
+
*/
|
1209 |
function end_ajax( $return = false ) {
|
1210 |
+
$return = apply_filters( 'wpmdb_before_response', $return );
|
1211 |
+
|
1212 |
if ( defined( 'DOING_WPMDB_TESTS' ) || $this->doing_cli_migration ) {
|
1213 |
+
// This function should signal the end of the PHP process, but for CLI it carries on so we need to reset our own usage
|
1214 |
+
// of the wpmdb_before_response filter before another respond_to_* function adds it again.
|
1215 |
+
remove_filter( 'wpmdb_before_response', array( $this, 'scramble' ) );
|
1216 |
+
|
1217 |
return ( false === $return ) ? null : $return;
|
1218 |
}
|
1219 |
|
1372 |
}
|
1373 |
|
1374 |
/**
|
1375 |
+
* Get a simplified base url without scheme.
|
1376 |
+
*
|
1377 |
+
* @param string $url
|
1378 |
+
*
|
1379 |
+
* @return string
|
1380 |
+
*/
|
1381 |
+
function scheme_less_url( $url ) {
|
1382 |
+
$url_parts = $this->parse_url( $url );
|
1383 |
+
|
1384 |
+
if ( false !== $url_parts ) {
|
1385 |
+
$reduced_url_parts = array_intersect_key( $url_parts, array_flip( array( 'host', 'port', 'path', 'user', 'pass' ) ) );
|
1386 |
+
if ( ! empty( $reduced_url_parts ) ) {
|
1387 |
+
$url = $this->unparse_url( $reduced_url_parts );
|
1388 |
+
}
|
1389 |
+
}
|
1390 |
+
|
1391 |
+
return $url;
|
1392 |
+
}
|
1393 |
+
|
1394 |
+
/**
|
1395 |
+
* Parses a url into its components. Compatible with PHP < 5.4.7.
|
1396 |
*
|
1397 |
* @param $url string The url to parse.
|
1398 |
*
|
1399 |
* @return array|false The parsed components or false on error.
|
1400 |
*/
|
1401 |
function parse_url( $url ) {
|
1402 |
+
$url = trim( $url );
|
1403 |
if ( 0 === strpos( $url, '//' ) ) {
|
1404 |
$url = 'http:' . $url;
|
1405 |
$no_scheme = true;
|
1419 |
* Standard notice display check
|
1420 |
* Returns dismiss and reminder links html for templates where necessary
|
1421 |
*
|
1422 |
+
* @param string $notice The name of the notice e.g. license-key-warning
|
1423 |
+
* @param bool $dismiss If the notice has a dismiss link
|
1424 |
* @param bool|int $reminder If the notice has a reminder link, this will be the number of seconds
|
1425 |
*
|
1426 |
* @return array|bool
|
1456 |
*/
|
1457 |
function maybe_schema_update() {
|
1458 |
$schema_version = get_site_option( 'wpmdb_schema_version' );
|
1459 |
+
$update_schema = false;
|
1460 |
|
1461 |
/*
|
1462 |
* Upgrade this option to a network wide option if the site has been upgraded
|
1482 |
add_option( 'wpmdb_error_log', $error_log, '', 'no' );
|
1483 |
}
|
1484 |
|
1485 |
+
$update_schema = true;
|
1486 |
$schema_version = 1;
|
1487 |
}
|
1488 |
|
1501 |
function slash_one_direction( $path ) {
|
1502 |
return str_replace( array( '/', '\\' ), DIRECTORY_SEPARATOR, $path );
|
1503 |
}
|
1504 |
+
|
1505 |
+
/**
|
1506 |
+
* Returns the table name where the alter statements are held during the migration.
|
1507 |
+
*
|
1508 |
+
* @return string
|
1509 |
+
*/
|
1510 |
+
function get_alter_table_name() {
|
1511 |
+
static $alter_table_name;
|
1512 |
+
|
1513 |
+
if ( ! empty( $alter_table_name ) ) {
|
1514 |
+
return $alter_table_name;
|
1515 |
+
}
|
1516 |
+
|
1517 |
+
$alter_table_name = apply_filters( 'wpmdb_alter_table_name', $this->temp_prefix . 'wpmdb_alter_statements' );
|
1518 |
+
|
1519 |
+
return $alter_table_name;
|
1520 |
+
}
|
1521 |
+
|
1522 |
+
/**
|
1523 |
+
* Returns the table name where the alter statements are held during the migration (old "wp_" prefixed style).
|
1524 |
+
*
|
1525 |
+
* @return string
|
1526 |
+
*/
|
1527 |
+
function get_legacy_alter_table_name() {
|
1528 |
+
static $alter_table_name;
|
1529 |
+
|
1530 |
+
if ( ! empty( $alter_table_name ) ) {
|
1531 |
+
return $alter_table_name;
|
1532 |
+
}
|
1533 |
+
|
1534 |
+
global $wpdb;
|
1535 |
+
$alter_table_name = apply_filters( 'wpmdb_alter_table_name', $wpdb->prefix . 'wpmdb_alter_statements' );
|
1536 |
+
|
1537 |
+
return $alter_table_name;
|
1538 |
+
}
|
1539 |
+
|
1540 |
+
/**
|
1541 |
+
* Save the migration state, and replace the current item to be returned if there is an error.
|
1542 |
+
*
|
1543 |
+
* @param $state mixed
|
1544 |
+
* @param $default mixed The default value to return on success, optional defaults to null.
|
1545 |
+
*
|
1546 |
+
* @return mixed
|
1547 |
+
*/
|
1548 |
+
function save_migration_state( $state, $default = null ) {
|
1549 |
+
if ( ! $this->migration_state->set( $state ) ) {
|
1550 |
+
$error_msg = __( 'Failed to save migration state. Please contact support.', 'wp-migrate-db' );
|
1551 |
+
$default = array( 'wpmdb_error' => 1, 'body' => $error_msg );
|
1552 |
+
$this->log_error( $error_msg );
|
1553 |
+
}
|
1554 |
+
|
1555 |
+
return $default;
|
1556 |
+
}
|
1557 |
+
|
1558 |
+
/**
|
1559 |
+
* Restore previous migration state and merge in new information or initialize new migration state.
|
1560 |
+
*
|
1561 |
+
* @param null $id
|
1562 |
+
*
|
1563 |
+
* @return array|bool|mixed|void
|
1564 |
+
*/
|
1565 |
+
function get_migration_state( $id = null ) {
|
1566 |
+
$return = true;
|
1567 |
+
|
1568 |
+
if ( ! empty( $id ) ) {
|
1569 |
+
$this->migration_state = new WPMDB_Migration_State( $id );
|
1570 |
+
$state = $this->migration_state->get();
|
1571 |
+
|
1572 |
+
if ( empty( $state ) || $this->migration_state->id() !== $id ) {
|
1573 |
+
$error_msg = __( 'Failed to retrieve migration state. Please contact support.', 'wp-migrate-db' );
|
1574 |
+
$return = array( 'wpmdb_error' => 1, 'body' => $error_msg );
|
1575 |
+
$this->log_error( $error_msg );
|
1576 |
+
$return = $this->end_ajax( json_encode( $return ) );
|
1577 |
+
} else {
|
1578 |
+
$this->state_data = array_merge( $state, $this->state_data );
|
1579 |
+
|
1580 |
+
$return = $this->save_migration_state( $this->state_data, $return );
|
1581 |
+
|
1582 |
+
if ( ! empty( $return['wpmdb_error'] ) ) {
|
1583 |
+
$return = $this->end_ajax( json_encode( $return ) );
|
1584 |
+
}
|
1585 |
+
}
|
1586 |
+
} else {
|
1587 |
+
$this->migration_state = new WPMDB_Migration_State();
|
1588 |
+
}
|
1589 |
+
|
1590 |
+
return $return;
|
1591 |
+
}
|
1592 |
+
|
1593 |
+
/**
|
1594 |
+
* Returns the absolute path to the root of the website.
|
1595 |
+
*
|
1596 |
+
* @return string
|
1597 |
+
*/
|
1598 |
+
function get_absolute_root_file_path() {
|
1599 |
+
static $absolute_path;
|
1600 |
+
|
1601 |
+
if ( ! empty( $absolute_path ) ) {
|
1602 |
+
return $absolute_path;
|
1603 |
+
}
|
1604 |
+
|
1605 |
+
$absolute_path = rtrim( ABSPATH, '\\/' );
|
1606 |
+
$site_url = rtrim( site_url( '', 'http' ), '\\/' );
|
1607 |
+
$home_url = rtrim( home_url( '', 'http' ), '\\/' );
|
1608 |
+
|
1609 |
+
if ( $site_url != $home_url ) {
|
1610 |
+
$difference = str_replace( $home_url, '', $site_url );
|
1611 |
+
if ( strpos( $absolute_path, $difference ) !== false ) {
|
1612 |
+
$absolute_path = rtrim( substr( $absolute_path, 0, - strlen( $difference ) ), '\\/' );
|
1613 |
+
}
|
1614 |
+
}
|
1615 |
+
|
1616 |
+
return $absolute_path;
|
1617 |
+
}
|
1618 |
+
|
1619 |
+
/**
|
1620 |
+
* Returns the function name that called the function using this function.
|
1621 |
+
*
|
1622 |
+
* @return string
|
1623 |
+
*/
|
1624 |
+
function get_caller_function() {
|
1625 |
+
list( , , $caller ) = debug_backtrace( false );
|
1626 |
+
|
1627 |
+
if ( ! empty( $caller['function'] ) ) {
|
1628 |
+
$caller = $caller['function'];
|
1629 |
+
} else {
|
1630 |
+
$caller = '';
|
1631 |
+
}
|
1632 |
+
|
1633 |
+
return $caller;
|
1634 |
+
}
|
1635 |
+
|
1636 |
+
/**
|
1637 |
+
* Scramble string.
|
1638 |
+
*
|
1639 |
+
* @param mixed $input String to be scrambled.
|
1640 |
+
*
|
1641 |
+
* @return mixed
|
1642 |
+
*/
|
1643 |
+
function scramble( $input ) {
|
1644 |
+
if ( ! empty( $input ) ) {
|
1645 |
+
$input = 'WPMDB-SCRAMBLED' . str_rot13( $input );
|
1646 |
+
}
|
1647 |
+
|
1648 |
+
return $input;
|
1649 |
+
}
|
1650 |
+
|
1651 |
+
/**
|
1652 |
+
* Unscramble string.
|
1653 |
+
*
|
1654 |
+
* @param mixed $input String to be unscrambled.
|
1655 |
+
*
|
1656 |
+
* @return mixed
|
1657 |
+
*/
|
1658 |
+
function unscramble( $input ) {
|
1659 |
+
if ( ! empty( $input ) && is_string( $input ) ) {
|
1660 |
+
if ( 0 === strpos( $input, 'WPMDB-SCRAMBLED' ) ) {
|
1661 |
+
// If the string begins with WPMDB-SCRAMBED we can unscramble.
|
1662 |
+
// As the scrambled string could be multiple segments of scrambling (from stow) we remove indicators in one go.
|
1663 |
+
$input = str_replace( 'WPMDB-SCRAMBLED', '', $input );
|
1664 |
+
$input = str_rot13( $input );
|
1665 |
+
} elseif ( false !== strpos( $input, 'WPMDB-SCRAMBLED' ) ) {
|
1666 |
+
// Starts with non-scrambled data (error), but with scrambled string following.
|
1667 |
+
$pos = strpos( $input, 'WPMDB-SCRAMBLED' );
|
1668 |
+
$input = substr( $input, 0, $pos ) . $this->unscramble( substr( $input, $pos ) );
|
1669 |
+
}
|
1670 |
+
}
|
1671 |
+
|
1672 |
+
return $input;
|
1673 |
+
}
|
1674 |
}
|
@@ -0,0 +1,508 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class WPMDB_CLI extends WPMDB_Base {
|
4 |
+
|
5 |
+
/**
|
6 |
+
* Instance of WPMDB.
|
7 |
+
*
|
8 |
+
* @var WPMDB
|
9 |
+
*/
|
10 |
+
protected $wpmdb;
|
11 |
+
|
12 |
+
/**
|
13 |
+
* Migration profile.
|
14 |
+
*
|
15 |
+
* @var array
|
16 |
+
*/
|
17 |
+
protected $profile;
|
18 |
+
|
19 |
+
/**
|
20 |
+
* Data to post during migration.
|
21 |
+
*
|
22 |
+
* @var array
|
23 |
+
*/
|
24 |
+
protected $post_data = array();
|
25 |
+
|
26 |
+
/**
|
27 |
+
* Required PHP version
|
28 |
+
*
|
29 |
+
* @var string
|
30 |
+
*/
|
31 |
+
protected $php_version_required;
|
32 |
+
|
33 |
+
/**
|
34 |
+
* Migration Data
|
35 |
+
*
|
36 |
+
* @var array
|
37 |
+
*/
|
38 |
+
protected $migration;
|
39 |
+
|
40 |
+
function __construct( $plugin_file_path ) {
|
41 |
+
parent::__construct( $plugin_file_path );
|
42 |
+
|
43 |
+
if ( ! version_compare( PHP_VERSION, $this->php_version_required, '>=' ) ) {
|
44 |
+
return;
|
45 |
+
}
|
46 |
+
|
47 |
+
global $wpmdb;
|
48 |
+
$this->wpmdb = $wpmdb;
|
49 |
+
}
|
50 |
+
|
51 |
+
/**
|
52 |
+
* Checks profile data before CLI migration.
|
53 |
+
*
|
54 |
+
* @param int|array $profile Profile key or array.
|
55 |
+
*
|
56 |
+
* @return mixed|WP_Error
|
57 |
+
*/
|
58 |
+
public function pre_cli_migration_check( $profile ) {
|
59 |
+
if ( ! version_compare( PHP_VERSION, $this->php_version_required, '>=' ) ) {
|
60 |
+
return $this->cli_error( sprintf( __( 'CLI addon requires PHP %1$s+', 'wp-migrate-db-cli' ), $this->php_version_required ) );
|
61 |
+
}
|
62 |
+
|
63 |
+
if ( is_array( $profile ) ) {
|
64 |
+
$query_str = http_build_query( $profile );
|
65 |
+
$profile = $this->wpmdb->parse_migration_form_data( $query_str );
|
66 |
+
$profile = wp_parse_args(
|
67 |
+
$profile,
|
68 |
+
array(
|
69 |
+
'save_computer' => '0',
|
70 |
+
'gzip_file' => '0',
|
71 |
+
'replace_guids' => '0',
|
72 |
+
'exclude_transients' => '0',
|
73 |
+
'exclude_spam' => '0',
|
74 |
+
'keep_active_plugins' => '0',
|
75 |
+
'compatibility_older_mysql' => '0',
|
76 |
+
)
|
77 |
+
);
|
78 |
+
}
|
79 |
+
|
80 |
+
$this->profile = $profile = apply_filters( 'wpmdb_cli_profile_before_migration', $profile );
|
81 |
+
|
82 |
+
if ( is_wp_error( $profile ) ) {
|
83 |
+
return $profile;
|
84 |
+
}
|
85 |
+
|
86 |
+
return true;
|
87 |
+
}
|
88 |
+
|
89 |
+
/**
|
90 |
+
* Performs CLI migration given a profile data.
|
91 |
+
*
|
92 |
+
* @param int|array $profile Profile key or array.
|
93 |
+
*
|
94 |
+
* @return bool|WP_Error Returns true if succeed or WP_Error if failed.
|
95 |
+
*/
|
96 |
+
public function cli_migration( $profile ) {
|
97 |
+
$pre_check = $this->pre_cli_migration_check( $profile );
|
98 |
+
if ( is_wp_error( $pre_check ) ) {
|
99 |
+
return $pre_check;
|
100 |
+
}
|
101 |
+
|
102 |
+
$this->set_time_limit();
|
103 |
+
$this->wpmdb->set_cli_migration();
|
104 |
+
|
105 |
+
if ( 'savefile' === $this->profile['action'] ) {
|
106 |
+
$this->post_data['intent'] = 'savefile';
|
107 |
+
if ( ! empty( $this->profile['export_dest'] ) ) {
|
108 |
+
$this->post_data['export_dest'] = $profile['export_dest'];
|
109 |
+
} else {
|
110 |
+
$this->post_data['export_dest'] = 'ORIGIN';
|
111 |
+
}
|
112 |
+
}
|
113 |
+
|
114 |
+
// Check for tables specified in migration profile that do not exist in the source database
|
115 |
+
if ( ! empty( $this->profile['select_tables'] ) ) {
|
116 |
+
$source_tables = apply_filters( 'wpmdb_cli_filter_source_tables', $this->get_tables() );
|
117 |
+
|
118 |
+
if ( ! empty( $source_tables ) ) {
|
119 |
+
// Return error if selected tables do not exist in source database
|
120 |
+
$nonexistent_tables = array();
|
121 |
+
foreach ( $this->profile['select_tables'] as $table ) {
|
122 |
+
if ( ! in_array( $table, $source_tables ) ) {
|
123 |
+
$nonexistent_tables[] = $table;
|
124 |
+
}
|
125 |
+
}
|
126 |
+
|
127 |
+
if ( ! empty( $nonexistent_tables ) ) {
|
128 |
+
$local_or_remote = ( 'pull' === $this->profile['action'] ) ? 'remote' : 'local';
|
129 |
+
return $this->cli_error( sprintf( __( 'The following table(s) do not exist in the %1$s database: %2$s', 'wp-migrate-db-cli' ), $local_or_remote, implode( ', ', $nonexistent_tables ) ) );
|
130 |
+
}
|
131 |
+
}
|
132 |
+
}
|
133 |
+
|
134 |
+
$profile = apply_filters( 'wpmdb_cli_filter_before_cli_initiate_migration', $profile );
|
135 |
+
if ( is_wp_error( $profile ) ) {
|
136 |
+
return $profile;
|
137 |
+
}
|
138 |
+
|
139 |
+
$this->migration = $this->cli_initiate_migration();
|
140 |
+
if ( is_wp_error( $this->migration ) ) {
|
141 |
+
return $this->migration;
|
142 |
+
}
|
143 |
+
|
144 |
+
$this->post_data['migration_state_id'] = $this->migration['migration_state_id'];
|
145 |
+
|
146 |
+
$tables_to_process = $this->migrate_tables();
|
147 |
+
if ( is_wp_error( $tables_to_process ) ) {
|
148 |
+
return $tables_to_process;
|
149 |
+
}
|
150 |
+
|
151 |
+
$this->post_data['tables'] = implode( ',', $tables_to_process );
|
152 |
+
|
153 |
+
$finalize = $this->finalize_migration();
|
154 |
+
if ( is_wp_error( $finalize ) || 'savefile' === $this->profile['action'] ) {
|
155 |
+
return $finalize;
|
156 |
+
}
|
157 |
+
|
158 |
+
return true;
|
159 |
+
}
|
160 |
+
|
161 |
+
/**
|
162 |
+
* Verify CLI response from endpoint.
|
163 |
+
*
|
164 |
+
* @param string $response Response from endpoint.
|
165 |
+
* @param string $function_name Name of called function.
|
166 |
+
*
|
167 |
+
* @return WP_Error|string
|
168 |
+
*/
|
169 |
+
function verify_cli_response( $response, $function_name ) {
|
170 |
+
$response = trim( $response );
|
171 |
+
if ( false === $response ) {
|
172 |
+
return $this->cli_error( $this->error );
|
173 |
+
}
|
174 |
+
|
175 |
+
if ( false === $this->wpmdb->is_json( $response ) ) {
|
176 |
+
return $this->cli_error( sprintf( __( 'We were expecting a JSON response, instead we received: %2$s (function name: %1$s)', 'wp-migrate-db-cli' ), $function_name, $response ) );
|
177 |
+
}
|
178 |
+
|
179 |
+
$response = json_decode( $response, true );
|
180 |
+
if ( isset( $response['wpmdb_error'] ) ) {
|
181 |
+
return $this->cli_error( $response['body'] );
|
182 |
+
}
|
183 |
+
|
184 |
+
// Display warnings and non fatal error messages as CLI warnings without aborting.
|
185 |
+
if ( isset( $response['wpmdb_warning'] ) || isset( $response['wpmdb_non_fatal_error'] ) ) {
|
186 |
+
$body = ( isset ( $response['cli_body'] ) ) ? $response['cli_body'] : $response['body'];
|
187 |
+
$messages = maybe_unserialize( $body );
|
188 |
+
foreach ( ( array ) $messages as $message ) {
|
189 |
+
if ( $message ) {
|
190 |
+
WP_CLI::warning( self::cleanup_message( $message ) );
|
191 |
+
}
|
192 |
+
}
|
193 |
+
}
|
194 |
+
|
195 |
+
return $response;
|
196 |
+
}
|
197 |
+
|
198 |
+
/**
|
199 |
+
* Return instance of WP_Error.
|
200 |
+
*
|
201 |
+
* @param string $message Error message.
|
202 |
+
*
|
203 |
+
* @return WP_Error.
|
204 |
+
*/
|
205 |
+
function cli_error( $message ) {
|
206 |
+
return new WP_Error( 'wpmdb_cli_error', self::cleanup_message( $message ) );
|
207 |
+
}
|
208 |
+
|
209 |
+
/**
|
210 |
+
* Cleanup message, replacing <br> with \n and removing HTML.
|
211 |
+
*
|
212 |
+
* @param string $message Error message.
|
213 |
+
*
|
214 |
+
* @return string $message.
|
215 |
+
*/
|
216 |
+
static function cleanup_message( $message ) {
|
217 |
+
$message = html_entity_decode( $message, ENT_QUOTES );
|
218 |
+
$message = preg_replace( '#<br\s*/?>#', "\n", $message );
|
219 |
+
$message = trim( strip_tags( $message ) );
|
220 |
+
|
221 |
+
return $message;
|
222 |
+
}
|
223 |
+
|
224 |
+
/**
|
225 |
+
* Initiates migration and verifies result
|
226 |
+
*
|
227 |
+
* @return array|WP_Error
|
228 |
+
*/
|
229 |
+
function cli_initiate_migration() {
|
230 |
+
do_action( 'wpmdb_cli_before_initiate_migration', $this->profile );
|
231 |
+
|
232 |
+
WP_CLI::log( __( 'Initiating migration...', 'wp-migrate-db-cli' ) );
|
233 |
+
|
234 |
+
$migration_args = $this->post_data;
|
235 |
+
$migration_args['form_data'] = http_build_query( $this->profile );
|
236 |
+
$migration_args['stage'] = 'migrate';
|
237 |
+
$this->post_data = apply_filters( 'wpmdb_cli_initiate_migration_args', $migration_args, $this->profile );
|
238 |
+
|
239 |
+
$response = $this->initiate_migration( $this->post_data );
|
240 |
+
|
241 |
+
$initiate_migration_response = $this->verify_cli_response( $response, 'initiate_migration()' );
|
242 |
+
if ( ! is_wp_error( $initiate_migration_response ) ) {
|
243 |
+
$initiate_migration_response = apply_filters( 'wpmdb_cli_initiate_migration_response', $initiate_migration_response );
|
244 |
+
}
|
245 |
+
|
246 |
+
return $initiate_migration_response;
|
247 |
+
}
|
248 |
+
|
249 |
+
/**
|
250 |
+
* Determine which tables to migrate
|
251 |
+
*
|
252 |
+
* @return array|WP_Error
|
253 |
+
*/
|
254 |
+
function get_tables_to_migrate() {
|
255 |
+
$tables_to_migrate = $this->get_tables( 'prefix' );
|
256 |
+
|
257 |
+
return apply_filters( 'wpmdb_cli_tables_to_migrate', $tables_to_migrate, $this->profile, $this->migration );
|
258 |
+
}
|
259 |
+
|
260 |
+
/**
|
261 |
+
* Returns a WP-CLI progress bar instance
|
262 |
+
*
|
263 |
+
* @param array $tables
|
264 |
+
* @param int $stage
|
265 |
+
*
|
266 |
+
* @return \cli\progress\Bar
|
267 |
+
*/
|
268 |
+
function get_progress_bar( $tables, $stage ) {
|
269 |
+
|
270 |
+
$progress_label = __( 'Exporting tables', 'wp-migrate-db-cli' );
|
271 |
+
|
272 |
+
$progress_label = apply_filters( 'wpmdb_cli_progress_label', $progress_label, $stage, $tables );
|
273 |
+
|
274 |
+
$progress_label = str_pad( $progress_label, 20, ' ' );
|
275 |
+
|
276 |
+
$count = $this->get_total_rows_from_table_list( $tables, $stage );
|
277 |
+
|
278 |
+
return new \cli\progress\Bar( $progress_label, $count );
|
279 |
+
}
|
280 |
+
|
281 |
+
/**
|
282 |
+
* Returns total rows from list of tables
|
283 |
+
*
|
284 |
+
* @param array $tables
|
285 |
+
* @param int $stage
|
286 |
+
*
|
287 |
+
* @return Int
|
288 |
+
*/
|
289 |
+
function get_total_rows_from_table_list( $tables, $stage ) {
|
290 |
+
static $cached_results = array();
|
291 |
+
|
292 |
+
if ( isset( $cached_results[ $stage ] ) ) {
|
293 |
+
return $cached_results[ $stage ];
|
294 |
+
}
|
295 |
+
|
296 |
+
$table_rows = $this->get_row_counts_from_table_list( $tables, $stage );
|
297 |
+
$cached_results[ $stage ] = array_sum( array_intersect_key( $table_rows, array_flip( $tables ) ) );
|
298 |
+
|
299 |
+
return $cached_results[ $stage ];
|
300 |
+
}
|
301 |
+
|
302 |
+
/**
|
303 |
+
* Returns row counts from list of tables
|
304 |
+
*
|
305 |
+
* @param array $tables
|
306 |
+
* @param int $stage
|
307 |
+
*
|
308 |
+
* @return mixed
|
309 |
+
*/
|
310 |
+
function get_row_counts_from_table_list( $tables, $stage ) {
|
311 |
+
static $cached_results = array();
|
312 |
+
|
313 |
+
if ( isset( $cached_results[ $stage ] ) ) {
|
314 |
+
return $cached_results[ $stage ];
|
315 |
+
}
|
316 |
+
|
317 |
+
$local_table_rows = $this->wpmdb->get_table_row_count();
|
318 |
+
$cached_results[ $stage ] = apply_filters( 'wpmdb_cli_get_row_counts_from_table_list', $local_table_rows, $stage );
|
319 |
+
|
320 |
+
return $cached_results[ $stage ];
|
321 |
+
}
|
322 |
+
|
323 |
+
/**
|
324 |
+
* @return array|mixed|string|void|WP_Error
|
325 |
+
*/
|
326 |
+
function migrate_tables() {
|
327 |
+
$tables_to_migrate = $this->get_tables_to_migrate();
|
328 |
+
|
329 |
+
$tables = $tables_to_migrate;
|
330 |
+
$stage_iterator = 2;
|
331 |
+
|
332 |
+
$filtered_vars = apply_filters( 'wpmdb_cli_filter_before_migrate_tables', array( 'tables' => $tables, 'stage_iterator' => $stage_iterator ) );
|
333 |
+
if ( ! is_array( $filtered_vars ) ) {
|
334 |
+
return $filtered_vars;
|
335 |
+
} else {
|
336 |
+
extract( $filtered_vars, EXTR_OVERWRITE );
|
337 |
+
}
|
338 |
+
|
339 |
+
if ( empty( $tables ) ) {
|
340 |
+
return $this->cli_error( __( 'No tables selected for migration.', 'wp-migrate-db' ) );
|
341 |
+
}
|
342 |
+
|
343 |
+
$table_rows = $this->get_row_counts_from_table_list( $tables, $stage_iterator );
|
344 |
+
|
345 |
+
do_action( 'wpmdb_cli_before_migrate_tables', $this->profile, $this->migration );
|
346 |
+
|
347 |
+
$notify = $this->get_progress_bar( $tables, $stage_iterator );
|
348 |
+
$args = $this->post_data;
|
349 |
+
|
350 |
+
do {
|
351 |
+
$migration_progress = 0;
|
352 |
+
|
353 |
+
foreach ( $tables as $key => $table ) {
|
354 |
+
$current_row = -1;
|
355 |
+
$primary_keys = '';
|
356 |
+
$table_progress = 0;
|
357 |
+
$table_progress_last = 0;
|
358 |
+
|
359 |
+
$args['table'] = $table;
|
360 |
+
$args['last_table'] = ( $key == count( $tables ) - 1 ) ? '1' : '0';
|
361 |
+
|
362 |
+
do {
|
363 |
+
// reset the current chunk
|
364 |
+
$this->wpmdb->empty_current_chunk();
|
365 |
+
|
366 |
+
$args['current_row'] = $current_row;
|
367 |
+
$args['primary_keys'] = $primary_keys;
|
368 |
+
$args = apply_filters( 'wpmdb_cli_migrate_table_args', $args, $this->profile, $this->migration );
|
369 |
+
|
370 |
+
$response = $this->migrate_table( $args );
|
371 |
+
|
372 |
+
$migrate_table_response = $this->verify_cli_response( $response, 'migrate_table()' );
|
373 |
+
|
374 |
+
if ( is_wp_error( $migrate_table_response ) ) {
|
375 |
+
return $migrate_table_response;
|
376 |
+
}
|
377 |
+
|
378 |
+
$migrate_table_response = apply_filters( 'wpmdb_cli_migrate_table_response', $migrate_table_response, $_POST, $this->profile, $this->migration );
|
379 |
+
|
380 |
+
$current_row = $migrate_table_response['current_row'];
|
381 |
+
$primary_keys = $migrate_table_response['primary_keys'];
|
382 |
+
|
383 |
+
$last_migration_progress = $migration_progress;
|
384 |
+
|
385 |
+
if ( -1 == $current_row ) {
|
386 |
+
$migration_progress -= $table_progress;
|
387 |
+
$migration_progress += $table_rows[ $table ];
|
388 |
+
} else {
|
389 |
+
if ( 0 === $table_progress_last ) {
|
390 |
+
$table_progress_last = $current_row;
|
391 |
+
$table_progress = $table_progress_last;
|
392 |
+
$migration_progress += $table_progress_last;
|
393 |
+
} else {
|
394 |
+
$iteration_progress = $current_row - $table_progress_last;
|
395 |
+
$table_progress_last = $current_row;
|
396 |
+
$table_progress += $iteration_progress;
|
397 |
+
$migration_progress += $iteration_progress;
|
398 |
+
}
|
399 |
+
}
|
400 |
+
|
401 |
+
$increment = $migration_progress - $last_migration_progress;
|
402 |
+
|
403 |
+
$notify->tick( $increment );
|
404 |
+
|
405 |
+
} while ( -1 != $current_row );
|
406 |
+
}
|
407 |
+
|
408 |
+
$notify->finish();
|
409 |
+
|
410 |
+
++$stage_iterator;
|
411 |
+
$args['stage'] = 'migrate';
|
412 |
+
$tables = $tables_to_migrate;
|
413 |
+
$table_rows = $this->get_row_counts_from_table_list( $tables, $stage_iterator );
|
414 |
+
|
415 |
+
if ( $stage_iterator < 3 ) {
|
416 |
+
$notify = $this->get_progress_bar( $tables, $stage_iterator );
|
417 |
+
}
|
418 |
+
} while ( $stage_iterator < 3 );
|
419 |
+
|
420 |
+
$this->post_data = $args;
|
421 |
+
|
422 |
+
return $tables;
|
423 |
+
}
|
424 |
+
|
425 |
+
/**
|
426 |
+
* Finalize migration
|
427 |
+
*
|
428 |
+
* @return bool|WP_Error
|
429 |
+
*/
|
430 |
+
function finalize_migration() {
|
431 |
+
do_action( 'wpmdb_cli_before_finalize_migration', $this->profile, $this->migration );
|
432 |
+
|
433 |
+
WP_CLI::log( __( 'Cleaning up...', 'wp-migrate-db-cli' ) );
|
434 |
+
|
435 |
+
$finalize = apply_filters( 'wpmdb_cli_finalize_migration', true, $this->profile, $this->migration );
|
436 |
+
if ( is_wp_error( $finalize ) ) {
|
437 |
+
return $finalize;
|
438 |
+
}
|
439 |
+
|
440 |
+
$this->post_data = apply_filters( 'wpmdb_cli_finalize_migration_args', $this->post_data, $this->profile, $this->migration );
|
441 |
+
|
442 |
+
if ( 'savefile' === $this->post_data['intent'] ) {
|
443 |
+
return $this->finalize_export();
|
444 |
+
}
|
445 |
+
|
446 |
+
$response = null;
|
447 |
+
$response = apply_filters( 'wpmdb_cli_finalize_migration_response', $response );
|
448 |
+
if ( ! empty( $response ) && '1' !== $response ) {
|
449 |
+
return $this->cli_error( $response );
|
450 |
+
}
|
451 |
+
|
452 |
+
do_action( 'wpmdb_cli_after_finalize_migration', $this->profile, $this->migration );
|
453 |
+
|
454 |
+
return true;
|
455 |
+
}
|
456 |
+
|
457 |
+
/**
|
458 |
+
* Stub for ajax_initiate_migration()
|
459 |
+
*
|
460 |
+
* @param array|bool $args
|
461 |
+
*
|
462 |
+
* @return string
|
463 |
+
*/
|
464 |
+
function initiate_migration( $args = false ) {
|
465 |
+
$_POST = $args;
|
466 |
+
$response = $this->wpmdb->ajax_initiate_migration();
|
467 |
+
|
468 |
+
return $response;
|
469 |
+
}
|
470 |
+
|
471 |
+
/**
|
472 |
+
* stub for ajax_migrate_table()
|
473 |
+
*
|
474 |
+
* @param array|bool $args
|
475 |
+
*
|
476 |
+
* @return string
|
477 |
+
*/
|
478 |
+
function migrate_table( $args = false ) {
|
479 |
+
$_POST = $args;
|
480 |
+
$response = $this->wpmdb->ajax_migrate_table();
|
481 |
+
|
482 |
+
return $response;
|
483 |
+
}
|
484 |
+
|
485 |
+
/**
|
486 |
+
* Finalize Export by moving file to specified destination
|
487 |
+
*
|
488 |
+
* @return string|error
|
489 |
+
*/
|
490 |
+
function finalize_export() {
|
491 |
+
$state_data = $this->wpmdb->state_data;
|
492 |
+
$temp_file = $state_data['dump_path'];
|
493 |
+
if ( 'ORIGIN' === $state_data['export_dest'] ) {
|
494 |
+
$response = $temp_file;
|
495 |
+
} else {
|
496 |
+
$dest_file = $state_data['export_dest'];
|
497 |
+
if ( file_exists( $temp_file ) && rename( $temp_file, $dest_file ) ) {
|
498 |
+
$response = $dest_file;
|
499 |
+
} else {
|
500 |
+
$response = $this->cli_error( __( 'Unable to move exported file.', 'wp-migrate-db' ) );
|
501 |
+
}
|
502 |
+
}
|
503 |
+
|
504 |
+
return $response;
|
505 |
+
}
|
506 |
+
|
507 |
+
|
508 |
+
}
|
@@ -0,0 +1,226 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Migrate your DB using WP Migrate DB.
|
5 |
+
*/
|
6 |
+
class WPMDB_Command extends WP_CLI_Command {
|
7 |
+
|
8 |
+
/**
|
9 |
+
* Export local DB to file.
|
10 |
+
*
|
11 |
+
* ## OPTIONS
|
12 |
+
*
|
13 |
+
* <output-file>
|
14 |
+
* : A file path to export to. Filename will be modified to end in .sql or
|
15 |
+
* .sql.gz if necessary.
|
16 |
+
*
|
17 |
+
* [--find=<strings>]
|
18 |
+
* : A comma separated list of strings to find when performing a string find
|
19 |
+
* and replace across the database.
|
20 |
+
*
|
21 |
+
* Table names should be quoted as needed, i.e. when using a comma in the
|
22 |
+
* find/replace string.
|
23 |
+
*
|
24 |
+
* The --replace=<strings> argument should be used in conjunction to specify
|
25 |
+
* the replace values for the strings found using this argument. The number
|
26 |
+
* of strings specified in this argument should match the number passed into
|
27 |
+
* --replace=<strings> argument.
|
28 |
+
*
|
29 |
+
* [--replace=<strings>]
|
30 |
+
* : A comma separated list of replace value strings to implement when
|
31 |
+
* performing a string find & replace across the database.
|
32 |
+
*
|
33 |
+
* Should be used in conjunction with the --find=<strings> argument, see it's
|
34 |
+
* documentation for further explanation of the find & replace functionality.
|
35 |
+
*
|
36 |
+
* [--exclude-post-revisions]
|
37 |
+
* : Exclude post revisions from export.
|
38 |
+
*
|
39 |
+
* [--skip-replace-guids]
|
40 |
+
* : Do not perform a find & replace on the guid column in the wp_posts table.
|
41 |
+
*
|
42 |
+
* [--exclude-spam]
|
43 |
+
* : Exclude spam comments.
|
44 |
+
*
|
45 |
+
* [--gzip-file]
|
46 |
+
* : GZip compress export file.
|
47 |
+
*
|
48 |
+
* [--include-transients]
|
49 |
+
* : Include transients (temporary cached data).
|
50 |
+
*
|
51 |
+
* ## EXAMPLES
|
52 |
+
*
|
53 |
+
* wp migratedb export ./migratedb.sql \
|
54 |
+
* --find=http://dev.bradt.ca,/Users/bradt/home/bradt.ca
|
55 |
+
* --replace=http://bradt.ca,/home/bradt.ca
|
56 |
+
*
|
57 |
+
* @param array $args
|
58 |
+
* @param array $assoc_args
|
59 |
+
*/
|
60 |
+
public function export( $args, $assoc_args ) {
|
61 |
+
|
62 |
+
$assoc_args['action'] = 'savefile';
|
63 |
+
$assoc_args['export_dest'] = trim( $args[0] );
|
64 |
+
|
65 |
+
if ( empty( $assoc_args['export_dest'] ) ) {
|
66 |
+
WP_CLI::error( WPMDB_CLI::cleanup_message( __( 'You must provide a destination filename.', 'wp-migrate-db-cli' ) ) );
|
67 |
+
}
|
68 |
+
|
69 |
+
$profile = $this->_get_profile_data_from_args( $args, $assoc_args );
|
70 |
+
|
71 |
+
if ( is_wp_error( $profile ) ) {
|
72 |
+
WP_CLI::error( $profile );
|
73 |
+
}
|
74 |
+
|
75 |
+
$this->_perform_cli_migration( $profile );
|
76 |
+
}
|
77 |
+
|
78 |
+
|
79 |
+
/**
|
80 |
+
* Get profile data from CLI args.
|
81 |
+
*
|
82 |
+
* @param array $args
|
83 |
+
* @param array $assoc_args
|
84 |
+
*
|
85 |
+
* @return array|WP_Error
|
86 |
+
*/
|
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 |
+
}
|
102 |
+
|
103 |
+
if ( 'savefile' === $assoc_args['action'] && ! empty( $assoc_args['export_dest'] ) ) {
|
104 |
+
$export_dest = $assoc_args['export_dest'];
|
105 |
+
}
|
106 |
+
|
107 |
+
$action = $assoc_args['action'];
|
108 |
+
|
109 |
+
// --find=<old> and --replace=<new>
|
110 |
+
$replace_old = array();
|
111 |
+
$replace_new = array();
|
112 |
+
if ( ! empty( $assoc_args['find'] ) ) {
|
113 |
+
$replace_old = explode( ',', $assoc_args['find'] );
|
114 |
+
}
|
115 |
+
if ( ! empty( $assoc_args['replace'] ) ) {
|
116 |
+
$replace_new = explode( ',', $assoc_args['replace'] );
|
117 |
+
}
|
118 |
+
if ( count( $replace_old ) !== count( $replace_new ) ) {
|
119 |
+
return $wpmdb_cli->cli_error( sprintf( __( '%1$s and %2$s must contain the same number of values', 'wp-migrate-db-cli' ), '--find', '--replace' ) );
|
120 |
+
}
|
121 |
+
array_unshift( $replace_old, '' );
|
122 |
+
array_unshift( $replace_new, '' );
|
123 |
+
|
124 |
+
// --exclude-spam
|
125 |
+
$exclude_spam = intval( isset( $assoc_args['exclude-spam'] ) );
|
126 |
+
|
127 |
+
// --gzip-file
|
128 |
+
$gzip_file = intval( isset( $assoc_args['gzip-file'] ) );
|
129 |
+
|
130 |
+
$select_post_types = array();
|
131 |
+
|
132 |
+
// --exclude-post-revisions
|
133 |
+
if ( ! empty( $assoc_args['exclude-post-revisions'] ) ) {
|
134 |
+
$select_post_types[] = 'revision';
|
135 |
+
}
|
136 |
+
|
137 |
+
$exclude_post_types = count( $select_post_types ) > 0 ? 1 : 0;
|
138 |
+
|
139 |
+
// --skip-replace-guids
|
140 |
+
$replace_guids = 1;
|
141 |
+
if ( isset( $assoc_args['skip-replace-guids'] ) ) {
|
142 |
+
$replace_guids = 0;
|
143 |
+
}
|
144 |
+
|
145 |
+
$select_tables = array();
|
146 |
+
$table_migrate_option = 'migrate_only_with_prefix';
|
147 |
+
|
148 |
+
// --include-transients.
|
149 |
+
$exclude_transients = intval( ! isset( $assoc_args['include-transients'] ) );
|
150 |
+
|
151 |
+
//cleanup filename for exports
|
152 |
+
if ( ! empty( $export_dest ) ) {
|
153 |
+
if ( $gzip_file ) {
|
154 |
+
if ( 'gz' !== pathinfo( $export_dest, PATHINFO_EXTENSION ) ) {
|
155 |
+
if ( 'sql' === pathinfo( $export_dest, PATHINFO_EXTENSION ) ) {
|
156 |
+
$export_dest .= '.gz';
|
157 |
+
} else {
|
158 |
+
$export_dest .= '.sql.gz';
|
159 |
+
}
|
160 |
+
}
|
161 |
+
} elseif ( 'sql' !== pathinfo( $export_dest, PATHINFO_EXTENSION ) ) {
|
162 |
+
$export_dest = preg_replace( '/(\.sql)?(\.gz)?$/i', '', $export_dest ) . '.sql';
|
163 |
+
}
|
164 |
+
|
165 |
+
// ensure export destination is writable
|
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(
|
173 |
+
'action',
|
174 |
+
'replace_old',
|
175 |
+
'table_migrate_option',
|
176 |
+
'replace_new',
|
177 |
+
'select_tables',
|
178 |
+
'exclude_post_types',
|
179 |
+
'select_post_types',
|
180 |
+
'replace_guids',
|
181 |
+
'exclude_spam',
|
182 |
+
'gzip_file',
|
183 |
+
'exclude_transients',
|
184 |
+
'export_dest'
|
185 |
+
);
|
186 |
+
|
187 |
+
$profile = apply_filters( 'wpmdb_cli_filter_get_profile_data_from_args', $profile, $args, $assoc_args );
|
188 |
+
|
189 |
+
return $profile;
|
190 |
+
}
|
191 |
+
|
192 |
+
|
193 |
+
/**
|
194 |
+
* Perform CLI migration.
|
195 |
+
*
|
196 |
+
* @param mixed $profile Profile key or array
|
197 |
+
*
|
198 |
+
* @return void
|
199 |
+
*/
|
200 |
+
protected function _perform_cli_migration( $profile ) {
|
201 |
+
$wpmdb_cli = null;
|
202 |
+
|
203 |
+
//load correct cli class
|
204 |
+
if ( function_exists( 'wpmdb_pro_cli' ) ) {
|
205 |
+
$wpmdb_cli = wpmdb_pro_cli();
|
206 |
+
} else {
|
207 |
+
$wpmdb_cli = wpmdb_cli();
|
208 |
+
}
|
209 |
+
|
210 |
+
if ( empty( $wpmdb_cli ) ) {
|
211 |
+
WP_CLI::error( __( 'WP Migrate DB CLI class not available.', 'wp-migrate-db-cli' ) );
|
212 |
+
return;
|
213 |
+
}
|
214 |
+
|
215 |
+
$result = $wpmdb_cli->cli_migration( $profile );
|
216 |
+
|
217 |
+
if ( ! is_wp_error( $result ) ) {
|
218 |
+
WP_CLI::success( sprintf( __( 'Export saved to: %s', 'wp-migrate-db-cli' ), $result ) );
|
219 |
+
} elseif ( is_wp_error( $result ) ) {
|
220 |
+
WP_CLI::error( WPMDB_CLI::cleanup_message( $result->get_error_message() ) );
|
221 |
+
}
|
222 |
+
}
|
223 |
+
|
224 |
+
}
|
225 |
+
|
226 |
+
WP_CLI::add_command( 'migratedb', 'WPMDB_Command' );
|
@@ -0,0 +1,299 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class WPMDB_Migration_State {
|
4 |
+
const OPTION_PREFIX = 'wpmdb_state_';
|
5 |
+
const TIMEOUT_PREFIX = 'wpmdb_state_timeout_';
|
6 |
+
const EXPIRATION = 86400; // 60s * 60m * 24h
|
7 |
+
|
8 |
+
private $_value = null;
|
9 |
+
private $_id = null;
|
10 |
+
|
11 |
+
/**
|
12 |
+
* @param string $id
|
13 |
+
*/
|
14 |
+
function __construct( $id = '' ) {
|
15 |
+
if ( ! empty( $id ) ) {
|
16 |
+
$value = get_site_option( $this->_option( $id ), false, false );
|
17 |
+
|
18 |
+
if ( false !== $value ) {
|
19 |
+
$this->_id = $id;
|
20 |
+
$this->_value = $value;
|
21 |
+
}
|
22 |
+
}
|
23 |
+
}
|
24 |
+
|
25 |
+
/**
|
26 |
+
* Returns the unique id of the instance.
|
27 |
+
*
|
28 |
+
* @return string
|
29 |
+
*/
|
30 |
+
function id() {
|
31 |
+
if ( empty( $this->_id ) ) {
|
32 |
+
$this->_id = uniqid();
|
33 |
+
}
|
34 |
+
|
35 |
+
return $this->_id;
|
36 |
+
}
|
37 |
+
|
38 |
+
/**
|
39 |
+
* Returns the site option string used to save the migration state.
|
40 |
+
*
|
41 |
+
* @param string $id
|
42 |
+
*
|
43 |
+
* @return string
|
44 |
+
*/
|
45 |
+
private function _option( $id = null ) {
|
46 |
+
if ( empty( $id ) ) {
|
47 |
+
$id = $this->id();
|
48 |
+
}
|
49 |
+
|
50 |
+
return self::OPTION_PREFIX . $id;
|
51 |
+
}
|
52 |
+
|
53 |
+
/**
|
54 |
+
* Returns the site option string used to save the migration state timeout.
|
55 |
+
*
|
56 |
+
* @param string $id
|
57 |
+
*
|
58 |
+
* @return string
|
59 |
+
*/
|
60 |
+
private function _timeout_option( $id = null ) {
|
61 |
+
if ( empty( $id ) ) {
|
62 |
+
$id = $this->id();
|
63 |
+
}
|
64 |
+
|
65 |
+
return self::TIMEOUT_PREFIX . $id;
|
66 |
+
}
|
67 |
+
|
68 |
+
/**
|
69 |
+
* Set the migration state.
|
70 |
+
*
|
71 |
+
* @param $value
|
72 |
+
*
|
73 |
+
* @return bool
|
74 |
+
*/
|
75 |
+
function set( $value ) {
|
76 |
+
if ( $this->_update_timeout() && update_site_option( $this->_option(), $value ) ) {
|
77 |
+
return true;
|
78 |
+
}
|
79 |
+
|
80 |
+
// If nothing changed it's still OK.
|
81 |
+
if ( $this->get() === $value ) {
|
82 |
+
return true;
|
83 |
+
}
|
84 |
+
|
85 |
+
return false;
|
86 |
+
}
|
87 |
+
|
88 |
+
/**
|
89 |
+
* Updates the companion timeout setting to the current migration state option.
|
90 |
+
*
|
91 |
+
* @return bool
|
92 |
+
*/
|
93 |
+
private function _update_timeout() {
|
94 |
+
$value = time() + self::EXPIRATION;
|
95 |
+
|
96 |
+
if ( update_site_option( $this->_timeout_option(), $value ) ) {
|
97 |
+
return true;
|
98 |
+
}
|
99 |
+
|
100 |
+
// If nothing changed it's still OK.
|
101 |
+
if ( get_site_option( $this->_timeout_option(), false, false ) == $value ) {
|
102 |
+
return true;
|
103 |
+
}
|
104 |
+
|
105 |
+
return false;
|
106 |
+
}
|
107 |
+
|
108 |
+
/**
|
109 |
+
* Returns the current saved migration state.
|
110 |
+
*
|
111 |
+
* @return mixed
|
112 |
+
*/
|
113 |
+
function get() {
|
114 |
+
return get_site_option( $this->_option(), false, false );
|
115 |
+
}
|
116 |
+
|
117 |
+
/**
|
118 |
+
* Deletes the site options for migration state and its companion timeout record.
|
119 |
+
*
|
120 |
+
* @param $id
|
121 |
+
*
|
122 |
+
* @return bool
|
123 |
+
*/
|
124 |
+
private static function _delete_id( $id ) {
|
125 |
+
if ( false === get_site_option( self::OPTION_PREFIX . $id, false, false ) || delete_site_option( self::OPTION_PREFIX . $id ) ) {
|
126 |
+
delete_site_option( self::TIMEOUT_PREFIX . $id );
|
127 |
+
|
128 |
+
return true;
|
129 |
+
}
|
130 |
+
|
131 |
+
return false;
|
132 |
+
}
|
133 |
+
|
134 |
+
/**
|
135 |
+
* Delete the current migration state.
|
136 |
+
*
|
137 |
+
* @return bool
|
138 |
+
*/
|
139 |
+
function delete() {
|
140 |
+
return $this->_delete_id( $this->id() );
|
141 |
+
}
|
142 |
+
|
143 |
+
/**
|
144 |
+
* Get all migration state ids that have timed out.
|
145 |
+
*
|
146 |
+
* @param int $timeout Optional UNIX timestamp for timeout, default of 0 uses current timestamp.
|
147 |
+
*
|
148 |
+
* @return array
|
149 |
+
*/
|
150 |
+
private static function _timed_out_ids( $timeout = 0 ) {
|
151 |
+
global $wpdb;
|
152 |
+
|
153 |
+
$ids = array();
|
154 |
+
|
155 |
+
if ( empty( $timeout ) ) {
|
156 |
+
$timeout = time();
|
157 |
+
}
|
158 |
+
|
159 |
+
if ( is_multisite() ) {
|
160 |
+
$timeout_keys = $wpdb->get_col(
|
161 |
+
$wpdb->prepare(
|
162 |
+
"SELECT meta_key FROM {$wpdb->sitemeta} WHERE site_id = %d AND meta_key like %s AND meta_value < %d",
|
163 |
+
$wpdb->siteid,
|
164 |
+
addcslashes( self::TIMEOUT_PREFIX, '_' ) . '%',
|
165 |
+
$timeout
|
166 |
+
)
|
167 |
+
);
|
168 |
+
} else {
|
169 |
+
$timeout_keys = $wpdb->get_col(
|
170 |
+
$wpdb->prepare(
|
171 |
+
"SELECT option_name FROM $wpdb->options WHERE option_name LIKE %s and option_value < %d",
|
172 |
+
addcslashes( self::TIMEOUT_PREFIX, '_' ) . '%',
|
173 |
+
$timeout
|
174 |
+
)
|
175 |
+
);
|
176 |
+
}
|
177 |
+
|
178 |
+
if ( ! empty( $timeout_keys ) ) {
|
179 |
+
$id_start = strlen( self::TIMEOUT_PREFIX );
|
180 |
+
|
181 |
+
foreach ( $timeout_keys as $timeout_key ) {
|
182 |
+
$ids[] = substr( $timeout_key, $id_start );
|
183 |
+
}
|
184 |
+
}
|
185 |
+
|
186 |
+
return $ids;
|
187 |
+
}
|
188 |
+
|
189 |
+
/**
|
190 |
+
* Get all migration state ids that have no time out companion.
|
191 |
+
*
|
192 |
+
* @return array
|
193 |
+
*/
|
194 |
+
private static function _orphaned_ids() {
|
195 |
+
global $wpdb;
|
196 |
+
|
197 |
+
$ids = array();
|
198 |
+
|
199 |
+
if ( is_multisite() ) {
|
200 |
+
$keys = $wpdb->get_col(
|
201 |
+
$wpdb->prepare( "
|
202 |
+
SELECT meta_key
|
203 |
+
FROM {$wpdb->sitemeta}
|
204 |
+
WHERE site_id = %d
|
205 |
+
AND meta_key LIKE %s
|
206 |
+
AND meta_key NOT LIKE %s
|
207 |
+
AND meta_key NOT IN (
|
208 |
+
SELECT CONCAT(%s, SUBSTR(meta_key, %d))
|
209 |
+
FROM {$wpdb->sitemeta}
|
210 |
+
WHERE site_id = %d
|
211 |
+
AND meta_key LIKE %s
|
212 |
+
)
|
213 |
+
",
|
214 |
+
$wpdb->siteid,
|
215 |
+
addcslashes( self::OPTION_PREFIX, '_' ) . '%',
|
216 |
+
addcslashes( self::TIMEOUT_PREFIX, '_' ) . '%',
|
217 |
+
self::OPTION_PREFIX,
|
218 |
+
strlen( self::TIMEOUT_PREFIX ) + 1,
|
219 |
+
$wpdb->siteid,
|
220 |
+
addcslashes( self::TIMEOUT_PREFIX, '_' ) . '%'
|
221 |
+
)
|
222 |
+
);
|
223 |
+
} else {
|
224 |
+
$keys = $wpdb->get_col(
|
225 |
+
$wpdb->prepare( "
|
226 |
+
SELECT option_name
|
227 |
+
FROM $wpdb->options
|
228 |
+
WHERE option_name LIKE %s
|
229 |
+
AND option_name NOT LIKE %s
|
230 |
+
AND option_name NOT IN (
|
231 |
+
SELECT CONCAT(%s, SUBSTR(option_name, %d))
|
232 |
+
FROM $wpdb->options
|
233 |
+
WHERE option_name LIKE %s
|
234 |
+
)
|
235 |
+
",
|
236 |
+
addcslashes( self::OPTION_PREFIX, '_' ) . '%',
|
237 |
+
addcslashes( self::TIMEOUT_PREFIX, '_' ) . '%',
|
238 |
+
self::OPTION_PREFIX,
|
239 |
+
strlen( self::TIMEOUT_PREFIX ) + 1,
|
240 |
+
addcslashes( self::TIMEOUT_PREFIX, '_' ) . '%'
|
241 |
+
)
|
242 |
+
);
|
243 |
+
}
|
244 |
+
|
245 |
+
if ( ! empty( $keys ) ) {
|
246 |
+
$id_start = strlen( self::OPTION_PREFIX );
|
247 |
+
|
248 |
+
foreach ( $keys as $key ) {
|
249 |
+
$ids[] = substr( $key, $id_start );
|
250 |
+
}
|
251 |
+
}
|
252 |
+
|
253 |
+
return $ids;
|
254 |
+
}
|
255 |
+
|
256 |
+
/**
|
257 |
+
* returns count of all migration state records that have timed out.
|
258 |
+
*
|
259 |
+
* @param int $timeout Optional UNIX timestamp for timeout, default of 0 uses current timestamp.
|
260 |
+
*
|
261 |
+
* @return int
|
262 |
+
*/
|
263 |
+
static function cleanup_count( $timeout = 0 ) {
|
264 |
+
return count( self::_timed_out_ids( $timeout ) ) + count( self::_orphaned_ids() );
|
265 |
+
}
|
266 |
+
|
267 |
+
/**
|
268 |
+
* Remove all migration state records that have timed out or are orphaned from their timeout companion.
|
269 |
+
*
|
270 |
+
* @param int $timeout Optional UNIX timestamp for timeout, default of 0 uses current timestamp.
|
271 |
+
*
|
272 |
+
* @return int Count of successfully cleaned up options.
|
273 |
+
*/
|
274 |
+
static function cleanup( $timeout = 0 ) {
|
275 |
+
$count = 0;
|
276 |
+
|
277 |
+
$timed_out_ids = self::_timed_out_ids( $timeout );
|
278 |
+
|
279 |
+
if ( ! empty( $timed_out_ids ) ) {
|
280 |
+
foreach ( $timed_out_ids as $id ) {
|
281 |
+
if ( self::_delete_id( $id ) ) {
|
282 |
+
$count ++;
|
283 |
+
}
|
284 |
+
}
|
285 |
+
}
|
286 |
+
|
287 |
+
$orphaned_ids = self::_orphaned_ids();
|
288 |
+
|
289 |
+
if ( ! empty( $orphaned_ids ) ) {
|
290 |
+
foreach ( $orphaned_ids as $id ) {
|
291 |
+
if ( self::_delete_id( $id ) ) {
|
292 |
+
$count ++;
|
293 |
+
}
|
294 |
+
}
|
295 |
+
}
|
296 |
+
|
297 |
+
return $count;
|
298 |
+
}
|
299 |
+
}
|
@@ -5,16 +5,34 @@ final class WPMDB_Replace {
|
|
5 |
protected $replace;
|
6 |
protected $subdomain_replaces_on;
|
7 |
protected $wpmdb;
|
|
|
|
|
|
|
8 |
|
9 |
private $table;
|
10 |
private $column;
|
11 |
private $row;
|
12 |
|
13 |
-
function __construct( $
|
14 |
-
$
|
15 |
-
|
16 |
-
$
|
17 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
18 |
}
|
19 |
|
20 |
/**
|
@@ -24,7 +42,7 @@ final class WPMDB_Replace {
|
|
24 |
*/
|
25 |
function is_subdomain_replaces_on() {
|
26 |
if ( ! isset( $this->subdomain_replaces_on ) ) {
|
27 |
-
$this->subdomain_replaces_on = ( is_multisite() &&
|
28 |
}
|
29 |
|
30 |
return $this->subdomain_replaces_on;
|
@@ -40,14 +58,12 @@ final class WPMDB_Replace {
|
|
40 |
* @return mixed
|
41 |
*/
|
42 |
function subdomain_replaces( $new ) {
|
43 |
-
|
44 |
-
|
45 |
-
if ( empty( $domain_replace ) ) {
|
46 |
return $new;
|
47 |
}
|
48 |
|
49 |
-
$pattern = '|//(.*?)\\.' . preg_quote( $this->
|
50 |
-
$replacement = '//$1.' . trim( $
|
51 |
$new = preg_replace( $pattern, $replacement, $new );
|
52 |
|
53 |
return $new;
|
@@ -75,19 +91,27 @@ final class WPMDB_Replace {
|
|
75 |
*
|
76 |
* Mostly from https://github.com/interconnectit/Search-Replace-DB
|
77 |
*
|
78 |
-
* @param
|
79 |
-
* @param bool
|
80 |
-
* @param bool
|
|
|
81 |
*
|
82 |
-
* @return
|
83 |
*/
|
84 |
-
function recursive_unserialize_replace( $data, $serialized = false, $parent_serialized = false ) {
|
85 |
$pre = apply_filters( 'wpmdb_pre_recursive_unserialize_replace', false, $data, $this );
|
86 |
if ( false !== $pre ) {
|
87 |
return $pre;
|
88 |
}
|
89 |
|
90 |
-
$is_json
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
91 |
// some unserialized data cannot be re-serialized eg. SimpleXMLElements
|
92 |
try {
|
93 |
if ( is_string( $data ) && ( $unserialized = @unserialize( $data ) ) !== false ) {
|
@@ -98,11 +122,11 @@ final class WPMDB_Replace {
|
|
98 |
return $data;
|
99 |
}
|
100 |
}
|
101 |
-
$data = $this->recursive_unserialize_replace( $unserialized, true, true );
|
102 |
} elseif ( is_array( $data ) ) {
|
103 |
$_tmp = array();
|
104 |
foreach ( $data as $key => $value ) {
|
105 |
-
$_tmp[ $key ] = $this->recursive_unserialize_replace( $value, false, $parent_serialized );
|
106 |
}
|
107 |
|
108 |
$data = $_tmp;
|
@@ -110,7 +134,12 @@ final class WPMDB_Replace {
|
|
110 |
} elseif ( is_object( $data ) ) { // Submitted by Tina Matter
|
111 |
$_tmp = clone $data;
|
112 |
foreach ( $data as $key => $value ) {
|
113 |
-
|
|
|
|
|
|
|
|
|
|
|
114 |
}
|
115 |
|
116 |
$data = $_tmp;
|
@@ -120,7 +149,7 @@ final class WPMDB_Replace {
|
|
120 |
$data = json_decode( $data, true );
|
121 |
|
122 |
foreach ( $data as $key => $value ) {
|
123 |
-
$_tmp[ $key ] = $this->recursive_unserialize_replace( $value, false, $parent_serialized );
|
124 |
}
|
125 |
|
126 |
$data = $_tmp;
|
@@ -134,12 +163,12 @@ final class WPMDB_Replace {
|
|
134 |
}
|
135 |
}
|
136 |
|
137 |
-
if ( $
|
138 |
-
|
139 |
}
|
140 |
|
141 |
-
if ( $
|
142 |
-
|
143 |
}
|
144 |
} catch ( Exception $error ) {
|
145 |
$error_msg = __( 'Failed attempting to do the recursive unserialize replace. Please contact support.', 'wp-migrate-db' );
|
@@ -148,6 +177,10 @@ final class WPMDB_Replace {
|
|
148 |
$this->wpmdb->log_error( $error_msg, $error_details );
|
149 |
}
|
150 |
|
|
|
|
|
|
|
|
|
151 |
return $data;
|
152 |
}
|
153 |
|
@@ -203,11 +236,22 @@ final class WPMDB_Replace {
|
|
203 |
*
|
204 |
* $is_posts = $this->table_is( 'posts' );
|
205 |
*
|
206 |
-
* @param string
|
|
|
207 |
* @return boolean Whether or not the desired table is the table currently being processed.
|
208 |
*/
|
209 |
public function table_is( $desired_table ) {
|
210 |
return $this->wpmdb->table_is( $desired_table, $this->table );
|
211 |
}
|
212 |
|
213 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
protected $replace;
|
6 |
protected $subdomain_replaces_on;
|
7 |
protected $wpmdb;
|
8 |
+
protected $intent;
|
9 |
+
protected $base_domain;
|
10 |
+
protected $site_domain;
|
11 |
|
12 |
private $table;
|
13 |
private $column;
|
14 |
private $row;
|
15 |
|
16 |
+
function __construct( $args ) {
|
17 |
+
$keys = array( 'table', 'search', 'replace', 'intent', 'base_domain', 'site_domain', 'wpmdb' );
|
18 |
+
|
19 |
+
if ( ! is_array( $args ) ) {
|
20 |
+
throw new InvalidArgumentException( 'WPMDB_Replace constructor expects the argument to be an array' );
|
21 |
+
}
|
22 |
+
|
23 |
+
foreach ( $keys as $key ) {
|
24 |
+
if ( ! isset( $args[ $key ] ) ) {
|
25 |
+
throw new InvalidArgumentException( "WPMDB_Replace constructor expects '$key' key to be present in the array argument" );
|
26 |
+
}
|
27 |
+
}
|
28 |
+
|
29 |
+
$this->table = $args['table'];
|
30 |
+
$this->search = $args['search'];
|
31 |
+
$this->replace = $args['replace'];
|
32 |
+
$this->intent = $args['intent'];
|
33 |
+
$this->base_domain = $args['base_domain'];
|
34 |
+
$this->site_domain = $args['site_domain'];
|
35 |
+
$this->wpmdb = $args['wpmdb'];
|
36 |
}
|
37 |
|
38 |
/**
|
42 |
*/
|
43 |
function is_subdomain_replaces_on() {
|
44 |
if ( ! isset( $this->subdomain_replaces_on ) ) {
|
45 |
+
$this->subdomain_replaces_on = ( is_multisite() && is_subdomain_install() && apply_filters( 'wpmdb_subdomain_replace', true ) );
|
46 |
}
|
47 |
|
48 |
return $this->subdomain_replaces_on;
|
58 |
* @return mixed
|
59 |
*/
|
60 |
function subdomain_replaces( $new ) {
|
61 |
+
if ( empty( $this->base_domain ) ) {
|
|
|
|
|
62 |
return $new;
|
63 |
}
|
64 |
|
65 |
+
$pattern = '|//(.*?)\\.' . preg_quote( $this->site_domain, '|' ) . '|';
|
66 |
+
$replacement = '//$1.' . trim( $this->base_domain );
|
67 |
$new = preg_replace( $pattern, $replacement, $new );
|
68 |
|
69 |
return $new;
|
91 |
*
|
92 |
* Mostly from https://github.com/interconnectit/Search-Replace-DB
|
93 |
*
|
94 |
+
* @param mixed $data Used to pass any subordinate arrays back to in.
|
95 |
+
* @param bool $serialized Does the array passed via $data need serialising.
|
96 |
+
* @param bool $parent_serialized Passes whether the original data passed in was serialized
|
97 |
+
* @param bool $filtered Should we apply before and after filters successively
|
98 |
*
|
99 |
+
* @return mixed The original array with all elements replaced as needed.
|
100 |
*/
|
101 |
+
function recursive_unserialize_replace( $data, $serialized = false, $parent_serialized = false, $filtered = true ) {
|
102 |
$pre = apply_filters( 'wpmdb_pre_recursive_unserialize_replace', false, $data, $this );
|
103 |
if ( false !== $pre ) {
|
104 |
return $pre;
|
105 |
}
|
106 |
|
107 |
+
$is_json = false;
|
108 |
+
$before_fired = false;
|
109 |
+
$successive_filter = $filtered;
|
110 |
+
|
111 |
+
if ( true === $filtered ) {
|
112 |
+
list( $data, $before_fired, $successive_filter ) = apply_filters( 'wpmdb_before_replace_custom_data', array( $data, $before_fired, $successive_filter ), $this );
|
113 |
+
}
|
114 |
+
|
115 |
// some unserialized data cannot be re-serialized eg. SimpleXMLElements
|
116 |
try {
|
117 |
if ( is_string( $data ) && ( $unserialized = @unserialize( $data ) ) !== false ) {
|
122 |
return $data;
|
123 |
}
|
124 |
}
|
125 |
+
$data = $this->recursive_unserialize_replace( $unserialized, true, true, $successive_filter );
|
126 |
} elseif ( is_array( $data ) ) {
|
127 |
$_tmp = array();
|
128 |
foreach ( $data as $key => $value ) {
|
129 |
+
$_tmp[ $key ] = $this->recursive_unserialize_replace( $value, false, $parent_serialized, $successive_filter );
|
130 |
}
|
131 |
|
132 |
$data = $_tmp;
|
134 |
} elseif ( is_object( $data ) ) { // Submitted by Tina Matter
|
135 |
$_tmp = clone $data;
|
136 |
foreach ( $data as $key => $value ) {
|
137 |
+
// Integer properties are crazy and the best thing we can do is to just ignore them.
|
138 |
+
// see http://stackoverflow.com/a/10333200 and https://github.com/deliciousbrains/wp-migrate-db-pro/issues/853
|
139 |
+
if ( is_int( $key ) ) {
|
140 |
+
continue;
|
141 |
+
}
|
142 |
+
$_tmp->$key = $this->recursive_unserialize_replace( $value, false, $parent_serialized, $successive_filter );
|
143 |
}
|
144 |
|
145 |
$data = $_tmp;
|
149 |
$data = json_decode( $data, true );
|
150 |
|
151 |
foreach ( $data as $key => $value ) {
|
152 |
+
$_tmp[ $key ] = $this->recursive_unserialize_replace( $value, false, $parent_serialized, $successive_filter );
|
153 |
}
|
154 |
|
155 |
$data = $_tmp;
|
163 |
}
|
164 |
}
|
165 |
|
166 |
+
if ( $is_json ) {
|
167 |
+
$data = json_encode( $data );
|
168 |
}
|
169 |
|
170 |
+
if ( $serialized ) {
|
171 |
+
$data = serialize( $data );
|
172 |
}
|
173 |
} catch ( Exception $error ) {
|
174 |
$error_msg = __( 'Failed attempting to do the recursive unserialize replace. Please contact support.', 'wp-migrate-db' );
|
177 |
$this->wpmdb->log_error( $error_msg, $error_details );
|
178 |
}
|
179 |
|
180 |
+
if ( true === $filtered ) {
|
181 |
+
$data = apply_filters( 'wpmdb_after_replace_custom_data', $data, $before_fired, $this );
|
182 |
+
}
|
183 |
+
|
184 |
return $data;
|
185 |
}
|
186 |
|
236 |
*
|
237 |
* $is_posts = $this->table_is( 'posts' );
|
238 |
*
|
239 |
+
* @param string $desired_table Name of the desired table, table prefix omitted.
|
240 |
+
*
|
241 |
* @return boolean Whether or not the desired table is the table currently being processed.
|
242 |
*/
|
243 |
public function table_is( $desired_table ) {
|
244 |
return $this->wpmdb->table_is( $desired_table, $this->table );
|
245 |
}
|
246 |
|
247 |
+
/**
|
248 |
+
* Intent of the current replace migration.
|
249 |
+
*
|
250 |
+
* Helpful for hookers who need to know what intent they are working on.
|
251 |
+
*
|
252 |
+
* @return string Intent of the current migration
|
253 |
+
*/
|
254 |
+
public function get_intent() {
|
255 |
+
return $this->intent;
|
256 |
+
}
|
257 |
+
}
|
@@ -0,0 +1,158 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
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 |
+
*/
|
13 |
+
static function sanitize_data( $data, $key_rules, $context ) {
|
14 |
+
if ( empty( $data ) || empty( $key_rules ) ) {
|
15 |
+
return $data;
|
16 |
+
}
|
17 |
+
|
18 |
+
return WPMDB_Sanitize::_sanitize_data( $data, $key_rules, $context );
|
19 |
+
}
|
20 |
+
|
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 |
+
*/
|
31 |
+
private static function _sanitize_data( $data, $key_rules, $context, $recursion_level = 0 ) {
|
32 |
+
if ( empty( $data ) || empty( $key_rules ) ) {
|
33 |
+
return $data;
|
34 |
+
}
|
35 |
+
|
36 |
+
if ( 0 === $recursion_level && is_array( $data ) ) {
|
37 |
+
// We always expect associative arrays.
|
38 |
+
if ( ! is_array( $key_rules ) ) {
|
39 |
+
wp_die( sprintf( __( '%1$s was not expecting data to be an array.', 'wp-db-migrate-pro' ), $context ) );
|
40 |
+
|
41 |
+
return false;
|
42 |
+
}
|
43 |
+
foreach ( $data as $key => $value ) {
|
44 |
+
// If a key does not have a rule it's not ours and can be removed.
|
45 |
+
// We should not fail if there is extra data as plugins like Polylang add their own data to each ajax request.
|
46 |
+
if ( ! array_key_exists( $key, $key_rules ) ) {
|
47 |
+
unset( $data[ $key ] );
|
48 |
+
continue;
|
49 |
+
}
|
50 |
+
$data[ $key ] = WPMDB_Sanitize::_sanitize_data( $value, $key_rules[ $key ], $context, ( $recursion_level + 1 ) );
|
51 |
+
}
|
52 |
+
} elseif ( is_array( $key_rules ) ) {
|
53 |
+
foreach ( $key_rules as $rule ) {
|
54 |
+
$data = WPMDB_Sanitize::_sanitize_data( $data, $rule, $context, ( $recursion_level + 1 ) );
|
55 |
+
}
|
56 |
+
} else {
|
57 |
+
// Neither $data or $key_rules are a first level array so can be analysed.
|
58 |
+
if ( 'array' == $key_rules ) {
|
59 |
+
if ( ! is_array( $data ) ) {
|
60 |
+
wp_die( sprintf( __( '%1$s was expecting an array but got something else: "%2$s"', 'wp-db-migrate-pro' ), $context, $data ) );
|
61 |
+
|
62 |
+
return false;
|
63 |
+
}
|
64 |
+
} elseif ( 'string' == $key_rules ) {
|
65 |
+
if ( ! is_string( $data ) ) {
|
66 |
+
wp_die( sprintf( __( '%1$s was expecting a string but got something else: "%2$s"', 'wp-db-migrate-pro' ), $context, $data ) );
|
67 |
+
|
68 |
+
return false;
|
69 |
+
}
|
70 |
+
} elseif ( 'key' == $key_rules ) {
|
71 |
+
$key_name = sanitize_key( $data );
|
72 |
+
if ( $key_name !== $data ) {
|
73 |
+
wp_die( sprintf( __( '%1$s was expecting a valid key but got something else: "%2$s"', 'wp-db-migrate-pro' ), $context, $data ) );
|
74 |
+
|
75 |
+
return false;
|
76 |
+
}
|
77 |
+
$data = $key_name;
|
78 |
+
} elseif ( 'text' == $key_rules ) {
|
79 |
+
$text = sanitize_text_field( $data );
|
80 |
+
if ( $text !== $data ) {
|
81 |
+
wp_die( sprintf( __( '%1$s was expecting text but got something else: "%2$s"', 'wp-db-migrate-pro' ), $context, $data ) );
|
82 |
+
|
83 |
+
return false;
|
84 |
+
}
|
85 |
+
$data = $text;
|
86 |
+
} elseif ( 'serialized' == $key_rules ) {
|
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 ) {
|
93 |
+
if ( ! is_numeric( $data ) ) {
|
94 |
+
wp_die( sprintf( __( '%1$s was expecting a valid numeric but got something else: "%2$s"', 'wp-db-migrate-pro' ), $context, $data ) );
|
95 |
+
|
96 |
+
return false;
|
97 |
+
}
|
98 |
+
} elseif ( 'int' == $key_rules ) {
|
99 |
+
// As we are sanitizing form data, even integers are within a string.
|
100 |
+
if ( ! is_numeric( $data ) || (int) $data != $data ) {
|
101 |
+
wp_die( sprintf( __( '%1$s was expecting an integer but got something else: "%2$s"', 'wp-db-migrate-pro' ), $context, $data ) );
|
102 |
+
|
103 |
+
return false;
|
104 |
+
}
|
105 |
+
$data = (int) $data;
|
106 |
+
} elseif ( 'positive_int' == $key_rules ) {
|
107 |
+
if ( ! is_numeric( $data ) || (int) $data != $data || 0 > $data ) {
|
108 |
+
wp_die( sprintf( __( '%1$s was expecting a positive number (int) but got something else: "%2$s"', 'wp-db-migrate-pro' ), $context, $data ) );
|
109 |
+
|
110 |
+
return false;
|
111 |
+
}
|
112 |
+
$data = floor( $data );
|
113 |
+
} elseif ( 'negative_int' == $key_rules ) {
|
114 |
+
if ( ! is_numeric( $data ) || (int) $data != $data || 0 < $data ) {
|
115 |
+
wp_die( sprintf( __( '%1$s was expecting a negative number (int) but got something else: "%2$s"', 'wp-db-migrate-pro' ), $context, $data ) );
|
116 |
+
|
117 |
+
return false;
|
118 |
+
}
|
119 |
+
$data = ceil( $data );
|
120 |
+
} elseif ( 'zero_int' == $key_rules ) {
|
121 |
+
if ( ! is_numeric( $data ) || (int) $data != $data || 0 !== $data ) {
|
122 |
+
wp_die( sprintf( __( '%1$s was expecting 0 (int) but got something else: "%2$s"', 'wp-db-migrate-pro' ), $context, $data ) );
|
123 |
+
|
124 |
+
return false;
|
125 |
+
}
|
126 |
+
$data = 0;
|
127 |
+
} elseif ( 'empty' == $key_rules ) {
|
128 |
+
if ( ! empty( $data ) ) {
|
129 |
+
wp_die( sprintf( __( '%1$s was expecting an empty value but got something else: "%2$s"', 'wp-db-migrate-pro' ), $context, $data ) );
|
130 |
+
|
131 |
+
return false;
|
132 |
+
}
|
133 |
+
} elseif ( 'url' == $key_rules ) {
|
134 |
+
$url = esc_url_raw( $data );
|
135 |
+
if ( empty( $url ) ) {
|
136 |
+
wp_die( sprintf( __( '%1$s was expecting a URL but got something else: "%2$s"', 'wp-db-migrate-pro' ), $context, $data ) );
|
137 |
+
|
138 |
+
return false;
|
139 |
+
}
|
140 |
+
$data = $url;
|
141 |
+
} elseif ( 'bool' == $key_rules ) {
|
142 |
+
$bool = sanitize_key( $data );
|
143 |
+
if ( empty( $bool ) || ! in_array( $bool, array( 'true', 'false' ) ) ) {
|
144 |
+
wp_die( sprintf( __( '%1$s was expecting a bool but got something else: "%2$s"', 'wp-db-migrate-pro' ), $context, $data ) );
|
145 |
+
|
146 |
+
return false;
|
147 |
+
}
|
148 |
+
$data = $bool;
|
149 |
+
} else {
|
150 |
+
wp_die( sprintf( __( 'Unknown sanitization rule "%1$s" supplied by %2$s', 'wp-db-migrate-pro' ), $key_rules, $context ) );
|
151 |
+
|
152 |
+
return false;
|
153 |
+
}
|
154 |
+
}
|
155 |
+
|
156 |
+
return $data;
|
157 |
+
}
|
158 |
+
}
|
@@ -9,14 +9,11 @@ class WPMDB extends WPMDB_Base {
|
|
9 |
protected $maximum_chunk_size;
|
10 |
protected $current_chunk = '';
|
11 |
protected $connection_details;
|
12 |
-
protected $remote_url;
|
13 |
-
protected $remote_key;
|
14 |
protected $form_data;
|
15 |
protected $max_insert_string_len;
|
16 |
protected $row_tracker;
|
17 |
protected $rows_per_segment = 100;
|
18 |
protected $create_alter_table_query;
|
19 |
-
protected $alter_table_name;
|
20 |
protected $session_salt;
|
21 |
protected $primary_keys;
|
22 |
protected $unhook_templates = array();
|
@@ -43,24 +40,18 @@ class WPMDB extends WPMDB_Base {
|
|
43 |
add_action( 'wp_ajax_wpmdb_initiate_migration', array( $this, 'ajax_initiate_migration' ) );
|
44 |
add_action( 'wp_ajax_wpmdb_migrate_table', array( $this, 'ajax_migrate_table' ) );
|
45 |
add_action( 'wp_ajax_wpmdb_finalize_migration', array( $this, 'ajax_finalize_migration' ) );
|
|
|
|
|
46 |
add_action( 'wp_ajax_wpmdb_clear_log', array( $this, 'ajax_clear_log' ) );
|
47 |
add_action( 'wp_ajax_wpmdb_get_log', array( $this, 'ajax_get_log' ) );
|
48 |
add_action( 'wp_ajax_wpmdb_fire_migration_complete', array( $this, 'fire_migration_complete' ) );
|
49 |
add_action( 'wp_ajax_wpmdb_plugin_compatibility', array( $this, 'ajax_plugin_compatibility' ) );
|
50 |
add_action( 'wp_ajax_wpmdb_blacklist_plugins', array( $this, 'ajax_blacklist_plugins' ) );
|
51 |
add_action( 'wp_ajax_wpmdb_update_max_request_size', array( $this, 'ajax_update_max_request_size' ) );
|
|
|
52 |
add_action( 'wp_ajax_wpmdb_cancel_migration', array( $this, 'ajax_cancel_migration' ) );
|
53 |
|
54 |
-
$
|
55 |
-
$site_url = rtrim( site_url( '', 'http' ), '\\/' );
|
56 |
-
$home_url = rtrim( home_url( '', 'http' ), '\\/' );
|
57 |
-
if ( $site_url != $home_url ) {
|
58 |
-
$difference = str_replace( $home_url, '', $site_url );
|
59 |
-
if ( strpos( $absolute_path, $difference ) !== false ) {
|
60 |
-
$absolute_path = rtrim( substr( $absolute_path, 0, - strlen( $difference ) ), '\\/' );
|
61 |
-
}
|
62 |
-
}
|
63 |
-
$this->absolute_root_file_path = $absolute_path;
|
64 |
|
65 |
$this->accepted_fields = array(
|
66 |
'action',
|
@@ -86,6 +77,7 @@ class WPMDB extends WPMDB_Base {
|
|
86 |
'exclude_post_types',
|
87 |
'exclude_post_revisions',
|
88 |
'compatibility_older_mysql',
|
|
|
89 |
);
|
90 |
|
91 |
$this->default_profile = array(
|
@@ -136,7 +128,7 @@ class WPMDB extends WPMDB_Base {
|
|
136 |
add_action( 'network_admin_menu', array( $this, 'network_admin_menu' ) );
|
137 |
/*
|
138 |
* The URL find & replace is locked down (delete & reorder disabled) on multisite installations as we require the URL
|
139 |
-
* of the remote site for export migrations. This URL is parsed into
|
140 |
* used to change values in the 'domain' & 'path' columns in the wp_blogs and wp_site tables.
|
141 |
*/
|
142 |
$this->lock_url_find_replace_row = true;
|
@@ -145,25 +137,22 @@ class WPMDB extends WPMDB_Base {
|
|
145 |
}
|
146 |
}
|
147 |
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
global $wpdb;
|
154 |
-
$this->alter_table_name = apply_filters( 'wpmdb_alter_table_name', $wpdb->prefix . 'wpmdb_alter_statements' );
|
155 |
-
|
156 |
-
return $this->alter_table_name;
|
157 |
-
}
|
158 |
-
|
159 |
function get_create_alter_table_query() {
|
160 |
if ( ! is_null( $this->create_alter_table_query ) ) {
|
161 |
return $this->create_alter_table_query;
|
162 |
}
|
163 |
|
|
|
|
|
|
|
164 |
$alter_table_name = $this->get_alter_table_name();
|
165 |
-
$this->create_alter_table_query
|
166 |
-
$this->create_alter_table_query .= sprintf( "CREATE TABLE `%s` ( `query`
|
167 |
$this->create_alter_table_query = apply_filters( 'wpmdb_create_alter_table_query', $this->create_alter_table_query );
|
168 |
|
169 |
return $this->create_alter_table_query;
|
@@ -175,61 +164,20 @@ class WPMDB extends WPMDB_Base {
|
|
175 |
return trailingslashit( substr( str_replace( '\\', '/', $short_path ), 1 ) );
|
176 |
}
|
177 |
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
// array(
|
182 |
-
// 'path' => '/path/to/custom/uploads/directory', <- note missing end trailing slash
|
183 |
-
// 'url' => 'http://yourwebsite.com/custom/uploads/directory' <- note missing end trailing slash
|
184 |
-
// );
|
185 |
-
$upload_info = apply_filters( 'wpmdb_upload_info', array() );
|
186 |
-
|
187 |
-
if ( ! empty( $upload_info ) ) {
|
188 |
-
return $upload_info[ $type ];
|
189 |
-
}
|
190 |
-
|
191 |
-
$upload_dir = wp_upload_dir();
|
192 |
-
|
193 |
-
$upload_info['path'] = $upload_dir['basedir'];
|
194 |
-
$upload_info['url'] = $upload_dir['baseurl'];
|
195 |
-
|
196 |
-
$upload_dir_name = apply_filters( 'wpmdb_upload_dir_name', 'wp-migrate-db' );
|
197 |
-
|
198 |
-
if ( ! file_exists( $upload_dir['basedir'] . DIRECTORY_SEPARATOR . $upload_dir_name ) ) {
|
199 |
-
$url = wp_nonce_url( $this->plugin_base, 'wp-migrate-db-pro-nonce' );
|
200 |
-
|
201 |
-
// TODO: Do not silence errors, use wp_mkdir_p?
|
202 |
-
if ( false === @mkdir( $upload_dir['basedir'] . DIRECTORY_SEPARATOR . $upload_dir_name, 0755 ) ) {
|
203 |
-
return $upload_info[ $type ];
|
204 |
-
}
|
205 |
-
|
206 |
-
$filename = $upload_dir['basedir'] . DIRECTORY_SEPARATOR . $upload_dir_name . DIRECTORY_SEPARATOR . 'index.php';
|
207 |
-
// TODO: Do not silence errors, use WP_Filesystem API?
|
208 |
-
if ( false === @file_put_contents( $filename, "<?php\r\n// Silence is golden\r\n?>" ) ) {
|
209 |
-
return $upload_info[ $type ];
|
210 |
-
}
|
211 |
-
}
|
212 |
-
|
213 |
-
$htaccess = $upload_dir['basedir'] . DIRECTORY_SEPARATOR . $upload_dir_name . DIRECTORY_SEPARATOR . '.htaccess';
|
214 |
-
if ( ! file_exists( $htaccess ) ) {
|
215 |
-
// TODO: Do not silence errors, use WP_Filesystem API?
|
216 |
-
if ( false === @file_put_contents( $htaccess, "Options -Indexes\r\nDeny from all" ) ) {
|
217 |
-
return $upload_info[ $type ];
|
218 |
-
}
|
219 |
-
}
|
220 |
-
|
221 |
-
$upload_info['path'] .= DIRECTORY_SEPARATOR . $upload_dir_name;
|
222 |
-
$upload_info['url'] .= '/' . $upload_dir_name;
|
223 |
-
|
224 |
-
return $upload_info[ $type ];
|
225 |
-
}
|
226 |
-
|
227 |
function ajax_plugin_compatibility() {
|
228 |
-
$
|
|
|
|
|
|
|
|
|
|
|
229 |
$mu_dir = ( defined( 'WPMU_PLUGIN_DIR' ) && defined( 'WPMU_PLUGIN_URL' ) ) ? WPMU_PLUGIN_DIR : trailingslashit( WP_CONTENT_DIR ) . 'mu-plugins';
|
230 |
$source = trailingslashit( $this->plugin_dir_path ) . 'compatibility/wp-migrate-db-pro-compatibility.php';
|
231 |
$dest = trailingslashit( $mu_dir ) . 'wp-migrate-db-pro-compatibility.php';
|
232 |
-
if ( '1' === trim( $this->
|
233 |
if ( ! wp_mkdir_p( $mu_dir ) ) {
|
234 |
printf( esc_html__( 'The following directory could not be created: %s', 'wp-migrate-db' ), $mu_dir );
|
235 |
exit;
|
@@ -249,21 +197,59 @@ class WPMDB extends WPMDB_Base {
|
|
249 |
exit;
|
250 |
}
|
251 |
|
|
|
|
|
|
|
252 |
function ajax_blacklist_plugins() {
|
253 |
-
$
|
254 |
-
|
|
|
|
|
|
|
|
|
|
|
255 |
update_site_option( 'wpmdb_settings', $this->settings );
|
256 |
exit;
|
257 |
}
|
258 |
|
|
|
|
|
|
|
|
|
|
|
259 |
function ajax_update_max_request_size() {
|
260 |
$this->check_ajax_referer( 'update-max-request-size' );
|
261 |
-
$this->set_post_data();
|
262 |
-
$this->settings['max_request'] = (int) $this->post_data['max_request_size'] * 1024;
|
263 |
-
update_site_option( 'wpmdb_settings', $this->settings );
|
264 |
-
$result = $this->end_ajax();
|
265 |
|
266 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
267 |
}
|
268 |
|
269 |
function is_json( $string, $strict = false ) {
|
@@ -279,9 +265,10 @@ class WPMDB extends WPMDB_Base {
|
|
279 |
if ( empty( $this->session_salt ) ) {
|
280 |
$this->session_salt = strtolower( wp_generate_password( 5, false, false ) );
|
281 |
}
|
282 |
-
$datetime
|
283 |
-
$ds
|
284 |
$dump_info = sprintf( '%s%s%s-%s-%s-%s.sql', $this->get_upload_info( $info_type ), $ds, sanitize_title_with_dashes( DB_NAME ), $migration_type, $datetime, $this->session_salt );
|
|
|
285 |
return ( $info_type == 'path' ? $this->slash_one_direction( $dump_info ) : $dump_info );
|
286 |
}
|
287 |
|
@@ -300,7 +287,7 @@ class WPMDB extends WPMDB_Base {
|
|
300 |
$form_data = wp_unslash( $form_data );
|
301 |
}
|
302 |
$this->accepted_fields = apply_filters( 'wpmdb_accepted_profile_fields', $this->accepted_fields );
|
303 |
-
$form_data
|
304 |
unset( $form_data['replace_old'][0] );
|
305 |
unset( $form_data['replace_new'][0] );
|
306 |
|
@@ -321,8 +308,30 @@ class WPMDB extends WPMDB_Base {
|
|
321 |
return $form_data;
|
322 |
}
|
323 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
324 |
function plugin_action_links( $links ) {
|
325 |
-
$link = sprintf( '<a href="%s">%s</a>', network_admin_url( $this->plugin_base ), _x( 'Settings', 'Plugin configuration and preferences', 'wp-migrate-db' ) );
|
326 |
array_unshift( $links, $link );
|
327 |
|
328 |
return $links;
|
@@ -354,6 +363,25 @@ class WPMDB extends WPMDB_Base {
|
|
354 |
}
|
355 |
}
|
356 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
357 |
function output_diagnostic_info() {
|
358 |
global $table_prefix;
|
359 |
global $wpdb;
|
@@ -366,13 +394,19 @@ class WPMDB extends WPMDB_Base {
|
|
366 |
echo esc_html( home_url() );
|
367 |
echo "\r\n";
|
368 |
|
|
|
|
|
|
|
|
|
369 |
echo 'Table Prefix: ';
|
370 |
echo esc_html( $table_prefix );
|
371 |
echo "\r\n";
|
372 |
|
373 |
echo 'WordPress: ';
|
374 |
echo bloginfo( 'version' );
|
375 |
-
|
|
|
|
|
376 |
echo "\r\n";
|
377 |
|
378 |
echo 'Web Server: ';
|
@@ -397,6 +431,20 @@ class WPMDB extends WPMDB_Base {
|
|
397 |
echo esc_html( WP_MEMORY_LIMIT );
|
398 |
echo "\r\n";
|
399 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
400 |
echo 'WPMDB Bottleneck: ';
|
401 |
echo esc_html( size_format( $this->get_bottleneck() ) );
|
402 |
echo "\r\n";
|
@@ -483,15 +531,19 @@ class WPMDB extends WPMDB_Base {
|
|
483 |
} else {
|
484 |
echo 'No';
|
485 |
}
|
486 |
-
echo "\r\n";
|
487 |
-
|
|
|
|
|
|
|
|
|
488 |
|
489 |
echo "Active Plugins:\r\n";
|
490 |
|
491 |
if ( isset( $GLOBALS['wpmdb_compatibility'] ) ) {
|
492 |
remove_filter( 'option_active_plugins', 'wpmdbc_exclude_plugins' );
|
493 |
remove_filter( 'site_option_active_sitewide_plugins', 'wpmdbc_exclude_site_plugins' );
|
494 |
-
$blacklist = array_flip( $this->settings['blacklist_plugins'] );
|
495 |
} else {
|
496 |
$blacklist = array();
|
497 |
}
|
@@ -500,7 +552,7 @@ class WPMDB extends WPMDB_Base {
|
|
500 |
|
501 |
if ( is_multisite() ) {
|
502 |
$network_active_plugins = wp_get_active_network_plugins();
|
503 |
-
$active_plugins
|
504 |
}
|
505 |
|
506 |
foreach ( $active_plugins as $plugin ) {
|
@@ -523,10 +575,6 @@ class WPMDB extends WPMDB_Base {
|
|
523 |
$this->print_plugin_details( $mu_plugin );
|
524 |
}
|
525 |
}
|
526 |
-
|
527 |
-
echo "\r\n";
|
528 |
-
|
529 |
-
do_action( 'wpmdb_diagnostic_info' );
|
530 |
}
|
531 |
|
532 |
function print_plugin_details( $plugin_path, $suffix = '' ) {
|
@@ -551,7 +599,7 @@ class WPMDB extends WPMDB_Base {
|
|
551 |
$alter_queries = $wpdb->get_results( "SELECT * FROM `{$alter_table_name}`", ARRAY_A );
|
552 |
if ( ! empty( $alter_queries ) ) {
|
553 |
foreach ( $alter_queries as $alter_query ) {
|
554 |
-
$sql .= $alter_query['query'];
|
555 |
}
|
556 |
}
|
557 |
|
@@ -570,7 +618,7 @@ class WPMDB extends WPMDB_Base {
|
|
570 |
$wpdb->show_errors();
|
571 |
|
572 |
if ( empty( $wpdb->charset ) ) {
|
573 |
-
$charset
|
574 |
$wpdb->charset = $charset;
|
575 |
$wpdb->set_charset( $wpdb->dbh, $wpdb->charset );
|
576 |
}
|
@@ -578,7 +626,8 @@ class WPMDB extends WPMDB_Base {
|
|
578 |
foreach ( $queries as $query ) {
|
579 |
if ( false === $wpdb->query( $query ) ) {
|
580 |
$return = ob_get_clean();
|
581 |
-
$
|
|
|
582 |
|
583 |
return $result;
|
584 |
}
|
@@ -594,19 +643,41 @@ class WPMDB extends WPMDB_Base {
|
|
594 |
*/
|
595 |
function ajax_migrate_table() {
|
596 |
$this->check_ajax_referer( 'migrate-table' );
|
597 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
598 |
global $wpdb;
|
599 |
|
600 |
-
$this->form_data = $this->parse_migration_form_data( $this->
|
601 |
|
602 |
$result = '';
|
603 |
|
604 |
// checks if we're performing a backup, if so, continue with the backup and exit immediately after
|
605 |
-
if ( $this->
|
|
|
|
|
|
|
|
|
|
|
606 |
// if performing a push we need to backup the REMOTE machine's DB
|
607 |
-
if ( $this->
|
608 |
-
$data
|
609 |
-
$this->
|
610 |
array(
|
611 |
'action',
|
612 |
'intent',
|
@@ -628,13 +699,19 @@ class WPMDB extends WPMDB_Base {
|
|
628 |
);
|
629 |
$data['action'] = 'wpmdb_backup_remote_table';
|
630 |
$data['intent'] = 'pull';
|
631 |
-
$ajax_url =
|
632 |
$data['sig'] = $this->create_signature( $data, $data['key'] );
|
633 |
$response = $this->remote_post( $ajax_url, $data, __FUNCTION__ );
|
634 |
ob_start();
|
635 |
$this->display_errors();
|
636 |
-
$
|
637 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
638 |
} else {
|
639 |
$return = $this->handle_table_backup();
|
640 |
}
|
@@ -645,33 +722,28 @@ class WPMDB extends WPMDB_Base {
|
|
645 |
}
|
646 |
|
647 |
// Pull and push need to be handled differently for obvious reasons, trigger different code depending on the migration intent (push or pull)
|
648 |
-
if ( $this->
|
649 |
$this->maximum_chunk_size = $this->get_bottleneck();
|
650 |
|
651 |
-
if ( isset( $this->
|
652 |
-
$this->maximum_chunk_size = (int) $this->
|
653 |
-
}
|
654 |
-
|
655 |
-
if ( $this->post_data['intent'] == 'push' ) {
|
656 |
-
$this->remote_key = $this->post_data['key'];
|
657 |
-
$this->remote_url = $this->post_data['url'];
|
658 |
}
|
659 |
|
660 |
$sql_dump_file_name = $this->get_upload_info( 'path' ) . DIRECTORY_SEPARATOR;
|
661 |
-
$sql_dump_file_name .= $this->format_dump_name( $this->
|
662 |
|
663 |
-
if ( $this->
|
664 |
$this->fp = $this->open( $sql_dump_file_name );
|
665 |
}
|
666 |
|
667 |
$db_version = '';
|
668 |
-
if ( ! empty( $this->
|
669 |
-
$db_version = $this->
|
670 |
|
671 |
-
if ( 'push' == $this->
|
672 |
// $db_version has been set to remote database's version.
|
673 |
add_filter( 'wpmdb_create_table_query', array( $this, 'mysql_compat_filter' ), 10, 3 );
|
674 |
-
} elseif ( 'savefile' == $this->
|
675 |
// compatibility_older_mysql is currently a checkbox meaning pre-5.5 compatibility (we play safe and target 5.1),
|
676 |
// this may change in the future to be a dropdown or radiobox returning the version to be compatible with.
|
677 |
$db_version = '5.1';
|
@@ -679,29 +751,30 @@ class WPMDB extends WPMDB_Base {
|
|
679 |
}
|
680 |
}
|
681 |
|
682 |
-
if ( ! empty( $this->
|
683 |
-
$this->find_replace_pairs = $this->
|
684 |
}
|
685 |
|
686 |
-
|
|
|
687 |
|
688 |
-
if ( $this->
|
689 |
$this->close( $this->fp );
|
690 |
}
|
691 |
|
692 |
-
ob_start();
|
693 |
$this->display_errors();
|
694 |
$maybe_errors = trim( ob_get_clean() );
|
695 |
if ( false === empty( $maybe_errors ) ) {
|
696 |
-
$
|
|
|
697 |
|
698 |
return $result;
|
699 |
}
|
700 |
|
701 |
return $result;
|
702 |
} else {
|
703 |
-
$data
|
704 |
-
$data['action']
|
705 |
$data['pull_limit'] = $this->get_sensible_pull_limit();
|
706 |
$data['db_version'] = $wpdb->db_version();
|
707 |
|
@@ -720,7 +793,7 @@ class WPMDB extends WPMDB_Base {
|
|
720 |
$data['find_replace_pairs'] = serialize( $data['find_replace_pairs'] );
|
721 |
}
|
722 |
|
723 |
-
$ajax_url
|
724 |
$data['sig'] = $this->create_signature( $data, $data['key'] );
|
725 |
|
726 |
$response = $this->remote_post( $ajax_url, $data, __FUNCTION__ );
|
@@ -729,7 +802,8 @@ class WPMDB extends WPMDB_Base {
|
|
729 |
$maybe_errors = trim( ob_get_clean() );
|
730 |
|
731 |
if ( false === empty( $maybe_errors ) ) {
|
732 |
-
$
|
|
|
733 |
|
734 |
return $result;
|
735 |
}
|
@@ -755,12 +829,12 @@ class WPMDB extends WPMDB_Base {
|
|
755 |
}
|
756 |
}
|
757 |
|
758 |
-
$result =
|
759 |
-
|
760 |
-
|
761 |
-
|
762 |
-
|
763 |
-
) );
|
764 |
}
|
765 |
|
766 |
return $result;
|
@@ -775,11 +849,27 @@ class WPMDB extends WPMDB_Base {
|
|
775 |
*/
|
776 |
function ajax_initiate_migration() {
|
777 |
global $wpdb;
|
|
|
778 |
$this->check_ajax_referer( 'initiate-migration' );
|
779 |
-
$this->set_post_data();
|
780 |
-
$this->form_data = $this->parse_migration_form_data( $this->post_data['form_data'] );
|
781 |
|
782 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
783 |
$return = array(
|
784 |
'code' => 200,
|
785 |
'message' => 'OK',
|
@@ -801,7 +891,7 @@ class WPMDB extends WPMDB_Base {
|
|
801 |
return $result;
|
802 |
}
|
803 |
|
804 |
-
if ( $this->gzip() && isset( $this->form_data['gzip_file'] ) ) {
|
805 |
$return['dump_path'] .= '.gz';
|
806 |
$return['dump_filename'] .= '.gz';
|
807 |
$return['dump_url'] .= '.gz';
|
@@ -815,12 +905,12 @@ class WPMDB extends WPMDB_Base {
|
|
815 |
} else { // does one last check that our verification string is valid
|
816 |
$data = array(
|
817 |
'action' => 'wpmdb_remote_initiate_migration',
|
818 |
-
'intent' => $this->
|
819 |
-
'form_data' => $this->
|
820 |
);
|
821 |
|
822 |
-
$data['sig'] = $this->create_signature( $data, $this->
|
823 |
-
$ajax_url =
|
824 |
$response = $this->remote_post( $ajax_url, $data, __FUNCTION__ );
|
825 |
|
826 |
if ( false === $response ) {
|
@@ -834,7 +924,7 @@ class WPMDB extends WPMDB_Base {
|
|
834 |
|
835 |
if ( false === $return ) {
|
836 |
$error_msg = __( 'Failed attempting to unserialize the response from the remote server. Please contact support.', 'wp-migrate-db' );
|
837 |
-
$return
|
838 |
$this->log_error( $error_msg, $response );
|
839 |
$result = $this->end_ajax( json_encode( $return ) );
|
840 |
|
@@ -848,7 +938,7 @@ class WPMDB extends WPMDB_Base {
|
|
848 |
return $result;
|
849 |
}
|
850 |
|
851 |
-
if ( $this->
|
852 |
// sets up our table to store 'ALTER' queries
|
853 |
$create_alter_table_query = $this->get_create_alter_table_query();
|
854 |
$process_chunk_result = $this->process_chunk( $create_alter_table_query );
|
@@ -859,7 +949,7 @@ class WPMDB extends WPMDB_Base {
|
|
859 |
}
|
860 |
}
|
861 |
|
862 |
-
if ( ! empty( $this->form_data['create_backup'] ) && $this->
|
863 |
$return['dump_filename'] = basename( $this->get_sql_dump_info( 'backup', 'path' ) );
|
864 |
$return['dump_filename'] = substr( $return['dump_filename'], 0, - 4 );
|
865 |
$return['dump_url'] = $this->get_sql_dump_info( 'backup', 'url' );
|
@@ -877,26 +967,44 @@ class WPMDB extends WPMDB_Base {
|
|
877 |
// Otherwise ensure it is set with own site_url so that we always return one.
|
878 |
$return['site_url'] = ( empty( $return['site_url'] ) ) ? site_url() : $return['site_url'];
|
879 |
|
880 |
-
$return['find_replace_pairs'] = $this->parse_find_replace_pairs( $this->
|
|
|
|
|
|
|
|
|
|
|
|
|
881 |
|
882 |
$result = $this->end_ajax( json_encode( $return ) );
|
883 |
|
884 |
return $result;
|
885 |
}
|
886 |
|
|
|
|
|
|
|
|
|
|
|
887 |
function ajax_save_profile() {
|
888 |
$this->check_ajax_referer( 'save-profile' );
|
889 |
-
|
890 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
891 |
$profile = wp_parse_args( $profile, $this->checkbox_options );
|
892 |
|
893 |
if ( isset( $profile['save_migration_profile_option'] ) && $profile['save_migration_profile_option'] == 'new' ) {
|
894 |
-
$profile['name']
|
895 |
$this->settings['profiles'][] = $profile;
|
896 |
} else {
|
897 |
-
$key
|
898 |
-
$name
|
899 |
-
$this->settings['profiles'][ $key ]
|
900 |
$this->settings['profiles'][ $key ]['name'] = $name;
|
901 |
}
|
902 |
|
@@ -908,10 +1016,22 @@ class WPMDB extends WPMDB_Base {
|
|
908 |
return $result;
|
909 |
}
|
910 |
|
|
|
|
|
|
|
|
|
|
|
911 |
function ajax_delete_migration_profile() {
|
912 |
$this->check_ajax_referer( 'delete-migration-profile' );
|
913 |
-
|
914 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
915 |
-- $key;
|
916 |
$return = '';
|
917 |
|
@@ -933,14 +1053,21 @@ class WPMDB extends WPMDB_Base {
|
|
933 |
return size_format( $size );
|
934 |
}
|
935 |
|
|
|
|
|
|
|
|
|
|
|
936 |
function get_post_types() {
|
937 |
global $wpdb;
|
938 |
|
939 |
if ( is_multisite() ) {
|
940 |
-
$tables
|
941 |
-
$sql
|
|
|
|
|
942 |
foreach ( $tables as $table ) {
|
943 |
-
if ( 0 == preg_match( '/' . $
|
944 |
continue;
|
945 |
}
|
946 |
$blog_id = str_replace( array( $wpdb->prefix, '_posts' ), array( '', '' ), $table );
|
@@ -977,16 +1104,24 @@ class WPMDB extends WPMDB_Base {
|
|
977 |
return $this->settings['profiles'][ $profile_id ];
|
978 |
}
|
979 |
|
|
|
|
|
|
|
|
|
|
|
980 |
function get_table_row_count() {
|
981 |
global $wpdb;
|
982 |
|
983 |
-
$sql = $wpdb->prepare( 'SELECT table_name, TABLE_ROWS FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = %s', DB_NAME );
|
984 |
$results = $wpdb->get_results( $sql, ARRAY_A );
|
985 |
|
986 |
$return = array();
|
987 |
|
988 |
-
foreach ( $results as $
|
989 |
-
|
|
|
|
|
|
|
990 |
}
|
991 |
|
992 |
return $return;
|
@@ -1013,9 +1148,10 @@ class WPMDB extends WPMDB_Base {
|
|
1013 |
$sql = $wpdb->prepare(
|
1014 |
"SELECT TABLE_NAME AS 'table',
|
1015 |
ROUND( ( data_length + index_length ) / 1024, 0 ) AS 'size'
|
1016 |
-
FROM
|
1017 |
-
WHERE
|
1018 |
-
AND
|
|
|
1019 |
DB_NAME,
|
1020 |
'BASE TABLE'
|
1021 |
);
|
@@ -1024,6 +1160,9 @@ class WPMDB extends WPMDB_Base {
|
|
1024 |
|
1025 |
if ( ! empty( $results ) ) {
|
1026 |
foreach ( $results as $result ) {
|
|
|
|
|
|
|
1027 |
$return[ $result['table'] ] = $result['size'];
|
1028 |
}
|
1029 |
}
|
@@ -1036,7 +1175,7 @@ class WPMDB extends WPMDB_Base {
|
|
1036 |
$extension = '.sql';
|
1037 |
$dump_name = sanitize_file_name( $dump_name );
|
1038 |
|
1039 |
-
if ( $this->gzip() && isset( $this->form_data['gzip_file'] ) ) {
|
1040 |
$extension .= '.gz';
|
1041 |
}
|
1042 |
|
@@ -1056,12 +1195,17 @@ class WPMDB extends WPMDB_Base {
|
|
1056 |
$this->set_post_data();
|
1057 |
|
1058 |
if ( ! isset( $this->domain_replace ) ) {
|
1059 |
-
if ( ! empty( $this->
|
1060 |
-
$this->domain_replace = $this->
|
1061 |
-
} elseif ( ! empty
|
1062 |
$url = $this->form_data['replace_new'][1];
|
1063 |
-
$url =
|
1064 |
-
|
|
|
|
|
|
|
|
|
|
|
1065 |
} else {
|
1066 |
$this->domain_replace = false;
|
1067 |
}
|
@@ -1148,14 +1292,14 @@ class WPMDB extends WPMDB_Base {
|
|
1148 |
$sql_constraints_query .= ";\n";
|
1149 |
|
1150 |
$create_query = implode(
|
1151 |
-
|
1152 |
-
|
1153 |
-
|
1154 |
-
|
1155 |
-
|
1156 |
-
|
1157 |
-
|
1158 |
-
|
1159 |
unset( $sql_lines );
|
1160 |
|
1161 |
$alter_table_query = $sql_constraints_query;
|
@@ -1185,23 +1329,31 @@ class WPMDB extends WPMDB_Base {
|
|
1185 |
$this->set_post_data();
|
1186 |
|
1187 |
if ( empty( $this->form_data ) ) {
|
1188 |
-
$this->form_data = $this->parse_migration_form_data( $this->
|
1189 |
}
|
1190 |
|
1191 |
-
$temp_prefix = $this->temp_prefix;
|
1192 |
-
$remote_prefix = ( isset( $this->
|
1193 |
|
1194 |
$table_structure = $wpdb->get_results( 'DESCRIBE ' . $this->backquote( $table ) );
|
1195 |
|
1196 |
if ( ! $table_structure ) {
|
1197 |
$this->error = __( 'Failed to retrieve table structure, please ensure your database is online. (#125)', 'wp-migrate-db' );
|
|
|
1198 |
return false;
|
1199 |
}
|
1200 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1201 |
$current_row = - 1;
|
1202 |
|
1203 |
-
if ( ! empty( $this->
|
1204 |
-
$temp_current_row = trim( $this->
|
1205 |
if ( ! empty( $temp_current_row ) ) {
|
1206 |
$current_row = (int) $temp_current_row;
|
1207 |
}
|
@@ -1209,23 +1361,21 @@ class WPMDB extends WPMDB_Base {
|
|
1209 |
|
1210 |
if ( $current_row == - 1 ) {
|
1211 |
// Add SQL statement to drop existing table
|
1212 |
-
if ( $this->form_data['action'] == 'savefile' || $this->
|
1213 |
$this->stow( "\n\n" );
|
1214 |
$this->stow( "#\n" );
|
1215 |
-
$this->stow( '# ' . sprintf( __( 'Delete any existing table %s', 'wp-migrate-db' ), $this->backquote( $
|
1216 |
$this->stow( "#\n" );
|
1217 |
$this->stow( "\n" );
|
1218 |
-
$this->stow( 'DROP TABLE IF EXISTS ' . $this->backquote( $table ) . ";\n" );
|
1219 |
-
} else {
|
1220 |
-
$this->stow( 'DROP TABLE IF EXISTS ' . $this->backquote( $temp_prefix . $table ) . ";\n" );
|
1221 |
}
|
|
|
1222 |
|
1223 |
// Table structure
|
1224 |
// Comment in SQL-file
|
1225 |
-
if ( $this->form_data['action'] == 'savefile' || $this->
|
1226 |
$this->stow( "\n\n" );
|
1227 |
$this->stow( "#\n" );
|
1228 |
-
$this->stow( '# ' . sprintf( __( 'Table structure of table %s', 'wp-migrate-db' ), $this->backquote( $
|
1229 |
$this->stow( "#\n" );
|
1230 |
$this->stow( "\n" );
|
1231 |
}
|
@@ -1234,26 +1384,45 @@ class WPMDB extends WPMDB_Base {
|
|
1234 |
|
1235 |
if ( false === $create_table ) {
|
1236 |
$this->error = __( 'Failed to generate the create table query, please ensure your database is online. (#126)', 'wp-migrate-db' );
|
1237 |
-
return false;
|
1238 |
-
}
|
1239 |
|
1240 |
-
|
1241 |
-
$create_table[0][1] = str_replace( 'CREATE TABLE `', 'CREATE TABLE `' . $temp_prefix, $create_table[0][1] );
|
1242 |
}
|
|
|
1243 |
|
1244 |
$create_table[0][1] = str_replace( 'TYPE=', 'ENGINE=', $create_table[0][1] );
|
1245 |
|
1246 |
$alter_table_query = '';
|
1247 |
-
$create_table[0][1] = $this->process_sql_constraint( $create_table[0][1], $
|
1248 |
|
1249 |
-
$create_table[0][1] = apply_filters( 'wpmdb_create_table_query', $create_table[0][1], $
|
1250 |
|
1251 |
$this->stow( $create_table[0][1] . ";\n" );
|
1252 |
|
1253 |
if ( ! empty( $alter_table_query ) ) {
|
1254 |
$alter_table_name = $this->get_alter_table_name();
|
1255 |
-
$insert
|
1256 |
-
if ( $this->form_data['action'] == 'savefile' || $this->
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1257 |
$process_chunk_result = $this->process_chunk( $insert );
|
1258 |
if ( true !== $process_chunk_result ) {
|
1259 |
$result = $this->end_ajax( $process_chunk_result );
|
@@ -1266,10 +1435,10 @@ class WPMDB extends WPMDB_Base {
|
|
1266 |
}
|
1267 |
|
1268 |
// Comment in SQL-file
|
1269 |
-
if ( $this->form_data['action'] == 'savefile' || $this->
|
1270 |
$this->stow( "\n\n" );
|
1271 |
$this->stow( "#\n" );
|
1272 |
-
$this->stow( '# ' . sprintf( __( 'Data contents of table %s', 'wp-migrate-db' ), $this->backquote( $
|
1273 |
$this->stow( "#\n" );
|
1274 |
}
|
1275 |
}
|
@@ -1280,10 +1449,10 @@ class WPMDB extends WPMDB_Base {
|
|
1280 |
$ints = array();
|
1281 |
foreach ( $table_structure as $struct ) {
|
1282 |
if ( ( 0 === strpos( $struct->Type, 'tinyint' ) ) ||
|
1283 |
-
|
1284 |
-
|
1285 |
-
|
1286 |
-
|
1287 |
) {
|
1288 |
$defs[ strtolower( $struct->Field ) ] = ( null === $struct->Default ) ? 'NULL' : $struct->Default;
|
1289 |
$ints[ strtolower( $struct->Field ) ] = '1';
|
@@ -1306,12 +1475,6 @@ class WPMDB extends WPMDB_Base {
|
|
1306 |
|
1307 |
$query_size = 0;
|
1308 |
|
1309 |
-
$table_name = $table;
|
1310 |
-
|
1311 |
-
if ( $this->form_data['action'] != 'savefile' && $this->post_data['stage'] != 'backup' ) {
|
1312 |
-
$table_name = $temp_prefix . $table;
|
1313 |
-
}
|
1314 |
-
|
1315 |
$this->primary_keys = array();
|
1316 |
$field_set = array();
|
1317 |
$use_primary_keys = true;
|
@@ -1329,10 +1492,10 @@ class WPMDB extends WPMDB_Base {
|
|
1329 |
}
|
1330 |
|
1331 |
$first_select = true;
|
1332 |
-
if ( ! empty( $this->
|
1333 |
-
$this->
|
1334 |
-
if ( ! empty( $this->
|
1335 |
-
$this->primary_keys = unserialize( $this->
|
1336 |
$first_select = false;
|
1337 |
}
|
1338 |
}
|
@@ -1347,7 +1510,7 @@ class WPMDB extends WPMDB_Base {
|
|
1347 |
$order_by = '';
|
1348 |
// We need ORDER BY here because with LIMIT, sometimes it will return
|
1349 |
// the same results from the previous query and we'll have duplicate insert statements
|
1350 |
-
if ( 'backup' != $this->
|
1351 |
if ( $this->table_is( 'comments', $table ) ) {
|
1352 |
$where .= ' AND comment_approved != "spam"';
|
1353 |
} elseif ( $this->table_is( 'commentmeta', $table ) ) {
|
@@ -1357,7 +1520,7 @@ class WPMDB extends WPMDB_Base {
|
|
1357 |
}
|
1358 |
}
|
1359 |
|
1360 |
-
if ( 'backup' != $this->
|
1361 |
$post_types = '\'' . implode( '\', \'', $this->form_data['select_post_types'] ) . '\'';
|
1362 |
if ( $this->table_is( 'posts', $table ) ) {
|
1363 |
$where .= ' AND `post_type` NOT IN ( ' . $post_types . ' )';
|
@@ -1377,7 +1540,7 @@ class WPMDB extends WPMDB_Base {
|
|
1377 |
}
|
1378 |
}
|
1379 |
|
1380 |
-
if ( 'backup' != $this->
|
1381 |
$col_name = 'option_name';
|
1382 |
|
1383 |
if ( isset( $wpdb->sitemeta ) && $wpdb->sitemeta == $table ) {
|
@@ -1388,7 +1551,7 @@ class WPMDB extends WPMDB_Base {
|
|
1388 |
}
|
1389 |
|
1390 |
// don't export/migrate wpmdb specific option rows unless we're performing a backup
|
1391 |
-
if ( 'backup' != $this->
|
1392 |
$col_name = 'option_name';
|
1393 |
|
1394 |
if ( isset( $wpdb->sitemeta ) && $wpdb->sitemeta == $table ) {
|
@@ -1398,6 +1561,7 @@ class WPMDB extends WPMDB_Base {
|
|
1398 |
$where .= " AND `{$col_name}` != 'wpmdb_settings'";
|
1399 |
$where .= " AND `{$col_name}` != 'wpmdb_error_log'";
|
1400 |
$where .= " AND `{$col_name}` != 'wpmdb_schema_version'";
|
|
|
1401 |
}
|
1402 |
|
1403 |
$limit = "LIMIT {$row_start}, {$row_inc}";
|
@@ -1424,9 +1588,9 @@ class WPMDB extends WPMDB_Base {
|
|
1424 |
$i = 0;
|
1425 |
foreach ( $temp_primary_keys as $primary_key => $value ) {
|
1426 |
// only the last field in the key should be different in this subclause
|
1427 |
-
$operator
|
1428 |
$subclauses[] = sprintf( '%s %s %s', $this->backquote( $primary_key ), $operator, $wpdb->prepare( '%s', $value ) );
|
1429 |
-
|
1430 |
}
|
1431 |
|
1432 |
// remove last field from array to reduce fields in next clause
|
@@ -1456,83 +1620,101 @@ class WPMDB extends WPMDB_Base {
|
|
1456 |
$table_data = $wpdb->get_results( $sql );
|
1457 |
|
1458 |
if ( $table_data ) {
|
1459 |
-
$to_search
|
1460 |
-
$to_replace
|
1461 |
-
$replacer
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1462 |
|
1463 |
foreach ( $table_data as $row ) {
|
1464 |
-
$
|
1465 |
-
$values = array();
|
1466 |
-
foreach ( $row as $key => $value ) {
|
1467 |
-
$replacer->set_column( $key );
|
1468 |
-
|
1469 |
-
if ( isset( $ints[strtolower( $key )] ) && $ints[strtolower( $key )] ) {
|
1470 |
-
// make sure there are no blank spots in the insert syntax,
|
1471 |
-
// yet try to avoid quotation marks around integers
|
1472 |
-
$value = ( null === $value || '' === $value ) ? $defs[ strtolower( $key ) ] : $value;
|
1473 |
-
$values[] = ( '' === $value ) ? "''" : $value;
|
1474 |
-
continue;
|
1475 |
-
}
|
1476 |
-
|
1477 |
-
if ( null === $value ) {
|
1478 |
-
$values[] = 'NULL';
|
1479 |
-
continue;
|
1480 |
-
}
|
1481 |
|
1482 |
-
|
1483 |
-
|
1484 |
-
|
1485 |
|
1486 |
-
|
1487 |
-
|
1488 |
-
|
1489 |
-
$new_path_current_site = $this->get_path_from_url( $this->form_data['replace_new'][1] );
|
1490 |
-
}
|
1491 |
|
1492 |
-
|
|
|
1493 |
|
1494 |
-
if (
|
1495 |
-
|
1496 |
-
|
|
|
|
|
|
|
1497 |
}
|
1498 |
-
}
|
1499 |
|
1500 |
-
|
1501 |
-
|
1502 |
-
|
1503 |
-
} elseif ( ! empty ( $this->form_data['replace_new'][1] ) ) {
|
1504 |
-
$url = $this->parse_url( $this->form_data['replace_new'][1] );
|
1505 |
-
$main_domain_replace = $url['host'];
|
1506 |
}
|
1507 |
|
1508 |
-
$
|
1509 |
-
|
1510 |
-
|
1511 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1512 |
}
|
1513 |
|
1514 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1515 |
|
1516 |
-
|
1517 |
-
}
|
1518 |
|
1519 |
-
|
1520 |
-
if ( $this->post_data['stage'] != 'backup' ) {
|
1521 |
-
$value = $replacer->recursive_unserialize_replace( $value );
|
1522 |
}
|
1523 |
-
}
|
1524 |
|
1525 |
-
|
1526 |
-
|
|
|
|
|
|
|
1527 |
|
1528 |
-
|
|
|
1529 |
|
1530 |
-
|
|
|
1531 |
|
1532 |
-
|
1533 |
-
|
|
|
|
|
|
|
1534 |
|
1535 |
-
if ( ( strlen( $this->current_chunk ) + strlen( $insert_line ) + strlen( $insert_buffer ) +
|
1536 |
if ( $insert_buffer == $insert_query_template ) {
|
1537 |
$insert_buffer .= $insert_line;
|
1538 |
|
@@ -1587,22 +1769,31 @@ class WPMDB extends WPMDB_Base {
|
|
1587 |
} while ( count( $table_data ) > 0 );
|
1588 |
|
1589 |
// Create footer/closing comment in SQL-file
|
1590 |
-
if ( $this->form_data['action']
|
1591 |
$this->stow( "\n" );
|
1592 |
$this->stow( "#\n" );
|
1593 |
-
$this->stow( '# ' . sprintf( __( 'End of data contents of table %s', 'wp-migrate-db' ), $this->backquote( $
|
1594 |
$this->stow( "# --------------------------------------------------------\n" );
|
1595 |
$this->stow( "\n" );
|
1596 |
|
1597 |
-
if ( $this->
|
1598 |
$this->stow( "#\n" );
|
1599 |
-
$this->stow( "# Add constraints back in
|
1600 |
$this->stow( "#\n\n" );
|
1601 |
$this->stow( $this->get_alter_queries() );
|
1602 |
$alter_table_name = $this->get_alter_table_name();
|
1603 |
|
1604 |
-
|
1605 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1606 |
}
|
1607 |
}
|
1608 |
}
|
@@ -1610,31 +1801,101 @@ class WPMDB extends WPMDB_Base {
|
|
1610 |
$this->row_tracker = - 1;
|
1611 |
|
1612 |
return $this->transfer_chunk();
|
1613 |
-
} // end
|
1614 |
|
1615 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1616 |
global $wpdb;
|
1617 |
|
1618 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1619 |
}
|
1620 |
|
1621 |
/**
|
1622 |
-
*
|
|
|
1623 |
*
|
1624 |
-
* @param array $tables
|
1625 |
-
* @param string $queried_table
|
1626 |
*
|
1627 |
-
* @return array
|
1628 |
*/
|
1629 |
function get_ms_compat_table_names( $tables, $queried_table ) {
|
1630 |
global $wpdb;
|
1631 |
|
1632 |
// default table prefix
|
1633 |
-
$prefix
|
|
|
1634 |
|
1635 |
// if multisite, extract blog ID from queried table name and add to prefix
|
1636 |
// won't match for primary blog because it uses standard table names, i.e. blog_id will never be 1
|
1637 |
-
if ( is_multisite() && preg_match( '/^' .
|
1638 |
$blog_id = $matches[1];
|
1639 |
$prefix .= $blog_id . '_';
|
1640 |
}
|
@@ -1670,7 +1931,7 @@ class WPMDB extends WPMDB_Base {
|
|
1670 |
return false;
|
1671 |
}
|
1672 |
|
1673 |
-
if ( $this->gzip() && isset( $this->form_data['gzip_file'] ) ) {
|
1674 |
$fp = gzopen( $filename, $mode );
|
1675 |
} else {
|
1676 |
$fp = fopen( $filename, $mode );
|
@@ -1680,7 +1941,7 @@ class WPMDB extends WPMDB_Base {
|
|
1680 |
}
|
1681 |
|
1682 |
function close( $fp ) {
|
1683 |
-
if ( $this->gzip() && isset( $this->form_data['gzip_file'] ) ) {
|
1684 |
gzclose( $fp );
|
1685 |
} else {
|
1686 |
fclose( $fp );
|
@@ -1689,12 +1950,24 @@ class WPMDB extends WPMDB_Base {
|
|
1689 |
unset( $this->fp );
|
1690 |
}
|
1691 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1692 |
function stow( $query_line, $replace = true ) {
|
1693 |
$this->set_post_data();
|
1694 |
$this->current_chunk .= $query_line;
|
1695 |
|
1696 |
-
if (
|
1697 |
-
|
|
|
|
|
|
|
|
|
1698 |
if ( ! @gzwrite( $this->fp, $query_line ) ) {
|
1699 |
$this->error = __( 'Failed to write the gzipped SQL data to the file. (#127)', 'wp-migrate-db' );
|
1700 |
|
@@ -1708,59 +1981,76 @@ class WPMDB extends WPMDB_Base {
|
|
1708 |
return false;
|
1709 |
}
|
1710 |
}
|
1711 |
-
} elseif ( $this->
|
1712 |
-
echo $query_line;
|
1713 |
}
|
1714 |
}
|
1715 |
|
1716 |
-
|
|
|
|
|
|
|
|
|
1717 |
function transfer_chunk() {
|
1718 |
$this->set_post_data();
|
1719 |
|
1720 |
-
if ( $this->
|
1721 |
$this->close( $this->fp );
|
1722 |
|
1723 |
-
$result =
|
1724 |
-
|
1725 |
-
|
1726 |
-
|
1727 |
-
|
1728 |
-
)
|
|
|
|
|
|
|
|
|
|
|
1729 |
|
1730 |
return $result;
|
1731 |
}
|
1732 |
|
1733 |
-
if ( $this->
|
1734 |
$result = $this->end_ajax( $this->row_tracker . ',' . serialize( $this->primary_keys ) );
|
1735 |
|
1736 |
return $result;
|
1737 |
}
|
1738 |
|
1739 |
$chunk_gzipped = '0';
|
1740 |
-
if ( isset( $this->
|
1741 |
$this->current_chunk = gzcompress( $this->current_chunk );
|
1742 |
$chunk_gzipped = '1';
|
1743 |
}
|
1744 |
|
1745 |
$data = array(
|
1746 |
'action' => 'wpmdb_process_chunk',
|
1747 |
-
'table' => $this->
|
1748 |
'chunk_gzipped' => $chunk_gzipped,
|
1749 |
'chunk' => $this->current_chunk,
|
1750 |
// NEEDS TO BE the last element in this array because of adding it back into the array in ajax_process_chunk()
|
1751 |
);
|
1752 |
|
1753 |
-
$data['sig'] = $this->create_signature( $data, $this->
|
1754 |
|
1755 |
-
$ajax_url =
|
1756 |
$response = $this->remote_post( $ajax_url, $data, __FUNCTION__ );
|
|
|
1757 |
ob_start();
|
1758 |
$this->display_errors();
|
1759 |
-
$
|
1760 |
-
$response .= trim( $response );
|
1761 |
|
1762 |
-
if (
|
1763 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1764 |
|
1765 |
return $result;
|
1766 |
}
|
@@ -1821,7 +2111,7 @@ class WPMDB extends WPMDB_Base {
|
|
1821 |
}
|
1822 |
|
1823 |
function network_admin_menu() {
|
1824 |
-
$title
|
1825 |
$hook_suffix = add_submenu_page( 'settings.php',
|
1826 |
$title,
|
1827 |
$title,
|
@@ -1832,7 +2122,7 @@ class WPMDB extends WPMDB_Base {
|
|
1832 |
}
|
1833 |
|
1834 |
function admin_menu() {
|
1835 |
-
$title
|
1836 |
$hook_suffix = add_management_page( $title,
|
1837 |
$title,
|
1838 |
'export',
|
@@ -1878,13 +2168,24 @@ class WPMDB extends WPMDB_Base {
|
|
1878 |
}
|
1879 |
|
1880 |
/**
|
1881 |
-
*
|
|
|
|
|
|
|
1882 |
*/
|
1883 |
-
function
|
1884 |
if ( ! empty( $_GET['download'] ) ) {
|
1885 |
$this->download_file();
|
1886 |
}
|
|
|
1887 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1888 |
if ( isset( $_GET['wpmdb-download-log'] ) && wp_verify_nonce( $_GET['nonce'], 'wpmdb-download-log' ) ) {
|
1889 |
ob_start();
|
1890 |
$this->output_diagnostic_info();
|
@@ -1892,7 +2193,7 @@ class WPMDB extends WPMDB_Base {
|
|
1892 |
$log = ob_get_clean();
|
1893 |
$url = $this->parse_url( home_url() );
|
1894 |
$host = sanitize_file_name( $url['host'] );
|
1895 |
-
$filename = sprintf( '%s-
|
1896 |
header( 'Content-Description: File Transfer' );
|
1897 |
header( 'Content-Type: application/octet-stream' );
|
1898 |
header( 'Content-Length: ' . strlen( $log ) );
|
@@ -1900,7 +2201,15 @@ class WPMDB extends WPMDB_Base {
|
|
1900 |
echo $log;
|
1901 |
exit;
|
1902 |
}
|
|
|
1903 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1904 |
if ( isset( $_GET['wpmdb-remove-licence'] ) && wp_verify_nonce( $_GET['nonce'], 'wpmdb-remove-licence' ) ) {
|
1905 |
$this->settings['licence'] = '';
|
1906 |
update_site_option( 'wpmdb_settings', $this->settings );
|
@@ -1912,7 +2221,15 @@ class WPMDB extends WPMDB_Base {
|
|
1912 |
wp_redirect( network_admin_url( $this->plugin_base . '#settings' ) );
|
1913 |
exit;
|
1914 |
}
|
|
|
1915 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1916 |
if ( isset( $_GET['wpmdb-disable-ssl'] ) && wp_verify_nonce( $_GET['nonce'], 'wpmdb-disable-ssl' ) ) {
|
1917 |
set_site_transient( 'wpmdb_temporarily_disable_ssl', '1', 60 * 60 * 24 * 30 ); // 30 days
|
1918 |
$hash = ( isset( $_GET['hash'] ) ) ? '#' . sanitize_title( $_GET['hash'] ) : '';
|
@@ -1922,7 +2239,15 @@ class WPMDB extends WPMDB_Base {
|
|
1922 |
wp_redirect( network_admin_url( $this->plugin_base . $hash ) );
|
1923 |
exit;
|
1924 |
}
|
|
|
1925 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1926 |
if ( isset( $_GET['wpmdb-check-licence'] ) && wp_verify_nonce( $_GET['nonce'], 'wpmdb-check-licence' ) ) {
|
1927 |
$hash = ( isset( $_GET['hash'] ) ) ? '#' . sanitize_title( $_GET['hash'] ) : '';
|
1928 |
// delete the licence transient as we want to attempt to fetch the licence details again
|
@@ -1931,14 +2256,27 @@ class WPMDB extends WPMDB_Base {
|
|
1931 |
wp_redirect( network_admin_url( $this->plugin_base . $hash ) );
|
1932 |
exit;
|
1933 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1934 |
|
1935 |
// add our custom CSS classes to <body>
|
1936 |
add_filter( 'admin_body_class', array( $this, 'admin_body_class' ) );
|
1937 |
|
1938 |
-
$plugins_url = trailingslashit( plugins_url(
|
1939 |
-
|
1940 |
-
$
|
1941 |
-
$min = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
|
1942 |
|
1943 |
$src = $plugins_url . 'asset/css/styles.css';
|
1944 |
wp_enqueue_style( 'wp-migrate-db-pro-styles', $src, array(), $version );
|
@@ -1989,7 +2327,7 @@ class WPMDB extends WPMDB_Base {
|
|
1989 |
'saved' => _x( 'Saved', 'The settings were saved successfully', 'wp-migrate-db' ),
|
1990 |
'reset_api_key' => __( 'Any sites setup to use the current secret key will no longer be able to connect. You will need to update those sites with the newly generated secret key. Do you wish to continue?', 'wp-migrate-db' ),
|
1991 |
'reset_api_key_problem' => __( 'An error occurred when trying to generate the secret key. Please see the Help tab for details on how to request support. (#105)', 'wp-migrate-db' ),
|
1992 |
-
'remove_profile' => __( 'You are
|
1993 |
'remove_profile_problem' => __( 'An error occurred when trying to delete the profile. Please see the Help tab for details on how to request support. (#106)', 'wp-migrate-db' ),
|
1994 |
'remove_profile_not_found' => __( "The selected migration profile could not be deleted because it was not found.\nPlease refresh this page to see an accurate list of the currently available migration profiles.", 'wp-migrate-db' ),
|
1995 |
'change_connection_info' => __( 'If you change the connection details, you will lose any replaces and table selections you have made below. Do you wish to continue?', 'wp-migrate-db' ),
|
@@ -2018,6 +2356,7 @@ class WPMDB extends WPMDB_Base {
|
|
2018 |
'migration_cancelled' => _x( 'Migration cancelled', 'The migration has been cancelled', 'wp-migrate-db' ),
|
2019 |
'migration_complete' => _x( 'Migration complete', 'The migration completed successfully', 'wp-migrate-db' ),
|
2020 |
'finalizing_migration' => _x( 'Finalizing migration', 'The migration is in the last stages', 'wp-migrate-db' ),
|
|
|
2021 |
'blacklist_problem' => __( 'A problem occurred when trying to add plugins to backlist.', 'wp-migrate-db' ),
|
2022 |
'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' ),
|
2023 |
'plugin_compatibility_settings_problem' => __( 'A problem occurred when trying to change the plugin compatibility setting.', 'wp-migrate-db' ),
|
@@ -2034,6 +2373,9 @@ class WPMDB extends WPMDB_Base {
|
|
2034 |
'ajax_json_message' => __( 'JSON Decoding Failure', 'wp-migrate-db' ),
|
2035 |
'ajax_json_errors' => __( 'Our AJAX request was expecting JSON but we received something else. Often this is caused by your theme and/or plugins spitting out PHP errors. If you can edit the theme or plugins causing the errors, you should be able to fix them up, but if not, you can set WP_DEBUG to false in wp-config.php to disable errors from showing up.', 'wp-migrate-db' ),
|
2036 |
'view_error_messages' => __( 'View error messages', 'wp-migrate-db' ),
|
|
|
|
|
|
|
2037 |
)
|
2038 |
);
|
2039 |
|
@@ -2073,60 +2415,66 @@ class WPMDB extends WPMDB_Base {
|
|
2073 |
}
|
2074 |
}
|
2075 |
|
|
|
|
|
|
|
|
|
|
|
2076 |
function admin_head_connection_info() {
|
2077 |
global $table_prefix;
|
2078 |
|
2079 |
-
$nonces = array(
|
2080 |
-
'update_max_request_size'
|
2081 |
-
'
|
2082 |
-
'
|
2083 |
-
'
|
2084 |
-
'
|
2085 |
-
'
|
2086 |
-
'
|
2087 |
-
'
|
2088 |
-
'
|
2089 |
-
'
|
2090 |
-
'
|
2091 |
-
'
|
2092 |
-
'
|
2093 |
-
'
|
2094 |
-
'
|
2095 |
-
'
|
2096 |
-
|
|
|
|
|
2097 |
|
2098 |
-
$
|
2099 |
-
|
2100 |
-
|
2101 |
-
|
2102 |
-
|
2103 |
-
|
2104 |
-
|
2105 |
-
|
2106 |
-
|
2107 |
-
|
2108 |
-
|
2109 |
-
|
2110 |
-
|
2111 |
-
|
2112 |
-
|
2113 |
-
|
2114 |
-
|
2115 |
-
|
2116 |
-
|
2117 |
-
|
2118 |
-
|
2119 |
-
var wpmdb_has_licence = '<?php echo esc_html( $this->get_licence_key() == '' ? '0' : '1' ); ?>';
|
2120 |
// TODO: Use WP_Filesystem API.
|
2121 |
-
|
2122 |
-
|
2123 |
-
|
2124 |
-
|
2125 |
-
|
2126 |
-
|
2127 |
-
|
2128 |
-
|
2129 |
-
|
2130 |
}
|
2131 |
|
2132 |
function maybe_update_profile( $profile, $profile_id ) {
|
@@ -2184,20 +2532,28 @@ class WPMDB extends WPMDB_Base {
|
|
2184 |
echo esc_html( ( isset( $option ) && $option == '1' ) ? ' checked="checked"' : '' );
|
2185 |
}
|
2186 |
|
|
|
|
|
|
|
2187 |
function ajax_cancel_migration() {
|
2188 |
-
$
|
2189 |
-
|
|
|
|
|
|
|
2190 |
|
2191 |
-
|
|
|
|
|
2192 |
case 'savefile' :
|
2193 |
-
$this->delete_export_file( $this->
|
2194 |
break;
|
2195 |
case 'push' :
|
2196 |
-
$data
|
2197 |
-
$data['
|
2198 |
-
$data['
|
2199 |
-
$ajax_url
|
2200 |
-
$data['sig']
|
2201 |
|
2202 |
$response = $this->remote_post( $ajax_url, $data, __FUNCTION__ );
|
2203 |
$this->display_errors();
|
@@ -2205,16 +2561,22 @@ class WPMDB extends WPMDB_Base {
|
|
2205 |
echo esc_html( trim( $response ) );
|
2206 |
break;
|
2207 |
case 'pull' :
|
2208 |
-
if ( $this->
|
2209 |
-
|
|
|
|
|
2210 |
} else {
|
2211 |
-
$this->delete_temporary_tables( $this->
|
2212 |
}
|
2213 |
break;
|
2214 |
default:
|
2215 |
break;
|
2216 |
}
|
2217 |
|
|
|
|
|
|
|
|
|
2218 |
exit;
|
2219 |
}
|
2220 |
|
@@ -2385,6 +2747,12 @@ class WPMDB extends WPMDB_Base {
|
|
2385 |
// Following regex matches any PRIMARY KEY or KEY statement on a table definition that has a COMMENT statement attached.
|
2386 |
// The regex is then reset (\K) to return just the COMMENT, its string and any leading whitespace for replacing with nothing.
|
2387 |
$create_table = preg_replace( '/(?-i)KEY\s.*`.*`\).*\K\sCOMMENT\s\'.*\'/', '', $create_table );
|
|
|
|
|
|
|
|
|
|
|
|
|
2388 |
}
|
2389 |
|
2390 |
return $create_table;
|
@@ -2399,7 +2767,7 @@ class WPMDB extends WPMDB_Base {
|
|
2399 |
* @return array
|
2400 |
*/
|
2401 |
function parse_find_replace_pairs( $intent = '', $site_url = '' ) {
|
2402 |
-
$find_replace_pairs
|
2403 |
$tmp_find_replace_pairs = array();
|
2404 |
if ( ! empty( $this->form_data['replace_old'] ) && ! empty( $this->form_data['replace_new'] ) ) {
|
2405 |
$tmp_find_replace_pairs = array_combine( $this->form_data['replace_old'], $this->form_data['replace_new'] );
|
@@ -2412,7 +2780,7 @@ class WPMDB extends WPMDB_Base {
|
|
2412 |
foreach ( $tmp_find_replace_pairs as $replace_old => $replace_new ) {
|
2413 |
$find_replace_pairs['replace_old'][ $i ] = $replace_old;
|
2414 |
$find_replace_pairs['replace_new'][ $i ] = $replace_new;
|
2415 |
-
$i++;
|
2416 |
}
|
2417 |
}
|
2418 |
|
@@ -2430,19 +2798,18 @@ class WPMDB extends WPMDB_Base {
|
|
2430 |
function mixed_case_table_name_warning( $migration_type ) {
|
2431 |
ob_start();
|
2432 |
?>
|
2433 |
-
|
2434 |
|
2435 |
-
|
2436 |
-
|
2437 |
-
|
2438 |
-
|
2439 |
-
|
2440 |
|
2441 |
-
|
2442 |
|
2443 |
-
|
2444 |
<?php
|
2445 |
return wptexturize( ob_get_clean() );
|
2446 |
}
|
2447 |
-
|
2448 |
}
|
9 |
protected $maximum_chunk_size;
|
10 |
protected $current_chunk = '';
|
11 |
protected $connection_details;
|
|
|
|
|
12 |
protected $form_data;
|
13 |
protected $max_insert_string_len;
|
14 |
protected $row_tracker;
|
15 |
protected $rows_per_segment = 100;
|
16 |
protected $create_alter_table_query;
|
|
|
17 |
protected $session_salt;
|
18 |
protected $primary_keys;
|
19 |
protected $unhook_templates = array();
|
40 |
add_action( 'wp_ajax_wpmdb_initiate_migration', array( $this, 'ajax_initiate_migration' ) );
|
41 |
add_action( 'wp_ajax_wpmdb_migrate_table', array( $this, 'ajax_migrate_table' ) );
|
42 |
add_action( 'wp_ajax_wpmdb_finalize_migration', array( $this, 'ajax_finalize_migration' ) );
|
43 |
+
add_action( 'wp_ajax_wpmdb_flush', array( $this, 'ajax_flush' ) );
|
44 |
+
add_action( 'wp_ajax_nopriv_wpmdb_flush', array( $this, 'ajax_nopriv_flush' ) ); // Required for Pull if user tables being updated.
|
45 |
add_action( 'wp_ajax_wpmdb_clear_log', array( $this, 'ajax_clear_log' ) );
|
46 |
add_action( 'wp_ajax_wpmdb_get_log', array( $this, 'ajax_get_log' ) );
|
47 |
add_action( 'wp_ajax_wpmdb_fire_migration_complete', array( $this, 'fire_migration_complete' ) );
|
48 |
add_action( 'wp_ajax_wpmdb_plugin_compatibility', array( $this, 'ajax_plugin_compatibility' ) );
|
49 |
add_action( 'wp_ajax_wpmdb_blacklist_plugins', array( $this, 'ajax_blacklist_plugins' ) );
|
50 |
add_action( 'wp_ajax_wpmdb_update_max_request_size', array( $this, 'ajax_update_max_request_size' ) );
|
51 |
+
add_action( 'wp_ajax_wpmdb_update_delay_between_requests', array( $this, 'ajax_update_delay_between_requests' ) );
|
52 |
add_action( 'wp_ajax_wpmdb_cancel_migration', array( $this, 'ajax_cancel_migration' ) );
|
53 |
|
54 |
+
$this->absolute_root_file_path = $this->get_absolute_root_file_path();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
55 |
|
56 |
$this->accepted_fields = array(
|
57 |
'action',
|
77 |
'exclude_post_types',
|
78 |
'exclude_post_revisions',
|
79 |
'compatibility_older_mysql',
|
80 |
+
'export_dest',
|
81 |
);
|
82 |
|
83 |
$this->default_profile = array(
|
128 |
add_action( 'network_admin_menu', array( $this, 'network_admin_menu' ) );
|
129 |
/*
|
130 |
* The URL find & replace is locked down (delete & reorder disabled) on multisite installations as we require the URL
|
131 |
+
* of the remote site for export migrations. This URL is parsed into its various components and
|
132 |
* used to change values in the 'domain' & 'path' columns in the wp_blogs and wp_site tables.
|
133 |
*/
|
134 |
$this->lock_url_find_replace_row = true;
|
137 |
}
|
138 |
}
|
139 |
|
140 |
+
/**
|
141 |
+
* Returns a fragment of SQL for creating the table where the alter statements are held during the migration.
|
142 |
+
*
|
143 |
+
* @return string
|
144 |
+
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
145 |
function get_create_alter_table_query() {
|
146 |
if ( ! is_null( $this->create_alter_table_query ) ) {
|
147 |
return $this->create_alter_table_query;
|
148 |
}
|
149 |
|
150 |
+
$legacy_alter_table_name = $this->get_legacy_alter_table_name();
|
151 |
+
$this->create_alter_table_query = sprintf( "DROP TABLE IF EXISTS `%s`;\n", $legacy_alter_table_name );
|
152 |
+
|
153 |
$alter_table_name = $this->get_alter_table_name();
|
154 |
+
$this->create_alter_table_query .= sprintf( "DROP TABLE IF EXISTS `%s`;\n", $alter_table_name );
|
155 |
+
$this->create_alter_table_query .= sprintf( "CREATE TABLE `%s` ( `query` LONGTEXT NOT NULL );\n", $alter_table_name );
|
156 |
$this->create_alter_table_query = apply_filters( 'wpmdb_create_alter_table_query', $this->create_alter_table_query );
|
157 |
|
158 |
return $this->create_alter_table_query;
|
164 |
return trailingslashit( substr( str_replace( '\\', '/', $short_path ), 1 ) );
|
165 |
}
|
166 |
|
167 |
+
/**
|
168 |
+
* Handler for ajax request to turn on or off Compatibility Mode.
|
169 |
+
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
170 |
function ajax_plugin_compatibility() {
|
171 |
+
$key_rules = array(
|
172 |
+
'action' => 'key',
|
173 |
+
'install' => 'numeric',
|
174 |
+
);
|
175 |
+
$this->set_post_data( $key_rules );
|
176 |
+
|
177 |
$mu_dir = ( defined( 'WPMU_PLUGIN_DIR' ) && defined( 'WPMU_PLUGIN_URL' ) ) ? WPMU_PLUGIN_DIR : trailingslashit( WP_CONTENT_DIR ) . 'mu-plugins';
|
178 |
$source = trailingslashit( $this->plugin_dir_path ) . 'compatibility/wp-migrate-db-pro-compatibility.php';
|
179 |
$dest = trailingslashit( $mu_dir ) . 'wp-migrate-db-pro-compatibility.php';
|
180 |
+
if ( '1' === trim( $this->state_data['install'] ) ) { // install MU plugin
|
181 |
if ( ! wp_mkdir_p( $mu_dir ) ) {
|
182 |
printf( esc_html__( 'The following directory could not be created: %s', 'wp-migrate-db' ), $mu_dir );
|
183 |
exit;
|
197 |
exit;
|
198 |
}
|
199 |
|
200 |
+
/**
|
201 |
+
* Handler for updating the plugins that are not to be loaded during a request (Compatibility Mode).
|
202 |
+
*/
|
203 |
function ajax_blacklist_plugins() {
|
204 |
+
$key_rules = array(
|
205 |
+
'action' => 'key',
|
206 |
+
'blacklist_plugins' => 'array',
|
207 |
+
);
|
208 |
+
$this->set_post_data( $key_rules );
|
209 |
+
|
210 |
+
$this->settings['blacklist_plugins'] = (array) $this->state_data['blacklist_plugins'];
|
211 |
update_site_option( 'wpmdb_settings', $this->settings );
|
212 |
exit;
|
213 |
}
|
214 |
|
215 |
+
/**
|
216 |
+
* Updates the Maximum Request Size setting.
|
217 |
+
*
|
218 |
+
* @return void
|
219 |
+
*/
|
220 |
function ajax_update_max_request_size() {
|
221 |
$this->check_ajax_referer( 'update-max-request-size' );
|
|
|
|
|
|
|
|
|
222 |
|
223 |
+
$key_rules = array(
|
224 |
+
'action' => 'key',
|
225 |
+
'max_request_size' => 'positive_int',
|
226 |
+
'nonce' => 'key',
|
227 |
+
);
|
228 |
+
$this->set_post_data( $key_rules );
|
229 |
+
|
230 |
+
$this->settings['max_request'] = (int) $this->state_data['max_request_size'] * 1024;
|
231 |
+
$result = update_site_option( 'wpmdb_settings', $this->settings );
|
232 |
+
$this->end_ajax( $result );
|
233 |
+
}
|
234 |
+
|
235 |
+
/**
|
236 |
+
* Updates the Delay Between Requests setting.
|
237 |
+
*
|
238 |
+
* @return void
|
239 |
+
*/
|
240 |
+
function ajax_update_delay_between_requests() {
|
241 |
+
$this->check_ajax_referer( 'update-delay-between-requests' );
|
242 |
+
|
243 |
+
$key_rules = array(
|
244 |
+
'action' => 'key',
|
245 |
+
'delay_between_requests' => 'positive_int',
|
246 |
+
'nonce' => 'key',
|
247 |
+
);
|
248 |
+
$this->set_post_data( $key_rules );
|
249 |
+
|
250 |
+
$this->settings['delay_between_requests'] = (int) $this->state_data['delay_between_requests'];
|
251 |
+
$result = update_site_option( 'wpmdb_settings', $this->settings );
|
252 |
+
$this->end_ajax( $result );
|
253 |
}
|
254 |
|
255 |
function is_json( $string, $strict = false ) {
|
265 |
if ( empty( $this->session_salt ) ) {
|
266 |
$this->session_salt = strtolower( wp_generate_password( 5, false, false ) );
|
267 |
}
|
268 |
+
$datetime = date( 'YmdHis' );
|
269 |
+
$ds = ( $info_type == 'path' ? DIRECTORY_SEPARATOR : '/' );
|
270 |
$dump_info = sprintf( '%s%s%s-%s-%s-%s.sql', $this->get_upload_info( $info_type ), $ds, sanitize_title_with_dashes( DB_NAME ), $migration_type, $datetime, $this->session_salt );
|
271 |
+
|
272 |
return ( $info_type == 'path' ? $this->slash_one_direction( $dump_info ) : $dump_info );
|
273 |
}
|
274 |
|
287 |
$form_data = wp_unslash( $form_data );
|
288 |
}
|
289 |
$this->accepted_fields = apply_filters( 'wpmdb_accepted_profile_fields', $this->accepted_fields );
|
290 |
+
$form_data = array_intersect_key( $form_data, array_flip( $this->accepted_fields ) );
|
291 |
unset( $form_data['replace_old'][0] );
|
292 |
unset( $form_data['replace_new'][0] );
|
293 |
|
308 |
return $form_data;
|
309 |
}
|
310 |
|
311 |
+
/**
|
312 |
+
* Returns the profile value for a given key.
|
313 |
+
*
|
314 |
+
* @param string $key
|
315 |
+
*
|
316 |
+
* @return mixed
|
317 |
+
*/
|
318 |
+
function profile_value( $key ) {
|
319 |
+
if ( ! empty( $key ) && ! empty( $this->form_data ) && isset( $this->form_data[ $key ] ) ) {
|
320 |
+
return $this->form_data[ $key ];
|
321 |
+
}
|
322 |
+
|
323 |
+
return null;
|
324 |
+
}
|
325 |
+
|
326 |
+
/**
|
327 |
+
* Adds settings link to plugin page
|
328 |
+
*
|
329 |
+
* @param array $links
|
330 |
+
*
|
331 |
+
* @return array $links
|
332 |
+
*/
|
333 |
function plugin_action_links( $links ) {
|
334 |
+
$link = sprintf( '<a href="%s">%s</a>', network_admin_url( $this->plugin_base ) . '#settings', _x( 'Settings', 'Plugin configuration and preferences', 'wp-migrate-db' ) );
|
335 |
array_unshift( $links, $link );
|
336 |
|
337 |
return $links;
|
363 |
}
|
364 |
}
|
365 |
|
366 |
+
/**
|
367 |
+
* Outputs diagnostic info for debugging.
|
368 |
+
*
|
369 |
+
* Outputs useful diagnostic info text at the Diagnostic Info & Error Log
|
370 |
+
* section under the Help tab so the information can be viewed or
|
371 |
+
* downloaded and shared for debugging.
|
372 |
+
*
|
373 |
+
* If you would like to add additional diagnostic information use the
|
374 |
+
* `wpmdb_diagnostic_info` action hook (see {@link https://developer.wordpress.org/reference/functions/add_action/}).
|
375 |
+
*
|
376 |
+
* <code>
|
377 |
+
* add_action( 'wpmdb_diagnostic_info', 'my_diagnostic_info' ) {
|
378 |
+
* echo "Additional Diagnostic Info: \r\n";
|
379 |
+
* echo "...\r\n";
|
380 |
+
* }
|
381 |
+
* </code>
|
382 |
+
*
|
383 |
+
* @return void
|
384 |
+
*/
|
385 |
function output_diagnostic_info() {
|
386 |
global $table_prefix;
|
387 |
global $wpdb;
|
394 |
echo esc_html( home_url() );
|
395 |
echo "\r\n";
|
396 |
|
397 |
+
echo 'Database Name: ';
|
398 |
+
echo esc_html( $wpdb->dbname );
|
399 |
+
echo "\r\n";
|
400 |
+
|
401 |
echo 'Table Prefix: ';
|
402 |
echo esc_html( $table_prefix );
|
403 |
echo "\r\n";
|
404 |
|
405 |
echo 'WordPress: ';
|
406 |
echo bloginfo( 'version' );
|
407 |
+
if ( is_multisite() ) {
|
408 |
+
echo ' Multisite';
|
409 |
+
}
|
410 |
echo "\r\n";
|
411 |
|
412 |
echo 'Web Server: ';
|
431 |
echo esc_html( WP_MEMORY_LIMIT );
|
432 |
echo "\r\n";
|
433 |
|
434 |
+
echo 'Blocked External HTTP Requests: ';
|
435 |
+
if ( ! defined( 'WP_HTTP_BLOCK_EXTERNAL' ) || ! WP_HTTP_BLOCK_EXTERNAL ) {
|
436 |
+
echo 'None';
|
437 |
+
} else {
|
438 |
+
$accessible_hosts = ( defined( 'WP_ACCESSIBLE_HOSTS' ) ) ? WP_ACCESSIBLE_HOSTS : '';
|
439 |
+
|
440 |
+
if ( empty( $accessible_hosts ) ) {
|
441 |
+
echo 'ALL';
|
442 |
+
} else {
|
443 |
+
echo 'Partially (Accessible Hosts: ' . esc_html( $accessible_hosts ) . ')';
|
444 |
+
}
|
445 |
+
}
|
446 |
+
echo "\r\n";
|
447 |
+
|
448 |
echo 'WPMDB Bottleneck: ';
|
449 |
echo esc_html( size_format( $this->get_bottleneck() ) );
|
450 |
echo "\r\n";
|
531 |
} else {
|
532 |
echo 'No';
|
533 |
}
|
534 |
+
echo "\r\n\r\n";
|
535 |
+
|
536 |
+
do_action( 'wpmdb_diagnostic_info' );
|
537 |
+
if ( has_action( 'wpmdb_diagnostic_info' ) ) {
|
538 |
+
echo "\r\n";
|
539 |
+
}
|
540 |
|
541 |
echo "Active Plugins:\r\n";
|
542 |
|
543 |
if ( isset( $GLOBALS['wpmdb_compatibility'] ) ) {
|
544 |
remove_filter( 'option_active_plugins', 'wpmdbc_exclude_plugins' );
|
545 |
remove_filter( 'site_option_active_sitewide_plugins', 'wpmdbc_exclude_site_plugins' );
|
546 |
+
$blacklist = array_flip( (array) $this->settings['blacklist_plugins'] );
|
547 |
} else {
|
548 |
$blacklist = array();
|
549 |
}
|
552 |
|
553 |
if ( is_multisite() ) {
|
554 |
$network_active_plugins = wp_get_active_network_plugins();
|
555 |
+
$active_plugins = array_map( array( $this, 'remove_wp_plugin_dir' ), $network_active_plugins );
|
556 |
}
|
557 |
|
558 |
foreach ( $active_plugins as $plugin ) {
|
575 |
$this->print_plugin_details( $mu_plugin );
|
576 |
}
|
577 |
}
|
|
|
|
|
|
|
|
|
578 |
}
|
579 |
|
580 |
function print_plugin_details( $plugin_path, $suffix = '' ) {
|
599 |
$alter_queries = $wpdb->get_results( "SELECT * FROM `{$alter_table_name}`", ARRAY_A );
|
600 |
if ( ! empty( $alter_queries ) ) {
|
601 |
foreach ( $alter_queries as $alter_query ) {
|
602 |
+
$sql .= $alter_query['query'] . "\n";
|
603 |
}
|
604 |
}
|
605 |
|
618 |
$wpdb->show_errors();
|
619 |
|
620 |
if ( empty( $wpdb->charset ) ) {
|
621 |
+
$charset = ( defined( 'DB_CHARSET' ) ? DB_CHARSET : 'utf8' );
|
622 |
$wpdb->charset = $charset;
|
623 |
$wpdb->set_charset( $wpdb->dbh, $wpdb->charset );
|
624 |
}
|
626 |
foreach ( $queries as $query ) {
|
627 |
if ( false === $wpdb->query( $query ) ) {
|
628 |
$return = ob_get_clean();
|
629 |
+
$return = array( 'wpmdb_error' => 1, 'body' => $return );
|
630 |
+
$result = $this->end_ajax( json_encode( $return ) );
|
631 |
|
632 |
return $result;
|
633 |
}
|
643 |
*/
|
644 |
function ajax_migrate_table() {
|
645 |
$this->check_ajax_referer( 'migrate-table' );
|
646 |
+
|
647 |
+
$key_rules = array(
|
648 |
+
'action' => 'key',
|
649 |
+
'migration_state_id' => 'key',
|
650 |
+
'table' => 'string',
|
651 |
+
'stage' => 'key',
|
652 |
+
'current_row' => 'numeric',
|
653 |
+
'last_table' => 'string',
|
654 |
+
'primary_keys' => 'string',
|
655 |
+
'gzip' => 'int',
|
656 |
+
'nonce' => 'key',
|
657 |
+
'bottleneck' => 'positive_int',
|
658 |
+
'prefix' => 'string',
|
659 |
+
'path_current_site' => 'string',
|
660 |
+
'domain_current_site' => 'text',
|
661 |
+
);
|
662 |
+
$this->set_post_data( $key_rules );
|
663 |
+
|
664 |
global $wpdb;
|
665 |
|
666 |
+
$this->form_data = $this->parse_migration_form_data( $this->state_data['form_data'] );
|
667 |
|
668 |
$result = '';
|
669 |
|
670 |
// checks if we're performing a backup, if so, continue with the backup and exit immediately after
|
671 |
+
if ( $this->state_data['stage'] == 'backup' && $this->state_data['intent'] != 'savefile' ) {
|
672 |
+
if ( empty( $this->state_data['dumpfile_created'] ) ) {
|
673 |
+
$this->state_data['dumpfile_created'] = true;
|
674 |
+
$this->save_migration_state( $this->state_data );
|
675 |
+
}
|
676 |
+
|
677 |
// if performing a push we need to backup the REMOTE machine's DB
|
678 |
+
if ( $this->state_data['intent'] == 'push' ) {
|
679 |
+
$data = $this->filter_post_elements(
|
680 |
+
$this->state_data,
|
681 |
array(
|
682 |
'action',
|
683 |
'intent',
|
699 |
);
|
700 |
$data['action'] = 'wpmdb_backup_remote_table';
|
701 |
$data['intent'] = 'pull';
|
702 |
+
$ajax_url = $this->ajax_url();
|
703 |
$data['sig'] = $this->create_signature( $data, $data['key'] );
|
704 |
$response = $this->remote_post( $ajax_url, $data, __FUNCTION__ );
|
705 |
ob_start();
|
706 |
$this->display_errors();
|
707 |
+
$maybe_errors = ob_get_clean();
|
708 |
+
|
709 |
+
if ( false === empty( $maybe_errors ) ) {
|
710 |
+
$maybe_errors = array( 'wpmdb_error' => 1, 'body' => $maybe_errors );
|
711 |
+
$return = json_encode( $maybe_errors );
|
712 |
+
} else {
|
713 |
+
$return = $response;
|
714 |
+
}
|
715 |
} else {
|
716 |
$return = $this->handle_table_backup();
|
717 |
}
|
722 |
}
|
723 |
|
724 |
// Pull and push need to be handled differently for obvious reasons, trigger different code depending on the migration intent (push or pull)
|
725 |
+
if ( $this->state_data['intent'] == 'push' || $this->state_data['intent'] == 'savefile' ) {
|
726 |
$this->maximum_chunk_size = $this->get_bottleneck();
|
727 |
|
728 |
+
if ( isset( $this->state_data['bottleneck'] ) ) {
|
729 |
+
$this->maximum_chunk_size = (int) $this->state_data['bottleneck'];
|
|
|
|
|
|
|
|
|
|
|
730 |
}
|
731 |
|
732 |
$sql_dump_file_name = $this->get_upload_info( 'path' ) . DIRECTORY_SEPARATOR;
|
733 |
+
$sql_dump_file_name .= $this->format_dump_name( $this->state_data['dump_filename'] );
|
734 |
|
735 |
+
if ( $this->state_data['intent'] == 'savefile' ) {
|
736 |
$this->fp = $this->open( $sql_dump_file_name );
|
737 |
}
|
738 |
|
739 |
$db_version = '';
|
740 |
+
if ( ! empty( $this->state_data['db_version'] ) ) {
|
741 |
+
$db_version = $this->state_data['db_version'];
|
742 |
|
743 |
+
if ( 'push' == $this->state_data['intent'] ) {
|
744 |
// $db_version has been set to remote database's version.
|
745 |
add_filter( 'wpmdb_create_table_query', array( $this, 'mysql_compat_filter' ), 10, 3 );
|
746 |
+
} elseif ( 'savefile' == $this->state_data['intent'] && ! empty( $this->form_data['compatibility_older_mysql'] ) ) {
|
747 |
// compatibility_older_mysql is currently a checkbox meaning pre-5.5 compatibility (we play safe and target 5.1),
|
748 |
// this may change in the future to be a dropdown or radiobox returning the version to be compatible with.
|
749 |
$db_version = '5.1';
|
751 |
}
|
752 |
}
|
753 |
|
754 |
+
if ( ! empty( $this->state_data['find_replace_pairs'] ) ) {
|
755 |
+
$this->find_replace_pairs = $this->state_data['find_replace_pairs'];
|
756 |
}
|
757 |
|
758 |
+
ob_start();
|
759 |
+
$result = $this->export_table( $this->state_data['table'], $db_version );
|
760 |
|
761 |
+
if ( $this->state_data['intent'] == 'savefile' && isset( $this->fp ) ) {
|
762 |
$this->close( $this->fp );
|
763 |
}
|
764 |
|
|
|
765 |
$this->display_errors();
|
766 |
$maybe_errors = trim( ob_get_clean() );
|
767 |
if ( false === empty( $maybe_errors ) ) {
|
768 |
+
$return = array( 'wpmdb_error' => 1, 'body' => $maybe_errors );
|
769 |
+
$result = $this->end_ajax( json_encode( $return ) );
|
770 |
|
771 |
return $result;
|
772 |
}
|
773 |
|
774 |
return $result;
|
775 |
} else {
|
776 |
+
$data = $this->filter_post_elements( $this->state_data, array( 'action', 'intent', 'url', 'key', 'table', 'form_data', 'stage', 'bottleneck', 'prefix', 'current_row', 'dump_filename', 'pull_limit', 'last_table', 'gzip', 'primary_keys', 'path_current_site', 'domain_current_site', 'site_url', 'find_replace_pairs' ) );
|
777 |
+
$data['action'] = 'wpmdb_process_pull_request';
|
778 |
$data['pull_limit'] = $this->get_sensible_pull_limit();
|
779 |
$data['db_version'] = $wpdb->db_version();
|
780 |
|
793 |
$data['find_replace_pairs'] = serialize( $data['find_replace_pairs'] );
|
794 |
}
|
795 |
|
796 |
+
$ajax_url = $this->ajax_url();
|
797 |
$data['sig'] = $this->create_signature( $data, $data['key'] );
|
798 |
|
799 |
$response = $this->remote_post( $ajax_url, $data, __FUNCTION__ );
|
802 |
$maybe_errors = trim( ob_get_clean() );
|
803 |
|
804 |
if ( false === empty( $maybe_errors ) ) {
|
805 |
+
$return = array( 'wpmdb_error' => 1, 'body' => $maybe_errors );
|
806 |
+
$result = $this->end_ajax( json_encode( $return ) );
|
807 |
|
808 |
return $result;
|
809 |
}
|
829 |
}
|
830 |
}
|
831 |
|
832 |
+
$result = array(
|
833 |
+
'current_row' => $row_information[0],
|
834 |
+
'primary_keys' => $row_information[1],
|
835 |
+
);
|
836 |
+
|
837 |
+
$result = $this->end_ajax( json_encode( $result ) );
|
838 |
}
|
839 |
|
840 |
return $result;
|
849 |
*/
|
850 |
function ajax_initiate_migration() {
|
851 |
global $wpdb;
|
852 |
+
|
853 |
$this->check_ajax_referer( 'initiate-migration' );
|
|
|
|
|
854 |
|
855 |
+
$key_rules = array(
|
856 |
+
'action' => 'key',
|
857 |
+
'intent' => 'key',
|
858 |
+
'url' => 'url',
|
859 |
+
'key' => 'string',
|
860 |
+
'form_data' => 'string',
|
861 |
+
'stage' => 'key',
|
862 |
+
'nonce' => 'key',
|
863 |
+
'temp_prefix' => 'string',
|
864 |
+
);
|
865 |
+
$this->set_post_data( $key_rules );
|
866 |
+
|
867 |
+
$this->form_data = $this->parse_migration_form_data( $this->state_data['form_data'] );
|
868 |
+
|
869 |
+
// A little bit of house keeping.
|
870 |
+
WPMDB_Migration_State::cleanup();
|
871 |
+
|
872 |
+
if ( $this->state_data['intent'] == 'savefile' ) {
|
873 |
$return = array(
|
874 |
'code' => 200,
|
875 |
'message' => 'OK',
|
891 |
return $result;
|
892 |
}
|
893 |
|
894 |
+
if ( $this->gzip() && isset( $this->form_data['gzip_file'] ) && $this->form_data['gzip_file'] ) {
|
895 |
$return['dump_path'] .= '.gz';
|
896 |
$return['dump_filename'] .= '.gz';
|
897 |
$return['dump_url'] .= '.gz';
|
905 |
} else { // does one last check that our verification string is valid
|
906 |
$data = array(
|
907 |
'action' => 'wpmdb_remote_initiate_migration',
|
908 |
+
'intent' => $this->state_data['intent'],
|
909 |
+
'form_data' => $this->state_data['form_data'],
|
910 |
);
|
911 |
|
912 |
+
$data['sig'] = $this->create_signature( $data, $this->state_data['key'] );
|
913 |
+
$ajax_url = $this->ajax_url();
|
914 |
$response = $this->remote_post( $ajax_url, $data, __FUNCTION__ );
|
915 |
|
916 |
if ( false === $response ) {
|
924 |
|
925 |
if ( false === $return ) {
|
926 |
$error_msg = __( 'Failed attempting to unserialize the response from the remote server. Please contact support.', 'wp-migrate-db' );
|
927 |
+
$return = array( 'wpmdb_error' => 1, 'body' => $error_msg );
|
928 |
$this->log_error( $error_msg, $response );
|
929 |
$result = $this->end_ajax( json_encode( $return ) );
|
930 |
|
938 |
return $result;
|
939 |
}
|
940 |
|
941 |
+
if ( $this->state_data['intent'] == 'pull' ) {
|
942 |
// sets up our table to store 'ALTER' queries
|
943 |
$create_alter_table_query = $this->get_create_alter_table_query();
|
944 |
$process_chunk_result = $this->process_chunk( $create_alter_table_query );
|
949 |
}
|
950 |
}
|
951 |
|
952 |
+
if ( ! empty( $this->form_data['create_backup'] ) && $this->state_data['intent'] == 'pull' ) {
|
953 |
$return['dump_filename'] = basename( $this->get_sql_dump_info( 'backup', 'path' ) );
|
954 |
$return['dump_filename'] = substr( $return['dump_filename'], 0, - 4 );
|
955 |
$return['dump_url'] = $this->get_sql_dump_info( 'backup', 'url' );
|
967 |
// Otherwise ensure it is set with own site_url so that we always return one.
|
968 |
$return['site_url'] = ( empty( $return['site_url'] ) ) ? site_url() : $return['site_url'];
|
969 |
|
970 |
+
$return['find_replace_pairs'] = $this->parse_find_replace_pairs( $this->state_data['intent'], $return['site_url'] );
|
971 |
+
|
972 |
+
// Store current migration state and return its id.
|
973 |
+
$state = array_merge( $this->state_data, $return );
|
974 |
+
unset( $return );
|
975 |
+
$return['migration_state_id'] = $this->migration_state->id();
|
976 |
+
$return = $this->save_migration_state( $state, $return );
|
977 |
|
978 |
$result = $this->end_ajax( json_encode( $return ) );
|
979 |
|
980 |
return $result;
|
981 |
}
|
982 |
|
983 |
+
/**
|
984 |
+
* Handler for the ajax request to save a migration profile.
|
985 |
+
*
|
986 |
+
* @return bool|null
|
987 |
+
*/
|
988 |
function ajax_save_profile() {
|
989 |
$this->check_ajax_referer( 'save-profile' );
|
990 |
+
|
991 |
+
$key_rules = array(
|
992 |
+
'action' => 'key',
|
993 |
+
'profile' => 'string',
|
994 |
+
'nonce' => 'key',
|
995 |
+
);
|
996 |
+
$this->set_post_data( $key_rules );
|
997 |
+
|
998 |
+
$profile = $this->parse_migration_form_data( $this->state_data['profile'] );
|
999 |
$profile = wp_parse_args( $profile, $this->checkbox_options );
|
1000 |
|
1001 |
if ( isset( $profile['save_migration_profile_option'] ) && $profile['save_migration_profile_option'] == 'new' ) {
|
1002 |
+
$profile['name'] = $profile['create_new_profile'];
|
1003 |
$this->settings['profiles'][] = $profile;
|
1004 |
} else {
|
1005 |
+
$key = $profile['save_migration_profile_option'];
|
1006 |
+
$name = $this->settings['profiles'][ $key ]['name'];
|
1007 |
+
$this->settings['profiles'][ $key ] = $profile;
|
1008 |
$this->settings['profiles'][ $key ]['name'] = $name;
|
1009 |
}
|
1010 |
|
1016 |
return $result;
|
1017 |
}
|
1018 |
|
1019 |
+
/**
|
1020 |
+
* Handler for deleting a migration profile.
|
1021 |
+
*
|
1022 |
+
* @return bool|null
|
1023 |
+
*/
|
1024 |
function ajax_delete_migration_profile() {
|
1025 |
$this->check_ajax_referer( 'delete-migration-profile' );
|
1026 |
+
|
1027 |
+
$key_rules = array(
|
1028 |
+
'action' => 'key',
|
1029 |
+
'profile_id' => 'positive_int',
|
1030 |
+
'nonce' => 'key',
|
1031 |
+
);
|
1032 |
+
$this->set_post_data( $key_rules );
|
1033 |
+
|
1034 |
+
$key = absint( $this->state_data['profile_id'] );
|
1035 |
-- $key;
|
1036 |
$return = '';
|
1037 |
|
1053 |
return size_format( $size );
|
1054 |
}
|
1055 |
|
1056 |
+
/**
|
1057 |
+
* Return array of post type slugs stored within DB.
|
1058 |
+
*
|
1059 |
+
* @return array List of post types
|
1060 |
+
*/
|
1061 |
function get_post_types() {
|
1062 |
global $wpdb;
|
1063 |
|
1064 |
if ( is_multisite() ) {
|
1065 |
+
$tables = $this->get_tables();
|
1066 |
+
$sql = "SELECT `post_type` FROM `{$wpdb->prefix}posts` ";
|
1067 |
+
$prefix_escaped = preg_quote( $wpdb->prefix, '/' );
|
1068 |
+
|
1069 |
foreach ( $tables as $table ) {
|
1070 |
+
if ( 0 == preg_match( '/' . $prefix_escaped . '[0-9]+_posts/', $table ) ) {
|
1071 |
continue;
|
1072 |
}
|
1073 |
$blog_id = str_replace( array( $wpdb->prefix, '_posts' ), array( '', '' ), $table );
|
1104 |
return $this->settings['profiles'][ $profile_id ];
|
1105 |
}
|
1106 |
|
1107 |
+
/**
|
1108 |
+
* Returns an array of table names with their associated row counts.
|
1109 |
+
*
|
1110 |
+
* @return array
|
1111 |
+
*/
|
1112 |
function get_table_row_count() {
|
1113 |
global $wpdb;
|
1114 |
|
1115 |
+
$sql = $wpdb->prepare( 'SELECT table_name, TABLE_ROWS FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = %s ORDER BY table_name', DB_NAME );
|
1116 |
$results = $wpdb->get_results( $sql, ARRAY_A );
|
1117 |
|
1118 |
$return = array();
|
1119 |
|
1120 |
+
foreach ( $results as $result ) {
|
1121 |
+
if ( $this->get_legacy_alter_table_name() == $result['table_name'] ) {
|
1122 |
+
continue;
|
1123 |
+
}
|
1124 |
+
$return[ $result['table_name'] ] = ( $result['TABLE_ROWS'] == 0 ? 1 : $result['TABLE_ROWS'] );
|
1125 |
}
|
1126 |
|
1127 |
return $return;
|
1148 |
$sql = $wpdb->prepare(
|
1149 |
"SELECT TABLE_NAME AS 'table',
|
1150 |
ROUND( ( data_length + index_length ) / 1024, 0 ) AS 'size'
|
1151 |
+
FROM INFORMATION_SCHEMA.TABLES
|
1152 |
+
WHERE INFORMATION_SCHEMA.TABLES.table_schema = %s
|
1153 |
+
AND INFORMATION_SCHEMA.TABLES.table_type = %s
|
1154 |
+
ORDER BY TABLE_NAME",
|
1155 |
DB_NAME,
|
1156 |
'BASE TABLE'
|
1157 |
);
|
1160 |
|
1161 |
if ( ! empty( $results ) ) {
|
1162 |
foreach ( $results as $result ) {
|
1163 |
+
if ( $this->get_legacy_alter_table_name() == $result['table'] ) {
|
1164 |
+
continue;
|
1165 |
+
}
|
1166 |
$return[ $result['table'] ] = $result['size'];
|
1167 |
}
|
1168 |
}
|
1175 |
$extension = '.sql';
|
1176 |
$dump_name = sanitize_file_name( $dump_name );
|
1177 |
|
1178 |
+
if ( $this->gzip() && isset( $this->form_data['gzip_file'] ) && $this->form_data['gzip_file'] ) {
|
1179 |
$extension .= '.gz';
|
1180 |
}
|
1181 |
|
1195 |
$this->set_post_data();
|
1196 |
|
1197 |
if ( ! isset( $this->domain_replace ) ) {
|
1198 |
+
if ( is_multisite() && ! empty( $this->state_data['domain_current_site'] ) ) {
|
1199 |
+
$this->domain_replace = $this->state_data['domain_current_site'];
|
1200 |
+
} elseif ( is_multisite() && ! empty( $this->form_data['replace_new'][1] ) ) {
|
1201 |
$url = $this->form_data['replace_new'][1];
|
1202 |
+
$url = parse_url( $url );
|
1203 |
+
|
1204 |
+
if ( isset( $url['host'] ) ) {
|
1205 |
+
$this->domain_replace = $url['host'];
|
1206 |
+
} else {
|
1207 |
+
$this->domain_replace = false;
|
1208 |
+
}
|
1209 |
} else {
|
1210 |
$this->domain_replace = false;
|
1211 |
}
|
1292 |
$sql_constraints_query .= ";\n";
|
1293 |
|
1294 |
$create_query = implode(
|
1295 |
+
$crlf,
|
1296 |
+
array_slice( $sql_lines, 0, $i )
|
1297 |
+
)
|
1298 |
+
. $crlf
|
1299 |
+
. implode(
|
1300 |
+
$crlf,
|
1301 |
+
array_slice( $sql_lines, $j, $sql_count - 1 )
|
1302 |
+
);
|
1303 |
unset( $sql_lines );
|
1304 |
|
1305 |
$alter_table_query = $sql_constraints_query;
|
1329 |
$this->set_post_data();
|
1330 |
|
1331 |
if ( empty( $this->form_data ) ) {
|
1332 |
+
$this->form_data = $this->parse_migration_form_data( $this->state_data['form_data'] );
|
1333 |
}
|
1334 |
|
1335 |
+
$temp_prefix = ( isset( $this->state_data['temp_prefix'] ) ? $this->state_data['temp_prefix'] : $this->temp_prefix );
|
1336 |
+
$remote_prefix = ( isset( $this->state_data['prefix'] ) ? $this->state_data['prefix'] : $wpdb->prefix );
|
1337 |
|
1338 |
$table_structure = $wpdb->get_results( 'DESCRIBE ' . $this->backquote( $table ) );
|
1339 |
|
1340 |
if ( ! $table_structure ) {
|
1341 |
$this->error = __( 'Failed to retrieve table structure, please ensure your database is online. (#125)', 'wp-migrate-db' );
|
1342 |
+
|
1343 |
return false;
|
1344 |
}
|
1345 |
|
1346 |
+
$table_name = $table;
|
1347 |
+
$table_name = apply_filters( 'wpmdb_target_table_name', $table_name, $this->form_data['action'], $this->state_data['stage'] );
|
1348 |
+
|
1349 |
+
if ( 'savefile' !== $this->form_data['action'] && 'backup' !== $this->state_data['stage'] ) {
|
1350 |
+
$table_name = $temp_prefix . $table;
|
1351 |
+
}
|
1352 |
+
|
1353 |
$current_row = - 1;
|
1354 |
|
1355 |
+
if ( ! empty( $this->state_data['current_row'] ) ) {
|
1356 |
+
$temp_current_row = trim( $this->state_data['current_row'] );
|
1357 |
if ( ! empty( $temp_current_row ) ) {
|
1358 |
$current_row = (int) $temp_current_row;
|
1359 |
}
|
1361 |
|
1362 |
if ( $current_row == - 1 ) {
|
1363 |
// Add SQL statement to drop existing table
|
1364 |
+
if ( $this->form_data['action'] == 'savefile' || $this->state_data['stage'] == 'backup' ) {
|
1365 |
$this->stow( "\n\n" );
|
1366 |
$this->stow( "#\n" );
|
1367 |
+
$this->stow( '# ' . sprintf( __( 'Delete any existing table %s', 'wp-migrate-db' ), $this->backquote( $table_name ) ) . "\n" );
|
1368 |
$this->stow( "#\n" );
|
1369 |
$this->stow( "\n" );
|
|
|
|
|
|
|
1370 |
}
|
1371 |
+
$this->stow( 'DROP TABLE IF EXISTS ' . $this->backquote( $table_name ) . ";\n" );
|
1372 |
|
1373 |
// Table structure
|
1374 |
// Comment in SQL-file
|
1375 |
+
if ( $this->form_data['action'] == 'savefile' || $this->state_data['stage'] == 'backup' ) {
|
1376 |
$this->stow( "\n\n" );
|
1377 |
$this->stow( "#\n" );
|
1378 |
+
$this->stow( '# ' . sprintf( __( 'Table structure of table %s', 'wp-migrate-db' ), $this->backquote( $table_name ) ) . "\n" );
|
1379 |
$this->stow( "#\n" );
|
1380 |
$this->stow( "\n" );
|
1381 |
}
|
1384 |
|
1385 |
if ( false === $create_table ) {
|
1386 |
$this->error = __( 'Failed to generate the create table query, please ensure your database is online. (#126)', 'wp-migrate-db' );
|
|
|
|
|
1387 |
|
1388 |
+
return false;
|
|
|
1389 |
}
|
1390 |
+
$create_table[0][1] = str_replace( 'CREATE TABLE `' . $table . '`', 'CREATE TABLE `' . $table_name . '`', $create_table[0][1] );
|
1391 |
|
1392 |
$create_table[0][1] = str_replace( 'TYPE=', 'ENGINE=', $create_table[0][1] );
|
1393 |
|
1394 |
$alter_table_query = '';
|
1395 |
+
$create_table[0][1] = $this->process_sql_constraint( $create_table[0][1], $table_name, $alter_table_query );
|
1396 |
|
1397 |
+
$create_table[0][1] = apply_filters( 'wpmdb_create_table_query', $create_table[0][1], $table_name, $db_version );
|
1398 |
|
1399 |
$this->stow( $create_table[0][1] . ";\n" );
|
1400 |
|
1401 |
if ( ! empty( $alter_table_query ) ) {
|
1402 |
$alter_table_name = $this->get_alter_table_name();
|
1403 |
+
$insert = sprintf( "INSERT INTO %s ( `query` ) VALUES ( '%s' );\n", $this->backquote( $alter_table_name ), esc_sql( $alter_table_query ) );
|
1404 |
+
if ( $this->form_data['action'] == 'savefile' || $this->state_data['stage'] == 'backup' ) {
|
1405 |
+
$process_chunk_result = $this->process_chunk( $insert );
|
1406 |
+
if ( true !== $process_chunk_result ) {
|
1407 |
+
$result = $this->end_ajax( $process_chunk_result );
|
1408 |
+
|
1409 |
+
return $result;
|
1410 |
+
}
|
1411 |
+
} else {
|
1412 |
+
$this->stow( $insert );
|
1413 |
+
}
|
1414 |
+
}
|
1415 |
+
|
1416 |
+
$alter_data_queries = array();
|
1417 |
+
$alter_data_queries = apply_filters( 'wpmdb_alter_data_queries', $alter_data_queries, $table_name, $this->form_data['action'], $this->state_data['stage'] );
|
1418 |
+
|
1419 |
+
if ( ! empty( $alter_data_queries ) ) {
|
1420 |
+
$alter_table_name = $this->get_alter_table_name();
|
1421 |
+
$insert = '';
|
1422 |
+
foreach ( $alter_data_queries as $alter_data_query ) {
|
1423 |
+
$insert .= sprintf( "INSERT INTO %s ( `query` ) VALUES ( '%s' );\n", $this->backquote( $alter_table_name ), esc_sql( $alter_data_query ) );
|
1424 |
+
}
|
1425 |
+
if ( 'savefile' == $this->form_data['action'] || 'backup' == $this->state_data['stage'] ) {
|
1426 |
$process_chunk_result = $this->process_chunk( $insert );
|
1427 |
if ( true !== $process_chunk_result ) {
|
1428 |
$result = $this->end_ajax( $process_chunk_result );
|
1435 |
}
|
1436 |
|
1437 |
// Comment in SQL-file
|
1438 |
+
if ( $this->form_data['action'] == 'savefile' || $this->state_data['stage'] == 'backup' ) {
|
1439 |
$this->stow( "\n\n" );
|
1440 |
$this->stow( "#\n" );
|
1441 |
+
$this->stow( '# ' . sprintf( __( 'Data contents of table %s', 'wp-migrate-db' ), $this->backquote( $table_name ) ) . "\n" );
|
1442 |
$this->stow( "#\n" );
|
1443 |
}
|
1444 |
}
|
1449 |
$ints = array();
|
1450 |
foreach ( $table_structure as $struct ) {
|
1451 |
if ( ( 0 === strpos( $struct->Type, 'tinyint' ) ) ||
|
1452 |
+
( 0 === strpos( strtolower( $struct->Type ), 'smallint' ) ) ||
|
1453 |
+
( 0 === strpos( strtolower( $struct->Type ), 'mediumint' ) ) ||
|
1454 |
+
( 0 === strpos( strtolower( $struct->Type ), 'int' ) ) ||
|
1455 |
+
( 0 === strpos( strtolower( $struct->Type ), 'bigint' ) )
|
1456 |
) {
|
1457 |
$defs[ strtolower( $struct->Field ) ] = ( null === $struct->Default ) ? 'NULL' : $struct->Default;
|
1458 |
$ints[ strtolower( $struct->Field ) ] = '1';
|
1475 |
|
1476 |
$query_size = 0;
|
1477 |
|
|
|
|
|
|
|
|
|
|
|
|
|
1478 |
$this->primary_keys = array();
|
1479 |
$field_set = array();
|
1480 |
$use_primary_keys = true;
|
1492 |
}
|
1493 |
|
1494 |
$first_select = true;
|
1495 |
+
if ( ! empty( $this->state_data['primary_keys'] ) ) {
|
1496 |
+
$this->state_data['primary_keys'] = trim( $this->state_data['primary_keys'] );
|
1497 |
+
if ( ! empty( $this->state_data['primary_keys'] ) && is_serialized( $this->state_data['primary_keys'] ) ) {
|
1498 |
+
$this->primary_keys = unserialize( $this->state_data['primary_keys'] );
|
1499 |
$first_select = false;
|
1500 |
}
|
1501 |
}
|
1510 |
$order_by = '';
|
1511 |
// We need ORDER BY here because with LIMIT, sometimes it will return
|
1512 |
// the same results from the previous query and we'll have duplicate insert statements
|
1513 |
+
if ( 'backup' != $this->state_data['stage'] && false === empty( $this->form_data['exclude_spam'] ) ) {
|
1514 |
if ( $this->table_is( 'comments', $table ) ) {
|
1515 |
$where .= ' AND comment_approved != "spam"';
|
1516 |
} elseif ( $this->table_is( 'commentmeta', $table ) ) {
|
1520 |
}
|
1521 |
}
|
1522 |
|
1523 |
+
if ( 'backup' != $this->state_data['stage'] && isset( $this->form_data['exclude_post_types'] ) && ! empty( $this->form_data['select_post_types'] ) ) {
|
1524 |
$post_types = '\'' . implode( '\', \'', $this->form_data['select_post_types'] ) . '\'';
|
1525 |
if ( $this->table_is( 'posts', $table ) ) {
|
1526 |
$where .= ' AND `post_type` NOT IN ( ' . $post_types . ' )';
|
1540 |
}
|
1541 |
}
|
1542 |
|
1543 |
+
if ( 'backup' != $this->state_data['stage'] && true === apply_filters( 'wpmdb_exclude_transients', true ) && isset( $this->form_data['exclude_transients'] ) && '1' === $this->form_data['exclude_transients'] && ( $this->table_is( 'options', $table ) || ( isset( $wpdb->sitemeta ) && $wpdb->sitemeta == $table ) ) ) {
|
1544 |
$col_name = 'option_name';
|
1545 |
|
1546 |
if ( isset( $wpdb->sitemeta ) && $wpdb->sitemeta == $table ) {
|
1551 |
}
|
1552 |
|
1553 |
// don't export/migrate wpmdb specific option rows unless we're performing a backup
|
1554 |
+
if ( 'backup' != $this->state_data['stage'] && ( $this->table_is( 'options', $table ) || ( isset( $wpdb->sitemeta ) && $wpdb->sitemeta == $table ) ) ) {
|
1555 |
$col_name = 'option_name';
|
1556 |
|
1557 |
if ( isset( $wpdb->sitemeta ) && $wpdb->sitemeta == $table ) {
|
1561 |
$where .= " AND `{$col_name}` != 'wpmdb_settings'";
|
1562 |
$where .= " AND `{$col_name}` != 'wpmdb_error_log'";
|
1563 |
$where .= " AND `{$col_name}` != 'wpmdb_schema_version'";
|
1564 |
+
$where .= " AND `{$col_name}` NOT LIKE 'wpmdb_state_%'";
|
1565 |
}
|
1566 |
|
1567 |
$limit = "LIMIT {$row_start}, {$row_inc}";
|
1588 |
$i = 0;
|
1589 |
foreach ( $temp_primary_keys as $primary_key => $value ) {
|
1590 |
// only the last field in the key should be different in this subclause
|
1591 |
+
$operator = ( count( $temp_primary_keys ) - 1 == $i ? '>' : '=' );
|
1592 |
$subclauses[] = sprintf( '%s %s %s', $this->backquote( $primary_key ), $operator, $wpdb->prepare( '%s', $value ) );
|
1593 |
+
++ $i;
|
1594 |
}
|
1595 |
|
1596 |
// remove last field from array to reduce fields in next clause
|
1620 |
$table_data = $wpdb->get_results( $sql );
|
1621 |
|
1622 |
if ( $table_data ) {
|
1623 |
+
$to_search = isset( $this->find_replace_pairs['replace_old'] ) ? $this->find_replace_pairs['replace_old'] : '';
|
1624 |
+
$to_replace = isset( $this->find_replace_pairs['replace_new'] ) ? $this->find_replace_pairs['replace_new'] : '';
|
1625 |
+
$replacer = new WPMDB_Replace( array(
|
1626 |
+
'table' => $table,
|
1627 |
+
'search' => $to_search,
|
1628 |
+
'replace' => $to_replace,
|
1629 |
+
'intent' => $this->state_data['intent'],
|
1630 |
+
'base_domain' => $this->get_domain_replace(),
|
1631 |
+
'site_domain' => $this->get_domain_current_site(),
|
1632 |
+
'wpmdb' => $this,
|
1633 |
+
) );
|
1634 |
|
1635 |
foreach ( $table_data as $row ) {
|
1636 |
+
$skip_row = false;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1637 |
|
1638 |
+
if ( ! apply_filters( 'wpmdb_table_row', $row, $table, $this->form_data['action'], $this->state_data['stage'] ) ) {
|
1639 |
+
$skip_row = true;
|
1640 |
+
}
|
1641 |
|
1642 |
+
if ( ! $skip_row ) {
|
1643 |
+
$replacer->set_row( $row );
|
1644 |
+
$values = array();
|
|
|
|
|
1645 |
|
1646 |
+
foreach ( $row as $key => $value ) {
|
1647 |
+
$replacer->set_column( $key );
|
1648 |
|
1649 |
+
if ( isset( $ints[ strtolower( $key ) ] ) && $ints[ strtolower( $key ) ] ) {
|
1650 |
+
// make sure there are no blank spots in the insert syntax,
|
1651 |
+
// yet try to avoid quotation marks around integers
|
1652 |
+
$value = ( null === $value || '' === $value ) ? $defs[ strtolower( $key ) ] : $value;
|
1653 |
+
$values[] = ( '' === $value ) ? "''" : $value;
|
1654 |
+
continue;
|
1655 |
}
|
|
|
1656 |
|
1657 |
+
if ( null === $value ) {
|
1658 |
+
$values[] = 'NULL';
|
1659 |
+
continue;
|
|
|
|
|
|
|
1660 |
}
|
1661 |
|
1662 |
+
if ( is_multisite() && 'path' == $key && $this->state_data['stage'] != 'backup' && ( $wpdb->site == $table || $wpdb->blogs == $table ) ) {
|
1663 |
+
$old_path_current_site = $this->get_path_current_site();
|
1664 |
+
$new_path_current_site = '';
|
1665 |
+
|
1666 |
+
if ( ! empty( $this->state_data['path_current_site'] ) ) {
|
1667 |
+
$new_path_current_site = $this->state_data['path_current_site'];
|
1668 |
+
} elseif ( ! empty ( $this->form_data['replace_new'][1] ) ) {
|
1669 |
+
$new_path_current_site = $this->get_path_from_url( $this->form_data['replace_new'][1] );
|
1670 |
+
}
|
1671 |
+
|
1672 |
+
$new_path_current_site = apply_filters( 'wpmdb_new_path_current_site', $new_path_current_site );
|
1673 |
+
|
1674 |
+
if ( ! empty( $new_path_current_site ) && $old_path_current_site != $new_path_current_site ) {
|
1675 |
+
$pos = strpos( $value, $old_path_current_site );
|
1676 |
+
$value = substr_replace( $value, $new_path_current_site, $pos, strlen( $old_path_current_site ) );
|
1677 |
+
}
|
1678 |
}
|
1679 |
|
1680 |
+
if ( is_multisite() && 'domain' == $key && $this->state_data['stage'] != 'backup' && ( $wpdb->site == $table || $wpdb->blogs == $table ) ) {
|
1681 |
+
if ( ! empty( $this->state_data['domain_current_site'] ) ) {
|
1682 |
+
$main_domain_replace = $this->state_data['domain_current_site'];
|
1683 |
+
} elseif ( ! empty ( $this->form_data['replace_new'][1] ) ) {
|
1684 |
+
$url = $this->parse_url( $this->form_data['replace_new'][1] );
|
1685 |
+
$main_domain_replace = $url['host'];
|
1686 |
+
}
|
1687 |
+
|
1688 |
+
$domain_replaces = array();
|
1689 |
+
$main_domain_find = sprintf( '/%s/', preg_quote( $this->get_domain_current_site(), '/' ) );
|
1690 |
+
if ( isset( $main_domain_replace ) ) {
|
1691 |
+
$domain_replaces[ $main_domain_find ] = $main_domain_replace;
|
1692 |
+
}
|
1693 |
|
1694 |
+
$domain_replaces = apply_filters( 'wpmdb_domain_replaces', $domain_replaces );
|
|
|
1695 |
|
1696 |
+
$value = preg_replace( array_keys( $domain_replaces ), array_values( $domain_replaces ), $value );
|
|
|
|
|
1697 |
}
|
|
|
1698 |
|
1699 |
+
if ( 'guid' != $key || ( false === empty( $this->form_data['replace_guids'] ) && $this->table_is( 'posts', $table ) ) ) {
|
1700 |
+
if ( $this->state_data['stage'] != 'backup' ) {
|
1701 |
+
$value = $replacer->recursive_unserialize_replace( $value );
|
1702 |
+
}
|
1703 |
+
}
|
1704 |
|
1705 |
+
$value = $this->sql_addslashes( $value );
|
1706 |
+
$value = str_replace( $multibyte_search, $multibyte_replace, $value );
|
1707 |
|
1708 |
+
$values[] = "'" . $value . "'";
|
1709 |
+
}
|
1710 |
|
1711 |
+
$insert_line = '(' . implode( ', ', $values ) . '),';
|
1712 |
+
$insert_line .= "\n";
|
1713 |
+
} else {
|
1714 |
+
$insert_line = '';
|
1715 |
+
}
|
1716 |
|
1717 |
+
if ( ( strlen( $this->current_chunk ) + strlen( $insert_line ) + strlen( $insert_buffer ) + 30 ) > $this->maximum_chunk_size ) {
|
1718 |
if ( $insert_buffer == $insert_query_template ) {
|
1719 |
$insert_buffer .= $insert_line;
|
1720 |
|
1769 |
} while ( count( $table_data ) > 0 );
|
1770 |
|
1771 |
// Create footer/closing comment in SQL-file
|
1772 |
+
if ( 'savefile' == $this->form_data['action'] || 'backup' == $this->state_data['stage'] ) {
|
1773 |
$this->stow( "\n" );
|
1774 |
$this->stow( "#\n" );
|
1775 |
+
$this->stow( '# ' . sprintf( __( 'End of data contents of table %s', 'wp-migrate-db' ), $this->backquote( $table_name ) ) . "\n" );
|
1776 |
$this->stow( "# --------------------------------------------------------\n" );
|
1777 |
$this->stow( "\n" );
|
1778 |
|
1779 |
+
if ( $this->state_data['last_table'] == '1' ) {
|
1780 |
$this->stow( "#\n" );
|
1781 |
+
$this->stow( "# Add constraints back in and apply any alter data queries.\n" );
|
1782 |
$this->stow( "#\n\n" );
|
1783 |
$this->stow( $this->get_alter_queries() );
|
1784 |
$alter_table_name = $this->get_alter_table_name();
|
1785 |
|
1786 |
+
$wpdb->query( 'DROP TABLE IF EXISTS ' . $this->backquote( $alter_table_name ) . ';' );
|
1787 |
+
|
1788 |
+
if ( 'backup' == $this->state_data['stage'] ) {
|
1789 |
+
// Re-create our table to store 'ALTER' queries so we don't get duplicates.
|
1790 |
+
$create_alter_table_query = $this->get_create_alter_table_query();
|
1791 |
+
$process_chunk_result = $this->process_chunk( $create_alter_table_query );
|
1792 |
+
if ( true !== $process_chunk_result ) {
|
1793 |
+
$result = $this->end_ajax( $process_chunk_result );
|
1794 |
+
|
1795 |
+
return $result;
|
1796 |
+
}
|
1797 |
}
|
1798 |
}
|
1799 |
}
|
1801 |
$this->row_tracker = - 1;
|
1802 |
|
1803 |
return $this->transfer_chunk();
|
1804 |
+
} // end export_table()
|
1805 |
|
1806 |
+
/**
|
1807 |
+
* Check that the given table is of the desired type,
|
1808 |
+
* including single and multisite installs.
|
1809 |
+
* eg: wp_posts, wp_2_posts
|
1810 |
+
*
|
1811 |
+
* The scope argument can take one of the following:
|
1812 |
+
*
|
1813 |
+
* 'table' - Match on the un-prefixed table name, this is the default.
|
1814 |
+
* 'all' - Match on 'blog' and 'global' tables. No old tables are returned.
|
1815 |
+
* 'blog' - Match the blog-level tables for the queried blog.
|
1816 |
+
* 'global' - Match the global tables for the installation, matching multisite tables only if running multisite.
|
1817 |
+
* 'ms_global' - Match the multisite global tables, regardless if current installation is multisite.
|
1818 |
+
* 'non_ms_global' - Match the non multisite global tables, regardless if current installation is multisite.
|
1819 |
+
* 'old' - Matches tables which are deprecated.
|
1820 |
+
*
|
1821 |
+
* @param string $desired_table Can be empty to match on tables from scopes other than 'table'.
|
1822 |
+
* @param string $given_table
|
1823 |
+
* @param string $scope Optional type of table to match against, default is 'table'.
|
1824 |
+
* @param string $new_prefix Optional new prefix already added to $given_table.
|
1825 |
+
* @param int $blog_id Optional Only used with 'blog' scope to test against a specific subsite's tables other than current for $wpdb.
|
1826 |
+
*
|
1827 |
+
* @return boolean
|
1828 |
+
*/
|
1829 |
+
function table_is( $desired_table, $given_table, $scope = 'table', $new_prefix = '', $blog_id = 0 ) {
|
1830 |
global $wpdb;
|
1831 |
|
1832 |
+
$scopes = array( 'all', 'blog', 'global', 'ms_global', 'non_ms_global', 'old' );
|
1833 |
+
|
1834 |
+
if ( ! in_array( $scope, $scopes ) ) {
|
1835 |
+
$scope = 'table';
|
1836 |
+
}
|
1837 |
+
|
1838 |
+
if ( empty( $desired_table ) && 'table' === $scope ) {
|
1839 |
+
return false;
|
1840 |
+
}
|
1841 |
+
|
1842 |
+
if ( ! empty( $new_prefix ) && 0 === stripos( $given_table, $new_prefix ) ) {
|
1843 |
+
$given_table = substr_replace( $given_table, $wpdb->prefix, 0, strlen( $new_prefix ) );
|
1844 |
+
}
|
1845 |
+
|
1846 |
+
$match = false;
|
1847 |
+
$prefix_escaped = preg_quote( $wpdb->prefix, '/' );
|
1848 |
+
$desired_table_escaped = preg_quote( $desired_table, '/' );
|
1849 |
+
|
1850 |
+
if ( 'table' === $scope ) {
|
1851 |
+
if ( $wpdb->{$desired_table} == $given_table ||
|
1852 |
+
preg_match( '/' . $prefix_escaped . '[0-9]+_' . $desired_table_escaped . '/', $given_table )
|
1853 |
+
) {
|
1854 |
+
$match = true;
|
1855 |
+
}
|
1856 |
+
} else {
|
1857 |
+
if ( 'non_ms_global' === $scope ) {
|
1858 |
+
$tables = array_diff_key( $wpdb->tables( 'global', true, $blog_id ), $wpdb->tables( 'ms_global', true, $blog_id ) );
|
1859 |
+
} else {
|
1860 |
+
$tables = $wpdb->tables( $scope, true, $blog_id );
|
1861 |
+
}
|
1862 |
+
|
1863 |
+
if ( ! empty( $desired_table ) ) {
|
1864 |
+
$tables = array_intersect_key( $tables, array( $desired_table => '' ) );
|
1865 |
+
}
|
1866 |
+
|
1867 |
+
if ( ! empty( $tables ) ) {
|
1868 |
+
foreach ( $tables as $table_name ) {
|
1869 |
+
if ( ! empty( $table_name ) && strtolower( $table_name ) === strtolower( $given_table ) ) {
|
1870 |
+
$match = true;
|
1871 |
+
break;
|
1872 |
+
}
|
1873 |
+
}
|
1874 |
+
}
|
1875 |
+
}
|
1876 |
+
|
1877 |
+
return $match;
|
1878 |
}
|
1879 |
|
1880 |
/**
|
1881 |
+
* Return multisite-compatible names for requested
|
1882 |
+
* tables, based on queried table name
|
1883 |
*
|
1884 |
+
* @param array $tables List of table names required
|
1885 |
+
* @param string $queried_table Name of table from which to derive the blog ID
|
1886 |
*
|
1887 |
+
* @return array List of table names altered for multisite compatibility
|
1888 |
*/
|
1889 |
function get_ms_compat_table_names( $tables, $queried_table ) {
|
1890 |
global $wpdb;
|
1891 |
|
1892 |
// default table prefix
|
1893 |
+
$prefix = $wpdb->prefix;
|
1894 |
+
$prefix_escaped = preg_quote( $prefix, '/' );
|
1895 |
|
1896 |
// if multisite, extract blog ID from queried table name and add to prefix
|
1897 |
// won't match for primary blog because it uses standard table names, i.e. blog_id will never be 1
|
1898 |
+
if ( is_multisite() && preg_match( '/^' . $prefix_escaped . '([0-9]+)_/', $queried_table, $matches ) ) {
|
1899 |
$blog_id = $matches[1];
|
1900 |
$prefix .= $blog_id . '_';
|
1901 |
}
|
1931 |
return false;
|
1932 |
}
|
1933 |
|
1934 |
+
if ( $this->gzip() && isset( $this->form_data['gzip_file'] ) && $this->form_data['gzip_file'] ) {
|
1935 |
$fp = gzopen( $filename, $mode );
|
1936 |
} else {
|
1937 |
$fp = fopen( $filename, $mode );
|
1941 |
}
|
1942 |
|
1943 |
function close( $fp ) {
|
1944 |
+
if ( $this->gzip() && isset( $this->form_data['gzip_file'] ) && $this->form_data['gzip_file'] ) {
|
1945 |
gzclose( $fp );
|
1946 |
} else {
|
1947 |
fclose( $fp );
|
1950 |
unset( $this->fp );
|
1951 |
}
|
1952 |
|
1953 |
+
/**
|
1954 |
+
* Write query line to chunk, file pointer, or buffer depending on migration stage/action.
|
1955 |
+
*
|
1956 |
+
* @param string $query_line
|
1957 |
+
* @param bool $replace
|
1958 |
+
*
|
1959 |
+
* @return bool
|
1960 |
+
*/
|
1961 |
function stow( $query_line, $replace = true ) {
|
1962 |
$this->set_post_data();
|
1963 |
$this->current_chunk .= $query_line;
|
1964 |
|
1965 |
+
if ( 0 === strlen( $query_line ) ) {
|
1966 |
+
return true;
|
1967 |
+
}
|
1968 |
+
|
1969 |
+
if ( $this->form_data['action'] == 'savefile' || $this->state_data['stage'] == 'backup' ) {
|
1970 |
+
if ( $this->gzip() && isset( $this->form_data['gzip_file'] ) && $this->form_data['gzip_file'] ) {
|
1971 |
if ( ! @gzwrite( $this->fp, $query_line ) ) {
|
1972 |
$this->error = __( 'Failed to write the gzipped SQL data to the file. (#127)', 'wp-migrate-db' );
|
1973 |
|
1981 |
return false;
|
1982 |
}
|
1983 |
}
|
1984 |
+
} elseif ( $this->state_data['intent'] == 'pull' ) {
|
1985 |
+
echo apply_filters( 'wpmdb_before_response', $query_line );
|
1986 |
}
|
1987 |
}
|
1988 |
|
1989 |
+
/**
|
1990 |
+
* Called once our chunk buffer is full, will transfer the SQL to the remote server for importing
|
1991 |
+
*
|
1992 |
+
* @return array|void
|
1993 |
+
*/
|
1994 |
function transfer_chunk() {
|
1995 |
$this->set_post_data();
|
1996 |
|
1997 |
+
if ( $this->state_data['intent'] == 'savefile' || $this->state_data['stage'] == 'backup' ) {
|
1998 |
$this->close( $this->fp );
|
1999 |
|
2000 |
+
$result = array(
|
2001 |
+
'current_row' => $this->row_tracker,
|
2002 |
+
'primary_keys' => serialize( $this->primary_keys )
|
2003 |
+
);
|
2004 |
+
|
2005 |
+
if ( $this->state_data['intent'] == 'savefile' && $this->state_data['last_table'] == '1' ) {
|
2006 |
+
$result['dump_filename'] = $this->state_data['dump_filename'];
|
2007 |
+
$result['dump_path'] = $this->state_data['dump_path'];
|
2008 |
+
}
|
2009 |
+
|
2010 |
+
$result = $this->end_ajax( json_encode( $result ) );
|
2011 |
|
2012 |
return $result;
|
2013 |
}
|
2014 |
|
2015 |
+
if ( $this->state_data['intent'] == 'pull' ) {
|
2016 |
$result = $this->end_ajax( $this->row_tracker . ',' . serialize( $this->primary_keys ) );
|
2017 |
|
2018 |
return $result;
|
2019 |
}
|
2020 |
|
2021 |
$chunk_gzipped = '0';
|
2022 |
+
if ( isset( $this->state_data['gzip'] ) && $this->state_data['gzip'] == '1' && $this->gzip() ) {
|
2023 |
$this->current_chunk = gzcompress( $this->current_chunk );
|
2024 |
$chunk_gzipped = '1';
|
2025 |
}
|
2026 |
|
2027 |
$data = array(
|
2028 |
'action' => 'wpmdb_process_chunk',
|
2029 |
+
'table' => $this->state_data['table'],
|
2030 |
'chunk_gzipped' => $chunk_gzipped,
|
2031 |
'chunk' => $this->current_chunk,
|
2032 |
// NEEDS TO BE the last element in this array because of adding it back into the array in ajax_process_chunk()
|
2033 |
);
|
2034 |
|
2035 |
+
$data['sig'] = $this->create_signature( $data, $this->state_data['key'] );
|
2036 |
|
2037 |
+
$ajax_url = $this->ajax_url();
|
2038 |
$response = $this->remote_post( $ajax_url, $data, __FUNCTION__ );
|
2039 |
+
|
2040 |
ob_start();
|
2041 |
$this->display_errors();
|
2042 |
+
$maybe_errors = trim( ob_get_clean() );
|
|
|
2043 |
|
2044 |
+
if ( false === empty( $maybe_errors ) ) {
|
2045 |
+
$maybe_errors = array( 'wpmdb_error' => 1, 'body' => $maybe_errors );
|
2046 |
+
$result = $this->end_ajax( json_encode( $maybe_errors ) );
|
2047 |
+
|
2048 |
+
return $result;
|
2049 |
+
}
|
2050 |
+
|
2051 |
+
if ( '1' !== $response ) {
|
2052 |
+
$return = array( 'wpmdb_error' => 1, 'body' => $response );
|
2053 |
+
$result = $this->end_ajax( json_encode( $return ) );
|
2054 |
|
2055 |
return $result;
|
2056 |
}
|
2111 |
}
|
2112 |
|
2113 |
function network_admin_menu() {
|
2114 |
+
$title = ( $this->is_pro ) ? __( 'Migrate DB Pro', 'wp-migrate-db' ) : __( 'Migrate DB', 'wp-migrate-db' );
|
2115 |
$hook_suffix = add_submenu_page( 'settings.php',
|
2116 |
$title,
|
2117 |
$title,
|
2122 |
}
|
2123 |
|
2124 |
function admin_menu() {
|
2125 |
+
$title = ( $this->is_pro ) ? __( 'Migrate DB Pro', 'wp-migrate-db' ) : __( 'Migrate DB', 'wp-migrate-db' );
|
2126 |
$hook_suffix = add_management_page( $title,
|
2127 |
$title,
|
2128 |
'export',
|
2168 |
}
|
2169 |
|
2170 |
/**
|
2171 |
+
* Check for download
|
2172 |
+
* if found prepare file for download
|
2173 |
+
*
|
2174 |
+
* @return void
|
2175 |
*/
|
2176 |
+
function http_verify_download() {
|
2177 |
if ( ! empty( $_GET['download'] ) ) {
|
2178 |
$this->download_file();
|
2179 |
}
|
2180 |
+
}
|
2181 |
|
2182 |
+
/**
|
2183 |
+
* Check for wpmdb-download-log and related nonce
|
2184 |
+
* if found begin diagnostic logging
|
2185 |
+
*
|
2186 |
+
* @return void
|
2187 |
+
*/
|
2188 |
+
function http_prepare_download_log() {
|
2189 |
if ( isset( $_GET['wpmdb-download-log'] ) && wp_verify_nonce( $_GET['nonce'], 'wpmdb-download-log' ) ) {
|
2190 |
ob_start();
|
2191 |
$this->output_diagnostic_info();
|
2193 |
$log = ob_get_clean();
|
2194 |
$url = $this->parse_url( home_url() );
|
2195 |
$host = sanitize_file_name( $url['host'] );
|
2196 |
+
$filename = sprintf( '%s-diagnostic-log-%s.txt', $host, date( 'YmdHis' ) );
|
2197 |
header( 'Content-Description: File Transfer' );
|
2198 |
header( 'Content-Type: application/octet-stream' );
|
2199 |
header( 'Content-Length: ' . strlen( $log ) );
|
2201 |
echo $log;
|
2202 |
exit;
|
2203 |
}
|
2204 |
+
}
|
2205 |
|
2206 |
+
/**
|
2207 |
+
* Check for wpmdb-remove-licence and related nonce
|
2208 |
+
* if found cleanup routines related to licenced product
|
2209 |
+
*
|
2210 |
+
* @return void
|
2211 |
+
*/
|
2212 |
+
function http_remove_license() {
|
2213 |
if ( isset( $_GET['wpmdb-remove-licence'] ) && wp_verify_nonce( $_GET['nonce'], 'wpmdb-remove-licence' ) ) {
|
2214 |
$this->settings['licence'] = '';
|
2215 |
update_site_option( 'wpmdb_settings', $this->settings );
|
2221 |
wp_redirect( network_admin_url( $this->plugin_base . '#settings' ) );
|
2222 |
exit;
|
2223 |
}
|
2224 |
+
}
|
2225 |
|
2226 |
+
/**
|
2227 |
+
* Check for wpmdb-disable-ssl and related nonce
|
2228 |
+
* if found temporaily disable ssl via transient
|
2229 |
+
*
|
2230 |
+
* @return void
|
2231 |
+
*/
|
2232 |
+
function http_disable_ssl() {
|
2233 |
if ( isset( $_GET['wpmdb-disable-ssl'] ) && wp_verify_nonce( $_GET['nonce'], 'wpmdb-disable-ssl' ) ) {
|
2234 |
set_site_transient( 'wpmdb_temporarily_disable_ssl', '1', 60 * 60 * 24 * 30 ); // 30 days
|
2235 |
$hash = ( isset( $_GET['hash'] ) ) ? '#' . sanitize_title( $_GET['hash'] ) : '';
|
2239 |
wp_redirect( network_admin_url( $this->plugin_base . $hash ) );
|
2240 |
exit;
|
2241 |
}
|
2242 |
+
}
|
2243 |
|
2244 |
+
/**
|
2245 |
+
* Check for wpmdb-check-licence and related nonce
|
2246 |
+
* if found refresh licence details
|
2247 |
+
*
|
2248 |
+
* @return void
|
2249 |
+
*/
|
2250 |
+
function http_refresh_licence() {
|
2251 |
if ( isset( $_GET['wpmdb-check-licence'] ) && wp_verify_nonce( $_GET['nonce'], 'wpmdb-check-licence' ) ) {
|
2252 |
$hash = ( isset( $_GET['hash'] ) ) ? '#' . sanitize_title( $_GET['hash'] ) : '';
|
2253 |
// delete the licence transient as we want to attempt to fetch the licence details again
|
2256 |
wp_redirect( network_admin_url( $this->plugin_base . $hash ) );
|
2257 |
exit;
|
2258 |
}
|
2259 |
+
}
|
2260 |
+
|
2261 |
+
/**
|
2262 |
+
* Checks and sets up plugin assets.
|
2263 |
+
* Filter actions, enqueue scripts, define configuration, and constants.
|
2264 |
+
*
|
2265 |
+
* @return void
|
2266 |
+
*/
|
2267 |
+
function load_assets() {
|
2268 |
+
$this->http_verify_download();
|
2269 |
+
$this->http_prepare_download_log();
|
2270 |
+
$this->http_remove_license();
|
2271 |
+
$this->http_disable_ssl();
|
2272 |
+
$this->http_refresh_licence();
|
2273 |
|
2274 |
// add our custom CSS classes to <body>
|
2275 |
add_filter( 'admin_body_class', array( $this, 'admin_body_class' ) );
|
2276 |
|
2277 |
+
$plugins_url = trailingslashit( plugins_url( $this->plugin_folder_name ) );
|
2278 |
+
$version = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? time() : $this->plugin_version;
|
2279 |
+
$min = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
|
|
|
2280 |
|
2281 |
$src = $plugins_url . 'asset/css/styles.css';
|
2282 |
wp_enqueue_style( 'wp-migrate-db-pro-styles', $src, array(), $version );
|
2327 |
'saved' => _x( 'Saved', 'The settings were saved successfully', 'wp-migrate-db' ),
|
2328 |
'reset_api_key' => __( 'Any sites setup to use the current secret key will no longer be able to connect. You will need to update those sites with the newly generated secret key. Do you wish to continue?', 'wp-migrate-db' ),
|
2329 |
'reset_api_key_problem' => __( 'An error occurred when trying to generate the secret key. Please see the Help tab for details on how to request support. (#105)', 'wp-migrate-db' ),
|
2330 |
+
'remove_profile' => __( 'You are about to remove the migration profile "{{profile}}". This cannot be undone. Do you wish to continue?', 'wp-migrate-db' ),
|
2331 |
'remove_profile_problem' => __( 'An error occurred when trying to delete the profile. Please see the Help tab for details on how to request support. (#106)', 'wp-migrate-db' ),
|
2332 |
'remove_profile_not_found' => __( "The selected migration profile could not be deleted because it was not found.\nPlease refresh this page to see an accurate list of the currently available migration profiles.", 'wp-migrate-db' ),
|
2333 |
'change_connection_info' => __( 'If you change the connection details, you will lose any replaces and table selections you have made below. Do you wish to continue?', 'wp-migrate-db' ),
|
2356 |
'migration_cancelled' => _x( 'Migration cancelled', 'The migration has been cancelled', 'wp-migrate-db' ),
|
2357 |
'migration_complete' => _x( 'Migration complete', 'The migration completed successfully', 'wp-migrate-db' ),
|
2358 |
'finalizing_migration' => _x( 'Finalizing migration', 'The migration is in the last stages', 'wp-migrate-db' ),
|
2359 |
+
'flushing' => _x( 'Flushing caches and rewrite rules', 'The caches and rewrite rules for the target are being flushed', 'wp-migrate-db' ),
|
2360 |
'blacklist_problem' => __( 'A problem occurred when trying to add plugins to backlist.', 'wp-migrate-db' ),
|
2361 |
'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' ),
|
2362 |
'plugin_compatibility_settings_problem' => __( 'A problem occurred when trying to change the plugin compatibility setting.', 'wp-migrate-db' ),
|
2373 |
'ajax_json_message' => __( 'JSON Decoding Failure', 'wp-migrate-db' ),
|
2374 |
'ajax_json_errors' => __( 'Our AJAX request was expecting JSON but we received something else. Often this is caused by your theme and/or plugins spitting out PHP errors. If you can edit the theme or plugins causing the errors, you should be able to fix them up, but if not, you can set WP_DEBUG to false in wp-config.php to disable errors from showing up.', 'wp-migrate-db' ),
|
2375 |
'view_error_messages' => __( 'View error messages', 'wp-migrate-db' ),
|
2376 |
+
'delaying_next_request' => __( 'Waiting %s seconds before executing next step', 'wp-migrate-db' ),
|
2377 |
+
'delay_between_requests_problem' => __( 'A problem occurred when trying to change the delay between requests, please try again.', 'wp-migrate-db' ),
|
2378 |
+
'flush_problem' => __( 'A problem occurred when flushing caches and rewrite rules. (#145)', 'wp-migrate-db' ),
|
2379 |
)
|
2380 |
);
|
2381 |
|
2415 |
}
|
2416 |
}
|
2417 |
|
2418 |
+
/**
|
2419 |
+
* Supply inline JS data and nonces for enqueued scripts.
|
2420 |
+
*
|
2421 |
+
* @return void
|
2422 |
+
*/
|
2423 |
function admin_head_connection_info() {
|
2424 |
global $table_prefix;
|
2425 |
|
2426 |
+
$nonces = apply_filters( 'wpmdb_nonces', array(
|
2427 |
+
'update_max_request_size' => wp_create_nonce( 'update-max-request-size' ),
|
2428 |
+
'update_delay_between_requests' => wp_create_nonce( 'update-delay-between-requests' ),
|
2429 |
+
'check_licence' => wp_create_nonce( 'check-licence' ),
|
2430 |
+
'verify_connection_to_remote_site' => wp_create_nonce( 'verify-connection-to-remote-site' ),
|
2431 |
+
'activate_licence' => wp_create_nonce( 'activate-licence' ),
|
2432 |
+
'clear_log' => wp_create_nonce( 'clear-log' ),
|
2433 |
+
'get_log' => wp_create_nonce( 'get-log' ),
|
2434 |
+
'save_profile' => wp_create_nonce( 'save-profile' ),
|
2435 |
+
'initiate_migration' => wp_create_nonce( 'initiate-migration' ),
|
2436 |
+
'migrate_table' => wp_create_nonce( 'migrate-table' ),
|
2437 |
+
'finalize_migration' => wp_create_nonce( 'finalize-migration' ),
|
2438 |
+
'reset_api_key' => wp_create_nonce( 'reset-api-key' ),
|
2439 |
+
'delete_migration_profile' => wp_create_nonce( 'delete-migration-profile' ),
|
2440 |
+
'save_setting' => wp_create_nonce( 'save-setting' ),
|
2441 |
+
'copy_licence_to_remote_site' => wp_create_nonce( 'copy-licence-to-remote-site' ),
|
2442 |
+
'reactivate_licence' => wp_create_nonce( 'reactivate-licence' ),
|
2443 |
+
'process_notice_link' => wp_create_nonce( 'process-notice-link' ),
|
2444 |
+
'flush' => wp_create_nonce( 'flush' ),
|
2445 |
+
) );
|
2446 |
|
2447 |
+
$data = apply_filters( 'wpmdb_data', array(
|
2448 |
+
'connection_info' => array( site_url( '', 'https' ), $this->settings['key'] ),
|
2449 |
+
'this_url' => esc_html( addslashes( home_url() ) ),
|
2450 |
+
'this_path' => esc_html( addslashes( $this->absolute_root_file_path ) ),
|
2451 |
+
'this_domain' => esc_html( $this->get_domain_current_site() ),
|
2452 |
+
'this_tables' => $this->get_tables(),
|
2453 |
+
'this_prefixed_tables' => $this->get_tables( 'prefix' ),
|
2454 |
+
'this_table_sizes' => $this->get_table_sizes(),
|
2455 |
+
'this_table_rows' => $this->get_table_row_count(),
|
2456 |
+
'this_upload_url' => esc_html( addslashes( trailingslashit( $this->get_upload_info( 'url' ) ) ) ),
|
2457 |
+
'this_upload_dir_long' => esc_html( addslashes( trailingslashit( $this->get_upload_info( 'path' ) ) ) ),
|
2458 |
+
'this_uploads_dir' => esc_html( addslashes( $this->get_short_uploads_dir() ) ),
|
2459 |
+
'this_website_name' => sanitize_title_with_dashes( DB_NAME ),
|
2460 |
+
'this_download_url' => network_admin_url( $this->plugin_base . '&download=' ),
|
2461 |
+
'this_prefix' => esc_html( $table_prefix ),
|
2462 |
+
'is_multisite' => esc_html( is_multisite() ? 'true' : 'false' ),
|
2463 |
+
'openssl_available' => esc_html( $this->open_ssl_enabled() ? 'true' : 'false' ),
|
2464 |
+
'max_request' => esc_html( $this->settings['max_request'] ),
|
2465 |
+
'delay_between_requests' => esc_html( $this->settings['delay_between_requests'] ),
|
2466 |
+
'bottleneck' => esc_html( $this->get_bottleneck( 'max' ) ),
|
2467 |
+
'has_licence' => esc_html( $this->get_licence_key() == '' ? '0' : '1' ),
|
|
|
2468 |
// TODO: Use WP_Filesystem API.
|
2469 |
+
'write_permission' => esc_html( is_writeable( $this->get_upload_info( 'path' ) ) ? 'true' : 'false' ),
|
2470 |
+
'nonces' => $nonces,
|
2471 |
+
'valid_licence' => ( $this->is_valid_licence() ) ? '1' : '0',
|
2472 |
+
'profile' => isset( $_GET['wpmdb-profile'] ) ? $_GET['wpmdb-profile'] : '-1',
|
2473 |
+
'is_pro' => esc_html( ( $this->is_pro ) ? 'true' : 'false' ),
|
2474 |
+
'lower_case_table_names' => esc_html( $this->get_lower_case_table_names_setting() ),
|
2475 |
+
) );
|
2476 |
+
|
2477 |
+
wp_localize_script( 'wp-migrate-db-pro-script', 'wpmdb_data', $data );
|
2478 |
}
|
2479 |
|
2480 |
function maybe_update_profile( $profile, $profile_id ) {
|
2532 |
echo esc_html( ( isset( $option ) && $option == '1' ) ? ' checked="checked"' : '' );
|
2533 |
}
|
2534 |
|
2535 |
+
/**
|
2536 |
+
* Called to cancel an in-progress migration.
|
2537 |
+
*/
|
2538 |
function ajax_cancel_migration() {
|
2539 |
+
$key_rules = array(
|
2540 |
+
'action' => 'key',
|
2541 |
+
'migration_state_id' => 'key',
|
2542 |
+
);
|
2543 |
+
$this->set_post_data( $key_rules );
|
2544 |
|
2545 |
+
$this->form_data = $this->parse_migration_form_data( $this->state_data['form_data'] );
|
2546 |
+
|
2547 |
+
switch ( $this->state_data['intent'] ) {
|
2548 |
case 'savefile' :
|
2549 |
+
$this->delete_export_file( $this->state_data['dump_filename'], false );
|
2550 |
break;
|
2551 |
case 'push' :
|
2552 |
+
$data = $this->filter_post_elements( $this->state_data, array( 'action', 'intent', 'url', 'key', 'form_data', 'dump_filename', 'temp_prefix', 'stage' ) );
|
2553 |
+
$data['dumpfile_created'] = empty( $this->state_data['dumpfile_created'] ) ? 0 : 1;
|
2554 |
+
$data['action'] = 'wpmdb_process_push_migration_cancellation';
|
2555 |
+
$ajax_url = $this->ajax_url();
|
2556 |
+
$data['sig'] = $this->create_signature( $data, $data['key'] );
|
2557 |
|
2558 |
$response = $this->remote_post( $ajax_url, $data, __FUNCTION__ );
|
2559 |
$this->display_errors();
|
2561 |
echo esc_html( trim( $response ) );
|
2562 |
break;
|
2563 |
case 'pull' :
|
2564 |
+
if ( $this->state_data['stage'] == 'backup' ) {
|
2565 |
+
if ( ! empty( $this->state_data['dumpfile_created'] ) ) {
|
2566 |
+
$this->delete_export_file( $this->state_data['dump_filename'], true );
|
2567 |
+
}
|
2568 |
} else {
|
2569 |
+
$this->delete_temporary_tables( $this->state_data['temp_prefix'] );
|
2570 |
}
|
2571 |
break;
|
2572 |
default:
|
2573 |
break;
|
2574 |
}
|
2575 |
|
2576 |
+
if ( ! $this->migration_state->delete() ) {
|
2577 |
+
$this->log_error( 'Could not delete migration state.' );
|
2578 |
+
}
|
2579 |
+
|
2580 |
exit;
|
2581 |
}
|
2582 |
|
2747 |
// Following regex matches any PRIMARY KEY or KEY statement on a table definition that has a COMMENT statement attached.
|
2748 |
// The regex is then reset (\K) to return just the COMMENT, its string and any leading whitespace for replacing with nothing.
|
2749 |
$create_table = preg_replace( '/(?-i)KEY\s.*`.*`\).*\K\sCOMMENT\s\'.*\'/', '', $create_table );
|
2750 |
+
|
2751 |
+
// Replace utf8mb4 introduced in MySQL 5.5.3 with utf8. As of WordPress 4.2 utf8mb4 is used by default on supported MySQL versions
|
2752 |
+
// but causes migrations to fail when the remote site uses MySQL < 5.5.3.
|
2753 |
+
$create_table = preg_replace( '/(COLLATE\s)utf8mb4/', '$1utf8', $create_table ); // Column collation
|
2754 |
+
$create_table = preg_replace( '/(COLLATE=)utf8mb4/', '$1utf8', $create_table ); // Table collation
|
2755 |
+
$create_table = preg_replace( '/(CHARSET\s?=\s?)utf8mb4/', '$1utf8', $create_table ); // Table charset
|
2756 |
}
|
2757 |
|
2758 |
return $create_table;
|
2767 |
* @return array
|
2768 |
*/
|
2769 |
function parse_find_replace_pairs( $intent = '', $site_url = '' ) {
|
2770 |
+
$find_replace_pairs = array();
|
2771 |
$tmp_find_replace_pairs = array();
|
2772 |
if ( ! empty( $this->form_data['replace_old'] ) && ! empty( $this->form_data['replace_new'] ) ) {
|
2773 |
$tmp_find_replace_pairs = array_combine( $this->form_data['replace_old'], $this->form_data['replace_new'] );
|
2780 |
foreach ( $tmp_find_replace_pairs as $replace_old => $replace_new ) {
|
2781 |
$find_replace_pairs['replace_old'][ $i ] = $replace_old;
|
2782 |
$find_replace_pairs['replace_new'][ $i ] = $replace_new;
|
2783 |
+
$i ++;
|
2784 |
}
|
2785 |
}
|
2786 |
|
2798 |
function mixed_case_table_name_warning( $migration_type ) {
|
2799 |
ob_start();
|
2800 |
?>
|
2801 |
+
<h4><?php _e( "Warning: Mixed Case Table Names", 'wp-migrate-db' ); ?></h4>
|
2802 |
|
2803 |
+
<?php if ( 'pull' === $migration_type ) : ?>
|
2804 |
+
<p><?php _e( "Whoa! We've detected that your <b>local</b> site has the MySQL setting <code>lower_case_table_names</code> set to <code>1</code>.", 'wp-migrate-db' ); ?></p>
|
2805 |
+
<?php else : ?>
|
2806 |
+
<p><?php _e( "Whoa! We've detected that your <b>remote</b> site has the MySQL setting <code>lower_case_table_names</code> set to <code>1</code>.", 'wp-migrate-db' ); ?></p>
|
2807 |
+
<?php endif; ?>
|
2808 |
|
2809 |
+
<p><?php _e( "As a result, uppercase characters in table names will be converted to lowercase during the migration.", 'wp-migrate-db' ); ?></p>
|
2810 |
|
2811 |
+
<p><?php printf( __( 'You can read more about this in <a href="%s">our documentation</a>, proceed with caution.', 'wp-migrate-db' ), 'https://deliciousbrains.com/wp-migrate-db-pro/doc/mixed-case-table-names/' ); ?></p>
|
2812 |
<?php
|
2813 |
return wptexturize( ob_get_clean() );
|
2814 |
}
|
|
|
2815 |
}
|
@@ -4,7 +4,7 @@ Plugin Name: WP Migrate DB Pro Compatibility
|
|
4 |
Plugin URI: http://deliciousbrains.com/wp-migrate-db-pro/
|
5 |
Description: Prevents 3rd party plugins from being loaded during WP Migrate DB Pro specific operations
|
6 |
Author: Delicious Brains
|
7 |
-
Version: 1.
|
8 |
Author URI: http://deliciousbrains.com
|
9 |
*/
|
10 |
|
@@ -53,18 +53,23 @@ add_action( 'admin_init', 'wpmdbc_tgmpa_compatibility', 1 );
|
|
53 |
* @return array
|
54 |
*/
|
55 |
function wpmdbc_exclude_plugins( $plugins ) {
|
56 |
-
if ( !
|
57 |
return $plugins;
|
58 |
}
|
59 |
-
|
60 |
-
if ( !
|
61 |
-
|
62 |
}
|
63 |
-
|
64 |
-
|
65 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
66 |
}
|
67 |
-
unset( $plugins[ $key ] );
|
68 |
}
|
69 |
|
70 |
return $plugins;
|
@@ -80,21 +85,61 @@ add_filter( 'option_active_plugins', 'wpmdbc_exclude_plugins' );
|
|
80 |
* @return array
|
81 |
*/
|
82 |
function wpmdbc_exclude_site_plugins( $plugins ) {
|
83 |
-
if ( !
|
84 |
return $plugins;
|
85 |
}
|
86 |
-
|
87 |
-
if ( !
|
88 |
-
|
89 |
}
|
90 |
-
|
91 |
-
|
92 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
93 |
}
|
94 |
-
unset( $plugins[ $plugin ] );
|
95 |
}
|
96 |
|
97 |
return $plugins;
|
98 |
}
|
99 |
|
100 |
add_filter( 'site_option_active_sitewide_plugins', 'wpmdbc_exclude_site_plugins' );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4 |
Plugin URI: http://deliciousbrains.com/wp-migrate-db-pro/
|
5 |
Description: Prevents 3rd party plugins from being loaded during WP Migrate DB Pro specific operations
|
6 |
Author: Delicious Brains
|
7 |
+
Version: 1.1
|
8 |
Author URI: http://deliciousbrains.com
|
9 |
*/
|
10 |
|
53 |
* @return array
|
54 |
*/
|
55 |
function wpmdbc_exclude_plugins( $plugins ) {
|
56 |
+
if ( ! is_array( $plugins ) || empty( $plugins ) ) {
|
57 |
return $plugins;
|
58 |
}
|
59 |
+
|
60 |
+
if ( ! wpmdbc_is_compatibility_mode_request() ) {
|
61 |
+
return $plugins;
|
62 |
}
|
63 |
+
|
64 |
+
$blacklist_plugins = wpmdbc_get_blacklist_plugins();
|
65 |
+
|
66 |
+
if ( ! empty( $blacklist_plugins ) ) {
|
67 |
+
foreach ( $plugins as $key => $plugin ) {
|
68 |
+
if ( false !== strpos( $plugin, 'wp-migrate-db-pro' ) || ! isset( $blacklist_plugins[ $plugin ] ) ) {
|
69 |
+
continue;
|
70 |
+
}
|
71 |
+
unset( $plugins[ $key ] );
|
72 |
}
|
|
|
73 |
}
|
74 |
|
75 |
return $plugins;
|
85 |
* @return array
|
86 |
*/
|
87 |
function wpmdbc_exclude_site_plugins( $plugins ) {
|
88 |
+
if ( ! is_array( $plugins ) || empty( $plugins ) ) {
|
89 |
return $plugins;
|
90 |
}
|
91 |
+
|
92 |
+
if ( ! wpmdbc_is_compatibility_mode_request() ) {
|
93 |
+
return $plugins;
|
94 |
}
|
95 |
+
|
96 |
+
$blacklist_plugins = wpmdbc_get_blacklist_plugins();
|
97 |
+
|
98 |
+
if ( ! empty( $blacklist_plugins ) ) {
|
99 |
+
foreach ( array_keys( $plugins ) as $plugin ) {
|
100 |
+
if ( false !== strpos( $plugin, 'wp-migrate-db-pro' ) || ! isset( $blacklist_plugins[ $plugin ] ) ) {
|
101 |
+
continue;
|
102 |
+
}
|
103 |
+
unset( $plugins[ $plugin ] );
|
104 |
}
|
|
|
105 |
}
|
106 |
|
107 |
return $plugins;
|
108 |
}
|
109 |
|
110 |
add_filter( 'site_option_active_sitewide_plugins', 'wpmdbc_exclude_site_plugins' );
|
111 |
+
|
112 |
+
/**
|
113 |
+
* Should the current request be processed by Compatibility Mode?
|
114 |
+
*
|
115 |
+
* @return bool
|
116 |
+
*/
|
117 |
+
function wpmdbc_is_compatibility_mode_request() {
|
118 |
+
if ( ! defined( 'DOING_AJAX' ) ||
|
119 |
+
! DOING_AJAX ||
|
120 |
+
! isset( $_POST['action'] ) ||
|
121 |
+
false === strpos( $_POST['action'], 'wpmdb' ) ||
|
122 |
+
in_array( $_POST['action'], array( 'wpmdb_flush', 'wpmdb_remote_flush' ) )
|
123 |
+
) {
|
124 |
+
return false;
|
125 |
+
}
|
126 |
+
|
127 |
+
return true;
|
128 |
+
}
|
129 |
+
|
130 |
+
/**
|
131 |
+
* Returns an array of plugin slugs to be blacklisted.
|
132 |
+
*
|
133 |
+
* @return array
|
134 |
+
*/
|
135 |
+
function wpmdbc_get_blacklist_plugins() {
|
136 |
+
$blacklist_plugins = array();
|
137 |
+
|
138 |
+
$wpmdb_settings = get_site_option( 'wpmdb_settings' );
|
139 |
+
|
140 |
+
if ( ! empty( $wpmdb_settings['blacklist_plugins'] ) ) {
|
141 |
+
$blacklist_plugins = array_flip( $wpmdb_settings['blacklist_plugins'] );
|
142 |
+
}
|
143 |
+
|
144 |
+
return $blacklist_plugins;
|
145 |
+
}
|
@@ -1,42 +1,41 @@
|
|
1 |
-
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
9 |
"MIME-Version: 1.0\n"
|
10 |
"Content-Type: text/plain; charset=UTF-8\n"
|
11 |
"Content-Transfer-Encoding: 8bit\n"
|
12 |
-
"X-Generator: Poedit 1.6.8\n"
|
13 |
-
"X-Poedit-Basepath: ..\n"
|
14 |
-
"X-Poedit-SourceCharset: UTF-8\n"
|
15 |
-
"X-Poedit-KeywordsList: __;_e;_n:1,2;_x:1,2c;_ex:1,2c;_nx:4c,1,2;esc_attr__;"
|
16 |
-
"esc_attr_e;esc_attr_x:1,2c;esc_html__;esc_html_e;esc_html_x:1,2c;_n_noop:1,2;"
|
17 |
-
"_nx_noop:3c,1,2;__ngettext_noop:1,2\n"
|
18 |
-
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
19 |
-
"X-Poedit-SearchPath-0: .\n"
|
20 |
|
21 |
-
#: class/wpmdb-base.php:
|
22 |
msgid ""
|
23 |
"Invalid content verification signature, please verify the connection "
|
24 |
"information on the remote site and try again."
|
25 |
msgstr ""
|
26 |
|
27 |
-
#: class/wpmdb-base.php:
|
28 |
#, php-format
|
29 |
msgid ""
|
30 |
"The connection to the remote server has timed out, no changes have been "
|
31 |
"committed. (#134 - scope: %s)"
|
32 |
msgstr ""
|
33 |
|
34 |
-
#: class/wpmdb-base.php:
|
35 |
#, php-format
|
36 |
msgid "We could not find: %s. Are you sure this is the correct URL?"
|
37 |
msgstr ""
|
38 |
|
39 |
-
#: class/wpmdb-base.php:
|
40 |
msgid ""
|
41 |
"It appears that you might be trying to pull from a local environment. This "
|
42 |
"will not work if <u>this</u> website happens to be located on a remote "
|
@@ -44,7 +43,7 @@ msgid ""
|
|
44 |
"environment."
|
45 |
msgstr ""
|
46 |
|
47 |
-
#: class/wpmdb-base.php:
|
48 |
msgid ""
|
49 |
"It appears that you might be trying to push to a local environment. This "
|
50 |
"will not work if <u>this</u> website happens to be located on a remote "
|
@@ -52,40 +51,62 @@ msgid ""
|
|
52 |
"environment."
|
53 |
msgstr ""
|
54 |
|
55 |
-
#: class/wpmdb-base.php:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
56 |
#, php-format
|
57 |
msgid ""
|
58 |
"The connection failed, an unexpected error occurred, please contact support. "
|
59 |
"(#121 - scope: %s)"
|
60 |
msgstr ""
|
61 |
|
62 |
-
#: class/wpmdb-base.php:
|
63 |
msgid ""
|
64 |
"The remote site is protected with Basic Authentication. Please enter the "
|
65 |
"username and password above to continue. (401 Unauthorized)"
|
66 |
msgstr ""
|
67 |
|
68 |
-
#: class/wpmdb-base.php:
|
69 |
#, php-format
|
70 |
msgid ""
|
71 |
"Unable to connect to the remote server, please check the connection details "
|
72 |
"- %1$s %2$s (#129 - scope: %3$s)"
|
73 |
msgstr ""
|
74 |
|
75 |
-
#: class/wpmdb-base.php:
|
|
|
76 |
msgid ""
|
77 |
-
"
|
78 |
-
"
|
79 |
msgstr ""
|
80 |
|
81 |
-
#: class/wpmdb-base.php:
|
82 |
#, php-format
|
83 |
msgid ""
|
84 |
-
"
|
85 |
-
"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
86 |
msgstr ""
|
87 |
|
88 |
-
#: class/wpmdb-base.php:
|
|
|
89 |
#, php-format
|
90 |
msgid ""
|
91 |
"<strong>Could not connect to deliciousbrains.com</strong> — You will "
|
@@ -93,61 +114,62 @@ msgid ""
|
|
93 |
"this is fixed. This issue is often caused by an improperly configured SSL "
|
94 |
"server (https). We recommend <a href=\"%1$s\" target=\"_blank\">fixing the "
|
95 |
"SSL configuration on your server</a>, but if you need a quick fix you can:"
|
96 |
-
"
|
97 |
-
"disable SSL for connections to deliciousbrains.com</a></p>"
|
98 |
msgstr ""
|
99 |
|
100 |
-
#: class/wpmdb-base.php:
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
#: class/wpmdb-base.php:508
|
105 |
-
msgid "There is a new version of "
|
106 |
msgstr ""
|
107 |
|
108 |
-
#: class/wpmdb-base.php:
|
|
|
109 |
#, php-format
|
110 |
-
msgid "
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
msgid "Settings"
|
117 |
msgstr ""
|
118 |
|
119 |
-
#: class/wpmdb-base.php:
|
120 |
-
#, php-format
|
121 |
msgid ""
|
122 |
-
"
|
123 |
-
"
|
124 |
msgstr ""
|
125 |
|
126 |
-
#: class/wpmdb-base.php:
|
127 |
#, php-format
|
128 |
-
|
129 |
-
"
|
130 |
-
"you don't have a license key, you may <a href=\"%3$s\">purchase one</a>."
|
131 |
msgstr ""
|
132 |
|
133 |
-
#: class/wpmdb-base.php:
|
134 |
-
|
135 |
-
msgid "Check my license again"
|
136 |
msgstr ""
|
137 |
|
138 |
-
#: class/wpmdb-base.php:
|
139 |
#, php-format
|
140 |
msgid ""
|
141 |
"Error retrieving download from deliciousbrain.com. Please try again or "
|
142 |
"download manually from <a href=\"%1$s\">%2$s</a>."
|
143 |
msgstr ""
|
144 |
|
145 |
-
#: class/wpmdb-base.php:
|
146 |
msgctxt "Delicious Brains account"
|
147 |
msgid "My Account"
|
148 |
msgstr ""
|
149 |
|
150 |
-
#: class/wpmdb-base.php:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
151 |
#, php-format
|
152 |
msgid ""
|
153 |
"To finish activating WP Migrate DB Pro, please go to %1$s and enter your "
|
@@ -155,45 +177,45 @@ msgid ""
|
|
155 |
"\">purchase one</a>."
|
156 |
msgstr ""
|
157 |
|
158 |
-
#: class/wpmdb-base.php:
|
|
|
159 |
msgctxt "A new version of the plugin is available"
|
160 |
msgid "Update Available"
|
161 |
msgstr ""
|
162 |
|
163 |
-
#: class/wpmdb-base.php:
|
164 |
#, php-format
|
165 |
-
msgid ""
|
166 |
-
"%1$s %2$s is now available. You currently have %3$s installed. <a href=\"%4$s"
|
167 |
-
"\">%5$s</a>"
|
168 |
msgstr ""
|
169 |
|
170 |
-
#: class/wpmdb-base.php:
|
|
|
171 |
msgctxt "Download and install a new version of the plugin"
|
172 |
msgid "Update Now"
|
173 |
msgstr ""
|
174 |
|
175 |
-
#: class/wpmdb-base.php:
|
176 |
#, php-format
|
177 |
msgid ""
|
178 |
-
"
|
179 |
-
"\"
|
180 |
msgstr ""
|
181 |
|
182 |
-
#: class/wpmdb-base.php:
|
183 |
#, php-format
|
184 |
msgid ""
|
185 |
-
"<strong>
|
186 |
-
"
|
187 |
-
"
|
188 |
-
"server (https). We recommend <a href=\"%s\" target=\"_blank\">fixing the SSL "
|
189 |
-
"configuration on your server</a>, but if you need a quick fix you can:"
|
190 |
msgstr ""
|
191 |
|
192 |
-
#: class/wpmdb-base.php:
|
193 |
-
msgid "
|
|
|
|
|
194 |
msgstr ""
|
195 |
|
196 |
-
#: class/wpmdb-base.php:
|
197 |
#, php-format
|
198 |
msgid ""
|
199 |
"<strong>Your License Was Cancelled</strong> — Please visit <a href=\"%s"
|
@@ -201,15 +223,43 @@ msgid ""
|
|
201 |
"enable push and pull."
|
202 |
msgstr ""
|
203 |
|
204 |
-
#: class/wpmdb-base.php:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
205 |
#, php-format
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
206 |
msgid ""
|
207 |
-
"
|
208 |
-
"
|
209 |
-
"push and pull."
|
210 |
msgstr ""
|
211 |
|
212 |
-
#: class/wpmdb-base.php:
|
213 |
#, php-format
|
214 |
msgid ""
|
215 |
"<strong>No Activations Left</strong> — Please visit <a href=\"%s\" "
|
@@ -217,7 +267,7 @@ msgid ""
|
|
217 |
"previous activation and enable push and pull."
|
218 |
msgstr ""
|
219 |
|
220 |
-
#: class/wpmdb-base.php:
|
221 |
#, php-format
|
222 |
msgid ""
|
223 |
"<strong>Your License Was Not Found</strong> — Perhaps you made a typo "
|
@@ -226,303 +276,486 @@ msgid ""
|
|
226 |
"license key."
|
227 |
msgstr ""
|
228 |
|
229 |
-
#: class/wpmdb-base.php:
|
230 |
msgid "<strong>Your License Was Not Found</strong> — "
|
231 |
msgstr ""
|
232 |
|
233 |
-
#: class/wpmdb-base.php:
|
234 |
msgid "Your License Is Inactive"
|
235 |
msgstr ""
|
236 |
|
237 |
-
#: class/wpmdb-base.php:
|
238 |
msgid "Your license has been deactivated for this install."
|
239 |
msgstr ""
|
240 |
|
241 |
-
#: class/wpmdb-base.php:
|
242 |
msgid "Reactivate License"
|
243 |
msgstr ""
|
244 |
|
245 |
-
#: class/wpmdb-base.php:
|
246 |
#, php-format
|
247 |
msgid ""
|
248 |
"<strong>An Unexpected Error Occurred</strong> — Please contact us at "
|
249 |
"<a href=\"%1$s\">%2$s</a> and quote the following:"
|
250 |
msgstr ""
|
251 |
|
252 |
-
#: class/wpmdb-base.php:
|
253 |
#, php-format
|
254 |
msgid "Invalid nonce for: %s"
|
255 |
msgstr ""
|
256 |
|
257 |
-
#: class/wpmdb-base.php:
|
258 |
#, php-format
|
259 |
msgid "Access denied for: %s"
|
260 |
msgstr ""
|
261 |
|
262 |
-
#: class/wpmdb.php:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
263 |
msgctxt "Configure a migration or export"
|
264 |
msgid "Migrate"
|
265 |
msgstr ""
|
266 |
|
267 |
-
#: class/wpmdb.php:
|
268 |
msgctxt "Get help or contact support"
|
269 |
msgid "Help"
|
270 |
msgstr ""
|
271 |
|
272 |
-
#: class/wpmdb.php:
|
273 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
274 |
msgstr ""
|
275 |
|
276 |
-
#: class/wpmdb.php:
|
277 |
-
|
|
|
278 |
msgstr ""
|
279 |
|
280 |
-
#: class/wpmdb.php:
|
|
|
|
|
281 |
msgid ""
|
282 |
"Failed attempting to unserialize the response from the remote server. Please "
|
283 |
"contact support."
|
284 |
msgstr ""
|
285 |
|
286 |
-
#: class/wpmdb.php:
|
287 |
msgid ""
|
288 |
"Failed to retrieve table structure, please ensure your database is online. "
|
289 |
"(#125)"
|
290 |
msgstr ""
|
291 |
|
292 |
-
#: class/wpmdb.php:
|
293 |
#, php-format
|
294 |
msgid "Delete any existing table %s"
|
295 |
msgstr ""
|
296 |
|
297 |
-
#: class/wpmdb.php:
|
298 |
#, php-format
|
299 |
msgid "Table structure of table %s"
|
300 |
msgstr ""
|
301 |
|
302 |
-
#: class/wpmdb.php:
|
303 |
msgid ""
|
304 |
"Failed to generate the create table query, please ensure your database is "
|
305 |
"online. (#126)"
|
306 |
msgstr ""
|
307 |
|
308 |
-
#: class/wpmdb.php:
|
309 |
#, php-format
|
310 |
msgid "Data contents of table %s"
|
311 |
msgstr ""
|
312 |
|
313 |
-
#: class/wpmdb.php:
|
314 |
#, php-format
|
315 |
msgid "End of data contents of table %s"
|
316 |
msgstr ""
|
317 |
|
318 |
-
#: class/wpmdb.php:
|
319 |
msgid "WordPress MySQL database migration"
|
320 |
msgstr ""
|
321 |
|
322 |
-
#: class/wpmdb.php:
|
323 |
#, php-format
|
324 |
msgid "Generated: %s"
|
325 |
msgstr ""
|
326 |
|
327 |
-
#: class/wpmdb.php:
|
328 |
#, php-format
|
329 |
msgid "Hostname: %s"
|
330 |
msgstr ""
|
331 |
|
332 |
-
#: class/wpmdb.php:
|
333 |
#, php-format
|
334 |
msgid "Database: %s"
|
335 |
msgstr ""
|
336 |
|
337 |
-
#: class/wpmdb.php:
|
338 |
msgid "Failed to write the gzipped SQL data to the file. (#127)"
|
339 |
msgstr ""
|
340 |
|
341 |
-
#: class/wpmdb.php:
|
342 |
msgid "Failed to write the SQL data to the file. (#128)"
|
343 |
msgstr ""
|
344 |
|
345 |
-
#: class/wpmdb.php:
|
|
|
|
|
346 |
msgid "Migrate DB Pro"
|
347 |
msgstr ""
|
348 |
|
349 |
-
#: class/wpmdb.php:
|
|
|
|
|
350 |
msgid "Migrate DB"
|
351 |
msgstr ""
|
352 |
|
353 |
-
#: class/wpmdb.php:
|
354 |
msgid ""
|
355 |
"A problem occurred when trying to change the maximum request size, please "
|
356 |
"try again."
|
357 |
msgstr ""
|
358 |
|
359 |
-
#: class/wpmdb.php:
|
|
|
360 |
msgid "A problem occurred when trying to check the license, please try again."
|
361 |
msgstr ""
|
362 |
|
363 |
-
#: class/wpmdb.php:
|
364 |
msgid "Establishing connection to remote server, please wait"
|
365 |
msgstr ""
|
366 |
|
367 |
-
#: class/wpmdb.php:
|
368 |
msgid ""
|
369 |
"A problem occurred when attempting to connect to the local server, please "
|
370 |
"check the details and try again."
|
371 |
msgstr ""
|
372 |
|
373 |
-
#: class/wpmdb.php:
|
374 |
msgid "Please enter your license key."
|
375 |
msgstr ""
|
376 |
|
377 |
-
#: class/wpmdb.php:
|
378 |
msgid ""
|
379 |
"A problem occurred when trying to register the license, please try again."
|
380 |
msgstr ""
|
381 |
|
382 |
-
#: class/wpmdb.php:
|
383 |
msgid ""
|
384 |
"Your license has been activated. You will now receive automatic updates and "
|
385 |
"access to email support."
|
386 |
msgstr ""
|
387 |
|
388 |
-
#: class/wpmdb.php:
|
|
|
389 |
msgid "Fetching license details, please wait..."
|
390 |
msgstr ""
|
391 |
|
392 |
-
#: class/wpmdb.php:
|
393 |
msgid ""
|
394 |
"An error occurred when trying to clear the debug log. Please contact "
|
395 |
"support. (#132)"
|
396 |
msgstr ""
|
397 |
|
398 |
-
#: class/wpmdb.php:
|
399 |
msgid ""
|
400 |
"An error occurred when trying to update the debug log. Please contact "
|
401 |
"support. (#133)"
|
402 |
msgstr ""
|
403 |
|
404 |
-
#: class/wpmdb.php:
|
405 |
msgctxt "Copy data between servers and save migration profile"
|
406 |
-
msgid "Migrate
|
407 |
msgstr ""
|
408 |
|
409 |
-
#: class/wpmdb.php:
|
410 |
msgctxt "Copy data between servers"
|
411 |
-
msgid "Migrate
|
412 |
msgstr ""
|
413 |
|
414 |
-
#: class/wpmdb.php:
|
415 |
msgid "Please select at least one table to migrate."
|
416 |
msgstr ""
|
417 |
|
418 |
-
#: class/wpmdb.php:
|
419 |
msgid "Please enter a name for your migration profile."
|
420 |
msgstr ""
|
421 |
|
422 |
-
#: class/wpmdb.php:
|
423 |
msgid ""
|
424 |
"An error occurred when attempting to save the migration profile. Please see "
|
425 |
"the Help tab for details on how to request support. (#118)"
|
426 |
msgstr ""
|
427 |
|
428 |
-
#: class/wpmdb.php:
|
429 |
msgctxt "Data has been successfully exported"
|
430 |
msgid "Exporting complete"
|
431 |
msgstr ""
|
432 |
|
433 |
-
#: class/wpmdb.php:
|
434 |
msgid "Exporting, please wait..."
|
435 |
msgstr ""
|
436 |
|
437 |
-
#: class/wpmdb.php:
|
438 |
msgid "please wait..."
|
439 |
msgstr ""
|
440 |
|
441 |
-
#: class/wpmdb.php:
|
442 |
msgctxt "Finished successfully"
|
443 |
msgid "complete"
|
444 |
msgstr ""
|
445 |
|
446 |
-
#: class/wpmdb.php:
|
447 |
msgctxt "Copy of data between servers did not complete"
|
448 |
msgid "Migration failed"
|
449 |
msgstr ""
|
450 |
|
451 |
-
#: class/wpmdb.php:
|
452 |
msgctxt "Saving a copy of the data before import"
|
453 |
msgid "Backing up"
|
454 |
msgstr ""
|
455 |
|
456 |
-
#: class/wpmdb.php:
|
457 |
msgctxt "Copying data between servers"
|
458 |
msgid "Migrating"
|
459 |
msgstr ""
|
460 |
|
461 |
-
#: class/wpmdb.php:
|
462 |
msgctxt "Current request status"
|
463 |
msgid "Status"
|
464 |
msgstr ""
|
465 |
|
466 |
-
#: class/wpmdb.php:
|
467 |
msgctxt "The message the server responded with"
|
468 |
msgid "Response"
|
469 |
msgstr ""
|
470 |
|
471 |
-
#: class/wpmdb.php:
|
472 |
msgid ""
|
473 |
"A problem occurred when attempting to process the following table (#113)"
|
474 |
msgstr ""
|
475 |
|
476 |
-
#: class/wpmdb.php:
|
477 |
msgid ""
|
478 |
"A problem occurred when processing the following table. We were expecting a "
|
479 |
"response in JSON format but instead received an empty response."
|
480 |
msgstr ""
|
481 |
|
482 |
-
#: class/wpmdb.php:
|
483 |
msgid "Migration completed with some errors"
|
484 |
msgstr ""
|
485 |
|
486 |
-
#: class/wpmdb.php:
|
487 |
msgid "Migration complete, your backup is located at:"
|
488 |
msgstr ""
|
489 |
|
490 |
-
#: class/wpmdb.php:
|
491 |
msgid "A problem occurred when finalizing the backup. (#140)"
|
492 |
msgstr ""
|
493 |
|
494 |
-
#: class/wpmdb.php:
|
495 |
-
#: template/common/
|
|
|
|
|
496 |
msgctxt "The settings were saved successfully"
|
497 |
msgid "Saved"
|
498 |
msgstr ""
|
499 |
|
500 |
-
#: class/wpmdb.php:
|
501 |
msgid ""
|
502 |
"Any sites setup to use the current secret key will no longer be able to "
|
503 |
"connect. You will need to update those sites with the newly generated secret "
|
504 |
"key. Do you wish to continue?"
|
505 |
msgstr ""
|
506 |
|
507 |
-
#: class/wpmdb.php:
|
508 |
msgid ""
|
509 |
"An error occurred when trying to generate the secret key. Please see the "
|
510 |
"Help tab for details on how to request support. (#105)"
|
511 |
msgstr ""
|
512 |
|
513 |
-
#: class/wpmdb.php:
|
514 |
msgid ""
|
515 |
-
"You are
|
516 |
-
"you wish to continue?"
|
517 |
msgstr ""
|
518 |
|
519 |
-
#: class/wpmdb.php:
|
520 |
msgid ""
|
521 |
"An error occurred when trying to delete the profile. Please see the Help tab "
|
522 |
"for details on how to request support. (#106)"
|
523 |
msgstr ""
|
524 |
|
525 |
-
#: class/wpmdb.php:
|
526 |
msgid ""
|
527 |
"The selected migration profile could not be deleted because it was not "
|
528 |
"found.\n"
|
@@ -530,220 +763,300 @@ msgid ""
|
|
530 |
"migration profiles."
|
531 |
msgstr ""
|
532 |
|
533 |
-
#: class/wpmdb.php:
|
534 |
msgid ""
|
535 |
"If you change the connection details, you will lose any replaces and table "
|
536 |
"selections you have made below. Do you wish to continue?"
|
537 |
msgstr ""
|
538 |
|
539 |
-
#: class/wpmdb.php:
|
|
|
540 |
msgid "Please enter the connection information above to continue."
|
541 |
msgstr ""
|
542 |
|
543 |
-
#: class/wpmdb.php:
|
544 |
msgid ""
|
545 |
"An error occurred when trying to save the settings. Please try again. If the "
|
546 |
"problem persists, please see the Help tab for details on how to request "
|
547 |
"support. (#108)"
|
548 |
msgstr ""
|
549 |
|
550 |
-
#: class/wpmdb.php:
|
551 |
msgid ""
|
552 |
"The connection information appears to be missing, please enter it to "
|
553 |
"continue."
|
554 |
msgstr ""
|
555 |
|
556 |
-
#: class/wpmdb.php:
|
557 |
msgid ""
|
558 |
"The connection information appears to be incorrect, it should consist of two "
|
559 |
"lines. The first being the remote server's URL and the second being the "
|
560 |
"secret key."
|
561 |
msgstr ""
|
562 |
|
563 |
-
#: class/wpmdb.php:
|
564 |
msgid ""
|
565 |
"The URL on the first line appears to be invalid, please check it and try "
|
566 |
"again."
|
567 |
msgstr ""
|
568 |
|
569 |
-
#: class/wpmdb.php:
|
570 |
msgid ""
|
571 |
"The secret key on the second line appears to be invalid. It should be a 32 "
|
572 |
"character string that consists of letters, numbers and special characters "
|
573 |
"only."
|
574 |
msgstr ""
|
575 |
|
576 |
-
#: class/wpmdb.php:
|
577 |
msgid ""
|
578 |
"It appears you've entered the URL for this website, you need to provide the "
|
579 |
"URL of the remote website instead."
|
580 |
msgstr ""
|
581 |
|
582 |
-
#: class/wpmdb.php:
|
583 |
msgid ""
|
584 |
"Looks like your remote secret key is the same as the secret key for this "
|
585 |
"site. To fix this, go to the <a href=\"#settings\">Settings tab</a> and "
|
586 |
"click \"Reset Secret Key\""
|
587 |
msgstr ""
|
588 |
|
589 |
-
#: class/wpmdb.php:
|
|
|
590 |
msgid "Time Elapsed:"
|
591 |
msgstr ""
|
592 |
|
593 |
-
#: class/wpmdb.php:
|
|
|
594 |
msgctxt "Temporarily stop migrating"
|
595 |
msgid "Pause"
|
596 |
msgstr ""
|
597 |
|
598 |
-
#: class/wpmdb.php:
|
599 |
msgctxt "The migration has been temporarily stopped"
|
600 |
msgid "Migration Paused"
|
601 |
msgstr ""
|
602 |
|
603 |
-
#: class/wpmdb.php:
|
604 |
msgctxt "Restart migrating after it was paused"
|
605 |
msgid "Resume"
|
606 |
msgstr ""
|
607 |
|
608 |
-
#: class/wpmdb.php:
|
609 |
msgid "Completing current request"
|
610 |
msgstr ""
|
611 |
|
612 |
-
#: class/wpmdb.php:
|
613 |
msgctxt "The migration is being cancelled"
|
614 |
msgid "Cancelling migration"
|
615 |
msgstr ""
|
616 |
|
617 |
-
#: class/wpmdb.php:
|
618 |
msgctxt "The migration has been temporarily stopped"
|
619 |
msgid "Paused"
|
620 |
msgstr ""
|
621 |
|
622 |
-
#: class/wpmdb.php:
|
623 |
msgid "Removing the local MySQL export file"
|
624 |
msgstr ""
|
625 |
|
626 |
-
#: class/wpmdb.php:
|
627 |
msgid "Removing the local backup MySQL export file"
|
628 |
msgstr ""
|
629 |
|
630 |
-
#: class/wpmdb.php:
|
631 |
msgid "Removing the local temporary tables"
|
632 |
msgstr ""
|
633 |
|
634 |
-
#: class/wpmdb.php:
|
635 |
msgid "Removing the remote backup MySQL export file"
|
636 |
msgstr ""
|
637 |
|
638 |
-
#: class/wpmdb.php:
|
639 |
msgid "Removing the remote temporary tables"
|
640 |
msgstr ""
|
641 |
|
642 |
-
#: class/wpmdb.php:
|
643 |
msgid "Migration cancellation failed"
|
644 |
msgstr ""
|
645 |
|
646 |
-
#: class/wpmdb.php:
|
647 |
msgid ""
|
648 |
"A problem occurred while cancelling the migration, you may have to manually "
|
649 |
"delete some temporary files / tables."
|
650 |
msgstr ""
|
651 |
|
652 |
-
#: class/wpmdb.php:
|
653 |
msgctxt "The migration has been cancelled"
|
654 |
msgid "Migration cancelled"
|
655 |
msgstr ""
|
656 |
|
657 |
-
#: class/wpmdb.php:
|
658 |
msgctxt "The migration completed successfully"
|
659 |
msgid "Migration complete"
|
660 |
msgstr ""
|
661 |
|
662 |
-
#: class/wpmdb.php:
|
663 |
msgctxt "The migration is in the last stages"
|
664 |
msgid "Finalizing migration"
|
665 |
msgstr ""
|
666 |
|
667 |
-
#: class/wpmdb.php:
|
|
|
|
|
|
|
|
|
|
|
668 |
msgid "A problem occurred when trying to add plugins to backlist."
|
669 |
msgstr ""
|
670 |
|
671 |
-
#: class/wpmdb.php:
|
672 |
msgid ""
|
673 |
"If confirmed we will install an additional WordPress 'Must Use' plugin. This "
|
674 |
"plugin will allow us to control which plugins are loaded during WP Migrate "
|
675 |
"DB Pro specific operations. Do you wish to continue?"
|
676 |
msgstr ""
|
677 |
|
678 |
-
#: class/wpmdb.php:
|
679 |
msgid ""
|
680 |
"A problem occurred when trying to change the plugin compatibility setting."
|
681 |
msgstr ""
|
682 |
|
683 |
-
#: class/wpmdb.php:
|
684 |
msgctxt "Confirmation required"
|
685 |
msgid "Sure?"
|
686 |
msgstr ""
|
687 |
|
688 |
-
#: class/wpmdb.php:
|
689 |
#, php-format
|
690 |
msgid "Pulling from %s, please wait..."
|
691 |
msgstr ""
|
692 |
|
693 |
-
#: class/wpmdb.php:
|
694 |
#, php-format
|
695 |
msgid "Pulling from %s complete"
|
696 |
msgstr ""
|
697 |
|
698 |
-
#: class/wpmdb.php:
|
699 |
#, php-format
|
700 |
msgid "Pushing to %s, please wait..."
|
701 |
msgstr ""
|
702 |
|
703 |
-
#: class/wpmdb.php:
|
704 |
#, php-format
|
705 |
msgid "Pushing to %s complete"
|
706 |
msgstr ""
|
707 |
|
708 |
-
#: class/wpmdb.php:
|
709 |
msgid "Copying license to the remote site, please wait"
|
710 |
msgstr ""
|
711 |
|
712 |
-
#: class/wpmdb.php:
|
713 |
-
msgid "Attempting to activate your
|
714 |
msgstr ""
|
715 |
|
716 |
-
#: class/wpmdb.php:
|
717 |
msgid "License successfully activated, please wait..."
|
718 |
msgstr ""
|
719 |
|
720 |
-
#: class/wpmdb.php:
|
721 |
msgid ""
|
722 |
"An error occurred when trying to reactivate your license. Please provide the "
|
723 |
"following information when requesting support:"
|
724 |
msgstr ""
|
725 |
|
726 |
-
#: class/wpmdb.php:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
727 |
msgid "Could not find the file to download:"
|
728 |
msgstr ""
|
729 |
|
730 |
-
#: class/wpmdb.php:
|
731 |
msgid "MySQL export file not found."
|
732 |
msgstr ""
|
733 |
|
734 |
-
#: class/wpmdb.php:
|
|
|
|
|
|
|
|
|
735 |
msgid ""
|
736 |
"WP Migrate DB and WP Migrate DB Pro cannot both be active. We've "
|
737 |
"automatically deactivated WP Migrate DB."
|
738 |
msgstr ""
|
739 |
|
740 |
-
#: class/wpmdb.php:
|
741 |
msgid ""
|
742 |
"WP Migrate DB and WP Migrate DB Pro cannot both be active. We've "
|
743 |
"automatically deactivated WP Migrate DB Pro."
|
744 |
msgstr ""
|
745 |
|
746 |
-
#: class/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
747 |
#, php-format
|
748 |
msgid ""
|
749 |
"The version of %1$s you have installed, requires version %2$s of WP Migrate "
|
@@ -751,168 +1064,261 @@ msgid ""
|
|
751 |
"Now</a></strong>"
|
752 |
msgstr ""
|
753 |
|
754 |
-
#: class/wpmdbpro.php:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
755 |
msgctxt "Plugin extensions"
|
756 |
msgid "Addons"
|
757 |
msgstr ""
|
758 |
|
759 |
-
#: class/wpmdbpro.php:
|
760 |
-
msgid "
|
761 |
msgstr ""
|
762 |
|
763 |
-
#: class/wpmdbpro.php:
|
764 |
msgid ""
|
765 |
"A brief walkthrough of the WP Migrate DB plugin showing all of the different "
|
766 |
"options and explaining them."
|
767 |
msgstr ""
|
768 |
|
769 |
-
#: class/wpmdbpro.php:
|
770 |
msgid "Pulling Live Data Into Your Local Development Environment"
|
771 |
msgstr ""
|
772 |
|
773 |
-
#: class/wpmdbpro.php:
|
774 |
msgid ""
|
775 |
"This screencast demonstrates how you can pull data from a remote, live "
|
776 |
"WordPress install and update the data in your local development environment."
|
777 |
msgstr ""
|
778 |
|
779 |
-
#: class/wpmdbpro.php:
|
780 |
msgid "Pushing Local Development Data to a Staging Environment"
|
781 |
msgstr ""
|
782 |
|
783 |
-
#: class/wpmdbpro.php:
|
784 |
msgid ""
|
785 |
"This screencast demonstrates how you can push a local WordPress database "
|
786 |
"you've been using for development to a staging environment."
|
787 |
msgstr ""
|
788 |
|
789 |
-
#: class/wpmdbpro.php:
|
790 |
msgid "Media Files Addon Demo"
|
791 |
msgstr ""
|
792 |
|
793 |
-
#: class/wpmdbpro.php:
|
794 |
msgid ""
|
795 |
"A short demo of how the Media Files addon allows you to sync up your "
|
796 |
"WordPress Media Libraries."
|
797 |
msgstr ""
|
798 |
|
799 |
-
#: class/wpmdbpro.php:
|
800 |
msgid ""
|
801 |
"Please activate your license before attempting a pull or push migration."
|
802 |
msgstr ""
|
803 |
|
804 |
-
#: class/wpmdbpro.php:
|
805 |
msgid ""
|
806 |
"The connection succeeded but the remote site is configured to reject pull "
|
807 |
"connections. You can change this in the \"settings\" tab on the remote site. "
|
808 |
"(#141)"
|
809 |
msgstr ""
|
810 |
|
811 |
-
#: class/wpmdbpro.php:
|
812 |
-
|
813 |
-
|
|
|
|
|
814 |
msgstr ""
|
815 |
|
816 |
-
#: class/wpmdbpro.php:
|
817 |
-
|
818 |
-
|
|
|
|
|
819 |
msgstr ""
|
820 |
|
821 |
-
#: class/wpmdbpro.php:
|
822 |
#, php-format
|
823 |
msgid ""
|
824 |
-
"
|
825 |
-
"
|
826 |
-
"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
827 |
msgstr ""
|
828 |
|
829 |
-
#: class/wpmdbpro.php:
|
830 |
msgctxt "Asking to try and connect to remote server after verification error"
|
831 |
msgid "Try again?"
|
832 |
msgstr ""
|
833 |
|
834 |
-
#: class/wpmdbpro.php:
|
835 |
#, php-format
|
836 |
msgid ""
|
837 |
"Activate remote license — Looks like you don't have a WP Migrate DB "
|
838 |
"Pro license active at %s."
|
839 |
msgstr ""
|
840 |
|
841 |
-
#: class/wpmdbpro.php:
|
842 |
#, php-format
|
843 |
msgid "Copy %1$s license key to %2$s and activate it"
|
844 |
msgstr ""
|
845 |
|
846 |
-
#: class/wpmdbpro.php:
|
847 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
848 |
msgid ""
|
849 |
-
"The connection succeeded but the remote site is configured to reject
|
850 |
"connections. You can change this in the \"settings\" tab on the remote site. "
|
851 |
-
"(#122)
|
|
|
|
|
|
|
|
|
|
|
852 |
msgstr ""
|
853 |
|
854 |
-
#: class/wpmdbpro.php:
|
855 |
msgctxt "Delete license"
|
856 |
msgid "Remove"
|
857 |
msgstr ""
|
858 |
|
859 |
-
#: class/wpmdbpro.php:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
860 |
msgctxt "License does not allow use of addons"
|
861 |
msgid "Addons Unavailable"
|
862 |
msgstr ""
|
863 |
|
864 |
-
#: class/wpmdbpro.php:
|
865 |
#, php-format
|
866 |
msgid ""
|
867 |
"Addons are not included with the Personal license. Visit <a href=\"%s\" "
|
868 |
"target=\"_blank\">My Account</a> to upgrade in just a few clicks."
|
869 |
msgstr ""
|
870 |
|
871 |
-
#: class/wpmdbpro.php:
|
872 |
msgctxt "Installed on website but not activated"
|
873 |
msgid "Installed"
|
874 |
msgstr ""
|
875 |
|
876 |
-
#: class/wpmdbpro.php:
|
877 |
msgctxt "Installed and activated on website"
|
878 |
msgid "Activated"
|
879 |
msgstr ""
|
880 |
|
881 |
-
#: class/wpmdbpro.php:
|
882 |
msgctxt "Enable addon so it may be used"
|
883 |
msgid "Activate"
|
884 |
msgstr ""
|
885 |
|
886 |
-
#: class/wpmdbpro.php:
|
887 |
msgctxt "Download and activate addon"
|
888 |
msgid "Install"
|
889 |
msgstr ""
|
890 |
|
891 |
-
#: class/wpmdbpro.php:
|
|
|
892 |
msgctxt "Download to your computer"
|
893 |
msgid "Download"
|
894 |
msgstr ""
|
895 |
|
896 |
-
#: class/wpmdbpro.php:
|
897 |
msgid "Could not upload the SQL to the server. (#135)"
|
898 |
msgstr ""
|
899 |
|
900 |
-
#: class/wpmdbpro.php:
|
901 |
msgid "Could not read the SQL file we uploaded to the server. (#136)"
|
902 |
msgstr ""
|
903 |
|
904 |
-
#: class/wpmdbpro.php:
|
905 |
msgid ""
|
906 |
"The connection succeeded but the remote site is configured to reject push "
|
907 |
"connections. You can change this in the \"settings\" tab on the remote site. "
|
908 |
"(#139)"
|
909 |
msgstr ""
|
910 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
911 |
#: template/addons.php:7
|
912 |
msgid "Fetching addon details, please wait..."
|
913 |
msgstr ""
|
914 |
|
915 |
-
#: template/addons.php:9
|
|
|
916 |
msgid ""
|
917 |
"We couldn't find your license information. Please switch to the settings tab "
|
918 |
"and enter your license."
|
@@ -922,8 +1328,9 @@ msgstr ""
|
|
922 |
msgid "Once completed, you may visit this tab to view the available addons."
|
923 |
msgstr ""
|
924 |
|
925 |
-
#: template/common/breadcrumbs.php:
|
926 |
-
|
|
|
927 |
msgstr ""
|
928 |
|
929 |
#: template/common/breadcrumbs.php:9
|
@@ -936,7 +1343,7 @@ msgid ""
|
|
936 |
"migration requests"
|
937 |
msgstr ""
|
938 |
|
939 |
-
#: template/common/compatibility.php:
|
940 |
msgid ""
|
941 |
"Some plugins add a lot of overhead to each request, requiring extra memory "
|
942 |
"and CPU. And some plugins even interfere with migrations and cause them to "
|
@@ -944,22 +1351,28 @@ msgid ""
|
|
944 |
"example a plugin that hooks into WP Migrate DB."
|
945 |
msgstr ""
|
946 |
|
947 |
-
#: template/common/compatibility.php:
|
948 |
-
#: template/pro/
|
|
|
|
|
949 |
msgid "Select All"
|
950 |
msgstr ""
|
951 |
|
952 |
-
#: template/common/compatibility.php:
|
953 |
-
#: template/pro/
|
|
|
|
|
954 |
msgid "Deselect All"
|
955 |
msgstr ""
|
956 |
|
957 |
-
#: template/common/compatibility.php:
|
958 |
-
#: template/pro/
|
|
|
|
|
959 |
msgid "Invert Selection"
|
960 |
msgstr ""
|
961 |
|
962 |
-
#: template/common/compatibility.php:
|
963 |
msgid "Save Changes"
|
964 |
msgstr ""
|
965 |
|
@@ -975,7 +1388,7 @@ msgstr ""
|
|
975 |
msgid "Maximum Request Size"
|
976 |
msgstr ""
|
977 |
|
978 |
-
#: template/common/max-request-size.php:
|
979 |
#, php-format
|
980 |
msgid ""
|
981 |
"We've detected that your server supports requests up to %s, but it's "
|
@@ -985,32 +1398,32 @@ msgid ""
|
|
985 |
"with time outs, try throttling this setting down."
|
986 |
msgstr ""
|
987 |
|
988 |
-
#: template/migrate-progress.php:
|
989 |
msgid "Please wait while migration is running..."
|
990 |
msgstr ""
|
991 |
|
992 |
-
#: template/migrate-progress.php:
|
993 |
msgid "Establishing Connection"
|
994 |
msgstr ""
|
995 |
|
996 |
-
#: template/migrate-progress.php:
|
997 |
msgctxt "Stop the migration"
|
998 |
msgid "Cancel"
|
999 |
msgstr ""
|
1000 |
|
1001 |
-
#: template/migrate.php:
|
1002 |
msgid "Export File"
|
1003 |
msgstr ""
|
1004 |
|
1005 |
-
#: template/migrate.php:
|
1006 |
msgid "Save as file to your computer"
|
1007 |
msgstr ""
|
1008 |
|
1009 |
-
#: template/migrate.php:
|
1010 |
msgid "Compress file with gzip"
|
1011 |
msgstr ""
|
1012 |
|
1013 |
-
#: template/migrate.php:
|
1014 |
msgid "Connection Info - Site URL & Secret Key"
|
1015 |
msgstr ""
|
1016 |
|
@@ -1026,46 +1439,37 @@ msgid ""
|
|
1026 |
msgstr ""
|
1027 |
|
1028 |
#: template/migrate.php:116
|
1029 |
-
msgid "Version Mismatch"
|
1030 |
-
msgstr ""
|
1031 |
-
|
1032 |
-
#: template/migrate.php:116
|
1033 |
-
#, php-format
|
1034 |
-
msgid ""
|
1035 |
-
"We've detected you have version <span class=\"remote-version\"></span> of WP "
|
1036 |
-
"Migrate DB Pro at <span class=\"remote-location\"></span> but are using %1$s "
|
1037 |
-
"here. Please go to the <a href=\"%2$s\">Plugins page</a> on both installs "
|
1038 |
-
"and check for updates."
|
1039 |
-
msgstr ""
|
1040 |
-
|
1041 |
-
#: template/migrate.php:120
|
1042 |
msgid "Cannot Access Uploads Directory"
|
1043 |
msgstr ""
|
1044 |
|
1045 |
-
#: template/migrate.php:
|
1046 |
msgid ""
|
1047 |
"We require write permissions to the standard WordPress uploads directory. "
|
1048 |
"Without this permission exports are unavailable. Please grant 755 "
|
1049 |
"permissions on the following directory:"
|
1050 |
msgstr ""
|
1051 |
|
1052 |
-
#: template/migrate.php:
|
1053 |
msgctxt "Source text to be replaced"
|
1054 |
msgid "Find"
|
1055 |
msgstr ""
|
1056 |
|
1057 |
-
#: template/migrate.php:
|
1058 |
msgctxt "Text to replace in source"
|
1059 |
msgid "Replace"
|
1060 |
msgstr ""
|
1061 |
|
1062 |
-
#: template/migrate.php:
|
|
|
1063 |
msgid ""
|
1064 |
-
"
|
1065 |
-
"
|
|
|
|
|
|
|
1066 |
msgstr ""
|
1067 |
|
1068 |
-
#: template/migrate.php:
|
1069 |
#, php-format
|
1070 |
msgid ""
|
1071 |
"<strong>New URL Missing</strong> — Please enter the protocol-relative "
|
@@ -1074,72 +1478,74 @@ msgid ""
|
|
1074 |
"documentation</a> on find and replace fields."
|
1075 |
msgstr ""
|
1076 |
|
1077 |
-
#: template/migrate.php:
|
1078 |
#, php-format
|
1079 |
msgid ""
|
1080 |
"<strong>New File Path Missing</strong> — Please enter the root file "
|
1081 |
-
"path of the remote website in the \"New file path\" field
|
1082 |
-
"of what the file path should be,
|
1083 |
-
"\"_blank\">our documentation</a> on
|
|
|
1084 |
msgstr ""
|
1085 |
|
1086 |
-
#: template/migrate.php:
|
1087 |
msgid "Advanced Options"
|
1088 |
msgstr ""
|
1089 |
|
1090 |
-
#: template/migrate.php:
|
1091 |
msgid "Replace GUIDs"
|
1092 |
msgstr ""
|
1093 |
|
1094 |
-
#: template/migrate.php:
|
1095 |
#, php-format
|
1096 |
msgid ""
|
1097 |
"Although the <a href=\"%s\" target=\"_blank\">WordPress Codex emphasizes</a> "
|
1098 |
"that GUIDs should not be changed, this is limited to sites that are already "
|
1099 |
-
"live. If the site has never been live,
|
1100 |
"example, you may be developing a new site locally at dev.somedomain.com and "
|
1101 |
"want to migrate the site live to somedomain.com."
|
1102 |
msgstr ""
|
1103 |
|
1104 |
-
#: template/migrate.php:
|
1105 |
msgid "Exclude spam comments"
|
1106 |
msgstr ""
|
1107 |
|
1108 |
-
#: template/migrate.php:
|
1109 |
msgid ""
|
1110 |
"Do not migrate the 'active_plugins' setting (i.e. which plugins are "
|
1111 |
"activated/deactivated)"
|
1112 |
msgstr ""
|
1113 |
|
1114 |
-
#: template/migrate.php:
|
1115 |
msgid "Compatible with older versions of MySQL (pre-5.5)"
|
1116 |
msgstr ""
|
1117 |
|
1118 |
-
#: template/migrate.php:
|
1119 |
msgid "Save Migration Profile"
|
1120 |
msgstr ""
|
1121 |
|
1122 |
-
#: template/migrate.php:
|
1123 |
msgid "Save the above settings for the next time you do a similiar migration"
|
1124 |
msgstr ""
|
1125 |
|
1126 |
-
#: template/migrate.php:
|
1127 |
msgid "Create new profile"
|
1128 |
msgstr ""
|
1129 |
|
1130 |
-
#: template/migrate.php:
|
|
|
1131 |
msgid "Warning: Different Table Prefixes"
|
1132 |
msgstr ""
|
1133 |
|
1134 |
-
#: template/migrate.php:
|
1135 |
msgid ""
|
1136 |
"Whoa! We've detected that the database table prefix differs between "
|
1137 |
-
"installations. Clicking the Migrate
|
1138 |
"tables in your local database with prefix \"<span class=\"remote-prefix\"></"
|
1139 |
"span>\"."
|
1140 |
msgstr ""
|
1141 |
|
1142 |
-
#: template/migrate.php:
|
1143 |
#, php-format
|
1144 |
msgid ""
|
1145 |
"However, your local install is configured to use table prefix \"%1$s\" and "
|
@@ -1148,21 +1554,21 @@ msgid ""
|
|
1148 |
"variable to \"<span class=\"remote-prefix\"></span>\"."
|
1149 |
msgstr ""
|
1150 |
|
1151 |
-
#: template/migrate.php:
|
1152 |
msgid ""
|
1153 |
"This will allow your local install the use the migrated tables. Once you do "
|
1154 |
"this, you shouldn't have to do it again."
|
1155 |
msgstr ""
|
1156 |
|
1157 |
-
#: template/migrate.php:
|
1158 |
#, php-format
|
1159 |
msgid ""
|
1160 |
"Whoa! We've detected that the database table prefix differs between "
|
1161 |
-
"installations. Clicking the Migrate
|
1162 |
"tables in the remote database with prefix \"%s\"."
|
1163 |
msgstr ""
|
1164 |
|
1165 |
-
#: template/migrate.php:
|
1166 |
#, php-format
|
1167 |
msgid ""
|
1168 |
"However, your remote install is configured to use table prefix \"<span class="
|
@@ -1172,13 +1578,13 @@ msgid ""
|
|
1172 |
"span>\" variable to \"%s\"."
|
1173 |
msgstr ""
|
1174 |
|
1175 |
-
#: template/migrate.php:
|
1176 |
msgid ""
|
1177 |
"This will allow your remote install the use the migrated tables. Once you do "
|
1178 |
"this, you shouldn't have to do it again."
|
1179 |
msgstr ""
|
1180 |
|
1181 |
-
#: template/options.php:
|
1182 |
msgid ""
|
1183 |
"<strong>PHP Safe Mode Enabled</strong> — We do not officially support "
|
1184 |
"running this plugin in safe mode because <code>set_time_limit()</code> has "
|
@@ -1188,12 +1594,13 @@ msgid ""
|
|
1188 |
"However, if you have trouble, we can't help you until you turn off safe mode."
|
1189 |
msgstr ""
|
1190 |
|
1191 |
-
#: template/options.php:
|
|
|
1192 |
#, php-format
|
1193 |
msgid "Your current PHP run time limit is set to %s seconds."
|
1194 |
msgstr ""
|
1195 |
|
1196 |
-
#: template/options.php:
|
1197 |
#, php-format
|
1198 |
msgid ""
|
1199 |
"<strong>Internet Explorer Not Supported</strong> — Less than 2% of our "
|
@@ -1202,7 +1609,7 @@ msgid ""
|
|
1202 |
"instead. If this is a problem for you, please let us know."
|
1203 |
msgstr ""
|
1204 |
|
1205 |
-
#: template/options.php:
|
1206 |
msgid ""
|
1207 |
"<strong>PHP Function Disabled</strong> — The <code>set_time_limit()</"
|
1208 |
"code> function is currently disabled on your server. We use this function to "
|
@@ -1212,44 +1619,75 @@ msgid ""
|
|
1212 |
msgstr ""
|
1213 |
|
1214 |
#: template/pro/backup.php:4
|
1215 |
-
msgid ""
|
1216 |
-
"Backup the <span class=\"directory-scope\">local</span> database before "
|
1217 |
-
"replacing it"
|
1218 |
msgstr ""
|
1219 |
|
1220 |
#: template/pro/backup.php:5
|
|
|
|
|
|
|
|
|
1221 |
msgid "An SQL file will be saved to"
|
1222 |
msgstr ""
|
1223 |
|
1224 |
-
#: template/pro/backup.php:
|
1225 |
msgid "Backup all tables with prefix"
|
1226 |
msgstr ""
|
1227 |
|
1228 |
-
#: template/pro/backup.php:
|
1229 |
msgid "Backup only tables selected for migration"
|
1230 |
msgstr ""
|
1231 |
|
1232 |
-
#: template/pro/backup.php:
|
1233 |
msgid "Backup only selected tables below"
|
1234 |
msgstr ""
|
1235 |
|
1236 |
-
#: template/pro/backup.php:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1237 |
#, php-format
|
1238 |
msgid ""
|
1239 |
-
"
|
1240 |
-
"
|
1241 |
-
"
|
1242 |
-
"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1243 |
msgstr ""
|
1244 |
|
1245 |
#: template/pro/connection-info.php:2
|
1246 |
msgid "Connection Info"
|
1247 |
msgstr ""
|
1248 |
|
1249 |
-
#: template/pro/connection-info.php:
|
1250 |
msgid "Reset Secret Key"
|
1251 |
msgstr ""
|
1252 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1253 |
#: template/pro/exclude-post-types.php:4
|
1254 |
msgid "Exclude Post Types"
|
1255 |
msgstr ""
|
@@ -1258,7 +1696,7 @@ msgstr ""
|
|
1258 |
msgid "Email Support"
|
1259 |
msgstr ""
|
1260 |
|
1261 |
-
#: template/pro/licence-info.php:
|
1262 |
msgid "Once completed, you may visit this tab to view your support details."
|
1263 |
msgstr ""
|
1264 |
|
@@ -1270,11 +1708,11 @@ msgstr ""
|
|
1270 |
msgid "The license key is currently defined in wp-config.php."
|
1271 |
msgstr ""
|
1272 |
|
1273 |
-
#: template/pro/licence.php:
|
1274 |
msgid "Activate License"
|
1275 |
msgstr ""
|
1276 |
|
1277 |
-
#: template/pro/outdated-addons-warning.php:
|
1278 |
#, php-format
|
1279 |
msgid ""
|
1280 |
"The version of the %1$s addon you have installed%2$s is out-of-date and will "
|
@@ -1299,6 +1737,25 @@ msgstr ""
|
|
1299 |
msgid "Replace remote db with this site's db"
|
1300 |
msgstr ""
|
1301 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1302 |
#: template/pro/select-tables.php:4
|
1303 |
msgctxt "Database tables"
|
1304 |
msgid "Tables"
|
@@ -1325,7 +1782,7 @@ msgstr ""
|
|
1325 |
msgid "Enable SSL verification"
|
1326 |
msgstr ""
|
1327 |
|
1328 |
-
#: template/pro/toggle-remote-requests.php:
|
1329 |
msgid ""
|
1330 |
"We disable SSL verification by default because a lot of people's "
|
1331 |
"environments are not setup for it to work. For example, with XAMPP, you have "
|
@@ -1343,7 +1800,7 @@ msgstr ""
|
|
1343 |
msgid "Would you like to use a saved migration profile?"
|
1344 |
msgstr ""
|
1345 |
|
1346 |
-
#: template/profile.php:
|
1347 |
msgid "Nope, let's start fresh..."
|
1348 |
msgstr ""
|
1349 |
|
@@ -1373,7 +1830,7 @@ msgstr ""
|
|
1373 |
msgid "Within a few hours WP Migrate DB Pro has paid for itself!"
|
1374 |
msgstr ""
|
1375 |
|
1376 |
-
#: template/wpmdb/progress-upgrade.php:
|
1377 |
msgid "More About The Pro Version"
|
1378 |
msgstr ""
|
1379 |
|
@@ -1390,32 +1847,30 @@ msgstr ""
|
|
1390 |
#: template/wpmdb/sidebar.php:11
|
1391 |
#, php-format
|
1392 |
msgid ""
|
1393 |
-
"Submit your name and email and we
|
1394 |
-
"
|
1395 |
msgstr ""
|
1396 |
|
1397 |
#: template/wpmdb/sidebar.php:15
|
1398 |
-
msgid "Your
|
1399 |
msgstr ""
|
1400 |
|
1401 |
#: template/wpmdb/sidebar.php:19
|
1402 |
-
msgid "
|
1403 |
msgstr ""
|
1404 |
|
1405 |
#: template/wpmdb/sidebar.php:23
|
1406 |
-
msgid "
|
1407 |
msgstr ""
|
1408 |
|
1409 |
-
#: template/wpmdb/sidebar.php:
|
1410 |
-
msgid ""
|
1411 |
-
"We promise we will not use your email for anything else and you can "
|
1412 |
-
"unsubscribe with <span style=\"white-space: nowrap;\">1-click anytime</span>."
|
1413 |
msgstr ""
|
1414 |
|
1415 |
-
#: template/wpmdb/sidebar.php:
|
1416 |
msgid ""
|
1417 |
-
"
|
1418 |
-
"
|
1419 |
msgstr ""
|
1420 |
|
1421 |
#: template/wpmdb/wordpress-org-support.php:2
|
@@ -1439,8 +1894,8 @@ msgstr ""
|
|
1439 |
#, php-format
|
1440 |
msgid ""
|
1441 |
"If you want a <strong>timely response via email from a developer</strong> "
|
1442 |
-
"who works on this plugin, <a href=\"%s\">upgrade
|
1443 |
-
"
|
1444 |
msgstr ""
|
1445 |
|
1446 |
#: template/wpmdb/wordpress-org-support.php:10
|
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
|
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-06-12 09:50-0300\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"
|
15 |
+
"Language: \n"
|
16 |
"MIME-Version: 1.0\n"
|
17 |
"Content-Type: text/plain; charset=UTF-8\n"
|
18 |
"Content-Transfer-Encoding: 8bit\n"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
19 |
|
20 |
+
#: class/wpmdb-base.php:143
|
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:333
|
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:335
|
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:340
|
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:342
|
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:350
|
55 |
+
#, php-format
|
56 |
+
msgid ""
|
57 |
+
"We've detected that <code>WP_HTTP_BLOCK_EXTERNAL</code> is enabled and the "
|
58 |
+
"host <strong>%1$s</strong> has not been added to <code>WP_ACCESSIBLE_HOSTS</"
|
59 |
+
"code>. Please disable <code>WP_HTTP_BLOCK_EXTERNAL</code> or add <strong>"
|
60 |
+
"%1$s</strong> to <code>WP_ACCESSIBLE_HOSTS</code> to continue. <a href=\"%2$s"
|
61 |
+
"\" target=\"_blank\">More information</a>. (#147 - scope: %3$s)"
|
62 |
+
msgstr ""
|
63 |
+
|
64 |
+
#: class/wpmdb-base.php:353
|
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:363
|
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:368
|
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:377
|
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:382
|
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:382
|
99 |
+
msgid "our documentation"
|
100 |
+
msgstr ""
|
101 |
+
|
102 |
+
#: class/wpmdb-base.php:390
|
103 |
+
msgid ""
|
104 |
+
"There was a problem with the AJAX request, we were expecting a serialized "
|
105 |
+
"response, instead we received:<br />"
|
106 |
msgstr ""
|
107 |
|
108 |
+
#: class/wpmdb-base.php:678
|
109 |
+
#: class/wpmdb-base.php:1139
|
110 |
#, php-format
|
111 |
msgid ""
|
112 |
"<strong>Could not connect to deliciousbrains.com</strong> — You will "
|
114 |
"this is fixed. This issue is often caused by an improperly configured SSL "
|
115 |
"server (https). We recommend <a href=\"%1$s\" target=\"_blank\">fixing the "
|
116 |
"SSL configuration on your server</a>, but if you need a quick fix you can:"
|
117 |
+
"%2$s"
|
|
|
118 |
msgstr ""
|
119 |
|
120 |
+
#: class/wpmdb-base.php:678
|
121 |
+
#: class/wpmdb-base.php:1139
|
122 |
+
msgid "Temporarily disable SSL for connections to deliciousbrains.com"
|
|
|
|
|
|
|
123 |
msgstr ""
|
124 |
|
125 |
+
#: class/wpmdb-base.php:686
|
126 |
+
#: class/wpmdb-base.php:1145
|
127 |
#, php-format
|
128 |
+
msgid ""
|
129 |
+
"We've detected that <code>WP_HTTP_BLOCK_EXTERNAL</code> is enabled and the "
|
130 |
+
"host <strong>%1$s</strong> has not been added to <code>WP_ACCESSIBLE_HOSTS</"
|
131 |
+
"code>. Please disable <code>WP_HTTP_BLOCK_EXTERNAL</code> or add <strong>"
|
132 |
+
"%1$s</strong> to <code>WP_ACCESSIBLE_HOSTS</code> to continue. <a href=\"%2$s"
|
133 |
+
"\" target=\"_blank\">More information</a>."
|
|
|
134 |
msgstr ""
|
135 |
|
136 |
+
#: class/wpmdb-base.php:731
|
|
|
137 |
msgid ""
|
138 |
+
"<strong>Delicious Brains API is Down — </strong>Unfortunately we're "
|
139 |
+
"experiencing some problems with our server."
|
140 |
msgstr ""
|
141 |
|
142 |
+
#: class/wpmdb-base.php:735
|
143 |
#, php-format
|
144 |
+
msgctxt "ex. 2 hours ago"
|
145 |
+
msgid "%s ago"
|
|
|
146 |
msgstr ""
|
147 |
|
148 |
+
#: class/wpmdb-base.php:740
|
149 |
+
msgid "Here's the most recent update on its status"
|
|
|
150 |
msgstr ""
|
151 |
|
152 |
+
#: class/wpmdb-base.php:767
|
153 |
#, php-format
|
154 |
msgid ""
|
155 |
"Error retrieving download from deliciousbrain.com. Please try again or "
|
156 |
"download manually from <a href=\"%1$s\">%2$s</a>."
|
157 |
msgstr ""
|
158 |
|
159 |
+
#: class/wpmdb-base.php:767
|
160 |
msgctxt "Delicious Brains account"
|
161 |
msgid "My Account"
|
162 |
msgstr ""
|
163 |
|
164 |
+
#: class/wpmdb-base.php:826
|
165 |
+
#: class/wpmdb.php:111
|
166 |
+
#: class/wpmdb.php:334
|
167 |
+
#: class/wpmdbpro.php:1875
|
168 |
+
msgctxt "Plugin configuration and preferences"
|
169 |
+
msgid "Settings"
|
170 |
+
msgstr ""
|
171 |
+
|
172 |
+
#: class/wpmdb-base.php:827
|
173 |
#, php-format
|
174 |
msgid ""
|
175 |
"To finish activating WP Migrate DB Pro, please go to %1$s and enter your "
|
177 |
"\">purchase one</a>."
|
178 |
msgstr ""
|
179 |
|
180 |
+
#: class/wpmdb-base.php:1058
|
181 |
+
#: class/wpmdb-base.php:1068
|
182 |
msgctxt "A new version of the plugin is available"
|
183 |
msgid "Update Available"
|
184 |
msgstr ""
|
185 |
|
186 |
+
#: class/wpmdb-base.php:1059
|
187 |
#, php-format
|
188 |
+
msgid "A new version of %1$s is now available. %2$s"
|
|
|
|
|
189 |
msgstr ""
|
190 |
|
191 |
+
#: class/wpmdb-base.php:1059
|
192 |
+
#: class/wpmdb-base.php:1069
|
193 |
msgctxt "Download and install a new version of the plugin"
|
194 |
msgid "Update Now"
|
195 |
msgstr ""
|
196 |
|
197 |
+
#: class/wpmdb-base.php:1069
|
198 |
#, php-format
|
199 |
msgid ""
|
200 |
+
"%1$s %2$s is now available. You currently have %3$s installed. <a href=\"%4$s"
|
201 |
+
"\">%5$s</a>"
|
202 |
msgstr ""
|
203 |
|
204 |
+
#: class/wpmdb-base.php:1113
|
205 |
#, php-format
|
206 |
msgid ""
|
207 |
+
"<strong>Activate Your License</strong> — Please <a href=\"%s\" class="
|
208 |
+
"\"%s\">enter your license key</a> to enable push and pull functionality, "
|
209 |
+
"priority support and plugin updates."
|
|
|
|
|
210 |
msgstr ""
|
211 |
|
212 |
+
#: class/wpmdb-base.php:1130
|
213 |
+
msgid ""
|
214 |
+
"<strong>We've temporarily activated your license and will complete the "
|
215 |
+
"activation once the Delicious Brains API is available again.</strong>"
|
216 |
msgstr ""
|
217 |
|
218 |
+
#: class/wpmdb-base.php:1152
|
219 |
#, php-format
|
220 |
msgid ""
|
221 |
"<strong>Your License Was Cancelled</strong> — Please visit <a href=\"%s"
|
223 |
"enable push and pull."
|
224 |
msgstr ""
|
225 |
|
226 |
+
#: class/wpmdb-base.php:1153
|
227 |
+
#: class/wpmdb-base.php:1158
|
228 |
+
#: class/wpmdb-base.php:1178
|
229 |
+
#: class/wpmdb-base.php:1182
|
230 |
+
#: class/wpmdbpro.php:1008
|
231 |
+
#: class/wpmdbpro.php:1882
|
232 |
+
msgid "Check my license again"
|
233 |
+
msgstr ""
|
234 |
+
|
235 |
+
#: class/wpmdb-base.php:1156
|
236 |
+
msgid "Your License Has Expired"
|
237 |
+
msgstr ""
|
238 |
+
|
239 |
+
#: class/wpmdb-base.php:1157
|
240 |
#, php-format
|
241 |
+
msgid "Login to <a href=\"%s\">My Account</a> to renew. "
|
242 |
+
msgstr ""
|
243 |
+
|
244 |
+
#: class/wpmdb-base.php:1162
|
245 |
+
msgid "Updates are only available to those with an active license. "
|
246 |
+
msgstr ""
|
247 |
+
|
248 |
+
#: class/wpmdb-base.php:1163
|
249 |
+
msgid "Only active licenses can download and install addons. "
|
250 |
+
msgstr ""
|
251 |
+
|
252 |
+
#: class/wpmdb-base.php:1164
|
253 |
+
msgid "Only active licenses can submit support requests. "
|
254 |
+
msgstr ""
|
255 |
+
|
256 |
+
#: class/wpmdb-base.php:1165
|
257 |
msgid ""
|
258 |
+
"All features will continue to work, but you won't be able to receive updates "
|
259 |
+
"or email support. "
|
|
|
260 |
msgstr ""
|
261 |
|
262 |
+
#: class/wpmdb-base.php:1177
|
263 |
#, php-format
|
264 |
msgid ""
|
265 |
"<strong>No Activations Left</strong> — Please visit <a href=\"%s\" "
|
267 |
"previous activation and enable push and pull."
|
268 |
msgstr ""
|
269 |
|
270 |
+
#: class/wpmdb-base.php:1181
|
271 |
#, php-format
|
272 |
msgid ""
|
273 |
"<strong>Your License Was Not Found</strong> — Perhaps you made a typo "
|
276 |
"license key."
|
277 |
msgstr ""
|
278 |
|
279 |
+
#: class/wpmdb-base.php:1185
|
280 |
msgid "<strong>Your License Was Not Found</strong> — "
|
281 |
msgstr ""
|
282 |
|
283 |
+
#: class/wpmdb-base.php:1189
|
284 |
msgid "Your License Is Inactive"
|
285 |
msgstr ""
|
286 |
|
287 |
+
#: class/wpmdb-base.php:1190
|
288 |
msgid "Your license has been deactivated for this install."
|
289 |
msgstr ""
|
290 |
|
291 |
+
#: class/wpmdb-base.php:1190
|
292 |
msgid "Reactivate License"
|
293 |
msgstr ""
|
294 |
|
295 |
+
#: class/wpmdb-base.php:1193
|
296 |
#, php-format
|
297 |
msgid ""
|
298 |
"<strong>An Unexpected Error Occurred</strong> — Please contact us at "
|
299 |
"<a href=\"%1$s\">%2$s</a> and quote the following:"
|
300 |
msgstr ""
|
301 |
|
302 |
+
#: class/wpmdb-base.php:1232
|
303 |
#, php-format
|
304 |
msgid "Invalid nonce for: %s"
|
305 |
msgstr ""
|
306 |
|
307 |
+
#: class/wpmdb-base.php:1240
|
308 |
#, php-format
|
309 |
msgid "Access denied for: %s"
|
310 |
msgstr ""
|
311 |
|
312 |
+
#: class/wpmdb-base.php:1439
|
313 |
+
msgctxt "dismiss notice permanently"
|
314 |
+
msgid "Dismiss"
|
315 |
+
msgstr ""
|
316 |
+
|
317 |
+
#: class/wpmdb-base.php:1448
|
318 |
+
msgid "Remind Me Later"
|
319 |
+
msgstr ""
|
320 |
+
|
321 |
+
#: class/wpmdb-base.php:1550
|
322 |
+
msgid "Failed to save migration state. Please contact support."
|
323 |
+
msgstr ""
|
324 |
+
|
325 |
+
#: class/wpmdb-base.php:1573
|
326 |
+
msgid "Failed to retrieve migration state. Please contact support."
|
327 |
+
msgstr ""
|
328 |
+
|
329 |
+
#: class/wpmdb-cli.php:60
|
330 |
+
#, php-format
|
331 |
+
msgid "CLI addon requires PHP %1$s+"
|
332 |
+
msgstr ""
|
333 |
+
|
334 |
+
#: class/wpmdb-cli.php:129
|
335 |
+
#, php-format
|
336 |
+
msgid "The following table(s) do not exist in the %1$s database: %2$s"
|
337 |
+
msgstr ""
|
338 |
+
|
339 |
+
#: class/wpmdb-cli.php:176
|
340 |
+
#, php-format
|
341 |
+
msgid ""
|
342 |
+
"We were expecting a JSON response, instead we received: %2$s (function name: "
|
343 |
+
"%1$s)"
|
344 |
+
msgstr ""
|
345 |
+
|
346 |
+
#: class/wpmdb-cli.php:232
|
347 |
+
msgid "Initiating migration..."
|
348 |
+
msgstr ""
|
349 |
+
|
350 |
+
#: class/wpmdb-cli.php:270
|
351 |
+
msgid "Exporting tables"
|
352 |
+
msgstr ""
|
353 |
+
|
354 |
+
#: class/wpmdb-cli.php:340
|
355 |
+
msgid "No tables selected for migration."
|
356 |
+
msgstr ""
|
357 |
+
|
358 |
+
#: class/wpmdb-cli.php:433
|
359 |
+
msgid "Cleaning up..."
|
360 |
+
msgstr ""
|
361 |
+
|
362 |
+
#: class/wpmdb-cli.php:500
|
363 |
+
msgid "Unable to move exported file."
|
364 |
+
msgstr ""
|
365 |
+
|
366 |
+
#: class/wpmdb-command.php:66
|
367 |
+
msgid "You must provide a destination filename."
|
368 |
+
msgstr ""
|
369 |
+
|
370 |
+
#: class/wpmdb-command.php:100
|
371 |
+
msgid "Missing action parameter"
|
372 |
+
msgstr ""
|
373 |
+
|
374 |
+
#: class/wpmdb-command.php:119
|
375 |
+
#, php-format
|
376 |
+
msgid "%1$s and %2$s must contain the same number of values"
|
377 |
+
msgstr ""
|
378 |
+
|
379 |
+
#: class/wpmdb-command.php:167
|
380 |
+
#, php-format
|
381 |
+
msgid ""
|
382 |
+
"Cannot write to file \"%1$s\". Please ensure that the specified directory "
|
383 |
+
"exists and is writable."
|
384 |
+
msgstr ""
|
385 |
+
|
386 |
+
#: class/wpmdb-command.php:211
|
387 |
+
msgid "WP Migrate DB CLI class not available."
|
388 |
+
msgstr ""
|
389 |
+
|
390 |
+
#: class/wpmdb-command.php:218
|
391 |
+
#, php-format
|
392 |
+
msgid "Export saved to: %s"
|
393 |
+
msgstr ""
|
394 |
+
|
395 |
+
#: class/wpmdb-replace.php:174
|
396 |
+
msgid ""
|
397 |
+
"Failed attempting to do the recursive unserialize replace. Please contact "
|
398 |
+
"support."
|
399 |
+
msgstr ""
|
400 |
+
|
401 |
+
#: class/wpmdb-sanitize.php:39
|
402 |
+
#, php-format
|
403 |
+
msgid "%1$s was not expecting data to be an array."
|
404 |
+
msgstr ""
|
405 |
+
|
406 |
+
#: class/wpmdb-sanitize.php:60
|
407 |
+
#, php-format
|
408 |
+
msgid "%1$s was expecting an array but got something else: \"%2$s\""
|
409 |
+
msgstr ""
|
410 |
+
|
411 |
+
#: class/wpmdb-sanitize.php:66
|
412 |
+
#, php-format
|
413 |
+
msgid "%1$s was expecting a string but got something else: \"%2$s\""
|
414 |
+
msgstr ""
|
415 |
+
|
416 |
+
#: class/wpmdb-sanitize.php:73
|
417 |
+
#, php-format
|
418 |
+
msgid "%1$s was expecting a valid key but got something else: \"%2$s\""
|
419 |
+
msgstr ""
|
420 |
+
|
421 |
+
#: class/wpmdb-sanitize.php:81
|
422 |
+
#, php-format
|
423 |
+
msgid "%1$s was expecting text but got something else: \"%2$s\""
|
424 |
+
msgstr ""
|
425 |
+
|
426 |
+
#: class/wpmdb-sanitize.php:88
|
427 |
+
#, php-format
|
428 |
+
msgid "%1$s was expecting serialized data but got something else: \"%2$s\""
|
429 |
+
msgstr ""
|
430 |
+
|
431 |
+
#: class/wpmdb-sanitize.php:94
|
432 |
+
#, php-format
|
433 |
+
msgid "%1$s was expecting a valid numeric but got something else: \"%2$s\""
|
434 |
+
msgstr ""
|
435 |
+
|
436 |
+
#: class/wpmdb-sanitize.php:101
|
437 |
+
#, php-format
|
438 |
+
msgid "%1$s was expecting an integer but got something else: \"%2$s\""
|
439 |
+
msgstr ""
|
440 |
+
|
441 |
+
#: class/wpmdb-sanitize.php:108
|
442 |
+
#, php-format
|
443 |
+
msgid ""
|
444 |
+
"%1$s was expecting a positive number (int) but got something else: \"%2$s\""
|
445 |
+
msgstr ""
|
446 |
+
|
447 |
+
#: class/wpmdb-sanitize.php:115
|
448 |
+
#, php-format
|
449 |
+
msgid ""
|
450 |
+
"%1$s was expecting a negative number (int) but got something else: \"%2$s\""
|
451 |
+
msgstr ""
|
452 |
+
|
453 |
+
#: class/wpmdb-sanitize.php:122
|
454 |
+
#, php-format
|
455 |
+
msgid "%1$s was expecting 0 (int) but got something else: \"%2$s\""
|
456 |
+
msgstr ""
|
457 |
+
|
458 |
+
#: class/wpmdb-sanitize.php:129
|
459 |
+
#, php-format
|
460 |
+
msgid "%1$s was expecting an empty value but got something else: \"%2$s\""
|
461 |
+
msgstr ""
|
462 |
+
|
463 |
+
#: class/wpmdb-sanitize.php:136
|
464 |
+
#, php-format
|
465 |
+
msgid "%1$s was expecting a URL but got something else: \"%2$s\""
|
466 |
+
msgstr ""
|
467 |
+
|
468 |
+
#: class/wpmdb-sanitize.php:144
|
469 |
+
#, php-format
|
470 |
+
msgid "%1$s was expecting a bool but got something else: \"%2$s\""
|
471 |
+
msgstr ""
|
472 |
+
|
473 |
+
#: class/wpmdb-sanitize.php:150
|
474 |
+
#, php-format
|
475 |
+
msgid "Unknown sanitization rule \"%1$s\" supplied by %2$s"
|
476 |
+
msgstr ""
|
477 |
+
|
478 |
+
#: class/wpmdb.php:110
|
479 |
msgctxt "Configure a migration or export"
|
480 |
msgid "Migrate"
|
481 |
msgstr ""
|
482 |
|
483 |
+
#: class/wpmdb.php:112
|
484 |
msgctxt "Get help or contact support"
|
485 |
msgid "Help"
|
486 |
msgstr ""
|
487 |
|
488 |
+
#: class/wpmdb.php:182
|
489 |
+
#, php-format
|
490 |
+
msgid "The following directory could not be created: %s"
|
491 |
+
msgstr ""
|
492 |
+
|
493 |
+
#: class/wpmdb.php:187
|
494 |
+
#, php-format
|
495 |
+
msgid "Could not copy the compatibility plugin from %1$s to %2$s"
|
496 |
msgstr ""
|
497 |
|
498 |
+
#: class/wpmdb.php:193
|
499 |
+
#, php-format
|
500 |
+
msgid "Could not remove the compatibility plugin from %s"
|
501 |
msgstr ""
|
502 |
|
503 |
+
#: class/wpmdb.php:926
|
504 |
+
#: class/wpmdbpro.php:333
|
505 |
+
#: class/wpmdbpro.php:1722
|
506 |
msgid ""
|
507 |
"Failed attempting to unserialize the response from the remote server. Please "
|
508 |
"contact support."
|
509 |
msgstr ""
|
510 |
|
511 |
+
#: class/wpmdb.php:1341
|
512 |
msgid ""
|
513 |
"Failed to retrieve table structure, please ensure your database is online. "
|
514 |
"(#125)"
|
515 |
msgstr ""
|
516 |
|
517 |
+
#: class/wpmdb.php:1367
|
518 |
#, php-format
|
519 |
msgid "Delete any existing table %s"
|
520 |
msgstr ""
|
521 |
|
522 |
+
#: class/wpmdb.php:1378
|
523 |
#, php-format
|
524 |
msgid "Table structure of table %s"
|
525 |
msgstr ""
|
526 |
|
527 |
+
#: class/wpmdb.php:1386
|
528 |
msgid ""
|
529 |
"Failed to generate the create table query, please ensure your database is "
|
530 |
"online. (#126)"
|
531 |
msgstr ""
|
532 |
|
533 |
+
#: class/wpmdb.php:1441
|
534 |
#, php-format
|
535 |
msgid "Data contents of table %s"
|
536 |
msgstr ""
|
537 |
|
538 |
+
#: class/wpmdb.php:1775
|
539 |
#, php-format
|
540 |
msgid "End of data contents of table %s"
|
541 |
msgstr ""
|
542 |
|
543 |
+
#: class/wpmdb.php:1915
|
544 |
msgid "WordPress MySQL database migration"
|
545 |
msgstr ""
|
546 |
|
547 |
+
#: class/wpmdb.php:1917
|
548 |
#, php-format
|
549 |
msgid "Generated: %s"
|
550 |
msgstr ""
|
551 |
|
552 |
+
#: class/wpmdb.php:1918
|
553 |
#, php-format
|
554 |
msgid "Hostname: %s"
|
555 |
msgstr ""
|
556 |
|
557 |
+
#: class/wpmdb.php:1919
|
558 |
#, php-format
|
559 |
msgid "Database: %s"
|
560 |
msgstr ""
|
561 |
|
562 |
+
#: class/wpmdb.php:1972
|
563 |
msgid "Failed to write the gzipped SQL data to the file. (#127)"
|
564 |
msgstr ""
|
565 |
|
566 |
+
#: class/wpmdb.php:1979
|
567 |
msgid "Failed to write the SQL data to the file. (#128)"
|
568 |
msgstr ""
|
569 |
|
570 |
+
#: class/wpmdb.php:2114
|
571 |
+
#: class/wpmdb.php:2125
|
572 |
+
#: class/wpmdbpro.php:1682
|
573 |
msgid "Migrate DB Pro"
|
574 |
msgstr ""
|
575 |
|
576 |
+
#: class/wpmdb.php:2114
|
577 |
+
#: class/wpmdb.php:2125
|
578 |
+
#: class/wpmdb.php:2659
|
579 |
msgid "Migrate DB"
|
580 |
msgstr ""
|
581 |
|
582 |
+
#: class/wpmdb.php:2298
|
583 |
msgid ""
|
584 |
"A problem occurred when trying to change the maximum request size, please "
|
585 |
"try again."
|
586 |
msgstr ""
|
587 |
|
588 |
+
#: class/wpmdb.php:2299
|
589 |
+
#: class/wpmdbpro.php:1008
|
590 |
msgid "A problem occurred when trying to check the license, please try again."
|
591 |
msgstr ""
|
592 |
|
593 |
+
#: class/wpmdb.php:2300
|
594 |
msgid "Establishing connection to remote server, please wait"
|
595 |
msgstr ""
|
596 |
|
597 |
+
#: class/wpmdb.php:2301
|
598 |
msgid ""
|
599 |
"A problem occurred when attempting to connect to the local server, please "
|
600 |
"check the details and try again."
|
601 |
msgstr ""
|
602 |
|
603 |
+
#: class/wpmdb.php:2302
|
604 |
msgid "Please enter your license key."
|
605 |
msgstr ""
|
606 |
|
607 |
+
#: class/wpmdb.php:2303
|
608 |
msgid ""
|
609 |
"A problem occurred when trying to register the license, please try again."
|
610 |
msgstr ""
|
611 |
|
612 |
+
#: class/wpmdb.php:2304
|
613 |
msgid ""
|
614 |
"Your license has been activated. You will now receive automatic updates and "
|
615 |
"access to email support."
|
616 |
msgstr ""
|
617 |
|
618 |
+
#: class/wpmdb.php:2305
|
619 |
+
#: template/pro/licence-info.php:6
|
620 |
msgid "Fetching license details, please wait..."
|
621 |
msgstr ""
|
622 |
|
623 |
+
#: class/wpmdb.php:2306
|
624 |
msgid ""
|
625 |
"An error occurred when trying to clear the debug log. Please contact "
|
626 |
"support. (#132)"
|
627 |
msgstr ""
|
628 |
|
629 |
+
#: class/wpmdb.php:2307
|
630 |
msgid ""
|
631 |
"An error occurred when trying to update the debug log. Please contact "
|
632 |
"support. (#133)"
|
633 |
msgstr ""
|
634 |
|
635 |
+
#: class/wpmdb.php:2308
|
636 |
msgctxt "Copy data between servers and save migration profile"
|
637 |
+
msgid "Migrate & Save Profile"
|
638 |
msgstr ""
|
639 |
|
640 |
+
#: class/wpmdb.php:2309
|
641 |
msgctxt "Copy data between servers"
|
642 |
+
msgid "Migrate"
|
643 |
msgstr ""
|
644 |
|
645 |
+
#: class/wpmdb.php:2310
|
646 |
msgid "Please select at least one table to migrate."
|
647 |
msgstr ""
|
648 |
|
649 |
+
#: class/wpmdb.php:2311
|
650 |
msgid "Please enter a name for your migration profile."
|
651 |
msgstr ""
|
652 |
|
653 |
+
#: class/wpmdb.php:2312
|
654 |
msgid ""
|
655 |
"An error occurred when attempting to save the migration profile. Please see "
|
656 |
"the Help tab for details on how to request support. (#118)"
|
657 |
msgstr ""
|
658 |
|
659 |
+
#: class/wpmdb.php:2313
|
660 |
msgctxt "Data has been successfully exported"
|
661 |
msgid "Exporting complete"
|
662 |
msgstr ""
|
663 |
|
664 |
+
#: class/wpmdb.php:2314
|
665 |
msgid "Exporting, please wait..."
|
666 |
msgstr ""
|
667 |
|
668 |
+
#: class/wpmdb.php:2315
|
669 |
msgid "please wait..."
|
670 |
msgstr ""
|
671 |
|
672 |
+
#: class/wpmdb.php:2316
|
673 |
msgctxt "Finished successfully"
|
674 |
msgid "complete"
|
675 |
msgstr ""
|
676 |
|
677 |
+
#: class/wpmdb.php:2317
|
678 |
msgctxt "Copy of data between servers did not complete"
|
679 |
msgid "Migration failed"
|
680 |
msgstr ""
|
681 |
|
682 |
+
#: class/wpmdb.php:2318
|
683 |
msgctxt "Saving a copy of the data before import"
|
684 |
msgid "Backing up"
|
685 |
msgstr ""
|
686 |
|
687 |
+
#: class/wpmdb.php:2319
|
688 |
msgctxt "Copying data between servers"
|
689 |
msgid "Migrating"
|
690 |
msgstr ""
|
691 |
|
692 |
+
#: class/wpmdb.php:2320
|
693 |
msgctxt "Current request status"
|
694 |
msgid "Status"
|
695 |
msgstr ""
|
696 |
|
697 |
+
#: class/wpmdb.php:2321
|
698 |
msgctxt "The message the server responded with"
|
699 |
msgid "Response"
|
700 |
msgstr ""
|
701 |
|
702 |
+
#: class/wpmdb.php:2322
|
703 |
msgid ""
|
704 |
"A problem occurred when attempting to process the following table (#113)"
|
705 |
msgstr ""
|
706 |
|
707 |
+
#: class/wpmdb.php:2323
|
708 |
msgid ""
|
709 |
"A problem occurred when processing the following table. We were expecting a "
|
710 |
"response in JSON format but instead received an empty response."
|
711 |
msgstr ""
|
712 |
|
713 |
+
#: class/wpmdb.php:2324
|
714 |
msgid "Migration completed with some errors"
|
715 |
msgstr ""
|
716 |
|
717 |
+
#: class/wpmdb.php:2325
|
718 |
msgid "Migration complete, your backup is located at:"
|
719 |
msgstr ""
|
720 |
|
721 |
+
#: class/wpmdb.php:2326
|
722 |
msgid "A problem occurred when finalizing the backup. (#140)"
|
723 |
msgstr ""
|
724 |
|
725 |
+
#: class/wpmdb.php:2327
|
726 |
+
#: template/common/compatibility.php:34
|
727 |
+
#: template/common/max-request-size.php:11
|
728 |
+
#: template/pro/delay-between-requests.php:11
|
729 |
msgctxt "The settings were saved successfully"
|
730 |
msgid "Saved"
|
731 |
msgstr ""
|
732 |
|
733 |
+
#: class/wpmdb.php:2328
|
734 |
msgid ""
|
735 |
"Any sites setup to use the current secret key will no longer be able to "
|
736 |
"connect. You will need to update those sites with the newly generated secret "
|
737 |
"key. Do you wish to continue?"
|
738 |
msgstr ""
|
739 |
|
740 |
+
#: class/wpmdb.php:2329
|
741 |
msgid ""
|
742 |
"An error occurred when trying to generate the secret key. Please see the "
|
743 |
"Help tab for details on how to request support. (#105)"
|
744 |
msgstr ""
|
745 |
|
746 |
+
#: class/wpmdb.php:2330
|
747 |
msgid ""
|
748 |
+
"You are about to remove the migration profile \"{{profile}}\". This cannot "
|
749 |
+
"be undone. Do you wish to continue?"
|
750 |
msgstr ""
|
751 |
|
752 |
+
#: class/wpmdb.php:2331
|
753 |
msgid ""
|
754 |
"An error occurred when trying to delete the profile. Please see the Help tab "
|
755 |
"for details on how to request support. (#106)"
|
756 |
msgstr ""
|
757 |
|
758 |
+
#: class/wpmdb.php:2332
|
759 |
msgid ""
|
760 |
"The selected migration profile could not be deleted because it was not "
|
761 |
"found.\n"
|
763 |
"migration profiles."
|
764 |
msgstr ""
|
765 |
|
766 |
+
#: class/wpmdb.php:2333
|
767 |
msgid ""
|
768 |
"If you change the connection details, you will lose any replaces and table "
|
769 |
"selections you have made below. Do you wish to continue?"
|
770 |
msgstr ""
|
771 |
|
772 |
+
#: class/wpmdb.php:2334
|
773 |
+
#: template/migrate.php:113
|
774 |
msgid "Please enter the connection information above to continue."
|
775 |
msgstr ""
|
776 |
|
777 |
+
#: class/wpmdb.php:2335
|
778 |
msgid ""
|
779 |
"An error occurred when trying to save the settings. Please try again. If the "
|
780 |
"problem persists, please see the Help tab for details on how to request "
|
781 |
"support. (#108)"
|
782 |
msgstr ""
|
783 |
|
784 |
+
#: class/wpmdb.php:2336
|
785 |
msgid ""
|
786 |
"The connection information appears to be missing, please enter it to "
|
787 |
"continue."
|
788 |
msgstr ""
|
789 |
|
790 |
+
#: class/wpmdb.php:2337
|
791 |
msgid ""
|
792 |
"The connection information appears to be incorrect, it should consist of two "
|
793 |
"lines. The first being the remote server's URL and the second being the "
|
794 |
"secret key."
|
795 |
msgstr ""
|
796 |
|
797 |
+
#: class/wpmdb.php:2338
|
798 |
msgid ""
|
799 |
"The URL on the first line appears to be invalid, please check it and try "
|
800 |
"again."
|
801 |
msgstr ""
|
802 |
|
803 |
+
#: class/wpmdb.php:2339
|
804 |
msgid ""
|
805 |
"The secret key on the second line appears to be invalid. It should be a 32 "
|
806 |
"character string that consists of letters, numbers and special characters "
|
807 |
"only."
|
808 |
msgstr ""
|
809 |
|
810 |
+
#: class/wpmdb.php:2340
|
811 |
msgid ""
|
812 |
"It appears you've entered the URL for this website, you need to provide the "
|
813 |
"URL of the remote website instead."
|
814 |
msgstr ""
|
815 |
|
816 |
+
#: class/wpmdb.php:2341
|
817 |
msgid ""
|
818 |
"Looks like your remote secret key is the same as the secret key for this "
|
819 |
"site. To fix this, go to the <a href=\"#settings\">Settings tab</a> and "
|
820 |
"click \"Reset Secret Key\""
|
821 |
msgstr ""
|
822 |
|
823 |
+
#: class/wpmdb.php:2342
|
824 |
+
#: template/migrate-progress.php:9
|
825 |
msgid "Time Elapsed:"
|
826 |
msgstr ""
|
827 |
|
828 |
+
#: class/wpmdb.php:2343
|
829 |
+
#: template/migrate-progress.php:21
|
830 |
msgctxt "Temporarily stop migrating"
|
831 |
msgid "Pause"
|
832 |
msgstr ""
|
833 |
|
834 |
+
#: class/wpmdb.php:2344
|
835 |
msgctxt "The migration has been temporarily stopped"
|
836 |
msgid "Migration Paused"
|
837 |
msgstr ""
|
838 |
|
839 |
+
#: class/wpmdb.php:2345
|
840 |
msgctxt "Restart migrating after it was paused"
|
841 |
msgid "Resume"
|
842 |
msgstr ""
|
843 |
|
844 |
+
#: class/wpmdb.php:2346
|
845 |
msgid "Completing current request"
|
846 |
msgstr ""
|
847 |
|
848 |
+
#: class/wpmdb.php:2347
|
849 |
msgctxt "The migration is being cancelled"
|
850 |
msgid "Cancelling migration"
|
851 |
msgstr ""
|
852 |
|
853 |
+
#: class/wpmdb.php:2348
|
854 |
msgctxt "The migration has been temporarily stopped"
|
855 |
msgid "Paused"
|
856 |
msgstr ""
|
857 |
|
858 |
+
#: class/wpmdb.php:2349
|
859 |
msgid "Removing the local MySQL export file"
|
860 |
msgstr ""
|
861 |
|
862 |
+
#: class/wpmdb.php:2350
|
863 |
msgid "Removing the local backup MySQL export file"
|
864 |
msgstr ""
|
865 |
|
866 |
+
#: class/wpmdb.php:2351
|
867 |
msgid "Removing the local temporary tables"
|
868 |
msgstr ""
|
869 |
|
870 |
+
#: class/wpmdb.php:2352
|
871 |
msgid "Removing the remote backup MySQL export file"
|
872 |
msgstr ""
|
873 |
|
874 |
+
#: class/wpmdb.php:2353
|
875 |
msgid "Removing the remote temporary tables"
|
876 |
msgstr ""
|
877 |
|
878 |
+
#: class/wpmdb.php:2354
|
879 |
msgid "Migration cancellation failed"
|
880 |
msgstr ""
|
881 |
|
882 |
+
#: class/wpmdb.php:2355
|
883 |
msgid ""
|
884 |
"A problem occurred while cancelling the migration, you may have to manually "
|
885 |
"delete some temporary files / tables."
|
886 |
msgstr ""
|
887 |
|
888 |
+
#: class/wpmdb.php:2356
|
889 |
msgctxt "The migration has been cancelled"
|
890 |
msgid "Migration cancelled"
|
891 |
msgstr ""
|
892 |
|
893 |
+
#: class/wpmdb.php:2357
|
894 |
msgctxt "The migration completed successfully"
|
895 |
msgid "Migration complete"
|
896 |
msgstr ""
|
897 |
|
898 |
+
#: class/wpmdb.php:2358
|
899 |
msgctxt "The migration is in the last stages"
|
900 |
msgid "Finalizing migration"
|
901 |
msgstr ""
|
902 |
|
903 |
+
#: class/wpmdb.php:2359
|
904 |
+
msgctxt "The caches and rewrite rules for the target are being flushed"
|
905 |
+
msgid "Flushing caches and rewrite rules"
|
906 |
+
msgstr ""
|
907 |
+
|
908 |
+
#: class/wpmdb.php:2360
|
909 |
msgid "A problem occurred when trying to add plugins to backlist."
|
910 |
msgstr ""
|
911 |
|
912 |
+
#: class/wpmdb.php:2361
|
913 |
msgid ""
|
914 |
"If confirmed we will install an additional WordPress 'Must Use' plugin. This "
|
915 |
"plugin will allow us to control which plugins are loaded during WP Migrate "
|
916 |
"DB Pro specific operations. Do you wish to continue?"
|
917 |
msgstr ""
|
918 |
|
919 |
+
#: class/wpmdb.php:2362
|
920 |
msgid ""
|
921 |
"A problem occurred when trying to change the plugin compatibility setting."
|
922 |
msgstr ""
|
923 |
|
924 |
+
#: class/wpmdb.php:2363
|
925 |
msgctxt "Confirmation required"
|
926 |
msgid "Sure?"
|
927 |
msgstr ""
|
928 |
|
929 |
+
#: class/wpmdb.php:2364
|
930 |
#, php-format
|
931 |
msgid "Pulling from %s, please wait..."
|
932 |
msgstr ""
|
933 |
|
934 |
+
#: class/wpmdb.php:2365
|
935 |
#, php-format
|
936 |
msgid "Pulling from %s complete"
|
937 |
msgstr ""
|
938 |
|
939 |
+
#: class/wpmdb.php:2366
|
940 |
#, php-format
|
941 |
msgid "Pushing to %s, please wait..."
|
942 |
msgstr ""
|
943 |
|
944 |
+
#: class/wpmdb.php:2367
|
945 |
#, php-format
|
946 |
msgid "Pushing to %s complete"
|
947 |
msgstr ""
|
948 |
|
949 |
+
#: class/wpmdb.php:2368
|
950 |
msgid "Copying license to the remote site, please wait"
|
951 |
msgstr ""
|
952 |
|
953 |
+
#: class/wpmdb.php:2369
|
954 |
+
msgid "Attempting to activate your license, please wait..."
|
955 |
msgstr ""
|
956 |
|
957 |
+
#: class/wpmdb.php:2370
|
958 |
msgid "License successfully activated, please wait..."
|
959 |
msgstr ""
|
960 |
|
961 |
+
#: class/wpmdb.php:2371
|
962 |
msgid ""
|
963 |
"An error occurred when trying to reactivate your license. Please provide the "
|
964 |
"following information when requesting support:"
|
965 |
msgstr ""
|
966 |
|
967 |
+
#: class/wpmdb.php:2372
|
968 |
+
msgid ""
|
969 |
+
"<strong>We've temporarily activated your licence and will complete the "
|
970 |
+
"activation once the Delicious Brains API is available again.</strong><br /"
|
971 |
+
">Please refresh this page to continue."
|
972 |
+
msgstr ""
|
973 |
+
|
974 |
+
#: class/wpmdb.php:2373
|
975 |
+
msgid "JSON Decoding Failure"
|
976 |
+
msgstr ""
|
977 |
+
|
978 |
+
#: class/wpmdb.php:2374
|
979 |
+
msgid ""
|
980 |
+
"Our AJAX request was expecting JSON but we received something else. Often "
|
981 |
+
"this is caused by your theme and/or plugins spitting out PHP errors. If you "
|
982 |
+
"can edit the theme or plugins causing the errors, you should be able to fix "
|
983 |
+
"them up, but if not, you can set WP_DEBUG to false in wp-config.php to "
|
984 |
+
"disable errors from showing up."
|
985 |
+
msgstr ""
|
986 |
+
|
987 |
+
#: class/wpmdb.php:2375
|
988 |
+
msgid "View error messages"
|
989 |
+
msgstr ""
|
990 |
+
|
991 |
+
#: class/wpmdb.php:2376
|
992 |
+
#, php-format
|
993 |
+
msgid "Waiting %s seconds before executing next step"
|
994 |
+
msgstr ""
|
995 |
+
|
996 |
+
#: class/wpmdb.php:2377
|
997 |
+
msgid ""
|
998 |
+
"A problem occurred when trying to change the delay between requests, please "
|
999 |
+
"try again."
|
1000 |
+
msgstr ""
|
1001 |
+
|
1002 |
+
#: class/wpmdb.php:2378
|
1003 |
+
msgid "A problem occurred when flushing caches and rewrite rules. (#145)"
|
1004 |
+
msgstr ""
|
1005 |
+
|
1006 |
+
#: class/wpmdb.php:2414
|
1007 |
msgid "Could not find the file to download:"
|
1008 |
msgstr ""
|
1009 |
|
1010 |
+
#: class/wpmdb.php:2593
|
1011 |
msgid "MySQL export file not found."
|
1012 |
msgstr ""
|
1013 |
|
1014 |
+
#: class/wpmdb.php:2599
|
1015 |
+
msgid "Could not delete the MySQL export file."
|
1016 |
+
msgstr ""
|
1017 |
+
|
1018 |
+
#: class/wpmdb.php:2694
|
1019 |
msgid ""
|
1020 |
"WP Migrate DB and WP Migrate DB Pro cannot both be active. We've "
|
1021 |
"automatically deactivated WP Migrate DB."
|
1022 |
msgstr ""
|
1023 |
|
1024 |
+
#: class/wpmdb.php:2696
|
1025 |
msgid ""
|
1026 |
"WP Migrate DB and WP Migrate DB Pro cannot both be active. We've "
|
1027 |
"automatically deactivated WP Migrate DB Pro."
|
1028 |
msgstr ""
|
1029 |
|
1030 |
+
#: class/wpmdb.php:2801
|
1031 |
+
msgid "Warning: Mixed Case Table Names"
|
1032 |
+
msgstr ""
|
1033 |
+
|
1034 |
+
#: class/wpmdb.php:2804
|
1035 |
+
msgid ""
|
1036 |
+
"Whoa! We've detected that your <b>local</b> site has the MySQL setting "
|
1037 |
+
"<code>lower_case_table_names</code> set to <code>1</code>."
|
1038 |
+
msgstr ""
|
1039 |
+
|
1040 |
+
#: class/wpmdb.php:2806
|
1041 |
+
msgid ""
|
1042 |
+
"Whoa! We've detected that your <b>remote</b> site has the MySQL setting "
|
1043 |
+
"<code>lower_case_table_names</code> set to <code>1</code>."
|
1044 |
+
msgstr ""
|
1045 |
+
|
1046 |
+
#: class/wpmdb.php:2809
|
1047 |
+
msgid ""
|
1048 |
+
"As a result, uppercase characters in table names will be converted to "
|
1049 |
+
"lowercase during the migration."
|
1050 |
+
msgstr ""
|
1051 |
+
|
1052 |
+
#: class/wpmdb.php:2811
|
1053 |
+
#, php-format
|
1054 |
+
msgid ""
|
1055 |
+
"You can read more about this in <a href=\"%s\">our documentation</a>, "
|
1056 |
+
"proceed with caution."
|
1057 |
+
msgstr ""
|
1058 |
+
|
1059 |
+
#: class/wpmdbpro-addon.php:61
|
1060 |
#, php-format
|
1061 |
msgid ""
|
1062 |
"The version of %1$s you have installed, requires version %2$s of WP Migrate "
|
1064 |
"Now</a></strong>"
|
1065 |
msgstr ""
|
1066 |
|
1067 |
+
#: class/wpmdbpro-cli-export.php:62
|
1068 |
+
msgid ""
|
1069 |
+
"The installation must be a Multisite network to make use of the subsite "
|
1070 |
+
"option"
|
1071 |
+
msgstr ""
|
1072 |
+
|
1073 |
+
#: class/wpmdbpro-cli-export.php:65
|
1074 |
+
msgid ""
|
1075 |
+
"The Multisite Tools addon needs to be installed and activated to make use of "
|
1076 |
+
"the subsite option"
|
1077 |
+
msgstr ""
|
1078 |
+
|
1079 |
+
#: class/wpmdbpro-cli-export.php:68
|
1080 |
+
#: class/wpmdbpro-cli-export.php:74
|
1081 |
+
msgid ""
|
1082 |
+
"A valid Blog ID or Subsite URL must be supplied to make use of the subsite "
|
1083 |
+
"option"
|
1084 |
+
msgstr ""
|
1085 |
+
|
1086 |
+
#: class/wpmdbpro-cli-export.php:85
|
1087 |
+
msgid "A new table name prefix may only be specified for subsite exports."
|
1088 |
+
msgstr ""
|
1089 |
+
|
1090 |
+
#: class/wpmdbpro-cli-export.php:88
|
1091 |
+
msgid "A valid prefix must be supplied to make use of the prefix option"
|
1092 |
+
msgstr ""
|
1093 |
+
|
1094 |
+
#: class/wpmdbpro.php:108
|
1095 |
msgctxt "Plugin extensions"
|
1096 |
msgid "Addons"
|
1097 |
msgstr ""
|
1098 |
|
1099 |
+
#: class/wpmdbpro.php:179
|
1100 |
+
msgid "UI Walkthrough"
|
1101 |
msgstr ""
|
1102 |
|
1103 |
+
#: class/wpmdbpro.php:180
|
1104 |
msgid ""
|
1105 |
"A brief walkthrough of the WP Migrate DB plugin showing all of the different "
|
1106 |
"options and explaining them."
|
1107 |
msgstr ""
|
1108 |
|
1109 |
+
#: class/wpmdbpro.php:183
|
1110 |
msgid "Pulling Live Data Into Your Local Development Environment"
|
1111 |
msgstr ""
|
1112 |
|
1113 |
+
#: class/wpmdbpro.php:184
|
1114 |
msgid ""
|
1115 |
"This screencast demonstrates how you can pull data from a remote, live "
|
1116 |
"WordPress install and update the data in your local development environment."
|
1117 |
msgstr ""
|
1118 |
|
1119 |
+
#: class/wpmdbpro.php:187
|
1120 |
msgid "Pushing Local Development Data to a Staging Environment"
|
1121 |
msgstr ""
|
1122 |
|
1123 |
+
#: class/wpmdbpro.php:188
|
1124 |
msgid ""
|
1125 |
"This screencast demonstrates how you can push a local WordPress database "
|
1126 |
"you've been using for development to a staging environment."
|
1127 |
msgstr ""
|
1128 |
|
1129 |
+
#: class/wpmdbpro.php:191
|
1130 |
msgid "Media Files Addon Demo"
|
1131 |
msgstr ""
|
1132 |
|
1133 |
+
#: class/wpmdbpro.php:192
|
1134 |
msgid ""
|
1135 |
"A short demo of how the Media Files addon allows you to sync up your "
|
1136 |
"WordPress Media Libraries."
|
1137 |
msgstr ""
|
1138 |
|
1139 |
+
#: class/wpmdbpro.php:299
|
1140 |
msgid ""
|
1141 |
"Please activate your license before attempting a pull or push migration."
|
1142 |
msgstr ""
|
1143 |
|
1144 |
+
#: class/wpmdbpro.php:600
|
1145 |
msgid ""
|
1146 |
"The connection succeeded but the remote site is configured to reject pull "
|
1147 |
"connections. You can change this in the \"settings\" tab on the remote site. "
|
1148 |
"(#141)"
|
1149 |
msgstr ""
|
1150 |
|
1151 |
+
#: class/wpmdbpro.php:651
|
1152 |
+
msgid ""
|
1153 |
+
"The connection succeeded but the remote site is configured to reject pull "
|
1154 |
+
"connections. You can change this in the \"settings\" tab on the remote site. "
|
1155 |
+
"(#110)"
|
1156 |
msgstr ""
|
1157 |
|
1158 |
+
#: class/wpmdbpro.php:653
|
1159 |
+
msgid ""
|
1160 |
+
"The connection succeeded but the remote site is configured to reject push "
|
1161 |
+
"connections. You can change this in the \"settings\" tab on the remote site. "
|
1162 |
+
"(#110)"
|
1163 |
msgstr ""
|
1164 |
|
1165 |
+
#: class/wpmdbpro.php:722
|
1166 |
#, php-format
|
1167 |
msgid ""
|
1168 |
+
"<b>Version Mismatch</b> — We've detected you have version %1$s of WP "
|
1169 |
+
"Migrate DB Pro at %2$s but are using an outdated version here. Please go to "
|
1170 |
+
"the Plugins page on both installs and check for updates."
|
1171 |
+
msgstr ""
|
1172 |
+
|
1173 |
+
#: class/wpmdbpro.php:724
|
1174 |
+
#, php-format
|
1175 |
+
msgid ""
|
1176 |
+
"<b>Version Mismatch</b> — We've detected you have version %1$s of WP "
|
1177 |
+
"Migrate DB Pro at %2$s but are using %3$s here. Please go to the <a href="
|
1178 |
+
"\"%4$s\">Plugins page</a> on both installs and check for updates."
|
1179 |
msgstr ""
|
1180 |
|
1181 |
+
#: class/wpmdbpro.php:735
|
1182 |
msgctxt "Asking to try and connect to remote server after verification error"
|
1183 |
msgid "Try again?"
|
1184 |
msgstr ""
|
1185 |
|
1186 |
+
#: class/wpmdbpro.php:748
|
1187 |
#, php-format
|
1188 |
msgid ""
|
1189 |
"Activate remote license — Looks like you don't have a WP Migrate DB "
|
1190 |
"Pro license active at %s."
|
1191 |
msgstr ""
|
1192 |
|
1193 |
+
#: class/wpmdbpro.php:750
|
1194 |
#, php-format
|
1195 |
msgid "Copy %1$s license key to %2$s and activate it"
|
1196 |
msgstr ""
|
1197 |
|
1198 |
+
#: class/wpmdbpro.php:761
|
1199 |
+
msgid ""
|
1200 |
+
"The connection succeeded but the remote site is configured to reject pull "
|
1201 |
+
"connections. You can change this in the \"settings\" tab on the remote site. "
|
1202 |
+
"(#122)"
|
1203 |
+
msgstr ""
|
1204 |
+
|
1205 |
+
#: class/wpmdbpro.php:763
|
1206 |
msgid ""
|
1207 |
+
"The connection succeeded but the remote site is configured to reject push "
|
1208 |
"connections. You can change this in the \"settings\" tab on the remote site. "
|
1209 |
+
"(#122)"
|
1210 |
+
msgstr ""
|
1211 |
+
|
1212 |
+
#: class/wpmdbpro.php:765
|
1213 |
+
msgctxt "Attempt to connect to the remote server again"
|
1214 |
+
msgid "Try again?"
|
1215 |
msgstr ""
|
1216 |
|
1217 |
+
#: class/wpmdbpro.php:911
|
1218 |
msgctxt "Delete license"
|
1219 |
msgid "Remove"
|
1220 |
msgstr ""
|
1221 |
|
1222 |
+
#: class/wpmdbpro.php:1085
|
1223 |
+
msgid ""
|
1224 |
+
"If you have an <strong>active license</strong>, you may send an email to the "
|
1225 |
+
"following address."
|
1226 |
+
msgstr ""
|
1227 |
+
|
1228 |
+
#: class/wpmdbpro.php:1087
|
1229 |
+
msgid ""
|
1230 |
+
"Please copy the Diagnostic Info & Error Log info below into a text file "
|
1231 |
+
"and attach it to your email. Do the same for any other site involved in your "
|
1232 |
+
"email."
|
1233 |
+
msgstr ""
|
1234 |
+
|
1235 |
+
#: class/wpmdbpro.php:1118
|
1236 |
msgctxt "License does not allow use of addons"
|
1237 |
msgid "Addons Unavailable"
|
1238 |
msgstr ""
|
1239 |
|
1240 |
+
#: class/wpmdbpro.php:1118
|
1241 |
#, php-format
|
1242 |
msgid ""
|
1243 |
"Addons are not included with the Personal license. Visit <a href=\"%s\" "
|
1244 |
"target=\"_blank\">My Account</a> to upgrade in just a few clicks."
|
1245 |
msgstr ""
|
1246 |
|
1247 |
+
#: class/wpmdbpro.php:1133
|
1248 |
msgctxt "Installed on website but not activated"
|
1249 |
msgid "Installed"
|
1250 |
msgstr ""
|
1251 |
|
1252 |
+
#: class/wpmdbpro.php:1135
|
1253 |
msgctxt "Installed and activated on website"
|
1254 |
msgid "Activated"
|
1255 |
msgstr ""
|
1256 |
|
1257 |
+
#: class/wpmdbpro.php:1138
|
1258 |
msgctxt "Enable addon so it may be used"
|
1259 |
msgid "Activate"
|
1260 |
msgstr ""
|
1261 |
|
1262 |
+
#: class/wpmdbpro.php:1142
|
1263 |
msgctxt "Download and activate addon"
|
1264 |
msgid "Install"
|
1265 |
msgstr ""
|
1266 |
|
1267 |
+
#: class/wpmdbpro.php:1148
|
1268 |
+
#: template/common/debug-info.php:4
|
1269 |
msgctxt "Download to your computer"
|
1270 |
msgid "Download"
|
1271 |
msgstr ""
|
1272 |
|
1273 |
+
#: class/wpmdbpro.php:1574
|
1274 |
msgid "Could not upload the SQL to the server. (#135)"
|
1275 |
msgstr ""
|
1276 |
|
1277 |
+
#: class/wpmdbpro.php:1580
|
1278 |
msgid "Could not read the SQL file we uploaded to the server. (#136)"
|
1279 |
msgstr ""
|
1280 |
|
1281 |
+
#: class/wpmdbpro.php:1599
|
1282 |
msgid ""
|
1283 |
"The connection succeeded but the remote site is configured to reject push "
|
1284 |
"connections. You can change this in the \"settings\" tab on the remote site. "
|
1285 |
"(#139)"
|
1286 |
msgstr ""
|
1287 |
|
1288 |
+
#: class/wpmdbpro.php:1865
|
1289 |
+
#, php-format
|
1290 |
+
msgid "There is a new version of %s available."
|
1291 |
+
msgstr ""
|
1292 |
+
|
1293 |
+
#: class/wpmdbpro.php:1867
|
1294 |
+
#, php-format
|
1295 |
+
msgid "View version %s details"
|
1296 |
+
msgstr ""
|
1297 |
+
|
1298 |
+
#: class/wpmdbpro.php:1877
|
1299 |
+
#, php-format
|
1300 |
+
msgid ""
|
1301 |
+
"To update, go to %1$s and enter your license key. If you don't have a "
|
1302 |
+
"license key, you may <a href=\"%2$s\">purchase one</a>."
|
1303 |
+
msgstr ""
|
1304 |
+
|
1305 |
+
#: class/wpmdbpro.php:1879
|
1306 |
+
#, php-format
|
1307 |
+
msgid ""
|
1308 |
+
"To finish activating %1$s, please go to %2$s and enter your license key. If "
|
1309 |
+
"you don't have a license key, you may <a href=\"%3$s\">purchase one</a>."
|
1310 |
+
msgstr ""
|
1311 |
+
|
1312 |
+
#: class/wpmdbpro.php:1945
|
1313 |
+
msgid "Could not retrieve version details. Please try again."
|
1314 |
+
msgstr ""
|
1315 |
+
|
1316 |
#: template/addons.php:7
|
1317 |
msgid "Fetching addon details, please wait..."
|
1318 |
msgstr ""
|
1319 |
|
1320 |
+
#: template/addons.php:9
|
1321 |
+
#: template/pro/licence-info.php:8
|
1322 |
msgid ""
|
1323 |
"We couldn't find your license information. Please switch to the settings tab "
|
1324 |
"and enter your license."
|
1328 |
msgid "Once completed, you may visit this tab to view the available addons."
|
1329 |
msgstr ""
|
1330 |
|
1331 |
+
#: template/common/breadcrumbs.php:3
|
1332 |
+
msgctxt "Default profile loaded"
|
1333 |
+
msgid "New Profile"
|
1334 |
msgstr ""
|
1335 |
|
1336 |
#: template/common/breadcrumbs.php:9
|
1343 |
"migration requests"
|
1344 |
msgstr ""
|
1345 |
|
1346 |
+
#: template/common/compatibility.php:9
|
1347 |
msgid ""
|
1348 |
"Some plugins add a lot of overhead to each request, requiring extra memory "
|
1349 |
"and CPU. And some plugins even interfere with migrations and cause them to "
|
1351 |
"example a plugin that hooks into WP Migrate DB."
|
1352 |
msgstr ""
|
1353 |
|
1354 |
+
#: template/common/compatibility.php:26
|
1355 |
+
#: template/pro/backup.php:44
|
1356 |
+
#: template/pro/exclude-post-types.php:19
|
1357 |
+
#: template/pro/select-tables.php:36
|
1358 |
msgid "Select All"
|
1359 |
msgstr ""
|
1360 |
|
1361 |
+
#: template/common/compatibility.php:28
|
1362 |
+
#: template/pro/backup.php:46
|
1363 |
+
#: template/pro/exclude-post-types.php:21
|
1364 |
+
#: template/pro/select-tables.php:38
|
1365 |
msgid "Deselect All"
|
1366 |
msgstr ""
|
1367 |
|
1368 |
+
#: template/common/compatibility.php:30
|
1369 |
+
#: template/pro/backup.php:48
|
1370 |
+
#: template/pro/exclude-post-types.php:23
|
1371 |
+
#: template/pro/select-tables.php:40
|
1372 |
msgid "Invert Selection"
|
1373 |
msgstr ""
|
1374 |
|
1375 |
+
#: template/common/compatibility.php:33
|
1376 |
msgid "Save Changes"
|
1377 |
msgstr ""
|
1378 |
|
1388 |
msgid "Maximum Request Size"
|
1389 |
msgstr ""
|
1390 |
|
1391 |
+
#: template/common/max-request-size.php:7
|
1392 |
#, php-format
|
1393 |
msgid ""
|
1394 |
"We've detected that your server supports requests up to %s, but it's "
|
1398 |
"with time outs, try throttling this setting down."
|
1399 |
msgstr ""
|
1400 |
|
1401 |
+
#: template/migrate-progress.php:5
|
1402 |
msgid "Please wait while migration is running..."
|
1403 |
msgstr ""
|
1404 |
|
1405 |
+
#: template/migrate-progress.php:8
|
1406 |
msgid "Establishing Connection"
|
1407 |
msgstr ""
|
1408 |
|
1409 |
+
#: template/migrate-progress.php:22
|
1410 |
msgctxt "Stop the migration"
|
1411 |
msgid "Cancel"
|
1412 |
msgstr ""
|
1413 |
|
1414 |
+
#: template/migrate.php:72
|
1415 |
msgid "Export File"
|
1416 |
msgstr ""
|
1417 |
|
1418 |
+
#: template/migrate.php:78
|
1419 |
msgid "Save as file to your computer"
|
1420 |
msgstr ""
|
1421 |
|
1422 |
+
#: template/migrate.php:85
|
1423 |
msgid "Compress file with gzip"
|
1424 |
msgstr ""
|
1425 |
|
1426 |
+
#: template/migrate.php:95
|
1427 |
msgid "Connection Info - Site URL & Secret Key"
|
1428 |
msgstr ""
|
1429 |
|
1439 |
msgstr ""
|
1440 |
|
1441 |
#: template/migrate.php:116
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1442 |
msgid "Cannot Access Uploads Directory"
|
1443 |
msgstr ""
|
1444 |
|
1445 |
+
#: template/migrate.php:118
|
1446 |
msgid ""
|
1447 |
"We require write permissions to the standard WordPress uploads directory. "
|
1448 |
"Without this permission exports are unavailable. Please grant 755 "
|
1449 |
"permissions on the following directory:"
|
1450 |
msgstr ""
|
1451 |
|
1452 |
+
#: template/migrate.php:129
|
1453 |
msgctxt "Source text to be replaced"
|
1454 |
msgid "Find"
|
1455 |
msgstr ""
|
1456 |
|
1457 |
+
#: template/migrate.php:130
|
1458 |
msgctxt "Text to replace in source"
|
1459 |
msgid "Replace"
|
1460 |
msgstr ""
|
1461 |
|
1462 |
+
#: template/migrate.php:217
|
1463 |
+
#, php-format
|
1464 |
msgid ""
|
1465 |
+
"<strong>New URL Missing</strong> — Please enter the protocol-relative "
|
1466 |
+
"URL of the remote website in the \"New URL\" field or remove the whole row "
|
1467 |
+
"entirely. If you are unsure of what this URL should be, please consult <a "
|
1468 |
+
"href=\"%s\" target=\"_blank\">our documentation</a> on find and replace "
|
1469 |
+
"fields."
|
1470 |
msgstr ""
|
1471 |
|
1472 |
+
#: template/migrate.php:219
|
1473 |
#, php-format
|
1474 |
msgid ""
|
1475 |
"<strong>New URL Missing</strong> — Please enter the protocol-relative "
|
1478 |
"documentation</a> on find and replace fields."
|
1479 |
msgstr ""
|
1480 |
|
1481 |
+
#: template/migrate.php:223
|
1482 |
#, php-format
|
1483 |
msgid ""
|
1484 |
"<strong>New File Path Missing</strong> — Please enter the root file "
|
1485 |
+
"path of the remote website in the \"New file path\" field or remove the "
|
1486 |
+
"whole row entirely. If you are unsure of what the file path should be, "
|
1487 |
+
"please consult <a href=\"%s\" target=\"_blank\">our documentation</a> on "
|
1488 |
+
"find and replace fields."
|
1489 |
msgstr ""
|
1490 |
|
1491 |
+
#: template/migrate.php:232
|
1492 |
msgid "Advanced Options"
|
1493 |
msgstr ""
|
1494 |
|
1495 |
+
#: template/migrate.php:241
|
1496 |
msgid "Replace GUIDs"
|
1497 |
msgstr ""
|
1498 |
|
1499 |
+
#: template/migrate.php:247
|
1500 |
#, php-format
|
1501 |
msgid ""
|
1502 |
"Although the <a href=\"%s\" target=\"_blank\">WordPress Codex emphasizes</a> "
|
1503 |
"that GUIDs should not be changed, this is limited to sites that are already "
|
1504 |
+
"live. If the site has never been live, we recommend replacing the GUIDs. For "
|
1505 |
"example, you may be developing a new site locally at dev.somedomain.com and "
|
1506 |
"want to migrate the site live to somedomain.com."
|
1507 |
msgstr ""
|
1508 |
|
1509 |
+
#: template/migrate.php:253
|
1510 |
msgid "Exclude spam comments"
|
1511 |
msgstr ""
|
1512 |
|
1513 |
+
#: template/migrate.php:259
|
1514 |
msgid ""
|
1515 |
"Do not migrate the 'active_plugins' setting (i.e. which plugins are "
|
1516 |
"activated/deactivated)"
|
1517 |
msgstr ""
|
1518 |
|
1519 |
+
#: template/migrate.php:271
|
1520 |
msgid "Compatible with older versions of MySQL (pre-5.5)"
|
1521 |
msgstr ""
|
1522 |
|
1523 |
+
#: template/migrate.php:287
|
1524 |
msgid "Save Migration Profile"
|
1525 |
msgstr ""
|
1526 |
|
1527 |
+
#: template/migrate.php:287
|
1528 |
msgid "Save the above settings for the next time you do a similiar migration"
|
1529 |
msgstr ""
|
1530 |
|
1531 |
+
#: template/migrate.php:309
|
1532 |
msgid "Create new profile"
|
1533 |
msgstr ""
|
1534 |
|
1535 |
+
#: template/migrate.php:318
|
1536 |
+
#: template/migrate.php:328
|
1537 |
msgid "Warning: Different Table Prefixes"
|
1538 |
msgstr ""
|
1539 |
|
1540 |
+
#: template/migrate.php:320
|
1541 |
msgid ""
|
1542 |
"Whoa! We've detected that the database table prefix differs between "
|
1543 |
+
"installations. Clicking the Migrate button below will create new database "
|
1544 |
"tables in your local database with prefix \"<span class=\"remote-prefix\"></"
|
1545 |
"span>\"."
|
1546 |
msgstr ""
|
1547 |
|
1548 |
+
#: template/migrate.php:322
|
1549 |
#, php-format
|
1550 |
msgid ""
|
1551 |
"However, your local install is configured to use table prefix \"%1$s\" and "
|
1554 |
"variable to \"<span class=\"remote-prefix\"></span>\"."
|
1555 |
msgstr ""
|
1556 |
|
1557 |
+
#: template/migrate.php:324
|
1558 |
msgid ""
|
1559 |
"This will allow your local install the use the migrated tables. Once you do "
|
1560 |
"this, you shouldn't have to do it again."
|
1561 |
msgstr ""
|
1562 |
|
1563 |
+
#: template/migrate.php:330
|
1564 |
#, php-format
|
1565 |
msgid ""
|
1566 |
"Whoa! We've detected that the database table prefix differs between "
|
1567 |
+
"installations. Clicking the Migrate button below will create new database "
|
1568 |
"tables in the remote database with prefix \"%s\"."
|
1569 |
msgstr ""
|
1570 |
|
1571 |
+
#: template/migrate.php:332
|
1572 |
#, php-format
|
1573 |
msgid ""
|
1574 |
"However, your remote install is configured to use table prefix \"<span class="
|
1578 |
"span>\" variable to \"%s\"."
|
1579 |
msgstr ""
|
1580 |
|
1581 |
+
#: template/migrate.php:334
|
1582 |
msgid ""
|
1583 |
"This will allow your remote install the use the migrated tables. Once you do "
|
1584 |
"this, you shouldn't have to do it again."
|
1585 |
msgstr ""
|
1586 |
|
1587 |
+
#: template/options.php:19
|
1588 |
msgid ""
|
1589 |
"<strong>PHP Safe Mode Enabled</strong> — We do not officially support "
|
1590 |
"running this plugin in safe mode because <code>set_time_limit()</code> has "
|
1594 |
"However, if you have trouble, we can't help you until you turn off safe mode."
|
1595 |
msgstr ""
|
1596 |
|
1597 |
+
#: template/options.php:21
|
1598 |
+
#: template/options.php:40
|
1599 |
#, php-format
|
1600 |
msgid "Your current PHP run time limit is set to %s seconds."
|
1601 |
msgstr ""
|
1602 |
|
1603 |
+
#: template/options.php:29
|
1604 |
#, php-format
|
1605 |
msgid ""
|
1606 |
"<strong>Internet Explorer Not Supported</strong> — Less than 2% of our "
|
1609 |
"instead. If this is a problem for you, please let us know."
|
1610 |
msgstr ""
|
1611 |
|
1612 |
+
#: template/options.php:38
|
1613 |
msgid ""
|
1614 |
"<strong>PHP Function Disabled</strong> — The <code>set_time_limit()</"
|
1615 |
"code> function is currently disabled on your server. We use this function to "
|
1619 |
msgstr ""
|
1620 |
|
1621 |
#: template/pro/backup.php:4
|
1622 |
+
msgid "Backup the local database before replacing it"
|
|
|
|
|
1623 |
msgstr ""
|
1624 |
|
1625 |
#: template/pro/backup.php:5
|
1626 |
+
msgid "Backup the remote database before replacing it"
|
1627 |
+
msgstr ""
|
1628 |
+
|
1629 |
+
#: template/pro/backup.php:7
|
1630 |
msgid "An SQL file will be saved to"
|
1631 |
msgstr ""
|
1632 |
|
1633 |
+
#: template/pro/backup.php:15
|
1634 |
msgid "Backup all tables with prefix"
|
1635 |
msgstr ""
|
1636 |
|
1637 |
+
#: template/pro/backup.php:21
|
1638 |
msgid "Backup only tables selected for migration"
|
1639 |
msgstr ""
|
1640 |
|
1641 |
+
#: template/pro/backup.php:27
|
1642 |
msgid "Backup only selected tables below"
|
1643 |
msgstr ""
|
1644 |
|
1645 |
+
#: template/pro/backup.php:51
|
1646 |
+
#, php-format
|
1647 |
+
msgid ""
|
1648 |
+
"The backup option has been disabled as your local uploads directory is "
|
1649 |
+
"currently not writeable. The following directory should have 755 "
|
1650 |
+
"permissions: <span class=\"upload-directory-location\">%s</span></p>"
|
1651 |
+
msgstr ""
|
1652 |
+
|
1653 |
+
#: template/pro/block-external-warning.php:4
|
1654 |
#, php-format
|
1655 |
msgid ""
|
1656 |
+
"We've detected that <code>WP_HTTP_BLOCK_EXTERNAL</code> is enabled which "
|
1657 |
+
"will prevent WP Migrate DB Pro from functioning properly. You should either "
|
1658 |
+
"disable <code>WP_HTTP_BLOCK_EXTERNAL</code> or add any sites that you'd like "
|
1659 |
+
"to migrate to or from with WP Migrate DB Pro to <code>WP_ACCESSIBLE_HOSTS</"
|
1660 |
+
"code> (deliciousbrains.com must be added to <code>WP_ACCESSIBLE_HOSTS</code> "
|
1661 |
+
"for the API to work). More information on this can be found <a href=\"%s\" "
|
1662 |
+
"target=\"_blank\">here</a>."
|
1663 |
+
msgstr ""
|
1664 |
+
|
1665 |
+
#. translators: 1: Remind Me Later, 2: Dismiss
|
1666 |
+
#: template/pro/block-external-warning.php:10
|
1667 |
+
#, php-format
|
1668 |
+
msgctxt "Block External actions"
|
1669 |
+
msgid "%1$s | %2$s"
|
1670 |
msgstr ""
|
1671 |
|
1672 |
#: template/pro/connection-info.php:2
|
1673 |
msgid "Connection Info"
|
1674 |
msgstr ""
|
1675 |
|
1676 |
+
#: template/pro/connection-info.php:5
|
1677 |
msgid "Reset Secret Key"
|
1678 |
msgstr ""
|
1679 |
|
1680 |
+
#: template/pro/delay-between-requests.php:3
|
1681 |
+
msgid "Delay Between Requests"
|
1682 |
+
msgstr ""
|
1683 |
+
|
1684 |
+
#: template/pro/delay-between-requests.php:7
|
1685 |
+
msgid ""
|
1686 |
+
"Some servers have rate limits which WP Migrate DB can hit when performing "
|
1687 |
+
"migrations. If you're experiencing migration failures due to server rate "
|
1688 |
+
"limits, you should set this to one or more seconds to alleviate the problem."
|
1689 |
+
msgstr ""
|
1690 |
+
|
1691 |
#: template/pro/exclude-post-types.php:4
|
1692 |
msgid "Exclude Post Types"
|
1693 |
msgstr ""
|
1696 |
msgid "Email Support"
|
1697 |
msgstr ""
|
1698 |
|
1699 |
+
#: template/pro/licence-info.php:9
|
1700 |
msgid "Once completed, you may visit this tab to view your support details."
|
1701 |
msgstr ""
|
1702 |
|
1708 |
msgid "The license key is currently defined in wp-config.php."
|
1709 |
msgstr ""
|
1710 |
|
1711 |
+
#: template/pro/licence.php:15
|
1712 |
msgid "Activate License"
|
1713 |
msgstr ""
|
1714 |
|
1715 |
+
#: template/pro/outdated-addons-warning.php:16
|
1716 |
#, php-format
|
1717 |
msgid ""
|
1718 |
"The version of the %1$s addon you have installed%2$s is out-of-date and will "
|
1737 |
msgid "Replace remote db with this site's db"
|
1738 |
msgstr ""
|
1739 |
|
1740 |
+
#: template/pro/secret-key-warning.php:2
|
1741 |
+
msgid "Improve Security"
|
1742 |
+
msgstr ""
|
1743 |
+
|
1744 |
+
#: template/pro/secret-key-warning.php:3
|
1745 |
+
#, php-format
|
1746 |
+
msgid ""
|
1747 |
+
"We have implemented a more secure method of secret key generation since your "
|
1748 |
+
"key was generated. We recommend you <a href=\"%s\">visit the Settings tab</"
|
1749 |
+
"a> and reset your secret key."
|
1750 |
+
msgstr ""
|
1751 |
+
|
1752 |
+
#. translators: 1: Remind Me Later, 2: Dismiss
|
1753 |
+
#: template/pro/secret-key-warning.php:7
|
1754 |
+
#, php-format
|
1755 |
+
msgctxt "Improve Security actions"
|
1756 |
+
msgid "%1$s | %2$s"
|
1757 |
+
msgstr ""
|
1758 |
+
|
1759 |
#: template/pro/select-tables.php:4
|
1760 |
msgctxt "Database tables"
|
1761 |
msgid "Tables"
|
1782 |
msgid "Enable SSL verification"
|
1783 |
msgstr ""
|
1784 |
|
1785 |
+
#: template/pro/toggle-remote-requests.php:23
|
1786 |
msgid ""
|
1787 |
"We disable SSL verification by default because a lot of people's "
|
1788 |
"environments are not setup for it to work. For example, with XAMPP, you have "
|
1800 |
msgid "Would you like to use a saved migration profile?"
|
1801 |
msgstr ""
|
1802 |
|
1803 |
+
#: template/profile.php:14
|
1804 |
msgid "Nope, let's start fresh..."
|
1805 |
msgstr ""
|
1806 |
|
1830 |
msgid "Within a few hours WP Migrate DB Pro has paid for itself!"
|
1831 |
msgstr ""
|
1832 |
|
1833 |
+
#: template/wpmdb/progress-upgrade.php:17
|
1834 |
msgid "More About The Pro Version"
|
1835 |
msgstr ""
|
1836 |
|
1847 |
#: template/wpmdb/sidebar.php:11
|
1848 |
#, php-format
|
1849 |
msgid ""
|
1850 |
+
"Submit your name and email and we'll send you a coupon for 20% off your "
|
1851 |
+
"upgrade to the pro version."
|
1852 |
msgstr ""
|
1853 |
|
1854 |
#: template/wpmdb/sidebar.php:15
|
1855 |
+
msgid "Your Email"
|
1856 |
msgstr ""
|
1857 |
|
1858 |
#: template/wpmdb/sidebar.php:19
|
1859 |
+
msgid "First Name"
|
1860 |
msgstr ""
|
1861 |
|
1862 |
#: template/wpmdb/sidebar.php:23
|
1863 |
+
msgid "Last Name"
|
1864 |
msgstr ""
|
1865 |
|
1866 |
+
#: template/wpmdb/sidebar.php:30
|
1867 |
+
msgid "Send me the coupon"
|
|
|
|
|
1868 |
msgstr ""
|
1869 |
|
1870 |
+
#: template/wpmdb/sidebar.php:34
|
1871 |
msgid ""
|
1872 |
+
"We promise we will not use your email for anything else and you can "
|
1873 |
+
"unsubscribe with 1-click anytime."
|
1874 |
msgstr ""
|
1875 |
|
1876 |
#: template/wpmdb/wordpress-org-support.php:2
|
1894 |
#, php-format
|
1895 |
msgid ""
|
1896 |
"If you want a <strong>timely response via email from a developer</strong> "
|
1897 |
+
"who works on this plugin, <a href=\"%s\">upgrade to WP Migrate DB Pro</a> "
|
1898 |
+
"and send us an email."
|
1899 |
msgstr ""
|
1900 |
|
1901 |
#: template/wpmdb/wordpress-org-support.php:10
|
@@ -3,8 +3,8 @@ Contributors: bradt
|
|
3 |
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=5VPMGLLK94XJC
|
4 |
Tags: database, migrate, backup, mysql
|
5 |
Requires at least: 3.0
|
6 |
-
Tested up to: 4.2
|
7 |
-
Stable tag: 0.
|
8 |
License: GPLv2
|
9 |
|
10 |
Exports your database, does a find and replace on URLs and file paths, then allows you to save it to your computer.
|
@@ -60,6 +60,31 @@ It is likely you have a download manager plugin or extension installed in your w
|
|
60 |
|
61 |
== Changelog ==
|
62 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
63 |
= 0.6.1 - 2014-10-29 =
|
64 |
* New: breadcrumb-style UI for saved profiles
|
65 |
* New: Brazilian Portugese translation
|
@@ -165,4 +190,4 @@ It is likely you have a download manager plugin or extension installed in your w
|
|
165 |
Runs export over 4x faster and adds some nice new features often requested. Upgrade recommended.
|
166 |
|
167 |
= 0.2.2 =
|
168 |
-
This version fixes a bug that breaks the WordPress core export feature. It is highly recommended that everyone upgrade.
|
3 |
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=5VPMGLLK94XJC
|
4 |
Tags: database, migrate, backup, mysql
|
5 |
Requires at least: 3.0
|
6 |
+
Tested up to: 4.2.2
|
7 |
+
Stable tag: 0.7
|
8 |
License: GPLv2
|
9 |
|
10 |
Exports your database, does a find and replace on URLs and file paths, then allows you to save it to your computer.
|
60 |
|
61 |
== Changelog ==
|
62 |
|
63 |
+
= 0.7 - 2015-06-12 =
|
64 |
+
|
65 |
+
* New: [WP-CLI export subcommand](https://deliciousbrains.com/wp-migrate-db-pro/doc/cli-export-subcommand/)
|
66 |
+
* New: Quick copy find textbox value to replace textbox by clicking arrow icon in between (hat tip Jonathan Perlman)
|
67 |
+
* New: Added filters to hook into find & replace routine and deal with encoded data ([example](https://github.com/deliciousbrains/wp-migrate-db-pro-tweaks/blob/master/wp-migrate-db-pro-tweaks.php#L316-L413))
|
68 |
+
* Improvement: Greatly reduced data passed through each HTTP request for better security and reliability
|
69 |
+
* Improvement: Massive overhaul of input sanitization for better security
|
70 |
+
* Improvement: Add `_mig_` prefix to wpmdb_alter_statements table
|
71 |
+
* Improvement: Cleanup wpmdb_alter_statements tables from failed migrations
|
72 |
+
* Improvement: Show dimmed remove icons in find & replace rows to indicate they can be removed
|
73 |
+
* Improvement: Dim remove icons next to saved profiles
|
74 |
+
* Improvement: Better error message when empty response received from remote server
|
75 |
+
* Improvement: Added diagnostic info to facilitate debugging and decrease time to resolution for support requests
|
76 |
+
* Improvement: Warning notice when `WP_HTTP_BLOCK_EXTERNAL` constant is set to true
|
77 |
+
* Improvement: Leave it to WordPress core to convert tables to utf8mb4
|
78 |
+
* Improvement: Workaround to fix issues with Siteground's staging environments
|
79 |
+
* Bug fix: Connection URL with space(s) in beginning failing
|
80 |
+
* Bug fix: Cancelling a gzipped Export does not remove file
|
81 |
+
* Bug fix: Unusual table names causing regular expressions to fail
|
82 |
+
* Bug fix: Preserving options not working when default subsite is not 1
|
83 |
+
* Bug fix: NAN% shown at beginning of a migration
|
84 |
+
* Bug fix: Migration progress bar is overflowing the scale, passing 100%
|
85 |
+
* Bug fix: Custom post type links broken after migration with Compatibility Mode enabled
|
86 |
+
* Bug fix: Saving a new profile does not change the URL to that saved profile URL
|
87 |
+
|
88 |
= 0.6.1 - 2014-10-29 =
|
89 |
* New: breadcrumb-style UI for saved profiles
|
90 |
* New: Brazilian Portugese translation
|
190 |
Runs export over 4x faster and adds some nice new features often requested. Upgrade recommended.
|
191 |
|
192 |
= 0.2.2 =
|
193 |
+
This version fixes a bug that breaks the WordPress core export feature. It is highly recommended that everyone upgrade.
|
@@ -12,7 +12,7 @@
|
|
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( $this->settings['blacklist_plugins'] );
|
16 |
foreach ( get_plugins() as $key => $plugin ) {
|
17 |
if ( 0 === strpos( $key, 'wp-migrate-db' ) ) {
|
18 |
continue;
|
@@ -34,4 +34,4 @@
|
|
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>
|
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;
|
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,4 +1,4 @@
|
|
1 |
-
<div class="option-section slider-outer-wrapper">
|
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>
|
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>
|
@@ -15,6 +15,7 @@
|
|
15 |
<div class="progress-bar"></div>
|
16 |
<div class="progress-tables"></div>
|
17 |
</div>
|
|
|
18 |
|
19 |
<div class="migration-controls">
|
20 |
<span class="pause-resume button"><?php _ex( 'Pause', 'Temporarily stop migrating', 'wp-migrate-db' ); ?></span>
|
15 |
<div class="progress-bar"></div>
|
16 |
<div class="progress-tables"></div>
|
17 |
</div>
|
18 |
+
<?php do_action( 'wpmdb_template_progress_after_bar' ); ?>
|
19 |
|
20 |
<div class="migration-controls">
|
21 |
<span class="pause-resume button"><?php _ex( 'Pause', 'Temporarily stop migrating', 'wp-migrate-db' ); ?></span>
|
@@ -122,6 +122,8 @@ $breadcrumbs_params = array(
|
|
122 |
|
123 |
<div class="step-two">
|
124 |
|
|
|
|
|
125 |
<div class="option-section">
|
126 |
<div class="header-wrapper clearfix">
|
127 |
<div class="option-heading find-heading"><?php _ex( 'Find', 'Source text to be replaced', 'wp-migrate-db' ); ?></div>
|
@@ -137,51 +139,51 @@ $breadcrumbs_params = array(
|
|
137 |
<td class="old-replace-col">
|
138 |
<input type="text" size="40" name="replace_old[]" class="code" placeholder="Old value" autocomplete="off" />
|
139 |
</td>
|
140 |
-
<td class="arrow-col">
|
141 |
<span class="right-arrow">→</span>
|
142 |
</td>
|
143 |
<td class="replace-right-col">
|
144 |
<input type="text" size="40" name="replace_new[]" class="code" placeholder="New value" autocomplete="off" />
|
145 |
-
<span
|
146 |
</td>
|
147 |
</tr>
|
148 |
<?php if ( $is_default_profile ) : ?>
|
149 |
-
<tr class="replace-row
|
150 |
<td class="sort-handle-col">
|
151 |
<span class="sort-handle"></span>
|
152 |
</td>
|
153 |
<td class="old-replace-col">
|
154 |
<input type="text" size="40" name="replace_old[]" class="code" id="old-url" placeholder="Old URL" value="<?php echo esc_url( preg_replace( '#^https?:#', '', home_url() ) ); ?>" autocomplete="off"<?php echo ( $this->lock_url_find_replace_row ) ? ' readonly' : ''; ?> />
|
155 |
</td>
|
156 |
-
<td class="arrow-col">
|
157 |
<span class="right-arrow">→</span>
|
158 |
</td>
|
159 |
<td class="replace-right-col">
|
160 |
<input type="text" size="40" name="replace_new[]" class="code" id="new-url" placeholder="New URL" autocomplete="off" />
|
161 |
<?php if ( ! $this->lock_url_find_replace_row ) : ?>
|
162 |
-
<span
|
163 |
<?php endif; ?>
|
164 |
</td>
|
165 |
</tr>
|
166 |
-
<tr class="replace-row
|
167 |
<td class="sort-handle-col">
|
168 |
<span class="sort-handle"></span>
|
169 |
</td>
|
170 |
<td class="old-replace-col">
|
171 |
<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" />
|
172 |
</td>
|
173 |
-
<td class="arrow-col">
|
174 |
<span class="right-arrow">→</span>
|
175 |
</td>
|
176 |
<td class="replace-right-col">
|
177 |
<input type="text" size="40" name="replace_new[]" class="code" id="new-path" placeholder="New file path" autocomplete="off" />
|
178 |
-
<span
|
179 |
</td>
|
180 |
</tr>
|
181 |
<?php else :
|
182 |
$i = 1;
|
183 |
foreach ( $loaded_profile['replace_old'] as $replace_old ) : ?>
|
184 |
-
<tr class="replace-row
|
185 |
<?php
|
186 |
$replace_new = ( ! empty( $loaded_profile['replace_new'][ $i ] ) ) ? $loaded_profile['replace_new'][ $i ] : '';
|
187 |
?>
|
@@ -191,13 +193,13 @@ $breadcrumbs_params = array(
|
|
191 |
<td class="old-replace-col">
|
192 |
<input type="text" size="40" name="replace_old[]" class="code" placeholder="Old value" value="<?php echo esc_attr( $replace_old ); ?>" autocomplete="off"<?php echo ( 1 == $i && $this->lock_url_find_replace_row ) ? ' readonly' : ''; ?> />
|
193 |
</td>
|
194 |
-
<td class="arrow-col">
|
195 |
<span class="right-arrow">→</span>
|
196 |
</td>
|
197 |
<td class="replace-right-col">
|
198 |
<input type="text" size="40" name="replace_new[]" class="code" placeholder="New value" value="<?php echo esc_attr( $replace_new ); ?>" autocomplete="off" />
|
199 |
<?php if ( ! $this->lock_url_find_replace_row || ( $this->lock_url_find_replace_row && $i != 1 ) ) : ?>
|
200 |
-
<span
|
201 |
<?php endif; ?>
|
202 |
</td>
|
203 |
</tr>
|
@@ -242,7 +244,7 @@ $breadcrumbs_params = array(
|
|
242 |
<a href="#" class="general-helper replace-guid-helper js-action-link"></a>
|
243 |
|
244 |
<div class="replace-guids-info helper-message">
|
245 |
-
<?php printf( __( 'Although the <a href="%s" target="_blank">WordPress Codex emphasizes</a> that GUIDs should not be changed, this is limited to sites that are already live. If the site has never been live,
|
246 |
</div>
|
247 |
</li>
|
248 |
<li>
|
122 |
|
123 |
<div class="step-two">
|
124 |
|
125 |
+
<?php do_action( 'wpmdb_before_migration_options' ); ?>
|
126 |
+
|
127 |
<div class="option-section">
|
128 |
<div class="header-wrapper clearfix">
|
129 |
<div class="option-heading find-heading"><?php _ex( 'Find', 'Source text to be replaced', 'wp-migrate-db' ); ?></div>
|
139 |
<td class="old-replace-col">
|
140 |
<input type="text" size="40" name="replace_old[]" class="code" placeholder="Old value" autocomplete="off" />
|
141 |
</td>
|
142 |
+
<td class="arrow-col" title="Copy Find to Replace">
|
143 |
<span class="right-arrow">→</span>
|
144 |
</td>
|
145 |
<td class="replace-right-col">
|
146 |
<input type="text" size="40" name="replace_new[]" class="code" placeholder="New value" autocomplete="off" />
|
147 |
+
<span class="replace-remove-row" data-profile-id="0"></span>
|
148 |
</td>
|
149 |
</tr>
|
150 |
<?php if ( $is_default_profile ) : ?>
|
151 |
+
<tr class="replace-row<?php echo ( $this->lock_url_find_replace_row ) ? ' pin' : ''; ?>">
|
152 |
<td class="sort-handle-col">
|
153 |
<span class="sort-handle"></span>
|
154 |
</td>
|
155 |
<td class="old-replace-col">
|
156 |
<input type="text" size="40" name="replace_old[]" class="code" id="old-url" placeholder="Old URL" value="<?php echo esc_url( preg_replace( '#^https?:#', '', home_url() ) ); ?>" autocomplete="off"<?php echo ( $this->lock_url_find_replace_row ) ? ' readonly' : ''; ?> />
|
157 |
</td>
|
158 |
+
<td class="arrow-col" title="Copy Find to Replace">
|
159 |
<span class="right-arrow">→</span>
|
160 |
</td>
|
161 |
<td class="replace-right-col">
|
162 |
<input type="text" size="40" name="replace_new[]" class="code" id="new-url" placeholder="New URL" autocomplete="off" />
|
163 |
<?php if ( ! $this->lock_url_find_replace_row ) : ?>
|
164 |
+
<span class="replace-remove-row" data-profile-id="0"></span>
|
165 |
<?php endif; ?>
|
166 |
</td>
|
167 |
</tr>
|
168 |
+
<tr class="replace-row">
|
169 |
<td class="sort-handle-col">
|
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">→</span>
|
177 |
</td>
|
178 |
<td class="replace-right-col">
|
179 |
<input type="text" size="40" name="replace_new[]" class="code" id="new-path" placeholder="New file path" autocomplete="off" />
|
180 |
+
<span class="replace-remove-row" data-profile-id="0"></span>
|
181 |
</td>
|
182 |
</tr>
|
183 |
<?php else :
|
184 |
$i = 1;
|
185 |
foreach ( $loaded_profile['replace_old'] as $replace_old ) : ?>
|
186 |
+
<tr class="replace-row<?php echo ( 1 == $i && $this->lock_url_find_replace_row ) ? ' pin' : ''; ?>">
|
187 |
<?php
|
188 |
$replace_new = ( ! empty( $loaded_profile['replace_new'][ $i ] ) ) ? $loaded_profile['replace_new'][ $i ] : '';
|
189 |
?>
|
193 |
<td class="old-replace-col">
|
194 |
<input type="text" size="40" name="replace_old[]" class="code" placeholder="Old value" value="<?php echo esc_attr( $replace_old ); ?>" autocomplete="off"<?php echo ( 1 == $i && $this->lock_url_find_replace_row ) ? ' readonly' : ''; ?> />
|
195 |
</td>
|
196 |
+
<td class="arrow-col" title="Copy Find to Replace">
|
197 |
<span class="right-arrow">→</span>
|
198 |
</td>
|
199 |
<td class="replace-right-col">
|
200 |
<input type="text" size="40" name="replace_new[]" class="code" placeholder="New value" value="<?php echo esc_attr( $replace_new ); ?>" autocomplete="off" />
|
201 |
<?php if ( ! $this->lock_url_find_replace_row || ( $this->lock_url_find_replace_row && $i != 1 ) ) : ?>
|
202 |
+
<span class="replace-remove-row" data-profile-id="0"></span>
|
203 |
<?php endif; ?>
|
204 |
</td>
|
205 |
</tr>
|
244 |
<a href="#" class="general-helper replace-guid-helper js-action-link"></a>
|
245 |
|
246 |
<div class="replace-guids-info helper-message">
|
247 |
+
<?php printf( __( 'Although the <a href="%s" target="_blank">WordPress Codex emphasizes</a> that GUIDs should not be changed, this is limited to sites that are already live. If the site has never been live, we recommend replacing the GUIDs. For example, you may be developing a new site locally at dev.somedomain.com and want to migrate the site live to somedomain.com.', 'wp-migrate-db' ), 'http://codex.wordpress.org/Changing_The_Site_URL#Important_GUID_Note' ); ?>
|
248 |
</div>
|
249 |
</li>
|
250 |
<li>
|
@@ -1,6 +1,6 @@
|
|
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' ) ); ?>
|
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 |
+
<?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 -->
|
@@ -17,5 +17,5 @@
|
|
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' ); ?> →</a>
|
18 |
</div>
|
19 |
|
20 |
-
<iframe width="419" height="265" src="//www.youtube.com/embed/
|
21 |
</div>
|
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' ); ?> →</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>
|
@@ -2,7 +2,7 @@
|
|
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 — Push and pull your database from one WordPress install to another in 1-click.', 'wp-migrate-db' ); ?>" /></a>
|
4 |
|
5 |
-
<form method="post" action="
|
6 |
<h2><?php _e( 'Get 20% Off!', 'wp-migrate-db' ); ?></h2>
|
7 |
|
8 |
<?php $user = wp_get_current_user(); ?>
|
@@ -11,14 +11,21 @@
|
|
11 |
<?php echo wptexturize( __( "Submit your name and email and we'll send you a coupon for 20% off your upgrade to the pro version.", 'wp-migrate-db' ) ); ?>
|
12 |
</p>
|
13 |
|
14 |
-
<div class="field
|
15 |
-
<input type="
|
16 |
</div>
|
17 |
|
18 |
-
<div class="field
|
19 |
-
<input type="
|
20 |
</div>
|
21 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
22 |
<div class="field submit-button">
|
23 |
<input type="submit" class="button" value="<?php _e( 'Send me the coupon', 'wp-migrate-db' ); ?>"/>
|
24 |
</div>
|
@@ -38,7 +45,7 @@
|
|
38 |
</p>
|
39 |
|
40 |
<p class="quote">
|
41 |
-
“
|
42 |
</p>
|
43 |
|
44 |
<p class="author">— Boxy Studio</p>
|
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 — 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>
|
7 |
|
8 |
<?php $user = wp_get_current_user(); ?>
|
11 |
<?php echo wptexturize( __( "Submit your name and email and we'll send you a coupon for 20% off your upgrade to the pro version.", 'wp-migrate-db' ) ); ?>
|
12 |
</p>
|
13 |
|
14 |
+
<div class="field">
|
15 |
+
<input type="email" name="email" value="<?php echo esc_attr( $user->user_email ); ?>" placeholder="<?php _e( 'Your Email', 'wp-migrate-db' ); ?>"/>
|
16 |
</div>
|
17 |
|
18 |
+
<div class="field">
|
19 |
+
<input type="text" name="first_name" value="<?php echo esc_attr( trim( $user->first_name ) ); ?>" placeholder="<?php _e( 'First Name', 'wp-migrate-db' ); ?>"/>
|
20 |
</div>
|
21 |
|
22 |
+
<div class="field">
|
23 |
+
<input type="text" name="last_name" value="<?php echo esc_attr( trim( $user->last_name ) ); ?>" placeholder="<?php _e( 'Last Name', 'wp-migrate-db' ); ?>"/>
|
24 |
+
</div>
|
25 |
+
|
26 |
+
<input type="hidden" name="campaigns[]" value="4" />
|
27 |
+
<input type="hidden" name="source" value="8" />
|
28 |
+
|
29 |
<div class="field submit-button">
|
30 |
<input type="submit" class="button" value="<?php _e( 'Send me the coupon', 'wp-migrate-db' ); ?>"/>
|
31 |
</div>
|
45 |
</p>
|
46 |
|
47 |
<p class="quote">
|
48 |
+
“WOW. WP Migrate DB Pro has made our local/live development a breeze. What a brilliant plugin. Worth every penny.”
|
49 |
</p>
|
50 |
|
51 |
<p class="author">— Boxy Studio</p>
|
@@ -5,8 +5,8 @@
|
|
5 |
|
6 |
<p><?php printf( __( 'You may ask the WordPress community for help by posting to the <a href="%s">WordPress.org support forum</a>. Response time can range from a few days to a few weeks and will likely be from a non-developer.', 'wp-migrate-db' ), 'http://wordpress.org/support/plugin/wp-migrate-db' ); ?></p>
|
7 |
|
8 |
-
<p
|
9 |
|
10 |
<p><?php printf( __( 'If you\'ve found a bug, please <a href="%s">submit an issue at Github</a>.', 'wp-migrate-db' ), 'https://github.com/bradt/wp-migrate-db/issues' ); ?></p>
|
11 |
|
12 |
-
</div>
|
5 |
|
6 |
<p><?php printf( __( 'You may ask the WordPress community for help by posting to the <a href="%s">WordPress.org support forum</a>. Response time can range from a few days to a few weeks and will likely be from a non-developer.', 'wp-migrate-db' ), 'http://wordpress.org/support/plugin/wp-migrate-db' ); ?></p>
|
7 |
|
8 |
+
<p class="upgrade-to-pro"><?php printf( __( 'If you want a <strong>timely response via email from a developer</strong> who works on this plugin, <a href="%s">upgrade to WP Migrate DB Pro</a> and send us an email.', 'wp-migrate-db' ), 'https://deliciousbrains.com/wp-migrate-db-pro/?utm_source=insideplugin&utm_medium=web&utm_content=help-tab&utm_campaign=freeplugin' ); ?></p>
|
9 |
|
10 |
<p><?php printf( __( 'If you\'ve found a bug, please <a href="%s">submit an issue at Github</a>.', 'wp-migrate-db' ), 'https://github.com/bradt/wp-migrate-db/issues' ); ?></p>
|
11 |
|
12 |
+
</div>
|
@@ -4,7 +4,7 @@ Plugin Name: WP Migrate DB
|
|
4 |
Plugin URI: http://wordpress.org/plugins/wp-migrate-db/
|
5 |
Description: Exports your database as a MySQL data dump (much like phpMyAdmin), does a find and replace on URLs and file paths, then allows you to save it to your computer.
|
6 |
Author: Delicious Brains
|
7 |
-
Version: 0.
|
8 |
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.
|
26 |
|
27 |
if ( ! class_exists( 'WPMDB_Utils' ) ) {
|
28 |
require dirname( __FILE__ ) . '/class/wpmdb-utils.php';
|
@@ -55,8 +55,41 @@ function wp_migrate_db() {
|
|
55 |
require_once $abspath . '/class/wpmdb-base.php';
|
56 |
require_once $abspath . '/class/wpmdb.php';
|
57 |
require_once $abspath . '/class/wpmdb-replace.php';
|
|
|
|
|
58 |
|
59 |
$wpmdb = new WPMDB( __FILE__ );
|
60 |
|
61 |
return $wpmdb;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
62 |
}
|
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
|
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.7';
|
26 |
|
27 |
if ( ! class_exists( 'WPMDB_Utils' ) ) {
|
28 |
require dirname( __FILE__ ) . '/class/wpmdb-utils.php';
|
55 |
require_once $abspath . '/class/wpmdb-base.php';
|
56 |
require_once $abspath . '/class/wpmdb.php';
|
57 |
require_once $abspath . '/class/wpmdb-replace.php';
|
58 |
+
require_once $abspath . '/class/wpmdb-migration-state.php';
|
59 |
+
require_once $abspath . '/class/wpmdb-sanitize.php';
|
60 |
|
61 |
$wpmdb = new WPMDB( __FILE__ );
|
62 |
|
63 |
return $wpmdb;
|
64 |
+
}
|
65 |
+
|
66 |
+
function wpmdb_cli_loaded() {
|
67 |
+
// register with wp-cli if it's running, and command hasn't already been defined elsewhere
|
68 |
+
if ( defined( 'WP_CLI' ) && WP_CLI && ! class_exists( 'WPMDB_Command' ) ) {
|
69 |
+
require_once dirname( __FILE__ ) . '/class/wpmdb-command.php';
|
70 |
+
}
|
71 |
+
}
|
72 |
+
add_action( 'plugins_loaded', 'wpmdb_cli_loaded', 20 );
|
73 |
+
|
74 |
+
function wpmdb_cli() {
|
75 |
+
global $wpmdb_cli;
|
76 |
+
|
77 |
+
if ( ! is_null( $wpmdb_cli ) ) {
|
78 |
+
return $wpmdb_cli;
|
79 |
+
}
|
80 |
+
|
81 |
+
if ( function_exists( 'wp_migrate_db' ) ) {
|
82 |
+
wp_migrate_db();
|
83 |
+
} else {
|
84 |
+
return false;
|
85 |
+
}
|
86 |
+
|
87 |
+
do_action( 'wp_migrate_db_cli_before_load' );
|
88 |
+
|
89 |
+
require_once dirname( __FILE__ ) . '/class/wpmdb-cli.php';
|
90 |
+
$wpmdb_cli = new WPMDB_CLI( __FILE__ );
|
91 |
+
|
92 |
+
do_action( 'wp_migrate_db_cli_after_load' );
|
93 |
+
|
94 |
+
return $wpmdb_cli;
|
95 |
}
|