All-in-One WP Migration - Version 6.79

Version Description

Added

  • File import has been re-added with limits imposed by server using wp_max_upload_size(). This article describes how to adjust the limits How-to: Increase maximum upload file size
  • Clean storage directory of files and folders created more than 24 hours ago
  • Support for force-https-littlebizzy plugin
  • Support for wp-simple-firewall

Fixed

  • The restore a backup message explains to users how to restore their backups without having to use an premium extension
Download this release

Release Info

Developer yani.iliev
Plugin Icon 128x128 All-in-One WP Migration
Version 6.79
Comparing to
See all releases

Code changes from version 6.78 to 6.79

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.78
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: 6.79
9
  * Text Domain: all-in-one-wp-migration
10
  * Domain Path: /languages
11
  * Network: True
constants.php CHANGED
@@ -31,7 +31,7 @@ define( 'AI1WM_DEBUG', false );
31
  // ==================
32
  // = Plugin Version =
33
  // ==================
34
- define( 'AI1WM_VERSION', '6.78' );
35
 
36
  // ===============
37
  // = Plugin Name =
31
  // ==================
32
  // = Plugin Version =
33
  // ==================
34
+ define( 'AI1WM_VERSION', '6.79' );
35
 
36
  // ===============
37
  // = Plugin Name =
lib/controller/class-ai1wm-export-controller.php CHANGED
@@ -146,4 +146,40 @@ class Ai1wm_Export_Controller {
146
 
147
  return $headers;
148
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
149
  }
146
 
147
  return $headers;
148
  }
149
+
150
+ public static function cleanup() {
151
+ // Iterate over storage directory
152
+ $iterator = new Ai1wm_Recursive_Directory_Iterator( AI1WM_STORAGE_PATH );
153
+
154
+ // Exclude index.php
155
+ $iterator = new Ai1wm_Recursive_Exclude_Filter( $iterator, array( 'index.php' ) );
156
+
157
+ // Recursively iterate over content directory
158
+ $iterator = new Ai1wm_Recursive_Iterator_Iterator( $iterator, RecursiveIteratorIterator::CHILD_FIRST, RecursiveIteratorIterator::CATCH_GET_CHILD );
159
+
160
+ // We can't delete in the main loop since deletion updates mtime for parent folders
161
+ $files = $folders = array();
162
+ foreach ( $iterator as $item ) {
163
+ try {
164
+ if ( $item->getMTime() < time() - 23 * 60 * 60 ) {
165
+ if ( $item->isFile() ) {
166
+ $files[] = $item->getPathname();
167
+ } elseif ( $item->isDir() ) {
168
+ $folders[] = $item->getPathname();
169
+ }
170
+ }
171
+ } catch ( Exception $e ) {
172
+ }
173
+ }
174
+
175
+ // Delete outdated files
176
+ foreach ( $files as $file ) {
177
+ @unlink( $file );
178
+ }
179
+
180
+ // Delete outdated folders
181
+ foreach ( $folders as $folder ) {
182
+ Ai1wm_Directory::delete( $folder );
183
+ }
184
+ }
185
  }
