Migration, Backup, Staging – WPvivid - Version 0.9.76

Version Description

  • Added a check to the integrity of uploaded backups.
  • Fixed a vulnerability in the plugin code.
  • Fixed some bugs in the plugin code.
  • Optimized the plugin code.
Download this release

Release Info

Developer wpvivid
Plugin Icon 128x128 Migration, Backup, Staging – WPvivid
Version 0.9.76
Comparing to
See all releases

Code changes from version 0.9.75 to 0.9.76

includes/class-wpvivid-backup-uploader.php CHANGED
@@ -15,6 +15,7 @@ class Wpvivid_BackupUploader
15
  add_action('wp_ajax_wpvivid_get_file_id',array($this,'get_file_id'));
16
  add_action('wp_ajax_wpvivid_upload_files',array($this,'upload_files'));
17
  add_action('wp_ajax_wpvivid_upload_files_finish',array($this,'upload_files_finish'));
 
18
 
19
  add_action('wp_ajax_wpvivid_rescan_local_folder',array($this,'rescan_local_folder_set_backup'));
20
  add_action('wp_ajax_wpvivid_get_backup_count',array($this,'get_backup_count'));
@@ -143,6 +144,40 @@ class Wpvivid_BackupUploader
143
  die();
144
  }
145
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
146
  function get_file_id()
147
  {
148
  global $wpvivid_plugin;
@@ -517,7 +552,13 @@ class Wpvivid_BackupUploader
517
  if($this->zip_check_sum($path . $filename))
518
  {
519
  if($this->check_is_a_wpvivid_backup($path.$filename) === true)
 
520
  $backups[$backup_id]['files'][]=$filename;
 
 
 
 
 
521
  }
522
  }
523
  }
