Migration, Backup, Staging – WPvivid - Version 0.9.64

Version Description

  • Fixed: Failed to refresh Dropbox token in some cases.
  • Fixed: Custom menu style could not be properly migrated in some cases.
  • Optimized the process of creating a staging site.
  • Added an option to resume the task of creating a staging site when it was interrupted.
  • Optimized the plugin code.
Download this release

Release Info

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

Code changes from version 0.9.63 to 0.9.64

admin/partials/wpvivid-backup-restore-page-display.php CHANGED
@@ -2190,10 +2190,10 @@ function wpvivid_backuppage_add_progress_module(){
2190
  <div class="action-progress-bar" id="wpvivid_action_progress_bar">
2191
  <div class="action-progress-bar-percent" id="wpvivid_action_progress_bar_percent" style="height:24px;width:0;"></div>
2192
  </div>
2193
- <div id="wpvivid_estimate_backup_info" style="float: left;">
2194
  <div class="backup-basic-info"><span class="wpvivid-element-space-right"><?php _e('Database Size:', 'wpvivid-backuprestore'); ?></span><span id="wpvivid_backup_database_size">N/A</span></div>
2195
  <div class="backup-basic-info"><span class="wpvivid-element-space-right"><?php _e('File Size:', 'wpvivid-backuprestore'); ?></span><span id="wpvivid_backup_file_size">N/A</span></div>
2196
- </div>
2197
  <div id="wpvivid_estimate_upload_info" style="float: left;">
2198
  <div class="backup-basic-info"><span class="wpvivid-element-space-right"><?php _e('Total Size:', 'wpvivid-backuprestore'); ?></span><span>N/A</span></div>
2199
  <div class="backup-basic-info"><span class="wpvivid-element-space-right"><?php _e('Uploaded:', 'wpvivid-backuprestore'); ?></span><span>N/A</span></div>
@@ -2389,8 +2389,13 @@ function wpvivid_backup_module_add_exec(){
2389
  if(bdownloading) {
2390
  m_downloading_id = '';
2391
  }
2392
- m_backup_task_id = jsonarray.task_id;
2393
- var descript = '';
 
 
 
 
 
2394
  if (jsonarray.check.alert_db === true || jsonarray.check.alter_files === true) {
2395
  descript = 'The database (the dumping SQL file) might be too large, backing up the database may run out of server memory and result in a backup failure.\n' +
2396
  'One or more files might be too large, backing up the file(s) may run out of server memory and result in a backup failure.\n' +
@@ -2412,7 +2417,7 @@ function wpvivid_backup_module_add_exec(){
2412
  jQuery('#wpvivid_backup_list').html('');
2413
  jQuery('#wpvivid_backup_list').append(jsonarray.html);
2414
  wpvivid_backup_now(jsonarray.task_id);
2415
- }
2416
  }
2417
  }
2418
  catch (err) {
2190
  <div class="action-progress-bar" id="wpvivid_action_progress_bar">
2191
  <div class="action-progress-bar-percent" id="wpvivid_action_progress_bar_percent" style="height:24px;width:0;"></div>
2192
  </div>
2193
+ <!--<div id="wpvivid_estimate_backup_info" style="float: left;">
2194
  <div class="backup-basic-info"><span class="wpvivid-element-space-right"><?php _e('Database Size:', 'wpvivid-backuprestore'); ?></span><span id="wpvivid_backup_database_size">N/A</span></div>
2195
  <div class="backup-basic-info"><span class="wpvivid-element-space-right"><?php _e('File Size:', 'wpvivid-backuprestore'); ?></span><span id="wpvivid_backup_file_size">N/A</span></div>
2196
+ </div>-->
2197
  <div id="wpvivid_estimate_upload_info" style="float: left;">
2198
  <div class="backup-basic-info"><span class="wpvivid-element-space-right"><?php _e('Total Size:', 'wpvivid-backuprestore'); ?></span><span>N/A</span></div>
2199
  <div class="backup-basic-info"><span class="wpvivid-element-space-right"><?php _e('Uploaded:', 'wpvivid-backuprestore'); ?></span><span>N/A</span></div>
2389
  if(bdownloading) {
2390
  m_downloading_id = '';
2391
  }
2392
+ m_backup_task_id = jsonarray.task_id;
2393
+
2394
+ jQuery('#wpvivid_backup_list').html('');
2395
+ jQuery('#wpvivid_backup_list').append(jsonarray.html);
2396
+ wpvivid_backup_now(m_backup_task_id);
2397
+ /*
2398
+ var descript = '';
2399
  if (jsonarray.check.alert_db === true || jsonarray.check.alter_files === true) {
2400
  descript = 'The database (the dumping SQL file) might be too large, backing up the database may run out of server memory and result in a backup failure.\n' +
2401
  'One or more files might be too large, backing up the file(s) may run out of server memory and result in a backup failure.\n' +
2417
  jQuery('#wpvivid_backup_list').html('');
2418
  jQuery('#wpvivid_backup_list').append(jsonarray.html);
2419
  wpvivid_backup_now(jsonarray.task_id);
2420
+ } */
2421
  }
2422
  }