lib/controller/class-ai1wm-main-controller.php CHANGED
@@ -79,6 +79,9 @@ class Ai1wm_Main_Controller {
79
  // Setup folders
80
  add_action( 'admin_init', array( $this, 'setup_folders' ) );
81
 
 
 
 
82
  // Load text domain
83
  add_action( 'admin_init', array( $this, 'load_textdomain' ) );
84
 
@@ -146,6 +149,7 @@ class Ai1wm_Main_Controller {
146
  add_filter( 'ai1wm_export', 'Ai1wm_Export_Clean::execute', 300 );
147
 
148
  // Add import commands
 
149
  add_filter( 'ai1wm_import', 'Ai1wm_Import_Compatibility::execute', 10 );
150
  add_filter( 'ai1wm_import', 'Ai1wm_Import_Validate::execute', 50 );
151
  add_filter( 'ai1wm_import', 'Ai1wm_Import_Confirm::execute', 100 );
@@ -216,6 +220,9 @@ class Ai1wm_Main_Controller {
216
 
217
  // Add "Check for updates" link to plugin list page
218
  add_filter( 'plugin_row_meta', 'Ai1wm_Updater_Controller::plugin_row_meta', 10, 2 );
 
 
 
219
  }
220
 
221
  /**
@@ -266,6 +273,18 @@ class Ai1wm_Main_Controller {
266
  }
267
  }
268
 
 
 
 
 
 
 
 
 
 
 
 
 
269
  /**
270
  * Create storage folder
271
  *
@@ -674,17 +693,12 @@ class Ai1wm_Main_Controller {
674
  ) );
675
 
676
  wp_localize_script( 'ai1wm_import', 'ai1wm_uploader', array(
677
- 'chunk_size' => apply_filters( 'ai1wm_max_chunk_size', AI1WM_MAX_CHUNK_SIZE ),
678
- 'max_retries' => apply_filters( 'ai1wm_max_chunk_retries', AI1WM_MAX_CHUNK_RETRIES ),
679
- 'url' => wp_make_link_relative( admin_url( 'admin-ajax.php?action=ai1wm_import' ) ),
680
- 'params' => array(
681
  'priority' => 5,
682
  'secret_key' => get_option( AI1WM_SECRET_KEY ),
683
  ),
684
- 'filters' => array(
685
- 'ai1wm_archive_extension' => array( 'wpress' ),
686
- 'ai1wm_archive_size' => apply_filters( 'ai1wm_max_file_size', AI1WM_MAX_FILE_SIZE ),
687
- ),
688
  ) );
689
 
690
  wp_localize_script( 'ai1wm_import', 'ai1wm_import', array(
@@ -715,7 +729,21 @@ class Ai1wm_Main_Controller {
715
  'how_may_we_help_you' => __( 'How may we help you?', AI1WM_PLUGIN_NAME ),
716
  'thanks_for_submitting_your_feedback' => __( 'Thanks for submitting your feedback!', AI1WM_PLUGIN_NAME ),
717
  'thanks_for_submitting_your_request' => __( 'Thanks for submitting your request!', AI1WM_PLUGIN_NAME ),
718
- 'import_from_file' => __( 'Import from file is available via a free extension. <a href="https://import.wp-migration.com" target="_blank">Download it here</a>', AI1WM_PLUGIN_NAME ),
 
 
 
 
 
 
 
 
 
 
 
 
 
 
719
  'invalid_archive_extension' => __(
720
  'The file type that you have tried to upload is not compatible with this plugin. ' .
721
  'Please ensure that your file is a <strong>.wpress</strong> file that was created with the All-in-One WP migration plugin. ' .
@@ -820,6 +848,7 @@ class Ai1wm_Main_Controller {
820
  'thanks_for_submitting_your_request' => __( 'Thanks for submitting your request!', AI1WM_PLUGIN_NAME ),
821
  'want_to_delete_this_file' => __( 'Are you sure you want to delete this file?', AI1WM_PLUGIN_NAME ),
822
  'unlimited' => __( 'Restoring a backup is available via Unlimited extension. <a href="https://servmask.com/products/unlimited-extension" target="_blank">Get it here</a>', AI1WM_PLUGIN_NAME ),
 
823
  ) );
824
  }
825
 
79
  // Setup folders
80
  add_action( 'admin_init', array( $this, 'setup_folders' ) );
81
 
82
+ // Schedule crons
83
+ add_action( 'admin_init', array( $this, 'schedule_crons' ) );
84
+
85
  // Load text domain
86
  add_action( 'admin_init', array( $this, 'load_textdomain' ) );
87
 
149
  add_filter( 'ai1wm_export', 'Ai1wm_Export_Clean::execute', 300 );
150
 
151
  // Add import commands
152
+ add_filter( 'ai1wm_import', 'Ai1wm_Import_Upload::execute', 5 );
153
  add_filter( 'ai1wm_import', 'Ai1wm_Import_Compatibility::execute', 10 );
154
  add_filter( 'ai1wm_import', 'Ai1wm_Import_Validate::execute', 50 );
155
  add_filter( 'ai1wm_import', 'Ai1wm_Import_Confirm::execute', 100 );
220
 
221
  // Add "Check for updates" link to plugin list page
222
  add_filter( 'plugin_row_meta', 'Ai1wm_Updater_Controller::plugin_row_meta', 10, 2 );
223
+
224
+ // Add storage folder daily cleanup cron
225
+ add_action( 'ai1wm_cleanup_cron', 'Ai1wm_Export_Controller::cleanup' );
226
  }
227
 
228
  /**
273
  }
274
  }
275
 
276
+ /**
277
+ * Schedule cron tasks for plugin operation, if not done yet
278
+ *
279
+ * @return void
280
+ */
281
+ public function schedule_crons() {
282
+ // Check if storage cleanup cron is scheduled
283
+ if ( ! wp_next_scheduled( 'ai1wm_cleanup_cron' ) ) {
284
+ Ai1wm_Cron::add( 'ai1wm_cleanup_cron', 'daily' );
285
+ }
286
+ }
287
+
288
  /**
289
  * Create storage folder
290
  *
693
  ) );
694
 
695
  wp_localize_script( 'ai1wm_import', 'ai1wm_uploader', array(
696
+ 'max_file_size' => wp_max_upload_size(),
697
+ 'url' => wp_make_link_relative( admin_url( 'admin-ajax.php?action=ai1wm_import' ) ),
698
+ 'params' => array(
 
699
  'priority' => 5,
700
  'secret_key' => get_option( AI1WM_SECRET_KEY ),
701
  ),
 
 
 
 
702
  ) );
703
 
704
  wp_localize_script( 'ai1wm_import', 'ai1wm_import', array(
729
  'how_may_we_help_you' => __( 'How may we help you?', AI1WM_PLUGIN_NAME ),
730
  'thanks_for_submitting_your_feedback' => __( 'Thanks for submitting your feedback!', AI1WM_PLUGIN_NAME ),
731
  'thanks_for_submitting_your_request' => __( 'Thanks for submitting your request!', AI1WM_PLUGIN_NAME ),
732
+ 'import_from_file' => sprintf(
733
+ __(
734
+ 'Your file exceeds the maximum upload size for this site: <strong>%s</strong><br />%s%s',
735
+ AI1WM_PLUGIN_NAME
736
+ ),
737
+ esc_html( size_format( wp_max_upload_size() ) ),
738
+ __(
739
+ '<a href="https://help.servmask.com/2018/10/27/how-to-increase-maximum-upload-file-size-in-wordpress/" target="_blank">How-to: Increase maximum upload file size</a> or ',
740
+ AI1WM_PLUGIN_NAME
741
+ ),
742
+ __(
743
+ '<a href="https://import.wp-migration.com" target="_blank">Get unlimited</a>',
744
+ AI1WM_PLUGIN_NAME
745
+ )
746
+ ),
747
  'invalid_archive_extension' => __(
748
  'The file type that you have tried to upload is not compatible with this plugin. ' .
749
  'Please ensure that your file is a <strong>.wpress</strong> file that was created with the All-in-One WP migration plugin. ' .
848
  'thanks_for_submitting_your_request' => __( 'Thanks for submitting your request!', AI1WM_PLUGIN_NAME ),
849
  'want_to_delete_this_file' => __( 'Are you sure you want to delete this file?', AI1WM_PLUGIN_NAME ),
850
  'unlimited' => __( 'Restoring a backup is available via Unlimited extension. <a href="https://servmask.com/products/unlimited-extension" target="_blank">Get it here</a>', AI1WM_PLUGIN_NAME ),
851
+ 'restore_from_file' => __( '"Restore" functionality has been moved to a paid extension. <a href="https://servmask.com/products/unlimited-extension" target="_blank">Get it here</a> or download the backup and then use "Import from file".', AI1WM_PLUGIN_NAME ),
852
  ) );
853
  }
854
 
lib/model/class-ai1wm-extensions.php CHANGED
@@ -93,7 +93,7 @@ class Ai1wm_Extensions {
93
  'about' => AI1WMDE_PLUGIN_ABOUT,
94
  'basename' => AI1WMDE_PLUGIN_BASENAME,
95
  'version' => AI1WMDE_VERSION,
96
- 'requires' => '3.32',
97
  'short' => AI1WMDE_PLUGIN_SHORT,
98
  );
99
  }
@@ -106,7 +106,7 @@ class Ai1wm_Extensions {
106
  'about' => AI1WMTE_PLUGIN_ABOUT,
107
  'basename' => AI1WMTE_PLUGIN_BASENAME,
108
  'version' => AI1WMTE_VERSION,
109
- 'requires' => '1.0',
110
  'short' => AI1WMTE_PLUGIN_SHORT,
111
  );
112
  }
@@ -119,7 +119,7 @@ class Ai1wm_Extensions {
119
  'about' => AI1WMFE_PLUGIN_ABOUT,
120
  'basename' => AI1WMFE_PLUGIN_BASENAME,
121
  'version' => AI1WMFE_VERSION,
122
- 'requires' => '2.37',
123
  'short' => AI1WMFE_PLUGIN_SHORT,
124
  );
125
  }
@@ -145,7 +145,7 @@ class Ai1wm_Extensions {
145
  'about' => AI1WMGE_PLUGIN_ABOUT,
146
  'basename' => AI1WMGE_PLUGIN_BASENAME,
147
  'version' => AI1WMGE_VERSION,
148
- 'requires' => '2.36',
149
  'short' => AI1WMGE_PLUGIN_SHORT,
150
  );
151
  }
@@ -197,7 +197,7 @@ class Ai1wm_Extensions {
197
  'about' => AI1WMME_PLUGIN_ABOUT,
198
  'basename' => AI1WMME_PLUGIN_BASENAME,
199
  'version' => AI1WMME_VERSION,
200
- 'requires' => '3.60',
201
  'short' => AI1WMME_PLUGIN_SHORT,
202
  );
203
  }
@@ -249,7 +249,7 @@ class Ai1wm_Extensions {
249
  'about' => AI1WMUE_PLUGIN_ABOUT,
250
  'basename' => AI1WMUE_PLUGIN_BASENAME,
251
  'version' => AI1WMUE_VERSION,
252
- 'requires' => '2.19',
253
  'short' => AI1WMUE_PLUGIN_SHORT,
254
  );
255
  }
@@ -262,7 +262,7 @@ class Ai1wm_Extensions {
262
  'about' => AI1WMLE_PLUGIN_ABOUT,
263
  'basename' => AI1WMLE_PLUGIN_BASENAME,
264
  'version' => AI1WMLE_VERSION,
265
- 'requires' => '2.27',
266
  'short' => AI1WMLE_PLUGIN_SHORT,
267
  );
268
  }
93
  'about' => AI1WMDE_PLUGIN_ABOUT,
94
  'basename' => AI1WMDE_PLUGIN_BASENAME,
95
  'version' => AI1WMDE_VERSION,
96
+ 'requires' => '3.33',
97
  'short' => AI1WMDE_PLUGIN_SHORT,
98
  );
99
  }
106
  'about' => AI1WMTE_PLUGIN_ABOUT,
107
  'basename' => AI1WMTE_PLUGIN_BASENAME,
108
  'version' => AI1WMTE_VERSION,
109
+ 'requires' => '1.1',
110
  'short' => AI1WMTE_PLUGIN_SHORT,
111
  );
112
  }
119
  'about' => AI1WMFE_PLUGIN_ABOUT,
120
  'basename' => AI1WMFE_PLUGIN_BASENAME,
121
  'version' => AI1WMFE_VERSION,
122
+ 'requires' => '2.40',
123
  'short' => AI1WMFE_PLUGIN_SHORT,
124
  );
125
  }
145
  'about' => AI1WMGE_PLUGIN_ABOUT,
146
  'basename' => AI1WMGE_PLUGIN_BASENAME,
147
  'version' => AI1WMGE_VERSION,
148
+ 'requires' => '2.38',
149
  'short' => AI1WMGE_PLUGIN_SHORT,
150
  );
151
  }
197
  'about' => AI1WMME_PLUGIN_ABOUT,
198
  'basename' => AI1WMME_PLUGIN_BASENAME,
199
  'version' => AI1WMME_VERSION,
200
+ 'requires' => '3.61',
201
  'short' => AI1WMME_PLUGIN_SHORT,
202
  );
203
  }
249
  'about' => AI1WMUE_PLUGIN_ABOUT,
250
  'basename' => AI1WMUE_PLUGIN_BASENAME,
251
  'version' => AI1WMUE_VERSION,
252
+ 'requires' => '2.20',
253
  'short' => AI1WMUE_PLUGIN_SHORT,
254
  );
255
  }
262
  'about' => AI1WMLE_PLUGIN_ABOUT,
263
  'basename' => AI1WMLE_PLUGIN_BASENAME,
264
  'version' => AI1WMLE_VERSION,
265
+ 'requires' => '2.29',
266
  'short' => AI1WMLE_PLUGIN_SHORT,
267
  );
268
  }
lib/model/import/class-ai1wm-import-done.php CHANGED
@@ -50,6 +50,7 @@ class Ai1wm_Import_Done {
50
  ai1wm_discover_plugin_basename( 'really-simple-ssl/rlrsssl-really-simple-ssl.php' ),
51
  ai1wm_discover_plugin_basename( 'wordpress-https/wordpress-https.php' ),
52
  ai1wm_discover_plugin_basename( 'wp-force-ssl/wp-force-ssl.php' ),
 
53
  ) );
54
  }
55
 
@@ -62,6 +63,7 @@ class Ai1wm_Import_Done {
62
  ai1wm_discover_plugin_basename( 'mycustomwidget/my_custom_widget.php' ),
63
  ai1wm_discover_plugin_basename( 'lockdown-wp-admin/lockdown-wp-admin.php' ),
64
  ai1wm_discover_plugin_basename( 'rename-wp-login/rename-wp-login.php' ),
 
65
  ) );
66
 
67
  // Deactivate Jetpack modules
@@ -106,6 +108,7 @@ class Ai1wm_Import_Done {
106
  ai1wm_discover_plugin_basename( 'really-simple-ssl/rlrsssl-really-simple-ssl.php' ),
107
  ai1wm_discover_plugin_basename( 'wordpress-https/wordpress-https.php' ),
108
  ai1wm_discover_plugin_basename( 'wp-force-ssl/wp-force-ssl.php' ),
 
109
  ) );
110
  }
111
 
@@ -118,6 +121,7 @@ class Ai1wm_Import_Done {
118
  ai1wm_discover_plugin_basename( 'mycustomwidget/my_custom_widget.php' ),
119
  ai1wm_discover_plugin_basename( 'lockdown-wp-admin/lockdown-wp-admin.php' ),
120
  ai1wm_discover_plugin_basename( 'rename-wp-login/rename-wp-login.php' ),
 
121
  ) );
122
 
123
  // Deactivate Jetpack modules
@@ -164,6 +168,7 @@ class Ai1wm_Import_Done {
164
  ai1wm_discover_plugin_basename( 'really-simple-ssl/rlrsssl-really-simple-ssl.php' ),
165
  ai1wm_discover_plugin_basename( 'wordpress-https/wordpress-https.php' ),
166
  ai1wm_discover_plugin_basename( 'wp-force-ssl/wp-force-ssl.php' ),
 
167
  ) );
168
  }
169
 
@@ -176,6 +181,7 @@ class Ai1wm_Import_Done {
176
  ai1wm_discover_plugin_basename( 'mycustomwidget/my_custom_widget.php' ),
177
  ai1wm_discover_plugin_basename( 'lockdown-wp-admin/lockdown-wp-admin.php' ),
178
  ai1wm_discover_plugin_basename( 'rename-wp-login/rename-wp-login.php' ),
 
179
  ) );
180
 
181
  // Deactivate Jetpack modules
50
  ai1wm_discover_plugin_basename( 'really-simple-ssl/rlrsssl-really-simple-ssl.php' ),
51
  ai1wm_discover_plugin_basename( 'wordpress-https/wordpress-https.php' ),
52
  ai1wm_discover_plugin_basename( 'wp-force-ssl/wp-force-ssl.php' ),
53
+ ai1wm_discover_plugin_basename( 'force-https-littlebizzy/force-https.php' ),
54
  ) );
55
  }
56
 
63
  ai1wm_discover_plugin_basename( 'mycustomwidget/my_custom_widget.php' ),
64
  ai1wm_discover_plugin_basename( 'lockdown-wp-admin/lockdown-wp-admin.php' ),
65
  ai1wm_discover_plugin_basename( 'rename-wp-login/rename-wp-login.php' ),
66
+ ai1wm_discover_plugin_basename( 'wp-simple-firewall/icwp-wpsf.php' ),
67
  ) );
68
 
69
  // Deactivate Jetpack modules
108
  ai1wm_discover_plugin_basename( 'really-simple-ssl/rlrsssl-really-simple-ssl.php' ),
109
  ai1wm_discover_plugin_basename( 'wordpress-https/wordpress-https.php' ),
110
  ai1wm_discover_plugin_basename( 'wp-force-ssl/wp-force-ssl.php' ),
111
+ ai1wm_discover_plugin_basename( 'force-https-littlebizzy/force-https.php' ),
112
  ) );
113
  }
114
 
121
  ai1wm_discover_plugin_basename( 'mycustomwidget/my_custom_widget.php' ),
122
  ai1wm_discover_plugin_basename( 'lockdown-wp-admin/lockdown-wp-admin.php' ),
123
  ai1wm_discover_plugin_basename( 'rename-wp-login/rename-wp-login.php' ),
124
+ ai1wm_discover_plugin_basename( 'wp-simple-firewall/icwp-wpsf.php' ),
125
  ) );
126
 
127
  // Deactivate Jetpack modules
168
  ai1wm_discover_plugin_basename( 'really-simple-ssl/rlrsssl-really-simple-ssl.php' ),
169
  ai1wm_discover_plugin_basename( 'wordpress-https/wordpress-https.php' ),
170
  ai1wm_discover_plugin_basename( 'wp-force-ssl/wp-force-ssl.php' ),
171
+ ai1wm_discover_plugin_basename( 'force-https-littlebizzy/force-https.php' ),
172
  ) );
173
  }
174
 
181
  ai1wm_discover_plugin_basename( 'mycustomwidget/my_custom_widget.php' ),
182
  ai1wm_discover_plugin_basename( 'lockdown-wp-admin/lockdown-wp-admin.php' ),
183
  ai1wm_discover_plugin_basename( 'rename-wp-login/rename-wp-login.php' ),
184
+ ai1wm_discover_plugin_basename( 'wp-simple-firewall/icwp-wpsf.php' ),
185
  ) );
186
 
187
  // Deactivate Jetpack modules
lib/model/import/class-ai1wm-import-upload.php ADDED
@@ -0,0 +1,110 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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_Import_Upload {
27
+
28
+ private static function validate() {
29
+ if ( ! array_key_exists( 'upload-file', $_FILES ) || ! is_array( $_FILES['upload-file'] ) ) {
30
+ throw new Ai1wm_Import_Retry_Exception(
31
+ __( 'Missing upload file.', AI1WM_PLUGIN_NAME ),
32
+ 400
33
+ );
34
+ }
35
+
36
+ if ( ! array_key_exists( 'error', $_FILES['upload-file'] ) ) {
37
+ throw new Ai1wm_Import_Retry_Exception(
38
+ __( 'Missing error key in upload file.', AI1WM_PLUGIN_NAME ),
39
+ 400
40
+ );
41
+ }
42
+
43
+ if ( ! array_key_exists( 'tmp_name', $_FILES['upload-file'] ) ) {
44
+ throw new Ai1wm_Import_Retry_Exception(
45
+ __( 'Missing tmp_name in upload file.', AI1WM_PLUGIN_NAME ),
46
+ 400
47
+ );
48
+ }
49
+ }
50
+
51
+ public static function execute( $params ) {
52
+ self::validate();
53
+
54
+ $error = $_FILES['upload-file']['error'];
55
+ $upload = $_FILES['upload-file']['tmp_name'];
56
+ $archive = ai1wm_archive_path( $params );
57
+
58
+ switch ( $error ) {
59
+ case UPLOAD_ERR_OK:
60
+ try {
61
+ ai1wm_copy( $upload, $archive );
62
+ ai1wm_unlink( $upload );
63
+ } catch ( Exception $e ) {
64
+ throw new Ai1wm_Import_Retry_Exception(
65
+ sprintf(
66
+ __( 'Unable to upload the file because %s', AI1WM_PLUGIN_NAME ),
67
+ $e->getMessage()
68
+ ),
69
+ 400
70
+ );
71
+ }
72
+ break;
73
+ case UPLOAD_ERR_INI_SIZE:
74
+ case UPLOAD_ERR_FORM_SIZE:
75
+ case UPLOAD_ERR_PARTIAL:
76
+ case UPLOAD_ERR_NO_FILE:
77
+ // File is too large
78
+ throw new Ai1wm_Import_Retry_Exception(
79
+ __( 'The file is too large for this server.', AI1WM_PLUGIN_NAME ),
80
+ 413
81
+ );
82
+ case UPLOAD_ERR_NO_TMP_DIR:
83
+ throw new Ai1wm_Import_Retry_Exception(
84
+ __( 'Missing a temporary folder.', AI1WM_PLUGIN_NAME ),
85
+ 400
86
+ );
87
+ case UPLOAD_ERR_CANT_WRITE:
88
+ throw new Ai1wm_Import_Retry_Exception(
89
+ __( 'Failed to write file to disk.', AI1WM_PLUGIN_NAME ),
90
+ 400
91
+ );
92
+ case UPLOAD_ERR_EXTENSION:
93
+ throw new Ai1wm_Import_Retry_Exception(
94
+ __( 'A PHP extension stopped the file upload.', AI1WM_PLUGIN_NAME ),
95
+ 400
96
+ );
97
+ default:
98
+ throw new Ai1wm_Import_Retry_Exception(
99
+ sprintf(
100
+ __( 'Unrecognized error %s during upload.', AI1WM_PLUGIN_NAME ),
101
+ $error
102
+ ),
103
+ 400
104
+ );
105
+ }
106
+
107
+ echo json_encode( array( 'errors' => array() ) );
108
+ exit;
109
+ }
110
+ }
lib/view/assets/javascript/backups.min.js CHANGED
@@ -1211,8 +1211,12 @@ jQuery(document).ready(function ($) {
1211
  $('.ai1wm-backup-restore').click(function (e) {
1212
  e.preventDefault();
1213
 
1214
- if (!!Ai1wm.UnlimitedExtensionRestore) {
 
 
1215
  var restore = new Ai1wm.UnlimitedExtensionRestore($(this).data('archive'));
 
 
1216
  } else {
1217
  var restore = new Ai1wm.Restore($(this).data('archive'));
1218
  }
@@ -1255,7 +1259,7 @@ global.Ai1wm = jQuery.extend({}, global.Ai1wm, { Feedback: Feedback, Report: Rep
1255
  var Import = __webpack_require__(3);
1256
  var Restore = function Restore(archive) {
1257
  var model = new Import();
1258
- model.setStatus({ type: 'pro', message: ai1wm_locale.unlimited });
1259
  };
1260
 
1261
  module.exports = Restore;
1211
  $('.ai1wm-backup-restore').click(function (e) {
1212
  e.preventDefault();
1213
 
1214
+ if (!!Ai1wm.MultisiteExtensionRestore) {
1215
+ var restore = new Ai1wm.MultisiteExtensionRestore($(this).data('archive'));
1216
+ } else if (!!Ai1wm.UnlimitedExtensionRestore) {
1217
  var restore = new Ai1wm.UnlimitedExtensionRestore($(this).data('archive'));
1218
+ } else if (!!Ai1wm.FreeExtensionRestore) {
1219
+ var restore = new Ai1wm.FreeExtensionRestore($(this).data('archive'));
1220
  } else {
1221
  var restore = new Ai1wm.Restore($(this).data('archive'));
1222
  }
1259
  var Import = __webpack_require__(3);
1260
  var Restore = function Restore(archive) {
1261
  var model = new Import();
1262
+ model.setStatus({ type: 'pro', message: ai1wm_locale.restore_from_file });
1263
  };
1264
 
1265
  module.exports = Restore;
lib/view/assets/javascript/import.min.js CHANGED
@@ -1176,7 +1176,9 @@ var FileUploader = __webpack_require__(14),
1176
  jQuery(document).ready(function ($) {
1177
  'use strict';
1178
 
1179
- if (!!Ai1wm.UnlimitedExtensionUploader) {
 
 
1180
  var uploader = new Ai1wm.UnlimitedExtensionUploader();
1181
  } else if (!!Ai1wm.FileExtensionUploader) {
1182
  var uploader = new Ai1wm.FileExtensionUploader();
@@ -1248,7 +1250,19 @@ FileUploader.prototype.init = function () {
1248
 
1249
  var file = e.target.files.item(0);
1250
  if (file) {
1251
- _this.model.setStatus({ type: 'pro', message: ai1wm_locale.import_from_file });
 
 
 
 
 
 
 
 
 
 
 
 
1252
  }
1253
 
1254
  formElement.trigger('reset');
@@ -1276,7 +1290,19 @@ FileUploader.prototype.init = function () {
1276
 
1277
  var file = e.originalEvent.dataTransfer.files.item(0);
1278
  if (file) {
1279
- _this.model.setStatus({ type: 'pro', message: ai1wm_locale.import_from_file });
 
 
 
 
 
 
 
 
 
 
 
 
1280
  }
1281
 
1282
  formElement.trigger('reset');
@@ -1284,6 +1310,95 @@ FileUploader.prototype.init = function () {
1284
  });
1285
  };
1286
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1287
  module.exports = FileUploader;
1288
 
1289
  /***/ })
