All-in-One WP Migration - Version 6.38

Version Description

  • Add support for HyperDB plugin
  • Add support for RevSlider plugin
  • Check available disk space during export/import
  • Support very restricted hosting environments
  • Add wpress mime-type to web.config when the server is IIS
  • Switch to AJAX from cURL on export/import
  • Respect WordPress constants FS_CHMOD_DIR and FS_CHMOD_FILE on import
  • Fix an issue related to generating archive and folder names
  • Fix an issue related to CSS styles on export page
  • Remove misleading available disk space information on "Backups" page
Download this release

Release Info

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

Code changes from version 5.56 to 6.38

Files changed (44) hide show
  1. all-in-one-wp-migration.php +1 -1
  2. constants.php +16 -18
  3. exceptions.php +1 -0
  4. functions.php +49 -24
  5. lib/controller/class-ai1wm-backups-controller.php +0 -2
  6. lib/controller/class-ai1wm-export-controller.php +8 -8
  7. lib/controller/class-ai1wm-feedback-controller.php +4 -3
  8. lib/controller/class-ai1wm-import-controller.php +8 -8
  9. lib/controller/class-ai1wm-main-controller.php +25 -35
  10. lib/controller/class-ai1wm-report-controller.php +6 -4
  11. lib/model/class-ai1wm-backups.php +0 -18
  12. lib/model/class-ai1wm-extensions.php +1 -1
  13. lib/model/class-ai1wm-log.php +9 -9
  14. lib/model/export/class-ai1wm-export-config.php +15 -8
  15. lib/model/export/class-ai1wm-export-content.php +39 -32
  16. lib/model/export/class-ai1wm-export-database.php +17 -10
  17. lib/model/export/class-ai1wm-export-enumerate.php +9 -12
  18. lib/model/export/class-ai1wm-export-init.php +48 -0
  19. lib/model/export/class-ai1wm-export-resolve.php +2 -10
  20. lib/model/http/class-ai1wm-http-stream.php +1 -1
  21. lib/model/import/class-ai1wm-import-blogs.php +20 -14
  22. lib/model/import/class-ai1wm-import-content.php +50 -34
  23. lib/model/import/class-ai1wm-import-database.php +10 -13
  24. lib/model/import/class-ai1wm-import-done.php +54 -10
  25. lib/model/import/class-ai1wm-import-resolve.php +3 -1
  26. lib/model/import/class-ai1wm-import-validate.php +65 -16
  27. lib/vendor/servmask/archiver/class-ai1wm-archiver.php +11 -35
  28. lib/vendor/servmask/archiver/class-ai1wm-compressor.php +5 -5
  29. lib/vendor/servmask/archiver/class-ai1wm-extractor.php +69 -35
  30. lib/vendor/servmask/cron/class-ai1wm-cron.php +1 -0
  31. lib/vendor/servmask/database/class-ai1wm-database.php +26 -34
  32. lib/vendor/servmask/filesystem/class-ai1wm-file-webconfig.php +47 -0
  33. lib/vendor/servmask/filesystem/class-ai1wm-file.php +3 -3
  34. lib/view/assets/css/export.min.css +1 -1
  35. lib/view/assets/javascript/backups.min.js +141 -50
  36. lib/view/assets/javascript/export.min.js +142 -48
  37. lib/view/assets/javascript/import.min.js +209 -143
  38. lib/view/backups/index.php +77 -85
  39. lib/view/common/report-problem.php +1 -1
  40. lib/view/export/find-replace.php +1 -1
  41. lib/view/import/import-buttons.php +23 -25
  42. lib/view/import/index.php +11 -5
  43. loader.php +12 -0
  44. readme.txt +13 -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: 5.56
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.38
9
  * Text Domain: all-in-one-wp-migration
10
  * Domain Path: /languages
11
  * Network: True
constants.php CHANGED
@@ -23,31 +23,24 @@
23
  * ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝
24
  */
25
 
26
- $local = array(
27
- 'iliev.local',
28
- 'develop.servmask.com',
29
- 'Borislav-MacBook-Pro.local',
30
- );
31
-
32
- if ( function_exists( 'gethostname' ) && in_array( gethostname(), $local ) ) {
33
- define( 'AI1WM_DEBUG', true );
34
- } else {
35
- define( 'AI1WM_DEBUG', false );
36
- }
37
 
38
  // ==================
39
  // = Plugin Version =
40
  // ==================
41
- define( 'AI1WM_VERSION', '5.56' );
42
 
43
  // ===============
44
  // = Plugin Name =
45
  // ===============
46
  define( 'AI1WM_PLUGIN_NAME', 'all-in-one-wp-migration' );
47
 
48
- // =================
49
  // = Directory Index =
50
- // =================
51
  define( 'AI1WM_DIRECTORY_INDEX', 'index.php' );
52
 
53
  // ================
@@ -287,14 +280,19 @@ define( 'AI1WM_STORAGE_INDEX', AI1WM_STORAGE_PATH . DIRECTORY_SEPARATOR . 'index
287
  // ======================
288
  define( 'AI1WM_BACKUPS_INDEX', AI1WM_BACKUPS_PATH . DIRECTORY_SEPARATOR . 'index.php' );
289
 
290
- // ======================
291
  // = Backups Htaccess File =
292
- // ======================
293
  define( 'AI1WM_BACKUPS_HTACCESS', AI1WM_BACKUPS_PATH . DIRECTORY_SEPARATOR . '.htaccess' );
294
 
295
- // ====================================
 
 
 
 
 
296
  // = WP Migration Plugin Base Dir =
297
- // ====================================
298
  if ( defined( 'AI1WM_PLUGIN_BASENAME' ) ) {
299
  define( 'AI1WM_PLUGIN_BASEDIR', dirname( AI1WM_PLUGIN_BASENAME ) );
300
  } else {
23
  * ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝
24
  */
25
 
26
+ // ================
27
+ // = Plugin Debug =
28
+ // ================
29
+ define( 'AI1WM_DEBUG', false );
 
 
 
 
 
 
 
30
 
31
  // ==================
32
  // = Plugin Version =
33
  // ==================
34
+ define( 'AI1WM_VERSION', '6.38' );
35
 
36
  // ===============
37
  // = Plugin Name =
38
  // ===============
39
  define( 'AI1WM_PLUGIN_NAME', 'all-in-one-wp-migration' );
40
 
41
+ // ===================
42
  // = Directory Index =
43
+ // ===================
44
  define( 'AI1WM_DIRECTORY_INDEX', 'index.php' );
45
 
46
  // ================
280
  // ======================
281
  define( 'AI1WM_BACKUPS_INDEX', AI1WM_BACKUPS_PATH . DIRECTORY_SEPARATOR . 'index.php' );
282
 
283
+ // =========================
284
  // = Backups Htaccess File =
285
+ // =========================
286
  define( 'AI1WM_BACKUPS_HTACCESS', AI1WM_BACKUPS_PATH . DIRECTORY_SEPARATOR . '.htaccess' );
287
 
288
+ // ==========================
289
+ // = Backups Webconfig File =
290
+ // ==========================
291
+ define( 'AI1WM_BACKUPS_WEBCONFIG', AI1WM_BACKUPS_PATH . DIRECTORY_SEPARATOR . 'web.config' );
292
+
293
+ // ================================
294
  // = WP Migration Plugin Base Dir =
295
+ // ================================
296
  if ( defined( 'AI1WM_PLUGIN_BASENAME' ) ) {
297
  define( 'AI1WM_PLUGIN_BASEDIR', dirname( AI1WM_PLUGIN_BASENAME ) );
298
  } else {
exceptions.php CHANGED
@@ -33,4 +33,5 @@ class Ai1wm_Not_Accesible_Exception extends Exception {}
33
  class Ai1wm_Not_Found_Exception extends Exception {}
34
  class Ai1wm_Not_Readable_Exception extends Exception {}
35
  class Ai1wm_Not_Writable_Exception extends Exception {}
 
36
  class Ai1wm_Storage_Exception extends Exception {}
33
  class Ai1wm_Not_Found_Exception extends Exception {}
34
  class Ai1wm_Not_Readable_Exception extends Exception {}
35
  class Ai1wm_Not_Writable_Exception extends Exception {}
36
+ class Ai1wm_Quota_Exceeded_Exception extends Exception {}
37
  class Ai1wm_Storage_Exception extends Exception {}
functions.php CHANGED
@@ -69,7 +69,7 @@ function ai1wm_archive_path( $params ) {
69
  }
70
 
71
  // Get archive path
72
- if ( empty( $params['backups'] ) ) {
73
  return ai1wm_storage_path( $params ) . DIRECTORY_SEPARATOR . basename( $params['archive'] );
74
  }
75
 
@@ -286,17 +286,18 @@ function ai1wm_site_name() {
286
  * @return string
287
  */
288
  function ai1wm_archive_file() {
289
- $site = parse_url( site_url() );
290
  $name = array();
291
 
292
  // Add domain
293
- if ( isset( $site['host'] ) ) {
294
- $name[] = $site['host'];
295
- }
296
 
297
  // Add path
298
- if ( isset( $site['path'] ) ) {
299
- $name[] = trim( $site['path'], '/' );
 
 
 
 
300
  }
301
 
302
  // Add year, month and day
@@ -308,7 +309,7 @@ function ai1wm_archive_file() {
308
  // Add unique identifier
309
  $name[] = rand( 100, 999 );
310
 
311
- return sprintf( '%s.wpress', implode( '-', $name ) );
312
  }
313
 
314
  /**
@@ -317,20 +318,21 @@ function ai1wm_archive_file() {
317
  * @return string
318
  */
319
  function ai1wm_archive_folder() {
320
- $site = parse_url( site_url() );
321
  $name = array();
322
 
323
  // Add domain
324
- if ( isset( $site['host'] ) ) {
325
- $name[] = $site['host'];
326
- }
327
 
328
  // Add path
329
- if ( isset( $site['path'] ) ) {
330
- $name[] = trim( $site['path'] , '/' );
 
 
 
 
331
  }
332
 
333
- return implode( '-', $name );
334
  }
335
 
336
  /**
@@ -478,6 +480,7 @@ function ai1wm_content_filters( $filters = array() ) {
478
  return array_merge( $filters, array(
479
  'index.php',
480
  'ai1wm-backups',
 
481
  'themes' . DIRECTORY_SEPARATOR . 'index.php',
482
  'plugins' . DIRECTORY_SEPARATOR . 'index.php',
483
  'uploads' . DIRECTORY_SEPARATOR . 'index.php',
@@ -693,31 +696,53 @@ function ai1wm_urldecode( $value ) {
693
  */
694
  function ai1wm_open( $file, $mode ) {
695
  $file_handle = fopen( $file, $mode );
696
-
697
  if ( false === $file_handle ) {
698
- throw new Exception( sprintf( __( 'Unable to open %s with mode %s', AI1WM_PLUGIN_NAME ), $file, $mode ) );
699
  }
 
700
  return $file_handle;
701
  }
702
 
703
  /**
704
  * Write contents to a file
705
  *
706
- * @param resource $handle File handle to write to
707
  * @param string $content Contents to write to the file
708
- * @param string $file Filename that contents shall be written to
709
  * @return int
710
  * @throws Exception
711
  */
712
- function ai1wm_write( $handle, $content, $file ) {
713
  $write_result = fwrite( $handle, $content );
714
-
715
  if ( false === $write_result ) {
716
- throw new Exception( sprintf( __( 'Unable to write to %s.', AI1WM_PLUGIN_NAME ), $file ) );
 
 
 
 
717
  }
 
718
  return $write_result;
719
  }
720
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
721
  /**
722
  * Closes a file handle
723
  *
@@ -747,8 +772,8 @@ function ai1wm_unlink( $file ) {
747
  function ai1wm_copy( $source_file, $destination_file ) {
748
  $source_handle = ai1wm_open( $source_file, 'rb' );
749
  $destination_handle = ai1wm_open( $destination_file, 'ab' );
750
- while ( $buffer = fread( $source_handle, 4096 ) ) {
751
- ai1wm_write( $destination_handle, $buffer, $destination_file );
752
  }
753
  ai1wm_close( $source_handle );
754
  ai1wm_close( $destination_handle );
69
  }
70
 
71
  // Get archive path
72
+ if ( empty( $params['ai1wm_manual_backups'] ) ) {
73
  return ai1wm_storage_path( $params ) . DIRECTORY_SEPARATOR . basename( $params['archive'] );
74
  }
75
 
286
  * @return string
287
  */
288
  function ai1wm_archive_file() {
 
289
  $name = array();
290
 
291
  // Add domain
292
+ $name[] = parse_url( site_url(), PHP_URL_HOST );
 
 
293
 
294
  // Add path
295
+ if ( ( $path = explode( '/', parse_url( site_url(), PHP_URL_PATH ) ) ) ) {
296
+ foreach ( $path as $directory ) {
297
+ if ( $directory ) {
298
+ $name[] = $directory;
299
+ }
300
+ }
301
  }
302
 
303
  // Add year, month and day
309
  // Add unique identifier
310
  $name[] = rand( 100, 999 );
311
 
312
+ return sprintf( '%s.wpress', strtolower( implode( '-', $name ) ) );
313
  }
314
 
315
  /**
318
  * @return string
319
  */
320
  function ai1wm_archive_folder() {
 
321
  $name = array();
322
 
323
  // Add domain
324
+ $name[] = parse_url( site_url(), PHP_URL_HOST );
 
 
325
 
326
  // Add path
327
+ if ( ( $path = explode( '/', parse_url( site_url(), PHP_URL_PATH ) ) ) ) {
328
+ foreach ( $path as $directory ) {
329
+ if ( $directory ) {
330
+ $name[] = $directory;
331
+ }
332
+ }
333
  }
334
 
335
+ return strtolower( implode( '-', $name ) );
336
  }
337
 
338
  /**
480
  return array_merge( $filters, array(
481
  'index.php',
482
  'ai1wm-backups',
483
+ 'object-cache.php',
484
  'themes' . DIRECTORY_SEPARATOR . 'index.php',
485
  'plugins' . DIRECTORY_SEPARATOR . 'index.php',
486
  'uploads' . DIRECTORY_SEPARATOR . 'index.php',
696
  */
697
  function ai1wm_open( $file, $mode ) {
698
  $file_handle = fopen( $file, $mode );
 
699
  if ( false === $file_handle ) {
700
+ throw new Ai1wm_Not_Accesible_Exception( sprintf( __( 'Unable to open %s with mode %s', AI1WM_PLUGIN_NAME ), $file, $mode ) );
701
  }
702
+
703
  return $file_handle;
704
  }
705
 
706
  /**
707
  * Write contents to a file
708
  *
709
+ * @param resource $handle File handle to write to
710
  * @param string $content Contents to write to the file
 
711
  * @return int
712
  * @throws Exception
713
  */
714
+ function ai1wm_write( $handle, $content ) {
715
  $write_result = fwrite( $handle, $content );
 
716
  if ( false === $write_result ) {
717
+ if ( ( $meta = stream_get_meta_data( $handle ) ) ) {
718
+ throw new Ai1wm_Not_Writable_Exception( sprintf( __( 'Unable to write to: %s', AI1WM_PLUGIN_NAME ), $meta['uri'] ) );
719
+ }
720
+ } elseif ( strlen( $content ) !== $write_result ) {
721
+ throw new Ai1wm_Quota_Exceeded_Exception( __( 'Out of disk space.', AI1WM_PLUGIN_NAME ) );
722
  }
723
+
724
  return $write_result;
725
  }
726
 
727
+ /**
728
+ * Read contents from a file
729
+ *
730
+ * @param resource $handle File handle to read from
731
+ * @param string $filesize File size
732
+ * @return int
733
+ * @throws Exception
734
+ */
735
+ function ai1wm_read( $handle, $filesize ) {
736
+ $read_result = fread( $handle, $filesize );
737
+ if ( false === $read_result ) {
738
+ if ( ( $meta = stream_get_meta_data( $handle ) ) ) {
739
+ throw new Ai1wm_Not_Readable_Exception( sprintf( __( 'Unable to read file: %s', AI1WM_PLUGIN_NAME ), $meta['uri'] ) );
740
+ }
741
+ }
742
+
743
+ return $read_result;
744
+ }
745
+
746
  /**
747
  * Closes a file handle
748
  *
772
  function ai1wm_copy( $source_file, $destination_file ) {
773
  $source_handle = ai1wm_open( $source_file, 'rb' );
774
  $destination_handle = ai1wm_open( $destination_file, 'ab' );
775
+ while ( $buffer = ai1wm_read( $source_handle, 4096 ) ) {
776
+ ai1wm_write( $destination_handle, $buffer );
777
  }
778
  ai1wm_close( $source_handle );
779
  ai1wm_close( $destination_handle );
lib/controller/class-ai1wm-backups-controller.php CHANGED
@@ -42,8 +42,6 @@ class Ai1wm_Backups_Controller {
42
  'backups/index',
43
  array(
44
  'backups' => $model->get_files(),
45
- 'free_space' => $model->get_free_space(),
46
- 'total_space' => $model->get_total_space(),
47
  'username' => get_option( AI1WM_AUTH_USER ),
48
  'password' => get_option( AI1WM_AUTH_PASSWORD ),
49
  )
42
  'backups/index',
43
  array(
44
  'backups' => $model->get_files(),
 
 
45
  'username' => get_option( AI1WM_AUTH_USER ),
46
  'password' => get_option( AI1WM_AUTH_PASSWORD ),
47
  )
lib/controller/class-ai1wm-export-controller.php CHANGED
@@ -76,7 +76,13 @@ class Ai1wm_Export_Controller {
76
  if ( $priority === key( $filters ) ) {
77
  foreach ( $hooks as $hook ) {
78
  try {
 
 
79
  $params = call_user_func_array( $hook['function'], array( $params ) );
 
 
 
 
80
  } catch ( Exception $e ) {
81
  Ai1wm_Status::error( $e->getMessage(), __( 'Unable to export', AI1WM_PLUGIN_NAME ) );
82
  exit;
@@ -89,16 +95,10 @@ class Ai1wm_Export_Controller {
89
  $completed = (bool) $params['completed'];
90
  }
91
 
92
- // Log request
93
- if ( empty( $params['priority'] ) || is_file( ai1wm_export_path( $params ) ) ) {
94
- Ai1wm_Log::export( $params );
95
- }
96
-
97
  // Do request
98
  if ( $completed === false || ( $next = next( $filters ) ) && ( $params['priority'] = key( $filters ) ) ) {
99
-
100
- // Check the status, maybe we need to stop it
101
- if ( ! is_file( ai1wm_export_path( $params ) ) ) {
102
  exit;
103
  }
104
 
76
  if ( $priority === key( $filters ) ) {
77
  foreach ( $hooks as $hook ) {
78
  try {
79
+
80
+ // Run function hook
81
  $params = call_user_func_array( $hook['function'], array( $params ) );
82
+
83
+ // Log request
84
+ Ai1wm_Log::export( $params );
85
+
86
  } catch ( Exception $e ) {
87
  Ai1wm_Status::error( $e->getMessage(), __( 'Unable to export', AI1WM_PLUGIN_NAME ) );
88
  exit;
95
  $completed = (bool) $params['completed'];
96
  }
97
 
 
 
 
 
 
98
  // Do request
99
  if ( $completed === false || ( $next = next( $filters ) ) && ( $params['priority'] = key( $filters ) ) ) {
100
+ if ( isset( $params['ai1wm_manual_export'] ) ) {
101
+ echo json_encode( $params );
 
102
  exit;
103
  }
104
 
lib/controller/class-ai1wm-feedback-controller.php CHANGED
@@ -51,11 +51,12 @@ class Ai1wm_Feedback_Controller {
51
  $terms = (bool) $_POST['ai1wm-terms'];
52
  }
53
 
 
 
54
  // Send Feedback
55
- $model = new Ai1wm_Feedback;
56
- $result = $model->add( $type, $email, $message, $terms );
57
 
58
- echo json_encode( $result );
59
  exit;
60
  }
61
  }
51
  $terms = (bool) $_POST['ai1wm-terms'];
52
  }
53
 
54
+ $model = new Ai1wm_Feedback;
55
+
56
  // Send Feedback
57
+ $response = $model->add( $type, $email, $message, $terms );
 
58
 
59
+ echo json_encode( $response );
60
  exit;
61
  }
62
  }
lib/controller/class-ai1wm-import-controller.php CHANGED
@@ -76,7 +76,13 @@ class Ai1wm_Import_Controller {
76
  if ( $priority === key( $filters ) ) {
77
  foreach ( $hooks as $hook ) {
78
  try {
 
 
79
  $params = call_user_func_array( $hook['function'], array( $params ) );
 
 
 
 
80
  } catch ( Ai1wm_Import_Retry_Exception $exception ) {
81
  status_header( $exception->getCode() );
82
  echo json_encode( array( 'message' => $exception->getMessage() ) );
@@ -93,16 +99,10 @@ class Ai1wm_Import_Controller {
93
  $completed = (bool) $params['completed'];
94
  }
95
 
96
- // Log request
97
- if ( empty( $params['priority'] ) || is_file( ai1wm_import_path( $params ) ) ) {
98
- Ai1wm_Log::import( $params );
99
- }
100
-
101
  // Do request
102
  if ( $completed === false || ( $next = next( $filters ) ) && ( $params['priority'] = key( $filters ) ) ) {
103
-
104
- // Check the status, maybe we need to stop it
105
- if ( ! is_file( ai1wm_import_path( $params ) ) ) {
106
  exit;
107
  }
108
 
76
  if ( $priority === key( $filters ) ) {
77
  foreach ( $hooks as $hook ) {
78
  try {
79
+
80
+ // Run function hook
81
  $params = call_user_func_array( $hook['function'], array( $params ) );
82
+
83
+ // Log request
84
+ Ai1wm_Log::import( $params );
85
+
86
  } catch ( Ai1wm_Import_Retry_Exception $exception ) {
87
  status_header( $exception->getCode() );
88
  echo json_encode( array( 'message' => $exception->getMessage() ) );
99
  $completed = (bool) $params['completed'];
100
  }
101
 
 
 
 
 
 
102
  // Do request
103
  if ( $completed === false || ( $next = next( $filters ) ) && ( $params['priority'] = key( $filters ) ) ) {
104
+ if ( isset( $params['ai1wm_manual_import'] ) || isset( $params['ai1wm_manual_backups'] ) ) {
105
+ echo json_encode( $params );
 
106
  exit;
107
  }
108
 
lib/controller/class-ai1wm-main-controller.php CHANGED
@@ -101,6 +101,9 @@ class Ai1wm_Main_Controller {
101
  // Add a links to plugin list page
102
  add_filter( 'plugin_row_meta', array( $this, 'plugin_row_meta' ), 10, 2 );
103
 
 
 
 
104
  return $this;
105
  }
106
 
@@ -111,6 +114,7 @@ class Ai1wm_Main_Controller {
111
  */
112
  public function ai1wm_commands() {
113
  // Add export commands
 
114
  add_filter( 'ai1wm_export', 'Ai1wm_Export_Compatibility::execute', 5 );
115
  add_filter( 'ai1wm_export', 'Ai1wm_Export_Resolve::execute', 5 );
116
  add_filter( 'ai1wm_export', 'Ai1wm_Export_Archive::execute', 10 );
@@ -277,42 +281,9 @@ class Ai1wm_Main_Controller {
277
 
278
  // Create .htaccess in backups folder
279
  Ai1wm_File_Htaccess::create( AI1WM_BACKUPS_HTACCESS );
280
- }
281
-
282
- /**
283
- * Creates a index.php file in specific folder
284
- *
285
- * The method will create index.php file with contents '<?php // silence is golden' without the single quotes
286
- * at the path specified by the argument. The file is only created if it doesn't exist. If the file is unable to
287
- * be created, the method will call wp_die to notify the user and stop the execution
288
- *
289
- * @param $path string Path to the folder where the index.php file needs to be created
290
- * @return void
291
- */
292
- protected function create_index_file( $path ) {
293
- // Name of the index file with the path
294
- $file = $path . DIRECTORY_SEPARATOR . AI1WM_DIRECTORY_INDEX;
295
-
296
- // Check if the file exists
297
- if ( ! is_file( $file ) ) {
298
-
299
- // File doesn't exist attempt to create ti
300
- $handle = fopen( $file, 'w' );
301
-
302
- // Check if we were able to open the file
303
- if ( false === $handle ) {
304
 
305
- // We couldn't create the folder, so let's tell the user
306
- if ( is_multisite() ) {
307
- return add_action( 'network_admin_notices', array( $this, 'index_notice' ) );
308
- } else {
309
- return add_action( 'admin_notices', array( $this, 'index_notice' ) );
310
- }
311
- }
312
-
313
- fwrite( $handle, '<?php // silence is golden' );
314
- fclose( $handle );
315
- }
316
  }
317
 
318
  /**
@@ -642,4 +613,23 @@ class Ai1wm_Main_Controller {
642
  add_action( 'wp_ajax_ai1wm_resolve', 'Ai1wm_Resolve_Controller::resolve' );
643
  }
644
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
645
  }
101
  // Add a links to plugin list page
102
  add_filter( 'plugin_row_meta', array( $this, 'plugin_row_meta' ), 10, 2 );
103
 
104
+ // Add custom schedules
105
+ add_filter( 'cron_schedules', array( $this, 'add_cron_schedules' ) );
106
+
107
  return $this;
108
  }
109
 
114
  */
115
  public function ai1wm_commands() {
116
  // Add export commands
117
+ add_filter( 'ai1wm_export', 'Ai1wm_Export_Init::execute', 5 );
118
  add_filter( 'ai1wm_export', 'Ai1wm_Export_Compatibility::execute', 5 );
119
  add_filter( 'ai1wm_export', 'Ai1wm_Export_Resolve::execute', 5 );
120
  add_filter( 'ai1wm_export', 'Ai1wm_Export_Archive::execute', 10 );
281
 
282
  // Create .htaccess in backups folder
283
  Ai1wm_File_Htaccess::create( AI1WM_BACKUPS_HTACCESS );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
284
 
285
+ // Create web.config in backups folder
286
+ Ai1wm_File_Webconfig::create( AI1WM_BACKUPS_WEBCONFIG );
 
 
 
 
 
 
 
 
 
287
  }
288
 
289
  /**
613
  add_action( 'wp_ajax_ai1wm_resolve', 'Ai1wm_Resolve_Controller::resolve' );
614
  }
615
  }
616
+
617
+ /**
618
+ * Add custom cron schedules
619
+ *
620
+ * @param array $schedules List of schedules
621
+ * @return array
622
+ */
623
+ public function add_cron_schedules( $schedules ) {
624
+ $schedules['weekly'] = array(
625
+ 'display' => __( 'Weekly', AI1WM_PLUGIN_NAME ),
626
+ 'interval' => 60 * 60 * 24 * 7,
627
+ );
628
+ $schedules['monthly'] = array(
629
+ 'display' => __( 'Monthly', AI1WM_PLUGIN_NAME ),
630
+ 'interval' => ( strtotime( '+1 month' ) - time() ),
631
+ );
632
+
633
+ return $schedules;
634
+ }
635
  }
lib/controller/class-ai1wm-report-controller.php CHANGED
@@ -45,10 +45,12 @@ class Ai1wm_Report_Controller {
45
  $terms = (bool) $_POST['ai1wm-terms'];
46
  }
47
 
48
- // Send Feedback
49
- $model = new Ai1wm_Report;
50
- $result = $model->add( $email, $message, $terms );
51
- echo json_encode( $result );
 
 
52
  exit;
53
  }
54
  }
45
  $terms = (bool) $_POST['ai1wm-terms'];
46
  }
47
 
48
+ $model = new Ai1wm_Report;
49
+
50
+ // Send Report
51
+ $response = $model->add( $email, $message, $terms );
52
+
53
+ echo json_encode( $response );
54
  exit;
55
  }
56
  }
lib/model/class-ai1wm-backups.php CHANGED
@@ -82,24 +82,6 @@ class Ai1wm_Backups {
82
  return true;
83
  }
84
 
