All-in-One WP Migration - Version 7.12

Version Description

Added

  • Display a message when MySQL server exceeds a limit
Download this release

Release Info

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

Code changes from version 7.11 to 7.12

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: 7.11
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: 7.12
9
  * Text Domain: all-in-one-wp-migration
10
  * Domain Path: /languages
11
  * Network: True
changelog.txt CHANGED
@@ -237,7 +237,7 @@
237
 
238
  = 1.8.1 =
239
  * Added "Get Support" link in the plugin list page
240
- * Removed "All in One WP Migration Beta" link from the readme file
241
 
242
  = 1.8.0 =
243
  * Added support for dynamically recognizing Site URL and Home URL on the import page
237
 
238
  = 1.8.1 =
239
  * Added "Get Support" link in the plugin list page
240
+ * Removed "All-in-One WP Migration Beta" link from the readme file
241
 
242
  = 1.8.0 =
243
  * Added support for dynamically recognizing Site URL and Home URL on the import page
constants.php CHANGED
@@ -35,7 +35,7 @@ define( 'AI1WM_DEBUG', false );
35
  // ==================
36
  // = Plugin Version =
37
  // ==================
38
- define( 'AI1WM_VERSION', '7.11' );
39
 
40
  // ===============
41
  // = Plugin Name =
35
  // ==================
36
  // = Plugin Version =
37
  // ==================
38
+ define( 'AI1WM_VERSION', '7.12' );
39
 
40
  // ===============
41
  // = Plugin Name =