1176
  jQuery(document).ready(function ($) {
1177
  'use strict';
1178
 
1179
+ if (!!Ai1wm.MultisiteExtensionUploader) {
1180
+ var uploader = new Ai1wm.MultisiteExtensionUploader();
1181
+ } else if (!!Ai1wm.UnlimitedExtensionUploader) {
1182
  var uploader = new Ai1wm.UnlimitedExtensionUploader();
1183
  } else if (!!Ai1wm.FileExtensionUploader) {
1184
  var uploader = new Ai1wm.FileExtensionUploader();
1250
 
1251
  var file = e.target.files.item(0);
1252
  if (file) {
1253
+ _this.fileSize = file.size;
1254
+
1255
+ if (file.size > ai1wm_uploader.max_file_size) {
1256
+ _this.model.setStatus({ type: 'pro', message: ai1wm_locale.import_from_file });
1257
+ } else {
1258
+ try {
1259
+ _this.onFilesAdded(file);
1260
+ _this.onBeforeUpload(file);
1261
+ _this.upload(file);
1262
+ } catch (error) {
1263
+ _this.onError(error);
1264
+ }
1265
+ }
1266
  }
1267
 
1268
  formElement.trigger('reset');
1290
 
1291
  var file = e.originalEvent.dataTransfer.files.item(0);
1292
  if (file) {
1293
+ _this.fileSize = file.size;
1294
+
1295
+ if (file.size > ai1wm_uploader.max_file_size) {
1296
+ _this.model.setStatus({ type: 'pro', message: ai1wm_locale.import_from_file });
1297
+ } else {
1298
+ try {
1299
+ _this.onFilesAdded(file);
1300
+ _this.onBeforeUpload(file);
1301
+ _this.upload(file);
1302
+ } catch (error) {
1303
+ _this.onError(error);
1304
+ }
1305
+ }
1306
  }
1307
 
1308
  formElement.trigger('reset');
1310
  });
1311
  };