85
- /**
86
- * Get free disk space
87
- *
88
- * @return integer
89
- */
90
- public function get_free_space() {
91
- return @disk_free_space( AI1WM_BACKUPS_PATH );
92
- }
93
-
94
- /**
95
- * Get total disk space
96
- *
97
- * @return integer
98
- */
99
- public function get_total_space() {
100
- return @disk_total_space( AI1WM_BACKUPS_PATH );
101
- }
102
-
103
  /**
104
  * Compare backup files by modified time
105
  *
82
  return true;
83
  }
84
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
85
  /**
86
  * Compare backup files by modified time
87
  *
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.25',
80
  'short' => AI1WMME_PLUGIN_SHORT,
81
  );
82
  }
76
  'about' => AI1WMME_PLUGIN_ABOUT,
77
  'basename' => AI1WMME_PLUGIN_BASENAME,
78
  'version' => AI1WMME_VERSION,
79
+ 'requires' => '3.26',
80
  'short' => AI1WMME_PLUGIN_SHORT,
81
  );
82
  }
lib/model/class-ai1wm-log.php CHANGED
@@ -38,9 +38,9 @@ class Ai1wm_Log {
38
  $data[] = PHP_EOL;
39
 
40
  // Write log data
41
- if ( $handle = fopen( ai1wm_export_path( $params ), 'a' ) ) {
42
- fwrite( $handle, implode( PHP_EOL, $data ) );
43
- fclose( $handle );
44
  }
45
  }
46
 
@@ -57,9 +57,9 @@ class Ai1wm_Log {
57
  $data[] = PHP_EOL;
58
 
59
  // Write log data
60
- if ( $handle = fopen( ai1wm_import_path( $params ), 'a' ) ) {
61
- fwrite( $handle, implode( PHP_EOL, $data ) );
62
- fclose( $handle );
63
  }
64
  }
65
 
@@ -76,9 +76,9 @@ class Ai1wm_Log {
76
  $data[] = PHP_EOL;
77
 
78
  // Write log data
79
- if ( $handle = fopen( ai1wm_error_path(), 'a' ) ) {
80
- fwrite( $handle, implode( PHP_EOL, $data ) );
81
- fclose( $handle );
82
  }
83
  }
84
  }
38
  $data[] = PHP_EOL;
39
 
40
  // Write log data
41
+ if ( $handle = ai1wm_open( ai1wm_export_path( $params ), 'a' ) ) {
42
+ ai1wm_write( $handle, implode( PHP_EOL, $data ) );
43
+ ai1wm_close( $handle );
44
  }
45
  }
46
 
57
  $data[] = PHP_EOL;
58
 
59
  // Write log data
60
+ if ( $handle = ai1wm_open( ai1wm_import_path( $params ), 'a' ) ) {
61
+ ai1wm_write( $handle, implode( PHP_EOL, $data ) );
62
+ ai1wm_close( $handle );
63
  }
64
  }
65
 
76
  $data[] = PHP_EOL;
77
 
78
  // Write log data
79
+ if ( $handle = ai1wm_open( ai1wm_error_path(), 'a' ) ) {
80
+ ai1wm_write( $handle, implode( PHP_EOL, $data ) );
81
+ ai1wm_close( $handle );
82
  }
83
  }
84
  }
lib/model/export/class-ai1wm-export-config.php CHANGED
@@ -40,35 +40,42 @@ class Ai1wm_Export_Config {
40
  // Set config
41
  $config = array();
42
 
43
- // Set Site URL
44
  if ( isset( $options['siteurl'] ) ) {
45
  $config['SiteURL'] = untrailingslashit( $options['siteurl'] );
46
  } else {
47
  $config['SiteURL'] = site_url();
48
  }
49
 
50
- // Set Home URL
51
  if ( isset( $options['home'] ) ) {
52
  $config['HomeURL'] = untrailingslashit( $options['home'] );
53
  } else {
54
  $config['HomeURL'] = home_url();
55
  }
56
 
57
- // Set Plugin Version
58
  $config['Plugin'] = array( 'Version' => AI1WM_VERSION );
59
 
60
- // Set WordPress Version and Content
 
 
 
 
 
 
 
61
  $config['WordPress'] = array( 'Version' => $wp_version, 'Content' => WP_CONTENT_DIR );
62
 
63
- // Set No Replace Email
64
  if ( isset( $params['options']['no_email_replace'] ) ) {
65
  $config['NoEmailReplace'] = true;
66
  }
67
 
68
  // Save package.json file
69
- $handle = fopen( ai1wm_package_path( $params ), 'w' );
70
- fwrite( $handle, json_encode( $config ) );
71
- fclose( $handle );
72
 
73
  // Add package.json file
74
  $archive = new Ai1wm_Compressor( ai1wm_archive_path( $params ) );
40
  // Set config
41
  $config = array();
42
 
43
+ // Set site URL
44
  if ( isset( $options['siteurl'] ) ) {
45
  $config['SiteURL'] = untrailingslashit( $options['siteurl'] );
46
  } else {
47
  $config['SiteURL'] = site_url();
48
  }
49
 
50
+ // Set home URL
51
  if ( isset( $options['home'] ) ) {
52
  $config['HomeURL'] = untrailingslashit( $options['home'] );
53
  } else {
54
  $config['HomeURL'] = home_url();
55
  }
56
 
57
+ // Set plugin version
58
  $config['Plugin'] = array( 'Version' => AI1WM_VERSION );
59
 
60
+ // Set active plugins
61
+ if ( isset( $params['options']['no_plugins'] ) ) {
62
+ $config['Plugins'] = array();
63
+ } else {
64
+ $config['Plugins'] = array_values( array_diff( ai1wm_active_plugins(), ai1wm_active_servmask_plugins() ) );
65
+ }
66
+
67
+ // Set WordPress version and content
68
  $config['WordPress'] = array( 'Version' => $wp_version, 'Content' => WP_CONTENT_DIR );
69
 
70
+ // Set no replace email
71
  if ( isset( $params['options']['no_email_replace'] ) ) {
72
  $config['NoEmailReplace'] = true;
73
  }
74
 
75
  // Save package.json file
76
+ $handle = ai1wm_open( ai1wm_package_path( $params ), 'w' );
77
+ ai1wm_write( $handle, json_encode( $config ) );
78
+ ai1wm_close( $handle );
79
 
80
  // Add package.json file
81
  $archive = new Ai1wm_Compressor( ai1wm_archive_path( $params ) );
lib/model/export/class-ai1wm-export-content.php CHANGED
@@ -77,14 +77,11 @@ class Ai1wm_Export_Content {
77
  Ai1wm_Status::info( sprintf( __( 'Archiving %d files...<br />%d%% complete', AI1WM_PLUGIN_NAME ), $total_files, $progress ) );
78
  }
79
 
80
- // Get map file
81
- $filemap = fopen( ai1wm_filemap_path( $params ), 'r' );
82
-
83
  // Start time
84
  $start = microtime( true );
85
 
86
- // Flag to hold if all files have been processed
87
- $completed = true;
88
 
89
  // Set filemap pointer at the current index
90
  if ( fseek( $filemap, $filemap_offset ) !== -1 ) {
@@ -107,24 +104,12 @@ class Ai1wm_Export_Content {
107
  Ai1wm_Status::info( sprintf( __( 'Archiving %d files...<br />%d%% complete', AI1WM_PLUGIN_NAME ), $total_files, $progress ) );
108
 
109
  // Set current filesize
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
-
124
- // Close the filemap file
125
- fclose( $filemap );
126
-
127
- return $params;
128
  }
129
 
130
  // Increment processed files
@@ -141,13 +126,14 @@ class Ai1wm_Export_Content {
141
  // Set filemap offset
142
  $filemap_offset = ftell( $filemap );
143
 
 
 
144
  } catch ( Exception $e ) {
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;
151
  break;
152
  }
153
  }
@@ -156,23 +142,44 @@ class Ai1wm_Export_Content {
156
  $archive->close();
157
  }
158
 
159
- // Set current filesize
160
- $params['current_filesize'] = $current_filesize;
161
 
162
- // Set content offset
163
- $params['content_offset'] = $content_offset;
164
 
165
- // Set filemap offset
166
- $params['filemap_offset'] = $filemap_offset;
167
 
168
- // Set processed files
169
- $params['processed'] = $processed;
170
 
171
- // Set completed flag
172
- $params['completed'] = $completed;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
173
 
174
  // Close the filemap file
175
- fclose( $filemap );
176
 
177
  return $params;
178
  }
77
  Ai1wm_Status::info( sprintf( __( 'Archiving %d files...<br />%d%% complete', AI1WM_PLUGIN_NAME ), $total_files, $progress ) );
78
  }
79
 
 
 
 
80
  // Start time
81
  $start = microtime( true );
82
 
83
+ // Get map file
84
+ $filemap = ai1wm_open( ai1wm_filemap_path( $params ), 'r' );
85
 
86
  // Set filemap pointer at the current index
87
  if ( fseek( $filemap, $filemap_offset ) !== -1 ) {
104
  Ai1wm_Status::info( sprintf( __( 'Archiving %d files...<br />%d%% complete', AI1WM_PLUGIN_NAME ), $total_files, $progress ) );
105
 
106
  // Set current filesize
107
+ $current_filesize = $archive->get_current_filesize();
108
 
109
  // Set content offset
110
+ $content_offset = $current_offset;
 
 
 
 
 
 
111
 
112
+ break;
 
 
 
 
 
 
113
  }
114
 
115
  // Increment processed files
126
  // Set filemap offset
127
  $filemap_offset = ftell( $filemap );
128
 
129
+ } catch ( Ai1wm_Quota_Exceeded_Exception $e ) {
130
+ throw new Exception( 'Out of disk space.' );
131
  } catch ( Exception $e ) {
132
  // Skip bad file permissions
133
  }
134
 
135
  // More than 10 seconds have passed, break and do another request
136
  if ( ( microtime( true ) - $start ) > 10 ) {
 
137
  break;
138
  }
139
  }
142
  $archive->close();
143
  }
144
 
145
+ // End of the filemap?
146
+ if ( feof( $filemap ) ) {
147
 
148
+ // Unset current filesize
149
+ unset( $params['current_filesize'] );
150
 
151
+ // Unset content offset
152
+ unset( $params['content_offset'] );
153
 
154
+ // Unset filemap offset
155
+ unset( $params['filemap_offset'] );
156
 
157
+ // Unset processed files
158
+ unset( $params['processed'] );
159
+
160
+ // Unset completed flag
161
+ unset( $params['completed'] );
162
+
163
+ } else {
164
+
165
+ // Set current filesize
166
+ $params['current_filesize'] = $current_filesize;
167
+
168
+ // Set content offset
169
+ $params['content_offset'] = $content_offset;
170
+
171
+ // Set filemap offset
172
+ $params['filemap_offset'] = $filemap_offset;
173
+
174
+ // Set processed files
175
+ $params['processed'] = $processed;
176
+
177
+ // Set completed flag
178
+ $params['completed'] = false;
179
+ }
180
 
181
  // Close the filemap file
182
+ ai1wm_close( $filemap );
183
 
184
  return $params;
185
  }
lib/model/export/class-ai1wm-export-database.php CHANGED
@@ -111,8 +111,8 @@ class Ai1wm_Export_Database {
111
  ->set_table_prefix_columns( ai1wm_table_prefix() . 'options', array( 'option_name' ) )
112
  ->set_table_prefix_columns( ai1wm_table_prefix() . 'usermeta', array( 'meta_key' ) );
113
 
114
- // Status options
115
- $client->set_table_query_clauses( ai1wm_table_prefix() . 'options', sprintf( " WHERE option_name != '%s' ", AI1WM_STATUS ) );
116
 
117
  // Set current table index
118
  if ( isset( $params['current_table_index'] ) ) {
@@ -122,10 +122,8 @@ class Ai1wm_Export_Database {
122
  }
123
 
124
  // Export database
125
- $completed = $client->export( ai1wm_database_path( $params ), $current_table_index, 10 );
126
 
127
- // Export completed
128
- if ( $completed ) {
129
  // Get archive file
130
  $archive = new Ai1wm_Compressor( ai1wm_archive_path( $params ) );
131
 
@@ -135,13 +133,22 @@ class Ai1wm_Export_Database {
135
 
136
  // Set progress
137
  Ai1wm_Status::info( __( 'Done exporting database.', AI1WM_PLUGIN_NAME ) );
138
- }
139
 
140
- // Set current table index
141
- $params['current_table_index'] = $current_table_index;
 
 
 
 
 
 
 
 
142
 
143
- // Set completed flag
144
- $params['completed'] = $completed;
 
 
145
 
146
  return $params;
147
  }
111
  ->set_table_prefix_columns( ai1wm_table_prefix() . 'options', array( 'option_name' ) )
112
  ->set_table_prefix_columns( ai1wm_table_prefix() . 'usermeta', array( 'meta_key' ) );
113
 
114
+ // Exclude active plugins and status options
115
+ $client->set_table_query_clauses( ai1wm_table_prefix() . 'options', sprintf( " WHERE option_name NOT IN ('%s', '%s') ", AI1WM_ACTIVE_PLUGINS, AI1WM_STATUS ) );
116
 
117
  // Set current table index
118
  if ( isset( $params['current_table_index'] ) ) {
122
  }
123
 
124
  // Export database
125
+ if ( $client->export( ai1wm_database_path( $params ), $current_table_index, 10 ) ) {
126
 
 
 
127
  // Get archive file
128
  $archive = new Ai1wm_Compressor( ai1wm_archive_path( $params ) );
129
 
133
 
134
  // Set progress
135
  Ai1wm_Status::info( __( 'Done exporting database.', AI1WM_PLUGIN_NAME ) );
 
136
 
137
+ // Unset current table index
138
+ unset( $params['current_table_index'] );
139
+
140
+ // Unset completed flag
141
+ unset( $params['completed'] );
142
+
143
+ } else {
144
+
145
+ // Set current table index
146
+ $params['current_table_index'] = $current_table_index;
147
 
148
+ // Set completed flag
149
+ $params['completed'] = false;
150
+
151
+ }
152
 
153
  return $params;
154
  }
lib/model/export/class-ai1wm-export-enumerate.php CHANGED
@@ -71,13 +71,10 @@ class Ai1wm_Export_Enumerate {
71
 
72
  // Exclude inactive plugins
73
  if ( isset( $params['options']['no_inactive_plugins'] ) ) {
74
- foreach ( get_plugins() as $basename => $plugin ) {
75
  if ( is_plugin_inactive( $basename ) ) {
76
- if ( dirname( $basename ) === '.' ) {
77
- $inactive_plugins[] = 'plugins' . DIRECTORY_SEPARATOR . basename( $basename );
78
- } else {
79
- $inactive_plugins[] = 'plugins' . DIRECTORY_SEPARATOR . dirname( $basename );
80
- }
81
  }
82
  }
83
  }
@@ -106,7 +103,7 @@ class Ai1wm_Export_Enumerate {
106
  }
107
 
108
  // Create map file
109
- $filemap = fopen( ai1wm_filemap_path( $params ) , 'a+' );
110
 
111
  try {
112
 
@@ -122,7 +119,7 @@ class Ai1wm_Export_Enumerate {
122
  // Write path line
123
  foreach ( $iterator as $item ) {
124
  if ( $item->isFile() ) {
125
- if ( fwrite( $filemap, $iterator->getSubPathName() . PHP_EOL ) ) {
126
  $total_files++;
127
 
128
  // Add current file size
@@ -134,6 +131,9 @@ class Ai1wm_Export_Enumerate {
134
  // Skip bad file permissions
135
  }
136
 
 
 
 
137
  // Set total files
138
  $params['total_files'] = $total_files;
139
 
@@ -141,10 +141,7 @@ class Ai1wm_Export_Enumerate {
141
  $params['total_size'] = $total_size;
142
 
143
  // Close the filemap file
144
- fclose( $filemap );
145
-
146
- // Set progress
147
- Ai1wm_Status::info( __( 'Done retrieving a list of all WordPress files.', AI1WM_PLUGIN_NAME ) );
148
 
149
  return $params;
150
  }
71
 
72
  // Exclude inactive plugins
73
  if ( isset( $params['options']['no_inactive_plugins'] ) ) {
74
+ foreach ( get_plugins() as $plugin => $info ) {
75
  if ( is_plugin_inactive( $basename ) ) {
76
+ $inactive_plugins[] = 'plugins' . DIRECTORY_SEPARATOR .
77
+ ( ( dirname( $plugin ) === '.' ) ? basename( $plugin ) : dirname( $plugin ) );
 
 
 
78
  }
79
  }
80
  }
103
  }
104
 
105
  // Create map file
106
+ $filemap = ai1wm_open( ai1wm_filemap_path( $params ) , 'a+' );
107
 
108
  try {
109
 
119
  // Write path line
120
  foreach ( $iterator as $item ) {
121
  if ( $item->isFile() ) {
122
+ if ( ai1wm_write( $filemap, $iterator->getSubPathName() . PHP_EOL ) ) {
123
  $total_files++;
124
 
125
  // Add current file size
131
  // Skip bad file permissions
132
  }
133
 
134
+ // Set progress
135
+ Ai1wm_Status::info( __( 'Done retrieving a list of all WordPress files.', AI1WM_PLUGIN_NAME ) );
136
+
137
  // Set total files
138
  $params['total_files'] = $total_files;
139
 
141
  $params['total_size'] = $total_size;
142
 
143
  // Close the filemap file
144
+ ai1wm_close( $filemap );
 
 
 
145
 
146
  return $params;
147
  }
lib/model/export/class-ai1wm-export-init.php ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Copyright (C) 2014-2016 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_Init {
27
+
28
+ public static function execute( $params ) {
29
+
30
+ // Set progress
31
+ Ai1wm_Status::info( __( 'Preparing to export...', AI1WM_PLUGIN_NAME ) );
32
+
33
+ // Set archive
34
+ if ( empty( $params['archive'] ) ) {
35
+ $params['archive'] = ai1wm_archive_file();
36
+ }
37
+
38
+ // Set storage
39
+ if ( empty( $params['storage'] ) ) {
40
+ $params['storage'] = ai1wm_storage_folder();
41
+ }
42
+
43
+ // Set progress
44
+ Ai1wm_Status::info( __( 'Done preparing to export.', AI1WM_PLUGIN_NAME ) );
45
+
46
+ return $params;
47
+ }
48
+ }
lib/model/export/class-ai1wm-export-resolve.php CHANGED
@@ -31,16 +31,8 @@ class Ai1wm_Export_Resolve {
31
  Ai1wm_Status::info( __( 'Resolving URL address...', AI1WM_PLUGIN_NAME ) );
32
 
33
  // HTTP resolve
34
- Ai1wm_Http::resolve( admin_url( 'admin-ajax.php?action=ai1wm_resolve' ) );
35
-
36
- // Set archive
37
- if ( empty( $params['archive'] ) ) {
38
- $params['archive'] = ai1wm_archive_file();
39
- }
40
-
41
- // Set storage
42
- if ( empty( $params['storage'] ) ) {
43
- $params['storage'] = ai1wm_storage_folder();
44
  }
45
 
46
  // Set progress
31
  Ai1wm_Status::info( __( 'Resolving URL address...', AI1WM_PLUGIN_NAME ) );
32
 
33
  // HTTP resolve
34
+ if ( empty( $params['ai1wm_manual_export'] ) ) {
35
+ Ai1wm_Http::resolve( admin_url( 'admin-ajax.php?action=ai1wm_resolve' ) );
 
 
 
 
 
 
 
 
36
  }
37
 
38
  // Set progress
lib/model/http/class-ai1wm-http-stream.php CHANGED
@@ -90,7 +90,7 @@ class Ai1wm_Http_Stream extends Ai1wm_Http_Abstract {
90
 
91
  // Send data to server
92
  if ( ( $length = fwrite( $handle, $request ) ) !== strlen( $request ) ) {
93
- trigger_error( sprintf( 'fwrite wrote only %d instead of %d' , $length, strlen( $request ) ) );
94
  }
95
 
96
  // Set blocking/non-blocking mode on a stream
90
 
91
  // Send data to server
92
  if ( ( $length = fwrite( $handle, $request ) ) !== strlen( $request ) ) {
93
+ trigger_error( sprintf( 'fwrite wrote only %d instead of %d', $length, strlen( $request ) ) );
94
  }
95
 
96
  // Set blocking/non-blocking mode on a stream
lib/model/import/class-ai1wm-import-blogs.php CHANGED
@@ -36,32 +36,38 @@ class Ai1wm_Import_Blogs {
36
  if ( true === is_file( ai1wm_multisite_path( $params ) ) ) {
37
 
38
  // Read multisite.json file
39
- $handle = fopen( ai1wm_multisite_path( $params ), 'r' );
40
- if ( $handle === false ) {
41
- throw new Ai1wm_Import_Exception( __( 'Unable to read multisite.json file', AI1WM_PLUGIN_NAME ) );
42
- }
43
 
44
  // Parse multisite.json file
45
- $multisite = fread( $handle, filesize( ai1wm_multisite_path( $params ) ) );
46
  $multisite = json_decode( $multisite, true );
47
 
48
  // Close handle
49
- fclose( $handle );
50
 
51
  // Validate
52
  if ( empty( $multisite['Network'] ) ) {
53
  if ( isset( $multisite['Sites'] ) && ( $sites = $multisite['Sites'] ) ) {
54
- if ( count( $sites ) === 1 && ( $site = current( $sites ) ) ) {
 
 
 
 
 
 
 
55
  $blogs[] = array(
56
  'Old' => array(
57
- 'BlogID' => $site['BlogID'],
58
- 'SiteURL' => $site['SiteURL'],
59
- 'HomeURL' => $site['HomeURL'],
 
60
  ),
61
  'New' => array(
62
  'BlogID' => null,
63
  'SiteURL' => site_url(),
64
  'HomeURL' => home_url(),
 
65
  ),
66
  );
67
  } else {
@@ -81,10 +87,10 @@ class Ai1wm_Import_Blogs {
81
  }
82
  }
83
 
84
- // Save blogs.json file
85
- $handle = fopen( ai1wm_blogs_path( $params ), 'w' );
86
- fwrite( $handle, json_encode( $blogs ) );
87
- fclose( $handle );
88
 
89
  // Set progress
90
  Ai1wm_Status::info( __( 'Done preparing blogs...', AI1WM_PLUGIN_NAME ) );
36
  if ( true === is_file( ai1wm_multisite_path( $params ) ) ) {
37
 
38
  // Read multisite.json file
39
+ $handle = ai1wm_open( ai1wm_multisite_path( $params ), 'r' );
 
 
 
40
 
41
  // Parse multisite.json file
42
+ $multisite = ai1wm_read( $handle, filesize( ai1wm_multisite_path( $params ) ) );
43
  $multisite = json_decode( $multisite, true );
44
 
45
  // Close handle
46
+ ai1wm_close( $handle );
47
 
48
  // Validate
49
  if ( empty( $multisite['Network'] ) ) {
50
  if ( isset( $multisite['Sites'] ) && ( $sites = $multisite['Sites'] ) ) {
51
+ if ( count( $sites ) === 1 && ( $subsite = current( $sites ) ) ) {
52
+
53
+ // Set active plugins (backward compatibility)
54
+ if ( empty( $subsite['Plugins'] ) ) {
55
+ $subsite['Plugins'] = array();
56
+ }
57
+
58
+ // Set blog items
59
  $blogs[] = array(
60
  'Old' => array(
61
+ 'BlogID' => $subsite['BlogID'],
62
+ 'SiteURL' => $subsite['SiteURL'],
63
+ 'HomeURL' => $subsite['HomeURL'],
64
+ 'Plugins' => $subsite['Plugins'],
65
  ),
66
  'New' => array(
67
  'BlogID' => null,
68
  'SiteURL' => site_url(),
69
  'HomeURL' => home_url(),
70
+ 'Plugins' => $subsite['Plugins'],
71
  ),
72
  );
73
  } else {
87
  }
88
  }
89
 
90
+ // Write blogs.json file
91
+ $handle = ai1wm_open( ai1wm_blogs_path( $params ), 'w' );
92
+ ai1wm_write( $handle, json_encode( $blogs ) );
93
+ ai1wm_close( $handle );
94
 
95
  // Set progress
96
  Ai1wm_Status::info( __( 'Done preparing blogs...', AI1WM_PLUGIN_NAME ) );
lib/model/import/class-ai1wm-import-content.php CHANGED
@@ -28,17 +28,14 @@ class Ai1wm_Import_Content {
28
  public static function execute( $params ) {
29
 
30
  // Read blogs.json file
31
- $handle = fopen( ai1wm_blogs_path( $params ), 'r' );
32
- if ( $handle === false ) {
33
- throw new Ai1wm_Import_Exception( 'Unable to read blogs.json file' );
34
- }
35
 
36
  // Parse blogs.json file
37
- $blogs = fread( $handle, filesize( ai1wm_blogs_path( $params ) ) );
38
  $blogs = json_decode( $blogs, true );
39
 
40
  // Close handle
41
- fclose( $handle );
42
 
43
  // Set content offset
44
  if ( isset( $params['content_offset'] ) ) {
@@ -86,9 +83,6 @@ class Ai1wm_Import_Content {
86
  // Start time
87
  $start = microtime( true );
88
 
89
- // Flag to hold if all files have been processed
90
- $completed = true;
91
-
92
  // Open the archive file for reading
93
  $archive = new Ai1wm_Extractor( ai1wm_archive_path( $params ) );
94
 
@@ -124,8 +118,23 @@ class Ai1wm_Import_Content {
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']['BlogID'] ) === true ) {
127
- $old_paths[] = ai1wm_sites_path( $blog['Old']['BlogID'] );
128
- $new_paths[] = ai1wm_sites_path( $blog['New']['BlogID'] );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
129
  }
130
  }
131
 
@@ -155,21 +164,9 @@ class Ai1wm_Import_Content {
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
-
169
- // Close the archive file
170
- $archive->close();
171
-
172
- return $params;
173
  }
174
 
175
  // Increment processed files
@@ -183,28 +180,47 @@ class Ai1wm_Import_Content {
183
  // Set archive offset
184
  $archive_offset = $archive->get_file_pointer();
185
 
 
 
186
  } catch ( Exception $e ) {
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;
193
  break;
194
  }
195
  }
196
 
197
- // Set content offset
198
- $params['content_offset'] = $content_offset;
199
 
200
- // Set archive offset
201
- $params['archive_offset'] = $archive_offset;
202
 
203
- // Set processed files
204
- $params['processed'] = $processed;
205
 
206
- // Set completed flag
207
- $params['completed'] = $completed;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
208
 
209
  // Close the archive file
210
  $archive->close();
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 content offset
41
  if ( isset( $params['content_offset'] ) ) {
83
  // Start time
84
  $start = microtime( true );
85
 
 
 
 
86
  // Open the archive file for reading
87
  $archive = new Ai1wm_Extractor( ai1wm_archive_path( $params ) );
88
 
118
  // Set base site extract paths (should be added at the end of arrays)
119
  foreach ( $blogs as $blog ) {
120
  if ( ai1wm_main_site( $blog['Old']['BlogID'] ) === true ) {
121
+ if ( defined( 'UPLOADBLOGSDIR' ) ) {
122
+ // Old sites dir style
123
+ $old_paths[] = ai1wm_files_path( $blog['Old']['BlogID'] );
124
+ $new_paths[] = ai1wm_files_path( $blog['New']['BlogID'] );
125
+
126
+ // New sites dir style
127
+ $old_paths[] = ai1wm_sites_path( $blog['Old']['BlogID'] );
128
+ $new_paths[] = ai1wm_files_path( $blog['New']['BlogID'] );
129
+ } else {
130
+ // Old sites dir style
131
+ $old_paths[] = ai1wm_files_path( $blog['Old']['BlogID'] );
132
+ $new_paths[] = ai1wm_sites_path( $blog['New']['BlogID'] );
133
+
134
+ // New sites dir style
135
+ $old_paths[] = ai1wm_sites_path( $blog['Old']['BlogID'] );
136
+ $new_paths[] = ai1wm_sites_path( $blog['New']['BlogID'] );
137
+ }
138
  }
139
  }
140
 
164
  Ai1wm_Status::info( sprintf( __( 'Restoring %d files...<br />%d%% complete', AI1WM_PLUGIN_NAME ), $total_files, $progress ) );
165
 
166
  // Set content offset
167
+ $content_offset = $current_offset;
 
 
 
 
 
 
168
 
169
+ break;
 
 
 
 
 
 
170
  }
171
 
172
  // Increment processed files
180
  // Set archive offset
181
  $archive_offset = $archive->get_file_pointer();
182
 
183
+ } catch ( Ai1wm_Quota_Exceeded_Exception $e ) {
184
+ throw new Exception( 'Out of disk space.' );
185
  } catch ( Exception $e ) {
186
  // Skip bad file permissions
187
  }
188
 
189
  // More than 10 seconds have passed, break and do another request
190
  if ( ( microtime( true ) - $start ) > 10 ) {
 
191
  break;
192
  }
193
  }
194
 
195
+ // End of the archive?
196
+ if ( $archive->has_reached_eof() ) {
197
 
198
+ // Unset content offset
199
+ unset( $params['content_offset'] );
200
 
201
+ // Unset archive offset
202
+ unset( $params['archive_offset'] );
203
 
204
+ // Unset processed files
205
+ unset( $params['processed'] );
206
+
207
+ // Unset completed flag
208
+ unset( $params['completed'] );
209
+
210
+ } else {
211
+
212
+ // Set content offset
213
+ $params['content_offset'] = $content_offset;
214
+
215
+ // Set archive offset
216
+ $params['archive_offset'] = $archive_offset;
217
+
218
+ // Set processed files
219
+ $params['processed'] = $processed;
220
+
221
+ // Set completed flag
222
+ $params['completed'] = false;
223
+ }
224
 
225
  // Close the archive file
226
  $archive->close();
lib/model/import/class-ai1wm-import-database.php CHANGED
@@ -34,30 +34,24 @@ class Ai1wm_Import_Database {
34
  }
35
 
36
  // Read blogs.json file
37
- $handle = fopen( ai1wm_blogs_path( $params ), 'r' );
38
- if ( $handle === false ) {
39
- throw new Ai1wm_Import_Exception( 'Unable to read blogs.json file' );
40
- }
41
 
42
  // Parse blogs.json file
43
- $blogs = fread( $handle, filesize( ai1wm_blogs_path( $params ) ) );
44
  $blogs = json_decode( $blogs, true );
45
 
46
  // Close handle
47
- fclose( $handle );
48
 
49
  // Read package.json file
50
- $handle = fopen( ai1wm_package_path( $params ), 'r' );
51
- if ( $handle === false ) {
52
- throw new Ai1wm_Import_Exception( 'Unable to read package.json file' );
53
- }
54
 
55
  // Parse package.json file
56
- $config = fread( $handle, filesize( ai1wm_package_path( $params ) ) );
57
  $config = json_decode( $config, true );
58
 
59
  // Close handle
60
- fclose( $handle );
61
 
62
  // Set progress
63
  Ai1wm_Status::info( __( 'Restoring database...', AI1WM_PLUGIN_NAME ) );
@@ -448,8 +442,11 @@ class Ai1wm_Import_Database {
448
  // Flush WP cache
449
  ai1wm_cache_flush();
450
 
 
 
 
451
  // Activate plugins
452
- activate_plugins( $active_servmask_plugins, null, is_multisite() );
453
 
454
  // Set the new URL IP
455
  update_option( AI1WM_URL_IP, $url_ip );
34
  }
35
 
36
  // Read blogs.json file
37
+ $handle = ai1wm_open( ai1wm_blogs_path( $params ), 'r' );
 
 
 
38
 
39
  // Parse blogs.json file
40
+ $blogs = ai1wm_read( $handle, filesize( ai1wm_blogs_path( $params ) ) );
41
  $blogs = json_decode( $blogs, true );
42
 
43
  // Close handle
44
+ ai1wm_close( $handle );
45
 
46
  // Read package.json file
47
+ $handle = ai1wm_open( ai1wm_package_path( $params ), 'r' );
 
 
 
48
 
49
  // Parse package.json file
50
+ $config = ai1wm_read( $handle, filesize( ai1wm_package_path( $params ) ) );
51
  $config = json_decode( $config, true );
52
 
53
  // Close handle
54
+ ai1wm_close( $handle );
55
 
56
  // Set progress
57
  Ai1wm_Status::info( __( 'Restoring database...', AI1WM_PLUGIN_NAME ) );
442
  // Flush WP cache
443
  ai1wm_cache_flush();
444
 
445
+ // Set progress
446
+ Ai1wm_Status::info( __( 'Done restoring database...', AI1WM_PLUGIN_NAME ) );
447
+
448
  // Activate plugins
449
+ activate_plugins( $active_servmask_plugins, null, false );
450
 
451
  // Set the new URL IP
452
  update_option( AI1WM_URL_IP, $url_ip );
lib/model/import/class-ai1wm-import-done.php CHANGED
@@ -27,28 +27,74 @@ class Ai1wm_Import_Done {
27
 
28
  public static function execute( $params ) {
29
 
 
 
 
30
  // Check multisite.json file
31
  if ( true === is_file( ai1wm_multisite_path( $params ) ) ) {
32
 
33
  // Read multisite.json file
34
- $handle = fopen( ai1wm_multisite_path( $params ), 'r' );
35
- if ( $handle === false ) {
36
- throw new Ai1wm_Import_Exception( __( 'Unable to read multisite.json file', AI1WM_PLUGIN_NAME ) );
37
- }
38
 
39
  // Parse multisite.json file
40
- $multisite = fread( $handle, filesize( ai1wm_multisite_path( $params ) ) );
41
  $multisite = json_decode( $multisite, true );
42
 
43
  // Close handle
44
- fclose( $handle );
45
 
46
- // Activate plugins
47
  if ( isset( $multisite['Plugins'] ) && ( $active_sitewide_plugins = $multisite['Plugins'] ) ) {
48
- activate_plugins( $active_sitewide_plugins, null, is_multisite(), true );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
49
  }
50
  }
51
 
 
 
 
 
 
52
  // Set progress
53
  Ai1wm_Status::done(
54
  sprintf(
@@ -65,7 +111,5 @@ class Ai1wm_Import_Done {
65
  AI1WM_PLUGIN_NAME
66
  )
67
  );
68
-
69
- return $params;
70
  }
71
  }
27
 
28
  public static function execute( $params ) {
29
 
30
+ // Set shutdown handler
31
+ @register_shutdown_function( 'Ai1wm_Import_Done::shutdown' );
32
+
33
  // Check multisite.json file
34
  if ( true === is_file( ai1wm_multisite_path( $params ) ) ) {
35
 
36
  // Read multisite.json file
37
+ $handle = ai1wm_open( ai1wm_multisite_path( $params ), 'r' );
 
 
 
38
 
39
  // Parse multisite.json file
40
+ $multisite = ai1wm_read( $handle, filesize( ai1wm_multisite_path( $params ) ) );
41
  $multisite = json_decode( $multisite, true );
42
 
43
  // Close handle
44
+ ai1wm_close( $handle );
45
 
46
+ // Activate sitewide plugins
47
  if ( isset( $multisite['Plugins'] ) && ( $active_sitewide_plugins = $multisite['Plugins'] ) ) {
48
+ activate_plugins( $active_sitewide_plugins, null, false, true );
49
+ }
50
+ } else {
51
+
52
+ // Check package.json file
53
+ if ( true === is_file( ai1wm_package_path( $params ) ) ) {
54
+
55
+ // Read package.json file
56
+ $handle = ai1wm_open( ai1wm_package_path( $params ), 'r' );
57
+
58
+ // Parse package.json file
59
+ $package = ai1wm_read( $handle, filesize( ai1wm_package_path( $params ) ) );
60
+ $package = json_decode( $package, true );
61
+
62
+ // Close handle
63
+ ai1wm_close( $handle );
64
+
65
+ // Activate plugins
66
+ if ( isset( $package['Plugins'] ) && ( $active_plugins = $package['Plugins'] ) ) {
67
+ activate_plugins( $active_plugins, null, false, true );
68
+ }
69
+ }
70
+ }
71
+
72
+ // Check blogs.json file
73
+ if ( true === is_file( ai1wm_blogs_path( $params ) ) ) {
74
+
75
+ // Read blogs.json file
76
+ $handle = ai1wm_open( ai1wm_blogs_path( $params ), 'r' );
77
+
78
+ // Parse blogs.json file
79
+ $blogs = ai1wm_read( $handle, filesize( ai1wm_blogs_path( $params ) ) );
80
+ $blogs = json_decode( $blogs, true );
81
+
82
+ // Close handle
83
+ ai1wm_close( $handle );
84
+
85
+ // Activate plugins
86
+ foreach ( $blogs as $blog ) {
87
+ if ( isset( $blog['New']['Plugins'] ) && ( $active_plugins = $blog['New']['Plugins'] ) ) {
88
+ activate_plugins( $active_plugins, null, false, true );
89
+ }
90
  }
91
  }
92
 
93
+ return $params;
94
+ }
95
+
96
+ public static function shutdown() {
97
+
98
  // Set progress
99
  Ai1wm_Status::done(
100
  sprintf(
111
  AI1WM_PLUGIN_NAME
112
  )
113
  );
 
 
114
  }
115
  }
lib/model/import/class-ai1wm-import-resolve.php CHANGED
@@ -31,7 +31,9 @@ class Ai1wm_Import_Resolve {
31
  Ai1wm_Status::info( __( 'Resolving URL address...', AI1WM_PLUGIN_NAME ) );
32
 
33
  // HTTP resolve
34
- Ai1wm_Http::resolve( admin_url( 'admin-ajax.php?action=ai1wm_resolve' ) );
 
 
35
 
36
  // Set progress
37
  Ai1wm_Status::info( __( 'Done resolving URL address...', AI1WM_PLUGIN_NAME ) );
31
  Ai1wm_Status::info( __( 'Resolving URL address...', AI1WM_PLUGIN_NAME ) );
32
 
33
  // HTTP resolve
34
+ if ( empty( $params['ai1wm_manual_import'] ) && empty( $params['ai1wm_manual_backups'] ) ) {
35
+ Ai1wm_Http::resolve( admin_url( 'admin-ajax.php?action=ai1wm_resolve' ) );
36
+ }
37
 
38
  // Set progress
39
  Ai1wm_Status::info( __( 'Done resolving URL address...', AI1WM_PLUGIN_NAME ) );
lib/model/import/class-ai1wm-import-validate.php CHANGED
@@ -27,12 +27,29 @@ class Ai1wm_Import_Validate {
27
 
28
  public static function execute( $params ) {
29
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
30
  // Set progress
31
  Ai1wm_Status::info( __( 'Unpacking archive...', AI1WM_PLUGIN_NAME ) );
32
 
33
  // Open the archive file for reading
34
  $archive = new Ai1wm_Extractor( ai1wm_archive_path( $params ) );
35
 
 
 
 
36
  // Validate the archive file consistency
37
  if ( ! $archive->is_valid() ) {
38
  throw new Ai1wm_Import_Exception(
@@ -74,26 +91,58 @@ class Ai1wm_Import_Validate {
74
  );
75
  }
76
 
77
- // Unpack package.json, multisite.json and database.sql files
78
- $archive->extract_by_files_array(
79
- ai1wm_storage_path( $params ),
80
- array(
81
- AI1WM_PACKAGE_NAME,
82
- AI1WM_MULTISITE_NAME,
83
- AI1WM_DATABASE_NAME,
84
- )
85
- );
86
 
87
- // Close the archive file
88
- $archive->close();
89
 
90
- // Check package.json file
91
- if ( false === is_file( ai1wm_package_path( $params ) ) ) {
92
- throw new Ai1wm_Import_Exception(
93
- __( 'Invalid archive file. It should contain <strong>package.json</strong> file.', AI1WM_PLUGIN_NAME )
94
- );
 
 
 
 
 
 
95
  }
96
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
97
  return $params;
98
  }
99
  }
27
 
28
  public static function execute( $params ) {
29
 
30
+ // Set content offset
31
+ if ( isset( $params['content_offset'] ) ) {
32
+ $content_offset = (int) $params['content_offset'];
33
+ } else {
34
+ $content_offset = 0;
35
+ }
36
+
37
+ // Set archive offset
38
+ if ( isset( $params['archive_offset'] ) ) {
39
+ $archive_offset = (int) $params['archive_offset'];
40
+ } else {
41
+ $archive_offset = 0;
42
+ }
43
+
44
  // Set progress
45
  Ai1wm_Status::info( __( 'Unpacking archive...', AI1WM_PLUGIN_NAME ) );
46
 
47
  // Open the archive file for reading
48
  $archive = new Ai1wm_Extractor( ai1wm_archive_path( $params ) );
49
 
50
+ // Set the file pointer to the one that we have saved
51
+ $archive->set_file_pointer( null, $archive_offset );
52
+
53
  // Validate the archive file consistency
54
  if ( ! $archive->is_valid() ) {
55
  throw new Ai1wm_Import_Exception(
91
  );
92
  }
93
 
94
+ if ( $archive->has_not_reached_eof() ) {
 
 
 
 
 
 
 
 
95
 
96
+ // Unpack package.json, multisite.json and database.sql files
97
+ if ( ( $current_offset = $archive->extract_by_files_array( ai1wm_storage_path( $params ), array( AI1WM_PACKAGE_NAME, AI1WM_MULTISITE_NAME, AI1WM_DATABASE_NAME ), $content_offset, 10 ) ) ) {
98
 
99
+ // Set content offset
100
+ $content_offset = $current_offset;
101
+
102
+ } else {
103
+
104
+ // Set content offset
105
+ $content_offset = 0;
106
+
107
+ // Set archive offset
108
+ $archive_offset = $archive->get_file_pointer();
109
+ }
110
  }
111
 
112
+ // End of the archive?
113
+ if ( $archive->has_reached_eof() ) {
114
+
115
+ // Check package.json file
116
+ if ( false === is_file( ai1wm_package_path( $params ) ) ) {
117
+ throw new Ai1wm_Import_Exception(
118
+ __( 'Invalid archive file. It should contain <strong>package.json</strong> file.', AI1WM_PLUGIN_NAME )
119
+ );
120
+ }
121
+
122
+ // Unset content offset
123
+ unset( $params['content_offset'] );
124
+
125
+ // Unset archive offset
126
+ unset( $params['archive_offset'] );
127
+
128
+ // Unset completed flag
129
+ unset( $params['completed'] );
130
+
131
+ } else {
132
+
133
+ // Set content offset
134
+ $params['content_offset'] = $content_offset;
135
+
136
+ // Set archive offset
137
+ $params['archive_offset'] = $archive_offset;
138
+
139
+ // Set completed flag
140
+ $params['completed'] = false;
141
+ }
142
+
143
+ // Close the archive file
144
+ $archive->close();
145
+
146
  return $params;
147
  }
148
  }
lib/vendor/servmask/archiver/class-ai1wm-archiver.php CHANGED
@@ -85,6 +85,7 @@ abstract class Ai1wm_Archiver {
85
  // initialize end of file
86
  $this->eof = pack( 'a4377', '' );
87
 
 
88
  if ( $write ) {
89
  $this->file_handle = $this->open_file_for_writing( $filename );
90
  } else {
@@ -138,16 +139,7 @@ abstract class Ai1wm_Archiver {
138
  * @throws \Ai1wm_Not_Accesible_Exception
139
  */
