XCloner – Backup and Restore - Version 4.1.1

Version Description

  • log tmp directories fix, tracking only ERROR reports from php
  • security improvement backup log name
  • database restore resume fix
  • memory limit fix
Download this release

Release Info

Developer xcloner
Plugin Icon 128x128 XCloner – Backup and Restore
Version 4.1.1
Comparing to
See all releases

Code changes from version 4.1.0 to 4.1.1

README.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: xcloner
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=AAPE8PLAE554S
4
  Tags: backup plugin, restore plugin, database backup, backup encryption, site backup, website cloner, wordpress backup, database restore, webdav, azure, ftp, sftp, amazon s3, dropbox, google drive, differential backup
5
  Requires at least: 3.0.1
6
- Tested up to: 5.0
7
- Stable tag: 4.1.0
8
 
9
  Backup your site, restore to any web location, encrypt and send your backups to Dropbox, Amazon S3, Azure, FTP, SFTP, WebDAV, Google Drive with XCloner plugin.
10
 
@@ -114,6 +114,12 @@ Immigration Attorney Montana <a href="https://www.immigrationlawofmt.com" target
114
 
115
  == Changelog ==
116
 
 
 
 
 
 
 
117
  = 4.1.0 =
118
  * added AES-128-CBC backup encryption and decryption option
119
  * manage backup fixes
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=AAPE8PLAE554S
4
  Tags: backup plugin, restore plugin, database backup, backup encryption, site backup, website cloner, wordpress backup, database restore, webdav, azure, ftp, sftp, amazon s3, dropbox, google drive, differential backup
5
  Requires at least: 3.0.1
6
+ Tested up to: 5.1
7
+ Stable tag: 4.1.1
8
 
9
  Backup your site, restore to any web location, encrypt and send your backups to Dropbox, Amazon S3, Azure, FTP, SFTP, WebDAV, Google Drive with XCloner plugin.
10
 
114
 
115
  == Changelog ==
116
 
117
+ = 4.1.1 =
118
+ * log tmp directories fix, tracking only ERROR reports from php
119
+ * security improvement backup log name
120
+ * database restore resume fix
121
+ * memory limit fix
122
+
123
  = 4.1.0 =
124
  * added AES-128-CBC backup encryption and decryption option
125
  * manage backup fixes