1312
 
1313
+ FileUploader.prototype.onFilesAdded = function (file) {
1314
+ if (file.name.substr(-6) !== 'wpress') {
1315
+ throw new Error(ai1wm_locale.invalid_archive_extension);
1316
+ }
1317
+
1318
+ // Initializing beforeunload event
1319
+ $(window).bind('beforeunload', function () {
1320
+ return ai1wm_locale.stop_importing_your_website;
1321
+ });
1322
+ };
1323
+
1324
+ FileUploader.prototype.onBeforeUpload = function (file) {
1325
+ var self = this;
1326
+
1327
+ var storage = Ai1wm.Util.random(12);
1328
+ var options = Ai1wm.Util.form('#ai1wm-import-form').concat({ name: 'storage', value: storage }).concat({ name: 'archive', value: file.name });
1329
+
1330
+ // Set global params
1331
+ this.model.setParams(options);
1332
+
1333
+ // Set multipart params
1334
+ $.extend(ai1wm_uploader.params, {
1335
+ storage: storage,
1336
+ archive: file.name
1337
+ });
1338
+
1339
+ // Set stop
1340
+ this.model.onStop = function () {
1341
+ self.stopUpload = true;
1342
+
1343
+ // Clean storage
1344
+ self.model.clean();
1345
+ };
1346
+
1347
+ // Set status
1348
+ this.model.setStatus({ type: 'progress', percent: '0.00' });
1349
+ };
1350
+
1351
+ FileUploader.prototype.upload = function (file, retries) {
1352
+ var self = this;
1353
+ var formData = new FormData();
1354
+ formData.append('upload-file', file);
1355
+ for (var name in ai1wm_uploader.params) {
1356
+ formData.append(name, ai1wm_uploader.params[name]);
1357
+ }
1358
+
1359
+ $.ajax({
1360
+ url: ai1wm_uploader.url,
1361
+ type: 'POST',
1362
+ data: formData,
1363
+ cache: false,
1364
+ contentType: false,
1365
+ processData: false,
1366
+ xhr: function xhr() {
1367
+ var handle = $.ajaxSettings.xhr();
1368
+ if (handle.upload) {
1369
+ handle.upload.addEventListener('progress', function (event) {
1370
+ var percent = event.loaded / event.total * 100;
1371
+ self.model.setStatus({ type: 'progress', percent: percent.toFixed(2) });
1372
+ });
1373
+ }
1374
+
1375
+ return handle;
1376
+ },
1377
+ success: function success(data, textStatus, jqXHR) {
1378
+ if (self.stopUpload) {
1379
+ return;
1380
+ }
1381
+
1382
+ self.onFileUploaded();
1383
+ },
1384
+ error: function error(jqXHR, textStatus, errorThrown) {
1385
+ throw new Error(textStatus);
1386
+ }
1387
+ });
1388
+ };
1389
+
1390
+ FileUploader.prototype.onUploadProgress = function (percent) {
1391
+ this.model.setStatus({ type: 'progress', percent: percent });
1392
+ };
1393
+
1394
+ FileUploader.prototype.onFileUploaded = function () {
1395
+ this.model.start();
1396
+ };
1397
+
1398
+ FileUploader.prototype.onError = function (error) {
1399
+ this.model.setStatus({ type: 'error', title: ai1wm_locale.unable_to_import, message: error.message });
1400
+ };
1401
+
1402
  module.exports = FileUploader;