140
  protected function open_file_in_mode( $file, $mode ) {
141
- // open the file for writing in binary mode
142
- $file_handle = @fopen( $file, $mode );
143
-
144
- // check if we have a handle
145
- if ( false === $file_handle ) {
146
- // we couldn't open the file
147
- throw new Ai1wm_Not_Accesible_Exception( sprintf( __( 'Unable to open %s', AI1WM_PLUGIN_NAME ), $file ) );
148
- }
149
-
150
- return $file_handle;
151
  }
152
 
153
  /**
@@ -155,15 +147,11 @@ abstract class Ai1wm_Archiver {
155
  *
156
  * @param resource $handle File handle
157
  * @param string $data Data to be written - binary
158
- * @param string $file Filename that the file handle belongs to
159
  *
160
  * @throws \Ai1wm_Not_Writable_Exception
161
  */
162
- protected function write_to_handle( $handle, $data, $file ) {
163
- $result = @fwrite( $handle, $data );
164
- if ( false === $result || ( ! empty( $data ) && 0 === $result ) ) {
165
- throw new Ai1wm_Not_Writable_Exception( sprintf( __( 'Unable to write %s', AI1WM_PLUGIN_NAME ), $file ) );
166
- }
167
  }
168
 
169
  /**
@@ -171,18 +159,12 @@ abstract class Ai1wm_Archiver {
171
  *
172
  * @param resource $handle File handle
173
  * @param int $size Size of data to be read in bytes
174
- * @param string $file Filename that the file handle belongs to
175
  *
176
  * @return string Content that was read
177
  * @throws \Ai1wm_Not_Readable_Exception
178
  */
179
- protected function read_from_handle( $handle, $size, $file ) {
180
- $result = @fread( $handle, $size );
181
- if ( false === $result ) {
182
- throw new Ai1wm_Not_Readable_Exception( sprintf( __( 'Unable to read %s', AI1WM_PLUGIN_NAME ), $file ) );
183
- }
184
-
185
- return $result;
186
  }
187
 
188
  /**
@@ -191,7 +173,7 @@ abstract class Ai1wm_Archiver {
191
  * @throws \Ai1wm_Not_Writable_Exception
192
  */
193
  protected function append_eof() {
194
- $this->write_to_handle( $this->file_handle, $this->eof, $this->filename );
195
  }
196
 
197
  /**
@@ -204,7 +186,7 @@ abstract class Ai1wm_Archiver {
204
 
205
  // set file offset
206
  if ( fseek( $this->file_handle, -4377, SEEK_END ) !== -1 ) {
207
- if ( fread( $this->file_handle, 4377 ) === $this->eof ) {
208
  if ( fseek( $this->file_handle, $offset, SEEK_SET ) !== -1 ) {
209
  return true;
210
  }
@@ -228,10 +210,9 @@ abstract class Ai1wm_Archiver {
228
  *
229
  * We either close the file or append the end of file block if complete argument is set to tru
230
  *
231
- * @param bool $complete Flag to append end of file block
 
232
  *
233
- * @throws \Ai1wm_Not_Accesible_Exception
234
- * @throws \Ai1wm_Not_Writable_Exception
235
  */
236
  public function close( $complete = false ) {
237
  // are we done appending to the file?
@@ -240,11 +221,6 @@ abstract class Ai1wm_Archiver {
240
  }
241
 
242
  // close the file
243
- $result = fclose( $this->file_handle );
244
-
245
- if ( false === $result ) {
246
- // unable to close the file
247
- throw new Ai1wm_Not_Accesible_Exception( sprintf( __( 'Unable to close %s', AI1WM_PLUGIN_NAME ), $this->filename ) );
248
- }
249
  }
250
  }
85
  // initialize end of file
86
  $this->eof = pack( 'a4377', '' );
87
 
88
+ // open file for writing or reading
89
  if ( $write ) {
90
  $this->file_handle = $this->open_file_for_writing( $filename );
91
  } else {
139
  * @throws \Ai1wm_Not_Accesible_Exception
140
  */
141
  protected function open_file_in_mode( $file, $mode ) {
142
+ return ai1wm_open( $file, $mode );
 
 
 
 
 
 
 
 
 
143
  }
144
 
145
  /**
147
  *
148
  * @param resource $handle File handle
149
  * @param string $data Data to be written - binary
 
150
  *
151
  * @throws \Ai1wm_Not_Writable_Exception
152
  */
153
+ protected function write_to_handle( $handle, $data ) {
154
+ return ai1wm_write( $handle, $data );
 
 
 
155
  }
156
 
157
  /**
159
  *
160
  * @param resource $handle File handle
161
  * @param int $size Size of data to be read in bytes
 
162
  *
163
  * @return string Content that was read
164
  * @throws \Ai1wm_Not_Readable_Exception
165
  */
166
+ protected function read_from_handle( $handle, $size ) {
167
+ return ai1wm_read( $handle, $size );
 
 
 
 
 
168
  }
169
 
170
  /**
173
  * @throws \Ai1wm_Not_Writable_Exception
174
  */
175
  protected function append_eof() {
176
+ return $this->write_to_handle( $this->file_handle, $this->eof );
177
  }
178
 
179
  /**
186
 
187
  // set file offset
188
  if ( fseek( $this->file_handle, -4377, SEEK_END ) !== -1 ) {
189
+ if ( ai1wm_read( $this->file_handle, 4377 ) === $this->eof ) {
190
  if ( fseek( $this->file_handle, $offset, SEEK_SET ) !== -1 ) {
191
  return true;
192
  }
210
  *
211
  * We either close the file or append the end of file block if complete argument is set to tru
212
  *
213
+ * @param bool $complete Flag to append end of file block
214
+ * @return void
215
  *
 
 
216
  */
217
  public function close( $complete = false ) {
218
  // are we done appending to the file?
221
  }
222
 
223
  // close the file
224
+ ai1wm_close( $this->file_handle );
 
 
 
 
 
225
  }
226
  }
lib/vendor/servmask/archiver/class-ai1wm-compressor.php CHANGED
@@ -64,7 +64,7 @@ class Ai1wm_Compressor extends Ai1wm_Archiver {
64
  $block = $this->get_file_block( $file, $new_filename );
65
 
66
  // write file block header to our archive file
67
- $this->write_to_handle( $this->file_handle, $block, $this->filename );
68
  }
69
 
70
  // set file size