2423
  catch (err) {
includes/class-wpvivid-export-import.php CHANGED
@@ -1553,14 +1553,14 @@ class WPvivid_Export_Import
1553
  <div style="margin-bottom: 10px;">
1554
  <label>
1555
  <input type="checkbox" id="wpvivid_overwrite_existing" />
1556
- <span><strong><?php _e('Overwrite existing pages', 'wpvivid-backuprestore'); ?></strong></span>
1557
  </label>
1558
  </div>
1559
  <div style="margin-bottom: 10px;">
1560
  <span><?php _e('With this option checked, Pages/posts already existing will be overwritten with the updated ones in an import.', 'wpvivid-backuprestore'); ?></span>
1561
  </div>
1562
- <input class="button button-primary" type="button" id="wpvivid_start_import" value="<?php esc_attr_e('Start to Import', 'wpvivid-backuprestore'); ?>" />
1563
- <input class="button button-primary" type="button" id="wpvivid_rechoose_import_file" value="<?php esc_attr_e('Back to Import Page', 'wpvivid-backuprestore'); ?>" />
1564
  </div>
1565
  <div id="wpvivid_import_step3" style="display: none;">
1566
  <div class="postbox wpvivid-import-log" id="wpvivid_import_log" style="margin-top: 10px; margin-bottom: 0;"></div>
@@ -1796,8 +1796,10 @@ class WPvivid_Export_Import
1796
  function wpvivid_import_step2(data)
1797
  {
1798
  jQuery('#wpvivid_import_file_data').html('');
 
1799
  jQuery.each(data, function (index, value)
1800
  {
 
1801
  import_file_name=value['file_name'];
1802
  var list = "";
1803
  var myDate = new Date(value['time']*1000);
@@ -1809,6 +1811,8 @@ class WPvivid_Export_Import
1809
  jQuery("#wpvivid_import_file_data").append("<ul>"+ list +"</ul>");
1810
  });
1811
 
 
 
1812
  jQuery('#wpvivid_import_step1').hide();
1813
  jQuery('#wpvivid_import_step2').show();
1814
  jQuery('#wpvivid_import_step3').hide();
1553
  <div style="margin-bottom: 10px;">
1554
  <label>
1555
  <input type="checkbox" id="wpvivid_overwrite_existing" />
1556
+ <span><strong id="wpvivid_import_type"><?php _e('Overwrite existing pages', 'wpvivid-backuprestore'); ?></strong></span>
1557
  </label>
1558
  </div>
1559
  <div style="margin-bottom: 10px;">
1560
  <span><?php _e('With this option checked, Pages/posts already existing will be overwritten with the updated ones in an import.', 'wpvivid-backuprestore'); ?></span>
1561
  </div>
1562
+ <input class="button button-primary" type="button" id="wpvivid_start_import" value="<?php esc_attr_e('Import', 'wpvivid-backuprestore'); ?>" />
1563
+ <input class="button button-primary" type="button" id="wpvivid_rechoose_import_file" value="<?php esc_attr_e('Back', 'wpvivid-backuprestore'); ?>" />
1564
  </div>
1565
  <div id="wpvivid_import_step3" style="display: none;">
1566
  <div class="postbox wpvivid-import-log" id="wpvivid_import_log" style="margin-top: 10px; margin-bottom: 0;"></div>
1796
  function wpvivid_import_step2(data)
1797
  {
1798
  jQuery('#wpvivid_import_file_data').html('');
1799
+ var import_type = 'pages';
1800
  jQuery.each(data, function (index, value)
1801
  {
1802
+ import_type = value['export_type'];
1803
  import_file_name=value['file_name'];
1804
  var list = "";
1805
  var myDate = new Date(value['time']*1000);
1811
  jQuery("#wpvivid_import_file_data").append("<ul>"+ list +"</ul>");
1812
  });
1813
 
1814
+ jQuery('#wpvivid_import_type').html('Overwrite existing '+import_type+'s');
1815
+
1816
  jQuery('#wpvivid_import_step1').hide();
1817
  jQuery('#wpvivid_import_step2').show();
1818
  jQuery('#wpvivid_import_step3').hide();
includes/class-wpvivid-migrate.php CHANGED
@@ -1156,13 +1156,13 @@ class WPvivid_Migrate
1156
  $task_msg = WPvivid_taskmanager::get_task($task['id']);
1157
  $wpvivid_plugin->update_last_backup_task($task_msg);
1158
  }
 
 
 
 
1159
  $list_tasks[$task['id']]['progress_html'] = '<div class="action-progress-bar" id="wpvivid_upload_progress_bar">
1160
  <div class="action-progress-bar-percent" id="wpvivid_upload_progress_bar_percent" style="height:24px;width:' . $list_tasks[$task['id']]['task_info']['backup_percent'] . '"></div>
1161
  </div>
1162
- <div id="wpvivid_estimate_backup_info" style="float:left;">
1163
- <div class="backup-basic-info"><span class="wpvivid-element-space-right">' . __('Database Size:', 'wpvivid-backuprestore') . '</span><span>' . $list_tasks[$task['id']]['task_info']['db_size'] . '</span></div>
1164
- <div class="backup-basic-info"><span class="wpvivid-element-space-right">' . __('File Size:', 'wpvivid-backuprestore') . '</span><span>' . $list_tasks[$task['id']]['task_info']['file_size'] . '</span></div>
1165
- </div>
1166
  <div id="wpvivid_estimate_upload_info" style="float: left;">
1167
  <div class="backup-basic-info"><span class="wpvivid-element-space-right">' . __('Total Size:', 'wpvivid-backuprestore') . '</span><span>' . $list_tasks[$task['id']]['task_info']['total'] . '</span></div>
1168
  <div class="backup-basic-info"><span class="wpvivid-element-space-right">' . __('Uploaded:', 'wpvivid-backuprestore') . '</span><span>' . $list_tasks[$task['id']]['task_info']['upload'] . '</span></div>
1156
  $task_msg = WPvivid_taskmanager::get_task($task['id']);
1157
  $wpvivid_plugin->update_last_backup_task($task_msg);
1158
  }
1159
+ //<div id="wpvivid_estimate_backup_info" style="float:left;">
1160
+ // <div class="backup-basic-info"><span class="wpvivid-element-space-right">' . __('Database Size:', 'wpvivid-backuprestore') . '</span><span>' . $list_tasks[$task['id']]['task_info']['db_size'] . '</span></div>
1161
+ // <div class="backup-basic-info"><span class="wpvivid-element-space-right">' . __('File Size:', 'wpvivid-backuprestore') . '</span><span>' . $list_tasks[$task['id']]['task_info']['file_size'] . '</span></div>
1162
+ // </div>
1163
  $list_tasks[$task['id']]['progress_html'] = '<div class="action-progress-bar" id="wpvivid_upload_progress_bar">
1164
  <div class="action-progress-bar-percent" id="wpvivid_upload_progress_bar_percent" style="height:24px;width:' . $list_tasks[$task['id']]['task_info']['backup_percent'] . '"></div>
1165
  </div>
 
 
 
 
1166
  <div id="wpvivid_estimate_upload_info" style="float: left;">
1167
  <div class="backup-basic-info"><span class="wpvivid-element-space-right">' . __('Total Size:', 'wpvivid-backuprestore') . '</span><span>' . $list_tasks[$task['id']]['task_info']['total'] . '</span></div>
1168
  <div class="backup-basic-info"><span class="wpvivid-element-space-right">' . __('Uploaded:', 'wpvivid-backuprestore') . '</span><span>' . $list_tasks[$task['id']]['task_info']['upload'] . '</span></div>
includes/class-wpvivid-restore-database.php CHANGED
@@ -828,8 +828,9 @@ class WPvivid_RestoreDB
828
  }
