All-in-One WP Migration - Version 6.69

Version Description

Added

  • Support for RTL languages
  • Disable My Custom Widgets, WPS Hide Login and Endurance Page Cache plugins after restoring a backup

Changed

  • Text on import steps
Download this release

Release Info

Developer bangelov
Plugin Icon 128x128 All-in-One WP Migration
Version 6.69
Comparing to
See all releases

Code changes from version 6.68 to 6.69

Files changed (91) hide show
  1. all-in-one-wp-migration.php +1 -6
  2. constants.php +31 -1
  3. exceptions.php +2 -0
  4. functions.php +79 -1
  5. lib/controller/class-ai1wm-export-controller.php +1 -5
  6. lib/controller/class-ai1wm-import-controller.php +1 -5
  7. lib/controller/class-ai1wm-main-controller.php +180 -106
  8. lib/model/class-ai1wm-deprecated.php +0 -2
  9. lib/model/class-ai1wm-extensions.php +11 -11
  10. lib/model/class-ai1wm-feedback.php +3 -2
  11. lib/model/class-ai1wm-report.php +3 -2
  12. lib/model/export/class-ai1wm-export-config-file.php +115 -0
  13. lib/model/export/class-ai1wm-export-config.php +4 -10
  14. lib/model/export/class-ai1wm-export-content.php +44 -10
  15. lib/model/export/class-ai1wm-export-database-file.php +24 -5
  16. lib/model/export/class-ai1wm-export-download.php +1 -1
  17. lib/model/export/class-ai1wm-export-enumerate.php +14 -14
  18. lib/model/import/class-ai1wm-import-confirm.php +1 -0
  19. lib/model/import/class-ai1wm-import-content.php +43 -31
  20. lib/model/import/class-ai1wm-import-database.php +178 -92
  21. lib/model/import/class-ai1wm-import-done.php +6 -0
  22. lib/model/import/class-ai1wm-import-mu-plugins.php +7 -1
  23. lib/model/import/class-ai1wm-import-validate.php +28 -18
  24. lib/vendor/servmask/archiver/class-ai1wm-archiver.php +22 -7
  25. lib/vendor/servmask/archiver/class-ai1wm-extractor.php +19 -10
  26. lib/vendor/servmask/command/class-ai1wm-wp-cli-command.php +1 -1
  27. lib/vendor/servmask/cron/class-ai1wm-cron.php +13 -13
  28. lib/vendor/servmask/database/class-ai1wm-database.php +2 -14
  29. lib/view/assets/css/backups.min.css +1 -1
  30. lib/view/assets/css/backups.min.rtl.css +1 -0
  31. lib/view/assets/css/common.min.css +1 -0
  32. lib/view/assets/css/export.min.css +1 -1
  33. lib/view/assets/css/export.min.rtl.css +1 -0
  34. lib/view/assets/css/import.min.css +1 -1
  35. lib/view/assets/css/import.min.rtl.css +1 -0
  36. lib/view/assets/css/servmask.min.css +1 -0
  37. lib/view/assets/css/servmask.min.rtl.css +1 -0
  38. lib/view/assets/css/updater.min.css +1 -1
  39. lib/view/assets/css/updater.min.rtl.css +1 -0
  40. lib/view/assets/javascript/backups.min.js +213 -269
  41. lib/view/assets/javascript/export.min.js +185 -446
  42. lib/view/assets/javascript/feedback.min.js +268 -0
  43. lib/view/assets/javascript/import.min.js +487 -727
  44. lib/view/assets/javascript/report.min.js +235 -0
  45. lib/view/assets/javascript/updater.min.js +25 -11
  46. lib/view/assets/javascript/util.min.js +215 -0
  47. lib/view/backups/index.php +11 -8
  48. lib/view/common/http-authentication.php +23 -1
  49. lib/view/common/leave-feedback.php +27 -2
  50. lib/view/common/maintenance-mode.php +23 -1
  51. lib/view/common/report-problem.php +29 -3
  52. lib/view/common/share-buttons.php +26 -0
  53. lib/view/export/advanced-settings.php +29 -5
  54. lib/view/export/button-box.php +27 -1
  55. lib/view/export/button-digitalocean.php +27 -1
  56. lib/view/export/button-dropbox.php +27 -1
  57. lib/view/export/button-file.php +26 -0
  58. lib/view/export/button-ftp.php +27 -1
  59. lib/view/export/button-gdrive.php +27 -1
  60. lib/view/export/button-mega.php +27 -1
  61. lib/view/export/button-onedrive.php +27 -1
  62. lib/view/export/button-s3.php +27 -1
  63. lib/view/export/export-buttons.php +26 -0
  64. lib/view/export/find-replace.php +28 -1
  65. lib/view/export/help-section.php +26 -0
  66. lib/view/export/index.php +4 -1
  67. lib/view/import/button-box.php +27 -1
  68. lib/view/import/button-digitalocean.php +27 -1
  69. lib/view/import/button-dropbox.php +27 -1
  70. lib/view/import/button-file.php +26 -0
  71. lib/view/import/button-ftp.php +27 -1
  72. lib/view/import/button-gdrive.php +27 -1
  73. lib/view/import/button-mega.php +27 -1
  74. lib/view/import/button-onedrive.php +27 -1
  75. lib/view/import/button-s3.php +27 -1
  76. lib/view/import/button-url.php +27 -1
  77. lib/view/import/import-buttons.php +26 -0
  78. lib/view/import/index.php +4 -1
  79. lib/view/main/admin-head.php +31 -5
  80. lib/view/main/backups-htaccess-notice.php +26 -0
  81. lib/view/main/backups-index-notice.php +26 -0
  82. lib/view/main/backups-path-notice.php +26 -0
  83. lib/view/main/backups-webconfig-notice.php +26 -0
  84. lib/view/main/get-support.php +26 -0
  85. lib/view/main/multisite-notice.php +26 -0
  86. lib/view/main/storage-index-notice.php +26 -0
  87. lib/view/main/storage-path-notice.php +26 -0
  88. lib/view/updater/check.php +27 -1
  89. lib/view/updater/modal.php +31 -5
  90. loader.php +5 -1
  91. readme.txt +12 -1