@@ -79,13 +79,13 @@ class Ai1wm_Compressor extends Ai1wm_Archiver {
79
  $chunk_size = $current_filesize > 512000 ? 512000 : $current_filesize;
80
 
81
  // read the file in chunks of 512KB
82
- $content = $this->read_from_handle( $handle, $chunk_size, $file );
83
 
84
  // remove the amount of bytes we read
85
  $current_filesize -= $chunk_size;
86
 
87
  // write file contents
88
- $this->write_to_handle( $this->file_handle, $content, $this->filename );
89
 
90
  // time elapsed
91
  if ( $timeout ) {
@@ -94,7 +94,7 @@ class Ai1wm_Compressor extends Ai1wm_Archiver {
94
  $offset = ftell( $handle );
95
 
96
  // close the handle
97
- fclose( $handle );
98
 
99
  // get file offset
100
  return $offset;
@@ -103,7 +103,7 @@ class Ai1wm_Compressor extends Ai1wm_Archiver {
103
  }
104
 
105
  // close the handle
106
- fclose( $handle );
107
  }
108
 
109
  /**
64
  $block = $this->get_file_block( $file, $new_filename );
65
 
66
  // write file block header to our archive file
67
+ $this->write_to_handle( $this->file_handle, $block );
68
  }
69
 
70
  // set file size
79
  $chunk_size = $current_filesize > 512000 ? 512000 : $current_filesize;
80
 
81
  // read the file in chunks of 512KB
82
+ $content = $this->read_from_handle( $handle, $chunk_size );
83
 
84
  // remove the amount of bytes we read
85
  $current_filesize -= $chunk_size;
86
 
87
  // write file contents
88
+ $this->write_to_handle( $this->file_handle, $content );
89
 
90
  // time elapsed
91
  if ( $timeout ) {
94
  $offset = ftell( $handle );
95
 
96
  // close the handle
97
+ ai1wm_close( $handle );
98
 
99
  // get file offset
100
  return $offset;
103
  }
104
 
105
  // close the handle
106
+ ai1wm_close( $handle );
107
  }
108
 
109
  /**
lib/vendor/servmask/archiver/class-ai1wm-extractor.php CHANGED
@@ -58,7 +58,7 @@ class Ai1wm_Extractor extends Ai1wm_Archiver {
58
  // total files
59
  $total_files = 0;
60
 
61
- while ( $block = $this->read_from_handle( $this->file_handle, 4377, $this->filename ) ) {
62
  // end block has been reached
63
  if ( $block === $this->eof ) {
64
  continue;
@@ -71,7 +71,7 @@ class Ai1wm_Extractor extends Ai1wm_Archiver {
71
  $total_files++;
72
 
73
  // skip file content so we can move forward to the next file
74
- $this->set_file_pointer( $this->file_handle, $data['size'], $this->filename );
75
  }
76
 
77
  return $total_files;
@@ -90,7 +90,7 @@ class Ai1wm_Extractor extends Ai1wm_Archiver {
90
  // total size
91
  $total_size = 0;
92
 
93
- while ( $block = $this->read_from_handle( $this->file_handle, 4377, $this->filename ) ) {
94
  // end block has been reached
95
  if ( $block === $this->eof ) {
96
  continue;
@@ -103,7 +103,7 @@ class Ai1wm_Extractor extends Ai1wm_Archiver {
103
  $total_size += $data['size'];
104
 
105
  // skip file content so we can move forward to the next file
106
- $this->set_file_pointer( $this->file_handle, $data['size'], $this->filename );
107
  }
108
 
109
  return $total_size;
@@ -114,7 +114,7 @@ class Ai1wm_Extractor extends Ai1wm_Archiver {
114
  throw new Ai1wm_Not_Readable_Exception( sprintf( __( '%s doesn\'t exist', AI1WM_PLUGIN_NAME ), $location ) );
115
  }
116
 
117
- $block = $this->read_from_handle( $this->file_handle, 4377, $this->filename );
118
 
119
  // we reached end of file, set the pointer to the end of the file so that feof returns true
120
  if ( $block === $this->eof ) {
@@ -142,7 +142,7 @@ class Ai1wm_Extractor extends Ai1wm_Archiver {
142
  // should we skip this file?
143
  for ( $i = 0; $i < count( $exclude ); $i++ ) {
144
  if ( strpos( $filename . DIRECTORY_SEPARATOR, $exclude[$i] . DIRECTORY_SEPARATOR ) === 0 ) {
145
- $this->set_file_pointer( $this->file_handle, $data['size'], $this->filename );
146
  return;
147
  }
148
  }
@@ -155,9 +155,12 @@ class Ai1wm_Extractor extends Ai1wm_Archiver {
155
  }
156
  }
157
 
 
 
158
  // check if location doesn't exist, then create it
159
- if ( false === is_dir( $location . DIRECTORY_SEPARATOR . $path ) ) {
160
- mkdir( $location . DIRECTORY_SEPARATOR . $path, 0755, true );
 
161
  }
162
 
163
  try {
@@ -167,7 +170,7 @@ class Ai1wm_Extractor extends Ai1wm_Archiver {
167
  }
168
  } catch ( Exception $e ) {
169
  // we don't have file permissions, skip file content
170
- $this->set_file_pointer( $this->file_handle, $data['size'], $this->filename );
171
  }
172
  }
173
 
@@ -184,8 +187,11 @@ class Ai1wm_Extractor extends Ai1wm_Archiver {
184
  throw new Ai1wm_Not_Readable_Exception( sprintf( __( '%s doesn\'t exist', AI1WM_PLUGIN_NAME ), $location ) );
185
  }
186
 
 
 
 
187
  // we read until we reached the end of the file, or the files we were looking for were found
188
- while ( ( $block = $this->read_from_handle( $this->file_handle, 4377, $this->filename ) ) ) {
189
  // end block has been reached and we still have files to extract
190
  // that means the files don't exist in the archive
191
  if ( $block === $this->eof ) {
@@ -223,9 +229,12 @@ class Ai1wm_Extractor extends Ai1wm_Archiver {
223
 
224
  // do we have a match?
225
  if ( $include ) {
 
 
226
  // check if location doesn't exist, then create it
227
- if ( false === is_dir( $location . DIRECTORY_SEPARATOR . $path ) ) {
228
- mkdir( $location . DIRECTORY_SEPARATOR . $path, 0755, true );
 
229
  }
230
 
231
  try {
@@ -235,39 +244,36 @@ class Ai1wm_Extractor extends Ai1wm_Archiver {
235
  }
236
  } catch ( Exception $e ) {
237
  // we don't have file permissions, skip file content
238
- $this->set_file_pointer( $this->file_handle, $data['size'], $this->filename );
239
  }
240
  } else {
241
  // we don't have a match, skip file content
242
- $this->set_file_pointer( $this->file_handle, $data['size'], $this->filename );
 
 
 
 
 
 
 
243
  }
244
  }
245
  }
246
 
247
- public function set_file_pointer( $handle = null, $offset = 0, $file = '' ) {
248
  // if null is used, we use the archive handle
249
  if ( is_null( $handle ) ) {
250
  $handle = $this->file_handle;
251
  }
252
 
253
- // if filename is empty, we use archive filename
254
- if ( empty( $file ) ) {
255
- $file = $this->filename;
256
- }
257
-
258
  // do we have offset to apply?
259
  if ( $offset > 0 ) {
260
  // set position to current location plus offset
261
  $result = fseek( $handle, $offset, SEEK_CUR );
262
-
263
  if ( -1 === $result ) {
264
- throw new Ai1wm_Not_Accesible_Exception(
265
- sprintf(
266
- __( 'Unable to seek to offset %d on %s', AI1WM_PLUGIN_NAME ),
267
- $offset,
268
- $file
269
- )
270
- );
271
  }
272
  }
273
  }
@@ -284,7 +290,7 @@ class Ai1wm_Extractor extends Ai1wm_Archiver {
284
  $data_file_pointer = $this->get_file_pointer();
285
 
286
  // set data file pointer
287
- $this->set_file_pointer( $this->file_handle, $offset, $this->filename );
288
 
289
  // set file size
290
  $data['size'] -= $offset;
@@ -298,13 +304,13 @@ class Ai1wm_Extractor extends Ai1wm_Archiver {
298
  $chunk_size = $data['size'] > 512000 ? 512000 : $data['size'];
299
 
300
  // read the file in chunks of 512KB from archiver
301
- $content = $this->read_from_handle( $this->file_handle, $chunk_size, $this->filename );
302
 
303
  // remove the amount of bytes we read
304
  $data['size'] -= $chunk_size;
305
 
306
  // write file contents
307
- $this->write_to_handle( $handle, $content, $file );
308
 
309
  // time elapsed
310
  if ( $timeout ) {
@@ -313,7 +319,7 @@ class Ai1wm_Extractor extends Ai1wm_Archiver {
313
  $offset = $this->get_file_pointer() - $data_file_pointer;
314
 
315
  // close the handle
316
- fclose( $handle );
317
 
318
  // get file offset
319
  return $offset;
@@ -322,13 +328,14 @@ class Ai1wm_Extractor extends Ai1wm_Archiver {
322
  }
323
 
324
  // close the handle
325
- fclose( $handle );
326
 
327
  // let's apply last modified date
328
  $this->set_mtime_of_file( $file, $data['mtime'] );
329
 
330
- // all files should chmoded to 755
331
- $this->set_file_mode( $file, 0644 );
 
332
  }
333
 
334
  private function set_mtime_of_file( $file, $mtime ) {
@@ -362,6 +369,16 @@ class Ai1wm_Extractor extends Ai1wm_Archiver {
362
  return $data;
363
  }
364
 
 
 
 
 
 
 
 
 
 
 
365
  /**
366
  * Check if file has reached end of file
367
  * Returns true if file has NOT reached eof, false otherwise
@@ -391,4 +408,21 @@ class Ai1wm_Extractor extends Ai1wm_Archiver {
391
 
392
  return $result;
393
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
394
  }
58
  // total files
59
  $total_files = 0;
60
 
61
+ while ( $block = $this->read_from_handle( $this->file_handle, 4377 ) ) {
62
  // end block has been reached
63
  if ( $block === $this->eof ) {
64
  continue;
71
  $total_files++;
72
 
73
  // skip file content so we can move forward to the next file
74
+ $this->set_file_pointer( $this->file_handle, $data['size'] );
75
  }
76
 
77
  return $total_files;
90
  // total size
91
  $total_size = 0;
92
 
93
+ while ( $block = $this->read_from_handle( $this->file_handle, 4377 ) ) {
94
  // end block has been reached
95
  if ( $block === $this->eof ) {
96
  continue;
103
  $total_size += $data['size'];
104
 
105
  // skip file content so we can move forward to the next file
106
+ $this->set_file_pointer( $this->file_handle, $data['size'] );
107
  }
108
 
109
  return $total_size;
114
  throw new Ai1wm_Not_Readable_Exception( sprintf( __( '%s doesn\'t exist', AI1WM_PLUGIN_NAME ), $location ) );
115
  }
116
 
117
+ $block = $this->read_from_handle( $this->file_handle, 4377 );
118
 
119
  // we reached end of file, set the pointer to the end of the file so that feof returns true
120
  if ( $block === $this->eof ) {
142
  // should we skip this file?
143
  for ( $i = 0; $i < count( $exclude ); $i++ ) {
144
  if ( strpos( $filename . DIRECTORY_SEPARATOR, $exclude[$i] . DIRECTORY_SEPARATOR ) === 0 ) {
145
+ $this->set_file_pointer( $this->file_handle, $data['size'] );
146
  return;
147
  }
148
  }
155
  }
156
  }
157
 
158
+ $directory = $location . DIRECTORY_SEPARATOR . $path;
159
+
160
  // check if location doesn't exist, then create it
161
+ if ( false === is_dir( $directory ) ) {
162
+ $permissions = self::get_permissions_for_directory();
163
+ mkdir( $directory, $permissions, true );
164
  }
165
 
166
  try {
170
  }
171
  } catch ( Exception $e ) {
172
  // we don't have file permissions, skip file content
173
+ $this->set_file_pointer( $this->file_handle, $data['size'] );
174
  }
175
  }
176
 
187
  throw new Ai1wm_Not_Readable_Exception( sprintf( __( '%s doesn\'t exist', AI1WM_PLUGIN_NAME ), $location ) );
188
  }
189
 
190
+ // start time
191
+ $start = microtime( true );
192
+
193
  // we read until we reached the end of the file, or the files we were looking for were found
194
+ while ( ( $block = $this->read_from_handle( $this->file_handle, 4377 ) ) ) {
195
  // end block has been reached and we still have files to extract
196
  // that means the files don't exist in the archive
197
  if ( $block === $this->eof ) {
229
 
230
  // do we have a match?
231
  if ( $include ) {
232
+ $directory = $location . DIRECTORY_SEPARATOR . $path;
233
+
234
  // check if location doesn't exist, then create it
235
+ if ( false === is_dir( $directory ) ) {
236
+ $permissions = self::get_permissions_for_directory();
237
+ mkdir( $directory, $permissions, true );
238
  }
239
 
240
  try {
244
  }
245
  } catch ( Exception $e ) {
246
  // we don't have file permissions, skip file content
247
+ $this->set_file_pointer( $this->file_handle, $data['size'] );
248
  }
249
  } else {
250
  // we don't have a match, skip file content
251
+ $this->set_file_pointer( $this->file_handle, $data['size'] );
252
+ }
253
+
254
+ // time elapsed
255
+ if ( $timeout ) {
256
+ if ( ( microtime( true ) - $start ) > $timeout ) {
257
+ break;
258
+ }
259
  }
260
  }
261
  }
262
 
263
+ public function set_file_pointer( $handle = null, $offset = 0 ) {
264
  // if null is used, we use the archive handle
265
  if ( is_null( $handle ) ) {
266
  $handle = $this->file_handle;
267
  }
268
 
 
 
 
 
 
269
  // do we have offset to apply?
270
  if ( $offset > 0 ) {
271
  // set position to current location plus offset
272
  $result = fseek( $handle, $offset, SEEK_CUR );
 
273
  if ( -1 === $result ) {
274
+ if ( ( $meta = stream_get_meta_data( $handle ) ) ) {
275
+ throw new Ai1wm_Not_Accesible_Exception( sprintf( __( 'Unable to seek to offset %d on %s', AI1WM_PLUGIN_NAME ), $offset, $meta['uri'] ) );
276
+ }
 
 
 
 
277
  }
278
  }
279
  }
290
  $data_file_pointer = $this->get_file_pointer();
291
 
292
  // set data file pointer
293
+ $this->set_file_pointer( $this->file_handle, $offset );
294
 
295
  // set file size
296
  $data['size'] -= $offset;
304
  $chunk_size = $data['size'] > 512000 ? 512000 : $data['size'];
305
 
306
  // read the file in chunks of 512KB from archiver
307
+ $content = $this->read_from_handle( $this->file_handle, $chunk_size );
308
 
309
  // remove the amount of bytes we read
310
  $data['size'] -= $chunk_size;
311
 
312
  // write file contents
313
+ $this->write_to_handle( $handle, $content );
314
 
315
  // time elapsed
316
  if ( $timeout ) {
319
  $offset = $this->get_file_pointer() - $data_file_pointer;
320
 
321
  // close the handle
322
+ ai1wm_close( $handle );
323
 
324
  // get file offset
325
  return $offset;
328
  }
329
 
330
  // close the handle
331
+ ai1wm_close( $handle );
332
 
333
  // let's apply last modified date
334
  $this->set_mtime_of_file( $file, $data['mtime'] );
335
 
336
+ // all files should chmoded to 644
337
+ $permissions = $this->get_permissions_for_file();
338
+ $this->set_file_mode( $file, $permissions);
339
  }
340
 
341
  private function set_mtime_of_file( $file, $mtime ) {
369
  return $data;
370
  }
371
 
372
+ /**
373
+ * Check if file has reached end of file
374
+ * Returns true if file has reached eof, false otherwise
375
+ *
376
+ * @return bool
377
+ */
378
+ public function has_reached_eof() {
379
+ return feof( $this->file_handle );
380
+ }
381
+
382
  /**
383
  * Check if file has reached end of file
384
  * Returns true if file has NOT reached eof, false otherwise
408
 
409
  return $result;
410
  }
411
+
412
+ public static function get_permissions_for_directory() {
413
+ if ( defined( 'FS_CHMOD_DIR' ) ) {
414
+ return FS_CHMOD_DIR;
415
+ }
416
+
417
+ return 0755;
418
+ }
419
+
420
+ public static function get_permissions_for_file() {
421
+ if ( defined( 'FS_CHMOD_FILE' ) ) {
422
+ return FS_CHMOD_FILE;
423
+ }
424
+
425
+ return 0644;
426
+ }
427
+
428
  }
lib/vendor/servmask/cron/class-ai1wm-cron.php CHANGED
@@ -37,6 +37,7 @@ class Ai1wm_Cron {
37
  public static function add( $hook, $recurrence, $args = array() ) {
38
  $args = array_slice( func_get_args(), 2 );
39
  $schedules = wp_get_schedules();
 
40
  if ( isset( $schedules[$recurrence] ) && ( $current = $schedules[$recurrence] ) ) {
41
  return wp_schedule_event( time() + $current['interval'], $recurrence, $hook, $args );
42
  }
37
  public static function add( $hook, $recurrence, $args = array() ) {
38
  $args = array_slice( func_get_args(), 2 );
39
  $schedules = wp_get_schedules();
40
+
41
  if ( isset( $schedules[$recurrence] ) && ( $current = $schedules[$recurrence] ) ) {
42
  return wp_schedule_event( time() + $current['interval'], $recurrence, $hook, $args );
43
  }
lib/vendor/servmask/database/class-ai1wm-database.php CHANGED
@@ -120,6 +120,20 @@ abstract class Ai1wm_Database {
120
  */
121
  public function __construct( $wpdb ) {
122
  $this->wpdb = $wpdb;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
123
  }
124
 
125
  /**
@@ -370,16 +384,11 @@ abstract class Ai1wm_Database {
370
  public function export( $file_name, &$current_table_index = 0, $timeout = 0 ) {
371
 
372
  // Set file handler
373
- $file_handler = fopen( $file_name, 'ab' );
374
- if ( $file_handler === false ) {
375
- throw new Exception( 'Unable to open database file' );
376
- }
377
 
378
  // Write headers
379
  if ( $current_table_index === 0 ) {
380
- if ( fwrite( $file_handler, $this->get_header() ) === false ) {
381
- throw new Exception( 'Unable to write database header information' );
382
- }
383
  }
384
 
385
  // Start time
@@ -414,9 +423,7 @@ abstract class Ai1wm_Database {
414
  $drop_table = "\nDROP TABLE IF EXISTS `$new_table_name`;\n";
415
 
416
  // Write table statement
417
- if ( fwrite( $file_handler, $drop_table ) === false ) {
418
- throw new Exception( 'Unable to write database table statement' );
419
- }
420
 
421
  // Replace create table prefixes
422
  $create_table = $this->replace_table_prefixes( $table['Create Table'], 14 );
@@ -425,14 +432,10 @@ abstract class Ai1wm_Database {
425
  $create_table = $this->strip_table_constraints( $create_table );
426
 
427
  // Write table structure
428
- if ( fwrite( $file_handler, $create_table ) === false ) {
429
- throw new Exception( 'Unable to write database table structure' );
430
- }
431
 
432
  // Write end of statement
433
- if ( fwrite( $file_handler, ";\n\n" ) === false ) {
434
- throw new Exception( 'Unable to write database end of statement' );
435
- }
436
  }
437
 
438
  $current_table_offset = 0;
@@ -450,9 +453,7 @@ abstract class Ai1wm_Database {
450
  while ( $row = $this->fetch_assoc( $result ) ) {
451
  if ( $current_table_offset % Ai1wm_Database::QUERIES_PER_TRANSACTION === 0 ) {
452
  // Write start transaction
453
- if ( fwrite( $file_handler, "START TRANSACTION;\n" ) === false ) {
454
- throw new Exception( 'Unable to write database start transaction' );
455
- }
456
  }
457
 
458
  $items = array();
@@ -473,25 +474,19 @@ abstract class Ai1wm_Database {
473
  $table_insert = "INSERT INTO `$new_table_name` VALUES ($table_values);\n";
474
 
475
  // Write insert statement
476
- if ( fwrite( $file_handler, $table_insert ) === false ) {
477
- throw new Exception( 'Unable to write database insert statement' );
478
- }
479
 
480
  $current_table_offset++;
481
 
482
  // Write end of transaction
483
  if ( $current_table_offset % Ai1wm_Database::QUERIES_PER_TRANSACTION === 0 ) {
484
- if ( fwrite( $file_handler, "COMMIT;\n" ) === false ) {
485
- throw new Exception( 'Unable to write database end of transaction' );
486
- }
487
  }
488
  }
489
 
490
  // Write end of transaction
491
  if ( $current_table_offset % Ai1wm_Database::QUERIES_PER_TRANSACTION !== 0 ) {
492
- if ( fwrite( $file_handler, "COMMIT;\n" ) === false ) {
493
- throw new Exception( 'Unable to write database end of transaction' );
494
- }
495
  }
496
 
497
  $current_table_index += 1;
@@ -509,7 +504,7 @@ abstract class Ai1wm_Database {
509
  }
510
 
511
  // Close file handler
512
- fclose( $file_handler );
513
 
514
  return $completed;
515
  }
@@ -526,10 +521,7 @@ abstract class Ai1wm_Database {
526
  $max_allowed_packet = $this->get_max_allowed_packet();
527
 
528
  // Set file handler
529
- $file_handler = fopen( $file_name, 'r' );
530
- if ($file_handler === false) {
531
- throw new Exception( 'Unable to open database file' );
532
- }
533
 
534
  $passed = 0;
535
  $failed = 0;
@@ -577,7 +569,7 @@ abstract class Ai1wm_Database {
577
  }
578
 
579
  // Close file handler
580
- fclose( $file_handler );
581
 
582
  // Check failed queries
583
  if ( ( ( $failed / $passed ) * 100 ) > 2 ) {
120
  */
121
  public function __construct( $wpdb ) {
122
  $this->wpdb = $wpdb;
123
+
124
+ // Set database host (HyberDB)
125
+ if ( empty( $this->wpdb->dbhost ) ) {
126
+ if ( isset( $this->wpdb->last_used_server['host'] ) ) {
127
+ $this->wpdb->dbhost = $this->wpdb->last_used_server['host'];
128
+ }
129
+ }
130
+
131
+ // Set database name (HyperDB)
132
+ if ( empty( $this->wpdb->dbname ) ) {
133
+ if ( isset( $this->wpdb->last_used_server['name'] ) ) {
134
+ $this->wpdb->dbname = $this->wpdb->last_used_server['name'];
135
+ }
136
+ }
137
  }
138
 
139
  /**
384
  public function export( $file_name, &$current_table_index = 0, $timeout = 0 ) {
385
 
386
  // Set file handler
387
+ $file_handler = ai1wm_open( $file_name, 'ab' );
 
 
 
388
 
389
  // Write headers
390
  if ( $current_table_index === 0 ) {
391
+ ai1wm_write( $file_handler, $this->get_header() );
 
 
392
  }
393
 
394
  // Start time
423
  $drop_table = "\nDROP TABLE IF EXISTS `$new_table_name`;\n";
424
 
425
  // Write table statement
426
+ ai1wm_write( $file_handler, $drop_table );
 
 
427
 
428
  // Replace create table prefixes
429
  $create_table = $this->replace_table_prefixes( $table['Create Table'], 14 );
432
  $create_table = $this->strip_table_constraints( $create_table );
433
 
434
  // Write table structure
435
+ ai1wm_write( $file_handler, $create_table );
 
 
436
 
437
  // Write end of statement
438
+ ai1wm_write( $file_handler, ";\n\n" );
 
 
439
  }
440
 
441
  $current_table_offset = 0;
453
  while ( $row = $this->fetch_assoc( $result ) ) {
454
  if ( $current_table_offset % Ai1wm_Database::QUERIES_PER_TRANSACTION === 0 ) {
455
  // Write start transaction
456
+ ai1wm_write( $file_handler, "START TRANSACTION;\n" );
 
 
457
  }
458
 
459
  $items = array();
474
  $table_insert = "INSERT INTO `$new_table_name` VALUES ($table_values);\n";
475
 
476
  // Write insert statement
477
+ ai1wm_write( $file_handler, $table_insert );
 
 
478
 
479
  $current_table_offset++;
480
 
481
  // Write end of transaction
482
  if ( $current_table_offset % Ai1wm_Database::QUERIES_PER_TRANSACTION === 0 ) {
483
+ ai1wm_write( $file_handler, "COMMIT;\n" );
 
 
484
  }
485
  }
486
 
487
  // Write end of transaction
488
  if ( $current_table_offset % Ai1wm_Database::QUERIES_PER_TRANSACTION !== 0 ) {
489
+ ai1wm_write( $file_handler, "COMMIT;\n" );
 
 
490
  }
491
 
492
  $current_table_index += 1;
504
  }
505
 
506
  // Close file handler
507
+ ai1wm_close( $file_handler );
508
 
509
  return $completed;
510
  }
521
  $max_allowed_packet = $this->get_max_allowed_packet();
522
 
523
  // Set file handler
524
+ $file_handler = ai1wm_open( $file_name, 'r' );
 
 
 
525
 
526
  $passed = 0;
527
  $failed = 0;
569
  }
570
 
571
  // Close file handler
572
+ ai1wm_close( $file_handler );
573
 
574
  // Check failed queries
575
  if ( ( ( $failed / $passed ) * 100 ) > 2 ) {
lib/vendor/servmask/filesystem/class-ai1wm-file-webconfig.php ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Copyright (C) 2014-2016 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_File_Webconfig {
27
+
28
+ /**
29
+ * Create web.config file
30
+ *
31
+ * The method will create web.config file with contents '<mimeMap fileExtension=".wpress" mimeType="application/octet-stream" />'
32
+ *
33
+ * @param string $path Path to the web.config file
34
+ * @return boolean|null
35
+ */
36
+ public static function create( $path ) {
37
+ $contents = "<configuration>\n" .
38
+ "<system.webServer>\n" .
39
+ "<staticContent>\n" .
40
+ "<mimeMap fileExtension=\".wpress\" mimeType=\"application/octet-stream\" />\n" .
41
+ "</staticContent>\n" .
42
+ "</system.webServer>\n" .
43
+ "</configuration>";
44
+
45
+ return Ai1wm_File::create( $path, $contents );
46
+ }
47
+ }
lib/vendor/servmask/filesystem/class-ai1wm-file.php CHANGED
@@ -37,12 +37,12 @@ class Ai1wm_File {
37
  */
38
  public static function create( $path, $contents ) {
39
  if ( ! is_file( $path ) ) {
40
- $handle = fopen( $path, 'w' );
41
  if ( false === $handle ) {
42
  return false;
43
  }
44
- fwrite( $handle, $contents );
45
- fclose( $handle );
46
  }
47
  }
48
  }
37
  */
38
  public static function create( $path, $contents ) {
39
  if ( ! is_file( $path ) ) {
40
+ $handle = ai1wm_open( $path, 'w' );
41
  if ( false === $handle ) {
42
  return false;
43
  }
44
+ ai1wm_write( $handle, $contents );
45
+ ai1wm_close( $handle );
46
  }
47
  }
48
  }
