WP Migrate DB - Version 0.6.1

Version Description

  • 2014-10-29 =
  • New: breadcrumb-style UI for saved profiles
  • New: Brazilian Portugese translation
  • Security: Added .htaccess to backup folder to help prevent direct downloads
  • Security: False values not included in signature
  • Improvement: Compatibility with TGM Plugin Activation
  • Improvement: Fixed hundreds of PHP Code Sniffer warnings
  • Improvement: Switch to update_site_option() and get_site_option()
  • Improvement: Cleaner and more instructive error message on JSON decoding failure
  • Improvement: New hooks to massage data before and after find & replace
  • Improvement: Common server security rules better accommodated
  • Improvement: Better compatibility with SSL on WP Engine
  • Improvement: Minify all the Javascripts
  • Improvement: Use PHP's DIRECTORY_SEPARATOR instead of our own constant
  • Improvement: Updated tons of translation strings to be translator-friendly
  • Improvement: Find & replace field error messages could suggest removing the fields
  • Improvement: Download button for Diagnostic Info & Error Log
  • Bug fix: 404 errors after successful migrations due to caching
  • Bug fix: Multisite exports broken on PHP < 5.4.7
  • Bug fix: Using relative paths for file includes
  • Bug fix: Typing new profile name does not select "Create new profile" option
  • Bug fix: Find & replace field errors stick around even after removing fields
  • Bug fix: wpmdb_error_log option is auto loading
  • Bug fix: Inconsistent stripping of slashes
  • Bug fix: Spinner is inconsistent with WP 3.8+ spinner
  • Bug fix: Apostrophe in path not being handled
  • Bug fix: Inappropriate use of htmlentities()
  • Bug fix: The table tooltip still shows during the media files migration
  • Bug fix: Import/Export issues between MySQL 5.1 and 5.5+
  • Bug fix: Notice error on Updates dashboard page
  • Bug fix: Signature verification error when local and remote plugins are different versions
  • Bug fix: Find & replace handle icon is rendering poorly
  • Bug fix: PHP Notice: Undefined variable: safe_mode
  • Bug fix: Fatal error: Cannot use object of type WP_Error as array in verify_download()
Download this release

Release Info

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

Code changes from version 0.6 to 0.6.1

asset/css/styles.css CHANGED
@@ -1,1622 +1 @@
1
- #wpmdb-main {
2
- width: 742px;
3
- position: relative;
4
- min-height: 950px;
5
- }
6
-
7
- #overlay {
8
- background-color: rgba(255, 255, 255, 0.9);
9
- }
10
-
11
- .wpmdb {
12
- /* =============================================================================
13
- Common & Global
14
- ========================================================================== */
15
- /* =============================================================================
16
- Migrate Tab
17
- ========================================================================== */
18
- /* Misc */
19
- /* Tabs */
20
- /* Saved migration profile selection */
21
- /* Output Selection */
22
- /* Find and Replace */
23
- /* Select Tables */
24
- /* Advanced Options */
25
- /* Save migration profile */
26
- /* Action buttons */
27
- /* =============================================================================
28
- Settings Tab
29
- ========================================================================== */
30
- /* =============================================================================
31
- Help Tab
32
- ========================================================================== */
33
- /* =============================================================================
34
- Addons Tab
35
- ========================================================================== */
36
- }
37
- .wpmdb .updated {
38
- clear: both;
39
- }
40
- .wpmdb div.updated.warning {
41
- max-width: 742px;
42
- -moz-box-sizing: border-box;
43
- -webkit-box-sizing: border-box;
44
- box-sizing: border-box;
45
- margin: 10px 0;
46
- }
47
- .wpmdb div.updated.warning p {
48
- font-size: 13px;
49
- margin: 0.5em 0;
50
- }
51
- .wpmdb a {
52
- text-decoration: none;
53
- }
54
- .wpmdb li {
55
- margin-bottom: 5px;
56
- position: relative;
57
- }
58
- .wpmdb ul {
59
- margin: 0;
60
- }
61
- .wpmdb input[type=checkbox],
62
- .wpmdb input[type=radio] {
63
- margin-right: 5px;
64
- vertical-align: baseline;
65
- margin-top: 0;
66
- }
67
- .wpmdb input[type=text],
68
- .wpmdb input[type=password] {
69
- padding: 5px;
70
- }
71
- .wpmdb input[disabled=disabled] {
72
- cursor: default;
73
- }
74
- .wpmdb label.disabled {
75
- color: #888;
76
- cursor: default;
77
- }
78
- .wpmdb .option-section {
79
- border-bottom: 1px solid #ccc;
80
- padding-bottom: 20px;
81
- margin-bottom: 20px;
82
- }
83
- .wpmdb .option-section h3 {
84
- font-size: 18px;
85
- font-weight: normal;
86
- }
87
- .wpmdb p.migrate-db {
88
- overflow: hidden;
89
- }
90
- .wpmdb p.migrate-db input {
91
- float: left;
92
- }
93
- .wpmdb p.migrate-db img {
94
- float: left;
95
- margin: 3px 0 0 5px;
96
- }
97
- .wpmdb p.migrate-db .save-settings-button {
98
- margin-left: 10px;
99
- display: none;
100
- }
101
- .wpmdb .indent-wrap {
102
- margin-left: 24px;
103
- }
104
- .wpmdb .expandable-content {
105
- display: none;
106
- margin-top: 10px;
107
- }
108
- .wpmdb .expandable-content li:last-child {
109
- margin-bottom: 0px;
110
- }
111
- .wpmdb .header-wrapper {
112
- margin-bottom: 10px;
113
- }
114
- .wpmdb .header-expand-collapse {
115
- cursor: pointer;
116
- display: inline-block;
117
- }
118
- .wpmdb .option-description {
119
- font-size: 12px;
120
- color: #999;
121
- margin-left: 8px;
122
- font-weight: normal;
123
- }
124
- .wpmdb .option-group li:last-child {
125
- margin-bottom: 0;
126
- }
127
- .wpmdb .connection-status {
128
- display: none;
129
- overflow: auto;
130
- }
131
- .wpmdb .connection-status.error {
132
- color: #9D1818;
133
- }
134
- .wpmdb .ajax-spinner {
135
- left: 6px;
136
- position: relative;
137
- top: 3px;
138
- }
139
- .wpmdb div.message {
140
- margin: 15px 0 0;
141
- }
142
- .wpmdb .licence-wrap h3 {
143
- margin: 0 0 10px 0;
144
- }
145
- .wpmdb .licence-input {
146
- clear: both;
147
- display: block;
148
- font-family: Consolas, Monaco, monospace;
149
- font-size: 14px;
150
- margin-bottom: 7px;
151
- padding: 10px;
152
- width: 418px;
153
- }
154
- .wpmdb .register-licence {
155
- float: left;
156
- outline: none;
157
- }
158
- .wpmdb .licence-status {
159
- color: #A21B1B;
160
- font-weight: bold;
161
- clear: both;
162
- padding-top: 0.5em;
163
- margin: 0;
164
- }
165
- .wpmdb .licence-status.success {
166
- color: #333;
167
- }
168
- .wpmdb .register-licence-ajax-spinner {
169
- margin: 4px 0 0 8px;
170
- }
171
- .wpmdb .return-to-profile-selection {
172
- margin-bottom: 15px;
173
- display: inline-block;
174
- }
175
- .wpmdb .return-to-profile-selection.bottom {
176
- margin-top: 10px;
177
- }
178
- .wpmdb h2.nav-tab-wrapper {
179
- margin-top: 10px;
180
- margin-bottom: 20px;
181
- padding-left: 5px;
182
- }
183
- .wpmdb h2.nav-tab-wrapper a.nav-tab-active {
184
- color: #464646;
185
- cursor: default;
186
- }
187
- .wpmdb label {
188
- display: inline-block;
189
- clear: both;
190
- }
191
- .wpmdb .migration-profile-options li {
192
- position: relative;
193
- width: 520px;
194
- }
195
- .wpmdb .migration-profile-options li a {
196
- padding: 5px 10px;
197
- width: 500px;
198
- border: 1px solid #ddd;
199
- margin: 0px 0px 7px;
200
- display: block;
201
- font-size: 14px;
202
- color: #333;
203
- }
204
- .wpmdb .migration-profile-options li a:hover {
205
- border-color: #bbb;
206
- }
207
- .wpmdb .main-list-delete-profile-link {
208
- color: #999999;
209
- font-family: "Times New Roman", serif;
210
- font-size: 26px;
211
- font-weight: 200;
212
- position: absolute;
213
- right: 7px;
214
- top: 6px;
215
- cursor: pointer;
216
- }
217
- .wpmdb .main-list-delete-profile-link:hover {
218
- color: #444;
219
- }
220
- .wpmdb .option-group li {
221
- margin-bottom: 5px;
222
- }
223
- .wpmdb .option-group > li {
224
- margin-bottom: 8px;
225
- }
226
- .wpmdb .option-group li > label {
227
- font-size: 14px;
228
- font-weight: bold;
229
- }
230
- .wpmdb .option-group ul {
231
- display: none;
232
- margin: 10px 0px 10px 25px;
233
- }
234
- .wpmdb .option-group ul label {
235
- font-size: 12px;
236
- font-weight: normal;
237
- }
238
- .wpmdb .option-heading, .wpmdb .checkbox-label {
239
- font-size: 14px;
240
- font-weight: bold;
241
- }
242
- .wpmdb .checkbox-label input[type=checkbox] {
243
- margin-right: 7px;
244
- position: relative;
245
- top: -1px;
246
- }
247
- .wpmdb .expand-collapse-arrow {
248
- margin-right: 9px;
249
- }
250
- .wpmdb .migrate-connection-info {
251
- min-width: 675px;
252
- margin: 0;
253
- }
254
- .wpmdb .migrate-tab .pull-push-connection-info {
255
- width: 418px;
256
- height: 65px;
257
- color: #333;
258
- font-family: Consolas, Monaco, monospace;
259
- font-size: 15px;
260
- line-height: 21px;
261
- padding: 10px;
262
- }
263
- .wpmdb .basic-access-auth-wrapper {
264
- display: none;
265
- margin-bottom: 5px;
266
- }
267
- .wpmdb .auth-username, .wpmdb .auth-password {
268
- width: 206px;
269
- margin-top: 3px;
270
- }
271
- .wpmdb .auth-password {
272
- width: 207px;
273
- }
274
- .wpmdb .connection-info-wrapper {
275
- display: none;
276
- width: 670px;
277
- }
278
- .wpmdb .connect-button {
279
- margin-top: 2px;
280
- }
281
- .wpmdb .temp-disabled {
282
- background-color: #EEEEEE;
283
- color: #888888;
284
- font-family: Consolas, Monaco, monospace;
285
- text-shadow: 0 1px 0 #FFFFFF;
286
- }
287
- .wpmdb .push-list ul {
288
- margin-bottom: 0px;
289
- }
290
- .wpmdb .find-heading, .wpmdb .replace-heading {
291
- float: left;
292
- }
293
- .wpmdb .find-heading {
294
- width: 400px;
295
- }
296
- .wpmdb .replace-fields {
297
- border-collapse: collapse;
298
- border-spacing: 0px;
299
- }
300
- .wpmdb .replace-fields input {
301
- width: 295px;
302
- }
303
- .wpmdb .replace-fields tr td {
304
- padding-bottom: 7px;
305
- }
306
- .wpmdb .replace-fields tr:last-child td {
307
- padding-bottom: 0px;
308
- }
309
- .wpmdb .arrow-col {
310
- width: 93px;
311
- text-align: center;
312
- vertical-align: middle;
313
- }
314
- .wpmdb .right-arrow {
315
- font-size: 36px;
316
- color: #aaa;
317
- font-family: arial, sans-serif;
318
- }
319
- .wpmdb .replace-right-col span {
320
- border-radius: 50%;
321
- border: 1px solid #ccc;
322
- background-color: #eee;
323
- width: 16px;
324
- height: 16px;
325
- display: inline-block;
326
- position: relative;
327
- top: 4px;
328
- cursor: pointer;
329
- }
330
- .wpmdb .replace-right-col span:hover {
331
- border-color: #aaa;
332
- }
333
- .wpmdb .pin .sort-handle-col {
334
- opacity: 0.5;
335
- cursor: default;
336
- }
337
- .wpmdb .pin .sort-handle {
338
- cursor: default !important;
339
- }
340
- .wpmdb .sort-handle-col {
341
- width: 20px;
342
- cursor: -webkit-grab;
343
- cursor: -moz-grab;
344
- }
345
- .wpmdb .sort-handle:before {
346
- content: "\f214";
347
- display: inline-block;
348
- -webkit-font-smoothing: antialiased;
349
- font: normal 16px/1 'dashicons';
350
- vertical-align: top;
351
- color: #aaa;
352
- background-color: transparent !important;
353
- }
354
- .wpmdb .original-repeatable-field {
355
- display: none;
356
- }
357
- .wpmdb .no-replaces-message {
358
- display: none;
359
- margin-bottom: 0px;
360
- }
361
- .wpmdb .inline-message.missing-replace {
362
- margin-top: 15px;
363
- display: none;
364
- }
365
- .wpmdb #new-path-missing-warning {
366
- margin-top: 5px;
367
- }
368
- .wpmdb .tables-header {
369
- display: inline-block;
370
- }
371
- .wpmdb .expand-collapse-arrow {
372
- display: inline-block;
373
- position: relative;
374
- top: -2px;
375
- font-size: 11px;
376
- }
377
- .wpmdb .collapsed {
378
- -moz-transform: scale(1) rotate(-90deg) translateX(0px) translateY(0px) skewX(0deg) skewY(0deg);
379
- -webkit-transform: scale(1) rotate(-90deg) translateX(0px) translateY(0px) skewX(0deg) skewY(0deg);
380
- -o-transform: scale(1) rotate(-90deg) translateX(0px) translateY(0px) skewX(0deg) skewY(0deg);
381
- -ms-transform: scale(1) rotate(-90deg) translateX(0px) translateY(0px) skewX(0deg) skewY(0deg);
382
- transform: scale(1) rotate(-90deg) translateX(0px) translateY(0px) skewX(0deg) skewY(0deg);
383
- }
384
- .wpmdb .select-deselect-divider {
385
- margin: 0 6px;
386
- }
387
- .wpmdb .select-wrap {
388
- display: none;
389
- margin-top: 12px;
390
- }
391
- .wpmdb .select-post-types-wrap {
392
- display: block;
393
- }
394
- .wpmdb .multiselect {
395
- min-width: 420px;
396
- min-height: 180px;
397
- margin-bottom: 10px;
398
- }
399
- .wpmdb .table-migrate-options li label {
400
- font-size: 12px;
401
- font-weight: normal;
402
- }
403
- .wpmdb .table-migrate-options li {
404
- margin-bottom: 5px;
405
- }
406
- .wpmdb .general-helper {
407
- border-radius: 50%;
408
- border: 1px solid #ccc;
409
- background-color: #eee;
410
- width: 15px;
411
- height: 15px;
412
- display: inline-block;
413
- position: relative;
414
- top: 4px;
415
- margin-top: -4px;
416
- cursor: pointer;
417
- margin-left: 2px;
418
- }
419
- .wpmdb .general-helper:hover {
420
- border-color: #aaa;
421
- }
422
- .wpmdb .general-helper:after {
423
- content: "?";
424
- color: #999999;
425
- font-size: 10px;
426
- font-weight: bold;
427
- left: 4px;
428
- position: absolute;
429
- top: -1px;
430
- }
431
- .wpmdb .helper-message {
432
- padding: 10px;
433
- border: 1px solid #ccc;
434
- border-radius: 3px;
435
- background-color: #fff;
436
- position: absolute;
437
- width: 500px;
438
- z-index: 9999;
439
- display: none;
440
- box-shadow: 0px 0px 5px rgba(0, 0, 0, 0.2);
441
- }
442
- .wpmdb .inline-message {
443
- padding: 10px;
444
- border-radius: 3px;
445
- margin-top: 5px;
446
- }
447
- .wpmdb .inline-message.error {
448
- border: 1px solid #CC0000;
449
- background-color: #FFEBE8;
450
- }
451
- .wpmdb .inline-message.warning {
452
- background-color: #FFFFE0;
453
- border: 1px solid #E6DB55;
454
- }
455
- .wpmdb .helper-message:before {
456
- content: '';
457
- border-bottom: 8px solid transparent;
458
- border-right: 8px solid #aaa;
459
- border-top: 8px solid transparent;
460
- display: block;
461
- height: 0;
462
- left: -8px;
463
- position: absolute;
464
- top: 11px;
465
- width: 0;
466
- }
467
- .wpmdb .helper-message:after {
468
- content: '';
469
- border-bottom: 8px solid transparent;
470
- border-right: 8px solid #fff;
471
- border-top: 8px solid transparent;
472
- display: block;
473
- height: 0;
474
- left: -7px;
475
- position: absolute;
476
- top: 11px;
477
- width: 0;
478
- }
479
- .wpmdb .helper-message.bottom:before {
480
- content: '';
481
- border-left: 8px solid transparent;
482
- border-right: 8px solid transparent;
483
- border-bottom: 8px solid #aaa;
484
- border-top: 0;
485
- display: block;
486
- height: 0;
487
- left: 50%;
488
- margin-left: -8px;
489
- position: absolute;
490
- top: -9px;
491
- width: 0;
492
- }
493
- .wpmdb .helper-message.bottom:after {
494
- content: '';
495
- border-left: 8px solid transparent;
496
- border-right: 8px solid transparent;
497
- border-bottom: 8px solid #fff;
498
- border-top: 0;
499
- display: block;
500
- height: 0;
501
- left: 50%;
502
- margin-left: -8px;
503
- position: absolute;
504
- top: -8px;
505
- width: 0;
506
- }
507
- .wpmdb .label-disabled {
508
- color: #888;
509
- }
510
- .wpmdb .prefix-notice, .wpmdb .ssl-notice, .wpmdb .different-plugin-version-notice, .wpmdb .directory-permission-notice {
511
- background-color: #FFFFE0;
512
- border: 1px solid #E6DB55;
513
- padding: 15px;
514
- border-radius: 3px;
515
- margin-bottom: 15px;
516
- display: none;
517
- }
518
- .wpmdb .prefix-notice p, .wpmdb .ssl-notice p, .wpmdb .different-plugin-version-notice p, .wpmdb .directory-permission-notice p {
519
- margin-top: 0px;
520
- }
521
- .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 {
522
- margin: 0px;
523
- }
524
- .wpmdb .different-plugin-version-notice, .wpmdb .directory-permission-notice {
525
- background-color: #FFEBE8;
526
- border-color: #CC0000;
527
- }
528
- .wpmdb .different-plugin-version-notice a, .wpmdb .directory-permission-notice a {
529
- color: #CC0000;
530
- text-decoration: underline;
531
- }
532
- .wpmdb .save-migration-profile-wrap li label {
533
- font-size: 12px;
534
- font-weight: normal;
535
- }
536
- .wpmdb .save-migration-profile-wrap li {
537
- margin-bottom: 5px;
538
- padding-left: 25px;
539
- }
540
- .wpmdb .save-migration-profile-wrap .indent-wrap {
541
- margin-left: 0px;
542
- }
543
- .wpmdb .create-new-label {
544
- margin-right: 8px;
545
- }
546
- .wpmdb .create-new-profile {
547
- position: absolute;
548
- top: -5px;
549
- }
550
- .wpmdb .replace-remove-row,
551
- .wpmdb .delete-profile {
552
- background-color: #eee;
553
- border: 1px solid #ccc;
554
- border-radius: 50% 50% 50% 50%;
555
- cursor: pointer;
556
- height: 11px;
557
- left: 5px;
558
- margin-left: 2px;
559
- position: absolute;
560
- margin-top: -6px;
561
- top: 50%;
562
- width: 11px;
563
- display: none;
564
- background-position: 50% 50%;
565
- background-size: 6px 6px;
566
- background-repeat: no-repeat;
567
- }
568
- .wpmdb .replace-remove-row:after,
569
- .wpmdb .delete-profile:after {
570
- content: "\00d7";
571
- left: 2px;
572
- position: absolute;
573
- top: -3px;
574
- color: #aaa;
575
- font-size: 12px;
576
- }
577
- .wpmdb .replace-remove-row:after {
578
- position: relative;
579
- }
580
- .wpmdb .replace-remove-row:hover,
581
- .wpmdb .delete-profile:hover {
582
- border-color: #aaa;
583
- }
584
- .wpmdb .migrate-db .ajax-success-msg {
585
- font-weight: bold;
586
- margin: 3px 0 0 9px;
587
- display: inline-block;
588
- }
589
- .wpmdb p img.save-profile-ajax-spinner {
590
- margin-left: 10px;
591
- }
592
- .wpmdb .backup-description {
593
- left: 20px;
594
- position: relative;
595
- }
596
- .wpmdb .backup-option-disabled {
597
- margin-bottom: 0px !important;
598
- }
599
- .wpmdb .settings-tab {
600
- display: none;
601
- }
602
- .wpmdb .settings-tab .slider {
603
- max-width: 416px;
604
- }
605
- .wpmdb .settings-tab .slider-label {
606
- display: block;
607
- margin-bottom: 10px;
608
- float: left;
609
- width: 50%;
610
- }
611
- .wpmdb .settings-tab .slider-label-wrapper {
612
- max-width: 416px;
613
- width: 100%;
614
- position: relative;
615
- }
616
- .wpmdb .settings-tab .amount {
617
- width: 50%;
618
- text-align: right;
619
- display: block;
620
- text-align: right;
621
- float: left;
622
- }
623
- .wpmdb .settings-tab .slider-spinner {
624
- position: absolute;
625
- right: -35px;
626
- bottom: -13px;
627
- }
628
- .wpmdb .settings-tab .slider-success-msg {
629
- display: none;
630
- right: -53px;
631
- bottom: -13px;
632
- position: absolute;
633
- font-weight: bold;
634
- }
635
- .wpmdb .settings-tab .ui-slider {
636
- border: 1px solid #dfdfdf;
637
- height: 10px;
638
- border-radius: 2px;
639
- position: relative;
640
- }
641
- .wpmdb .settings-tab .ui-slider-handle {
642
- width: 7px;
643
- height: 20px;
644
- background-color: #aaa;
645
- display: block;
646
- position: absolute;
647
- top: -5px;
648
- outline: none;
649
- }
650
- .wpmdb .settings-tab .ui-slider-handle:active {
651
- background-color: #999;
652
- }
653
- .wpmdb .settings-tab .ui-slider-range {
654
- background-color: #eee;
655
- height: 100%;
656
- }
657
- .wpmdb .settings-tab .option-section li label {
658
- font-size: 12px;
659
- font-weight: normal;
660
- position: relative;
661
- }
662
- .wpmdb .settings-tab .option-section li {
663
- margin-bottom: 5px;
664
- }
665
- .wpmdb .settings-tab .option-section li:last-child {
666
- margin-bottom: 0px;
667
- }
668
- .wpmdb .settings-tab .option-section .ajax-spinner {
669
- right: -23px;
670
- left: inherit;
671
- top: 0px;
672
- position: absolute;
673
- }
674
- .wpmdb .settings-tab .option-section .ajax-success-msg {
675
- right: -42px;
676
- left: inherit;
677
- top: 0px;
678
- position: absolute;
679
- font-weight: bold;
680
- }
681
- .wpmdb .settings-tab .option-section .bubble .ajax-spinner {
682
- right: -45px;
683
- }
684
- .wpmdb .settings-tab .option-section .bubble .ajax-success-msg {
685
- right: -65px;
686
- }
687
- .wpmdb .allow-remote-reqeusts {
688
- font-size: 14px;
689
- font-weight: bold;
690
- }
691
- .wpmdb .connection-info-label {
692
- margin-top: 15px;
693
- margin-bottom: 5px;
694
- display: block;
695
- }
696
- .wpmdb .connection-info {
697
- clear: both;
698
- font-size: 15px;
699
- line-height: 21px;
700
- font-family: Consolas, Monaco, monospace;
701
- padding: 10px 10px;
702
- height: 67px;
703
- text-shadow: 0px 1px 0px #fff;
704
- display: block;
705
- margin-bottom: 7px;
706
- width: 418px;
707
- }
708
- .wpmdb .reset-button-wrap {
709
- width: 418px;
710
- }
711
- .wpmdb .reset-api-key {
712
- float: left;
713
- }
714
- .wpmdb .reset-api-key-ajax-spinner {
715
- float: left;
716
- margin: 4px 7px;
717
- }
718
- .wpmdb .masked-licence {
719
- margin-top: 0px;
720
- }
721
- .wpmdb .bull {
722
- font-size: 22px;
723
- position: relative;
724
- top: 4px;
725
- }
726
- .wpmdb .plugin-compatibility-wrap {
727
- padding: 18px 18px 18px 24px;
728
- background-color: #e6e6e6;
729
- margin-left: 0;
730
- }
731
- .wpmdb .plugin-compatibility-wrap p:last-of-type {
732
- margin-bottom: 0;
733
- }
734
- .wpmdb ul.plugin-compatibility-options {
735
- display: block;
736
- margin: 10px 0 10px 0px;
737
- }
738
- .wpmdb .plugin-compatibility-spinner {
739
- position: relative;
740
- top: 3px;
741
- left: 10px;
742
- }
743
- .wpmdb .plugin-compatibility-success-msg {
744
- position: relative;
745
- left: 10px;
746
- font-weight: bold;
747
- display: none;
748
- }
749
- .wpmdb .help-tab {
750
- display: none;
751
- }
752
- .wpmdb .help-tab h3 {
753
- font-size: 18px;
754
- font-weight: normal;
755
- }
756
- .wpmdb .help-tab .support {
757
- border-bottom: 1px solid #ccc;
758
- margin-bottom: 25px;
759
- padding-bottom: 18px;
760
- }
761
- .wpmdb .help-tab .support p {
762
- width: 640px;
763
- }
764
- .wpmdb .help-tab .support .email a {
765
- font-size: 12px;
766
- }
767
- .wpmdb .help-tab .support .ajax-spinner {
768
- top: 2px;
769
- }
770
- .wpmdb .help-tab .video-viewer {
771
- margin-bottom: 30px;
772
- }
773
- .wpmdb .help-tab .videos {
774
- width: 640px;
775
- }
776
- .wpmdb .help-tab .videos ul > li {
777
- margin-bottom: 30px;
778
- overflow: hidden;
779
- position: relative;
780
- }
781
- .wpmdb .help-tab .videos ul > li a {
782
- overflow: hidden;
783
- display: block;
784
- width: 320px;
785
- height: 180px;
786
- float: left;
787
- margin-right: 15px;
788
- position: relative;
789
- z-index: 1;
790
- }
791
- .wpmdb .help-tab .videos ul > li a:before, .wpmdb .help-tab .videos ul > li a:after {
792
- position: absolute;
793
- content: " ";
794
- margin: auto;
795
- left: 0;
796
- right: 0;
797
- top: 0;
798
- bottom: 0;
799
- }
800
- .wpmdb .help-tab .videos ul > li a:before {
801
- width: 64px;
802
- height: 64px;
803
- -webkit-border-radius: 64px;
804
- -moz-border-radius: 64px;
805
- -ms-border-radius: 64px;
806
- -o-border-radius: 64px;
807
- border-radius: 64px;
808
- filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=80);
809
- opacity: 0.8;
810
- border: 1px solid #ddd;
811
- background-color: #fff;
812
- z-index: 2;
813
- }
814
- .wpmdb .help-tab .videos ul > li a:after {
815
- filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=80);
816
- opacity: 0.8;
817
- border: 21.33333px solid transparent;
818
- border-top-width: 12.8px;
819
- border-bottom-width: 12.8px;
820
- border-left-color: #333;
821
- background: transparent;
822
- display: block;
823
- left: 25px;
824
- width: 0px;
825
- height: 0px;
826
- z-index: 3;
827
- }
828
- .wpmdb .help-tab .videos .video:last-child {
829
- margin-bottom: 0px;
830
- }
831
- .wpmdb .help-tab .videos img {
832
- width: 320px;
833
- height: 240px;
834
- position: relative;
835
- top: 50%;
836
- margin-top: -120px;
837
- }
838
- .wpmdb .help-tab .debug {
839
- width: 640px;
840
- border-bottom: 1px solid #CCCCCC;
841
- margin-bottom: 25px;
842
- padding-bottom: 28px;
843
- }
844
- .wpmdb .help-tab .debug textarea {
845
- width: 100%;
846
- min-height: 200px;
847
- font-family: Consolas, Monaco, monospace;
848
- margin-bottom: 5px;
849
- }
850
- .wpmdb .help-tab h4 {
851
- margin: 0 0 0.2em 0;
852
- }
853
- .wpmdb .help-tab p {
854
- margin: 0 0 0.5em 0;
855
- }
856
- .wpmdb .help-tab iframe {
857
- display: none;
858
- }
859
- .wpmdb .addons-tab {
860
- display: none;
861
- }
862
- .wpmdb .addons-tab .addon {
863
- position: relative;
864
- width: 100%;
865
- min-height: 138px;
866
- padding: 25px 30px 30px 165px;
867
- -webkit-box-sizing: border-box;
868
- -moz-box-sizing: border-box;
869
- box-sizing: border-box;
870
- color: #fff;
871
- margin-bottom: 15px;
872
- }
873
- .wpmdb .addons-tab .addon .actions {
874
- float: right;
875
- font-size: 14px;
876
- }
877
- .wpmdb .addons-tab .addon .actions > * {
878
- margin-right: 10px;
879
- }
880
- .wpmdb .addons-tab .addon .actions *:last-child {
881
- margin-right: 0;
882
- }
883
- .wpmdb .addons-tab .addon .actions .action {
884
- background-color: #fff;
885
- font-weight: bold;
886
- display: inline-block;
887
- padding: 0.2em 0.4em;
888
- }
889
- .wpmdb .addons-tab .addon .actions .action:hover {
890
- background-color: rgba(255, 255, 255, 0.92);
891
- }
892
- .wpmdb .addons-tab .addon .actions .status {
893
- border-bottom: 2px solid #fff;
894
- padding-bottom: 0.1em;
895
- }
896
- .wpmdb .addons-tab .addon h1 {
897
- font-family: "HelveticaNeue-Light", "Helvetica Neue Light", "Helvetica Neue", sans-serif;
898
- font-weight: normal;
899
- float: left;
900
- margin: 0;
901
- margin-top: 5px;
902
- }
903
- .wpmdb .addons-tab .addon p {
904
- font-size: 16px;
905
- line-height: 1.2em;
906
- clear: both;
907
- padding-top: 15px;
908
- margin: 0;
909
- }
910
- .wpmdb .addons-tab .addon.wp-migrate-db-pro-media-files {
911
- background: #3fab3f url(../img/icon-media-files.svg) no-repeat 30px 30px;
912
- background-size: 110px 85px;
913
- }
914
- .wpmdb .addons-tab .addon.wp-migrate-db-pro-media-files .action {
915
- color: #3fab3f;
916
- }
917
- .wpmdb .addons-tab .addon.wp-migrate-db-pro-cli {
918
- background: #272822 url(../img/icon-cli.svg) no-repeat 30px 30px;
919
- background-size: 110px 97px;
920
- min-height: 157px;
921
- color: #e6db74;
922
- }
923
- .wpmdb .addons-tab .addon.wp-migrate-db-pro-cli .action {
924
- color: #272822;
925
- background-color: #ddd;
926
- }
927
- .wpmdb .addons-tab .addon.wp-migrate-db-pro-cli .action:hover {
928
- color: #272822;
929
- background-color: #eee;
930
- }
931
- .wpmdb .addons-tab .addon.wp-migrate-db-pro-cli p a {
932
- text-decoration: underline;
933
- color: #e6db74;
934
- }
935
- .wpmdb .addons-tab .addon.wp-migrate-db-pro-cli p a:hover {
936
- color: #eee69f;
937
- }
938
- .wpmdb .addons-tab .addon.wp-migrate-db-pro-cli code {
939
- color: #66d9ef;
940
- white-space: nowrap;
941
- margin: 0;
942
- padding: 0;
943
- }
944
- .wpmdb .addons-tab .addon.wp-migrate-db-pro-cli code .var {
945
- color: #f92772;
946
- }
947
- .wpmdb .addons-tab .addon.wp-migrate-db-pro-cli code .bracket {
948
- color: #fff;
949
- }
950
-
951
- /* Progress Information */
952
- /* Contain floats: h5bp.com/q */
953
- .clearfix:before, .clearfix:after {
954
- content: "";
955
- display: table;
956
- }
957
-
958
- .clearfix:after {
959
- clear: both;
960
- }
961
-
962
- .clearfix {
963
- zoom: 1;
964
- }
965
-
966
- .general-spinner {
967
- width: 16px;
968
- height: 16px;
969
- }
970
-
971
- .migration-error {
972
- color: #A21B1B;
973
- display: block;
974
- font-weight: bold;
975
- max-height: 400px;
976
- max-width: 100%;
977
- overflow: scroll;
978
- word-wrap: break-word;
979
- }
980
-
981
- .progress-content {
982
- display: none;
983
- position: relative;
984
- margin: 0 auto;
985
- background-color: #fff;
986
- padding: 50px;
987
- box-shadow: 0 0 10px #ccc;
988
- cursor: default;
989
- width: 80%;
990
- z-index: 99999;
991
- position: fixed;
992
- left: 50%;
993
- margin-left: -40%;
994
- -moz-box-sizing: border-box;
995
- -webkit-box-sizing: border-box;
996
- box-sizing: border-box;
997
- max-height: 100%;
998
- overflow-y: auto;
999
- }
1000
- .progress-content .progress-bar {
1001
- height: 10px;
1002
- background-color: #8cc1e9;
1003
- margin-bottom: 5px;
1004
- background-image: -webkit-gradient(linear, 50% 100%, 50% 0%, color-stop(0%, #72a7cf), color-stop(100%, #8cc1e9));
1005
- background-image: -webkit-linear-gradient(bottom, #72a7cf, #8cc1e9);
1006
- background-image: -moz-linear-gradient(bottom, #72a7cf, #8cc1e9);
1007
- background-image: -o-linear-gradient(bottom, #72a7cf, #8cc1e9);
1008
- background-image: linear-gradient(bottom, #72a7cf, #8cc1e9);
1009
- }
1010
- .progress-content .progress-title {
1011
- font-size: 18px;
1012
- font-family: "HelveticaNeue-Light", "Helvetica Neue Light", "Helvetica Neue", sans-serif;
1013
- font-weight: normal;
1014
- float: left;
1015
- }
1016
- .progress-content .progress-bar {
1017
- width: 0%;
1018
- }
1019
- .progress-content .progress-info-wrapper {
1020
- margin-bottom: 10px;
1021
- }
1022
- .progress-content .progress-text {
1023
- clear: left;
1024
- float: left;
1025
- width: 100%;
1026
- }
1027
- .progress-content .timer {
1028
- float: right;
1029
- }
1030
- .progress-content .progress-tables {
1031
- overflow: hidden;
1032
- margin-bottom: 2px;
1033
- padding: 0 0 20px 0;
1034
- }
1035
- .progress-content .progress-bar-wrapper {
1036
- position: relative;
1037
- }
1038
- .progress-content .progress-bar-wrapper:before {
1039
- content: '';
1040
- display: block;
1041
- height: 5px;
1042
- width: 1px;
1043
- background-color: #ccc;
1044
- position: absolute;
1045
- top: 15px;
1046
- left: 0px;
1047
- }
1048
- .progress-content .progress-tables-hover-boxes {
1049
- position: absolute;
1050
- top: 0px;
1051
- left: 0px;
1052
- display: block;
1053
- width: 100%;
1054
- }
1055
- .progress-content .progress-chunk-hover {
1056
- display: block;
1057
- float: left;
1058
- height: 35px;
1059
- position: relative;
1060
- top: -5px;
1061
- z-index: 1;
1062
- }
1063
- .progress-content .progress-chunk {
1064
- -moz-box-sizing: border-box;
1065
- -webkit-box-sizing: border-box;
1066
- box-sizing: border-box;
1067
- float: left;
1068
- display: block;
1069
- height: 6px;
1070
- border-right: 1px solid #ccc;
1071
- border-bottom: 1px solid #ccc;
1072
- color: #999;
1073
- position: relative;
1074
- text-align: center;
1075
- }
1076
- .progress-content .progress-chunk > span {
1077
- padding: 0px 3px;
1078
- white-space: nowrap;
1079
- text-overflow: ellipsis;
1080
- margin-top: 10px;
1081
- display: inline-block;
1082
- }
1083
- .progress-content .progress-label {
1084
- padding: 5px 10px;
1085
- border: 1px solid #ccc;
1086
- border-radius: 3px;
1087
- background-color: #fff;
1088
- font-family: Consolas, Monaco, monospace;
1089
- font-size: 12px;
1090
- display: inline-block;
1091
- top: -35px;
1092
- position: absolute;
1093
- opacity: 0;
1094
- -webkit-transition: opacity 200ms ease-in-out;
1095
- -moz-transition: opacity 200ms ease-in-out;
1096
- -ms-transition: opacity 200ms ease-in-out;
1097
- -o-transition: opacity 200ms ease-in-out;
1098
- transition: opacity 200ms ease-in-out;
1099
- }
1100
- .progress-content .label-visible {
1101
- opacity: 1;
1102
- }
1103
- .progress-content .progress-label:before {
1104
- content: "";
1105
- width: 0;
1106
- height: 0;
1107
- border-left: 4px solid transparent;
1108
- border-right: 4px solid transparent;
1109
- border-top: 4px solid #ccc;
1110
- display: block;
1111
- position: absolute;
1112
- bottom: -5px;
1113
- left: 50%;
1114
- margin-left: -2px;
1115
- }
1116
- .progress-content .progress-label:after {
1117
- content: "";
1118
- width: 0;
1119
- height: 0;
1120
- border-left: 4px solid transparent;
1121
- border-right: 4px solid transparent;
1122
- border-top: 4px solid #fff;
1123
- display: block;
1124
- position: absolute;
1125
- bottom: -4px;
1126
- left: 50%;
1127
- margin-left: -2px;
1128
- }
1129
- .progress-content .migration-progress-ajax-spinner {
1130
- left: 7px;
1131
- position: relative;
1132
- top: 15px;
1133
- }
1134
- .progress-content .close-progress-content {
1135
- color: #999999;
1136
- cursor: pointer;
1137
- font-family: "Times New Roman",serif;
1138
- font-size: 26px;
1139
- font-weight: 200;
1140
- position: absolute;
1141
- right: 20px;
1142
- top: 20px;
1143
- padding: 5px;
1144
- display: none;
1145
- }
1146
- .progress-content .close-progress-content:hover {
1147
- color: #666;
1148
- border-color: #aaa;
1149
- }
1150
- .progress-content .migration-controls {
1151
- display: block;
1152
- margin-top: 45px;
1153
- overflow: hidden;
1154
- }
1155
- .progress-content .migration-controls span {
1156
- float: left;
1157
- text-align: center;
1158
- display: block;
1159
- }
1160
- .progress-content .migration-controls span:first-child {
1161
- margin-right: 10px;
1162
- width: 71px;
1163
- }
1164
- .progress-content .pro-version {
1165
- margin-top: 45px;
1166
- padding-top: 40px;
1167
- position: relative;
1168
- border-top: 1px solid #ccc;
1169
- }
1170
- .progress-content .pro-version iframe {
1171
- position: absolute;
1172
- top: 40px;
1173
- right: 0;
1174
- display: block;
1175
- }
1176
- .progress-content .pro-version-content {
1177
- padding-right: 460px;
1178
- min-height: 255px;
1179
- }
1180
- .progress-content .pro-version-content h1 {
1181
- line-height: 1em;
1182
- margin-top: 0;
1183
- font-size: 20px;
1184
- }
1185
- .progress-content .pro-version-content ul {
1186
- margin-left: 24px;
1187
- }
1188
- .progress-content .pro-version-content li {
1189
- position: relative;
1190
- font-size: 14px;
1191
- line-height: 1.4em;
1192
- margin-bottom: 15px;
1193
- max-width: 580px;
1194
- }
1195
- .progress-content .pro-version-content li:before {
1196
- content: "\f147";
1197
- display: inline-block;
1198
- -webkit-font-smoothing: antialiased;
1199
- font: normal 30px/1 'dashicons';
1200
- position: absolute;
1201
- top: -3px;
1202
- left: -32px;
1203
- vertical-align: top;
1204
- font-family: 'dashicons';
1205
- }
1206
- .progress-content .pro-version-content .pro-quote {
1207
- margin: 0 0 20px 0;
1208
- max-width: 570px;
1209
- }
1210
- .progress-content .pro-version-content .pro-quote .dashicons-star-filled {
1211
- font-size: 16px;
1212
- width: 16px;
1213
- height: 16px;
1214
- position: relative;
1215
- top: 2px;
1216
- }
1217
- .progress-content .pro-version-content .pro-quote-author {
1218
- font-style: italic;
1219
- white-space: nowrap;
1220
- }
1221
- @media screen and (max-width: 1096px) {
1222
- .progress-content .pro-version iframe {
1223
- position: relative;
1224
- top: auto;
1225
- right: auto;
1226
- }
1227
- .progress-content .pro-version-content {
1228
- min-height: 0;
1229
- padding: 0 0 20px 0;
1230
- }
1231
- }
1232
-
1233
- .wpmdb-not-pro .wpmdb .wpmdb-main {
1234
- margin-top: 15px;
1235
- }
1236
- .wpmdb-not-pro .wpmdb .migrate-selection ul {
1237
- margin: 0px;
1238
- }
1239
- .wpmdb-not-pro .wpmdb .help-tab .support p {
1240
- width: auto;
1241
- }
1242
-
1243
- #wpmdb-sidebar {
1244
- position: absolute;
1245
- top: -21px;
1246
- right: -312px;
1247
- width: 292px;
1248
- }
1249
- #wpmdb-sidebar .block {
1250
- padding: 20px;
1251
- border: 1px solid #ccc;
1252
- }
1253
- #wpmdb-sidebar .subscribe {
1254
- border-top: none;
1255
- }
1256
- #wpmdb-sidebar .subscribe h2 {
1257
- padding: 0;
1258
- margin: 0;
1259
- margin-bottom: 0.5em;
1260
- color: #666;
1261
- font-size: 20px;
1262
- line-height: 1.2em;
1263
- float: none;
1264
- }
1265
- #wpmdb-sidebar .subscribe h3 {
1266
- font-size: 16px;
1267
- margin: 0;
1268
- }
1269
- #wpmdb-sidebar .subscribe p {
1270
- margin: 0;
1271
- }
1272
- #wpmdb-sidebar .subscribe p.interesting {
1273
- margin-bottom: 1em;
1274
- line-height: 1.4;
1275
- }
1276
- #wpmdb-sidebar .subscribe .links {
1277
- margin-bottom: 2em;
1278
- }
1279
- #wpmdb-sidebar .subscribe .links a {
1280
- text-decoration: none;
1281
- }
1282
- #wpmdb-sidebar .subscribe .promise {
1283
- color: #999;
1284
- font-size: 12px;
1285
- line-height: 1.4em;
1286
- }
1287
- #wpmdb-sidebar .subscribe .field {
1288
- margin-bottom: 0.5em;
1289
- }
1290
- #wpmdb-sidebar .subscribe .field p {
1291
- margin-bottom: 0.3em;
1292
- }
1293
- #wpmdb-sidebar .subscribe .field.submit-button {
1294
- margin-bottom: 1em;
1295
- }
1296
- #wpmdb-sidebar .testimonial {
1297
- border-top: none;
1298
- }
1299
- #wpmdb-sidebar .testimonial p {
1300
- margin: 0;
1301
- }
1302
- #wpmdb-sidebar .testimonial .quote {
1303
- font-size: 20px;
1304
- }
1305
- #wpmdb-sidebar .testimonial .author {
1306
- white-space: nowrap;
1307
- text-align: right;
1308
- }
1309
- #wpmdb-sidebar .testimonial .stars {
1310
- white-space: nowrap;
1311
- margin-bottom: 5px;
1312
- }
1313
- #wpmdb-sidebar .testimonial .via {
1314
- text-align: right;
1315
- font-size: 12px;
1316
- }
1317
- #wpmdb-sidebar .testimonial .via a {
1318
- color: #666;
1319
- }
1320
- #wpmdb-sidebar .testimonial .via a:before {
1321
- content: "\f301";
1322
- display: inline-block;
1323
- -webkit-font-smoothing: antialiased;
1324
- font: normal 18px/1 'dashicons';
1325
- vertical-align: top;
1326
- margin-right: 3px;
1327
- }
1328
- @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) {
1329
- #wpmdb-sidebar .wpmdb-banner {
1330
- background-image: url(../img/wp-migrate-db-pro@2x.jpg);
1331
- background-size: 292px 292px;
1332
- width: 292px;
1333
- height: 292px;
1334
- display: block;
1335
- }
1336
- #wpmdb-sidebar .wpmdb-banner img {
1337
- display: none;
1338
- }
1339
- }
1340
- @media screen and (max-width: 1252px) {
1341
- #wpmdb-sidebar {
1342
- position: relative;
1343
- top: auto;
1344
- right: auto;
1345
- margin-top: 50px;
1346
- }
1347
- }
1348
-
1349
- body.mp6 input[type=checkbox]:disabled {
1350
- opacity: 1;
1351
- border-color: #ccc;
1352
- }
1353
- body.mp6 #wpmdb-main {
1354
- margin-top: 20px;
1355
- font-size: 14px;
1356
- }
1357
- body.mp6 p {
1358
- font-size: 14px;
1359
- }
1360
- body.mp6 .wrap h2 {
1361
- float: left;
1362
- }
1363
- body.mp6 .wpmdb input[type=checkbox],
1364
- body.mp6 .wpmdb input[type=radio] {
1365
- vertical-align: middle;
1366
- margin-top: -4px;
1367
- }
1368
- body.mp6 .wpmdb input[type=text],
1369
- body.mp6 .wpmdb input[type=password] {
1370
- padding: 3px 5px;
1371
- }
1372
- body.mp6 .wpmdb input.code {
1373
- padding-top: 6px;
1374
- }
1375
- body.mp6 .wpmdb label {
1376
- font-size: 14px;
1377
- }
1378
- body.mp6 .wpmdb h2.nav-tab-wrapper {
1379
- float: none;
1380
- margin-bottom: 0;
1381
- width: 722px;
1382
- }
1383
- body.mp6 .wpmdb .help-tab h3 {
1384
- margin-top: 0;
1385
- }
1386
- body.mp6 .wpmdb .temp-disabled {
1387
- background-color: #f9f9f9;
1388
- }
1389
- body.mp6 .wpmdb .migration-profile-options li a {
1390
- border-color: #ccc;
1391
- color: #555;
1392
- background-color: #e4e4e4;
1393
- }
1394
- body.mp6 .wpmdb .migration-profile-options li a:hover {
1395
- background-color: #fff;
1396
- color: #464646;
1397
- }
1398
- body.mp6 .wpmdb .settings-tab .slider-label span {
1399
- vertical-align: middle;
1400
- }
1401
- body.mp6 .wpmdb .settings-tab .slider-label-wrapper {
1402
- font-size: 14px;
1403
- }
1404
- body.mp6 .wpmdb .settings-tab .ui-slider {
1405
- border-color: #ccc;
1406
- background-color: #fff;
1407
- }
1408
- body.mp6 .wpmdb .settings-tab .ui-slider-range {
1409
- background-color: #d8fcd1;
1410
- }
1411
- body.mp6 .wpmdb .settings-tab .option-section li label {
1412
- font-size: 14px;
1413
- }
1414
- body.mp6 .wpmdb .connection-info,
1415
- body.mp6 .wpmdb .migrate-tab .pull-push-connection-info {
1416
- font-weight: bold;
1417
- font-size: 14px;
1418
- }
1419
- body.mp6 .wpmdb .general-helper {
1420
- border: 0;
1421
- width: auto;
1422
- height: auto;
1423
- top: auto;
1424
- margin: 0;
1425
- }
1426
- body.mp6 .wpmdb .general-helper:after {
1427
- content: "\f223";
1428
- display: inline-block;
1429
- -webkit-font-smoothing: antialiased;
1430
- font: normal 22px/1 'dashicons';
1431
- vertical-align: top;
1432
- top: auto;
1433
- left: auto;
1434
- position: relative;
1435
- }
1436
- body.mp6 .wpmdb .helper-message {
1437
- font-size: 14px;
1438
- line-height: 1.4em;
1439
- }
1440
- body.mp6 .wpmdb .right-arrow {
1441
- display: none;
1442
- }
1443
- body.mp6 .wpmdb .arrow-col {
1444
- width: 75px;
1445
- }
1446
- body.mp6 .wpmdb .arrow-col:after {
1447
- content: "\f344";
1448
- display: inline-block;
1449
- -webkit-font-smoothing: antialiased;
1450
- font: normal 22px/1 'dashicons';
1451
- vertical-align: top;
1452
- color: #999;
1453
- }
1454
- body.mp6 .wpmdb .find-heading {
1455
- width: 409px;
1456
- }
1457
- body.mp6 .wpmdb .replace-fields input {
1458
- width: 304px;
1459
- }
1460
- body.mp6 .wpmdb .replace-right-col span {
1461
- border-color: #999;
1462
- }
1463
- body.mp6 .wpmdb .replace-right-col span:hover {
1464
- border-color: #666;
1465
- }
1466
- body.mp6 .wpmdb .replace-add-row:after, body.mp6 .wpmdb .replace-add-row:before {
1467
- background-color: #999;
1468
- }
1469
- body.mp6 .wpmdb .replace-add-row:hover:after, body.mp6 .wpmdb .replace-add-row:hover:before {
1470
- background-color: #666;
1471
- }
1472
- body.mp6 .wpmdb .option-group.migrate-selection > li > label {
1473
- font-size: 16px;
1474
- }
1475
- body.mp6 .wpmdb .saved-migration-profile-label {
1476
- font-size: 16px;
1477
- }
1478
- body.mp6 .wpmdb .option-heading, body.mp6 .wpmdb .checkbox-label {
1479
- font-size: 16px;
1480
- }
1481
- body.mp6 .wpmdb .checkbox-label input[type=checkbox] {
1482
- top: auto;
1483
- }
1484
- body.mp6 .wpmdb .return-to-profile-selection {
1485
- font-size: 14px;
1486
- }
1487
- body.mp6 .wpmdb .option-description {
1488
- font-size: 13px;
1489
- }
1490
- body.mp6 .wpmdb .save-migration-profile-wrap li {
1491
- position: relative;
1492
- }
1493
- body.mp6 .wpmdb .replace-remove-row,
1494
- body.mp6 .wpmdb .delete-profile {
1495
- border: 0;
1496
- border-radius: 0;
1497
- height: auto;
1498
- width: auto;
1499
- left: 0;
1500
- top: 50%;
1501
- margin-left: 0;
1502
- }
1503
- body.mp6 .wpmdb .replace-remove-row:after,
1504
- body.mp6 .wpmdb .delete-profile:after {
1505
- content: "\f153";
1506
- display: inline-block;
1507
- -webkit-font-smoothing: antialiased;
1508
- font: normal 18px/1 'dashicons';
1509
- vertical-align: middle;
1510
- color: #999;
1511
- }
1512
- body.mp6 .wpmdb .replace-remove-row:hover:after,
1513
- body.mp6 .wpmdb .delete-profile:hover:after {
1514
- color: #666;
1515
- }
1516
- body.mp6 .wpmdb .addons-tab .addon h1 {
1517
- font-family: 'Open Sans', sans-serif;
1518
- font-weight: 200;
1519
- font-size: 24px;
1520
- margin-top: 2px;
1521
- }
1522
- body.mp6 .wpmdb .addons-tab .addon.wp-migrate-db-pro-cli h1 {
1523
- margin-top: 5px;
1524
- }
1525
- body.mp6 .wpmdb .addons-tab .addon p {
1526
- font-size: 14px;
1527
- line-height: 1.4em;
1528
- }
1529
- body.mp6 .wpmdb .help-tab .support p, body.mp6 .wpmdb .help-tab .support .email a {
1530
- font-size: 14px;
1531
- }
1532
- body.mp6 .wpmdb .help-tab div.warning p {
1533
- font-size: 13px;
1534
- }
1535
- body.mp6 .wpmdb .help-tab .videos h4, body.mp6 .wpmdb .help-tab .videos p {
1536
- font-size: 14px;
1537
- }
1538
- body.mp6 .wpmdb .inline-message, body.mp6 .wpmdb .notification-message {
1539
- border-radius: 0;
1540
- border: 0;
1541
- box-shadow: 0 1px 1px 0 rgba(0, 0, 0, 0.1);
1542
- padding: 10px 14px;
1543
- font-size: 13px;
1544
- }
1545
- body.mp6 .wpmdb .notification-message {
1546
- margin-bottom: 20px;
1547
- background-color: #fff;
1548
- }
1549
- body.mp6 .wpmdb .notification-message.ssl-notice, body.mp6 .wpmdb .notification-message.invalid-licence {
1550
- margin-bottom: 0;
1551
- margin-top: 15px;
1552
- }
1553
- body.mp6 .wpmdb .notification-message p {
1554
- font-size: 13px;
1555
- margin-top: 0;
1556
- }
1557
- body.mp6 .wpmdb .notification-message p:last-child {
1558
- margin: 0;
1559
- }
1560
- body.mp6 .wpmdb .notification-message h4 {
1561
- margin-top: 0;
1562
- }
1563
- body.mp6 .wpmdb .notification-message a {
1564
- color: #0074a2;
1565
- text-decoration: none;
1566
- }
1567
- body.mp6 .wpmdb .notification-message a:hover {
1568
- color: #2ea2cc;
1569
- }
1570
- body.mp6 .wpmdb div.notification-message.invalid-licence p:last-child {
1571
- margin: 0.5em 0;
1572
- }
1573
- body.mp6 .wpmdb div.notification-message.invalid-licence p:last-child a.button {
1574
- color: #555555;
1575
- }
1576
- body.mp6 .wpmdb .inline-message.error, body.mp6 .wpmdb .notification-message.error-notice {
1577
- border-left: 4px solid #dd3d36;
1578
- background-color: #fff;
1579
- }
1580
- body.mp6 .wpmdb .inline-message.warning, body.mp6 .wpmdb .notification-message.warning-notice {
1581
- background-color: #fff;
1582
- border-left: 4px solid #ffba00;
1583
- }
1584
- body.mp6 .wpmdb .inline-message.success, body.mp6 .wpmdb .notification-message.success-notice {
1585
- border-left: 4px solid #7ad03a;
1586
- }
1587
- body.mp6 .wpmdb .ssl-notice {
1588
- margin-bottom: 0;
1589
- }
1590
- body.mp6 .wpmdb .different-plugin-version-notice, body.mp6 .wpmdb .directory-permission-notice {
1591
- margin-bottom: 10px;
1592
- }
1593
- body.mp6 .wpmdb .licence-status {
1594
- color: #444;
1595
- margin-top: 15px;
1596
- float: left;
1597
- font-weight: normal;
1598
- }
1599
- body.mp6 .progress-content {
1600
- font-size: 14px;
1601
- box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
1602
- background-color: #eee;
1603
- }
1604
- body.mp6 .progress-content .progress-title {
1605
- font-family: 'Open Sans', sans-serif;
1606
- font-weight: normal;
1607
- font-size: 22px;
1608
- }
1609
- body.mp6 .progress-content .dashicons-yes {
1610
- font-size: 42px;
1611
- line-height: 0.5em;
1612
- }
1613
- body.mp6 .progress-content .progress-bar {
1614
- background-image: none;
1615
- background-color: #0074a2;
1616
- }
1617
- body.mp6 #overlay {
1618
- background-color: rgba(0, 0, 0, 0.5);
1619
- }
1620
- body.mp6 .migration-progress-ajax-spinner {
1621
- top: 20px;
1622
- }
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}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
asset/js/common.js CHANGED
@@ -39,6 +39,53 @@ function wpmdb_parse_json( maybe_json ) {
39
  return json_object;
40
  }
41
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
42
  (function($) {
43
  // jQuery code here
44
  })(jQuery);
39
  return json_object;
40
  }
41
 
42
+ /**
43
+ * Global error method for detecting PHP or other errors in AJAX response
44
+ *
45
+ * @param title - the error title if not a PHP error
46
+ * @param code - the error code if not a PHP error
47
+ * @param text - the AJAX response text to sniff for errors
48
+ * @param jqXHR - optional AJAX object used to enrich the error message
49
+ *
50
+ * @returns {string} - html error string with view error toggle element
51
+ */
52
+ function wpmdbGetAjaxErrors( title, code, text, jqXHR ) {
53
+ var jsonErrors = false;
54
+ var html = '';
55
+
56
+ var validJson = wpmdb_parse_json( text );
57
+ if ( false === validJson ) {
58
+ jsonErrors = true;
59
+ title = wpmdb_strings.ajax_json_message;
60
+ code = '(#144)';
61
+ var originalText = text;
62
+ text = wpmdb_strings.ajax_json_errors + ' ' + code;
63
+ text += '<br><a class="show-errors-toggle" href="#">' + wpmdb_strings.view_error_messages + '</a> ';
64
+ text += '<div class="migration-php-errors">' + originalText + '</div>';
65
+ }
66
+
67
+ // Only add local connection issue if php errors (#144) or jqXHR has been provided
68
+ if ( jsonErrors || jqXHR !== undefined ) {
69
+ html += '<strong>' + title + '</strong>' + ' &mdash; ';
70
+ }
71
+
72
+ // Only add extra error details if not php errors (#144) and jqXHR has been provided
73
+ if ( ! jsonErrors && jqXHR !== undefined ) {
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 ( ! jsonErrors ) {
80
+ text += ' ' + code;
81
+ }
82
+
83
+ // Finally add the error message to the output
84
+ html += text;
85
+
86
+ return html;
87
+ }
88
+
89
  (function($) {
90
  // jQuery code here
91
  })(jQuery);
asset/js/common.min.js ADDED
@@ -0,0 +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+="",x=a.split("."),x1=x[0],x2=x.length>1?"."+x[1]:"";for(var b=/(\d+)(\d{3})/;b.test(x1);)x1=x1.replace(b,"$1,$2");return x1+x2}function wpmdb_parse_json(a){try{var 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> &mdash; "),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);
asset/js/hook.min.js ADDED
@@ -0,0 +1 @@
 
1
+ !function(a){a.wpmdb={hooks:{action:{},filter:{}},add_action:function(a,b,c){jQuery.wpmdb.add_hook("action",a,b,c)},add_filter:function(a,b,c){jQuery.wpmdb.add_hook("filter",a,b,c)},do_action:function(a,b){jQuery.wpmdb.do_hook("action",a,null,b)},apply_filters:function(a,b,c){return jQuery.wpmdb.do_hook("filter",a,b,c)},remove_action:function(a,b){jQuery.wpmdb.remove_hook("action",a,b)},remove_filter:function(a,b){jQuery.wpmdb.remove_hook("filter",a,b)},add_hook:function(a,b,c,d){void 0==jQuery.wpmdb.hooks[a][b]&&(jQuery.wpmdb.hooks[a][b]=[]);var e=jQuery.wpmdb.hooks[a][b];void 0==d&&(d=b+"_"+e.length),jQuery.wpmdb.hooks[a][b].push({tag:d,callable:c})},do_hook:function(a,b,c,d){if(void 0!=jQuery.wpmdb.hooks[a][b])for(var e=jQuery.wpmdb.hooks[a][b],f=0;f<e.length;f++)"action"==a?e[f].callable(d):c=e[f].callable(c,d);return"filter"==a?c:void 0},remove_hook:function(a,b,c){if(void 0!=jQuery.wpmdb.hooks[a][b])for(var d=jQuery.wpmdb.hooks[a][b],e=d.length-1;e>=0;e--)(void 0==c||c==d[e].tag)&&d.splice(e,1)}}}(jQuery);
asset/js/script.js CHANGED
@@ -22,6 +22,7 @@ var execute_next_step;
22
  var currently_migrating = false;
23
  var dump_filename = '';
24
  var dump_url = '';
 
25
  var migration_intent;
26
  var remote_site;
27
  var secret_key;
@@ -36,8 +37,10 @@ var execute_next_step;
36
  var timer_count;
37
  var overall_percent;
38
  var migration_cancelled = false;
 
 
39
 
40
- var admin_url = ajaxurl.replace( '/admin-ajax.php', '' ), spinner_url = admin_url + '/images/wpspin_light';
41
 
42
  if( window.devicePixelRatio >= 2 ){
43
  spinner_url += '-2x';
@@ -51,11 +54,11 @@ var execute_next_step;
51
 
52
  // For IE and Firefox prior to version 4
53
  if (e) {
54
- e.returnValue = wpmdb_i10n.sure;
55
  }
56
 
57
  // For Safari
58
- return wpmdb_i10n.sure;
59
  }
60
  };
61
 
@@ -73,7 +76,7 @@ var execute_next_step;
73
  function setup_counter() {
74
  timer_count = 0,
75
  counter_display = $('.timer'),
76
- label = wpmdb_i10n.time_elapsed + ' ';
77
 
78
  elapsed_interval = setInterval(count,1000);
79
  }
@@ -126,16 +129,6 @@ var execute_next_step;
126
  return;
127
  }
128
 
129
- function maybe_show_version_warning( plugin_version, url ) {
130
- if( typeof plugin_version != 'undefined' && plugin_version != wpmdb_plugin_version ) {
131
- $('.different-plugin-version-notice').show();
132
- $('.remote-version').html( plugin_version );
133
- $('.remote-location').html( url );
134
- $('.step-two').hide();
135
- show_version_notice = true;
136
- }
137
- }
138
-
139
  function maybe_show_prefix_notice( prefix ) {
140
  if( prefix != wpmdb_this_prefix ) {
141
  $('.remote-prefix').html( prefix );
@@ -149,6 +142,68 @@ var execute_next_step;
149
  }
150
  }
151
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
152
  function get_domain_name( url ){
153
  var temp_url = url;
154
  var domain = temp_url.replace( /\/\/(.*)@/, '//' ).replace('http://','').replace('https://','').replace('www.','');
@@ -159,11 +214,11 @@ var execute_next_step;
159
  var domain = get_domain_name(url);
160
  var migrating_stage_label, completed_stage_label;
161
  if ( intent == 'pull' ) {
162
- migrating_stage_label = wpmdb_i10n.pull_migration_label_migrating;
163
- completed_stage_label = wpmdb_i10n.pull_migration_label_completed;
164
  } else {
165
- migrating_stage_label = wpmdb_i10n.push_migration_label_migrating;
166
- completed_stage_label = wpmdb_i10n.push_migration_label_completed;
167
  }
168
 
169
  migrating_stage_label = migrating_stage_label.replace( '%s', domain );
@@ -180,12 +235,26 @@ var execute_next_step;
180
  return url.replace(/^https?:/i, "");
181
  }
182
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
183
  $(document).ready(function() {
184
 
185
  $('#plugin-compatibility').change(function(e){
186
  var install = '1';
187
  if ( $(this).is(':checked') ) {
188
- var answer = confirm( wpmdb_i10n.mu_plugin_confirmation );
189
 
190
  if( ! answer ){
191
  $(this).prop('checked',false);
@@ -212,7 +281,7 @@ var execute_next_step;
212
  install : install,
213
  },
214
  error: function(jqXHR, textStatus, errorThrown){
215
- alert( wpmdb_i10n.plugin_compatibility_settings_problem + '\r\n\r\n' + wpmdb_i10n.status + ' ' + jqXHR.status + ' ' + jqXHR.statusText + '\r\n\r\n' + wpmdb_i10n.response + '\r\n' + jqXHR.responseText );
216
  $('.ajax-spinner').remove();
217
  $('#plugin-compatibility').removeAttr('disabled');
218
  $('.plugin-compatibility').removeClass('disabled');
@@ -222,7 +291,7 @@ var execute_next_step;
222
  alert( data );
223
  }
224
  else {
225
- $('.plugin-compatibility').append('<span class="ajax-success-msg">' + wpmdb_i10n.saved + '</span>');
226
  $('.ajax-success-msg').fadeOut(2000,function(){
227
  $(this).remove();
228
  });
@@ -272,7 +341,7 @@ var execute_next_step;
272
  error: function(jqXHR, textStatus, errorThrown){
273
  $('.slider').slider('enable');
274
  $('.slider-spinner').remove();
275
- alert( wpmdb_i10n.max_request_size_problem );
276
  },
277
  success: function(data){
278
  $('.slider').slider('enable');
@@ -330,10 +399,14 @@ var execute_next_step;
330
  nonce : wpmdb_nonces.check_licence,
331
  },
332
  error: function(jqXHR, textStatus, errorThrown){
333
- alert( wpmdb_i10n.license_check_problem );
334
  },
335
  success: function(data){
336
- if ( typeof data.errors !== 'undefined' ) {
 
 
 
 
337
  var msg = '';
338
  for (var key in data.errors) {
339
  msg += data.errors[key];
@@ -349,20 +422,6 @@ var execute_next_step;
349
  });
350
  }
351
 
352
- function disable_export_type_controls() {
353
- $('.option-group').each(function(index){
354
- $('input', this).attr('disabled','disabled');
355
- $('label', this).css('cursor','default');
356
- });
357
- }
358
-
359
- function enable_export_type_controls() {
360
- $('.option-group').each(function(index){
361
- $('input', this).removeAttr('disabled');
362
- $('label', this).css('cursor','pointer');
363
- });
364
- }
365
-
366
  // automatically validate connnection info if we're loading a saved profile
367
  establish_remote_connection_from_saved_profile();
368
 
@@ -378,7 +437,7 @@ var execute_next_step;
378
  doing_ajax = true;
379
  disable_export_type_controls();
380
 
381
- $('.connection-status').html( wpmdb_i10n.establishing_remote_connection );
382
  $('.connection-status').removeClass( 'notification-message error-notice migration-error' );
383
  $('.connection-status').append( '<img src="' + spinner_url + '" alt="" class="ajax-spinner general-spinner" />' );
384
 
@@ -399,8 +458,7 @@ var execute_next_step;
399
  profile : wpmdb_profile
400
  },
401
  error: function(jqXHR, textStatus, errorThrown){
402
- $('.connection-status').html( wpmdb_i10n.connection_local_server_problem + ' (#102)' );
403
- $('.connection-status').append( '<br /><br />' + wpmdb_i10n.status + ': ' + jqXHR.status + ' ' + jqXHR.statusText + '<br /><br />' + wpmdb_i10n.response + '<br />' + jqXHR.responseText );
404
  $('.connection-status').addClass( 'notification-message error-notice migration-error' );
405
  $('.ajax-spinner').remove();
406
  doing_ajax = false;
@@ -423,7 +481,6 @@ var execute_next_step;
423
  }
424
 
425
  maybe_show_ssl_warning( connection_info[0], connection_info[1], data.scheme );
426
- maybe_show_version_warning( data.plugin_version, connection_info[0] );
427
  maybe_show_prefix_notice( data.prefix );
428
 
429
  $('.pull-push-connection-info').addClass('temp-disabled');
@@ -436,6 +493,8 @@ var execute_next_step;
436
  connection_data = data;
437
  move_connection_info_box();
438
 
 
 
439
  var loaded_tables = '';
440
  if( wpmdb_default_profile == false && typeof wpmdb_loaded_tables != 'undefined' ){
441
  loaded_tables = wpmdb_loaded_tables;
@@ -537,7 +596,6 @@ var execute_next_step;
537
  }
538
 
539
  $.wpmdb.do_action( 'verify_connection_to_remote_site', connection_data );
540
-
541
  }
542
 
543
  });
@@ -545,11 +603,22 @@ var execute_next_step;
545
  }
546
 
547
  // add to <a> tags which act as JS event buttons, will not jump page to top and will deselect the button
548
- $('.js-action-link').click(function(e){
549
  e.preventDefault();
550
  $(this).blur();
551
  });
552
 
 
 
 
 
 
 
 
 
 
 
 
553
  // registers your licence
554
  $('.licence-form').submit(function(e){
555
  e.preventDefault();
@@ -564,7 +633,7 @@ var execute_next_step;
564
 
565
  if( licence_key == '' ){
566
  $('.licence-status').addClass( 'notification-message error-notice' );
567
- $('.licence-status').html( wpmdb_i10n.enter_license_key );
568
  return;
569
  }
570
 
@@ -585,7 +654,7 @@ var execute_next_step;
585
  error: function(jqXHR, textStatus, errorThrown){
586
  doing_licence_registration_ajax = false;
587
  $('.register-licence-ajax-spinner').remove();
588
- $('.licence-status').html( wpmdb_i10n.register_license_problem );
589
  },
590
  success: function(data){
591
  doing_licence_registration_ajax = false;
@@ -596,22 +665,21 @@ var execute_next_step;
596
  for (var key in data.errors) {
597
  msg += data.errors[key];
598
  }
599
- $('.licence-status').html( msg );
 
 
 
 
 
600
  }
601
  else if ( typeof data.wpmdb_error !== 'undefined' && typeof data.body !== 'undefined' ) {
602
  $('.licence-status').html( data.body );
603
  }
604
  else {
605
- $('.licence-input, .register-licence').remove();
606
- $('.licence-not-entered').prepend( data.masked_licence );
607
- $('.licence-status').html( wpmdb_i10n.license_registered ).delay(5000).fadeOut(1000);
608
  $('.licence-status').addClass('success notification-message success-notice');
609
- $('.support-content').empty().html('<p>' + wpmdb_i10n.fetching_license + '<img src="' + spinner_url + '" alt="" class="ajax-spinner general-spinner" /></p>');
610
- check_licence( licence_key );
611
-
612
  $('.invalid-licence').hide();
613
- $('.migrate-selection label').removeClass('disabled');
614
- $('.migrate-selection input').removeAttr('disabled');
615
  }
616
  }
617
  });
@@ -631,7 +699,7 @@ var execute_next_step;
631
  nonce : wpmdb_nonces.clear_log,
632
  },
633
  error: function(jqXHR, textStatus, errorThrown){
634
- alert( wpmdb_i10n.clear_log_problem );
635
  },
636
  success: function(data){
637
  }
@@ -650,7 +718,7 @@ var execute_next_step;
650
  nonce : wpmdb_nonces.get_log,
651
  },
652
  error: function(jqXHR, textStatus, errorThrown){
653
- alert( wpmdb_i10n.update_log_problem );
654
  },
655
  success: function(data){
656
  $('.debug-log-textarea').val(data);
@@ -661,24 +729,24 @@ var execute_next_step;
661
  // select all tables
662
  $('.multiselect-select-all').click(function(){
663
  var multiselect = $(this).parents('.select-wrap').children('.multiselect');
664
- $(multiselect).focus();
665
  $('option', multiselect).attr('selected',1);
 
666
  });
667
 
668
  // deselect all tables
669
  $('.multiselect-deselect-all').click(function(){
670
  var multiselect = $(this).parents('.select-wrap').children('.multiselect');
671
- $(multiselect).focus();
672
  $('option', multiselect).removeAttr('selected');
 
673
  });
674
 
675
  // invert table selection
676
  $('.multiselect-invert-selection').click(function(){
677
  var multiselect = $(this).parents('.select-wrap').children('.multiselect');
678
- $(multiselect).focus();
679
  $('option', multiselect).each(function(){
680
  $(this).attr('selected', ! $(this).attr('selected'));
681
  });
 
682
  });
683
 
684
  // on option select hide all "advanced" option divs and show the correct div for the option selected
@@ -724,17 +792,21 @@ var execute_next_step;
724
  $('#save-migration-profile').change(function() {
725
  if( $(this).is(':checked') ){
726
  $('.save-settings-button').show();
727
- $('.migrate-db .button-primary').val(wpmdb_i10n.migrate_db_save);
728
  }
729
  else{
730
  $('.save-settings-button').hide();
731
- $('.migrate-db .button-primary').val(wpmdb_i10n.migrate_db);
732
  }
733
  });
734
 
 
 
 
 
735
  if( $('#save-migration-profile').is(':checked') ){
736
  $('.save-settings-button').show();
737
- $('.migrate-db .button-primary').val(wpmdb_i10n.migrate_db_save);
738
  };
739
 
740
  $('.checkbox-label input[type=checkbox]').each(function(){
@@ -758,7 +830,7 @@ var execute_next_step;
758
 
759
  // check that they've selected some tables to migrate
760
  if( $('#migrate-selected').is(':checked') && $('#select-tables').val() == null ){
761
- alert( wpmdb_i10n.please_select_one_table );
762
  return;
763
  }
764
 
@@ -786,7 +858,7 @@ var execute_next_step;
786
  if( $('#save-migration-profile').is(':checked') ){
787
 
788
  if( $.trim( $('.create-new-profile').val() ) == '' && $('#create_new').is(':checked') ){
789
- alert( wpmdb_i10n.enter_name_for_profile );
790
  $('.create-new-profile').focus();
791
  return;
792
  }
@@ -811,7 +883,7 @@ var execute_next_step;
811
  nonce : wpmdb_nonces.save_profile,
812
  },
813
  error: function(jqXHR, textStatus, errorThrown){
814
- alert( wpmdb_i10n.save_profile_problem );
815
  },
816
  success: function(data){
817
  if(create_new_profile){
@@ -867,10 +939,10 @@ var execute_next_step;
867
 
868
  $('#overlay').after($progress_content);
869
 
870
- completed_msg = wpmdb_i10n.exporting_complete;
871
 
872
  if( migration_intent == 'savefile' ){
873
- static_migration_label = wpmdb_i10n.exporting_please_wait;
874
  }
875
  else{
876
  static_migration_label = get_migration_status_label(remote_site, migration_intent, 'migrating');
@@ -1018,9 +1090,8 @@ var execute_next_step;
1018
  nonce : wpmdb_nonces.initiate_migration,
1019
  },
1020
  error: function(jqXHR, textStatus, errorThrown){
1021
- $('.progress-title').html(wpmdb_i10n.migration_failed);
1022
- $('.progress-text').html( wpmdb_i10n.connection_local_server_problem + ' (#112)' );
1023
- $('.progress-text').append( '<br /><br />' + wpmdb_i10n.status + ': ' + jqXHR.status + ' ' + jqXHR.statusText + '<br /><br />' + wpmdb_i10n.response + ':<br />' + jqXHR.responseText );
1024
  $('.progress-text').addClass( 'migration-error' );
1025
  console.log( jqXHR );
1026
  console.log( textStatus );
@@ -1033,14 +1104,18 @@ var execute_next_step;
1033
  if( typeof data.wpmdb_error != 'undefined' && data.wpmdb_error == 1 ){
1034
  migration_error = true;
1035
  migration_complete_events();
1036
- $('.progress-title').html( wpmdb_i10n.migration_failed );
1037
  $('.progress-text').addClass( 'migration-error' );
1038
  $('.progress-text').html( data.body );
1039
  return;
1040
  }
1041
 
1042
  dump_url = data.dump_url;
 
1043
  dump_filename = data.dump_filename;
 
 
 
1044
 
1045
  var i = 0;
1046
  var progress_size = 0;
@@ -1088,6 +1163,8 @@ var execute_next_step;
1088
 
1089
  }
1090
  else {
 
 
1091
  hooks = $.wpmdb.apply_filters( 'wpmdb_before_migration_complete_hooks', hooks );
1092
  hooks.push( 'migration_complete' );
1093
  hooks = $.wpmdb.apply_filters( 'wpmdb_after_migration_complete_hooks', hooks );
@@ -1099,10 +1176,10 @@ var execute_next_step;
1099
  }
1100
 
1101
  if( stage == 'backup' ){
1102
- $('.progress-text').html( overall_percent + '% - ' + wpmdb_i10n.backing_up + ' "' + tables_to_migrate[i] + '"' );
1103
  }
1104
  else{
1105
- $('.progress-text').html( overall_percent + '% - ' + wpmdb_i10n.migrating + ' "' + tables_to_migrate[i] + '"');
1106
  }
1107
 
1108
  last_table = 0;
@@ -1116,19 +1193,22 @@ var execute_next_step;
1116
  }
1117
 
1118
  var request_data = {
1119
- action : 'wpmdb_migrate_table',
1120
- intent : migration_intent,
1121
- url : remote_site,
1122
- key : secret_key,
1123
- table : tables_to_migrate[i],
1124
- form_data : form_data,
1125
- stage : stage,
1126
- current_row : current_row,
1127
- dump_filename : dump_filename,
1128
- last_table : last_table,
1129
- primary_keys : primary_keys,
1130
- gzip : gzip,
1131
- nonce : wpmdb_nonces.migrate_table,
 
 
 
1132
  };
1133
 
1134
  if( migration_intent != 'savefile' ) {
@@ -1151,9 +1231,9 @@ var execute_next_step;
1151
  timeout: 0,
1152
  data: request_data,
1153
  error: function(jqXHR, textStatus, errorThrown){
1154
- $('.progress-title').html(wpmdb_i10n.migration_failed);
1155
- $('.progress-text').html( wpmdb_i10n.table_process_problem + ' ' + tables_to_migrate[i] );
1156
- $('.progress-text').append( '<br /><br />' + wpmdb_i10n.status + ': ' + jqXHR.status + ' ' + jqXHR.statusText + '<br /><br />' + wpmdb_i10n.response + ':<br />' + jqXHR.responseText );
1157
  $('.progress-text').addClass( 'migration-error' );
1158
  doing_ajax = false;
1159
  console.log( jqXHR );
@@ -1168,12 +1248,12 @@ var execute_next_step;
1168
  data = $.trim( data );
1169
  row_information = wpmdb_parse_json( data );
1170
  if( false == row_information || null == row_information ){
1171
- $('.progress-title').html(wpmdb_i10n.migration_failed);
1172
  if( '' == data || null == data ) {
1173
- $('.progress-text').html( wpmdb_i10n.table_process_problem_empty_response + ' ' + tables_to_migrate[i] );
1174
  }
1175
  else {
1176
- $('.progress-text').html(data);
1177
  }
1178
  $('.progress-text').addClass('migration-error');
1179
  migration_error = true;
@@ -1182,7 +1262,7 @@ var execute_next_step;
1182
  }
1183
 
1184
  if( typeof row_information.wpmdb_error != 'undefined' && row_information.wpmdb_error == 1 ){
1185
- $('.progress-title').html(wpmdb_i10n.migration_failed);
1186
  $('.progress-text').addClass( 'migration-error' );
1187
  $('.progress-text').html( row_information.body );
1188
  migration_error = true;
@@ -1236,7 +1316,7 @@ var execute_next_step;
1236
  else {
1237
  $('.progress-text').html(non_fatal_errors);
1238
  $('.progress-text').addClass('migration-error');
1239
- $('.progress-title').html( wpmdb_i10n.completed_with_some_errors );
1240
  }
1241
 
1242
  $('.progress-bar-wrapper').hide();
@@ -1266,7 +1346,7 @@ var execute_next_step;
1266
  $('.migration-controls').fadeOut();
1267
  if( migration_intent == 'savefile' ){
1268
  currently_migrating = false;
1269
- var migrate_complete_text = wpmdb_i10n.migration_complete;
1270
  if( $('#save_computer').is(':checked') ){
1271
  var url = wpmdb_this_download_url + encodeURIComponent( dump_filename );
1272
  if( $('#gzip_file').is(':checked') ){
@@ -1275,7 +1355,7 @@ var execute_next_step;
1275
  window.location = url;
1276
  }
1277
  else{
1278
- migrate_complete_text = wpmdb_i10n.completed_dump_located_at + ' <a href="' + dump_url + '">' + dump_url + '</a>.';
1279
  }
1280
 
1281
  if( migration_error == false ){
@@ -1286,7 +1366,7 @@ var execute_next_step;
1286
 
1287
  }
1288
  else{ // rename temp tables, delete old tables
1289
- $('.progress-text').html( wpmdb_i10n.finalizing_migration );
1290
  $.ajax({
1291
  url: ajaxurl,
1292
  type: 'POST',
@@ -1304,8 +1384,8 @@ var execute_next_step;
1304
  nonce : wpmdb_nonces.finalize_migration,
1305
  },
1306
  error: function(jqXHR, textStatus, errorThrown){
1307
- $('.progress-title').html( wpmdb_i10n.migration_failed );
1308
- $('.progress-text').html( wpmdb_i10n.finalize_tables_problem );
1309
  $('.progress-text').addClass('migration-error');
1310
  alert( jqXHR + ' : ' + textStatus + ' : ' + errorThrown );
1311
  migration_error = true;
@@ -1314,7 +1394,7 @@ var execute_next_step;
1314
  },
1315
  success: function(data){
1316
  if( $.trim( data ) != '' ){
1317
- $('.progress-title').html( wpmdb_i10n.migration_failed );
1318
  $('.progress-text').html(data);
1319
  $('.progress-text').addClass('migration-error');
1320
  migration_error = true;
@@ -1330,11 +1410,11 @@ var execute_next_step;
1330
  }
1331
 
1332
  // close progress pop up once migration is completed
1333
- $('body').delegate('.close-progress-content-button', 'click', function(e){
1334
  hide_overlay();
1335
  });
1336
 
1337
- $('body').delegate('#overlay', 'click', function(){
1338
  if( migration_completed == true ){
1339
  hide_overlay();
1340
  }
@@ -1358,12 +1438,12 @@ var execute_next_step;
1358
 
1359
  // check that they've selected some tables to migrate
1360
  if( $('#migrate-selected').is(':checked') && $('#select-tables').val() == null ){
1361
- alert( wpmdb_i10n.please_select_one_table );
1362
  return;
1363
  }
1364
 
1365
  if( $.trim( $('.create-new-profile').val() ) == '' && $('#create_new').is(':checked') ){
1366
- alert( wpmdb_i10n.enter_name_for_profile );
1367
  $('.create-new-profile').focus();
1368
  return;
1369
  }
@@ -1392,10 +1472,10 @@ var execute_next_step;
1392
  nonce : wpmdb_nonces.save_profile,
1393
  },
1394
  error: function(jqXHR, textStatus, errorThrown){
1395
- alert( wpmdb_i10n.save_profile_problem );
1396
  $('.save-settings-button').removeAttr('disabled');
1397
  $('.save-profile-ajax-spinner').remove();
1398
- $('.save-settings-button').after('<span class="ajax-success-msg">' + wpmdb_i10n.saved + '</span>');
1399
  $('.ajax-success-msg').fadeOut(2000,function(){
1400
  $(this).remove();
1401
  });
@@ -1404,7 +1484,7 @@ var execute_next_step;
1404
  success: function(data){
1405
  $('.save-settings-button').removeAttr('disabled');
1406
  $('.save-profile-ajax-spinner').remove();
1407
- $('.save-settings-button').after('<span class="ajax-success-msg">' + wpmdb_i10n.saved + '</span>');
1408
  $('.ajax-success-msg').fadeOut(2000,function(){
1409
  $(this).remove();
1410
  });
@@ -1414,7 +1494,9 @@ var execute_next_step;
1414
  if(create_new_profile){
1415
  var new_profile_key = parseInt(data, 10);
1416
  var new_profile_id = new_profile_key + 1;
1417
- 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>';
 
 
1418
  $('#create_new').parents('li').before(new_li);
1419
  $('#profile-' + new_profile_id).attr('checked','checked');
1420
  }
@@ -1425,7 +1507,7 @@ var execute_next_step;
1425
  });
1426
 
1427
  // progress label updating
1428
- $('body').delegate('.progress-chunk-hover', 'mousemove', function(e) {
1429
  mX = e.pageX;
1430
  offset = $('.progress-bar-wrapper').offset();
1431
  label_offset = $('.progress-label').outerWidth() / 2;
@@ -1435,7 +1517,7 @@ var execute_next_step;
1435
  });
1436
 
1437
  // show / hide progress lavel on hover
1438
- $('body').delegate('.progress-chunk-hover', 'hover', function(event) {
1439
  if( event.type === 'mouseenter' ){
1440
  $('.progress-label').addClass('label-visible');
1441
  }
@@ -1468,6 +1550,8 @@ var execute_next_step;
1468
  $('#create-backup').removeAttr('disabled');
1469
  $('#create-backup-label').removeClass('disabled');
1470
  $('.backup-option-disabled').hide();
 
 
1471
  var connection_info = $.trim( $('.pull-push-connection-info').val() ).split("\n");
1472
  if( $('#pull').is(':checked') ){
1473
  $('.pull-list li').append( connection_info_box );
@@ -1491,7 +1575,7 @@ var execute_next_step;
1491
  $('.different-plugin-version-notice').show();
1492
  $('.step-two').hide();
1493
  }
1494
- $('.directory-scope').html('local');
1495
  if( false == wpmdb_write_permission ) {
1496
  $('#create-backup').prop('checked',false);
1497
  $('#create-backup').attr('disabled','disabled');
@@ -1527,7 +1611,7 @@ var execute_next_step;
1527
  $('.different-plugin-version-notice').show();
1528
  $('.step-two').hide();
1529
  }
1530
- $('.directory-scope').html('remote');
1531
  if( '0' == connection_data.write_permissions ) {
1532
  $('#create-backup').prop('checked',false);
1533
  $('#create-backup').attr('disabled','disabled');
@@ -1545,6 +1629,7 @@ var execute_next_step;
1545
  $('.connection-status').hide();
1546
  $('.step-two').show();
1547
  $('.table-prefix').html(wpmdb_this_prefix);
 
1548
  if( profile_name_edited == false ){
1549
  $('.create-new-profile').val('');
1550
  }
@@ -1555,6 +1640,7 @@ var execute_next_step;
1555
  $('.step-two').hide();
1556
  }
1557
  }
 
1558
  $.wpmdb.do_action( 'move_connection_info_box' );
1559
  }
1560
 
@@ -1602,6 +1688,7 @@ var execute_next_step;
1602
 
1603
  // show / hide GUID helper description
1604
  $('.general-helper').click(function(e){
 
1605
  var icon = $(this),
1606
  bubble = $(this).next();
1607
 
@@ -1633,6 +1720,24 @@ var execute_next_step;
1633
  e.stopPropagation();
1634
  });
1635
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1636
  // migrate / settings tabs
1637
  $('.nav-tab').click(function(){
1638
  $('.nav-tab').removeClass('nav-tab-active');
@@ -1663,17 +1768,35 @@ var execute_next_step;
1663
 
1664
  });
1665
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1666
  // repeatable fields
1667
- $('body').delegate('.add-row', 'click', function() {
1668
  $(this).parents('tr').before( $('.original-repeatable-field').clone().removeClass('original-repeatable-field') );
1669
  });
1670
 
1671
  // repeatable fields
1672
- $('body').delegate('.replace-remove-row', 'click', function() {
1673
  $(this).parents('tr').remove();
1674
  if( $('.replace-row').length < 2 ){
1675
  $('.no-replaces-message').show();
1676
  }
 
 
 
 
 
1677
  });
1678
 
1679
  $('.add-replace').click(function(){
@@ -1683,7 +1806,7 @@ var execute_next_step;
1683
 
1684
  $
1685
 
1686
- $('body').delegate('#find-and-replace-sort tbody tr.replace-row', 'hover', function(event) {
1687
  if( event.type === 'mouseenter' ){
1688
  $('.replace-remove-row', this).show();
1689
  }
@@ -1706,7 +1829,7 @@ var execute_next_step;
1706
  });
1707
 
1708
  // delete saved profiles
1709
- $('body').delegate('.save-migration-profile-wrap li', 'hover', function(event) {
1710
  if( event.type === 'mouseenter' ){
1711
  $('.delete-profile', this).show();
1712
  }
@@ -1755,9 +1878,28 @@ var execute_next_step;
1755
  }
1756
  }
1757
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1758
  // regenerates the saved secret key
1759
  $('.reset-api-key').click(function(){
1760
- var answer = confirm( wpmdb_i10n.reset_api_key );
1761
 
1762
  if( ! answer || doing_reset_api_key_ajax ){
1763
  return;
@@ -1776,7 +1918,7 @@ var execute_next_step;
1776
  nonce : wpmdb_nonces.reset_api_key,
1777
  },
1778
  error: function(jqXHR, textStatus, errorThrown){
1779
- alert( wpmdb_i10n.reset_api_key_problem );
1780
  $('.reset-api-key-ajax-spinner').remove();
1781
  doing_reset_api_key_ajax = false;
1782
  },
@@ -1834,7 +1976,7 @@ var execute_next_step;
1834
  blacklist_plugins : $(select_element).val(),
1835
  },
1836
  error: function(jqXHR, textStatus, errorThrown){
1837
- alert( wpmdb_i10n.blacklist_problem + '\r\n\r\n' + wpmdb_i10n.status + ' ' + jqXHR.status + ' ' + jqXHR.statusText + '\r\n\r\n' + wpmdb_i10n.response + '\r\n' + jqXHR.responseText );
1838
  $(select_element).removeAttr('disabled');
1839
  $('.plugin-compatibility-save').removeClass('disabled');
1840
  doing_plugin_compatibility_ajax = false;
@@ -1855,11 +1997,11 @@ var execute_next_step;
1855
  });
1856
 
1857
  // delete a profile from the migrate form area
1858
- $('body').delegate('.delete-profile', 'click', function(){
1859
  var name = $(this).next().clone();
1860
  $('input',name).remove();
1861
  var name = $.trim($(name).html());
1862
- var answer = confirm( wpmdb_i10n.remove_profile + ' "' + name + '"' );
1863
 
1864
  if(!answer){
1865
  return;
@@ -1878,11 +2020,11 @@ var execute_next_step;
1878
  nonce : wpmdb_nonces.delete_migration_profile,
1879
  },
1880
  error: function(jqXHR, textStatus, errorThrown){
1881
- alert( wpmdb_i10n.remove_profile_problem );
1882
  },
1883
  success: function(data){
1884
  if( data == '-1' ){
1885
- alert( wpmdb_i10n.remove_profile_not_found );
1886
  }
1887
  }
1888
  });
@@ -1892,7 +2034,7 @@ var execute_next_step;
1892
  // deletes a profile from the main profile selection screen
1893
  $('.main-list-delete-profile-link').click(function(){
1894
  var name = $(this).prev().html();
1895
- var answer = confirm( wpmdb_i10n.remove_profile + ' "' + name + '"' );
1896
 
1897
  if(!answer){
1898
  return;
@@ -1911,15 +2053,15 @@ var execute_next_step;
1911
  nonce : wpmdb_nonces.delete_migration_profile,
1912
  },
1913
  error: function(jqXHR, textStatus, errorThrown){
1914
- alert( wpmdb_i10n.remove_profile_problem );
1915
  }
1916
  });
1917
 
1918
  });
1919
 
1920
  // warn the user when editing the connection info after a connection has been established
1921
- $('body').delegate('.temp-disabled', 'click', function() {
1922
- var answer = confirm( wpmdb_i10n.change_connection_info );
1923
 
1924
  if( ! answer ){
1925
  return;
@@ -1932,7 +2074,7 @@ var execute_next_step;
1932
  $('.temp-disabled').removeClass('temp-disabled');
1933
  $('.connect-button').show();
1934
  $('.step-two').hide();
1935
- $('.connection-status').show().html( wpmdb_i10n.enter_connection_info );
1936
  connection_established = false;
1937
  }
1938
  });
@@ -1958,12 +2100,12 @@ var execute_next_step;
1958
  nonce : wpmdb_nonces.save_setting,
1959
  },
1960
  error: function(jqXHR, textStatus, errorThrown){
1961
- alert( wpmdb_i10n.save_settings_problem );
1962
  $('.ajax-spinner').remove();
1963
  },
1964
  success: function(data){
1965
  $('.ajax-spinner').remove();
1966
- $($label).append('<span class="ajax-success-msg">' + wpmdb_i10n.saved + '</span>');
1967
  $('.ajax-success-msg').fadeOut(2000,function(){
1968
  $(this).remove();
1969
  });
@@ -1993,11 +2135,11 @@ var execute_next_step;
1993
 
1994
  });
1995
 
1996
- $('body').delegate('.try-again','click',function(){
1997
  connection_box_changed();
1998
  });
1999
 
2000
- $('body').delegate('.try-http','click',function(){
2001
  var connection_info = $.trim( $('.pull-push-connection-info').val() ).split("\n");
2002
  var new_url = connection_info[0].replace( 'https', 'http' );
2003
  var new_contents = new_url + "\n" + connection_info[1];
@@ -2009,7 +2151,7 @@ var execute_next_step;
2009
  profile_name_edited = true;
2010
  });
2011
 
2012
- $('body').delegate('.temporarily-disable-ssl','click',function(){
2013
  if(window.location.hash) {
2014
  var hash = window.location.hash.substring(1);
2015
  }
@@ -2032,32 +2174,32 @@ var execute_next_step;
2032
 
2033
  if( connection_info == '' ){
2034
  error = true;
2035
- error_message = wpmdb_i10n.connection_info_missing;
2036
  }
2037
 
2038
  if( connection_info.length != 2 && ! error ){
2039
  error = true;
2040
- error_message = wpmdb_i10n.connection_info_incorrect;
2041
  }
2042
 
2043
  if( ! error && ! validate_url( connection_info[0] ) ){
2044
  error = true;
2045
- error_message = wpmdb_i10n.connection_info_url_invalid;
2046
  }
2047
 
2048
- if( ! error && connection_info[1].length != 32 ){
2049
  error = true;
2050
- error_message = wpmdb_i10n.connection_info_key_invalid;
2051
  }
2052
 
2053
  if( ! error && connection_info[0] == wpmdb_connection_info[0] ){
2054
  error = true;
2055
- error_message = wpmdb_i10n.connection_info_local_url;
2056
  }
2057
 
2058
  if( ! error && connection_info[1] == wpmdb_connection_info[1] ){
2059
  error = true;
2060
- error_message = wpmdb_i10n.connection_info_local_key;
2061
  }
2062
 
2063
  if( error ){
@@ -2089,7 +2231,7 @@ var execute_next_step;
2089
  $('.prefix-notice').hide();
2090
  $('.connection-status').show();
2091
 
2092
- $('.connection-status').html( wpmdb_i10n.establishing_remote_connection );
2093
  $('.connection-status').removeClass( 'notification-message error-notice migration-error' );
2094
  $('.connection-status').append( '<img src="' + spinner_url + '" alt="" class="ajax-spinner general-spinner" />' );
2095
 
@@ -2110,8 +2252,7 @@ var execute_next_step;
2110
  nonce : wpmdb_nonces.verify_connection_to_remote_site,
2111
  },
2112
  error: function(jqXHR, textStatus, errorThrown){
2113
- $('.connection-status').html( wpmdb_i10n.connection_local_server_problem + ' (#100)' );
2114
- $('.connection-status').append( '<br /><br />' + wpmdb_i10n.status + ': ' + jqXHR.status + ' ' + jqXHR.statusText + '<br /><br />' + wpmdb_i10n.response + ':<br />' + jqXHR.responseText );
2115
  $('.connection-status').addClass( 'notification-message error-notice migration-error' );
2116
  $('.ajax-spinner').remove();
2117
  doing_ajax = false;
@@ -2144,13 +2285,14 @@ var execute_next_step;
2144
  $('.step-two').show();
2145
 
2146
  maybe_show_ssl_warning( connection_info[0], connection_info[1], data.scheme );
2147
- maybe_show_version_warning( data.plugin_version, connection_info[0] );
2148
  maybe_show_prefix_notice( data.prefix );
2149
 
2150
  connection_established = true;
2151
  connection_data = data;
2152
  move_connection_info_box();
2153
 
 
 
2154
  var table_select = document.createElement('select');
2155
  $(table_select).attr({
2156
  multiple : 'multiple',
@@ -2214,14 +2356,14 @@ var execute_next_step;
2214
 
2215
  }
2216
 
2217
- $('body').delegate('.pause-resume','click',function(){
2218
  if( true == migration_paused ) {
2219
  migration_paused = false;
2220
  doing_ajax = true;
2221
  $('.progress-title').html(previous_progress_title);
2222
  $('.progress-text').html(previous_progress_text);
2223
  $('.migration-progress-ajax-spinner').show();
2224
- $('.pause-resume').html(wpmdb_i10n.pause);
2225
  // resume the timer
2226
  elapsed_interval = setInterval(count,1000);
2227
  execute_next_step();
@@ -2231,17 +2373,17 @@ var execute_next_step;
2231
  doing_ajax = false;
2232
  previous_progress_title = $('.progress-title').html();
2233
  previous_progress_text = $('.progress-text').html();
2234
- $('.progress-title').html(wpmdb_i10n.migration_paused);
2235
- $('.pause-resume').html(wpmdb_i10n.resume);
2236
- $('.progress-text').html(wpmdb_i10n.completing_current_request);
2237
  }
2238
  });
2239
 
2240
- $('body').delegate('.cancel','click',function(){
2241
  migration_cancelled = true;
2242
  migration_paused = false;
2243
- $('.progress-text').html(wpmdb_i10n.completing_current_request);
2244
- $('.progress-title').html(wpmdb_i10n.cancelling_migration);
2245
  $('.migration-controls').fadeOut();
2246
  $('.migration-progress-ajax-spinner').show();
2247
 
@@ -2260,29 +2402,29 @@ var execute_next_step;
2260
  $('.migration-progress-ajax-spinner').hide();
2261
  // pause the timer
2262
  clearInterval( elapsed_interval );
2263
- $('.progress-text').html(wpmdb_i10n.paused);
2264
  return;
2265
  }
2266
  else if( true == migration_cancelled) {
2267
  migration_intent = $('input[name=action]:checked').val();
2268
 
2269
  if( 'savefile' == migration_intent ) {
2270
- progress_msg = wpmdb_i10n.removing_local_sql;
2271
  }
2272
  else if( 'pull' == migration_intent ) {
2273
  if( 'backup' == stage ) {
2274
- progress_msg = wpmdb_i10n.removing_local_backup;
2275
  }
2276
  else {
2277
- progress_msg = wpmdb_i10n.removing_local_temp_tables;
2278
  }
2279
  }
2280
  else if( 'push' == migration_intent ) {
2281
  if( 'backup' == stage ) {
2282
- progress_msg = wpmdb_i10n.removing_remote_sql;
2283
  }
2284
  else {
2285
- progress_msg = wpmdb_i10n.removing_remote_temp_tables;
2286
  }
2287
  }
2288
  $('.progress-text').html(progress_msg);
@@ -2308,9 +2450,9 @@ var execute_next_step;
2308
  cache: false,
2309
  data: request_data,
2310
  error: function(jqXHR, textStatus, errorThrown){
2311
- $('.progress-title').html(wpmdb_i10n.migration_cancellation_failed);
2312
- $('.progress-text').html(wpmdb_i10n.manually_remove_temp_files);
2313
- $('.progress-text').append( '<br /><br />' + wpmdb_i10n.status + ': ' + jqXHR.status + ' ' + jqXHR.statusText + '<br /><br />' + wpmdb_i10n.response + ':<br />' + jqXHR.responseText );
2314
  $('.progress-text').addClass( 'migration-error' );
2315
  console.log( jqXHR );
2316
  console.log( textStatus );
@@ -2323,14 +2465,14 @@ var execute_next_step;
2323
  doing_ajax = false;
2324
  data = $.trim( data );
2325
  if( data != '' ){
2326
- $('.progress-title').html(wpmdb_i10n.migration_cancellation_failed);
2327
  $('.progress-text').html(data);
2328
  $('.progress-text').addClass('migration-error');
2329
  migration_error = true;
2330
  migration_complete_events();
2331
  return;
2332
  }
2333
- completed_msg = wpmdb_i10n.migration_cancelled;
2334
  $('.progress-text').hide();
2335
  migration_complete_events();
2336
  }
@@ -2341,6 +2483,105 @@ var execute_next_step;
2341
  }
2342
  }
2343
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2344
  });
2345
 
2346
- })(jQuery);
22
  var currently_migrating = false;
23
  var dump_filename = '';
24
  var dump_url = '';
25
+ var db_version = '';
26
  var migration_intent;
27
  var remote_site;
28
  var secret_key;
37
  var timer_count;
38
  var overall_percent;
39
  var migration_cancelled = false;
40
+ var site_url = '';
41
+ var find_replace_pairs;
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';
54
 
55
  // For IE and Firefox prior to version 4
56
  if (e) {
57
+ e.returnValue = wpmdb_strings.sure;
58
  }
59
 
60
  // For Safari
61
+ return wpmdb_strings.sure;
62
  }
63
  };
64
 
76
  function setup_counter() {
77
  timer_count = 0,
78
  counter_display = $('.timer'),
79
+ label = wpmdb_strings.time_elapsed + ' ';
80
 
81
  elapsed_interval = setInterval(count,1000);
82
  }
129
  return;
130
  }
131
 
 
 
 
 
 
 
 
 
 
 
132
  function maybe_show_prefix_notice( prefix ) {
133
  if( prefix != wpmdb_this_prefix ) {
134
  $('.remote-prefix').html( prefix );
142
  }
143
  }
144
 
145
+ function maybe_show_mixed_cased_table_name_warning() {
146
+ if ( 'undefined' == typeof connection_data || false == connection_data ) {
147
+ return;
148
+ }
149
+
150
+ var migration_intent = $( 'input[name=action]:checked' ).val();
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' == table_intent ) {
157
+ tables_to_migrate = $( '#select-tables' ).val();
158
+ } else {
159
+ if ( 'push' == migration_intent || 'savefile' == migration_intent ) {
160
+ tables_to_migrate = wpmdb_this_prefixed_tables;
161
+ } else {
162
+ tables_to_migrate = connection_data.prefixed_tables;
163
+ }
164
+ }
165
+
166
+ if ( null === tables_to_migrate ) {
167
+ return;
168
+ }
169
+
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 == tables_to_migrate.toLowerCase() ) {
174
+ return;
175
+ }
176
+
177
+ /*
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' != connection_data.lower_case_table_names && ( 'push' == migration_intent || 'savefile' == migration_intent ) ) {
182
+ return;
183
+ }
184
+
185
+ /*
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' != wpmdb_lower_case_table_names && 'pull' == migration_intent ) {
190
+ return;
191
+ }
192
+
193
+ /*
194
+ * At this stage we've determined:
195
+ * 1. The source database contains at least one table that contains an uppercase character.
196
+ * 2. The destination environment has lower_case_table_names set to 1.
197
+ * 3. The source database table containing the uppercase letter will be converted to lowercase during the migration.
198
+ */
199
+
200
+ if ( 'push' == migration_intent || 'savefile' == migration_intent ) {
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.','');
214
  var domain = get_domain_name(url);
215
  var migrating_stage_label, completed_stage_label;
216
  if ( intent == 'pull' ) {
217
+ migrating_stage_label = wpmdb_strings.pull_migration_label_migrating;
218
+ completed_stage_label = wpmdb_strings.pull_migration_label_completed;
219
  } else {
220
+ migrating_stage_label = wpmdb_strings.push_migration_label_migrating;
221
+ completed_stage_label = wpmdb_strings.push_migration_label_completed;
222
  }
223
 
224
  migrating_stage_label = migrating_stage_label.replace( '%s', domain );
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
  $(document).ready(function() {
253
 
254
  $('#plugin-compatibility').change(function(e){
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);
281
  install : 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');
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
  });
341
  error: function(jqXHR, textStatus, errorThrown){
342
  $('.slider').slider('enable');
343
  $('.slider-spinner').remove();
344
+ alert( wpmdb_strings.max_request_size_problem );
345
  },
346
  success: function(data){
347
  $('.slider').slider('enable');
399
  nonce : wpmdb_nonces.check_licence,
400
  },
401
  error: function(jqXHR, textStatus, errorThrown){
402
+ alert( wpmdb_strings.license_check_problem );
403
  },
404
  success: function(data){
405
+ if ( typeof data.dbrains_api_down !== 'undefined' ) {
406
+ $('.support-content').empty().html( data.dbrains_api_down + data.message );
407
+ $('.addons-content').empty().html( data.dbrains_api_down );
408
+ }
409
+ else if ( typeof data.errors !== 'undefined') {
410
  var msg = '';
411
  for (var key in data.errors) {
412
  msg += data.errors[key];
422
  });
423
  }
424
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
425
  // automatically validate connnection info if we're loading a saved profile
426
  establish_remote_connection_from_saved_profile();
427
 
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( '<img src="' + spinner_url + '" alt="" class="ajax-spinner general-spinner" />' );
443
 
458
  profile : wpmdb_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;
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');
493
  connection_data = data;
494
  move_connection_info_box();
495
 
496
+ maybe_show_mixed_cased_table_name_warning();
497
+
498
  var loaded_tables = '';
499
  if( wpmdb_default_profile == false && typeof wpmdb_loaded_tables != 'undefined' ){
500
  loaded_tables = wpmdb_loaded_tables;
596
  }
597
 
598
  $.wpmdb.do_action( 'verify_connection_to_remote_site', connection_data );
 
599
  }
600
 
601
  });
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();
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
 
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;
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
  });
699
  nonce : wpmdb_nonces.clear_log,
700
  },
701
  error: function(jqXHR, textStatus, errorThrown){
702
+ alert( wpmdb_strings.clear_log_problem );
703
  },
704
  success: function(data){
705
  }
718
  nonce : wpmdb_nonces.get_log,
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);
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', ! $(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
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(){
830
 
831
  // check that they've selected some tables to migrate
832
  if( $('#migrate-selected').is(':checked') && $('#select-tables').val() == null ){
833
+ alert( wpmdb_strings.please_select_one_table );
834
  return;
835
  }
836
 
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
  }
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){
939
 
940
  $('#overlay').after($progress_content);
941
 
942
+ completed_msg = wpmdb_strings.exporting_complete;
943
 
944
  if( migration_intent == 'savefile' ){
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');
1090
  nonce : wpmdb_nonces.initiate_migration,
1091
  },
1092
  error: function(jqXHR, textStatus, errorThrown){
1093
+ $('.progress-title').html(wpmdb_strings.migration_failed);
1094
+ $('.progress-text').html( getAjaxErrors( jqXHR.responseText, '(#112)', jqXHR ) );
 
1095
  $('.progress-text').addClass( 'migration-error' );
1096
  console.log( jqXHR );
1097
  console.log( textStatus );
1104
  if( typeof data.wpmdb_error != 'undefined' && data.wpmdb_error == 1 ){
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
  dump_url = data.dump_url;
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;
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 );
1176
  }
1177
 
1178
  if( stage == 'backup' ){
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;
1193
  }
1194
 
1195
  var request_data = {
1196
+ action : 'wpmdb_migrate_table',
1197
+ intent : migration_intent,
1198
+ url : remote_site,
1199
+ key : secret_key,
1200
+ table : tables_to_migrate[i],
1201
+ db_version : db_version,
1202
+ form_data : form_data,
1203
+ stage : stage,
1204
+ current_row : current_row,
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 != 'savefile' ) {
1231
  timeout: 0,
1232
  data: request_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 );
1248
  data = $.trim( data );
1249
  row_information = wpmdb_parse_json( data );
1250
  if( false == row_information || null == row_information ){
1251
+ $('.progress-title').html(wpmdb_strings.migration_failed);
1252
  if( '' == data || null == data ) {
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;
1262
  }
1263
 
1264
  if( typeof row_information.wpmdb_error != 'undefined' && row_information.wpmdb_error == 1 ){
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;
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();
1346
  $('.migration-controls').fadeOut();
1347
  if( migration_intent == 'savefile' ){
1348
  currently_migrating = false;
1349
+ var migrate_complete_text = wpmdb_strings.migration_complete;
1350
  if( $('#save_computer').is(':checked') ){
1351
  var url = wpmdb_this_download_url + encodeURIComponent( dump_filename );
1352
  if( $('#gzip_file').is(':checked') ){
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 == false ){
1366
 
1367
  }
1368
  else{ // rename temp tables, delete old tables
1369
+ $('.progress-text').html( wpmdb_strings.finalizing_migration );
1370
  $.ajax({
1371
  url: ajaxurl,
1372
  type: 'POST',
1384
  nonce : wpmdb_nonces.finalize_migration,
1385
  },
1386
  error: function(jqXHR, textStatus, errorThrown){
1387
+ $('.progress-title').html( wpmdb_strings.migration_failed );
1388
+ $('.progress-text').html( wpmdb_strings.finalize_tables_problem );
1389
  $('.progress-text').addClass('migration-error');
1390
  alert( jqXHR + ' : ' + textStatus + ' : ' + errorThrown );
1391
  migration_error = true;
1394
  },
1395
  success: function(data){
1396
  if( $.trim( data ) != '' ){
1397
+ $('.progress-title').html( wpmdb_strings.migration_failed );
1398
  $('.progress-text').html(data);
1399
  $('.progress-text').addClass('migration-error');
1400
  migration_error = true;
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 == true ){
1419
  hide_overlay();
1420
  }
1438
 
1439
  // check that they've selected some tables to migrate
1440
  if( $('#migrate-selected').is(':checked') && $('#select-tables').val() == null ){
1441
+ alert( wpmdb_strings.please_select_one_table );
1442
  return;
1443
  }
1444
 
1445
  if( $.trim( $('.create-new-profile').val() ) == '' && $('#create_new').is(':checked') ){
1446
+ alert( wpmdb_strings.enter_name_for_profile );
1447
  $('.create-new-profile').focus();
1448
  return;
1449
  }
1472
  nonce : wpmdb_nonces.save_profile,
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
  });
1484
  success: function(data){
1485
  $('.save-settings-button').removeAttr('disabled');
1486
  $('.save-profile-ajax-spinner').remove();
1487
+ $('.save-settings-button').after('<span class="ajax-success-msg">' + wpmdb_strings.saved + '</span>');
1488
  $('.ajax-success-msg').fadeOut(2000,function(){
1489
  $(this).remove();
1490
  });
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 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"></label></li>');
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
  }
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;
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
  }
1550
  $('#create-backup').removeAttr('disabled');
1551
  $('#create-backup-label').removeClass('disabled');
1552
  $('.backup-option-disabled').hide();
1553
+ $('.directory-scope').hide();
1554
+ $('.compatibility-older-mysql').hide();
1555
  var connection_info = $.trim( $('.pull-push-connection-info').val() ).split("\n");
1556
  if( $('#pull').is(':checked') ){
1557
  $('.pull-list li').append( connection_info_box );
1575
  $('.different-plugin-version-notice').show();
1576
  $('.step-two').hide();
1577
  }
1578
+ $('.directory-scope.pull').show();
1579
  if( false == wpmdb_write_permission ) {
1580
  $('#create-backup').prop('checked',false);
1581
  $('#create-backup').attr('disabled','disabled');
1611
  $('.different-plugin-version-notice').show();
1612
  $('.step-two').hide();
1613
  }
1614
+ $('.directory-scope.push').show();
1615
  if( '0' == connection_data.write_permissions ) {
1616
  $('#create-backup').prop('checked',false);
1617
  $('#create-backup').attr('disabled','disabled');
1629
  $('.connection-status').hide();
1630
  $('.step-two').show();
1631
  $('.table-prefix').html(wpmdb_this_prefix);
1632
+ $('.compatibility-older-mysql').show();
1633
  if( profile_name_edited == false ){
1634
  $('.create-new-profile').val('');
1635
  }
1640
  $('.step-two').hide();
1641
  }
1642
  }
1643
+ maybe_show_mixed_cased_table_name_warning();
1644
  $.wpmdb.do_action( 'move_connection_info_box' );
1645
  }
1646
 
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
 
1720
  e.stopPropagation();
1721
  });
1722
 
1723
+ $('body').on('click', '.show-errors-toggle', function (e) {
1724
+ e.preventDefault();
1725
+ $(this).next('.migration-php-errors').toggle();
1726
+ });
1727
+
1728
+ /**
1729
+ * Core plugin wrapper for the common AJAX error detecting method
1730
+ *
1731
+ * @param text
1732
+ * @param code
1733
+ * @param jqXHR
1734
+ *
1735
+ * @returns {string}
1736
+ */
1737
+ function getAjaxErrors( text, code, jqXHR ) {
1738
+ return wpmdbGetAjaxErrors( wpmdb_strings.connection_local_server_problem, code, text, jqXHR );
1739
+ }
1740
+
1741
  // migrate / settings tabs
1742
  $('.nav-tab').click(function(){
1743
  $('.nav-tab').removeClass('nav-tab-active');
1768
 
1769
  });
1770
 
1771
+ $('body').on('click', "a[href^='#']", function(event) {
1772
+ var href = $(event.target).attr('href');
1773
+ var tab_name = href.substr(1);
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' == prev_id || 'new-path' == prev_id ) {
1798
+ $('#' + prev_id + '-missing-warning').hide();
1799
+ }
1800
  });
1801
 
1802
  $('.add-replace').click(function(){
1806
 
1807
  $
1808
 
1809
+ $('body').on('mouseenter mouseleave', '#find-and-replace-sort tbody tr.replace-row', function(event) {
1810
  if( event.type === 'mouseenter' ){
1811
  $('.replace-remove-row', this).show();
1812
  }
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
  }
1878
  }
1879
  }
1880
 
1881
+ // process notice links clicks, eg. dismiss, reminder
1882
+ $('.notice-link').click(function (e) {
1883
+ e.preventDefault();
1884
+ $(this).closest('.inline-message').hide()
1885
+ $.ajax({
1886
+ url : ajaxurl,
1887
+ type : 'POST',
1888
+ dataType: 'text',
1889
+ cache : false,
1890
+ data : {
1891
+ action : 'wpmdb_process_notice_link',
1892
+ nonce : wpmdb_nonces.process_notice_link,
1893
+ notice : $(this).data('notice'),
1894
+ type : $(this).data('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;
1918
  nonce : wpmdb_nonces.reset_api_key,
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
  },
1976
  blacklist_plugins : $(select_element).val(),
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;
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
  var name = $.trim($(name).html());
2004
+ var answer = confirm( wpmdb_strings.remove_profile + ' "' + name + '"' );
2005
 
2006
  if(!answer){
2007
  return;
2020
  nonce : wpmdb_nonces.delete_migration_profile,
2021
  },
2022
  error: function(jqXHR, textStatus, errorThrown){
2023
+ alert( wpmdb_strings.remove_profile_problem );
2024
  },
2025
  success: function(data){
2026
  if( data == '-1' ){
2027
+ alert( wpmdb_strings.remove_profile_not_found );
2028
  }
2029
  }
2030
  });
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 + ' "' + name + '"' );
2038
 
2039
  if(!answer){
2040
  return;
2053
  nonce : wpmdb_nonces.delete_migration_profile,
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;
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
  });
2100
  nonce : wpmdb_nonces.save_setting,
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
  });
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];
2151
  profile_name_edited = true;
2152
  });
2153
 
2154
+ $('body').on('click', '.temporarily-disable-ssl', function(){
2155
  if(window.location.hash) {
2156
  var hash = window.location.hash.substring(1);
2157
  }
2174
 
2175
  if( connection_info == '' ){
2176
  error = true;
2177
+ error_message = wpmdb_strings.connection_info_missing;
2178
  }
2179
 
2180
  if( connection_info.length != 2 && ! error ){
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] == wpmdb_connection_info[0] ){
2196
  error = true;
2197
+ error_message = wpmdb_strings.connection_info_local_url;
2198
  }
2199
 
2200
  if( ! error && connection_info[1] == wpmdb_connection_info[1] ){
2201
  error = true;
2202
+ error_message = wpmdb_strings.connection_info_local_key;
2203
  }
2204
 
2205
  if( error ){
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( '<img src="' + spinner_url + '" alt="" class="ajax-spinner general-spinner" />' );
2237
 
2252
  nonce : wpmdb_nonces.verify_connection_to_remote_site,
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;
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
  var table_select = document.createElement('select');
2297
  $(table_select).attr({
2298
  multiple : 'multiple',
2356
 
2357
  }
2358
 
2359
+ $('body').on('click', '.pause-resume', function(){
2360
  if( true == migration_paused ) {
2361
  migration_paused = false;
2362
  doing_ajax = true;
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();
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
+ $('body').on('click', '.cancel', function(){
2383
  migration_cancelled = true;
2384
  migration_paused = false;
2385
+ $('.progress-text').html(wpmdb_strings.completing_current_request);
2386
+ $('.progress-title').html(wpmdb_strings.cancelling_migration);
2387
  $('.migration-controls').fadeOut();
2388
  $('.migration-progress-ajax-spinner').show();
2389
 
2402
  $('.migration-progress-ajax-spinner').hide();
2403
  // pause the timer
2404
  clearInterval( elapsed_interval );
2405
+ $('.progress-text').html(wpmdb_strings.paused);
2406
  return;
2407
  }
2408
  else if( true == migration_cancelled) {
2409
  migration_intent = $('input[name=action]:checked').val();
2410
 
2411
  if( 'savefile' == migration_intent ) {
2412
+ progress_msg = wpmdb_strings.removing_local_sql;
2413
  }
2414
  else if( 'pull' == migration_intent ) {
2415
  if( 'backup' == stage ) {
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' == migration_intent ) {
2423
  if( 'backup' == stage ) {
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);
2450
  cache: false,
2451
  data: request_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 );
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
  }
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( '<img src="' + spinner_url + '" alt="" class="ajax-spinner general-spinner" />' );
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: ajaxurl,
2498
+ type: 'POST',
2499
+ dataType: 'json',
2500
+ cache: false,
2501
+ data: {
2502
+ action : 'wpmdb_copy_licence_to_remote_site',
2503
+ url : connection_info[0],
2504
+ key : connection_info[1],
2505
+ nonce : wpmdb_nonces.copy_licence_to_remote_site,
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 != 'undefined' && data.wpmdb_error == 1 ){
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( '<img src="' + spinner_url + '" alt="" class="ajax-spinner general-spinner" />' );
2539
+
2540
+ $.ajax({
2541
+ url: ajaxurl,
2542
+ type: 'POST',
2543
+ dataType: 'json',
2544
+ cache: false,
2545
+ data: {
2546
+ action : 'wpmdb_reactivate_licence',
2547
+ nonce : wpmdb_nonces.reactivate_licence,
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 != 'undefined' && data.wpmdb_error == 1 ){
2560
+ $('.invalid-licence').html( data.body );
2561
+ return;
2562
+ }
2563
+
2564
+ if( typeof data.wpmdb_dbrains_api_down != 'undefined' && data.wpmdb_dbrains_api_down == 1 ) {
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);
asset/js/script.min.js CHANGED
@@ -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(){w=0,counter_display=a(".timer"),label=wpmdb_i10n.time_elapsed+" ",s=setInterval(e,1e3)}function d(){hours=Math.floor(w/3600)%24,minutes=Math.floor(w/60)%60,seconds=w%60;var a=label+b(hours,2,0)+":"+b(minutes,2,0)+":"+b(seconds,2,0);counter_display.html(a)}function e(){w+=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(),I=!0,b=b.replace("https","http"),void a(".pull-push-connection-info").val(b+"\n"+c)):void(I=!1)}function i(b,c){"undefined"!=typeof b&&b!=wpmdb_plugin_version&&(a(".different-plugin-version-notice").show(),a(".remote-version").html(b),a(".remote-location").html(c),a(".step-two").hide(),J=!0)}function j(b){b!=wpmdb_this_prefix&&(a(".remote-prefix").html(b),H=!0,a("#pull").is(":checked")?a(".prefix-notice.pull").show():a(".prefix-notice.push").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_i10n.pull_migration_label_migrating,e=wpmdb_i10n.pull_migration_label_completed):(d=wpmdb_i10n.push_migration_label_migrating,e=wpmdb_i10n.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,"")}var n,o,p,q,r,s,t,u,v,w,x,y=!1,z="",A=!1,B=!1,C=!1,D=!1,E=!1,F=!1,G=!1,H=!1,I=!1,J=!1,K=!1,L=!1,M="",N="",O="",P=!1,Q=!1,R=ajaxurl.replace("/admin-ajax.php",""),S=R+"/images/wpspin_light";window.devicePixelRatio>=2&&(S+="-2x"),S+=".gif",window.onbeforeunload=function(a){return L?(a=a||window.event,a&&(a.returnValue=wpmdb_i10n.sure),wpmdb_i10n.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_i10n.license_check_problem)},success:function(b){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(){a(".option-group").each(function(){a("input",this).attr("disabled","disabled"),a("label",this).css("cursor","default")})}function w(){a(".option-group").each(function(){a("input",this).removeAttr("disabled"),a("label",this).css("cursor","pointer")})}function R(){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&&!A&&wpmdb_is_pro){z=b,A=!0,d(),a(".connection-status").html(wpmdb_i10n.establishing_remote_connection),a(".connection-status").removeClass("notification-message error-notice migration-error"),a(".connection-status").append('<img src="'+S+'" alt="" class="ajax-spinner general-spinner" />');var e=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:e,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(wpmdb_i10n.connection_local_server_problem+" (#102)"),a(".connection-status").append("<br /><br />"+wpmdb_i10n.status+": "+b.status+" "+b.statusText+"<br /><br />"+wpmdb_i10n.response+"<br />"+b.responseText),a(".connection-status").addClass("notification-message error-notice migration-error"),a(".ajax-spinner").remove(),A=!1,w()},success:function(b){if(a(".ajax-spinner").remove(),A=!1,w(),"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.plugin_version,c[0]),j(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(),y=!0,connection_data=b,V();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>")}),ab=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>")}),cb=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>")}),db=l,a("#pull").is(":checked")?(a("#select-tables").remove(),a(".select-tables-wrap").prepend(ab),a("#select-post-types").remove(),a(".select-post-types-wrap").prepend(cb),a("#select-backup").remove(),a(".backup-tables-wrap").prepend(eb),a(".table-prefix").html(b.prefix),a(".uploads-dir").html(wpmdb_this_uploads_dir)):(a("#select-backup").remove(),a(".backup-tables-wrap").prepend(db)),a.wpmdb.do_action("verify_connection_to_remote_site",connection_data)}})}}function T(){a.ajax({url:ajaxurl,type:"POST",dataType:"text",cache:!1,data:{action:"wpmdb_get_log",nonce:wpmdb_nonces.get_log},error:function(){alert(wpmdb_i10n.update_log_problem)},success:function(b){a(".debug-log-textarea").val(b)}})}function U(){var b=a(".progress-content").outerHeight();a(".progress-content").animate({top:"-"+b+"px"},400,"swing",function(){a("#overlay").remove(),a(".progress-content").remove()}),K=!1}function V(){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.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(),y){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==F){var b=k(connection_data.url);a(".create-new-profile").val(b)}1==H&&a(".prefix-notice.pull").show(),1==I&&a(".ssl-notice").show(),1==J&&(a(".different-plugin-version-notice").show(),a(".step-two").hide()),a(".directory-scope").html("local"),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(),y){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==F){var b=k(connection_data.url);a(".create-new-profile").val(b)}1==H&&a(".prefix-notice.push").show(),1==I&&a(".ssl-notice").show(),1==J&&(a(".different-plugin-version-notice").show(),a(".step-two").hide()),a(".directory-scope").html("remote"),"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),0==F&&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()));a.wpmdb.do_action("move_connection_info_box")}function W(){a("#push").is(":checked")||a("#savefile").is(":checked")?((""==z||"pull"==z)&&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(_),a("#select-post-types").remove(),a(".select-post-types-wrap").prepend(bb),a("#select-backup").remove(),a(".backup-tables-wrap").prepend(db),z="push"):a("#pull").is(":checked")&&((""==z||"push"==z)&&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(ab),a("#select-post-types").remove(),a(".select-post-types-wrap").prepend(cb),a("#select-backup").remove(),a(".backup-tables-wrap").prepend(eb),z="pull")}function X(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 Y(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&&(T(),"1"==wpmdb_has_licence&&(a(".support-content p").append('<img src="'+S+'" alt="" class="ajax-spinner general-spinner" />'),b(),G=!0)),"addons"==c&&1!=d&&"1"==wpmdb_has_licence&&(a(".addons-content p").append('<img src="'+S+'" alt="" class="ajax-spinner general-spinner" />'),b(),G=!0)}function Z(b){var c=a(".pull-push-connection-info");if(!A&&!a(c).hasClass("temp-disabled")){var b=a(".pull-push-connection-info").val(),e=a.trim(b).split("\n"),f=!1,g="";if(""==e&&(f=!0,g=wpmdb_i10n.connection_info_missing),2==e.length||f||(f=!0,g=wpmdb_i10n.connection_info_incorrect),f||X(e[0])||(f=!0,g=wpmdb_i10n.connection_info_url_invalid),f||32==e[1].length||(f=!0,g=wpmdb_i10n.connection_info_key_invalid),f||e[0]!=wpmdb_connection_info[0]||(f=!0,g=wpmdb_i10n.connection_info_local_url),f||e[1]!=wpmdb_connection_info[1]||(f=!0,g=wpmdb_i10n.connection_info_local_key),f)return a(".connection-status").html(g),void a(".connection-status").addClass("notification-message error-notice migration-error");if(0==wpmdb_openssl_available){e[0]=e[0].replace("https://","http://");var l=e[0]+"\n"+e[1];a(".pull-push-connection-info").val(l)}if(H=!1,A=!0,d(),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()))+"@");var 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_i10n.establishing_remote_connection),a(".connection-status").removeClass("notification-message error-notice migration-error"),a(".connection-status").append('<img src="'+S+'" alt="" class="ajax-spinner general-spinner" />');var n=a("input[name=action]:checked").val();F=!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:n,nonce:wpmdb_nonces.verify_connection_to_remote_site},error:function(b){a(".connection-status").html(wpmdb_i10n.connection_local_server_problem+" (#100)"),a(".connection-status").append("<br /><br />"+wpmdb_i10n.status+": "+b.status+" "+b.statusText+"<br /><br />"+wpmdb_i10n.response+":<br />"+b.responseText),a(".connection-status").addClass("notification-message error-notice migration-error"),a(".ajax-spinner").remove(),A=!1,w()},success:function(b){if(a(".ajax-spinner").remove(),A=!1,w(),"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(e[0],e[1],b.scheme),i(b.plugin_version,e[0]),j(b.prefix),y=!0,connection_data=b,V();var d=document.createElement("select");a(d).attr({multiple:"multiple",name:"select_tables[]",id:"select-tables","class":"multiselect"}),a.each(connection_data.tables,function(b,c){a(d).append('<option value="'+c+'">'+c+" ("+connection_data.table_sizes_hr[c]+")</option>")}),ab=d,db=a(d).clone(),a(db).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>")}),cb=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(ab),a("#select-post-types").remove(),a(".select-post-types-wrap").prepend(cb),a(".table-prefix").html(b.prefix),a(".uploads-dir").html(wpmdb_this_uploads_dir)):(a("#select-backup").remove(),a(".backup-tables-wrap").prepend(db),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_i10n.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="'+S+'" 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_i10n.plugin_compatibility_settings_problem+"\r\n\r\n"+wpmdb_i10n.status+" "+b.status+" "+b.statusText+"\r\n\r\n"+wpmdb_i10n.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_i10n.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="'+S+'" 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_i10n.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 $=a(".progress-content").clone();a(".progress-content").remove();var _=a("#select-tables").clone(),ab=a("#select-tables").clone(),bb=a("#select-post-types").clone(),cb=a("#select-post-types").clone(),db=a("#select-backup").clone(),eb=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()),R(),a(".js-action-link").click(function(b){b.preventDefault(),a(this).blur()}),a(".licence-form").submit(function(c){if(c.preventDefault(),!B){a(".licence-status").removeClass("notification-message error-notice success-notice");var d=a.trim(a(".licence-input").val());if(""==d)return a(".licence-status").addClass("notification-message error-notice"),void a(".licence-status").html(wpmdb_i10n.enter_license_key);a(".licence-status").empty().removeClass("success"),B=!0,a(".button.register-licence").after('<img src="'+S+'" 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:d,nonce:wpmdb_nonces.activate_licence},error:function(){B=!1,a(".register-licence-ajax-spinner").remove(),a(".licence-status").html(wpmdb_i10n.register_license_problem)},success:function(c){if(B=!1,a(".register-licence-ajax-spinner").remove(),"undefined"!=typeof c.errors){var e="";for(var f in c.errors)e+=c.errors[f];a(".licence-status").html(e)}else"undefined"!=typeof c.wpmdb_error&&"undefined"!=typeof c.body?a(".licence-status").html(c.body):(a(".licence-input, .register-licence").remove(),a(".licence-not-entered").prepend(c.masked_licence),a(".licence-status").html(wpmdb_i10n.license_registered).delay(5e3).fadeOut(1e3),a(".licence-status").addClass("success notification-message success-notice"),a(".support-content").empty().html("<p>"+wpmdb_i10n.fetching_license+'<img src="'+S+'" alt="" class="ajax-spinner general-spinner" /></p>'),b(d),a(".invalid-licence").hide(),a(".migrate-selection label").removeClass("disabled"),a(".migrate-selection input").removeAttr("disabled"))}})}}),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_i10n.clear_log_problem)},success:function(){}})}),a(".multiselect-select-all").click(function(){var b=a(this).parents(".select-wrap").children(".multiselect");a(b).focus(),a("option",b).attr("selected",1)}),a(".multiselect-deselect-all").click(function(){var b=a(this).parents(".select-wrap").children(".multiselect");a(b).focus(),a("option",b).removeAttr("selected")}),a(".multiselect-invert-selection").click(function(){var b=a(this).parents(".select-wrap").children(".multiselect");a(b).focus(),a("option",b).each(function(){a(this).attr("selected",!a(this).attr("selected"))})}),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_i10n.migrate_db_save)):(a(".save-settings-button").hide(),a(".migrate-db .button-primary").val(wpmdb_i10n.migrate_db))}),a("#save-migration-profile").is(":checked")&&(a(".save-settings-button").show(),a(".migrate-db .button-primary").val(wpmdb_i10n.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_i10n.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_i10n.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_i10n.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("")}}})}q=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=$.clone(),n=a("input[name=action]:checked").val(),r="backup","savefile"==n&&(r="migrate"),0==a("#create-backup").is(":checked")&&(r="migrate");var i=a("input[name=table_migrate_option]:checked").val(),j=a.trim(a(".pull-push-connection-info").val()).split("\n"),k="";o=j[0],p=j[1];var m="";a("#overlay").after($progress_content),t=wpmdb_i10n.exporting_complete,"savefile"==n?m=wpmdb_i10n.exporting_please_wait:(m=l(o,n,"migrating"),t=l(o,n,"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"==r?("migrate_only_with_prefix"==table_option&&"backup_selected"==backup_option&&(backup_option="backup_only_with_prefix"),"push"==n?(k=connection_data.table_rows,"backup_only_with_prefix"==backup_option?O=connection_data.prefixed_tables:"backup_selected"==backup_option?(selected_tables=a("#select-tables").val(),O=f(selected_tables,connection_data.tables)):"backup_manual_select"==backup_option&&(O=a("#select-backup").val())):(k=wpmdb_this_table_rows,"backup_only_with_prefix"==backup_option?O=wpmdb_this_prefixed_tables:"backup_selected"==backup_option?(selected_tables=a("#select-tables").val(),O=f(selected_tables,wpmdb_this_tables)):"backup_manual_select"==backup_option&&(O=a("#select-backup").val()))):"migrate_select"==i?(O=a("#select-tables").val(),k="push"==n||"savefile"==n?wpmdb_this_table_rows:connection_data.table_rows):"push"==n||"savefile"==n?(O=wpmdb_this_prefixed_tables,k=wpmdb_this_table_rows):(O=connection_data.prefixed_tables,k=connection_data.table_rows),table_details=d(O,k),k=table_details[0],total_size=table_details[1],a(".progress-title").after('<img src="'+S+'" alt="" class="migration-progress-ajax-spinner general-spinner" />');var s=a(".progress-content").outerHeight();a(".progress-content").css("top","-"+s+"px").show().animate({top:"0px"}),c(),L=!0,a.ajax({url:ajaxurl,type:"POST",dataType:"json",cache:!1,data:{action:"wpmdb_initiate_migration",intent:n,url:o,key:p,form_data:q,stage:r,nonce:wpmdb_nonces.initiate_migration},error:function(b,c,d){a(".progress-title").html(wpmdb_i10n.migration_failed),a(".progress-text").html(wpmdb_i10n.connection_local_server_problem+" (#112)"),a(".progress-text").append("<br /><br />"+wpmdb_i10n.status+": "+b.status+" "+b.statusText+"<br /><br />"+wpmdb_i10n.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){if("undefined"!=typeof b.wpmdb_error&&1==b.wpmdb_error)return migration_error=!0,migration_complete_events(),a(".progress-title").html(wpmdb_i10n.migration_failed),a(".progress-text").addClass("migration-error"),void a(".progress-text").html(b.body);N=b.dump_url,M=b.dump_filename;var c=0,e=0;x=0;var f=0,g=0,h=0,j=0;migrate_table_recursive=function(b,l){if(c>=O.length){if("backup"!=r)return 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();r="migrate",c=0,e=0,a(".progress-bar").width("0px"),"migrate_select"==i?(O=a("#select-tables").val(),k="push"==n||"savefile"==n?wpmdb_this_table_rows:connection_data.table_rows):"push"==n||"savefile"==n?(O=wpmdb_this_prefixed_tables,k=wpmdb_this_table_rows):(O=connection_data.prefixed_tables,k=connection_data.table_rows),a(".progress-tables").empty(),a(".progress-tables-hover-boxes").empty(),table_details=d(O,k),k=table_details[0],total_size=table_details[1]}a(".progress-text").html("backup"==r?x+"% - "+wpmdb_i10n.backing_up+' "'+O[c]+'"':x+"% - "+wpmdb_i10n.migrating+' "'+O[c]+'"'),last_table=0,c==O.length-1&&(last_table=1),gzip=0,"savefile"!=n&&1==parseInt(connection_data.gzip)&&(gzip=1);var m={action:"wpmdb_migrate_table",intent:n,url:o,key:p,table:O[c],form_data:q,stage:r,current_row:b,dump_filename:M,last_table:last_table,primary_keys:l,gzip:gzip,nonce:wpmdb_nonces.migrate_table};"savefile"!=n&&(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),A=!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_i10n.migration_failed),a(".progress-text").html(wpmdb_i10n.table_process_problem+" "+O[c]),a(".progress-text").append("<br /><br />"+wpmdb_i10n.status+": "+b.status+" "+b.statusText+"<br /><br />"+wpmdb_i10n.response+":<br />"+b.responseText),a(".progress-text").addClass("migration-error"),A=!1,console.log(b),console.log(d),console.log(e),migration_error=!0,migration_complete_events()},success:function(b){if(A=!1,b=a.trim(b),row_information=wpmdb_parse_json(b),0==row_information||null==row_information)return a(".progress-title").html(wpmdb_i10n.migration_failed),a(".progress-text").html(""==b||null==b?wpmdb_i10n.table_process_problem_empty_response+" "+O[c]:b),a(".progress-text").addClass("migration-error"),migration_error=!0,void migration_complete_events();if("undefined"!=typeof row_information.wpmdb_error&&1==row_information.wpmdb_error)return a(".progress-title").html(wpmdb_i10n.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[O[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);
2
- var d=100*e/total_size;a(".progress-bar").width(d+"%"),x=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"!=n&&1==a("#save_computer").is(":checked")&&a(".progress-text").css("visibility","hidden"),a(".progress-title").html(t).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_i10n.completed_with_some_errors)),a(".progress-bar-wrapper").hide()),a(".migration-controls").hide(),hooks=[],call_stack=[],migration_error=!1,L=!1,K=!0,P=!1,Q=!1,A=!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(s)},migration_complete=function(){if(a(".migration-controls").fadeOut(),"savefile"==n){L=!1;var b=wpmdb_i10n.migration_complete;if(a("#save_computer").is(":checked")){var c=wpmdb_this_download_url+encodeURIComponent(M);a("#gzip_file").is(":checked")&&(c+="&gzip=1"),window.location=c}else b=wpmdb_i10n.completed_dump_located_at+' <a href="'+N+'">'+N+"</a>.";0==migration_error&&(a(".progress-text").html(b),migration_complete_events(),a(".progress-title").html(t))}else a(".progress-text").html(wpmdb_i10n.finalizing_migration),a.ajax({url:ajaxurl,type:"POST",dataType:"text",cache:!1,data:{action:"wpmdb_finalize_migration",intent:n,url:o,key:p,form_data:q,prefix:connection_data.prefix,temp_prefix:connection_data.temp_prefix,tables:O.join(","),nonce:wpmdb_nonces.finalize_migration},error:function(b,c,d){a(".progress-title").html(wpmdb_i10n.migration_failed),a(".progress-text").html(wpmdb_i10n.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_i10n.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").delegate(".close-progress-content-button","click",function(){U()}),a("body").delegate("#overlay","click",function(){1==K&&U()}),a(".save-settings-button").click(function(b){var c;if(a(this).blur(),b.preventDefault(),!D){if(a("#migrate-selected").is(":checked")&&null==a("#select-tables").val())return void alert(wpmdb_i10n.please_select_one_table);if(""==a.trim(a(".create-new-profile").val())&&a("#create_new").is(":checked"))return alert(wpmdb_i10n.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();D=!0,c=a("#migrate-form").serialize(),a(".save-settings-button").after('<img src="'+S+'" 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_i10n.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_i10n.saved+"</span>"),a(".ajax-success-msg").fadeOut(2e3,function(){a(this).remove()}),D=!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_i10n.saved+"</span>"),a(".ajax-success-msg").fadeOut(2e3,function(){a(this).remove()}),D=!1,a(".create-new-profile").val(""),d){var c=parseInt(b,10),f=c+1,g='<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"> '+e+"</label></li>";a("#create_new").parents("li").before(g),a("#profile-"+f).attr("checked","checked")}}})}}),a("body").delegate(".progress-chunk-hover","mousemove",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").delegate(".progress-chunk-hover","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"),V(),a(".migrate-selection.option-group input[type=radio]").change(function(){V(),y&&W()}),!a("#pull").is(":checked")&&!a("#push").is(":checked")||y||(a(".step-two").hide(),a(".connection-status").show()),a(".general-helper").click(function(b){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(".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")&&(T(),0==G&&"1"==wpmdb_has_licence&&(a(".support-content p").append('<img src="'+S+'" alt="" class="ajax-spinner general-spinner" />'),b(),G=!0)),a(this).hasClass("addons")&&0==G&&"1"==wpmdb_has_licence&&(a(".addons-content p").append('<img src="'+S+'" alt="" class="ajax-spinner general-spinner" />'),b(),G=!0)}),a("body").delegate(".add-row","click",function(){a(this).parents("tr").before(a(".original-repeatable-field").clone().removeClass("original-repeatable-field"))}),a("body").delegate(".replace-remove-row","click",function(){a(this).parents("tr").remove(),a(".replace-row").length<2&&a(".no-replaces-message").show()}),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").delegate("#find-and-replace-sort tbody tr.replace-row","hover",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").delegate(".save-migration-profile-wrap li","hover",function(b){"mouseenter"===b.type?a(".delete-profile",this).show():a(".delete-profile",this).hide()}),window.location.hash){var fb=window.location.hash.substring(1);Y(fb,!1)}""!=g("install-plugin")&&(fb="addons",G=!0,Y(fb,!0)),a(".reset-api-key").click(function(){var b=confirm(wpmdb_i10n.reset_api_key);b&&!C&&(C=!0,a(".reset-api-key").after('<img src="'+S+'" 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_i10n.reset_api_key_problem),a(".reset-api-key-ajax-spinner").remove(),C=!1},success:function(b){a(".reset-api-key-ajax-spinner").remove(),C=!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(){E||(a(this).addClass("disabled"),select_element=a("#selected-plugins"),a(select_element).attr("disabled","disabled"),E=!0,a(this).after('<img src="'+S+'" 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_i10n.blacklist_problem+"\r\n\r\n"+wpmdb_i10n.status+" "+b.status+" "+b.statusText+"\r\n\r\n"+wpmdb_i10n.response+"\r\n"+b.responseText),a(select_element).removeAttr("disabled"),a(".plugin-compatibility-save").removeClass("disabled"),E=!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"),E=!1,a(".plugin-compatibility-spinner").remove(),a(".plugin-compatibility-success-msg").show().fadeOut(2e3)}}))}),a("body").delegate(".delete-profile","click",function(){var b=a(this).next().clone();a("input",b).remove();var b=a.trim(a(b).html()),c=confirm(wpmdb_i10n.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_i10n.remove_profile_problem)},success:function(a){"-1"==a&&alert(wpmdb_i10n.remove_profile_not_found)}}))}),a(".main-list-delete-profile-link").click(function(){var b=a(this).prev().html(),c=confirm(wpmdb_i10n.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_i10n.remove_profile_problem)}}))}),a("body").delegate(".temp-disabled","click",function(){var b=confirm(wpmdb_i10n.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_i10n.enter_connection_info),y=!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="'+S+'" 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_i10n.save_settings_problem),a(".ajax-spinner").remove()},success:function(){a(".ajax-spinner").remove(),a(d).append('<span class="ajax-success-msg">'+wpmdb_i10n.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(),Z()}),a(".pull-push-connection-info").bind("paste",function(){setTimeout(function(){Z()},0)}),a("body").delegate(".try-again","click",function(){Z()}),a("body").delegate(".try-http","click",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),Z()}),a(".create-new-profile").change(function(){F=!0}),a("body").delegate(".temporarily-disable-ssl","click",function(){if(window.location.hash)var b=window.location.hash.substring(1);a(this).attr("href",a(this).attr("href")+"&hash="+b)}),a("body").delegate(".pause-resume","click",function(){1==P?(P=!1,A=!0,a(".progress-title").html(u),a(".progress-text").html(v),a(".migration-progress-ajax-spinner").show(),a(".pause-resume").html(wpmdb_i10n.pause),s=setInterval(e,1e3),execute_next_step()):(P=!0,A=!1,u=a(".progress-title").html(),v=a(".progress-text").html(),a(".progress-title").html(wpmdb_i10n.migration_paused),a(".pause-resume").html(wpmdb_i10n.resume),a(".progress-text").html(wpmdb_i10n.completing_current_request))}),a("body").delegate(".cancel","click",function(){Q=!0,P=!1,a(".progress-text").html(wpmdb_i10n.completing_current_request),a(".progress-title").html(wpmdb_i10n.cancelling_migration),a(".migration-controls").fadeOut(),a(".migration-progress-ajax-spinner").show(),0==A&&execute_next_step()}),a(".enter-licence").click(function(){a(".settings").click(),a(".licence-input").focus()}),execute_next_step=function(){if(1==P)return a(".migration-progress-ajax-spinner").hide(),clearInterval(s),void a(".progress-text").html(wpmdb_i10n.paused);if(1==Q){n=a("input[name=action]:checked").val(),"savefile"==n?progress_msg=wpmdb_i10n.removing_local_sql:"pull"==n?progress_msg="backup"==r?wpmdb_i10n.removing_local_backup:wpmdb_i10n.removing_local_temp_tables:"push"==n&&(progress_msg="backup"==r?wpmdb_i10n.removing_remote_sql:wpmdb_i10n.removing_remote_temp_tables),a(".progress-text").html(progress_msg);var b={action:"wpmdb_cancel_migration",intent:n,url:o,key:p,stage:r,dump_filename:M,form_data:q};"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_i10n.migration_cancellation_failed),a(".progress-text").html(wpmdb_i10n.manually_remove_temp_files),a(".progress-text").append("<br /><br />"+wpmdb_i10n.status+": "+b.status+" "+b.statusText+"<br /><br />"+wpmdb_i10n.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 A=!1,b=a.trim(b),""!=b?(a(".progress-title").html(wpmdb_i10n.migration_cancellation_failed),a(".progress-text").html(b),a(".progress-text").addClass("migration-error"),migration_error=!0,void migration_complete_events()):(t=wpmdb_i10n.migration_cancelled,a(".progress-text").hide(),void migration_complete_events())}})}else next_step_in_migration.fn.apply(null,next_step_in_migration.args)}})}(jQuery);
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);
class/wpmdb-base.php CHANGED
@@ -1,4 +1,5 @@
1
  <?php
 
2
  class WPMDB_Base {
3
  protected $settings;
4
  protected $plugin_file_path;
@@ -14,6 +15,7 @@ class WPMDB_Base {
14
  protected $transient_timeout;
15
  protected $transient_retry_timeout;
16
  protected $dbrains_api_base = 'https://deliciousbrains.com';
 
17
  protected $multipart_boundary = 'bWH4JVmYCnf6GfXacrcc';
18
  protected $attempting_to_connect_to;
19
  protected $error;
@@ -24,17 +26,20 @@ class WPMDB_Base {
24
  protected $is_pro = false;
25
  protected $is_addon = false;
26
  protected $core_slug;
 
 
27
 
28
  function __construct( $plugin_file_path ) {
29
- $this->settings = get_option( 'wpmdb_settings' );
 
30
 
31
- $this->plugin_file_path = $plugin_file_path;
32
- $this->plugin_dir_path = plugin_dir_path( $plugin_file_path );
33
  $this->plugin_folder_name = basename( $this->plugin_dir_path );
34
- $this->plugin_basename = plugin_basename( $plugin_file_path );
35
- $this->template_dir = $this->plugin_dir_path . 'template' . DS;
36
- $this->plugin_title = ucwords( str_ireplace( '-', ' ', basename( $plugin_file_path ) ) );
37
- $this->plugin_title = str_ireplace( array( 'db', 'wp', '.php' ), array( 'DB', 'WP', '' ), $this->plugin_title );
38
 
39
  // We need to set $this->plugin_slug here because it was set here
40
  // in Media Files prior to version 1.1.2. If we remove it the customer
@@ -54,23 +59,40 @@ class WPMDB_Base {
54
  if ( $this->is_addon || $this->is_pro ) {
55
  $this->pro_addon_construct();
56
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
57
  }
58
 
59
  function pro_addon_construct() {
60
  $this->addons = array(
61
  'wp-migrate-db-pro-media-files/wp-migrate-db-pro-media-files.php' => array(
62
- 'name' => 'Media Files',
63
  'required_version' => '1.1.4',
64
  ),
65
- 'wp-migrate-db-pro-cli/wp-migrate-db-pro-cli.php' => array(
66
- 'name' => 'CLI',
67
  'required_version' => '1.0',
68
  )
69
  );
70
 
71
  $this->invalid_content_verification_error = __( 'Invalid content verification signature, please verify the connection information on the remote site and try again.', 'wp-migrate-db' );
72
 
73
- $this->transient_timeout = 60 * 60 * 12;
74
  $this->transient_retry_timeout = 60 * 60 * 2;
75
 
76
  if ( defined( 'DBRAINS_API_BASE' ) ) {
@@ -83,7 +105,7 @@ class WPMDB_Base {
83
 
84
  $this->dbrains_api_url = $this->dbrains_api_base . '/?wc-api=delicious-brains';
85
 
86
- // allow devs to change the temporary prefix applied to the tables
87
  $this->temp_prefix = apply_filters( 'wpmdb_temporary_prefix', $this->temp_prefix );
88
 
89
  // Seen when the user clicks "view details" on the plugin listing page
@@ -98,8 +120,88 @@ class WPMDB_Base {
98
  add_action( 'wpmdb_notices', array( $this, 'version_update_notice' ) );
99
  }
100
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
101
  function template( $template, $dir = '', $args = array() ) {
102
  global $wpdb;
 
103
  extract( $args, EXTR_OVERWRITE );
104
  $dir = ( ! empty( $dir ) ) ? trailingslashit( $dir ) : $dir;
105
  include $this->template_dir . $dir . $template . '.php';
@@ -121,10 +223,11 @@ class WPMDB_Base {
121
 
122
  function remote_post( $url, $data, $scope, $args = array(), $expecting_serial = false ) {
123
  $this->set_time_limit();
 
124
 
125
  if ( function_exists( 'fsockopen' ) && strpos( $url, 'https://' ) === 0 && $scope == 'ajax_verify_connection_to_remote_site' ) {
126
- $url_parts = parse_url( $url );
127
- $host = $url_parts['host'];
128
  if ( $pf = @fsockopen( $host, 443, $err, $err_string, 1 ) ) {
129
  // worked
130
  fclose( $pf );
@@ -138,11 +241,12 @@ class WPMDB_Base {
138
 
139
  $default_remote_post_timeout = apply_filters( 'wpmdb_default_remote_post_timeout', 60 * 20 );
140
 
141
- $args = wp_parse_args( $args, array(
142
- 'timeout' => $default_remote_post_timeout,
143
- 'blocking' => true,
144
- 'sslverify' => $sslverify,
145
- ) );
 
146
 
147
  $args['method'] = 'POST';
148
 
@@ -151,7 +255,7 @@ class WPMDB_Base {
151
  }
152
 
153
  $args['headers']['Content-Type'] = 'multipart/form-data; boundary=' . $this->multipart_boundary;
154
- $args['headers']['Referer'] = network_admin_url( 'admin-ajax.php' );
155
 
156
  $this->attempting_to_connect_to = $url;
157
 
@@ -166,12 +270,12 @@ class WPMDB_Base {
166
  return $this->retry_remote_post( $url, $data, $scope, $args, $expecting_serial );
167
  } elseif ( isset( $response->errors['http_request_failed'][0] ) && strstr( $response->errors['http_request_failed'][0], 'timed out' ) ) {
168
  $this->error = sprintf( __( 'The connection to the remote server has timed out, no changes have been committed. (#134 - scope: %s)', 'wp-migrate-db' ), $scope );
169
- } 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' ) ) ) {
170
- $this->error = sprintf( __( 'We could not find: %s. Are you sure this is the correct URL?', 'wp-migrate-db' ), $_POST['url'] );
171
- $url_bits = parse_url( $_POST['url'] );
172
- if ( strstr( $_POST['url'], 'dev.' ) || strstr( $_POST['url'], '.dev' ) || ! strstr( $url_bits['host'], '.' ) ) {
173
  $this->error .= '<br />';
174
- if ( $_POST['intent'] == 'pull' ) {
175
  $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' );
176
  } else {
177
  $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' );
@@ -181,6 +285,7 @@ class WPMDB_Base {
181
  $this->error = sprintf( __( 'The connection failed, an unexpected error occurred, please contact support. (#121 - scope: %s)', 'wp-migrate-db' ), $scope );
182
  }
183
  $this->log_error( $this->error, $response );
 
184
  return false;
185
  } elseif ( (int) $response['response']['code'] < 200 || (int) $response['response']['code'] > 399 ) {
186
  if ( strpos( $url, 'https://' ) === 0 && $scope == 'ajax_verify_connection_to_remote_site' ) {
@@ -188,18 +293,21 @@ class WPMDB_Base {
188
  } elseif ( $response['response']['code'] == '401' ) {
189
  $this->error = __( 'The remote site is protected with Basic Authentication. Please enter the username and password above to continue. (401 Unauthorized)', 'wp-migrate-db' );
190
  $this->log_error( $this->error, $response );
 
191
  return false;
192
  } else {
193
  $this->error = sprintf( __( 'Unable to connect to the remote server, please check the connection details - %1$s %2$s (#129 - scope: %3$s)', 'wp-migrate-db' ), $response['response']['code'], $response['response']['message'], $scope );
194
  $this->log_error( $this->error, $response );
 
195
  return false;
196
  }
197
  } elseif ( $expecting_serial && is_serialized( $response['body'] ) == false ) {
198
  if ( strpos( $url, 'https://' ) === 0 && $scope == 'ajax_verify_connection_to_remote_site' ) {
199
  return $this->retry_remote_post( $url, $data, $scope, $args, $expecting_serial );
200
  }
201
- $this->error = __( 'There was a problem with the AJAX request, we were expecting a serialized response, instead we received:<br />', 'wp-migrate-db' ) . htmlentities( $response['body'] );
202
  $this->log_error( $this->error, $response );
 
203
  return false;
204
  } elseif ( $response['body'] === '0' ) {
205
  if ( strpos( $url, 'https://' ) === 0 && $scope == 'ajax_verify_connection_to_remote_site' ) {
@@ -207,6 +315,7 @@ class WPMDB_Base {
207
  }
208
  $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 );
209
  $this->log_error( $this->error, $response );
 
210
  return false;
211
  } elseif ( $expecting_serial && is_serialized( $response['body'] ) == true && $scope == 'ajax_verify_connection_to_remote_site' ) {
212
  $unserialized_response = unserialize( $response['body'] );
@@ -223,19 +332,19 @@ class WPMDB_Base {
223
  if ( $response = $this->remote_post( $url, $data, $scope, $args, $expecting_serial ) ) {
224
  return $response;
225
  }
 
226
  return false;
227
  }
228
 
229
  function array_to_multipart( $data ) {
230
- if ( !$data || !is_array( $data ) ) {
231
  return $data;
232
  }
233
 
234
  $result = '';
235
 
236
  foreach ( $data as $key => $value ) {
237
- $result .= '--' . $this->multipart_boundary . "\r\n" .
238
- sprintf( 'Content-Disposition: form-data; name="%s"', $key );
239
 
240
  if ( 'chunk' == $key ) {
241
  if ( $data['chunk_gzipped'] ) {
@@ -250,7 +359,7 @@ class WPMDB_Base {
250
  $result .= "\r\n\r\n" . $value . "\r\n";
251
  }
252
 
253
- $result .= "--" . $this->multipart_boundary . "--\r\n";
254
 
255
  return $result;
256
  }
@@ -268,38 +377,39 @@ class WPMDB_Base {
268
  $result .= '--' . $this->multipart_boundary . "\r\n" . sprintf( 'Content-Disposition: form-data; name="media[]"; filename="%s"', basename( $file ) );
269
  $result .= sprintf( "\r\nContent-Type: %s", $filetype['type'] );
270
  $result .= "\r\n\r\n" . $contents . "\r\n";
271
- $result .= "--" . $this->multipart_boundary . "--\r\n";
272
 
273
  return $result;
274
  }
275
 
276
  function log_error( $wpmdb_error, $additional_error_var = false ) {
277
  $error_header = "********************************************\n****** Log date: " . date( 'Y/m/d H:i:s' ) . " ******\n********************************************\n\n";
278
- $error = $error_header . "WPMDB Error: " . $wpmdb_error . "\n\n";
279
 
280
  if ( ! empty( $this->attempting_to_connect_to ) ) {
281
- $error .= "Attempted to connect to: " . $this->attempting_to_connect_to . "\n\n";
282
  }
283
 
284
  if ( $additional_error_var !== false ) {
285
  $error .= print_r( $additional_error_var, true ) . "\n\n";
286
  }
287
 
288
- $log = get_option( 'wpmdb_error_log' );
289
 
290
- if ( $log ) {
291
- $log = $log . $error;
292
  } else {
293
- $log = $error;
294
  }
295
 
296
- update_option( 'wpmdb_error_log', $log );
297
  }
298
 
299
  function display_errors() {
300
  if ( ! empty( $this->error ) ) {
301
  echo $this->error;
302
  $this->error = '';
 
303
  return true;
304
  }
305
 
@@ -307,19 +417,26 @@ class WPMDB_Base {
307
  }
308
 
309
  function filter_post_elements( $post_array, $accepted_elements ) {
310
- if ( isset( $post_array['form_data'] ) ) {
311
- $post_array['form_data'] = stripslashes( $post_array['form_data'] );
312
- }
313
-
314
  $accepted_elements[] = 'sig';
 
315
  return array_intersect_key( $post_array, array_flip( $accepted_elements ) );
316
  }
317
 
 
 
 
 
 
 
 
 
318
  function create_signature( $data, $key ) {
319
  if ( isset( $data['sig'] ) ) {
320
  unset( $data['sig'] );
321
  }
 
322
  $flat_data = implode( '', $data );
 
323
  return base64_encode( hash_hmac( 'sha1', $flat_data, $key, true ) );
324
  }
325
 
@@ -332,16 +449,17 @@ class WPMDB_Base {
332
  unset( $data['nonce'] );
333
  }
334
 
335
- $temp = $data;
336
  $computed_signature = $this->create_signature( $temp, $key );
 
337
  return $computed_signature === $data['sig'];
338
  }
339
 
340
  function get_dbrains_api_url( $request, $args = array() ) {
341
- $url = $this->dbrains_api_url;
342
  $args['request'] = $request;
343
- $args['version'] = $GLOBALS['wpmdb_meta'][$this->core_slug]['version'];
344
- $url = add_query_arg( $args, $url );
345
  if ( false !== get_site_transient( 'wpmdb_temporarily_disable_ssl' ) && 0 === strpos( $this->dbrains_api_url, 'https://' ) ) {
346
  $url = substr_replace( $url, 'http', 0, 5 );
347
  }
@@ -351,41 +469,124 @@ class WPMDB_Base {
351
  return $url;
352
  }
353
 
 
 
 
 
 
 
 
 
354
  function dbrains_api_request( $request, $args = array() ) {
 
 
 
 
 
 
 
 
355
  $sslverify = ( $this->settings['verify_ssl'] == 1 ? true : false );
356
 
357
- $url = $this->get_dbrains_api_url( $request, $args );
358
- $response = wp_remote_get( $url, array(
359
- 'timeout' => 30,
360
- 'blocking' => true,
361
- 'sslverify' => $sslverify
362
- ) );
 
 
 
363
 
364
  if ( is_wp_error( $response ) || (int) $response['response']['code'] < 200 || (int) $response['response']['code'] > 399 ) {
365
  $this->log_error( print_r( $response, true ) );
366
- $disable_ssl_url = network_admin_url( $this->plugin_base . '&nonce=' . wp_create_nonce( 'wpmdb-disable-ssl' ) . '&wpmdb-disable-ssl=1' );
 
 
 
 
 
 
 
 
 
 
 
367
  $connection_failed_message = '<div class="updated warning inline-message">';
368
- $connection_failed_message .= sprintf( __( '<strong>Could not connect to deliciousbrains.com</strong> &mdash; You will not receive update notifications or be able to activate your license until this is fixed. This issue is often caused by an improperly configured SSL server (https). We recommend <a href="%1$s" target="_blank">fixing the SSL configuration on your server</a>, but if you need a quick fix you can:<p><a href="%2$s" class="temporarily-disable-ssl button">Temporarily disable SSL for connections to deliciousbrains.com</a></p>', 'wp-migrate-db' ), 'https://deliciousbrains.com/wp-migrate-db-pro/documentation/#could-no-connect', $disable_ssl_url );
369
  $connection_failed_message .= '</div>';
 
370
  return json_encode( array( 'errors' => array( 'connection_failed' => $connection_failed_message ) ) );
371
  }
372
 
373
  return $response['body'];
374
  }
375
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
376
  function plugin_update_popup() {
377
  if ( $this->plugin_slug != $_GET['plugin'] ) {
378
  return;
379
  }
380
 
381
- $filename = $this->plugin_slug;
382
  $latest_version = $this->get_latest_version( $this->plugin_slug );
383
 
384
  if ( $this->is_beta_version( $latest_version ) ) {
385
  $filename .= '-beta';
386
  }
387
 
388
- $url = $this->dbrains_api_base . '/content/themes/delicious-brains/update-popup/' . $filename . '.html';
389
  $data = wp_remote_get( $url, array( 'timeout' => 30 ) );
390
 
391
  if ( is_wp_error( $data ) || 200 != $data['response']['code'] ) {
@@ -405,21 +606,21 @@ class WPMDB_Base {
405
  * TODO: Implement "Check my license again" link
406
  */
407
  function plugin_row() {
408
- $licence = $this->get_licence_key();
409
  $licence_response = $this->is_licence_expired();
410
- $licence_problem = isset( $licence_response['errors'] );
411
 
412
- if ( ! isset( $GLOBALS['wpmdb_meta'][$this->plugin_slug]['version'] ) ) {
413
  $installed_version = '0';
414
  } else {
415
- $installed_version = $GLOBALS['wpmdb_meta'][$this->plugin_slug]['version'];
416
  }
417
 
418
  $latest_version = $this->get_latest_version( $this->plugin_slug );
419
 
420
  $new_version = '';
421
  if ( version_compare( $installed_version, $latest_version, '<' ) ) {
422
- $new_version = __( 'There is a new version of ' . $this->plugin_title . ' available.', 'wp-migrate-db' );
423
  $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">';
424
  $new_version .= sprintf( __( 'View version %s details', 'wp-migrate-db' ), $latest_version ) . '</a>.';
425
  }
@@ -429,46 +630,54 @@ class WPMDB_Base {
429
  }
430
 
431
  if ( empty( $licence ) ) {
432
- $settings_link = sprintf( '<a href="%s">%s</a>', network_admin_url( $this->plugin_base ) . '#settings', __( 'Settings', 'wp-migrate-db' ) );
 
 
433
  if ( $new_version ) {
434
  $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/' );
435
  } else {
436
  $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/' );
437
  }
438
  } elseif ( $licence_problem ) {
439
- $message = array_shift( $licence_response['errors'] ) . sprintf( ' <a href="#" class="check-my-licence-again">%s</a>', __( 'Check my license again', 'wp-migrate-db' ) );
 
440
  } else {
441
  return;
442
  } ?>
443
 
444
  <tr class="plugin-update-tr wpmdbpro-custom">
445
  <td colspan="3" class="plugin-update">
446
- <div class="update-message"><span class="wpmdb-new-version-notice"><?php echo $new_version; ?></span> <span class="wpmdb-licence-error-notice"><?php echo $message; ?></span></div>
447
  </td>
448
  </tr>
449
 
450
- <?php if ( $new_version ) : // removes the built-in plugin update message ?>
451
- <script type="text/javascript">
452
- (function($) {
453
- var wpmdb_row = jQuery('#<?php echo $this->plugin_slug; ?>'),
454
- next_row = wpmdb_row.next();
455
-
456
- // If there's a plugin update row - need to keep the original update row available so we can switch it out
457
- // if the user has a successful response from the 'check my license again' link
458
- if (next_row.hasClass('plugin-update-tr') && !next_row.hasClass('wpmdbpro-custom')) {
459
- var original = next_row.clone();
460
- original.add
461
- next_row.html(next_row.next().html()).addClass('wpmdbpro-custom-visible');
462
- next_row.next().remove();
463
- next_row.after(original);
464
- original.addClass('wpmdb-original-update-row');
465
- }
466
- })(jQuery);
467
- </script>
468
- <?php endif;
 
469
  }
470
 
471
  function verify_download( $response, $args, $url ) {
 
 
 
 
472
  $download_url = $this->get_plugin_update_download_url( $this->plugin_slug );
473
 
474
  if ( 0 === strpos( $url, $download_url ) || 402 != $response['response']['code'] ) {
@@ -479,7 +688,7 @@ class WPMDB_Base {
479
  $data = @file_get_contents( $response['filename'] );
480
 
481
  if ( ! $data ) {
482
- return new WP_Error( 'wpmdbpro_download_error_empty', sprintf( __( 'Error retrieving download from deliciousbrain.com. Please try again or download manually from <a href="%1$s">%2$s</a>.', 'wp-migrate-db' ), 'https://deliciousbrains.com/my-account/', __( 'My Account', 'wp-migrate-db' ) ) );
483
  }
484
 
485
  $decoded_data = json_decode( $data, true );
@@ -502,8 +711,35 @@ class WPMDB_Base {
502
  return $this->is_licence_constant() ? WPMDB_LICENCE : $this->settings['licence'];
503
  }
504
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
505
  function is_valid_licence( $skip_transient_check = false ) {
506
  $response = $this->is_licence_expired( $skip_transient_check );
 
 
 
 
 
 
 
 
 
 
507
  return ( isset( $response['errors'] ) ) ? false : true;
508
  }
509
 
@@ -511,7 +747,7 @@ class WPMDB_Base {
511
  $licence = $this->get_licence_key();
512
 
513
  if ( empty( $licence ) ) {
514
- $settings_link = sprintf( '<a href="%s">%s</a>', network_admin_url( $this->plugin_base ) . '#settings', __( 'Settings', 'wp-migrate-db' ) );
515
  $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/' );
516
  return array( 'errors' => array( 'no_licence' => $message ) );
517
  }
@@ -527,20 +763,19 @@ class WPMDB_Base {
527
  }
528
 
529
  function check_licence( $licence_key ) {
530
- // testing only 1st line = valid licence 2nd line = not valid licence
531
- // return json_encode( array( 'ok' => 'ok' ) );
532
- // return json_encode( array( 'errors' => array( 'standard' => 'oh no! licence is not working.') ) );
533
  if ( empty( $licence_key ) ) {
534
  return false;
535
  }
536
 
537
  $args = array(
538
  'licence_key' => $licence_key,
539
- 'site_url' => home_url( '', 'http' ),
540
  );
541
 
542
  $response = $this->dbrains_api_request( 'check_support_access', $args );
 
543
  set_site_transient( 'wpmdb_licence_response', $response, $this->transient_timeout );
 
544
  return $response;
545
  }
546
 
@@ -555,8 +790,8 @@ class WPMDB_Base {
555
  function get_required_version( $slug ) {
556
  $plugin_file = sprintf( '%1$s/%1$s.php', $slug );
557
 
558
- if ( isset( $this->addons[$plugin_file]['required_version'] ) ) {
559
- return $this->addons[$plugin_file]['required_version'];
560
  } else {
561
  return 0;
562
  }
@@ -565,15 +800,15 @@ class WPMDB_Base {
565
  function get_latest_version( $slug ) {
566
  $data = $this->get_upgrade_data();
567
 
568
- if ( ! isset( $data[$slug] ) ) {
569
  return false;
570
  }
571
 
572
  // If pre-1.1.2 version of Media Files addon
573
- if ( ! isset( $GLOBALS['wpmdb_meta'][$slug]['version'] ) ) {
574
  $installed_version = false;
575
  } else {
576
- $installed_version = $GLOBALS['wpmdb_meta'][$slug]['version'];
577
  }
578
 
579
  $required_version = $this->get_required_version( $slug );
@@ -582,13 +817,13 @@ class WPMDB_Base {
582
  // and the API returned a beta version and it's newer than the latest stable version
583
  if ( $installed_version
584
  && ( $this->is_beta_version( $installed_version ) || $this->is_beta_version( $required_version ) )
585
- && isset( $data[$slug]['beta_version'] )
586
- && version_compare( $data[$slug]['version'], $data[$slug]['beta_version'], '<' )
587
  ) {
588
- return $data[$slug]['beta_version'];
589
  }
590
 
591
- return $data[$slug]['version'];
592
  }
593
 
594
  function get_upgrade_data() {
@@ -609,21 +844,23 @@ class WPMDB_Base {
609
  $data = json_decode( $data, true );
610
 
611
  /*
612
- We need to set the transient even when there's an error,
613
- otherwise we'll end up making API requests over and over again
614
- and slowing things down big time.
615
  */
616
- $default_upgrade_data = array( 'wp-migrate-db-pro' => array( 'version' => $GLOBALS['wpmdb_meta'][$this->core_slug]['version'] ) );
617
 
618
- if ( !$data ) {
619
  set_site_transient( 'wpmdb_upgrade_data', $default_upgrade_data, $this->transient_retry_timeout );
620
  $this->log_error( 'Error trying to decode JSON upgrade data.' );
 
621
  return false;
622
  }
623
 
624
  if ( isset( $data['errors'] ) ) {
625
  set_site_transient( 'wpmdb_upgrade_data', $default_upgrade_data, $this->transient_retry_timeout );
626
  $this->log_error( 'Error trying to get upgrade data.', $data['errors'] );
 
627
  return false;
628
  }
629
 
@@ -633,12 +870,12 @@ class WPMDB_Base {
633
  }
634
 
635
  function get_plugin_update_download_url( $plugin_slug, $is_beta = false ) {
636
- $licence = $this->get_licence_key();
637
  $query_args = array(
638
- 'request' => 'download',
639
  'licence_key' => $licence,
640
- 'slug' => $plugin_slug,
641
- 'site_url' => home_url( '', 'http' ),
642
  );
643
 
644
  if ( $is_beta ) {
@@ -653,9 +890,10 @@ class WPMDB_Base {
653
 
654
  foreach ( $vector as $key1 => $value1 ) {
655
  foreach ( $value1 as $key2 => $value2 ) {
656
- $result[$key2][$key1] = $value2;
657
  }
658
  }
 
659
  return $result;
660
  }
661
 
@@ -664,10 +902,11 @@ class WPMDB_Base {
664
  return false;
665
  }
666
 
667
- $current_max_execution_time = ini_get( 'max_execution_time' );
668
  $proposed_max_execution_time = ( $current_max_execution_time == 30 ) ? 31 : 30;
669
  @set_time_limit( $proposed_max_execution_time );
670
  $current_max_execution_time = ini_get( 'max_execution_time' );
 
671
  return $proposed_max_execution_time == $current_max_execution_time;
672
  }
673
 
@@ -680,11 +919,11 @@ class WPMDB_Base {
680
 
681
  $plugins = get_plugins();
682
 
683
- if ( ! isset( $plugins[$plugin_basename]['Name'] ) ) {
684
  return false;
685
  }
686
 
687
- return $plugins[$plugin_basename]['Name'];
688
  }
689
 
690
  function get_class_props() {
@@ -694,8 +933,8 @@ class WPMDB_Base {
694
  // Get only the table beginning with our DB prefix or temporary prefix, also skip views
695
  function get_tables( $scope = 'regular' ) {
696
  global $wpdb;
697
- $prefix = ( $scope == 'temp' ? $this->temp_prefix : $wpdb->prefix );
698
- $tables = $wpdb->get_results( 'SHOW FULL TABLES', ARRAY_N );
699
  $clean_tables = array();
700
 
701
  foreach ( $tables as $table ) {
@@ -710,14 +949,14 @@ class WPMDB_Base {
710
 
711
  function version_update_notice() {
712
  // We don't want to show both the "Update Required" and "Update Available" messages at the same time
713
- if ( isset( $this->addons[$this->plugin_basename] ) && true == $this->is_addon_outdated( $this->plugin_basename ) ) {
714
  return;
715
  }
716
 
717
  // To reduce UI clutter we hide addon update notices if the core plugin has updates available
718
- if ( isset( $this->addons[$this->plugin_basename] ) ) {
719
- $core_installed_version = $GLOBALS['wpmdb_meta'][$this->core_slug]['version'];
720
- $core_latest_version = $this->get_latest_version( $this->core_slug );
721
  // Core update is available, don't show update notices for addons until core is updated
722
  if ( version_compare( $core_installed_version, $core_latest_version, '<' ) ) {
723
  return;
@@ -727,21 +966,22 @@ class WPMDB_Base {
727
  $update_url = wp_nonce_url( network_admin_url( 'update.php?action=upgrade-plugin&plugin=' . urlencode( $this->plugin_basename ) ), 'upgrade-plugin_' . $this->plugin_basename );
728
 
729
  // If pre-1.1.2 version of Media Files addon, don't bother getting the versions
730
- if ( !isset( $GLOBALS['wpmdb_meta'][$this->plugin_slug]['version'] ) ) { ?>
 
731
  <div style="display: block;" class="updated warning inline-message">
732
- <strong>Update Available</strong> &mdash;
733
- A new version of <?php echo $this->plugin_title; ?> is now available. <a href="<?php echo $update_url; ?>">Update Now</a>
734
  </div>
735
- <?php
736
  } else {
737
- $installed_version = $GLOBALS['wpmdb_meta'][$this->plugin_slug]['version'];
738
- $latest_version = $this->get_latest_version( $this->plugin_slug );
739
 
740
  if ( version_compare( $installed_version, $latest_version, '<' ) ) { ?>
741
- <div style="display: block;" class="updated warning inline-message">
742
- <strong><?php _e( 'Update Available', 'wp-migrate-db' ); ?></strong> &mdash;
743
- <?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, __( 'Update Now', 'wp-migrate-db' ) ); ?>
744
- </div>
745
  <?php
746
  }
747
  }
@@ -749,19 +989,21 @@ class WPMDB_Base {
749
 
750
  function plugins_dir() {
751
  $path = untrailingslashit( $this->plugin_dir_path );
752
- return substr( $path, 0, strrpos( $path, DS ) ) . DS;
 
753
  }
754
 
755
  function is_addon_outdated( $addon_basename ) {
756
  $addon_slug = current( explode( '/', $addon_basename ) );
757
 
758
  // If pre-1.1.2 version of Media Files addon, then it is outdated
759
- if ( ! isset( $GLOBALS['wpmdb_meta'][$addon_slug]['version'] ) ) {
760
  return true;
761
  }
762
 
763
- $installed_version = $GLOBALS['wpmdb_meta'][$addon_slug]['version'];
764
- $required_version = $this->addons[$addon_basename]['required_version'];
 
765
  return version_compare( $installed_version, $required_version, '<' );
766
  }
767
 
@@ -769,41 +1011,65 @@ class WPMDB_Base {
769
  return $this->plugin_file_path;
770
  }
771
 
772
- function get_licence_status_message() {
773
- $licence = $this->get_licence_key();
774
-
775
- if ( empty( $licence ) ) {
 
 
 
 
 
 
 
 
776
  $message = sprintf( __( '<strong>Activate Your License</strong> &mdash; Please <a href="#" class="%s">enter your license key</a> to enable push and pull.', 'wp-migrate-db' ), 'js-action-link enter-licence' );
777
  return $message;
778
  }
779
 
780
- $trans = get_site_transient( 'wpmdb_licence_response' );
 
 
 
 
 
 
 
 
 
781
 
782
- if ( false === $trans ) {
783
- $trans = $this->check_licence( $licence );
784
  }
785
 
786
- $trans = json_decode( $trans, true );
787
  $errors = $trans['errors'];
788
 
789
  $check_licence_again_url = network_admin_url( $this->plugin_base . '&nonce=' . wp_create_nonce( 'wpmdb-check-licence' ) . '&wpmdb-check-licence=1' );
790
 
791
  if ( isset( $errors['connection_failed'] ) ) {
792
  $disable_ssl_url = network_admin_url( $this->plugin_base . '&nonce=' . wp_create_nonce( 'wpmdb-disable-ssl' ) . '&wpmdb-disable-ssl=1' );
793
- $message = sprintf( __( '<strong>Could not connect to deliciousbrains.com</strong> &mdash; You will not receive update notifications or be able to activate your license until this is fixed. This issue is often caused by an improperly configured SSL server (https). We recommend <a href="%s" target="_blank">fixing the SSL configuration on your server</a>, but if you need a quick fix you can:', 'wp-migrate-db' ), 'https://deliciousbrains.com/wp-migrate-db-pro/documentation/#could-no-connect' );
794
- $message .= 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' ) );
795
  } elseif ( isset( $errors['subscription_cancelled'] ) ) {
796
  $message = sprintf( __( '<strong>Your License Was Cancelled</strong> &mdash; 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/' );
797
  $message .= sprintf( '<br /><a href="%s">%s</a>', $check_licence_again_url, __( 'Check my license again', 'wp-migrate-db' ) );
798
  } elseif ( isset( $errors['subscription_expired'] ) ) {
799
- $message = sprintf( __( '<strong>Your License Has Expired</strong> &mdash; Please visit <a href="%s" target="_blank">My Account</a> to purchase a new license and enable push and pull.', 'wp-migrate-db' ), 'https://deliciousbrains.com/my-account/' );
800
  $message .= sprintf( '<br /><a href="%s">%s</a>', $check_licence_again_url, __( 'Check my license again', 'wp-migrate-db' ) );
801
  } elseif ( isset( $errors['no_activations_left'] ) ) {
802
  $message = sprintf( __( '<strong>No Activations Left</strong> &mdash; Please visit <a href="%s" target="_blank">My Account</a> to upgrade your license or deactivate a previous activation and enable push and pull.', 'wp-migrate-db' ), 'https://deliciousbrains.com/my-account/' );
803
  $message .= sprintf( ' <a href="%s">%s</a>', $check_licence_again_url, __( 'Check my license again', 'wp-migrate-db' ) );
804
  } elseif ( isset( $errors['licence_not_found'] ) ) {
805
- $message = sprintf( __( '<strong>Your License Was Not Found</strong> &mdash; 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/' );
806
- $message .= sprintf( ' <a href="%s">%s</a>', $check_licence_again_url, __( 'Check my license again', 'wp-migrate-db' ) );
 
 
 
 
 
 
 
 
 
807
  } else {
808
  $error = reset( $errors );
809
  $message = sprintf( __( '<strong>An Unexpected Error Occurred</strong> &mdash; 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' );
@@ -819,7 +1085,7 @@ class WPMDB_Base {
819
 
820
  function end_ajax( $return = false ) {
821
  if ( defined( 'DOING_WPMDB_TESTS' ) || $this->doing_cli_migration ) {
822
- return ( false === $return ) ? NULL : $return;
823
  }
824
 
825
  echo ( false === $return ) ? '' : $return;
@@ -847,4 +1113,242 @@ class WPMDB_Base {
847
  }
848
  }
849
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
850
  }
1
  <?php
2
+
3
  class WPMDB_Base {
4
  protected $settings;
5
  protected $plugin_file_path;
15
  protected $transient_timeout;
16
  protected $transient_retry_timeout;
17
  protected $dbrains_api_base = 'https://deliciousbrains.com';
18
+ protected $dbrains_api_status_url = 'http://s3.amazonaws.com/cdn.deliciousbrains.com/status.json';
19
  protected $multipart_boundary = 'bWH4JVmYCnf6GfXacrcc';
20
  protected $attempting_to_connect_to;
21
  protected $error;
26
  protected $is_pro = false;
27
  protected $is_addon = false;
28
  protected $core_slug;
29
+ protected $error_log;
30
+ protected $post_data;
31
 
32
  function __construct( $plugin_file_path ) {
33
+ $this->load_settings();
34
+ $this->maybe_schema_update();
35
 
36
+ $this->plugin_file_path = $plugin_file_path;
37
+ $this->plugin_dir_path = plugin_dir_path( $plugin_file_path );
38
  $this->plugin_folder_name = basename( $this->plugin_dir_path );
39
+ $this->plugin_basename = plugin_basename( $plugin_file_path );
40
+ $this->template_dir = $this->plugin_dir_path . 'template' . DIRECTORY_SEPARATOR;
41
+ $this->plugin_title = ucwords( str_ireplace( '-', ' ', basename( $plugin_file_path ) ) );
42
+ $this->plugin_title = str_ireplace( array( 'db', 'wp', '.php' ), array( 'DB', 'WP', '' ), $this->plugin_title );
43
 
44
  // We need to set $this->plugin_slug here because it was set here
45
  // in Media Files prior to version 1.1.2. If we remove it the customer
59
  if ( $this->is_addon || $this->is_pro ) {
60
  $this->pro_addon_construct();
61
  }
62
+
63
+ add_action( 'init', array( $this, 'load_plugin_textdomain' ) );
64
+ }
65
+
66
+ /**
67
+ * Sets $this->post_data from $_POST, potentially un-slashed.
68
+ */
69
+ function set_post_data() {
70
+ if ( defined( 'DOING_WPMDB_TESTS' ) || $this->doing_cli_migration ) {
71
+ $this->post_data = $_POST;
72
+ } elseif ( is_null( $this->post_data ) ) {
73
+ $this->post_data = wp_unslash( $_POST );
74
+ }
75
+ }
76
+
77
+ function load_plugin_textdomain() {
78
+ load_plugin_textdomain( 'wp-migrate-db', false, dirname( plugin_basename( $this->plugin_file_path ) ) . '/languages/' );
79
  }
80
 
81
  function pro_addon_construct() {
82
  $this->addons = array(
83
  'wp-migrate-db-pro-media-files/wp-migrate-db-pro-media-files.php' => array(
84
+ 'name' => 'Media Files',
85
  'required_version' => '1.1.4',
86
  ),
87
+ 'wp-migrate-db-pro-cli/wp-migrate-db-pro-cli.php' => array(
88
+ 'name' => 'CLI',
89
  'required_version' => '1.0',
90
  )
91
  );
92
 
93
  $this->invalid_content_verification_error = __( 'Invalid content verification signature, please verify the connection information on the remote site and try again.', 'wp-migrate-db' );
94
 
95
+ $this->transient_timeout = 60 * 60 * 12;
96
  $this->transient_retry_timeout = 60 * 60 * 2;
97
 
98
  if ( defined( 'DBRAINS_API_BASE' ) ) {
105
 
106
  $this->dbrains_api_url = $this->dbrains_api_base . '/?wc-api=delicious-brains';
107
 
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
120
  add_action( 'wpmdb_notices', array( $this, 'version_update_notice' ) );
121
  }
122
 
123
+ /**
124
+ * Loads the settings into the settings class property, sets some defaults if no existing settings are found.
125
+ */
126
+ function load_settings() {
127
+ if ( ! is_null( $this->settings ) ) {
128
+ return;
129
+ }
130
+
131
+ $update_settings = false;
132
+ $this->settings = get_site_option( 'wpmdb_settings' );
133
+
134
+ /*
135
+ * Settings were previously stored and retrieved using get_option and update_option respectively.
136
+ * Here we update the subsite option to a network wide option if applicable.
137
+ */
138
+ if ( false === $this->settings && is_multisite() && is_network_admin() ) {
139
+ $this->settings = get_option( 'wpmdb_settings' );
140
+ if ( false !== $this->settings ) {
141
+ $update_settings = true;
142
+ delete_option( 'wpmdb_settings' );
143
+ }
144
+ }
145
+
146
+ $default_settings = array(
147
+ 'key' => $this->generate_key(),
148
+ 'allow_pull' => false,
149
+ 'allow_push' => false,
150
+ 'profiles' => array(),
151
+ 'licence' => '',
152
+ 'verify_ssl' => false,
153
+ 'blacklist_plugins' => array(),
154
+ 'max_request' => min( 1024 * 1024, $this->get_bottleneck( 'max' ) ),
155
+ );
156
+
157
+ // if we still don't have settings exist this must be a fresh install, set up some default settings
158
+ if ( false === $this->settings ) {
159
+ $this->settings = $default_settings;
160
+ $update_settings = true;
161
+ } else {
162
+ /*
163
+ * When new settings are added an existing customer's db won't have the new settings.
164
+ * They're added here to circumvent array index errors in debug mode.
165
+ */
166
+ foreach ( $default_settings as $key => $value ) {
167
+ if ( ! isset( $this->settings[ $key ] ) ) {
168
+ $this->settings[ $key ] = $value;
169
+ $update_settings = true;
170
+ }
171
+ }
172
+ }
173
+
174
+ if ( $update_settings ) {
175
+ update_site_option( 'wpmdb_settings', $this->settings );
176
+ }
177
+ }
178
+
179
+ /**
180
+ * Loads the error log into the error log class property.
181
+ */
182
+ function load_error_log() {
183
+ if ( ! is_null( $this->error_log ) ) {
184
+ return;
185
+ }
186
+
187
+ $this->error_log = get_site_option( 'wpmdb_error_log' );
188
+
189
+ /*
190
+ * The error log was previously stored and retrieved using get_option and update_option respectively.
191
+ * Here we update the subsite option to a network wide option if applicable.
192
+ */
193
+ if ( false === $this->error_log && is_multisite() && is_network_admin() ) {
194
+ $this->error_log = get_option( 'wpmdb_error_log' );
195
+ if ( false !== $this->error_log ) {
196
+ update_site_option( 'wpmdb_error_log', $this->error_log );
197
+ delete_option( 'wpmdb_error_log' );
198
+ }
199
+ }
200
+ }
201
+
202
  function template( $template, $dir = '', $args = array() ) {
203
  global $wpdb;
204
+ // TODO: Refactor to remove extract().
205
  extract( $args, EXTR_OVERWRITE );
206
  $dir = ( ! empty( $dir ) ) ? trailingslashit( $dir ) : $dir;
207
  include $this->template_dir . $dir . $template . '.php';
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://' ) === 0 && $scope == 'ajax_verify_connection_to_remote_site' ) {
229
+ $url_parts = $this->parse_url( $url );
230
+ $host = $url_parts['host'];
231
  if ( $pf = @fsockopen( $host, 443, $err, $err_string, 1 ) ) {
232
  // worked
233
  fclose( $pf );
241
 
242
  $default_remote_post_timeout = apply_filters( 'wpmdb_default_remote_post_timeout', 60 * 20 );
243
 
244
+ $args = wp_parse_args( $args,
245
+ array(
246
+ 'timeout' => $default_remote_post_timeout,
247
+ 'blocking' => true,
248
+ 'sslverify' => $sslverify,
249
+ ) );
250
 
251
  $args['method'] = 'POST';
252
 
255
  }
256
 
257
  $args['headers']['Content-Type'] = 'multipart/form-data; boundary=' . $this->multipart_boundary;
258
+ $args['headers']['Referer'] = $this->referer_from_url( $url );
259
 
260
  $this->attempting_to_connect_to = $url;
261
 
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->post_data['url'] );
275
+ $url_bits = $this->parse_url( $this->post_data['url'] );
276
+ if ( strstr( $this->post_data['url'], 'dev.' ) || strstr( $this->post_data['url'], '.dev' ) || ! strstr( $url_bits['host'], '.' ) ) {
277
  $this->error .= '<br />';
278
+ if ( $this->post_data['intent'] == 'pull' ) {
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' );
285
  $this->error = sprintf( __( 'The connection failed, an unexpected error occurred, please contact support. (#121 - scope: %s)', 'wp-migrate-db' ), $scope );
286
  }
287
  $this->log_error( $this->error, $response );
288
+
289
  return false;
290
  } elseif ( (int) $response['response']['code'] < 200 || (int) $response['response']['code'] > 399 ) {
291
  if ( strpos( $url, 'https://' ) === 0 && $scope == 'ajax_verify_connection_to_remote_site' ) {
293
  } elseif ( $response['response']['code'] == '401' ) {
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
+
297
  return false;
298
  } else {
299
  $this->error = sprintf( __( 'Unable to connect to the remote server, please check the connection details - %1$s %2$s (#129 - scope: %3$s)', 'wp-migrate-db' ), $response['response']['code'], $response['response']['message'], $scope );
300
  $this->log_error( $this->error, $response );
301
+
302
  return false;
303
  }
304
  } elseif ( $expecting_serial && is_serialized( $response['body'] ) == false ) {
305
  if ( strpos( $url, 'https://' ) === 0 && $scope == 'ajax_verify_connection_to_remote_site' ) {
306
  return $this->retry_remote_post( $url, $data, $scope, $args, $expecting_serial );
307
  }
308
+ $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'] );
309
  $this->log_error( $this->error, $response );
310
+
311
  return false;
312
  } elseif ( $response['body'] === '0' ) {
313
  if ( strpos( $url, 'https://' ) === 0 && $scope == 'ajax_verify_connection_to_remote_site' ) {
315
  }
316
  $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 );
317
  $this->log_error( $this->error, $response );
318
+
319
  return false;
320
  } elseif ( $expecting_serial && is_serialized( $response['body'] ) == true && $scope == 'ajax_verify_connection_to_remote_site' ) {
321
  $unserialized_response = unserialize( $response['body'] );
332
  if ( $response = $this->remote_post( $url, $data, $scope, $args, $expecting_serial ) ) {
333
  return $response;
334
  }
335
+
336
  return false;
337
  }
338
 
339
  function array_to_multipart( $data ) {
340
+ if ( ! $data || ! is_array( $data ) ) {
341
  return $data;
342
  }
343
 
344
  $result = '';
345
 
346
  foreach ( $data as $key => $value ) {
347
+ $result .= '--' . $this->multipart_boundary . "\r\n" . sprintf( 'Content-Disposition: form-data; name="%s"', $key );
 
348
 
349
  if ( 'chunk' == $key ) {
350
  if ( $data['chunk_gzipped'] ) {
359
  $result .= "\r\n\r\n" . $value . "\r\n";
360
  }
361
 
362
+ $result .= '--' . $this->multipart_boundary . "--\r\n";
363
 
364
  return $result;
365
  }
377
  $result .= '--' . $this->multipart_boundary . "\r\n" . sprintf( 'Content-Disposition: form-data; name="media[]"; filename="%s"', basename( $file ) );
378
  $result .= sprintf( "\r\nContent-Type: %s", $filetype['type'] );
379
  $result .= "\r\n\r\n" . $contents . "\r\n";
380
+ $result .= '--' . $this->multipart_boundary . "--\r\n";
381
 
382
  return $result;
383
  }
384
 
385
  function log_error( $wpmdb_error, $additional_error_var = false ) {
386
  $error_header = "********************************************\n****** Log date: " . date( 'Y/m/d H:i:s' ) . " ******\n********************************************\n\n";
387
+ $error = $error_header . 'WPMDB Error: ' . $wpmdb_error . "\n\n";
388
 
389
  if ( ! empty( $this->attempting_to_connect_to ) ) {
390
+ $error .= 'Attempted to connect to: ' . $this->attempting_to_connect_to . "\n\n";
391
  }
392
 
393
  if ( $additional_error_var !== false ) {
394
  $error .= print_r( $additional_error_var, true ) . "\n\n";
395
  }
396
 
397
+ $this->load_error_log();
398
 
399
+ if ( isset( $this->error_log ) ) {
400
+ $this->error_log .= $error;
401
  } else {
402
+ $this->error_log = $error;
403
  }
404
 
405
+ update_site_option( 'wpmdb_error_log', $this->error_log );
406
  }
407
 
408
  function display_errors() {
409
  if ( ! empty( $this->error ) ) {
410
  echo $this->error;
411
  $this->error = '';
412
+
413
  return true;
414
  }
415
 
417
  }
418
 
419
  function filter_post_elements( $post_array, $accepted_elements ) {
 
 
 
 
420
  $accepted_elements[] = 'sig';
421
+
422
  return array_intersect_key( $post_array, array_flip( $accepted_elements ) );
423
  }
424
 
425
+ function sanitize_signature_data( $value ) {
426
+ if ( is_bool( $value ) ) {
427
+ $value = $value ? 'true' : 'false';
428
+ }
429
+
430
+ return $value;
431
+ }
432
+
433
  function create_signature( $data, $key ) {
434
  if ( isset( $data['sig'] ) ) {
435
  unset( $data['sig'] );
436
  }
437
+ $data = array_map( array( $this, 'sanitize_signature_data' ), $data );
438
  $flat_data = implode( '', $data );
439
+
440
  return base64_encode( hash_hmac( 'sha1', $flat_data, $key, true ) );
441
  }
442
 
449
  unset( $data['nonce'] );
450
  }
451
 
452
+ $temp = $data;
453
  $computed_signature = $this->create_signature( $temp, $key );
454
+
455
  return $computed_signature === $data['sig'];
456
  }
457
 
458
  function get_dbrains_api_url( $request, $args = array() ) {
459
+ $url = $this->dbrains_api_url;
460
  $args['request'] = $request;
461
+ $args['version'] = $GLOBALS['wpmdb_meta'][ $this->core_slug ]['version'];
462
+ $url = add_query_arg( $args, $url );
463
  if ( false !== get_site_transient( 'wpmdb_temporarily_disable_ssl' ) && 0 === strpos( $this->dbrains_api_url, 'https://' ) ) {
464
  $url = substr_replace( $url, 'http', 0, 5 );
465
  }
469
  return $url;
470
  }
471
 
472
+ /**
473
+ * Main function for communicating with the Delicious Brains API.
474
+ *
475
+ * @param string $request
476
+ * @param array $args
477
+ *
478
+ * @return mixed
479
+ */
480
  function dbrains_api_request( $request, $args = array() ) {
481
+ $trans = get_site_transient( 'wpmdb_dbrains_api_down' );
482
+
483
+ if ( false !== $trans ) {
484
+ $api_down_message = sprintf( '<div class="updated warning inline-message">%s</div>', $trans );
485
+
486
+ return json_encode( array( 'dbrains_api_down' => $api_down_message ) );
487
+ }
488
+
489
  $sslverify = ( $this->settings['verify_ssl'] == 1 ? true : false );
490
 
491
+ $url = $this->get_dbrains_api_url( $request, $args );
492
+ $response = wp_remote_get(
493
+ $url,
494
+ array(
495
+ 'timeout' => 30,
496
+ 'blocking' => true,
497
+ 'sslverify' => $sslverify,
498
+ )
499
+ );
500
 
501
  if ( is_wp_error( $response ) || (int) $response['response']['code'] < 200 || (int) $response['response']['code'] > 399 ) {
502
  $this->log_error( print_r( $response, true ) );
503
+
504
+ if ( true === $this->dbrains_api_down() ) {
505
+ $trans = get_site_transient( 'wpmdb_dbrains_api_down' );
506
+
507
+ if ( false !== $trans ) {
508
+ $api_down_message = sprintf( '<div class="updated warning inline-message">%s</div>', $trans );
509
+
510
+ return json_encode( array( 'dbrains_api_down' => $api_down_message ) );
511
+ }
512
+ }
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> &mdash; You will not receive update notifications or be able to activate your license until this is fixed. This issue is often caused by an improperly configured SSL server (https). We recommend <a href="%1$s" target="_blank">fixing the SSL configuration on your server</a>, but if you need a quick fix you can:%2$s', 'wp-migrate-db' ), 'https://deliciousbrains.com/wp-migrate-db-pro/doc/could-not-connect-deliciousbrains-com/', sprintf( '<p><a href="%1$s" class="temporarily-disable-ssl button">%2$s</a></p>', $disable_ssl_url, __( 'Temporarily disable SSL for connections to deliciousbrains.com', 'wp-migrate-db' ) ) );
517
  $connection_failed_message .= '</div>';
518
+
519
  return json_encode( array( 'errors' => array( 'connection_failed' => $connection_failed_message ) ) );
520
  }
521
 
522
  return $response['body'];
523
  }
524
 
525
+ /**
526
+ * Is the Delicious Brains API down?
527
+ *
528
+ * If not available then a 'wpmdb_dbrains_api_down' transient will be set with an appropriate message.
529
+ *
530
+ * @return bool
531
+ */
532
+ function dbrains_api_down() {
533
+ if ( false !== get_site_transient( 'wpmdb_dbrains_api_down' ) ) {
534
+ return true;
535
+ }
536
+
537
+ $response = wp_remote_get( $this->dbrains_api_status_url, array( 'timeout' => 30 ) );
538
+
539
+ // Can't get to api status url so fall back to normal failure handling.
540
+ if ( is_wp_error( $response ) || 200 != (int) $response['response']['code'] || empty( $response['body'] ) ) {
541
+ return false;
542
+ }
543
+
544
+ $json = json_decode( $response['body'], true );
545
+
546
+ // Can't decode json so fall back to normal failure handling.
547
+ if ( ! $json ) {
548
+ return false;
549
+ }
550
+
551
+ // JSON doesn't seem to have the format we expect or is not down, so fall back to normal failure handling.
552
+ if ( ! isset( $json['api']['status'] ) || 'down' != $json['api']['status'] ) {
553
+ return false;
554
+ }
555
+
556
+ $message = __( "<strong>Delicious Brains API is Down — </strong>Unfortunately we're experiencing some problems with our server.", 'wp-migrate-db' );
557
+
558
+ if ( ! empty( $json['api']['updated'] ) ) {
559
+ $updated = $json['api']['updated'];
560
+ $updated_ago = sprintf( _x( '%s ago', 'ex. 2 hours ago', 'wp-migrate-db' ), human_time_diff( strtotime( $updated ) ) );
561
+ }
562
+
563
+ if ( ! empty( $json['api']['message'] ) ) {
564
+ $message .= '<br />';
565
+ $message .= __( "Here's the most recent update on its status", 'wp-migrate-db' );
566
+ if ( ! empty( $updated_ago ) ) {
567
+ $message .= ' (' . $updated_ago . ')';
568
+ }
569
+ $message .= ': <em>' . $json['api']['message'] . '</em>';
570
+ }
571
+
572
+ set_site_transient( 'wpmdb_dbrains_api_down', $message, $this->transient_retry_timeout );
573
+
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'] ) {
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
  }
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;
679
+ }
680
+
681
  $download_url = $this->get_plugin_update_download_url( $this->plugin_slug );
682
 
683
  if ( 0 === strpos( $url, $download_url ) || 402 != $response['response']['code'] ) {
688
  $data = @file_get_contents( $response['filename'] );
689
 
690
  if ( ! $data ) {
691
+ return new WP_Error( 'wpmdbpro_download_error_empty', sprintf( __( 'Error retrieving download from deliciousbrain.com. Please try again or download manually from <a href="%1$s">%2$s</a>.', 'wp-migrate-db' ), 'https://deliciousbrains.com/my-account/', _x( 'My Account', 'Delicious Brains account', 'wp-migrate-db' ) ) );
692
  }
693
 
694
  $decoded_data = json_decode( $data, true );
711
  return $this->is_licence_constant() ? WPMDB_LICENCE : $this->settings['licence'];
712
  }
713
 
714
+ /**
715
+ * Sets the licence index in the $settings array class property and updates the wpmdb_settings option.
716
+ *
717
+ * @param string $key
718
+ */
719
+ function set_licence_key( $key ) {
720
+ $this->settings['licence'] = $key;
721
+ update_site_option( 'wpmdb_settings', $this->settings );
722
+ }
723
+
724
+ /**
725
+ * Checks whether the saved licence has expired or not.
726
+ *
727
+ * @param bool $skip_transient_check
728
+ *
729
+ * @return bool
730
+ */
731
  function is_valid_licence( $skip_transient_check = false ) {
732
  $response = $this->is_licence_expired( $skip_transient_check );
733
+
734
+ if ( isset( $response['dbrains_api_down'] ) ) {
735
+ return true;
736
+ }
737
+
738
+ // Don't cripple the plugin's functionality if the user's licence is expired
739
+ if ( isset( $response['errors']['subscription_expired'] ) && 1 === count( $response['errors'] ) ) {
740
+ return true;
741
+ }
742
+
743
  return ( isset( $response['errors'] ) ) ? false : true;
744
  }
745
 
747
  $licence = $this->get_licence_key();
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 = 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/' );
752
  return array( 'errors' => array( 'no_licence' => $message ) );
753
  }
763
  }
764
 
765
  function check_licence( $licence_key ) {
 
 
 
766
  if ( empty( $licence_key ) ) {
767
  return false;
768
  }
769
 
770
  $args = array(
771
  'licence_key' => $licence_key,
772
+ 'site_url' => home_url( '', 'http' ),
773
  );
774
 
775
  $response = $this->dbrains_api_request( 'check_support_access', $args );
776
+
777
  set_site_transient( 'wpmdb_licence_response', $response, $this->transient_timeout );
778
+
779
  return $response;
780
  }
781
 
790
  function get_required_version( $slug ) {
791
  $plugin_file = sprintf( '%1$s/%1$s.php', $slug );
792
 
793
+ if ( isset( $this->addons[ $plugin_file ]['required_version'] ) ) {
794
+ return $this->addons[ $plugin_file ]['required_version'];
795
  } else {
796
  return 0;
797
  }
800
  function get_latest_version( $slug ) {
801
  $data = $this->get_upgrade_data();
802
 
803
+ if ( ! isset( $data[ $slug ] ) ) {
804
  return false;
805
  }
806
 
807
  // If pre-1.1.2 version of Media Files addon
808
+ if ( ! isset( $GLOBALS['wpmdb_meta'][ $slug ]['version'] ) ) {
809
  $installed_version = false;
810
  } else {
811
+ $installed_version = $GLOBALS['wpmdb_meta'][ $slug ]['version'];
812
  }
813
 
814
  $required_version = $this->get_required_version( $slug );
817
  // and the API returned a beta version and it's newer than the latest stable version
818
  if ( $installed_version
819
  && ( $this->is_beta_version( $installed_version ) || $this->is_beta_version( $required_version ) )
820
+ && isset( $data[ $slug ]['beta_version'] )
821
+ && version_compare( $data[ $slug ]['version'], $data[ $slug ]['beta_version'], '<' )
822
  ) {
823
+ return $data[ $slug ]['beta_version'];
824
  }
825
 
826
+ return $data[ $slug ]['version'];
827
  }
828
 
829
  function get_upgrade_data() {
844
  $data = json_decode( $data, true );
845
 
846
  /*
847
+ We need to set the transient even when there's an error,
848
+ otherwise we'll end up making API requests over and over again
849
+ and slowing things down big time.
850
  */
851
+ $default_upgrade_data = array( 'wp-migrate-db-pro' => array( 'version' => $GLOBALS['wpmdb_meta'][ $this->core_slug ]['version'] ) );
852
 
853
+ if ( ! $data ) {
854
  set_site_transient( 'wpmdb_upgrade_data', $default_upgrade_data, $this->transient_retry_timeout );
855
  $this->log_error( 'Error trying to decode JSON upgrade data.' );
856
+
857
  return false;
858
  }
859
 
860
  if ( isset( $data['errors'] ) ) {
861
  set_site_transient( 'wpmdb_upgrade_data', $default_upgrade_data, $this->transient_retry_timeout );
862
  $this->log_error( 'Error trying to get upgrade data.', $data['errors'] );
863
+
864
  return false;
865
  }
866
 
870
  }
871
 
872
  function get_plugin_update_download_url( $plugin_slug, $is_beta = false ) {
873
+ $licence = $this->get_licence_key();
874
  $query_args = array(
875
+ 'request' => 'download',
876
  'licence_key' => $licence,
877
+ 'slug' => $plugin_slug,
878
+ 'site_url' => home_url( '', 'http' ),
879
  );
880
 
881
  if ( $is_beta ) {
890
 
891
  foreach ( $vector as $key1 => $value1 ) {
892
  foreach ( $value1 as $key2 => $value2 ) {
893
+ $result[ $key2 ][ $key1 ] = $value2;
894
  }
895
  }
896
+
897
  return $result;
898
  }
899
 
902
  return false;
903
  }
904
 
905
+ $current_max_execution_time = ini_get( 'max_execution_time' );
906
  $proposed_max_execution_time = ( $current_max_execution_time == 30 ) ? 31 : 30;
907
  @set_time_limit( $proposed_max_execution_time );
908
  $current_max_execution_time = ini_get( 'max_execution_time' );
909
+
910
  return $proposed_max_execution_time == $current_max_execution_time;
911
  }
912
 
919
 
920
  $plugins = get_plugins();
921
 
922
+ if ( ! isset( $plugins[ $plugin_basename ]['Name'] ) ) {
923
  return false;
924
  }
925
 
926
+ return $plugins[ $plugin_basename ]['Name'];
927
  }
928
 
929
  function get_class_props() {
933
  // Get only the table beginning with our DB prefix or temporary prefix, also skip views
934
  function get_tables( $scope = 'regular' ) {
935
  global $wpdb;
936
+ $prefix = ( $scope == 'temp' ? $this->temp_prefix : $wpdb->prefix );
937
+ $tables = $wpdb->get_results( 'SHOW FULL TABLES', ARRAY_N );
938
  $clean_tables = array();
939
 
940
  foreach ( $tables as $table ) {
949
 
950
  function version_update_notice() {
951
  // We don't want to show both the "Update Required" and "Update Available" messages at the same time
952
+ if ( isset( $this->addons[ $this->plugin_basename ] ) && true == $this->is_addon_outdated( $this->plugin_basename ) ) {
953
  return;
954
  }
955
 
956
  // To reduce UI clutter we hide addon update notices if the core plugin has updates available
957
+ if ( isset( $this->addons[ $this->plugin_basename ] ) ) {
958
+ $core_installed_version = $GLOBALS['wpmdb_meta'][ $this->core_slug ]['version'];
959
+ $core_latest_version = $this->get_latest_version( $this->core_slug );
960
  // Core update is available, don't show update notices for addons until core is updated
961
  if ( version_compare( $core_installed_version, $core_latest_version, '<' ) ) {
962
  return;
966
  $update_url = wp_nonce_url( network_admin_url( 'update.php?action=upgrade-plugin&plugin=' . urlencode( $this->plugin_basename ) ), 'upgrade-plugin_' . $this->plugin_basename );
967
 
968
  // If pre-1.1.2 version of Media Files addon, don't bother getting the versions
969
+ if ( ! isset( $GLOBALS['wpmdb_meta'][ $this->plugin_slug ]['version'] ) ) {
970
+ ?>
971
  <div style="display: block;" class="updated warning inline-message">
972
+ <strong><?php _ex( 'Update Available', 'A new version of the plugin is available', 'wp-migrate-db' ); ?></strong> &mdash;
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
+ <?php
976
  } else {
977
+ $installed_version = $GLOBALS['wpmdb_meta'][ $this->plugin_slug ]['version'];
978
+ $latest_version = $this->get_latest_version( $this->plugin_slug );
979
 
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> &mdash;
983
+ <?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' ) ); ?>
984
+ </div>
985
  <?php
986
  }
987
  }
989
 
990
  function plugins_dir() {
991
  $path = untrailingslashit( $this->plugin_dir_path );
992
+
993
+ return substr( $path, 0, strrpos( $path, DIRECTORY_SEPARATOR ) ) . DIRECTORY_SEPARATOR;
994
  }
995
 
996
  function is_addon_outdated( $addon_basename ) {
997
  $addon_slug = current( explode( '/', $addon_basename ) );
998
 
999
  // If pre-1.1.2 version of Media Files addon, then it is outdated
1000
+ if ( ! isset( $GLOBALS['wpmdb_meta'][ $addon_slug ]['version'] ) ) {
1001
  return true;
1002
  }
1003
 
1004
+ $installed_version = $GLOBALS['wpmdb_meta'][ $addon_slug ]['version'];
1005
+ $required_version = $this->addons[ $addon_basename ]['required_version'];
1006
+
1007
  return version_compare( $installed_version, $required_version, '<' );
1008
  }
1009
 
1011
  return $this->plugin_file_path;
1012
  }
1013
 
1014
+ /**
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> &mdash; Please <a href="#" class="%s">enter your license key</a> to enable push and pull.', 'wp-migrate-db' ), 'js-action-link enter-licence' );
1027
  return $message;
1028
  }
1029
 
1030
+ if ( ! $trans ) {
1031
+ $trans = get_site_transient( 'wpmdb_licence_response' );
1032
+
1033
+ if ( false === $trans ) {
1034
+ $trans = $this->check_licence( $licence );
1035
+ }
1036
+
1037
+ $trans = json_decode( $trans, true );
1038
+ $api_response_provided = false;
1039
+ }
1040
 
1041
+ if ( isset( $trans['dbrains_api_down'] ) ) {
1042
+ return __( "<strong>We've temporarily activated your license and will complete the activation once the Delicious Brains API is available again.</strong>", 'wp-migrate-db' );
1043
  }
1044
 
 
1045
  $errors = $trans['errors'];
1046
 
1047
  $check_licence_again_url = network_admin_url( $this->plugin_base . '&nonce=' . wp_create_nonce( 'wpmdb-check-licence' ) . '&wpmdb-check-licence=1' );
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 = sprintf( __( '<strong>Could not connect to deliciousbrains.com</strong> &mdash; You will not receive update notifications or be able to activate your license until this is fixed. This issue is often caused by an improperly configured SSL server (https). We recommend <a href="%1$s" target="_blank">fixing the SSL configuration on your server</a>, but if you need a quick fix you can:%2$s', 'wp-migrate-db' ), 'https://deliciousbrains.com/wp-migrate-db-pro/doc/could-not-connect-deliciousbrains-com/', sprintf( '<p><a href="%1$s" class="temporarily-disable-ssl button">%2$s</a></p>', $disable_ssl_url, __( 'Temporarily disable SSL for connections to deliciousbrains.com', 'wp-migrate-db' ) ) );
 
1052
  } elseif ( isset( $errors['subscription_cancelled'] ) ) {
1053
  $message = sprintf( __( '<strong>Your License Was Cancelled</strong> &mdash; 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
+ $message = sprintf( __( '<strong>Your License Has Expired</strong> &mdash; Your expired license has been added to this install, so you can now use the push and pull features. Please visit <a href="%s" target="_blank">My Account</a> to renew your license and continue receiving plugin updates and access to email support.', 'wp-migrate-db' ), 'https://deliciousbrains.com/my-account/' );
1057
  $message .= sprintf( '<br /><a href="%s">%s</a>', $check_licence_again_url, __( 'Check my license again', 'wp-migrate-db' ) );
1058
  } elseif ( isset( $errors['no_activations_left'] ) ) {
1059
  $message = sprintf( __( '<strong>No Activations Left</strong> &mdash; Please visit <a href="%s" target="_blank">My Account</a> to upgrade your license or deactivate a previous activation and enable push and pull.', 'wp-migrate-db' ), 'https://deliciousbrains.com/my-account/' );
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> &mdash; 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> &mdash; ', 'wp-migrate-db' );
1068
+ $message .= $error;
1069
+ }
1070
+ } elseif ( isset( $errors['activation_deactivated'] ) ) {
1071
+ $message = sprintf( '<strong>%s</strong> &mdash; ', __( '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 = reset( $errors );
1075
  $message = sprintf( __( '<strong>An Unexpected Error Occurred</strong> &mdash; 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' );
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
 
1091
  echo ( false === $return ) ? '' : $return;
1113
  }
1114
  }
1115
 
1116
+ // Generates our secret key
1117
+ function generate_key( $length = 40 ) {
1118
+ $keyset = 'abcdefghijklmnopqrstuvqxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/';
1119
+ $key = '';
1120
+
1121
+ for ( $i = 0; $i < $length; $i ++ ) {
1122
+ $key .= substr( $keyset, wp_rand( 0, strlen( $keyset ) - 1 ), 1 );
1123
+ }
1124
+
1125
+ return $key;
1126
+ }
1127
+
1128
+ function get_bottleneck( $type = 'regular' ) {
1129
+ $suhosin_limit = false;
1130
+ $suhosin_request_limit = false;
1131
+ $suhosin_post_limit = false;
1132
+
1133
+ if ( function_exists( 'ini_get' ) ) {
1134
+ $suhosin_request_limit = $this->return_bytes( ini_get( 'suhosin.request.max_value_length' ) );
1135
+ $suhosin_post_limit = $this->return_bytes( ini_get( 'suhosin.post.max_value_length' ) );
1136
+ }
1137
+
1138
+ if ( $suhosin_request_limit && $suhosin_post_limit ) {
1139
+ $suhosin_limit = min( $suhosin_request_limit, $suhosin_post_limit );
1140
+ }
1141
+
1142
+ // we have to account for HTTP headers and other bloating, here we minus 1kb for bloat
1143
+ $post_max_upper_size = apply_filters( 'wpmdb_post_max_upper_size', 26214400 );
1144
+ $calculated_bottleneck = min( ( $this->get_post_max_size() - 1024 ), $post_max_upper_size );
1145
+
1146
+ if ( $suhosin_limit ) {
1147
+ $calculated_bottleneck = min( $calculated_bottleneck, $suhosin_limit - 1024 );
1148
+ }
1149
+
1150
+ if ( $type != 'max' ) {
1151
+ $calculated_bottleneck = min( $calculated_bottleneck, $this->settings['max_request'] );
1152
+ }
1153
+
1154
+ return apply_filters( 'wpmdb_bottleneck', $calculated_bottleneck );
1155
+ }
1156
+
1157
+ function return_bytes( $val ) {
1158
+ if ( is_numeric( $val ) ) {
1159
+ return $val;
1160
+ }
1161
+
1162
+ if ( empty( $val ) ) {
1163
+ return false;
1164
+ }
1165
+
1166
+ $val = trim( $val );
1167
+ $last = strtolower( $val[ strlen( $val ) - 1 ] );
1168
+
1169
+ switch ( $last ) {
1170
+ // The 'G' modifier is available since PHP 5.1.0
1171
+ case 'g':
1172
+ $val *= 1024;
1173
+ case 'm':
1174
+ $val *= 1024;
1175
+ case 'k':
1176
+ $val *= 1024;
1177
+ break;
1178
+ default :
1179
+ $val = false;
1180
+ break;
1181
+ }
1182
+
1183
+ return $val;
1184
+ }
1185
+
1186
+ function get_post_max_size() {
1187
+ $val = trim( ini_get( 'post_max_size' ) );
1188
+ $last = strtolower( $val[ strlen( $val ) - 1 ] );
1189
+
1190
+ switch ( $last ) {
1191
+ case 'g':
1192
+ $val *= 1024;
1193
+ case 'm':
1194
+ $val *= 1024;
1195
+ case 'k':
1196
+ $val *= 1024;
1197
+ }
1198
+
1199
+ return $val;
1200
+ }
1201
+
1202
+ /**
1203
+ * Returns a url string given an associative array as per the output of parse_url.
1204
+ *
1205
+ * @param $parsed_url
1206
+ *
1207
+ * @return string
1208
+ */
1209
+ function unparse_url( $parsed_url ) {
1210
+ $scheme = isset( $parsed_url['scheme'] ) ? $parsed_url['scheme'] . '://' : '';
1211
+ $host = isset( $parsed_url['host'] ) ? $parsed_url['host'] : '';
1212
+ $port = isset( $parsed_url['port'] ) ? ':' . $parsed_url['port'] : '';
1213
+ $user = isset( $parsed_url['user'] ) ? $parsed_url['user'] : '';
1214
+ $pass = isset( $parsed_url['pass'] ) ? ':' . $parsed_url['pass'] : '';
1215
+ $pass = ( $user || $pass ) ? "$pass@" : '';
1216
+ $path = isset( $parsed_url['path'] ) ? $parsed_url['path'] : '';
1217
+ $query = isset( $parsed_url['query'] ) ? '?' . $parsed_url['query'] : '';
1218
+ $fragment = isset( $parsed_url['fragment'] ) ? '#' . $parsed_url['fragment'] : '';
1219
+
1220
+ return "$scheme$user$pass$host$port$path$query$fragment";
1221
+ }
1222
+
1223
+ /**
1224
+ * Get a simplified url for use as the referrer.
1225
+ *
1226
+ * @param $referer_url
1227
+ *
1228
+ * @return string
1229
+ *
1230
+ * NOTE: mis-spelling intentional to match usage.
1231
+ */
1232
+ function referer_from_url( $referer_url ) {
1233
+ $url_parts = $this->parse_url( $referer_url );
1234
+
1235
+ if ( false !== $url_parts ) {
1236
+ $reduced_url_parts = array_intersect_key( $url_parts, array_flip( array( 'scheme', 'host', 'port', 'path' ) ) );
1237
+ if ( ! empty( $reduced_url_parts ) ) {
1238
+ $referer_url = $this->unparse_url( $reduced_url_parts );
1239
+ }
1240
+ }
1241
+
1242
+ return $referer_url;
1243
+ }
1244
+
1245
+ /**
1246
+ * Parses a url into it's components. Compatible with PHP < 5.4.7.
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;
1256
+ } else {
1257
+ $no_scheme = false;
1258
+ }
1259
+
1260
+ $parts = parse_url( $url );
1261
+ if ( $no_scheme ) {
1262
+ unset( $parts['scheme'] );
1263
+ }
1264
+
1265
+ return $parts;
1266
+ }
1267
+
1268
+ /**
1269
+ * Standard notice display check
1270
+ * Returns dismiss and reminder links html for templates where necessary
1271
+ *
1272
+ * @param string $notice The name of the notice e.g. license-key-warning
1273
+ * @param bool $dismiss If the notice has a dismiss link
1274
+ * @param bool|int $reminder If the notice has a reminder link, this will be the number of seconds
1275
+ *
1276
+ * @return array|bool
1277
+ */
1278
+ function check_notice( $notice, $dismiss = false, $reminder = false ) {
1279
+ if ( true === apply_filters( 'wpmdb_hide_' . $notice, false ) ) {
1280
+ return false;
1281
+ }
1282
+ global $current_user;
1283
+ $notice_links = array();
1284
+
1285
+ if ( $dismiss ) {
1286
+ if ( get_user_meta( $current_user->ID, 'wpmdb_dismiss_' . $notice ) ) {
1287
+ return false;
1288
+ }
1289
+ $notice_links['dismiss'] = '<a href="#" class="notice-link" data-notice="' . $notice . '" data-type="dismiss">' . _x( 'Dismiss', 'dismiss notice permanently', 'wp-migrate-db' ) . '</a>';
1290
+ }
1291
+
1292
+ if ( $reminder ) {
1293
+ if ( ( $reminder_set = get_user_meta( $current_user->ID, 'wpmdb_reminder_' . $notice, true ) ) ) {
1294
+ if ( strtotime( 'now' ) < $reminder_set ) {
1295
+ return false;
1296
+ }
1297
+ }
1298
+ $notice_links['reminder'] = '<a href="#" class="notice-link" data-notice="' . $notice . '" data-type="reminder" data-reminder="' . $reminder . '">' . __( 'Remind Me Later', 'wp-migrate-db' ) . '</a>';
1299
+ }
1300
+
1301
+ return ( count( $notice_links ) > 0 ) ? $notice_links : true;
1302
+ }
1303
+
1304
+ /**
1305
+ * Performs a schema update if required.
1306
+ */
1307
+ function maybe_schema_update() {
1308
+ $schema_version = get_site_option( 'wpmdb_schema_version' );
1309
+ $update_schema = false;
1310
+
1311
+ /*
1312
+ * Upgrade this option to a network wide option if the site has been upgraded
1313
+ * from a regular WordPress installation to a multisite installation.
1314
+ */
1315
+ if ( false === $schema_version && is_multisite() && is_network_admin() ) {
1316
+ $schema_version = get_option( 'wpmdb_schema_version' );
1317
+ if ( false !== $schema_version ) {
1318
+ update_site_option( 'wpmdb_schema_version', $schema_version );
1319
+ delete_option( 'wpmdb_schema_version' );
1320
+ }
1321
+ }
1322
+
1323
+ if ( false === $schema_version ) {
1324
+ $schema_version = 0;
1325
+ }
1326
+
1327
+ if ( $schema_version < 1 ) {
1328
+ $error_log = get_option( 'wpmdb_error_log' );
1329
+ // skip multisite installations as we can't use add_site_option because it doesn't include an 'autoload' argument
1330
+ if ( false !== $error_log && false === is_multisite() ) {
1331
+ delete_option( 'wpmdb_error_log' );
1332
+ add_option( 'wpmdb_error_log', $error_log, '', 'no' );
1333
+ }
1334
+
1335
+ $update_schema = true;
1336
+ $schema_version = 1;
1337
+ }
1338
+
1339
+ if ( true === $update_schema ) {
1340
+ update_site_option( 'wpmdb_schema_version', $schema_version );
1341
+ }
1342
+ }
1343
+
1344
+ /**
1345
+ * Converts file paths that include mixed slashes to use the correct type of slash for the current operating system.
1346
+ *
1347
+ * @param $path string
1348
+ *
1349
+ * @return string
1350
+ */
1351
+ function slash_one_direction( $path ) {
1352
+ return str_replace( array( '/', '\\' ), DIRECTORY_SEPARATOR, $path );
1353
+ }
1354
  }
class/wpmdb-replace.php ADDED
@@ -0,0 +1,213 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ final class WPMDB_Replace {
4
+ protected $search;
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( $table, $search, $replace, $wpmdb ) {
14
+ $this->table = $table;
15
+ $this->search = $search;
16
+ $this->replace = $replace;
17
+ $this->wpmdb = $wpmdb;
18
+ }
19
+
20
+ /**
21
+ * Determine whether to apply a subdomain replace over each value in the database.
22
+ *
23
+ * @return bool
24
+ */
25
+ function is_subdomain_replaces_on() {
26
+ if ( ! isset( $this->subdomain_replaces_on ) ) {
27
+ $this->subdomain_replaces_on = ( is_multisite() && defined( 'SUBDOMAIN_INSTALL' ) && SUBDOMAIN_INSTALL && apply_filters( 'wpmdb_subdomain_replace', true ) );
28
+ }
29
+
30
+ return $this->subdomain_replaces_on;
31
+ }
32
+
33
+ /**
34
+ * Automatically replace URLs for subdomain based multisite installations
35
+ * e.g. //site1.example.com -> //site1.example.local for site with domain example.com
36
+ * NB: only handles the current network site, does not work for additional networks / mapped domains
37
+ *
38
+ * @param $new
39
+ *
40
+ * @return mixed
41
+ */
42
+ function subdomain_replaces( $new ) {
43
+ $domain_replace = $this->wpmdb->get_domain_replace();
44
+
45
+ if ( empty( $domain_replace ) ) {
46
+ return $new;
47
+ }
48
+
49
+ $pattern = '|//(.*?)\\.' . preg_quote( $this->wpmdb->get_domain_current_site(), '|' ) . '|';
50
+ $replacement = '//$1.' . trim( $domain_replace );
51
+ $new = preg_replace( $pattern, $replacement, $new );
52
+
53
+ return $new;
54
+ }
55
+
56
+ /**
57
+ * Applies find/replace pairs to a given string.
58
+ *
59
+ * @param string $subject
60
+ *
61
+ * @return string
62
+ */
63
+ function apply_replaces( $subject ) {
64
+ $new = str_ireplace( $this->search, $this->replace, $subject, $count );
65
+ if ( $this->is_subdomain_replaces_on() ) {
66
+ $new = $this->subdomain_replaces( $new );
67
+ }
68
+
69
+ return $new;
70
+ }
71
+
72
+ /**
73
+ * Take a serialized array and unserialize it replacing elements as needed and
74
+ * unserialising any subordinate arrays and performing the replace on those too.
75
+ *
76
+ * Mostly from https://github.com/interconnectit/Search-Replace-DB
77
+ *
78
+ * @param array $data Used to pass any subordinate arrays back to in.
79
+ * @param bool $serialized Does the array passed via $data need serialising.
80
+ * @param bool $parent_serialized Passes whether the original data passed in was serialized
81
+ *
82
+ * @return array The original array with all elements replaced as needed.
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 = false;
91
+ // some unserialized data cannot be re-serialized eg. SimpleXMLElements
92
+ try {
93
+ if ( is_string( $data ) && ( $unserialized = @unserialize( $data ) ) !== false ) {
94
+ // PHP currently has a bug that doesn't allow you to clone the DateInterval / DatePeriod classes.
95
+ // We skip them here as they probably won't need data to be replaced anyway
96
+ if ( is_object( $unserialized ) ) {
97
+ if ( $unserialized instanceof DateInterval || $unserialized instanceof DatePeriod ) {
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;
109
+ unset( $_tmp );
110
+ } elseif ( is_object( $data ) ) { // Submitted by Tina Matter
111
+ $_tmp = clone $data;
112
+ foreach ( $data as $key => $value ) {
113
+ $_tmp->$key = $this->recursive_unserialize_replace( $value, false, $parent_serialized );
114
+ }
115
+
116
+ $data = $_tmp;
117
+ unset( $_tmp );
118
+ } elseif ( $this->wpmdb->is_json( $data, true ) ) {
119
+ $_tmp = array();
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;
127
+ unset( $_tmp );
128
+ $is_json = true;
129
+ } elseif ( is_string( $data ) ) {
130
+ list( $data, $do_replace ) = apply_filters( 'wpmdb_replace_custom_data', array( $data, true ), $this );
131
+
132
+ if ( $do_replace ) {
133
+ $data = $this->apply_replaces( $data );
134
+ }
135
+ }
136
+
137
+ if ( $serialized ) {
138
+ return serialize( $data );
139
+ }
140
+
141
+ if ( $is_json ) {
142
+ return json_encode( $data );
143
+ }
144
+ } catch ( Exception $error ) {
145
+ $error_msg = __( 'Failed attempting to do the recursive unserialize replace. Please contact support.', 'wp-migrate-db' );
146
+ $error_details = $error->getMessage() . "\n\n";
147
+ $error_details .= var_export( $data, true );
148
+ $this->wpmdb->log_error( $error_msg, $error_details );
149
+ }
150
+
151
+ return $data;
152
+ }
153
+
154
+ /**
155
+ * Getter for the $table class property.
156
+ *
157
+ * @return string Name of the table currently being processed in the migration.
158
+ */
159
+ public function get_table() {
160
+ return $this->table;
161
+ }
162
+
163
+ /**
164
+ * Getter for the $column class property.
165
+ *
166
+ * @return string Name of the column currently being processed in the migration.
167
+ */
168
+ public function get_column() {
169
+ return $this->column;
170
+ }
171
+
172
+ /**
173
+ * Getter for the $row class property.
174
+ *
175
+ * @return string Name of the row currently being processed in the migration.
176
+ */
177
+ public function get_row() {
178
+ return $this->row;
179
+ }
180
+
181
+ /**
182
+ * Setter for the $column class property.
183
+ *
184
+ * @param string $column Name of the column currently being processed in the migration.
185
+ */
186
+ public function set_column( $column ) {
187
+ $this->column = $column;
188
+ }
189
+
190
+ /**
191
+ * Setter for the $row class property.
192
+ *
193
+ * @param string $row Name of the row currently being processed in the migration.
194
+ */
195
+ public function set_row( $row ) {
196
+ $this->row = $row;
197
+ }
198
+
199
+ /**
200
+ * Multsite safe way of comparing the table currently being processed in the migration against a desired table.
201
+ *
202
+ * The table prefix should be omitted, example:
203
+ *
204
+ * $is_posts = $this->table_is( 'posts' );
205
+ *
206
+ * @param string $desired_table Name of the desired table, table prefix omitted.
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
+ }
class/wpmdb-utils.php CHANGED
@@ -1,4 +1,5 @@
1
  <?php
 
2
  class WPMDB_Utils {
3
 
4
  /**
@@ -24,5 +25,4 @@ class WPMDB_Utils {
24
 
25
  return true;
26
  }
27
-
28
  }
1
  <?php
2
+
3
  class WPMDB_Utils {
4
 
5
  /**
25
 
26
  return true;
27
  }
 
28
  }
class/wpmdb.php CHANGED
@@ -1,4 +1,5 @@
1
  <?php
 
2
  class WPMDB extends WPMDB_Base {
3
  protected $fp;
4
  protected $absolute_root_file_path;
@@ -23,52 +24,15 @@ class WPMDB extends WPMDB_Base {
23
  protected $lock_url_find_replace_row = false;
24
  protected $subdomain_replaces_on;
25
  protected $domain_replace;
26
- protected $tables;
27
  protected $checkbox_options;
 
28
 
29
  function __construct( $plugin_file_path ) {
30
  parent::__construct( $plugin_file_path );
31
 
32
- $this->plugin_version = $GLOBALS['wpmdb_meta'][$this->core_slug]['version'];
33
-
34
- $this->max_insert_string_len = 50000; // 50000 is the default as defined by phphmyadmin
35
-
36
- $default_settings = array(
37
- 'key' => $this->generate_key(),
38
- 'allow_pull' => false,
39
- 'allow_push' => false,
40
- 'profiles' => array(),
41
- 'licence' => '',
42
- 'verify_ssl' => false,
43
- 'blacklist_plugins' => array(),
44
- );
45
-
46
- if ( empty( $this->settings['max_request'] ) ) {
47
- $this->settings['max_request'] = min( 1024 * 1024, $this->get_bottleneck( 'max' ) );
48
- update_option( 'wpmdb_settings', $this->settings );
49
- }
50
-
51
- // if no settings exist then this is a fresh install, set up some default settings
52
- if ( empty( $this->settings ) ) {
53
- $this->settings = $default_settings;
54
- update_option( 'wpmdb_settings', $this->settings );
55
- } else {
56
- // When we add a new setting, an existing customer's db won't have this
57
- // new setting, so we need to add it. Otherwise, they'll see
58
- // array index errors in debug mode
59
- $update_settings = false;
60
-
61
- foreach ( $default_settings as $key => $value ) {
62
- if ( ! isset( $this->settings[$key] ) ) {
63
- $this->settings[$key] = $value;
64
- $update_settings = true;
65
- }
66
- }
67
 
68
- if ( $update_settings ) {
69
- update_option( 'wpmdb_settings', $this->settings );
70
- }
71
- }
72
 
73
  add_filter( 'plugin_action_links_' . $this->plugin_basename, array( $this, 'plugin_action_links' ) );
74
  add_filter( 'network_admin_plugin_action_links_' . $this->plugin_basename, array( $this, 'plugin_action_links' ) );
@@ -88,12 +52,12 @@ class WPMDB extends WPMDB_Base {
88
  add_action( 'wp_ajax_wpmdb_cancel_migration', array( $this, 'ajax_cancel_migration' ) );
89
 
90
  $absolute_path = rtrim( ABSPATH, '\\/' );
91
- $site_url = rtrim( site_url( '', 'http' ), '\\/' );
92
- $home_url = rtrim( home_url( '', 'http' ), '\\/' );
93
  if ( $site_url != $home_url ) {
94
  $difference = str_replace( $home_url, '', $site_url );
95
  if ( strpos( $absolute_path, $difference ) !== false ) {
96
- $absolute_path = rtrim( substr( $absolute_path, 0, -strlen( $difference ) ), '\\/' );
97
  }
98
  }
99
  $this->absolute_root_file_path = $absolute_path;
@@ -121,36 +85,39 @@ class WPMDB extends WPMDB_Base {
121
  'exclude_transients',
122
  'exclude_post_types',
123
  'exclude_post_revisions',
 
124
  );
125
 
126
  $this->default_profile = array(
127
- 'action' => 'savefile',
128
- 'save_computer' => '1',
129
- 'gzip_file' => '1',
130
- 'table_migrate_option' => 'migrate_only_with_prefix',
131
- 'replace_guids' => '1',
132
- 'default_profile' => true,
133
- 'name' => '',
134
- 'select_tables' => array(),
135
- 'select_post_types' => array(),
136
- 'backup_option' => 'backup_only_with_prefix',
137
- 'exclude_transients' => '1',
 
138
  );
139
 
140
  $this->checkbox_options = array(
141
- 'save_computer' => '0',
142
- 'gzip_file' => '0',
143
- 'replace_guids' => '0',
144
- 'exclude_spam' => '0',
145
- 'keep_active_plugins' => '0',
146
- 'create_backup' => '0',
147
- 'exclude_post_types' => '0',
 
148
  );
149
 
150
  $this->plugin_tabs = array(
151
- '<a href="#" class="nav-tab nav-tab-active js-action-link migrate" data-div-name="migrate-tab">' . __( 'Migrate', 'wp-migrate-db' ) . '</a>',
152
- '<a href="#" class="nav-tab js-action-link settings" data-div-name="settings-tab">' . __( 'Settings', 'wp-migrate-db' ) . '</a>',
153
- '<a href="#" class="nav-tab js-action-link help" data-div-name="help-tab">' . __( 'Help', 'wp-migrate-db' ) . '</a>',
154
  );
155
 
156
  // automatically deactivate WPMDB Pro / Free if the other is already active
@@ -159,6 +126,9 @@ class WPMDB extends WPMDB_Base {
159
  // display a notice when either WP Migrate DB or WP Migrate DB Pro is automatically deactivated
160
  add_action( 'pre_current_active_plugins', array( $this, 'plugin_deactivated_notice' ) );
161
 
 
 
 
162
  // this is how many DB rows are processed at a time, allow devs to change this value
163
  $this->rows_per_segment = apply_filters( 'wpmdb_rows_per_segment', $this->rows_per_segment );
164
 
@@ -182,6 +152,7 @@ class WPMDB extends WPMDB_Base {
182
 
183
  global $wpdb;
184
  $this->alter_table_name = apply_filters( 'wpmdb_alter_table_name', $wpdb->prefix . 'wpmdb_alter_statements' );
 
185
  return $this->alter_table_name;
186
  }
187
 
@@ -194,17 +165,19 @@ class WPMDB extends WPMDB_Base {
194
  $this->create_alter_table_query = sprintf( "DROP TABLE IF EXISTS `%s`;\n", $alter_table_name );
195
  $this->create_alter_table_query .= sprintf( "CREATE TABLE `%s` ( `query` longtext NOT NULL );\n", $alter_table_name );
196
  $this->create_alter_table_query = apply_filters( 'wpmdb_create_alter_table_query', $this->create_alter_table_query );
 
197
  return $this->create_alter_table_query;
198
  }
199
 
200
  function get_short_uploads_dir() {
201
  $short_path = str_replace( $this->absolute_root_file_path, '', $this->get_upload_info( 'path' ) );
 
202
  return trailingslashit( substr( str_replace( '\\', '/', $short_path ), 1 ) );
203
  }
204
 
205
  function get_upload_info( $type = 'path' ) {
206
  // Let developers define their own path to for export files
207
- // Note: We require a very specific data set here, it should be similiar to the following
208
  // array(
209
  // 'path' => '/path/to/custom/uploads/directory', <- note missing end trailing slash
210
  // 'url' => 'http://yourwebsite.com/custom/uploads/directory' <- note missing end trailing slash
@@ -212,52 +185,64 @@ class WPMDB extends WPMDB_Base {
212
  $upload_info = apply_filters( 'wpmdb_upload_info', array() );
213
 
214
  if ( ! empty( $upload_info ) ) {
215
- return $upload_info[$type];
216
  }
217
 
218
  $upload_dir = wp_upload_dir();
219
 
220
  $upload_info['path'] = $upload_dir['basedir'];
221
- $upload_info['url'] = $upload_dir['baseurl'];
222
 
223
  $upload_dir_name = apply_filters( 'wpmdb_upload_dir_name', 'wp-migrate-db' );
224
 
225
- if ( ! file_exists( $upload_dir['basedir'] . DS . $upload_dir_name ) ) {
226
  $url = wp_nonce_url( $this->plugin_base, 'wp-migrate-db-pro-nonce' );
227
 
228
- if ( false === @mkdir( $upload_dir['basedir'] . DS . $upload_dir_name, 0755 ) ) {
229
- return $upload_info[$type];
 
230
  }
231
 
232
- $filename = $upload_dir['basedir'] . DS . $upload_dir_name . DS . 'index.php';
 
233
  if ( false === @file_put_contents( $filename, "<?php\r\n// Silence is golden\r\n?>" ) ) {
234
- return $upload_info[$type];
235
  }
236
  }
237
 
238
- $upload_info['path'] .= DS . $upload_dir_name;
 
 
 
 
 
 
 
 
239
  $upload_info['url'] .= '/' . $upload_dir_name;
240
 
241
- return $upload_info[$type];
242
  }
243
 
244
  function ajax_plugin_compatibility() {
 
245
  $mu_dir = ( defined( 'WPMU_PLUGIN_DIR' ) && defined( 'WPMU_PLUGIN_URL' ) ) ? WPMU_PLUGIN_DIR : trailingslashit( WP_CONTENT_DIR ) . 'mu-plugins';
246
  $source = trailingslashit( $this->plugin_dir_path ) . 'compatibility/wp-migrate-db-pro-compatibility.php';
247
- $dest = trailingslashit( $mu_dir ) . 'wp-migrate-db-pro-compatibility.php';
248
- if ( '1' === trim( $_POST['install'] ) ) { // install MU plugin
249
  if ( ! wp_mkdir_p( $mu_dir ) ) {
250
- _e( sprintf( 'The following directory could not be created: %s', $mu_dir ), 'wp-migrate-db' );
251
  exit;
252
  }
253
 
254
  if ( ! copy( $source, $dest ) ) {
255
- _e( sprintf( 'Could not copy the compatibility plugin from %1$s to %2$s', $source, $dest ), 'wp-migrate-db' );
256
  exit;
257
  }
258
  } else { // uninstall MU plugin
 
259
  if ( file_exists( $dest ) && ! unlink( $dest ) ) {
260
- _e( sprintf( 'Could not remove the compatibility plugin from %s', $dest ), 'wp-migrate-db' );
261
  exit;
262
  }
263
  }
@@ -265,16 +250,19 @@ class WPMDB extends WPMDB_Base {
265
  }
266
 
267
  function ajax_blacklist_plugins() {
268
- $this->settings['blacklist_plugins'] = $_POST['blacklist_plugins'];
269
- update_option( 'wpmdb_settings', $this->settings );
 
270
  exit;
271
  }
272
 
273
  function ajax_update_max_request_size() {
274
  $this->check_ajax_referer( 'update-max-request-size' );
275
- $this->settings['max_request'] = (int) $_POST['max_request_size'] * 1024;
276
- update_option( 'wpmdb_settings', $this->settings );
 
277
  $result = $this->end_ajax();
 
278
  return $result;
279
  }
280
 
@@ -283,7 +271,8 @@ class WPMDB extends WPMDB_Base {
283
  if ( $strict == true && ! is_array( $json ) ) {
284
  return false;
285
  }
286
- return ! ( $json == NULL || $json == false );
 
287
  }
288
 
289
  function get_sql_dump_info( $migration_type, $info_type ) {
@@ -291,21 +280,41 @@ class WPMDB extends WPMDB_Base {
291
  $this->session_salt = strtolower( wp_generate_password( 5, false, false ) );
292
  }
293
  $datetime = date( 'YmdHis' );
294
- $ds = ( $info_type == 'path' ? DS : '/' );
295
- return 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 );
 
296
  }
297
 
 
 
 
 
 
 
 
298
  function parse_migration_form_data( $data ) {
299
  parse_str( $data, $form_data );
 
 
 
 
 
300
  $this->accepted_fields = apply_filters( 'wpmdb_accepted_profile_fields', $this->accepted_fields );
301
  $form_data = array_intersect_key( $form_data, array_flip( $this->accepted_fields ) );
302
  unset( $form_data['replace_old'][0] );
303
  unset( $form_data['replace_new'][0] );
304
 
 
 
 
 
 
 
 
305
  if ( isset( $form_data['exclude_post_revisions'] ) ) {
306
- $form_data['exclude_post_types'] = '1';
307
  $form_data['select_post_types'][] = 'revision';
308
- $form_data['select_post_types'] = array_unique( $form_data['select_post_types'] );
309
  unset( $form_data['exclude_post_revisions'] );
310
  }
311
 
@@ -313,15 +322,17 @@ class WPMDB extends WPMDB_Base {
313
  }
314
 
315
  function plugin_action_links( $links ) {
316
- $link = sprintf( '<a href="%s">%s</a>', network_admin_url( $this->plugin_base ), __( 'Settings', 'wp-migrate-db' ) );
317
  array_unshift( $links, $link );
 
318
  return $links;
319
  }
320
 
321
  function ajax_clear_log() {
322
  $this->check_ajax_referer( 'clear-log' );
323
- delete_option( 'wpmdb_error_log' );
324
  $result = $this->end_ajax();
 
325
  return $result;
326
  }
327
 
@@ -332,13 +343,14 @@ class WPMDB extends WPMDB_Base {
332
  $this->output_log_file();
333
  $return = ob_get_clean();
334
  $result = $this->end_ajax( $return );
 
335
  return $result;
336
  }
337
 
338
  function output_log_file() {
339
- $log = get_option( 'wpmdb_error_log' );
340
- if ( $log ) {
341
- echo $log;
342
  }
343
  }
344
 
@@ -347,24 +359,24 @@ class WPMDB extends WPMDB_Base {
347
  global $wpdb;
348
 
349
  echo 'site_url(): ';
350
- echo site_url();
351
  echo "\r\n";
352
 
353
  echo 'home_url(): ';
354
- echo home_url();
355
  echo "\r\n";
356
 
357
  echo 'Table Prefix: ';
358
- echo $table_prefix;
359
  echo "\r\n";
360
 
361
  echo 'WordPress: ';
362
- echo ( is_multisite() ) ? 'WPMU' : 'MU';
363
  echo bloginfo( 'version' );
 
364
  echo "\r\n";
365
 
366
  echo 'Web Server: ';
367
- echo $_SERVER['SERVER_SOFTWARE'];
368
  echo "\r\n";
369
 
370
  echo 'PHP: ';
@@ -377,51 +389,59 @@ class WPMDB extends WPMDB_Base {
377
  echo esc_html( empty( $wpdb->use_mysqli ) ? mysql_get_server_info() : mysqli_get_server_info( $wpdb->dbh ) );
378
  echo "\r\n";
379
 
380
- _e( 'ext/mysqli', 'wp-app-store' ); echo ': ';
381
  echo empty( $wpdb->use_mysqli ) ? 'no' : 'yes';
382
  echo "\r\n";
383
 
384
- _e( 'WP Memory Limit', 'wp-app-store' ); echo ': ';
385
- echo WP_MEMORY_LIMIT;
386
  echo "\r\n";
387
 
388
  echo 'WPMDB Bottleneck: ';
389
- echo size_format( $this->get_bottleneck() );
 
 
 
 
 
 
 
 
390
  echo "\r\n";
391
 
392
  if ( function_exists( 'ini_get' ) && $suhosin_limit = ini_get( 'suhosin.post.max_value_length' ) ) {
393
  echo 'Suhosin Post Max Value Length: ';
394
- echo is_numeric( $suhosin_limit ) ? size_format( $suhosin_limit ) : $suhosin_limit;
395
  echo "\r\n";
396
  }
397
 
398
  if ( function_exists( 'ini_get' ) && $suhosin_limit = ini_get( 'suhosin.request.max_value_length' ) ) {
399
  echo 'Suhosin Request Max Value Length: ';
400
- echo is_numeric( $suhosin_limit ) ? size_format( $suhosin_limit ) : $suhosin_limit;
401
  echo "\r\n";
402
  }
403
 
404
  echo 'Debug Mode: ';
405
- echo ( defined( 'WP_DEBUG' ) && WP_DEBUG ) ? 'Yes' : 'No';
406
  echo "\r\n";
407
 
408
  echo 'WP Max Upload Size: ';
409
- echo size_format( wp_max_upload_size() );
410
  echo "\r\n";
411
 
412
  echo 'PHP Post Max Size: ';
413
- echo size_format( $this->get_post_max_size() );
414
  echo "\r\n";
415
 
416
  echo 'PHP Time Limit: ';
417
  if ( function_exists( 'ini_get' ) ) {
418
- echo ini_get( 'max_execution_time' );
419
  }
420
  echo "\r\n";
421
 
422
  echo 'PHP Error Log: ';
423
  if ( function_exists( 'ini_get' ) ) {
424
- echo ini_get( 'error_log' );
425
  }
426
  echo "\r\n";
427
 
@@ -435,7 +455,7 @@ class WPMDB extends WPMDB_Base {
435
 
436
  echo 'OpenSSL: ';
437
  if ( $this->open_ssl_enabled() ) {
438
- echo OPENSSL_VERSION_TEXT;
439
  } else {
440
  echo 'Disabled';
441
  }
@@ -448,10 +468,34 @@ class WPMDB extends WPMDB_Base {
448
  echo 'Disabled';
449
  }
450
  echo "\r\n";
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
451
  echo "\r\n";
452
 
453
  echo "Active Plugins:\r\n";
454
 
 
 
 
 
 
 
 
 
455
  $active_plugins = (array) get_option( 'active_plugins', array() );
456
 
457
  if ( is_multisite() ) {
@@ -460,31 +504,57 @@ class WPMDB extends WPMDB_Base {
460
  }
461
 
462
  foreach ( $active_plugins as $plugin ) {
463
- $plugin_data = @get_plugin_data( WP_PLUGIN_DIR . '/' . $plugin );
464
- if ( empty( $plugin_data['Name'] ) ) {
465
- continue;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
466
  }
467
- printf( "%s (v%s) by %s\r\n", $plugin_data['Name'], $plugin_data['Version'], $plugin_data['AuthorName'] );
468
  }
469
 
470
  echo "\r\n";
 
 
 
 
 
 
 
 
 
 
 
471
  }
472
 
473
  function remove_wp_plugin_dir( $name ) {
474
  $plugin = str_replace( WP_PLUGIN_DIR, '', $name );
 
475
  return substr( $plugin, 1 );
476
  }
477
 
478
  function get_alter_queries() {
479
  global $wpdb;
480
  $alter_table_name = $this->get_alter_table_name();
481
- $sql = '';
482
- $alter_queries = $wpdb->get_results( "SELECT * FROM `{$alter_table_name}`", ARRAY_A );
483
  if ( ! empty( $alter_queries ) ) {
484
  foreach ( $alter_queries as $alter_query ) {
485
  $sql .= $alter_query['query'];
486
  }
487
  }
 
488
  return $sql;
489
  }
490
 
@@ -509,6 +579,7 @@ class WPMDB extends WPMDB_Base {
509
  if ( false === $wpdb->query( $query ) ) {
510
  $return = ob_get_clean();
511
  $result = $this->end_ajax( $return );
 
512
  return $result;
513
  }
514
  }
@@ -516,28 +587,50 @@ class WPMDB extends WPMDB_Base {
516
  return true;
517
  }
518
 
 
 
 
 
 
519
  function ajax_migrate_table() {
520
  $this->check_ajax_referer( 'migrate-table' );
 
521
  global $wpdb;
522
 
523
- $this->form_data = $this->parse_migration_form_data( $_POST['form_data'] );
524
 
525
  $result = '';
526
 
527
  // checks if we're performing a backup, if so, continue with the backup and exit immediately after
528
- if ( $_POST['stage'] == 'backup' && $_POST['intent'] != 'savefile' ) {
529
  // if performing a push we need to backup the REMOTE machine's DB
530
- if ( $_POST['intent'] == 'push' ) {
531
- $data = $_POST;
532
- if ( isset( $data['nonce'] ) ) {
533
- unset( $data['nonce'] );
534
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
535
  $data['action'] = 'wpmdb_backup_remote_table';
536
  $data['intent'] = 'pull';
537
- $ajax_url = trailingslashit( $_POST['url'] ) . 'wp-admin/admin-ajax.php';
538
- $data['primary_keys'] = stripslashes( $data['primary_keys'] );
539
- $data['sig'] = $this->create_signature( $data, $data['key'] );
540
- $response = $this->remote_post( $ajax_url, $data, __FUNCTION__ );
541
  ob_start();
542
  $this->display_errors();
543
  $return = ob_get_clean();
@@ -547,32 +640,52 @@ class WPMDB extends WPMDB_Base {
547
  }
548
 
549
  $result = $this->end_ajax( $return );
 
550
  return $result;
551
  }
552
 
553
  // Pull and push need to be handled differently for obvious reasons, trigger different code depending on the migration intent (push or pull)
554
- if ( $_POST['intent'] == 'push' || $_POST['intent'] == 'savefile' ) {
555
  $this->maximum_chunk_size = $this->get_bottleneck();
556
 
557
- if ( isset( $_POST['bottleneck'] ) ) {
558
- $this->maximum_chunk_size = (int) $_POST['bottleneck'];
559
  }
560
 
561
- if ( $_POST['intent'] == 'push' ) {
562
- $this->remote_key = $_POST['key'];
563
- $this->remote_url = $_POST['url'];
564
  }
565
 
566
- $sql_dump_file_name = $this->get_upload_info( 'path' ) . DS;
567
- $sql_dump_file_name .= $this->format_dump_name( $_POST['dump_filename'] );
568
 
569
- if ( $_POST['intent'] == 'savefile' ) {
570
  $this->fp = $this->open( $sql_dump_file_name );
571
  }
572
 
573
- $result = $this->export_table( $_POST['table'] );
 
 
 
 
 
 
 
 
 
 
 
 
 
574
 
575
- if ( $_POST['intent'] == 'savefile' ) {
 
 
 
 
 
 
576
  $this->close( $this->fp );
577
  }
578
 
@@ -581,22 +694,19 @@ class WPMDB extends WPMDB_Base {
581
  $maybe_errors = trim( ob_get_clean() );
582
  if ( false === empty( $maybe_errors ) ) {
583
  $result = $this->end_ajax( $maybe_errors );
 
584
  return $result;
585
  }
586
 
587
  return $result;
588
  } else {
589
- $data = $_POST;
590
-
591
- if ( isset( $data['nonce'] ) ) {
592
- unset( $data['nonce'] );
593
- }
594
-
595
  $data['action'] = 'wpmdb_process_pull_request';
596
  $data['pull_limit'] = $this->get_sensible_pull_limit();
 
597
 
598
  if ( is_multisite() ) {
599
- $data['path_current_site'] = $this->get_path_current_site();
600
  $data['domain_current_site'] = $this->get_domain_current_site();
601
  }
602
 
@@ -606,8 +716,11 @@ class WPMDB extends WPMDB_Base {
606
  unset( $data['sig'] );
607
  }
608
 
 
 
 
 
609
  $ajax_url = trailingslashit( $data['url'] ) . 'wp-admin/admin-ajax.php';
610
- $data['primary_keys'] = stripslashes( $data['primary_keys'] );
611
  $data['sig'] = $this->create_signature( $data, $data['key'] );
612
 
613
  $response = $this->remote_post( $ajax_url, $data, __FUNCTION__ );
@@ -617,11 +730,13 @@ class WPMDB extends WPMDB_Base {
617
 
618
  if ( false === empty( $maybe_errors ) ) {
619
  $result = $this->end_ajax( $maybe_errors );
 
620
  return $result;
621
  }
622
 
623
  if ( strpos( $response, ';' ) === false ) {
624
  $result = $this->end_ajax( $response );
 
625
  return $result;
626
  }
627
 
@@ -629,20 +744,21 @@ class WPMDB extends WPMDB_Base {
629
  // need to split this up into a chunk and row_tracker
630
  $row_information = trim( substr( strrchr( $response, "\n" ), 1 ) );
631
  $row_information = explode( ',', $row_information );
632
- $chunk = substr( $response, 0, strrpos( $response, ";\n" ) + 1 );
633
 
634
  if ( ! empty( $chunk ) ) {
635
  $process_chunk_result = $this->process_chunk( $chunk );
636
  if ( true !== $process_chunk_result ) {
637
  $result = $this->end_ajax( $process_chunk_result );
 
638
  return $result;
639
  }
640
  }
641
 
642
  $result = $this->end_ajax( json_encode(
643
  array(
644
- 'current_row' => $row_information[0],
645
- 'primary_keys' => $row_information[1]
646
  )
647
  ) );
648
  }
@@ -650,22 +766,30 @@ class WPMDB extends WPMDB_Base {
650
  return $result;
651
  }
652
 
653
- // Occurs right before the first table is migrated / backed up during the migration process
654
- // Does a quick check to make sure the verification string is valid and also opens / creates files for writing to (if required)
 
 
 
 
 
655
  function ajax_initiate_migration() {
 
656
  $this->check_ajax_referer( 'initiate-migration' );
657
- $this->form_data = $this->parse_migration_form_data( $_POST['form_data'] );
 
658
 
659
- if ( $_POST['intent'] == 'savefile' ) {
660
  $return = array(
661
- 'code' => 200,
662
  'message' => 'OK',
663
- 'body' => json_encode( array( 'error' => 0 ) ),
664
  );
665
 
666
- $return['dump_filename'] = basename( $this->get_sql_dump_info( 'migrate', 'path' ) );
667
- $return['dump_url'] = $this->get_sql_dump_info( 'migrate', 'url' );
668
- $dump_filename_no_extension = substr( $return['dump_filename'], 0, -4 );
 
669
 
670
  $create_alter_table_query = $this->get_create_alter_table_query();
671
  // sets up our table to store 'ALTER' queries
@@ -673,33 +797,36 @@ class WPMDB extends WPMDB_Base {
673
 
674
  if ( true !== $process_chunk_result ) {
675
  $result = $this->end_ajax( $process_chunk_result );
 
676
  return $result;
677
  }
678
 
679
  if ( $this->gzip() && isset( $this->form_data['gzip_file'] ) ) {
 
680
  $return['dump_filename'] .= '.gz';
681
  $return['dump_url'] .= '.gz';
682
  }
683
 
684
- $this->fp = $this->open( $this->get_upload_info( 'path' ) . DS . $return['dump_filename'] );
685
  $this->db_backup_header();
686
  $this->close( $this->fp );
687
 
688
  $return['dump_filename'] = $dump_filename_no_extension;
689
  } else { // does one last check that our verification string is valid
690
  $data = array(
691
- 'action' => 'wpmdb_remote_initiate_migration',
692
- 'intent' => $_POST['intent'],
693
- 'form_data' => $_POST['form_data'],
694
  );
695
 
696
- $data['sig'] = $this->create_signature( $data, $_POST['key'] );
697
- $ajax_url = trailingslashit( $_POST['url'] ) . 'wp-admin/admin-ajax.php';
698
- $response = $this->remote_post( $ajax_url, $data, __FUNCTION__ );
699
 
700
  if ( false === $response ) {
701
  $return = array( 'wpmdb_error' => 1, 'body' => $this->error );
702
  $result = $this->end_ajax( json_encode( $return ) );
 
703
  return $result;
704
  }
705
 
@@ -710,42 +837,57 @@ class WPMDB extends WPMDB_Base {
710
  $return = array( 'wpmdb_error' => 1, 'body' => $error_msg );
711
  $this->log_error( $error_msg, $response );
712
  $result = $this->end_ajax( json_encode( $return ) );
 
713
  return $result;
714
  }
715
 
716
  if ( isset( $return['error'] ) && $return['error'] == 1 ) {
717
  $return = array( 'wpmdb_error' => 1, 'body' => $return['message'] );
718
  $result = $this->end_ajax( json_encode( $return ) );
 
719
  return $result;
720
  }
721
 
722
- if ( $_POST['intent'] == 'pull' ) {
723
  // sets up our table to store 'ALTER' queries
724
  $create_alter_table_query = $this->get_create_alter_table_query();
725
- $process_chunk_result = $this->process_chunk( $create_alter_table_query );
726
  if ( true !== $process_chunk_result ) {
727
  $result = $this->end_ajax( $process_chunk_result );
 
728
  return $result;
729
  }
730
  }
731
 
732
- if ( ! empty( $this->form_data['create_backup'] ) && $_POST['intent'] == 'pull' ) {
733
  $return['dump_filename'] = basename( $this->get_sql_dump_info( 'backup', 'path' ) );
734
- $return['dump_filename'] = substr( $return['dump_filename'], 0, -4 );
735
- $return['dump_url'] = $this->get_sql_dump_info( 'backup', 'url' );
736
  }
737
  }
738
 
739
  $return['dump_filename'] = ( empty( $return['dump_filename'] ) ) ? '' : $return['dump_filename'];
740
- $return['dump_url'] = ( empty( $return['dump_url'] ) ) ? '' : $return['dump_url'];
 
 
 
 
 
 
 
 
 
 
741
 
742
  $result = $this->end_ajax( json_encode( $return ) );
 
743
  return $result;
744
  }
745
 
746
  function ajax_save_profile() {
747
  $this->check_ajax_referer( 'save-profile' );
748
- $profile = $this->parse_migration_form_data( $_POST['profile'] );
 
749
  $profile = wp_parse_args( $profile, $this->checkbox_options );
750
 
751
  if ( isset( $profile['save_migration_profile_option'] ) && $profile['save_migration_profile_option'] == 'new' ) {
@@ -753,50 +895,42 @@ class WPMDB extends WPMDB_Base {
753
  $this->settings['profiles'][] = $profile;
754
  } else {
755
  $key = $profile['save_migration_profile_option'];
756
- $name = $this->settings['profiles'][$key]['name'];
757
- $this->settings['profiles'][$key] = $profile;
758
- $this->settings['profiles'][$key]['name'] = $name;
759
  }
760
 
761
- update_option( 'wpmdb_settings', $this->settings );
762
  end( $this->settings['profiles'] );
763
- $key = key( $this->settings['profiles'] );
764
  $result = $this->end_ajax( $key );
 
765
  return $result;
766
  }
767
 
768
  function ajax_delete_migration_profile() {
769
  $this->check_ajax_referer( 'delete-migration-profile' );
770
- $key = absint( $_POST['profile_id'] );
771
- --$key;
 
772
  $return = '';
773
 
774
- if ( isset( $this->settings['profiles'][$key] ) ) {
775
- unset( $this->settings['profiles'][$key] );
776
- update_option( 'wpmdb_settings', $this->settings );
777
  } else {
778
  $return = '-1';
779
  }
780
 
781
  $result = $this->end_ajax( $return );
 
782
  return $result;
783
  }
784
 
785
  function format_table_sizes( $size ) {
786
  $size *= 1024;
787
- return size_format( $size );
788
- }
789
-
790
- // Generates our secret key
791
- function generate_key() {
792
- $keyset = 'abcdefghijklmnopqrstuvqxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/';
793
- $key = '';
794
-
795
- for ( $i = 0; $i < 32; $i++ ) {
796
- $key .= substr( $keyset, rand( 0, strlen( $keyset ) -1 ), 1 );
797
- }
798
 
799
- return $key;
800
  }
801
 
802
  function get_post_types() {
@@ -804,19 +938,22 @@ class WPMDB extends WPMDB_Base {
804
 
805
  if ( is_multisite() ) {
806
  $tables = $this->get_tables();
807
- $sql = "SELECT `post_type` FROM `{$wpdb->prefix}posts` ";
808
  foreach ( $tables as $table ) {
809
- if ( 0 == preg_match( '/' . $wpdb->prefix . '[0-9]+_posts/', $table ) ) continue;
 
 
810
  $blog_id = str_replace( array( $wpdb->prefix, '_posts' ), array( '', '' ), $table );
811
- $sql .= "UNION SELECT `post_type` FROM `{$wpdb->prefix}" . $blog_id . "_posts` ";
812
  }
813
- $sql .= ";";
814
  $post_types = $wpdb->get_results( $sql, ARRAY_A );
815
  } else {
816
  $post_types = $wpdb->get_results(
817
  "SELECT DISTINCT `post_type`
818
  FROM `{$wpdb->prefix}posts`
819
- WHERE 1;", ARRAY_A
 
820
  );
821
  }
822
 
@@ -831,97 +968,68 @@ class WPMDB extends WPMDB_Base {
831
 
832
  // Retrieves the specified profile, if -1, returns the default profile
833
  function get_profile( $profile_id ) {
834
- --$profile_id;
835
 
836
- if ( $profile_id == '-1' || ! isset( $this->settings['profiles'][$profile_id] ) ) {
837
  return $this->default_profile;
838
  }
839
 
840
- return $this->settings['profiles'][$profile_id];
841
  }
842
 
843
  function get_table_row_count() {
844
  global $wpdb;
845
 
846
- $sql = $wpdb->prepare( "SELECT table_name, TABLE_ROWS FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = %s", DB_NAME );
847
  $results = $wpdb->get_results( $sql, ARRAY_A );
848
 
849
  $return = array();
850
 
851
  foreach ( $results as $results ) {
852
- $return[$results['table_name']] = ( $results['TABLE_ROWS'] == 0 ? 1 : $results['TABLE_ROWS'] );
853
  }
854
 
855
  return $return;
856
  }
857
 
858
- function get_table_sizes( $scope = 'regular' ) {
 
 
 
 
 
 
 
859
  global $wpdb;
860
 
861
- $prefix = ( $scope == 'temp' ? $this->temp_prefix : $wpdb->prefix );
 
 
 
 
 
 
862
 
863
  $sql = $wpdb->prepare(
864
  "SELECT TABLE_NAME AS 'table',
865
- ROUND ( ( data_length + index_length ) / 1024, 0 ) AS 'size'
866
  FROM information_schema.TABLES
867
  WHERE information_schema.TABLES.table_schema='%s'
868
- AND information_schema.TABLES.table_type='%s'", DB_NAME, 'BASE TABLE'
 
 
869
  );
870
 
871
  $results = $wpdb->get_results( $sql, ARRAY_A );
872
 
873
- $return = array();
874
-
875
- foreach ( $results as $result ) {
876
- $return[$result['table']] = $result['size'];
877
- }
878
-
879
- return apply_filters( 'wpmdb_table_sizes', $return, $scope );
880
- }
881
-
882
- function get_post_max_size() {
883
- $val = trim( ini_get( 'post_max_size' ) );
884
- $last = strtolower( $val[ strlen( $val ) - 1 ] );
885
-
886
- switch ( $last ) {
887
- case 'g':
888
- $val *= 1024;
889
- case 'm':
890
- $val *= 1024;
891
- case 'k':
892
- $val *= 1024;
893
- }
894
-
895
- return $val;
896
- }
897
-
898
- function get_bottleneck( $type = 'regular' ) {
899
- $suhosin_limit = false;
900
- $suhosin_request_limit = false;
901
- $suhosin_post_limit = false;
902
-
903
- if ( function_exists( 'ini_get' ) ) {
904
- $suhosin_request_limit = $this->return_bytes( ini_get( 'suhosin.request.max_value_length' ) );
905
- $suhosin_post_limit = $this->return_bytes( ini_get( 'suhosin.post.max_value_length' ) );
906
- }
907
-
908
- if ( $suhosin_request_limit && $suhosin_post_limit ) {
909
- $suhosin_limit = min( $suhosin_request_limit, $suhosin_post_limit );
910
- }
911
-
912
- // we have to account for HTTP headers and other bloating, here we minus 1kb for bloat
913
- $post_max_upper_size = apply_filters( 'wpmdb_post_max_upper_size', 26214400 );
914
- $calculated_bottleneck = min( ( $this->get_post_max_size() - 1024 ), $post_max_upper_size );
915
-
916
- if ( $suhosin_limit ) {
917
- $calculated_bottleneck = min( $calculated_bottleneck, $suhosin_limit - 1024 );
918
- }
919
-
920
- if ( $type != 'max' ) {
921
- $calculated_bottleneck = min( $calculated_bottleneck, $this->settings['max_request'] );
922
  }
923
 
924
- return apply_filters( 'wpmdb_bottleneck', $calculated_bottleneck );
 
925
  }
926
 
927
  function format_dump_name( $dump_name ) {
@@ -939,66 +1047,27 @@ class WPMDB extends WPMDB_Base {
939
  $this->template( 'options' );
940
  }
941
 
942
- function apply_replaces( $subject, $is_serialized = false ) {
943
- $search = $this->form_data['replace_old'];
944
- $replace = $this->form_data['replace_new'];
945
- $new = str_ireplace( $search, $replace, $subject, $count );
946
- if ( $this->is_subdomain_replaces_on() ) {
947
- $new = $this->subdomain_replaces( $new );
948
- }
949
- return $new;
950
- }
951
-
952
- /**
953
- * Determine whether to apply a subdomain replace over each value in the database.
954
- *
955
- * @return bool
956
- */
957
- function is_subdomain_replaces_on() {
958
- if ( ! isset( $this->subdomain_replaces_on ) ) {
959
- $this->subdomain_replaces_on = ( is_multisite() && defined( 'SUBDOMAIN_INSTALL' ) && SUBDOMAIN_INSTALL && apply_filters( 'wpmdb_subdomain_replace', true ) );
960
- }
961
- return $this->subdomain_replaces_on;
962
- }
963
-
964
  /**
965
  * Get the remote site's base domain for subdomain multisite search/replace.
966
  *
967
  * @return string|bool The remote site's domain or false on error.
968
  */
969
  function get_domain_replace() {
 
 
970
  if ( ! isset( $this->domain_replace ) ) {
971
- if ( ! empty( $_POST['domain_current_site'] ) ) {
972
- $this->domain_replace = $_POST['domain_current_site'];
973
  } elseif ( ! empty ( $this->form_data['replace_new'][1] ) ) { // occurs when performing an export migration
974
  $url = $this->form_data['replace_new'][1];
975
- $url = ( 0 === strpos( $url, '//' ) ) ? 'http:' . $url : $url;
976
- $url = parse_url( $url );
977
  $this->domain_replace = $url['host'];
978
  } else {
979
  $this->domain_replace = false;
980
  }
981
  }
982
- return $this->domain_replace;
983
- }
984
-
985
- /*
986
- * Automatically replace URLs for subdomain based multisite installations
987
- * e.g. //site1.example.com -> //site1.example.local for site with domain example.com
988
- * NB: only handles the current network site, does not work for additional networks / mapped domains
989
- */
990
- function subdomain_replaces( $new ) {
991
- $domain_replace = $this->get_domain_replace();
992
-
993
- if ( empty( $domain_replace ) ) {
994
- return $new;
995
- }
996
 
997
- $pattern = '|//(.*?)\\.' . preg_quote( $this->get_domain_current_site(), '|' ) . '|';
998
- $replacement = '//$1.' . trim( $domain_replace );
999
- $new = preg_replace( $pattern, $replacement, $new );
1000
-
1001
- return $new;
1002
  }
1003
 
1004
  function process_sql_constraint( $create_query, $table, &$alter_table_query ) {
@@ -1023,11 +1092,11 @@ class WPMDB extends WPMDB_Base {
1023
  $sql_count = count( $sql_lines );
1024
 
1025
  // lets find first line with constraints
1026
- for ( $i = 0; $i < $sql_count; $i++ ) {
1027
  if ( preg_match(
1028
- '@^[\s]*(CONSTRAINT|FOREIGN[\s]+KEY)@',
1029
- $sql_lines[$i]
1030
- ) ) {
1031
  break;
1032
  }
1033
  }
@@ -1035,40 +1104,38 @@ class WPMDB extends WPMDB_Base {
1035
  // If we really found a constraint
1036
  if ( $i != $sql_count ) {
1037
  // remove, from the end of create statement
1038
- $sql_lines[$i - 1] = preg_replace(
1039
  '@,$@',
1040
  '',
1041
- $sql_lines[$i - 1]
1042
  );
1043
 
1044
  // let's do the work
1045
- $sql_constraints_query .= 'ALTER TABLE '
1046
- . $this->backquote( $table )
1047
- . $crlf;
1048
 
1049
  $first = true;
1050
- for ( $j = $i; $j < $sql_count; $j++ ) {
1051
  if ( preg_match(
1052
- '@CONSTRAINT|FOREIGN[\s]+KEY@',
1053
- $sql_lines[$j]
1054
- ) ) {
1055
- if ( strpos( $sql_lines[$j], 'CONSTRAINT' ) === false ) {
1056
  $tmp_str = preg_replace(
1057
  '/(FOREIGN[\s]+KEY)/',
1058
  'ADD \1',
1059
- $sql_lines[$j]
1060
  );
1061
  $sql_constraints_query .= $tmp_str;
1062
  } else {
1063
  $tmp_str = preg_replace(
1064
  '/(CONSTRAINT)/',
1065
  'ADD \1',
1066
- $sql_lines[$j]
1067
  );
1068
  $sql_constraints_query .= $tmp_str;
1069
  preg_match(
1070
  '/(CONSTRAINT)([\s])([\S]*)([\s])/',
1071
- $sql_lines[$j],
1072
  $matches
1073
  );
1074
  }
@@ -1081,20 +1148,22 @@ class WPMDB extends WPMDB_Base {
1081
  $sql_constraints_query .= ";\n";
1082
 
1083
  $create_query = implode(
1084
- $crlf,
1085
- array_slice( $sql_lines, 0, $i )
1086
- )
1087
- . $crlf
1088
- . implode(
1089
- $crlf,
1090
- array_slice( $sql_lines, $j, $sql_count - 1 )
1091
- );
1092
  unset( $sql_lines );
1093
 
1094
  $alter_table_query = $sql_constraints_query;
 
1095
  return $create_query;
1096
  }
1097
  }
 
1098
  return $create_query;
1099
  }
1100
 
@@ -1105,86 +1174,90 @@ class WPMDB extends WPMDB_Base {
1105
  * Modified by Scott Merrill (http://www.skippy.net/)
1106
  * to use the WordPress $wpdb object
1107
  *
1108
- * @param string $table
1109
- * @return void
 
 
1110
  */
1111
- function export_table( $table ) {
1112
  global $wpdb;
1113
  $this->set_time_limit();
 
1114
 
1115
  if ( empty( $this->form_data ) ) {
1116
- $this->form_data = $this->parse_migration_form_data( $_POST['form_data'] );
1117
  }
1118
 
1119
- $temp_prefix = $this->temp_prefix;
1120
- $remote_prefix = ( isset( $_POST['prefix'] ) ? $_POST['prefix'] : $wpdb->prefix );
1121
 
1122
- $table_structure = $wpdb->get_results( "DESCRIBE " . $this->backquote( $table ) );
1123
 
1124
  if ( ! $table_structure ) {
1125
  $this->error = __( 'Failed to retrieve table structure, please ensure your database is online. (#125)', 'wp-migrate-db' );
1126
  return false;
1127
  }
1128
 
1129
- $current_row = -1;
1130
 
1131
- if ( ! empty( $_POST['current_row'] ) ) {
1132
- $temp_current_row = trim( $_POST['current_row'] );
1133
  if ( ! empty( $temp_current_row ) ) {
1134
  $current_row = (int) $temp_current_row;
1135
  }
1136
  }
1137
 
1138
- if ( $current_row == -1 ) {
1139
  // Add SQL statement to drop existing table
1140
- if ( $this->form_data['action'] == 'savefile' || $_POST['stage'] == 'backup' ) {
1141
  $this->stow( "\n\n" );
1142
  $this->stow( "#\n" );
1143
- $this->stow( "# " . sprintf( __( 'Delete any existing table %s', 'wp-migrate-db' ), $this->backquote( $table ) ) . "\n" );
1144
  $this->stow( "#\n" );
1145
  $this->stow( "\n" );
1146
- $this->stow( "DROP TABLE IF EXISTS " . $this->backquote( $table ) . ";\n" );
1147
  } else {
1148
- $this->stow( "DROP TABLE IF EXISTS " . $this->backquote( $temp_prefix . $table ) . ";\n" );
1149
  }
1150
 
1151
  // Table structure
1152
  // Comment in SQL-file
1153
- if ( $this->form_data['action'] == 'savefile' || $_POST['stage'] == 'backup' ) {
1154
  $this->stow( "\n\n" );
1155
  $this->stow( "#\n" );
1156
- $this->stow( "# " . sprintf( __( 'Table structure of table %s', 'wp-migrate-db' ), $this->backquote( $table ) ) . "\n" );
1157
  $this->stow( "#\n" );
1158
  $this->stow( "\n" );
1159
  }
1160
 
1161
- $create_table = $wpdb->get_results( "SHOW CREATE TABLE " . $this->backquote( $table ), ARRAY_N );
1162
 
1163
  if ( false === $create_table ) {
1164
  $this->error = __( 'Failed to generate the create table query, please ensure your database is online. (#126)', 'wp-migrate-db' );
1165
  return false;
1166
  }
1167
 
1168
- if ( $this->form_data['action'] != 'savefile' && $_POST['stage'] != 'backup' ) {
1169
  $create_table[0][1] = str_replace( 'CREATE TABLE `', 'CREATE TABLE `' . $temp_prefix, $create_table[0][1] );
1170
  }
1171
 
1172
  $create_table[0][1] = str_replace( 'TYPE=', 'ENGINE=', $create_table[0][1] );
1173
 
1174
- $alter_table_query = '';
1175
  $create_table[0][1] = $this->process_sql_constraint( $create_table[0][1], $table, $alter_table_query );
1176
 
1177
- $create_table[0][1] = apply_filters( 'wpmdb_create_table_query', $create_table[0][1], $table );
1178
 
1179
  $this->stow( $create_table[0][1] . ";\n" );
1180
 
1181
  if ( ! empty( $alter_table_query ) ) {
1182
  $alter_table_name = $this->get_alter_table_name();
1183
  $insert = sprintf( "INSERT INTO %s ( `query` ) VALUES ( '%s' );\n", $this->backquote( $alter_table_name ), esc_sql( $alter_table_query ) );
1184
- if ( $this->form_data['action'] == 'savefile' || $_POST['stage'] == 'backup' ) {
1185
  $process_chunk_result = $this->process_chunk( $insert );
1186
  if ( true !== $process_chunk_result ) {
1187
  $result = $this->end_ajax( $process_chunk_result );
 
1188
  return $result;
1189
  }
1190
  } else {
@@ -1193,7 +1266,7 @@ class WPMDB extends WPMDB_Base {
1193
  }
1194
 
1195
  // Comment in SQL-file
1196
- if ( $this->form_data['action'] == 'savefile' || $_POST['stage'] == 'backup' ) {
1197
  $this->stow( "\n\n" );
1198
  $this->stow( "#\n" );
1199
  $this->stow( '# ' . sprintf( __( 'Data contents of table %s', 'wp-migrate-db' ), $this->backquote( $table ) ) . "\n" );
@@ -1201,8 +1274,8 @@ class WPMDB extends WPMDB_Base {
1201
  }
1202
  }
1203
 
1204
- // $defs = mysql defaults, looks up the default for that paricular column, used later on to prevent empty inserts values for that column
1205
- // $ints = holds a list of the possible integar types so as to not wrap them in quotation marks later in the insert statements
1206
  $defs = array();
1207
  $ints = array();
1208
  foreach ( $table_structure as $struct ) {
@@ -1210,80 +1283,81 @@ class WPMDB extends WPMDB_Base {
1210
  ( 0 === strpos( strtolower( $struct->Type ), 'smallint' ) ) ||
1211
  ( 0 === strpos( strtolower( $struct->Type ), 'mediumint' ) ) ||
1212
  ( 0 === strpos( strtolower( $struct->Type ), 'int' ) ) ||
1213
- ( 0 === strpos( strtolower( $struct->Type ), 'bigint' ) ) ) {
1214
- $defs[strtolower( $struct->Field )] = ( null === $struct->Default ) ? 'NULL' : $struct->Default;
1215
- $ints[strtolower( $struct->Field )] = "1";
 
1216
  }
1217
  }
1218
 
1219
  // Batch by $row_inc
1220
 
1221
- $row_inc = $this->rows_per_segment;
1222
  $row_start = 0;
1223
- if ( $current_row != -1 ) {
1224
  $row_start = $current_row;
1225
  }
1226
 
1227
  $this->row_tracker = $row_start;
1228
 
1229
  // \x08\\x09, not required
1230
- $search = array( "\x00", "\x0a", "\x0d", "\x1a" );
1231
- $replace = array( '\0', '\n', '\r', '\Z' );
1232
 
1233
  $query_size = 0;
1234
 
1235
  $table_name = $table;
1236
 
1237
- if ( $this->form_data['action'] != 'savefile' && $_POST['stage'] != 'backup' ) {
1238
  $table_name = $temp_prefix . $table;
1239
  }
1240
 
1241
  $this->primary_keys = array();
1242
- $field_set = array();
1243
- $use_primary_keys = true;
1244
 
1245
  foreach ( $table_structure as $col ) {
1246
  $field_set[] = $this->backquote( $col->Field );
1247
  if ( $col->Key == 'PRI' && true == $use_primary_keys ) {
1248
  if ( false === strpos( $col->Type, 'int' ) ) {
1249
- $use_primary_keys = false;
1250
  $this->primary_keys = array();
1251
  continue;
1252
  }
1253
- $this->primary_keys[$col->Field] = 0;
1254
  }
1255
  }
1256
 
1257
  $first_select = true;
1258
- if ( ! empty( $_POST['primary_keys'] ) ) {
1259
- $_POST['primary_keys'] = trim( $_POST['primary_keys'] );
1260
- if ( ! empty( $_POST['primary_keys'] ) && is_serialized( $_POST['primary_keys'] ) ) {
1261
- $this->primary_keys = unserialize( stripslashes( $_POST['primary_keys'] ) );
1262
- $first_select = false;
1263
  }
1264
  }
1265
 
1266
  $fields = implode( ', ', $field_set );
1267
 
1268
- $insert_buffer = $insert_query_template = "INSERT INTO " . $this->backquote( $table_name ) . " ( " . $fields . ") VALUES\n";
1269
 
1270
  do {
1271
- $join = array();
1272
- $where = 'WHERE 1=1';
1273
  $order_by = '';
1274
  // We need ORDER BY here because with LIMIT, sometimes it will return
1275
  // the same results from the previous query and we'll have duplicate insert statements
1276
- if ( 'backup' != $_POST['stage'] && isset( $this->form_data['exclude_spam'] ) ) {
1277
  if ( $this->table_is( 'comments', $table ) ) {
1278
  $where .= ' AND comment_approved != "spam"';
1279
  } elseif ( $this->table_is( 'commentmeta', $table ) ) {
1280
- $tables = $this->get_ms_compat_table_names( array( 'commentmeta', 'comments' ), $table ) ;
1281
  $join[] = sprintf( 'INNER JOIN %1$s ON %1$s.comment_ID = %2$s.comment_id', $this->backquote( $tables['comments_table'] ), $this->backquote( $tables['commentmeta_table'] ) );
1282
  $where .= sprintf( ' AND %1$s.comment_approved != \'spam\'', $this->backquote( $tables['comments_table'] ) );
1283
  }
1284
  }
1285
 
1286
- if ( 'backup' != $_POST['stage'] && isset( $this->form_data['exclude_post_types'] ) && ! empty( $this->form_data['select_post_types'] ) ) {
1287
  $post_types = '\'' . implode( '\', \'', $this->form_data['select_post_types'] ) . '\'';
1288
  if ( $this->table_is( 'posts', $table ) ) {
1289
  $where .= ' AND `post_type` NOT IN ( ' . $post_types . ' )';
@@ -1303,7 +1377,7 @@ class WPMDB extends WPMDB_Base {
1303
  }
1304
  }
1305
 
1306
- if ( 'backup' != $_POST['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 ) ) ) {
1307
  $col_name = 'option_name';
1308
 
1309
  if ( isset( $wpdb->sitemeta ) && $wpdb->sitemeta == $table ) {
@@ -1313,10 +1387,17 @@ class WPMDB extends WPMDB_Base {
1313
  $where .= " AND `{$col_name}` NOT LIKE '\_transient\_%' AND `{$col_name}` NOT LIKE '\_site\_transient\_%'";
1314
  }
1315
 
1316
- // don't export/migrate the wpmdb_settings or wpmdb_error_log option rows unless we're performing a backup
1317
- if ( 'backup' != $_POST['stage'] && $wpdb->options === $table ) {
1318
- $where .= " AND `option_name` NOT LIKE 'wpmdb_settings'";
1319
- $where .= " AND `option_name` NOT LIKE 'wpmdb_error_log'";
 
 
 
 
 
 
 
1320
  }
1321
 
1322
  $limit = "LIMIT {$row_start}, {$row_inc}";
@@ -1326,7 +1407,7 @@ class WPMDB extends WPMDB_Base {
1326
  $primary_keys_keys = array_map( array( $this, 'backquote' ), $primary_keys_keys );
1327
 
1328
  $order_by = 'ORDER BY ' . implode( ',', $primary_keys_keys );
1329
- $limit = "LIMIT $row_inc";
1330
 
1331
  if ( false == $first_select ) {
1332
  $where .= ' AND ';
@@ -1337,10 +1418,10 @@ class WPMDB extends WPMDB_Base {
1337
  // build a list of clauses, iteratively reducing the number of fields compared in the compound key
1338
  // e.g. (a = 1 AND b = 2 AND c > 3) OR (a = 1 AND b > 2) OR (a > 1)
1339
  $clauses = array();
1340
- for ( $j = 0; $j < $primary_key_count; $j++ ) {
1341
  // build a subclause for each field in the compound index
1342
  $subclauses = array();
1343
- $i = 0;
1344
  foreach ( $temp_primary_keys as $primary_key => $value ) {
1345
  // only the last field in the key should be different in this subclause
1346
  $operator = ( count( $temp_primary_keys ) - 1 == $i ? '>' : '=' );
@@ -1363,76 +1444,89 @@ class WPMDB extends WPMDB_Base {
1363
  $first_select = false;
1364
  }
1365
 
1366
- $join = implode( ' ', array_unique( $join ) );
1367
- $join = apply_filters( 'wpmdb_rows_join', $join, $table );
1368
- $where = apply_filters( 'wpmdb_rows_where', $where, $table );
1369
  $order_by = apply_filters( 'wpmdb_rows_order_by', $order_by, $table );
1370
- $limit = apply_filters( 'wpmdb_rows_limit', $limit, $table );
1371
 
1372
- $sql = "SELECT " . $this->backquote( $table ) . ".* FROM " . $this->backquote( $table ) . " $join $where $order_by $limit";
1373
  $sql = apply_filters( 'wpmdb_rows_sql', $sql, $table );
1374
 
1375
  $table_data = $wpdb->get_results( $sql );
1376
 
1377
  if ( $table_data ) {
 
 
 
 
1378
  foreach ( $table_data as $row ) {
 
1379
  $values = array();
1380
  foreach ( $row as $key => $value ) {
 
 
1381
  if ( isset( $ints[strtolower( $key )] ) && $ints[strtolower( $key )] ) {
1382
  // make sure there are no blank spots in the insert syntax,
1383
  // yet try to avoid quotation marks around integers
1384
- $value = ( null === $value || '' === $value ) ? $defs[strtolower( $key )] : $value;
1385
  $values[] = ( '' === $value ) ? "''" : $value;
1386
- } else {
1387
- if ( null === $value ) {
1388
- $values[] = 'NULL';
1389
- } else {
1390
- if ( is_multisite() && 'path' == $key && $_POST['stage'] != 'backup' && ( $wpdb->site == $table || $wpdb->blogs == $table ) ) {
1391
- $old_path_current_site = $this->get_path_current_site();
1392
- $new_path_current_site = '';
1393
-
1394
- if ( ! empty( $_POST['path_current_site'] ) ) {
1395
- $new_path_current_site = stripslashes( $_POST['path_current_site'] );
1396
- } elseif ( ! empty ( $this->form_data['replace_new'][1] ) ) {
1397
- $new_path_current_site = $this->get_path_from_url( $this->form_data['replace_new'][1] );
1398
- }
1399
-
1400
- $new_path_current_site = apply_filters( 'wpmdb_new_path_current_site', $new_path_current_site );
1401
-
1402
- if ( ! empty( $new_path_current_site ) && $old_path_current_site != $new_path_current_site ) {
1403
- $pos = strpos( $value, $old_path_current_site );
1404
- $value = substr_replace( $value, $new_path_current_site, $pos, strlen( $old_path_current_site ) );
1405
- }
1406
- }
1407
 
1408
- if ( is_multisite() && 'domain' == $key && $_POST['stage'] != 'backup' && ( $wpdb->site == $table || $wpdb->blogs == $table ) ) {
1409
- if ( ! empty( $_POST['domain_current_site'] ) ) {
1410
- $main_domain_replace = $_POST['domain_current_site'];
1411
- } elseif ( ! empty ( $this->form_data['replace_new'][1] ) ) {
1412
- $url = parse_url( $this->form_data['replace_new'][1] );
1413
- $main_domain_replace = $url['host'];
1414
- }
1415
 
1416
- $domain_replaces = array();
1417
- $main_domain_find = sprintf( "/%s/", preg_quote( $this->get_domain_current_site(), '/' ) );
1418
- if ( isset( $main_domain_replace ) ) {
1419
- $domain_replaces[$main_domain_find] = $main_domain_replace;
1420
- }
1421
 
1422
- $domain_replaces = apply_filters( 'wpmdb_domain_replaces', $domain_replaces );
 
 
 
 
1423
 
1424
- $value = preg_replace( array_keys( $domain_replaces ), array_values( $domain_replaces ), $value );
1425
- }
1426
 
1427
- if ( 'guid' != $key || ( isset( $this->form_data['replace_guids'] ) && $this->table_is( 'posts', $table ) ) ) {
1428
- if ( $_POST['stage'] != 'backup' ) {
1429
- $value = $this->recursive_unserialize_replace( $value );
1430
- }
1431
- }
 
 
 
 
 
 
 
 
1432
 
1433
- $values[] = "'" . str_replace( $search, $replace, $this->sql_addslashes( $value ) ) . "'";
 
 
 
 
 
 
 
 
 
 
 
 
 
1434
  }
1435
  }
 
 
 
 
 
 
1436
  }
1437
 
1438
  $insert_line = '(' . implode( ', ', $values ) . '),';
@@ -1442,11 +1536,11 @@ class WPMDB extends WPMDB_Base {
1442
  if ( $insert_buffer == $insert_query_template ) {
1443
  $insert_buffer .= $insert_line;
1444
 
1445
- ++$this->row_tracker;
1446
 
1447
  if ( ! empty( $this->primary_keys ) ) {
1448
  foreach ( $this->primary_keys as $primary_key => $value ) {
1449
- $this->primary_keys[$primary_key] = $row->$primary_key;
1450
  }
1451
  }
1452
  }
@@ -1455,7 +1549,8 @@ class WPMDB extends WPMDB_Base {
1455
  $insert_buffer .= " ;\n";
1456
  $this->stow( $insert_buffer );
1457
  $insert_buffer = $insert_query_template;
1458
- $query_size = 0;
 
1459
  return $this->transfer_chunk();
1460
  }
1461
 
@@ -1464,17 +1559,17 @@ class WPMDB extends WPMDB_Base {
1464
  $insert_buffer .= " ;\n";
1465
  $this->stow( $insert_buffer );
1466
  $insert_buffer = $insert_query_template;
1467
- $query_size = 0;
1468
  }
1469
 
1470
  $insert_buffer .= $insert_line;
1471
  $query_size += strlen( $insert_line );
1472
 
1473
- ++$this->row_tracker;
1474
 
1475
  if ( ! empty( $this->primary_keys ) ) {
1476
  foreach ( $this->primary_keys as $primary_key => $value ) {
1477
- $this->primary_keys[$primary_key] = $row->$primary_key;
1478
  }
1479
  }
1480
  }
@@ -1486,21 +1581,20 @@ class WPMDB extends WPMDB_Base {
1486
  $insert_buffer .= " ;\n";
1487
  $this->stow( $insert_buffer );
1488
  $insert_buffer = $insert_query_template;
1489
- $query_size = 0;
1490
  }
1491
-
1492
  }
1493
  } while ( count( $table_data ) > 0 );
1494
 
1495
  // Create footer/closing comment in SQL-file
1496
- if ( $this->form_data['action'] == 'savefile' || $_POST['stage'] == 'backup' ) {
1497
  $this->stow( "\n" );
1498
  $this->stow( "#\n" );
1499
- $this->stow( "# " . sprintf( __( 'End of data contents of table %s', 'wp-migrate-db' ), $this->backquote( $table ) ) . "\n" );
1500
  $this->stow( "# --------------------------------------------------------\n" );
1501
  $this->stow( "\n" );
1502
 
1503
- if ( $_POST['last_table'] == '1' ) {
1504
  $this->stow( "#\n" );
1505
  $this->stow( "# Add constraints back in\n" );
1506
  $this->stow( "#\n\n" );
@@ -1508,26 +1602,27 @@ class WPMDB extends WPMDB_Base {
1508
  $alter_table_name = $this->get_alter_table_name();
1509
 
1510
  if ( $this->form_data['action'] == 'savefile' ) {
1511
- $wpdb->query( "DROP TABLE IF EXISTS " . $this->backquote( $alter_table_name ) . ";" );
1512
  }
1513
  }
1514
  }
1515
 
1516
- $this->row_tracker = -1;
1517
- return $this->transfer_chunk();
1518
 
 
1519
  } // end backup_table()
1520
 
1521
  function table_is( $desired_table, $given_table ) {
1522
  global $wpdb;
 
1523
  return $wpdb->{$desired_table} == $given_table || preg_match( '/' . $wpdb->prefix . '[0-9]+_' . $desired_table . '/', $given_table );
1524
  }
1525
 
1526
  /**
1527
  * return multisite-compatible names for requested tables, based on queried table name
1528
  *
1529
- * @param array $tables list of table names required
1530
- * @param string $queried_table name of table from which to derive the blog ID
1531
  *
1532
  * @return array list of table names altered for multisite compatibility
1533
  */
@@ -1548,87 +1643,19 @@ class WPMDB extends WPMDB_Base {
1548
  $ms_compat_table_names = array();
1549
 
1550
  foreach ( $tables as $table ) {
1551
- $ms_compat_table_names[$table . '_table'] = $prefix . $table;
1552
  }
1553
 
1554
  return $ms_compat_table_names;
1555
  }
1556
 
1557
- /**
1558
- * Take a serialized array and unserialize it replacing elements as needed and
1559
- * unserialising any subordinate arrays and performing the replace on those too.
1560
- *
1561
- * Mostly from https://github.com/interconnectit/Search-Replace-DB
1562
- *
1563
- * @param array $data Used to pass any subordinate arrays back to in.
1564
- * @param bool $serialized Does the array passed via $data need serialising.
1565
- * @param bool $parent_serialized Passes whether the original data passed in was serialized
1566
- *
1567
- * @return array The original array with all elements replaced as needed.
1568
- */
1569
- function recursive_unserialize_replace( $data, $serialized = false, $parent_serialized = false ) {
1570
- $is_json = false;
1571
- // some unseriliased data cannot be re-serialized eg. SimpleXMLElements
1572
- try {
1573
- if ( is_string( $data ) && ( $unserialized = @unserialize( $data ) ) !== false ) {
1574
- // PHP currently has a bug that doesn't allow you to clone the DateInterval / DatePeriod classes.
1575
- // We skip them here as they probably won't need data to be replaced anyway
1576
- if ( is_object( $unserialized ) ) {
1577
- if ( $unserialized instanceof DateInterval || $unserialized instanceof DatePeriod ) return $data;
1578
- }
1579
- $data = $this->recursive_unserialize_replace( $unserialized, true, true );
1580
- } elseif ( is_array( $data ) ) {
1581
- $_tmp = array( );
1582
- foreach ( $data as $key => $value ) {
1583
- $_tmp[ $key ] = $this->recursive_unserialize_replace( $value, false, $parent_serialized );
1584
- }
1585
-
1586
- $data = $_tmp;
1587
- unset( $_tmp );
1588
- } elseif ( is_object( $data ) ) { // Submitted by Tina Matter
1589
- $_tmp = clone $data;
1590
- foreach ( $data as $key => $value ) {
1591
- $_tmp->$key = $this->recursive_unserialize_replace( $value, false, $parent_serialized );
1592
- }
1593
-
1594
- $data = $_tmp;
1595
- unset( $_tmp );
1596
- } elseif ( $this->is_json( $data, true ) ) {
1597
- $_tmp = array( );
1598
- $data = json_decode( $data, true );
1599
-
1600
- foreach ( $data as $key => $value ) {
1601
- $_tmp[ $key ] = $this->recursive_unserialize_replace( $value, false, $parent_serialized );
1602
- }
1603
-
1604
- $data = $_tmp;
1605
- unset( $_tmp );
1606
- $is_json = true;
1607
- } elseif ( is_string( $data ) ) {
1608
- $data = $this->apply_replaces( $data, $parent_serialized );
1609
- }
1610
-
1611
- if ( $serialized ) {
1612
- return serialize( $data );
1613
- }
1614
-
1615
- if ( $is_json ) {
1616
- return json_encode( $data );
1617
- }
1618
- } catch( Exception $error ) {
1619
-
1620
- }
1621
-
1622
- return $data;
1623
- }
1624
-
1625
  function db_backup_header() {
1626
  $charset = ( defined( 'DB_CHARSET' ) ? DB_CHARSET : 'utf8' );
1627
- $this->stow( "# " . __( 'WordPress MySQL database migration', 'wp-migrate-db' ) . "\n", false );
1628
  $this->stow( "#\n", false );
1629
- $this->stow( "# " . sprintf( __( 'Generated: %s', 'wp-migrate-db' ), date( "l j. F Y H:i T" ) ) . "\n", false );
1630
- $this->stow( "# " . sprintf( __( 'Hostname: %s', 'wp-migrate-db' ), DB_HOST ) . "\n", false );
1631
- $this->stow( "# " . sprintf( __( 'Database: %s', 'wp-migrate-db' ), $this->backquote( DB_NAME ) ) . "\n", false );
1632
  $this->stow( "# --------------------------------------------------------\n\n", false );
1633
  $this->stow( "/*!40101 SET NAMES $charset */;\n\n", false );
1634
  $this->stow( "SET sql_mode='NO_AUTO_VALUE_ON_ZERO';\n\n", false );
@@ -1663,28 +1690,34 @@ class WPMDB extends WPMDB_Base {
1663
  }
1664
 
1665
  function stow( $query_line, $replace = true ) {
 
1666
  $this->current_chunk .= $query_line;
1667
 
1668
- if ( $this->form_data['action'] == 'savefile' || $_POST['stage'] == 'backup' ) {
1669
  if ( $this->gzip() && isset( $this->form_data['gzip_file'] ) ) {
1670
  if ( ! @gzwrite( $this->fp, $query_line ) ) {
1671
  $this->error = __( 'Failed to write the gzipped SQL data to the file. (#127)', 'wp-migrate-db' );
 
1672
  return false;
1673
  }
1674
  } else {
 
1675
  if ( false === @fwrite( $this->fp, $query_line ) ) {
1676
  $this->error = __( 'Failed to write the SQL data to the file. (#128)', 'wp-migrate-db' );
 
1677
  return false;
1678
  }
1679
  }
1680
- } elseif ( $_POST['intent'] == 'pull' ) {
1681
  echo $query_line;
1682
  }
1683
  }
1684
 
1685
  // Called in the $this->stow function once our chunk buffer is full, will transfer the SQL to the remote server for importing
1686
  function transfer_chunk() {
1687
- if ( $_POST['intent'] == 'savefile' || $_POST['stage'] == 'backup' ) {
 
 
1688
  $this->close( $this->fp );
1689
 
1690
  $result = $this->end_ajax( json_encode(
@@ -1693,28 +1726,31 @@ class WPMDB extends WPMDB_Base {
1693
  'primary_keys' => serialize( $this->primary_keys )
1694
  )
1695
  ) );
 
1696
  return $result;
1697
  }
1698
 
1699
- if ( $_POST['intent'] == 'pull' ) {
1700
  $result = $this->end_ajax( $this->row_tracker . ',' . serialize( $this->primary_keys ) );
 
1701
  return $result;
1702
  }
1703
 
1704
  $chunk_gzipped = '0';
1705
- if ( isset( $_POST['gzip'] ) && $_POST['gzip'] == '1' && $this->gzip() ) {
1706
  $this->current_chunk = gzcompress( $this->current_chunk );
1707
- $chunk_gzipped = '1';
1708
  }
1709
 
1710
  $data = array(
1711
- 'action' => 'wpmdb_process_chunk',
1712
- 'table' => $_POST['table'],
1713
  'chunk_gzipped' => $chunk_gzipped,
1714
- 'chunk' => $this->current_chunk // NEEDS TO BE the last element in this array because of adding it back into the array in ajax_process_chunk()
 
1715
  );
1716
 
1717
- $data['sig'] = $this->create_signature( $data, $_POST['key'] );
1718
 
1719
  $ajax_url = trailingslashit( $this->remote_url ) . 'wp-admin/admin-ajax.php';
1720
  $response = $this->remote_post( $ajax_url, $data, __FUNCTION__ );
@@ -1725,29 +1761,37 @@ class WPMDB extends WPMDB_Base {
1725
 
1726
  if ( ! empty( $response ) ) {
1727
  $result = $this->end_ajax( $response );
 
1728
  return $result;
1729
  }
1730
 
1731
  $result = $this->end_ajax( json_encode(
1732
  array(
1733
- 'current_row' => $this->row_tracker,
1734
- 'primary_keys' => serialize( $this->primary_keys )
1735
  )
1736
  ) );
 
1737
  return $result;
1738
  }
1739
 
1740
  /**
1741
  * Add backquotes to tables and db-names in
1742
  * SQL queries. Taken from phpMyAdmin.
 
 
 
 
1743
  */
1744
  function backquote( $a_name ) {
1745
- if ( !empty( $a_name ) && $a_name != '*' ) {
1746
  if ( is_array( $a_name ) ) {
1747
  $result = array();
1748
  reset( $a_name );
1749
- while ( list( $key, $val ) = each( $a_name ) )
1750
- $result[$key] = '`' . $val . '`';
 
 
1751
  return $result;
1752
  } else {
1753
  return '`' . $a_name . '`';
@@ -1760,6 +1804,11 @@ class WPMDB extends WPMDB_Base {
1760
  /**
1761
  * Better addslashes for SQL queries.
1762
  * Taken from phpMyAdmin.
 
 
 
 
 
1763
  */
1764
  function sql_addslashes( $a_string = '', $is_like = false ) {
1765
  if ( $is_like ) {
@@ -1773,29 +1822,38 @@ class WPMDB extends WPMDB_Base {
1773
 
1774
  function network_admin_menu() {
1775
  $title = ( $this->is_pro ) ? __( 'Migrate DB Pro', 'wp-migrate-db' ) : __( 'Migrate DB', 'wp-migrate-db' );
1776
- $hook_suffix = add_submenu_page( 'settings.php', $title, $title, 'manage_network_options', $this->core_slug, array( $this, 'options_page' ) );
 
 
 
 
 
1777
  $this->after_admin_menu( $hook_suffix );
1778
  }
1779
 
1780
  function admin_menu() {
1781
  $title = ( $this->is_pro ) ? __( 'Migrate DB Pro', 'wp-migrate-db' ) : __( 'Migrate DB', 'wp-migrate-db' );
1782
- $hook_suffix = add_management_page( $title, $title, 'export', $this->core_slug, array( $this, 'options_page' ) );
 
 
 
 
1783
  $this->after_admin_menu( $hook_suffix );
1784
  }
1785
 
1786
  function after_admin_menu( $hook_suffix ) {
1787
  add_action( 'admin_head-' . $hook_suffix, array( $this, 'admin_head_connection_info' ) );
1788
- add_action( 'load-' . $hook_suffix , array( $this, 'load_assets' ) );
1789
 
1790
  // Remove licence from the database if constant is set
1791
- if ( $this->is_licence_constant() && !empty( $this->settings['licence'] ) ) {
1792
  $this->settings['licence'] = '';
1793
- update_option( 'wpmdb_settings', $this->settings );
1794
  }
1795
  }
1796
 
1797
  function admin_body_class( $classes ) {
1798
- if ( !$classes ) {
1799
  $classes = array();
1800
  } else {
1801
  $classes = explode( ' ', $classes );
@@ -1811,7 +1869,7 @@ class WPMDB extends WPMDB_Base {
1811
  // Recommended way to target WP 3.8+
1812
  // http://make.wordpress.org/ui/2013/11/19/targeting-the-new-dashboard-design-in-a-post-mp6-world/
1813
  if ( version_compare( $GLOBALS['wp_version'], '3.8-alpha', '>' ) ) {
1814
- if ( !in_array( 'mp6', $classes ) ) {
1815
  $classes[] = 'mp6';
1816
  }
1817
  }
@@ -1819,14 +1877,33 @@ class WPMDB extends WPMDB_Base {
1819
  return implode( ' ', $classes );
1820
  }
1821
 
 
 
 
1822
  function load_assets() {
1823
  if ( ! empty( $_GET['download'] ) ) {
1824
  $this->download_file();
1825
  }
1826
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1827
  if ( isset( $_GET['wpmdb-remove-licence'] ) && wp_verify_nonce( $_GET['nonce'], 'wpmdb-remove-licence' ) ) {
1828
  $this->settings['licence'] = '';
1829
- update_option( 'wpmdb_settings', $this->settings );
1830
  // delete these transients as they contain information only valid for authenticated licence holders
1831
  delete_site_transient( 'update_plugins' );
1832
  delete_site_transient( 'wpmdb_upgrade_data' );
@@ -1861,95 +1938,104 @@ class WPMDB extends WPMDB_Base {
1861
  $plugins_url = trailingslashit( plugins_url() ) . trailingslashit( $this->plugin_folder_name );
1862
 
1863
  $version = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? time() : $this->plugin_version;
1864
- $min = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
1865
 
1866
  $src = $plugins_url . 'asset/css/styles.css';
1867
  wp_enqueue_style( 'wp-migrate-db-pro-styles', $src, array(), $version );
1868
 
1869
- $src = $plugins_url . 'asset/js/common.js';
1870
- wp_enqueue_script( 'wp-migrate-db-pro-common', $src, NULL, $version, true );
1871
 
1872
- $src = $plugins_url . 'asset/js/hook.js';
1873
- wp_enqueue_script( 'wp-migrate-db-pro-hook', $src, NULL, $version, true );
1874
 
1875
  do_action( 'wpmdb_load_assets' );
1876
 
1877
-
1878
-
1879
  $src = $plugins_url . "asset/js/script$min.js";
1880
  wp_enqueue_script( 'wp-migrate-db-pro-script', $src, array( 'jquery' ), $version, true );
1881
 
1882
- wp_localize_script( 'wp-migrate-db-pro-script', 'wpmdb_i10n', array(
1883
- 'max_request_size_problem' => __( "A problem occurred when trying to change the maximum request size, please try again.", 'wp-migrate-db' ),
1884
- 'license_check_problem' => __( "A problem occurred when trying to check the license, please try again.", 'wp-migrate-db' ),
1885
- 'establishing_remote_connection' => __( "Establishing connection to remote server, please wait", 'wp-migrate-db' ),
1886
- 'connection_local_server_problem' => __( "A problem occurred when attempting to connect to the local server, please check the details and try again.", 'wp-migrate-db' ),
1887
- 'enter_license_key' => __( "Please enter your license key.", 'wp-migrate-db' ),
1888
- 'register_license_problem' => __( "A problem occurred when trying to register the license, please try again.", 'wp-migrate-db' ),
1889
- 'license_registered' => __( "Your license has been activated. You will now receive automatic updates and access to email support.", 'wp-migrate-db' ),
1890
- 'fetching_license' => __( "Fetching license details, please wait...", 'wp-migrate-db' ),
1891
- 'clear_log_problem' => __( "An error occurred when trying to clear the debug log. Please contact support. (#132)", 'wp-migrate-db' ),
1892
- 'update_log_problem' => __( "An error occurred when trying to update the debug log. Please contact support. (#133)", 'wp-migrate-db' ),
1893
- 'migrate_db_save' => __( "Migrate DB & Save", 'wp-migrate-db' ),
1894
- 'migrate_db' => __( "Migrate DB", 'wp-migrate-db' ),
1895
- 'please_select_one_table' => __( "Please select at least one table to migrate.", 'wp-migrate-db' ),
1896
- 'enter_name_for_profile' => __( "Please enter a name for your migration profile.", 'wp-migrate-db' ),
1897
- 'save_profile_problem' => __( "An error occurred when attempting to save the migration profile. Please see the Help tab for details on how to request support. (#118)", 'wp-migrate-db' ),
1898
- 'exporting_complete' => __( "Exporting complete", 'wp-migrate-db' ),
1899
- 'exporting_please_wait' => __( "Exporting, please wait...", 'wp-migrate-db' ),
1900
- 'please_wait' => __( "please wait...", 'wp-migrate-db' ),
1901
- 'complete' => __( "complete", 'wp-migrate-db' ),
1902
- 'migration_failed' => __( "Migration failed", 'wp-migrate-db' ),
1903
- 'backing_up' => __( "Backing up", 'wp-migrate-db' ),
1904
- 'migrating' => __( "Migrating", 'wp-migrate-db' ),
1905
- 'status' => __( "Status", 'wp-migrate-db' ),
1906
- 'response' => __( "Response", 'wp-migrate-db' ),
1907
- 'table_process_problem' => __( "A problem occurred when attempting to process the following table (#113)", 'wp-migrate-db' ),
1908
- 'table_process_problem_empty_response' => __( "A problem occurred when processing the following table. We were expecting a response in JSON format but instead received an empty response.", 'wp-migrate-db' ),
1909
- 'completed_with_some_errors' => __( "Migration completed with some errors", 'wp-migrate-db' ),
1910
- 'completed_dump_located_at' => __( "Migration complete, your backup is located at:", 'wp-migrate-db' ),
1911
- 'finalize_tables_problem' => __( "A problem occurred when finalizing the backup. (#132)", 'wp-migrate-db' ),
1912
- 'saved' => __( "Saved", 'wp-migrate-db' ),
1913
- 'reset_api_key' => __( "Any sites setup to use the current API key will no longer be able to connect. You will need to update those sites with the newly generated API key. Do you wish to continue?", 'wp-migrate-db' ),
1914
- 'reset_api_key_problem' => __( "An error occurred when trying to generate the API key. Please see the Help tab for details on how to request support. (#105)", 'wp-migrate-db' ),
1915
- 'remove_profile' => __( "You are removing the following migration profile. This cannot be undone. Do you wish to continue?", 'wp-migrate-db' ),
1916
- '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' ),
1917
- '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' ),
1918
- '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' ),
1919
- 'enter_connection_info' => __( "Please enter the connection information above to continue.", 'wp-migrate-db' ),
1920
- 'save_settings_problem' => __( "An error occurred when trying to save the settings. Please try again. If the problem persists, please see the Help tab for details on how to request support. (#108)", 'wp-migrate-db' ),
1921
- 'connection_info_missing' => __( "The connection information appears to be missing, please enter it to continue.", 'wp-migrate-db' ),
1922
- 'connection_info_incorrect' => __( "The connection information appears to be incorrect, it should consist of two lines. The first being the remote server's URL and the second being the secret key.", 'wp-migrate-db' ),
1923
- 'connection_info_url_invalid' => __( "The URL on the first line appears to be invalid, please check it and try again.", 'wp-migrate-db' ),
1924
- 'connection_info_key_invalid' => __( "The secret key on the second line appears to be invalid. It should be a 32 character string that consists of letters, numbers and special characters only.", 'wp-migrate-db' ),
1925
- 'connection_info_local_url' => __( "It appears you've entered the URL for this website, you need to provide the URL of the remote website instead.", 'wp-migrate-db' ),
1926
- 'connection_info_local_key' => __( "It appears you've entered the secret key for this website, you need to provide the secret key for the remote website instead.", 'wp-migrate-db' ),
1927
- 'time_elapsed' => __( "Time Elapsed:", 'wp-migrate-db' ),
1928
- 'pause' => __( "Pause", 'wp-migrate-db' ),
1929
- 'migration_paused' => __( "Migration Paused", 'wp-migrate-db' ),
1930
- 'resume' => __( "Resume", 'wp-migrate-db' ),
1931
- 'completing_current_request' => __( "Completing current request", 'wp-migrate-db' ),
1932
- 'cancelling_migration' => __( "Cancelling migration", 'wp-migrate-db' ),
1933
- 'paused' => __( "Paused", 'wp-migrate-db' ),
1934
- 'removing_local_sql' => __( "Removing the local MySQL export file", 'wp-migrate-db' ),
1935
- 'removing_local_backup' => __( "Removing the local backup MySQL export file", 'wp-migrate-db' ),
1936
- 'removing_local_temp_tables' => __( "Removing the local temporary tables", 'wp-migrate-db' ),
1937
- 'removing_remote_sql' => __( "Removing the remote backup MySQL export file", 'wp-migrate-db' ),
1938
- 'removing_remote_temp_tables' => __( "Removing the remote temporary tables", 'wp-migrate-db' ),
1939
- 'migration_cancellation_failed' => __( "Migration cancellation failed", 'wp-migrate-db' ),
1940
- 'manually_remove_temp_files' => __( "A problem occurred while cancelling the migration, you may have to manually delete some temporary files / tables.", 'wp-migrate-db' ),
1941
- 'migration_cancelled' => __( "Migration cancelled", 'wp-migrate-db' ),
1942
- 'migration_complete' => __( "Migration complete", 'wp-migrate-db' ),
1943
- 'finalizing_migration' => __( "Finalizing migration", 'wp-migrate-db' ),
1944
- 'blacklist_problem' => __( "A problem occurred when trying to add plugins to backlist.", 'wp-migrate-db' ),
1945
- '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' ),
1946
- 'plugin_compatibility_settings_problem' => __( "A problem occurred when trying to change the plugin compatibility setting.", 'wp-migrate-db' ),
1947
- 'sure' => __( "Sure?", 'wp-migrate-db' ),
1948
- 'pull_migration_label_migrating' => __( 'Pulling from %s, please wait...', 'wp-migrate-db' ),
1949
- 'pull_migration_label_completed' => __( 'Pulling from %s complete', 'wp-migrate-db' ),
1950
- 'push_migration_label_migrating' => __( 'Pushing to %s, please wait...', 'wp-migrate-db' ),
1951
- 'push_migration_label_completed' => __( 'Pushing to %s complete', 'wp-migrate-db' ),
1952
- ) );
 
 
 
 
 
 
 
 
 
 
 
1953
 
1954
  wp_enqueue_script( 'jquery' );
1955
  wp_enqueue_script( 'jquery-ui-core' );
@@ -1958,7 +2044,7 @@ class WPMDB extends WPMDB_Base {
1958
  }
1959
 
1960
  function download_file() {
1961
- // dont need to check for user permissions as our 'add_management_page' already takes care of this
1962
  $this->set_time_limit();
1963
 
1964
  $dump_name = $this->format_dump_name( $_GET['download'] );
@@ -1967,10 +2053,10 @@ class WPMDB extends WPMDB_Base {
1967
  $dump_name .= '.gz';
1968
  }
1969
 
1970
- $diskfile = $this->get_upload_info( 'path' ) . DS . $dump_name;
1971
- $filename = basename( $diskfile );
1972
- $last_dash = strrpos( $filename, '-' );
1973
- $salt = substr( $filename, $last_dash, 6 );
1974
  $filename_no_salt = str_replace( $salt, '', $filename );
1975
 
1976
  if ( file_exists( $diskfile ) ) {
@@ -1979,10 +2065,11 @@ class WPMDB extends WPMDB_Base {
1979
  header( 'Content-Length: ' . filesize( $diskfile ) );
1980
  header( 'Content-Disposition: attachment; filename=' . $filename_no_salt );
1981
  $success = readfile( $diskfile );
 
1982
  unlink( $diskfile );
1983
  exit;
1984
  } else {
1985
- wp_die( __( 'Could not find the file to download:', 'wp-migrate-db' ) . '<br />' . $diskfile );
1986
  }
1987
  }
1988
 
@@ -1990,52 +2077,56 @@ class WPMDB extends WPMDB_Base {
1990
  global $table_prefix;
1991
 
1992
  $nonces = array(
1993
- 'update_max_request_size' => wp_create_nonce( 'update-max-request-size' ),
1994
- 'check_licence' => wp_create_nonce( 'check-licence' ),
1995
- 'verify_connection_to_remote_site' => wp_create_nonce( 'verify-connection-to-remote-site' ),
1996
- 'activate_licence' => wp_create_nonce( 'activate-licence' ),
1997
- 'clear_log' => wp_create_nonce( 'clear-log' ),
1998
- 'get_log' => wp_create_nonce( 'get-log' ),
1999
- 'save_profile' => wp_create_nonce( 'save-profile' ),
2000
- 'initiate_migration' => wp_create_nonce( 'initiate-migration' ),
2001
- 'migrate_table' => wp_create_nonce( 'migrate-table' ),
2002
- 'finalize_migration' => wp_create_nonce( 'finalize-migration' ),
2003
- 'reset_api_key' => wp_create_nonce( 'reset-api-key' ),
2004
- 'delete_migration_profile' => wp_create_nonce( 'delete-migration-profile' ),
2005
- 'save_setting' => wp_create_nonce( 'save-setting' ),
 
 
 
2006
  );
2007
 
2008
  $nonces = apply_filters( 'wpmdb_nonces', $nonces ); ?>
2009
 
2010
  <script type='text/javascript'>
2011
  var wpmdb_connection_info = <?php echo json_encode( array( site_url( '', 'https' ), $this->settings['key'] ) ); ?>;
2012
- var wpmdb_this_url = '<?php echo addslashes( home_url() ) ?>';
2013
- var wpmdb_this_path = '<?php echo addslashes( $this->absolute_root_file_path ); ?>';
2014
- var wpmdb_this_domain = '<?php echo $this->get_domain_current_site(); ?>';
2015
  var wpmdb_this_tables = <?php echo json_encode( $this->get_tables() ); ?>;
2016
  var wpmdb_this_prefixed_tables = <?php echo json_encode( $this->get_tables( 'prefix' ) ); ?>;
2017
  var wpmdb_this_table_sizes = <?php echo json_encode( $this->get_table_sizes() ); ?>;
2018
  var wpmdb_this_table_rows = <?php echo json_encode( $this->get_table_row_count() ); ?>;
2019
- var wpmdb_this_upload_url = '<?php echo addslashes( trailingslashit( $this->get_upload_info( 'url' ) ) ); ?>';
2020
- var wpmdb_this_upload_dir_long = '<?php echo addslashes( trailingslashit( $this->get_upload_info( 'path' ) ) ); ?>';
2021
  var wpmdb_this_website_name = '<?php echo sanitize_title_with_dashes( DB_NAME ); ?>';
2022
  var wpmdb_this_download_url = '<?php echo network_admin_url( $this->plugin_base . '&download=' ); ?>';
2023
- var wpmdb_this_prefix = '<?php echo $table_prefix; ?>';
2024
- var wpmdb_is_multisite = <?php echo is_multisite() ? 'true' : 'false'; ?>;
2025
- var wpmdb_openssl_available = <?php echo $this->open_ssl_enabled() ? 'true' : 'false'; ?>;
2026
- var wpmdb_plugin_version = '<?php echo $this->plugin_version; ?>';
2027
- var wpmdb_max_request = '<?php echo $this->settings['max_request'] ?>';
2028
- var wpmdb_bottleneck = '<?php echo $this->get_bottleneck( 'max' ); ?>';
2029
- var wpmdb_this_uploads_dir = '<?php echo addslashes( $this->get_short_uploads_dir() ); ?>';
2030
- var wpmdb_has_licence = '<?php echo $this->get_licence_key() == '' ? '0' : '1'; ?>';
2031
- var wpmdb_write_permission = <?php echo is_writeable( $this->get_upload_info( 'path' ) ) ? 'true' : 'false'; ?>;
2032
  var wpmdb_nonces = <?php echo json_encode( $nonces ); ?>;
2033
  var wpmdb_valid_licence = '<?php echo ( $this->is_valid_licence() ) ? '1' : '0'; ?>';
2034
  var wpmdb_profile = '<?php echo isset( $_GET['wpmdb-profile'] ) ? $_GET['wpmdb-profile'] : '-1'; ?>';
2035
- var wpmdb_is_pro = <?php echo ( $this->is_pro ) ? 'true' : 'false' ?>;
 
2036
  <?php do_action( 'wpmdb_js_variables' ); ?>
2037
  </script>
2038
- <?php
2039
  }
2040
 
2041
  function maybe_update_profile( $profile, $profile_id ) {
@@ -2044,27 +2135,28 @@ class WPMDB extends WPMDB_Base {
2044
  if ( isset( $profile['exclude_revisions'] ) ) {
2045
  unset( $profile['exclude_revisions'] );
2046
  $profile['select_post_types'] = array( 'revision' );
2047
- $profile_changed = true;
2048
  }
2049
 
2050
  if ( isset( $profile['post_type_migrate_option'] ) && 'migrate_select_post_types' == $profile['post_type_migrate_option'] && 'pull' != $profile['action'] ) {
2051
  unset( $profile['post_type_migrate_option'] );
2052
  $profile['exclude_post_types'] = '1';
2053
- $all_post_types = $this->get_post_types();
2054
- $profile['select_post_types'] = array_diff( $all_post_types, $profile['select_post_types'] );
2055
- $profile_changed = true;
2056
  }
2057
 
2058
  if ( $profile_changed ) {
2059
- $this->settings['profiles'][$profile_id] = $profile;
2060
- update_option( 'wpmdb_settings', $this->settings );
2061
  }
2062
 
2063
  return $profile;
2064
  }
2065
 
2066
  function get_path_from_url( $url ) {
2067
- $parts = parse_url( $url );
 
2068
  return ( ! empty( $parts['path'] ) ) ? trailingslashit( $parts['path'] ) : '/';
2069
  }
2070
 
@@ -2074,6 +2166,7 @@ class WPMDB extends WPMDB_Base {
2074
  }
2075
 
2076
  $current_site = get_current_site();
 
2077
  return $current_site->path;
2078
  }
2079
 
@@ -2083,51 +2176,24 @@ class WPMDB extends WPMDB_Base {
2083
  }
2084
 
2085
  $current_site = get_current_site();
2086
- return $current_site->domain;
2087
- }
2088
 
2089
- function return_bytes( $val ) {
2090
- if ( is_numeric( $val ) ) {
2091
- return $val;
2092
- }
2093
-
2094
- if ( empty( $val ) ) {
2095
- return false;
2096
- }
2097
-
2098
- $val = trim( $val );
2099
- $last = strtolower( $val[strlen( $val )-1] );
2100
-
2101
- switch ( $last ) {
2102
- // The 'G' modifier is available since PHP 5.1.0
2103
- case 'g':
2104
- $val *= 1024;
2105
- case 'm':
2106
- $val *= 1024;
2107
- case 'k':
2108
- $val *= 1024;
2109
- break;
2110
- default :
2111
- $val = false;
2112
- break;
2113
- }
2114
-
2115
- return $val;
2116
  }
2117
 
2118
  function maybe_checked( $option ) {
2119
- echo ( isset( $option ) && $option == '1' ) ? ' checked="checked"' : '';
2120
  }
2121
 
2122
  function ajax_cancel_migration() {
2123
- $this->form_data = $this->parse_migration_form_data( $_POST['form_data'] );
 
2124
 
2125
- switch ( $_POST['intent'] ) {
2126
  case 'savefile' :
2127
- $this->delete_export_file( $_POST['dump_filename'], false );
2128
  break;
2129
  case 'push' :
2130
- $data = $_POST;
2131
  $data['action'] = 'wpmdb_process_push_migration_cancellation';
2132
  $data['temp_prefix'] = $this->temp_prefix;
2133
  $ajax_url = trailingslashit( $data['url'] ) . 'wp-admin/admin-ajax.php';
@@ -2136,13 +2202,13 @@ class WPMDB extends WPMDB_Base {
2136
  $response = $this->remote_post( $ajax_url, $data, __FUNCTION__ );
2137
  $this->display_errors();
2138
 
2139
- echo trim( $response );
2140
  break;
2141
  case 'pull' :
2142
- if ( $_POST['stage'] == 'backup' ) {
2143
- $this->delete_export_file( $_POST['dump_filename'], true );
2144
  } else {
2145
- $this->delete_temporary_tables( $_POST['temp_prefix'] );
2146
  }
2147
  break;
2148
  default:
@@ -2159,15 +2225,16 @@ class WPMDB extends WPMDB_Base {
2159
  $dump_file = preg_replace( '/.gz$/', '', $dump_file );
2160
  }
2161
 
2162
- $dump_file = $this->get_upload_info( 'path' ) . DS . $dump_file;
2163
 
2164
  if ( empty( $dump_file ) || false == file_exists( $dump_file ) ) {
2165
  _e( 'MySQL export file not found.', 'wp-migrate-db' );
2166
  exit;
2167
  }
2168
 
 
2169
  if ( false === @unlink( $dump_file ) ) {
2170
- e( 'Could not delete the MySQL export file.', 'wp-migrate-db' );
2171
  exit;
2172
  }
2173
  }
@@ -2220,7 +2287,6 @@ class WPMDB extends WPMDB_Base {
2220
  call_user_func( array( $this, $method_name ), $args );
2221
  }
2222
  }
2223
-
2224
  }
2225
 
2226
  function plugin_tabs() {
@@ -2236,10 +2302,10 @@ class WPMDB extends WPMDB_Base {
2236
  return;
2237
  }
2238
 
2239
- $plugin_to_deactivate = 'wp-migrate-db.php';
2240
  $deactivated_notice_id = '1';
2241
  if ( $plugin_to_deactivate == basename( $plugin ) ) {
2242
- $plugin_to_deactivate = 'wp-migrate-db-pro.php';
2243
  $deactivated_notice_id = '2';
2244
  }
2245
 
@@ -2254,6 +2320,7 @@ class WPMDB extends WPMDB_Base {
2254
  if ( false !== strpos( $basename, $plugin_to_deactivate ) ) {
2255
  set_transient( 'wp_migrate_db_deactivated_notice_id', $deactivated_notice_id, 1 * HOUR_IN_SECONDS );
2256
  deactivate_plugins( $basename );
 
2257
  return;
2258
  }
2259
  }
@@ -2268,11 +2335,114 @@ class WPMDB extends WPMDB_Base {
2268
  } ?>
2269
 
2270
  <div class="updated" style="border-left: 4px solid #ffba00;">
2271
- <p><?php echo $message; ?></p>
2272
  </div> <?php
2273
 
2274
  delete_transient( 'wp_migrate_db_deactivated_notice_id' );
2275
  }
2276
  }
2277
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2278
  }
1
  <?php
2
+
3
  class WPMDB extends WPMDB_Base {
4
  protected $fp;
5
  protected $absolute_root_file_path;
24
  protected $lock_url_find_replace_row = false;
25
  protected $subdomain_replaces_on;
26
  protected $domain_replace;
 
27
  protected $checkbox_options;
28
+ protected $find_replace_pairs = array();
29
 
30
  function __construct( $plugin_file_path ) {
31
  parent::__construct( $plugin_file_path );
32
 
33
+ $this->plugin_version = $GLOBALS['wpmdb_meta'][ $this->core_slug ]['version'];
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
34
 
35
+ $this->max_insert_string_len = 50000; // 50000 is the default as defined by PhpMyAdmin
 
 
 
36
 
37
  add_filter( 'plugin_action_links_' . $this->plugin_basename, array( $this, 'plugin_action_links' ) );
38
  add_filter( 'network_admin_plugin_action_links_' . $this->plugin_basename, array( $this, 'plugin_action_links' ) );
52
  add_action( 'wp_ajax_wpmdb_cancel_migration', array( $this, 'ajax_cancel_migration' ) );
53
 
54
  $absolute_path = rtrim( ABSPATH, '\\/' );
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;
85
  'exclude_transients',
86
  'exclude_post_types',
87
  'exclude_post_revisions',
88
+ 'compatibility_older_mysql',
89
  );
90
 
91
  $this->default_profile = array(
92
+ 'action' => 'savefile',
93
+ 'save_computer' => '1',
94
+ 'gzip_file' => '1',
95
+ 'table_migrate_option' => 'migrate_only_with_prefix',
96
+ 'replace_guids' => '1',
97
+ 'default_profile' => true,
98
+ 'name' => '',
99
+ 'select_tables' => array(),
100
+ 'select_post_types' => array(),
101
+ 'backup_option' => 'backup_only_with_prefix',
102
+ 'exclude_transients' => '1',
103
+ 'compatibility_older_mysql' => '1',
104
  );
105
 
106
  $this->checkbox_options = array(
107
+ 'save_computer' => '0',
108
+ 'gzip_file' => '0',
109
+ 'replace_guids' => '0',
110
+ 'exclude_spam' => '0',
111
+ 'keep_active_plugins' => '0',
112
+ 'create_backup' => '0',
113
+ 'exclude_post_types' => '0',
114
+ 'compatibility_older_mysql' => '0',
115
  );
116
 
117
  $this->plugin_tabs = array(
118
+ '<a href="#" class="nav-tab nav-tab-active js-action-link migrate" data-div-name="migrate-tab">' . esc_html( _x( 'Migrate', 'Configure a migration or export', 'wp-migrate-db' ) ) . '</a>',
119
+ '<a href="#" class="nav-tab js-action-link settings" data-div-name="settings-tab">' . esc_html( _x( 'Settings', 'Plugin configuration and preferences', 'wp-migrate-db' ) ) . '</a>',
120
+ '<a href="#" class="nav-tab js-action-link help" data-div-name="help-tab">' . esc_html( _x( 'Help', 'Get help or contact support', 'wp-migrate-db' ) ) . '</a>',
121
  );
122
 
123
  // automatically deactivate WPMDB Pro / Free if the other is already active
126
  // display a notice when either WP Migrate DB or WP Migrate DB Pro is automatically deactivated
127
  add_action( 'pre_current_active_plugins', array( $this, 'plugin_deactivated_notice' ) );
128
 
129
+ // check if WP Engine is filtering the buffer and prevent it
130
+ add_action( 'plugins_loaded', array( $this, 'maybe_disable_wp_engine_filtering' ) );
131
+
132
  // this is how many DB rows are processed at a time, allow devs to change this value
133
  $this->rows_per_segment = apply_filters( 'wpmdb_rows_per_segment', $this->rows_per_segment );
134
 
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
 
165
  $this->create_alter_table_query = sprintf( "DROP TABLE IF EXISTS `%s`;\n", $alter_table_name );
166
  $this->create_alter_table_query .= sprintf( "CREATE TABLE `%s` ( `query` longtext NOT NULL );\n", $alter_table_name );
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;
170
  }
171
 
172
  function get_short_uploads_dir() {
173
  $short_path = str_replace( $this->absolute_root_file_path, '', $this->get_upload_info( 'path' ) );
174
+
175
  return trailingslashit( substr( str_replace( '\\', '/', $short_path ), 1 ) );
176
  }
177
 
178
  function get_upload_info( $type = 'path' ) {
179
  // Let developers define their own path to for export files
180
+ // Note: We require a very specific data set here, it should be similar to the following
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
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
+ $this->set_post_data();
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->post_data['install'] ) ) { // install MU plugin
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;
236
  }
237
 
238
  if ( ! copy( $source, $dest ) ) {
239
+ printf( esc_html__( 'Could not copy the compatibility plugin from %1$s to %2$s', 'wp-migrate-db' ), $source, $dest );
240
  exit;
241
  }
242
  } else { // uninstall MU plugin
243
+ // TODO: Use WP_Filesystem API.
244
  if ( file_exists( $dest ) && ! unlink( $dest ) ) {
245
+ printf( esc_html__( 'Could not remove the compatibility plugin from %s', 'wp-migrate-db' ), $dest );
246
  exit;
247
  }
248
  }
250
  }
251
 
252
  function ajax_blacklist_plugins() {
253
+ $this->set_post_data();
254
+ $this->settings['blacklist_plugins'] = $this->post_data['blacklist_plugins'];
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
  return $result;
267
  }
268
 
271
  if ( $strict == true && ! is_array( $json ) ) {
272
  return false;
273
  }
274
+
275
+ return ! ( $json == null || $json == false );
276
  }
277
 
278
  function get_sql_dump_info( $migration_type, $info_type ) {
280
  $this->session_salt = strtolower( wp_generate_password( 5, false, false ) );
281
  }
282
  $datetime = date( 'YmdHis' );
283
+ $ds = ( $info_type == 'path' ? DIRECTORY_SEPARATOR : '/' );
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
 
288
+ /**
289
+ * Returns validated and sanitized form data.
290
+ *
291
+ * @param array|string $data
292
+ *
293
+ * @return array|string
294
+ */
295
  function parse_migration_form_data( $data ) {
296
  parse_str( $data, $form_data );
297
+ // As the magic_quotes_gpc setting affects the output of parse_str() we may need to remove any quote escaping.
298
+ // (it uses the same mechanism that PHP > uses to populate the $_GET, $_POST, etc. variables)
299
+ if ( get_magic_quotes_gpc() ) {
300
+ $form_data = wp_unslash( $form_data );
301
+ }
302
  $this->accepted_fields = apply_filters( 'wpmdb_accepted_profile_fields', $this->accepted_fields );
303
  $form_data = array_intersect_key( $form_data, array_flip( $this->accepted_fields ) );
304
  unset( $form_data['replace_old'][0] );
305
  unset( $form_data['replace_new'][0] );
306
 
307
+ if ( ! isset( $form_data['replace_old'] ) ) {
308
+ $form_data['replace_old'] = array();
309
+ }
310
+ if ( ! isset( $form_data['replace_new'] ) ) {
311
+ $form_data['replace_new'] = array();
312
+ }
313
+
314
  if ( isset( $form_data['exclude_post_revisions'] ) ) {
315
+ $form_data['exclude_post_types'] = '1';
316
  $form_data['select_post_types'][] = 'revision';
317
+ $form_data['select_post_types'] = array_unique( $form_data['select_post_types'] );
318
  unset( $form_data['exclude_post_revisions'] );
319
  }
320
 
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;
329
  }
330
 
331
  function ajax_clear_log() {
332
  $this->check_ajax_referer( 'clear-log' );
333
+ delete_site_option( 'wpmdb_error_log' );
334
  $result = $this->end_ajax();
335
+
336
  return $result;
337
  }
338
 
343
  $this->output_log_file();
344
  $return = ob_get_clean();
345
  $result = $this->end_ajax( $return );
346
+
347
  return $result;
348
  }
349
 
350
  function output_log_file() {
351
+ $this->load_error_log();
352
+ if ( isset( $this->error_log ) ) {
353
+ echo $this->error_log;
354
  }
355
  }
356
 
359
  global $wpdb;
360
 
361
  echo 'site_url(): ';
362
+ echo esc_html( site_url() );
363
  echo "\r\n";
364
 
365
  echo 'home_url(): ';
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
+ echo ( is_multisite() ) ? ' Multisite' : '';
376
  echo "\r\n";
377
 
378
  echo 'Web Server: ';
379
+ echo esc_html( ! empty( $_SERVER['SERVER_SOFTWARE'] ) ? $_SERVER['SERVER_SOFTWARE'] : '' );
380
  echo "\r\n";
381
 
382
  echo 'PHP: ';
389
  echo esc_html( empty( $wpdb->use_mysqli ) ? mysql_get_server_info() : mysqli_get_server_info( $wpdb->dbh ) );
390
  echo "\r\n";
391
 
392
+ echo 'ext/mysqli: ';
393
  echo empty( $wpdb->use_mysqli ) ? 'no' : 'yes';
394
  echo "\r\n";
395
 
396
+ echo 'WP Memory Limit: ';
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";
403
+
404
+ echo 'WP Locale: ';
405
+ echo esc_html( get_locale() );
406
+ echo "\r\n";
407
+
408
+ echo 'DB Charset: ';
409
+ echo esc_html( DB_CHARSET );
410
  echo "\r\n";
411
 
412
  if ( function_exists( 'ini_get' ) && $suhosin_limit = ini_get( 'suhosin.post.max_value_length' ) ) {
413
  echo 'Suhosin Post Max Value Length: ';
414
+ echo esc_html( is_numeric( $suhosin_limit ) ? size_format( $suhosin_limit ) : $suhosin_limit );
415
  echo "\r\n";
416
  }
417
 
418
  if ( function_exists( 'ini_get' ) && $suhosin_limit = ini_get( 'suhosin.request.max_value_length' ) ) {
419
  echo 'Suhosin Request Max Value Length: ';
420
+ echo esc_html( is_numeric( $suhosin_limit ) ? size_format( $suhosin_limit ) : $suhosin_limit );
421
  echo "\r\n";
422
  }
423
 
424
  echo 'Debug Mode: ';
425
+ echo esc_html( ( defined( 'WP_DEBUG' ) && WP_DEBUG ) ? 'Yes' : 'No' );
426
  echo "\r\n";
427
 
428
  echo 'WP Max Upload Size: ';
429
+ echo esc_html( size_format( wp_max_upload_size() ) );
430
  echo "\r\n";
431
 
432
  echo 'PHP Post Max Size: ';
433
+ echo esc_html( size_format( $this->get_post_max_size() ) );
434
  echo "\r\n";
435
 
436
  echo 'PHP Time Limit: ';
437
  if ( function_exists( 'ini_get' ) ) {
438
+ echo esc_html( ini_get( 'max_execution_time' ) );
439
  }
440
  echo "\r\n";
441
 
442
  echo 'PHP Error Log: ';
443
  if ( function_exists( 'ini_get' ) ) {
444
+ echo esc_html( ini_get( 'error_log' ) );
445
  }
446
  echo "\r\n";
447
 
455
 
456
  echo 'OpenSSL: ';
457
  if ( $this->open_ssl_enabled() ) {
458
+ echo esc_html( OPENSSL_VERSION_TEXT );
459
  } else {
460
  echo 'Disabled';
461
  }
468
  echo 'Disabled';
469
  }
470
  echo "\r\n";
471
+
472
+ echo 'Enable SSL verification setting: ';
473
+ if ( 1 == $this->settings['verify_ssl'] ) {
474
+ echo 'Yes';
475
+ } else {
476
+ echo 'No';
477
+ }
478
+ echo "\r\n";
479
+
480
+ echo 'Compatibility Mode: ';
481
+ if ( isset( $GLOBALS['wpmdb_compatibility'] ) ) {
482
+ echo 'Yes';
483
+ } else {
484
+ echo 'No';
485
+ }
486
+ echo "\r\n";
487
  echo "\r\n";
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
+ }
498
+
499
  $active_plugins = (array) get_option( 'active_plugins', array() );
500
 
501
  if ( is_multisite() ) {
504
  }
505
 
506
  foreach ( $active_plugins as $plugin ) {
507
+ $suffix = ( isset( $blacklist[ $plugin ] ) ) ? '*' : '';
508
+ $this->print_plugin_details( WP_PLUGIN_DIR . '/' . $plugin, $suffix );
509
+ }
510
+
511
+ if ( isset( $GLOBALS['wpmdb_compatibility'] ) ) {
512
+ add_filter( 'option_active_plugins', 'wpmdbc_exclude_plugins' );
513
+ add_filter( 'site_option_active_sitewide_plugins', 'wpmdbc_exclude_site_plugins' );
514
+ }
515
+
516
+ $mu_plugins = wp_get_mu_plugins();
517
+ if ( $mu_plugins ) {
518
+ echo "\r\n";
519
+
520
+ echo "Must-use Plugins:\r\n";
521
+
522
+ foreach ( $mu_plugins as $mu_plugin ) {
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 = '' ) {
533
+ $plugin_data = get_plugin_data( $plugin_path );
534
+ if ( empty( $plugin_data['Name'] ) ) {
535
+ return;
536
+ }
537
+
538
+ printf( "%s%s (v%s) by %s\r\n", $plugin_data['Name'], $suffix, $plugin_data['Version'], $plugin_data['AuthorName'] );
539
  }
540
 
541
  function remove_wp_plugin_dir( $name ) {
542
  $plugin = str_replace( WP_PLUGIN_DIR, '', $name );
543
+
544
  return substr( $plugin, 1 );
545
  }
546
 
547
  function get_alter_queries() {
548
  global $wpdb;
549
  $alter_table_name = $this->get_alter_table_name();
550
+ $sql = '';
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
+
558
  return $sql;
559
  }
560
 
579
  if ( false === $wpdb->query( $query ) ) {
580
  $return = ob_get_clean();
581
  $result = $this->end_ajax( $return );
582
+
583
  return $result;
584
  }
585
  }
587
  return true;
588
  }
589
 
590
+ /**
591
+ * Called for each database table to be migrated.
592
+ *
593
+ * @return string
594
+ */
595
  function ajax_migrate_table() {
596
  $this->check_ajax_referer( 'migrate-table' );
597
+ $this->set_post_data();
598
  global $wpdb;
599
 
600
+ $this->form_data = $this->parse_migration_form_data( $this->post_data['form_data'] );
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->post_data['stage'] == 'backup' && $this->post_data['intent'] != 'savefile' ) {
606
  // if performing a push we need to backup the REMOTE machine's DB
607
+ if ( $this->post_data['intent'] == 'push' ) {
608
+ $data = $this->filter_post_elements(
609
+ $this->post_data,
610
+ array(
611
+ 'action',
612
+ 'intent',
613
+ 'url',
614
+ 'key',
615
+ 'table',
616
+ 'form_data',
617
+ 'stage',
618
+ 'bottleneck',
619
+ 'prefix',
620
+ 'current_row',
621
+ 'dump_filename',
622
+ 'last_table',
623
+ 'gzip',
624
+ 'primary_keys',
625
+ 'path_current_site',
626
+ 'domain_current_site',
627
+ )
628
+ );
629
  $data['action'] = 'wpmdb_backup_remote_table';
630
  $data['intent'] = 'pull';
631
+ $ajax_url = trailingslashit( $this->post_data['url'] ) . 'wp-admin/admin-ajax.php';
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
  $return = ob_get_clean();
640
  }
641
 
642
  $result = $this->end_ajax( $return );
643
+
644
  return $result;
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->post_data['intent'] == 'push' || $this->post_data['intent'] == 'savefile' ) {
649
  $this->maximum_chunk_size = $this->get_bottleneck();
650
 
651
+ if ( isset( $this->post_data['bottleneck'] ) ) {
652
+ $this->maximum_chunk_size = (int) $this->post_data['bottleneck'];
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->post_data['dump_filename'] );
662
 
663
+ if ( $this->post_data['intent'] == 'savefile' ) {
664
  $this->fp = $this->open( $sql_dump_file_name );
665
  }
666
 
667
+ $db_version = '';
668
+ if ( ! empty( $this->post_data['db_version'] ) ) {
669
+ $db_version = $this->post_data['db_version'];
670
+
671
+ if ( 'push' == $this->post_data['intent'] ) {
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->post_data['intent'] && ! empty( $this->form_data['compatibility_older_mysql'] ) ) {
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';
678
+ add_filter( 'wpmdb_create_table_query', array( $this, 'mysql_compat_filter' ), 10, 3 );
679
+ }
680
+ }
681
 
682
+ if ( ! empty( $this->post_data['find_replace_pairs'] ) ) {
683
+ $this->find_replace_pairs = $this->post_data['find_replace_pairs'];
684
+ }
685
+
686
+ $result = $this->export_table( $this->post_data['table'], $db_version );
687
+
688
+ if ( $this->post_data['intent'] == 'savefile' ) {
689
  $this->close( $this->fp );
690
  }
691
 
694
  $maybe_errors = trim( ob_get_clean() );
695
  if ( false === empty( $maybe_errors ) ) {
696
  $result = $this->end_ajax( $maybe_errors );
697
+
698
  return $result;
699
  }
700
 
701
  return $result;
702
  } else {
703
+ $data = $this->filter_post_elements( $this->post_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' ) );
 
 
 
 
 
704
  $data['action'] = 'wpmdb_process_pull_request';
705
  $data['pull_limit'] = $this->get_sensible_pull_limit();
706
+ $data['db_version'] = $wpdb->db_version();
707
 
708
  if ( is_multisite() ) {
709
+ $data['path_current_site'] = $this->get_path_current_site();
710
  $data['domain_current_site'] = $this->get_domain_current_site();
711
  }
712
 
716
  unset( $data['sig'] );
717
  }
718
 
719
+ if ( isset( $data['find_replace_pairs'] ) ) {
720
+ $data['find_replace_pairs'] = serialize( $data['find_replace_pairs'] );
721
+ }
722
+
723
  $ajax_url = trailingslashit( $data['url'] ) . 'wp-admin/admin-ajax.php';
 
724
  $data['sig'] = $this->create_signature( $data, $data['key'] );
725
 
726
  $response = $this->remote_post( $ajax_url, $data, __FUNCTION__ );
730
 
731
  if ( false === empty( $maybe_errors ) ) {
732
  $result = $this->end_ajax( $maybe_errors );
733
+
734
  return $result;
735
  }
736
 
737
  if ( strpos( $response, ';' ) === false ) {
738
  $result = $this->end_ajax( $response );
739
+
740
  return $result;
741
  }
742
 
744
  // need to split this up into a chunk and row_tracker
745
  $row_information = trim( substr( strrchr( $response, "\n" ), 1 ) );
746
  $row_information = explode( ',', $row_information );
747
+ $chunk = substr( $response, 0, strrpos( $response, ";\n" ) + 1 );
748
 
749
  if ( ! empty( $chunk ) ) {
750
  $process_chunk_result = $this->process_chunk( $chunk );
751
  if ( true !== $process_chunk_result ) {
752
  $result = $this->end_ajax( $process_chunk_result );
753
+
754
  return $result;
755
  }
756
  }
757
 
758
  $result = $this->end_ajax( json_encode(
759
  array(
760
+ 'current_row' => $row_information[0],
761
+ 'primary_keys' => $row_information[1],
762
  )
763
  ) );
764
  }
766
  return $result;
767
  }
768
 
769
+ /**
770
+ * Occurs right before the first table is migrated / backed up during the migration process.
771
+ *
772
+ * @return string
773
+ *
774
+ * Does a quick check to make sure the verification string is valid and also opens / creates files for writing to (if required).
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
+ if ( $this->post_data['intent'] == 'savefile' ) {
783
  $return = array(
784
+ 'code' => 200,
785
  'message' => 'OK',
786
+ 'body' => json_encode( array( 'error' => 0 ) ),
787
  );
788
 
789
+ $return['dump_path'] = $this->get_sql_dump_info( 'migrate', 'path' );
790
+ $return['dump_filename'] = basename( $return['dump_path'] );
791
+ $return['dump_url'] = $this->get_sql_dump_info( 'migrate', 'url' );
792
+ $dump_filename_no_extension = substr( $return['dump_filename'], 0, - 4 );
793
 
794
  $create_alter_table_query = $this->get_create_alter_table_query();
795
  // sets up our table to store 'ALTER' queries
797
 
798
  if ( true !== $process_chunk_result ) {
799
  $result = $this->end_ajax( $process_chunk_result );
800
+
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';
808
  }
809
 
810
+ $this->fp = $this->open( $this->get_upload_info( 'path' ) . DIRECTORY_SEPARATOR . $return['dump_filename'] );
811
  $this->db_backup_header();
812
  $this->close( $this->fp );
813
 
814
  $return['dump_filename'] = $dump_filename_no_extension;
815
  } else { // does one last check that our verification string is valid
816
  $data = array(
817
+ 'action' => 'wpmdb_remote_initiate_migration',
818
+ 'intent' => $this->post_data['intent'],
819
+ 'form_data' => $this->post_data['form_data'],
820
  );
821
 
822
+ $data['sig'] = $this->create_signature( $data, $this->post_data['key'] );
823
+ $ajax_url = trailingslashit( $this->post_data['url'] ) . 'wp-admin/admin-ajax.php';
824
+ $response = $this->remote_post( $ajax_url, $data, __FUNCTION__ );
825
 
826
  if ( false === $response ) {
827
  $return = array( 'wpmdb_error' => 1, 'body' => $this->error );
828
  $result = $this->end_ajax( json_encode( $return ) );
829
+
830
  return $result;
831
  }
832
 
837
  $return = array( 'wpmdb_error' => 1, 'body' => $error_msg );
838
  $this->log_error( $error_msg, $response );
839
  $result = $this->end_ajax( json_encode( $return ) );
840
+
841
  return $result;
842
  }
843
 
844
  if ( isset( $return['error'] ) && $return['error'] == 1 ) {
845
  $return = array( 'wpmdb_error' => 1, 'body' => $return['message'] );
846
  $result = $this->end_ajax( json_encode( $return ) );
847
+
848
  return $result;
849
  }
850
 
851
+ if ( $this->post_data['intent'] == 'pull' ) {
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 );
855
  if ( true !== $process_chunk_result ) {
856
  $result = $this->end_ajax( $process_chunk_result );
857
+
858
  return $result;
859
  }
860
  }
861
 
862
+ if ( ! empty( $this->form_data['create_backup'] ) && $this->post_data['intent'] == 'pull' ) {
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' );
866
  }
867
  }
868
 
869
  $return['dump_filename'] = ( empty( $return['dump_filename'] ) ) ? '' : $return['dump_filename'];
870
+ $return['dump_url'] = ( empty( $return['dump_url'] ) ) ? '' : $return['dump_url'];
871
+
872
+ // A successful call to wpmdb_remote_initiate_migration for a Push migration will have set db_version.
873
+ // Otherwise ensure it is set with own db_version so that we always return one.
874
+ $return['db_version'] = ( empty( $return['db_version'] ) ) ? $wpdb->db_version() : $return['db_version'];
875
+
876
+ // A successful call to wpmdb_remote_initiate_migration for a Push migration will have set site_url.
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->post_data['intent'], $return['site_url'] );
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
+ $this->set_post_data();
890
+ $profile = $this->parse_migration_form_data( $this->post_data['profile'] );
891
  $profile = wp_parse_args( $profile, $this->checkbox_options );
892
 
893
  if ( isset( $profile['save_migration_profile_option'] ) && $profile['save_migration_profile_option'] == 'new' ) {
895
  $this->settings['profiles'][] = $profile;
896
  } else {
897
  $key = $profile['save_migration_profile_option'];
898
+ $name = $this->settings['profiles'][ $key ]['name'];
899
+ $this->settings['profiles'][ $key ] = $profile;
900
+ $this->settings['profiles'][ $key ]['name'] = $name;
901
  }
902
 
903
+ update_site_option( 'wpmdb_settings', $this->settings );
904
  end( $this->settings['profiles'] );
905
+ $key = key( $this->settings['profiles'] );
906
  $result = $this->end_ajax( $key );
907
+
908
  return $result;
909
  }
910
 
911
  function ajax_delete_migration_profile() {
912
  $this->check_ajax_referer( 'delete-migration-profile' );
913
+ $this->set_post_data();
914
+ $key = absint( $this->post_data['profile_id'] );
915
+ -- $key;
916
  $return = '';
917
 
918
+ if ( isset( $this->settings['profiles'][ $key ] ) ) {
919
+ unset( $this->settings['profiles'][ $key ] );
920
+ update_site_option( 'wpmdb_settings', $this->settings );
921
  } else {
922
  $return = '-1';
923
  }
924
 
925
  $result = $this->end_ajax( $return );
926
+
927
  return $result;
928
  }
929
 
930
  function format_table_sizes( $size ) {
931
  $size *= 1024;
 
 
 
 
 
 
 
 
 
 
 
932
 
933
+ return size_format( $size );
934
  }
935
 
936
  function get_post_types() {
938
 
939
  if ( is_multisite() ) {
940
  $tables = $this->get_tables();
941
+ $sql = "SELECT `post_type` FROM `{$wpdb->prefix}posts` ";
942
  foreach ( $tables as $table ) {
943
+ if ( 0 == preg_match( '/' . $wpdb->prefix . '[0-9]+_posts/', $table ) ) {
944
+ continue;
945
+ }
946
  $blog_id = str_replace( array( $wpdb->prefix, '_posts' ), array( '', '' ), $table );
947
+ $sql .= "UNION SELECT `post_type` FROM `{$wpdb->prefix}" . $blog_id . '_posts` ';
948
  }
949
+ $sql .= ';';
950
  $post_types = $wpdb->get_results( $sql, ARRAY_A );
951
  } else {
952
  $post_types = $wpdb->get_results(
953
  "SELECT DISTINCT `post_type`
954
  FROM `{$wpdb->prefix}posts`
955
+ WHERE 1;",
956
+ ARRAY_A
957
  );
958
  }
959
 
968
 
969
  // Retrieves the specified profile, if -1, returns the default profile
970
  function get_profile( $profile_id ) {
971
+ -- $profile_id;
972
 
973
+ if ( $profile_id == '-1' || ! isset( $this->settings['profiles'][ $profile_id ] ) ) {
974
  return $this->default_profile;
975
  }
976
 
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 $results ) {
989
+ $return[ $results['table_name'] ] = ( $results['TABLE_ROWS'] == 0 ? 1 : $results['TABLE_ROWS'] );
990
  }
991
 
992
  return $return;
993
  }
994
 
995
+ /**
996
+ * Returns an array of table names with associated size in kilobytes.
997
+ *
998
+ * @return mixed
999
+ *
1000
+ * NOTE: Returned array may have been altered by wpmdb_table_sizes filter.
1001
+ */
1002
+ function get_table_sizes() {
1003
  global $wpdb;
1004
 
1005
+ static $return;
1006
+
1007
+ if ( ! empty( $return ) ) {
1008
+ return $return;
1009
+ }
1010
+
1011
+ $return = array();
1012
 
1013
  $sql = $wpdb->prepare(
1014
  "SELECT TABLE_NAME AS 'table',
1015
+ ROUND( ( data_length + index_length ) / 1024, 0 ) AS 'size'
1016
  FROM information_schema.TABLES
1017
  WHERE information_schema.TABLES.table_schema='%s'
1018
+ AND information_schema.TABLES.table_type='%s'",
1019
+ DB_NAME,
1020
+ 'BASE TABLE'
1021
  );
1022
 
1023
  $results = $wpdb->get_results( $sql, ARRAY_A );
1024
 
1025
+ if ( ! empty( $results ) ) {
1026
+ foreach ( $results as $result ) {
1027
+ $return[ $result['table'] ] = $result['size'];
1028
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1029
  }
1030
 
1031
+ // "regular" is passed to the filter as the scope for backwards compatibility (a possible but never used scope was "temp").
1032
+ return apply_filters( 'wpmdb_table_sizes', $return, 'regular' );
1033
  }
1034
 
1035
  function format_dump_name( $dump_name ) {
1047
  $this->template( 'options' );
1048
  }
1049
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1050
  /**
1051
  * Get the remote site's base domain for subdomain multisite search/replace.
1052
  *
1053
  * @return string|bool The remote site's domain or false on error.
1054
  */
1055
  function get_domain_replace() {
1056
+ $this->set_post_data();
1057
+
1058
  if ( ! isset( $this->domain_replace ) ) {
1059
+ if ( ! empty( $this->post_data['domain_current_site'] ) ) {
1060
+ $this->domain_replace = $this->post_data['domain_current_site'];
1061
  } elseif ( ! empty ( $this->form_data['replace_new'][1] ) ) { // occurs when performing an export migration
1062
  $url = $this->form_data['replace_new'][1];
1063
+ $url = $this->parse_url( $url );
 
1064
  $this->domain_replace = $url['host'];
1065
  } else {
1066
  $this->domain_replace = false;
1067
  }
1068
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1069
 
1070
+ return $this->domain_replace;
 
 
 
 
1071
  }
1072
 
1073
  function process_sql_constraint( $create_query, $table, &$alter_table_query ) {
1092
  $sql_count = count( $sql_lines );
1093
 
1094
  // lets find first line with constraints
1095
+ for ( $i = 0; $i < $sql_count; $i ++ ) {
1096
  if ( preg_match(
1097
+ '@^[\s]*(CONSTRAINT|FOREIGN[\s]+KEY)@',
1098
+ $sql_lines[ $i ]
1099
+ ) ) {
1100
  break;
1101
  }
1102
  }
1104
  // If we really found a constraint
1105
  if ( $i != $sql_count ) {
1106
  // remove, from the end of create statement
1107
+ $sql_lines[ $i - 1 ] = preg_replace(
1108
  '@,$@',
1109
  '',
1110
+ $sql_lines[ $i - 1 ]
1111
  );
1112
 
1113
  // let's do the work
1114
+ $sql_constraints_query .= 'ALTER TABLE ' . $this->backquote( $table ) . $crlf;
 
 
1115
 
1116
  $first = true;
1117
+ for ( $j = $i; $j < $sql_count; $j ++ ) {
1118
  if ( preg_match(
1119
+ '@CONSTRAINT|FOREIGN[\s]+KEY@',
1120
+ $sql_lines[ $j ]
1121
+ ) ) {
1122
+ if ( strpos( $sql_lines[ $j ], 'CONSTRAINT' ) === false ) {
1123
  $tmp_str = preg_replace(
1124
  '/(FOREIGN[\s]+KEY)/',
1125
  'ADD \1',
1126
+ $sql_lines[ $j ]
1127
  );
1128
  $sql_constraints_query .= $tmp_str;
1129
  } else {
1130
  $tmp_str = preg_replace(
1131
  '/(CONSTRAINT)/',
1132
  'ADD \1',
1133
+ $sql_lines[ $j ]
1134
  );
1135
  $sql_constraints_query .= $tmp_str;
1136
  preg_match(
1137
  '/(CONSTRAINT)([\s])([\S]*)([\s])/',
1138
+ $sql_lines[ $j ],
1139
  $matches
1140
  );
1141
  }
1148
  $sql_constraints_query .= ";\n";
1149
 
1150
  $create_query = implode(
1151
+ $crlf,
1152
+ array_slice( $sql_lines, 0, $i )
1153
+ )
1154
+ . $crlf
1155
+ . implode(
1156
+ $crlf,
1157
+ array_slice( $sql_lines, $j, $sql_count - 1 )
1158
+ );
1159
  unset( $sql_lines );
1160
 
1161
  $alter_table_query = $sql_constraints_query;
1162
+
1163
  return $create_query;
1164
  }
1165
  }
1166
+
1167
  return $create_query;
1168
  }
1169
 
1174
  * Modified by Scott Merrill (http://www.skippy.net/)
1175
  * to use the WordPress $wpdb object
1176
  *
1177
+ * @param string $table
1178
+ * @param string $db_version
1179
+ *
1180
+ * @return mixed
1181
  */
1182
+ function export_table( $table, $db_version = '' ) {
1183
  global $wpdb;
1184
  $this->set_time_limit();
1185
+ $this->set_post_data();
1186
 
1187
  if ( empty( $this->form_data ) ) {
1188
+ $this->form_data = $this->parse_migration_form_data( $this->post_data['form_data'] );
1189
  }
1190
 
1191
+ $temp_prefix = $this->temp_prefix;
1192
+ $remote_prefix = ( isset( $this->post_data['prefix'] ) ? $this->post_data['prefix'] : $wpdb->prefix );
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->post_data['current_row'] ) ) {
1204
+ $temp_current_row = trim( $this->post_data['current_row'] );
1205
  if ( ! empty( $temp_current_row ) ) {
1206
  $current_row = (int) $temp_current_row;
1207
  }
1208
  }
1209
 
1210
+ if ( $current_row == - 1 ) {
1211
  // Add SQL statement to drop existing table
1212
+ if ( $this->form_data['action'] == 'savefile' || $this->post_data['stage'] == 'backup' ) {
1213
  $this->stow( "\n\n" );
1214
  $this->stow( "#\n" );
1215
+ $this->stow( '# ' . sprintf( __( 'Delete any existing table %s', 'wp-migrate-db' ), $this->backquote( $table ) ) . "\n" );
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->post_data['stage'] == 'backup' ) {
1226
  $this->stow( "\n\n" );
1227
  $this->stow( "#\n" );
1228
+ $this->stow( '# ' . sprintf( __( 'Table structure of table %s', 'wp-migrate-db' ), $this->backquote( $table ) ) . "\n" );
1229
  $this->stow( "#\n" );
1230
  $this->stow( "\n" );
1231
  }
1232
 
1233
+ $create_table = $wpdb->get_results( 'SHOW CREATE TABLE ' . $this->backquote( $table ), ARRAY_N );
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
+ if ( $this->form_data['action'] != 'savefile' && $this->post_data['stage'] != 'backup' ) {
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], $table, $alter_table_query );
1248
 
1249
+ $create_table[0][1] = apply_filters( 'wpmdb_create_table_query', $create_table[0][1], $table, $db_version );
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 = sprintf( "INSERT INTO %s ( `query` ) VALUES ( '%s' );\n", $this->backquote( $alter_table_name ), esc_sql( $alter_table_query ) );
1256
+ if ( $this->form_data['action'] == 'savefile' || $this->post_data['stage'] == 'backup' ) {
1257
  $process_chunk_result = $this->process_chunk( $insert );
1258
  if ( true !== $process_chunk_result ) {
1259
  $result = $this->end_ajax( $process_chunk_result );
1260
+
1261
  return $result;
1262
  }
1263
  } else {
1266
  }
1267
 
1268
  // Comment in SQL-file
1269
+ if ( $this->form_data['action'] == 'savefile' || $this->post_data['stage'] == 'backup' ) {
1270
  $this->stow( "\n\n" );
1271
  $this->stow( "#\n" );
1272
  $this->stow( '# ' . sprintf( __( 'Data contents of table %s', 'wp-migrate-db' ), $this->backquote( $table ) ) . "\n" );
1274
  }
1275
  }
1276
 
1277
+ // $defs = mysql defaults, looks up the default for that particular column, used later on to prevent empty inserts values for that column
1278
+ // $ints = holds a list of the possible integer types so as to not wrap them in quotation marks later in the insert statements
1279
  $defs = array();
1280
  $ints = array();
1281
  foreach ( $table_structure as $struct ) {
1283
  ( 0 === strpos( strtolower( $struct->Type ), 'smallint' ) ) ||
1284
  ( 0 === strpos( strtolower( $struct->Type ), 'mediumint' ) ) ||
1285
  ( 0 === strpos( strtolower( $struct->Type ), 'int' ) ) ||
1286
+ ( 0 === strpos( strtolower( $struct->Type ), 'bigint' ) )
1287
+ ) {
1288
+ $defs[ strtolower( $struct->Field ) ] = ( null === $struct->Default ) ? 'NULL' : $struct->Default;
1289
+ $ints[ strtolower( $struct->Field ) ] = '1';
1290
  }
1291
  }
1292
 
1293
  // Batch by $row_inc
1294
 
1295
+ $row_inc = $this->rows_per_segment;
1296
  $row_start = 0;
1297
+ if ( $current_row != - 1 ) {
1298
  $row_start = $current_row;
1299
  }
1300
 
1301
  $this->row_tracker = $row_start;
1302
 
1303
  // \x08\\x09, not required
1304
+ $multibyte_search = array( "\x00", "\x0a", "\x0d", "\x1a" );
1305
+ $multibyte_replace = array( '\0', '\n', '\r', '\Z' );
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;
1318
 
1319
  foreach ( $table_structure as $col ) {
1320
  $field_set[] = $this->backquote( $col->Field );
1321
  if ( $col->Key == 'PRI' && true == $use_primary_keys ) {
1322
  if ( false === strpos( $col->Type, 'int' ) ) {
1323
+ $use_primary_keys = false;
1324
  $this->primary_keys = array();
1325
  continue;
1326
  }
1327
+ $this->primary_keys[ $col->Field ] = 0;
1328
  }
1329
  }
1330
 
1331
  $first_select = true;
1332
+ if ( ! empty( $this->post_data['primary_keys'] ) ) {
1333
+ $this->post_data['primary_keys'] = trim( $this->post_data['primary_keys'] );
1334
+ if ( ! empty( $this->post_data['primary_keys'] ) && is_serialized( $this->post_data['primary_keys'] ) ) {
1335
+ $this->primary_keys = unserialize( $this->post_data['primary_keys'] );
1336
+ $first_select = false;
1337
  }
1338
  }
1339
 
1340
  $fields = implode( ', ', $field_set );
1341
 
1342
+ $insert_buffer = $insert_query_template = 'INSERT INTO ' . $this->backquote( $table_name ) . ' ( ' . $fields . ") VALUES\n";
1343
 
1344
  do {
1345
+ $join = array();
1346
+ $where = 'WHERE 1=1';
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->post_data['stage'] && isset( $this->form_data['exclude_spam'] ) ) {
1351
  if ( $this->table_is( 'comments', $table ) ) {
1352
  $where .= ' AND comment_approved != "spam"';
1353
  } elseif ( $this->table_is( 'commentmeta', $table ) ) {
1354
+ $tables = $this->get_ms_compat_table_names( array( 'commentmeta', 'comments' ), $table );
1355
  $join[] = sprintf( 'INNER JOIN %1$s ON %1$s.comment_ID = %2$s.comment_id', $this->backquote( $tables['comments_table'] ), $this->backquote( $tables['commentmeta_table'] ) );
1356
  $where .= sprintf( ' AND %1$s.comment_approved != \'spam\'', $this->backquote( $tables['comments_table'] ) );
1357
  }
1358
  }
1359
 
1360
+ if ( 'backup' != $this->post_data['stage'] && isset( $this->form_data['exclude_post_types'] ) && ! empty( $this->form_data['select_post_types'] ) ) {
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
  }
1378
  }
1379
 
1380
+ if ( 'backup' != $this->post_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 ) ) ) {
1381
  $col_name = 'option_name';
1382
 
1383
  if ( isset( $wpdb->sitemeta ) && $wpdb->sitemeta == $table ) {
1387
  $where .= " AND `{$col_name}` NOT LIKE '\_transient\_%' AND `{$col_name}` NOT LIKE '\_site\_transient\_%'";
1388
  }
1389
 
1390
+ // don't export/migrate wpmdb specific option rows unless we're performing a backup
1391
+ if ( 'backup' != $this->post_data['stage'] && ( $this->table_is( 'options', $table ) || ( isset( $wpdb->sitemeta ) && $wpdb->sitemeta == $table ) ) ) {
1392
+ $col_name = 'option_name';
1393
+
1394
+ if ( isset( $wpdb->sitemeta ) && $wpdb->sitemeta == $table ) {
1395
+ $col_name = 'meta_key';
1396
+ }
1397
+
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}";
1407
  $primary_keys_keys = array_map( array( $this, 'backquote' ), $primary_keys_keys );
1408
 
1409
  $order_by = 'ORDER BY ' . implode( ',', $primary_keys_keys );
1410
+ $limit = "LIMIT $row_inc";
1411
 
1412
  if ( false == $first_select ) {
1413
  $where .= ' AND ';
1418
  // build a list of clauses, iteratively reducing the number of fields compared in the compound key
1419
  // e.g. (a = 1 AND b = 2 AND c > 3) OR (a = 1 AND b > 2) OR (a > 1)
1420
  $clauses = array();
1421
+ for ( $j = 0; $j < $primary_key_count; $j ++ ) {
1422
  // build a subclause for each field in the compound index
1423
  $subclauses = array();
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 = ( count( $temp_primary_keys ) - 1 == $i ? '>' : '=' );
1444
  $first_select = false;
1445
  }
1446
 
1447
+ $join = implode( ' ', array_unique( $join ) );
1448
+ $join = apply_filters( 'wpmdb_rows_join', $join, $table );
1449
+ $where = apply_filters( 'wpmdb_rows_where', $where, $table );
1450
  $order_by = apply_filters( 'wpmdb_rows_order_by', $order_by, $table );
1451
+ $limit = apply_filters( 'wpmdb_rows_limit', $limit, $table );
1452
 
1453
+ $sql = 'SELECT ' . $this->backquote( $table ) . '.* FROM ' . $this->backquote( $table ) . " $join $where $order_by $limit";
1454
  $sql = apply_filters( 'wpmdb_rows_sql', $sql, $table );
1455
 
1456
  $table_data = $wpdb->get_results( $sql );
1457
 
1458
  if ( $table_data ) {
1459
+ $to_search = isset( $this->find_replace_pairs['replace_old'] ) ? $this->find_replace_pairs['replace_old'] : '';
1460
+ $to_replace = isset( $this->find_replace_pairs['replace_new'] ) ? $this->find_replace_pairs['replace_new'] : '';
1461
+ $replacer = new WPMDB_Replace( $table, $to_search, $to_replace, $this );
1462
+
1463
  foreach ( $table_data as $row ) {
1464
+ $replacer->set_row( $row );
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
+ if ( is_multisite() && 'path' == $key && $this->post_data['stage'] != 'backup' && ( $wpdb->site == $table || $wpdb->blogs == $table ) ) {
1483
+ $old_path_current_site = $this->get_path_current_site();
1484
+ $new_path_current_site = '';
 
 
1485
 
1486
+ if ( ! empty( $this->post_data['path_current_site'] ) ) {
1487
+ $new_path_current_site = $this->post_data['path_current_site'];
1488
+ } elseif ( ! empty ( $this->form_data['replace_new'][1] ) ) {
1489
+ $new_path_current_site = $this->get_path_from_url( $this->form_data['replace_new'][1] );
1490
+ }
1491
 
1492
+ $new_path_current_site = apply_filters( 'wpmdb_new_path_current_site', $new_path_current_site );
 
1493
 
1494
+ if ( ! empty( $new_path_current_site ) && $old_path_current_site != $new_path_current_site ) {
1495
+ $pos = strpos( $value, $old_path_current_site );
1496
+ $value = substr_replace( $value, $new_path_current_site, $pos, strlen( $old_path_current_site ) );
1497
+ }
1498
+ }
1499
+
1500
+ if ( is_multisite() && 'domain' == $key && $this->post_data['stage'] != 'backup' && ( $wpdb->site == $table || $wpdb->blogs == $table ) ) {
1501
+ if ( ! empty( $this->post_data['domain_current_site'] ) ) {
1502
+ $main_domain_replace = $this->post_data['domain_current_site'];
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
+ $domain_replaces = array();
1509
+ $main_domain_find = sprintf( '/%s/', preg_quote( $this->get_domain_current_site(), '/' ) );
1510
+ if ( isset( $main_domain_replace ) ) {
1511
+ $domain_replaces[ $main_domain_find ] = $main_domain_replace;
1512
+ }
1513
+
1514
+ $domain_replaces = apply_filters( 'wpmdb_domain_replaces', $domain_replaces );
1515
+
1516
+ $value = preg_replace( array_keys( $domain_replaces ), array_values( $domain_replaces ), $value );
1517
+ }
1518
+
1519
+ if ( 'guid' != $key || ( isset( $this->form_data['replace_guids'] ) && $this->table_is( 'posts', $table ) ) ) {
1520
+ if ( $this->post_data['stage'] != 'backup' ) {
1521
+ $value = $replacer->recursive_unserialize_replace( $value );
1522
  }
1523
  }
1524
+
1525
+ $value = $this->sql_addslashes( $value );
1526
+ $value = str_replace( $multibyte_search, $multibyte_replace, $value );
1527
+
1528
+ $values[] = "'" . $value . "'";
1529
+
1530
  }
1531
 
1532
  $insert_line = '(' . implode( ', ', $values ) . '),';
1536
  if ( $insert_buffer == $insert_query_template ) {
1537
  $insert_buffer .= $insert_line;
1538
 
1539
+ ++ $this->row_tracker;
1540
 
1541
  if ( ! empty( $this->primary_keys ) ) {
1542
  foreach ( $this->primary_keys as $primary_key => $value ) {
1543
+ $this->primary_keys[ $primary_key ] = $row->$primary_key;
1544
  }
1545
  }
1546
  }
1549
  $insert_buffer .= " ;\n";
1550
  $this->stow( $insert_buffer );
1551
  $insert_buffer = $insert_query_template;
1552
+ $query_size = 0;
1553
+
1554
  return $this->transfer_chunk();
1555
  }
1556
 
1559
  $insert_buffer .= " ;\n";
1560
  $this->stow( $insert_buffer );
1561
  $insert_buffer = $insert_query_template;
1562
+ $query_size = 0;
1563
  }
1564
 
1565
  $insert_buffer .= $insert_line;
1566
  $query_size += strlen( $insert_line );
1567
 
1568
+ ++ $this->row_tracker;
1569
 
1570
  if ( ! empty( $this->primary_keys ) ) {
1571
  foreach ( $this->primary_keys as $primary_key => $value ) {
1572
+ $this->primary_keys[ $primary_key ] = $row->$primary_key;
1573
  }
1574
  }
1575
  }
1581
  $insert_buffer .= " ;\n";
1582
  $this->stow( $insert_buffer );
1583
  $insert_buffer = $insert_query_template;
1584
+ $query_size = 0;
1585
  }
 
1586
  }
1587
  } while ( count( $table_data ) > 0 );
1588
 
1589
  // Create footer/closing comment in SQL-file
1590
+ if ( $this->form_data['action'] == 'savefile' || $this->post_data['stage'] == 'backup' ) {
1591
  $this->stow( "\n" );
1592
  $this->stow( "#\n" );
1593
+ $this->stow( '# ' . sprintf( __( 'End of data contents of table %s', 'wp-migrate-db' ), $this->backquote( $table ) ) . "\n" );
1594
  $this->stow( "# --------------------------------------------------------\n" );
1595
  $this->stow( "\n" );
1596
 
1597
+ if ( $this->post_data['last_table'] == '1' ) {
1598
  $this->stow( "#\n" );
1599
  $this->stow( "# Add constraints back in\n" );
1600
  $this->stow( "#\n\n" );
1602
  $alter_table_name = $this->get_alter_table_name();
1603
 
1604
  if ( $this->form_data['action'] == 'savefile' ) {
1605
+ $wpdb->query( 'DROP TABLE IF EXISTS ' . $this->backquote( $alter_table_name ) . ';' );
1606
  }
1607
  }
1608
  }
1609
 
1610
+ $this->row_tracker = - 1;
 
1611
 
1612
+ return $this->transfer_chunk();
1613
  } // end backup_table()
1614
 
1615
  function table_is( $desired_table, $given_table ) {
1616
  global $wpdb;
1617
+
1618
  return $wpdb->{$desired_table} == $given_table || preg_match( '/' . $wpdb->prefix . '[0-9]+_' . $desired_table . '/', $given_table );
1619
  }
1620
 
1621
  /**
1622
  * return multisite-compatible names for requested tables, based on queried table name
1623
  *
1624
+ * @param array $tables list of table names required
1625
+ * @param string $queried_table name of table from which to derive the blog ID
1626
  *
1627
  * @return array list of table names altered for multisite compatibility
1628
  */
1643
  $ms_compat_table_names = array();
1644
 
1645
  foreach ( $tables as $table ) {
1646
+ $ms_compat_table_names[ $table . '_table' ] = $prefix . $table;
1647
  }
1648
 
1649
  return $ms_compat_table_names;
1650
  }
1651
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1652
  function db_backup_header() {
1653
  $charset = ( defined( 'DB_CHARSET' ) ? DB_CHARSET : 'utf8' );
1654
+ $this->stow( '# ' . __( 'WordPress MySQL database migration', 'wp-migrate-db' ) . "\n", false );
1655
  $this->stow( "#\n", false );
1656
+ $this->stow( '# ' . sprintf( __( 'Generated: %s', 'wp-migrate-db' ), date( 'l j. F Y H:i T' ) ) . "\n", false );
1657
+ $this->stow( '# ' . sprintf( __( 'Hostname: %s', 'wp-migrate-db' ), DB_HOST ) . "\n", false );
1658
+ $this->stow( '# ' . sprintf( __( 'Database: %s', 'wp-migrate-db' ), $this->backquote( DB_NAME ) ) . "\n", false );
1659
  $this->stow( "# --------------------------------------------------------\n\n", false );
1660
  $this->stow( "/*!40101 SET NAMES $charset */;\n\n", false );
1661
  $this->stow( "SET sql_mode='NO_AUTO_VALUE_ON_ZERO';\n\n", false );
1690
  }
1691
 
1692
  function stow( $query_line, $replace = true ) {
1693
+ $this->set_post_data();
1694
  $this->current_chunk .= $query_line;
1695
 
1696
+ if ( $this->form_data['action'] == 'savefile' || $this->post_data['stage'] == 'backup' ) {
1697
  if ( $this->gzip() && isset( $this->form_data['gzip_file'] ) ) {
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
+
1701
  return false;
1702
  }
1703
  } else {
1704
+ // TODO: Use WP_Filesystem API.
1705
  if ( false === @fwrite( $this->fp, $query_line ) ) {
1706
  $this->error = __( 'Failed to write the SQL data to the file. (#128)', 'wp-migrate-db' );
1707
+
1708
  return false;
1709
  }
1710
  }
1711
+ } elseif ( $this->post_data['intent'] == 'pull' ) {
1712
  echo $query_line;
1713
  }
1714
  }
1715
 
1716
  // Called in the $this->stow function once our chunk buffer is full, will transfer the SQL to the remote server for importing
1717
  function transfer_chunk() {
1718
+ $this->set_post_data();
1719
+
1720
+ if ( $this->post_data['intent'] == 'savefile' || $this->post_data['stage'] == 'backup' ) {
1721
  $this->close( $this->fp );
1722
 
1723
  $result = $this->end_ajax( json_encode(
1726
  'primary_keys' => serialize( $this->primary_keys )
1727
  )
1728
  ) );
1729
+
1730
  return $result;
1731
  }
1732
 
1733
+ if ( $this->post_data['intent'] == 'pull' ) {
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->post_data['gzip'] ) && $this->post_data['gzip'] == '1' && $this->gzip() ) {
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->post_data['table'],
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->post_data['key'] );
1754
 
1755
  $ajax_url = trailingslashit( $this->remote_url ) . 'wp-admin/admin-ajax.php';
1756
  $response = $this->remote_post( $ajax_url, $data, __FUNCTION__ );
1761
 
1762
  if ( ! empty( $response ) ) {
1763
  $result = $this->end_ajax( $response );
1764
+
1765
  return $result;
1766
  }
1767
 
1768
  $result = $this->end_ajax( json_encode(
1769
  array(
1770
+ 'current_row' => $this->row_tracker,
1771
+ 'primary_keys' => serialize( $this->primary_keys )
1772
  )
1773
  ) );
1774
+
1775
  return $result;
1776
  }
1777
 
1778
  /**
1779
  * Add backquotes to tables and db-names in
1780
  * SQL queries. Taken from phpMyAdmin.
1781
+ *
1782
+ * @param $a_name
1783
+ *
1784
+ * @return array|string
1785
  */
1786
  function backquote( $a_name ) {
1787
+ if ( ! empty( $a_name ) && $a_name != '*' ) {
1788
  if ( is_array( $a_name ) ) {
1789
  $result = array();
1790
  reset( $a_name );
1791
+ while ( list( $key, $val ) = each( $a_name ) ) {
1792
+ $result[ $key ] = '`' . $val . '`';
1793
+ }
1794
+
1795
  return $result;
1796
  } else {
1797
  return '`' . $a_name . '`';
1804
  /**
1805
  * Better addslashes for SQL queries.
1806
  * Taken from phpMyAdmin.
1807
+ *
1808
+ * @param string $a_string
1809
+ * @param bool $is_like
1810
+ *
1811
+ * @return mixed
1812
  */
1813
  function sql_addslashes( $a_string = '', $is_like = false ) {
1814
  if ( $is_like ) {
1822
 
1823
  function network_admin_menu() {
1824
  $title = ( $this->is_pro ) ? __( 'Migrate DB Pro', 'wp-migrate-db' ) : __( 'Migrate DB', 'wp-migrate-db' );
1825
+ $hook_suffix = add_submenu_page( 'settings.php',
1826
+ $title,
1827
+ $title,
1828
+ 'manage_network_options',
1829
+ $this->core_slug,
1830
+ array( $this, 'options_page' ) );
1831
  $this->after_admin_menu( $hook_suffix );
1832
  }
1833
 
1834
  function admin_menu() {
1835
  $title = ( $this->is_pro ) ? __( 'Migrate DB Pro', 'wp-migrate-db' ) : __( 'Migrate DB', 'wp-migrate-db' );
1836
+ $hook_suffix = add_management_page( $title,
1837
+ $title,
1838
+ 'export',
1839
+ $this->core_slug,
1840
+ array( $this, 'options_page' ) );
1841
  $this->after_admin_menu( $hook_suffix );
1842
  }
1843
 
1844
  function after_admin_menu( $hook_suffix ) {
1845
  add_action( 'admin_head-' . $hook_suffix, array( $this, 'admin_head_connection_info' ) );
1846
+ add_action( 'load-' . $hook_suffix, array( $this, 'load_assets' ) );
1847
 
1848
  // Remove licence from the database if constant is set
1849
+ if ( $this->is_licence_constant() && ! empty( $this->settings['licence'] ) ) {
1850
  $this->settings['licence'] = '';
1851
+ update_site_option( 'wpmdb_settings', $this->settings );
1852
  }
1853
  }
1854
 
1855
  function admin_body_class( $classes ) {
1856
+ if ( ! $classes ) {
1857
  $classes = array();
1858
  } else {
1859
  $classes = explode( ' ', $classes );
1869
  // Recommended way to target WP 3.8+
1870
  // http://make.wordpress.org/ui/2013/11/19/targeting-the-new-dashboard-design-in-a-post-mp6-world/
1871
  if ( version_compare( $GLOBALS['wp_version'], '3.8-alpha', '>' ) ) {
1872
+ if ( ! in_array( 'mp6', $classes ) ) {
1873
  $classes[] = 'mp6';
1874
  }
1875
  }
1877
  return implode( ' ', $classes );
1878
  }
1879
 
1880
+ /**
1881
+ * TODO: refactor to separate out all discrete actions into individual methods
1882
+ */
1883
  function load_assets() {
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();
1891
+ $this->output_log_file();
1892
+ $log = ob_get_clean();
1893
+ $url = $this->parse_url( home_url() );
1894
+ $host = sanitize_file_name( $url['host'] );
1895
+ $filename = sprintf( '%s-dianostic-log-%s.txt', $host, date( 'YmdHis' ) );
1896
+ header( 'Content-Description: File Transfer' );
1897
+ header( 'Content-Type: application/octet-stream' );
1898
+ header( 'Content-Length: ' . strlen( $log ) );
1899
+ header( 'Content-Disposition: attachment; filename=' . $filename );
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 );
1907
  // delete these transients as they contain information only valid for authenticated licence holders
1908
  delete_site_transient( 'update_plugins' );
1909
  delete_site_transient( 'wpmdb_upgrade_data' );
1938
  $plugins_url = trailingslashit( plugins_url() ) . trailingslashit( $this->plugin_folder_name );
1939
 
1940
  $version = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? time() : $this->plugin_version;
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 );
1945
 
1946
+ $src = $plugins_url . "asset/js/common$min.js";
1947
+ wp_enqueue_script( 'wp-migrate-db-pro-common', $src, null, $version, true );
1948
 
1949
+ $src = $plugins_url . "asset/js/hook$min.js";
1950
+ wp_enqueue_script( 'wp-migrate-db-pro-hook', $src, null, $version, true );
1951
 
1952
  do_action( 'wpmdb_load_assets' );
1953
 
 
 
1954
  $src = $plugins_url . "asset/js/script$min.js";
1955
  wp_enqueue_script( 'wp-migrate-db-pro-script', $src, array( 'jquery' ), $version, true );
1956
 
1957
+ wp_localize_script( 'wp-migrate-db-pro-script',
1958
+ 'wpmdb_strings',
1959
+ array(
1960
+ 'max_request_size_problem' => __( 'A problem occurred when trying to change the maximum request size, please try again.', 'wp-migrate-db' ),
1961
+ 'license_check_problem' => __( 'A problem occurred when trying to check the license, please try again.', 'wp-migrate-db' ),
1962
+ 'establishing_remote_connection' => __( 'Establishing connection to remote server, please wait', 'wp-migrate-db' ),
1963
+ 'connection_local_server_problem' => __( 'A problem occurred when attempting to connect to the local server, please check the details and try again.', 'wp-migrate-db' ),
1964
+ 'enter_license_key' => __( 'Please enter your license key.', 'wp-migrate-db' ),
1965
+ 'register_license_problem' => __( 'A problem occurred when trying to register the license, please try again.', 'wp-migrate-db' ),
1966
+ 'license_registered' => __( 'Your license has been activated. You will now receive automatic updates and access to email support.', 'wp-migrate-db' ),
1967
+ 'fetching_license' => __( 'Fetching license details, please wait...', 'wp-migrate-db' ),
1968
+ 'clear_log_problem' => __( 'An error occurred when trying to clear the debug log. Please contact support. (#132)', 'wp-migrate-db' ),
1969
+ 'update_log_problem' => __( 'An error occurred when trying to update the debug log. Please contact support. (#133)', 'wp-migrate-db' ),
1970
+ 'migrate_db_save' => _x( 'Migrate & Save Profile', 'Copy data between servers and save migration profile', 'wp-migrate-db' ),
1971
+ 'migrate_db' => _x( 'Migrate', 'Copy data between servers', 'wp-migrate-db' ),
1972
+ 'please_select_one_table' => __( 'Please select at least one table to migrate.', 'wp-migrate-db' ),
1973
+ 'enter_name_for_profile' => __( 'Please enter a name for your migration profile.', 'wp-migrate-db' ),
1974
+ 'save_profile_problem' => __( 'An error occurred when attempting to save the migration profile. Please see the Help tab for details on how to request support. (#118)', 'wp-migrate-db' ),
1975
+ 'exporting_complete' => _x( 'Exporting complete', 'Data has been successfully exported', 'wp-migrate-db' ),
1976
+ 'exporting_please_wait' => __( 'Exporting, please wait...', 'wp-migrate-db' ),
1977
+ 'please_wait' => __( 'please wait...', 'wp-migrate-db' ),
1978
+ 'complete' => _x( 'complete', 'Finished successfully', 'wp-migrate-db' ),
1979
+ 'migration_failed' => _x( 'Migration failed', 'Copy of data between servers did not complete', 'wp-migrate-db' ),
1980
+ 'backing_up' => _x( 'Backing up', 'Saving a copy of the data before import', 'wp-migrate-db' ),
1981
+ 'migrating' => _x( 'Migrating', 'Copying data between servers', 'wp-migrate-db' ),
1982
+ 'status' => _x( 'Status', 'Current request status', 'wp-migrate-db' ),
1983
+ 'response' => _x( 'Response', 'The message the server responded with', 'wp-migrate-db' ),
1984
+ 'table_process_problem' => __( 'A problem occurred when attempting to process the following table (#113)', 'wp-migrate-db' ),
1985
+ 'table_process_problem_empty_response' => __( 'A problem occurred when processing the following table. We were expecting a response in JSON format but instead received an empty response.', 'wp-migrate-db' ),
1986
+ 'completed_with_some_errors' => __( 'Migration completed with some errors', 'wp-migrate-db' ),
1987
+ 'completed_dump_located_at' => __( 'Migration complete, your backup is located at:', 'wp-migrate-db' ),
1988
+ 'finalize_tables_problem' => __( 'A problem occurred when finalizing the backup. (#140)', 'wp-migrate-db' ),
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 removing the following migration profile. This cannot be undone. Do you wish to continue?', 'wp-migrate-db' ),
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' ),
1996
+ 'enter_connection_info' => __( 'Please enter the connection information above to continue.', 'wp-migrate-db' ),
1997
+ 'save_settings_problem' => __( 'An error occurred when trying to save the settings. Please try again. If the problem persists, please see the Help tab for details on how to request support. (#108)', 'wp-migrate-db' ),
1998
+ 'connection_info_missing' => __( 'The connection information appears to be missing, please enter it to continue.', 'wp-migrate-db' ),
1999
+ 'connection_info_incorrect' => __( "The connection information appears to be incorrect, it should consist of two lines. The first being the remote server's URL and the second being the secret key.", 'wp-migrate-db' ),
2000
+ 'connection_info_url_invalid' => __( 'The URL on the first line appears to be invalid, please check it and try again.', 'wp-migrate-db' ),
2001
+ 'connection_info_key_invalid' => __( 'The secret key on the second line appears to be invalid. It should be a 32 character string that consists of letters, numbers and special characters only.', 'wp-migrate-db' ),
2002
+ 'connection_info_local_url' => __( "It appears you've entered the URL for this website, you need to provide the URL of the remote website instead.", 'wp-migrate-db' ),
2003
+ 'connection_info_local_key' => __( 'Looks like your remote secret key is the same as the secret key for this site. To fix this, go to the <a href="#settings">Settings tab</a> and click "Reset Secret Key"', 'wp-migrate-db' ),
2004
+ 'time_elapsed' => __( 'Time Elapsed:', 'wp-migrate-db' ),
2005
+ 'pause' => _x( 'Pause', 'Temporarily stop migrating', 'wp-migrate-db' ),
2006
+ 'migration_paused' => _x( 'Migration Paused', 'The migration has been temporarily stopped', 'wp-migrate-db' ),
2007
+ 'resume' => _x( 'Resume', 'Restart migrating after it was paused', 'wp-migrate-db' ),
2008
+ 'completing_current_request' => __( 'Completing current request', 'wp-migrate-db' ),
2009
+ 'cancelling_migration' => _x( 'Cancelling migration', 'The migration is being cancelled', 'wp-migrate-db' ),
2010
+ 'paused' => _x( 'Paused', 'The migration has been temporarily stopped', 'wp-migrate-db' ),
2011
+ 'removing_local_sql' => __( 'Removing the local MySQL export file', 'wp-migrate-db' ),
2012
+ 'removing_local_backup' => __( 'Removing the local backup MySQL export file', 'wp-migrate-db' ),
2013
+ 'removing_local_temp_tables' => __( 'Removing the local temporary tables', 'wp-migrate-db' ),
2014
+ 'removing_remote_sql' => __( 'Removing the remote backup MySQL export file', 'wp-migrate-db' ),
2015
+ 'removing_remote_temp_tables' => __( 'Removing the remote temporary tables', 'wp-migrate-db' ),
2016
+ 'migration_cancellation_failed' => __( 'Migration cancellation failed', 'wp-migrate-db' ),
2017
+ 'manually_remove_temp_files' => __( 'A problem occurred while cancelling the migration, you may have to manually delete some temporary files / tables.', 'wp-migrate-db' ),
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' ),
2024
+ 'sure' => _x( 'Sure?', 'Confirmation required', 'wp-migrate-db' ),
2025
+ 'pull_migration_label_migrating' => __( 'Pulling from %s, please wait...', 'wp-migrate-db' ),
2026
+ 'pull_migration_label_completed' => __( 'Pulling from %s complete', 'wp-migrate-db' ),
2027
+ 'push_migration_label_migrating' => __( 'Pushing to %s, please wait...', 'wp-migrate-db' ),
2028
+ 'push_migration_label_completed' => __( 'Pushing to %s complete', 'wp-migrate-db' ),
2029
+ 'copying_license' => __( 'Copying license to the remote site, please wait', 'wp-migrate-db' ),
2030
+ 'attempting_to_activate_licence' => __( 'Attempting to activate your license, please wait...', 'wp-migrate-db' ),
2031
+ 'licence_reactivated' => __( 'License successfully activated, please wait...', 'wp-migrate-db' ),
2032
+ 'activate_licence_problem' => __( 'An error occurred when trying to reactivate your license. Please provide the following information when requesting support:', 'wp-migrate-db' ),
2033
+ 'temporarily_activated_licence' => __( "<strong>We've temporarily activated your licence and will complete the activation once the Delicious Brains API is available again.</strong><br />Please refresh this page to continue.", 'wp-migrate-db' ),
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
 
2040
  wp_enqueue_script( 'jquery' );
2041
  wp_enqueue_script( 'jquery-ui-core' );
2044
  }
2045
 
2046
  function download_file() {
2047
+ // don't need to check for user permissions as our 'add_management_page' already takes care of this
2048
  $this->set_time_limit();
2049
 
2050
  $dump_name = $this->format_dump_name( $_GET['download'] );
2053
  $dump_name .= '.gz';
2054
  }
2055
 
2056
+ $diskfile = $this->get_upload_info( 'path' ) . DIRECTORY_SEPARATOR . $dump_name;
2057
+ $filename = basename( $diskfile );
2058
+ $last_dash = strrpos( $filename, '-' );
2059
+ $salt = substr( $filename, $last_dash, 6 );
2060
  $filename_no_salt = str_replace( $salt, '', $filename );
2061
 
2062
  if ( file_exists( $diskfile ) ) {
2065
  header( 'Content-Length: ' . filesize( $diskfile ) );
2066
  header( 'Content-Disposition: attachment; filename=' . $filename_no_salt );
2067
  $success = readfile( $diskfile );
2068
+ // TODO: Use WP_Filesystem API.
2069
  unlink( $diskfile );
2070
  exit;
2071
  } else {
2072
+ wp_die( __( 'Could not find the file to download:', 'wp-migrate-db' ) . '<br />' . esc_html( $diskfile ) );
2073
  }
2074
  }
2075
 
2077
  global $table_prefix;
2078
 
2079
  $nonces = array(
2080
+ 'update_max_request_size' => wp_create_nonce( 'update-max-request-size' ),
2081
+ 'check_licence' => wp_create_nonce( 'check-licence' ),
2082
+ 'verify_connection_to_remote_site' => wp_create_nonce( 'verify-connection-to-remote-site' ),
2083
+ 'activate_licence' => wp_create_nonce( 'activate-licence' ),
2084
+ 'clear_log' => wp_create_nonce( 'clear-log' ),
2085
+ 'get_log' => wp_create_nonce( 'get-log' ),
2086
+ 'save_profile' => wp_create_nonce( 'save-profile' ),
2087
+ 'initiate_migration' => wp_create_nonce( 'initiate-migration' ),
2088
+ 'migrate_table' => wp_create_nonce( 'migrate-table' ),
2089
+ 'finalize_migration' => wp_create_nonce( 'finalize-migration' ),
2090
+ 'reset_api_key' => wp_create_nonce( 'reset-api-key' ),
2091
+ 'delete_migration_profile' => wp_create_nonce( 'delete-migration-profile' ),
2092
+ 'save_setting' => wp_create_nonce( 'save-setting' ),
2093
+ 'copy_licence_to_remote_site' => wp_create_nonce( 'copy-licence-to-remote-site' ),
2094
+ 'reactivate_licence' => wp_create_nonce( 'reactivate-licence' ),
2095
+ 'process_notice_link' => wp_create_nonce( 'process-notice-link' ),
2096
  );
2097
 
2098
  $nonces = apply_filters( 'wpmdb_nonces', $nonces ); ?>
2099
 
2100
  <script type='text/javascript'>
2101
  var wpmdb_connection_info = <?php echo json_encode( array( site_url( '', 'https' ), $this->settings['key'] ) ); ?>;
2102
+ var wpmdb_this_url = '<?php echo esc_html( addslashes( home_url() ) ) ?>';
2103
+ var wpmdb_this_path = '<?php echo esc_html( addslashes( $this->absolute_root_file_path ) ); ?>';
2104
+ var wpmdb_this_domain = '<?php echo esc_html( $this->get_domain_current_site() ); ?>';
2105
  var wpmdb_this_tables = <?php echo json_encode( $this->get_tables() ); ?>;
2106
  var wpmdb_this_prefixed_tables = <?php echo json_encode( $this->get_tables( 'prefix' ) ); ?>;
2107
  var wpmdb_this_table_sizes = <?php echo json_encode( $this->get_table_sizes() ); ?>;
2108
  var wpmdb_this_table_rows = <?php echo json_encode( $this->get_table_row_count() ); ?>;
2109
+ var wpmdb_this_upload_url = '<?php echo esc_html( addslashes( trailingslashit( $this->get_upload_info( 'url' ) ) ) ); ?>';
2110
+ var wpmdb_this_upload_dir_long = '<?php echo esc_html( addslashes( trailingslashit( $this->get_upload_info( 'path' ) ) ) ); ?>';
2111
  var wpmdb_this_website_name = '<?php echo sanitize_title_with_dashes( DB_NAME ); ?>';
2112
  var wpmdb_this_download_url = '<?php echo network_admin_url( $this->plugin_base . '&download=' ); ?>';
2113
+ var wpmdb_this_prefix = '<?php echo esc_html( $table_prefix ); ?>';
2114
+ var wpmdb_is_multisite = <?php echo esc_html( is_multisite() ? 'true' : 'false' ); ?>;
2115
+ var wpmdb_openssl_available = <?php echo esc_html( $this->open_ssl_enabled() ? 'true' : 'false' ); ?>;
2116
+ var wpmdb_max_request = '<?php echo esc_html( $this->settings['max_request'] ); ?>';
2117
+ var wpmdb_bottleneck = '<?php echo esc_html( $this->get_bottleneck( 'max' ) ); ?>';
2118
+ var wpmdb_this_uploads_dir = '<?php echo esc_html( addslashes( $this->get_short_uploads_dir() ) ); ?>';
2119
+ var wpmdb_has_licence = '<?php echo esc_html( $this->get_licence_key() == '' ? '0' : '1' ); ?>';
2120
+ // TODO: Use WP_Filesystem API.
2121
+ var wpmdb_write_permission = <?php echo esc_html( is_writeable( $this->get_upload_info( 'path' ) ) ? 'true' : 'false' ); ?>;
2122
  var wpmdb_nonces = <?php echo json_encode( $nonces ); ?>;
2123
  var wpmdb_valid_licence = '<?php echo ( $this->is_valid_licence() ) ? '1' : '0'; ?>';
2124
  var wpmdb_profile = '<?php echo isset( $_GET['wpmdb-profile'] ) ? $_GET['wpmdb-profile'] : '-1'; ?>';
2125
+ var wpmdb_is_pro = <?php echo esc_html( ( $this->is_pro ) ? 'true' : 'false' ); ?>;
2126
+ var wpmdb_lower_case_table_names = '<?php echo esc_html( $this->get_lower_case_table_names_setting() ); ?>';
2127
  <?php do_action( 'wpmdb_js_variables' ); ?>
2128
  </script>
2129
+ <?php
2130
  }
2131
 
2132
  function maybe_update_profile( $profile, $profile_id ) {
2135
  if ( isset( $profile['exclude_revisions'] ) ) {
2136
  unset( $profile['exclude_revisions'] );
2137
  $profile['select_post_types'] = array( 'revision' );
2138
+ $profile_changed = true;
2139
  }
2140
 
2141
  if ( isset( $profile['post_type_migrate_option'] ) && 'migrate_select_post_types' == $profile['post_type_migrate_option'] && 'pull' != $profile['action'] ) {
2142
  unset( $profile['post_type_migrate_option'] );
2143
  $profile['exclude_post_types'] = '1';
2144
+ $all_post_types = $this->get_post_types();
2145
+ $profile['select_post_types'] = array_diff( $all_post_types, $profile['select_post_types'] );
2146
+ $profile_changed = true;
2147
  }
2148
 
2149
  if ( $profile_changed ) {
2150
+ $this->settings['profiles'][ $profile_id ] = $profile;
2151
+ update_site_option( 'wpmdb_settings', $this->settings );
2152
  }
2153
 
2154
  return $profile;
2155
  }
2156
 
2157
  function get_path_from_url( $url ) {
2158
+ $parts = $this->parse_url( $url );
2159
+
2160
  return ( ! empty( $parts['path'] ) ) ? trailingslashit( $parts['path'] ) : '/';
2161
  }
2162
 
2166
  }
2167
 
2168
  $current_site = get_current_site();
2169
+
2170
  return $current_site->path;
2171
  }
2172
 
2176
  }
2177
 
2178
  $current_site = get_current_site();
 
 
2179
 
2180
+ return $current_site->domain;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2181
  }
2182
 
2183
  function maybe_checked( $option ) {
2184
+ echo esc_html( ( isset( $option ) && $option == '1' ) ? ' checked="checked"' : '' );
2185
  }
2186
 
2187
  function ajax_cancel_migration() {
2188
+ $this->set_post_data();
2189
+ $this->form_data = $this->parse_migration_form_data( $this->post_data['form_data'] );
2190
 
2191
+ switch ( $this->post_data['intent'] ) {
2192
  case 'savefile' :
2193
+ $this->delete_export_file( $this->post_data['dump_filename'], false );
2194
  break;
2195
  case 'push' :
2196
+ $data = $this->filter_post_elements( $this->post_data, array( 'action', 'intent', 'url', 'key', 'form_data', 'dump_filename', 'temp_prefix', 'stage' ) );
2197
  $data['action'] = 'wpmdb_process_push_migration_cancellation';
2198
  $data['temp_prefix'] = $this->temp_prefix;
2199
  $ajax_url = trailingslashit( $data['url'] ) . 'wp-admin/admin-ajax.php';
2202
  $response = $this->remote_post( $ajax_url, $data, __FUNCTION__ );
2203
  $this->display_errors();
2204
 
2205
+ echo esc_html( trim( $response ) );
2206
  break;
2207
  case 'pull' :
2208
+ if ( $this->post_data['stage'] == 'backup' ) {
2209
+ $this->delete_export_file( $this->post_data['dump_filename'], true );
2210
  } else {
2211
+ $this->delete_temporary_tables( $this->post_data['temp_prefix'] );
2212
  }
2213
  break;
2214
  default:
2225
  $dump_file = preg_replace( '/.gz$/', '', $dump_file );
2226
  }
2227
 
2228
+ $dump_file = $this->get_upload_info( 'path' ) . DIRECTORY_SEPARATOR . $dump_file;
2229
 
2230
  if ( empty( $dump_file ) || false == file_exists( $dump_file ) ) {
2231
  _e( 'MySQL export file not found.', 'wp-migrate-db' );
2232
  exit;
2233
  }
2234
 
2235
+ // TODO: Use WP_Filesystem API.
2236
  if ( false === @unlink( $dump_file ) ) {
2237
+ _e( 'Could not delete the MySQL export file.', 'wp-migrate-db' );
2238
  exit;
2239
  }
2240
  }
2287
  call_user_func( array( $this, $method_name ), $args );
2288
  }
2289
  }
 
2290
  }
2291
 
2292
  function plugin_tabs() {
2302
  return;
2303
  }
2304
 
2305
+ $plugin_to_deactivate = 'wp-migrate-db.php';
2306
  $deactivated_notice_id = '1';
2307
  if ( $plugin_to_deactivate == basename( $plugin ) ) {
2308
+ $plugin_to_deactivate = 'wp-migrate-db-pro.php';
2309
  $deactivated_notice_id = '2';
2310
  }
2311
 
2320
  if ( false !== strpos( $basename, $plugin_to_deactivate ) ) {
2321
  set_transient( 'wp_migrate_db_deactivated_notice_id', $deactivated_notice_id, 1 * HOUR_IN_SECONDS );
2322
  deactivate_plugins( $basename );
2323
+
2324
  return;
2325
  }
2326
  }
2335
  } ?>
2336
 
2337
  <div class="updated" style="border-left: 4px solid #ffba00;">
2338
+ <p><?php echo esc_html( $message ); ?></p>
2339
  </div> <?php
2340
 
2341
  delete_transient( 'wp_migrate_db_deactivated_notice_id' );
2342
  }
2343
  }
2344
 
2345
+ /**
2346
+ * When the "Use SSL for WP-admin and WP-login" option is checked in the
2347
+ * WP Engine settings, the WP Engine must-use plugin buffers the output and
2348
+ * does a find & replace for URLs. When we return PHP serialized data, it
2349
+ * replaces http:// with https:// and corrupts the serialization.
2350
+ * So here, we disable this filtering for our requests.
2351
+ */
2352
+ function maybe_disable_wp_engine_filtering() {
2353
+ // Detect if the must-use WP Engine plugin is running
2354
+ if ( ! defined( 'WPE_PLUGIN_BASE' ) ) {
2355
+ return;
2356
+ }
2357
+
2358
+ // Make sure this is a WP Migrate DB Ajax request
2359
+ if ( ! class_exists( 'WPMDB_Utils' ) || ! WPMDB_Utils::is_ajax() ) {
2360
+ return;
2361
+ }
2362
+
2363
+ // Turn off WP Engine's output filtering
2364
+ if ( ! defined( 'WPE_NO_HTML_FILTER' ) ) {
2365
+ define( 'WPE_NO_HTML_FILTER', true );
2366
+ }
2367
+ }
2368
+
2369
+ /**
2370
+ * Ensures that the given create table sql string is compatible with the target database server version.
2371
+ *
2372
+ * @param $create_table
2373
+ * @param $table
2374
+ * @param $db_version
2375
+ *
2376
+ * @return mixed
2377
+ */
2378
+ function mysql_compat_filter( $create_table, $table, $db_version ) {
2379
+ if ( empty( $db_version ) ) {
2380
+ return $create_table;
2381
+ }
2382
+
2383
+ if ( version_compare( $db_version, '5.5.3', '<' ) ) {
2384
+ // Remove index comments introduced in MySQL 5.5.3.
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;
2391
+ }
2392
+
2393
+ /**
2394
+ * Provides find/replace pairs with wpmdb_find_and_replace filter applied.
2395
+ *
2396
+ * @param string $intent
2397
+ * @param string $site_url
2398
+ *
2399
+ * @return array
2400
+ */
2401
+ function parse_find_replace_pairs( $intent = '', $site_url = '' ) {
2402
+ $find_replace_pairs = array();
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'] );
2406
+ }
2407
+
2408
+ $tmp_find_replace_pairs = apply_filters( 'wpmdb_find_and_replace', $tmp_find_replace_pairs, $intent, $site_url );
2409
+
2410
+ if ( ! empty( $tmp_find_replace_pairs ) ) {
2411
+ $i = 1;
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
+
2419
+ return $find_replace_pairs;
2420
+ }
2421
+
2422
+ function get_lower_case_table_names_setting() {
2423
+ global $wpdb;
2424
+
2425
+ $setting = $wpdb->get_var( "SHOW VARIABLES LIKE 'lower_case_table_names'", 1 );
2426
+
2427
+ return empty( $setting ) ? '-1' : $setting;
2428
+ }
2429
+
2430
+ function mixed_case_table_name_warning( $migration_type ) {
2431
+ ob_start();
2432
+ ?>
2433
+ <h4><?php _e( "Warning: Mixed Case Table Names", 'wp-migrate-db' ); ?></h4>
2434
+
2435
+ <?php if ( 'pull' === $migration_type ) : ?>
2436
+ <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>
2437
+ <?php else : ?>
2438
+ <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>
2439
+ <?php endif; ?>
2440
+
2441
+ <p><?php _e( "As a result, uppercase characters in table names will be converted to lowercase during the migration.", 'wp-migrate-db' ); ?></p>
2442
+
2443
+ <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>
2444
+ <?php
2445
+ return wptexturize( ob_get_clean() );
2446
+ }
2447
+
2448
  }
compatibility/wp-migrate-db-pro-compatibility.php CHANGED
@@ -10,42 +10,91 @@ Author URI: http://deliciousbrains.com
10
 
11
  $GLOBALS['wpmdb_compatibility'] = true;
12
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
13
 
14
  /**
15
- * remove blog-active plugins
16
- * @param array $plugins numerically keyed array of plugin names
17
- * @return array
18
- */
 
 
19
  function wpmdbc_exclude_plugins( $plugins ) {
20
- if ( !defined( 'DOING_AJAX' ) || !DOING_AJAX || !isset( $_POST['action'] ) || false === strpos( $_POST['action'], 'wpmdb' ) ) return $plugins;
21
- $wpmdb_settings = get_option( 'wpmdb_settings' );
22
- if ( !empty( $wpmdb_settings['blacklist_plugins'] ) ) {
 
 
23
  $blacklist_plugins = array_flip( $wpmdb_settings['blacklist_plugins'] );
24
  }
25
- foreach( $plugins as $key => $plugin ) {
26
- if ( false !== strpos( $plugin, 'wp-migrate-db-pro' ) || !isset( $blacklist_plugins[$plugin] ) ) continue;
27
- unset( $plugins[$key] );
 
 
28
  }
 
29
  return $plugins;
30
  }
31
- add_filter( 'option_active_plugins', 'wpmdbc_exclude_plugins' );
32
 
 
33
 
34
  /**
35
- * remove network-active plugins
36
- * @param array $plugins array of plugins keyed by name (name=>timestamp pairs)
37
- * @return array
38
- */
 
 
39
  function wpmdbc_exclude_site_plugins( $plugins ) {
40
- if ( !defined( 'DOING_AJAX' ) || !DOING_AJAX || !isset( $_POST['action'] ) || false === strpos( $_POST['action'], 'wpmdb' ) ) return $plugins;
41
- $wpmdb_settings = get_option( 'wpmdb_settings' );
42
- if ( !empty( $wpmdb_settings['blacklist_plugins'] ) ) {
 
 
43
  $blacklist_plugins = array_flip( $wpmdb_settings['blacklist_plugins'] );
44
  }
45
- foreach( array_keys( $plugins ) as $plugin ) {
46
- if ( false !== strpos( $plugin, 'wp-migrate-db-pro' ) || !isset( $blacklist_plugins[$plugin] ) ) continue;
47
- unset( $plugins[$plugin] );
 
 
48
  }
 
49
  return $plugins;
50
  }
 
51
  add_filter( 'site_option_active_sitewide_plugins', 'wpmdbc_exclude_site_plugins' );
10
 
11
  $GLOBALS['wpmdb_compatibility'] = true;
12
 
13
+ /**
14
+ * Remove TGM Plugin Activation 'force_activation' admin_init action hook if present.
15
+ *
16
+ * This is to stop excluded plugins being deactivated after a migration, when a theme uses TGMPA to require a plugin to be always active.
17
+ */
18
+ function wpmdbc_tgmpa_compatibility() {
19
+ $remove_function = false;
20
+
21
+ // run on wpmdb page
22
+ if ( isset( $_GET['page'] ) && 'wp-migrate-db-pro' == $_GET['page'] ) {
23
+ $remove_function = true;
24
+ }
25
+ // run on wpmdb ajax requests
26
+ if ( defined( 'DOING_AJAX' ) && DOING_AJAX && isset( $_POST['action'] ) && false !== strpos( $_POST['action'], 'wpmdb' ) ) {
27
+ $remove_function = true;
28
+ }
29
+
30
+ if ( $remove_function ) {
31
+ global $wp_filter;
32
+ $admin_init_functions = $wp_filter['admin_init'];
33
+ foreach ( $admin_init_functions as $priority => $functions ) {
34
+ foreach ( $functions as $key => $function ) {
35
+ // searching for function this way as can't rely on the calling class being named TGM_Plugin_Activation
36
+ if ( false !== strpos( $key, 'force_activation' ) ) {
37
+ unset( $wp_filter['admin_init'][ $priority ][ $key ] );
38
+
39
+ return;
40
+ }
41
+ }
42
+ }
43
+ }
44
+ }
45
+
46
+ add_action( 'admin_init', 'wpmdbc_tgmpa_compatibility', 1 );
47
 
48
  /**
49
+ * remove blog-active plugins
50
+ *
51
+ * @param array $plugins numerically keyed array of plugin names
52
+ *
53
+ * @return array
54
+ */
55
  function wpmdbc_exclude_plugins( $plugins ) {
56
+ if ( ! defined( 'DOING_AJAX' ) || ! DOING_AJAX || ! isset( $_POST['action'] ) || false === strpos( $_POST['action'], 'wpmdb' ) ) {
57
+ return $plugins;
58
+ }
59
+ $wpmdb_settings = get_site_option( 'wpmdb_settings' );
60
+ if ( ! empty( $wpmdb_settings['blacklist_plugins'] ) ) {
61
  $blacklist_plugins = array_flip( $wpmdb_settings['blacklist_plugins'] );
62
  }
63
+ foreach ( $plugins as $key => $plugin ) {
64
+ if ( false !== strpos( $plugin, 'wp-migrate-db-pro' ) || ! isset( $blacklist_plugins[ $plugin ] ) ) {
65
+ continue;
66
+ }
67
+ unset( $plugins[ $key ] );
68
  }
69
+
70
  return $plugins;
71
  }
 
72
 
73
+ add_filter( 'option_active_plugins', 'wpmdbc_exclude_plugins' );
74
 
75
  /**
76
+ * remove network-active plugins
77
+ *
78
+ * @param array $plugins array of plugins keyed by name (name=>timestamp pairs)
79
+ *
80
+ * @return array
81
+ */
82
  function wpmdbc_exclude_site_plugins( $plugins ) {
83
+ if ( ! defined( 'DOING_AJAX' ) || ! DOING_AJAX || ! isset( $_POST['action'] ) || false === strpos( $_POST['action'], 'wpmdb' ) ) {
84
+ return $plugins;
85
+ }
86
+ $wpmdb_settings = get_site_option( 'wpmdb_settings' );
87
+ if ( ! empty( $wpmdb_settings['blacklist_plugins'] ) ) {
88
  $blacklist_plugins = array_flip( $wpmdb_settings['blacklist_plugins'] );
89
  }
90
+ foreach ( array_keys( $plugins ) as $plugin ) {
91
+ if ( false !== strpos( $plugin, 'wp-migrate-db-pro' ) || ! isset( $blacklist_plugins[ $plugin ] ) ) {
92
+ continue;
93
+ }
94
+ unset( $plugins[ $plugin ] );
95
  }
96
+
97
  return $plugins;
98
  }
99
+
100
  add_filter( 'site_option_active_sitewide_plugins', 'wpmdbc_exclude_site_plugins' );
languages/{wp-migrate-db-pro-en.pot → wp-migrate-db-en.pot} RENAMED
@@ -1,15 +1,15 @@
1
  msgid ""
2
  msgstr ""
3
- "Project-Id-Version: WP Migrate DB Pro\n"
4
- "POT-Creation-Date: 2014-08-13 12:59+1000\n"
5
- "PO-Revision-Date: 2014-08-13 13:00+1000\n"
6
  "Last-Translator: Delicious Brains <nom@deliciousbrains.com>\n"
7
  "Language-Team: Delicious Brains <nom@deliciousbrains.com>\n"
8
  "Language: en\n"
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.7\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__;"
@@ -18,25 +18,25 @@ msgstr ""
18
  "Plural-Forms: nplurals=2; plural=(n != 1);\n"
19
  "X-Poedit-SearchPath-0: .\n"
20
 
21
- #: class/wpmdb-base.php:71
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:168
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:170
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:175
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 +44,7 @@ msgid ""
44
  "environment."
45
  msgstr ""
46
 
47
- #: class/wpmdb-base.php:177
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 +52,40 @@ msgid ""
52
  "environment."
53
  msgstr ""
54
 
55
- #: class/wpmdb-base.php:181
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:189
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:193
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:201
76
  msgid ""
77
  "There was a problem with the AJAX request, we were expecting a serialized "
78
  "response, instead we received:<br />"
79
  msgstr ""
80
 
81
- #: class/wpmdb-base.php:208
82
  #, php-format
83
  msgid ""
84
  "WP Migrate DB Pro does not seem to be installed or active on the remote "
85
  "site. (#131 - scope: %s)"
86
  msgstr ""
87
 
88
- #: class/wpmdb-base.php:368
89
  #, php-format
90
  msgid ""
91
  "<strong>Could not connect to deliciousbrains.com</strong> &mdash; You will "
@@ -97,55 +97,57 @@ msgid ""
97
  "disable SSL for connections to deliciousbrains.com</a></p>"
98
  msgstr ""
99
 
100
- #: class/wpmdb-base.php:392
101
  msgid "Could not retrieve version details. Please try again."
102
  msgstr ""
103
 
104
- #: class/wpmdb-base.php:422
105
  msgid "There is a new version of "
106
  msgstr ""
107
 
108
- #: class/wpmdb-base.php:424
109
  #, php-format
110
  msgid "View version %s details"
111
  msgstr ""
112
 
113
- #: class/wpmdb-base.php:432 class/wpmdb-base.php:514 class/wpmdb.php:152
114
- #: class/wpmdb.php:316
 
115
  msgid "Settings"
116
  msgstr ""
117
 
118
- #: class/wpmdb-base.php:434
119
  #, php-format
120
  msgid ""
121
  "To update, go to %1$s and enter your license key. If you don't have a "
122
  "license key, you may <a href=\"%2$s\">purchase one</a>."
123
  msgstr ""
124
 
125
- #: class/wpmdb-base.php:436
126
  #, php-format
127
  msgid ""
128
  "To finish activating %1$s, please go to %2$s and enter your license key. If "
129
  "you don't have a license key, you may <a href=\"%3$s\">purchase one</a>."
130
  msgstr ""
131
 
132
- #: class/wpmdb-base.php:439 class/wpmdb-base.php:797 class/wpmdb-base.php:800
133
- #: class/wpmdb-base.php:803 class/wpmdb-base.php:806 class/wpmdbpro.php:532
134
  msgid "Check my license again"
135
  msgstr ""
136
 
137
- #: class/wpmdb-base.php:482
138
  #, php-format
139
  msgid ""
140
  "Error retrieving download from deliciousbrain.com. Please try again or "
141
  "download manually from <a href=\"%1$s\">%2$s</a>."
142
  msgstr ""
143
 
144
- #: class/wpmdb-base.php:482
 
145
  msgid "My Account"
146
  msgstr ""
147
 
148
- #: class/wpmdb-base.php:515
149
  #, php-format
150
  msgid ""
151
  "To finish activating WP Migrate DB Pro, please go to %1$s and enter your "
@@ -153,29 +155,31 @@ msgid ""
153
  "\">purchase one</a>."
154
  msgstr ""
155
 
156
- #: class/wpmdb-base.php:742
 
157
  msgid "Update Available"
158
  msgstr ""
159
 
160
- #: class/wpmdb-base.php:743
161
  #, php-format
162
  msgid ""
163
  "%1$s %2$s is now available. You currently have %3$s installed. <a href=\"%4$s"
164
  "\">%5$s</a>"
165
  msgstr ""
166
 
167
- #: class/wpmdb-base.php:743
 
168
  msgid "Update Now"
169
  msgstr ""
170
 
171
- #: class/wpmdb-base.php:776
172
  #, php-format
173
  msgid ""
174
  "<strong>Activate Your License</strong> &mdash; Please <a href=\"#\" class="
175
  "\"%s\">enter your license key</a> to enable push and pull."
176
  msgstr ""
177
 
178
- #: class/wpmdb-base.php:793
179
  #, php-format
180
  msgid ""
181
  "<strong>Could not connect to deliciousbrains.com</strong> &mdash; You will "
@@ -185,11 +189,11 @@ msgid ""
185
  "configuration on your server</a>, but if you need a quick fix you can:"
186
  msgstr ""
187
 
188
- #: class/wpmdb-base.php:794
189
  msgid "Temporarily disable SSL for connections to deliciousbrains.com"
190
  msgstr ""
191
 
192
- #: class/wpmdb-base.php:796
193
  #, php-format
194
  msgid ""
195
  "<strong>Your License Was Cancelled</strong> &mdash; Please visit <a href=\"%s"
@@ -197,7 +201,7 @@ msgid ""
197
  "enable push and pull."
198
  msgstr ""
199
 
200
- #: class/wpmdb-base.php:799
201
  #, php-format
202
  msgid ""
203
  "<strong>Your License Has Expired</strong> &mdash; Please visit <a href=\"%s"
@@ -205,7 +209,7 @@ msgid ""
205
  "push and pull."
206
  msgstr ""
207
 
208
- #: class/wpmdb-base.php:802
209
  #, php-format
210
  msgid ""
211
  "<strong>No Activations Left</strong> &mdash; Please visit <a href=\"%s\" "
@@ -213,7 +217,7 @@ msgid ""
213
  "previous activation and enable push and pull."
214
  msgstr ""
215
 
216
- #: class/wpmdb-base.php:805
217
  #, php-format
218
  msgid ""
219
  "<strong>Your License Was Not Found</strong> &mdash; Perhaps you made a typo "
@@ -222,272 +226,303 @@ msgid ""
222
  "license key."
223
  msgstr ""
224
 
225
- #: class/wpmdb-base.php:809
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
226
  #, php-format
227
  msgid ""
228
  "<strong>An Unexpected Error Occurred</strong> &mdash; Please contact us at "
229
  "<a href=\"%1$s\">%2$s</a> and quote the following:"
230
  msgstr ""
231
 
232
- #: class/wpmdb-base.php:837
233
  #, php-format
234
  msgid "Invalid nonce for: %s"
235
  msgstr ""
236
 
237
- #: class/wpmdb-base.php:845
238
  #, php-format
239
  msgid "Access denied for: %s"
240
  msgstr ""
241
 
242
- #: class/wpmdb.php:151
 
243
  msgid "Migrate"
244
  msgstr ""
245
 
246
- #: class/wpmdb.php:153
 
247
  msgid "Help"
248
  msgstr ""
249
 
250
- #: class/wpmdb.php:380
251
  msgid "ext/mysqli"
252
  msgstr ""
253
 
254
- #: class/wpmdb.php:384
255
  msgid "WP Memory Limit"
256
  msgstr ""
257
 
258
- #: class/wpmdb.php:709 class/wpmdbpro.php:189
259
  msgid ""
260
  "Failed attempting to unserialize the response from the remote server. Please "
261
  "contact support."
262
  msgstr ""
263
 
264
- #: class/wpmdb.php:1125
265
  msgid ""
266
  "Failed to retrieve table structure, please ensure your database is online. "
267
  "(#125)"
268
  msgstr ""
269
 
270
- #: class/wpmdb.php:1143
271
  #, php-format
272
  msgid "Delete any existing table %s"
273
  msgstr ""
274
 
275
- #: class/wpmdb.php:1156
276
  #, php-format
277
  msgid "Table structure of table %s"
278
  msgstr ""
279
 
280
- #: class/wpmdb.php:1164
281
  msgid ""
282
  "Failed to generate the create table query, please ensure your database is "
283
  "online. (#126)"
284
  msgstr ""
285
 
286
- #: class/wpmdb.php:1199
287
  #, php-format
288
  msgid "Data contents of table %s"
289
  msgstr ""
290
 
291
- #: class/wpmdb.php:1499
292
  #, php-format
293
  msgid "End of data contents of table %s"
294
  msgstr ""
295
 
296
- #: class/wpmdb.php:1627
297
  msgid "WordPress MySQL database migration"
298
  msgstr ""
299
 
300
- #: class/wpmdb.php:1629
301
  #, php-format
302
  msgid "Generated: %s"
303
  msgstr ""
304
 
305
- #: class/wpmdb.php:1630
306
  #, php-format
307
  msgid "Hostname: %s"
308
  msgstr ""
309
 
310
- #: class/wpmdb.php:1631
311
  #, php-format
312
  msgid "Database: %s"
313
  msgstr ""
314
 
315
- #: class/wpmdb.php:1671
316
  msgid "Failed to write the gzipped SQL data to the file. (#127)"
317
  msgstr ""
318
 
319
- #: class/wpmdb.php:1676
320
  msgid "Failed to write the SQL data to the file. (#128)"
321
  msgstr ""
322
 
323
- #: class/wpmdb.php:1775 class/wpmdb.php:1781 class/wpmdbpro.php:867
324
  msgid "Migrate DB Pro"
325
  msgstr ""
326
 
327
- #: class/wpmdb.php:1775 class/wpmdb.php:1781 class/wpmdb.php:1894
328
- #: class/wpmdb.php:2231
329
  msgid "Migrate DB"
330
  msgstr ""
331
 
332
- #: class/wpmdb.php:1883
333
  msgid ""
334
  "A problem occurred when trying to change the maximum request size, please "
335
  "try again."
336
  msgstr ""
337
 
338
- #: class/wpmdb.php:1884 class/wpmdbpro.php:533
339
  msgid "A problem occurred when trying to check the license, please try again."
340
  msgstr ""
341
 
342
- #: class/wpmdb.php:1885
343
  msgid "Establishing connection to remote server, please wait"
344
  msgstr ""
345
 
346
- #: class/wpmdb.php:1886
347
  msgid ""
348
  "A problem occurred when attempting to connect to the local server, please "
349
  "check the details and try again."
350
  msgstr ""
351
 
352
- #: class/wpmdb.php:1887
353
  msgid "Please enter your license key."
354
  msgstr ""
355
 
356
- #: class/wpmdb.php:1888
357
  msgid ""
358
  "A problem occurred when trying to register the license, please try again."
359
  msgstr ""
360
 
361
- #: class/wpmdb.php:1889
362
  msgid ""
363
  "Your license has been activated. You will now receive automatic updates and "
364
  "access to email support."
365
  msgstr ""
366
 
367
- #: class/wpmdb.php:1890 template/pro/licence-info.php:5
368
  msgid "Fetching license details, please wait..."
369
  msgstr ""
370
 
371
- #: class/wpmdb.php:1891
372
  msgid ""
373
  "An error occurred when trying to clear the debug log. Please contact "
374
  "support. (#132)"
375
  msgstr ""
376
 
377
- #: class/wpmdb.php:1892
378
  msgid ""
379
  "An error occurred when trying to update the debug log. Please contact "
380
  "support. (#133)"
381
  msgstr ""
382
 
383
- #: class/wpmdb.php:1893
 
384
  msgid "Migrate DB & Save"
385
  msgstr ""
386
 
387
- #: class/wpmdb.php:1895
 
 
 
 
 
388
  msgid "Please select at least one table to migrate."
389
  msgstr ""
390
 
391
- #: class/wpmdb.php:1896
392
  msgid "Please enter a name for your migration profile."
393
  msgstr ""
394
 
395
- #: class/wpmdb.php:1897
396
  msgid ""
397
  "An error occurred when attempting to save the migration profile. Please see "
398
  "the Help tab for details on how to request support. (#118)"
399
  msgstr ""
400
 
401
- #: class/wpmdb.php:1898
 
402
  msgid "Exporting complete"
403
  msgstr ""
404
 
405
- #: class/wpmdb.php:1899
406
  msgid "Exporting, please wait..."
407
  msgstr ""
408
 
409
- #: class/wpmdb.php:1900
410
  msgid "please wait..."
411
  msgstr ""
412
 
413
- #: class/wpmdb.php:1901
 
414
  msgid "complete"
415
  msgstr ""
416
 
417
- #: class/wpmdb.php:1902
 
418
  msgid "Migration failed"
419
  msgstr ""
420
 
421
- #: class/wpmdb.php:1903
 
422
  msgid "Backing up"
423
  msgstr ""
424
 
425
- #: class/wpmdb.php:1904
 
426
  msgid "Migrating"
427
  msgstr ""
428
 
429
- #: class/wpmdb.php:1905
 
430
  msgid "Status"
431
  msgstr ""
432
 
433
- #: class/wpmdb.php:1906
 
434
  msgid "Response"
435
  msgstr ""
436
 
437
- #: class/wpmdb.php:1907
438
  msgid ""
439
  "A problem occurred when attempting to process the following table (#113)"
440
  msgstr ""
441
 
442
- #: class/wpmdb.php:1908
443
  msgid ""
444
  "A problem occurred when processing the following table. We were expecting a "
445
  "response in JSON format but instead received an empty response."
446
  msgstr ""
447
 
448
- #: class/wpmdb.php:1909
449
  msgid "Migration completed with some errors"
450
  msgstr ""
451
 
452
- #: class/wpmdb.php:1910
453
  msgid "Migration complete, your backup is located at:"
454
  msgstr ""
455
 
456
- #: class/wpmdb.php:1911
457
- msgid "A problem occurred when finalizing the backup. (#132)"
458
  msgstr ""
459
 
460
- #: class/wpmdb.php:1912 template/common/compatibility.php:33
461
  #: template/common/max-request-size.php:10
 
462
  msgid "Saved"
463
  msgstr ""
464
 
465
- #: class/wpmdb.php:1913
466
  msgid ""
467
- "Any sites setup to use the current API key will no longer be able to "
468
- "connect. You will need to update those sites with the newly generated API "
469
  "key. Do you wish to continue?"
470
  msgstr ""
471
 
472
- #: class/wpmdb.php:1914
473
  msgid ""
474
- "An error occurred when trying to generate the API key. Please see the Help "
475
- "tab for details on how to request support. (#105)"
476
  msgstr ""
477
 
478
- #: class/wpmdb.php:1915
479
  msgid ""
480
  "You are removing the following migration profile. This cannot be undone. Do "
481
  "you wish to continue?"
482
  msgstr ""
483
 
484
- #: class/wpmdb.php:1916
485
  msgid ""
486
  "An error occurred when trying to delete the profile. Please see the Help tab "
487
  "for details on how to request support. (#106)"
488
  msgstr ""
489
 
490
- #: class/wpmdb.php:1917
491
  msgid ""
492
  "The selected migration profile could not be deleted because it was not "
493
  "found.\n"
@@ -495,186 +530,214 @@ msgid ""
495
  "migration profiles."
496
  msgstr ""
497
 
498
- #: class/wpmdb.php:1918
499
  msgid ""
500
  "If you change the connection details, you will lose any replaces and table "
501
  "selections you have made below. Do you wish to continue?"
502
  msgstr ""
503
 
504
- #: class/wpmdb.php:1919 template/migrate.php:113
505
  msgid "Please enter the connection information above to continue."
506
  msgstr ""
507
 
508
- #: class/wpmdb.php:1920
509
  msgid ""
510
  "An error occurred when trying to save the settings. Please try again. If the "
511
  "problem persists, please see the Help tab for details on how to request "
512
  "support. (#108)"
513
  msgstr ""
514
 
515
- #: class/wpmdb.php:1921
516
  msgid ""
517
  "The connection information appears to be missing, please enter it to "
518
  "continue."
519
  msgstr ""
520
 
521
- #: class/wpmdb.php:1922
522
  msgid ""
523
  "The connection information appears to be incorrect, it should consist of two "
524
  "lines. The first being the remote server's URL and the second being the "
525
  "secret key."
526
  msgstr ""
527
 
528
- #: class/wpmdb.php:1923
529
  msgid ""
530
  "The URL on the first line appears to be invalid, please check it and try "
531
  "again."
532
  msgstr ""
533
 
534
- #: class/wpmdb.php:1924
535
  msgid ""
536
  "The secret key on the second line appears to be invalid. It should be a 32 "
537
  "character string that consists of letters, numbers and special characters "
538
  "only."
539
  msgstr ""
540
 
541
- #: class/wpmdb.php:1925
542
  msgid ""
543
  "It appears you've entered the URL for this website, you need to provide the "
544
  "URL of the remote website instead."
545
  msgstr ""
546
 
547
- #: class/wpmdb.php:1926
548
  msgid ""
549
- "It appears you've entered the secret key for this website, you need to "
550
- "provide the secret key for the remote website instead."
 
551
  msgstr ""
552
 
553
- #: class/wpmdb.php:1927 template/migrate-progress.php:8
554
  msgid "Time Elapsed:"
555
  msgstr ""
556
 
557
- #: class/wpmdb.php:1928 template/migrate-progress.php:19
 
558
  msgid "Pause"
559
  msgstr ""
560
 
561
- #: class/wpmdb.php:1929
 
562
  msgid "Migration Paused"
563
  msgstr ""
564
 
565
- #: class/wpmdb.php:1930
 
566
  msgid "Resume"
567
  msgstr ""
568
 
569
- #: class/wpmdb.php:1931
570
  msgid "Completing current request"
571
  msgstr ""
572
 
573
- #: class/wpmdb.php:1932
 
574
  msgid "Cancelling migration"
575
  msgstr ""
576
 
577
- #: class/wpmdb.php:1933
 
578
  msgid "Paused"
579
  msgstr ""
580
 
581
- #: class/wpmdb.php:1934
582
  msgid "Removing the local MySQL export file"
583
  msgstr ""
584
 
585
- #: class/wpmdb.php:1935
586
  msgid "Removing the local backup MySQL export file"
587
  msgstr ""
588
 
589
- #: class/wpmdb.php:1936
590
  msgid "Removing the local temporary tables"
591
  msgstr ""
592
 
593
- #: class/wpmdb.php:1937
594
  msgid "Removing the remote backup MySQL export file"
595
  msgstr ""
596
 
597
- #: class/wpmdb.php:1938
598
  msgid "Removing the remote temporary tables"
599
  msgstr ""
600
 
601
- #: class/wpmdb.php:1939
602
  msgid "Migration cancellation failed"
603
  msgstr ""
604
 
605
- #: class/wpmdb.php:1940
606
  msgid ""
607
  "A problem occurred while cancelling the migration, you may have to manually "
608
  "delete some temporary files / tables."
609
  msgstr ""
610
 
611
- #: class/wpmdb.php:1941
 
612
  msgid "Migration cancelled"
613
  msgstr ""
614
 
615
- #: class/wpmdb.php:1942
 
616
  msgid "Migration complete"
617
  msgstr ""
618
 
619
- #: class/wpmdb.php:1943
 
620
  msgid "Finalizing migration"
621
  msgstr ""
622
 
623
- #: class/wpmdb.php:1944
624
  msgid "A problem occurred when trying to add plugins to backlist."
625
  msgstr ""
626
 
627
- #: class/wpmdb.php:1945
628
  msgid ""
629
  "If confirmed we will install an additional WordPress 'Must Use' plugin. This "
630
  "plugin will allow us to control which plugins are loaded during WP Migrate "
631
  "DB Pro specific operations. Do you wish to continue?"
632
  msgstr ""
633
 
634
- #: class/wpmdb.php:1946
635
  msgid ""
636
  "A problem occurred when trying to change the plugin compatibility setting."
637
  msgstr ""
638
 
639
- #: class/wpmdb.php:1947
 
640
  msgid "Sure?"
641
  msgstr ""
642
 
643
- #: class/wpmdb.php:1948
644
  #, php-format
645
  msgid "Pulling from %s, please wait..."
646
  msgstr ""
647
 
648
- #: class/wpmdb.php:1949
649
  #, php-format
650
  msgid "Pulling from %s complete"
651
  msgstr ""
652
 
653
- #: class/wpmdb.php:1950
654
  #, php-format
655
  msgid "Pushing to %s, please wait..."
656
  msgstr ""
657
 
658
- #: class/wpmdb.php:1951
659
  #, php-format
660
  msgid "Pushing to %s complete"
661
  msgstr ""
662
 
663
- #: class/wpmdb.php:1985
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
664
  msgid "Could not find the file to download:"
665
  msgstr ""
666
 
667
- #: class/wpmdb.php:2165
668
  msgid "MySQL export file not found."
669
  msgstr ""
670
 
671
- #: class/wpmdb.php:2265
672
  msgid ""
673
  "WP Migrate DB and WP Migrate DB Pro cannot both be active. We've "
674
  "automatically deactivated WP Migrate DB."
675
  msgstr ""
676
 
677
- #: class/wpmdb.php:2267
678
  msgid ""
679
  "WP Migrate DB and WP Migrate DB Pro cannot both be active. We've "
680
  "automatically deactivated WP Migrate DB Pro."
@@ -688,71 +751,74 @@ msgid ""
688
  "Now</a></strong>"
689
  msgstr ""
690
 
691
- #: class/wpmdbpro.php:54
 
692
  msgid "Addons"
693
  msgstr ""
694
 
695
- #: class/wpmdbpro.php:117
696
  msgid "Feature Walkthrough"
697
  msgstr ""
698
 
699
- #: class/wpmdbpro.php:118
700
  msgid ""
701
  "A brief walkthrough of the WP Migrate DB plugin showing all of the different "
702
  "options and explaining them."
703
  msgstr ""
704
 
705
- #: class/wpmdbpro.php:121
706
  msgid "Pulling Live Data Into Your Local Development&nbsp;Environment"
707
  msgstr ""
708
 
709
- #: class/wpmdbpro.php:122
710
  msgid ""
711
  "This screencast demonstrates how you can pull data from a remote, live "
712
  "WordPress install and update the data in your local development environment."
713
  msgstr ""
714
 
715
- #: class/wpmdbpro.php:125
716
  msgid "Pushing Local Development Data to a Staging&nbsp;Environment"
717
  msgstr ""
718
 
719
- #: class/wpmdbpro.php:126
720
  msgid ""
721
  "This screencast demonstrates how you can push a local WordPress database "
722
  "you've been using for development to a staging environment."
723
  msgstr ""
724
 
725
- #: class/wpmdbpro.php:129
726
  msgid "Media Files Addon Demo"
727
  msgstr ""
728
 
729
- #: class/wpmdbpro.php:130
730
  msgid ""
731
  "A short demo of how the Media Files addon allows you to sync up your "
732
  "WordPress Media Libraries."
733
  msgstr ""
734
 
735
- #: class/wpmdbpro.php:163
736
  msgid ""
737
  "Please activate your license before attempting a pull or push migration."
738
  msgstr ""
739
 
740
- #: class/wpmdbpro.php:269
741
  msgid ""
742
  "The connection succeeded but the remote site is configured to reject pull "
743
  "connections. You can change this in the \"settings\" tab on the remote site. "
744
- "(#132)"
745
  msgstr ""
746
 
747
- #: class/wpmdbpro.php:291 class/wpmdbpro.php:344
 
748
  msgid "pull"
749
  msgstr ""
750
 
751
- #: class/wpmdbpro.php:293 class/wpmdbpro.php:346
 
752
  msgid "push"
753
  msgstr ""
754
 
755
- #: class/wpmdbpro.php:295
756
  #, php-format
757
  msgid ""
758
  "The connection succeeded but the remote site is configured to reject %s "
@@ -760,11 +826,24 @@ msgid ""
760
  "(#110)"
761
  msgstr ""
762
 
763
- #: class/wpmdbpro.php:334
 
764
  msgid "Try again?"
765
  msgstr ""
766
 
767
- #: class/wpmdbpro.php:349
 
 
 
 
 
 
 
 
 
 
 
 
768
  #, php-format
769
  msgid ""
770
  "The connection succeeded but the remote site is configured to reject %s "
@@ -772,57 +851,61 @@ msgid ""
772
  "(#122) <a href=\"#\" class=\"try-again js-action-link\">Try again?</a>"
773
  msgstr ""
774
 
775
- #: class/wpmdbpro.php:437
776
- msgctxt ""
777
- "\"Remove\" in this context is used to delete a license, example formatting: "
778
- "xxxx-xxxx-xxxx Remove"
779
  msgid "Remove"
780
  msgstr ""
781
 
782
- #: class/wpmdbpro.php:596
 
783
  msgid "Addons Unavailable"
784
  msgstr ""
785
 
786
- #: class/wpmdbpro.php:596
787
  #, php-format
788
  msgid ""
789
  "Addons are not included with the Personal license. Visit <a href=\"%s\" "
790
  "target=\"_blank\">My Account</a> to upgrade in just a few clicks."
791
  msgstr ""
792
 
793
- #: class/wpmdbpro.php:609
 
794
  msgid "Installed"
795
  msgstr ""
796
 
797
- #: class/wpmdbpro.php:611
 
798
  msgid "Activated"
799
  msgstr ""
800
 
801
- #: class/wpmdbpro.php:614
 
802
  msgid "Activate"
803
  msgstr ""
804
 
805
- #: class/wpmdbpro.php:618
 
806
  msgid "Install"
807
  msgstr ""
808
 
809
- #: class/wpmdbpro.php:624
 
810
  msgid "Download"
811
  msgstr ""
812
 
813
- #: class/wpmdbpro.php:800
814
  msgid "Could not upload the SQL to the server. (#135)"
815
  msgstr ""
816
 
817
- #: class/wpmdbpro.php:805
818
  msgid "Could not read the SQL file we uploaded to the server. (#136)"
819
  msgstr ""
820
 
821
- #: class/wpmdbpro.php:821
822
  msgid ""
823
  "The connection succeeded but the remote site is configured to reject push "
824
  "connections. You can change this in the \"settings\" tab on the remote site. "
825
- "(#133)"
826
  msgstr ""
827
 
828
  #: template/addons.php:7
@@ -839,6 +922,14 @@ msgstr ""
839
  msgid "Once completed, you may visit this tab to view the available addons."
840
  msgstr ""
841
 
 
 
 
 
 
 
 
 
842
  #: template/common/compatibility.php:4
843
  msgid ""
844
  "Improve performance and reliability by not loading the following plugins for "
@@ -853,22 +944,22 @@ msgid ""
853
  "example a plugin that hooks into WP Migrate DB."
854
  msgstr ""
855
 
856
- #: template/common/compatibility.php:25 template/pro/backup.php:43
857
  #: template/pro/exclude-post-types.php:20 template/pro/select-tables.php:37
858
  msgid "Select All"
859
  msgstr ""
860
 
861
- #: template/common/compatibility.php:27 template/pro/backup.php:45
862
  #: template/pro/exclude-post-types.php:22 template/pro/select-tables.php:39
863
  msgid "Deselect All"
864
  msgstr ""
865
 
866
- #: template/common/compatibility.php:29 template/pro/backup.php:47
867
  #: template/pro/exclude-post-types.php:24 template/pro/select-tables.php:41
868
  msgid "Invert Selection"
869
  msgstr ""
870
 
871
- #: template/common/compatibility.php:32
872
  msgid "Save Changes"
873
  msgstr ""
874
 
@@ -876,7 +967,7 @@ msgstr ""
876
  msgid "Diagnostic Info &amp; Error Log"
877
  msgstr ""
878
 
879
- #: template/common/debug-info.php:4
880
  msgid "Clear Error Log"
881
  msgstr ""
882
 
@@ -903,13 +994,10 @@ msgid "Establishing Connection"
903
  msgstr ""
904
 
905
  #: template/migrate-progress.php:20
 
906
  msgid "Cancel"
907
  msgstr ""
908
 
909
- #: template/migrate.php:62 template/migrate.php:333
910
- msgid "Back to select a saved profile"
911
- msgstr ""
912
-
913
  #: template/migrate.php:73
914
  msgid "Export File"
915
  msgstr ""
@@ -962,10 +1050,12 @@ msgid ""
962
  msgstr ""
963
 
964
  #: template/migrate.php:131
 
965
  msgid "Find"
966
  msgstr ""
967
 
968
  #: template/migrate.php:132
 
969
  msgid "Replace"
970
  msgstr ""
971
 
@@ -1021,23 +1111,27 @@ msgid ""
1021
  "activated/deactivated)"
1022
  msgstr ""
1023
 
1024
- #: template/migrate.php:276
 
 
 
 
1025
  msgid "Save Migration Profile"
1026
  msgstr ""
1027
 
1028
- #: template/migrate.php:276
1029
  msgid "Save the above settings for the next time you do a similiar migration"
1030
  msgstr ""
1031
 
1032
- #: template/migrate.php:295
1033
  msgid "Create new profile"
1034
  msgstr ""
1035
 
1036
- #: template/migrate.php:304 template/migrate.php:314
1037
  msgid "Warning: Different Table Prefixes"
1038
  msgstr ""
1039
 
1040
- #: template/migrate.php:306
1041
  msgid ""
1042
  "Whoa! We've detected that the database table prefix differs between "
1043
  "installations. Clicking the Migrate DB button below will create new database "
@@ -1045,7 +1139,7 @@ msgid ""
1045
  "span>\"."
1046
  msgstr ""
1047
 
1048
- #: template/migrate.php:308
1049
  #, php-format
1050
  msgid ""
1051
  "However, your local install is configured to use table prefix \"%1$s\" and "
@@ -1054,13 +1148,13 @@ msgid ""
1054
  "variable to \"<span class=\"remote-prefix\"></span>\"."
1055
  msgstr ""
1056
 
1057
- #: template/migrate.php:310
1058
  msgid ""
1059
  "This will allow your local install the use the migrated tables. Once you do "
1060
  "this, you shouldn't have to do it again."
1061
  msgstr ""
1062
 
1063
- #: template/migrate.php:316
1064
  #, php-format
1065
  msgid ""
1066
  "Whoa! We've detected that the database table prefix differs between "
@@ -1068,7 +1162,7 @@ msgid ""
1068
  "tables in the remote database with prefix \"%s\"."
1069
  msgstr ""
1070
 
1071
- #: template/migrate.php:318
1072
  #, php-format
1073
  msgid ""
1074
  "However, your remote install is configured to use table prefix \"<span class="
@@ -1078,7 +1172,7 @@ msgid ""
1078
  "span>\" variable to \"%s\"."
1079
  msgstr ""
1080
 
1081
- #: template/migrate.php:320
1082
  msgid ""
1083
  "This will allow your remote install the use the migrated tables. Once you do "
1084
  "this, you shouldn't have to do it again."
@@ -1153,7 +1247,7 @@ msgid "Connection Info"
1153
  msgstr ""
1154
 
1155
  #: template/pro/connection-info.php:4
1156
- msgid "Reset API Key"
1157
  msgstr ""
1158
 
1159
  #: template/pro/exclude-post-types.php:4
@@ -1188,6 +1282,7 @@ msgid ""
1188
  msgstr ""
1189
 
1190
  #: template/pro/pull-push-radio-buttons.php:4
 
1191
  msgid "Pull"
1192
  msgstr ""
1193
 
@@ -1196,6 +1291,7 @@ msgid "Replace this site's db with remote db"
1196
  msgstr ""
1197
 
1198
  #: template/pro/pull-push-radio-buttons.php:13
 
1199
  msgid "Push"
1200
  msgstr ""
1201
 
@@ -1204,6 +1300,7 @@ msgid "Replace remote db with this site's db"
1204
  msgstr ""
1205
 
1206
  #: template/pro/select-tables.php:4
 
1207
  msgid "Tables"
1208
  msgstr ""
1209
 
@@ -1238,6 +1335,7 @@ msgid ""
1238
  msgstr ""
1239
 
1240
  #: template/pro/videos.php:2
 
1241
  msgid "Videos"
1242
  msgstr ""
1243
 
@@ -1321,6 +1419,7 @@ msgid ""
1321
  msgstr ""
1322
 
1323
  #: template/wpmdb/wordpress-org-support.php:2
 
1324
  msgid "Support"
1325
  msgstr ""
1326
 
1
  msgid ""
2
  msgstr ""
3
+ "Project-Id-Version: WP Migrate DB\n"
4
+ "POT-Creation-Date: 2014-08-29 13:17+1000\n"
5
+ "PO-Revision-Date: 2014-08-29 13:18+1000\n"
6
  "Last-Translator: Delicious Brains <nom@deliciousbrains.com>\n"
7
  "Language-Team: Delicious Brains <nom@deliciousbrains.com>\n"
8
  "Language: en\n"
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__;"
18
  "Plural-Forms: nplurals=2; plural=(n != 1);\n"
19
  "X-Poedit-SearchPath-0: .\n"
20
 
21
+ #: class/wpmdb-base.php:78
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:254
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:256
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:261
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
  "environment."
45
  msgstr ""
46
 
47
+ #: class/wpmdb-base.php:263
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
  "environment."
53
  msgstr ""
54
 
55
+ #: class/wpmdb-base.php:267
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:275
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:279
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:287
76
  msgid ""
77
  "There was a problem with the AJAX request, we were expecting a serialized "
78
  "response, instead we received:<br />"
79
  msgstr ""
80
 
81
+ #: class/wpmdb-base.php:294
82
  #, php-format
83
  msgid ""
84
  "WP Migrate DB Pro does not seem to be installed or active on the remote "
85
  "site. (#131 - scope: %s)"
86
  msgstr ""
87
 
88
+ #: class/wpmdb-base.php:454
89
  #, php-format
90
  msgid ""
91
  "<strong>Could not connect to deliciousbrains.com</strong> &mdash; You will "
97
  "disable SSL for connections to deliciousbrains.com</a></p>"
98
  msgstr ""
99
 
100
+ #: class/wpmdb-base.php:478
101
  msgid "Could not retrieve version details. Please try again."
102
  msgstr ""
103
 
104
+ #: class/wpmdb-base.php:508
105
  msgid "There is a new version of "
106
  msgstr ""
107
 
108
+ #: class/wpmdb-base.php:510
109
  #, php-format
110
  msgid "View version %s details"
111
  msgstr ""
112
 
113
+ #: class/wpmdb-base.php:518 class/wpmdb-base.php:616 class/wpmdb.php:118
114
+ #: class/wpmdb.php:285
115
+ msgctxt "Plugin configuration and preferences"
116
  msgid "Settings"
117
  msgstr ""
118
 
119
+ #: class/wpmdb-base.php:520
120
  #, php-format
121
  msgid ""
122
  "To update, go to %1$s and enter your license key. If you don't have a "
123
  "license key, you may <a href=\"%2$s\">purchase one</a>."
124
  msgstr ""
125
 
126
+ #: class/wpmdb-base.php:522
127
  #, php-format
128
  msgid ""
129
  "To finish activating %1$s, please go to %2$s and enter your license key. If "
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:525 class/wpmdb-base.php:902 class/wpmdb-base.php:905
134
+ #: class/wpmdb-base.php:908 class/wpmdb-base.php:912 class/wpmdbpro.php:604
135
  msgid "Check my license again"
136
  msgstr ""
137
 
138
+ #: class/wpmdb-base.php:568
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:568
146
+ msgctxt "Delicious Brains account"
147
  msgid "My Account"
148
  msgstr ""
149
 
150
+ #: class/wpmdb-base.php:617
151
  #, php-format
152
  msgid ""
153
  "To finish activating WP Migrate DB Pro, please go to %1$s and enter your "
155
  "\">purchase one</a>."
156
  msgstr ""
157
 
158
+ #: class/wpmdb-base.php:842
159
+ msgctxt "A new version of the plugin is available"
160
  msgid "Update Available"
161
  msgstr ""
162
 
163
+ #: class/wpmdb-base.php:843
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:843
171
+ msgctxt "Download and install a new version of the plugin"
172
  msgid "Update Now"
173
  msgstr ""
174
 
175
+ #: class/wpmdb-base.php:877
176
  #, php-format
177
  msgid ""
178
  "<strong>Activate Your License</strong> &mdash; Please <a href=\"#\" class="
179
  "\"%s\">enter your license key</a> to enable push and pull."
180
  msgstr ""
181
 
182
+ #: class/wpmdb-base.php:898
183
  #, php-format
184
  msgid ""
185
  "<strong>Could not connect to deliciousbrains.com</strong> &mdash; You will "
189
  "configuration on your server</a>, but if you need a quick fix you can:"
190
  msgstr ""
191
 
192
+ #: class/wpmdb-base.php:899
193
  msgid "Temporarily disable SSL for connections to deliciousbrains.com"
194
  msgstr ""
195
 
196
+ #: class/wpmdb-base.php:901
197
  #, php-format
198
  msgid ""
199
  "<strong>Your License Was Cancelled</strong> &mdash; Please visit <a href=\"%s"
201
  "enable push and pull."
202
  msgstr ""
203
 
204
+ #: class/wpmdb-base.php:904
205
  #, php-format
206
  msgid ""
207
  "<strong>Your License Has Expired</strong> &mdash; Please visit <a href=\"%s"
209
  "push and pull."
210
  msgstr ""
211
 
212
+ #: class/wpmdb-base.php:907
213
  #, php-format
214
  msgid ""
215
  "<strong>No Activations Left</strong> &mdash; Please visit <a href=\"%s\" "
217
  "previous activation and enable push and pull."
218
  msgstr ""
219
 
220
+ #: class/wpmdb-base.php:911
221
  #, php-format
222
  msgid ""
223
  "<strong>Your License Was Not Found</strong> &mdash; Perhaps you made a typo "
226
  "license key."
227
  msgstr ""
228
 
229
+ #: class/wpmdb-base.php:915
230
+ msgid "<strong>Your License Was Not Found</strong> &mdash; "
231
+ msgstr ""
232
+
233
+ #: class/wpmdb-base.php:919
234
+ msgid "Your License Is Inactive"
235
+ msgstr ""
236
+
237
+ #: class/wpmdb-base.php:920
238
+ msgid "Your license has been deactivated for this install."
239
+ msgstr ""
240
+
241
+ #: class/wpmdb-base.php:920
242
+ msgid "Reactivate License"
243
+ msgstr ""
244
+
245
+ #: class/wpmdb-base.php:923
246
  #, php-format
247
  msgid ""
248
  "<strong>An Unexpected Error Occurred</strong> &mdash; Please contact us at "
249
  "<a href=\"%1$s\">%2$s</a> and quote the following:"
250
  msgstr ""
251
 
252
+ #: class/wpmdb-base.php:951
253
  #, php-format
254
  msgid "Invalid nonce for: %s"
255
  msgstr ""
256
 
257
+ #: class/wpmdb-base.php:959
258
  #, php-format
259
  msgid "Access denied for: %s"
260
  msgstr ""
261
 
262
+ #: class/wpmdb.php:117
263
+ msgctxt "Configure a migration or export"
264
  msgid "Migrate"
265
  msgstr ""
266
 
267
+ #: class/wpmdb.php:119
268
+ msgctxt "Get help or contact support"
269
  msgid "Help"
270
  msgstr ""
271
 
272
+ #: class/wpmdb.php:349
273
  msgid "ext/mysqli"
274
  msgstr ""
275
 
276
+ #: class/wpmdb.php:353
277
  msgid "WP Memory Limit"
278
  msgstr ""
279
 
280
+ #: class/wpmdb.php:688 class/wpmdbpro.php:229 class/wpmdbpro.php:997
281
  msgid ""
282
  "Failed attempting to unserialize the response from the remote server. Please "
283
  "contact support."
284
  msgstr ""
285
 
286
+ #: class/wpmdb.php:1053
287
  msgid ""
288
  "Failed to retrieve table structure, please ensure your database is online. "
289
  "(#125)"
290
  msgstr ""
291
 
292
+ #: class/wpmdb.php:1071
293
  #, php-format
294
  msgid "Delete any existing table %s"
295
  msgstr ""
296
 
297
+ #: class/wpmdb.php:1084
298
  #, php-format
299
  msgid "Table structure of table %s"
300
  msgstr ""
301
 
302
+ #: class/wpmdb.php:1092
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:1127
309
  #, php-format
310
  msgid "Data contents of table %s"
311
  msgstr ""
312
 
313
+ #: class/wpmdb.php:1433
314
  #, php-format
315
  msgid "End of data contents of table %s"
316
  msgstr ""
317
 
318
+ #: class/wpmdb.php:1561
319
  msgid "WordPress MySQL database migration"
320
  msgstr ""
321
 
322
+ #: class/wpmdb.php:1563
323
  #, php-format
324
  msgid "Generated: %s"
325
  msgstr ""
326
 
327
+ #: class/wpmdb.php:1564
328
  #, php-format
329
  msgid "Hostname: %s"
330
  msgstr ""
331
 
332
+ #: class/wpmdb.php:1565
333
  #, php-format
334
  msgid "Database: %s"
335
  msgstr ""
336
 
337
+ #: class/wpmdb.php:1605
338
  msgid "Failed to write the gzipped SQL data to the file. (#127)"
339
  msgstr ""
340
 
341
+ #: class/wpmdb.php:1610
342
  msgid "Failed to write the SQL data to the file. (#128)"
343
  msgstr ""
344
 
345
+ #: class/wpmdb.php:1709 class/wpmdb.php:1715 class/wpmdbpro.php:967
346
  msgid "Migrate DB Pro"
347
  msgstr ""
348
 
349
+ #: class/wpmdb.php:1709 class/wpmdb.php:1715 class/wpmdb.php:2159
 
350
  msgid "Migrate DB"
351
  msgstr ""
352
 
353
+ #: class/wpmdb.php:1834
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:1835 class/wpmdbpro.php:605
360
  msgid "A problem occurred when trying to check the license, please try again."
361
  msgstr ""
362
 
363
+ #: class/wpmdb.php:1836
364
  msgid "Establishing connection to remote server, please wait"
365
  msgstr ""
366
 
367
+ #: class/wpmdb.php:1837
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:1838
374
  msgid "Please enter your license key."
375
  msgstr ""
376
 
377
+ #: class/wpmdb.php:1839
378
  msgid ""
379
  "A problem occurred when trying to register the license, please try again."
380
  msgstr ""
381
 
382
+ #: class/wpmdb.php:1840
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:1841 template/pro/licence-info.php:5
389
  msgid "Fetching license details, please wait..."
390
  msgstr ""
391
 
392
+ #: class/wpmdb.php:1842
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:1843
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:1844
405
+ msgctxt "Copy data between servers and save migration profile"
406
  msgid "Migrate DB & Save"
407
  msgstr ""
408
 
409
+ #: class/wpmdb.php:1845
410
+ msgctxt "Copy data between servers"
411
+ msgid "Migrate DB"
412
+ msgstr ""
413
+
414
+ #: class/wpmdb.php:1846
415
  msgid "Please select at least one table to migrate."
416
  msgstr ""
417
 
418
+ #: class/wpmdb.php:1847
419
  msgid "Please enter a name for your migration profile."
420
  msgstr ""
421
 
422
+ #: class/wpmdb.php:1848
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:1849
429
+ msgctxt "Data has been successfully exported"
430
  msgid "Exporting complete"
431
  msgstr ""
432
 
433
+ #: class/wpmdb.php:1850
434
  msgid "Exporting, please wait..."
435
  msgstr ""
436
 
437
+ #: class/wpmdb.php:1851
438
  msgid "please wait..."
439
  msgstr ""
440
 
441
+ #: class/wpmdb.php:1852
442
+ msgctxt "Finished successfully"
443
  msgid "complete"
444
  msgstr ""
445
 
446
+ #: class/wpmdb.php:1853
447
+ msgctxt "Copy of data between servers did not complete"
448
  msgid "Migration failed"
449
  msgstr ""
450
 
451
+ #: class/wpmdb.php:1854
452
+ msgctxt "Saving a copy of the data before import"
453
  msgid "Backing up"
454
  msgstr ""
455
 
456
+ #: class/wpmdb.php:1855
457
+ msgctxt "Copying data between servers"
458
  msgid "Migrating"
459
  msgstr ""
460
 
461
+ #: class/wpmdb.php:1856
462
+ msgctxt "Current request status"
463
  msgid "Status"
464
  msgstr ""
465
 
466
+ #: class/wpmdb.php:1857
467
+ msgctxt "The message the server responded with"
468
  msgid "Response"
469
  msgstr ""
470
 
471
+ #: class/wpmdb.php:1858
472
  msgid ""
473
  "A problem occurred when attempting to process the following table (#113)"
474
  msgstr ""
475
 
476
+ #: class/wpmdb.php:1859
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:1860
483
  msgid "Migration completed with some errors"
484
  msgstr ""
485
 
486
+ #: class/wpmdb.php:1861
487
  msgid "Migration complete, your backup is located at:"
488
  msgstr ""
489
 
490
+ #: class/wpmdb.php:1862
491
+ msgid "A problem occurred when finalizing the backup. (#140)"
492
  msgstr ""
493
 
494
+ #: class/wpmdb.php:1863 template/common/compatibility.php:31
495
  #: template/common/max-request-size.php:10
496
+ msgctxt "The settings were saved successfully"
497
  msgid "Saved"
498
  msgstr ""
499
 
500
+ #: class/wpmdb.php:1864
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:1865
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:1866
514
  msgid ""
515
  "You are removing the following migration profile. This cannot be undone. Do "
516
  "you wish to continue?"
517
  msgstr ""
518
 
519
+ #: class/wpmdb.php:1867
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:1868
526
  msgid ""
527
  "The selected migration profile could not be deleted because it was not "
528
  "found.\n"
530
  "migration profiles."
531
  msgstr ""
532
 
533
+ #: class/wpmdb.php:1869
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:1870 template/migrate.php:113
540
  msgid "Please enter the connection information above to continue."
541
  msgstr ""
542
 
543
+ #: class/wpmdb.php:1871
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:1872
551
  msgid ""
552
  "The connection information appears to be missing, please enter it to "
553
  "continue."
554
  msgstr ""
555
 
556
+ #: class/wpmdb.php:1873
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:1874
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:1875
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:1876
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:1877
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:1878 template/migrate-progress.php:8
590
  msgid "Time Elapsed:"
591
  msgstr ""
592
 
593
+ #: class/wpmdb.php:1879 template/migrate-progress.php:19
594
+ msgctxt "Temporarily stop migrating"
595
  msgid "Pause"
596
  msgstr ""
597
 
598
+ #: class/wpmdb.php:1880
599
+ msgctxt "The migration has been temporarily stopped"
600
  msgid "Migration Paused"
601
  msgstr ""
602
 
603
+ #: class/wpmdb.php:1881
604
+ msgctxt "Restart migrating after it was paused"
605
  msgid "Resume"
606
  msgstr ""
607
 
608
+ #: class/wpmdb.php:1882
609
  msgid "Completing current request"
610
  msgstr ""
611
 
612
+ #: class/wpmdb.php:1883
613
+ msgctxt "The migration is being cancelled"
614
  msgid "Cancelling migration"
615
  msgstr ""
616
 
617
+ #: class/wpmdb.php:1884
618
+ msgctxt "The migration has been temporarily stopped"
619
  msgid "Paused"
620
  msgstr ""
621
 
622
+ #: class/wpmdb.php:1885
623
  msgid "Removing the local MySQL export file"
624
  msgstr ""
625
 
626
+ #: class/wpmdb.php:1886
627
  msgid "Removing the local backup MySQL export file"
628
  msgstr ""
629
 
630
+ #: class/wpmdb.php:1887
631
  msgid "Removing the local temporary tables"
632
  msgstr ""
633
 
634
+ #: class/wpmdb.php:1888
635
  msgid "Removing the remote backup MySQL export file"
636
  msgstr ""
637
 
638
+ #: class/wpmdb.php:1889
639
  msgid "Removing the remote temporary tables"
640
  msgstr ""
641
 
642
+ #: class/wpmdb.php:1890
643
  msgid "Migration cancellation failed"
644
  msgstr ""
645
 
646
+ #: class/wpmdb.php:1891
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:1892
653
+ msgctxt "The migration has been cancelled"
654
  msgid "Migration cancelled"
655
  msgstr ""
656
 
657
+ #: class/wpmdb.php:1893
658
+ msgctxt "The migration completed successfully"
659
  msgid "Migration complete"
660
  msgstr ""
661
 
662
+ #: class/wpmdb.php:1894
663
+ msgctxt "The migration is in the last stages"
664
  msgid "Finalizing migration"
665
  msgstr ""
666
 
667
+ #: class/wpmdb.php:1895
668
  msgid "A problem occurred when trying to add plugins to backlist."
669
  msgstr ""
670
 
671
+ #: class/wpmdb.php:1896
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:1897
679
  msgid ""
680
  "A problem occurred when trying to change the plugin compatibility setting."
681
  msgstr ""
682
 
683
+ #: class/wpmdb.php:1898
684
+ msgctxt "Confirmation required"
685
  msgid "Sure?"
686
  msgstr ""
687
 
688
+ #: class/wpmdb.php:1899
689
  #, php-format
690
  msgid "Pulling from %s, please wait..."
691
  msgstr ""
692
 
693
+ #: class/wpmdb.php:1900
694
  #, php-format
695
  msgid "Pulling from %s complete"
696
  msgstr ""
697
 
698
+ #: class/wpmdb.php:1901
699
  #, php-format
700
  msgid "Pushing to %s, please wait..."
701
  msgstr ""
702
 
703
+ #: class/wpmdb.php:1902
704
  #, php-format
705
  msgid "Pushing to %s complete"
706
  msgstr ""
707
 
708
+ #: class/wpmdb.php:1903
709
+ msgid "Copying license to the remote site, please wait"
710
+ msgstr ""
711
+
712
+ #: class/wpmdb.php:1904
713
+ msgid "Attempting to activate your licence, please wait..."
714
+ msgstr ""
715
+
716
+ #: class/wpmdb.php:1905
717
+ msgid "License successfully activated, please wait..."
718
+ msgstr ""
719
+
720
+ #: class/wpmdb.php:1906
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:1940
727
  msgid "Could not find the file to download:"
728
  msgstr ""
729
 
730
+ #: class/wpmdb.php:2093
731
  msgid "MySQL export file not found."
732
  msgstr ""
733
 
734
+ #: class/wpmdb.php:2193
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:2195
741
  msgid ""
742
  "WP Migrate DB and WP Migrate DB Pro cannot both be active. We've "
743
  "automatically deactivated WP Migrate DB Pro."
751
  "Now</a></strong>"
752
  msgstr ""
753
 
754
+ #: class/wpmdbpro.php:93
755
+ msgctxt "Plugin extensions"
756
  msgid "Addons"
757
  msgstr ""
758
 
759
+ #: class/wpmdbpro.php:156
760
  msgid "Feature Walkthrough"
761
  msgstr ""
762
 
763
+ #: class/wpmdbpro.php:157
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:160
770
  msgid "Pulling Live Data Into Your Local Development&nbsp;Environment"
771
  msgstr ""
772
 
773
+ #: class/wpmdbpro.php:161
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:164
780
  msgid "Pushing Local Development Data to a Staging&nbsp;Environment"
781
  msgstr ""
782
 
783
+ #: class/wpmdbpro.php:165
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:168
790
  msgid "Media Files Addon Demo"
791
  msgstr ""
792
 
793
+ #: class/wpmdbpro.php:169
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:202
800
  msgid ""
801
  "Please activate your license before attempting a pull or push migration."
802
  msgstr ""
803
 
804
+ #: class/wpmdbpro.php:309
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:339 class/wpmdbpro.php:407
812
+ msgctxt "Import data from remote database"
813
  msgid "pull"
814
  msgstr ""
815
 
816
+ #: class/wpmdbpro.php:341 class/wpmdbpro.php:409
817
+ msgctxt "Export data to remote database"
818
  msgid "push"
819
  msgstr ""
820
 
821
+ #: class/wpmdbpro.php:343
822
  #, php-format
823
  msgid ""
824
  "The connection succeeded but the remote site is configured to reject %s "
826
  "(#110)"
827
  msgstr ""
828
 
829
+ #: class/wpmdbpro.php:383
830
+ msgctxt "Asking to try and connect to remote server after verification error"
831
  msgid "Try again?"
832
  msgstr ""
833
 
834
+ #: class/wpmdbpro.php:395
835
+ #, php-format
836
+ msgid ""
837
+ "Activate remote license &mdash; Looks like you don't have a WP Migrate DB "
838
+ "Pro license active at %s."
839
+ msgstr ""
840
+
841
+ #: class/wpmdbpro.php:397
842
+ #, php-format
843
+ msgid "Copy %1$s license key to %2$s and activate it"
844
+ msgstr ""
845
+
846
+ #: class/wpmdbpro.php:412
847
  #, php-format
848
  msgid ""
849
  "The connection succeeded but the remote site is configured to reject %s "
851
  "(#122) <a href=\"#\" class=\"try-again js-action-link\">Try again?</a>"
852
  msgstr ""
853
 
854
+ #: class/wpmdbpro.php:504
855
+ msgctxt "Delete license"
 
 
856
  msgid "Remove"
857
  msgstr ""
858
 
859
+ #: class/wpmdbpro.php:672
860
+ msgctxt "License does not allow use of addons"
861
  msgid "Addons Unavailable"
862
  msgstr ""
863
 
864
+ #: class/wpmdbpro.php:672
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:685
872
+ msgctxt "Installed on website but not activated"
873
  msgid "Installed"
874
  msgstr ""
875
 
876
+ #: class/wpmdbpro.php:687
877
+ msgctxt "Installed and activated on website"
878
  msgid "Activated"
879
  msgstr ""
880
 
881
+ #: class/wpmdbpro.php:690
882
+ msgctxt "Enable addon so it may be used"
883
  msgid "Activate"
884
  msgstr ""
885
 
886
+ #: class/wpmdbpro.php:694
887
+ msgctxt "Download and activate addon"
888
  msgid "Install"
889
  msgstr ""
890
 
891
+ #: class/wpmdbpro.php:700 template/common/debug-info.php:4
892
+ msgctxt "Download to your computer"
893
  msgid "Download"
894
  msgstr ""
895
 
896
+ #: class/wpmdbpro.php:900
897
  msgid "Could not upload the SQL to the server. (#135)"
898
  msgstr ""
899
 
900
+ #: class/wpmdbpro.php:905
901
  msgid "Could not read the SQL file we uploaded to the server. (#136)"
902
  msgstr ""
903
 
904
+ #: class/wpmdbpro.php:921
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
922
  msgid "Once completed, you may visit this tab to view the available addons."
923
  msgstr ""
924
 
925
+ #: template/common/breadcrumbs.php:4
926
+ msgid "Back to select a saved profile"
927
+ msgstr ""
928
+
929
+ #: template/common/breadcrumbs.php:9
930
+ msgid "Saved Profiles"
931
+ msgstr ""
932
+
933
  #: template/common/compatibility.php:4
934
  msgid ""
935
  "Improve performance and reliability by not loading the following plugins for "
944
  "example a plugin that hooks into WP Migrate DB."
945
  msgstr ""
946
 
947
+ #: template/common/compatibility.php:23 template/pro/backup.php:43
948
  #: template/pro/exclude-post-types.php:20 template/pro/select-tables.php:37
949
  msgid "Select All"
950
  msgstr ""
951
 
952
+ #: template/common/compatibility.php:25 template/pro/backup.php:45
953
  #: template/pro/exclude-post-types.php:22 template/pro/select-tables.php:39
954
  msgid "Deselect All"
955
  msgstr ""
956
 
957
+ #: template/common/compatibility.php:27 template/pro/backup.php:47
958
  #: template/pro/exclude-post-types.php:24 template/pro/select-tables.php:41
959
  msgid "Invert Selection"
960
  msgstr ""
961
 
962
+ #: template/common/compatibility.php:30
963
  msgid "Save Changes"
964
  msgstr ""
965
 
967
  msgid "Diagnostic Info &amp; Error Log"
968
  msgstr ""
969
 
970
+ #: template/common/debug-info.php:5
971
  msgid "Clear Error Log"
972
  msgstr ""
973
 
994
  msgstr ""
995
 
996
  #: template/migrate-progress.php:20
997
+ msgctxt "Stop the migration"
998
  msgid "Cancel"
999
  msgstr ""
1000
 
 
 
 
 
1001
  #: template/migrate.php:73
1002
  msgid "Export File"
1003
  msgstr ""
1050
  msgstr ""
1051
 
1052
  #: template/migrate.php:131
1053
+ msgctxt "Source text to be replaced"
1054
  msgid "Find"
1055
  msgstr ""
1056
 
1057
  #: template/migrate.php:132
1058
+ msgctxt "Text to replace in source"
1059
  msgid "Replace"
1060
  msgstr ""
1061
 
1111
  "activated/deactivated)"
1112
  msgstr ""
1113
 
1114
+ #: template/migrate.php:266
1115
+ msgid "Compatible with older versions of MySQL (pre-5.5)"
1116
+ msgstr ""
1117
+
1118
+ #: template/migrate.php:282
1119
  msgid "Save Migration Profile"
1120
  msgstr ""
1121
 
1122
+ #: template/migrate.php:282
1123
  msgid "Save the above settings for the next time you do a similiar migration"
1124
  msgstr ""
1125
 
1126
+ #: template/migrate.php:301
1127
  msgid "Create new profile"
1128
  msgstr ""
1129
 
1130
+ #: template/migrate.php:310 template/migrate.php:320
1131
  msgid "Warning: Different Table Prefixes"
1132
  msgstr ""
1133
 
1134
+ #: template/migrate.php:312
1135
  msgid ""
1136
  "Whoa! We've detected that the database table prefix differs between "
1137
  "installations. Clicking the Migrate DB button below will create new database "
1139
  "span>\"."
1140
  msgstr ""
1141
 
1142
+ #: template/migrate.php:314
1143
  #, php-format
1144
  msgid ""
1145
  "However, your local install is configured to use table prefix \"%1$s\" and "
1148
  "variable to \"<span class=\"remote-prefix\"></span>\"."
1149
  msgstr ""
1150
 
1151
+ #: template/migrate.php:316
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:322
1158
  #, php-format
1159
  msgid ""
1160
  "Whoa! We've detected that the database table prefix differs between "
1162
  "tables in the remote database with prefix \"%s\"."
1163
  msgstr ""
1164
 
1165
+ #: template/migrate.php:324
1166
  #, php-format
1167
  msgid ""
1168
  "However, your remote install is configured to use table prefix \"<span class="
1172
  "span>\" variable to \"%s\"."
1173
  msgstr ""
1174
 
1175
+ #: template/migrate.php:326
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."
1247
  msgstr ""
1248
 
1249
  #: template/pro/connection-info.php:4
1250
+ msgid "Reset Secret Key"
1251
  msgstr ""
1252
 
1253
  #: template/pro/exclude-post-types.php:4
1282
  msgstr ""
1283
 
1284
  #: template/pro/pull-push-radio-buttons.php:4
1285
+ msgctxt "Import data from remote database"
1286
  msgid "Pull"
1287
  msgstr ""
1288
 
1291
  msgstr ""
1292
 
1293
  #: template/pro/pull-push-radio-buttons.php:13
1294
+ msgctxt "Export data to remote database"
1295
  msgid "Push"
1296
  msgstr ""
1297
 
1300
  msgstr ""
1301
 
1302
  #: template/pro/select-tables.php:4
1303
+ msgctxt "Database tables"
1304
  msgid "Tables"
1305
  msgstr ""
1306
 
1335
  msgstr ""
1336
 
1337
  #: template/pro/videos.php:2
1338
+ msgctxt "Tutorial videos"
1339
  msgid "Videos"
1340
  msgstr ""
1341
 
1419
  msgstr ""
1420
 
1421
  #: template/wpmdb/wordpress-org-support.php:2
1422
+ msgctxt "Get help from the community"
1423
  msgid "Support"
1424
  msgstr ""
1425
 
languages/wp-migrate-db-pt_BR.mo ADDED
Binary file
readme.txt CHANGED
@@ -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.0
7
- Stable tag: 0.6
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.
@@ -17,7 +17,7 @@ It even takes into account serialized data (both arrays and objects) and updates
17
 
18
  Example: <code>s:5:"hello"</code> becomes <code>s:11:"hello world"</code>
19
 
20
- **\*NEW\* Pro Version with Email Support and More Features**
21
 
22
  * Select the tables you want to migrate
23
  * Pull production db down and replace local db
@@ -60,7 +60,42 @@ It is likely you have a download manager plugin or extension installed in your w
60
 
61
  == Changelog ==
62
 
63
- = 0.6 =
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
64
  * New: Updated the migration UI to include a detailed progress bar, time elapsed, pause and cancel buttons and more!
65
  * New: Option to exclude transients (temporary cached data)
66
  * New: Migration profiles
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.6.1
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.
17
 
18
  Example: <code>s:5:"hello"</code> becomes <code>s:11:"hello world"</code>
19
 
20
+ **PRO Version with Email Support and More Features**
21
 
22
  * Select the tables you want to migrate
23
  * Pull production db down and replace local db
60
 
61
  == Changelog ==
62
 
63
+ = 0.6.1 - 2014-10-29 =
64
+ * New: breadcrumb-style UI for saved profiles
65
+ * New: Brazilian Portugese translation
66
+ * Security: Added .htaccess to backup folder to help prevent direct downloads
67
+ * Security: False values not included in signature
68
+ * Improvement: Compatibility with TGM Plugin Activation
69
+ * Improvement: Fixed hundreds of PHP Code Sniffer warnings
70
+ * Improvement: Switch to `update_site_option()` and `get_site_option()`
71
+ * Improvement: Cleaner and more instructive error message on JSON decoding failure
72
+ * Improvement: New hooks to massage data before and after find & replace
73
+ * Improvement: Common server security rules better accommodated
74
+ * Improvement: Better compatibility with SSL on WP Engine
75
+ * Improvement: Minify all the Javascripts
76
+ * Improvement: Use PHP's DIRECTORY_SEPARATOR instead of our own constant
77
+ * Improvement: Updated tons of translation strings to be translator-friendly
78
+ * Improvement: Find &amp; replace field error messages could suggest removing the fields
79
+ * Improvement: Download button for Diagnostic Info &amp; Error Log
80
+ * Bug fix: 404 errors after successful migrations due to caching
81
+ * Bug fix: Multisite exports broken on PHP < 5.4.7
82
+ * Bug fix: Using relative paths for file includes
83
+ * Bug fix: Typing new profile name does not select "Create new profile" option
84
+ * Bug fix: Find &amp; replace field errors stick around even after removing fields
85
+ * Bug fix: `wpmdb_error_log` option is auto loading
86
+ * Bug fix: Inconsistent stripping of slashes
87
+ * Bug fix: Spinner is inconsistent with WP 3.8+ spinner
88
+ * Bug fix: Apostrophe in path not being handled
89
+ * Bug fix: Inappropriate use of `htmlentities()`
90
+ * Bug fix: The table tooltip still shows during the media files migration
91
+ * Bug fix: Import/Export issues between MySQL 5.1 and 5.5+
92
+ * Bug fix: Notice error on Updates dashboard page
93
+ * Bug fix: Signature verification error when local and remote plugins are different versions
94
+ * Bug fix: Find &amp; replace handle icon is rendering poorly
95
+ * Bug fix: PHP Notice: Undefined variable: safe_mode
96
+ * Bug fix: Fatal error: Cannot use object of type WP_Error as array in `verify_download()`
97
+
98
+ = 0.6 - 2014-08-19 =
99
  * New: Updated the migration UI to include a detailed progress bar, time elapsed, pause and cancel buttons and more!
100
  * New: Option to exclude transients (temporary cached data)
101
  * New: Migration profiles
template/addons.php CHANGED
@@ -3,7 +3,7 @@
3
  ?>
4
  <div class="addons-tab content-tab">
5
  <div class="addons-content">
6
- <?php if( ! empty( $licence ) ) : ?>
7
  <p><?php _e( 'Fetching addon details, please wait...', 'wp-migrate-db' ); ?></p>
8
  <?php else : ?>
9
  <p><?php _e( 'We couldn\'t find your license information. Please switch to the settings tab and enter your license.', 'wp-migrate-db' ); ?></p>
3
  ?>
4
  <div class="addons-tab content-tab">
5
  <div class="addons-content">
6
+ <?php if ( ! empty( $licence ) ) : ?>
7
  <p><?php _e( 'Fetching addon details, please wait...', 'wp-migrate-db' ); ?></p>
8
  <?php else : ?>
9
  <p><?php _e( 'We couldn\'t find your license information. Please switch to the settings tab and enter your license.', 'wp-migrate-db' ); ?></p>
template/common/breadcrumbs.php ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if ( count( $this->settings['profiles'] ) > 0 ) :
3
+ $profile_name = $is_default_profile ? _x( 'New Profile', 'Default profile loaded', 'wp-migrate-db' ) : $loaded_profile['name'];
4
+ ?>
5
+
6
+ <div class="crumbs">
7
+
8
+ <a class="crumb" href="<?php echo $this->plugin_base; ?>" class="return-to-profile-selection clearfix">
9
+ <?php _e( 'Saved Profiles', 'wp-migrate-db' ); ?>
10
+ </a>
11
+
12
+ <span class="crumb"><?php echo esc_html( $profile_name ); ?></span>
13
+
14
+ </div>
15
+
16
+ <?php
17
+ endif;
template/common/compatibility.php CHANGED
@@ -1,25 +1,26 @@
1
  <div class="option-section plugin-compatibility-section">
2
  <label for="plugin-compatibility" class="plugin-compatibility bubble">
3
- <input id="plugin-compatibility" type="checkbox" name="plugin_compatibility"<?php echo $plugin_compatibility_checked; ?> autocomplete="off"<?php echo $plugin_compatibility_checked; ?> />
4
- <?php _e( 'Improve performance and reliability by not loading the following plugins for migration requests', 'wp-migrate-db' ); ?>
5
  </label>
6
  <a href="#" class="general-helper plugin-compatibility-helper js-action-link"></a>
 
7
  <div class="plugin-compatibility-message helper-message bottom">
8
  <?php _e( 'Some plugins add a lot of overhead to each request, requiring extra memory and CPU. And some plugins even interfere with migrations and cause them to fail. We recommend only loading plugins that affect migration requests, for example a plugin that hooks into WP Migrate DB.', 'wp-migrate-db' ); ?></br>
9
  </div>
10
 
11
  <div class="indent-wrap expandable-content plugin-compatibility-wrap select-wrap">
12
  <select autocomplete="off" class="multiselect" id="selected-plugins" name="selected_plugins[]" multiple="multiple">
13
- <?php
14
  $blacklist = array_flip( $this->settings['blacklist_plugins'] );
15
  foreach ( get_plugins() as $key => $plugin ) {
16
- if ( 0 === strpos( $plugin['Name'], 'WP Migrate DB' ) ) {
17
  continue;
18
  }
19
- $selected = ( isset( $blacklist[$key] ) ) ? ' selected' : '';
20
  printf( '<option value="%s"%s>%s</option>', $key, $selected, $plugin['Name'] );
21
  }
22
- ?>
23
  </select>
24
  <br>
25
  <a class="multiselect-select-all js-action-link" href="#"><?php _e( 'Select All', 'wp-migrate-db' ); ?></a>
@@ -30,7 +31,7 @@
30
 
31
  <p>
32
  <span class="button plugin-compatibility-save"><?php _e( 'Save Changes', 'wp-migrate-db' ); ?></span>
33
- <span class="plugin-compatibility-success-msg"><?php _e( 'Saved', 'wp-migrate-db' ); ?></span>
34
  </p>
35
  </div>
36
  </div>
1
  <div class="option-section plugin-compatibility-section">
2
  <label for="plugin-compatibility" class="plugin-compatibility bubble">
3
+ <input id="plugin-compatibility" type="checkbox" name="plugin_compatibility"<?php echo $plugin_compatibility_checked; ?> autocomplete="off"<?php echo $plugin_compatibility_checked; ?> />
4
+ <?php _e( 'Improve performance and reliability by not loading the following plugins for migration requests', 'wp-migrate-db' ); ?>
5
  </label>
6
  <a href="#" class="general-helper plugin-compatibility-helper js-action-link"></a>
7
+
8
  <div class="plugin-compatibility-message helper-message bottom">
9
  <?php _e( 'Some plugins add a lot of overhead to each request, requiring extra memory and CPU. And some plugins even interfere with migrations and cause them to fail. We recommend only loading plugins that affect migration requests, for example a plugin that hooks into WP Migrate DB.', 'wp-migrate-db' ); ?></br>
10
  </div>
11
 
12
  <div class="indent-wrap expandable-content plugin-compatibility-wrap select-wrap">
13
  <select autocomplete="off" class="multiselect" id="selected-plugins" name="selected_plugins[]" multiple="multiple">
14
+ <?php
15
  $blacklist = array_flip( $this->settings['blacklist_plugins'] );
16
  foreach ( get_plugins() as $key => $plugin ) {
17
+ if ( 0 === strpos( $key, 'wp-migrate-db' ) ) {
18
  continue;
19
  }
20
+ $selected = ( isset( $blacklist[ $key ] ) ) ? ' selected' : '';
21
  printf( '<option value="%s"%s>%s</option>', $key, $selected, $plugin['Name'] );
22
  }
23
+ ?>
24
  </select>
25
  <br>
26
  <a class="multiselect-select-all js-action-link" href="#"><?php _e( 'Select All', 'wp-migrate-db' ); ?></a>
31
 
32
  <p>
33
  <span class="button plugin-compatibility-save"><?php _e( 'Save Changes', 'wp-migrate-db' ); ?></span>
34
+ <span class="plugin-compatibility-success-msg"><?php _ex( 'Saved', 'The settings were saved successfully', 'wp-migrate-db' ); ?></span>
35
  </p>
36
  </div>
37
  </div>
template/common/debug-info.php CHANGED
@@ -1,5 +1,6 @@
1
  <div class="debug">
2
  <h3><?php _e( 'Diagnostic Info &amp; Error Log', 'wp-migrate-db' ); ?></h3>
3
  <textarea class="debug-log-textarea" autocomplete="off" readonly></textarea>
 
4
  <a class="button clear-log js-action-link"><?php _e( 'Clear Error Log', 'wp-migrate-db' ); ?></a>
5
  </div>
1
  <div class="debug">
2
  <h3><?php _e( 'Diagnostic Info &amp; Error Log', 'wp-migrate-db' ); ?></h3>
3
  <textarea class="debug-log-textarea" autocomplete="off" readonly></textarea>
4
+ <a href="<?php echo network_admin_url( $this->plugin_base . '&nonce=' . wp_create_nonce( 'wpmdb-download-log' ) . '&wpmdb-download-log=1' ); ?>" class="button"><?php _ex( 'Download', 'Download to your computer', 'wp-migrate-db' ); ?></a>
5
  <a class="button clear-log js-action-link"><?php _e( 'Clear Error Log', 'wp-migrate-db' ); ?></a>
6
  </div>
template/common/max-request-size.php CHANGED
@@ -2,12 +2,13 @@
2
  <div class="clearfix slider-label-wrapper">
3
  <div class="slider-label"><span><?php _e( 'Maximum Request Size', 'wp-migrate-db' ); ?></span>
4
  <a class="general-helper slider-helper js-action-link" href="#"></a>
 
5
  <div class="slider-message helper-message">
6
  <?php printf( __( 'We\'ve detected that your server supports requests up to %s, but it\'s possible that your server has limitations that we could not detect. To be on the safe side, we set the default to 1 MB, but you can try throttling it up to get better performance. If you\'re getting a 413 error or having trouble with time outs, try throttling this setting down.', 'wp-migrate-db' ), size_format( $this->get_bottleneck( 'max' ) ) ); ?>
7
  </div>
8
  </div>
9
  <div class="amount"></div>
10
- <span class="slider-success-msg"><?php _e( 'Saved', 'wp-migrate-db' ); ?></span>
11
  </div>
12
  <div class="slider"></div>
13
  </div>
2
  <div class="clearfix slider-label-wrapper">
3
  <div class="slider-label"><span><?php _e( 'Maximum Request Size', 'wp-migrate-db' ); ?></span>
4
  <a class="general-helper slider-helper js-action-link" href="#"></a>
5
+
6
  <div class="slider-message helper-message">
7
  <?php printf( __( 'We\'ve detected that your server supports requests up to %s, but it\'s possible that your server has limitations that we could not detect. To be on the safe side, we set the default to 1 MB, but you can try throttling it up to get better performance. If you\'re getting a 413 error or having trouble with time outs, try throttling this setting down.', 'wp-migrate-db' ), size_format( $this->get_bottleneck( 'max' ) ) ); ?>
8
  </div>
9
  </div>
10
  <div class="amount"></div>
11
+ <span class="slider-success-msg"><?php _ex( 'Saved', 'The settings were saved successfully', 'wp-migrate-db' ); ?></span>
12
  </div>
13
  <div class="slider"></div>
14
  </div>
template/migrate-progress.php CHANGED
@@ -1,5 +1,6 @@
1
  <div class="progress-content">
2
  <span class="close-progress-content close-progress-content-button">&times;</span>
 
3
  <div>
4
  <h2 class="progress-title"><?php _e( 'Please wait while migration is running...', 'wp-migrate-db' ); ?></h2>
5
  </div>
@@ -16,8 +17,8 @@
16
  </div>
17
 
18
  <div class="migration-controls">
19
- <span class="pause-resume button"><?php _e( 'Pause', 'wp-migrate-db' ); ?></span>
20
- <span class="cancel button"><?php _e( 'Cancel', 'wp-migrate-db' ); ?></span>
21
  </div>
22
 
23
  <?php $this->template_part( array( 'progress_upgrade' ) ); ?>
1
  <div class="progress-content">
2
  <span class="close-progress-content close-progress-content-button">&times;</span>
3
+
4
  <div>
5
  <h2 class="progress-title"><?php _e( 'Please wait while migration is running...', 'wp-migrate-db' ); ?></h2>
6
  </div>
17
  </div>
18
 
19
  <div class="migration-controls">
20
+ <span class="pause-resume button"><?php _ex( 'Pause', 'Temporarily stop migrating', 'wp-migrate-db' ); ?></span>
21
+ <span class="cancel button"><?php _ex( 'Cancel', 'Stop the migration', 'wp-migrate-db' ); ?></span>
22
  </div>
23
 
24
  <?php $this->template_part( array( 'progress_upgrade' ) ); ?>
template/migrate.php CHANGED
@@ -2,27 +2,26 @@
2
  global $wpdb;
3
  global $loaded_profile;
4
 
5
- if( isset( $_GET['wpmdb-profile'] ) ){
6
  $loaded_profile = $this->get_profile( $_GET['wpmdb-profile'] );
7
- }
8
- else{
9
  $loaded_profile = $this->default_profile;
10
  }
11
 
12
  $is_default_profile = isset( $loaded_profile['default_profile'] );
13
 
14
- $convert_exclude_revisions = false;
15
  $convert_post_type_selection = false;
16
- if( ! $is_default_profile ) {
17
- if( isset( $loaded_profile['exclude_revisions'] ) ) {
18
  $convert_exclude_revisions = true;
19
  }
20
  /* We used to provide users the option of selecting which post types they'd like to migrate.
21
- * We found that our wording for this funtionality was a little confusing so we switched it to instead read "Exclude Post Types"
22
  * Once we made the switch we needed a way of inverting their saved post type selection to instead exclude the select post types.
23
  * This was required to make their select compatible with the new "exclude" wording.
24
  * This is easy enough for "push" and "export" saved profile as we know which post types exist on the local system and
25
- * can easily invert the selection. Pull saved profiles is a little tricker.
26
  * $this->maybe_update_profile() is used to update deprecated profile options to their new values.
27
  * At the time of page request $this->maybe_update_profile() cannot be used to update a pull profile as we don't know which
28
  * post types exist on the remote machine. As such we invert this selection later using the $convert_post_type_selection flag below.
@@ -33,21 +32,25 @@ if( ! $is_default_profile ) {
33
  $loaded_profile = $this->maybe_update_profile( $loaded_profile, $_GET['wpmdb-profile'] );
34
  }
35
 
36
- if( false == $is_default_profile ) {
37
  $loaded_profile = wp_parse_args( $loaded_profile, $this->default_profile );
38
  }
39
- $loaded_profile = wp_parse_args( $loaded_profile, $this->checkbox_options );
 
 
 
 
40
  ?>
41
  <script type='text/javascript'>
42
  var wpmdb_default_profile = <?php echo ( $is_default_profile ? 'true' : 'false' ); ?>;
43
- <?php if( isset( $loaded_profile['select_tables'] ) && ! empty( $loaded_profile['select_tables'] ) ) : ?>
44
- var wpmdb_loaded_tables = <?php echo json_encode( $loaded_profile['select_tables'] ); ?>;
45
  <?php endif; ?>
46
- <?php if( isset( $loaded_profile['select_post_types'] ) ) : ?>
47
- var wpmdb_loaded_post_types = <?php echo json_encode( $loaded_profile['select_post_types'] ); ?>;
48
  <?php endif; ?>
49
- <?php if( isset( $loaded_profile['select_backup'] ) && ! empty( $loaded_profile['select_backup'] ) ) : ?>
50
- var wpmdb_loaded_tables_backup = <?php echo json_encode( $loaded_profile['select_backup'] ); ?>;
51
  <?php endif; ?>
52
  var wpmdb_convert_exclude_revisions = <?php echo ( $convert_exclude_revisions ? 'true' : 'false' ); ?>;
53
  var wpmdb_convert_post_type_selection = <?php echo ( $convert_post_type_selection ? '1' : '0' ); ?>;
@@ -57,284 +60,295 @@ $loaded_profile = wp_parse_args( $loaded_profile, $this->checkbox_options );
57
 
58
  <form method="post" id="migrate-form" action="#migrate" enctype="multipart/form-data">
59
 
60
- <?php if ( count( $this->settings['profiles'] ) > 0 ) : ?>
61
- <a href="<?php echo $this->plugin_base; ?>" class="return-to-profile-selection clearfix">
62
- &larr; <?php _e( 'Back to select a saved profile', 'wp-migrate-db' ); ?>
63
- </a>
64
- <?php endif; ?>
65
 
66
- <div class="option-section">
67
 
68
- <ul class="option-group migrate-selection">
69
- <li>
70
- <?php $savefile_style = ( true == $this->is_pro ) ? '' : ' style="display: none;"'; ?>
71
- <label for="savefile"<?php echo $savefile_style; ?>>
72
  <input id="savefile" type="radio" value="savefile" name="action"<?php echo ( $loaded_profile['action'] == 'savefile' || ! $this->is_pro ) ? ' checked="checked"' : ''; ?> />
73
  <?php _e( 'Export File', 'wp-migrate-db' ); ?>
74
- </label>
75
- <ul>
76
- <li>
77
- <label for="save_computer">
78
  <input id="save_computer" type="checkbox" value="1" name="save_computer"<?php $this->maybe_checked( $loaded_profile['save_computer'] ); ?> />
79
  <?php _e( 'Save as file to your computer', 'wp-migrate-db' ); ?>
 
 
 
 
 
 
 
80
  </label>
81
  </li>
82
- <?php if ( $this->gzip() ) : ?>
83
- <li>
84
- <label for="gzip_file">
85
- <input id="gzip_file" type="checkbox" value="1" name="gzip_file"<?php $this->maybe_checked( $loaded_profile['gzip_file'] ); ?> />
86
- <?php _e( 'Compress file with gzip', 'wp-migrate-db' ); ?>
87
- </label>
88
- </li>
89
- <?php endif; ?>
90
- </ul>
91
- </li>
92
- <?php $this->template_part( array( 'pull_push_radio_buttons' ), $loaded_profile ); ?>
93
- </ul>
94
-
95
- <div class="connection-info-wrapper clearfix">
96
- <textarea class="pull-push-connection-info" name="connection_info" placeholder="<?php _e( 'Connection Info - Site URL &amp; Secret Key', 'wp-migrate-db' ); ?>"><?php echo ( isset( $loaded_profile['connection_info'] ) ? $loaded_profile['connection_info'] : '' ); ?></textarea>
97
- <br />
98
- <div class="basic-access-auth-wrapper clearfix">
99
- <input type="text" name="auth_username" class="auth-username auth-credentials" placeholder="Username" autocomplete="off" />
100
- <input type="password" name="auth_password" class="auth-password auth-credentials" placeholder="Password" autocomplete="off" />
101
- </div>
102
- <input class="button connect-button" type="submit" value="Connect" name="Connect" autocomplete="off" />
103
- </div>
104
-
105
- <div class="notification-message warning-notice ssl-notice inline-message">
106
- <strong><?php _e( 'SSL Disabled', 'wp-migrate-db' ); ?></strong> &mdash; <?php _e( 'We couldn\'t connect over SSL but regular http (no SSL) appears to be working so we\'ve switched to that. If you run a push or pull, your data will be transmitted unencrypted. Most people are fine with this, but just a heads up.', 'wp-migrate-db' ); ?>
107
  </div>
 
 
108
 
109
- <?php $this->template_part( array( 'invalid_licence_warning' ) ); ?>
110
-
111
  </div>
112
 
113
- <p class="connection-status"><?php _e( 'Please enter the connection information above to continue.', 'wp-migrate-db' ); ?></p>
114
 
115
- <div class="notification-message error-notice different-plugin-version-notice inline-message" style="display: none;">
116
- <b><?php _e( 'Version Mismatch', 'wp-migrate-db' ); ?></b> &mdash; <?php printf( __( 'We\'ve detected you have version <span class="remote-version"></span> of WP Migrate DB Pro at <span class="remote-location"></span> but are using %1$s here. Please go to the <a href="%2$s">Plugins page</a> on both installs and check for updates.', 'wp-migrate-db' ), $GLOBALS['wpmdb_meta'][$this->plugin_slug]['version'], network_admin_url( 'plugins.php' ) ); ?>
117
- </div>
118
 
119
- <div class="notification-message error-notice directory-permission-notice inline-message" style="display: none;">
120
- <strong><?php _e( 'Cannot Access Uploads Directory', 'wp-migrate-db' ); ?></strong> &mdash;
121
- <?php
122
- _e( 'We require write permissions to the standard WordPress uploads directory. Without this permission exports are unavailable. Please grant 755 permissions on the following directory:', 'wp-migrate-db' );
123
- echo $this->get_upload_info( 'path' );
124
- ?>
125
- </div>
126
 
127
- <div class="step-two">
 
 
 
 
 
 
128
 
129
- <div class="option-section">
130
- <div class="header-wrapper clearfix">
131
- <div class="option-heading find-heading"><?php _e( 'Find', 'wp-migrate-db' ); ?></div>
132
- <div class="option-heading replace-heading"><?php _e( 'Replace', 'wp-migrate-db' ); ?></div>
133
- </div>
134
 
135
- <p class="no-replaces-message"><?php _e( 'Doesn\'t look we have any replaces yet, <a href="#" class="js-action-link add-replace">add one?</a>', 'wp-migrate-db' ); ?></p>
 
 
 
 
136
 
137
- <table id="find-and-replace-sort" class="clearfix replace-fields">
138
- <tbody>
139
- <tr class="replace-row original-repeatable-field">
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
140
  <td class="sort-handle-col">
141
  <span class="sort-handle"></span>
142
  </td>
143
  <td class="old-replace-col">
144
- <input type="text" size="40" name="replace_old[]" class="code" placeholder="Old value" autocomplete="off" />
145
  </td>
146
  <td class="arrow-col">
147
  <span class="right-arrow">&rarr;</span>
148
  </td>
149
  <td class="replace-right-col">
150
- <input type="text" size="40" name="replace_new[]" class="code" placeholder="New value" autocomplete="off" />
151
  <span style="display: none;" class="replace-remove-row" data-profile-id="0"></span>
152
  </td>
153
  </tr>
154
- <?php if( $is_default_profile ) : ?>
155
- <tr class="replace-row ui-state-default<?php echo ( $this->lock_url_find_replace_row ) ? ' pin' : ''; ?>">
 
 
 
 
 
156
  <td class="sort-handle-col">
157
  <span class="sort-handle"></span>
158
  </td>
159
  <td class="old-replace-col">
160
- <input type="text" size="40" name="replace_old[]" class="code" id="old-url" placeholder="Old URL" value="<?php echo preg_replace( '#^https?:#', '', htmlentities( home_url() ) ); ?>" autocomplete="off"<?php echo ( $this->lock_url_find_replace_row ) ? ' readonly' : ''; ?> />
161
  </td>
162
  <td class="arrow-col">
163
  <span class="right-arrow">&rarr;</span>
164
  </td>
165
  <td class="replace-right-col">
166
- <input type="text" size="40" name="replace_new[]" class="code" id="new-url" placeholder="New URL" autocomplete="off" />
167
- <?php if ( ! $this->lock_url_find_replace_row ) : ?>
168
  <span style="display: none;" class="replace-remove-row" data-profile-id="0"></span>
169
  <?php endif; ?>
170
  </td>
171
  </tr>
172
- <tr class="replace-row ui-state-default">
173
- <td class="sort-handle-col">
174
- <span class="sort-handle"></span>
175
- </td>
176
- <td class="old-replace-col">
177
- <input type="text" size="40" name="replace_old[]" class="code" id="old-path" placeholder="Old file path" value="<?php echo htmlentities( $this->absolute_root_file_path ); ?>" autocomplete="off" />
178
- </td>
179
- <td class="arrow-col">
180
- <span class="right-arrow">&rarr;</span>
181
- </td>
182
- <td class="replace-right-col">
183
- <input type="text" size="40" name="replace_new[]" class="code" id="new-path" placeholder="New file path" autocomplete="off" />
184
- <span style="display: none;" class="replace-remove-row" data-profile-id="0"></span>
185
- </td>
186
- </tr>
187
- <?php else :
188
- $i = 1;
189
- foreach( $loaded_profile['replace_old'] as $replace_old ) : ?>
190
- <tr class="replace-row ui-state-default<?php echo ( 1 == $i && $this->lock_url_find_replace_row ) ? ' pin' : ''; ?>">
191
- <td class="sort-handle-col">
192
- <span class="sort-handle"></span>
193
- </td>
194
- <td class="old-replace-col">
195
- <input type="text" size="40" name="replace_old[]" class="code" placeholder="Old value" value="<?php echo $replace_old; ?>" autocomplete="off"<?php echo ( 1 == $i && $this->lock_url_find_replace_row ) ? ' readonly' : ''; ?> />
196
- </td>
197
- <td class="arrow-col">
198
- <span class="right-arrow">&rarr;</span>
199
- </td>
200
- <td class="replace-right-col">
201
- <input type="text" size="40" name="replace_new[]" class="code" placeholder="New value" value="<?php echo ( isset( $loaded_profile['replace_new'][$i] ) ? $loaded_profile['replace_new'][$i] : '' ); ?>" autocomplete="off" />
202
- <?php if ( ! $this->lock_url_find_replace_row || ( $this->lock_url_find_replace_row && $i != 1 ) ) : ?>
203
- <span style="display: none;" class="replace-remove-row" data-profile-id="0"></span>
204
- <?php endif; ?>
205
- </td>
206
- </tr>
207
- <?php
208
- ++$i;
209
- endforeach; ?>
210
- <?php endif; ?>
211
- <tr class="pin">
212
- <td colspan="4"><a class="button add-row">Add Row</a></td>
213
- </tr>
214
- </tbody>
215
- </table>
216
 
217
- <div id="new-url-missing-warning" class="warning inline-message missing-replace"><?php printf( __( '<strong>New URL Missing</strong> &mdash; Please enter the protocol-relative URL of the remote website in the "New URL" field. If you are unsure of what this URL should be, please consult <a href="%s" target="_blank">our documentation</a> on find and replace fields.', 'wp-migrate-db' ), 'https://deliciousbrains.com/wp-migrate-db-pro/documentation/#find-and-replace' ); ?></div>
218
- <div id="new-path-missing-warning" class="warning inline-message missing-replace"><?php printf( __( '<strong>New File Path Missing</strong> &mdash; Please enter the root file path of the remote website in the "New file path" field. If you are unsure of what the file path should be, please consult <a href="%s" target="_blank">our documentation</a> on find and replace fields.', 'wp-migrate-db' ), 'https://deliciousbrains.com/wp-migrate-db-pro/documentation/#find-and-replace' ); ?></div>
 
 
 
 
 
 
219
 
220
- </div>
221
 
222
- <?php $this->template_part( array( 'select_tables', 'exclude_post_types' ), $loaded_profile ); ?>
223
 
224
- <div class="option-section">
225
- <div class="header-expand-collapse clearfix">
226
- <div class="expand-collapse-arrow collapsed">&#x25BC;</div>
227
- <div class="option-heading tables-header"><?php _e( 'Advanced Options', 'wp-migrate-db' ); ?></div>
228
- </div>
229
 
230
- <div class="indent-wrap expandable-content">
231
 
232
- <ul>
233
- <li>
234
- <label for="replace-guids">
235
  <input id="replace-guids" type="checkbox" value="1" name="replace_guids"<?php $this->maybe_checked( $loaded_profile['replace_guids'] ); ?> />
236
  <?php _e( 'Replace GUIDs', 'wp-migrate-db' ); ?>
237
- </label>
238
 
239
- <a href="#" class="general-helper replace-guid-helper js-action-link"></a>
240
 
241
- <div class="replace-guids-info helper-message">
242
- <?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, I 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' ); ?>
243
- </div>
244
- </li>
245
- <li>
246
- <label for="exclude-spam">
247
  <input id="exclude-spam" type="checkbox" autocomplete="off" value="1" name="exclude_spam"<?php $this->maybe_checked( $loaded_profile['exclude_spam'] ); ?> />
248
  <?php _e( 'Exclude spam comments', 'wp-migrate-db' ); ?>
249
- </label>
250
- </li>
251
- <li class="keep-active-plugins">
252
- <label for="keep-active-plugins">
253
  <input id="keep-active-plugins" type="checkbox" value="1" autocomplete="off" name="keep_active_plugins"<?php $this->maybe_checked( $loaded_profile['keep_active_plugins'] ); ?> />
254
  <?php _e( 'Do not migrate the \'active_plugins\' setting (i.e. which plugins are activated/deactivated)', 'wp-migrate-db' ); ?>
255
- </label>
256
- </li>
257
- <li>
258
- <label for="exclude-transients">
259
  <input id="exclude-transients" type="checkbox" value="1" autocomplete="off" name="exclude_transients"<?php $this->maybe_checked( $loaded_profile['exclude_transients'] ); ?> />
260
  Exclude <a href="https://codex.wordpress.org/Transients_API" target="_blank">transients</a> (temporary cached data)
261
- </label>
262
- </li>
263
- <?php $this->template_part( array( 'exclude_post_revisions' ), $loaded_profile ); ?>
264
- </ul>
 
 
 
 
 
 
265
 
266
- </div>
267
  </div>
 
268
 
269
- <?php $this->template_part( array( 'backup' ), $loaded_profile ); ?>
270
 
271
- <?php do_action( 'wpmdb_after_advanced_options' ); ?>
272
 
273
- <div class="option-section save-migration-profile-wrap">
274
- <label for="save-migration-profile" class="save-migration-profile checkbox-label">
275
- <input id="save-migration-profile" type="checkbox" value="1" name="save_migration_profile"<?php echo ( ! $is_default_profile ? ' checked="checked"' : '' ); ?> />
276
  <?php _e( 'Save Migration Profile', 'wp-migrate-db' ); ?><span class="option-description"><?php _e( 'Save the above settings for the next time you do a similiar migration', 'wp-migrate-db' ); ?></span>
277
- </label>
278
 
279
- <div class="indent-wrap expandable-content">
280
- <ul class="option-group">
281
- <?php
282
- foreach( $this->settings['profiles'] as $profile_id => $profile ){ ++$profile_id; ?>
283
- <li>
284
- <span class="delete-profile" data-profile-id="<?php echo $profile_id; ?>"></span>
285
- <label for="profile-<?php echo $profile_id; ?>">
286
- <input id="profile-<?php echo $profile_id; ?>" type="radio" value="<?php echo --$profile_id; ?>" name="save_migration_profile_option"<?php echo ( $loaded_profile['name'] == $profile['name'] ) ? ' checked="checked"' : ''; ?> />
287
- <?php echo $profile['name']; ?>
288
- </label>
289
- </li>
290
- <?php }
291
  ?>
292
  <li>
293
- <label for="create_new" class="create-new-label">
294
- <input id="create_new" type="radio" value="new" name="save_migration_profile_option"<?php echo ( $is_default_profile ? ' checked="checked"' : '' ); ?> />
295
- <?php _e( 'Create new profile', 'wp-migrate-db' ); ?>
 
296
  </label>
297
- <input type="text" placeholder="e.g. Live Site" name="create_new_profile" class="create-new-profile" />
298
  </li>
299
- </ul>
300
- </div>
 
 
 
 
 
 
 
 
 
301
  </div>
 
302
 
303
- <div class="notification-message warning-notice prefix-notice pull">
304
- <h4><?php _e( 'Warning: Different Table Prefixes', 'wp-migrate-db' ); ?></h4>
305
 
306
- <p><?php _e( 'Whoa! We\'ve detected that the database table prefix differs between installations. Clicking the Migrate DB button below will create new database tables in your local database with prefix "<span class="remote-prefix"></span>".', 'wp-migrate-db' ); ?></p>
307
 
308
- <p><?php printf( __( 'However, your local install is configured to use table prefix "%1$s" and will ignore the migrated tables. So, <b>AFTER</b> migration is complete, you will need to edit your local install\'s wp-config.php and change the "%1$s" variable to "<span class="remote-prefix"></span>".', 'wp-migrate-db' ), $wpdb->prefix, $wpdb->prefix ); ?></p>
309
 
310
- <p><?php _e( 'This will allow your local install the use the migrated tables. Once you do this, you shouldn\'t have to do it again.', 'wp-migrate-db' ); ?></p>
311
- </div>
312
 
313
- <div class="notification-message warning-notice prefix-notice push">
314
- <h4><?php _e( 'Warning: Different Table Prefixes', 'wp-migrate-db' ); ?></h4>
315
 
316
- <p><?php printf( __( 'Whoa! We\'ve detected that the database table prefix differs between installations. Clicking the Migrate DB button below will create new database tables in the remote database with prefix "%s".', 'wp-migrate-db' ), $wpdb->prefix ); ?></p>
317
 
318
- <p><?php printf( __( 'However, your remote install is configured to use table prefix "<span class="remote-prefix"></span>" and will ignore the migrated tables. So, <b>AFTER</b> migration is complete, you will need to edit your remote install\'s wp-config.php and change the "<span class="remote-prefix"></span>" variable to "%s".', 'wp-migrate-db' ), $wpdb->prefix ); ?></p>
319
 
320
- <p><?php _e( 'This will allow your remote install the use the migrated tables. Once you do this, you shouldn\'t have to do it again.', 'wp-migrate-db' ); ?></p>
321
- </div>
322
 
323
- <p class="migrate-db">
324
- <input type="hidden" class="remote-json-data" name="remote_json_data" autocomplete="off" />
325
- <input class="button-primary migrate-db-button" type="submit" value="Migrate DB" name="Submit" autocomplete="off" />
326
- <input class="button save-settings-button" type="submit" value="Save Profile" name="submit_save_profile" autocomplete="off" />
327
- </p>
328
 
 
 
329
  </div>
330
 
331
- <?php if ( count( $this->settings['profiles'] ) > 0 ) : ?>
332
- <a href="<?php echo $this->plugin_base; ?>" class="return-to-profile-selection clearfix bottom">
333
- &larr; <?php _e( 'Back to select a saved profile', 'wp-migrate-db' ); ?>
334
- </a>
335
- <?php endif; ?>
 
 
336
 
337
  </form>
338
  <?php $this->template( 'migrate-progress' ); ?>
339
 
340
- </div> <!-- end .migrate-tab -->
2
  global $wpdb;
3
  global $loaded_profile;
4
 
5
+ if ( isset( $_GET['wpmdb-profile'] ) ) {
6
  $loaded_profile = $this->get_profile( $_GET['wpmdb-profile'] );
7
+ } else {
 
8
  $loaded_profile = $this->default_profile;
9
  }
10
 
11
  $is_default_profile = isset( $loaded_profile['default_profile'] );
12
 
13
+ $convert_exclude_revisions = false;
14
  $convert_post_type_selection = false;
15
+ if ( ! $is_default_profile ) {
16
+ if ( isset( $loaded_profile['exclude_revisions'] ) ) {
17
  $convert_exclude_revisions = true;
18
  }
19
  /* We used to provide users the option of selecting which post types they'd like to migrate.
20
+ * We found that our wording for this functionality was a little confusing so we switched it to instead read "Exclude Post Types"
21
  * Once we made the switch we needed a way of inverting their saved post type selection to instead exclude the select post types.
22
  * This was required to make their select compatible with the new "exclude" wording.
23
  * This is easy enough for "push" and "export" saved profile as we know which post types exist on the local system and
24
+ * can easily invert the selection. Pull saved profiles is a little trickier.
25
  * $this->maybe_update_profile() is used to update deprecated profile options to their new values.
26
  * At the time of page request $this->maybe_update_profile() cannot be used to update a pull profile as we don't know which
27
  * post types exist on the remote machine. As such we invert this selection later using the $convert_post_type_selection flag below.
32
  $loaded_profile = $this->maybe_update_profile( $loaded_profile, $_GET['wpmdb-profile'] );
33
  }
34
 
35
+ if ( false == $is_default_profile ) {
36
  $loaded_profile = wp_parse_args( $loaded_profile, $this->default_profile );
37
  }
38
+ $loaded_profile = wp_parse_args( $loaded_profile, $this->checkbox_options );
39
+ $breadcrumbs_params = array(
40
+ 'loaded_profile' => $loaded_profile,
41
+ 'is_default_profile' => $is_default_profile,
42
+ );
43
  ?>
44
  <script type='text/javascript'>
45
  var wpmdb_default_profile = <?php echo ( $is_default_profile ? 'true' : 'false' ); ?>;
46
+ <?php if ( isset( $loaded_profile['select_tables'] ) && ! empty( $loaded_profile['select_tables'] ) ) : ?>
47
+ var wpmdb_loaded_tables = <?php echo json_encode( $loaded_profile['select_tables'] ); ?>;
48
  <?php endif; ?>
49
+ <?php if ( isset( $loaded_profile['select_post_types'] ) ) : ?>
50
+ var wpmdb_loaded_post_types = <?php echo json_encode( $loaded_profile['select_post_types'] ); ?>;
51
  <?php endif; ?>
52
+ <?php if ( isset( $loaded_profile['select_backup'] ) && ! empty( $loaded_profile['select_backup'] ) ) : ?>
53
+ var wpmdb_loaded_tables_backup = <?php echo json_encode( $loaded_profile['select_backup'] ); ?>;
54
  <?php endif; ?>
55
  var wpmdb_convert_exclude_revisions = <?php echo ( $convert_exclude_revisions ? 'true' : 'false' ); ?>;
56
  var wpmdb_convert_post_type_selection = <?php echo ( $convert_post_type_selection ? '1' : '0' ); ?>;
60
 
61
  <form method="post" id="migrate-form" action="#migrate" enctype="multipart/form-data">
62
 
63
+ <?php $this->template( 'breadcrumbs', 'common', $breadcrumbs_params ); ?>
 
 
 
 
64
 
65
+ <div class="option-section">
66
 
67
+ <ul class="option-group migrate-selection">
68
+ <li>
69
+ <?php $savefile_style = ( true == $this->is_pro ) ? '' : ' style="display: none;"'; ?>
70
+ <label for="savefile"<?php echo $savefile_style; ?>>
71
  <input id="savefile" type="radio" value="savefile" name="action"<?php echo ( $loaded_profile['action'] == 'savefile' || ! $this->is_pro ) ? ' checked="checked"' : ''; ?> />
72
  <?php _e( 'Export File', 'wp-migrate-db' ); ?>
73
+ </label>
74
+ <ul>
75
+ <li>
76
+ <label for="save_computer">
77
  <input id="save_computer" type="checkbox" value="1" name="save_computer"<?php $this->maybe_checked( $loaded_profile['save_computer'] ); ?> />
78
  <?php _e( 'Save as file to your computer', 'wp-migrate-db' ); ?>
79
+ </label>
80
+ </li>
81
+ <?php if ( $this->gzip() ) : ?>
82
+ <li>
83
+ <label for="gzip_file">
84
+ <input id="gzip_file" type="checkbox" value="1" name="gzip_file"<?php $this->maybe_checked( $loaded_profile['gzip_file'] ); ?> />
85
+ <?php _e( 'Compress file with gzip', 'wp-migrate-db' ); ?>
86
  </label>
87
  </li>
88
+ <?php endif; ?>
89
+ </ul>
90
+ </li>
91
+ <?php $this->template_part( array( 'pull_push_radio_buttons' ), $loaded_profile ); ?>
92
+ </ul>
93
+
94
+ <div class="connection-info-wrapper clearfix">
95
+ <textarea class="pull-push-connection-info" name="connection_info" placeholder="<?php _e( 'Connection Info - Site URL &amp; Secret Key', 'wp-migrate-db' ); ?>"><?php echo esc_html( isset( $loaded_profile['connection_info'] ) ? $loaded_profile['connection_info'] : '' ); ?></textarea>
96
+ <br/>
97
+
98
+ <div class="basic-access-auth-wrapper clearfix">
99
+ <input type="text" name="auth_username" class="auth-username auth-credentials" placeholder="Username" autocomplete="off"/>
100
+ <input type="password" name="auth_password" class="auth-password auth-credentials" placeholder="Password" autocomplete="off"/>
 
 
 
 
 
 
 
 
 
 
 
 
101
  </div>
102
+ <input class="button connect-button" type="submit" value="Connect" name="Connect" autocomplete="off"/>
103
+ </div>
104
 
105
+ <div class="notification-message warning-notice ssl-notice inline-message">
106
+ <strong><?php _e( 'SSL Disabled', 'wp-migrate-db' ); ?></strong> &mdash; <?php _e( 'We couldn\'t connect over SSL but regular http (no SSL) appears to be working so we\'ve switched to that. If you run a push or pull, your data will be transmitted unencrypted. Most people are fine with this, but just a heads up.', 'wp-migrate-db' ); ?>
107
  </div>
108
 
109
+ <?php $this->template_part( array( 'invalid_licence_warning' ) ); ?>
110
 
111
+ </div>
 
 
112
 
113
+ <p class="connection-status"><?php _e( 'Please enter the connection information above to continue.', 'wp-migrate-db' ); ?></p>
 
 
 
 
 
 
114
 
115
+ <div class="notification-message error-notice directory-permission-notice inline-message" style="display: none;">
116
+ <strong><?php _e( 'Cannot Access Uploads Directory', 'wp-migrate-db' ); ?></strong> &mdash;
117
+ <?php
118
+ _e( 'We require write permissions to the standard WordPress uploads directory. Without this permission exports are unavailable. Please grant 755 permissions on the following directory:', 'wp-migrate-db' );
119
+ echo esc_html( $this->get_upload_info( 'path' ) );
120
+ ?>
121
+ </div>
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>
128
+ <div class="option-heading replace-heading"><?php _ex( 'Replace', 'Text to replace in source', 'wp-migrate-db' ); ?></div>
129
+ </div>
130
 
131
+ <table id="find-and-replace-sort" class="clearfix replace-fields">
132
+ <tbody>
133
+ <tr class="replace-row original-repeatable-field">
134
+ <td class="sort-handle-col">
135
+ <span class="sort-handle"></span>
136
+ </td>
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">&rarr;</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 style="display: none;" class="replace-remove-row" data-profile-id="0"></span>
146
+ </td>
147
+ </tr>
148
+ <?php if ( $is_default_profile ) : ?>
149
+ <tr class="replace-row ui-state-default<?php echo ( $this->lock_url_find_replace_row ) ? ' pin' : ''; ?>">
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">&rarr;</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 style="display: none;" class="replace-remove-row" data-profile-id="0"></span>
163
+ <?php endif; ?>
164
+ </td>
165
+ </tr>
166
+ <tr class="replace-row ui-state-default">
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">&rarr;</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 style="display: none;" class="replace-remove-row" data-profile-id="0"></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 ui-state-default<?php echo ( 1 == $i && $this->lock_url_find_replace_row ) ? ' pin' : ''; ?>">
185
+ <?php
186
+ $replace_new = ( ! empty( $loaded_profile['replace_new'][ $i ] ) ) ? $loaded_profile['replace_new'][ $i ] : '';
187
+ ?>
188
  <td class="sort-handle-col">
189
  <span class="sort-handle"></span>
190
  </td>
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">&rarr;</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 style="display: none;" class="replace-remove-row" data-profile-id="0"></span>
201
  <?php endif; ?>
202
  </td>
203
  </tr>
204
+ <?php
205
+ ++$i;
206
+ endforeach; ?>
207
+ <?php endif; ?>
208
+ <tr class="pin">
209
+ <td colspan="4"><a class="button add-row">Add Row</a></td>
210
+ </tr>
211
+ </tbody>
212
+ </table>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
213
 
214
+ <?php
215
+ $new_url_missing_warning = __( '<strong>New URL Missing</strong> &mdash; Please enter the protocol-relative URL of the remote website in the "New URL" field or remove the whole row entirely. If you are unsure of what this URL should be, please consult <a href="%s" target="_blank">our documentation</a> on find and replace fields.', 'wp-migrate-db' );
216
+ if ( $is_default_profile && $this->lock_url_find_replace_row ) {
217
+ $new_url_missing_warning = __( '<strong>New URL Missing</strong> &mdash; Please enter the protocol-relative URL of the remote website in the "New URL" field. If you are unsure of what this URL should be, please consult <a href="%s" target="_blank">our documentation</a> on find and replace fields.', 'wp-migrate-db' );
218
+ }
219
+ ?>
220
+ <div id="new-url-missing-warning" class="warning inline-message missing-replace"><?php printf( $new_url_missing_warning, 'https://deliciousbrains.com/wp-migrate-db-pro/doc/find-and-replace/' ); ?></div>
221
+ <div id="new-path-missing-warning" class="warning inline-message missing-replace"><?php printf( __( '<strong>New File Path Missing</strong> &mdash; Please enter the root file path of the remote website in the "New file path" field or remove the whole row entirely. If you are unsure of what the file path should be, please consult <a href="%s" target="_blank">our documentation</a> on find and replace fields.', 'wp-migrate-db' ), 'https://deliciousbrains.com/wp-migrate-db-pro/doc/find-and-replace/' ); ?></div>
222
 
223
+ </div>
224
 
225
+ <?php $this->template_part( array( 'select_tables', 'exclude_post_types' ), $loaded_profile ); ?>
226
 
227
+ <div class="option-section">
228
+ <div class="header-expand-collapse clearfix">
229
+ <div class="expand-collapse-arrow collapsed">&#x25BC;</div>
230
+ <div class="option-heading tables-header"><?php _e( 'Advanced Options', 'wp-migrate-db' ); ?></div>
231
+ </div>
232
 
233
+ <div class="indent-wrap expandable-content">
234
 
235
+ <ul>
236
+ <li>
237
+ <label for="replace-guids">
238
  <input id="replace-guids" type="checkbox" value="1" name="replace_guids"<?php $this->maybe_checked( $loaded_profile['replace_guids'] ); ?> />
239
  <?php _e( 'Replace GUIDs', 'wp-migrate-db' ); ?>
240
+ </label>
241
 
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, I 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' ); ?>
246
+ </div>
247
+ </li>
248
+ <li>
249
+ <label for="exclude-spam">
250
  <input id="exclude-spam" type="checkbox" autocomplete="off" value="1" name="exclude_spam"<?php $this->maybe_checked( $loaded_profile['exclude_spam'] ); ?> />
251
  <?php _e( 'Exclude spam comments', 'wp-migrate-db' ); ?>
252
+ </label>
253
+ </li>
254
+ <li class="keep-active-plugins">
255
+ <label for="keep-active-plugins">
256
  <input id="keep-active-plugins" type="checkbox" value="1" autocomplete="off" name="keep_active_plugins"<?php $this->maybe_checked( $loaded_profile['keep_active_plugins'] ); ?> />
257
  <?php _e( 'Do not migrate the \'active_plugins\' setting (i.e. which plugins are activated/deactivated)', 'wp-migrate-db' ); ?>
258
+ </label>
259
+ </li>
260
+ <li>
261
+ <label for="exclude-transients">
262
  <input id="exclude-transients" type="checkbox" value="1" autocomplete="off" name="exclude_transients"<?php $this->maybe_checked( $loaded_profile['exclude_transients'] ); ?> />
263
  Exclude <a href="https://codex.wordpress.org/Transients_API" target="_blank">transients</a> (temporary cached data)
264
+ </label>
265
+ </li>
266
+ <li class="compatibility-older-mysql">
267
+ <label for="compatibility-older-mysql">
268
+ <input id="compatibility-older-mysql" type="checkbox" value="1" autocomplete="off" name="compatibility_older_mysql"<?php $this->maybe_checked( $loaded_profile['compatibility_older_mysql'] ); ?> />
269
+ <?php _e( 'Compatible with older versions of MySQL (pre-5.5)', 'wp-migrate-db' ); ?>
270
+ </label>
271
+ </li>
272
+ <?php $this->template_part( array( 'exclude_post_revisions' ), $loaded_profile ); ?>
273
+ </ul>
274
 
 
275
  </div>
276
+ </div>
277
 
278
+ <?php $this->template_part( array( 'backup' ), $loaded_profile ); ?>
279
 
280
+ <?php do_action( 'wpmdb_after_advanced_options' ); ?>
281
 
282
+ <div class="option-section save-migration-profile-wrap">
283
+ <label for="save-migration-profile" class="save-migration-profile checkbox-label">
284
+ <input id="save-migration-profile" type="checkbox" value="1" name="save_migration_profile"<?php echo( ! $is_default_profile ? ' checked="checked"' : '' ); ?> />
285
  <?php _e( 'Save Migration Profile', 'wp-migrate-db' ); ?><span class="option-description"><?php _e( 'Save the above settings for the next time you do a similiar migration', 'wp-migrate-db' ); ?></span>
286
+ </label>
287
 
288
+ <div class="indent-wrap expandable-content">
289
+ <ul class="option-group">
290
+ <?php
291
+ foreach ( $this->settings['profiles'] as $profile_id => $profile ) {
292
+ ++ $profile_id;
 
 
 
 
 
 
 
293
  ?>
294
  <li>
295
+ <span class="delete-profile" data-profile-id="<?php echo esc_attr( $profile_id ); ?>"></span>
296
+ <label for="profile-<?php echo esc_attr( $profile_id ); ?>">
297
+ <input id="profile-<?php echo esc_attr( $profile_id ); ?>" type="radio" value="<?php echo esc_attr( -- $profile_id ); ?>" name="save_migration_profile_option"<?php echo ( $loaded_profile['name'] == $profile['name'] ) ? ' checked="checked"' : ''; ?> />
298
+ <?php echo esc_html( $profile['name'] ); ?>
299
  </label>
 
300
  </li>
301
+ <?php
302
+ }
303
+ ?>
304
+ <li>
305
+ <label for="create_new" class="create-new-label">
306
+ <input id="create_new" type="radio" value="new" name="save_migration_profile_option"<?php echo( $is_default_profile ? ' checked="checked"' : '' ); ?> />
307
+ <?php _e( 'Create new profile', 'wp-migrate-db' ); ?>
308
+ </label>
309
+ <input type="text" placeholder="e.g. Live Site" name="create_new_profile" class="create-new-profile"/>
310
+ </li>
311
+ </ul>
312
  </div>
313
+ </div>
314
 
315
+ <div class="notification-message warning-notice prefix-notice pull">
316
+ <h4><?php _e( 'Warning: Different Table Prefixes', 'wp-migrate-db' ); ?></h4>
317
 
318
+ <p><?php _e( 'Whoa! We\'ve detected that the database table prefix differs between installations. Clicking the Migrate button below will create new database tables in your local database with prefix "<span class="remote-prefix"></span>".', 'wp-migrate-db' ); ?></p>
319
 
320
+ <p><?php printf( __( 'However, your local install is configured to use table prefix "%1$s" and will ignore the migrated tables. So, <b>AFTER</b> migration is complete, you will need to edit your local install\'s wp-config.php and change the "%1$s" variable to "<span class="remote-prefix"></span>".', 'wp-migrate-db' ), $wpdb->prefix, $wpdb->prefix ); ?></p>
321
 
322
+ <p><?php _e( 'This will allow your local install the use the migrated tables. Once you do this, you shouldn\'t have to do it again.', 'wp-migrate-db' ); ?></p>
323
+ </div>
324
 
325
+ <div class="notification-message warning-notice prefix-notice push">
326
+ <h4><?php _e( 'Warning: Different Table Prefixes', 'wp-migrate-db' ); ?></h4>
327
 
328
+ <p><?php printf( __( 'Whoa! We\'ve detected that the database table prefix differs between installations. Clicking the Migrate button below will create new database tables in the remote database with prefix "%s".', 'wp-migrate-db' ), $wpdb->prefix ); ?></p>
329
 
330
+ <p><?php printf( __( 'However, your remote install is configured to use table prefix "<span class="remote-prefix"></span>" and will ignore the migrated tables. So, <b>AFTER</b> migration is complete, you will need to edit your remote install\'s wp-config.php and change the "<span class="remote-prefix"></span>" variable to "%s".', 'wp-migrate-db' ), $wpdb->prefix ); ?></p>
331
 
332
+ <p><?php _e( 'This will allow your remote install the use the migrated tables. Once you do this, you shouldn\'t have to do it again.', 'wp-migrate-db' ); ?></p>
333
+ </div>
334
 
335
+ <div class="notification-message warning-notice mixed-case-table-name-notice pull">
336
+ <?php echo $this->mixed_case_table_name_warning( 'pull' ); ?>
337
+ </div>
 
 
338
 
339
+ <div class="notification-message warning-notice mixed-case-table-name-notice push">
340
+ <?php echo $this->mixed_case_table_name_warning( 'push' ); ?>
341
  </div>
342
 
343
+ <p class="migrate-db">
344
+ <input type="hidden" class="remote-json-data" name="remote_json_data" autocomplete="off"/>
345
+ <input class="button-primary migrate-db-button" type="submit" value="Migrate" name="Submit" autocomplete="off"/>
346
+ <input class="button save-settings-button" type="submit" value="Save Profile" name="submit_save_profile" autocomplete="off"/>
347
+ </p>
348
+
349
+ </div>
350
 
351
  </form>
352
  <?php $this->template( 'migrate-progress' ); ?>
353
 
354
+ </div> <!-- end .migrate-tab -->
template/options.php CHANGED
@@ -1,6 +1,7 @@
1
  <div class="wrap wpmdb">
2
 
3
- <div id="icon-tools" class="icon32"><br /></div><h2><?php echo $this->get_plugin_title(); ?></h2>
 
4
 
5
  <h2 class="nav-tab-wrapper">
6
  <?php $this->plugin_tabs(); ?>
@@ -10,7 +11,9 @@
10
 
11
  <?php
12
  $hide_warning = apply_filters( 'wpmdb_hide_safe_mode_warning', false );
13
- if ( function_exists( 'ini_get' ) && ini_get( 'safe_mode' ) && !$hide_warning ) { ?>
 
 
14
  <div class="updated warning inline-message">
15
  <?php
16
  _e( "<strong>PHP Safe Mode Enabled</strong> &mdash; We do not officially support running this plugin in safe mode because <code>set_time_limit()</code> has no effect. Therefore we can't extend the run time of the script and ensure it doesn't time out before the migration completes. We haven't disabled the plugin however, so you're free to cross your fingers and hope for the best. However, if you have trouble, we can't help you until you turn off safe mode.", 'wp-migrate-db' );
@@ -18,7 +21,7 @@
18
  printf( __( 'Your current PHP run time limit is set to %s seconds.', 'wp-migrate-db' ), ini_get( 'max_execution_time' ) );
19
  } ?>
20
  </div>
21
- <?php
22
  }
23
  ?>
24
 
@@ -28,7 +31,7 @@
28
 
29
  <?php
30
  $hide_warning = apply_filters( 'wpmdb_hide_set_time_limit_warning', false );
31
- if ( false == $this->set_time_limit_available() && !$hide_warning && !$safe_mode ) {
32
  ?>
33
  <div class="updated warning inline-message">
34
  <?php
@@ -37,7 +40,7 @@
37
  printf( __( 'Your current PHP run time limit is set to %s seconds.', 'wp-migrate-db' ), ini_get( 'max_execution_time' ) );
38
  } ?>
39
  </div>
40
- <?php
41
  }
42
  ?>
43
 
@@ -57,6 +60,7 @@
57
  $this->template_part( array( 'sidebar' ) );
58
  ?>
59
 
60
- </div> <!-- end #wpmdb-main -->
 
61
 
62
  </div> <!-- end .wrap -->
1
  <div class="wrap wpmdb">
2
 
3
+ <div id="icon-tools" class="icon32"><br/></div>
4
+ <h2><?php echo $this->get_plugin_title(); ?></h2>
5
 
6
  <h2 class="nav-tab-wrapper">
7
  <?php $this->plugin_tabs(); ?>
11
 
12
  <?php
13
  $hide_warning = apply_filters( 'wpmdb_hide_safe_mode_warning', false );
14
+ $safe_mode = ( function_exists( 'ini_get' ) && ini_get( 'safe_mode' ) );
15
+ if ( $safe_mode && ! $hide_warning ) {
16
+ ?>
17
  <div class="updated warning inline-message">
18
  <?php
19
  _e( "<strong>PHP Safe Mode Enabled</strong> &mdash; We do not officially support running this plugin in safe mode because <code>set_time_limit()</code> has no effect. Therefore we can't extend the run time of the script and ensure it doesn't time out before the migration completes. We haven't disabled the plugin however, so you're free to cross your fingers and hope for the best. However, if you have trouble, we can't help you until you turn off safe mode.", 'wp-migrate-db' );
21
  printf( __( 'Your current PHP run time limit is set to %s seconds.', 'wp-migrate-db' ), ini_get( 'max_execution_time' ) );
22
  } ?>
23
  </div>
24
+ <?php
25
  }
26
  ?>
27
 
31
 
32
  <?php
33
  $hide_warning = apply_filters( 'wpmdb_hide_set_time_limit_warning', false );
34
+ if ( false == $this->set_time_limit_available() && ! $hide_warning && ! $safe_mode ) {
35
  ?>
36
  <div class="updated warning inline-message">
37
  <?php
40
  printf( __( 'Your current PHP run time limit is set to %s seconds.', 'wp-migrate-db' ), ini_get( 'max_execution_time' ) );
41
  } ?>
42
  </div>
43
+ <?php
44
  }
45
  ?>
46
 
60
  $this->template_part( array( 'sidebar' ) );
61
  ?>
62
 
63
+ </div>
64
+ <!-- end #wpmdb-main -->
65
 
66
  </div> <!-- end .wrap -->
template/profile.php CHANGED
@@ -1,9 +1,17 @@
1
  <div class="migrate-tab content-tab">
2
  <p class="saved-migration-profile-label"><?php _e( 'Would you like to use a saved migration profile?', 'wp-migrate-db' ); ?></p>
3
  <ul class="migration-profile-options">
4
- <?php foreach( $this->settings['profiles'] as $key => $profile ) { ++$key ?>
5
- <li><a href="<?php echo $this->plugin_base . '&wpmdb-profile=' . $key; ?>"><?php printf( '%s - %s', $key, $profile['name'] ); ?></a><span class="main-list-delete-profile-link" data-profile-id="<?php echo $key; ?>">&times;</span></li>
 
 
 
 
 
 
6
  <?php } ?>
7
- <li><a href="<?php echo $this->plugin_base . '&wpmdb-profile=-1'; ?>"><?php _e( 'Nope, let\'s start fresh...', 'wp-migrate-db' ); ?></a></li>
 
 
8
  </ul>
9
- </div>
1
  <div class="migrate-tab content-tab">
2
  <p class="saved-migration-profile-label"><?php _e( 'Would you like to use a saved migration profile?', 'wp-migrate-db' ); ?></p>
3
  <ul class="migration-profile-options">
4
+ <?php
5
+ foreach ( $this->settings['profiles'] as $key => $profile ) {
6
+ ++ $key
7
+ ?>
8
+ <li>
9
+ <a href="<?php echo $this->plugin_base . '&wpmdb-profile=' . $key; ?>"><?php printf( '%s - %s', $key, esc_html( $profile['name'] ) ); ?></a>
10
+ <span class="main-list-delete-profile-link" data-profile-id="<?php echo $key; ?>">&times;</span>
11
+ </li>
12
  <?php } ?>
13
+ <li>
14
+ <a href="<?php echo $this->plugin_base . '&wpmdb-profile=-1'; ?>"><?php _e( 'Nope, let\'s start fresh...', 'wp-migrate-db' ); ?></a>
15
+ </li>
16
  </ul>
17
+ </div>
template/wpmdb/exclude-post-revisions.php CHANGED
@@ -1,6 +1,6 @@
1
  <li>
2
  <label for="exclude-post-revisions">
3
- <input id="exclude-post-revisions" type="checkbox" autocomplete="off" value="1" name="exclude_post_revisions"<?php echo ( in_array( 'revision', $loaded_profile['select_post_types'] ) ) ? ' checked="checked"' : ''; ?> />
4
- <?php _e( 'Exclude post revisions', 'wp-migrate-db' ); ?>
5
  </label>
6
  </li>
1
  <li>
2
  <label for="exclude-post-revisions">
3
+ <input id="exclude-post-revisions" type="checkbox" autocomplete="off" value="1" name="exclude_post_revisions"<?php echo ( in_array( 'revision', $loaded_profile['select_post_types'] ) ) ? ' checked="checked"' : ''; ?> />
4
+ <?php _e( 'Exclude post revisions', 'wp-migrate-db' ); ?>
5
  </label>
6
  </li>
template/wpmdb/progress-upgrade.php CHANGED
@@ -8,8 +8,10 @@
8
  </ul>
9
 
10
  <p class="pro-quote">
11
- <strong>&#8220;<?php _e( 'Within a few hours WP Migrate DB Pro has paid for itself!', 'wp-migrate-db' ); ?>&#8221;</strong>
12
- <span class="pro-quote-author">&mdash; Eric Wagner <span class="dashicons dashicons-star-filled"></span><span class="dashicons dashicons-star-filled"></span><span class="dashicons dashicons-star-filled"></span><span class="dashicons dashicons-star-filled"></span><span class="dashicons dashicons-star-filled"></span></span>
 
 
13
  </p>
14
 
15
  <a class="button" href="https://deliciousbrains.com/wp-migrate-db-pro/?utm_source=insideplugin&utm_medium=web&utm_content=progress-bar&utm_campaign=freeplugin" target="_blank"><?php _e( 'More About The Pro Version', 'wp-migrate-db' ); ?> &rarr;</a>
8
  </ul>
9
 
10
  <p class="pro-quote">
11
+ <strong>&#8220;<?php _e( 'Within a few hours WP Migrate DB Pro has paid for itself!', 'wp-migrate-db' ); ?> &#8221;</strong>
12
+ <span class="pro-quote-author">
13
+ &mdash; Eric Wagner <span class="dashicons dashicons-star-filled"></span><span class="dashicons dashicons-star-filled"></span><span class="dashicons dashicons-star-filled"></span><span class="dashicons dashicons-star-filled"></span><span class="dashicons dashicons-star-filled"></span>
14
+ </span>
15
  </p>
16
 
17
  <a class="button" href="https://deliciousbrains.com/wp-migrate-db-pro/?utm_source=insideplugin&utm_medium=web&utm_content=progress-bar&utm_campaign=freeplugin" target="_blank"><?php _e( 'More About The Pro Version', 'wp-migrate-db' ); ?> &rarr;</a>
template/wpmdb/sidebar.php CHANGED
@@ -8,30 +8,41 @@
8
  <?php $user = wp_get_current_user(); ?>
9
 
10
  <p class="interesting">
11
- <?php _e( 'Submit your name and email and we&#8217;ll send you a coupon for 20% off your upgrade to the pro version.', 'wp-migrate-db' ); ?>
12
  </p>
13
 
14
  <div class="field notify-name">
15
- <input type="text" name="cm-name" value="<?php echo trim( esc_attr( $user->first_name ) . ' ' . esc_attr( $user->last_name ) ); ?>" placeholder="<?php _e( 'Your Name', 'wp-migrate-db' ); ?>" />
16
  </div>
17
 
18
  <div class="field notify-email">
19
- <input type="email" name="cm-virn-virn" value="<?php echo esc_attr( $user->user_email ); ?>" placeholder="<?php _e( 'Your Email', 'wp-migrate-db' ); ?>" />
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>
25
 
26
  <p class="promise">
27
- <?php _e( 'We promise we will not use your email for anything else and you can unsubscribe with <span style="white-space: nowrap;">1-click anytime</span>.', 'wp-migrate-db' ); ?>
28
  </p>
29
  </form>
30
 
31
  <div class="block testimonial">
32
- <p class="stars"><span class="dashicons dashicons-star-filled"></span><span class="dashicons dashicons-star-filled"></span><span class="dashicons dashicons-star-filled"></span><span class="dashicons dashicons-star-filled"></span><span class="dashicons dashicons-star-filled"></span></p>
33
- <p class="quote">&#8220;<?php _e( 'WOW. WP Migrate DB Pro has made our local/live development a breeze. What a brilliant plugin. Worth every penny.', 'wp-migrate-db' ); ?>&#8221;</p>
 
 
 
 
 
 
 
 
 
 
34
  <p class="author">&mdash; Boxy Studio</p>
 
35
  <p class="via"><a target="_blank" href="https://twitter.com/BoxyStudio/status/458965600434675712">via Twitter</a></p>
36
  </div>
37
  </div>
8
  <?php $user = wp_get_current_user(); ?>
9
 
10
  <p class="interesting">
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 notify-name">
15
+ <input type="text" name="cm-name" value="<?php echo trim( esc_attr( $user->first_name ) . ' ' . esc_attr( $user->last_name ) ); ?>" placeholder="<?php _e( 'Your Name', 'wp-migrate-db' ); ?>"/>
16
  </div>
17
 
18
  <div class="field notify-email">
19
+ <input type="email" name="cm-virn-virn" value="<?php echo esc_attr( $user->user_email ); ?>" placeholder="<?php _e( 'Your Email', 'wp-migrate-db' ); ?>"/>
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>
25
 
26
  <p class="promise">
27
+ <?php _e( 'We promise we will not use your email for anything else and you can unsubscribe with 1-click anytime.', 'wp-migrate-db' ); ?>
28
  </p>
29
  </form>
30
 
31
  <div class="block testimonial">
32
+ <p class="stars">
33
+ <span class="dashicons dashicons-star-filled"></span>
34
+ <span class="dashicons dashicons-star-filled"></span>
35
+ <span class="dashicons dashicons-star-filled"></span>
36
+ <span class="dashicons dashicons-star-filled"></span>
37
+ <span class="dashicons dashicons-star-filled"></span>
38
+ </p>
39
+
40
+ <p class="quote">
41
+ &#8220;<?php _e( 'WOW. WP Migrate DB Pro has made our local/live development a breeze. What a brilliant plugin. Worth every penny.', 'wp-migrate-db' ); ?>&#8221;
42
+ </p>
43
+
44
  <p class="author">&mdash; Boxy Studio</p>
45
+
46
  <p class="via"><a target="_blank" href="https://twitter.com/BoxyStudio/status/458965600434675712">via Twitter</a></p>
47
  </div>
48
  </div>
template/wpmdb/wordpress-org-support.php CHANGED
@@ -1,5 +1,5 @@
1
  <div class="support">
2
- <h3><?php _e( 'Support', 'wp-migrate-db' ); ?></h3>
3
 
4
  <p><?php _e( 'As this is a free plugin, we do not provide support.', 'wp-migrate-db' ); ?></p>
5
 
1
  <div class="support">
2
+ <h3><?php _ex( 'Support', 'Get help from the community', 'wp-migrate-db' ); ?></h3>
3
 
4
  <p><?php _e( 'As this is a free plugin, we do not provide support.', 'wp-migrate-db' ); ?></p>
5
 
wp-migrate-db.php CHANGED
@@ -4,7 +4,7 @@ Plugin Name: WP Migrate DB
4
  Plugin URI: http://wordpress.org/plugins/wp-migrate-db/
5
  Description: Exports your database as a MySQL data dump (much like phpMyAdmin), does a find and replace on URLs and file paths, then allows you to save it to your computer.
6
  Author: Delicious Brains
7
- Version: 0.6
8
  Author URI: http://deliciousbrains.com
9
  Network: True
10
  Text Domain: wp-migrate-db
@@ -22,22 +22,12 @@ Domain Path: /languages/
22
  // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
23
  // **********************************************************************
24
 
25
- $GLOBALS['wpmdb_meta']['wp-migrate-db']['version'] = '0.6';
26
 
27
  if ( ! class_exists( 'WPMDB_Utils' ) ) {
28
  require dirname( __FILE__ ) . '/class/wpmdb-utils.php';
29
  }
30
 
31
- // Define the directory seperator if it isn't already
32
- if( !defined( 'DS' ) ) {
33
- if (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN') {
34
- define('DS', '\\');
35
- }
36
- else {
37
- define('DS', '/');
38
- }
39
- }
40
-
41
  function wp_migrate_db_loaded() {
42
  // exit quickly unless: standalone admin; multisite network admin; one of our AJAX calls
43
  if ( ! is_admin() || ( is_multisite() && ! is_network_admin() && ! WPMDB_Utils::is_ajax() ) ) {
@@ -45,15 +35,8 @@ function wp_migrate_db_loaded() {
45
  }
46
  wp_migrate_db();
47
  }
48
- add_action( 'plugins_loaded', 'wp_migrate_db_loaded' );
49
 
50
- function wp_migrate_db_init() {
51
- // if neither WordPress admin nor running from wp-cli, exit quickly to prevent performance impact
52
- if ( !is_admin() && ! ( defined( 'WP_CLI' ) && WP_CLI ) ) return;
53
-
54
- load_plugin_textdomain( 'wp-migrate-db', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
55
- }
56
- add_action( 'init', 'wp_migrate_db_init' );
57
 
58
  /**
59
  * Populate the $wpmdb global with an instance of the WPMDB class and return it.
@@ -71,8 +54,9 @@ function wp_migrate_db() {
71
 
72
  require_once $abspath . '/class/wpmdb-base.php';
73
  require_once $abspath . '/class/wpmdb.php';
 
74
 
75
  $wpmdb = new WPMDB( __FILE__ );
76
 
77
  return $wpmdb;
78
- }
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.6.1
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.6.1';
26
 
27
  if ( ! class_exists( 'WPMDB_Utils' ) ) {
28
  require dirname( __FILE__ ) . '/class/wpmdb-utils.php';
29
  }
30
 
 
 
 
 
 
 
 
 
 
 
31
  function wp_migrate_db_loaded() {
32
  // exit quickly unless: standalone admin; multisite network admin; one of our AJAX calls
33
  if ( ! is_admin() || ( is_multisite() && ! is_network_admin() && ! WPMDB_Utils::is_ajax() ) ) {
35
  }
36
  wp_migrate_db();
37
  }
 
38
 
39
+ add_action( 'plugins_loaded', 'wp_migrate_db_loaded' );
 
 
 
 
 
 
40
 
41
  /**
42
  * Populate the $wpmdb global with an instance of the WPMDB class and return it.
54
 
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
+ }