all-in-one-wp-migration.php CHANGED
@@ -5,7 +5,7 @@
5
* Description: Migration tool for all your blog data. Import or Export your blog content with a single click.
6
* Author: ServMask
7
* Author URI: https://servmask.com/
8
- * Version: 6.68
9
* Text Domain: all-in-one-wp-migration
10
* Domain Path: /languages
11
* Network: True
@@ -33,11 +33,6 @@
33
* ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝
34
*/
35
36
- @ignore_user_abort( true );
37
- @set_time_limit( 0 );
38
- @ini_set( 'max_input_time', '-1' );
39
- @ini_set( 'pcre.backtrack_limit', PHP_INT_MAX );
40
-
41
// Check SSL Mode
42
if ( isset( $_SERVER['HTTP_X_FORWARDED_PROTO'] ) && ( $_SERVER['HTTP_X_FORWARDED_PROTO'] === 'https' ) ) {
43
$_SERVER['HTTPS'] = 'on';
5
* Description: Migration tool for all your blog data. Import or Export your blog content with a single click.
6
* Author: ServMask
7
* Author URI: https://servmask.com/
8
+ * Version: 6.69
9
* Text Domain: all-in-one-wp-migration
10
* Domain Path: /languages
11
* Network: True
33
* ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝
34
*/
35
36
// Check SSL Mode
37
if ( isset( $_SERVER['HTTP_X_FORWARDED_PROTO'] ) && ( $_SERVER['HTTP_X_FORWARDED_PROTO'] === 'https' ) ) {
38
$_SERVER['HTTPS'] = 'on';
constants.php CHANGED
@@ -31,7 +31,7 @@ define( 'AI1WM_DEBUG', false );
31
// ==================
32
// = Plugin Version =
33
// ==================
34
- define( 'AI1WM_VERSION', '6.68' );
35
36
// ===============
37
// = Plugin Name =
@@ -148,6 +148,16 @@ define( 'AI1WM_MULTISITE_NAME', 'multisite.json' );
148
// ======================
149
define( 'AI1WM_BLOGS_NAME', 'blogs.json' );
150
151
// ========================
152
// = Archive FileMap Name =
153
// ========================
@@ -158,6 +168,21 @@ define( 'AI1WM_FILEMAP_NAME', 'filemap.list' );
158
// =================================
159
define( 'AI1WM_MUPLUGINS_NAME', 'mu-plugins' );
160
161
// ===================
162
// = Export Log Name =
163
// ===================
@@ -228,6 +253,11 @@ define( 'AI1WM_ACTIVE_TEMPLATE', 'template' );
228
// =====================
229
define( 'AI1WM_ACTIVE_STYLESHEET', 'stylesheet' );
230
231
// ===============
232
// = Updater Key =
233
// ===============
31
// ==================
32
// = Plugin Version =
33
// ==================
34
+ define( 'AI1WM_VERSION', '6.69' );
35
36
// ===============
37
// = Plugin Name =
148
// ======================
149
define( 'AI1WM_BLOGS_NAME', 'blogs.json' );
150
151
+ // =========================
152
+ // = Archive Settings Name =
153
+ // =========================
154
+ define( 'AI1WM_SETTINGS_NAME', 'settings.json' );
155
+
156
+ // ==========================
157
+ // = Archive Multipart Name =
158
+ // ==========================
159
+ define( 'AI1WM_MULTIPART_NAME', 'multipart.list' );
160
+
161
// ========================
162
// = Archive FileMap Name =
163
// ========================
168
// =================================
169
define( 'AI1WM_MUPLUGINS_NAME', 'mu-plugins' );
170
171
+ // =============================
172
+ // = Endurance Page Cache Name =
173
+ // =============================
174
+ define( 'AI1WM_ENDURANCE_PAGE_CACHE_NAME', 'endurance-page-cache.php' );
175
+
176
+ // ===========================
177
+ // = Endurance PHP Edge Name =
178
+ // ===========================
179
+ define( 'AI1WM_ENDURANCE_PHP_EDGE_NAME', 'endurance-php-edge.php' );
180
+
181
+ // ================================
182
+ // = Endurance Browser Cache Name =
183
+ // ================================
184
+ define( 'AI1WM_ENDURANCE_BROWSER_CACHE_NAME', 'endurance-browser-cache.php' );
185
+
186
// ===================
187
// = Export Log Name =
188
// ===================
253
// =====================
254
define( 'AI1WM_ACTIVE_STYLESHEET', 'stylesheet' );
255
256
+ // ============
257
+ // = Cron Key =
258
+ // ============
259
+ define( 'AI1WM_CRON', 'cron' );
260
+
261
// ===============
262
// = Updater Key =
263
// ===============
exceptions.php CHANGED
@@ -34,6 +34,8 @@ class Ai1wm_Not_Seekable_Exception extends Exception {}
34
class Ai1wm_Not_Tellable_Exception extends Exception {}
35
class Ai1wm_Not_Readable_Exception extends Exception {}
36
class Ai1wm_Not_Writable_Exception extends Exception {}
37
class Ai1wm_Not_Found_Exception extends Exception {}
38
class Ai1wm_Not_Directory_Exception extends Exception {}
39
class Ai1wm_Not_Valid_Secret_Key_Exception extends Exception {}
34
class Ai1wm_Not_Tellable_Exception extends Exception {}
35
class Ai1wm_Not_Readable_Exception extends Exception {}
36
class Ai1wm_Not_Writable_Exception extends Exception {}
37
+ class Ai1wm_Not_Truncatable_Exception extends Exception {}
38
+ class Ai1wm_Not_Closable_Exception extends Exception {}
39
class Ai1wm_Not_Found_Exception extends Exception {}
40
class Ai1wm_Not_Directory_Exception extends Exception {}
41
class Ai1wm_Not_Valid_Secret_Key_Exception extends Exception {}
functions.php CHANGED
@@ -106,6 +106,16 @@ function ai1wm_import_path( $params ) {
106
return ai1wm_storage_path( $params ) . DIRECTORY_SEPARATOR . AI1WM_IMPORT_NAME;
107
}
108
109
/**
110
* Get filemap.list absolute path
111
*
@@ -146,6 +156,16 @@ function ai1wm_blogs_path( $params ) {
146
return ai1wm_storage_path( $params ) . DIRECTORY_SEPARATOR . AI1WM_BLOGS_NAME;
147
}
148
149
/**
150
* Get database.sql absolute path
151
*
@@ -229,6 +249,26 @@ function ai1wm_database_bytes( $params ) {
229
return filesize( ai1wm_database_path( $params ) );
230
}
231
232
/**
233
* Get archive size as text
234
*
@@ -861,7 +901,6 @@ function ai1wm_cache_flush() {
861
wp_cache_delete( 'notoptions', 'options' );
862
}
863
864
-
865
/**
866
* URL encode
867
*
@@ -882,6 +921,21 @@ function ai1wm_urldecode( $value ) {
882
return is_array( $value ) ? array_map( 'ai1wm_urldecode', $value ) : urldecode( stripslashes( $value ) );
883
}
884
885
/**
886
* Opens a file in specified mode
887
*
@@ -1145,3 +1199,27 @@ function ai1wm_is_scheduled_backup() {
1145
return empty( $_REQUEST['ai1wm_manual_export'] ) && empty( $_REQUEST['ai1wm_manual_import'] ) && empty( $_REQUEST['ai1wm_manual_restore'] );
1146
}
1147
106
return ai1wm_storage_path( $params ) . DIRECTORY_SEPARATOR . AI1WM_IMPORT_NAME;
107
}
108
109
+ /**
110
+ * Get multipart.list absolute path
111
+ *
112
+ * @param array $params Request parameters
113
+ * @return string
114
+ */
115
+ function ai1wm_multipart_path( $params ) {
116
+ return ai1wm_storage_path( $params ) . DIRECTORY_SEPARATOR . AI1WM_MULTIPART_NAME;
117
+ }
118
+
119
/**
120
* Get filemap.list absolute path
121
*
156
return ai1wm_storage_path( $params ) . DIRECTORY_SEPARATOR . AI1WM_BLOGS_NAME;
157
}
158
159
+ /**
160
+ * Get settings.json absolute path
161
+ *
162
+ * @param array $params Request parameters
163
+ * @return string
164
+ */
165
+ function ai1wm_settings_path( $params ) {
166
+ return ai1wm_storage_path( $params ) . DIRECTORY_SEPARATOR . AI1WM_SETTINGS_NAME;
167
+ }
168
+
169
/**
170
* Get database.sql absolute path
171
*
249
return filesize( ai1wm_database_path( $params ) );
250
}
251
252
+ /**
253
+ * Get package size in bytes
254
+ *
255
+ * @param array $params Request parameters
256
+ * @return integer
257
+ */
258
+ function ai1wm_package_bytes( $params ) {
259
+ return filesize( ai1wm_package_path( $params ) );
260
+ }
261
+
262
+ /**
263
+ * Get multisite size in bytes
264
+ *
265
+ * @param array $params Request parameters
266
+ * @return integer
267
+ */
268
+ function ai1wm_multisite_bytes( $params ) {
269
+ return filesize( ai1wm_multisite_path( $params ) );
270
+ }
271
+
272
/**
273
* Get archive size as text
274
*
901
wp_cache_delete( 'notoptions', 'options' );
902
}
903
904
/**
905
* URL encode
906
*
921
return is_array( $value ) ? array_map( 'ai1wm_urldecode', $value ) : urldecode( stripslashes( $value ) );
922
}
923
924
+ /**
925
+ * Set URL scheme
926
+ *
927
+ * @param string $url URL value
928
+ * @param string $scheme URL scheme
929
+ * @return string
930
+ */
931
+ function ai1wm_urlscheme( $url, $scheme = '' ) {
932
+ if ( empty( $scheme ) ) {
933
+ return preg_replace( '#^\w+://#', '//', $url );
934
+ }
935
+
936
+ return preg_replace( '#^\w+://#', $scheme . '://', $url );
937
+ }
938
+
939
/**
940
* Opens a file in specified mode
941
*
1199
return empty( $_REQUEST['ai1wm_manual_export'] ) && empty( $_REQUEST['ai1wm_manual_import'] ) && empty( $_REQUEST['ai1wm_manual_restore'] );
1200
}
1201
1202
+ /**
1203
+ * PHP setup environment
1204
+ *
1205
+ * @return void
1206
+ */
1207
+ function ai1wm_setup_environment() {
1208
+ // Set whether a client disconnect should abort script execution
1209
+ @ignore_user_abort( true );
1210
+
1211
+ // Set maximum execution time
1212
+ @set_time_limit( 0 );
1213
+
1214
+ // Set maximum time in seconds a script is allowed to parse input data
1215
+ @ini_set( 'max_input_time', '-1' );
1216
+
1217
+ // Set maximum backtracking steps
1218
+ @ini_set( 'pcre.backtrack_limit', PHP_INT_MAX );
1219
+
1220
+ // Set error handler
1221
+ @set_error_handler( 'Ai1wm_Handler::error' );
1222
+
1223
+ // Set shutdown handler
1224
+ @register_shutdown_function( 'Ai1wm_Handler::shutdown' );
1225
+ }
lib/controller/class-ai1wm-export-controller.php CHANGED
@@ -32,11 +32,7 @@ class Ai1wm_Export_Controller {
32
public static function export( $params = array() ) {
33
global $wp_filter;
34
35
- // Set error handler
36
- @set_error_handler( 'Ai1wm_Handler::error' );
37
-
38
- // Set shutdown handler
39
- @register_shutdown_function( 'Ai1wm_Handler::shutdown' );
40
41
// Set params
42
if ( empty( $params ) ) {
32
public static function export( $params = array() ) {
33
global $wp_filter;
34
35
+ ai1wm_setup_environment();
36
37
// Set params
38
if ( empty( $params ) ) {
lib/controller/class-ai1wm-import-controller.php CHANGED
@@ -32,11 +32,7 @@ class Ai1wm_Import_Controller {
32
public static function import( $params = array() ) {
33
global $wp_filter;
34
35
- // Set error handler
36
- @set_error_handler( 'Ai1wm_Handler::error' );
37
-
38
- // Set shutdown handler
39
- @register_shutdown_function( 'Ai1wm_Handler::shutdown' );
40
41
// Set params
42
if ( empty( $params ) ) {
32
public static function import( $params = array() ) {
33
global $wp_filter;
34
35
+ ai1wm_setup_environment();
36
37
// Set params
38
if ( empty( $params ) ) {
lib/controller/class-ai1wm-main-controller.php CHANGED
@@ -86,17 +86,20 @@ class Ai1wm_Main_Controller {
86
// Export and import buttons
87
add_action( 'plugins_loaded', array( $this, 'ai1wm_buttons' ), 10 );
88
89
- // Add export scripts and styles
90
- add_action( 'admin_enqueue_scripts', array( $this, 'register_export_scripts_and_styles' ), 5 );
91
92
- // Add import scripts and styles
93
- add_action( 'admin_enqueue_scripts', array( $this, 'register_import_scripts_and_styles' ), 5 );
94
95
- // Add backups scripts and styles
96
- add_action( 'admin_enqueue_scripts', array( $this, 'register_backups_scripts_and_styles' ), 5 );
97
98
- // Add updater scripts and styles
99
- add_action( 'admin_enqueue_scripts', array( $this, 'register_updater_scripts_and_styles' ), 5 );
100
101
return $this;
102
}
@@ -133,6 +136,7 @@ class Ai1wm_Main_Controller {
133
134
add_filter( 'ai1wm_export', 'Ai1wm_Export_Archive::execute', 10 );
135
add_filter( 'ai1wm_export', 'Ai1wm_Export_Config::execute', 50 );
136
add_filter( 'ai1wm_export', 'Ai1wm_Export_Enumerate::execute', 100 );
137
add_filter( 'ai1wm_export', 'Ai1wm_Export_Content::execute', 150 );
138
add_filter( 'ai1wm_export', 'Ai1wm_Export_Database::execute', 200 );
@@ -363,88 +367,135 @@ class Ai1wm_Main_Controller {
363
* @return void
364
*/
365
public function admin_menu() {
366
- // top level WP Migration menu
367
add_menu_page(
368
'All-in-One WP Migration',
369
'All-in-One WP Migration',
370
'export',
371
- 'site-migration-export',
372
'Ai1wm_Export_Controller::index',
373
'',
374
'76.295'
375
);
376
377
- // sublevel Export menu
378
add_submenu_page(
379
- 'site-migration-export',
380
__( 'Export', AI1WM_PLUGIN_NAME ),
381
__( 'Export', AI1WM_PLUGIN_NAME ),
382
'export',
383
- 'site-migration-export',
384
'Ai1wm_Export_Controller::index'
385
);
386
387
- // sublevel Import menu
388
add_submenu_page(
389
- 'site-migration-export',
390
__( 'Import', AI1WM_PLUGIN_NAME ),
391
__( 'Import', AI1WM_PLUGIN_NAME ),
392
'import',
393
- 'site-migration-import',
394
'Ai1wm_Import_Controller::index'
395
);
396
397
- // sublevel Backups menu
398
add_submenu_page(
399
- 'site-migration-export',
400
__( 'Backups', AI1WM_PLUGIN_NAME ),
401
__( 'Backups', AI1WM_PLUGIN_NAME ),
402
'import',
403
- 'site-migration-backups',
404
'Ai1wm_Backups_Controller::index'
405
);
406
}
407
408
/**
409
- * Register scripts and styles for Export Controller
410
*
411
* @return void
412
*/
413
- public function register_export_scripts_and_styles( $hook ) {
414
- if ( stripos( 'toplevel_page_site-migration-export', $hook ) === false ) {
415
- return;
416
}
417
418
- do_action( 'ai1mw_register_export_scripts_and_styles' );
419
420
- // we don't want heartbeat to occur when exporting
421
wp_deregister_script( 'heartbeat' );
422
423
- // we don't want auth check for monitoring whether the user is still logged in
424
remove_action( 'admin_enqueue_scripts', 'wp_auth_check_load' );
425
426
- wp_enqueue_style(
427
- 'ai1wm-css-export',
428
- Ai1wm_Template::asset_link( 'css/export.min.css' )
429
- );
430
wp_enqueue_script(
431
- 'ai1wm-js-export',
432
Ai1wm_Template::asset_link( 'javascript/export.min.js' ),
433
- array( 'jquery' )
434
);
435
- wp_localize_script( 'ai1wm-js-export', 'ai1wm_feedback', array(
436
'ajax' => array(
437
'url' => wp_make_link_relative( admin_url( 'admin-ajax.php?action=ai1wm_feedback' ) ),
438
),
439
'secret_key' => get_option( AI1WM_SECRET_KEY ),
440
) );
441
- wp_localize_script( 'ai1wm-js-export', 'ai1wm_report', array(
442
'ajax' => array(
443
'url' => wp_make_link_relative( admin_url( 'admin-ajax.php?action=ai1wm_report' ) ),
444
),
445
'secret_key' => get_option( AI1WM_SECRET_KEY ),
446
) );
447
- wp_localize_script( 'ai1wm-js-export', 'ai1wm_export', array(
448
'ajax' => array(
449
'url' => wp_make_link_relative( admin_url( 'admin-ajax.php?action=ai1wm_export' ) ),
450
),
@@ -456,33 +507,55 @@ class Ai1wm_Main_Controller {
456
}
457
458
/**
459
- * Register scripts and styles for Import Controller
460
*
461
* @return void
462
*/
463
- public function register_import_scripts_and_styles( $hook ) {
464
- if ( stripos( 'all-in-one-wp-migration_page_site-migration-import', $hook ) === false ) {
465
return;
466
}
467
468
- do_action( 'ai1mw_register_import_scripts_and_styles' );
469
-
470
- // we don't want heartbeat to occur when importing
471
wp_deregister_script( 'heartbeat' );
472
473
- // we don't want auth check for monitoring whether the user is still logged in
474
remove_action( 'admin_enqueue_scripts', 'wp_auth_check_load' );
475
476
- wp_enqueue_style(
477
- 'ai1wm-css-import',
478
- Ai1wm_Template::asset_link( 'css/import.min.css' )
479
- );
480
wp_enqueue_script(
481
- 'ai1wm-js-import',
482
Ai1wm_Template::asset_link( 'javascript/import.min.js' ),
483
- array( 'jquery' )
484
);
485
- wp_localize_script( 'ai1wm-js-import', 'ai1wm_uploader', array(
486
'chunk_size' => apply_filters( 'ai1wm_max_chunk_size', AI1WM_MAX_CHUNK_SIZE ),
487
'max_retries' => apply_filters( 'ai1wm_max_chunk_retries', AI1WM_MAX_CHUNK_RETRIES ),
488
'url' => wp_make_link_relative( admin_url( 'admin-ajax.php?action=ai1wm_import' ) ),
@@ -495,19 +568,8 @@ class Ai1wm_Main_Controller {
495
'ai1wm_archive_size' => apply_filters( 'ai1wm_max_file_size', AI1WM_MAX_FILE_SIZE ),
496
),
497
) );
498
- wp_localize_script( 'ai1wm-js-import', 'ai1wm_feedback', array(
499
- 'ajax' => array(
500
- 'url' => wp_make_link_relative( admin_url( 'admin-ajax.php?action=ai1wm_feedback' ) ),
501
- ),
502
- 'secret_key' => get_option( AI1WM_SECRET_KEY ),
503
- ) );
504
- wp_localize_script( 'ai1wm-js-import', 'ai1wm_report', array(
505
- 'ajax' => array(
506
- 'url' => wp_make_link_relative( admin_url( 'admin-ajax.php?action=ai1wm_report' ) ),
507
- ),
508
- 'secret_key' => get_option( AI1WM_SECRET_KEY ),
509
- ) );
510
- wp_localize_script( 'ai1wm-js-import', 'ai1wm_import', array(
511
'ajax' => array(
512
'url' => wp_make_link_relative( admin_url( 'admin-ajax.php?action=ai1wm_import' ) ),
513
),
@@ -524,68 +586,65 @@ class Ai1wm_Main_Controller {
524
),
525
size_format( apply_filters( 'ai1wm_max_file_size', AI1WM_MAX_FILE_SIZE ) )
526
),
527
- 'invalid_extension' => sprintf(
528
- __(
529
- 'Version 2.1.1 of All in One WP Migration introduces new compression algorithm. ' .
530
- 'It makes exporting and importing 10 times faster.' .
531
- '<br />Unfortunately, the new format is not back compatible with backups made with earlier ' .
532
- 'versions of the plugin.' .
533
- '<br />You can either create a new backup with the latest version of the ' .
534
- 'plugin, or convert the archive to the new format using our tools ' .
535
- '<a href="%s" target="_blank">here</a>.',
536
- AI1WM_PLUGIN_NAME
537
- ),
538
- AI1WM_ARCHIVE_TOOLS_URL
539
),
540
) );
541
}
542
543
/**
544
- * Register scripts and styles for Backups Controller
545
*
546
* @return void
547
*/
548
- public function register_backups_scripts_and_styles( $hook ) {
549
- if ( stripos( 'all-in-one-wp-migration_page_site-migration-backups', $hook ) === false ) {
550
return;
551
}
552
553
- do_action( 'ai1mw_register_backups_scripts_and_styles' );
554
-
555
- // we don't want heartbeat to occur when restoring
556
wp_deregister_script( 'heartbeat' );
557
558
- // we don't want auth check for monitoring whether the user is still logged in
559
remove_action( 'admin_enqueue_scripts', 'wp_auth_check_load' );
560
561
- wp_enqueue_style(
562
- 'ai1wm-css-backups',
563
- Ai1wm_Template::asset_link( 'css/backups.min.css' )
564
- );
565
wp_enqueue_script(
566
- 'ai1wm-js-backups',
567
Ai1wm_Template::asset_link( 'javascript/backups.min.js' ),
568
- array( 'jquery' )
569
);
570
- wp_localize_script( 'ai1wm-js-backups', 'ai1wm_feedback', array(
571
'ajax' => array(
572
'url' => wp_make_link_relative( admin_url( 'admin-ajax.php?action=ai1wm_feedback' ) ),
573
),
574
'secret_key' => get_option( AI1WM_SECRET_KEY ),
575
) );
576
- wp_localize_script( 'ai1wm-js-backups', 'ai1wm_report', array(
577
'ajax' => array(
578
'url' => wp_make_link_relative( admin_url( 'admin-ajax.php?action=ai1wm_report' ) ),
579
),
580
'secret_key' => get_option( AI1WM_SECRET_KEY ),
581
) );
582
- wp_localize_script( 'ai1wm-js-backups', 'ai1wm_backups', array(
583
- 'ajax' => array(
584
- 'url' => wp_make_link_relative( admin_url( 'admin-ajax.php?action=ai1wm_backups' ) ),
585
- ),
586
- 'secret_key' => get_option( AI1WM_SECRET_KEY ),
587
- ) );
588
- wp_localize_script( 'ai1wm-js-backups', 'ai1wm_import', array(
589
'ajax' => array(
590
'url' => wp_make_link_relative( admin_url( 'admin-ajax.php?action=ai1wm_import' ) ),
591
),
@@ -594,30 +653,45 @@ class Ai1wm_Main_Controller {
594
),
595
'secret_key' => get_option( AI1WM_SECRET_KEY ),
596
) );
597
}
598
599
/**
600
- * Register scripts and styles for Updater Controller
601
*
602
* @return void
603
*/
604
- public function register_updater_scripts_and_styles( $hook ) {
605
if ( 'plugins.php' !== strtolower( $hook ) ) {
606
return;
607
}
608
609
- do_action( 'ai1mw_register_updater_scripts_and_styles' );
610
611
- wp_enqueue_style(
612
- 'ai1wm-css-updater',
613
- Ai1wm_Template::asset_link( 'css/updater.min.css' )
614
- );
615
wp_enqueue_script(
616
- 'ai1wm-js-updater',
617
Ai1wm_Template::asset_link( 'javascript/updater.min.js' ),
618
- array( 'jquery' )
619
);
620
- wp_localize_script( 'ai1wm-js-updater', 'ai1wm_updater', array(
621
'ajax' => array(
622
'url' => wp_make_link_relative( admin_url( 'admin-ajax.php?action=ai1wm_updater' ) ),
623
),
86
// Export and import buttons
87
add_action( 'plugins_loaded', array( $this, 'ai1wm_buttons' ), 10 );
88
89
+ // Register scripts and styles
90
+ add_action( 'admin_enqueue_scripts', array( $this, 'register_scripts_and_styles' ), 5 );
91
92
+ // Enqueue export scripts and styles
93
+ add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_export_scripts_and_styles' ), 5 );
94
95
+ // Enqueue import scripts and styles
96
+ add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_import_scripts_and_styles' ), 5 );
97
98
+ // Enqueue backups scripts and styles
99
+ add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_backups_scripts_and_styles' ), 5 );
100
+
101
+ // Enqueue updater scripts and styles
102
+ add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_updater_scripts_and_styles' ), 5 );
103
104
return $this;
105
}
136
137
add_filter( 'ai1wm_export', 'Ai1wm_Export_Archive::execute', 10 );
138
add_filter( 'ai1wm_export', 'Ai1wm_Export_Config::execute', 50 );
139
+ add_filter( 'ai1wm_export', 'Ai1wm_Export_Config_File::execute', 60 );
140
add_filter( 'ai1wm_export', 'Ai1wm_Export_Enumerate::execute', 100 );
141
add_filter( 'ai1wm_export', 'Ai1wm_Export_Content::execute', 150 );
142
add_filter( 'ai1wm_export', 'Ai1wm_Export_Database::execute', 200 );
367
* @return void
368
*/
369
public function admin_menu() {
370
+ // Top-level WP Migration menu
371
add_menu_page(
372
'All-in-One WP Migration',
373
'All-in-One WP Migration',
374
'export',
375
+ 'ai1wm_export',
376
'Ai1wm_Export_Controller::index',
377
'',
378
'76.295'
379
);
380
381
+ // Sub-level Export menu
382
add_submenu_page(
383
+ 'ai1wm_export',
384
__( 'Export', AI1WM_PLUGIN_NAME ),
385
__( 'Export', AI1WM_PLUGIN_NAME ),
386
'export',
387
+ 'ai1wm_export',
388
'Ai1wm_Export_Controller::index'
389
);
390
391
+ // Sub-level Import menu
392
add_submenu_page(
393
+ 'ai1wm_export',
394
__( 'Import', AI1WM_PLUGIN_NAME ),
395
__( 'Import', AI1WM_PLUGIN_NAME ),
396
'import',
397
+ 'ai1wm_import',
398
'Ai1wm_Import_Controller::index'
399
);
400
401
+ // Sub-level Backups menu
402
add_submenu_page(
403
+ 'ai1wm_export',
404
__( 'Backups', AI1WM_PLUGIN_NAME ),
405
__( 'Backups', AI1WM_PLUGIN_NAME ),
406
'import',
407
+ 'ai1wm_backups',
408
'Ai1wm_Backups_Controller::index'
409
);
410
}
411
412
/**
413
+ * Register scripts and styles
414
*
415
* @return void
416
*/
417
+ public function register_scripts_and_styles() {
418
+ if ( is_rtl() ) {
419
+ wp_register_style(
420
+ 'ai1wm_servmask',
421
+ Ai1wm_Template::asset_link( 'css/servmask.min.rtl.css' )
422
+ );
423
+ } else {
424
+ wp_register_style(
425
+ 'ai1wm_servmask',
426
+ Ai1wm_Template::asset_link( 'css/servmask.min.css' )
427
+ );
428
}
429
430
+ wp_register_script(
431
+ 'ai1wm_util',
432
+ Ai1wm_Template::asset_link( 'javascript/util.min.js' ),
433
+ array( 'jquery' )
434
+ );
435
436
+ wp_register_script(
437
+ 'ai1wm_feedback',
438
+ Ai1wm_Template::asset_link( 'javascript/feedback.min.js' ),
439
+ array( 'ai1wm_util' )
440
+ );
441
+
442
+ wp_register_script(
443
+ 'ai1wm_report',
444
+ Ai1wm_Template::asset_link( 'javascript/report.min.js' ),
445
+ array( 'ai1wm_util' )
446
+ );
447
+ }
448
+
449
+ /**
450
+ * Enqueue scripts and styles for Export Controller
451
+ *
452
+ * @param string $hook Hook suffix
453
+ * @return void
454
+ */
455
+ public function enqueue_export_scripts_and_styles( $hook ) {
456
+ if ( stripos( 'toplevel_page_ai1wm_export', $hook ) === false ) {
457
+ return;
458
+ }
459
+
460
+ // We don't want heartbeat to occur when exporting
461
wp_deregister_script( 'heartbeat' );
462
463
+ // We don't want auth check for monitoring whether the user is still logged in
464
remove_action( 'admin_enqueue_scripts', 'wp_auth_check_load' );
465
466
+ if ( is_rtl() ) {
467
+ wp_enqueue_style(
468
+ 'ai1wm_export',
469
+ Ai1wm_Template::asset_link( 'css/export.min.rtl.css' )
470
+ );
471
+ } else {
472
+ wp_enqueue_style(
473
+ 'ai1wm_export',
474
+ Ai1wm_Template::asset_link( 'css/export.min.css' )
475
+ );
476
+ }
477
+
478
wp_enqueue_script(
479
+ 'ai1wm_export',
480
Ai1wm_Template::asset_link( 'javascript/export.min.js' ),
481
+ array( 'ai1wm_util' )
482
);
483
+
484
+ wp_localize_script( 'ai1wm_export', 'ai1wm_feedback', array(
485
'ajax' => array(
486
'url' => wp_make_link_relative( admin_url( 'admin-ajax.php?action=ai1wm_feedback' ) ),
487
),
488
'secret_key' => get_option( AI1WM_SECRET_KEY ),
489
) );
490
+
491
+ wp_localize_script( 'ai1wm_export', 'ai1wm_report', array(
492
'ajax' => array(
493
'url' => wp_make_link_relative( admin_url( 'admin-ajax.php?action=ai1wm_report' ) ),
494
),
495
'secret_key' => get_option( AI1WM_SECRET_KEY ),
496
) );
497
+
498
+ wp_localize_script( 'ai1wm_export', 'ai1wm_export', array(
499
'ajax' => array(
500
'url' => wp_make_link_relative( admin_url( 'admin-ajax.php?action=ai1wm_export' ) ),
501
),
507
}
508
509
/**
510
+ * Enqueue scripts and styles for Import Controller
511
*
512
+ * @param string $hook Hook suffix
513
* @return void
514
*/
515
+ public function enqueue_import_scripts_and_styles( $hook ) {
516
+ if ( stripos( 'all-in-one-wp-migration_page_ai1wm_import', $hook ) === false ) {
517
return;
518
}
519
520
+ // We don't want heartbeat to occur when importing
521
wp_deregister_script( 'heartbeat' );
522
523
+ // We don't want auth check for monitoring whether the user is still logged in
524
remove_action( 'admin_enqueue_scripts', 'wp_auth_check_load' );
525
526
+ if ( is_rtl() ) {
527
+ wp_enqueue_style(
528
+ 'ai1wm_import',
529
+ Ai1wm_Template::asset_link( 'css/import.min.rtl.css' )
530
+ );
531
+ } else {
532
+ wp_enqueue_style(
533
+ 'ai1wm_import',
534
+ Ai1wm_Template::asset_link( 'css/import.min.css' )
535
+ );
536
+ }
537
+
538
wp_enqueue_script(
539
+ 'ai1wm_import',
540
Ai1wm_Template::asset_link( 'javascript/import.min.js' ),
541
+ array( 'ai1wm_util' )
542
);
543
+
544
+ wp_localize_script( 'ai1wm_import', 'ai1wm_feedback', array(
545
+ 'ajax' => array(
546
+ 'url' => wp_make_link_relative( admin_url( 'admin-ajax.php?action=ai1wm_feedback' ) ),
547
+ ),
548
+ 'secret_key' => get_option( AI1WM_SECRET_KEY ),
549
+ ) );
550
+
551
+ wp_localize_script( 'ai1wm_import', 'ai1wm_report', array(
552
+ 'ajax' => array(
553
+ 'url' => wp_make_link_relative( admin_url( 'admin-ajax.php?action=ai1wm_report' ) ),
554
+ ),
555
+ 'secret_key' => get_option( AI1WM_SECRET_KEY ),
556
+ ) );
557
+
558
+ wp_localize_script( 'ai1wm_import', 'ai1wm_uploader', array(
559
'chunk_size' => apply_filters( 'ai1wm_max_chunk_size', AI1WM_MAX_CHUNK_SIZE ),
560
'max_retries' => apply_filters( 'ai1wm_max_chunk_retries', AI1WM_MAX_CHUNK_RETRIES ),
561
'url' => wp_make_link_relative( admin_url( 'admin-ajax.php?action=ai1wm_import' ) ),
568
'ai1wm_archive_size' => apply_filters( 'ai1wm_max_file_size', AI1WM_MAX_FILE_SIZE ),
569
),
570
) );
571
+
572
+ wp_localize_script( 'ai1wm_import', 'ai1wm_import', array(
573
'ajax' => array(
574
'url' => wp_make_link_relative( admin_url( 'admin-ajax.php?action=ai1wm_import' ) ),
575
),
586
),
587
size_format( apply_filters( 'ai1wm_max_file_size', AI1WM_MAX_FILE_SIZE ) )
588
),
589
+ 'invalid_extension' => __(
590
+ 'The file type that you have tried to upload is not compatible with this plugin. ' .
591
+ 'Please ensure that your file is a <strong>.wpress</strong> file that was created with the All-in-One WP migration plugin. ' .
592
+ '<a href="https://help.servmask.com/knowledgebase/invalid-backup-file/" target="_blank">Technical details</a>',
593
+ AI1WM_PLUGIN_NAME
594
),
595
) );
596
}
597
598
/**
599
+ * Enqueue scripts and styles for Backups Controller
600
*
601
+ * @param string $hook Hook suffix
602
* @return void
603
*/
604
+ public function enqueue_backups_scripts_and_styles( $hook ) {
605
+ if ( stripos( 'all-in-one-wp-migration_page_ai1wm_backups', $hook ) === false ) {
606
return;
607
}
608
609
+ // We don't want heartbeat to occur when restoring
610
wp_deregister_script( 'heartbeat' );
611
612
+ // We don't want auth check for monitoring whether the user is still logged in
613
remove_action( 'admin_enqueue_scripts', 'wp_auth_check_load' );
614
615
+ if ( is_rtl() ) {
616
+ wp_enqueue_style(
617
+ 'ai1wm_backups',
618
+ Ai1wm_Template::asset_link( 'css/backups.min.rtl.css' )
619
+ );
620
+ } else {
621
+ wp_enqueue_style(
622
+ 'ai1wm_backups',
623
+ Ai1wm_Template::asset_link( 'css/backups.min.css' )
624
+ );
625
+ }
626
+
627
wp_enqueue_script(
628
+ 'ai1wm_backups',
629
Ai1wm_Template::asset_link( 'javascript/backups.min.js' ),
630
+ array( 'ai1wm_util' )
631
);
632
+
633
+ wp_localize_script( 'ai1wm_backups', 'ai1wm_feedback', array(
634
'ajax' => array(
635
'url' => wp_make_link_relative( admin_url( 'admin-ajax.php?action=ai1wm_feedback' ) ),
636
),
637
'secret_key' => get_option( AI1WM_SECRET_KEY ),
638
) );
639
+
640
+ wp_localize_script( 'ai1wm_backups', 'ai1wm_report', array(
641
'ajax' => array(
642
'url' => wp_make_link_relative( admin_url( 'admin-ajax.php?action=ai1wm_report' ) ),
643
),
644
'secret_key' => get_option( AI1WM_SECRET_KEY ),
645
) );
646
+
647
+ wp_localize_script( 'ai1wm_backups', 'ai1wm_import', array(
648
'ajax' => array(
649
'url' => wp_make_link_relative( admin_url( 'admin-ajax.php?action=ai1wm_import' ) ),
650
),
653
),
654
'secret_key' => get_option( AI1WM_SECRET_KEY ),
655
) );
656
+
657
+ wp_localize_script( 'ai1wm_backups', 'ai1wm_backups', array(
658
+ 'ajax' => array(
659
+ 'url' => wp_make_link_relative( admin_url( 'admin-ajax.php?action=ai1wm_backups' ) ),
660
+ ),
661
+ 'secret_key' => get_option( AI1WM_SECRET_KEY ),
662
+ ) );
663
}
664
665
/**
666
+ * Enqueue scripts and styles for Updater Controller
667
*
668
+ * @param string $hook Hook suffix
669
* @return void
670
*/
671
+ public function enqueue_updater_scripts_and_styles( $hook ) {
672
if ( 'plugins.php' !== strtolower( $hook ) ) {
673
return;
674
}
675
676
+ if ( is_rtl() ) {
677
+ wp_enqueue_style(
678
+ 'ai1wm_updater',
679
+ Ai1wm_Template::asset_link( 'css/updater.min.rtl.css' )
680
+ );
681
+ } else {
682
+ wp_enqueue_style(
683
+ 'ai1wm_updater',
684
+ Ai1wm_Template::asset_link( 'css/updater.min.css' )
685
+ );
686
+ }
687
688
wp_enqueue_script(
689
+ 'ai1wm_updater',
690
Ai1wm_Template::asset_link( 'javascript/updater.min.js' ),
691
+ array( 'ai1wm_util' )
692
);
693
+
694
+ wp_localize_script( 'ai1wm_updater', 'ai1wm_updater', array(
695
'ajax' => array(
696
'url' => wp_make_link_relative( admin_url( 'admin-ajax.php?action=ai1wm_updater' ) ),
697
),
lib/model/class-ai1wm-deprecated.php CHANGED
@@ -24,7 +24,5 @@
24
*/
25
26
class Ai1wm_Export_Abstract {}
27
-
28
class Ai1wm_Import_Abstract {}
29
-
30
class Ai1wm_Config {}
24
*/
25
26
class Ai1wm_Export_Abstract {}
27
class Ai1wm_Import_Abstract {}
28
class Ai1wm_Config {}
lib/model/class-ai1wm-extensions.php CHANGED
@@ -40,7 +40,7 @@ class Ai1wm_Extensions {
40
'about' => AI1WMBE_PLUGIN_ABOUT,
41
'basename' => AI1WMBE_PLUGIN_BASENAME,
42
'version' => AI1WMBE_VERSION,
43
- 'requires' => '1.9',
44
'short' => AI1WMBE_PLUGIN_SHORT,
45
);
46
}
@@ -52,7 +52,7 @@ class Ai1wm_Extensions {
52
'about' => AI1WMIE_PLUGIN_ABOUT,
53
'basename' => AI1WMIE_PLUGIN_BASENAME,
54
'version' => AI1WMIE_VERSION,
55
- 'requires' => '1.0',
56
'short' => AI1WMIE_PLUGIN_SHORT,
57
);
58
}
@@ -64,7 +64,7 @@ class Ai1wm_Extensions {
64
'about' => AI1WMDE_PLUGIN_ABOUT,
65
'basename' => AI1WMDE_PLUGIN_BASENAME,
66
'version' => AI1WMDE_VERSION,
67
- 'requires' => '3.28',
68
'short' => AI1WMDE_PLUGIN_SHORT,
69
);
70
}
@@ -76,7 +76,7 @@ class Ai1wm_Extensions {
76
'about' => AI1WMFE_PLUGIN_ABOUT,
77
'basename' => AI1WMFE_PLUGIN_BASENAME,
78
'version' => AI1WMFE_VERSION,
79
- 'requires' => '2.33',
80
'short' => AI1WMFE_PLUGIN_SHORT,
81
);
82
}
@@ -88,7 +88,7 @@ class Ai1wm_Extensions {
88
'about' => AI1WMGE_PLUGIN_ABOUT,
89
'basename' => AI1WMGE_PLUGIN_BASENAME,
90
'version' => AI1WMGE_VERSION,
91
- 'requires' => '2.30',
92
'short' => AI1WMGE_PLUGIN_SHORT,
93
);
94
}
@@ -100,7 +100,7 @@ class Ai1wm_Extensions {
100
'about' => AI1WMEE_PLUGIN_ABOUT,
101
'basename' => AI1WMEE_PLUGIN_BASENAME,
102
'version' => AI1WMEE_VERSION,
103
- 'requires' => '1.6',
104
'short' => AI1WMEE_PLUGIN_SHORT,
105
);
106
}
@@ -112,7 +112,7 @@ class Ai1wm_Extensions {
112
'about' => AI1WMME_PLUGIN_ABOUT,
113
'basename' => AI1WMME_PLUGIN_BASENAME,
114
'version' => AI1WMME_VERSION,
115
- 'requires' => '3.50',
116
'short' => AI1WMME_PLUGIN_SHORT,
117
);
118
}
@@ -124,7 +124,7 @@ class Ai1wm_Extensions {
124
'about' => AI1WMOE_PLUGIN_ABOUT,
125
'basename' => AI1WMOE_PLUGIN_BASENAME,
126
'version' => AI1WMOE_VERSION,
127
- 'requires' => '1.19',
128
'short' => AI1WMOE_PLUGIN_SHORT,
129
);
130
}
@@ -136,7 +136,7 @@ class Ai1wm_Extensions {
136
'about' => AI1WMSE_PLUGIN_ABOUT,
137
'basename' => AI1WMSE_PLUGIN_BASENAME,
138
'version' => AI1WMSE_VERSION,
139
- 'requires' => '3.22',
140
'short' => AI1WMSE_PLUGIN_SHORT,
141
);
142
}
@@ -148,7 +148,7 @@ class Ai1wm_Extensions {
148
'about' => AI1WMUE_PLUGIN_ABOUT,
149
'basename' => AI1WMUE_PLUGIN_BASENAME,
150
'version' => AI1WMUE_VERSION,
151
- 'requires' => '2.15',
152
'short' => AI1WMUE_PLUGIN_SHORT,
153
);
154
}
@@ -160,7 +160,7 @@ class Ai1wm_Extensions {
160
'about' => AI1WMLE_PLUGIN_ABOUT,
161
'basename' => AI1WMLE_PLUGIN_BASENAME,
162
'version' => AI1WMLE_VERSION,
163
- 'requires' => '2.22',
164
'short' => AI1WMLE_PLUGIN_SHORT,
165
);
166
}
40
'about' => AI1WMBE_PLUGIN_ABOUT,
41
'basename' => AI1WMBE_PLUGIN_BASENAME,
42
'version' => AI1WMBE_VERSION,
43
+ 'requires' => '1.10',
44
'short' => AI1WMBE_PLUGIN_SHORT,
45
);
46
}
52
'about' => AI1WMIE_PLUGIN_ABOUT,
53
'basename' => AI1WMIE_PLUGIN_BASENAME,
54
'version' => AI1WMIE_VERSION,
55
+ 'requires' => '1.1',
56
'short' => AI1WMIE_PLUGIN_SHORT,
57
);
58
}
64
'about' => AI1WMDE_PLUGIN_ABOUT,
65
'basename' => AI1WMDE_PLUGIN_BASENAME,
66
'version' => AI1WMDE_VERSION,
67
+ 'requires' => '3.29',
68
'short' => AI1WMDE_PLUGIN_SHORT,
69
);
70
}
76
'about' => AI1WMFE_PLUGIN_ABOUT,
77
'basename' => AI1WMFE_PLUGIN_BASENAME,
78
'version' => AI1WMFE_VERSION,
79
+ 'requires' => '2.34',
80
'short' => AI1WMFE_PLUGIN_SHORT,
81
);
82
}
88
'about' => AI1WMGE_PLUGIN_ABOUT,
89
'basename' => AI1WMGE_PLUGIN_BASENAME,
90
'version' => AI1WMGE_VERSION,
91
+ 'requires' => '2.31',
92
'short' => AI1WMGE_PLUGIN_SHORT,
93
);
94
}
100
'about' => AI1WMEE_PLUGIN_ABOUT,
101
'basename' => AI1WMEE_PLUGIN_BASENAME,
102
'version' => AI1WMEE_VERSION,
103
+ 'requires' => '1.7',
104
'short' => AI1WMEE_PLUGIN_SHORT,
105
);
106
}
112
'about' => AI1WMME_PLUGIN_ABOUT,
113
'basename' => AI1WMME_PLUGIN_BASENAME,
114
'version' => AI1WMME_VERSION,
115
+ 'requires' => '3.51',
116
'short' => AI1WMME_PLUGIN_SHORT,
117
);
118
}
124
'about' => AI1WMOE_PLUGIN_ABOUT,
125
'basename' => AI1WMOE_PLUGIN_BASENAME,
126
'version' => AI1WMOE_VERSION,
127
+ 'requires' => '1.20',
128
'short' => AI1WMOE_PLUGIN_SHORT,
129
);
130
}
136
'about' => AI1WMSE_PLUGIN_ABOUT,
137
'basename' => AI1WMSE_PLUGIN_BASENAME,
138
'version' => AI1WMSE_VERSION,
139
+ 'requires' => '3.23',
140
'short' => AI1WMSE_PLUGIN_SHORT,
141
);
142
}
148
'about' => AI1WMUE_PLUGIN_ABOUT,
149
'basename' => AI1WMUE_PLUGIN_BASENAME,
150
'version' => AI1WMUE_VERSION,
151
+ 'requires' => '2.16',
152
'short' => AI1WMUE_PLUGIN_SHORT,
153
);
154
}
160
'about' => AI1WMLE_PLUGIN_ABOUT,
161
'basename' => AI1WMLE_PLUGIN_BASENAME,
162
'version' => AI1WMLE_VERSION,
163
+ 'requires' => '2.23',
164
'short' => AI1WMLE_PLUGIN_SHORT,
165
);
166
}
lib/model/class-ai1wm-feedback.php CHANGED
@@ -26,7 +26,7 @@
26
class Ai1wm_Feedback {
27
28
/**
29
- * Submit customer feedback to ServMask.com
30
*
31
* @param string $type Feedback type
32
* @param string $email User e-mail
@@ -51,7 +51,8 @@ class Ai1wm_Feedback {
51
$response = wp_remote_post(
52
AI1WM_FEEDBACK_URL,
53
array(
54
- 'body' => array(
55
'type' => $type,
56
'email' => $email,
57
'message' => $message,
26
class Ai1wm_Feedback {
27
28
/**
29
+ * Submit customer feedback to servmask.com
30
*
31
* @param string $type Feedback type
32
* @param string $email User e-mail
51
$response = wp_remote_post(
52
AI1WM_FEEDBACK_URL,
53
array(
54
+ 'timeout' => 15,
55
+ 'body' => array(
56
'type' => $type,
57
'email' => $email,
58
'message' => $message,
lib/model/class-ai1wm-report.php CHANGED
@@ -26,7 +26,7 @@
26
class Ai1wm_Report {
27
28
/**
29
- * Submit customer report to ServMask.com
30
*
31
* @param string $email User e-mail
32
* @param string $message User message
@@ -48,7 +48,8 @@ class Ai1wm_Report {
48
$response = wp_remote_post(
49
AI1WM_REPORT_URL,
50
array(
51
- 'body' => array(
52
'email' => $email,
53
'message' => $message,
54
),
26
class Ai1wm_Report {
27
28
/**
29
+ * Submit customer report to servmask.com
30
*
31
* @param string $email User e-mail
32
* @param string $message User message
48
$response = wp_remote_post(
49
AI1WM_REPORT_URL,
50
array(
51
+ 'timeout' => 15,
52
+ 'body' => array(
53
'email' => $email,
54
'message' => $message,
55
),
lib/model/export/class-ai1wm-export-config-file.php ADDED
@@ -0,0 +1,115 @@
1
+ <?php
2
+ /**
3
+ * Copyright (C) 2014-2018 ServMask Inc.
4
+ *
5
+ * This program is free software: you can redistribute it and/or modify
6
+ * it under the terms of the GNU General Public License as published by
7
+ * the Free Software Foundation, either version 3 of the License, or
8
+ * (at your option) any later version.
9
+ *
10
+ * This program is distributed in the hope that it will be useful,
11
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
+ * GNU General Public License for more details.
14
+ *
15
+ * You should have received a copy of the GNU General Public License
16
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
17
+ *
18
+ * ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗
19
+ * ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝
20
+ * ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝
21
+ * ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗
22
+ * ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗
23
+ * ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝
24
+ */
25
+
26
+ class Ai1wm_Export_Config_File {
27
+
28
+ public static function execute( $params ) {
29
+
30
+ $package_bytes_written = 0;
31
+
32
+ // Set archive bytes offset
33
+ if ( isset( $params['archive_bytes_offset'] ) ) {
34
+ $archive_bytes_offset = (int) $params['archive_bytes_offset'];
35
+ } else {
36
+ $archive_bytes_offset = ai1wm_archive_bytes( $params );
37
+ }
38
+
39
+ // Set package bytes offset
40
+ if ( isset( $params['package_bytes_offset'] ) ) {
41
+ $package_bytes_offset = (int) $params['package_bytes_offset'];
42
+ } else {
43
+ $package_bytes_offset = 0;
44
+ }
45
+
46
+ // Get total package size
47
+ if ( isset( $params['total_package_size'] ) ) {
48
+ $total_package_size = (int) $params['total_package_size'];
49
+ } else {
50
+ $total_package_size = ai1wm_package_bytes( $params );
51
+ }
52
+
53
+ // What percent of package have we processed?
54
+ $progress = (int) min( ( $package_bytes_offset / $total_package_size ) * 100, 100 );
55
+
56
+ // Set progress
57
+ Ai1wm_Status::info( sprintf( __( 'Archiving configuration file...<br />%d%% complete', AI1WM_PLUGIN_NAME ), $progress ) );
58
+
59
+ // Open the archive file for writing
60
+ $archive = new Ai1wm_Compressor( ai1wm_archive_path( $params ) );
61
+
62
+ // Set the file pointer to the one that we have saved
63
+ $archive->set_file_pointer( $archive_bytes_offset );
64
+
65
+ // Add package.json to archive
66
+ if ( $archive->add_file( ai1wm_package_path( $params ), AI1WM_PACKAGE_NAME, $package_bytes_written, $package_bytes_offset, 10 ) ) {
67
+
68
+ // Set progress
69
+ Ai1wm_Status::info( __( 'Done archiving configuration file.', AI1WM_PLUGIN_NAME ) );
70
+
71
+ // Unset archive bytes offset
72
+ unset( $params['archive_bytes_offset'] );
73
+
74
+ // Unset package bytes offset
75
+ unset( $params['package_bytes_offset'] );
76
+
77
+ // Unset total package size
78
+ unset( $params['total_package_size'] );
79
+
80
+ // Unset completed flag
81
+ unset( $params['completed'] );
82
+
83
+ } else {
84
+
85
+ // Get archive bytes offset
86
+ $archive_bytes_offset = $archive->get_file_pointer();
87
+
88
+ // What percent of package have we processed?
89
+ $progress = (int) min( ( $package_bytes_offset / $total_package_size ) * 100, 100 );
90
+
91
+ // Set progress
92
+ Ai1wm_Status::info( sprintf( __( 'Archiving configuration file...<br />%d%% complete', AI1WM_PLUGIN_NAME ), $progress ) );
93
+
94
+ // Set archive bytes offset
95
+ $params['archive_bytes_offset'] = $archive_bytes_offset;
96
+
97
+ // Set package bytes offset
98
+ $params['package_bytes_offset'] = $package_bytes_offset;
99
+
100
+ // Set total package size
101
+ $params['total_package_size'] = $total_package_size;
102
+
103
+ // Set completed flag
104
+ $params['completed'] = false;
105
+ }
106
+
107
+ // Truncate the archive file
108
+ $archive->truncate();
109
+
110
+ // Close the archive file
111
+ $archive->close();
112
+
113
+ return $params;
114
+ }
115
+ }
lib/model/export/class-ai1wm-export-config.php CHANGED
@@ -29,14 +29,11 @@ class Ai1wm_Export_Config {
29
global $wp_version, $wpdb;
30
31
// Set progress
32
- Ai1wm_Status::info( __( 'Adding configuration to archive...', AI1WM_PLUGIN_NAME ) );
33
34
// Get options
35
$options = wp_load_alloptions();
36
37
- // Set config
38
- $config = array();
39
-
40
// Get database client
41
if ( empty( $wpdb->use_mysqli ) ) {
42
$mysql = new Ai1wm_Database_Mysql( $wpdb );
@@ -44,6 +41,8 @@ class Ai1wm_Export_Config {
44
$mysql = new Ai1wm_Database_Mysqli( $wpdb );
45
}
46
47
// Set site URL
48
$config['SiteURL'] = site_url();
49
@@ -101,13 +100,8 @@ class Ai1wm_Export_Config {
101
ai1wm_write( $handle, json_encode( $config ) );
102
ai1wm_close( $handle );
103
104
- // Add package.json file
105
- $archive = new Ai1wm_Compressor( ai1wm_archive_path( $params ) );
106
- $archive->add_file( ai1wm_package_path( $params ), AI1WM_PACKAGE_NAME );
107
- $archive->close();
108
-
109
// Set progress
110
- Ai1wm_Status::info( __( 'Done adding configuration to archive.', AI1WM_PLUGIN_NAME ) );
111
112
return $params;
113
}
29
global $wp_version, $wpdb;
30
31
// Set progress
32
+ Ai1wm_Status::info( __( 'Preparing configuration file...', AI1WM_PLUGIN_NAME ) );
33
34
// Get options
35
$options = wp_load_alloptions();
36
37
// Get database client
38
if ( empty( $wpdb->use_mysqli ) ) {
39
$mysql = new Ai1wm_Database_Mysql( $wpdb );
41
$mysql = new Ai1wm_Database_Mysqli( $wpdb );
42
}
43
44
+ $config = array();
45
+
46
// Set site URL
47
$config['SiteURL'] = site_url();
48
100
ai1wm_write( $handle, json_encode( $config ) );
101
ai1wm_close( $handle );
102
103
// Set progress
104
+ Ai1wm_Status::info( __( 'Done preparing configuration file.', AI1WM_PLUGIN_NAME ) );
105
106
return $params;
107
}
lib/model/export/class-ai1wm-export-content.php CHANGED
@@ -27,6 +27,13 @@ class Ai1wm_Export_Content {
27
28
public static function execute( $params ) {
29
30
// Set file bytes offset
31
if ( isset( $params['file_bytes_offset'] ) ) {
32
$file_bytes_offset = (int) $params['file_bytes_offset'];
@@ -41,11 +48,11 @@ class Ai1wm_Export_Content {
41
$filemap_bytes_offset = 0;
42
}
43
44
- // Get total files count
45
- if ( isset( $params['total_files_count'] ) ) {
46
- $total_files_count = (int) $params['total_files_count'];
47
} else {
48
- $total_files_count = 1;
49
}
50
51
// Get total files size
@@ -55,11 +62,11 @@ class Ai1wm_Export_Content {
55
$total_files_size = 1;
56
}
57
58
- // Get processed files size
59
- if ( isset( $params['processed_files_size'] ) ) {
60
- $processed_files_size = (int) $params['processed_files_size'];
61
} else {
62
- $processed_files_size = 0;
63
}
64
65
// What percent of files have we processed?
@@ -80,9 +87,12 @@ class Ai1wm_Export_Content {
80
// Set filemap pointer at the current index
81
if ( fseek( $filemap, $filemap_bytes_offset ) !== -1 ) {
82
83
- // Get archive
84
$archive = new Ai1wm_Compressor( ai1wm_archive_path( $params ) );
85
86
// Loop over files
87
while ( $path = trim( fgets( $filemap ) ) ) {
88
$file_bytes_written = 0;
@@ -91,7 +101,7 @@ class Ai1wm_Export_Content {
91
if ( ( $completed = $archive->add_file( WP_CONTENT_DIR . DIRECTORY_SEPARATOR . $path, $path, $file_bytes_written, $file_bytes_offset, 10 ) ) ) {
92
$file_bytes_offset = 0;
93
94
- // Set filemap bytes offset
95
$filemap_bytes_offset = ftell( $filemap );
96
}
97
@@ -111,6 +121,12 @@ class Ai1wm_Export_Content {
111
}
112
}
113
114
// Close the archive file
115
$archive->close();
116
}
@@ -118,6 +134,9 @@ class Ai1wm_Export_Content {
118
// End of the filemap?
119
if ( feof( $filemap ) ) {
120
121
// Unset file bytes offset
122
unset( $params['file_bytes_offset'] );
123
@@ -127,11 +146,20 @@ class Ai1wm_Export_Content {
127
// Unset processed files size
128
unset( $params['processed_files_size'] );
129
130
// Unset completed flag
131
unset( $params['completed'] );
132
133
} else {
134
135
// Set file bytes offset
136
$params['file_bytes_offset'] = $file_bytes_offset;
137
@@ -141,6 +169,12 @@ class Ai1wm_Export_Content {
141
// Set processed files size
142
$params['processed_files_size'] = $processed_files_size;
143
144
// Set completed flag
145
$params['completed'] = $completed;
146
}
27
28
public static function execute( $params ) {
29
30
+ // Set archive bytes offset
31
+ if ( isset( $params['archive_bytes_offset'] ) ) {
32
+ $archive_bytes_offset = (int) $params['archive_bytes_offset'];
33
+ } else {
34
+ $archive_bytes_offset = ai1wm_archive_bytes( $params );
35
+ }
36
+
37
// Set file bytes offset
38
if ( isset( $params['file_bytes_offset'] ) ) {
39
$file_bytes_offset = (int) $params['file_bytes_offset'];
48
$filemap_bytes_offset = 0;
49
}
50
51
+ // Get processed files size
52
+ if ( isset( $params['processed_files_size'] ) ) {
53
+ $processed_files_size = (int) $params['processed_files_size'];
54
} else {
55
+ $processed_files_size = 0;
56
}
57
58
// Get total files size
62
$total_files_size = 1;
63
}
64
65
+ // Get total files count
66
+ if ( isset( $params['total_files_count'] ) ) {
67
+ $total_files_count = (int) $params['total_files_count'];
68
} else {
69
+ $total_files_count = 1;
70
}
71
72
// What percent of files have we processed?
87
// Set filemap pointer at the current index
88
if ( fseek( $filemap, $filemap_bytes_offset ) !== -1 ) {
89
90
+ // Open the archive file for writing
91
$archive = new Ai1wm_Compressor( ai1wm_archive_path( $params ) );
92
93
+ // Set the file pointer to the one that we have saved
94
+ $archive->set_file_pointer( $archive_bytes_offset );
95
+
96
// Loop over files
97
while ( $path = trim( fgets( $filemap ) ) ) {
98
$file_bytes_written = 0;
101
if ( ( $completed = $archive->add_file( WP_CONTENT_DIR . DIRECTORY_SEPARATOR . $path, $path, $file_bytes_written, $file_bytes_offset, 10 ) ) ) {
102
$file_bytes_offset = 0;
103
104
+ // Get filemap bytes offset
105
$filemap_bytes_offset = ftell( $filemap );
106
}
107
121
}
122
}
123
124
+ // Get archive bytes offset
125
+ $archive_bytes_offset = $archive->get_file_pointer();
126
+
127
+ // Truncate the archive file
128
+ $archive->truncate();
129
+
130
// Close the archive file
131
$archive->close();
132
}
134
// End of the filemap?
135
if ( feof( $filemap ) ) {
136
137
+ // Unset archive bytes offset
138
+ unset( $params['archive_bytes_offset'] );
139
+
140
// Unset file bytes offset
141
unset( $params['file_bytes_offset'] );
142
146
// Unset processed files size
147
unset( $params['processed_files_size'] );
148
149
+ // Unset total files size
150
+ unset( $params['total_files_size'] );
151
+
152
+ // Unset total files count
153
+ unset( $params['total_files_count'] );
154
+
155
// Unset completed flag
156
unset( $params['completed'] );
157
158
} else {
159
160
+ // Set archive bytes offset
161
+ $params['archive_bytes_offset'] = $archive_bytes_offset;
162
+
163
// Set file bytes offset
164
$params['file_bytes_offset'] = $file_bytes_offset;
165
169
// Set processed files size
170
$params['processed_files_size'] = $processed_files_size;
171
172
+ // Set total files size
173
+ $params['total_files_size'] = $total_files_size;
174
+
175
+ // Set total files count
176
+ $params['total_files_count'] = $total_files_count;
177
+
178
// Set completed flag
179
$params['completed'] = $completed;
180
}
lib/model/export/class-ai1wm-export-database-file.php CHANGED
@@ -34,6 +34,13 @@ class Ai1wm_Export_Database_File {
34
35
$database_bytes_written = 0;
36
37
// Set database bytes offset
38
if ( isset( $params['database_bytes_offset'] ) ) {
39
$database_bytes_offset = (int) $params['database_bytes_offset'];
@@ -45,7 +52,7 @@ class Ai1wm_Export_Database_File {
45
if ( isset( $params['total_database_size'] ) ) {
46
$total_database_size = (int) $params['total_database_size'];
47
} else {
48
- $total_database_size = 1;
49
}
50
51
// What percent of database have we processed?
@@ -54,15 +61,21 @@ class Ai1wm_Export_Database_File {
54
// Set progress
55
Ai1wm_Status::info( sprintf( __( 'Archiving database...<br />%d%% complete', AI1WM_PLUGIN_NAME ), $progress ) );
56
57
- // Get archive
58
$archive = new Ai1wm_Compressor( ai1wm_archive_path( $params ) );
59
60
- // Add file to archive
61
if ( $archive->add_file( ai1wm_database_path( $params ), AI1WM_DATABASE_NAME, $database_bytes_written, $database_bytes_offset, 10 ) ) {
62
63
// Set progress
64
Ai1wm_Status::info( __( 'Done archiving database.', AI1WM_PLUGIN_NAME ) );
65
66
// Unset database bytes offset
67
unset( $params['database_bytes_offset'] );
68
@@ -74,8 +87,8 @@ class Ai1wm_Export_Database_File {
74
75
} else {
76
77
- // Get total database size
78
- $total_database_size = ai1wm_database_bytes( $params );
79
80
// What percent of database have we processed?
81
$progress = (int) min( ( $database_bytes_offset / $total_database_size ) * 100, 100 );
@@ -83,6 +96,9 @@ class Ai1wm_Export_Database_File {
83
// Set progress
84
Ai1wm_Status::info( sprintf( __( 'Archiving database...<br />%d%% complete', AI1WM_PLUGIN_NAME ), $progress ) );
85
86
// Set database bytes offset
87
$params['database_bytes_offset'] = $database_bytes_offset;
88
@@ -93,6 +109,9 @@ class Ai1wm_Export_Database_File {
93
$params['completed'] = false;
94
}
95
96
// Close the archive file
97
$archive->close();
98
34
35
$database_bytes_written = 0;
36
37
+ // Set archive bytes offset
38
+ if ( isset( $params['archive_bytes_offset'] ) ) {
39
+ $archive_bytes_offset = (int) $params['archive_bytes_offset'];
40
+ } else {
41
+ $archive_bytes_offset = ai1wm_archive_bytes( $params );
42
+ }
43
+
44
// Set database bytes offset
45
if ( isset( $params['database_bytes_offset'] ) ) {
46
$database_bytes_offset = (int) $params['database_bytes_offset'];
52
if ( isset( $params['total_database_size'] ) ) {
53
$total_database_size = (int) $params['total_database_size'];
54
} else {
55
+ $total_database_size = ai1wm_database_bytes( $params );
56
}
57
58
// What percent of database have we processed?
61
// Set progress
62
Ai1wm_Status::info( sprintf( __( 'Archiving database...<br />%d%% complete', AI1WM_PLUGIN_NAME ), $progress ) );
63
64
+ // Open the archive file for writing
65
$archive = new Ai1wm_Compressor( ai1wm_archive_path( $params ) );
66
67
+ // Set the file pointer to the one that we have saved
68
+ $archive->set_file_pointer( $archive_bytes_offset );
69
+
70
+ // Add database.sql to archive
71
if ( $archive->add_file( ai1wm_database_path( $params ), AI1WM_DATABASE_NAME, $database_bytes_written, $database_bytes_offset, 10 ) ) {
72
73
// Set progress
74
Ai1wm_Status::info( __( 'Done archiving database.', AI1WM_PLUGIN_NAME ) );
75
76
+ // Unset archive bytes offset
77
+ unset( $params['archive_bytes_offset'] );
78
+
79
// Unset database bytes offset
80
unset( $params['database_bytes_offset'] );
81
87
88
} else {
89
90
+ // Get archive bytes offset
91
+ $archive_bytes_offset = $archive->get_file_pointer();
92
93
// What percent of database have we processed?
94
$progress = (int) min( ( $database_bytes_offset / $total_database_size ) * 100, 100 );
96
// Set progress
97
Ai1wm_Status::info( sprintf( __( 'Archiving database...<br />%d%% complete', AI1WM_PLUGIN_NAME ), $progress ) );
98
99
+ // Set archive bytes offset
100
+ $params['archive_bytes_offset'] = $archive_bytes_offset;
101
+
102
// Set database bytes offset
103
$params['database_bytes_offset'] = $database_bytes_offset;
104
109
$params['completed'] = false;
110
}
111
112
+ // Truncate the archive file
113
+ $archive->truncate();
114
+
115
// Close the archive file
116
$archive->close();
117
lib/model/export/class-ai1wm-export-download.php CHANGED
@@ -30,7 +30,7 @@ class Ai1wm_Export_Download {
30
// Set progress
31
Ai1wm_Status::info( __( 'Renaming exported file...', AI1WM_PLUGIN_NAME ) );
32
33
- // Close achive file
34
$archive = new Ai1wm_Compressor( ai1wm_archive_path( $params ) );
35
36
// Append EOF block
30
// Set progress
31
Ai1wm_Status::info( __( 'Renaming exported file...', AI1WM_PLUGIN_NAME ) );
32
33
+ // Open the archive file for writing
34
$archive = new Ai1wm_Compressor( ai1wm_archive_path( $params ) );
35
36
// Append EOF block
lib/model/export/class-ai1wm-export-enumerate.php CHANGED
@@ -27,6 +27,20 @@ class Ai1wm_Export_Enumerate {
27
28
public static function execute( $params ) {
29
30
// Set progress
31
Ai1wm_Status::info( __( 'Retrieving a list of all WordPress files...', AI1WM_PLUGIN_NAME ) );
32
@@ -88,20 +102,6 @@ class Ai1wm_Export_Enumerate {
88
$exclude_filters = array_merge( $exclude_filters, array( 'uploads', 'blogs.dir' ) );
89
}
90
91
- // Get total files count
92
- if ( isset( $params['total_files_count'] ) ) {
93
- $total_files_count = (int) $params['total_files_count'];
94
- } else {
95
- $total_files_count = 0;
96
- }
97
-
98
- // Get total files size
99
- if ( isset( $params['total_files_size'] ) ) {
100
- $total_files_size = (int) $params['total_files_size'];
101
- } else {
102
- $total_files_size = 0;
103
- }
104
-
105
// Create map file
106
$filemap = ai1wm_open( ai1wm_filemap_path( $params ), 'w' );
107
27
28
public static function execute( $params ) {
29
30
+ // Get total files count
31
+ if ( isset( $params['total_files_count'] ) ) {
32
+ $total_files_count = (int) $params['total_files_count'];
33
+ } else {
34
+ $total_files_count = 0;
35
+ }
36
+
37
+ // Get total files size
38
+ if ( isset( $params['total_files_size'] ) ) {
39
+ $total_files_size = (int) $params['total_files_size'];
40
+ } else {
41
+ $total_files_size = 0;
42
+ }
43
+
44
// Set progress
45
Ai1wm_Status::info( __( 'Retrieving a list of all WordPress files...', AI1WM_PLUGIN_NAME ) );
46
102
$exclude_filters = array_merge( $exclude_filters, array( 'uploads', 'blogs.dir' ) );
103
}
104
105
// Create map file
106
$filemap = ai1wm_open( ai1wm_filemap_path( $params ), 'w' );
107
lib/model/import/class-ai1wm-import-confirm.php CHANGED
@@ -26,6 +26,7 @@
26
class Ai1wm_Import_Confirm {
27
28
public static function execute( $params ) {
29
$messages = array();
30
31
// Read package.json file
26
class Ai1wm_Import_Confirm {
27
28
public static function execute( $params ) {
29
+
30
$messages = array();
31
32
// Read package.json file
lib/model/import/class-ai1wm-import-content.php CHANGED
@@ -27,15 +27,12 @@ class Ai1wm_Import_Content {
27
28
public static function execute( $params ) {
29
30
- // Read blogs.json file
31
- $handle = ai1wm_open( ai1wm_blogs_path( $params ), 'r' );
32
-
33
- // Parse blogs.json file
34
- $blogs = ai1wm_read( $handle, filesize( ai1wm_blogs_path( $params ) ) );
35
- $blogs = json_decode( $blogs, true );
36
-
37
- // Close handle
38
- ai1wm_close( $handle );
39
40
// Set file bytes offset
41
if ( isset( $params['file_bytes_offset'] ) ) {
@@ -44,18 +41,11 @@ class Ai1wm_Import_Content {
44
$file_bytes_offset = 0;
45
}
46
47
- // Set archive bytes offset
48
- if ( isset( $params['archive_bytes_offset'] ) ) {
49
- $archive_bytes_offset = (int) $params['archive_bytes_offset'];
50
- } else {
51
- $archive_bytes_offset = 0;
52
- }
53
-
54
- // Get total files count
55
- if ( isset( $params['total_files_count'] ) ) {
56
- $total_files_count = (int) $params['total_files_count'];
57
} else {
58
- $total_files_count = 1;
59
}
60
61
// Get total files size
@@ -65,13 +55,23 @@ class Ai1wm_Import_Content {
65
$total_files_size = 1;
66
}
67
68
- // Get processed files size
69
- if ( isset( $params['processed_files_size'] ) ) {
70
- $processed_files_size = (int) $params['processed_files_size'];
71
} else {
72
- $processed_files_size = 0;
73
}
74
75
// What percent of files have we processed?
76
$progress = (int) min( ( $processed_files_size / $total_files_size ) * 100, 100 );
77
@@ -158,7 +158,7 @@ class Ai1wm_Import_Content {
158
$file_bytes_offset = 0;
159
}
160
161
- // Set archive bytes offset
162
$archive_bytes_offset = $archive->get_file_pointer();
163
164
// Increment processed files size
@@ -180,29 +180,41 @@ class Ai1wm_Import_Content {
180
// End of the archive?
181
if ( $archive->has_reached_eof() ) {
182
183
- // Unset file bytes offset
184
- unset( $params['file_bytes_offset'] );
185
-
186
// Unset archive bytes offset
187
unset( $params['archive_bytes_offset'] );
188
189
// Unset processed files size
190
unset( $params['processed_files_size'] );
191
192
// Unset completed flag
193
unset( $params['completed'] );
194
195
} else {
196
197
- // Set file bytes offset
198
- $params['file_bytes_offset'] = $file_bytes_offset;
199
-
200
// Set archive bytes offset
201
$params['archive_bytes_offset'] = $archive_bytes_offset;
202
203
// Set processed files size
204
$params['processed_files_size'] = $processed_files_size;
205
206
// Set completed flag
207
$params['completed'] = $completed;
208
}
27
28
public static function execute( $params ) {
29
30
+ // Set archive bytes offset
31
+ if ( isset( $params['archive_bytes_offset'] ) ) {
32
+ $archive_bytes_offset = (int) $params['archive_bytes_offset'];
33
+ } else {
34
+ $archive_bytes_offset = 0;
35
+ }
36
37
// Set file bytes offset
38
if ( isset( $params['file_bytes_offset'] ) ) {
41
$file_bytes_offset = 0;
42
}
43
44
+ // Get processed files size
45
+ if ( isset( $params['processed_files_size'] ) ) {
46
+ $processed_files_size = (int) $params['processed_files_size'];
47
} else {
48
+ $processed_files_size = 0;
49
}
50
51
// Get total files size
55
$total_files_size = 1;
56
}
57
58
+ // Get total files count
59
+ if ( isset( $params['total_files_count'] ) ) {
60
+ $total_files_count = (int) $params['total_files_count'];
61
} else {
62
+ $total_files_count = 1;
63
}
64
65
+ // Read blogs.json file
66
+ $handle = ai1wm_open( ai1wm_blogs_path( $params ), 'r' );
67
+
68
+ // Parse blogs.json file
69
+ $blogs = ai1wm_read( $handle, filesize( ai1wm_blogs_path( $params ) ) );
70
+ $blogs = json_decode( $blogs, true );
71
+
72
+ // Close handle
73
+ ai1wm_close( $handle );
74
+
75
// What percent of files have we processed?
76
$progress = (int) min( ( $processed_files_size / $total_files_size ) * 100, 100 );
77
158
$file_bytes_offset = 0;
159
}
160
161
+ // Get archive bytes offset
162
$archive_bytes_offset = $archive->get_file_pointer();
163
164
// Increment processed files size
180
// End of the archive?
181
if ( $archive->has_reached_eof() ) {
182
183
// Unset archive bytes offset
184
unset( $params['archive_bytes_offset'] );
185
186
+ // Unset file bytes offset
187
+ unset( $params['file_bytes_offset'] );
188
+
189
// Unset processed files size
190
unset( $params['processed_files_size'] );
191
192
+ // Unset total files size
193
+ unset( $params['total_files_size'] );
194
+
195
+ // Unset total files count
196
+ unset( $params['total_files_count'] );
197
+
198
// Unset completed flag
199
unset( $params['completed'] );
200
201
} else {
202
203
// Set archive bytes offset
204
$params['archive_bytes_offset'] = $archive_bytes_offset;
205
206
+ // Set file bytes offset
207
+ $params['file_bytes_offset'] = $file_bytes_offset;
208
+
209
// Set processed files size
210
$params['processed_files_size'] = $processed_files_size;
211
212
+ // Set total files size
213
+ $params['total_files_size'] = $total_files_size;
214
+
215
+ // Set total files count
216
+ $params['total_files_count'] = $total_files_count;
217
+
218
// Set completed flag
219
$params['completed'] = $completed;
220
}
lib/model/import/class-ai1wm-import-database.php CHANGED
@@ -211,50 +211,77 @@ class Ai1wm_Import_Database {
211
// Replace Site URL
212
if ( $site_url !== $blog['New']['SiteURL'] ) {
213
214
- // Get domain
215
- $old_domain = parse_url( $site_url, PHP_URL_HOST );
216
- $new_domain = parse_url( $blog['New']['SiteURL'], PHP_URL_HOST );
217
218
- // Get path
219
- $old_path = parse_url( $site_url, PHP_URL_PATH );
220
- $new_path = parse_url( $blog['New']['SiteURL'], PHP_URL_PATH );
221
222
- // Get scheme
223
- $new_scheme = parse_url( $blog['New']['SiteURL'], PHP_URL_SCHEME );
224
225
- // Add domain and path
226
- if ( ! in_array( sprintf( "'%s','%s'", $old_domain, trailingslashit( $old_path ) ), $old_raw_values ) ) {
227
- $old_raw_values[] = sprintf( "'%s','%s'", $old_domain, trailingslashit( $old_path ) );
228
- $new_raw_values[] = sprintf( "'%s','%s'", $new_domain, trailingslashit( $new_path ) );
229
- }
230
231
- // Replace Site URL scheme
232
- foreach ( array( 'http', 'https' ) as $old_scheme ) {
233
234
- // Add plain Site URL
235
- if ( ! in_array( set_url_scheme( $site_url, $old_scheme ), $old_values ) ) {
236
- $old_values[] = set_url_scheme( $site_url, $old_scheme );
237
- $new_values[] = set_url_scheme( $blog['New']['SiteURL'], $new_scheme );
238
}
239
240
- // Add URL encoded Site URL
241
- if ( ! in_array( urlencode( set_url_scheme( $site_url, $old_scheme ) ), $old_values ) ) {
242
- $old_values[] = urlencode( set_url_scheme( $site_url, $old_scheme ) );
243
- $new_values[] = urlencode( set_url_scheme( $blog['New']['SiteURL'], $new_scheme ) );
244
}
245
246
- // Add JSON escaped Site URL
247
- if ( ! in_array( addcslashes( set_url_scheme( $site_url, $old_scheme ), '/' ), $old_values ) ) {
248
- $old_values[] = addcslashes( set_url_scheme( $site_url, $old_scheme ), '/' );
249
- $new_values[] = addcslashes( set_url_scheme( $blog['New']['SiteURL'], $new_scheme ), '/' );
250
}
251
- }
252
253
- // Add email
254
- if ( ! isset( $config['NoEmailReplace'] ) ) {
255
- if ( ! in_array( sprintf( '@%s', $old_domain ), $old_values ) ) {
256
- $old_values[] = sprintf( '@%s', $old_domain );
257
- $new_values[] = sprintf( '@%s', $new_domain );
258
}
259
}
260
}
@@ -278,50 +305,77 @@ class Ai1wm_Import_Database {
278
// Replace Home URL
279
if ( $home_url !== $blog['New']['HomeURL'] ) {
280
281
- // Get domain
282
- $old_domain = parse_url( $home_url, PHP_URL_HOST );
283
- $new_domain = parse_url( $blog['New']['HomeURL'], PHP_URL_HOST );
284
285
- // Get path
286
- $old_path = parse_url( $home_url, PHP_URL_PATH );
287
- $new_path = parse_url( $blog['New']['HomeURL'], PHP_URL_PATH );
288
289
- // Get scheme
290
- $new_scheme = parse_url( $blog['New']['HomeURL'], PHP_URL_SCHEME );
291
292
- // Add domain and path
293
- if ( ! in_array( sprintf( "'%s','%s'", $old_domain, trailingslashit( $old_path ) ), $old_raw_values ) ) {
294
- $old_raw_values[] = sprintf( "'%s','%s'", $old_domain, trailingslashit( $old_path ) );
295
- $new_raw_values[] = sprintf( "'%s','%s'", $new_domain, trailingslashit( $new_path ) );
296
- }
297
298
- // Replace Home URL scheme
299
- foreach ( array( 'http', 'https' ) as $old_scheme ) {
300
301
- // Add plain Home URL
302
- if ( ! in_array( set_url_scheme( $home_url, $old_scheme ), $old_values ) ) {
303
- $old_values[] = set_url_scheme( $home_url, $old_scheme );
304
- $new_values[] = set_url_scheme( $blog['New']['HomeURL'], $new_scheme );
305
}
306
307
- // Add URL encoded Home URL
308
- if ( ! in_array( urlencode( set_url_scheme( $home_url, $old_scheme ) ), $old_values ) ) {
309
- $old_values[] = urlencode( set_url_scheme( $home_url, $old_scheme ) );
310
- $new_values[] = urlencode( set_url_scheme( $blog['New']['HomeURL'], $new_scheme ) );
311
}
312
313
- // Add JSON escaped Home URL
314
- if ( ! in_array( addcslashes( set_url_scheme( $home_url, $old_scheme ), '/' ), $old_values ) ) {
315
- $old_values[] = addcslashes( set_url_scheme( $home_url, $old_scheme ), '/' );
316
- $new_values[] = addcslashes( set_url_scheme( $blog['New']['HomeURL'], $new_scheme ), '/' );
317
}
318
- }
319
320
- // Add email
321
- if ( ! isset( $config['NoEmailReplace'] ) ) {
322
- if ( ! in_array( sprintf( '@%s', $old_domain ), $old_values ) ) {
323
- $old_values[] = sprintf( '@%s', $old_domain );
324
- $new_values[] = sprintf( '@%s', $new_domain );
325
}
326
}
327
}
@@ -348,13 +402,13 @@ class Ai1wm_Import_Database {
348
349
// Get www URL
350
if ( stripos( $site_url, '//www.' ) !== false ) {
351
- $www_url = str_ireplace( '//www.', '//', $site_url );
352
} else {
353
- $www_url = str_ireplace( '//', '//www.', $site_url );
354
}
355
356
// Replace Site URL
357
- foreach ( array( $site_url, $www_url ) as $url ) {
358
359
// Get domain
360
$old_domain = parse_url( $url, PHP_URL_HOST );
@@ -373,25 +427,41 @@ class Ai1wm_Import_Database {
373
$new_raw_values[] = sprintf( "'%s','%s'", $new_domain, trailingslashit( $new_path ) );
374
}
375
376
// Replace Site URL scheme
377
- foreach ( array( 'http', 'https' ) as $old_scheme ) {
378
379
// Add plain Site URL
380
- if ( ! in_array( set_url_scheme( $url, $old_scheme ), $old_values ) ) {
381
- $old_values[] = set_url_scheme( $url, $old_scheme );
382
- $new_values[] = set_url_scheme( site_url(), $new_scheme );
383
}
384
385
// Add URL encoded Site URL
386
- if ( ! in_array( urlencode( set_url_scheme( $url, $old_scheme ) ), $old_values ) ) {
387
- $old_values[] = urlencode( set_url_scheme( $url, $old_scheme ) );
388
- $new_values[] = urlencode( set_url_scheme( site_url(), $new_scheme ) );
389
}
390
391
// Add JSON escaped Site URL
392
- if ( ! in_array( addcslashes( set_url_scheme( $url, $old_scheme ), '/' ), $old_values ) ) {
393
- $old_values[] = addcslashes( set_url_scheme( $url, $old_scheme ), '/' );
394
- $new_values[] = addcslashes( set_url_scheme( site_url(), $new_scheme ), '/' );
395
}
396
}
397
@@ -426,13 +496,13 @@ class Ai1wm_Import_Database {
426
427
// Get www URL
428
if ( stripos( $home_url, '//www.' ) !== false ) {
429
- $www_url = str_ireplace( '//www.', '//', $home_url );
430
} else {
431
- $www_url = str_ireplace( '//', '//www.', $home_url );
432
}
433
434
// Replace Home URL
435
- foreach ( array( $home_url, $www_url ) as $url ) {
436
437
// Get domain
438
$old_domain = parse_url( $url, PHP_URL_HOST );
@@ -451,25 +521,41 @@ class Ai1wm_Import_Database {
451
$new_raw_values[] = sprintf( "'%s','%s'", $new_domain, trailingslashit( $new_path ) );
452
}
453
454
// Replace Home URL scheme
455
- foreach ( array( 'http', 'https' ) as $old_scheme ) {
456
457
// Add plain Home URL
458
- if ( ! in_array( set_url_scheme( $url, $old_scheme ), $old_values ) ) {
459
- $old_values[] = set_url_scheme( $url, $old_scheme );
460
- $new_values[] = set_url_scheme( home_url(), $new_scheme );
461
}
462
463
// Add URL encoded Home URL
464
- if ( ! in_array( urlencode( set_url_scheme( $url, $old_scheme ) ), $old_values ) ) {
465
- $old_values[] = urlencode( set_url_scheme( $url, $old_scheme ) );
466
- $new_values[] = urlencode( set_url_scheme( home_url(), $new_scheme ) );
467
}
468
469
// Add JSON escaped Home URL
470
- if ( ! in_array( addcslashes( set_url_scheme( $url, $old_scheme ), '/' ), $old_values ) ) {
471
- $old_values[] = addcslashes( set_url_scheme( $url, $old_scheme ), '/' );
472
- $new_values[] = addcslashes( set_url_scheme( home_url(), $new_scheme ), '/' );
473
}
474
}
475
211
// Replace Site URL
212
if ( $site_url !== $blog['New']['SiteURL'] ) {
213
214
+ // Get www URL
215
+ if ( stripos( $site_url, '//www.' ) !== false ) {
216
+ $site_url_www_inversion = str_ireplace( '//www.', '//', $site_url );
217
+ } else {
218
+ $site_url_www_inversion = str_ireplace( '//', '//www.', $site_url );
219
+ }
220
221
+ // Replace Site URL
222
+ foreach ( array( $site_url, $site_url_www_inversion ) as $url ) {
223
224
+ // Get domain
225
+ $old_domain = parse_url( $url, PHP_URL_HOST );
226
+ $new_domain = parse_url( $blog['New']['SiteURL'], PHP_URL_HOST );
227
228
+ // Get path
229
+ $old_path = parse_url( $url, PHP_URL_PATH );
230
+ $new_path = parse_url( $blog['New']['SiteURL'], PHP_URL_PATH );
231
232
+ // Get scheme
233
+ $new_scheme = parse_url( $blog['New']['SiteURL'], PHP_URL_SCHEME );
234
235
+ // Add domain and path
236
+ if ( ! in_array( sprintf( "'%s','%s'", $old_domain, trailingslashit( $old_path ) ), $old_raw_values ) ) {
237
+ $old_raw_values[] = sprintf( "'%s','%s'", $old_domain, trailingslashit( $old_path ) );
238
+ $new_raw_values[] = sprintf( "'%s','%s'", $new_domain, trailingslashit( $new_path ) );
239
}
240
241
+ // Add domain and path with single quote
242
+ if ( ! in_array( sprintf( "='%s%s", $old_domain, untrailingslashit( $old_path ) ), $old_values ) ) {
243
+ $old_values[] = sprintf( "='%s%s", $old_domain, untrailingslashit( $old_path ) );
244
+ $new_values[] = sprintf( "='%s%s", $new_domain, untrailingslashit( $new_path ) );
245
}
246
247
+ // Add domain and path with double quote
248
+ if ( ! in_array( sprintf( '="%s%s', $old_domain, untrailingslashit( $old_path ) ), $old_values ) ) {
249
+ $old_values[] = sprintf( '="%s%s', $old_domain, untrailingslashit( $old_path ) );
250
+ $new_values[] = sprintf( '="%s%s', $new_domain, untrailingslashit( $new_path ) );
251
}
252
253
+ // Add Site URL scheme
254
+ $old_schemes = array( 'http', 'https', '' );
255
+ $new_schemes = array( $new_scheme, $new_scheme, '' );
256
+
257
+ // Replace Site URL scheme
258
+ for ( $i = 0; $i < count( $old_schemes ); $i++ ) {
259
+
260
+ // Add plain Site URL
261
+ if ( ! in_array( ai1wm_urlscheme( $url, $old_schemes[ $i ] ), $old_values ) ) {
262
+ $old_values[] = ai1wm_urlscheme( $url, $old_schemes[ $i ] );
263
+ $new_values[] = ai1wm_urlscheme( $blog['New']['SiteURL'], $new_schemes[ $i ] );
264
+ }
265
+
266
+ // Add URL encoded Site URL
267
+ if ( ! in_array( urlencode( ai1wm_urlscheme( $url, $old_schemes[ $i ] ) ), $old_values ) ) {
268
+ $old_values[] = urlencode( ai1wm_urlscheme( $url, $old_schemes[ $i ] ) );
269
+ $new_values[] = urlencode( ai1wm_urlscheme( $blog['New']['SiteURL'], $new_schemes[ $i ] ) );
270
+ }
271
+
272
+ // Add JSON escaped Site URL
273
+ if ( ! in_array( addcslashes( ai1wm_urlscheme( $url, $old_schemes[ $i ] ), '/' ), $old_values ) ) {
274
+ $old_values[] = addcslashes( ai1wm_urlscheme( $url, $old_schemes[ $i ] ), '/' );
275
+ $new_values[] = addcslashes( ai1wm_urlscheme( $blog['New']['SiteURL'], $new_schemes[ $i ] ), '/' );
276
+ }
277
+ }
278
+
279
+ // Add email
280
+ if ( ! isset( $config['NoEmailReplace'] ) ) {
281
+ if ( ! in_array( sprintf( '@%s', $old_domain ), $old_values ) ) {
282
+ $old_values[] = sprintf( '@%s', $old_domain );
283
+ $new_values[] = sprintf( '@%s', $new_domain );
284
+ }
285
}
286
}
287
}
305
// Replace Home URL
306
if ( $home_url !== $blog['New']['HomeURL'] ) {
307
308
+ // Get www URL
309
+ if ( stripos( $home_url, '//www.' ) !== false ) {
310
+ $home_url_www_inversion = str_ireplace( '//www.', '//', $home_url );
311
+ } else {
312
+ $home_url_www_inversion = str_ireplace( '//', '//www.', $home_url );
313
+ }
314
315
+ // Replace Home URL
316
+ foreach ( array( $home_url, $home_url_www_inversion ) as $url ) {
317
318
+ // Get domain
319
+ $old_domain = parse_url( $url, PHP_URL_HOST );
320
+ $new_domain = parse_url( $blog['New']['HomeURL'], PHP_URL_HOST );
321
322
+ // Get path
323
+ $old_path = parse_url( $url, PHP_URL_PATH );
324
+ $new_path = parse_url( $blog['New']['HomeURL'], PHP_URL_PATH );
325
326
+ // Get scheme
327
+ $new_scheme = parse_url( $blog['New']['HomeURL'], PHP_URL_SCHEME );
328
329
+ // Add domain and path
330
+ if ( ! in_array( sprintf( "'%s','%s'", $old_domain, trailingslashit( $old_path ) ), $old_raw_values ) ) {
331
+ $old_raw_values[] = sprintf( "'%s','%s'", $old_domain, trailingslashit( $old_path ) );
332
+ $new_raw_values[] = sprintf( "'%s','%s'", $new_domain, trailingslashit( $new_path ) );
333
}
334
335
+ // Add domain and path with single quote
336
+ if ( ! in_array( sprintf( "='%s%s", $old_domain, untrailingslashit( $old_path ) ), $old_values ) ) {
337
+ $old_values[] = sprintf( "='%s%s", $old_domain, untrailingslashit( $old_path ) );
338
+ $new_values[] = sprintf( "='%s%s", $new_domain, untrailingslashit( $new_path ) );
339
}
340
341
+ // Add domain and path with double quote
342
+ if ( ! in_array( sprintf( '="%s%s', $old_domain, untrailingslashit( $old_path ) ), $old_values ) ) {
343
+ $old_values[] = sprintf( '="%s%s', $old_domain, untrailingslashit( $old_path ) );
344
+ $new_values[] = sprintf( '="%s%s', $new_domain, untrailingslashit( $new_path ) );
345
}
346
347
+ // Set Home URL scheme
348
+ $old_schemes = array( 'http', 'https', '' );
349
+ $new_schemes = array( $new_scheme, $new_scheme, '' );
350
+
351
+ // Replace Home URL scheme
352
+ for ( $i = 0; $i < count( $old_schemes ); $i++ ) {
353
+
354
+ // Add plain Home URL
355
+ if ( ! in_array( ai1wm_urlscheme( $url, $old_schemes[ $i ] ), $old_values ) ) {
356
+ $old_values[] = ai1wm_urlscheme( $url, $old_schemes[ $i ] );
357
+ $new_values[] = ai1wm_urlscheme( $blog['New']['HomeURL'], $new_schemes[ $i ] );
358
+ }
359
+
360
+ // Add URL encoded Home URL
361
+ if ( ! in_array( urlencode( ai1wm_urlscheme( $url, $old_schemes[ $i ] ) ), $old_values ) ) {
362
+ $old_values[] = urlencode( ai1wm_urlscheme( $url, $old_schemes[ $i ] ) );
363
+ $new_values[] = urlencode( ai1wm_urlscheme( $blog['New']['HomeURL'], $new_schemes[ $i ] ) );
364
+ }
365
+
366
+ // Add JSON escaped Home URL
367
+ if ( ! in_array( addcslashes( ai1wm_urlscheme( $url, $old_schemes[ $i ] ), '/' ), $old_values ) ) {
368
+ $old_values[] = addcslashes( ai1wm_urlscheme( $url, $old_schemes[ $i ] ), '/' );
369
+ $new_values[] = addcslashes( ai1wm_urlscheme( $blog['New']['HomeURL'], $new_schemes[ $i ] ), '/' );
370
+ }
371
+ }
372
+
373
+ // Add email
374
+ if ( ! isset( $config['NoEmailReplace'] ) ) {
375
+ if ( ! in_array( sprintf( '@%s', $old_domain ), $old_values ) ) {
376
+ $old_values[] = sprintf( '@%s', $old_domain );
377
+ $new_values[] = sprintf( '@%s', $new_domain );
378
+ }
379
}
380
}
381
}
402
403
// Get www URL
404
if ( stripos( $site_url, '//www.' ) !== false ) {
405
+ $site_url_www_inversion = str_ireplace( '//www.', '//', $site_url );
406
} else {
407
+ $site_url_www_inversion = str_ireplace( '//', '//www.', $site_url );
408
}
409
410
// Replace Site URL
411
+ foreach ( array( $site_url, $site_url_www_inversion ) as $url ) {
412
413
// Get domain
414
$old_domain = parse_url( $url, PHP_URL_HOST );
427
$new_raw_values[] = sprintf( "'%s','%s'", $new_domain, trailingslashit( $new_path ) );
428
}
429
430
+ // Add domain and path with single quote
431
+ if ( ! in_array( sprintf( "='%s%s", $old_domain, untrailingslashit( $old_path ) ), $old_values ) ) {
432
+ $old_values[] = sprintf( "='%s%s", $old_domain, untrailingslashit( $old_path ) );
433
+ $new_values[] = sprintf( "='%s%s", $new_domain, untrailingslashit( $new_path ) );
434
+ }
435
+
436
+ // Add domain and path with double quote
437
+ if ( ! in_array( sprintf( '="%s%s', $old_domain, untrailingslashit( $old_path ) ), $old_values ) ) {
438
+ $old_values[] = sprintf( '="%s%s', $old_domain, untrailingslashit( $old_path ) );
439
+ $new_values[] = sprintf( '="%s%s', $new_domain, untrailingslashit( $new_path ) );
440
+ }
441
+
442
+ // Set Site URL scheme
443
+ $old_schemes = array( 'http', 'https', '' );
444
+ $new_schemes = array( $new_scheme, $new_scheme, '' );
445
+
446
// Replace Site URL scheme
447
+ for ( $i = 0; $i < count( $old_schemes ); $i++ ) {
448
449
// Add plain Site URL
450
+ if ( ! in_array( ai1wm_urlscheme( $url, $old_schemes[ $i ] ), $old_values ) ) {
451
+ $old_values[] = ai1wm_urlscheme( $url, $old_schemes[ $i ] );
452
+ $new_values[] = ai1wm_urlscheme( site_url(), $new_schemes[ $i ] );
453
}
454
455
// Add URL encoded Site URL
456
+ if ( ! in_array( urlencode( ai1wm_urlscheme( $url, $old_schemes[ $i ] ) ), $old_values ) ) {
457
+ $old_values[] = urlencode( ai1wm_urlscheme( $url, $old_schemes[ $i ] ) );
458
+ $new_values[] = urlencode( ai1wm_urlscheme( site_url(), $new_schemes[ $i ] ) );
459
}
460
461
// Add JSON escaped Site URL
462
+ if ( ! in_array( addcslashes( ai1wm_urlscheme( $url, $old_schemes[ $i ] ), '/' ), $old_values ) ) {
463
+ $old_values[] = addcslashes( ai1wm_urlscheme( $url, $old_schemes[ $i ] ), '/' );
464
+ $new_values[] = addcslashes( ai1wm_urlscheme( site_url(), $new_schemes[ $i ] ), '/' );
465
}
466
}
467
496
497
// Get www URL
498
if ( stripos( $home_url, '//www.' ) !== false ) {
499
+ $home_url_www_inversion = str_ireplace( '//www.', '//', $home_url );
500
} else {
501
+ $home_url_www_inversion = str_ireplace( '//', '//www.', $home_url );
502
}
503
504
// Replace Home URL
505
+ foreach ( array( $home_url, $home_url_www_inversion ) as $url ) {
506
507
// Get domain
508
$old_domain = parse_url( $url, PHP_URL_HOST );
521
$new_raw_values[] = sprintf( "'%s','%s'", $new_domain, trailingslashit( $new_path ) );
522
}
523
524
+ // Add domain and path with single quote
525
+ if ( ! in_array( sprintf( "='%s%s", $old_domain, untrailingslashit( $old_path ) ), $old_values ) ) {
526
+ $old_values[] = sprintf( "='%s%s", $old_domain, untrailingslashit( $old_path ) );
527
+ $new_values[] = sprintf( "='%s%s", $new_domain, untrailingslashit( $new_path ) );
528
+ }
529
+
530
+ // Add domain and path with double quote
531
+ if ( ! in_array( sprintf( '="%s%s', $old_domain, untrailingslashit( $old_path ) ), $old_values ) ) {
532
+ $old_values[] = sprintf( '="%s%s', $old_domain, untrailingslashit( $old_path ) );
533
+ $new_values[] = sprintf( '="%s%s', $new_domain, untrailingslashit( $new_path ) );
534
+ }
535
+
536
+ // Add Home URL scheme
537
+ $old_schemes = array( 'http', 'https', '' );
538
+ $new_schemes = array( $new_scheme, $new_scheme, '' );
539
+
540
// Replace Home URL scheme
541
+ for ( $i = 0; $i < count( $old_schemes ); $i++ ) {
542
543
// Add plain Home URL
544
+ if ( ! in_array( ai1wm_urlscheme( $url, $old_schemes[ $i ] ), $old_values ) ) {
545
+ $old_values[] = ai1wm_urlscheme( $url, $old_schemes[ $i ] );
546
+ $new_values[] = ai1wm_urlscheme( home_url(), $new_schemes[ $i ] );
547
}
548
549
// Add URL encoded Home URL
550
+ if ( ! in_array( urlencode( ai1wm_urlscheme( $url, $old_schemes[ $i ] ) ), $old_values ) ) {
551
+ $old_values[] = urlencode( ai1wm_urlscheme( $url, $old_schemes[ $i ] ) );
552
+ $new_values[] = urlencode( ai1wm_urlscheme( home_url(), $new_schemes[ $i ] ) );
553
}
554
555
// Add JSON escaped Home URL
556
+ if ( ! in_array( addcslashes( ai1wm_urlscheme( $url, $old_schemes[ $i ] ), '/' ), $old_values ) ) {
557
+ $old_values[] = addcslashes( ai1wm_urlscheme( $url, $old_schemes[ $i ] ), '/' );
558
+ $new_values[] = addcslashes( ai1wm_urlscheme( home_url(), $new_schemes[ $i ] ), '/' );
559
}
560
}
561
lib/model/import/class-ai1wm-import-done.php CHANGED
@@ -56,6 +56,8 @@ class Ai1wm_Import_Done {
56
// Deactivate WordPress plugins
57
ai1wm_deactivate_plugins( array(
58
'invisible-recaptcha/invisible-recaptcha.php',
59
) );
60
61
// Deactivate Jetpack modules
@@ -106,6 +108,8 @@ class Ai1wm_Import_Done {
106
// Deactivate WordPress plugins
107
ai1wm_deactivate_plugins( array(
108
'invisible-recaptcha/invisible-recaptcha.php',
109
) );
110
111
// Deactivate Jetpack modules
@@ -158,6 +162,8 @@ class Ai1wm_Import_Done {
158
// Deactivate WordPress plugins
159
ai1wm_deactivate_plugins( array(
160
'invisible-recaptcha/invisible-recaptcha.php',
161
) );
162
163
// Deactivate Jetpack modules
56
// Deactivate WordPress plugins
57
ai1wm_deactivate_plugins( array(
58
'invisible-recaptcha/invisible-recaptcha.php',
59
+ 'wps-hide-login/wps-hide-login.php',
60
+ 'mycustomwidget/my_custom_widget.php',
61
) );
62
63
// Deactivate Jetpack modules
108
// Deactivate WordPress plugins
109
ai1wm_deactivate_plugins( array(
110
'invisible-recaptcha/invisible-recaptcha.php',
111
+ 'wps-hide-login/wps-hide-login.php',
112
+ 'mycustomwidget/my_custom_widget.php',
113
) );
114
115
// Deactivate Jetpack modules
162
// Deactivate WordPress plugins
163
ai1wm_deactivate_plugins( array(
164
'invisible-recaptcha/invisible-recaptcha.php',
165
+ 'wps-hide-login/wps-hide-login.php',
166
+ 'mycustomwidget/my_custom_widget.php',
167
) );
168
169
// Deactivate Jetpack modules
lib/model/import/class-ai1wm-import-mu-plugins.php CHANGED
@@ -30,11 +30,17 @@ class Ai1wm_Import_Mu_Plugins {
30
// Set progress
31
Ai1wm_Status::info( __( 'Activating mu-plugins...', AI1WM_PLUGIN_NAME ) );
32
33
// Open the archive file for reading
34
$archive = new Ai1wm_Extractor( ai1wm_archive_path( $params ) );
35
36
// Unpack mu-plugins files
37
- $archive->extract_by_files_array( WP_CONTENT_DIR, array( AI1WM_MUPLUGINS_NAME ) );
38
39
// Close the archive file
40
$archive->close();
30
// Set progress
31
Ai1wm_Status::info( __( 'Activating mu-plugins...', AI1WM_PLUGIN_NAME ) );
32
33
+ $exclude_files = array(
34
+ AI1WM_MUPLUGINS_NAME . DIRECTORY_SEPARATOR . AI1WM_ENDURANCE_PAGE_CACHE_NAME,
35
+ AI1WM_MUPLUGINS_NAME . DIRECTORY_SEPARATOR . AI1WM_ENDURANCE_PHP_EDGE_NAME,
36
+ AI1WM_MUPLUGINS_NAME . DIRECTORY_SEPARATOR . AI1WM_ENDURANCE_BROWSER_CACHE_NAME,
37
+ );
38
+
39
// Open the archive file for reading
40
$archive = new Ai1wm_Extractor( ai1wm_archive_path( $params ) );
41
42
// Unpack mu-plugins files
43
+ $archive->extract_by_files_array( WP_CONTENT_DIR, array( AI1WM_MUPLUGINS_NAME ), $exclude_files );
44
45
// Close the archive file
46
$archive->close();
lib/model/import/class-ai1wm-import-validate.php CHANGED
<
@@ -38,6 +38,13 @@ class Ai1wm_Import_Validate {
38
);
39
}
40
41