829
  //$query=str_replace('INSERT INTO', 'INSERT IGNORE INTO', $query);
830
 
831
- $pos=strpos($query,'mainwp_child_');
832
- if($pos!==false)
 
833
  {
834
  $wpvivid_plugin->restore_data->write_log('skip insert item: '.$query,'notice');
835
  }
828
  }
829
  //$query=str_replace('INSERT INTO', 'INSERT IGNORE INTO', $query);
830
 
831
+ $pos_mainwp_child=strpos($query,'mainwp_child_');
832
+ $pos_ws_menu_editor_pro=strpos($query,'ws_menu_editor_pro');
833
+ if($pos_mainwp_child!==false && $pos_ws_menu_editor_pro === false)
834
  {
835
  $wpvivid_plugin->restore_data->write_log('skip insert item: '.$query,'notice');
836
  }
includes/class-wpvivid.php CHANGED
@@ -447,13 +447,14 @@ class WPvivid {
447
  if($ret['result']=='success')
448
  {
449
  //Check the website data to be backed up
 
450
  $ret['check']=$this->check_backup($ret['task_id'],$backup_options);
451
  if(isset($ret['check']['result']) && $ret['check']['result'] == WPVIVID_FAILED)
452
  {
453
  $this->end_shutdown_function=true;
454
  echo json_encode(array('result' => WPVIVID_FAILED,'error' => $ret['check']['error']));
455
  die();
456
- }
457
 
458
  $html = '';
459
  $html = apply_filters('wpvivid_add_backup_list', $html);
@@ -871,7 +872,7 @@ class WPvivid {
871
  $ret = $this->pre_backup($schedule_options['backup']);
872
  if ($ret['result'] == 'success') {
873
  //Check the website data to be backed up.
874
- $this->check_backup($ret['task_id'], $schedule_options['backup']);
875
  //flush buffer
876
  $this->flush($ret['task_id']);
877
  //start backup task.
@@ -4058,13 +4059,13 @@ class WPvivid {
4058
  //do_action('wpvivid_update_schedule_last_time_addon');
4059
  }
4060
  }*/
 
 
 
 
4061
  $list_tasks[$task['id']]['progress_html'] = '<div class="action-progress-bar" id="wpvivid_action_progress_bar">
4062
  <div class="action-progress-bar-percent" id="wpvivid_action_progress_bar_percent" style="height:24px;width:' . $list_tasks[$task['id']]['task_info']['backup_percent'] . '"></div>
4063
  </div>
4064
- <div id="wpvivid_estimate_backup_info" style="float:left; ' . $list_tasks[$task['id']]['task_info']['display_estimate_backup'] . '">
4065
- <div class="backup-basic-info"><span class="wpvivid-element-space-right">' . __('Database Size:', 'wpvivid-backuprestore') . '</span><span id="wpvivid_backup_database_size">' . $list_tasks[$task['id']]['task_info']['db_size'] . '</span></div>
4066
- <div class="backup-basic-info"><span class="wpvivid-element-space-right">' . __('File Size:', 'wpvivid-backuprestore') . '</span><span id="wpvivid_backup_file_size">' . $list_tasks[$task['id']]['task_info']['file_size'] . '</span></div>
4067
- </div>
4068
  <div id="wpvivid_estimate_upload_info" style="float: left;">
4069
  <div class="backup-basic-info"><span class="wpvivid-element-space-right">' . __('Total Size:', 'wpvivid-backuprestore') . '</span><span>' . $list_tasks[$task['id']]['task_info']['total'] . '</span></div>
4070
  <div class="backup-basic-info"><span class="wpvivid-element-space-right">' . __('Uploaded:', 'wpvivid-backuprestore') . '</span><span>' . $list_tasks[$task['id']]['task_info']['upload'] . '</span></div>
447
  if($ret['result']=='success')
448
  {
449
  //Check the website data to be backed up
450
+ /*
451
  $ret['check']=$this->check_backup($ret['task_id'],$backup_options);
452
  if(isset($ret['check']['result']) && $ret['check']['result'] == WPVIVID_FAILED)
453
  {
454
  $this->end_shutdown_function=true;
455
  echo json_encode(array('result' => WPVIVID_FAILED,'error' => $ret['check']['error']));
456
  die();
457
+ }*/
458
 
459
  $html = '';
460
  $html = apply_filters('wpvivid_add_backup_list', $html);
872
  $ret = $this->pre_backup($schedule_options['backup']);
873
  if ($ret['result'] == 'success') {
874
  //Check the website data to be backed up.
875
+ //$this->check_backup($ret['task_id'], $schedule_options['backup']);
876
  //flush buffer
877
  $this->flush($ret['task_id']);
878
  //start backup task.
4059
  //do_action('wpvivid_update_schedule_last_time_addon');
4060
  }
4061
  }*/
4062
+ //<div id="wpvivid_estimate_backup_info" style="float:left; ' . $list_tasks[$task['id']]['task_info']['display_estimate_backup'] . '">
4063
+ // <div class="backup-basic-info"><span class="wpvivid-element-space-right">' . __('Database Size:', 'wpvivid-backuprestore') . '</span><span id="wpvivid_backup_database_size">' . $list_tasks[$task['id']]['task_info']['db_size'] . '</span></div>
4064
+ // <div class="backup-basic-info"><span class="wpvivid-element-space-right">' . __('File Size:', 'wpvivid-backuprestore') . '</span><span id="wpvivid_backup_file_size">' . $list_tasks[$task['id']]['task_info']['file_size'] . '</span></div>
4065
+ // </div>
4066
  $list_tasks[$task['id']]['progress_html'] = '<div class="action-progress-bar" id="wpvivid_action_progress_bar">
4067
  <div class="action-progress-bar-percent" id="wpvivid_action_progress_bar_percent" style="height:24px;width:' . $list_tasks[$task['id']]['task_info']['backup_percent'] . '"></div>
4068
  </div>
 
 
 
 
4069
  <div id="wpvivid_estimate_upload_info" style="float: left;">
4070
  <div class="backup-basic-info"><span class="wpvivid-element-space-right">' . __('Total Size:', 'wpvivid-backuprestore') . '</span><span>' . $list_tasks[$task['id']]['task_info']['total'] . '</span></div>
4071
  <div class="backup-basic-info"><span class="wpvivid-element-space-right">' . __('Uploaded:', 'wpvivid-backuprestore') . '</span><span>' . $list_tasks[$task['id']]['task_info']['upload'] . '</span></div>
includes/customclass/class-wpvivid-base-dropbox.php CHANGED
@@ -249,7 +249,7 @@ class Dropbox_Base{
249
  {
250
  $options=array();
251
  $options['timeout']=30;
252
-
253
  $params = array(
254
  'client_id' => self::API_ID,
255
  'refresh_token' => $this -> refresh_token,
249
  {
250
  $options=array();
251
  $options['timeout']=30;
252
+ $options['sslverify']=FALSE;
253
  $params = array(
254
  'client_id' => self::API_ID,
255
  'refresh_token' => $this -> refresh_token,
includes/staging/class-wpvivid-staging-list-ui-display.php CHANGED
@@ -144,9 +144,31 @@ class WPvivid_Staging_List_UI_Display_Free
144
  </div>
145
 
146
  <div class="wpvivid-copy-staging-to-live-block <?php echo esc_attr($class_btn); ?>" name="<?php echo esc_attr($id); ?>" style="padding:1em 1em 0 0;">
147
- <span class="wpvivid-rectangle wpvivid-grey-light wpvivid-hover-blue wpvivid-staging-operate wpvivid-update-live-to-staging"><?php echo $update_btn; ?></span>
148
- <span class="wpvivid-rectangle wpvivid-grey-light wpvivid-hover-blue wpvivid-staging-operate wpvivid-copy-staging-to-live"><?php echo $copy_btn; ?></span>
 
 
 
 
 
 
 
149
  <span class="wpvivid-rectangle wpvivid-grey-light wpvivid-hover-blue wpvivid-staging-operate wpvivid-delete-staging-site">Delete</span>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
150
  </div>
151
  <div style="clear: both;"></div>
152
  </div>
@@ -1070,6 +1092,34 @@ class WPvivid_Staging_List_UI_Display_Free
1070
  });
1071
  }
1072
  });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1073
  </script>
1074
  </div>
1075
  <?php
144
  </div>
145
 
146
  <div class="wpvivid-copy-staging-to-live-block <?php echo esc_attr($class_btn); ?>" name="<?php echo esc_attr($id); ?>" style="padding:1em 1em 0 0;">
147
+ <?php
148
+ if($staging['status']['str'] === 'completed')
149
+ {
150
+ ?>
151
+ <span class="wpvivid-rectangle wpvivid-grey-light wpvivid-hover-blue wpvivid-staging-operate wpvivid-update-live-to-staging"><?php echo $update_btn; ?></span>
152
+ <span class="wpvivid-rectangle wpvivid-grey-light wpvivid-hover-blue wpvivid-staging-operate wpvivid-copy-staging-to-live"><?php echo $copy_btn; ?></span>
153
+ <?php
154
+ }
155
+ ?>
156
  <span class="wpvivid-rectangle wpvivid-grey-light wpvivid-hover-blue wpvivid-staging-operate wpvivid-delete-staging-site">Delete</span>
157
+ <?php
158
+ if($staging['status']['str'] === 'ready')
159
+ {
160
+ ?>
161
+ <span class="wpvivid-rectangle wpvivid-grey-light wpvivid-hover-blue wpvivid-staging-operate wpvivid-restart-staging-site">Resume</span>
162
+ <span class="dashicons dashicons-editor-help wpvivid-dashicons-editor-help wpvivid-tooltip" style="margin-top: 4px;">
163
+ <div class="wpvivid-bottom">
164
+ <!-- The content you need -->
165
+ <p>The staging site is not fully created yet due to an interruption. Click the Resume button to continue the creation.</p>
166
+ <i></i> <!-- do not delete this line -->
167
+ </div>
168
+ </span>
169
+ <?php
170
+ }
171
+ ?>
172
  </div>
173
  <div style="clear: both;"></div>
174
  </div>
1092
  });
1093
  }
