Migration, Backup, Staging – WPvivid - Version 0.9.29

Version Description

  • Successfully tested with WordPress 5.3.
  • Fixed: Locked backups were deleted automatically.
  • Changed: Backups will now be split every 200MB by default.
  • Fixed some bugs in the plugin code.
Download this release

Release Info

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

Code changes from version 0.9.28 to 0.9.29

admin/class-wpvivid-admin.php CHANGED
@@ -143,9 +143,10 @@ class WPvivid_Admin {
143
 
144
  $html = '<div class="postbox">
145
  <h2>
146
- <div style="float: left; margin-right: 10px;"><span style="margin: 0; padding: 0">Current Version: '.$wpvivid_version.'</span></div>
 
147
  <div style="float: left; margin-left: 0;">
148
- <span style="margin: 0; padding: 0"><a href="https://wordpress.org/plugins/wpvivid-backuprestore/#developers" target="_blank" style="text-decoration: none;">changelog</a></span>
149
  </div>
150
  <div style="clear: both;"></div>
151
  </h2>
@@ -223,7 +224,8 @@ class WPvivid_Admin {
223
  *
224
  *
225
  */
226
- public function add_plugin_admin_menu() {
 
227
 
228
  /*
229
  * Add a settings page for this plugin to the Settings menu.
@@ -233,8 +235,16 @@ class WPvivid_Admin {
233
  * Administration Menus: http://codex.wordpress.org/Administration_Menus
234
  *
235
  */
236
- add_menu_page(__('WPvivid Backup'), __('WPvivid Backup'), 'administrator', $this->plugin_name, array($this, 'display_plugin_setup_page'), 'dashicons-cloud', 100);
237
-
 
 
 
 
 
 
 
 
238
  $this->submenus = apply_filters('wpvivid_get_admin_menus', $this->submenus);
239
 
240
  usort($this->submenus, function ($a, $b) {
@@ -254,7 +264,7 @@ class WPvivid_Admin {
254
  $submenu['menu_title'],
255
  $submenu['capability'],
256
  $submenu['menu_slug'],
257
- $submenu['function'], false, 100);
258
  }
259
  }
260
 
143
 
144
  $html = '<div class="postbox">
145
  <h2>
146
+ <div style="float: left; margin-right: 5px;"><span style="margin: 0; padding: 0">Current Version: '.$wpvivid_version.'</span></div>
147
+ <div style="float: left; margin-right: 5px;"><span style="margin: 0; padding: 0">|</span></div>
148
  <div style="float: left; margin-left: 0;">
149
+ <span style="margin: 0; padding: 0"><a href="https://wordpress.org/plugins/wpvivid-backuprestore/#developers" target="_blank" style="text-decoration: none;">ChangeLog</a></span>
150
  </div>
151
  <div style="clear: both;"></div>
152
  </h2>
224
  *
225
  *
226
  */
227
+ public function add_plugin_admin_menu()
228
+ {
229
 
230
  /*
231
  * Add a settings page for this plugin to the Settings menu.
235
  * Administration Menus: http://codex.wordpress.org/Administration_Menus
236
  *
237
  */
238
+ $menu['page_title']=__('WPvivid Backup');
239
+ $menu['menu_title']=__('WPvivid Backup');
240
+ $menu['capability']='administrator';
241
+ $menu['menu_slug']= $this->plugin_name;
242
+ $menu['function']=array($this, 'display_plugin_setup_page');
243
+ $menu['icon_url']='dashicons-cloud';
244
+ $menu['position']=100;
245
+ $menu = apply_filters('wpvivid_get_main_admin_menus', $menu);
246
+
247
+ add_menu_page( $menu['page_title'],$menu['menu_title'], $menu['capability'], $menu['menu_slug'], $menu['function'], $menu['icon_url'], $menu['position']);
248
  $this->submenus = apply_filters('wpvivid_get_admin_menus', $this->submenus);
249
 
250
  usort($this->submenus, function ($a, $b) {
264
  $submenu['menu_title'],
265
  $submenu['capability'],
266
  $submenu['menu_slug'],
267
+ $submenu['function']);
268
  }
269
  }
270
 
admin/partials/wpvivid-backup-restore-page-display.php CHANGED
@@ -139,6 +139,7 @@ function wpvivid_backuppage_add_tab_restore(){
139
 
140
  function wpvivid_backuppage_add_page_backup(){
141
  $backuplist=WPvivid_Backuplist::get_backuplist();
 
142
  ?>
143
  <div class="backup-tab-content wpvivid_tab_backup" id="page-backups">
144
  <div style="margin-top:10px; margin-bottom:10px;">
@@ -260,31 +261,54 @@ function wpvivid_backuppage_add_page_backup(){
260
  }
261
 
262
  function wpvivid_set_backup_lock(backup_id, lock_status){
 
 
263
  if(lock_status === "lock"){
264
  var lock=0;
265
  }
266
  else{
267
  var lock=1;
268
- }
269
- var ajax_data={
270
- 'action': 'wpvivid_set_security_lock',
271
- 'backup_id': backup_id,
272
- 'lock': lock
273
- };
274
- wpvivid_post_request(ajax_data, function(data) {
275
- try {
276
- var jsonarray = jQuery.parseJSON(data);
277
- if (jsonarray.result === 'success') {
278
- jQuery('#wpvivid_lock_'+backup_id).html(jsonarray.html);
 
 
 
 
 
 
279
  }
280
  }
281
- catch(err){
282
- alert(err);
283
- }
284
- }, function(XMLHttpRequest, textStatus, errorThrown) {
285
- var error_message = wpvivid_output_ajaxerror('setting up a lock for the backup', textStatus, errorThrown);
286
- alert(error_message);
287
- });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
288
  }
289
 
290
  function wpvivid_read_log(action, param){
@@ -1438,7 +1462,7 @@ function wpvivid_backuppage_add_progress_module(){
1438
  <div style="clear: both;"></div>
1439
  <div>
1440
  <div id="wpvivid_backup_cancel" class="backup-log-btn"><input class="button-primary" id="wpvivid_backup_cancel_btn" type="submit" value="<?php esc_attr_e( 'Cancel', 'wpvivid' ); ?>" /></div>
1441
- <div id="wpvivid_backup_log" class="backup-log-btn"><input class="button-primary backup-log-btn" id="wpvivid_backup_log_btn" type="submit" value="<?php esc_attr_e( 'Log', 'wpvivid' ); ?>" /></div>
1442
  </div>
1443
  <div style="clear: both;"></div>
1444
  </div>
@@ -1498,7 +1522,7 @@ function wpvivid_backup_module_add_descript(){
1498
  <div class="quickstart-storage-setting">
1499
  <span class="list-top-chip backup" name="ismerge" value="1"><?php _e('Local Storage Directory: '); ?></span>
1500
  <span class="list-top-chip" id="wpvivid_local_storage_path"><?php _e(WP_CONTENT_DIR.DIRECTORY_SEPARATOR.$backupdir); ?></span>
1501
- <span class="list-top-chip" id=""><a href="#" onclick="wpvivid_click_switch_page('wrap', 'wpvivid_tab_setting', true);" style="text-decoration: none;"><?php _e(' rename directory', 'wpvivid'); ?></a></span>
1502
  </div>
1503
  <?php
1504
  }
139
 
140
  function wpvivid_backuppage_add_page_backup(){
141
  $backuplist=WPvivid_Backuplist::get_backuplist();
142
+ $display_backup_count = WPvivid_Setting::get_max_backup_count();
143
  ?>
144
  <div class="backup-tab-content wpvivid_tab_backup" id="page-backups">
145
  <div style="margin-top:10px; margin-bottom:10px;">
261
  }
262
 
263
  function wpvivid_set_backup_lock(backup_id, lock_status){
264
+ var max_count_limit = '<?php echo $display_backup_count; ?>';
265
+ var check_status = true;
266
  if(lock_status === "lock"){
267
  var lock=0;
268
  }
269
  else{
270
  var lock=1;
271
+ var check_can_lock=false;
272
+ var baackup_list_count = jQuery('#wpvivid_backup_list').find('tr').length;
273
+ if(baackup_list_count >= max_count_limit) {
274
+ jQuery('#wpvivid_backup_list').find('tr').find('td:eq(0)').find('span:eq(0)').each(function () {
275
+ var span_id = jQuery(this).attr('id');
276
+ span_id = span_id.replace('wpvivid_lock_', '');
277
+ if (span_id !== backup_id) {
278
+ var name = jQuery(this).find('img:eq(0)').attr('name');
279
+ if (name === 'unlock') {
280
+ check_can_lock = true;
281
+ return false;
282
+ }
283
+ }
284
+ });
285
+ if (!check_can_lock) {
286
+ check_status = false;
287
+ alert('The locked backups will reach the maximum limits of retained backups, which causes being unable to create a new backup. So, please unlock one of them and continue.');
288
  }
289
  }
290
+ }
291
+ if(check_status) {
292
+ var ajax_data = {
293
+ 'action': 'wpvivid_set_security_lock',
294
+ 'backup_id': backup_id,
295
+ 'lock': lock
296
+ };
297
+ wpvivid_post_request(ajax_data, function (data) {
298
+ try {
299
+ var jsonarray = jQuery.parseJSON(data);
300
+ if (jsonarray.result === 'success') {
301
+ jQuery('#wpvivid_lock_' + backup_id).html(jsonarray.html);
302
+ }
303
+ }
304
+ catch (err) {
305
+ alert(err);
306
+ }
307
+ }, function (XMLHttpRequest, textStatus, errorThrown) {
308
+ var error_message = wpvivid_output_ajaxerror('setting up a lock for the backup', textStatus, errorThrown);
309
+ alert(error_message);
310
+ });
311
+ }
312
  }
313
 
314
  function wpvivid_read_log(action, param){
1462
  <div style="clear: both;"></div>
1463
  <div>
1464
  <div id="wpvivid_backup_cancel" class="backup-log-btn"><input class="button-primary" id="wpvivid_backup_cancel_btn" type="submit" value="<?php esc_attr_e( 'Cancel', 'wpvivid' ); ?>" /></div>
1465
+ <div id="wpvivid_backup_log" class="backup-log-btn"><input class="button-primary" id="wpvivid_backup_log_btn" type="submit" value="<?php esc_attr_e( 'Log', 'wpvivid' ); ?>" /></div>
1466
  </div>
1467
  <div style="clear: both;"></div>
1468
  </div>
1522
  <div class="quickstart-storage-setting">
1523
  <span class="list-top-chip backup" name="ismerge" value="1"><?php _e('Local Storage Directory: '); ?></span>
1524
  <span class="list-top-chip" id="wpvivid_local_storage_path"><?php _e(WP_CONTENT_DIR.DIRECTORY_SEPARATOR.$backupdir); ?></span>
1525
+ <span class="list-top-chip"><a href="#" onclick="wpvivid_click_switch_page('wrap', 'wpvivid_tab_setting', true);" style="text-decoration: none;"><?php _e(' rename directory', 'wpvivid'); ?></a></span>
1526
  </div>
1527
  <?php
1528
  }
includes/class-wpvivid-backuplist.php CHANGED
@@ -180,6 +180,25 @@ class WPvivid_Backuplist
180
  return $list;
181
  }
182
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
183
  public static function check_backuplist_limit($max_count)
184
  {
185
  $list = WPvivid_Setting::get_option('wpvivid_backup_list');
@@ -187,31 +206,8 @@ class WPvivid_Backuplist
187
  if($size>=$max_count)
188
  {
189
  $ret['result']='need_delete';
190
- $oldest_id='not set';
191
- $oldest=0;
192
- foreach ($list as $k=>$backup)
193
- {
194
- if($oldest==0)
195
- {
196
- $oldest=$backup['create_time'];
197
- $oldest_id=$k;
198
- }
199
- else
200
- {
201
- if(!array_key_exists('lock',$backup))
202
- {
203
- if($oldest>$backup['create_time'])
204
- {
205
- $oldest_id=$k;
206
- }
207
- }
208
- }
209
- }
210
-
211
- if($oldest_id!='not set')
212
- {
213
- $ret['oldest_id']=$oldest_id;
214
- }
215
  }
216
  else
217
  {
@@ -231,27 +227,7 @@ class WPvivid_Backuplist
231
 
232
  while($size>$max_count)
233
  {
234
- $oldest_id='not set';
235
-
236
- $oldest=0;
237
- foreach ($list as $k=>$backup)
238
- {
239
- if($oldest==0)
240
- {
241
- $oldest=$backup['create_time'];
242
- $oldest_id=$k;
243
- }
244
- else
245
- {
246
- if(!array_key_exists('lock',$backup))
247
- {
248
- if($oldest>$backup['create_time'])
249
- {
250
- $oldest_id=$k;
251
- }
252
- }
253
- }
254
- }
255
 
256
  if($oldest_id!='not set')
257
  {
@@ -284,27 +260,7 @@ class WPvivid_Backuplist
284
 
285
  while($size>$max_count)
286
  {
287
- $oldest_id='not set';
288
-
289
- $oldest=0;
290
- foreach ($list as $k=>$backup)
291
- {
292
- if($oldest==0)
293
- {
294
- $oldest=$backup['create_time'];
295
- $oldest_id=$k;
296
- }
297
- else
298
- {
299
- if(!array_key_exists('lock',$backup))
300
- {
301
- if($oldest>$backup['create_time'])
302
- {
303
- $oldest_id=$k;
304
- }
305
- }
306
- }
307
- }
308
 
309
  if($oldest_id!='not set')
310
  {
180
  return $list;
181
  }
182
 
183
+ public static function get_oldest_backup_id($list){
184
+ $oldest_id='not set';
185
+ $oldest=0;
186
+ foreach ($list as $k=>$backup)
187
+ {
188
+ if(!array_key_exists('lock',$backup)) {
189
+ if ($oldest == 0) {
190
+ $oldest = $backup['create_time'];
191
+ $oldest_id = $k;
192
+ } else {
193
+ if ($oldest > $backup['create_time']) {
194
+ $oldest_id = $k;
195
+ }
196
+ }
197
+ }
198
+ }
199
+ return $oldest_id;
200
+ }
201
+
202
  public static function check_backuplist_limit($max_count)
203
  {
204
  $list = WPvivid_Setting::get_option('wpvivid_backup_list');
206
  if($size>=$max_count)
207
  {
208
  $ret['result']='need_delete';
209
+ $oldest_id=self::get_oldest_backup_id($list);
210
+ $ret['oldest_id']=$oldest_id;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
211
  }
212
  else
213
  {
227
 
228
  while($size>$max_count)
229
  {
230
+ $oldest_id=self::get_oldest_backup_id($list);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
231
 
232
  if($oldest_id!='not set')
233
  {
260
 
261
  while($size>$max_count)
262
  {
263
+ $oldest_id=self::get_oldest_backup_id($list);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
264
 
265
  if($oldest_id!='not set')
266
  {
includes/class-wpvivid-crypt.php CHANGED
@@ -70,4 +70,13 @@ class WPvivid_crypt
70
  $this->rsa->loadKey($this->public_key);
71
  return $this->rsa->encrypt($info);
72
  }
 
 
 
 
 
 
 
 
 
73
  }
70
  $this->rsa->loadKey($this->public_key);
71
  return $this->rsa->encrypt($info);
72
  }
73
+
74
+ public function encrypt_user_token($user,$token)
75
+ {
76
+ $user_info['user']=$user;
77
+ $user_info['token']=$token;
78
+ $info=json_encode($user_info);
79
+ $this->rsa->loadKey($this->public_key);
80
+ return $this->rsa->encrypt($info);
81
+ }
82
  }
includes/class-wpvivid-downloader.php CHANGED
@@ -174,7 +174,7 @@ class WPvivid_downloader
174
  {
175
  global $wpvivid_plugin;
176
 
177
- set_time_limit(60);
178
 
179
  $remote=$wpvivid_plugin->remote_collection->get_remote($remote);
180
 
174
  {
175
  global $wpvivid_plugin;
176
 
177
+ @set_time_limit(60);
178
 
179
  $remote=$wpvivid_plugin->remote_collection->get_remote($remote);
180
 
includes/class-wpvivid-export-import.php CHANGED
@@ -691,7 +691,7 @@ class WPvivid_Export_Import
691
  </td>
692
  <td class="column-description desc">
693
  <div class="wpvivid-storage-form-desc">
694
- <i>Export <?php _e($descript_type); ?> published or last modified after this date.</i>
695
  </div>
696
  </td>
697
  </tr>
@@ -708,7 +708,7 @@ class WPvivid_Export_Import
708
  </td>
709
  <td class="column-description desc">
710
  <div class="wpvivid-storage-form-desc">
711
- <i>Export <?php _e($descript_type); ?> published or last modified before this date.</i>
712
  </div>
713
  </td>
714
  </tr>
@@ -1150,7 +1150,7 @@ class WPvivid_Export_Import
1150
 
1151
  $export=new WPvivid_Exporter();
1152
 
1153
- set_time_limit(900);
1154
  try
1155
  {
1156
  $ret = $export->export($task_id);
@@ -1423,7 +1423,7 @@ class WPvivid_Export_Import
1423
  $download_rate = 1024 * 10;
1424
  $file = fopen($path, "r");
1425
  while (!feof($file)) {
1426
- set_time_limit(20);
1427
  // send the current file part to the browser
1428
  print fread($file, round($download_rate * 1024));
1429
  // flush the content to the browser
691
  </td>
692
  <td class="column-description desc">
693
  <div class="wpvivid-storage-form-desc">
694
+ <i>Export <?php _e($descript_type); ?> published after this date.</i>
695
  </div>
696
  </td>
697
  </tr>
708
  </td>
709
  <td class="column-description desc">
710
  <div class="wpvivid-storage-form-desc">
711
+ <i>Export <?php _e($descript_type); ?> published before this date.</i>
712
  </div>
713
  </td>
714
  </tr>
1150
 
1151
  $export=new WPvivid_Exporter();
1152
 
1153
+ @set_time_limit(900);
1154
  try
1155
  {
1156
  $ret = $export->export($task_id);
1423
  $download_rate = 1024 * 10;
1424
  $file = fopen($path, "r");
1425
  while (!feof($file)) {
1426
+ @set_time_limit(20);
1427
  // send the current file part to the browser
1428
  print fread($file, round($download_rate * 1024));
1429
  // flush the content to the browser
includes/class-wpvivid-exporter.php CHANGED
@@ -1364,7 +1364,7 @@ class WPvivid_Exporter
1364
  WPvivid_Exporter_taskmanager::update_main_task_progress($task_id, 'export', 5, 0);
1365
  while($next!==false)
1366
  {
1367
- set_time_limit(900);
1368
  $wpvivid_plugin->wpvivid_log->WriteLog('Prepare to export post '.$next['file_name'],'notice');
1369
 
1370
  $this->task->update_sub_task_progress($next['file_name'],0,'Start export file '.$next['file_name']);
@@ -1615,106 +1615,11 @@ class WPvivid_Exporter
1615
  {
1616
  global $wpdb;
1617
 
1618
- //$files=array();
1619
- //$upload_dir = wp_upload_dir();
1620
- //$dir=$upload_dir['basedir'];
1621
- //setup_postdata( $post );
1622
-
1623
  $postmeta = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $wpdb->postmeta WHERE post_id = %d", $post->ID ) );
1624
  $post_meta_line='';
1625
- //$test_path=WP_CONTENT_DIR.DIRECTORY_SEPARATOR.WPvivid_Setting::get_backupdir().DIRECTORY_SEPARATOR;
1626
  $added_meta_key=array();
1627
  foreach ( $postmeta as $meta )
1628
  {
1629
- /*
1630
- $upload_dir = wp_upload_dir( $post->post_date );
1631
-
1632
- if ( $upload_dir['error'] !== false )
1633
- {
1634
- continue;
1635
- }
1636
- $dir=$upload_dir['basedir'];
1637
- $subdir=$upload_dir['subdir'];
1638
- if ( apply_filters( 'wxr_export_skip_postmeta', false, $meta->meta_key, $meta ) ) {
1639
- continue;
1640
- }
1641
- if($meta->meta_key=='_wp_attached_file')
1642
- {
1643
- $bfound=false;
1644
- $name=$dir.DIRECTORY_SEPARATOR.$meta->meta_value;
1645
- if(file_exists($name))
1646
- {
1647
- $files[]=$name;
1648
- $bfound=true;
1649
- }
1650
-
1651
- if($bfound)
1652
- {
1653
- $attach_meta = wp_get_attachment_metadata( $post->ID );
1654
- if($attach_meta!=false)
1655
- {
1656
- foreach ($attach_meta['sizes'] as $key=>$value)
1657
- {
1658
- $data=image_get_intermediate_size($post->ID,$key);
1659
- $data['path']=ltrim($data['path'], './');
1660
- if(file_exists($dir.DIRECTORY_SEPARATOR.$data['path']))
1661
- {
1662
- $files[]=$dir.DIRECTORY_SEPARATOR.$data['path'];
1663
- }
1664
- }
1665
- }
1666
- }
1667
- }*/
1668
- /*
1669
- else if($meta->meta_key=='_wp_attachment_metadata')
1670
- {
1671
- $meta_data=$meta->meta_value;
1672
- $meta_data = @unserialize($meta_data);
1673
- if($meta_data!==false)
1674
- {
1675
- if(is_array($meta_data))
1676
- {
1677
- if(isset($meta_data['sizes']))
1678
- {
1679
- foreach ($meta_data['sizes'] as $key=>$value)
1680
- {
1681
- $name=$dir.DIRECTORY_SEPARATOR.$value['file'];
1682
- if(file_exists($name))
1683
- {
1684
- $files[]=$name;
1685
- file_put_contents($test_path.'file_found.txt',$name.PHP_EOL,FILE_APPEND);
1686
- }
1687
- else
1688
- {
1689
- $name=$dir.$subdir.DIRECTORY_SEPARATOR.$value['file'];
1690
- if(file_exists($name))
1691
- {
1692
- $files[]=$name;
1693
- file_put_contents($test_path.'file_found.txt',$name.PHP_EOL,FILE_APPEND);
1694
- }
1695
- else
1696
- {
1697
- $data=image_get_intermediate_size($post->ID,$key);
1698
- $data['path']=ltrim($data['path'], './');
1699
- if(file_exists($dir.DIRECTORY_SEPARATOR.$data['path']))
1700
- {
1701
- $files[]=$dir.DIRECTORY_SEPARATOR.$data['path'];
1702
- file_put_contents($test_path.'file_found_data.txt',json_encode($data).PHP_EOL,FILE_APPEND);
1703
- file_put_contents($test_path.'file_found.txt',$dir.DIRECTORY_SEPARATOR.$data['path'].PHP_EOL,FILE_APPEND);
1704
- }
1705
- else
1706
- {
1707
- file_put_contents($test_path.'file_not_found_data.txt',json_encode($data).PHP_EOL,FILE_APPEND);
1708
- file_put_contents($test_path.'file_not_found.txt',$dir.DIRECTORY_SEPARATOR.$data['path'].PHP_EOL,FILE_APPEND);
1709
- }
1710
- }
1711
- }
1712
- }
1713
- }
1714
- }
1715
- }
1716
- }
1717
- */
1718
  if(in_array($meta->meta_key,$added_meta_key))
1719
  continue;
1720
  $added_meta_key[]=$meta->meta_key;
@@ -1726,10 +1631,6 @@ class WPvivid_Exporter
1726
  </wp:postmeta>';
1727
  }
1728
 
1729
- //if(empty($files))
1730
- // return $files;
1731
- //unset($files);
1732
-
1733
  $this->write_post_header_to_file($file,$post);
1734
 
1735
  file_put_contents($file,$post_meta_line,FILE_APPEND);
1364
  WPvivid_Exporter_taskmanager::update_main_task_progress($task_id, 'export', 5, 0);
1365
  while($next!==false)
1366
  {
1367
+ @set_time_limit(900);
1368
  $wpvivid_plugin->wpvivid_log->WriteLog('Prepare to export post '.$next['file_name'],'notice');
1369
 
1370
  $this->task->update_sub_task_progress($next['file_name'],0,'Start export file '.$next['file_name']);
1615
  {
1616
  global $wpdb;
1617
 
 
 
 
 
 
1618
  $postmeta = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $wpdb->postmeta WHERE post_id = %d", $post->ID ) );
1619
  $post_meta_line='';
 
1620
  $added_meta_key=array();
1621
  foreach ( $postmeta as $meta )
1622
  {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1623
  if(in_array($meta->meta_key,$added_meta_key))
1624
  continue;
1625
  $added_meta_key[]=$meta->meta_key;
1631
  </wp:postmeta>';
1632
  }
1633
 
 
 
 
 
1634
  $this->write_post_header_to_file($file,$post);
1635
 
1636
  file_put_contents($file,$post_meta_line,FILE_APPEND);
includes/class-wpvivid-importer.php CHANGED
@@ -566,7 +566,7 @@ class WPvivid_media_importer
566
 
567
  $this->import_log = new WPvivid_import_data();
568
 
569
- set_time_limit(900);
570
 
571
  $path=WP_CONTENT_DIR.DIRECTORY_SEPARATOR.WPvivid_Setting::get_backupdir().DIRECTORY_SEPARATOR.WPVIVID_IMPORT_EXPORT_DIR;
572
 
@@ -613,7 +613,7 @@ class WPvivid_media_importer
613
  }
614
  $this->import_log->wpvivid_write_import_log('The file extracton is completed, file name: '.$file_path, 'notice');
615
 
616
- set_time_limit(900);
617
  $file_path=$path.DIRECTORY_SEPARATOR.$xml_file;
618
  $this->import_log->wpvivid_write_import_log('Prepare import, file name: '.$file_path, 'notice');
619
  $ret=$this->_import($file_path, WPvivid_Impoter_taskmanager::get_options($id));
566
 
567
  $this->import_log = new WPvivid_import_data();
568
 
569
+ @set_time_limit(900);
570
 
571
  $path=WP_CONTENT_DIR.DIRECTORY_SEPARATOR.WPvivid_Setting::get_backupdir().DIRECTORY_SEPARATOR.WPVIVID_IMPORT_EXPORT_DIR;
572
 
613
  }
614
  $this->import_log->wpvivid_write_import_log('The file extracton is completed, file name: '.$file_path, 'notice');
615
 
616
+ @set_time_limit(900);
617
  $file_path=$path.DIRECTORY_SEPARATOR.$xml_file;
618
  $this->import_log->wpvivid_write_import_log('Prepare import, file name: '.$file_path, 'notice');
619
  $ret=$this->_import($file_path, WPvivid_Impoter_taskmanager::get_options($id));
includes/class-wpvivid-mail-report.php CHANGED
@@ -353,7 +353,7 @@ class WPvivid_mail_report
353
  <tr>
354
  <td style="padding-top:20px;padding-bottom:0px;padding-left:40px;padding-right:40px;background-color:#ffffff;width:100%;text-align:left">
355
  <p style="gdsherpa-regular;margin-top:0px;font-size:14px;line-height:24px;margin-bottom:0px">
356
- *WPvivd Backup plugin is a Wordpress plugin that it will help you back up your site to the leading cloud storage providers like Dropbox, Google Drive, Amazon S3, Microsoft OneDrive, FTP and SFTP.
357
  </p>
358
  <p style="gdsherpa-regular;margin-top:0px;font-size:14px;line-height:24px;margin-bottom:0px">
359
  Plugin Page: <a href="https://wordpress.org/plugins/wpvivid-backuprestore/">https://wordpress.org/plugins/wpvivid-backuprestore/</a>
353
  <tr>
354
  <td style="padding-top:20px;padding-bottom:0px;padding-left:40px;padding-right:40px;background-color:#ffffff;width:100%;text-align:left">
355
  <p style="gdsherpa-regular;margin-top:0px;font-size:14px;line-height:24px;margin-bottom:0px">
356
+ *WPvivid Backup plugin is a Wordpress plugin that it will help you back up your site to the leading cloud storage providers like Dropbox, Google Drive, Amazon S3, Microsoft OneDrive, FTP and SFTP.
357
  </p>
358
  <p style="gdsherpa-regular;margin-top:0px;font-size:14px;line-height:24px;margin-bottom:0px">
359
  Plugin Page: <a href="https://wordpress.org/plugins/wpvivid-backuprestore/">https://wordpress.org/plugins/wpvivid-backuprestore/</a>
includes/class-wpvivid-public-interface.php CHANGED
@@ -339,7 +339,7 @@ class WPvivid_Public_Interface
339
  $download_info['backup_id']=sanitize_key($backup_id);
340
  $download_info['file_name'] = $file_name;
341
 
342
- set_time_limit(600);
343
  if (session_id())
344
  session_write_close();
345
  try
339
  $download_info['backup_id']=sanitize_key($backup_id);
340
  $download_info['file_name'] = $file_name;
341
 
342
+ @set_time_limit(600);
343
  if (session_id())
344
  session_write_close();
345
  try
includes/class-wpvivid-tab-page-container.php CHANGED
@@ -63,7 +63,6 @@ class WPvivid_Tab_Page_Container
63
  </div>
64
  </div>
65
  </div>
66
-
67
  <div id="postbox-container-1" class="postbox-container">
68
  <div class="meta-box-sortables">
69
  <?php
@@ -138,7 +137,7 @@ class WPvivid_Tab_Page_Container
138
 
139
  jQuery(document).ready(function($)
140
  {
141
- jQuery(document).on('<?php echo $this->container_id?>-show', function(event,id)
142
  {
143
  jQuery('#<?php echo $this->container_id?>').find( '.<?php echo $this->container_id?>-tab' ).each(function()
144
  {
@@ -152,6 +151,10 @@ class WPvivid_Tab_Page_Container
152
 
153
  jQuery("#wpvivid_page_"+id).show();
154
  jQuery("#wpvivid_tab_"+id).show();
 
 
 
 
155
  jQuery("#wpvivid_tab_"+id).addClass( "nav-tab-active" );
156
  });
157
  });
63
  </div>
64
  </div>
65
  </div>
 
66
  <div id="postbox-container-1" class="postbox-container">
67
  <div class="meta-box-sortables">
68
  <?php
137
 
138
  jQuery(document).ready(function($)
139
  {
140
+ jQuery(document).on('<?php echo $this->container_id?>-show', function(event,id,redirect)
141
  {
142
  jQuery('#<?php echo $this->container_id?>').find( '.<?php echo $this->container_id?>-tab' ).each(function()
143
  {
151
 
152
  jQuery("#wpvivid_page_"+id).show();
153
  jQuery("#wpvivid_tab_"+id).show();
154
+ jQuery("#wpvivid_tab_"+id).find( '.nav-tab-delete-img' ).each(function()
155
+ {
156
+ jQuery(this).attr('redirect',redirect);
157
+ });
158
  jQuery("#wpvivid_tab_"+id).addClass( "nav-tab-active" );
159
  });
160
  });
includes/class-wpvivid.php CHANGED
@@ -1765,7 +1765,7 @@ class WPvivid {
1765
  */
1766
  public function check_backup($task_id,$backup_option)
1767
  {
1768
- set_time_limit(180);
1769
  $options=WPvivid_Setting::get_option('wpvivid_common_setting');
1770
  if(isset($options['estimate_backup']))
1771
  {
@@ -2158,7 +2158,7 @@ class WPvivid {
2158
  $download_info['backup_id'] = sanitize_key($_POST['backup_id']);
2159
  //$download_info['file_name']=sanitize_file_name($_POST['file_name']);
2160
  $download_info['file_name'] = $_POST['file_name'];
2161
- set_time_limit(600);
2162
  if (session_id())
2163
  session_write_close();
2164
 
@@ -2381,7 +2381,7 @@ class WPvivid {
2381
  $download_rate = 1024 * 10;
2382
  $file = fopen($path, "r");
2383
  while (!feof($file)) {
2384
- set_time_limit(20);
2385
  // send the current file part to the browser
2386
  print fread($file, round($download_rate * 1024));
2387
  // flush the content to the browser
@@ -3189,7 +3189,7 @@ class WPvivid {
3189
  die();
3190
  }
3191
 
3192
- set_time_limit(600);
3193
 
3194
  $backup_id = sanitize_key($_POST['backup_id']);
3195
  //$file_name=sanitize_file_name($_POST['file_name']);
@@ -3775,7 +3775,6 @@ class WPvivid {
3775
  $backup_id=false;
3776
  }
3777
  $ret = $this->_list_tasks($backup_id);
3778
-
3779
  $backup_success_count=WPvivid_Setting::get_option('wpvivid_backup_success_count');
3780
  if(!empty($backup_success_count)){
3781
  WPvivid_Setting::delete_option('wpvivid_backup_success_count');
@@ -3795,7 +3794,6 @@ class WPvivid {
3795
  echo json_encode(array('result'=>'failed','error'=>$message));
3796
  die();
3797
  }
3798
-
3799
  die();
3800
  }
3801
 
@@ -3845,7 +3843,7 @@ class WPvivid {
3845
  <div style="clear: both;"></div>
3846
  <div>
3847
  <div id="wpvivid_backup_cancel" class="backup-log-btn"><input class="button-primary" id="wpvivid_backup_cancel_btn" type="submit" value="' . esc_attr('Cancel', 'wpvivid') . '" style="' . $list_tasks[$task['id']]['task_info']['css_btn_cancel'] . '" /></div>
3848
- <div id="wpvivid_backup_log" class="backup-log-btn"><input class="button-primary backup-log-btn" id="wpvivid_backup_log_btn" type="submit" value="' . esc_attr('Log', 'wpvivid') . '" style="' . $list_tasks[$task['id']]['task_info']['css_btn_log'] . '" /></div>
3849
  </div>
3850
  <div style="clear: both;"></div>';
3851
  }
@@ -5255,8 +5253,13 @@ class WPvivid {
5255
 
5256
  public function ajax_check_security($role='administrator')
5257
  {
5258
- if(!is_admin()||!current_user_can($role))
 
 
 
 
5259
  die();
 
5260
  }
5261
 
5262
  public function wpvivid_add_backup_list($html, $list_name = 'wpvivid_backup_list', $tour = false)
1765
  */
1766
  public function check_backup($task_id,$backup_option)
1767
  {
1768
+ @set_time_limit(180);
1769
  $options=WPvivid_Setting::get_option('wpvivid_common_setting');
1770
  if(isset($options['estimate_backup']))
1771
  {
2158
  $download_info['backup_id'] = sanitize_key($_POST['backup_id']);
2159
  //$download_info['file_name']=sanitize_file_name($_POST['file_name']);
2160
  $download_info['file_name'] = $_POST['file_name'];
2161
+ @set_time_limit(600);
2162
  if (session_id())
2163
  session_write_close();
2164
 
2381
  $download_rate = 1024 * 10;
2382
  $file = fopen($path, "r");
2383
  while (!feof($file)) {
2384
+ @set_time_limit(20);
2385
  // send the current file part to the browser
2386
  print fread($file, round($download_rate * 1024));
2387
  // flush the content to the browser
3189
  die();
3190
  }
3191
 
3192
+ @set_time_limit(600);
3193
 
3194
  $backup_id = sanitize_key($_POST['backup_id']);
3195
  //$file_name=sanitize_file_name($_POST['file_name']);
3775
  $backup_id=false;
3776
  }
3777
  $ret = $this->_list_tasks($backup_id);
 
3778
  $backup_success_count=WPvivid_Setting::get_option('wpvivid_backup_success_count');
3779
  if(!empty($backup_success_count)){
3780
  WPvivid_Setting::delete_option('wpvivid_backup_success_count');
3794
  echo json_encode(array('result'=>'failed','error'=>$message));
3795
  die();
3796
  }
 
3797
  die();
3798
  }
3799
 
3843
  <div style="clear: both;"></div>
3844
  <div>
3845
  <div id="wpvivid_backup_cancel" class="backup-log-btn"><input class="button-primary" id="wpvivid_backup_cancel_btn" type="submit" value="' . esc_attr('Cancel', 'wpvivid') . '" style="' . $list_tasks[$task['id']]['task_info']['css_btn_cancel'] . '" /></div>
3846
+ <div id="wpvivid_backup_log" class="backup-log-btn"><input class="button-primary" id="wpvivid_backup_log_btn" type="submit" value="' . esc_attr('Log', 'wpvivid') . '" style="' . $list_tasks[$task['id']]['task_info']['css_btn_log'] . '" /></div>
3847
  </div>
3848
  <div style="clear: both;"></div>';
3849
  }
5253
 
5254
  public function ajax_check_security($role='administrator')
5255
  {
5256
+ $check=is_admin()&&current_user_can($role);
5257
+ $check=apply_filters('wpvivid_ajax_check_security',$check);
5258
+
5259
+ if(!$check)
5260
+ {
5261
  die();
5262
+ }
5263
  }
5264
 
5265
  public function wpvivid_add_backup_list($html, $list_name = 'wpvivid_backup_list', $tour = false)
includes/customclass/class-wpvivid-dropbox.php CHANGED
@@ -201,7 +201,6 @@ class WPvivid_Dropbox extends WPvivid_Remote {
201
  $wpvivid_plugin->wpvivid_download_log->WriteLog('Remote type: Dropbox.','notice');
202
  $this->current_file_name = $file['file_name'];
203
  $this->current_file_size = $file['size'];
204
- $file_md5 = $file['md5'];
205
  $options = $this->options;
206
  $dropbox = new Dropbox_Base($options);
207
 
201
  $wpvivid_plugin->wpvivid_download_log->WriteLog('Remote type: Dropbox.','notice');
202
  $this->current_file_name = $file['file_name'];
203
  $this->current_file_size = $file['size'];
 
204
  $options = $this->options;
205
  $dropbox = new Dropbox_Base($options);
206
 
includes/customclass/class-wpvivid-ftpclass.php CHANGED
@@ -541,7 +541,6 @@ class WPvivid_FTPClass extends WPvivid_Remote{
541
  $port = empty($this->options['port']) ? 21 : $this->options['port'];
542
 
543
  $local_path = trailingslashit($local_path) . $file['file_name'];
544
- $md5 = $file['md5'];
545
  $remote_file = trailingslashit($path) . $file['file_name'];
546
 
547
  $this->current_file_name = $file['file_name'];
541
  $port = empty($this->options['port']) ? 21 : $this->options['port'];
542
 
543
  $local_path = trailingslashit($local_path) . $file['file_name'];
 
544
  $remote_file = trailingslashit($path) . $file['file_name'];
545
 
546
  $this->current_file_name = $file['file_name'];
includes/customclass/class-wpvivid-one-drive.php CHANGED
@@ -562,7 +562,7 @@ class WPvivid_one_drive extends WPvivid_Remote
562
 
563
  public function cleanup($files)
564
  {
565
- set_time_limit(120);
566
 
567
  $path=$this->options['path'];
568
  if($this->need_refresh())
562
 
563
  public function cleanup($files)
564
  {
565
+ @set_time_limit(120);
566
 
567
  $path=$this->options['path'];
568
  if($this->need_refresh())
includes/customclass/class-wpvivid-sftpclass.php CHANGED
@@ -523,7 +523,6 @@ class WPvivid_SFTPClass extends WPvivid_Remote{
523
  $port = empty($this->options['port']) ? 22 : $this->options['port'];
524
  $local_path = trailingslashit($local_path) . $file['file_name'];
525
  $file_size = $file['size'];
526
- $md5 = $file['md5'];
527
  $remote_file_name = trailingslashit($path) . $file['file_name'];
528
 
529
  $wpvivid_plugin->wpvivid_download_log->WriteLog('Connecting SFTP server.','notice');
523
  $port = empty($this->options['port']) ? 22 : $this->options['port'];
524
  $local_path = trailingslashit($local_path) . $file['file_name'];
525
  $file_size = $file['size'];
 
526
  $remote_file_name = trailingslashit($path) . $file['file_name'];
527
 
528
  $wpvivid_plugin->wpvivid_download_log->WriteLog('Connecting SFTP server.','notice');
readme.txt CHANGED
@@ -2,9 +2,9 @@
2
  Contributors: wpvivid
3
  Tags: move, clone, migrate, copy, backup, restore, auto backup, cloud backup
4
  Requires at least: 4.5
5
- Tested up to: 5.2
6
  Requires PHP: 5.3
7
- Stable tag: 0.9.28
8
  License: GPLv3 or later
9
  License URI: https://www.gnu.org/licenses/gpl-3.0.en.html
10
 
@@ -166,6 +166,11 @@ Thank you for translating WPvivid Backup Plugin to your languages!
166
  * [Andrew Galas](https://profiles.wordpress.org/andrewgalas) (Polish)
167
 
168
  == Changelog ==
 
 
 
 
 
169
  = 0.9.28 =
170
  - New feature Added: Export and import posts or pages with images in bulk.
171
  - Fixed: URL replacement failures after website migration in some cases.
2
  Contributors: wpvivid
3
  Tags: move, clone, migrate, copy, backup, restore, auto backup, cloud backup
4
  Requires at least: 4.5
5
+ Tested up to: 5.3
6
  Requires PHP: 5.3
7
+ Stable tag: 0.9.29
8
  License: GPLv3 or later
9
  License URI: https://www.gnu.org/licenses/gpl-3.0.en.html
10
 
166
  * [Andrew Galas](https://profiles.wordpress.org/andrewgalas) (Polish)
167
 
168
  == Changelog ==
169
+ = 0.9.29 =
170
+ - Successfully tested with WordPress 5.3.
171
+ - Fixed: Locked backups were deleted automatically.
172
+ - Changed: Backups will now be split every 200MB by default.
173
+ - Fixed some bugs in the plugin code.
174
  = 0.9.28 =
175
  - New feature Added: Export and import posts or pages with images in bulk.
176
  - Fixed: URL replacement failures after website migration in some cases.
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.28
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.28' );
25
  //
26
  define('WPVIVID_RESTORE_INIT','init');
27
  define('WPVIVID_RESTORE_READY','ready');
@@ -50,7 +50,7 @@ define('WPVIVID_MAX_BACKUP_COUNT',7);
50
  define('WPVIVID_DEFAULT_BACKUP_COUNT',3);
51
  define('WPVIVID_DEFAULT_COMPRESS_TYPE','zip');
52
  //Max zip file size.
53
- define('WPVIVID_DEFAULT_MAX_FILE_SIZE',0);
54
  //Instruct PclZip to use all the time temporary files to create the zip archive or not.The default value is 1.
55
  define('WPVIVID_DEFAULT_USE_TEMP',1);
56
  //Instruct PclZip to use temporary files for files with size greater than.The default value is 16M.
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.29
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.29' );
25
  //
26
  define('WPVIVID_RESTORE_INIT','init');
27
  define('WPVIVID_RESTORE_READY','ready');
50
  define('WPVIVID_DEFAULT_BACKUP_COUNT',3);
51
  define('WPVIVID_DEFAULT_COMPRESS_TYPE','zip');
52
  //Max zip file size.
53
+ define('WPVIVID_DEFAULT_MAX_FILE_SIZE',200);
54
  //Instruct PclZip to use all the time temporary files to create the zip archive or not.The default value is 1.
55
  define('WPVIVID_DEFAULT_USE_TEMP',1);
56
  //Instruct PclZip to use temporary files for files with size greater than.The default value is 16M.