All-in-One WP Migration - Version 5.52

Version Description

  • Simplify the text on import page
  • Fix an issue with special characters on export and import
  • Fix an issue with export and import of large files
Download this release

Release Info

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

Code changes from version 5.51 to 5.52

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: 5.51
9
  * Text Domain: all-in-one-wp-migration
10
  * Domain Path: /languages
11
  * Network: True
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: 5.52
9
  * Text Domain: all-in-one-wp-migration
10
  * Domain Path: /languages
11
  * Network: True
constants.php CHANGED
@@ -38,7 +38,7 @@ if ( function_exists( 'gethostname' ) && in_array( gethostname(), $local ) ) {
38
  // ==================
39
  // = Plugin Version =
40
  // ==================
41
- define( 'AI1WM_VERSION', '5.51' );
42
 
43
  // ===============
44
  // = Plugin Name =
@@ -185,10 +185,10 @@ define( 'AI1WM_ERROR_NAME', 'error.log' );
185
  // ==========
186
  define( 'AI1WM_URL_IP', 'ai1wm_url_ip' );
187
 
188
- // =================
189
- // = URL Transport =
190
- // =================
191
- define( 'AI1WM_URL_TRANSPORT', 'ai1wm_url_transport' );
192
 
193
  // ==============
194
  // = Secret Key =
38
  // ==================
39
  // = Plugin Version =
40
  // ==================
41
+ define( 'AI1WM_VERSION', '5.52' );
42
 
43
  // ===============
44
  // = Plugin Name =
185
  // ==========
186
  define( 'AI1WM_URL_IP', 'ai1wm_url_ip' );
187
 
188
+ // ===============
189
+ // = URL Adapter =
190
+ // ===============
191
+ define( 'AI1WM_URL_ADAPTER', 'ai1wm_url_adapter' );
192
 
193
  // ==============
194
  // = Secret Key =
lib/controller/class-ai1wm-resolve-controller.php CHANGED
@@ -55,12 +55,12 @@ class Ai1wm_Resolve_Controller {
55
  update_option( AI1WM_URL_IP, $ip );
56
  }
57
 
58
- // Set transport layer
59
- if ( isset( $params['url_transport'] ) && ( $transport = $params['url_transport'] ) ) {
60
- if ( $transport === 'curl' ) {
61
- update_option( AI1WM_URL_TRANSPORT, 'curl' );
62
  } else {
63
- update_option( AI1WM_URL_TRANSPORT, 'stream' );
64
  }
65
  }
66
  }
55
  update_option( AI1WM_URL_IP, $ip );
56
  }
57
 
58
+ // Set adapter
59
+ if ( isset( $params['url_adapter'] ) && ( $adapter = $params['url_adapter'] ) ) {
60
+ if ( $adapter === 'curl' ) {
61
+ update_option( AI1WM_URL_ADAPTER, 'curl' );
62
  } else {
63
+ update_option( AI1WM_URL_ADAPTER, 'stream' );
64
  }
65
  }
66
  }
lib/model/class-ai1wm-extensions.php CHANGED
@@ -76,7 +76,7 @@ class Ai1wm_Extensions {
76
  'about' => AI1WMME_PLUGIN_ABOUT,
77
  'basename' => AI1WMME_PLUGIN_BASENAME,
78
  'version' => AI1WMME_VERSION,
79
- 'requires' => '3.23',
80
  'short' => AI1WMME_PLUGIN_SHORT,
81
  );
82
  }
76
  'about' => AI1WMME_PLUGIN_ABOUT,
77
  'basename' => AI1WMME_PLUGIN_BASENAME,
78
  'version' => AI1WMME_VERSION,
79
+ 'requires' => '3.24',
80
  'short' => AI1WMME_PLUGIN_SHORT,
81
  );
82
  }
lib/model/class-ai1wm-http.php CHANGED
@@ -35,18 +35,18 @@ class Ai1wm_Http {
35
  // Get IP address
36
  $ip = get_option( AI1WM_URL_IP );
37
 
38
- // Get transport
39
- $transport = get_option( AI1WM_URL_TRANSPORT );
40
 
41
  // HTTP request
42
- Ai1wm_Http::request( $url, $ip, $transport, $params );
43
  }