1094
  });
1095
+
1096
+ jQuery('#wpvivid_staging_list').on("click", '.wpvivid-restart-staging-site', function(){
1097
+ var descript = 'Are you sure to restart this staging site?';
1098
+ var ret = confirm(descript);
1099
+ if (ret === true) {
1100
+ var id = jQuery(this).parent().attr('name');
1101
+ var ajax_data = {
1102
+ 'action':'wpvividstg_set_restart_staging_id_free',
1103
+ 'id': id
1104
+ };
1105
+ wpvivid_post_request(ajax_data, function (data) {
1106
+ var jsonarray = jQuery.parseJSON(data);
1107
+ if (jsonarray.result === 'success') {
1108
+ jQuery('#wpvivid_choose_staging_content').hide();
1109
+ jQuery('#wpvivid_create_btn').hide();
1110
+ jQuery('#wpvivid_create_staging_step2').show();
1111
+ switch_staging_tab('create_staging');
1112
+ wpvivid_restart_staging();
1113
+ }
1114
+ else if (jsonarray.result === 'failed') {
1115
+ alert(jsonarray.error);
1116
+ }
1117
+ }, function (XMLHttpRequest, textStatus, errorThrown) {
1118
+ var error_message = wpvivid_output_ajaxerror('setting restart staging id', textStatus, errorThrown);
1119
+ alert(error_message);
1120
+ });
1121
+ }
1122
+ });
1123
  </script>
