Version Description
- Fixed: There was no notification after restoration in some environments.
- Fixed some vulnerabilities in the plugin code.
- Fixed: Backup information of live site would be copied to the staging site when creating a staging site.
- Changed staging site creation time to local time.
- Fixed some bugs in the plugin code.
- Successfully tested with WordPress 5.9.2.
Download this release
Release Info
Developer | wpvivid |
Plugin | Migration, Backup, Staging – WPvivid |
Version | 0.9.70 |
Comparing to | |
See all releases |
Code changes from version 0.9.69 to 0.9.70
- admin/js/wpvivid-admin.js +8 -5
- admin/partials/wpvivid-admin-display.php +7 -1
- admin/partials/wpvivid-backup-restore-page-display.php +8 -4
- includes/class-wpvivid-interface-mainwp.php +27 -24
- includes/class-wpvivid-mail-report.php +13 -9
- includes/class-wpvivid.php +51 -5
- includes/customclass/class-wpvivid-google-drive.php +88 -85
- includes/staging/class-wpvivid-staging-copy-db-ex.php +8 -0
- includes/staging/class-wpvivid-staging-list-ui-display.php +2 -2
- includes/staging/class-wpvivid-staging-log-page.php +9 -1
- readme.txt +11 -4
- wpvivid-backuprestore.php +2 -2
admin/js/wpvivid-admin.js
CHANGED
@@ -559,11 +559,14 @@ function wpvivid_cron_task(){
|
|
559 |
|
560 |
function wpvivid_clear_notice(notice_id){
|
561 |
var t = document.getElementById(notice_id);
|
562 |
-
|
563 |
-
|
564 |
-
|
565 |
-
var
|
566 |
-
|
|
|
|
|
|
|
567 |
}
|
568 |
jQuery('#'+notice_id).hide();
|
569 |
}
|
559 |
|
560 |
function wpvivid_clear_notice(notice_id){
|
561 |
var t = document.getElementById(notice_id);
|
562 |
+
if(t !== null)
|
563 |
+
{
|
564 |
+
var oDiv = t.getElementsByTagName("div");
|
565 |
+
var count = oDiv.length;
|
566 |
+
for (count; count > 0; count--) {
|
567 |
+
var i = count - 1;
|
568 |
+
oDiv[i].parentNode.removeChild(oDiv[i]);
|
569 |
+
}
|
570 |
}
|
571 |
jQuery('#'+notice_id).hide();
|
572 |
}
|
admin/partials/wpvivid-admin-display.php
CHANGED
@@ -264,7 +264,13 @@ foreach ($page_array as $page_name){
|
|
264 |
{
|
265 |
$sub_tab=isset($_GET['sub_tab'])?$_GET['sub_tab']:'googledrive';
|
266 |
$sub_page=isset($_GET['sub_page'])?$_GET['sub_page']:'storage_account_google_drive';
|
267 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
268 |
}
|
269 |
}
|
270 |
?>
|
264 |
{
|
265 |
$sub_tab=isset($_GET['sub_tab'])?$_GET['sub_tab']:'googledrive';
|
266 |
$sub_page=isset($_GET['sub_page'])?$_GET['sub_page']:'storage_account_google_drive';
|
267 |
+
if($sub_tab === 'googledrive' || $sub_tab === 'dropbox' || $sub_tab === 'one_drive')
|
268 |
+
{
|
269 |
+
if($sub_page === 'storage_account_google_drive' || $sub_page === 'storage_account_dropbox' || $sub_page === 'storage_account_one_drive')
|
270 |
+
{
|
271 |
+
echo "switchstorageTabs('$sub_tab','$sub_page');";
|
272 |
+
}
|
273 |
+
}
|
274 |
}
|
275 |
}
|
276 |
?>
|
admin/partials/wpvivid-backup-restore-page-display.php
CHANGED
@@ -708,12 +708,14 @@ function wpvivid_backuppage_add_page_backup(){
|
|
708 |
}
|
709 |
}
|
710 |
|
711 |
-
function wpvivid_read_log(action, param){
|
712 |
var tab_id = '';
|
713 |
var content_id = '';
|
714 |
var ajax_data = '';
|
715 |
var show_page = '';
|
716 |
if(typeof param === 'undefined') param = '';
|
|
|
|
|
717 |
switch(action){
|
718 |
case 'wpvivid_view_backup_task_log':
|
719 |
ajax_data = {
|
@@ -745,7 +747,9 @@ function wpvivid_backuppage_add_page_backup(){
|
|
745 |
case 'wpvivid_view_log':
|
746 |
var ajax_data={
|
747 |
'action':action,
|
748 |
-
'path':param
|
|
|
|
|
749 |
};
|
750 |
tab_id = 'wpvivid_tab_read_log';
|
751 |
content_id = 'wpvivid_read_log_content';
|
@@ -1114,7 +1118,7 @@ function wpvivid_backuppage_add_page_backup(){
|
|
1114 |
force_del = 1;
|
1115 |
}
|
1116 |
else{
|
1117 |
-
descript = '<?php _e('Are you sure to remove this backup? This backup will be deleted permanently
|
1118 |
force_del = 0;
|
1119 |
}
|
1120 |
if(m_downloading_id === backup_id){
|
@@ -1166,7 +1170,7 @@ function wpvivid_backuppage_add_page_backup(){
|
|
1166 |
descript = '<?php _e('This request might delete the backup being downloaded, are you sure you want to continue?', 'wpvivid-backuprestore'); ?>';
|
1167 |
}
|
1168 |
else{
|
1169 |
-
descript = '<?php _e('Are you sure to remove the selected backups? These backups will be deleted permanently
|
1170 |
}
|
1171 |
var ret = confirm(descript);
|
1172 |
if (ret === true) {
|
708 |
}
|
709 |
}
|
710 |
|
711 |
+
function wpvivid_read_log(action, param, log_type, log_result){
|
712 |
var tab_id = '';
|
713 |
var content_id = '';
|
714 |
var ajax_data = '';
|
715 |
var show_page = '';
|
716 |
if(typeof param === 'undefined') param = '';
|
717 |
+
if(typeof log_type === 'undefined') log_type = '';
|
718 |
+
if(typeof log_result === 'undefined') log_result = '';
|
719 |
switch(action){
|
720 |
case 'wpvivid_view_backup_task_log':
|
721 |
ajax_data = {
|
747 |
case 'wpvivid_view_log':
|
748 |
var ajax_data={
|
749 |
'action':action,
|
750 |
+
'path':param,
|
751 |
+
'log_type':log_type,
|
752 |
+
'log_result':log_result
|
753 |
};
|
754 |
tab_id = 'wpvivid_tab_read_log';
|
755 |
content_id = 'wpvivid_read_log_content';
|
1118 |
force_del = 1;
|
1119 |
}
|
1120 |
else{
|
1121 |
+
descript = '<?php _e('Are you sure to remove this backup? This backup will be deleted permanently.', 'wpvivid-backuprestore'); ?>';
|
1122 |
force_del = 0;
|
1123 |
}
|
1124 |
if(m_downloading_id === backup_id){
|
1170 |
descript = '<?php _e('This request might delete the backup being downloaded, are you sure you want to continue?', 'wpvivid-backuprestore'); ?>';
|
1171 |
}
|
1172 |
else{
|
1173 |
+
descript = '<?php _e('Are you sure to remove the selected backups? These backups will be deleted permanently.', 'wpvivid-backuprestore'); ?>';
|
1174 |
}
|
1175 |
var ret = confirm(descript);
|
1176 |
if (ret === true) {
|
includes/class-wpvivid-interface-mainwp.php
CHANGED
@@ -205,32 +205,35 @@ class WPvivid_Interface_MainWP
|
|
205 |
}
|
206 |
|
207 |
public function wpvivid_set_backup_report_addon_mainwp($data){
|
208 |
-
$
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
$option[$task_id]['
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
|
|
|
|
224 |
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
|
|
|
|
|
|
|
|
230 |
}
|
231 |
-
}
|
232 |
-
else{
|
233 |
-
update_option('wpvivid_backup_reports', $option);
|
234 |
}
|
235 |
}
|
236 |
|
205 |
}
|
206 |
|
207 |
public function wpvivid_set_backup_report_addon_mainwp($data){
|
208 |
+
if(isset($data['id']))
|
209 |
+
{
|
210 |
+
$task_id = $data['id'];
|
211 |
+
$option = array();
|
212 |
+
$option[$task_id]['task_id'] = $task_id;
|
213 |
+
$option[$task_id]['backup_time'] = $data['status']['start_time'];
|
214 |
+
if($data['status']['str'] == 'completed'){
|
215 |
+
$option[$task_id]['status'] = 'Succeeded';
|
216 |
+
}
|
217 |
+
elseif($data['status']['str'] == 'error'){
|
218 |
+
$option[$task_id]['status'] = 'Failed, '.$data['status']['error'];
|
219 |
+
}
|
220 |
+
elseif($data['status']['str'] == 'cancel'){
|
221 |
+
$option[$task_id]['status'] = 'Canceled';
|
222 |
+
}
|
223 |
+
else{
|
224 |
+
$option[$task_id]['status'] = 'The last backup message not found.';
|
225 |
+
}
|
226 |
|
227 |
+
$backup_reports = get_option('wpvivid_backup_reports', array());
|
228 |
+
if(!empty($backup_reports)){
|
229 |
+
foreach ($option as $key => $value){
|
230 |
+
$backup_reports[$key] = $value;
|
231 |
+
update_option('wpvivid_backup_reports', $backup_reports);
|
232 |
+
}
|
233 |
+
}
|
234 |
+
else{
|
235 |
+
update_option('wpvivid_backup_reports', $option);
|
236 |
}
|
|
|
|
|
|
|
237 |
}
|
238 |
}
|
239 |
|
includes/class-wpvivid-mail-report.php
CHANGED
@@ -99,13 +99,17 @@ class WPvivid_mail_report
|
|
99 |
$status=$task['status']['str'];
|
100 |
if($status=='completed')
|
101 |
{
|
102 |
-
$status='
|
103 |
}
|
104 |
else
|
105 |
{
|
106 |
-
$status='
|
107 |
}
|
108 |
$type=$task['type'];
|
|
|
|
|
|
|
|
|
109 |
$offset=get_option('gmt_offset');
|
110 |
$start_time=date("m-d-Y H:i:s",$task['status']['start_time']+$offset*60*60);
|
111 |
$end_time=date("m-d-Y H:i:s",time()+$offset*60*60);
|
@@ -313,37 +317,37 @@ class WPvivid_mail_report
|
|
313 |
<tbody>
|
314 |
<tr>
|
315 |
<td valign="top" align="left" style="padding-top:0px;padding-right:0px;padding-bottom:0px;padding-left:0px">
|
316 |
-
<p style="text-align:left;Margin-top:0px;Margin-bottom:0px;gdsherpa-regular;font-size:14px;line-height:24px"><label>Backup
|
317 |
</td>
|
318 |
</tr>
|
319 |
<tr>
|
320 |
<td valign="top" align="left" style="padding-top:0px;padding-right:0px;padding-bottom:0px;padding-left:0px">
|
321 |
-
<p style="text-align:left;Margin-top:0px;Margin-bottom:0px;gdsherpa-regular;font-size:14px;line-height:24px"><label>Backup Type
|
322 |
</td>
|
323 |
</tr>
|
324 |
<tr>
|
325 |
<td valign="top" align="left" style="padding-top:0px;padding-right:0px;padding-bottom:0px;padding-left:0px">
|
326 |
-
<p style="text-align:left;Margin-top:0px;Margin-bottom:0px;gdsherpa-regular;font-size:14px;line-height:24px"><label>Start Time
|
327 |
</td>
|
328 |
</tr>
|
329 |
<tr>
|
330 |
<td valign="top" align="left" style="padding-top:0px;padding-right:0px;padding-bottom:0px;padding-left:0px">
|
331 |
-
<p style="text-align:left;Margin-top:0px;Margin-bottom:0px;gdsherpa-regular;font-size:14px;line-height:24px"><label>End Time
|
332 |
</td>
|
333 |
</tr>
|
334 |
<tr>
|
335 |
<td valign="top" align="left" style="padding-top:0px;padding-right:0px;padding-bottom:0px;padding-left:0px">
|
336 |
-
<p style="text-align:left;Margin-top:0px;Margin-bottom:0px;gdsherpa-regular;font-size:14px;line-height:24px"><label>Running Time
|
337 |
</td>
|
338 |
</tr>
|
339 |
<tr>
|
340 |
<td valign="top" align="left" style="padding-top:0px;padding-right:0px;padding-bottom:0px;padding-left:0px">
|
341 |
-
<p style="text-align:left;Margin-top:0px;Margin-bottom:0px;gdsherpa-regular;font-size:14px;line-height:24px"><label>
|
342 |
</td>
|
343 |
</tr>
|
344 |
<tr>
|
345 |
<td valign="top" align="left" style="padding-top:0px;padding-right:0px;padding-bottom:0px;padding-left:0px">
|
346 |
-
<p style="text-align:left;Margin-top:0px;Margin-bottom:0px;gdsherpa-regular;font-size:14px;line-height:24px"><label>Backup Content
|
347 |
</td>
|
348 |
</tr>
|
349 |
</tbody>
|
99 |
$status=$task['status']['str'];
|
100 |
if($status=='completed')
|
101 |
{
|
102 |
+
$status='Succeeded';
|
103 |
}
|
104 |
else
|
105 |
{
|
106 |
+
$status='Failed. '.$task['status']['error'];
|
107 |
}
|
108 |
$type=$task['type'];
|
109 |
+
if($type === 'Cron')
|
110 |
+
{
|
111 |
+
$type = 'Cron-Schedule';
|
112 |
+
}
|
113 |
$offset=get_option('gmt_offset');
|
114 |
$start_time=date("m-d-Y H:i:s",$task['status']['start_time']+$offset*60*60);
|
115 |
$end_time=date("m-d-Y H:i:s",time()+$offset*60*60);
|
317 |
<tbody>
|
318 |
<tr>
|
319 |
<td valign="top" align="left" style="padding-top:0px;padding-right:0px;padding-bottom:0px;padding-left:0px">
|
320 |
+
<p style="text-align:left;Margin-top:0px;Margin-bottom:0px;gdsherpa-regular;font-size:14px;line-height:24px"><label>Backup: </label><label>'.$status.'</label></p>
|
321 |
</td>
|
322 |
</tr>
|
323 |
<tr>
|
324 |
<td valign="top" align="left" style="padding-top:0px;padding-right:0px;padding-bottom:0px;padding-left:0px">
|
325 |
+
<p style="text-align:left;Margin-top:0px;Margin-bottom:0px;gdsherpa-regular;font-size:14px;line-height:24px"><label>Backup Type: </label><label>'.$type.'</label></p>
|
326 |
</td>
|
327 |
</tr>
|
328 |
<tr>
|
329 |
<td valign="top" align="left" style="padding-top:0px;padding-right:0px;padding-bottom:0px;padding-left:0px">
|
330 |
+
<p style="text-align:left;Margin-top:0px;Margin-bottom:0px;gdsherpa-regular;font-size:14px;line-height:24px"><label>Start Time: </label><label>'.$start_time.'</label></p>
|
331 |
</td>
|
332 |
</tr>
|
333 |
<tr>
|
334 |
<td valign="top" align="left" style="padding-top:0px;padding-right:0px;padding-bottom:0px;padding-left:0px">
|
335 |
+
<p style="text-align:left;Margin-top:0px;Margin-bottom:0px;gdsherpa-regular;font-size:14px;line-height:24px"><label>End Time: </label><label>'.$end_time.'</label></p>
|
336 |
</td>
|
337 |
</tr>
|
338 |
<tr>
|
339 |
<td valign="top" align="left" style="padding-top:0px;padding-right:0px;padding-bottom:0px;padding-left:0px">
|
340 |
+
<p style="text-align:left;Margin-top:0px;Margin-bottom:0px;gdsherpa-regular;font-size:14px;line-height:24px"><label>Running Time: </label><label>'.$running_time.'</label></p>
|
341 |
</td>
|
342 |
</tr>
|
343 |
<tr>
|
344 |
<td valign="top" align="left" style="padding-top:0px;padding-right:0px;padding-bottom:0px;padding-left:0px">
|
345 |
+
<p style="text-align:left;Margin-top:0px;Margin-bottom:0px;gdsherpa-regular;font-size:14px;line-height:24px"><label>Backed up to: </label><label>'.$remote.'</label></p>
|
346 |
</td>
|
347 |
</tr>
|
348 |
<tr>
|
349 |
<td valign="top" align="left" style="padding-top:0px;padding-right:0px;padding-bottom:0px;padding-left:0px">
|
350 |
+
<p style="text-align:left;Margin-top:0px;Margin-bottom:0px;gdsherpa-regular;font-size:14px;line-height:24px"><label>Backup Content: </label><label>'.$content.'</label></p>
|
351 |
</td>
|
352 |
</tr>
|
353 |
</tbody>
|
includes/class-wpvivid.php
CHANGED
@@ -3642,7 +3642,7 @@ class WPvivid {
|
|
3642 |
*/
|
3643 |
public function restore()
|
3644 |
{
|
3645 |
-
check_ajax_referer( 'wpvivid_ajax', 'nonce' );
|
3646 |
|
3647 |
$this->end_shutdown_function=false;
|
3648 |
register_shutdown_function(array($this,'deal_restore_shutdown_error'));
|
@@ -3851,7 +3851,7 @@ class WPvivid {
|
|
3851 |
{
|
3852 |
try
|
3853 |
{
|
3854 |
-
check_ajax_referer( 'wpvivid_ajax', 'nonce' );
|
3855 |
if(!isset($_POST['backup_id'])||empty($_POST['backup_id'])||!is_string($_POST['backup_id']))
|
3856 |
{
|
3857 |
$this->end_shutdown_function=true;
|
@@ -5415,7 +5415,7 @@ class WPvivid {
|
|
5415 |
<td>'.__($value['des'], 'wpvivid-backuprestore').'</td>
|
5416 |
<td>'.__($value['file_name'], 'wpvivid-backuprestore').'</td>
|
5417 |
<td>
|
5418 |
-
<a onclick="wpvivid_read_log(\''.'wpvivid_view_log'.'\', \''.$value['
|
5419 |
<img src="'.esc_url(WPVIVID_PLUGIN_URL.$pic_log).'" style="vertical-align:middle;">Log
|
5420 |
</a>
|
5421 |
</td>
|
@@ -5494,6 +5494,14 @@ class WPvivid {
|
|
5494 |
$log_file['path']=$file;
|
5495 |
$log_file['des']='';
|
5496 |
$log_file['time']='';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5497 |
$line = fgets($handle);
|
5498 |
if($line!==false)
|
5499 |
{
|
@@ -5549,7 +5557,45 @@ class WPvivid {
|
|
5549 |
$this->ajax_check_security();
|
5550 |
try {
|
5551 |
if (isset($_POST['path']) && !empty($_POST['path']) && is_string($_POST['path'])) {
|
5552 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5553 |
if (!file_exists($path)) {
|
5554 |
$json['result'] = 'failed';
|
5555 |
$json['error'] = __('The log not found.', 'wpvivid-backuprestore');
|
@@ -6014,7 +6060,7 @@ class WPvivid {
|
|
6014 |
</label><br>
|
6015 |
<label title="">
|
6016 |
<input type="radio" option="schedule" name="save_local_remote" value="remote" '.$backup_remote.' />
|
6017 |
-
<span>'.__( 'Send backups to remote storage (choose
|
6018 |
</label>
|
6019 |
<label style="display: none;">
|
6020 |
<input type="checkbox" option="schedule" name="lock" value="0" />
|
3642 |
*/
|
3643 |
public function restore()
|
3644 |
{
|
3645 |
+
//check_ajax_referer( 'wpvivid_ajax', 'nonce' );
|
3646 |
|
3647 |
$this->end_shutdown_function=false;
|
3648 |
register_shutdown_function(array($this,'deal_restore_shutdown_error'));
|
3851 |
{
|
3852 |
try
|
3853 |
{
|
3854 |
+
//check_ajax_referer( 'wpvivid_ajax', 'nonce' );
|
3855 |
if(!isset($_POST['backup_id'])||empty($_POST['backup_id'])||!is_string($_POST['backup_id']))
|
3856 |
{
|
3857 |
$this->end_shutdown_function=true;
|
5415 |
<td>'.__($value['des'], 'wpvivid-backuprestore').'</td>
|
5416 |
<td>'.__($value['file_name'], 'wpvivid-backuprestore').'</td>
|
5417 |
<td>
|
5418 |
+
<a onclick="wpvivid_read_log(\''.'wpvivid_view_log'.'\', \''.$value['file_name'].'\', \''.'backup'.'\', \''.$value['result'].'\')" style="cursor:pointer;">
|
5419 |
<img src="'.esc_url(WPVIVID_PLUGIN_URL.$pic_log).'" style="vertical-align:middle;">Log
|
5420 |
</a>
|
5421 |
</td>
|
5494 |
$log_file['path']=$file;
|
5495 |
$log_file['des']='';
|
5496 |
$log_file['time']='';
|
5497 |
+
if(preg_match('/error/', $file))
|
5498 |
+
{
|
5499 |
+
$log_file['result']='failed';
|
5500 |
+
}
|
5501 |
+
else
|
5502 |
+
{
|
5503 |
+
$log_file['result']='success';
|
5504 |
+
}
|
5505 |
$line = fgets($handle);
|
5506 |
if($line!==false)
|
5507 |
{
|
5557 |
$this->ajax_check_security();
|
5558 |
try {
|
5559 |
if (isset($_POST['path']) && !empty($_POST['path']) && is_string($_POST['path'])) {
|
5560 |
+
$file_name = sanitize_text_field($_POST['path']);
|
5561 |
+
if(isset($_POST['log_type']))
|
5562 |
+
{
|
5563 |
+
$log_type = sanitize_text_field($_POST['log_type']);
|
5564 |
+
}
|
5565 |
+
else
|
5566 |
+
{
|
5567 |
+
$log_type = 'backup';
|
5568 |
+
}
|
5569 |
+
|
5570 |
+
if(isset($_POST['log_result']))
|
5571 |
+
{
|
5572 |
+
$log_result = sanitize_text_field($_POST['log_result']);
|
5573 |
+
}
|
5574 |
+
else
|
5575 |
+
{
|
5576 |
+
$log_result = 'success';
|
5577 |
+
}
|
5578 |
+
|
5579 |
+
if($log_type === 'backup')
|
5580 |
+
{
|
5581 |
+
$general_setting=WPvivid_Setting::get_setting(true, "");
|
5582 |
+
$log_dir = WP_CONTENT_DIR.DIRECTORY_SEPARATOR.$general_setting['options']['wpvivid_local_setting']['path'].DIRECTORY_SEPARATOR.'wpvivid_log'.DIRECTORY_SEPARATOR;
|
5583 |
+
}
|
5584 |
+
else
|
5585 |
+
{
|
5586 |
+
$log_dir = WP_CONTENT_DIR.DIRECTORY_SEPARATOR.'wpvivid_staging'.DIRECTORY_SEPARATOR;
|
5587 |
+
}
|
5588 |
+
|
5589 |
+
if($log_result === 'success')
|
5590 |
+
{
|
5591 |
+
$res_dir = '';
|
5592 |
+
}
|
5593 |
+
else
|
5594 |
+
{
|
5595 |
+
$res_dir = 'error'.DIRECTORY_SEPARATOR;
|
5596 |
+
}
|
5597 |
+
|
5598 |
+
$path = $log_dir.$res_dir.$file_name;
|
5599 |
if (!file_exists($path)) {
|
5600 |
$json['result'] = 'failed';
|
5601 |
$json['error'] = __('The log not found.', 'wpvivid-backuprestore');
|
6060 |
</label><br>
|
6061 |
<label title="">
|
6062 |
<input type="radio" option="schedule" name="save_local_remote" value="remote" '.$backup_remote.' />
|
6063 |
+
<span>'.__( 'Send backups to remote storage (You can choose whether to keep the backup in localhost after it is uploaded to cloud storage in Settings.)', 'wpvivid-backuprestore' ).'</span>
|
6064 |
</label>
|
6065 |
<label style="display: none;">
|
6066 |
<input type="checkbox" option="schedule" name="lock" value="0" />
|
includes/customclass/class-wpvivid-google-drive.php
CHANGED
@@ -76,116 +76,119 @@ class Wpvivid_Google_drive extends WPvivid_Remote
|
|
76 |
{
|
77 |
if(isset($_GET['action']))
|
78 |
{
|
79 |
-
if($_GET['
|
80 |
{
|
81 |
-
$
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
include_once WPVIVID_PLUGIN_DIR . '/vendor/autoload.php';
|
89 |
-
$client = new Google_Client();
|
90 |
-
$client->setAuthConfig($this->google_drive_secrets);
|
91 |
-
$client->setApprovalPrompt('force');
|
92 |
-
$client->addScope(Google_Service_Drive::DRIVE_FILE);
|
93 |
-
$client->setAccessType('offline');
|
94 |
-
$client->setState(admin_url() . 'admin.php?page=WPvivid' . '&action=wpvivid_google_drive_finish_auth&main_tab=storage&sub_tab=googledrive&sub_page=storage_account_google_drive&auth_id='.$auth_id);
|
95 |
-
$auth_url = $client->createAuthUrl();
|
96 |
-
$remote_options['auth_id']=$auth_id;
|
97 |
-
update_option('wpvivid_tmp_remote_options',$remote_options);
|
98 |
-
header('Location: ' . filter_var($auth_url, FILTER_SANITIZE_URL));
|
99 |
-
}
|
100 |
-
catch (Exception $e){
|
101 |
-
if($e->getMessage() === 'file does not exist'){
|
102 |
-
$error_msg = __('Authentication failed, the client_secrets.json file is missing. Please make sure the client_secrets.json file is in wpvivid-backuprestore\includes\customclass directory.', 'wpvivid-backuprestore');
|
103 |
-
echo '<div class="notice notice-error"><p>'.$error_msg.'</p></div>';
|
104 |
}
|
105 |
-
|
106 |
-
|
107 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
108 |
}
|
109 |
-
|
110 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
111 |
}
|
112 |
}
|
113 |
-
|
114 |
-
else if($_GET['action']=='wpvivid_google_drive_finish_auth')
|
115 |
-
{
|
116 |
-
try
|
117 |
{
|
118 |
-
|
119 |
{
|
120 |
-
|
121 |
-
return;
|
122 |
-
}
|
123 |
-
|
124 |
-
$remoteslist = WPvivid_Setting::get_all_remote_options();
|
125 |
-
foreach ($remoteslist as $key => $value)
|
126 |
-
{
|
127 |
-
if (isset($value['auth_id']) && isset($_GET['auth_id']) && $value['auth_id'] == sanitize_text_field($_GET['auth_id']))
|
128 |
{
|
129 |
-
|
130 |
return;
|
131 |
}
|
132 |
-
}
|
133 |
|
134 |
-
|
135 |
-
|
136 |
-
{
|
137 |
-
return;
|
138 |
-
}
|
139 |
-
else
|
140 |
-
{
|
141 |
-
if($tmp_options['auth_id']===$_GET['auth_id'])
|
142 |
{
|
143 |
-
if(
|
144 |
{
|
145 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
146 |
{
|
147 |
-
$
|
148 |
-
|
|
|
|
|
149 |
|
150 |
-
|
|
|
151 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
152 |
}
|
153 |
else
|
154 |
{
|
155 |
-
|
156 |
-
$tmp_options['token']['access_token'] = sanitize_text_field($_POST['access_token']);
|
157 |
-
$tmp_options['token']['expires_in'] = sanitize_text_field($_POST['expires_in']);
|
158 |
-
$tmp_options['token']['refresh_token'] = sanitize_text_field($_POST['refresh_token']);
|
159 |
-
$tmp_options['token']['scope'] = sanitize_text_field($_POST['scope']);
|
160 |
-
$tmp_options['token']['token_type'] = sanitize_text_field($_POST['token_type']);
|
161 |
-
$tmp_options['token']['created'] = sanitize_text_field($_POST['created']);
|
162 |
-
update_option('wpvivid_tmp_remote_options',$tmp_options);
|
163 |
}
|
164 |
-
$this->add_remote=true;
|
165 |
-
}
|
166 |
-
else
|
167 |
-
{
|
168 |
-
return;
|
169 |
}
|
170 |
}
|
|
|
|
|
|
|
171 |
}
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
add_action('show_notice', array($this, 'wpvivid_show_notice_add_google_drive_success'));
|
182 |
-
} else if ($_GET['result'] == 'error') {
|
183 |
-
add_action('show_notice', array($this, 'wpvivid_show_notice_add_google_drive_error'));
|
184 |
}
|
185 |
}
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
}
|
190 |
}
|
191 |
}
|
76 |
{
|
77 |
if(isset($_GET['action']))
|
78 |
{
|
79 |
+
if($_GET['page'] === 'WPvivid')
|
80 |
{
|
81 |
+
if($_GET['action']=='wpvivid_google_drive_auth')
|
82 |
+
{
|
83 |
+
$auth_id = uniqid('wpvivid-auth-');
|
84 |
+
$res = $this -> compare_php_version();
|
85 |
+
if($res['result'] == WPVIVID_FAILED){
|
86 |
+
echo '<div class="notice notice-warning is-dismissible"><p>'.$res['error'].'</p></div>';
|
87 |
+
return ;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
88 |
}
|
89 |
+
try {
|
90 |
+
include_once WPVIVID_PLUGIN_DIR . '/vendor/autoload.php';
|
91 |
+
$client = new Google_Client();
|
92 |
+
$client->setAuthConfig($this->google_drive_secrets);
|
93 |
+
$client->setApprovalPrompt('force');
|
94 |
+
$client->addScope(Google_Service_Drive::DRIVE_FILE);
|
95 |
+
$client->setAccessType('offline');
|
96 |
+
$client->setState(admin_url() . 'admin.php?page=WPvivid' . '&action=wpvivid_google_drive_finish_auth&main_tab=storage&sub_tab=googledrive&sub_page=storage_account_google_drive&auth_id='.$auth_id);
|
97 |
+
$auth_url = $client->createAuthUrl();
|
98 |
+
$remote_options['auth_id']=$auth_id;
|
99 |
+
update_option('wpvivid_tmp_remote_options',$remote_options);
|
100 |
+
header('Location: ' . filter_var($auth_url, FILTER_SANITIZE_URL));
|
101 |
}
|
102 |
+
catch (Exception $e){
|
103 |
+
if($e->getMessage() === 'file does not exist'){
|
104 |
+
$error_msg = __('Authentication failed, the client_secrets.json file is missing. Please make sure the client_secrets.json file is in wpvivid-backuprestore\includes\customclass directory.', 'wpvivid-backuprestore');
|
105 |
+
echo '<div class="notice notice-error"><p>'.$error_msg.'</p></div>';
|
106 |
+
}
|
107 |
+
else if($e->getMessage() === 'invalid json for auth config'){
|
108 |
+
$error_msg = __('Authentication failed, the format of the client_secrets.json file is incorrect. Please delete and re-install the plugin to recreate the file.', 'wpvivid-backuprestore');
|
109 |
+
echo '<div class="notice notice-error"><p>'.$error_msg.'</p></div>';
|
110 |
+
}
|
111 |
+
else{
|
112 |
+
echo '<div class="notice notice-error"><p>'.$e->getMessage().'</p></div>';
|
113 |
+
}
|
114 |
}
|
115 |
}
|
116 |
+
else if($_GET['action']=='wpvivid_google_drive_finish_auth')
|
|
|
|
|
|
|
117 |
{
|
118 |
+
try
|
119 |
{
|
120 |
+
if(isset($_GET['error']))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
121 |
{
|
122 |
+
header('Location: '.admin_url().'admin.php?page='.WPVIVID_PLUGIN_SLUG.'&action=wpvivid_google_drive&main_tab=storage&sub_tab=googledrive&sub_page=storage_account_google_drive&result=error&resp_msg='.sanitize_text_field($_GET['error']));
|
123 |
return;
|
124 |
}
|
|
|
125 |
|
126 |
+
$remoteslist = WPvivid_Setting::get_all_remote_options();
|
127 |
+
foreach ($remoteslist as $key => $value)
|
|
|
|
|
|
|
|
|
|
|
|
|
128 |
{
|
129 |
+
if (isset($value['auth_id']) && isset($_GET['auth_id']) && $value['auth_id'] == sanitize_text_field($_GET['auth_id']))
|
130 |
{
|
131 |
+
_e('<div class="notice notice-success is-dismissible"><p>You have authenticated the Google Drive account as your remote storage.</p></div>');
|
132 |
+
return;
|
133 |
+
}
|
134 |
+
}
|
135 |
+
|
136 |
+
$tmp_options=get_option('wpvivid_tmp_remote_options',false);
|
137 |
+
if($tmp_options===false)
|
138 |
+
{
|
139 |
+
return;
|
140 |
+
}
|
141 |
+
else
|
142 |
+
{
|
143 |
+
if($tmp_options['auth_id']===$_GET['auth_id'])
|
144 |
+
{
|
145 |
+
if(empty($_POST['refresh_token']))
|
146 |
{
|
147 |
+
if(empty($tmp_options['token']['refresh_token']))
|
148 |
+
{
|
149 |
+
$err = 'No refresh token was received from Google, which means that you entered client secret incorrectly, or that you did not re-authenticated yet after you corrected it. Please authenticate again.';
|
150 |
+
header('Location: '.admin_url().'admin.php?page='.WPVIVID_PLUGIN_SLUG.'&action=wpvivid_google_drive&main_tab=storage&sub_tab=googledrive&sub_page=storage_account_google_drive&result=error&resp_msg='.$err);
|
151 |
|
152 |
+
return;
|
153 |
+
}
|
154 |
}
|
155 |
+
else
|
156 |
+
{
|
157 |
+
$tmp_options['type'] = WPVIVID_REMOTE_GOOGLEDRIVE;
|
158 |
+
$tmp_options['token']['access_token'] = sanitize_text_field($_POST['access_token']);
|
159 |
+
$tmp_options['token']['expires_in'] = sanitize_text_field($_POST['expires_in']);
|
160 |
+
$tmp_options['token']['refresh_token'] = sanitize_text_field($_POST['refresh_token']);
|
161 |
+
$tmp_options['token']['scope'] = sanitize_text_field($_POST['scope']);
|
162 |
+
$tmp_options['token']['token_type'] = sanitize_text_field($_POST['token_type']);
|
163 |
+
$tmp_options['token']['created'] = sanitize_text_field($_POST['created']);
|
164 |
+
update_option('wpvivid_tmp_remote_options',$tmp_options);
|
165 |
+
}
|
166 |
+
$this->add_remote=true;
|
167 |
}
|
168 |
else
|
169 |
{
|
170 |
+
return;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
171 |
}
|
|
|
|
|
|
|
|
|
|
|
172 |
}
|
173 |
}
|
174 |
+
catch (Exception $e){
|
175 |
+
echo '<div class="notice notice-error"><p>'.$e->getMessage().'</p></div>';
|
176 |
+
}
|
177 |
}
|
178 |
+
else if($_GET['action']=='wpvivid_google_drive')
|
179 |
+
{
|
180 |
+
try {
|
181 |
+
if (isset($_GET['result'])) {
|
182 |
+
if ($_GET['result'] == 'success') {
|
183 |
+
add_action('show_notice', array($this, 'wpvivid_show_notice_add_google_drive_success'));
|
184 |
+
} else if ($_GET['result'] == 'error') {
|
185 |
+
add_action('show_notice', array($this, 'wpvivid_show_notice_add_google_drive_error'));
|
186 |
+
}
|
|
|
|
|
|
|
187 |
}
|
188 |
}
|
189 |
+
catch (Exception $e){
|
190 |
+
_e('<div class="notice notice-error"><p>'.$e->getMessage().'</p></div>');
|
191 |
+
}
|
192 |
}
|
193 |
}
|
194 |
}
|
includes/staging/class-wpvivid-staging-copy-db-ex.php
CHANGED
@@ -357,6 +357,14 @@ class WPvivid_Staging_Copy_DB
|
|
357 |
$error=$db->last_error;
|
358 |
$wpvivid_plugin->staging->log->WriteLog($error, 'Warning');
|
359 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
360 |
}
|
361 |
|
362 |
if(!$this->task->is_restore())
|
357 |
$error=$db->last_error;
|
358 |
$wpvivid_plugin->staging->log->WriteLog($error, 'Warning');
|
359 |
}
|
360 |
+
|
361 |
+
$delete_query = $db->prepare("DELETE FROM {$prefix}options WHERE option_name = %s", 'wpvivid_backup_list');
|
362 |
+
$wpvivid_plugin->staging->log->WriteLog($delete_query, 'notice');
|
363 |
+
if ($db->get_results($delete_query)===false)
|
364 |
+
{
|
365 |
+
$error=$db->last_error;
|
366 |
+
$wpvivid_plugin->staging->log->WriteLog($error, 'Warning');
|
367 |
+
}
|
368 |
}
|
369 |
|
370 |
if(!$this->task->is_restore())
|
includes/staging/class-wpvivid-staging-list-ui-display.php
CHANGED
@@ -158,7 +158,7 @@ class WPvivid_Staging_List_UI_Display_Free
|
|
158 |
{
|
159 |
$staging_create_time = $staging['create_time'];
|
160 |
$offset=get_option('gmt_offset');
|
161 |
-
$utc_time = $staging_create_time
|
162 |
$staging_create_time = date('M-d-Y H:i', $utc_time);
|
163 |
}
|
164 |
else
|
@@ -170,7 +170,7 @@ class WPvivid_Staging_List_UI_Display_Free
|
|
170 |
{
|
171 |
$staging_copy_time = $staging['copy_time'];
|
172 |
$offset=get_option('gmt_offset');
|
173 |
-
$utc_time = $staging_copy_time
|
174 |
$staging_copy_time = date('M-d-Y H:i', $utc_time);
|
175 |
}
|
176 |
else
|
158 |
{
|
159 |
$staging_create_time = $staging['create_time'];
|
160 |
$offset=get_option('gmt_offset');
|
161 |
+
$utc_time = $staging_create_time + $offset * 60 * 60;
|
162 |
$staging_create_time = date('M-d-Y H:i', $utc_time);
|
163 |
}
|
164 |
else
|
170 |
{
|
171 |
$staging_copy_time = $staging['copy_time'];
|
172 |
$offset=get_option('gmt_offset');
|
173 |
+
$utc_time = $staging_copy_time + $offset * 60 * 60;
|
174 |
$staging_copy_time = date('M-d-Y H:i', $utc_time);
|
175 |
}
|
176 |
else
|
includes/staging/class-wpvivid-staging-log-page.php
CHANGED
@@ -486,7 +486,7 @@ class WPvivid_Staging_Log_Page_Free
|
|
486 |
<td>'.__($value['des'], 'wpvivid-backuprestore').'</td>
|
487 |
<td>'.__($value['file_name'], 'wpvivid-backuprestore').'</td>
|
488 |
<td>
|
489 |
-
<a onclick="wpvivid_read_log(\''.'wpvivid_view_log'.'\', \''.$value['
|
490 |
<img src="'.esc_url(WPVIVID_PLUGIN_URL.$pic_log).'" style="vertical-align:middle;">Log
|
491 |
</a>
|
492 |
</td>
|
@@ -642,6 +642,14 @@ class WPvivid_Staging_Log_Page_Free
|
|
642 |
$log_file['des']='';
|
643 |
$log_file['time']='';
|
644 |
$log_file['error']=false;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
645 |
$line = fgets($handle);
|
646 |
if($line!==false)
|
647 |
{
|
486 |
<td>'.__($value['des'], 'wpvivid-backuprestore').'</td>
|
487 |
<td>'.__($value['file_name'], 'wpvivid-backuprestore').'</td>
|
488 |
<td>
|
489 |
+
<a onclick="wpvivid_read_log(\''.'wpvivid_view_log'.'\', \''.$value['file_name'].'\', \''.'staging'.'\', \''.$value['result'].'\')" style="cursor:pointer;">
|
490 |
<img src="'.esc_url(WPVIVID_PLUGIN_URL.$pic_log).'" style="vertical-align:middle;">Log
|
491 |
</a>
|
492 |
</td>
|
642 |
$log_file['des']='';
|
643 |
$log_file['time']='';
|
644 |
$log_file['error']=false;
|
645 |
+
if(preg_match('/error/', $file))
|
646 |
+
{
|
647 |
+
$log_file['result']='failed';
|
648 |
+
}
|
649 |
+
else
|
650 |
+
{
|
651 |
+
$log_file['result']='success';
|
652 |
+
}
|
653 |
$line = fgets($handle);
|
654 |
if($line!==false)
|
655 |
{
|
readme.txt
CHANGED
@@ -1,14 +1,14 @@
|
|
1 |
-
=== Migration, Backup, Staging - WPvivid
|
2 |
Contributors: wpvivid
|
3 |
Tags: move, clone, migrate, staging, backup, restore, auto backup, cloud backup
|
4 |
Requires at least: 4.5
|
5 |
-
Tested up to: 5.
|
6 |
Requires PHP: 5.3
|
7 |
-
Stable tag: 0.9.
|
8 |
License: GPLv3 or later
|
9 |
License URI: https://www.gnu.org/licenses/gpl-3.0.en.html
|
10 |
|
11 |
-
|
12 |
|
13 |
== Description ==
|
14 |
WPvivid Backup Plugin offers backup, migration, and staging as basic features, and is integrating more and more elegant features, such as unused images cleaner etc.
|
@@ -192,6 +192,13 @@ Thank you for translating WPvivid Backup Plugin to your languages!
|
|
192 |
* [Nima](https://profiles.wordpress.org/nima78600/) (Persian)
|
193 |
|
194 |
== Changelog ==
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
195 |
= 0.9.69 =
|
196 |
- Updated: For security reasons, adding Google Drive, Dropbox, OneDrive now needs to get authentication first.
|
197 |
- Updated: Changed time in a log file to local time.
|
1 |
+
=== Migration, Backup, Staging - WPvivid ===
|
2 |
Contributors: wpvivid
|
3 |
Tags: move, clone, migrate, staging, backup, restore, auto backup, cloud backup
|
4 |
Requires at least: 4.5
|
5 |
+
Tested up to: 5.9.2
|
6 |
Requires PHP: 5.3
|
7 |
+
Stable tag: 0.9.70
|
8 |
License: GPLv3 or later
|
9 |
License URI: https://www.gnu.org/licenses/gpl-3.0.en.html
|
10 |
|
11 |
+
Migrate, staging, back up WP.
|
12 |
|
13 |
== Description ==
|
14 |
WPvivid Backup Plugin offers backup, migration, and staging as basic features, and is integrating more and more elegant features, such as unused images cleaner etc.
|
192 |
* [Nima](https://profiles.wordpress.org/nima78600/) (Persian)
|
193 |
|
194 |
== Changelog ==
|
195 |
+
= 0.9.70 =
|
196 |
+
- Fixed: There was no notification after restoration in some environments.
|
197 |
+
- Fixed some vulnerabilities in the plugin code.
|
198 |
+
- Fixed: Backup information of live site would be copied to the staging site when creating a staging site.
|
199 |
+
- Changed staging site creation time to local time.
|
200 |
+
- Fixed some bugs in the plugin code.
|
201 |
+
- Successfully tested with WordPress 5.9.2.
|
202 |
= 0.9.69 =
|
203 |
- Updated: For security reasons, adding Google Drive, Dropbox, OneDrive now needs to get authentication first.
|
204 |
- Updated: Changed time in a log file to local time.
|
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.
|
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.
|
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.70
|
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.70' );
|
25 |
//
|
26 |
define('WPVIVID_RESTORE_INIT','init');
|
27 |
define('WPVIVID_RESTORE_READY','ready');
|