lib/view/assets/css/export.min.css CHANGED
@@ -1 +1 @@
1
- @charset "UTF-8";.ai1wm-divider{-ms-box-sizing:border-box;box-sizing:border-box;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;-webkit-tap-highlight-color:transparent;border:none;height:0;background-color:transparent;font-size:14px;font-weight:700;text-align:center;text-transform:uppercase;color:rgba(0,0,0,.8);position:relative;top:0%;left:0%;margin:1rem 2.5rem;height:auto;padding:0;line-height:1}.ai1wm-divider:before,.ai1wm-divider:after{position:absolute;content:" ";z-index:3;width:50%;top:50%;height:0%;border-top:1px solid rgba(0,0,0,.1);border-bottom:1px solid rgba(255,255,255,.8)}.ai1wm-divider:before{left:0%;margin-left:-2.5rem}.ai1wm-divider:after{left:auto;right:0%;margin-right:-2.5rem}@-webkit-keyframes ai1wm-rotate{0%{-webkit-transform:rotateZ(0);transform:rotateZ(0)}25%{-webkit-transform:rotateZ(-90deg);transform:rotateZ(-90deg)}50%{-webkit-transform:rotateZ(-180deg);transform:rotateZ(-180deg)}75%{-webkit-transform:rotateZ(-270deg);transform:rotateZ(-270deg)}100%{-webkit-transform:rotateZ(-360deg);transform:rotateZ(-360deg)}}@keyframes ai1wm-rotate{0%{-webkit-transform:rotateZ(0);transform:rotateZ(0)}25%{-webkit-transform:rotateZ(-90deg);transform:rotateZ(-90deg)}50%{-webkit-transform:rotateZ(-180deg);transform:rotateZ(-180deg)}75%{-webkit-transform:rotateZ(-270deg);transform:rotateZ(-270deg)}100%{-webkit-transform:rotateZ(-360deg);transform:rotateZ(-360deg)}}@-webkit-keyframes ai1wm-emphasize{0%{-webkit-transform:scale(1);transform:scale(1)}50%{-webkit-transform:scale(1.2);transform:scale(1.2)}100%{-webkit-transform:scale(1);transform:scale(1)}}@keyframes ai1wm-emphasize{0%{-webkit-transform:scale(1);transform:scale(1)}50%{-webkit-transform:scale(1.2);transform:scale(1.2)}100%{-webkit-transform:scale(1);transform:scale(1)}}@-webkit-keyframes ai1wm-fadein{0%{-webkit-transform:scale(0);transform:scale(0)}50%{-webkit-transform:scale(1.5);transform:scale(1.5)}100%{-webkit-transform:scale(1);transform:scale(1)}}@keyframes ai1wm-fadein{0%{-webkit-transform:scale(0);transform:scale(0)}50%{-webkit-transform:scale(1.5);transform:scale(1.5)}100%{-webkit-transform:scale(1);transform:scale(1)}}[class^="ai1wm-icon-"],[class*=" ai1wm-icon-"]{font-family:'servmask';speak:none;font-style:normal;font-weight:400;font-variant:normal;text-transform:none;line-height:1;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.ai1wm-icon-file-zip:before{content:"\e60f"}.ai1wm-icon-folder:before{content:"\e60e"}.ai1wm-icon-file:before{content:"\e60b"}.ai1wm-icon-file-content:before{content:"\e60c"}.ai1wm-icon-cloud-upload:before{content:"\e600"}.ai1wm-icon-history:before{content:"\e603"}.ai1wm-icon-notification:before{content:"\e619"}.ai1wm-icon-arrow-down:before{content:"\e604"}.ai1wm-icon-close:before{content:"\e61a"}.ai1wm-icon-wordpress2:before{content:"\e620"}.ai1wm-icon-arrow-right:before{content:"\e605"}.ai1wm-icon-plus2:before{content:"\e607"}.ai1wm-icon-export:before{content:"\e601"}.ai1wm-icon-publish:before{content:"\e602"}.ai1wm-icon-paperplane:before{content:"\e608"}.ai1wm-icon-help:before{content:"\e609"}.ai1wm-icon-chevron-right:before{content:"\e60d"}.ai1wm-icon-chevron-down{display:inline-block;position:relative;-webkit-transform:rotateZ(90deg);transform:rotateZ(90deg);margin-left:.5em!important}.ai1wm-icon-chevron-down:before{content:"\e60d"}.ai1wm-icon-dropbox:before{content:"\e606"}.ai1wm-icon-gear:before{content:"\e60a"}.ai1wm-icon-alone{margin:0!important}@media (min-width:855px){.ai1wm-row{margin-right:399px}.ai1wm-row:before,.ai1wm-row:after{content:" ";display:table}.ai1wm-row:after{clear:both}.ai1wm-left{float:left;width:100%}.ai1wm-right{float:right;width:377px;margin-right:-399px}.ai1wm-right .ai1wm-sidebar{width:100%}.ai1wm-right .ai1wm-segment{width:333px;border:1px solid #d6d6d6;border-radius:3px;box-shadow:inset 0 1px 0 0 #fff;color:#333;background-color:#f9f9f9;padding:20px;text-decoration:none;text-shadow:0 1px 0 #fff;background-clip:padding-box}.ai1wm-right .ai1wm-segment h2{margin:22px 0 0;padding:0;font-weight:700;font-size:14px;text-transform:uppercase;text-align:center}.ai1wm-right .ai1wm-feedback-email{width:100%;font-weight:400;font-size:.8rem;height:2.3rem;line-height:2.3rem;border-radius:5px;margin-bottom:4px;padding:0 10px}.ai1wm-right .ai1wm-feedback-message,.ai1wm-right .ai1wm-http-authentication{width:100%;border-radius:3px;font-size:.8rem;padding:6px 10px;resize:none}.ai1wm-right .ai1wm-feedback-terms-segment{font-size:.7rem;line-height:1rem;margin:4px 0 8px}.ai1wm-right .ai1wm-feedback-terms-segment>.ai1wm-feedback-terms{border-radius:3px}}.ai1wm-holder{position:relative;border:1px solid #d6d6d6;border-radius:3px;box-shadow:inset 0 1px 0 0 #fff;padding:20px;background:#f9f9f9}.ai1wm-holder h1{margin:0;padding:0;float:left;font-weight:300;font-size:22px;text-transform:uppercase}.ai1wm-holder h1 i{position:relative;top:2px}@media (max-width:854px){.ai1wm-container{margin-left:10px!important}.ai1wm-row,.ai1wm-right{margin-right:0!important}.ai1wm-right{float:left!important;width:100%!important;margin-top:18px}.ai1wm-right .ai1wm-sidebar{width:auto!important;border:1px solid #d6d6d6;border-radius:3px;box-shadow:inset 0 1px 0 0 #fff;padding:20px;background:#f9f9f9}.ai1wm-right .ai1wm-feedback-email{width:100%;font-weight:400;font-size:.8rem;height:2.3rem;line-height:2.3rem;border-radius:5px;margin-bottom:4px;padding:0 10px}.ai1wm-right .ai1wm-feedback-message{width:100%;border-radius:3px;font-size:.8rem;padding:6px 10px;resize:none}.ai1wm-right .ai1wm-feedback-terms-segment{font-size:.7rem;line-height:1rem;margin:4px 0 8px;border-radius:3px}.ai1wm-right .ai1wm-feedback-terms-segment>.ai1wm-feedback-terms{border-radius:3px}}.ai1wm-container{margin:20px 20px 0 2px}.ai1wm-container:before,.ai1wm-container:after{content:" ";display:table}.ai1wm-container:after{clear:both}.ai1wm-replace-row{width:100%;box-shadow:outset 0 1px 0 0 #fff;border-radius:3px;color:#333;font-size:11px;font-weight:700;background-color:#f9f9f9;text-decoration:none;text-shadow:0 1px 0 #fff;background-clip:padding-box;margin-bottom:10px}.ai1wm-replace-row .ai1wm-field-inline{float:left;width:100%}.ai1wm-replace-row .ai1wm-field-inline input{width:100%;font-weight:400;font-size:.8rem;padding:0 10px;height:2.3rem;line-height:2.3rem;margin-bottom:4px}.ai1wm-field{margin-bottom:4px}.ai1wm-field input[type="text"],.ai1wm-field textarea{width:100%;font-weight:400}.ai1wm-field-set{margin-top:18px}.ai1wm-message{-moz-box-sizing:border-box;background-color:#EFEFEF;border-radius:4px;color:rgba(0,0,0,.6);height:auto;margin:10px 0;min-height:18px;padding:6px 10px;position:relative;border:1px solid;transition:opacity .1s ease 0s,color .1s ease 0s,background .1s ease 0s,box-shadow .1s ease 0s}.ai1wm-message.ai1wm-success-message{background-color:#F2F8F0;color:#119000;font-size:12px}.ai1wm-message.ai1wm-info-message{background-color:#d9edf7;color:#31708f;font-size:11px}.ai1wm-message.ai1wm-error-message{background-color:#F1D7D7;color:#A95252;font-size:12px}.ai1wm-message.ai1wm-red-message{color:#D95C5C;border:2px solid #D95C5C;background-color:transparent}.ai1wm-message.ai1wm-red-message h3{margin:.4em 0;color:#D95C5C}.ai1wm-message p{margin:4px 0;font-size:12px}.ai1wm-message-warning{display:block;font-size:14px;line-height:18px;padding:12px 20px;margin:0 0 22px;background-color:#f9f9f9;border:1px solid #d6d6d6;border-radius:3px;box-shadow:0 1px 0 0 #fff inset;border-left:4px solid #ffba00}.ai1wm-button-group{border:2px solid #27ae60;background-color:transparent;color:#27ae60;border-radius:5px;cursor:pointer;text-transform:uppercase;font-weight:600;transition:background-color .2s ease-out;display:inline-block}.ai1wm-button-group.ai1wm-button-export{width:154px;box-sizing:content-box}.ai1wm-button-group.ai1wm-button-export.ai1wm-open>.ai1wm-dropdown-menu{height:210px;border-top:1px solid #27ae60}.ai1wm-button-group.ai1wm-button-export .ai1mw-lines{-webkit-transform:translate(20px,-1px);transform:translate(20px,-1px)}.ai1wm-button-group.ai1wm-button-import{width:170px;box-sizing:content-box}.ai1wm-button-group.ai1wm-button-import.ai1wm-open>.ai1wm-dropdown-menu{height:240px;border-top:1px solid #27ae60}.ai1wm-button-group.ai1wm-button-import .ai1mw-lines{-webkit-transform:translate(8px,-1px);transform:translate(8px,-1px)}.ai1wm-button-group .ai1wm-button-main{padding:6px 25px 1px;height:22px;box-sizing:content-box}.ai1wm-button-group .ai1wm-dropdown-menu{height:0;overflow:hidden;transition:height .2s cubic-bezier(.19,1,.22,1);border-top:none}.ai1wm-dropdown-menu{list-style:none}.ai1wm-dropdown-menu,.ai1wm-dropdown-menu li{margin:0!important;padding:0}.ai1wm-dropdown-menu li a,.ai1wm-dropdown-menu li a:visited{display:block;padding:6px 25px 1px 26px;height:22px;line-height:22px;text-decoration:none;color:#27ae60;text-align:left;box-sizing:content-box}.ai1wm-dropdown-menu li a:hover,.ai1wm-dropdown-menu li a:visited:hover{text-decoration:none;color:#111}.ai1mw-lines{position:relative;display:inline-block;width:12px;height:10px}.ai1wm-line{display:inline-block;width:100%;height:2px;margin:auto;background:#27ae60;position:absolute;transition:all .2s ease-in-out}.ai1wm-line-first{top:0}div.ai1wm-open .ai1wm-line-first,div.ai1wm-open .ai1wm-line-third,.ai1wm-line-second{top:50%}.ai1wm-line-third{top:100%}.ai1wm-button-gray{border:2px solid #95a5a6;background-color:transparent;color:#95a5a6;border-radius:5px;cursor:pointer;padding:5px 25px 5px 26px;text-transform:uppercase;font-weight:600;outline:none;transition:background-color .2s ease-out;text-decoration:none}.ai1wm-button-gray:hover{background-color:#95a5a6;color:#fff}.ai1wm-button-green{border:2px solid #27ae60;background-color:transparent;color:#27ae60;border-radius:5px;cursor:pointer;padding:5px 25px 5px 26px;text-transform:uppercase;font-weight:600;outline:none;transition:background-color .2s ease-out;text-decoration:none}.ai1wm-button-green:hover{background-color:#27ae60;color:#fff}.ai1wm-button-green-small{border:2px solid #6eb649;background-color:transparent;color:#6eb649;border-radius:5px;cursor:pointer;padding:5px 25px 5px 26px;text-transform:uppercase;font-weight:600;outline:none;transition:background-color .2s ease-out;text-decoration:none}.ai1wm-button-green-small:hover{background-color:#6eb649;color:#fff}.ai1wm-button-blue{border:2px solid #00aff0;background-color:transparent;color:#00aff0;border-radius:5px;cursor:pointer;padding:5px 25px 5px 26px;text-transform:uppercase;font-weight:600;outline:none;transition:background-color .2s ease-out;text-decoration:none}.ai1wm-button-blue:hover{background-color:#00aff0;color:#fff}.ai1wm-button-red{border:2px solid #e74c3c;background-color:transparent;color:#e74c3c;border-radius:5px;cursor:pointer;padding:5px 25px 5px 26px;text-transform:uppercase;font-weight:600;outline:none;transition:background-color .2s ease-out;text-decoration:none}.ai1wm-button-red:hover{background-color:#e74c3c;color:#fff}.ai1wm-button-alone{border-radius:50px!important;padding:5px 8px!important}.ai1wm-button-blue[disabled="disabled"],.ai1wm-button-green[disabled="disabled"],.ai1wm-button-red[disabled="disabled"],.ai1wm-button-green-small[disabled="disabled"]{opacity:.6;cursor:default}.ai1wm-button-blue[disabled="disabled"]:hover{color:#00aff0}.ai1wm-button-red[disabled="disabled"]:hover{color:#e74c3c}.ai1wm-button-green[disabled="disabled"]:hover{color:#27ae60}.ai1wm-button-blue[disabled="disabled"]:hover,.ai1wm-button-green[disabled="disabled"]:hover,.ai1wm-button-red[disabled="disabled"]:hover,.ai1wm-button-green-small[disabled="disabled"]:hover{background:0 0}.ai1wm-button-gray i,.ai1wm-button-green i,.ai1wm-button-blue i,.ai1wm-button-red i{margin-left:-.5em;margin-right:.2em}.ai1wm-message-close-button{position:absolute;right:10px;top:6px;text-decoration:none;font-size:10px}input[type="radio"].ai1wm-flat-radio-button{display:none}input[type="radio"].ai1wm-flat-radio-button+a i,input[type="radio"].ai1wm-flat-radio-button+label i{vertical-align:middle;float:left;width:25px;height:25px;border-radius:50%;background:0 0;border:2px solid #ccc;content:" ";cursor:pointer;position:relative;box-sizing:content-box}input[type="radio"].ai1wm-flat-radio-button:checked+a i,input[type="radio"].ai1wm-flat-radio-button:checked+label i{background-color:#d9d9d9;border-color:#6f6f6f}.ai1wm-clear{*zoom:1;clear:both}.ai1wm-clear:before,.ai1wm-clear:after{content:" ";display:table}.ai1wm-clear:after{clear:both}.ai1wm-list-expanded{display:block!important}.ai1wm-field-inline input{border-radius:5px}.ai1wm-container .ai1wm-row label{position:relative;top:-1px}.ai1wm-share-button-container{text-align:center}.ai1wm-share-button-container .ai1wm-share-button{text-decoration:none;margin:10px;font-size:30px}.ai1wm-report-problem{position:relative;float:right}.ai1wm-report-problem-dialog{position:absolute;z-index:999;width:280px;right:0;background-color:#fff;margin:6px 0 0;padding:15px 15px 10px;border:1px solid #D6D6D6;border-radius:3px;box-shadow:0 1px 0 0 #fff inset;display:none}.ai1wm-report-email{width:100%;font-weight:400;font-size:.8rem;height:2.3rem;line-height:2.3rem;border-radius:5px;margin-bottom:4px;padding:0 10px}.ai1wm-report-message{width:100%;border-radius:3px;font-size:.8rem;padding:6px 10px;resize:none}.ai1wm-report-cancel:link,.ai1wm-report-cancel:visited,.ai1wm-report-cancel:active,.ai1wm-feedback-cancel:link,.ai1wm-feedback-cancel:visited,.ai1wm-feedback-cancel:active{float:right;line-height:34px;outline:0;text-decoration:none;color:#e74c3c}.ai1wm-report-active{display:block}.ai1wm-report-terms-segment{font-size:.7rem;line-height:1rem;margin:4px 0 8px}.ai1wm-report-terms-segment>.ai1wm-report-terms{border-radius:3px}.ai1wm-no-underline{text-decoration:none}.ai1wm-top-negative-four{top:-4px}.ai1wm-feedback-form{display:none}.ai1wm-feedback-types{margin:0;padding:0;list-style:none}.ai1wm-feedback-types li{margin:14px 0;padding:0}.ai1wm-feedback-types>li>label>span{display:inline-block;padding:5px 0 6px 8px}.ai1wm-feedback-types>li>a{height:29px;outline:none;color:#333;text-deciration:none}.ai1wm-feedback-types>li>a>span{display:inline-block;padding:5px 0 6px 8px}.ai1wm-loader{display:inline-block;width:128px;height:128px;position:relative;-webkit-animation:ai1wm-rotate 1.5s infinite linear;animation:ai1wm-rotate 1.5s infinite linear;background:url("../img/logo-128x128.png");background-repeat:no-repeat;background-position:center center}.ai1wm-hide{display:none}.ai1wm-label{border:1px solid #5cb85c;background-color:transparent;color:#5cb85c;cursor:pointer;text-transform:uppercase;font-weight:600;outline:none;transition:background-color .2s ease-out;padding:.2em .6em;font-size:.8em;border-radius:5px}.ai1wm-label:hover{background-color:#5cb85c;color:#fff}.ai1wm-dialog-message{text-align:left;line-height:1.5em}@keyframes ai1wm-rotate{0%{-webkit-transform:rotateZ(0);transform:rotateZ(0)}25%{-webkit-transform:rotateZ(-90deg);transform:rotateZ(-90deg)}50%{-webkit-transform:rotateZ(-180deg);transform:rotateZ(-180deg)}75%{-webkit-transform:rotateZ(-270deg);transform:rotateZ(-270deg)}100%{-webkit-transform:rotateZ(-360deg);transform:rotateZ(-360deg)}}@keyframes ai1wm-emphasize{0%{-webkit-transform:scale(1);transform:scale(1)}50%{-webkit-transform:scale(1.2);transform:scale(1.2)}100%{-webkit-transform:scale(1);transform:scale(1)}}@keyframes ai1wm-fadein{0%{-webkit-transform:scale(0);transform:scale(0)}50%{-webkit-transform:scale(1.5);transform:scale(1.5)}100%{-webkit-transform:scale(1);transform:scale(1)}}.ai1wm-accordion{margin:1em 0;display:block}.ai1wm-accordion h4{cursor:pointer;color:rgba(0,116,162,.8);margin:0}.ai1wm-accordion h4 small{color:#444;font-weight:400;display:inline}.ai1wm-accordion .ai1wm-icon-arrow-right{transition:-webkit-transform .1s ease-out;transition:transform .1s ease-out}.ai1wm-accordion ul{margin:0;padding:0;list-style:none;visibility:hidden;height:0;transition:height .2s cubic-bezier(.19,1,.22,1)}.ai1wm-accordion.ai1wm-open h4 .ai1wm-icon-arrow-right{-webkit-transform:rotate(90deg);transform:rotate(90deg);display:inline-block}.ai1wm-accordion.ai1wm-open ul{height:auto;margin:.6em 0 0 2em;visibility:visible}.ai1wm-overlay{display:none;position:fixed;top:0;left:0;width:100%;height:100%;background-color:rgba(0,0,0,.7);z-index:100001}.ai1wm-modal-container{position:fixed;display:none;top:50%;left:50%;z-index:100002;width:480px;height:auto;padding:16px;-webkit-transform:translate(-240px,-94px);transform:translate(-240px,-94px);border:1px solid #fff;box-shadow:0 2px 6px #292929;border-radius:6px;background:#f6f6f6;box-sizing:border-box;text-align:center}.ai1wm-modal-container section{display:block;min-height:102px}.ai1wm-modal-container section h1{margin:0;padding:0}.ai1wm-modal-container section h1 .ai1wm-title-green{color:#27ae60;font-size:20px}.ai1wm-modal-container section h1 .ai1wm-title-red{color:#e74c3c;font-size:20px}.ai1wm-modal-container section h1 .ai1wm-title-grey{color:gray;font-size:20px}.ai1wm-modal-container section h1 .ai1wm-loader{width:32px;height:32px;background:url("../img/logo-32x32.png")}.ai1wm-modal-container section h1 .ai1wm-icon-notification{font-size:1.2em;color:#e74c3c}.ai1wm-modal-container section p{margin:0;padding:12px 0}.ai1wm-modal-container section p .ai1wm-modal-sites p{padding:4px 10px;text-align:left}.ai1wm-modal-container section p .ai1wm-modal-sites input,.ai1wm-modal-container section p .ai1wm-modal-sites select{padding:0 6px;width:100%;border-radius:3px;height:30px;line-height:30px}.ai1wm-modal-container section p .ai1wm-modal-subtitle-green{color:#27ae60}.ai1wm-modal-container section p .ai1wm-modal-subtitle-red{color:#e74c3c}.ai1wm-modal-container section p .ai1wm-modal-subdescription{display:block;text-align:left}.ai1wm-modal-container section p a.ai1wm-button-green{display:inline-block;position:relative;top:26px}.ai1wm-modal-container section p a.ai1wm-emphasize{-webkit-animation:ai1wm-emphasize 1s infinite;animation:ai1wm-emphasize 1s infinite}.ai1wm-modal-container section p em{display:block;color:#34495e;font-style:normal}.ai1wm-query-arrow{position:relative;top:4px;float:right}.ai1wm-query.ai1wm-open{background:#ebebeb!important}.ai1wm-query.ai1wm-open p small{border-bottom:1px dashed #000}.ai1wm-query.ai1wm-open div{visibility:visible!important;height:82px!important;margin-top:8px}.ai1wm-query.ai1wm-open .ai1wm-query-arrow{-webkit-transform:rotate(90deg);transform:rotate(90deg)}.ai1wm-query{width:100%;margin:0 0 10px;list-style:none;background:0 0;border:1px solid #d8d8d8;padding:10px;border-radius:5px;box-sizing:border-box}.ai1wm-query div{transition:height .2s cubic-bezier(.19,1,.22,1);visibility:hidden;height:0}.ai1wm-query div input{width:100%;font-weight:400;font-size:.8rem;padding:0 10px;height:2.3rem;line-height:2.3rem;margin-bottom:4px;border:1px solid #ddd;box-shadow:inset 0 1px 2px rgba(0,0,0,.07);background-color:#fff;color:#333;transition:.05s border-color ease-in-out;border-radius:5px}.ai1wm-query div input:focus{border-color:#5b9dd9;box-shadow:0 0 2px rgba(30,140,190,.8)}.ai1wm-query p{margin:0;cursor:pointer}.ai1wm-query p small{display:inline;width:auto;float:none}.ai1wm-query-arrow{transition:-webkit-transform .1s ease-out;transition:transform .1s ease-out}.ai1wm-include-tables{display:inline-block;width:300px;margin:0 6px 0 0}.ai1wm-include-plugins{display:inline-block;width:300px;vertical-align:top}.ai1wm-include-media{display:inline-block;width:300px;margin:0 6px 0 0}.ai1wm-include-themes{display:inline-block;width:300px;vertical-align:top}.ai1wm-export-stats{margin-bottom:1em}#ai1wm-export-download{display:none;margin:0 0 2em}#ai1wm-export-download-stop{display:inline-block;margin:0 0 2em}#ai1wm-export-download.ai1wm-active{display:inline-block;-webkit-animation:ai1wm-fadein .5s;animation:ai1wm-fadein .5s}#ai1wm-export-download.ai1wm-emphasize{display:inline-block;-webkit-animation:ai1wm-emphasize 1s infinite;animation:ai1wm-emphasize 1s infinite}#ai1wm-export-download-size{display:block;color:#34495e}
1
+ @charset "UTF-8";.ai1wm-divider{-ms-box-sizing:border-box;box-sizing:border-box;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;-webkit-tap-highlight-color:transparent;border:none;height:0;background-color:transparent;font-size:14px;font-weight:700;text-align:center;text-transform:uppercase;color:rgba(0,0,0,.8);position:relative;top:0%;left:0%;margin:1rem 2.5rem;height:auto;padding:0;line-height:1}.ai1wm-divider:before,.ai1wm-divider:after{position:absolute;content:" ";z-index:3;width:50%;top:50%;height:0%;border-top:1px solid rgba(0,0,0,.1);border-bottom:1px solid rgba(255,255,255,.8)}.ai1wm-divider:before{left:0%;margin-left:-2.5rem}.ai1wm-divider:after{left:auto;right:0%;margin-right:-2.5rem}@-webkit-keyframes ai1wm-rotate{0%{-webkit-transform:rotateZ(0);transform:rotateZ(0)}25%{-webkit-transform:rotateZ(-90deg);transform:rotateZ(-90deg)}50%{-webkit-transform:rotateZ(-180deg);transform:rotateZ(-180deg)}75%{-webkit-transform:rotateZ(-270deg);transform:rotateZ(-270deg)}100%{-webkit-transform:rotateZ(-360deg);transform:rotateZ(-360deg)}}@keyframes ai1wm-rotate{0%{-webkit-transform:rotateZ(0);transform:rotateZ(0)}25%{-webkit-transform:rotateZ(-90deg);transform:rotateZ(-90deg)}50%{-webkit-transform:rotateZ(-180deg);transform:rotateZ(-180deg)}75%{-webkit-transform:rotateZ(-270deg);transform:rotateZ(-270deg)}100%{-webkit-transform:rotateZ(-360deg);transform:rotateZ(-360deg)}}@-webkit-keyframes ai1wm-emphasize{0%{-webkit-transform:scale(1);transform:scale(1)}50%{-webkit-transform:scale(1.2);transform:scale(1.2)}100%{-webkit-transform:scale(1);transform:scale(1)}}@keyframes ai1wm-emphasize{0%{-webkit-transform:scale(1);transform:scale(1)}50%{-webkit-transform:scale(1.2);transform:scale(1.2)}100%{-webkit-transform:scale(1);transform:scale(1)}}@-webkit-keyframes ai1wm-fadein{0%{-webkit-transform:scale(0);transform:scale(0)}50%{-webkit-transform:scale(1.5);transform:scale(1.5)}100%{-webkit-transform:scale(1);transform:scale(1)}}@keyframes ai1wm-fadein{0%{-webkit-transform:scale(0);transform:scale(0)}50%{-webkit-transform:scale(1.5);transform:scale(1.5)}100%{-webkit-transform:scale(1);transform:scale(1)}}[class^="ai1wm-icon-"],[class*=" ai1wm-icon-"]{font-family:'servmask';speak:none;font-style:normal;font-weight:400;font-variant:normal;text-transform:none;line-height:1;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.ai1wm-icon-file-zip:before{content:"\e60f"}.ai1wm-icon-folder:before{content:"\e60e"}.ai1wm-icon-file:before{content:"\e60b"}.ai1wm-icon-file-content:before{content:"\e60c"}.ai1wm-icon-cloud-upload:before{content:"\e600"}.ai1wm-icon-history:before{content:"\e603"}.ai1wm-icon-notification:before{content:"\e619"}.ai1wm-icon-arrow-down:before{content:"\e604"}.ai1wm-icon-close:before{content:"\e61a"}.ai1wm-icon-wordpress2:before{content:"\e620"}.ai1wm-icon-arrow-right:before{content:"\e605"}.ai1wm-icon-plus2:before{content:"\e607"}.ai1wm-icon-export:before{content:"\e601"}.ai1wm-icon-publish:before{content:"\e602"}.ai1wm-icon-paperplane:before{content:"\e608"}.ai1wm-icon-help:before{content:"\e609"}.ai1wm-icon-chevron-right:before{content:"\e60d"}.ai1wm-icon-chevron-down{display:inline-block;position:relative;-webkit-transform:rotateZ(90deg);transform:rotateZ(90deg);margin-left:.5em!important}.ai1wm-icon-chevron-down:before{content:"\e60d"}.ai1wm-icon-dropbox:before{content:"\e606"}.ai1wm-icon-gear:before{content:"\e60a"}.ai1wm-icon-alone{margin:0!important}@media (min-width:855px){.ai1wm-row{margin-right:399px}.ai1wm-row:before,.ai1wm-row:after{content:" ";display:table}.ai1wm-row:after{clear:both}.ai1wm-left{float:left;width:100%}.ai1wm-right{float:right;width:377px;margin-right:-399px}.ai1wm-right .ai1wm-sidebar{width:100%}.ai1wm-right .ai1wm-segment{width:333px;border:1px solid #d6d6d6;border-radius:3px;box-shadow:inset 0 1px 0 0 #fff;color:#333;background-color:#f9f9f9;padding:20px;text-decoration:none;text-shadow:0 1px 0 #fff;background-clip:padding-box}.ai1wm-right .ai1wm-segment h2{margin:22px 0 0;padding:0;font-weight:700;font-size:14px;text-transform:uppercase;text-align:center}.ai1wm-right .ai1wm-feedback-email{width:100%;font-weight:400;font-size:.8rem;height:2.3rem;line-height:2.3rem;border-radius:5px;margin-bottom:4px;padding:0 10px}.ai1wm-right .ai1wm-feedback-message,.ai1wm-right .ai1wm-http-authentication{width:100%;border-radius:3px;font-size:.8rem;padding:6px 10px;resize:none}.ai1wm-right .ai1wm-feedback-terms-segment{font-size:.7rem;line-height:1rem;margin:4px 0 8px}.ai1wm-right .ai1wm-feedback-terms-segment>.ai1wm-feedback-terms{border-radius:3px}}.ai1wm-holder{position:relative;border:1px solid #d6d6d6;border-radius:3px;box-shadow:inset 0 1px 0 0 #fff;padding:20px;background:#f9f9f9}.ai1wm-holder h1{margin:0;padding:0;float:left;font-weight:300;font-size:22px;text-transform:uppercase}.ai1wm-holder h1 i{position:relative;top:2px}@media (max-width:854px){.ai1wm-container{margin-left:10px!important}.ai1wm-row,.ai1wm-right{margin-right:0!important}.ai1wm-right{float:left!important;width:100%!important;margin-top:18px}.ai1wm-right .ai1wm-sidebar{width:auto!important;border:1px solid #d6d6d6;border-radius:3px;box-shadow:inset 0 1px 0 0 #fff;padding:20px;background:#f9f9f9}.ai1wm-right .ai1wm-feedback-email{width:100%;font-weight:400;font-size:.8rem;height:2.3rem;line-height:2.3rem;border-radius:5px;margin-bottom:4px;padding:0 10px}.ai1wm-right .ai1wm-feedback-message{width:100%;border-radius:3px;font-size:.8rem;padding:6px 10px;resize:none}.ai1wm-right .ai1wm-feedback-terms-segment{font-size:.7rem;line-height:1rem;margin:4px 0 8px;border-radius:3px}.ai1wm-right .ai1wm-feedback-terms-segment>.ai1wm-feedback-terms{border-radius:3px}}.ai1wm-container{margin:20px 20px 0 2px}.ai1wm-container:before,.ai1wm-container:after{content:" ";display:table}.ai1wm-container:after{clear:both}.ai1wm-replace-row{width:100%;box-shadow:outset 0 1px 0 0 #fff;border-radius:3px;color:#333;font-size:11px;font-weight:700;background-color:#f9f9f9;text-decoration:none;text-shadow:0 1px 0 #fff;background-clip:padding-box;margin-bottom:10px}.ai1wm-replace-row .ai1wm-field-inline{float:left;width:100%}.ai1wm-replace-row .ai1wm-field-inline input{width:100%;font-weight:400;font-size:.8rem;padding:0 10px;height:2.3rem;line-height:2.3rem;margin-bottom:4px}.ai1wm-field{margin-bottom:4px}.ai1wm-field input[type="text"],.ai1wm-field textarea{width:100%;font-weight:400}.ai1wm-field-set{margin-top:18px}.ai1wm-message{-moz-box-sizing:border-box;background-color:#EFEFEF;border-radius:4px;color:rgba(0,0,0,.6);height:auto;margin:10px 0;min-height:18px;padding:6px 10px;position:relative;border:1px solid;transition:opacity .1s ease 0s,color .1s ease 0s,background .1s ease 0s,box-shadow .1s ease 0s}.ai1wm-message.ai1wm-success-message{background-color:#F2F8F0;color:#119000;font-size:12px}.ai1wm-message.ai1wm-info-message{background-color:#d9edf7;color:#31708f;font-size:11px}.ai1wm-message.ai1wm-error-message{background-color:#F1D7D7;color:#A95252;font-size:12px}.ai1wm-message.ai1wm-red-message{color:#D95C5C;border:2px solid #D95C5C;background-color:transparent}.ai1wm-message.ai1wm-red-message h3{margin:.4em 0;color:#D95C5C}.ai1wm-message p{margin:4px 0;font-size:12px}.ai1wm-message-warning{display:block;font-size:14px;line-height:18px;padding:12px 20px;margin:0 0 22px;background-color:#f9f9f9;border:1px solid #d6d6d6;border-radius:3px;box-shadow:0 1px 0 0 #fff inset;border-left:4px solid #ffba00}.ai1wm-button-group{border:2px solid #27ae60;background-color:transparent;color:#27ae60;border-radius:5px;cursor:pointer;text-transform:uppercase;font-weight:600;transition:background-color .2s ease-out;display:inline-block}.ai1wm-button-group.ai1wm-button-export{width:154px;box-sizing:content-box}.ai1wm-button-group.ai1wm-button-export.ai1wm-open>.ai1wm-dropdown-menu{height:210px;border-top:1px solid #27ae60}.ai1wm-button-group.ai1wm-button-export .ai1mw-lines{-webkit-transform:translate(20px,-1px);transform:translate(20px,-1px)}.ai1wm-button-group.ai1wm-button-import{width:170px;box-sizing:content-box}.ai1wm-button-group.ai1wm-button-import.ai1wm-open>.ai1wm-dropdown-menu{height:240px;border-top:1px solid #27ae60}.ai1wm-button-group.ai1wm-button-import .ai1mw-lines{-webkit-transform:translate(8px,-1px);transform:translate(8px,-1px)}.ai1wm-button-group .ai1wm-button-main{padding:6px 25px 1px;height:22px;box-sizing:content-box}.ai1wm-button-group .ai1wm-dropdown-menu{height:0;overflow:hidden;transition:height .2s cubic-bezier(.19,1,.22,1);border-top:none}.ai1wm-dropdown-menu{list-style:none}.ai1wm-dropdown-menu,.ai1wm-dropdown-menu li{margin:0!important;padding:0}.ai1wm-dropdown-menu li a,.ai1wm-dropdown-menu li a:visited{display:block;padding:6px 25px 1px 26px;height:22px;line-height:22px;text-decoration:none;color:#27ae60;text-align:left;box-sizing:content-box}.ai1wm-dropdown-menu li a:hover,.ai1wm-dropdown-menu li a:visited:hover{text-decoration:none;color:#111}.ai1mw-lines{position:relative;display:inline-block;width:12px;height:10px}.ai1wm-line{display:inline-block;width:100%;height:2px;margin:auto;background:#27ae60;position:absolute;transition:all .2s ease-in-out}.ai1wm-line-first{top:0}div.ai1wm-open .ai1wm-line-first,div.ai1wm-open .ai1wm-line-third,.ai1wm-line-second{top:50%}.ai1wm-line-third{top:100%}.ai1wm-button-gray{border:2px solid #95a5a6;background-color:transparent;color:#95a5a6;border-radius:5px;cursor:pointer;padding:5px 25px 5px 26px;text-transform:uppercase;font-weight:600;outline:none;transition:background-color .2s ease-out;text-decoration:none}.ai1wm-button-gray:hover{background-color:#95a5a6;color:#fff}.ai1wm-button-green{border:2px solid #27ae60;background-color:transparent;color:#27ae60;border-radius:5px;cursor:pointer;padding:5px 25px 5px 26px;text-transform:uppercase;font-weight:600;outline:none;transition:background-color .2s ease-out;text-decoration:none}.ai1wm-button-green:hover{background-color:#27ae60;color:#fff}.ai1wm-button-green-small{border:2px solid #6eb649;background-color:transparent;color:#6eb649;border-radius:5px;cursor:pointer;padding:5px 25px 5px 26px;text-transform:uppercase;font-weight:600;outline:none;transition:background-color .2s ease-out;text-decoration:none}.ai1wm-button-green-small:hover{background-color:#6eb649;color:#fff}.ai1wm-button-blue{border:2px solid #00aff0;background-color:transparent;color:#00aff0;border-radius:5px;cursor:pointer;padding:5px 25px 5px 26px;text-transform:uppercase;font-weight:600;outline:none;transition:background-color .2s ease-out;text-decoration:none}.ai1wm-button-blue:hover{background-color:#00aff0;color:#fff}.ai1wm-button-red{border:2px solid #e74c3c;background-color:transparent;color:#e74c3c;border-radius:5px;cursor:pointer;padding:5px 25px 5px 26px;text-transform:uppercase;font-weight:600;outline:none;transition:background-color .2s ease-out;text-decoration:none}.ai1wm-button-red:hover{background-color:#e74c3c;color:#fff}.ai1wm-button-alone{border-radius:50px!important;padding:5px 8px!important}.ai1wm-button-blue[disabled="disabled"],.ai1wm-button-green[disabled="disabled"],.ai1wm-button-red[disabled="disabled"],.ai1wm-button-green-small[disabled="disabled"]{opacity:.6;cursor:default}.ai1wm-button-blue[disabled="disabled"]:hover{color:#00aff0}.ai1wm-button-red[disabled="disabled"]:hover{color:#e74c3c}.ai1wm-button-green[disabled="disabled"]:hover{color:#27ae60}.ai1wm-button-blue[disabled="disabled"]:hover,.ai1wm-button-green[disabled="disabled"]:hover,.ai1wm-button-red[disabled="disabled"]:hover,.ai1wm-button-green-small[disabled="disabled"]:hover{background:0 0}.ai1wm-button-gray i,.ai1wm-button-green i,.ai1wm-button-blue i,.ai1wm-button-red i{margin-left:-.5em;margin-right:.2em}.ai1wm-message-close-button{position:absolute;right:10px;top:6px;text-decoration:none;font-size:10px}input[type="radio"].ai1wm-flat-radio-button{display:none}input[type="radio"].ai1wm-flat-radio-button+a i,input[type="radio"].ai1wm-flat-radio-button+label i{vertical-align:middle;float:left;width:25px;height:25px;border-radius:50%;background:0 0;border:2px solid #ccc;content:" ";cursor:pointer;position:relative;box-sizing:content-box}input[type="radio"].ai1wm-flat-radio-button:checked+a i,input[type="radio"].ai1wm-flat-radio-button:checked+label i{background-color:#d9d9d9;border-color:#6f6f6f}.ai1wm-clear{*zoom:1;clear:both}.ai1wm-clear:before,.ai1wm-clear:after{content:" ";display:table}.ai1wm-clear:after{clear:both}.ai1wm-list-expanded{display:block!important}.ai1wm-field-inline input{border-radius:5px}.ai1wm-container .ai1wm-row label{position:relative;top:-1px}.ai1wm-share-button-container{text-align:center}.ai1wm-share-button-container .ai1wm-share-button{text-decoration:none;margin:10px;font-size:30px}.ai1wm-report-problem{position:relative;float:right}.ai1wm-report-problem-dialog{position:absolute;z-index:999;width:280px;right:0;background-color:#fff;margin:6px 0 0;padding:15px 15px 10px;border:1px solid #D6D6D6;border-radius:3px;box-shadow:0 1px 0 0 #fff inset;display:none}.ai1wm-report-email{width:100%;font-weight:400;font-size:.8rem;height:2.3rem;line-height:2.3rem;border-radius:5px;margin-bottom:4px;padding:0 10px}.ai1wm-report-message{width:100%;border-radius:3px;font-size:.8rem;padding:6px 10px;resize:none}.ai1wm-report-cancel:link,.ai1wm-report-cancel:visited,.ai1wm-report-cancel:active,.ai1wm-feedback-cancel:link,.ai1wm-feedback-cancel:visited,.ai1wm-feedback-cancel:active{float:right;line-height:34px;outline:0;text-decoration:none;color:#e74c3c}.ai1wm-report-active{display:block}.ai1wm-report-terms-segment{font-size:.7rem;line-height:1rem;margin:4px 0 8px}.ai1wm-report-terms-segment>.ai1wm-report-terms{border-radius:3px}.ai1wm-no-underline{text-decoration:none}.ai1wm-top-negative-four{top:-4px}.ai1wm-feedback-form{display:none}.ai1wm-feedback-types{margin:0;padding:0;list-style:none}.ai1wm-feedback-types li{margin:14px 0;padding:0}.ai1wm-feedback-types>li>label>span{display:inline-block;padding:5px 0 6px 8px}.ai1wm-feedback-types>li>a{height:29px;outline:none;color:#333;text-deciration:none}.ai1wm-feedback-types>li>a>span{display:inline-block;padding:5px 0 6px 8px}.ai1wm-loader{display:inline-block;width:128px;height:128px;position:relative;-webkit-animation:ai1wm-rotate 1.5s infinite linear;animation:ai1wm-rotate 1.5s infinite linear;background:url("../img/logo-128x128.png");background-repeat:no-repeat;background-position:center center}.ai1wm-hide{display:none}.ai1wm-label{border:1px solid #5cb85c;background-color:transparent;color:#5cb85c;cursor:pointer;text-transform:uppercase;font-weight:600;outline:none;transition:background-color .2s ease-out;padding:.2em .6em;font-size:.8em;border-radius:5px}.ai1wm-label:hover{background-color:#5cb85c;color:#fff}.ai1wm-dialog-message{text-align:left;line-height:1.5em}@keyframes ai1wm-rotate{0%{-webkit-transform:rotateZ(0);transform:rotateZ(0)}25%{-webkit-transform:rotateZ(-90deg);transform:rotateZ(-90deg)}50%{-webkit-transform:rotateZ(-180deg);transform:rotateZ(-180deg)}75%{-webkit-transform:rotateZ(-270deg);transform:rotateZ(-270deg)}100%{-webkit-transform:rotateZ(-360deg);transform:rotateZ(-360deg)}}@keyframes ai1wm-emphasize{0%{-webkit-transform:scale(1);transform:scale(1)}50%{-webkit-transform:scale(1.2);transform:scale(1.2)}100%{-webkit-transform:scale(1);transform:scale(1)}}@keyframes ai1wm-fadein{0%{-webkit-transform:scale(0);transform:scale(0)}50%{-webkit-transform:scale(1.5);transform:scale(1.5)}100%{-webkit-transform:scale(1);transform:scale(1)}}.ai1wm-accordion{margin:1em 0;display:block}.ai1wm-accordion h4{cursor:pointer;color:rgba(0,116,162,.8);margin:0}.ai1wm-accordion h4 small{color:#444;font-weight:400;display:inline;float:none;width:auto}.ai1wm-accordion .ai1wm-icon-arrow-right{transition:-webkit-transform .1s ease-out;transition:transform .1s ease-out}.ai1wm-accordion ul{margin:0;padding:0;list-style:none;visibility:hidden;height:0;transition:height .2s cubic-bezier(.19,1,.22,1)}.ai1wm-accordion ul li small{display:inline;float:none;width:auto}.ai1wm-accordion.ai1wm-open h4 .ai1wm-icon-arrow-right{-webkit-transform:rotate(90deg);transform:rotate(90deg);display:inline-block}.ai1wm-accordion.ai1wm-open ul{height:auto;margin:.6em 0 0 2em;visibility:visible}.ai1wm-overlay{display:none;position:fixed;top:0;left:0;width:100%;height:100%;background-color:rgba(0,0,0,.7);z-index:100001}.ai1wm-modal-container{position:fixed;display:none;top:50%;left:50%;z-index:100002;width:480px;height:auto;padding:16px;-webkit-transform:translate(-240px,-94px);transform:translate(-240px,-94px);border:1px solid #fff;box-shadow:0 2px 6px #292929;border-radius:6px;background:#f6f6f6;box-sizing:border-box;text-align:center}.ai1wm-modal-container section{display:block;min-height:102px}.ai1wm-modal-container section h1{margin:0;padding:0}.ai1wm-modal-container section h1 .ai1wm-title-green{color:#27ae60;font-size:20px}.ai1wm-modal-container section h1 .ai1wm-title-red{color:#e74c3c;font-size:20px}.ai1wm-modal-container section h1 .ai1wm-title-grey{color:gray;font-size:20px}.ai1wm-modal-container section h1 .ai1wm-loader{width:32px;height:32px;background:url("../img/logo-32x32.png")}.ai1wm-modal-container section h1 .ai1wm-icon-notification{font-size:1.2em;color:#e74c3c}.ai1wm-modal-container section p{margin:0;padding:12px 0}.ai1wm-modal-container section p .ai1wm-modal-sites p{padding:4px 10px;text-align:left}.ai1wm-modal-container section p .ai1wm-modal-sites input,.ai1wm-modal-container section p .ai1wm-modal-sites select{padding:0 6px;width:100%;border-radius:3px;height:30px;line-height:30px}.ai1wm-modal-container section p .ai1wm-modal-subtitle-green{color:#27ae60}.ai1wm-modal-container section p .ai1wm-modal-subtitle-red{color:#e74c3c}.ai1wm-modal-container section p .ai1wm-modal-subdescription{display:block;text-align:left}.ai1wm-modal-container section p a.ai1wm-button-green{display:inline-block;position:relative;top:26px}.ai1wm-modal-container section p a.ai1wm-emphasize{-webkit-animation:ai1wm-emphasize 1s infinite;animation:ai1wm-emphasize 1s infinite}.ai1wm-modal-container section p em{display:block;color:#34495e;font-style:normal}.ai1wm-query-arrow{position:relative;top:4px;float:right}.ai1wm-query.ai1wm-open{background:#ebebeb!important}.ai1wm-query.ai1wm-open p small{border-bottom:1px dashed #000}.ai1wm-query.ai1wm-open div{visibility:visible!important;height:82px!important;margin-top:8px}.ai1wm-query.ai1wm-open .ai1wm-query-arrow{-webkit-transform:rotate(90deg);transform:rotate(90deg)}.ai1wm-query{width:100%;margin:0 0 10px;list-style:none;background:0 0;border:1px solid #d8d8d8;padding:10px;border-radius:5px;box-sizing:border-box}.ai1wm-query div{transition:height .2s cubic-bezier(.19,1,.22,1);visibility:hidden;height:0}.ai1wm-query div input{width:100%;font-weight:400;font-size:.8rem;padding:0 10px;height:2.3rem;line-height:2.3rem;margin-bottom:4px;border:1px solid #ddd;box-shadow:inset 0 1px 2px rgba(0,0,0,.07);background-color:#fff;color:#333;transition:.05s border-color ease-in-out;border-radius:5px}.ai1wm-query div input:focus{border-color:#5b9dd9;box-shadow:0 0 2px rgba(30,140,190,.8)}.ai1wm-query p{margin:0;cursor:pointer}.ai1wm-query p small{display:inline;width:auto;float:none}.ai1wm-query-arrow{transition:-webkit-transform .1s ease-out;transition:transform .1s ease-out}.ai1wm-include-tables{display:inline-block;width:300px;margin:0 6px 0 0}.ai1wm-include-plugins{display:inline-block;width:300px;vertical-align:top}.ai1wm-include-media{display:inline-block;width:300px;margin:0 6px 0 0}.ai1wm-include-themes{display:inline-block;width:300px;vertical-align:top}.ai1wm-export-stats{margin-bottom:1em}#ai1wm-export-download{display:none;margin:0 0 2em}#ai1wm-export-download-stop{display:inline-block;margin:0 0 2em}#ai1wm-export-download.ai1wm-active{display:inline-block;-webkit-animation:ai1wm-fadein .5s;animation:ai1wm-fadein .5s}#ai1wm-export-download.ai1wm-emphasize{display:inline-block;-webkit-animation:ai1wm-emphasize 1s infinite;animation:ai1wm-emphasize 1s infinite}#ai1wm-export-download-size{display:block;color:#34495e}#ai1wm-queries{padding:0}
lib/view/assets/javascript/backups.min.js CHANGED
@@ -116,10 +116,10 @@
116
  // Restore from file
117
  $('.ai1wm-backup-restore').click(function (e) {
118
  var storage = Util.random(12);
119
- var archive = $(this).data('archive');
120
 
121
  // Set global params
122
- model.setParams([{ name: 'storage', value: storage }, { name: 'archive', value: archive }, { name: 'backups', value: 1 }]);
123
 
124
  // Start import
125
  model.start();
@@ -434,6 +434,9 @@
434
  // Set params
435
  this.params = [];
436
 
 
 
 
437
  // Set modal
438
  this.modal = new Modal();
439
 
@@ -457,17 +460,25 @@
457
  this.params = Util.list(params);
458
  };
459
 
460
- Import.prototype.start = function (options) {
461
  var self = this;
 
 
 
 
 
 
 
 
 
 
 
462
 
463
  // Initializing beforeunload event
464
  $(window).bind('beforeunload', function () {
465
  return 'You are about to stop importing your website, are you sure?';
466
  });
467
 
468
- // Set stop
469
- this.stop = false;
470
-
471
  // Set initial status
472
  this.setStatus({ type: 'info', message: 'Preparing to import...' });
473
 
@@ -480,18 +491,58 @@
480
  }
481
 
482
  // Import
483
- $.post(ai1wm_import.ajax.url, params).done(function () {
484
  self.getStatus();
 
 
 
 
485
  }).fail(function () {
486
- self.setStatus({
487
- type: 'error',
488
- message: 'Unable to start the import. Refresh the page and try again'
489
- });
 
 
 
 
 
 
 
490
  });
491
  };
492
 
493
- Import.prototype.confirm = function (options) {
494
  var self = this;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
495
 
496
  // Set params
497
  var params = this.params.concat({ name: 'secret_key', value: ai1wm_import.secret_key }).concat({ name: 'priority', value: 150 });
@@ -502,18 +553,35 @@
502
  }
503
 
504
  // Confirm
505
- $.post(ai1wm_import.ajax.url, params).done(function () {
506
  self.getStatus();
 
 
 
 
507
  }).fail(function () {
508
- self.setStatus({
509
- type: 'error',
510
- message: 'Unable to confirm the import. Refresh the page and try again'
511
- });
 
 
 
 
 
 
 
512
  });
513
  };
514
 
515
- Import.prototype.blogs = function (options) {
516
  var self = this;
 
 
 
 
 
 
517
 
518
  // Set params
519
  var params = this.params.concat({ name: 'secret_key', value: ai1wm_import.secret_key }).concat({ name: 'priority', value: 150 });
@@ -524,21 +592,36 @@
524
  }
525
 
526
  // Blogs
527
- $.post(ai1wm_import.ajax.url, params).done(function () {
528
  self.getStatus();
 
 
 
 
529
  }).fail(function () {
530
- self.setStatus({
531
- type: 'error',
532
- message: 'Unable to prepare blogs the import. Refresh the page and try again'
533
- });
 
 
 
 
 
 
 
534
  });
535
  };
536
 
537
- Import.prototype.clean = function (options) {
538
  var self = this;
 
539
 
540
- // Set stop
541
- this.stop = true;
 
 
 
542
 
543
  // Set params
544
  var params = this.params.concat({ name: 'secret_key', value: ai1wm_import.secret_key }).concat({ name: 'priority', value: 400 });
@@ -549,14 +632,24 @@
549
  }
550
 
551
  // Clean
552
- $.post(ai1wm_import.ajax.url, params).done(function () {
553
  // Unbinding the beforeunload event when we stop importing
554
  $(window).unbind('beforeunload');
 
 
 
555
  }).fail(function () {
556
- self.setStatus({
557
- type: 'error',
558
- message: 'Unable to clean the import. Refresh the page and try again'
559
- });
 
 
 
 
 
 
 
560
  });
561
  };
562
 
@@ -564,7 +657,7 @@
564
  var self = this;
565
 
566
  // Stop getting status
567
- if (this.stop) {
568
  return;
569
  }
570
 
@@ -591,14 +684,10 @@
591
  }
592
 
593
  // Import is not done yet, let's check status in 3 seconds
594
- setTimeout(function () {
595
- self.getStatus();
596
- }, 3000);
597
  }).fail(function () {
598
  // Import is not done yet, let's check status in 3 seconds
599
- setTimeout(function () {
600
- self.getStatus();
601
- }, 3000);
602
  });;