1124
  </div>
1125
  <?php
includes/staging/class-wpvivid-staging-task-ex.php CHANGED
@@ -882,6 +882,19 @@ class WPvivid_Staging_Task
882
  $this->update_task();
883
  return true;
884
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
885
 
886
  return false;
887
  }
882
  $this->update_task();
883
  return true;
884
  }
885
+ else
886
+ {
887
+ $no_response_time=time()-$this->task['status']['run_time'];
888
+ if($no_response_time>180)
889
+ {
890
+ $next_timeout_time = $limit-$time_spend;
891
+ global $wpvivid_plugin;
892
+ $wpvivid_plugin->staging->log->OpenLogFile($this->get_log_file_name());
893
+ $wpvivid_plugin->staging->log->WriteLog('Task is not responding and will time out in '.$next_timeout_time,'notice');
894
+ $this->task['status']['str']='no_reponse';
895
+ $this->update_task();
896
+ }
897
+ }
898
 
899
  return false;
900
  }
includes/staging/class-wpvivid-staging.php CHANGED
@@ -161,6 +161,7 @@ class WPvivid_Staging_Free
161
  {
162
  add_action('wp_ajax_wpvividstg_start_staging_free', array($this, 'start_staging'));
163
  add_action('wp_ajax_nopriv_wpvividstg_start_staging_free', array($this, 'start_staging'));
 
164
  add_action('wp_ajax_wpvividstg_get_staging_progress_free', array($this, 'get_staging_progress'));
165
  add_action('wp_ajax_nopriv_wpvividstg_get_staging_progress_free', array($this, 'get_staging_progress'));
166
  add_action('wp_ajax_wpvividstg_delete_site_free', array($this, 'delete_site'));
@@ -1877,11 +1878,27 @@ class WPvivid_Staging_Free
1877
  $task_id=get_option('wpvivid_current_running_staging_task','');
1878
  if(empty($task_id))
1879
  {
1880
- $ret['result']='success';
1881
- $ret['log']='';
1882
- $ret['continue']=0;
1883
- echo json_encode($ret);
1884
- die();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1885
  }
1886
 
1887
  try
@@ -1973,10 +1990,48 @@ class WPvivid_Staging_Free
1973
  }
