Migration, Backup, Staging – WPvivid - Version 0.9.77

Version Description

  • Updated: Transferred files will be deleted automatically when auto migration fails.
  • 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.77
Comparing to
See all releases

Code changes from version 0.9.76 to 0.9.77

includes/class-wpvivid-backup-uploader.php CHANGED
@@ -161,7 +161,15 @@ class Wpvivid_BackupUploader
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
 
161
  $path=WP_CONTENT_DIR.DIRECTORY_SEPARATOR.WPvivid_Setting::get_backupdir().DIRECTORY_SEPARATOR;
162
  foreach ($incomplete_backup as $backup)
163
  {
164
+ $backup = basename($backup);
165
+ if (preg_match('/wpvivid-.*_.*_.*\.zip$/', $backup))
166
+ {
167
+ @unlink($path.$backup);
168
+ }
169
+ else if(preg_match('/'.apply_filters('wpvivid_white_label_file_prefix', 'wpvivid').'-.*_.*_.*\.zip$/', $backup))
170
+ {
171
+ @unlink($path.$backup);
172
+ }
173
  }
174
  }
175
 
includes/class-wpvivid-exporter.php CHANGED
@@ -244,7 +244,7 @@ class WPvivid_Post_List extends WP_List_Table
244
  public function column_title( $post ) {
245
  echo '<strong>';
246
  $title = $post->post_title;
247
- echo $title;
248
  echo "</strong>\n";
249
  }
250
 
244
  public function column_title( $post ) {
245
  echo '<strong>';
246
  $title = $post->post_title;
247
+ echo esc_html($title);
248
  echo "</strong>\n";
249
  }
250
 
includes/customclass/class-wpvivid-send-to-site.php CHANGED
@@ -54,6 +54,10 @@ class WPvivid_Send_to_site extends WPvivid_Remote
54
  {
55
  $this->send_to_site_file_status();
56
  }
 
 
 
 
57
  die();
58
  }
59
  }
@@ -118,6 +122,7 @@ class WPvivid_Send_to_site extends WPvivid_Remote
118
  $result=$this->_upload($task_id, $file,$callback);
119
  if($result['result'] !==WPVIVID_SUCCESS)
120
  {
 
121
  return $result;
122
  }
123
  }
@@ -248,6 +253,67 @@ class WPvivid_Send_to_site extends WPvivid_Remote
248
  return array('result' =>WPVIVID_SUCCESS);
249
  }
250
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
251
  public function connect_site($task_id)
252
  {
253
  $json=array();
@@ -873,4 +939,123 @@ class WPvivid_Send_to_site extends WPvivid_Remote
873
  }
874
  die();
875
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
876
  }
54
  {
55
  $this->send_to_site_file_status();
56
  }
57
+ else if($_POST['wpvivid_action']=='clear_backup_cache')
58
+ {
59
+ $this->clear_backup_cache();
60
+ }
61
  die();
62
  }
63
  }
122
  $result=$this->_upload($task_id, $file,$callback);
123
  if($result['result'] !==WPVIVID_SUCCESS)
124
  {
125
+ $this->wpvivid_clear_backup_cache($task_id);
126
  return $result;
127
  }
128
  }
253
  return array('result' =>WPVIVID_SUCCESS);
254
  }
255
 
256
+ public function wpvivid_clear_backup_cache($task_id)
257
+ {
258
+ global $wpvivid_plugin;
259
+ $json=array();
260
+
261
+ $json['backup_id']=$task_id;
262
+ $json=json_encode($json);
263
+ $crypt=new WPvivid_crypt(base64_decode($this->options['token']));
264
+ $data=$crypt->encrypt_message($json);
265
+
266
+ $data=base64_encode($data);
267
+
268
+ $wpvivid_plugin->wpvivid_log->WriteLog('Failed upload backup, clear backup cache.','notice');
269
+
270
+ global $wp_version;
271
+ $args['user-agent'] ='WordPress/' . $wp_version . '; ' . get_bloginfo('url');
272
+ $args['body']=array('wpvivid_content'=>$data,'wpvivid_action'=>'clear_backup_cache');
273
+ $args['timeout']=30;
274
+ $response=wp_remote_post($this->options['url'],$args);
275
+
276
+ if ( is_wp_error( $response ) )
277
+ {
278
+ $ret['result']=WPVIVID_FAILED;
279
+ $ret['error']= $response->get_error_message();
280
+ $wpvivid_plugin->wpvivid_log->WriteLog( $ret['error'],'notice');
281
+ }
282
+ else
283
+ {
284
+ if($response['response']['code']==200)
285
+ {
286
+ $res=json_decode($response['body'],1);
287
+ if($res!=null)
288
+ {
289
+ if($res['result']==WPVIVID_SUCCESS)
290
+ {
291
+ $ret['result']=WPVIVID_SUCCESS;
292
+ }
293
+ else
294
+ {
295
+ $ret['result']=WPVIVID_FAILED;
296
+ $ret['error']= $res['error'];
297
+ $wpvivid_plugin->wpvivid_log->WriteLog( $ret['error'],'notice');
298
+ }
299
+ }
300
+ else
301
+ {
302
+ $ret['result']=WPVIVID_FAILED;
303
+ $ret['error']= 'Failed to parse returned data, unable to clear target site backup cache.';
304
+ $wpvivid_plugin->wpvivid_log->WriteLog( $ret['error'],'notice');
305
+ }
306
+ }
307
+ else
308
+ {
309
+ $ret['result']=WPVIVID_FAILED;
310
+ $ret['error']= 'Clear backup cache error '.$response['response']['code'].' '.$response['body'];
311
+ $wpvivid_plugin->wpvivid_log->WriteLog( $ret['error'],'notice');
312
+ }
313
+ }
314
+ return $ret;
315
+ }
316
+
317
  public function connect_site($task_id)