603
  };
604
 
@@ -678,9 +767,8 @@
678
  var title = $('<span></span>').addClass('ai1wm-title-red').text('Unable to import');
679
 
680
  // Create close button
681
- var closeButton = $('<button class="ai1wm-button-red">Close</button>').on('click', function () {
682
- self.modal.hide();
683
- self.overlay.hide();
684
  });
685
 
686
  // Append close button
@@ -703,6 +791,7 @@
703
  // Progress Modal
704
  this.progress = function (params) {
705
  if (this.view === 'progress') {
 
706
  // Update progressBarMeter
707
  this.progress.progressBarMeter.width(params.percent + '%');
708
 
@@ -735,11 +824,9 @@
735
  this.progress.progressBarPercent = $('<span class="ai1wm-progress-bar-percent">0%</span>').text(params.percent + '%');
736
 
737
  // Create stop import
738
- var stopButton = $('<button class="ai1wm-button-red"><i class="ai1wm-icon-notification"></i> Stop import</button>').on('click', function () {
739
  $(this).attr('disabled', 'disabled');
740
  self.onStop();
741
- self.modal.hide();
742
- self.overlay.hide();
743
  });
744
 
745
  // Append progress meter and progress percent
@@ -785,7 +872,7 @@
785
  var warning = $('<span class="ai1wm-icon-notification"></span>');
786
 
787
  // Create confirm button
788
- var confirmButton = $('<button class="ai1wm-button-green">Continue</button>').on('click', function () {
789
  $(this).attr('disabled', 'disabled');
790
  self.onConfirm();
791
  });
@@ -829,7 +916,7 @@
829
  var title = $('<span></span>').addClass('ai1wm-title-grey').text(params.title);
830
 
831
  // Create continue button
832
- var continueButton = $('<button class="ai1wm-button-green">Continue</button>').on('click', function () {
833
  $(this).attr('disabled', 'disabled');
834
  self.onBlogs($(this).closest('form').serializeArray());
835
  });
@@ -873,7 +960,7 @@
873
  var loader = $('<span class="ai1wm-loader"></span>');
874
 
875
  // Create stop import
876
- var stopButton = $('<button class="ai1wm-button-red"><i class="ai1wm-icon-notification"></i> Stop import</button>').attr('disabled', 'disabled');
877
 
878
  // Append stop button
879
  action.append(stopButton);
@@ -914,9 +1001,8 @@
914
  var title = $('<span></span>').addClass('ai1wm-title-green').text(params.title);
915
 
916
  // Create close button
917
- var closeButton = $('<button class="ai1wm-button-red">Close</button>').on('click', function () {
918
- self.modal.hide();
919
- self.overlay.hide();
920
  });
921
 
922
  // Append close button
@@ -978,6 +1064,11 @@
978
  this.view = params.type;
979
  };
980
 
 
 
 
 
 
981
  module.exports = Modal;
982
 
983
  /***/ }
116
  // Restore from file
117
  $('.ai1wm-backup-restore').click(function (e) {
118
  var storage = Util.random(12);
119
+ var options = Util.form('#ai1wm-backups-form').concat({ name: 'storage', value: storage }).concat({ name: 'archive', value: $(this).data('archive') });
120
 
121
  // Set global params
122
+ model.setParams(options);
123
 
124
  // Start import
125
  model.start();
434
  // Set params
435
  this.params = [];
436
 
437
+ // Set stop flag
438
+ this.stopImport = false;
439
+
440
  // Set modal
441
  this.modal = new Modal();
442
 
460
  this.params = Util.list(params);
461
  };
462
 
463
+ Import.prototype.start = function (options, retries) {
464
  var self = this;
465
+ var retries = retries || 0;
466
+
467
+ // Set stop flag
468
+ if (retries === 0) {
469
+ this.stopImport = false;
470
+ }
471
+
472
+ // Stop running import
473
+ if (this.stopImport) {
474
+ return;
475
+ }
476
 
477
  // Initializing beforeunload event
478
  $(window).bind('beforeunload', function () {
479
  return 'You are about to stop importing your website, are you sure?';
480
  });
481
 
 
 
 
482
  // Set initial status
483
  this.setStatus({ type: 'info', message: 'Preparing to import...' });
484
 
491
  }
492
 
493
  // Import
494
+ $.post(ai1wm_import.ajax.url, params, null, 'json').done(function () {
495
  self.getStatus();
496
+ }).done(function (params) {
497
+ if (params) {
498
+ self.run(params);
499
+ }
500
  }).fail(function () {
501
+ var timeout = retries * 1000;
502
+ if (retries >= 5) {
503
+ return self.setStatus({
504
+ type: 'error',
505
+ message: 'Unable to start the import. Refresh the page and try again'
506
+ });
507
+ }
508
+
509
+ retries++;
510
+
511
+ setTimeout(self.start.bind(self, options, retries), timeout);
512
  });
513
  };
514
 
515
+ Import.prototype.run = function (params, retries) {
516
  var self = this;
517
+ var retries = retries || 0;
518
+
519
+ // Stop running import
520
+ if (this.stopImport) {
521
+ return;
522
+ }
523
+
524
+ // Import
525
+ $.post(ai1wm_import.ajax.url, params, null, 'json').done(function (params) {
526
+ if (params) {
527
+ self.run(params);
528
+ }
529
+ }).fail(function () {
530
+ var timeout = retries * 1000;
531
+
532
+ retries++;
533
+
534
+ setTimeout(self.run.bind(self, params, retries), timeout);
535
+ });
536
+ };
537
+
538
+ Import.prototype.confirm = function (options, retries) {
539
+ var self = this;
540
+ var retries = retries || 0;
541
+
542
+ // Stop running import
543
+ if (this.stopImport) {
544
+ return;
545
+ }
546
 
547
  // Set params
548
  var params = this.params.concat({ name: 'secret_key', value: ai1wm_import.secret_key }).concat({ name: 'priority', value: 150 });
553
  }
554
 
555
  // Confirm
556
+ $.post(ai1wm_import.ajax.url, params, null, 'json').done(function () {
557
  self.getStatus();
558
+ }).done(function (params) {
559
+ if (params) {
560
+ self.run(params);
561
+ }
562
  }).fail(function () {
563
+ var timeout = retries * 1000;
564
+ if (retries >= 5) {
565
+ return self.setStatus({
566
+ type: 'error',
567
+ message: 'Unable to confirm the import. Refresh the page and try again'
568
+ });
569
+ }
570
+
571
+ retries++;
572
+
573
+ setTimeout(self.confirm.bind(self, options, retries), timeout);
574
  });
575
  };
576
 
577
+ Import.prototype.blogs = function (options, retries) {
578
  var self = this;
579
+ var retries = retries || 0;
580
+
581
+ // Stop running import
582
+ if (this.stopImport) {
583
+ return;
584
+ }
585
 
586
  // Set params
587
  var params = this.params.concat({ name: 'secret_key', value: ai1wm_import.secret_key }).concat({ name: 'priority', value: 150 });
592
  }
593
 
594
  // Blogs
595
+ $.post(ai1wm_import.ajax.url, params, null, 'json').done(function () {
596
  self.getStatus();
597
+ }).done(function (params) {
598
+ if (params) {
599
+ self.run(params);
600
+ }
601
  }).fail(function () {
602
+ var timeout = retries * 1000;
603
+ if (retries >= 5) {
604
+ return self.setStatus({
605
+ type: 'error',
606
+ message: 'Unable to prepare blogs the import. Refresh the page and try again'
607
+ });
608
+ }
609
+
610
+ retries++;
611
+
612
+ setTimeout(self.blogs.bind(self, options, retries), timeout);
613
  });
614
  };
615
 
616
+ Import.prototype.clean = function (options, retries) {
617
  var self = this;
618
+ var retries = retries || 0;
619
 
620
+ // Set stop flag
621
+ this.stopImport = true;
622
+
623
+ // Set initial status
624
+ this.setStatus({ type: 'info', message: 'Please wait, stopping the import...' });
625
 
626
  // Set params
627
  var params = this.params.concat({ name: 'secret_key', value: ai1wm_import.secret_key }).concat({ name: 'priority', value: 400 });
632
  }
633
 
634
  // Clean
635
+ $.post(ai1wm_import.ajax.url, params, null, 'json').done(function () {
636
  // Unbinding the beforeunload event when we stop importing
637
  $(window).unbind('beforeunload');
638
+
639
+ // Destroy modal
640
+ self.modal.destroy();
641
  }).fail(function () {
642
+ var timeout = retries * 1000;
643
+ if (retries >= 5) {
644
+ return self.setStatus({
645
+ type: 'error',
646
+ message: 'Unable to stop the import. Refresh the page and try again'
647
+ });
648
+ }
649
+
650
+ retries++;
651
+
652
+ setTimeout(self.clean.bind(self, options, retries), timeout);
653
  });
654
  };
655
 
657
  var self = this;
658
 
659
  // Stop getting status
660
+ if (this.stopImport) {
661
  return;
662
  }
663
 
684
  }
685
 
686
  // Import is not done yet, let's check status in 3 seconds
687
+ setTimeout(self.getStatus.bind(self), 3000);
 
 
688
  }).fail(function () {
689
  // Import is not done yet, let's check status in 3 seconds
690
+ setTimeout(self.getStatus.bind(self), 3000);
 
 
691
  });;
692
  };
693
 
767
  var title = $('<span></span>').addClass('ai1wm-title-red').text('Unable to import');
768
 
769
  // Create close button
770
+ var closeButton = $('<button type="button" class="ai1wm-button-red">Close</button>').on('click', function () {
771
+ self.destroy();
 
772
  });
773
 
774
  // Append close button
791
  // Progress Modal
792
  this.progress = function (params) {
793
  if (this.view === 'progress') {
794
+
795
  // Update progressBarMeter
796
  this.progress.progressBarMeter.width(params.percent + '%');
797
 
824
  this.progress.progressBarPercent = $('<span class="ai1wm-progress-bar-percent">0%</span>').text(params.percent + '%');
825
 
826
  // Create stop import
827
+ var stopButton = $('<button type="button" class="ai1wm-button-red"><i class="ai1wm-icon-notification"></i> Stop import</button>').on('click', function () {
828
  $(this).attr('disabled', 'disabled');
829
  self.onStop();
 
 
830
  });
831
 
832
  // Append progress meter and progress percent
872
  var warning = $('<span class="ai1wm-icon-notification"></span>');
873
 
874
  // Create confirm button
875
+ var confirmButton = $('<button type="button" class="ai1wm-button-green">Continue</button>').on('click', function () {
876
  $(this).attr('disabled', 'disabled');
877
  self.onConfirm();
878
  });
916
  var title = $('<span></span>').addClass('ai1wm-title-grey').text(params.title);
917
 
918
  // Create continue button
919
+ var continueButton = $('<button type="button" class="ai1wm-button-green">Continue</button>').on('click', function () {
920
  $(this).attr('disabled', 'disabled');
921
  self.onBlogs($(this).closest('form').serializeArray());
922
  });
960
  var loader = $('<span class="ai1wm-loader"></span>');
961
 
962
  // Create stop import
963
+ var stopButton = $('<button type="button" class="ai1wm-button-red"><i class="ai1wm-icon-notification"></i> Stop import</button>').attr('disabled', 'disabled');
964
 
965
  // Append stop button
966
  action.append(stopButton);
1001
  var title = $('<span></span>').addClass('ai1wm-title-green').text(params.title);
1002
 
1003
  // Create close button
1004
+ var closeButton = $('<button type="button" class="ai1wm-button-red">Close</button>').on('click', function () {
1005
+ self.destroy();
 
1006
  });
1007
 
1008
  // Append close button
1064
  this.view = params.type;
1065
  };
1066
 
1067
+ Modal.prototype.destroy = function () {
1068
+ this.modal.hide();
1069
+ this.overlay.hide();
1070
+ };
1071
+
1072
  module.exports = Modal;
1073
 
1074
  /***/ }
lib/view/assets/javascript/export.min.js CHANGED
@@ -529,33 +529,66 @@
529
  Dialog = __webpack_require__(9);
530
 
531
  var Extensions = {
532
- 's3': 'Amazon S3 Extension',
533
- 'url': 'URL Extension',
534
- 'ftp': 'FTP Extension',
535
- 'gdrive': 'Google Drive Extension',
536
- 'dropbox': 'Dropbox Extension'
537
  };
538
 
539
  window.Ai1wmExportController = function (provider) {
540
- this._export = {};
541
- this._provider = provider;
542
  };
543
 
544
  window.Ai1wmExportController.prototype.start = function () {
545
- new Dialog('<strong>All in One WP Migration</strong> is not compatible with current version of ' + '<strong>' + Extensions[this._provider] + '</strong>. Please contact ' + '<a href="mailto:support@servmask.com">support@servmask.com</a> for more details.');
546
  };
547
 
548
  window.Ai1wmImportController = function (provider) {
549
- this._import = {};
550
- this._provider = provider;
551
  };
552
 
553
  window.Ai1wmImportController.prototype.init = function () {};
554
 
555
  window.Ai1wmImportController.prototype.download = function () {
556
- new Dialog('<strong>All in One WP Migration</strong> is not compatible with current version of ' + '<strong>' + Extensions[this._provider] + '</strong>. Please contact ' + '<a href="mailto:support@servmask.com">support@servmask.com</a> for more details.');
557
  };
558
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
559
  /***/ },
560
  /* 9 */
561
  /***/ function(module, exports) {
@@ -610,7 +643,7 @@
610
  this.action = $('<div></div>');
611
 
612
  // Create close button
613
- this.closeButton = $('<button class="ai1wm-button-red">Close</button>').on('click', function () {
614
  self.modal.hide();
615
  self.overlay.hide();
616
  });
@@ -673,6 +706,9 @@
673
  // Set params
674
  this.params = [];
675
 
 
 
 
676
  // Set modal
677
  this.modal = new Modal();
678
 
@@ -686,17 +722,25 @@
686
  this.params = Util.list(params);
687
  };
688
 
689
- Export.prototype.start = function (options) {
690
  var self = this;
 
 
 
 
 
 
 
 
 
 
 
691
 
692
  // Initializing beforeunload event
693
  $(window).bind('beforeunload', function () {
694
  return 'You are about to stop exporting your website, are you sure?';
695
  });
696
 
697
- // Set stop
698
- this.stop = false;
699
-
700
  // Set initial status
701
  this.setStatus({ type: 'info', message: 'Preparing to export...' });
702
 
@@ -709,21 +753,65 @@
709
  }
710
 
711
  // Export
712
- $.post(ai1wm_export.ajax.url, params).done(function () {
713
  self.getStatus();
 
 
 
 
714
  }).fail(function () {
715
- self.setStatus({
716
- type: 'error',
717
- message: 'Unable to start the export. Refresh the page and try again'
718
- });
 
 
 
 
 
 
 
719
  });
720
  };
721
 
722
- Export.prototype.clean = function (options) {
723
  var self = this;
 
724
 
725
- // Set stop
726
- this.stop = true;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
727
 
728
  // Set params
729
  var params = this.params.concat({ name: 'secret_key', value: ai1wm_export.secret_key }).concat({ name: 'priority', value: 300 });
@@ -734,14 +822,24 @@
734
  }
735
 
736
  // Clean
737
- $.post(ai1wm_export.ajax.url, params).done(function () {
738
  // Unbinding the beforeunload event when we stop exporting
739
  $(window).unbind('beforeunload');
 
 
 
740
  }).fail(function () {
741
- self.setStatus({
742
- type: 'error',
743
- message: 'Unable to clean the export. Refresh the page and try again'
744
- });
 
 
 
 
 
 
 
745
  });
746
  };
747
 
@@ -749,7 +847,7 @@
749
  var self = this;
750
 
751
  // Stop getting status
752
- if (this.stop) {
753
  return;
754
  }
755
 
@@ -773,14 +871,10 @@
773
  }
774
 
775
  // Export is not done yet, let's check status in 3 seconds
776
- setTimeout(function () {
777
- self.getStatus();
778
- }, 3000);
779
  }).fail(function () {
780
  // Export is not done yet, let's check status in 3 seconds
781
- setTimeout(function () {
782
- self.getStatus();
783
- }, 3000);
784
  });
785
  };
786
 
@@ -851,9 +945,8 @@
851
  var title = $('<span></span>').addClass('ai1wm-title-red').text('Unable to export');
852
 
853
  // Create close button
854
- var closeButton = $('<button class="ai1wm-button-red">Close</button>').on('click', function () {
855
- self.modal.hide();
856
- self.overlay.hide();
857
  });
858
 