1974
  else
1975
  {
1976
- while(!feof($file))
1977
  {
1978
- $buffer .= fread($file,1024);
 
 
 
1979
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1980
  fclose($file);
1981
  }
1982
 
@@ -2278,6 +2333,27 @@ class WPvivid_Staging_Free
2278
  die();
2279
  }
2280
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2281
  public function set_db_connect_option($new_site_url,$new_home_url,$additional_db_options,$table_prefix,$mu_single_site_id='')
2282
  {
2283
  global $wpdb;
@@ -2720,13 +2796,27 @@ class WPvivid_Staging_Free
2720
 
2721
  if ($error === false)
2722
  {
2723
- $error = 'unknown Error';
2724
  } else {
2725
  $error = 'type: '. $error['type'] . ', ' . $error['message'] . ' file:' . $error['file'] . ' line:' . $error['line'];
2726
  error_log($error);
2727
  }
2728
  $this->log->WriteLog($error,'error');
2729
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2730
  die();
2731
  }
2732
  }
161
  {
162
  add_action('wp_ajax_wpvividstg_start_staging_free', array($this, 'start_staging'));
163
  add_action('wp_ajax_nopriv_wpvividstg_start_staging_free', array($this, 'start_staging'));
164
+ add_action('wp_ajax_wpvividstg_set_restart_staging_id_free', array($this, 'set_restart_staging_id'));
165
  add_action('wp_ajax_wpvividstg_get_staging_progress_free', array($this, 'get_staging_progress'));
166
  add_action('wp_ajax_nopriv_wpvividstg_get_staging_progress_free', array($this, 'get_staging_progress'));
167
  add_action('wp_ajax_wpvividstg_delete_site_free', array($this, 'delete_site'));
1878
  $task_id=get_option('wpvivid_current_running_staging_task','');
1879
  if(empty($task_id))
1880
  {
1881
+ $list = get_option('wpvivid_staging_task_list',array());
1882
+ if(!empty($list))
1883
+ {
1884
+ foreach ($list as $key => $value)
1885
+ {
1886
+ if($value['status']['str'] === 'running' || $value['status']['str'] === 'ready')
1887
+ {
1888
+ $task_id = $value['id'];
1889
+ update_option('wpvivid_current_running_staging_task', $task_id);
1890
+ break;
1891
+ }
1892
+ }
1893
+ }
1894
+ if(empty($task_id))
1895
+ {
1896
+ $ret['result']='success';
1897
+ $ret['log']='';
1898
+ $ret['continue']=0;
1899
+ echo json_encode($ret);
1900
+ die();
1901
+ }
1902
  }
1903
 
1904
  try
1990
  }