44
 
45
  public static function resolve( $url ) {
46
 
47
- // Reset IP address and transport layer
48
  delete_option( AI1WM_URL_IP );
49
- delete_option( AI1WM_URL_TRANSPORT );
50
 
51
  // Set secret
52
  $secret_key = get_option( AI1WM_SECRET_KEY );
@@ -67,7 +67,7 @@ class Ai1wm_Http {
67
  $local = gethostbyname( $host );
68
 
69
  // HTTP resolve
70
- foreach ( array( 'stream', 'curl' ) as $transport ) {
71
  foreach ( array( $server, $local, $host ) as $ip ) {
72
 
73
  // Add IPv6 support
@@ -76,10 +76,10 @@ class Ai1wm_Http {
76
  }
77
 
78
  // HTTP request
79
- Ai1wm_Http::request( $url, $ip, $transport, array(
80
  'secret_key' => $secret_key,
81
  'url_ip' => $ip,
82
- 'url_transport' => $transport,
83
  ) );
84
 
85
  // HTTP response
@@ -88,8 +88,8 @@ class Ai1wm_Http {
88
  // Flush WP cache
89
  ai1wm_cache_flush();
90
 
91
- // Is valid transport layer?
92
- if ( get_option( AI1WM_URL_IP ) && get_option( AI1WM_URL_TRANSPORT ) ) {
93
  return;
94
  }
95
  }
@@ -104,7 +104,7 @@ class Ai1wm_Http {
104
  ) );
105
  }
106
 
107
- public static function request( $url, $ip, $transport, $params = array() ) {
108
  // Set host
109
  $host = parse_url( $url, PHP_URL_HOST );
110
 
@@ -126,6 +126,13 @@ class Ai1wm_Http {
126
  $headers[] = "Host: {$host}";
127
  }
128
 
 
 
 
 
 
 
 
129
  // Add authorization header
130
  if ( ( $user = get_option( AI1WM_AUTH_USER ) ) && ( $password = get_option( AI1WM_AUTH_PASSWORD ) ) ) {
131
  if ( ( $hash = base64_encode( "{$user}:{$password}" ) ) ) {
@@ -134,6 +141,6 @@ class Ai1wm_Http {
134
  }
135
 
136
  // HTTP request
137
- Ai1wm_Http_Factory::create( $transport )->get( add_query_arg( $params, $url ), $headers );
138
  }
139
  }
35
  // Get IP address
36
  $ip = get_option( AI1WM_URL_IP );
37
 
38
+ // Get adapter
39
+ $adapter = get_option( AI1WM_URL_ADAPTER );
40
 
41
  // HTTP request
42
+ Ai1wm_Http::request( $url, $ip, $adapter, $params );
43
  }
44
 
45
  public static function resolve( $url ) {
46
 
47
+ // Reset IP address and adapter
48
  delete_option( AI1WM_URL_IP );
49
+ delete_option( AI1WM_URL_ADAPTER );
50
 
51
  // Set secret
52
  $secret_key = get_option( AI1WM_SECRET_KEY );
67
  $local = gethostbyname( $host );
68
 
69
  // HTTP resolve
70
+ foreach ( array( 'stream', 'curl' ) as $adapter ) {
71
  foreach ( array( $server, $local, $host ) as $ip ) {
72
 
73
  // Add IPv6 support
76
  }
77
 
78
  // HTTP request
79
+ Ai1wm_Http::request( $url, $ip, $adapter, array(
80
  'secret_key' => $secret_key,
81
  'url_ip' => $ip,
82
+ 'url_adapter' => $adapter,
83
  ) );
84
 
85
  // HTTP response
88
  // Flush WP cache
89
  ai1wm_cache_flush();
90
 
91
+ // Is valid adapter?
92
+ if ( get_option( AI1WM_URL_IP ) && get_option( AI1WM_URL_ADAPTER ) ) {
93
  return;
94
  }
95
  }
104
  ) );
105
  }
106
 
107
+ public static function request( $url, $ip, $adapter, $params = array() ) {
108
  // Set host
109
  $host = parse_url( $url, PHP_URL_HOST );
110
 
126
  $headers[] = "Host: {$host}";
127
  }