lib/controller/class-ai1wm-export-controller.php CHANGED
@@ -128,7 +128,7 @@ class Ai1wm_Export_Controller {
128
  $active_filters = array();
129
  $static_filters = array();
130
 
131
- // All in One WP Migration
132
  if ( defined( 'AI1WM_PLUGIN_NAME' ) ) {
133
  $active_filters[] = apply_filters( 'ai1wm_export_file', Ai1wm_Template::get_content( 'export/button-file' ) );
134
  } else {
128
  $active_filters = array();
129
  $static_filters = array();
130
 
131
+ // All-in-One WP Migration
132
  if ( defined( 'AI1WM_PLUGIN_NAME' ) ) {
133
  $active_filters[] = apply_filters( 'ai1wm_export_file', Ai1wm_Template::get_content( 'export/button-file' ) );
134
  } else {
lib/controller/class-ai1wm-import-controller.php CHANGED
@@ -80,6 +80,15 @@ class Ai1wm_Import_Controller {
80
  echo json_encode( array( 'errors' => array( array( 'code' => $e->getCode(), 'message' => $e->getMessage() ) ) ) );
81
  }
82
  exit;
 
 
 
 
 
 
 
 
 
83
  } catch ( Exception $e ) {
84
  if ( defined( 'WP_CLI' ) ) {
85
  WP_CLI::error( sprintf( __( 'Unable to import: %s', AI1WM_PLUGIN_NAME ), $e->getMessage() ) );
@@ -136,7 +145,7 @@ class Ai1wm_Import_Controller {
136
  $active_filters = array();
137
  $static_filters = array();
138
 
139
- // All in One WP Migration
140
  if ( defined( 'AI1WM_PLUGIN_NAME' ) ) {
141
  $active_filters[] = apply_filters( 'ai1wm_import_file', Ai1wm_Template::get_content( 'import/button-file' ) );
142
  } else {
80
  echo json_encode( array( 'errors' => array( array( 'code' => $e->getCode(), 'message' => $e->getMessage() ) ) ) );
81
  }
82
  exit;
83
+ } catch ( Ai1wm_Database_Exception $e ) {
84
+ if ( defined( 'WP_CLI' ) ) {
85
+ WP_CLI::error( sprintf( __( 'Unable to import. Error code: %s. %s', AI1WM_PLUGIN_NAME ), $e->getCode(), $e->getMessage() ) );
86
+ } else {
87
+ status_header( $e->getCode() );
88
+ echo json_encode( array( 'errors' => array( array( 'code' => $e->getCode(), 'message' => $e->getMessage() ) ) ) );
89
+ }
90
+ Ai1wm_Directory::delete( ai1wm_storage_path( $params ) );
91
+ exit;
92
  } catch ( Exception $e ) {
93
  if ( defined( 'WP_CLI' ) ) {
94
  WP_CLI::error( sprintf( __( 'Unable to import: %s', AI1WM_PLUGIN_NAME ), $e->getMessage() ) );
145
  $active_filters = array();
146
  $static_filters = array();
147
 
148
+ // All-in-One WP Migration
149
  if ( defined( 'AI1WM_PLUGIN_NAME' ) ) {
150
  $active_filters[] = apply_filters( 'ai1wm_import_file', Ai1wm_Template::get_content( 'import/button-file' ) );
151
  } else {
lib/controller/class-ai1wm-main-controller.php CHANGED
@@ -101,7 +101,7 @@ class Ai1wm_Main_Controller {
101
  // Admin header
102
  add_action( 'admin_head', array( $this, 'admin_head' ) );
103
 
104
- // All in One WP Migration
105
  add_action( 'plugins_loaded', array( $this, 'ai1wm_loaded' ), 10 );
106
 
107
  // Export and import commands
@@ -191,7 +191,7 @@ class Ai1wm_Main_Controller {
191
  }
192
 
193
  /**
194
- * All in One WP Migration loaded
195
  *
196
  * @return void
197
  */
101
  // Admin header
102
  add_action( 'admin_head', array( $this, 'admin_head' ) );
103
 
104
+ // All-in-One WP Migration
105
  add_action( 'plugins_loaded', array( $this, 'ai1wm_loaded' ), 10 );
106
 
107
  // Export and import commands
191
  }
192
 
193
  /**
194
+ * All-in-One WP Migration loaded
195
  *
196
  * @return void
197
  */
lib/vendor/servmask/command/class-ai1wm-wp-cli-command.php CHANGED
@@ -26,7 +26,7 @@ if ( defined( 'WP_CLI' ) ) {
26
  if ( is_multisite() ) {
27
  WP_CLI::error_multi_line(
28
  array(
29
- __( 'WordPress Multisite is supported via our All in One WP Migration Multisite Extension.', AI1WM_PLUGIN_NAME ),
30
  __( 'You can get a copy of it here: https://servmask.com/products/multisite-extension', AI1WM_PLUGIN_NAME ),
31
  )
32
  );
@@ -35,7 +35,7 @@ if ( defined( 'WP_CLI' ) ) {
35
 
36
  WP_CLI::error_multi_line(
37
  array(
38
- __( 'WordPress CLI is supported via our All in One WP Migration Unlimited Extension.', AI1WM_PLUGIN_NAME ),
39
  __( 'You can get a copy of it here: https://servmask.com/products/unlimited-extension', AI1WM_PLUGIN_NAME ),
40
  )
41
  );
26
  if ( is_multisite() ) {
27
  WP_CLI::error_multi_line(
28
  array(
29
+ __( 'WordPress Multisite is supported via our All-in-One WP Migration Multisite Extension.', AI1WM_PLUGIN_NAME ),
30
  __( 'You can get a copy of it here: https://servmask.com/products/multisite-extension', AI1WM_PLUGIN_NAME ),
31
  )
32
  );
35
 
36
  WP_CLI::error_multi_line(
37
  array(
38
+ __( 'WordPress CLI is supported via our All-in-One WP Migration Unlimited Extension.', AI1WM_PLUGIN_NAME ),
39
  __( 'You can get a copy of it here: https://servmask.com/products/unlimited-extension', AI1WM_PLUGIN_NAME ),
40
  )
41
  );
lib/vendor/servmask/database/class-ai1wm-database.php CHANGED
@@ -147,8 +147,9 @@ abstract class Ai1wm_Database {
147
  if ( get_resource_type( $this->wpdb->dbh ) === 'SQL Server Connection' ) {
148
  throw new Ai1wm_Database_Exception(
149
  'Your WordPress installation uses Microsoft SQL Server. ' .
150
- 'In order to use All in One WP Migration, please change your installation to MySQL and try again. ' .
151
- '<a href="https://help.servmask.com/knowledgebase/microsoft-sql-server/" target="_blank">Technical details</a>'
 
152
  );
153
  }
154
  }
@@ -859,6 +860,39 @@ abstract class Ai1wm_Database {
859
  // Run SQL query
860
  $this->query( $query );
861
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
862
  }
863
 
864
  // Set query offset
@@ -1475,7 +1509,7 @@ abstract class Ai1wm_Database {
1475
  protected function get_header() {
1476
  // Some info about software, source and time
1477
  $header = sprintf(
1478
- "-- All In One WP Migration SQL Dump\n" .
1479
  "-- https://servmask.com/\n" .
1480
  "--\n" .
1481
  "-- Host: %s\n" .
147
  if ( get_resource_type( $this->wpdb->dbh ) === 'SQL Server Connection' ) {
148
  throw new Ai1wm_Database_Exception(
149
  'Your WordPress installation uses Microsoft SQL Server. ' .
150
+ 'To use All-in-One WP Migration, please change your installation to MySQL and try again. ' .
151
+ '<a href="https://help.servmask.com/knowledgebase/microsoft-sql-server/" target="_blank">Technical details</a>',
152
+ 501
153
  );
154
  }
155
  }
860
  // Run SQL query
861
  $this->query( $query );
862
  }
863
+
864
+ // Check max queries per hour
865
+ if ( $this->errno() === 1226 ) {
866
+ if ( stripos( $this->error(), 'max_queries_per_hour' ) !== false ) {
867
+ throw new Ai1wm_Database_Exception(
868
+ 'Your WordPress installation has reached the maximum allowed queries per hour set by your server admin or hosting provider. ' .
869
+ 'To use All-in-One WP Migration, please increase MySQL max_queries_per_hour limit. ' .
870
+ '<a href="https://help.servmask.com/knowledgebase/mysql-error-codes/#max-queries-per-hour" target="_blank">Technical details</a>',
871
+ 503
872
+ );
873
+ } elseif ( stripos( $this->error(), 'max_updates_per_hour' ) !== false ) {
874
+ throw new Ai1wm_Database_Exception(
875
+ 'Your WordPress installation has reached the maximum allowed updates per hour set by your server admin or hosting provider. ' .
876
+ 'To use All-in-One WP Migration, please increase MySQL max_updates_per_hour limit. ' .
877
+ '<a href="https://help.servmask.com/knowledgebase/mysql-error-codes/#max-updates-per-hour" target="_blank">Technical details</a>',
878
+ 503
879
+ );
880
+ } elseif ( stripos( $this->error(), 'max_connections_per_hour' ) !== false ) {
881
+ throw new Ai1wm_Database_Exception(
882
+ 'Your WordPress installation has reached the maximum allowed connections per hour set by your server admin or hosting provider. ' .
883
+ 'To use All-in-One WP Migration, please increase MySQL max_connections_per_hour limit. ' .
884
+ '<a href="https://help.servmask.com/knowledgebase/mysql-error-codes/#max-connections-per-hour" target="_blank">Technical details</a>',
885
+ 503
886
+ );
887
+ } elseif ( stripos( $this->error(), 'max_user_connections' ) !== false ) {
888
+ throw new Ai1wm_Database_Exception(
889
+ 'Your WordPress installation has reached the maximum allowed user connections set by your server admin or hosting provider. ' .
890
+ 'To use All-in-One WP Migration, please increase MySQL max_user_connections limit. ' .
891
+ '<a href="https://help.servmask.com/knowledgebase/mysql-error-codes/#max-user-connections" target="_blank">Technical details</a>',
892
+ 503
893
+ );
894
+ }
895
+ }
896
  }
897
 
898
  // Set query offset
1509
  protected function get_header() {
1510
  // Some info about software, source and time
1511
  $header = sprintf(
1512
+ "-- All-in-One WP Migration SQL Dump\n" .
1513
  "-- https://servmask.com/\n" .
1514
  "--\n" .
1515
  "-- Host: %s\n" .
lib/view/assets/javascript/backups.min.js CHANGED
@@ -350,9 +350,6 @@ var Import = function Import() {
350
  // Set params
351
  this.params = [];
352
 
353
- // Set stop flag
354
- this.stopImport = false;
355
-
356
  // Set modal
357
  this.modal = new Modal();
358
 
@@ -380,13 +377,13 @@ Import.prototype.start = function (options, retries) {
380
  var self = this;
381
  retries = retries || 0;
382
 
383
- // Set stop flag
384
  if (retries === 0) {
385
- this.stopImport = false;
386
  }
387
 
388
  // Stop running import
389
- if (this.stopImport) {
390
  return;
391
  }
392
 
@@ -421,14 +418,34 @@ Import.prototype.start = function (options, retries) {
421
  if (result) {
422
  self.run(result);
423
  }
424
- }).fail(function () {
425
  var timeout = retries * 1000;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
426
  if (retries >= 5) {
427
- return self.setStatus({
 
428
  type: 'error',
429
  title: ai1wm_locale.unable_to_import,
430
  message: ai1wm_locale.unable_to_start_the_import
431
  });
 
432
  }
433
 
434
  retries++;
@@ -442,7 +459,7 @@ Import.prototype.run = function (params, retries) {
442
  retries = retries || 0;
443
 
444
  // Stop running import
445
- if (this.stopImport) {
446
  return;
447
  }
448
 
@@ -459,9 +476,26 @@ Import.prototype.run = function (params, retries) {
459
  if (result) {
460
  self.run(result);
461
  }
462
- }).fail(function () {
463
  var timeout = retries * 1000;
464
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
465
  retries++;
466
 
467
  setTimeout(self.run.bind(self, params, retries), timeout);
@@ -473,7 +507,7 @@ Import.prototype.confirm = function (options, retries) {
473
  retries = retries || 0;
474
 
475
  // Stop running import
476
- if (this.stopImport) {
477
  return;
478
  }
479
 
@@ -500,14 +534,34 @@ Import.prototype.confirm = function (options, retries) {
500
  if (result) {
501
  self.run(result);
502
  }
503
- }).fail(function () {
504
  var timeout = retries * 1000;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
505
  if (retries >= 5) {
506
- return self.setStatus({
 
507
  type: 'error',
508
  title: ai1wm_locale.unable_to_import,
509
  message: ai1wm_locale.unable_to_confirm_the_import
510
  });
 
511
  }
512
 
513
  retries++;
@@ -521,7 +575,7 @@ Import.prototype.blogs = function (options, retries) {
521
  retries = retries || 0;
522
 
523
  // Stop running import
524
- if (this.stopImport) {
525
  return;
526
  }
527
 
@@ -548,14 +602,34 @@ Import.prototype.blogs = function (options, retries) {
548
  if (result) {
549
  self.run(result);
550
  }
551
- }).fail(function () {
552
  var timeout = retries * 1000;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
553
  if (retries >= 5) {
554
- return self.setStatus({
 
555
  type: 'error',
556
  title: ai1wm_locale.unable_to_import,
557
  message: ai1wm_locale.unable_to_prepare_blogs_on_import
558
  });
 
559
  }
560
 
561
  retries++;
@@ -568,8 +642,10 @@ Import.prototype.clean = function (options, retries) {
568
  var self = this;
569
  retries = retries || 0;
570
 
571
- // Set stop flag
572
- this.stopImport = true;
 
 
573
 
574
  // Set initial status
575
  this.setStatus({ type: 'info', message: ai1wm_locale.please_wait_stopping_the_import });
@@ -597,14 +673,34 @@ Import.prototype.clean = function (options, retries) {
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
  title: ai1wm_locale.unable_to_import,
606
  message: ai1wm_locale.unable_to_stop_the_import
607
  });
 
608
  }
609
 
610
  retries++;
@@ -617,11 +713,11 @@ Import.prototype.getStatus = function () {
617
  var self = this;
618
 
619
  // Stop getting status
620
- if (this.stopImport) {
621
  return;
622
  }
623
 
624
- $.ajax({
625
  url: ai1wm_import.status.url,
626
  type: 'GET',
627
  dataType: 'json',
@@ -671,6 +767,20 @@ Import.prototype.onStop = function (options) {
671
  this.clean(options);
672
  };
673
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
674
  module.exports = Import;
675
 
676
  /***/ }),
@@ -764,7 +874,8 @@ var Modal = function Modal() {
764
 
765
  // Update progress bar percent
766
  if (this.progress.progressBarPercent) {
767
- return this.progress.progressBarPercent.text(params.percent + '%');
 
768
  }
769
 
770
  // Create the modal container
@@ -1156,9 +1267,6 @@ var Export = function Export() {
1156
  // Set params
1157
  this.params = [];
1158
 
1159
- // Set stop flag
1160
- this.stopExport = false;
1161
-
1162
  // Set modal
1163
  this.modal = new Modal();
1164
 
@@ -1176,13 +1284,13 @@ Export.prototype.start = function (options, retries) {
1176
  var self = this;
1177
  retries = retries || 0;
1178
 
1179
- // Set stop flag
1180
  if (retries === 0) {
1181
- this.stopExport = false;
1182
  }
1183
 
1184
  // Stop running export
1185
- if (this.stopExport) {
1186
  return;
1187
  }
1188
 
@@ -1217,14 +1325,34 @@ Export.prototype.start = function (options, retries) {
1217
  if (result) {
1218
  self.run(result);
1219
  }
1220
- }).fail(function () {
1221
  var timeout = retries * 1000;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1222
  if (retries >= 5) {
1223
- return self.setStatus({
 
1224
  type: 'error',
1225
  title: ai1wm_locale.unable_to_export,
1226
  message: ai1wm_locale.unable_to_start_the_export
1227
  });
 
1228
  }
1229
 
1230
  retries++;
@@ -1238,7 +1366,7 @@ Export.prototype.run = function (params, retries) {
1238
  retries = retries || 0;
1239
 
1240
  // Stop running export
1241
- if (this.stopExport) {
1242
  return;
1243
  }
1244
 
@@ -1255,14 +1383,34 @@ Export.prototype.run = function (params, retries) {
1255
  if (result) {
1256
  self.run(result);
1257
  }
1258
- }).fail(function () {
1259
  var timeout = retries * 1000;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1260
  if (retries >= 5) {
1261
- return self.setStatus({
 
1262
  type: 'error',
1263
  title: ai1wm_locale.unable_to_export,
1264
  message: ai1wm_locale.unable_to_run_the_export
1265
  });
 
1266
  }
1267
 
1268
  retries++;
@@ -1275,8 +1423,10 @@ Export.prototype.clean = function (options, retries) {
1275
  var self = this;
1276
  retries = retries || 0;
1277
 
1278
- // Set stop flag
1279
- this.stopExport = true;
 
 
1280
 
1281
  // Set initial status
1282
  this.setStatus({ type: 'info', message: ai1wm_locale.please_wait_stopping_the_export });
@@ -1304,14 +1454,34 @@ Export.prototype.clean = function (options, retries) {
1304
 
1305
  // Destroy modal
1306
  self.modal.destroy();
1307
- }).fail(function () {
1308
  var timeout = retries * 1000;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1309
  if (retries >= 5) {
1310
- return self.setStatus({
 
1311
  type: 'error',
1312
  title: ai1wm_locale.unable_to_export,
1313
  message: ai1wm_locale.unable_to_stop_the_export
1314
  });
 
1315
  }
1316
 
1317
  retries++;
@@ -1324,11 +1494,11 @@ Export.prototype.getStatus = function () {
1324
  var self = this;
1325
 
1326
  // Stop getting status
1327
- if (this.stopExport) {
1328
  return;
1329
  }
1330
 
1331
- $.ajax({
1332
  url: ai1wm_export.status.url,
1333
  type: 'GET',
1334
  dataType: 'json',
@@ -1367,6 +1537,20 @@ Export.prototype.onStop = function (options) {
1367
  this.clean(options);
1368
  };
1369
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1370
  module.exports = Export;
1371
 
1372
  /***/ }),
350
  // Set params
351
  this.params = [];
352
 
 
 
 
353
  // Set modal
354
  this.modal = new Modal();
355
 
377
  var self = this;
378
  retries = retries || 0;
379
 
380
+ // Reset stop flag
381
  if (retries === 0) {
382
+ this.stopImport(false);
383
  }
384
 
385
  // Stop running import
386
+ if (this.isImportStopped()) {
387
  return;
388
  }
389
 
418
  if (result) {
419
  self.run(result);
420
  }
421
+ }).fail(function (xhr) {
422
  var timeout = retries * 1000;
423
+
424
+ try {
425
+ var json = Ai1wm.Util.json(xhr.responseText);
426
+ if (json) {
427
+ var result = JSON.parse(json);
428
+ var error = result.errors.pop();
429
+ if (error.message) {
430
+ self.stopImport(true);
431
+ self.setStatus({
432
+ type: 'error',
433
+ title: ai1wm_locale.unable_to_import,
434
+ message: error.message
435
+ });
436
+ return;
437
+ }
438
+ }
439
+ } catch (e) {}
440
+
441
  if (retries >= 5) {
442
+ self.stopImport(true);
443
+ self.setStatus({
444
  type: 'error',
445
  title: ai1wm_locale.unable_to_import,
446
  message: ai1wm_locale.unable_to_start_the_import
447
  });
448
+ return;
449
  }
450
 
451
  retries++;
459
  retries = retries || 0;
460
 
461
  // Stop running import
462
+ if (this.isImportStopped()) {
463
  return;
464
  }
465
 
476
  if (result) {
477
  self.run(result);
478
  }
479
+ }).fail(function (xhr) {
480
  var timeout = retries * 1000;
481
 
482
+ try {
483
+ var json = Ai1wm.Util.json(xhr.responseText);
484
+ if (json) {
485
+ var result = JSON.parse(json);
486
+ var error = result.errors.pop();
487
+ if (error.message) {
488
+ self.stopImport(true);
489
+ self.setStatus({
490
+ type: 'error',
491
+ title: ai1wm_locale.unable_to_import,
492
+ message: error.message
493
+ });
494
+ return;
495
+ }
496
+ }
497
+ } catch (e) {}
498
+
499
  retries++;
500
 
501
  setTimeout(self.run.bind(self, params, retries), timeout);
507
  retries = retries || 0;
508
 
509
  // Stop running import
510
+ if (this.isImportStopped()) {
511
  return;
512
  }
513
 
534
  if (result) {
535
  self.run(result);
536
  }
537
+ }).fail(function (xhr) {
538
  var timeout = retries * 1000;
539
+
540
+ try {
541
+ var json = Ai1wm.Util.json(xhr.responseText);
542
+ if (json) {
543
+ var result = JSON.parse(json);
544
+ var error = result.errors.pop();
545
+ if (error.message) {
546
+ self.stopImport(true);
547
+ self.setStatus({
548
+ type: 'error',
549
+ title: ai1wm_locale.unable_to_import,
550
+ message: error.message
551
+ });
552
+ return;
553
+ }
554
+ }
555
+ } catch (e) {}
556
+
557
  if (retries >= 5) {
558
+ self.stopImport(true);
559
+ self.setStatus({
560
  type: 'error',
561
  title: ai1wm_locale.unable_to_import,
562
  message: ai1wm_locale.unable_to_confirm_the_import
563
  });
564
+ return;
565
  }
566
 
567
  retries++;
575
  retries = retries || 0;
576
 
577
  // Stop running import
578
+ if (this.isImportStopped()) {
579
  return;
580
  }
581
 
602
  if (result) {
603
  self.run(result);
604
  }
605
+ }).fail(function (xhr) {
606
  var timeout = retries * 1000;
607
+
608
+ try {
609
+ var json = Ai1wm.Util.json(xhr.responseText);
610
+ if (json) {
611
+ var result = JSON.parse(json);
612
+ var error = result.errors.pop();
613
+ if (error.message) {
614
+ self.stopImport(true);
615
+ self.setStatus({
616
+ type: 'error',
617
+ title: ai1wm_locale.unable_to_import,
618
+ message: error.message
619
+ });
620
+ return;
621
+ }
622
+ }
623
+ } catch (e) {}
624
+
625
  if (retries >= 5) {
626
+ self.stopImport(true);
627
+ self.setStatus({
628
  type: 'error',
629
  title: ai1wm_locale.unable_to_import,
630
  message: ai1wm_locale.unable_to_prepare_blogs_on_import
631
  });
632
+ return;
633
  }
634
 
635
  retries++;
642
  var self = this;
643
  retries = retries || 0;
644
 
645
+ // Reset stop flag
646
+ if (retries === 0) {
647
+ this.stopImport(true);
648
+ }
649
 
650
  // Set initial status
651
  this.setStatus({ type: 'info', message: ai1wm_locale.please_wait_stopping_the_import });
673
 
674
  // Destroy modal
675
  self.modal.destroy();
676
+ }).fail(function (xhr) {
677
  var timeout = retries * 1000;
678
+
679
+ try {
680
+ var json = Ai1wm.Util.json(xhr.responseText);
681
+ if (json) {
682
+ var result = JSON.parse(json);
683
+ var error = result.errors.pop();
684
+ if (error.message) {
685
+ self.stopImport(true);
686
+ self.setStatus({
687
+ type: 'error',
688
+ title: ai1wm_locale.unable_to_import,
689
+ message: error.message
690
+ });
691
+ return;
692
+ }
693
+ }
694
+ } catch (e) {}
695
+
696
  if (retries >= 5) {
697
+ self.stopImport(true);
698
+ self.setStatus({
699
  type: 'error',
700
  title: ai1wm_locale.unable_to_import,
701
  message: ai1wm_locale.unable_to_stop_the_import
702
  });
703
+ return;
704
  }
705
 
706
  retries++;
713
  var self = this;
714
 
715
  // Stop getting status
716
+ if (this.isImportStopped()) {
717
  return;
718
  }
719
 
720
+ this.statusXhr = $.ajax({
721
  url: ai1wm_import.status.url,
722
  type: 'GET',
723
  dataType: 'json',
767
  this.clean(options);
768
  };
769
 
770
+ Import.prototype.stopImport = function (isStopped) {
771
+ try {
772
+ if (isStopped) {
773
+ this.statusXhr.abort();
774
+ }
775
+ } finally {
776
+ this.isStopped = isStopped;
777
+ }
778
+ };
779
+
780
+ Import.prototype.isImportStopped = function () {
781
+ return this.isStopped;
782
+ };
783
+
784
  module.exports = Import;
785
 
786
  /***/ }),
874
 
875
  // Update progress bar percent
876
  if (this.progress.progressBarPercent) {
877
+ this.progress.progressBarPercent.text(params.percent + '%');
878
+ return;
879
  }
880
 
881
  // Create the modal container
1267
  // Set params
1268
  this.params = [];
1269
 
 
 
 
1270
  // Set modal
1271
  this.modal = new Modal();
1272
 
1284
  var self = this;
1285
  retries = retries || 0;
1286
 
1287
+ // Reset stop flag
1288
  if (retries === 0) {
1289
+ this.stopExport(false);
1290
  }
1291
 
1292
  // Stop running export
1293
+ if (this.isExportStopped()) {
1294
  return;
1295
  }
1296
 
1325
  if (result) {
1326
  self.run(result);
1327
  }
1328
+ }).fail(function (xhr) {
1329
  var timeout = retries * 1000;
1330
+
1331
+ try {
1332
+ var json = Ai1wm.Util.json(xhr.responseText);
1333
+ if (json) {
1334
+ var result = JSON.parse(json);
1335
+ var error = result.errors.pop();
1336
+ if (error.message) {
1337
+ self.stopExport(true);
1338
+ self.setStatus({
1339
+ type: 'error',
1340
+ title: ai1wm_locale.unable_to_export,
1341
+ message: error.message
1342
+ });
1343
+ return;
1344
+ }
1345
+ }
1346
+ } catch (e) {}
1347
+
1348
  if (retries >= 5) {
1349
+ self.stopExport(true);
1350
+ self.setStatus({
1351
  type: 'error',
1352
  title: ai1wm_locale.unable_to_export,
1353
  message: ai1wm_locale.unable_to_start_the_export
1354
  });
1355
+ return;
1356
  }
1357
 
1358
  retries++;
1366
  retries = retries || 0;
1367
 
1368
  // Stop running export
1369
+ if (this.isExportStopped()) {
1370
  return;
1371
  }
1372
 
1383
  if (result) {
1384
  self.run(result);
1385
  }
1386
+ }).fail(function (xhr) {
1387
  var timeout = retries * 1000;
1388
+
1389
+ try {
1390
+ var json = Ai1wm.Util.json(xhr.responseText);
1391
+ if (json) {
1392
+ var result = JSON.parse(json);
1393
+ var error = result.errors.pop();
1394
+ if (error.message) {
1395
+ self.stopExport(true);
1396
+ self.setStatus({
1397
+ type: 'error',
1398
+ title: ai1wm_locale.unable_to_export,
1399
+ message: error.message
1400
+ });
1401
+ return;
1402
+ }
1403
+ }
1404
+ } catch (e) {}
1405
+
1406
  if (retries >= 5) {
1407
+ self.stopExport(true);
1408
+ self.setStatus({
1409
  type: 'error',
1410
  title: ai1wm_locale.unable_to_export,
1411
  message: ai1wm_locale.unable_to_run_the_export
1412
  });
1413
+ return;
1414
  }
1415
 
1416
  retries++;
1423
  var self = this;
1424
  retries = retries || 0;
1425
 
1426
+ // Reset stop flag
1427
+ if (retries === 0) {
1428
+ this.stopExport(true);
1429
+ }
1430
 
1431
  // Set initial status
1432
  this.setStatus({ type: 'info', message: ai1wm_locale.please_wait_stopping_the_export });
1454
 
1455
  // Destroy modal
1456
  self.modal.destroy();
1457
+ }).fail(function (xhr) {
1458
  var timeout = retries * 1000;
1459
+
1460
+ try {
1461
+ var json = Ai1wm.Util.json(xhr.responseText);
1462
+ if (json) {
1463
+ var result = JSON.parse(json);
1464
+ var error = result.errors.pop();
1465
+ if (error.message) {
1466
+ self.stopExport(true);
1467
+ self.setStatus({
1468
+ type: 'error',
1469
+ title: ai1wm_locale.unable_to_export,
1470
+ message: error.message
1471
+ });
1472
+ return;
1473
+ }
1474
+ }
1475
+ } catch (e) {}
1476
+
1477
  if (retries >= 5) {
1478
+ self.stopExport(true);
1479
+ self.setStatus({
1480
  type: 'error',
1481
  title: ai1wm_locale.unable_to_export,
1482
  message: ai1wm_locale.unable_to_stop_the_export
1483
  });
1484
+ return;
1485
  }
1486
 
1487
  retries++;
1494
  var self = this;
1495
 
1496
  // Stop getting status
1497
+ if (this.isExportStopped()) {
1498
  return;
1499
  }
1500
 
1501
+ this.statusXhr = $.ajax({
1502
  url: ai1wm_export.status.url,
1503
  type: 'GET',
1504
  dataType: 'json',
1537
  this.clean(options);
1538
  };
1539
 
1540
+ Export.prototype.stopExport = function (isStopped) {
1541
+ try {
1542
+ if (isStopped) {
1543
+ this.statusXhr.abort();
1544
+ }
1545
+ } finally {
1546
+ this.isStopped = isStopped;
1547
+ }
1548
+ };
1549
+
1550
+ Export.prototype.isExportStopped = function () {
1551
+ return this.isStopped;
1552
+ };
1553
+
1554
  module.exports = Export;
1555
 
1556
  /***/ }),
lib/view/assets/javascript/export.min.js CHANGED
@@ -352,9 +352,6 @@ var Export = function Export() {
352
  // Set params
353
  this.params = [];
354
 
355
- // Set stop flag
356
- this.stopExport = false;
357
-
358
  // Set modal
359
  this.modal = new Modal();
360
 
@@ -372,13 +369,13 @@ Export.prototype.start = function (options, retries) {
372
  var self = this;
373
  retries = retries || 0;
374
 
375
- // Set stop flag
376
  if (retries === 0) {
377
- this.stopExport = false;
378
  }
379
 
380
  // Stop running export
381
- if (this.stopExport) {
382
  return;
383
  }
384
 
@@ -413,14 +410,34 @@ Export.prototype.start = function (options, retries) {
413
  if (result) {
414
  self.run(result);
415
  }
416
- }).fail(function () {
417
  var timeout = retries * 1000;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
418
  if (retries >= 5) {
419
- return self.setStatus({
 
420
  type: 'error',
421
  title: ai1wm_locale.unable_to_export,
422
  message: ai1wm_locale.unable_to_start_the_export
423
  });
 
424
  }
425
 
426
  retries++;
@@ -434,7 +451,7 @@ Export.prototype.run = function (params, retries) {
434
  retries = retries || 0;
435
 
436
  // Stop running export
437
- if (this.stopExport) {
438
  return;
439
  }
440
 
@@ -451,14 +468,34 @@ Export.prototype.run = function (params, retries) {
451
  if (result) {
452
  self.run(result);
453
  }
454
- }).fail(function () {
455
  var timeout = retries * 1000;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
456
  if (retries >= 5) {
457
- return self.setStatus({
 
458
  type: 'error',
459
  title: ai1wm_locale.unable_to_export,
460
  message: ai1wm_locale.unable_to_run_the_export
461
  });
 
462
  }
463
 
464
  retries++;
@@ -471,8 +508,10 @@ Export.prototype.clean = function (options, retries) {
471
  var self = this;
472
  retries = retries || 0;
473
 
474
- // Set stop flag
475
- this.stopExport = true;
 
 
476
 
477
  // Set initial status
478
  this.setStatus({ type: 'info', message: ai1wm_locale.please_wait_stopping_the_export });
@@ -500,14 +539,34 @@ Export.prototype.clean = function (options, retries) {
500
 
501
  // Destroy modal
502
  self.modal.destroy();
503
- }).fail(function () {
504
  var timeout = retries * 1000;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
505
  if (retries >= 5) {
506
- return self.setStatus({
 
507
  type: 'error',
508
  title: ai1wm_locale.unable_to_export,
509
  message: ai1wm_locale.unable_to_stop_the_export
510
  });
 
511
  }
512
 
513
  retries++;
@@ -520,11 +579,11 @@ Export.prototype.getStatus = function () {
520
  var self = this;
521
 
522
  // Stop getting status
523
- if (this.stopExport) {
524
  return;
525
  }
526
 
527
- $.ajax({
528
  url: ai1wm_export.status.url,
529
  type: 'GET',
530
  dataType: 'json',
@@ -563,6 +622,20 @@ Export.prototype.onStop = function (options) {
563
  this.clean(options);
564
  };
565
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
566
  module.exports = Export;
567
 
568
  /***/ }),
352
  // Set params
353
  this.params = [];
354
 
 
 
 
355
  // Set modal
356
  this.modal = new Modal();
357
 
369
  var self = this;
370
  retries = retries || 0;
371
 
372
+ // Reset stop flag
373
  if (retries === 0) {
374
+ this.stopExport(false);
375
  }
376
 
377
  // Stop running export
378
+ if (this.isExportStopped()) {
379
  return;
380
  }
381
 
410
  if (result) {
411
  self.run(result);
412
  }
413
+ }).fail(function (xhr) {
414
  var timeout = retries * 1000;
415
+
416
+ try {
417
+ var json = Ai1wm.Util.json(xhr.responseText);
418
+ if (json) {
419
+ var result = JSON.parse(json);
420
+ var error = result.errors.pop();
421
+ if (error.message) {
422
+ self.stopExport(true);
423
+ self.setStatus({
424
+ type: 'error',
425
+ title: ai1wm_locale.unable_to_export,
426
+ message: error.message
427
+ });
428
+ return;
429
+ }
430
+ }
431
+ } catch (e) {}
432
+
433
  if (retries >= 5) {
434
+ self.stopExport(true);
435
+ self.setStatus({
436
  type: 'error',
437
  title: ai1wm_locale.unable_to_export,
438
  message: ai1wm_locale.unable_to_start_the_export
439
  });
440
+ return;
441
  }
442
 
443
  retries++;
451
  retries = retries || 0;
452
 
453
  // Stop running export
454
+ if (this.isExportStopped()) {
455
  return;
456
  }
457
 
468
  if (result) {
469
  self.run(result);
470
  }
471
+ }).fail(function (xhr) {
472
  var timeout = retries * 1000;
473
+
474
+ try {
475
+ var json = Ai1wm.Util.json(xhr.responseText);
476
+ if (json) {
477
+ var result = JSON.parse(json);
478
+ var error = result.errors.pop();
479
+ if (error.message) {
480
+ self.stopExport(true);
481
+ self.setStatus({
482
+ type: 'error',
483
+ title: ai1wm_locale.unable_to_export,
484
+ message: error.message
485
+ });
486
+ return;
487
+ }
488
+ }
489
+ } catch (e) {}
490
+
491
  if (retries >= 5) {
492
+ self.stopExport(true);
493
+ self.setStatus({
494
  type: 'error',
495
  title: ai1wm_locale.unable_to_export,
496
  message: ai1wm_locale.unable_to_run_the_export
497
  });
498
+ return;
499
  }
500
 
501
  retries++;
508
  var self = this;
509
  retries = retries || 0;
510
 
511
+ // Reset stop flag
512
+ if (retries === 0) {
513
+ this.stopExport(true);
514
+ }
515
 
516
  // Set initial status
517
  this.setStatus({ type: 'info', message: ai1wm_locale.please_wait_stopping_the_export });
539
 
540
  // Destroy modal
541
  self.modal.destroy();
542
+ }).fail(function (xhr) {
543
  var timeout = retries * 1000;
544
+
545
+ try {
546
+ var json = Ai1wm.Util.json(xhr.responseText);
547
+ if (json) {
548
+ var result = JSON.parse(json);
549
+ var error = result.errors.pop();
550
+ if (error.message) {
551
+ self.stopExport(true);
552
+ self.setStatus({
553
+ type: 'error',
554
+ title: ai1wm_locale.unable_to_export,
555
+ message: error.message
556
+ });
557
+ return;
558
+ }
559
+ }
560
+ } catch (e) {}
561
+
562
  if (retries >= 5) {
563
+ self.stopExport(true);
564
+ self.setStatus({
565
  type: 'error',
566
  title: ai1wm_locale.unable_to_export,
567
  message: ai1wm_locale.unable_to_stop_the_export
568
  });
569
+ return;
570
  }
571
 
572
  retries++;
579
  var self = this;
580
 
581
  // Stop getting status
582
+ if (this.isExportStopped()) {
583
  return;
584
  }
585
 
586
+ this.statusXhr = $.ajax({
587
  url: ai1wm_export.status.url,
588
  type: 'GET',
589
  dataType: 'json',
622
  this.clean(options);
623
  };
624
 
625
+ Export.prototype.stopExport = function (isStopped) {
626
+ try {
627
+ if (isStopped) {
628
+ this.statusXhr.abort();
629
+ }
630
+ } finally {
631
+ this.isStopped = isStopped;
632
+ }
633
+ };
634
+
635
+ Export.prototype.isExportStopped = function () {
636
+ return this.isStopped;
637
+ };
638
+
639
  module.exports = Export;
640
 
641
  /***/ }),
lib/view/assets/javascript/import.min.js CHANGED
@@ -350,9 +350,6 @@ var Import = function Import() {
350
  // Set params
351
  this.params = [];
352
 
353
- // Set stop flag
354
- this.stopImport = false;
355
-
356
  // Set modal
357
  this.modal = new Modal();
358
 
@@ -380,13 +377,13 @@ Import.prototype.start = function (options, retries) {
380
  var self = this;
381
  retries = retries || 0;
382
 
383
- // Set stop flag
384
  if (retries === 0) {
385
- this.stopImport = false;
386
  }
387
 
388
  // Stop running import
389
- if (this.stopImport) {
390
  return;
391
  }
392
 
@@ -421,14 +418,34 @@ Import.prototype.start = function (options, retries) {
421
  if (result) {
422
  self.run(result);
423
  }
424
- }).fail(function () {
425
  var timeout = retries * 1000;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
426
  if (retries >= 5) {
427
- return self.setStatus({
 
428
  type: 'error',
429
  title: ai1wm_locale.unable_to_import,
430
  message: ai1wm_locale.unable_to_start_the_import
431
  });
 
432
  }
433
 
434
  retries++;
@@ -442,7 +459,7 @@ Import.prototype.run = function (params, retries) {
442
  retries = retries || 0;
443
 
444
  // Stop running import
445
- if (this.stopImport) {
446
  return;
447
  }
448
 
@@ -459,9 +476,26 @@ Import.prototype.run = function (params, retries) {
459
  if (result) {
460
  self.run(result);
461
  }
462
- }).fail(function () {
463
  var timeout = retries * 1000;
464
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
465
  retries++;
466
 
467
  setTimeout(self.run.bind(self, params, retries), timeout);
@@ -473,7 +507,7 @@ Import.prototype.confirm = function (options, retries) {
473
  retries = retries || 0;
474
 
475
  // Stop running import
476
- if (this.stopImport) {
477
  return;
478
  }
479
 
@@ -500,14 +534,34 @@ Import.prototype.confirm = function (options, retries) {
500
  if (result) {
501
  self.run(result);
502
  }
503
- }).fail(function () {
504
  var timeout = retries * 1000;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
505
  if (retries >= 5) {
506
- return self.setStatus({
 
507
  type: 'error',
508
  title: ai1wm_locale.unable_to_import,
509
  message: ai1wm_locale.unable_to_confirm_the_import
510
  });
 
511
  }
512
 
513
  retries++;
@@ -521,7 +575,7 @@ Import.prototype.blogs = function (options, retries) {
521
  retries = retries || 0;
522
 
523
  // Stop running import
524
- if (this.stopImport) {
525
  return;
526
  }
527
 
@@ -548,14 +602,34 @@ Import.prototype.blogs = function (options, retries) {
548
  if (result) {
549
  self.run(result);
550
  }
551
- }).fail(function () {
552
  var timeout = retries * 1000;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
553
  if (retries >= 5) {
554
- return self.setStatus({
 
555
  type: 'error',
556
  title: ai1wm_locale.unable_to_import,
557
  message: ai1wm_locale.unable_to_prepare_blogs_on_import
558
  });
 
559
  }
560
 
561
  retries++;
@@ -568,8 +642,10 @@ Import.prototype.clean = function (options, retries) {
568
  var self = this;
569
  retries = retries || 0;
570
 
571
- // Set stop flag
572
- this.stopImport = true;
 
 
573
 
574
  // Set initial status
575
  this.setStatus({ type: 'info', message: ai1wm_locale.please_wait_stopping_the_import });
@@ -597,14 +673,34 @@ Import.prototype.clean = function (options, retries) {
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
  title: ai1wm_locale.unable_to_import,
606
  message: ai1wm_locale.unable_to_stop_the_import
607
  });
 
608
  }
609
 
610
  retries++;
@@ -617,11 +713,11 @@ Import.prototype.getStatus = function () {
617
  var self = this;
618
 
619
  // Stop getting status
620
- if (this.stopImport) {
621
  return;
622
  }
623
 
624
- $.ajax({
625
  url: ai1wm_import.status.url,
626
  type: 'GET',
627
  dataType: 'json',
@@ -671,6 +767,20 @@ Import.prototype.onStop = function (options) {
671
  this.clean(options);
672
  };
673
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
674
  module.exports = Import;
675
 
676
  /***/ }),
@@ -764,7 +874,8 @@ var Modal = function Modal() {
764
 
765
  // Update progress bar percent
766
  if (this.progress.progressBarPercent) {
767
- return this.progress.progressBarPercent.text(params.percent + '%');
 
768
  }
769
 
770
  // Create the modal container
350
  // Set params
351
  this.params = [];
352
 
 
 
 
353
  // Set modal
354
  this.modal = new Modal();
355
 
377
  var self = this;
378
  retries = retries || 0;
379
 
380
+ // Reset stop flag
381
  if (retries === 0) {
382
+ this.stopImport(false);
383
  }
384
 
385
  // Stop running import
386
+ if (this.isImportStopped()) {
387
  return;
388
  }
389
 
418
  if (result) {
419
  self.run(result);
420
  }
421
+ }).fail(function (xhr) {
422
  var timeout = retries * 1000;
423
+
424
+ try {
425
+ var json = Ai1wm.Util.json(xhr.responseText);
426
+ if (json) {
427
+ var result = JSON.parse(json);
428
+ var error = result.errors.pop();
429
+ if (error.message) {
430
+ self.stopImport(true);
431
+ self.setStatus({
432
+ type: 'error',
433
+ title: ai1wm_locale.unable_to_import,
434
+ message: error.message
435
+ });
436
+ return;
437
+ }
438
+ }
439
+ } catch (e) {}
440
+
441
  if (retries >= 5) {
442
+ self.stopImport(true);
443
+ self.setStatus({
444
  type: 'error',
445
  title: ai1wm_locale.unable_to_import,
446
  message: ai1wm_locale.unable_to_start_the_import
447
  });
448
+ return;
449
  }
450
 
451
  retries++;
459
  retries = retries || 0;
460
 
461
  // Stop running import
462
+ if (this.isImportStopped()) {
463
  return;
464
  }
465
 
476
  if (result) {
477
  self.run(result);
478
  }
479
+ }).fail(function (xhr) {
480
  var timeout = retries * 1000;
481
 
482
+ try {
483
+ var json = Ai1wm.Util.json(xhr.responseText);
484
+ if (json) {
485
+ var result = JSON.parse(json);
486
+ var error = result.errors.pop();
487
+ if (error.message) {
488
+ self.stopImport(true);
489
+ self.setStatus({
490
+ type: 'error',
491
+ title: ai1wm_locale.unable_to_import,
492
+ message: error.message
493
+ });
494
+ return;
495
+ }
496
+ }
497
+ } catch (e) {}
498
+
499
  retries++;
500
 
501
  setTimeout(self.run.bind(self, params, retries), timeout);
507
  retries = retries || 0;
508
 
509
  // Stop running import
510
+ if (this.isImportStopped()) {
511
  return;
512
  }
513
 
534
  if (result) {
535
  self.run(result);
536
  }
537
+ }).fail(function (xhr) {
538
  var timeout = retries * 1000;
539
+
540
+ try {
541
+ var json = Ai1wm.Util.json(xhr.responseText);
542
+ if (json) {
543
+ var result = JSON.parse(json);
544
+ var error = result.errors.pop();
545
+ if (error.message) {
546
+ self.stopImport(true);
547
+ self.setStatus({
548
+ type: 'error',
549
+ title: ai1wm_locale.unable_to_import,
550
+ message: error.message
551
+ });
552
+ return;
553
+ }
554
+ }
555
+ } catch (e) {}
556
+
557
  if (retries >= 5) {
558
+ self.stopImport(true);
559
+ self.setStatus({
560
  type: 'error',
561
  title: ai1wm_locale.unable_to_import,
562
  message: ai1wm_locale.unable_to_confirm_the_import
563
  });
564
+ return;
565
  }
566
 
567
  retries++;
575
  retries = retries || 0;
576
 
577
  // Stop running import
578
+ if (this.isImportStopped()) {
579
  return;
580
  }
581
 
602
  if (result) {
603
  self.run(result);
604
  }
605
+ }).fail(function (xhr) {
606
  var timeout = retries * 1000;
607
+
608
+ try {
609
+ var json = Ai1wm.Util.json(xhr.responseText);
610
+ if (json) {
611
+ var result = JSON.parse(json);
612
+ var error = result.errors.pop();
613
+ if (error.message) {
614
+ self.stopImport(true);
615
+ self.setStatus({
616
+ type: 'error',
617
+ title: ai1wm_locale.unable_to_import,
618
+ message: error.message
619
+ });
620
+ return;
621
+ }
622
+ }
623
+ } catch (e) {}
624
+
625
  if (retries >= 5) {
626
+ self.stopImport(true);
627
+ self.setStatus({
628
  type: 'error',
629
  title: ai1wm_locale.unable_to_import,
630
  message: ai1wm_locale.unable_to_prepare_blogs_on_import
631
  });
632
+ return;
633
  }
634
 
635
  retries++;
642
  var self = this;
643
  retries = retries || 0;
644
 
645
+ // Reset stop flag
646
+ if (retries === 0) {
647
+ this.stopImport(true);
648
+ }
649
 
650
  // Set initial status
651
  this.setStatus({ type: 'info', message: ai1wm_locale.please_wait_stopping_the_import });
673
 
674
  // Destroy modal
675
  self.modal.destroy();
676
+ }).fail(function (xhr) {
677
  var timeout = retries * 1000;
678
+
679
+ try {
680
+ var json = Ai1wm.Util.json(xhr.responseText);
681
+ if (json) {
682
+ var result = JSON.parse(json);
683
+ var error = result.errors.pop();
684
+ if (error.message) {
685
+ self.stopImport(true);
686
+ self.setStatus({
687
+ type: 'error',
688
+ title: ai1wm_locale.unable_to_import,
689
+ message: error.message
690
+ });
691
+ return;
692
+ }
693
+ }
694
+ } catch (e) {}
695
+
696
  if (retries >= 5) {
697
+ self.stopImport(true);
698
+ self.setStatus({
699
  type: 'error',
700
  title: ai1wm_locale.unable_to_import,
701
  message: ai1wm_locale.unable_to_stop_the_import
702
  });
703
+ return;
704
  }
705
 
706
  retries++;
713
  var self = this;
714
 
715
  // Stop getting status
716
+ if (this.isImportStopped()) {
717
  return;
718
  }
719
 
720
+ this.statusXhr = $.ajax({
721
  url: ai1wm_import.status.url,
722
  type: 'GET',
723
  dataType: 'json',
767
  this.clean(options);
768
  };
769
 
770
+ Import.prototype.stopImport = function (isStopped) {
771
+ try {
772
+ if (isStopped) {
773
+ this.statusXhr.abort();
774
+ }
775
+ } finally {
776
+ this.isStopped = isStopped;
777
+ }
778
+ };
779
+
780
+ Import.prototype.isImportStopped = function () {
781
+ return this.isStopped;
782
+ };
783
+
784
  module.exports = Import;
785
 
786
  /***/ }),
874
 
875
  // Update progress bar percent
876
  if (this.progress.progressBarPercent) {
877
+ this.progress.progressBarPercent.text(params.percent + '%');
878
+ return;
879
  }
880
 
881
  // Create the modal container
lib/view/main/backups-htaccess-notice.php CHANGED
@@ -33,7 +33,7 @@ if ( ! defined( 'ABSPATH' ) ) {
33
  <?php
34
  printf(
35
  __(
36
- 'All in One WP Migration is not able to create <strong>%s</strong> file. ' .
37
  'Try to change permissions of the parent folder or send us an email at ' .
38
  '<a href="mailto:support@servmask.com">support@servmask.com</a> for assistance.',
39
  AI1WM_PLUGIN_NAME
33
  <?php
34
  printf(
35
  __(
36
+ 'All-in-One WP Migration is not able to create <strong>%s</strong> file. ' .
37
  'Try to change permissions of the parent folder or send us an email at ' .
38
  '<a href="mailto:support@servmask.com">support@servmask.com</a> for assistance.',
39
  AI1WM_PLUGIN_NAME
lib/view/main/backups-index-notice.php CHANGED
@@ -33,7 +33,7 @@ if ( ! defined( 'ABSPATH' ) ) {
33
  <?php
34
  printf(
35
  __(
36
- 'All in One WP Migration is not able to create <strong>%s</strong> file. ' .
37
  'Try to change permissions of the parent folder or send us an email at ' .
38
  '<a href="mailto:support@servmask.com">support@servmask.com</a> for assistance.',
39
  AI1WM_PLUGIN_NAME
33
  <?php
34
  printf(
35
  __(
36
+ 'All-in-One WP Migration is not able to create <strong>%s</strong> file. ' .
37
  'Try to change permissions of the parent folder or send us an email at ' .
38
  '<a href="mailto:support@servmask.com">support@servmask.com</a> for assistance.',
39
  AI1WM_PLUGIN_NAME
lib/view/main/backups-path-notice.php CHANGED
@@ -33,9 +33,9 @@ if ( ! defined( 'ABSPATH' ) ) {
33
  <?php
34
  printf(
35
  __(
36
- 'All in One WP Migration is not able to create <strong>%s</strong> folder. ' .
37
  'You will need to create this folder and grant it read/write/execute permissions (0777) ' .
38
- 'for the All in One WP Migration plugin to function properly.',
39
  AI1WM_PLUGIN_NAME
40
  ),
41
  AI1WM_BACKUPS_PATH
33
  <?php
34
  printf(
35
  __(
36
+ 'All-in-One WP Migration is not able to create <strong>%s</strong> folder. ' .
37
  'You will need to create this folder and grant it read/write/execute permissions (0777) ' .
38
+ 'for the All-in-One WP Migration plugin to function properly.',
39
  AI1WM_PLUGIN_NAME
40
  ),
41
  AI1WM_BACKUPS_PATH
lib/view/main/backups-webconfig-notice.php CHANGED
@@ -33,7 +33,7 @@ if ( ! defined( 'ABSPATH' ) ) {
33
  <?php
34
  printf(
35
  __(
36
- 'All in One WP Migration is not able to create <strong>%s</strong> file. ' .
37
  'Try to change permissions of the parent folder or send us an email at ' .
38
  '<a href="mailto:support@servmask.com">support@servmask.com</a> for assistance.',
39
  AI1WM_PLUGIN_NAME
33
  <?php
34
  printf(
35
  __(
36
+ 'All-in-One WP Migration is not able to create <strong>%s</strong> file. ' .
37
  'Try to change permissions of the parent folder or send us an email at ' .
38
  '<a href="mailto:support@servmask.com">support@servmask.com</a> for assistance.',
39
  AI1WM_PLUGIN_NAME
lib/view/main/multisite-notice.php CHANGED
@@ -32,7 +32,7 @@ if ( ! defined( 'ABSPATH' ) ) {
32
  <p>
33
  <?php
34
  _e(
35
- 'WordPress Multisite is supported via our All in One WP Migration Multisite Extension. ' .
36
  'You can get a copy of it here',
37
  AI1WM_PLUGIN_NAME
38
  );
32
  <p>
33
  <?php
34
  _e(
35
+ 'WordPress Multisite is supported via our All-in-One WP Migration Multisite Extension. ' .
36
  'You can get a copy of it here',
37
  AI1WM_PLUGIN_NAME
38
  );
lib/view/main/storage-index-notice.php CHANGED
@@ -33,7 +33,7 @@ if ( ! defined( 'ABSPATH' ) ) {
33
  <?php
34
  printf(
35
  __(
36
- 'All in One WP Migration is not able to create <strong>%s</strong> file. ' .
37
  'Try to change permissions of the parent folder or send us an email at ' .
38
  '<a href="mailto:support@servmask.com">support@servmask.com</a> for assistance.',
39
  AI1WM_PLUGIN_NAME
33
  <?php
34
  printf(
35
  __(
36
+ 'All-in-One WP Migration is not able to create <strong>%s</strong> file. ' .
37
  'Try to change permissions of the parent folder or send us an email at ' .
38
  '<a href="mailto:support@servmask.com">support@servmask.com</a> for assistance.',
39
  AI1WM_PLUGIN_NAME
lib/view/main/storage-path-notice.php CHANGED
@@ -33,9 +33,9 @@ if ( ! defined( 'ABSPATH' ) ) {
33
  <?php
34
  printf(
35
  __(
36
- 'All in One WP Migration is not able to create <strong>%s</strong> folder. ' .
37
  'You will need to create this folder and grant it read/write/execute permissions (0777) ' .
38
- 'for the All in One WP Migration plugin to function properly.',
39
  AI1WM_PLUGIN_NAME
40
  ),
41
  AI1WM_STORAGE_PATH
33
  <?php
34
  printf(
35
  __(
36
+ 'All-in-One WP Migration is not able to create <strong>%s</strong> folder. ' .
37
  'You will need to create this folder and grant it read/write/execute permissions (0777) ' .
38
+ 'for the All-in-One WP Migration plugin to function properly.',
39
  AI1WM_PLUGIN_NAME
40
  ),
41
  AI1WM_STORAGE_PATH
lib/view/main/wordpress-htaccess-notice.php CHANGED
@@ -33,7 +33,7 @@ if ( ! defined( 'ABSPATH' ) ) {
33
  <?php
34
  printf(
35
  __(
36
- 'All in One WP Migration is not able to create <strong>%s</strong> file. ' .
37
  'Try to change permissions of the parent folder or send us an email at ' .
38
  '<a href="mailto:support@servmask.com">support@servmask.com</a> for assistance.',
39
  AI1WM_PLUGIN_NAME
33
  <?php
34
  printf(
35
  __(
36
+ 'All-in-One WP Migration is not able to create <strong>%s</strong> file. ' .
37
  'Try to change permissions of the parent folder or send us an email at ' .
38
  '<a href="mailto:support@servmask.com">support@servmask.com</a> for assistance.',
39
  AI1WM_PLUGIN_NAME
readme.txt CHANGED
@@ -4,7 +4,7 @@ Tags: move, transfer, copy, migrate, backup, clone, restore, db migration, wordp
4
  Requires at least: 3.3
5
  Tested up to: 5.3
6
  Requires PHP: 5.2.17
7
- Stable tag: 7.11
8
  License: GPLv2 or later
9
 
10
  Move, transfer, copy, migrate, and backup a site with 1-click. Quick, easy, and reliable.
@@ -108,6 +108,11 @@ Alternatively you can download the plugin using the download button on this page
108
  All-in-One WP Migration **asks for your consent** to collect **requester's email address** when filling plugin's contact form. [GDPR Compliant Privacy Policy](https://www.iubenda.com/privacy-policy/946881)
109
 
110
  == Changelog ==
 
 
 
 
 
111
  = 7.11 =
112
  **Added**
113
 
4
  Requires at least: 3.3
5
  Tested up to: 5.3
6
  Requires PHP: 5.2.17
7
+ Stable tag: 7.12
8
  License: GPLv2 or later
9
 
10
  Move, transfer, copy, migrate, and backup a site with 1-click. Quick, easy, and reliable.
108
  All-in-One WP Migration **asks for your consent** to collect **requester's email address** when filling plugin's contact form. [GDPR Compliant Privacy Policy](https://www.iubenda.com/privacy-policy/946881)
109
 
110
  == Changelog ==
111
+ = 7.12 =
112
+ **Added**
113
+
114
+ * Display a message when MySQL server [exceeds a limit](https://help.servmask.com/knowledgebase/mysql-error-codes/)
115
+
116
  = 7.11 =
117
  **Added**
118