1991
  else
1992
  {
1993
+ if(filesize($file_name)<=1*1024*1024)
1994
  {
1995
+ while(!feof($file))
1996
+ {
1997
+ $buffer .= fread($file,1024);
1998
+ }
1999
  }
2000
+ else
2001
+ {
2002
+ $pos=-2;
2003
+ $eof='';
2004
+ $n=50;
2005
+ $buffer_array = array();
2006
+ while($n>0)
2007
+ {
2008
+ while($eof!=="\n")
2009
+ {
2010
+ if(!fseek($file, $pos, SEEK_END))
2011
+ {
2012
+ $eof=fgetc($file);
2013
+ $pos--;
2014
+ }
2015
+ else
2016
+ {
2017
+ break;
2018
+ }
2019
+ }
2020
+ $buffer_array[].=fgets($file);
2021
+ $eof='';
2022
+ $n--;
2023
+ }
2024
+
2025
+ if(!empty($buffer_array))
2026
+ {
2027
+ $buffer_array = array_reverse($buffer_array);
2028
+ foreach($buffer_array as $value)
2029
+ {
2030
+ $buffer.=$value;
2031
+ }
2032
+ }
2033
+ }
2034
+
2035
  fclose($file);
2036
  }
2037
 
2333
  die();
2334
  }
2335
 