admin/js/xcloner-restore-class.js CHANGED
@@ -262,6 +262,7 @@ class Xcloner_Restore{
262
  {
263
  this.ajaxurl = this.restore_script_url;
264
  this.set_cancel(false);
 
265
 
266
 
267
  if(this.resume.callback == "get_remote_mysqldump_files_callback")
@@ -365,8 +366,14 @@ class Xcloner_Restore{
365
  this.do_ajax(this.resume.callback, this.resume.action, this.resume.params);
366
  this.resume = new Object();
367
  return;
368
- }
369
- document.dispatchEvent(new CustomEvent("xcloner_restore_update_progress", {detail: {percent: 0, class: 'indeterminate' }}));
 
 
 
 
 
 
370
  document.dispatchEvent(new CustomEvent("remote_restore_update_files_list", {detail: {files: ""}}));
371
 
372
  this.do_ajax('remote_restore_backup_file_callback', 'restore_backup_to_path', params)
@@ -374,14 +381,23 @@ class Xcloner_Restore{
374
 
375
  remote_restore_mysql_backup_file_callback(response, status, params = new Object())
376
  {
 
 
 
 
 
 
 
377
  if(!status)
378
  {
379
- this.start = response.statusText.start;
 
380
  document.dispatchEvent(new CustomEvent("xcloner_restore_display_query_box", {detail: { query: response.statusText.query }}));
381
 
382
  document.dispatchEvent(new CustomEvent("xcloner_restore_display_status_text", {detail: {status: 'error', message: response.status+" "+response.statusText.message }}));
383
  //document.dispatchEvent(new CustomEvent("xcloner_restore_update_progress", {detail: {percent: 100 }}));
384
  document.dispatchEvent(new CustomEvent("remote_restore_mysql_backup_finish"));
 
385
  return;
386
  }
387
 
@@ -394,7 +410,8 @@ class Xcloner_Restore{
394
  {
395
  params.start = response.statusText.start
396
  params.processed = response.statusText.processed
397
-
 
398
  var percent = 0;
399
 
400
  if(response.statusText.backup_size)
@@ -441,7 +458,7 @@ class Xcloner_Restore{
441
  params.mysqldump_file = mysqldump_file
442
  params.query = ""
443
  params.start = 0
444
-
445
  if(jQuery(".xcloner-restore .query-box .query-list").val())
446
  {
447
  params.query = jQuery(".xcloner-restore .query-box .query-list").val();
@@ -747,6 +764,8 @@ class Xcloner_Restore{
747
 
748
  return;
749
  }
 
 
750
 
751
  if(!this.restore_script_url)
752
  {
@@ -764,16 +783,24 @@ class Xcloner_Restore{
764
  crossDomain: true,
765
  data: params,
766
  error: function(xhr, status, error) {
 
 
 
 
767
  document.dispatchEvent(new CustomEvent("xcloner_restore_display_status_text", {detail: {status: 'error', message: xhr.status+" "+xhr.statusText}}));
768
  $this[callback](xhr, false);
769
  }
770
  }).done(function(json) {
771
  if(!json)
772
  {
773
- document.dispatchEvent(new CustomEvent("xcloner_restore_display_status_text", {detail: {status: 'error', message: "Lost connection with the API, please try and authentificate again"}}));
 
 
 
 
774
  }
775
 
776
- if(json.status != 200){
777
  if(json.error)
778
  {
779
  document.dispatchEvent(new CustomEvent("xcloner_restore_display_status_text", {detail: {status: 'error', message: json.message}}));
262
  {
263
  this.ajaxurl = this.restore_script_url;
264
  this.set_cancel(false);
265
+ this.resume.callback = "";
266
 
267
 
268
  if(this.resume.callback == "get_remote_mysqldump_files_callback")
366
  this.do_ajax(this.resume.callback, this.resume.action, this.resume.params);
367
  this.resume = new Object();
368
  return;
369
+ }else {
370
+ document.dispatchEvent(new CustomEvent("xcloner_restore_update_progress", {
371
+ detail: {
372
+ percent: 0,
373
+ class: 'indeterminate'
374
+ }
375
+ }));
376
+ }
377
  document.dispatchEvent(new CustomEvent("remote_restore_update_files_list", {detail: {files: ""}}));
378
 
379
  this.do_ajax('remote_restore_backup_file_callback', 'restore_backup_to_path', params)
381
 
382
  remote_restore_mysql_backup_file_callback(response, status, params = new Object())
383
  {
384
+ if(!response){
385
+
386
+ this.set_cancel(true);
387
+
388
+ document.dispatchEvent(new CustomEvent("remote_restore_mysql_backup_finish"));
389
+ return;
390
+ }
391
  if(!status)
392
  {
393
+ this.start = response.statusText.start;
394
+
395
  document.dispatchEvent(new CustomEvent("xcloner_restore_display_query_box", {detail: { query: response.statusText.query }}));
396
 
397
  document.dispatchEvent(new CustomEvent("xcloner_restore_display_status_text", {detail: {status: 'error', message: response.status+" "+response.statusText.message }}));
398
  //document.dispatchEvent(new CustomEvent("xcloner_restore_update_progress", {detail: {percent: 100 }}));
399
  document.dispatchEvent(new CustomEvent("remote_restore_mysql_backup_finish"));
400
+ //this.set_cancel(true);
401
  return;
402
  }
403
 
410
  {
411
  params.start = response.statusText.start
412
  params.processed = response.statusText.processed
413
+ this.start = params.start;
414
+
415
  var percent = 0;
416
 
417
  if(response.statusText.backup_size)
458
  params.mysqldump_file = mysqldump_file
459
  params.query = ""
460
  params.start = 0
461
+
462
  if(jQuery(".xcloner-restore .query-box .query-list").val())
463
  {
464
  params.query = jQuery(".xcloner-restore .query-box .query-list").val();
764
 
765
  return;
766
  }
767
+
768
+ var $this = this;
769
 
770
  if(!this.restore_script_url)
771
  {
783
  crossDomain: true,
784
  data: params,
785
  error: function(xhr, status, error) {
786
+ $this.resume.callback = callback
787
+ $this.resume.action = action
788
+ $this.resume.params = params
789
+
790
  document.dispatchEvent(new CustomEvent("xcloner_restore_display_status_text", {detail: {status: 'error', message: xhr.status+" "+xhr.statusText}}));
791
  $this[callback](xhr, false);
792
  }
793
  }).done(function(json) {
794
  if(!json)
795
  {
796
+ $this.resume.callback = callback
797
+ $this.resume.action = action
798
+ $this.resume.params = params
799
+
800
+ document.dispatchEvent(new CustomEvent("xcloner_restore_display_status_text", {detail: {status: 'error', message: "Lost connection with the API, please try and authentificate again"}}));
801
  }
802
 
803
+ if(json && json.status != 200){
804
  if(json.error)
805
  {
806
  document.dispatchEvent(new CustomEvent("xcloner_restore_display_status_text", {detail: {status: 'error', message: json.message}}));
includes/class-xcloner-encryption.php CHANGED
@@ -164,6 +164,9 @@ class Xcloner_Encryption
164
 
165
  fclose($fpOut);
166
 
 
 
 
167
  if (!feof($fpIn)) {
168
  fclose($fpIn);
169
  //echo "\n NEW:".$key.md5($iv);
164
 
165
  fclose($fpOut);
166
 
167
+ unset($ciphertext);
168
+ unset($plaintext);
169
+
170
  if (!feof($fpIn)) {
171
  fclose($fpIn);
172
  //echo "\n NEW:".$key.md5($iv);
includes/class-xcloner-file-system.php CHANGED
@@ -62,7 +62,7 @@ class Xcloner_File_System
62
  private $last_logged_file;
63
  private $folders_to_process_per_session = 25;
64
  private $backup_archive_extensions = array("tar", "tgz", "tar.gz", "gz", "csv", "encrypted", "decrypted");
65
- private $backup_name_tags = array('[time]', '[hostname]', '[domain]');
66
 
67
  /**
68
  * Xcloner_File_System constructor.
@@ -78,27 +78,27 @@ class Xcloner_File_System
78
 
79
  try {
80
 
81
- $this->start_adapter = new Local($this->xcloner_settings->get_xcloner_start_path(), LOCK_EX, 'SKIP_LINKS');
82
  $this->start_filesystem = new Filesystem($this->start_adapter, new Config([
83
  'disable_asserts' => true,
84
  ]));
85
 
86
- $this->tmp_adapter = new Local($this->xcloner_settings->get_xcloner_tmp_path(), LOCK_EX, 'SKIP_LINKS');
87
  $this->tmp_filesystem = new Filesystem($this->tmp_adapter, new Config([
88
  'disable_asserts' => true,
89
  ]));
90
- $adapter = new Local($this->xcloner_settings->get_xcloner_tmp_path(), LOCK_EX | FILE_APPEND, 'SKIP_LINKS');
91
  $this->tmp_filesystem_append = new Filesystem($adapter, new Config([
92
  'disable_asserts' => true,
93
  ]));
94
 
95
- $adapter = new Local($this->xcloner_settings->get_xcloner_store_path(), LOCK_EX, 'SKIP_LINKS');
96
  $this->storage_filesystem = new Filesystem($adapter, new Config([
97
  'disable_asserts' => true,
98
  ]));
99
 
100
  $this->storage_adapter = new Local($this->xcloner_settings->get_xcloner_store_path(), FILE_APPEND,
101
- 'SKIP_LINKS');
102
  $this->storage_filesystem_append = new Filesystem($this->storage_adapter, new Config([
103
  'disable_asserts' => true,
104
  ]));
@@ -519,7 +519,9 @@ class Xcloner_File_System
519
 
520
  public function cleanup_tmp_directories()
521
  {
522
- $adapter = new Local($this->xcloner_settings->get_xcloner_tmp_path(false), LOCK_EX | FILE_APPEND, 'SKIP_LINKS');
 
 
523
  $tmp_filesystem = new Filesystem($adapter, new Config([
524
  'disable_asserts' => true,
525
  ]));
@@ -778,6 +780,8 @@ class Xcloner_File_System
778
  $name = str_replace($tag, date("Y-m-d_H-i"), $name);
779
  } elseif ($tag == '[hostname]') {
780
  $name = str_replace($tag, gethostname(), $name);
 
 
781
  } elseif ($tag == '[domain]') {
782
  $domain = parse_url(admin_url(), PHP_URL_HOST);
783
  $name = str_replace($tag, $domain, $name);
62
  private $last_logged_file;
63
  private $folders_to_process_per_session = 25;
64
  private $backup_archive_extensions = array("tar", "tgz", "tar.gz", "gz", "csv", "encrypted", "decrypted");
65
+ private $backup_name_tags = array('[time]', '[hostname]', '[domain]', '[hash]');
66
 
67
  /**
68
  * Xcloner_File_System constructor.
78
 
79
  try {
80
 
81
+ $this->start_adapter = new Local($this->xcloner_settings->get_xcloner_start_path(), LOCK_EX, '0001');
82
  $this->start_filesystem = new Filesystem($this->start_adapter, new Config([
83
  'disable_asserts' => true,
84
  ]));
85
 
86
+ $this->tmp_adapter = new Local($this->xcloner_settings->get_xcloner_tmp_path(), LOCK_EX, '0001');
87
  $this->tmp_filesystem = new Filesystem($this->tmp_adapter, new Config([
88
  'disable_asserts' => true,
89
  ]));
90
+ $adapter = new Local($this->xcloner_settings->get_xcloner_tmp_path(), LOCK_EX | FILE_APPEND, '0001');
91
  $this->tmp_filesystem_append = new Filesystem($adapter, new Config([
92
  'disable_asserts' => true,
93
  ]));
94
 
95
+ $adapter = new Local($this->xcloner_settings->get_xcloner_store_path(), LOCK_EX, '0001');
96
  $this->storage_filesystem = new Filesystem($adapter, new Config([
97
  'disable_asserts' => true,
98
  ]));
99
 
100
  $this->storage_adapter = new Local($this->xcloner_settings->get_xcloner_store_path(), FILE_APPEND,
101
+ '0001');
102
  $this->storage_filesystem_append = new Filesystem($this->storage_adapter, new Config([
103
  'disable_asserts' => true,
104
  ]));
519
 
520
  public function cleanup_tmp_directories()
521
  {
522
+ $this->logger->info(sprintf(("Cleaning up the temporary directories")));
523
+
524
+ $adapter = new Local($this->xcloner_settings->get_xcloner_tmp_path(false), LOCK_EX, '0001');
525
  $tmp_filesystem = new Filesystem($adapter, new Config([
526
  'disable_asserts' => true,
527
  ]));
780
  $name = str_replace($tag, date("Y-m-d_H-i"), $name);
781
  } elseif ($tag == '[hostname]') {
782
  $name = str_replace($tag, gethostname(), $name);
783
+ }elseif ($tag == '[hash]') {
784
+ $name = str_replace($tag, $this->xcloner_settings->randomString(5), $name);
785
  } elseif ($tag == '[domain]') {
786
  $domain = parse_url(admin_url(), PHP_URL_HOST);
787
  $name = str_replace($tag, $domain, $name);
includes/class-xcloner-scheduler.php CHANGED
@@ -313,7 +313,7 @@ class Xcloner_Scheduler {
313
  $part = 0;
314
  $backup_parts = array();
315
 
316
- if ($schedule['backup_params']->backup_encrypt) {
317
  $this->logger->info(sprintf("Encrypting backup archive %s.", $return['extra']['backup_parent']), array("CRON"));
318
 
319
  $backup_file = $return['extra']['backup_parent'];
313
  $part = 0;
314
  $backup_parts = array();
315
 
316
+ if (isset($schedule['backup_params']->backup_encrypt) && $schedule['backup_params']->backup_encrypt) {
317
  $this->logger->info(sprintf("Encrypting backup archive %s.", $return['extra']['backup_parent']), array("CRON"));
318
 
319
  $backup_file = $return['extra']['backup_parent'];
includes/class-xcloner-settings.php CHANGED
@@ -71,7 +71,7 @@ class Xcloner_Settings {
71
  * @param $length the length of the string to create
72
  * @return string
73
  */
74
- private function randomString($length = 6) {
75
  $str = "";
76
  $characters = array_merge(range('A', 'Z'), range('a', 'z'), range('0', '9'));
77
  $max = count($characters) - 1;
@@ -225,7 +225,7 @@ class Xcloner_Settings {
225
  }
226
 
227
  public function get_server_unique_hash($strlen = 0) {
228
- $hash = md5(get_home_url().__DIR__);
229
 
230
  if ($strlen) {
231
  $hash = substr($hash, 0, $strlen);
71
  * @param $length the length of the string to create
72
  * @return string
73
  */
74
+ public function randomString($length = 6) {
75
  $str = "";
76
  $characters = array_merge(range('A', 'Z'), range('a', 'z'), range('0', '9'));
77
  $max = count($characters) - 1;
225
  }
226
 
227
  public function get_server_unique_hash($strlen = 0) {
228
+ $hash = md5(get_home_url().__DIR__.$this->get_xcloner_encryption_key());
229
 
230
  if ($strlen) {
231
  $hash = substr($hash, 0, $strlen);
includes/class-xcloner.php CHANGED
@@ -542,10 +542,13 @@ class Xcloner {
542
  $logger = new XCloner_Logger($this, "php_system");
543
  $error = error_get_last();
544
 
545
- if ($error['type'] and $logger)
546
  {
547
- $logger->info($this->friendly_error_type($error['type']).": ".var_export($error, true));
548
- }
 
 
 
549
 
550
  }
551
 
542
  $logger = new XCloner_Logger($this, "php_system");
543
  $error = error_get_last();
544
 
545
+ if ($error['type'] and $error['type'] === E_ERROR and $logger)
546
  {
547
+ $logger->error($this->friendly_error_type($error['type']).": ".var_export($error, true));
548
+ }elseif ($error['type'] and $logger)
549
+ {
550
+ $logger->debug($this->friendly_error_type($error['type']).": ".var_export($error, true));
551
+ }
552
 
553
  }
554
 
vendor/league/flysystem/.gitattributes CHANGED
@@ -1,6 +1,7 @@
1
  * text=auto
2
 
3
  /build export-ignore
 
4
  /docs export-ignore
5
  /spec export-ignore
6
  /stub export-ignore
@@ -10,10 +11,10 @@
10
  /.php_cs export-ignore
11
  /.scrutinizer.yml export-ignore
12
  /.travis.yml export-ignore
 
13
  /phpunit.php export-ignore
14
  /phpspec.yml export-ignore
15
  /phpunit.xml export-ignore
16
  /changelog.md export-ignore
17
- /appveyor.yml export-ignore
18
  /README.md export-ignore
19
  /wait_for_ftp_service.php export-ignore
1
  * text=auto
2
 
3
  /build export-ignore
4
+ /.github export-ignore
5
  /docs export-ignore
6
  /spec export-ignore
7
  /stub export-ignore
11
  /.php_cs export-ignore
12
  /.scrutinizer.yml export-ignore
13
  /.travis.yml export-ignore
14
+ /.appveyor.yml export-ignore
15
  /phpunit.php export-ignore
16
  /phpspec.yml export-ignore
17
  /phpunit.xml export-ignore
18
  /changelog.md export-ignore
 
19
  /README.md export-ignore
20
  /wait_for_ftp_service.php export-ignore
xcloner.php CHANGED
@@ -15,7 +15,7 @@
15
  * Plugin Name: XCloner - Site Backup and Restore
16
  * Plugin URI: http://www.xcloner.com
17
  * Description: XCloner is a tool that will help you manage your website backups, generate/restore/move so your website will be always secured! With XCloner you will be able to clone your site to any other location with just a few clicks, as well as transfer the backup archives to remote FTP, SFTP, DropBox, Amazon S3, Google Drive, WebDAV, Backblaze, Azure accounts.
18
- * Version: 4.1.0
19
  * Author: Liuta Ovidiu
20
  * Author URI: http://www.thinkovi.com
21
  * License: GPL-2.0+
15
  * Plugin Name: XCloner - Site Backup and Restore
16
  * Plugin URI: http://www.xcloner.com
17
  * Description: XCloner is a tool that will help you manage your website backups, generate/restore/move so your website will be always secured! With XCloner you will be able to clone your site to any other location with just a few clicks, as well as transfer the backup archives to remote FTP, SFTP, DropBox, Amazon S3, Google Drive, WebDAV, Backblaze, Azure accounts.
18
+ * Version: 4.1.1
19
  * Author: Liuta Ovidiu
20
  * Author URI: http://www.thinkovi.com
21
  * License: GPL-2.0+