859
  // Append close button
@@ -895,11 +988,9 @@
895
  var loader = $('<span class="ai1wm-loader"></span>');
896
 
897
  // Create stop export
898
- var stopButton = $('<button class="ai1wm-button-red"><i class="ai1wm-icon-notification"></i> Stop export</button>').on('click', function () {
899
  $(this).attr('disabled', 'disabled');
900
  self.onStop();
901
- self.modal.hide();
902
- self.overlay.hide();
903
  });
904
 
905
  // Append stop button
@@ -941,9 +1032,8 @@
941
  var title = $('<span></span>').addClass('ai1wm-title-green').text(params.title);
942
 
943
  // Create close button
944
- var closeButton = $('<button class="ai1wm-button-red">Close</button>').on('click', function () {
945
- self.modal.hide();
946
- self.overlay.hide();
947
  });
948
 
949
  // Append close button
@@ -982,9 +1072,8 @@
982
  var action = $('<div></div>');
983
 
984
  // Create close button
985
- var closeButton = $('<button class="ai1wm-button-red">Close</button>').on('click', function () {
986
- self.modal.hide();
987
- self.overlay.hide();
988
  });
989
 
990
  // Append close button
@@ -1033,6 +1122,11 @@
1033
  }
1034
  };
1035
 
 
 
 
 
 
1036
  module.exports = Modal;
1037
 
1038
  /***/ }
529
  Dialog = __webpack_require__(9);
530
 
531
  var Extensions = {
532
+ 's3': 'Amazon S3 Extension',
533
+ 'url': 'URL Extension',
534
+ 'ftp': 'FTP Extension',
535
+ 'gdrive': 'Google Drive Extension',
536
+ 'dropbox': 'Dropbox Extension'
537
  };
538
 
539
  window.Ai1wmExportController = function (provider) {
540
+ this._export = {};
541
+ this._provider = provider;
542
  };
543
 
544
  window.Ai1wmExportController.prototype.start = function () {
545
+ new Dialog('<strong>All in One WP Migration</strong> is not compatible with current version of ' + '<strong>' + Extensions[this._provider] + '</strong>. Please contact ' + '<a href="mailto:support@servmask.com">support@servmask.com</a> for more details.');
546
  };
547
 
548
  window.Ai1wmImportController = function (provider) {
549
+ this._import = {};
550
+ this._provider = provider;
551
  };
552
 
553
  window.Ai1wmImportController.prototype.init = function () {};
554
 
555
  window.Ai1wmImportController.prototype.download = function () {
556
+ new Dialog('<strong>All in One WP Migration</strong> is not compatible with current version of ' + '<strong>' + Extensions[this._provider] + '</strong>. Please contact ' + '<a href="mailto:support@servmask.com">support@servmask.com</a> for more details.');
557
  };
558
 
559
+ jQuery(document).ready(function ($) {
560
+ 'use strict';
561
+
562
+ // Box extension
563
+
564
+ $('#ai1wmbe-import-file-cancel').attr('type', 'button');
565
+ $('#ai1wmbe-import-file').attr('type', 'button');
566
+
567
+ // Dropbox extension
568
+ $('#ai1wmde-import-file-cancel').attr('type', 'button');
569
+ $('#ai1wmde-import-file').attr('type', 'button');
570
+
571
+ // FTP extension
572
+ $('#ai1wmfe-import-file-cancel').attr('type', 'button');
573
+ $('#ai1wmfe-import-file').attr('type', 'button');
574
+
575
+ // Google Drive extension
576
+ $('#ai1wmge-import-file-cancel').attr('type', 'button');
577
+ $('#ai1wmge-import-file').attr('type', 'button');
578
+
579
+ // OneDrive extension
580
+ $('#ai1wmoe-import-file-cancel').attr('type', 'button');
581
+ $('#ai1wmoe-import-file').attr('type', 'button');
582
+
583
+ // Amazon S3 extension
584
+ $('#ai1wmse-import-file-cancel').attr('type', 'button');
585
+ $('#ai1wmse-import-file').attr('type', 'button');
586
+
587
+ // URL extension
588
+ $('#ai1wmle-import-file-cancel').attr('type', 'button');
589
+ $('#ai1wmle-import-file').attr('type', 'button');
590
+ });
591
+
592
  /***/ },
593
  /* 9 */
594
  /***/ function(module, exports) {
643
  this.action = $('<div></div>');
644
 
645
  // Create close button
646
+ this.closeButton = $('<button type="button" class="ai1wm-button-red">Close</button>').on('click', function () {
647
  self.modal.hide();
648
  self.overlay.hide();
649
  });
706
  // Set params
707
  this.params = [];
708
 
709
+ // Set stop flag
710
+ this.stopExport = false;
711
+
712
  // Set modal
713
  this.modal = new Modal();
714
 
722
  this.params = Util.list(params);
723
  };
724
 
725
+ Export.prototype.start = function (options, retries) {
726
  var self = this;
727
+ var retries = retries || 0;
728
+
729
+ // Set stop flag
730
+ if (retries === 0) {
731
+ this.stopExport = false;
732
+ }
733
+
734
+ // Stop running export
735
+ if (this.stopExport) {
736
+ return;
737
+ }
738
 
739
  // Initializing beforeunload event
740
  $(window).bind('beforeunload', function () {
741
  return 'You are about to stop exporting your website, are you sure?';
742
  });
743
 
 
 
 
744
  // Set initial status
745
  this.setStatus({ type: 'info', message: 'Preparing to export...' });
746
 
753
  }
754
 
755
  // Export
756
+ $.post(ai1wm_export.ajax.url, params, null, 'json').done(function () {
757
  self.getStatus();
758
+ }).done(function (params) {
759
+ if (params) {
760
+ self.run(params);
761
+ }
762
  }).fail(function () {
763
+ var timeout = retries * 1000;
764
+ if (retries >= 5) {
765
+ return self.setStatus({
766
+ type: 'error',
767
+ message: 'Unable to start the export. Refresh the page and try again'
768
+ });
769
+ }
770
+
771
+ retries++;
772
+
773
+ setTimeout(self.start.bind(self, options, retries), timeout);
774
  });
775
  };
776
 
777
+ Export.prototype.run = function (params, retries) {
778
  var self = this;
779
+ var retries = retries || 0;
780
 
781
+ // Stop running export
782
+ if (this.stopExport) {
783
+ return;
784
+ }
785
+
786
+ // Export
787
+ $.post(ai1wm_export.ajax.url, params, null, 'json').done(function (params) {
788
+ if (params) {
789
+ self.run(params);
790
+ }
791
+ }).fail(function () {
792
+ var timeout = retries * 1000;
793
+ if (retries >= 5) {
794
+ return self.setStatus({
795
+ type: 'error',
796
+ message: 'Unable to run the export. Refresh the page and try again'
797
+ });
798
+ }
799
+
800
+ retries++;
801
+
802
+ setTimeout(self.run.bind(self, params, retries), timeout);
803
+ });
804
+ };
805
+
806
+ Export.prototype.clean = function (options, retries) {
807
+ var self = this;
808
+ var retries = retries || 0;
809
+
810
+ // Set stop flag
811
+ this.stopExport = true;
812
+
813
+ // Set initial status
814
+ this.setStatus({ type: 'info', message: 'Please wait, stopping the export...' });
815
 
816
  // Set params
817
  var params = this.params.concat({ name: 'secret_key', value: ai1wm_export.secret_key }).concat({ name: 'priority', value: 300 });
822
  }
823
 
824
  // Clean
825
+ $.post(ai1wm_export.ajax.url, params, null, 'json').done(function () {
826
  // Unbinding the beforeunload event when we stop exporting
827
  $(window).unbind('beforeunload');
828
+
829
+ // Destroy modal
830
+ self.modal.destroy();
831
  }).fail(function () {
832
+ var timeout = retries * 1000;
833
+ if (retries >= 5) {
834
+ return self.setStatus({
835
+ type: 'error',
836
+ message: 'Unable to stop the export. Refresh the page and try again'
837
+ });
838
+ }
839
+
840
+ retries++;
841
+
842
+ setTimeout(self.clean.bind(self, options, retries), timeout);
843
  });
844
  };
845
 
847
  var self = this;
848
 
849
  // Stop getting status
850
+ if (this.stopExport) {
851
  return;
852
  }
853
 
871
  }
872
 
873
  // Export is not done yet, let's check status in 3 seconds
874
+ setTimeout(self.getStatus.bind(self), 3000);
 
 
875
  }).fail(function () {
876
  // Export is not done yet, let's check status in 3 seconds
877
+ setTimeout(self.getStatus.bind(self), 3000);
 
 
878
  });
879
  };
880
 
945
  var title = $('<span></span>').addClass('ai1wm-title-red').text('Unable to export');
946
 
947
  // Create close button
948
+ var closeButton = $('<button type="button" class="ai1wm-button-red">Close</button>').on('click', function () {
949
+ self.destroy();
 
950
  });
951
 
952
  // Append close button
988
  var loader = $('<span class="ai1wm-loader"></span>');
989
 
990
  // Create stop export
991
+ var stopButton = $('<button type="button" class="ai1wm-button-red"><i class="ai1wm-icon-notification"></i> Stop export</button>').on('click', function () {
992
  $(this).attr('disabled', 'disabled');
993
  self.onStop();
 
 
994
  });
995
 
996
  // Append stop button
1032
  var title = $('<span></span>').addClass('ai1wm-title-green').text(params.title);
1033
 
1034
  // Create close button
1035
+ var closeButton = $('<button type="button" class="ai1wm-button-red">Close</button>').on('click', function () {
1036
+ self.destroy();
 
1037
  });
1038
 
1039
  // Append close button
1072
  var action = $('<div></div>');
1073
 
1074
  // Create close button
1075
+ var closeButton = $('<button type="button" class="ai1wm-button-red">Close</button>').on('click', function () {
1076
+ self.destroy();
 
1077
  });
1078
 
1079
  // Append close button
1122
  }
1123
  };
1124
 
1125
+ Modal.prototype.destroy = function () {
1126
+ this.modal.hide();
1127
+ this.overlay.hide();
1128
+ };
1129
+
1130
  module.exports = Modal;
1131
 
1132
  /***/ }
lib/view/assets/javascript/import.min.js CHANGED
@@ -393,6 +393,9 @@
393
  // Set params
394
  this.params = [];
395
 
 
 
 
396
  // Set modal
397
  this.modal = new Modal();
398
 
@@ -416,17 +419,25 @@
416
  this.params = Util.list(params);
417
  };
418
 
419
- Import.prototype.start = function (options) {
420
  var self = this;
 
 
 
 
 
 
 
 
 
 
 
421
 
422
  // Initializing beforeunload event
423
  $(window).bind('beforeunload', function () {
424
  return 'You are about to stop importing your website, are you sure?';
425
  });
426
 
427
- // Set stop
428
- this.stop = false;
429
-
430
  // Set initial status
431
  this.setStatus({ type: 'info', message: 'Preparing to import...' });
432
 
@@ -439,18 +450,58 @@
439
  }
440
 
441
  // Import
442
- $.post(ai1wm_import.ajax.url, params).done(function () {
443
  self.getStatus();
 
 
 
 
444
  }).fail(function () {
445
- self.setStatus({
446
- type: 'error',
447
- message: 'Unable to start the import. Refresh the page and try again'
448
- });
 
 
 
 
 
 
 
449
  });
450
  };
451
 
452
- Import.prototype.confirm = function (options) {
453
  var self = this;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
454
 
455
  // Set params
456
  var params = this.params.concat({ name: 'secret_key', value: ai1wm_import.secret_key }).concat({ name: 'priority', value: 150 });
@@ -461,18 +512,35 @@
461
  }
462
 
463
  // Confirm
464
- $.post(ai1wm_import.ajax.url, params).done(function () {
465
  self.getStatus();
 
 
 
 
466
  }).fail(function () {
467
- self.setStatus({
468
- type: 'error',
469
- message: 'Unable to confirm the import. Refresh the page and try again'
470
- });
 
 
 
 
 
 
 
471
  });
472
  };
473
 
474
- Import.prototype.blogs = function (options) {
475
  var self = this;
 
 
 
 
 
 
476
 
477
  // Set params
478
  var params = this.params.concat({ name: 'secret_key', value: ai1wm_import.secret_key }).concat({ name: 'priority', value: 150 });
@@ -483,21 +551,36 @@
483
  }
484
 
485
  // Blogs
486
- $.post(ai1wm_import.ajax.url, params).done(function () {
487
  self.getStatus();
 
 
 
 
488
  }).fail(function () {
489
- self.setStatus({
490
- type: 'error',
491
- message: 'Unable to prepare blogs the import. Refresh the page and try again'
492
- });
 
 
 
 
 
 
 
493
  });
494
  };
495
 
496
- Import.prototype.clean = function (options) {
497
  var self = this;
 
498
 
499
- // Set stop
500
- this.stop = true;
 
 
 
501
 
502
  // Set params
503
  var params = this.params.concat({ name: 'secret_key', value: ai1wm_import.secret_key }).concat({ name: 'priority', value: 400 });
@@ -508,14 +591,24 @@
508
  }
509
 
510
  // Clean
511
- $.post(ai1wm_import.ajax.url, params).done(function () {
512
  // Unbinding the beforeunload event when we stop importing
513
  $(window).unbind('beforeunload');
 
 
 
514
  }).fail(function () {
515
- self.setStatus({
516
- type: 'error',
517
- message: 'Unable to clean the import. Refresh the page and try again'
518
- });
 
 
 
 
 
 
 
519
  });
520
  };
521
 
@@ -523,7 +616,7 @@
523
  var self = this;
524
 
525
  // Stop getting status
526
- if (this.stop) {
527
  return;
528
  }
529
 
@@ -550,14 +643,10 @@
550
  }
551
 
552
  // Import is not done yet, let's check status in 3 seconds
553
- setTimeout(function () {
554
- self.getStatus();
555
- }, 3000);
556
  }).fail(function () {
557
  // Import is not done yet, let's check status in 3 seconds
558
- setTimeout(function () {
559
- self.getStatus();
560
- }, 3000);
561
  });;
562
  };
563
 
@@ -637,9 +726,8 @@
637
  var title = $('<span></span>').addClass('ai1wm-title-red').text('Unable to import');
638
 
639
  // Create close button
640
- var closeButton = $('<button class="ai1wm-button-red">Close</button>').on('click', function () {
641
- self.modal.hide();
642
- self.overlay.hide();
643
  });
644
 
645
  // Append close button
@@ -662,6 +750,7 @@
662
  // Progress Modal
663
  this.progress = function (params) {
664
  if (this.view === 'progress') {
 
665
  // Update progressBarMeter
666
  this.progress.progressBarMeter.width(params.percent + '%');
667
 
@@ -694,11 +783,9 @@
694
  this.progress.progressBarPercent = $('<span class="ai1wm-progress-bar-percent">0%</span>').text(params.percent + '%');
695
 
696
  // Create stop import
697
- var stopButton = $('<button class="ai1wm-button-red"><i class="ai1wm-icon-notification"></i> Stop import</button>').on('click', function () {
698
  $(this).attr('disabled', 'disabled');
699
  self.onStop();
700
- self.modal.hide();
701
- self.overlay.hide();
702
  });
703
 
704
  // Append progress meter and progress percent
@@ -744,7 +831,7 @@
744
  var warning = $('<span class="ai1wm-icon-notification"></span>');
745
 
746
  // Create confirm button
747
- var confirmButton = $('<button class="ai1wm-button-green">Continue</button>').on('click', function () {
748
  $(this).attr('disabled', 'disabled');
749
  self.onConfirm();
750
  });
@@ -788,7 +875,7 @@
788
  var title = $('<span></span>').addClass('ai1wm-title-grey').text(params.title);
789
 
790
  // Create continue button
791
- var continueButton = $('<button class="ai1wm-button-green">Continue</button>').on('click', function () {
792
  $(this).attr('disabled', 'disabled');
793
  self.onBlogs($(this).closest('form').serializeArray());
794
  });
@@ -832,7 +919,7 @@
832
  var loader = $('<span class="ai1wm-loader"></span>');
833
 
834
  // Create stop import
835
- var stopButton = $('<button class="ai1wm-button-red"><i class="ai1wm-icon-notification"></i> Stop import</button>').attr('disabled', 'disabled');
836
 
837
  // Append stop button
838
  action.append(stopButton);
@@ -873,9 +960,8 @@
873
  var title = $('<span></span>').addClass('ai1wm-title-green').text(params.title);
874
 
875
  // Create close button
876
- var closeButton = $('<button class="ai1wm-button-red">Close</button>').on('click', function () {
877
- self.modal.hide();
878
- self.overlay.hide();
879
  });
880
 
881
  // Append close button
@@ -937,6 +1023,11 @@
937
  this.view = params.type;
938
  };
939
 
 
 
 
 
 
940
  module.exports = Modal;
941
 
942
  /***/ },
@@ -975,33 +1066,66 @@
975
  Dialog = __webpack_require__(9);
976
 
977
  var Extensions = {
978
- 's3': 'Amazon S3 Extension',
979
- 'url': 'URL Extension',
980
- 'ftp': 'FTP Extension',
981
- 'gdrive': 'Google Drive Extension',
982
- 'dropbox': 'Dropbox Extension'
983
  };
984
 
985
  window.Ai1wmExportController = function (provider) {
986
- this._export = {};
987
- this._provider = provider;
988
  };
989
 
990
  window.Ai1wmExportController.prototype.start = function () {
991
- new Dialog('<strong>All in One WP Migration</strong> is not compatible with current version of ' + '<strong>' + Extensions[this._provider] + '</strong>. Please contact ' + '<a href="mailto:support@servmask.com">support@servmask.com</a> for more details.');
992
  };
993
 
994
  window.Ai1wmImportController = function (provider) {
995
- this._import = {};
996
- this._provider = provider;
997
  };
998
 
999
  window.Ai1wmImportController.prototype.init = function () {};
1000
 
1001
  window.Ai1wmImportController.prototype.download = function () {
1002
- new Dialog('<strong>All in One WP Migration</strong> is not compatible with current version of ' + '<strong>' + Extensions[this._provider] + '</strong>. Please contact ' + '<a href="mailto:support@servmask.com">support@servmask.com</a> for more details.');
1003
  };
1004
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1005
  /***/ },
1006
  /* 9 */
1007
  /***/ function(module, exports) {
@@ -1056,7 +1180,7 @@
1056
  this.action = $('<div></div>');
1057
 
1058
  // Create close button
1059
- this.closeButton = $('<button class="ai1wm-button-red">Close</button>').on('click', function () {
1060
  self.modal.hide();
1061
  self.overlay.hide();
1062
  });
@@ -1120,7 +1244,6 @@
1120
  FileUploader.prototype.setDefaultValues = function () {
1121
  this.model = new Import();
1122
  this.stopUpload = false;
1123
- this.retries = 0;
1124
  };
1125
 
1126
  FileUploader.prototype.init = function () {
@@ -1172,11 +1295,14 @@
1172
  });
1173
  };
1174
 
1175
- FileUploader.prototype.upload = function (file) {
1176
  var _this2 = this;
1177
 
 
 
1178
  var chunkSize = file.size > ai1wm_uploader.chunk_size ? ai1wm_uploader.chunk_size : file.size;
1179
  var formData = this.getFormData(file, chunkSize);
 
1180
  fetch(ai1wm_uploader.url, {
1181
  method: 'POST',
1182
  credentials: 'include',
@@ -1191,7 +1317,6 @@
1191
  ai1wm_uploader.chunk_size = chunkSize / 2;
1192
  return _this2.upload(file);
1193
  case 200:
1194
- _this2.retries = 0;
1195
  file = file.slice(chunkSize, file.size, 'application/octet-binary');
1196
  var uploadedBytes = _this2.fileSize - file.size;
1197
  var progress = uploadedBytes / _this2.fileSize * 100;
@@ -1201,12 +1326,14 @@
1201
  throw new Error(response.status);
1202
  }
1203
  }).catch(function (error) {
1204
- var timeout = _this2.retries * 1000;
1205
- if (_this2.retries > 30) {
1206
  return _this2.onError(new Error('We are sorry, there seems to be a problem while uploading your file. Follow <a href="https://www.youtube.com/watch?v=mRp7qTFYKgs" target="_blank">this guide</a> to resolve it.'));
1207
  }
1208
- _this2.retries++;
1209
- setTimeout(_this2.upload.bind(_this2, file), timeout);
 
 
1210
  });
1211
  };
1212
 
@@ -1255,22 +1382,22 @@
1255
  FileUploader.prototype.onBeforeUpload = function (file) {
1256
  var self = this;
1257
 
1258
- // Set storage and archive
1259
- this.storage = Util.random(12);
1260
- this.archive = file.name;
 
 
1261
 
1262
  // Set multipart params
1263
  $.extend(ai1wm_uploader.params, {
1264
- storage: this.storage,
1265
- archive: this.archive
1266
  });
1267
 
1268
- // Set global params
1269
- self.model.setParams([{ name: 'storage', value: this.storage }, { name: 'archive', value: this.archive }]);
1270
-
1271
  // Set stop
1272
  this.model.onStop = function () {
1273
  self.stopUpload = true;
 
1274
  // Clean storage
1275
  self.model.clean();
1276
  };
@@ -2721,74 +2848,13 @@
2721
  /***/ function(module, exports) {
2722
 
2723
  // shim for using process in browser
2724
- var process = module.exports = {};
2725
-
2726
- // cached from whatever global is present so that test runners that stub it
2727
- // don't break things. But we need to wrap it in a try catch in case it is
2728
- // wrapped in strict mode code which doesn't define any globals. It's inside a
2729
- // function because try/catches deoptimize in certain engines.
2730
-
2731
- var cachedSetTimeout;
2732
- var cachedClearTimeout;
2733
-
2734
- (function () {
2735
- try {
2736
- cachedSetTimeout = setTimeout;
2737
- } catch (e) {
2738
- cachedSetTimeout = function () {
2739
- throw new Error('setTimeout is not defined');
2740
- }
2741
- }
2742
- try {
2743
- cachedClearTimeout = clearTimeout;
2744
- } catch (e) {
2745
- cachedClearTimeout = function () {
2746
- throw new Error('clearTimeout is not defined');
2747
- }
2748
- }
2749
- } ())
2750
- function runTimeout(fun) {
2751
- if (cachedSetTimeout === setTimeout) {
2752
- //normal enviroments in sane situations
2753
- return setTimeout(fun, 0);
2754
- }
2755
- try {
2756
- // when when somebody has screwed with setTimeout but no I.E. maddness
2757
- return cachedSetTimeout(fun, 0);
2758
- } catch(e){
2759
- try {
2760
- // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
2761
- return cachedSetTimeout.call(null, fun, 0);
2762
- } catch(e){
2763
- // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error
2764
- return cachedSetTimeout.call(this, fun, 0);
2765
- }
2766
- }
2767
-
2768
-
2769
- }
2770
- function runClearTimeout(marker) {
2771
- if (cachedClearTimeout === clearTimeout) {
2772
- //normal enviroments in sane situations
2773
- return clearTimeout(marker);
2774
- }
2775
- try {
2776
- // when when somebody has screwed with setTimeout but no I.E. maddness
2777
- return cachedClearTimeout(marker);
2778
- } catch (e){
2779
- try {
2780
- // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
2781
- return cachedClearTimeout.call(null, marker);
2782
- } catch (e){
2783
- // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.
2784
- // Some versions of I.E. have different rules for clearTimeout vs setTimeout
2785
- return cachedClearTimeout.call(this, marker);
2786
- }
2787
- }
2788
 
 
2789
 
 
 
 
2790
 
2791
- }
2792
  var queue = [];
2793
  var draining = false;
2794
  var currentQueue;
@@ -2813,7 +2879,7 @@
2813
  if (draining) {
2814
  return;
2815
  }
2816
- var timeout = runTimeout(cleanUpNextTick);
2817
  draining = true;
2818
 
2819
  var len = queue.length;
@@ -2830,7 +2896,7 @@
2830
  }
2831
  currentQueue = null;
2832
  draining = false;
2833
- runClearTimeout(timeout);
2834
  }
2835
 
2836
  process.nextTick = function (fun) {
@@ -2842,7 +2908,7 @@
2842
  }
2843
  queue.push(new Item(fun, args));
2844
  if (queue.length === 1 && !draining) {
2845
- runTimeout(drainQueue);
2846
  }
2847
  };
2848
 
393
  // Set params
394
  this.params = [];
395
 
396
+ // Set stop flag
397
+ this.stopImport = false;
398
+
399
  // Set modal
400
  this.modal = new Modal();
401
 
419
  this.params = Util.list(params);
420
  };
421
 
422
+ Import.prototype.start = function (options, retries) {
423
  var self = this;
424
+ var retries = retries || 0;
425
+
426
+ // Set stop flag
427
+ if (retries === 0) {
428
+ this.stopImport = false;
429
+ }
430
+
431
+ // Stop running import
432
+ if (this.stopImport) {
433
+ return;
434
+ }
435
 
436
  // Initializing beforeunload event
437
  $(window).bind('beforeunload', function () {
438
  return 'You are about to stop importing your website, are you sure?';
439
  });
440
 
 
 
 
441
  // Set initial status
442
  this.setStatus({ type: 'info', message: 'Preparing to import...' });
443
 
450
  }
451
 
452
  // Import
453
+ $.post(ai1wm_import.ajax.url, params, null, 'json').done(function () {
454
  self.getStatus();
455
+ }).done(function (params) {
456
+ if (params) {
457
+ self.run(params);
458
+ }
459
  }).fail(function () {
460
+ var timeout = retries * 1000;
461
+ if (retries >= 5) {
462
+ return self.setStatus({
463
+ type: 'error',
464
+ message: 'Unable to start the import. Refresh the page and try again'
465
+ });
466
+ }
467
+
468
+ retries++;
469
+
470
+ setTimeout(self.start.bind(self, options, retries), timeout);
471
  });
472
  };
473
 
474
+ Import.prototype.run = function (params, retries) {
475
  var self = this;
476
+ var retries = retries || 0;
477
+
478
+ // Stop running import
479
+ if (this.stopImport) {
480
+ return;
481
+ }
482
+
483
+ // Import
484
+ $.post(ai1wm_import.ajax.url, params, null, 'json').done(function (params) {
485
+ if (params) {
486
+ self.run(params);
487
+ }
488
+ }).fail(function () {
489
+ var timeout = retries * 1000;
490
+
491
+ retries++;
492
+
493
+ setTimeout(self.run.bind(self, params, retries), timeout);
494
+ });
495
+ };
496
+
497
+ Import.prototype.confirm = function (options, retries) {
498
+ var self = this;
499
+ var retries = retries || 0;
500
+
501
+ // Stop running import
502
+ if (this.stopImport) {
503
+ return;
504
+ }
505
 
506
  // Set params
507
  var params = this.params.concat({ name: 'secret_key', value: ai1wm_import.secret_key }).concat({ name: 'priority', value: 150 });
512
  }
513
 
514
  // Confirm
515
+ $.post(ai1wm_import.ajax.url, params, null, 'json').done(function () {
516
  self.getStatus();
517
+ }).done(function (params) {
518
+ if (params) {
519
+ self.run(params);
520
+ }
521
  }).fail(function () {
522
+ var timeout = retries * 1000;
523
+ if (retries >= 5) {
524
+ return self.setStatus({
525
+ type: 'error',
526
+ message: 'Unable to confirm the import. Refresh the page and try again'
527
+ });
528
+ }
529
+
530
+ retries++;
531
+
532
+ setTimeout(self.confirm.bind(self, options, retries), timeout);
533
  });
534
  };
535
 
536
+ Import.prototype.blogs = function (options, retries) {
537
  var self = this;
538
+ var retries = retries || 0;
539
+
540
+ // Stop running import
541
+ if (this.stopImport) {
542
+ return;
543
+ }
544
 
545
  // Set params
546
  var params = this.params.concat({ name: 'secret_key', value: ai1wm_import.secret_key }).concat({ name: 'priority', value: 150 });
551
  }
552
 
553
  // Blogs
554
+ $.post(ai1wm_import.ajax.url, params, null, 'json').done(function () {
555
  self.getStatus();
556
+ }).done(function (params) {
557
+ if (params) {
558
+ self.run(params);
559
+ }
560
  }).fail(function () {
561
+ var timeout = retries * 1000;
562
+ if (retries >= 5) {
563
+ return self.setStatus({
564
+ type: 'error',
565
+ message: 'Unable to prepare blogs the import. Refresh the page and try again'
566
+ });
567
+ }
568
+
569
+ retries++;
570
+
571
+ setTimeout(self.blogs.bind(self, options, retries), timeout);
572
  });
573
  };
574
 
575
+ Import.prototype.clean = function (options, retries) {
576
  var self = this;
577
+ var retries = retries || 0;
578
 
579
+ // Set stop flag
580
+ this.stopImport = true;
581
+
582
+ // Set initial status
583
+ this.setStatus({ type: 'info', message: 'Please wait, stopping the import...' });
584
 
585
  // Set params
586
  var params = this.params.concat({ name: 'secret_key', value: ai1wm_import.secret_key }).concat({ name: 'priority', value: 400 });
591
  }