2336
+ public function set_restart_staging_id()
2337
+ {
2338
+ global $wpvivid_plugin;
2339
+ $wpvivid_plugin->ajax_check_security();
2340
+ try {
2341
+ if(isset($_POST['id']))
2342
+ {
2343
+ $task_id = $_POST['id'];
2344
+ update_option('wpvivid_current_running_staging_task', $task_id);
2345
+ $ret['result'] = 'success';
2346
+ echo json_encode($ret);
2347
+ }
2348
+ }
2349
+ catch (Exception $error) {
2350
+ $message = 'An exception has occurred. class: '.get_class($error).';msg: '.$error->getMessage().';code: '.$error->getCode().';line: '.$error->getLine().';in_file: '.$error->getFile().';';
2351
+ error_log($message);
2352
+ echo json_encode(array('result'=>'failed','error'=>$message));
2353
+ }
2354
+ die();
2355
+ }
2356
+
2357
  public function set_db_connect_option($new_site_url,$new_home_url,$additional_db_options,$table_prefix,$mu_single_site_id='')
2358
  {
2359
  global $wpdb;
2796
 
2797
  if ($error === false)
2798
  {
2799
+ $error = 'Task interrupted. Please hold on. We are starting a retry.';
2800
  } else {
2801
  $error = 'type: '. $error['type'] . ', ' . $error['message'] . ' file:' . $error['file'] . ' line:' . $error['line'];
2802
  error_log($error);
2803
  }
2804
  $this->log->WriteLog($error,'error');
2805
 
2806
+ $list = get_option('wpvivid_staging_task_list',array());
2807
+ if(!empty($list))
2808
+ {
2809
+ foreach ($list as $key => $value)
2810
+ {
2811
+ if($value['status']['str'] === 'running')
2812
+ {
2813
+ $list[$key]['status']['str']='ready';
2814
+ update_option('wpvivid_staging_task_list', $list);
2815
+ break;
2816
+ }
2817
+ }
2818
+ }
2819
+
2820
  die();
2821
  }
2822
  }
includes/upload-cleaner/class-wpvivid-uploads-scanner.php CHANGED
@@ -861,6 +861,21 @@ class WPvivid_Uploads_Scanner
861
  }
862
  }
863
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
864
  }
865
 
866
  if(!empty($element_data['elements']))
861
  }
862
  }
863
  }
864
+
865
+ if(isset($settings['gallery']))
866
+ {
867
+ foreach ($settings['gallery'] as $item)
868
+ {
869
+ if(isset($item['id']))
870
+ {
871
+ if(!in_array($item['id'],$attachment_added_ids))
872
+ {
873
+ $element_image[]=$item['id'];
874
+ $attachment_added_ids[]=$item['id'];
875
+ }
876
+ }
877
+ }
878
+ }
879
  }
880
 
881
  if(!empty($element_data['elements']))
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: 5.8.1
6
  Requires PHP: 5.3
7
- Stable tag: 0.9.63
8
  License: GPLv3 or later
9
  License URI: https://www.gnu.org/licenses/gpl-3.0.en.html
10
 
@@ -192,6 +192,12 @@ Thank you for translating WPvivid Backup Plugin to your languages!
192
  * [Nima](https://profiles.wordpress.org/nima78600/) (Persian)
193
 
194
  == Changelog ==
 
 
 
 
 
 
195
  = 0.9.63 =
196
  - Added support for Dropbox's new API.
197
  - Fixed: some images used in Elementor would be scanned as 'unused'.
4
  Requires at least: 4.5
5
  Tested up to: 5.8.1
6
  Requires PHP: 5.3
7
+ Stable tag: 0.9.64
8
  License: GPLv3 or later
9
  License URI: https://www.gnu.org/licenses/gpl-3.0.en.html
10
 
192
  * [Nima](https://profiles.wordpress.org/nima78600/) (Persian)
193
 
194
  == Changelog ==
195
+ = 0.9.64 =
196
+ - Fixed: Failed to refresh Dropbox token in some cases.
197
+ - Fixed: Custom menu style could not be properly migrated in some cases.
198
+ - Optimized the process of creating a staging site.
199
+ - Added an option to resume the task of creating a staging site when it was interrupted.
200
+ - Optimized the plugin code.
201
  = 0.9.63 =
202
  - Added support for Dropbox's new API.
203
  - Fixed: some images used in Elementor would be 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.63
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.63' );
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.64
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.64' );
25
  //
26
  define('WPVIVID_RESTORE_INIT','init');
27
  define('WPVIVID_RESTORE_READY','ready');