1403
 
1404
  /***/ })
lib/view/import/pro.php CHANGED
@@ -24,4 +24,14 @@
24
  */
25
  ?>
26
 
27
- <i class="ai1wm-icon-notification" style="color: #e74c3c;"></i>&nbsp;<?php _e( 'Import from file is available via a free extension. <a href="https://import.wp-migration.com" target="_blank">Download it here</a>', AI1WM_PLUGIN_NAME ); ?>
 
 
 
 
 
 
 
 
 
 
24
  */
25
  ?>
26
 
27
+ <p class="max-upload-size">
28
+ <?php printf( __( 'Maximum upload file size: <strong>%s</strong>.' ), esc_html( size_format( wp_max_upload_size() ) ) ); ?>
29
+ </p>
30
+ <p>
31
+ <a href="https://help.servmask.com/2018/10/27/how-to-increase-maximum-upload-file-size-in-wordpress/" target="_blank"><?php _e( 'How-to: Increase maximum upload file size', AI1WM_PLUGIN_NAME ); ?></a>
32
+ <?php _e( 'or', AI1WM_PLUGIN_NAME ); ?>
33
+ <a href="https://import.wp-migration.com" target="_blank" class="ai1wm-label">
34
+ <i class="ai1wm-icon-notification"></i>
35
+ <?php _e( 'Get unlimited', AI1WM_PLUGIN_NAME ); ?>
36
+ </a>
37
+ </p>
loader.php CHANGED
@@ -275,6 +275,10 @@ require_once AI1WM_IMPORT_PATH .
275
  DIRECTORY_SEPARATOR .