128
 
129
+ // Set user agent header
130
+ if ( ! empty( $_SERVER['HTTP_USER_AGENT'] ) ) {
131
+ $headers[] = "User-Agent: {$_SERVER['HTTP_USER_AGENT']}";
132
+ } else {
133
+ $headers[] = "User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_5) AppleWebKit/537.36 (KHTML, like Gecko)";
134
+ }
135
+
136
  // Add authorization header
137
  if ( ( $user = get_option( AI1WM_AUTH_USER ) ) && ( $password = get_option( AI1WM_AUTH_PASSWORD ) ) ) {
138
  if ( ( $hash = base64_encode( "{$user}:{$password}" ) ) ) {
141
  }
142
 
143
  // HTTP request
144
+ Ai1wm_Http_Factory::create( $adapter )->get( add_query_arg( ai1wm_urlencode( $params ), $url ), $headers );
145
  }
146
  }
lib/model/export/class-ai1wm-export-content.php CHANGED
@@ -96,10 +96,10 @@ class Ai1wm_Export_Content {
96
  try {
97
 
98
  // Add file to archive
99
- if ( ( $content_offset = $archive->add_file( WP_CONTENT_DIR . DIRECTORY_SEPARATOR . $path, $path, $current_filesize, $content_offset, 10 ) ) ) {
100
 
101
- // Set progress
102
- if ( ( $processed += $content_offset ) ) {
103
  $progress = (int) ( ( $processed / $total_size ) * 100 );
104
  }
105
 
@@ -110,11 +110,14 @@ class Ai1wm_Export_Content {
110
  $params['current_filesize'] = $archive->get_current_filesize();
111
 
112
  // Set content offset
113
- $params['content_offset'] = $content_offset;
114
 
115
  // Set filemap offset
116
  $params['filemap_offset'] = $filemap_offset;
117
 
 
 
 
118
  // Set completed flag
119
  $params['completed'] = false;
120
 
@@ -124,6 +127,11 @@ class Ai1wm_Export_Content {
124
  return $params;
125
  }
126
 
 
 
 
 
 
127
  // Set current filesize
128
  $current_filesize = 0;
129
 
@@ -137,9 +145,6 @@ class Ai1wm_Export_Content {
137
  // Skip bad file permissions
138
  }
139
 
140
- // Increment processed files
141
- $processed += $archive->get_current_filesize();
142
-
143
  // More than 10 seconds have passed, break and do another request
144
  if ( ( microtime( true ) - $start ) > 10 ) {
145
  $completed = false;
@@ -147,6 +152,7 @@ class Ai1wm_Export_Content {
147
  }
148
  }
149
 
 
150
  $archive->close();
151
  }
152
 
96
  try {
97
 
98
  // Add file to archive
99
+ if ( ( $current_offset = $archive->add_file( WP_CONTENT_DIR . DIRECTORY_SEPARATOR . $path, $path, $current_filesize, $content_offset, 10 ) ) ) {
100
 
101
+ // What percent of files have we processed?
102
+ if ( ( $processed += ( $current_offset - $content_offset ) ) ) {
103
  $progress = (int) ( ( $processed / $total_size ) * 100 );
104
  }
105
 
110
  $params['current_filesize'] = $archive->get_current_filesize();
111
 
112
  // Set content offset
113
+ $params['content_offset'] = $current_offset;
114
 
115
  // Set filemap offset
116
  $params['filemap_offset'] = $filemap_offset;
117
 
118
+ // Set processed files
119
+ $params['processed'] = $processed;
120
+
121
  // Set completed flag
122
  $params['completed'] = false;
123
 
127
  return $params;
128
  }
129
 
130
+ // Increment processed files
131
+ if ( empty( $content_offset ) ) {
132
+ $processed += $archive->get_current_filesize();
133
+ }
134
+
135
  // Set current filesize
136
  $current_filesize = 0;
137
 
145
  // Skip bad file permissions
146
  }
147
 
 
 
 
148
  // More than 10 seconds have passed, break and do another request
149
  if ( ( microtime( true ) - $start ) > 10 ) {
150
  $completed = false;
152
  }
153
  }
154
 
155
+ // Close the archive file
156
  $archive->close();
157
  }
158
 
lib/model/import/class-ai1wm-import-content.php CHANGED
@@ -100,20 +100,30 @@ class Ai1wm_Import_Content {
100
 
101
  // Set extract paths
102
  foreach ( $blogs as $blog ) {
103
- if ( defined( 'UPLOADBLOGSDIR' ) ) {
104
- // Old sites dir style
105
- $old_paths[] = ai1wm_files_path( $blog->Old->Id );
106
- $new_paths[] = ai1wm_files_path( $blogs->New->Id );
107
-
108
- // New sites dir style
109
- $old_paths[] = ai1wm_sites_path( $blog->Old->Id );
110
- $new_paths[] = ai1wm_files_path( $blog->New->Id );
111
- } else {
112
- // Old sites dir style
113
- $old_paths[] = ai1wm_files_path( $blog->Old->Id );
114
- $new_paths[] = ai1wm_sites_path( $blog->New->Id );
 
 
 
 
 
 
 
 
115
 
116
- // New sites dir style
 
 
117
  $old_paths[] = ai1wm_sites_path( $blog->Old->Id );
118
  $new_paths[] = ai1wm_sites_path( $blog->New->Id );
119
  }
@@ -134,10 +144,10 @@ class Ai1wm_Import_Content {
134
  ) );
135
 
136
  // Extract a file from archive to WP_CONTENT_DIR
137
- if ( ( $content_offset = $archive->extract_one_file_to( WP_CONTENT_DIR, $exclude_files, $old_paths, $new_paths, $content_offset, 10 ) ) ) {
138
 
139
- // Set progress
140
- if ( ( $processed += $content_offset ) ) {
141
  $progress = (int) ( ( $processed / $total_size ) * 100 );
142
  }
143
 
@@ -145,11 +155,14 @@ class Ai1wm_Import_Content {
145
  Ai1wm_Status::info( sprintf( __( 'Restoring %d files...<br />%d%% complete', AI1WM_PLUGIN_NAME ), $total_files, $progress ) );
146
 
147
  // Set content offset
148
- $params['content_offset'] = $content_offset;
149
 
150
  // Set archive offset
151
  $params['archive_offset'] = $archive_offset;
152
 
 
 
 
153
  // Set completed flag
154
  $params['completed'] = false;
155
 
@@ -159,6 +172,11 @@ class Ai1wm_Import_Content {
159
  return $params;
160
  }
161
 
 
 
 
 
 
162
  // Set content offset
163
  $content_offset = 0;
164
 
@@ -169,9 +187,6 @@ class Ai1wm_Import_Content {
169
  // Skip bad file permissions
170
  }
171
 
172
- // Increment processed files
173
- $processed += $archive->get_current_filesize();
174
-
175
  // More than 10 seconds have passed, break and do another request
176
  if ( ( microtime( true ) - $start ) > 10 ) {
177
  $completed = false;
100
 
101
  // Set extract paths
102
  foreach ( $blogs as $blog ) {
103
+ if ( ai1wm_main_site( $blog->Old->Id ) === false ) {
104
+ if ( defined( 'UPLOADBLOGSDIR' ) ) {
105
+ // Old sites dir style
106
+ $old_paths[] = ai1wm_files_path( $blog->Old->Id );
107
+ $new_paths[] = ai1wm_files_path( $blogs->New->Id );
108
+
109
+ // New sites dir style
110
+ $old_paths[] = ai1wm_sites_path( $blog->Old->Id );
111
+ $new_paths[] = ai1wm_files_path( $blog->New->Id );
112
+ } else {
113
+ // Old sites dir style
114
+ $old_paths[] = ai1wm_files_path( $blog->Old->Id );
115
+ $new_paths[] = ai1wm_sites_path( $blog->New->Id );
116
+
117
+ // New sites dir style
118
+ $old_paths[] = ai1wm_sites_path( $blog->Old->Id );
119
+ $new_paths[] = ai1wm_sites_path( $blog->New->Id );
120
+ }
121
+ }
122
+ }
123
 
124
+ // Set base site extract paths (should be added at the end of arrays)
125
+ foreach ( $blogs as $blog ) {
126
+ if ( ai1wm_main_site( $blog->Old->Id ) === true ) {
127
  $old_paths[] = ai1wm_sites_path( $blog->Old->Id );
128
  $new_paths[] = ai1wm_sites_path( $blog->New->Id );
129
  }
144
  ) );
145
 
146
  // Extract a file from archive to WP_CONTENT_DIR
147
+ if ( ( $current_offset = $archive->extract_one_file_to( WP_CONTENT_DIR, $exclude_files, $old_paths, $new_paths, $content_offset, 10 ) ) ) {
148
 
149
+ // What percent of files have we processed?
150
+ if ( ( $processed += ( $current_offset - $content_offset ) ) ) {
151
  $progress = (int) ( ( $processed / $total_size ) * 100 );
152
  }
153
 
155
  Ai1wm_Status::info( sprintf( __( 'Restoring %d files...<br />%d%% complete', AI1WM_PLUGIN_NAME ), $total_files, $progress ) );
156
 
157
  // Set content offset
158
+ $params['content_offset'] = $current_offset;
159
 
160
  // Set archive offset
161
  $params['archive_offset'] = $archive_offset;
162
 
163
+ // Set processed files
164
+ $params['processed'] = $processed;
165
+
166
  // Set completed flag
167
  $params['completed'] = false;
168
 
172
  return $params;
173
  }
174
 
175
+ // Increment processed files
176
+ if ( empty( $content_offset ) ) {
177
+ $processed += $archive->get_current_filesize();
178
+ }
179
+
180
  // Set content offset
181
  $content_offset = 0;
182
 
187
  // Skip bad file permissions
188
  }
189
 
 
 
 
190
  // More than 10 seconds have passed, break and do another request
191
  if ( ( microtime( true ) - $start ) > 10 ) {
192
  $completed = false;
lib/model/import/class-ai1wm-import-database.php CHANGED
@@ -366,8 +366,8 @@ class Ai1wm_Import_Database {
366
  // Get URL IP
367
  $url_ip = get_option( AI1WM_URL_IP );
368
 
369
- // Get URL transport
370
- $url_transport = get_option( AI1WM_URL_TRANSPORT );
371
 
372
  // Get secret key
373
  $secret_key = get_option( AI1WM_SECRET_KEY );
@@ -449,8 +449,8 @@ class Ai1wm_Import_Database {
449
  // Set the new URL IP
450
  update_option( AI1WM_URL_IP, $url_ip );
451
 
452
- // Set the new URL transport
453
- update_option( AI1WM_URL_TRANSPORT, $url_transport );
454
 
455
  // Set the new secret key value
456
  update_option( AI1WM_SECRET_KEY, $secret_key );
366
  // Get URL IP
367
  $url_ip = get_option( AI1WM_URL_IP );
368
 
369
+ // Get URL adapter
370
+ $url_adapter = get_option( AI1WM_URL_ADAPTER );
371
 
372
  // Get secret key
373
  $secret_key = get_option( AI1WM_SECRET_KEY );
449
  // Set the new URL IP
450
  update_option( AI1WM_URL_IP, $url_ip );
451
 
452
+ // Set the new URL adapter
453
+ update_option( AI1WM_URL_ADAPTER, $url_adapter );
454
 
455
  // Set the new secret key value
456
  update_option( AI1WM_SECRET_KEY, $secret_key );
lib/view/assets/javascript/backups.min.js CHANGED
@@ -826,7 +826,7 @@
826
  var action = $('<div></div>');
827
 
828
  // Create title
829
- var title = $('<span></span>').addClass('ai1wm-title-grey').text('Update subsite name');
830
 
831
  // Create continue button
832
  var continueButton = $('<button class="ai1wm-button-green">Continue</button>').on('click', function () {
826
  var action = $('<div></div>');
827
 
828
  // Create title
829
+ var title = $('<span></span>').addClass('ai1wm-title-grey').text('Update subsite URL');
830
 
831
  // Create continue button
832
  var continueButton = $('<button class="ai1wm-button-green">Continue</button>').on('click', function () {
lib/view/assets/javascript/import.min.js CHANGED
@@ -785,7 +785,7 @@
785
  var action = $('<div></div>');
786
 
787
  // Create title
788
- var title = $('<span></span>').addClass('ai1wm-title-grey').text('Update subsite name');
789
 
790
  // Create continue button
791
  var continueButton = $('<button class="ai1wm-button-green">Continue</button>').on('click', function () {
785
  var action = $('<div></div>');
786
 
787
  // Create title
788
+ var title = $('<span></span>').addClass('ai1wm-title-grey').text('Update subsite URL');
789
 
790
  // Create continue button
791
  var continueButton = $('<button class="ai1wm-button-green">Continue</button>').on('click', function () {
lib/view/import/index.php CHANGED
@@ -33,8 +33,7 @@
33
  <?php include AI1WM_TEMPLATES_PATH . '/common/report-problem.php'; ?>
34
 
35
  <p class="ai1wm-clear">
36
- <?php _e( 'Use the box below to upload the archive file.', AI1WM_PLUGIN_NAME ); ?><br />
37
- <?php _e( 'When the file is successfully uploaded, it will be automatically restored on the current WordPress instance.', AI1WM_PLUGIN_NAME ); ?>
38
  </p>
39
 
40
  <?php include AI1WM_TEMPLATES_PATH . '/import/import-buttons.php'; ?>
33
  <?php include AI1WM_TEMPLATES_PATH . '/common/report-problem.php'; ?>
34
 
35
  <p class="ai1wm-clear">
36
+ <?php _e( 'Use the box below to upload a wpress file.', AI1WM_PLUGIN_NAME ); ?><br />
 
37
  </p>
38
 
39
  <?php include AI1WM_TEMPLATES_PATH . '/import/import-buttons.php'; ?>
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: yani.iliev, bangelov, pimjitsawang
3
  Tags: db migration, migration, wordpress migration, db backup, db restore, website backup, website restore, website migration, website deploy, wordpress deploy, db backup, database export, database serialization, database find replace
4
  Requires at least: 3.3
5
  Tested up to: 4.6
6
- Stable tag: 5.51
7
  License: GPLv2 or later
8
 
9
  All-in-One WP Migration is the only tool that you will ever need to migrate a WordPress site.
@@ -78,6 +78,11 @@ All in One WP Plugin is the first plugin to offer true mobile experience on Word
78
  3. Plugin Menu
79
 
80
  == Changelog ==
 
 
 
 
 
81
  = 5.51 =
82
  * Add support for utf8mb4_unicode_520_ci database collation
83
 
3
  Tags: db migration, migration, wordpress migration, db backup, db restore, website backup, website restore, website migration, website deploy, wordpress deploy, db backup, database export, database serialization, database find replace
4
  Requires at least: 3.3
5
  Tested up to: 4.6
6
+ Stable tag: 5.52
7
  License: GPLv2 or later
8
 
9
  All-in-One WP Migration is the only tool that you will ever need to migrate a WordPress site.
78
  3. Plugin Menu
79
 
80
  == Changelog ==
81
+ = 5.52 =
82
+ * Simplify the text on import page
83
+ * Fix an issue with special characters on export and import
84
+ * Fix an issue with export and import of large files
85
+
86
  = 5.51 =
87
  * Add support for utf8mb4_unicode_520_ci database collation
88
 
uninstall.php CHANGED
@@ -36,7 +36,7 @@ if ( defined( 'WP_UNINSTALL_PLUGIN' ) ) {
36
 
37
  // Delete any options or other data stored in the database here
38
  delete_option( AI1WM_URL_IP );
39
- delete_option( AI1WM_URL_TRANSPORT );
40
  delete_option( AI1WM_SECRET_KEY );
41
  delete_option( AI1WM_AUTH_USER );
42
  delete_option( AI1WM_AUTH_PASSWORD );
36
 
37
  // Delete any options or other data stored in the database here
38
  delete_option( AI1WM_URL_IP );
39
+ delete_option( AI1WM_URL_ADAPTER );
40
  delete_option( AI1WM_SECRET_KEY );
41
  delete_option( AI1WM_AUTH_USER );
42
  delete_option( AI1WM_AUTH_PASSWORD );