592
 
593
  // Clean
594
+ $.post(ai1wm_import.ajax.url, params, null, 'json').done(function () {
595
  // Unbinding the beforeunload event when we stop importing
596
  $(window).unbind('beforeunload');
597
+
598
+ // Destroy modal
599
+ self.modal.destroy();
600
  }).fail(function () {
601
+ var timeout = retries * 1000;
602
+ if (retries >= 5) {
603
+ return self.setStatus({
604
+ type: 'error',
605
+ message: 'Unable to stop the import. Refresh the page and try again'
606
+ });
607
+ }
608
+
609
+ retries++;
610
+
611
+ setTimeout(self.clean.bind(self, options, retries), timeout);
612
  });
613
  };
614
 
616
  var self = this;
617
 
618
  // Stop getting status
619
+ if (this.stopImport) {
620
  return;
621
  }
622
 
643
  }
644
 
645
  // Import is not done yet, let's check status in 3 seconds
646
+ setTimeout(self.getStatus.bind(self), 3000);
 
 
647
  }).fail(function () {
648
  // Import is not done yet, let's check status in 3 seconds
649
+ setTimeout(self.getStatus.bind(self), 3000);
 
 
650
  });;
651
  };
652
 
726
  var title = $('<span></span>').addClass('ai1wm-title-red').text('Unable to import');
727
 
728
  // Create close button
729
+ var closeButton = $('<button type="button" class="ai1wm-button-red">Close</button>').on('click', function () {
730
+ self.destroy();
 
731
  });
732
 
733
  // Append close button
750
  // Progress Modal
751
  this.progress = function (params) {
752
  if (this.view === 'progress') {
753
+
754
  // Update progressBarMeter
755
  this.progress.progressBarMeter.width(params.percent + '%');
756
 
783
  this.progress.progressBarPercent = $('<span class="ai1wm-progress-bar-percent">0%</span>').text(params.percent + '%');
784
 
785
  // Create stop import
786
+ var stopButton = $('<button type="button" class="ai1wm-button-red"><i class="ai1wm-icon-notification"></i> Stop import</button>').on('click', function () {
787
  $(this).attr('disabled', 'disabled');
788
  self.onStop();
 
 
789
  });
790
 
791
  // Append progress meter and progress percent
831
  var warning = $('<span class="ai1wm-icon-notification"></span>');
832
 
833
  // Create confirm button
834
+ var confirmButton = $('<button type="button" class="ai1wm-button-green">Continue</button>').on('click', function () {
835
  $(this).attr('disabled', 'disabled');
836
  self.onConfirm();
837
  });
875
  var title = $('<span></span>').addClass('ai1wm-title-grey').text(params.title);
876
 
877
  // Create continue button
878
+ var continueButton = $('<button type="button" class="ai1wm-button-green">Continue</button>').on('click', function () {
879
  $(this).attr('disabled', 'disabled');
880
  self.onBlogs($(this).closest('form').serializeArray());
881
  });
919
  var loader = $('<span class="ai1wm-loader"></span>');
920
 
921
  // Create stop import
922
+ var stopButton = $('<button type="button" class="ai1wm-button-red"><i class="ai1wm-icon-notification"></i> Stop import</button>').attr('disabled', 'disabled');
923
 
924
  // Append stop button
925
  action.append(stopButton);
960
  var title = $('<span></span>').addClass('ai1wm-title-green').text(params.title);
961
 
962
  // Create close button
963
+ var closeButton = $('<button type="button" class="ai1wm-button-red">Close</button>').on('click', function () {
964
+ self.destroy();
 
965
  });
966
 
967
  // Append close button
1023
  this.view = params.type;
1024
  };
1025
 
1026
+ Modal.prototype.destroy = function () {
1027
+ this.modal.hide();
1028
+ this.overlay.hide();
1029
+ };
1030
+
1031
  module.exports = Modal;
1032
 
1033
  /***/ },
1066
  Dialog = __webpack_require__(9);
1067
 
1068
  var Extensions = {
1069
+ 's3': 'Amazon S3 Extension',
1070
+ 'url': 'URL Extension',
1071
+ 'ftp': 'FTP Extension',
1072
+ 'gdrive': 'Google Drive Extension',
1073
+ 'dropbox': 'Dropbox Extension'
1074
  };
1075
 
1076
  window.Ai1wmExportController = function (provider) {
1077
+ this._export = {};
1078
+ this._provider = provider;
1079
  };
1080
 
1081
  window.Ai1wmExportController.prototype.start = function () {
1082
+ new Dialog('<strong>All in One WP Migration</strong> is not compatible with current version of ' + '<strong>' + Extensions[this._provider] + '</strong>. Please contact ' + '<a href="mailto:support@servmask.com">support@servmask.com</a> for more details.');
1083
  };
1084
 
1085
  window.Ai1wmImportController = function (provider) {
1086
+ this._import = {};
1087
+ this._provider = provider;
1088
  };
1089
 
1090
  window.Ai1wmImportController.prototype.init = function () {};
1091
 
1092
  window.Ai1wmImportController.prototype.download = function () {
1093
+ new Dialog('<strong>All in One WP Migration</strong> is not compatible with current version of ' + '<strong>' + Extensions[this._provider] + '</strong>. Please contact ' + '<a href="mailto:support@servmask.com">support@servmask.com</a> for more details.');
1094
  };
1095
 
1096
+ jQuery(document).ready(function ($) {
1097
+ 'use strict';
1098
+
1099
+ // Box extension
1100
+
1101
+ $('#ai1wmbe-import-file-cancel').attr('type', 'button');
1102
+ $('#ai1wmbe-import-file').attr('type', 'button');
1103
+
1104
+ // Dropbox extension
1105
+ $('#ai1wmde-import-file-cancel').attr('type', 'button');
1106
+ $('#ai1wmde-import-file').attr('type', 'button');
1107
+
1108
+ // FTP extension
1109
+ $('#ai1wmfe-import-file-cancel').attr('type', 'button');
1110
+ $('#ai1wmfe-import-file').attr('type', 'button');
1111
+
1112
+ // Google Drive extension
1113
+ $('#ai1wmge-import-file-cancel').attr('type', 'button');
1114
+ $('#ai1wmge-import-file').attr('type', 'button');
1115
+
1116
+ // OneDrive extension
1117
+ $('#ai1wmoe-import-file-cancel').attr('type', 'button');
1118
+ $('#ai1wmoe-import-file').attr('type', 'button');
1119
+
1120
+ // Amazon S3 extension
1121
+ $('#ai1wmse-import-file-cancel').attr('type', 'button');
1122
+ $('#ai1wmse-import-file').attr('type', 'button');
1123
+
1124
+ // URL extension
1125
+ $('#ai1wmle-import-file-cancel').attr('type', 'button');
1126
+ $('#ai1wmle-import-file').attr('type', 'button');
1127
+ });
1128
+
1129
  /***/ },
1130
  /* 9 */
1131
  /***/ function(module, exports) {
1180
  this.action = $('<div></div>');
1181
 
1182
  // Create close button
1183
+ this.closeButton = $('<button type="button" class="ai1wm-button-red">Close</button>').on('click', function () {
1184
  self.modal.hide();
1185
  self.overlay.hide();
1186
  });
1244
  FileUploader.prototype.setDefaultValues = function () {
1245
  this.model = new Import();
1246
  this.stopUpload = false;
 
1247
  };
1248
 
1249
  FileUploader.prototype.init = function () {
1295
  });
1296
  };
1297
 
1298
+ FileUploader.prototype.upload = function (file, retries) {
1299
  var _this2 = this;
1300
 
1301
+ var retries = retries || 0;
1302
+
1303
  var chunkSize = file.size > ai1wm_uploader.chunk_size ? ai1wm_uploader.chunk_size : file.size;
1304
  var formData = this.getFormData(file, chunkSize);
1305
+
1306
  fetch(ai1wm_uploader.url, {
1307
  method: 'POST',
1308
  credentials: 'include',
1317
  ai1wm_uploader.chunk_size = chunkSize / 2;
1318
  return _this2.upload(file);
1319
  case 200:
 
1320
  file = file.slice(chunkSize, file.size, 'application/octet-binary');
1321
  var uploadedBytes = _this2.fileSize - file.size;
1322
  var progress = uploadedBytes / _this2.fileSize * 100;
1326
  throw new Error(response.status);
1327
  }
1328
  }).catch(function (error) {
1329
+ var timeout = retries * 1000;
1330
+ if (retries >= 30) {
1331
  return _this2.onError(new Error('We are sorry, there seems to be a problem while uploading your file. Follow <a href="https://www.youtube.com/watch?v=mRp7qTFYKgs" target="_blank">this guide</a> to resolve it.'));
1332
  }
1333
+
1334
+ retries++;
1335
+
1336
+ setTimeout(_this2.upload.bind(_this2, file, retries), timeout);
1337
  });
1338
  };
1339
 
1382
  FileUploader.prototype.onBeforeUpload = function (file) {
1383
  var self = this;
1384
 
1385
+ var storage = Util.random(12);
1386
+ var options = Util.form('#ai1wm-import-form').concat({ name: 'storage', value: storage }).concat({ name: 'archive', value: file.name });
1387
+
1388
+ // Set global params
1389
+ this.model.setParams(options);
1390
 
1391
  // Set multipart params
1392
  $.extend(ai1wm_uploader.params, {
1393
+ storage: storage,
1394
+ archive: file.name
1395
  });
1396
 
 
 
 
1397
  // Set stop
1398
  this.model.onStop = function () {
1399
  self.stopUpload = true;
1400
+
1401
  // Clean storage
1402
  self.model.clean();
1403
  };
2848
  /***/ function(module, exports) {
2849
 
2850
  // shim for using process in browser
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2851
 
2852
+ var process = module.exports = {};
2853
 
2854
+ // cached from whatever global is present so that test runners that stub it don't break things.
2855
+ var cachedSetTimeout = setTimeout;
2856
+ var cachedClearTimeout = clearTimeout;
2857
 
 
2858
  var queue = [];
2859
  var draining = false;
2860
  var currentQueue;
2879
  if (draining) {
2880
  return;
2881
  }
2882
+ var timeout = cachedSetTimeout(cleanUpNextTick);
2883
  draining = true;
2884
 
2885
  var len = queue.length;
2896
  }
2897
  currentQueue = null;
2898
  draining = false;
2899
+ cachedClearTimeout(timeout);
2900
  }
2901
 
2902
  process.nextTick = function (fun) {
2908
  }
2909
  queue.push(new Item(fun, args));
2910
  if (queue.length === 1 && !draining) {
2911
+ cachedSetTimeout(drainQueue, 0);
2912
  }
2913
  };
2914
 
lib/view/backups/index.php CHANGED
@@ -32,97 +32,89 @@
32
 
33
  <?php include AI1WM_TEMPLATES_PATH . '/common/report-problem.php'; ?>
34
 
35
- <?php if ( is_readable( AI1WM_BACKUPS_PATH ) && is_writable( AI1WM_BACKUPS_PATH ) ) : ?>
36
- <div class="ai1wm-clear">
37
- <?php if ( $total_space ) : ?>
38
- <p id="ai1wm-backup-size">
39
- <?php _e( 'Available disk space', AI1WM_PLUGIN_NAME ); ?>
40
- <strong><?php echo size_format( $free_space, 2 ); ?></strong>
41
- </p>
42
 
43
- <?php $progress = ceil( ( $free_space / $total_space ) * 100 ); ?>
44
-
45
- <div id="ai1wm-backup-progress">
46
- <div id="ai1wm-backup-progress-bar" style="width: <?php echo $progress; ?>%;">
47
- <?php echo $progress; ?>%
48
- </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
49
  </div>
50
  <?php endif; ?>
51
- </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
52
 
53
- <table class="ai1wm-backups <?php echo empty( $backups ) ? 'ai1wm-hide' : null; ?>">
54
- <thead>
55
- <tr>
56
- <th class="ai1wm-column-name"><?php _e( 'Name', AI1WM_PLUGIN_NAME ); ?></th>
57
- <th class="ai1wm-column-date"><?php _e( 'Date', AI1WM_PLUGIN_NAME ); ?></th>
58
- <th class="ai1wm-column-size"><?php _e( 'Size', AI1WM_PLUGIN_NAME ); ?></th>
59
- <th class="ai1wm-column-actions"></th>
60
- </tr>
61
- </thead>
62
 
63
- <tbody>
64
- <?php foreach ( $backups as $backup ) : ?>
65
- <tr>
66
- <td class="ai1wm-column-name">
67
- <i class="ai1wm-icon-file-zip"></i>
68
- <?php echo $backup['filename']; ?>
69
- </td>
70
- <?php if ( is_null( $backup['mtime'] ) || is_null( $backup['size'] ) ) : ?>
71
- <td class="ai1wm-column-info" colspan="3">
72
- <?php _e( 'The file is too large for your hosting plan.', AI1WM_PLUGIN_NAME ); ?>
73
- </td>
74
- <?php else : ?>
75
- <td class="ai1wm-column-date">
76
- <?php echo human_time_diff( $backup['mtime'] ); ?> <?php _e( 'ago', AI1WM_PLUGIN_NAME ); ?>
77
- </td>
78
- <td class="ai1wm-column-size">
79
- <?php echo size_format( $backup['size'], 2 ); ?>
80
- </td>
81
- <td class="ai1wm-column-actions ai1wm-backup-actions">
82
- <a href="<?php echo ai1wm_backups_url( array( 'archive' => $backup['filename'] ) ); ?>" class="ai1wm-button-green ai1wm-button-alone ai1wm-backup-download">
83
- <i class="ai1wm-icon-arrow-down ai1wm-icon-alone"></i>
84
- <span><?php _e( 'Download', AI1WM_PLUGIN_NAME ); ?></span>
85
- </a>
86
- <a href="#" data-archive="<?php echo $backup['filename']; ?>" class="ai1wm-button-gray ai1wm-button-alone ai1wm-backup-restore">
87
- <i class="ai1wm-icon-cloud-upload ai1wm-icon-alone"></i>
88
- <span><?php _e( 'Restore', AI1WM_PLUGIN_NAME ); ?></span>
89
- </a>
90
- <a href="#" data-archive="<?php echo $backup['filename']; ?>" class="ai1wm-button-red ai1wm-button-alone ai1wm-backup-delete">
91
- <i class="ai1wm-icon-close ai1wm-icon-alone"></i>
92
- <span><?php _e( 'Delete', AI1WM_PLUGIN_NAME ); ?></span>
93
- </a>
94
- </td>
95
- <?php endif; ?>
96
- </tr>
97
- <?php endforeach; ?>
98
- </tbody>
99
- </table>
100
 
101
- <div class="ai1wm-backups-empty <?php echo empty( $backups ) ? null : 'ai1wm-hide'; ?>">
102
- <p><?php _e( 'There are no backups available at this time, why not create a new one?', AI1WM_PLUGIN_NAME ); ?></p>
103
- <p>
104
- <a href="<?php echo network_admin_url( 'admin.php?page=site-migration-export' ); ?>" class="ai1wm-button-green">
105
- <i class="ai1wm-icon-export"></i>
106
- <?php _e( 'Create backup', AI1WM_PLUGIN_NAME ); ?>
107
- </a>
108
- </p>
109
- </div>
110
- <?php else : ?>
111
- <br />
112
- <br />
113
- <div class="ai1wm-clear ai1wm-message ai1wm-red-message">
114
- <?php
115
- printf(
116
- __(
117
- '<h3>Site could not create backups!</h3>' .
118
- '<p>Please make sure that storage directory <strong>%s</strong> has read and write permissions.</p>',
119
- AI1WM_PLUGIN_NAME
120
- ),
121
- AI1WM_STORAGE_PATH
122
- );
123
- ?>
124
- </div>
125
- <?php endif; ?>
126
  </div>
127
  </div>
128
  <div class="ai1wm-right">
32
 
33
  <?php include AI1WM_TEMPLATES_PATH . '/common/report-problem.php'; ?>
34
 
35
+ <form action="" method="post" id="ai1wm-backups-form" class="ai1wm-clear">
 
 
 
 
 
 
36
 
37
+ <?php if ( is_readable( AI1WM_BACKUPS_PATH ) && is_writable( AI1WM_BACKUPS_PATH ) ) : ?>
38
+ <?php if ( $backups ) : ?>
39
+ <table class="ai1wm-backups">
40
+ <thead>
41
+ <tr>
42
+ <th class="ai1wm-column-name"><?php _e( 'Name', AI1WM_PLUGIN_NAME ); ?></th>
43
+ <th class="ai1wm-column-date"><?php _e( 'Date', AI1WM_PLUGIN_NAME ); ?></th>
44
+ <th class="ai1wm-column-size"><?php _e( 'Size', AI1WM_PLUGIN_NAME ); ?></th>
45
+ <th class="ai1wm-column-actions"></th>
46
+ </tr>
47
+ </thead>
48
+ <tbody>
49
+ <?php foreach ( $backups as $backup ) : ?>
50
+ <tr>
51
+ <td class="ai1wm-column-name">
52
+ <i class="ai1wm-icon-file-zip"></i>
53
+ <?php echo esc_html( $backup['filename'] ); ?>
54
+ </td>
55
+ <?php if ( is_null( $backup['mtime'] ) || is_null( $backup['size'] ) ) : ?>
56
+ <td class="ai1wm-column-info" colspan="3">
57
+ <?php _e( 'The file is too large for your hosting plan.', AI1WM_PLUGIN_NAME ); ?>
58
+ </td>
59
+ <?php else : ?>
60
+ <td class="ai1wm-column-date">
61
+ <?php echo human_time_diff( $backup['mtime'] ); ?> <?php _e( 'ago', AI1WM_PLUGIN_NAME ); ?>
62
+ </td>
63
+ <td class="ai1wm-column-size">
64
+ <?php echo size_format( $backup['size'], 2 ); ?>
65
+ </td>
66
+ <td class="ai1wm-column-actions ai1wm-backup-actions">
67
+ <a href="<?php echo ai1wm_backups_url( array( 'archive' => esc_attr( $backup['filename'] ) ) ); ?>" class="ai1wm-button-green ai1wm-button-alone ai1wm-backup-download">
68
+ <i class="ai1wm-icon-arrow-down ai1wm-icon-alone"></i>
69
+ <span><?php _e( 'Download', AI1WM_PLUGIN_NAME ); ?></span>
70
+ </a>
71
+ <a href="#" data-archive="<?php echo esc_attr( $backup['filename'] ); ?>" class="ai1wm-button-gray ai1wm-button-alone ai1wm-backup-restore">
72
+ <i class="ai1wm-icon-cloud-upload ai1wm-icon-alone"></i>
73
+ <span><?php _e( 'Restore', AI1WM_PLUGIN_NAME ); ?></span>
74
+ </a>
75
+ <a href="#" data-archive="<?php echo esc_attr( $backup['filename'] ); ?>" class="ai1wm-button-red ai1wm-button-alone ai1wm-backup-delete">
76
+ <i class="ai1wm-icon-close ai1wm-icon-alone"></i>
77
+ <span><?php _e( 'Delete', AI1WM_PLUGIN_NAME ); ?></span>
78
+ </a>
79
+ </td>
80
+ <?php endif; ?>
81
+ </tr>
82
+ <?php endforeach; ?>
83
+ </tbody>
84
+ </table>
85
+ <?php else : ?>
86
+ <div class="ai1wm-backups-empty">
87
+ <p><?php _e( 'There are no backups available at this time, why not create a new one?', AI1WM_PLUGIN_NAME ); ?></p>
88
+ <p>
89
+ <a href="<?php echo network_admin_url( 'admin.php?page=site-migration-export' ); ?>" class="ai1wm-button-green">
90
+ <i class="ai1wm-icon-export"></i>
91
+ <?php _e( 'Create backup', AI1WM_PLUGIN_NAME ); ?>
92
+ </a>
93
+ </p>
94
  </div>
95
  <?php endif; ?>
96
+ <?php else : ?>
97
+ <br />
98
+ <br />
99
+ <div class="ai1wm-clear ai1wm-message ai1wm-red-message">
100
+ <?php
101
+ printf(
102
+ __(
103
+ '<h3>Site could not create backups!</h3>' .
104
+ '<p>Please make sure that storage directory <strong>%s</strong> has read and write permissions.</p>',
105
+ AI1WM_PLUGIN_NAME
106
+ ),
107
+ AI1WM_STORAGE_PATH
108
+ );
109
+ ?>
110
+ </div>
111
+ <?php endif; ?>
112
 
113
+ <?php do_action( 'ai1wm_backups_left_end' ); ?>
 
 
 
 
 
 
 
 
114
 
115
+ <input type="hidden" name="ai1wm_manual_backups" value="1" />
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
116
 
117
+ </form>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
118
  </div>
119
  </div>
120
  <div class="ai1wm-right">
lib/view/common/report-problem.php CHANGED
@@ -1,5 +1,5 @@
1
  <div class="ai1wm-report-problem">
2
- <button id="ai1wm-report-problem-button" class="ai1wm-button-red">
3
  <i class="ai1wm-icon-notification"></i> <?php _e( 'Report issue', AI1WM_PLUGIN_NAME ); ?>
4
  </button>
5
  <div class="ai1wm-report-problem-dialog">
1
  <div class="ai1wm-report-problem">
2
+ <button type="button" id="ai1wm-report-problem-button" class="ai1wm-button-red">
3
  <i class="ai1wm-icon-notification"></i> <?php _e( 'Report issue', AI1WM_PLUGIN_NAME ); ?>
4
  </button>
5
  <div class="ai1wm-report-problem-dialog">
lib/view/export/find-replace.php CHANGED
@@ -17,6 +17,6 @@
17
  </li>
18
  </ul>
19
 
20
- <button class="ai1wm-button-gray" id="ai1wm-add-new-replace-button">
21
  <i class="ai1wm-icon-plus2"></i><?php _e( 'Add', AI1WM_PLUGIN_NAME ); ?>
22
  </button>
17
  </li>
18
  </ul>
19
 
20
+ <button type="button" class="ai1wm-button-gray" id="ai1wm-add-new-replace-button">
21
  <i class="ai1wm-icon-plus2"></i><?php _e( 'Add', AI1WM_PLUGIN_NAME ); ?>
22
  </button>
lib/view/import/import-buttons.php CHANGED
@@ -2,35 +2,33 @@
2
  <div class="ai1wm-import-messages"></div>
3
 
4
  <div class="ai1wm-import-form">
5
- <form action="" method="post" enctype="multipart/form-data">
6
- <div class="hide-if-no-js">
7
- <div class="ai1wm-drag-drop-area" id="ai1wm-drag-drop-area">
8
- <div id="ai1wm-import-init">
9
- <p>
10
- <i class="ai1wm-icon-cloud-upload"></i><br />
11
- <?php _e( 'Drag & Drop to upload', AI1WM_PLUGIN_NAME ); ?>
12
- </p>
13
- <div class="ai1wm-button-group ai1wm-button-import ai1wm-expandable">
14
- <div class="ai1wm-button-main">
15
- <span><?php _e( 'Import From', AI1WM_PLUGIN_NAME ); ?></span>
16
- <span class="ai1mw-lines">
17
- <span class="ai1wm-line ai1wm-line-first"></span>
18
- <span class="ai1wm-line ai1wm-line-second"></span>
19
- <span class="ai1wm-line ai1wm-line-third"></span>
20
- </span>
21
- </div>
22
- <ul class="ai1wm-dropdown-menu ai1wm-import-providers">
23
- <?php foreach ( apply_filters( 'ai1wm_import_buttons', array() ) as $button ) : ?>
24
- <li>
25
- <?php echo $button; ?>
26
- </li>
27
- <?php endforeach; ?>
28
- </ul>
29
  </div>
 
 
 
 
 
 
 
30
  </div>
31
  </div>
32
  </div>
33
- </form>
34
  </div>
35
 
36
  <p>
2
  <div class="ai1wm-import-messages"></div>
3
 
4
  <div class="ai1wm-import-form">
5
+ <div class="hide-if-no-js">
6
+ <div class="ai1wm-drag-drop-area" id="ai1wm-drag-drop-area">
7
+ <div id="ai1wm-import-init">
8
+ <p>
9
+ <i class="ai1wm-icon-cloud-upload"></i><br />
10
+ <?php _e( 'Drag & Drop to upload', AI1WM_PLUGIN_NAME ); ?>
11
+ </p>
12
+ <div class="ai1wm-button-group ai1wm-button-import ai1wm-expandable">
13
+ <div class="ai1wm-button-main">
14
+ <span><?php _e( 'Import From', AI1WM_PLUGIN_NAME ); ?></span>
15
+ <span class="ai1mw-lines">
16
+ <span class="ai1wm-line ai1wm-line-first"></span>
17
+ <span class="ai1wm-line ai1wm-line-second"></span>
18
+ <span class="ai1wm-line ai1wm-line-third"></span>
19
+ </span>
 
 
 
 
 
 
 
 
 
20
  </div>
21
+ <ul class="ai1wm-dropdown-menu ai1wm-import-providers">
22
+ <?php foreach ( apply_filters( 'ai1wm_import_buttons', array() ) as $button ) : ?>
23
+ <li>
24
+ <?php echo $button; ?>
25
+ </li>
26
+ <?php endforeach; ?>
27
+ </ul>
28
  </div>
29
  </div>
30
  </div>
31
+ </div>
32
  </div>
33
 
34
  <p>
lib/view/import/index.php CHANGED
@@ -32,13 +32,19 @@
32
 
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'; ?>
 
 
40
 
41
- <?php do_action( 'ai1wm_import_left_end' ); ?>
 
 
 
 
 
 
42
  </div>
43
  </div>
44
  <div class="ai1wm-right">
32
 
33
  <?php include AI1WM_TEMPLATES_PATH . '/common/report-problem.php'; ?>
34
 
35
+ <form action="" method="post" id="ai1wm-import-form" class="ai1wm-clear" enctype="multipart/form-data">
 
 
36
 
37
+ <p>
38
+ <?php _e( 'Use the box below to upload a wpress file.', AI1WM_PLUGIN_NAME ); ?><br />
39
+ </p>
40
 
41
+ <?php include AI1WM_TEMPLATES_PATH . '/import/import-buttons.php'; ?>
42
+
43
+ <?php do_action( 'ai1wm_import_left_end' ); ?>
44
+
45
+ <input type="hidden" name="ai1wm_manual_import" value="1" />
46
+
47
+ </form>
48
  </div>
49
  </div>
50
  <div class="ai1wm-right">
loader.php CHANGED
@@ -58,6 +58,14 @@ require_once AI1WM_VENDOR_PATH .
58
  DIRECTORY_SEPARATOR .
59
  'class-ai1wm-file-htaccess.php';
60
 
 
 
 
 
 
 
 
 
61
  require_once AI1WM_VENDOR_PATH .
62
  DIRECTORY_SEPARATOR .
63
  'servmask' .
@@ -182,6 +190,10 @@ require_once AI1WM_CONTROLLER_PATH .
182
  DIRECTORY_SEPARATOR .
183
  'class-ai1wm-report-controller.php';
184
 
 
 
 
 
185
  require_once AI1WM_EXPORT_PATH .
186
  DIRECTORY_SEPARATOR .
187
  'class-ai1wm-export-compatibility.php';
58
  DIRECTORY_SEPARATOR .
59
  'class-ai1wm-file-htaccess.php';
60
 
61
+ require_once AI1WM_VENDOR_PATH .
62
+ DIRECTORY_SEPARATOR .
63
+ 'servmask' .
64
+ DIRECTORY_SEPARATOR .
65
+ 'filesystem' .
66
+ DIRECTORY_SEPARATOR .
67
+ 'class-ai1wm-file-webconfig.php';
68
+
69
  require_once AI1WM_VENDOR_PATH .
70
  DIRECTORY_SEPARATOR .
71
  'servmask' .
190
  DIRECTORY_SEPARATOR .
191
  'class-ai1wm-report-controller.php';
192
 
193
+ require_once AI1WM_EXPORT_PATH .
194
+ DIRECTORY_SEPARATOR .
195
+ 'class-ai1wm-export-init.php';
196
+
197
  require_once AI1WM_EXPORT_PATH .
198
  DIRECTORY_SEPARATOR .
199
  'class-ai1wm-export-compatibility.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.7
6
- Stable tag: 5.56
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,18 @@ 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.56 =
82
  * Fix an issue with WP_Hook class introcuded in WP 4.7
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.7
6
+ Stable tag: 6.38
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
+ = 6.38 =
82
+ * Add support for HyperDB plugin
83
+ * Add support for RevSlider plugin
84
+ * Check available disk space during export/import
85
+ * Support very restricted hosting environments
86
+ * Add wpress mime-type to web.config when the server is IIS
87
+ * Switch to AJAX from cURL on export/import
88
+ * Respect WordPress constants FS_CHMOD_DIR and FS_CHMOD_FILE on import
89
+ * Fix an issue related to generating archive and folder names
90
+ * Fix an issue related to CSS styles on export page
91
+ * Remove misleading available disk space information on "Backups" page
92
+
93
  = 5.56 =
94
  * Fix an issue with WP_Hook class introcuded in WP 4.7
95