276
  'class-ai1wm-import-compatibility.php';
277
 
 
 
 
 
278
  require_once AI1WM_IMPORT_PATH .
279
  DIRECTORY_SEPARATOR .
280
  'class-ai1wm-import-validate.php';
275
  DIRECTORY_SEPARATOR .
276
  'class-ai1wm-import-compatibility.php';
277
 
278
+ require_once AI1WM_IMPORT_PATH .
279
+ DIRECTORY_SEPARATOR .
280
+ 'class-ai1wm-import-upload.php';
281
+
282
  require_once AI1WM_IMPORT_PATH .
283
  DIRECTORY_SEPARATOR .
284
  'class-ai1wm-import-validate.php';
readme.txt CHANGED
@@ -4,7 +4,7 @@ Tags: move, transfer, copy, migrate, backup, clone, restore, db migration, wordp
4
  Requires at least: 3.3
5
  Tested up to: 4.9
6
  Requires PHP: 5.2.17
7
- Stable tag: 6.78
8
  License: GPLv2 or later
9
 
10
  Move, transfer, copy, migrate, and backup a site with 1-click. Quick, easy, and reliable.
@@ -107,6 +107,18 @@ Alternatively you can download the plugin using the download button on this page
107
  All-in-One WP Migration **asks for your consent** to collect **requester's email address** when filling plugin's contact form. [GDPR Compliant Privacy Policy](https://www.iubenda.com/privacy-policy/946881)
108
 
109
  == Changelog ==
 
 
 
 
 
 
 
 
 
 
 
 
110
  = 6.78 =
111
  **Added**
112
 
4
  Requires at least: 3.3
5
  Tested up to: 4.9
6
  Requires PHP: 5.2.17
7
+ Stable tag: 6.79
8
  License: GPLv2 or later
9
 
10
  Move, transfer, copy, migrate, and backup a site with 1-click. Quick, easy, and reliable.
107
  All-in-One WP Migration **asks for your consent** to collect **requester's email address** when filling plugin's contact form. [GDPR Compliant Privacy Policy](https://www.iubenda.com/privacy-policy/946881)
108
 
109
  == Changelog ==
110
+ = 6.79 =
111
+ **Added**
112
+
113
+ * File import has been re-added with limits imposed by server using wp_max_upload_size(). This article describes how to adjust the limits [How-to: Increase maximum upload file size](https://help.servmask.com/2018/10/27/how-to-increase-maximum-upload-file-size-in-wordpress/)
114
+ * Clean storage directory of files and folders created more than 24 hours ago
115
+ * Support for force-https-littlebizzy plugin
116
+ * Support for wp-simple-firewall
117
+
118
+ **Fixed**
119
+
120
+ * The restore a backup message explains to users how to restore their backups without having to use an premium extension
121
+
122
  = 6.78 =
123
  **Added**
124