318
  {
319
  $json=array();
939
  }
940
  die();
941
  }
942
+
943
+ public function clear_backup_cache()
944
+ {
945
+ include_once WPVIVID_PLUGIN_DIR . '/includes/class-wpvivid-crypt.php';
946
+ try {
947
+ if (isset($_POST['wpvivid_content'])) {
948
+ $default = array();
949
+ $option = get_option('wpvivid_api_token', $default);
950
+ if (empty($option)) {
951
+ die();
952
+ }
953
+ if ($option['expires'] != 0 && $option['expires'] < time()) {
954
+ die();
955
+ }
956
+
957
+ $crypt = new WPvivid_crypt(base64_decode($option['private_key']));
958
+ $body = base64_decode($_POST['wpvivid_content']);
959
+ $data = $crypt->decrypt_message($body);
960
+
961
+ if (!is_string($data)) {
962
+ $ret['result'] = WPVIVID_FAILED;
963
+ $ret['error'] = 'The key is invalid.';
964
+ echo json_encode($ret);
965
+ die();
966
+ }
967
+ $params = json_decode($data, 1);
968
+ if (is_null($params)) {
969
+ $ret['result'] = WPVIVID_FAILED;
970
+ $ret['error'] = 'The key is invalid.';
971
+ echo json_encode($ret);
972
+ die();
973
+ }
974
+
975
+ global $wpvivid_plugin;
976
+ $wpvivid_plugin->wpvivid_log = new WPvivid_Log();
977
+ $wpvivid_plugin->wpvivid_log->OpenLogFile($params['backup_id'] . '_backup', 'no_folder', 'backup');
978
+
979
+ $dir=WPvivid_Setting::get_backupdir();
980
+
981
+
982
+ $backup_path=WP_CONTENT_DIR.DIRECTORY_SEPARATOR.$dir.DIRECTORY_SEPARATOR;
983
+ if(is_dir($backup_path))
984
+ {
985
+ $handler = opendir($backup_path);
986
+ if($handler!==false)
987
+ {
988
+ while (($filename = readdir($handler)) !== false)
989
+ {
990
+ if ($filename != "." && $filename != "..")
991
+ {
992
+ if (is_dir($backup_path . $filename))
993
+ {
994
+ continue;
995
+ }
996
+ else {
997
+ if (self::is_wpvivid_backup($filename))
998
+ {
999
+ if ($id =self::get_wpvivid_backup_id($filename))
1000
+ {
1001
+ $white_label_id = str_replace(apply_filters('wpvivid_white_label_file_prefix', 'wpvivid'), 'wpvivid', $id);
1002
+ if(isset($params['backup_id']))
1003
+ {
1004
+ $clear_backup_id = sanitize_text_field($params['backup_id']);
1005
+
1006
+ if($id === $clear_backup_id || $white_label_id === $clear_backup_id)
1007
+ {
1008
+ $wpvivid_plugin->wpvivid_log->WriteLog('Clear backup file: '.$backup_path.$filename, 'notice');
1009
+ @unlink($backup_path.$filename);
1010
+ }
1011
+ }
1012
+ }
1013
+ }
1014
+ }
1015
+ }
1016
+ }
1017
+ if($handler)
1018
+ @closedir($handler);
1019
+ }
1020
+ $ret['result'] = WPVIVID_SUCCESS;
1021
+ }
1022
+ else{
1023
+ $ret['result']=WPVIVID_PRO_FAILED;
1024
+ $ret['error']='Failed to get local storage directory.';
1025
+ }
1026
+ echo json_encode($ret);
1027
+ }
1028
+ }
1029
+ catch (Exception $e) {
1030
+ $ret['result']=WPVIVID_FAILED;
1031
+ $ret['error']=$e->getMessage();
1032
+ echo json_encode($ret);
1033
+ die();
1034
+ }
1035
+ die();
1036
+ }
1037
+
1038
+ public static function is_wpvivid_backup($file_name)
1039
+ {
1040
+ if (preg_match('/wpvivid-.*_.*_.*\.zip$/', $file_name))
1041
+ {
1042
+ return true;
1043
+ }
1044
+ else {
1045
+ return false;
1046
+ }
1047
+ }
1048
+
1049
+ public static function get_wpvivid_backup_id($file_name)
1050
+ {
1051
+ if (preg_match('/wpvivid-(.*?)_/', $file_name, $matches))
1052
+ {
1053
+ $id = $matches[0];
1054
+ $id = substr($id, 0, strlen($id) - 1);
1055
+ return $id;
1056
+ }
1057
+ else {
1058
+ return false;
1059
+ }
1060
+ }
1061
  }
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.76
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.76 =
202
  - Added a check to the integrity of uploaded backups.
203
  - Fixed a vulnerability in the plugin code.
4
  Requires at least: 4.5
5
  Tested up to: 6.0.1
6
  Requires PHP: 5.3
7
+ Stable tag: 0.9.77
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.77 =
202
+ - Updated: Transferred files will be deleted automatically when auto migration fails.
203
+ - Fixed a vulnerability in the plugin code.
204
+ - Fixed some bugs in the plugin code.
205
+ - Optimized the plugin code.
206
  = 0.9.76 =
207
  - Added a check to the integrity of uploaded backups.
208
  - Fixed a vulnerability in the plugin code.
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.76
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.76' );
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.77
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.77' );
25
  //
26
  define('WPVIVID_RESTORE_INIT','init');
27
  define('WPVIVID_RESTORE_READY','ready');