@@ -610,7 +651,13 @@ class Wpvivid_BackupUploader
610
  {
611
  try {
612
  var jsonarray = jQuery.parseJSON(data);
613
- if(jsonarray.html !== false){
 
 
 
 
 
 
614
  jQuery('#wpvivid_backup_list').html('');
615
  jQuery('#wpvivid_backup_list').append(jsonarray.html);
616
  wpvivid_popup_tour('show');
@@ -801,6 +848,19 @@ class Wpvivid_BackupUploader
801
  );
802
  }
803
 
 
 
 
 
 
 
 
 
 
 
 
 
 
804
  function wpvivid_init_upload_list()
805
  {
806
  uploader = new plupload.Uploader(<?php echo json_encode($plupload_init); ?>);
@@ -870,7 +930,17 @@ class Wpvivid_BackupUploader
870
  var jsonarray = jQuery.parseJSON(data);
871
  if(jsonarray.result === 'success')
872
  {
873
- alert('The upload has completed.');
 
 
 
 
 
 
 
 
 
 
874
  jQuery('#wpvivid_backup_list').html('');
875
  jQuery('#wpvivid_backup_list').append(jsonarray.html);
876
  wpvivid_click_switch_page('backup', 'wpvivid_tab_backup', true);
15
  add_action('wp_ajax_wpvivid_get_file_id',array($this,'get_file_id'));
16
  add_action('wp_ajax_wpvivid_upload_files',array($this,'upload_files'));
17
  add_action('wp_ajax_wpvivid_upload_files_finish',array($this,'upload_files_finish'));
18
+ add_action('wp_ajax_wpvivid_delete_upload_incomplete_backup_free', array($this, 'delete_upload_incomplete_backup'));
19
 
20
  add_action('wp_ajax_wpvivid_rescan_local_folder',array($this,'rescan_local_folder_set_backup'));
21
  add_action('wp_ajax_wpvivid_get_backup_count',array($this,'get_backup_count'));
144
  die();
145
  }
146
 
147
+ function delete_upload_incomplete_backup()
148
+ {
149
+ global $wpvivid_plugin;
150
+ $wpvivid_plugin->ajax_check_security();
151
+
152
+ try {
153
+ if(isset($_POST['incomplete_backup'])&&!empty($_POST['incomplete_backup']))
154
+ {
155
+ $json = $_POST['incomplete_backup'];
156
+ $json = stripslashes($json);
157
+ $incomplete_backup = json_decode($json, true);
158
+
159
+ if(is_array($incomplete_backup) && !empty($incomplete_backup))
160
+ {
161
+ $path=WP_CONTENT_DIR.DIRECTORY_SEPARATOR.WPvivid_Setting::get_backupdir().DIRECTORY_SEPARATOR;
162
+ foreach ($incomplete_backup as $backup)
163
+ {
164
+ @unlink($path.$backup);
165
+ }
166
+ }
167
+
168
+ $ret['result']='success';
169
+ echo json_encode($ret);
170
+ }
171
+ }
172
+ catch (Exception $error)
173
+ {
174
+ $message = 'An exception has occurred. class: '.get_class($error).';msg: '.$error->getMessage().';code: '.$error->getCode().';line: '.$error->getLine().';in_file: '.$error->getFile().';';
175
+ error_log($message);
176
+ echo json_encode(array('result'=>'failed','error'=>$message));
177
+ }
178
+ die();
179
+ }
180
+
181
  function get_file_id()
182
  {
183
  global $wpvivid_plugin;
552
  if($this->zip_check_sum($path . $filename))
553
  {
554
  if($this->check_is_a_wpvivid_backup($path.$filename) === true)
555
+ {
556
  $backups[$backup_id]['files'][]=$filename;
557
+ }
558
+ else
559
+ {
560
+ $ret['incomplete_backup'][] = $filename;
561
+ }
562
  }
563
  }
564
  }
651
  {
652
  try {
653
  var jsonarray = jQuery.parseJSON(data);
654
+ if(typeof jsonarray.incomplete_backup !== 'undefined' && jsonarray.incomplete_backup.length > 0)
655
+ {
656
+ var incomplete_count = jsonarray.incomplete_backup.length;
657
+ alert('Failed to scan '+incomplete_count+' backup zips, the zips can be corrupted during creation or download process. Please check the zips.');
658
+ }
659
+ if(jsonarray.html !== false)
660
+ {
661
  jQuery('#wpvivid_backup_list').html('');
662
  jQuery('#wpvivid_backup_list').append(jsonarray.html);
663
  wpvivid_popup_tour('show');
848
  );
849
  }
850
 
851
+ function wpvivid_delete_incomplete_backups(incomplete_backup)
852
+ {
853
+ var ajax_data = {
854
+ 'action': 'wpvivid_delete_upload_incomplete_backup_free',
855
+ 'incomplete_backup': incomplete_backup
856
+ };
857
+ wpvivid_post_request(ajax_data, function (data)
858
+ {
859
+ }, function (XMLHttpRequest, textStatus, errorThrown)
860
+ {
861
+ });
862
+ }
863
+
864
  function wpvivid_init_upload_list()
865
  {
866
  uploader = new plupload.Uploader(<?php echo json_encode($plupload_init); ?>);
930
  var jsonarray = jQuery.parseJSON(data);
931
  if(jsonarray.result === 'success')
932
  {
933
+ if(typeof jsonarray.incomplete_backup !== 'undefined' && jsonarray.incomplete_backup.length > 0)
934
+ {
935
+ var incomplete_count = jsonarray.incomplete_backup.length;
936
+ var incomplete_backup = JSON.stringify(jsonarray.incomplete_backup);
937
+ wpvivid_delete_incomplete_backups(incomplete_backup);
938
+ alert('Failed to scan '+incomplete_count+' backup zips, the zips can be corrupted during creation or download process. Please check the zips.');
939
+ }
940
+ else
941
+ {
942
+ alert('The upload has completed.');
943
+ }
944
  jQuery('#wpvivid_backup_list').html('');
945
  jQuery('#wpvivid_backup_list').append(jsonarray.html);
946
  wpvivid_click_switch_page('backup', 'wpvivid_tab_backup', true);
includes/class-wpvivid-export-import.php CHANGED
@@ -1439,9 +1439,11 @@ class WPvivid_Export_Import
1439
  try{
1440
  if(isset($_REQUEST['file_name']) && !empty($_REQUEST['file_name']) && is_string($_REQUEST['file_name']) &&
1441
  isset($_REQUEST['file_size']) && !empty($_REQUEST['file_size']) && is_string($_REQUEST['file_size'])){
1442
- $file_name = $_REQUEST['file_name'];
1443
  $file_size = intval($_REQUEST['file_size']);
1444
 
 
 
1445
  $path=WP_CONTENT_DIR.DIRECTORY_SEPARATOR.WPvivid_Setting::get_backupdir().DIRECTORY_SEPARATOR.WPVIVID_IMPORT_EXPORT_DIR.DIRECTORY_SEPARATOR.$file_name;
1446
  if (file_exists($path)) {
1447
  if (session_id()) {
1439
  try{
1440
  if(isset($_REQUEST['file_name']) && !empty($_REQUEST['file_name']) && is_string($_REQUEST['file_name']) &&
1441
  isset($_REQUEST['file_size']) && !empty($_REQUEST['file_size']) && is_string($_REQUEST['file_size'])){
1442
+ $file_name = sanitize_text_field($_REQUEST['file_name']);
1443
  $file_size = intval($_REQUEST['file_size']);
1444
 
1445
+ $file_name = basename($file_name);
1446
+
1447
  $path=WP_CONTENT_DIR.DIRECTORY_SEPARATOR.WPvivid_Setting::get_backupdir().DIRECTORY_SEPARATOR.WPVIVID_IMPORT_EXPORT_DIR.DIRECTORY_SEPARATOR.$file_name;
1448
  if (file_exists($path)) {
1449
  if (session_id()) {
readme.txt CHANGED
@@ -4,7 +4,7 @@ Tags: move, clone, migrate, staging, backup, restore, auto backup, cloud backup
4
  Requires at least: 4.5
5
  Tested up to: 6.0.1
6
  Requires PHP: 5.3
7
- Stable tag: 0.9.75
8
  License: GPLv3 or later
9
  License URI: https://www.gnu.org/licenses/gpl-3.0.en.html
10
 
@@ -198,6 +198,11 @@ Thank you so much for translating WPvivid Backup Plugin to your languages!
198
  * [Yordan Soares](https://profiles.wordpress.org/yordansoares/) (Spanish(all locales))
199
  * [Chun-Chih Cheng](https://www.facebook.com/groups/wordpresstwhant) (Chinese (Taiwan))
200
  == Changelog ==
 
 
 
 
 
201
  = 0.9.75 =
202
  - Fixed: Page styling got lost after importing the page in some cases.
203
  - Fixed: Some used images were falsely scanned as unused.
4
  Requires at least: 4.5
5
  Tested up to: 6.0.1
6
  Requires PHP: 5.3
7
+ Stable tag: 0.9.76
8
  License: GPLv3 or later
9
  License URI: https://www.gnu.org/licenses/gpl-3.0.en.html
10
 
198
  * [Yordan Soares](https://profiles.wordpress.org/yordansoares/) (Spanish(all locales))
199
  * [Chun-Chih Cheng](https://www.facebook.com/groups/wordpresstwhant) (Chinese (Taiwan))
200
  == Changelog ==
201
+ = 0.9.76 =
202
+ - Added a check to the integrity of uploaded backups.
203
+ - Fixed a vulnerability in the plugin code.
204
+ - Fixed some bugs in the plugin code.
205
+ - Optimized the plugin code.
206
  = 0.9.75 =
207
  - Fixed: Page styling got lost after importing the page in some cases.
208
  - Fixed: Some used images were falsely scanned as unused.
wpvivid-backuprestore.php CHANGED
@@ -7,7 +7,7 @@
7
  * @wordpress-plugin
8
  * Plugin Name: WPvivid Backup Plugin
9
  * Description: Clone or copy WP sites then move or migrate them to new host (new domain), schedule backups, transfer backups to leading remote storage. All in one.
10
- * Version: 0.9.75
11
  * Author: WPvivid Team
12
  * Author URI: https://wpvivid.com
13
  * License: GPL-3.0+
@@ -21,7 +21,7 @@ if ( ! defined( 'WPINC' ) ) {
21
  die;
22
  }
23
 
24
- define( 'WPVIVID_PLUGIN_VERSION', '0.9.75' );
25
  //
26
  define('WPVIVID_RESTORE_INIT','init');
27
  define('WPVIVID_RESTORE_READY','ready');
7
  * @wordpress-plugin
8
  * Plugin Name: WPvivid Backup Plugin
9
  * Description: Clone or copy WP sites then move or migrate them to new host (new domain), schedule backups, transfer backups to leading remote storage. All in one.
10
+ * Version: 0.9.76
11
  * Author: WPvivid Team
12
  * Author URI: https://wpvivid.com
13
  * License: GPL-3.0+
21
  die;
22
  }
23
 
24
+ define( 'WPVIVID_PLUGIN_VERSION', '0.9.76' );
25
  //
26
  define('WPVIVID_RESTORE_INIT','init');
27
  define('WPVIVID_RESTORE_READY','ready');