Version Description
- Refined descriptions on the user interface.
- Fixed a few interface errors.
- Fixed a bug where backup is runnable in some cases during the process of a restoration.
Download this release
Release Info
Developer | wpvivid |
Plugin | Migration, Backup, Staging – WPvivid |
Version | 0.9.5 |
Comparing to | |
See all releases |
Code changes from version 0.9.4 to 0.9.5
- admin/class-wpvivid-admin.php +7 -6
- admin/css/wpvivid-admin.css +23 -19
- admin/js/wpvivid-admin.js +34 -13
- admin/partials/wpvivid-admin-display.php +160 -140
- includes/class-wpvivid-backup-database.php +2 -1
- includes/class-wpvivid-backup-site.php +12 -9
- includes/class-wpvivid-backup.php +115 -84
- includes/class-wpvivid-backuplist.php +7 -0
- includes/class-wpvivid-mysqldump.php +29 -2
- includes/class-wpvivid-restore.php +0 -1
- includes/class-wpvivid-schedule.php +3 -28
- includes/class-wpvivid-setting.php +8 -17
- includes/class-wpvivid-zipclass.php +61 -1
- includes/class-wpvivid.php +218 -161
- readme.txt +13 -6
- wpvivid-backuprestore.php +10 -17
admin/class-wpvivid-admin.php
CHANGED
@@ -128,11 +128,11 @@ class WPvivid_Admin {
|
|
128 |
*
|
129 |
*/
|
130 |
add_menu_page(__('WPvivid'), __('WPvivid'), 'administrator', $this->plugin_name, array($this, 'display_plugin_backup_page'), false, 100);
|
131 |
-
add_submenu_page($this->plugin_name, __('WPvivid'), __('Backup / Restore'), 'administrator', $this->plugin_name, array($this, 'display_plugin_backup_page'), false, 100);
|
132 |
-
add_submenu_page($this->plugin_name, __('WPvivid'), __('Settings'), 'administrator', 'wpvivid-setting', array($this, 'display_plugin_setting_page'), false, 100);
|
133 |
-
add_submenu_page($this->plugin_name, __('WPvivid'), __('Remote Storage'), 'administrator', 'wpvivid-remote', array($this, 'display_plugin_remote_page'), false, 100);
|
134 |
-
add_submenu_page($this->plugin_name, __('WPvivid'), __('Website Info'), 'administrator', 'wpvivid-website', array($this, 'display_plugin_website_page'), false, 100);
|
135 |
-
add_submenu_page($this->plugin_name, __('WPvivid'), __('Logs'), 'administrator', 'wpvivid-log', array($this, 'display_plugin_log_page'), false, 100);
|
136 |
}
|
137 |
|
138 |
function add_toolbar_items($wp_admin_bar){
|
@@ -179,7 +179,7 @@ class WPvivid_Admin {
|
|
179 |
|
180 |
public function add_action_links( $links ) {
|
181 |
$settings_link = array(
|
182 |
-
'<a href="' . admin_url( '
|
183 |
);
|
184 |
return array_merge( $settings_link, $links );
|
185 |
}
|
@@ -262,4 +262,5 @@ class WPvivid_Admin {
|
|
262 |
global $request_page;
|
263 |
return $request_page;
|
264 |
}
|
|
|
265 |
}
|
128 |
*
|
129 |
*/
|
130 |
add_menu_page(__('WPvivid'), __('WPvivid'), 'administrator', $this->plugin_name, array($this, 'display_plugin_backup_page'), false, 100);
|
131 |
+
add_submenu_page($this->plugin_name, __('WPvivid'), __('Backup / Restore', 'wpvivid'), 'administrator', $this->plugin_name, array($this, 'display_plugin_backup_page'), false, 100);
|
132 |
+
add_submenu_page($this->plugin_name, __('WPvivid'), __('Settings', 'wpvivid'), 'administrator', 'wpvivid-setting', array($this, 'display_plugin_setting_page'), false, 100);
|
133 |
+
add_submenu_page($this->plugin_name, __('WPvivid'), __('Remote Storage', 'wpvivid'), 'administrator', 'wpvivid-remote', array($this, 'display_plugin_remote_page'), false, 100);
|
134 |
+
add_submenu_page($this->plugin_name, __('WPvivid'), __('Website Info', 'wpvivid'), 'administrator', 'wpvivid-website', array($this, 'display_plugin_website_page'), false, 100);
|
135 |
+
add_submenu_page($this->plugin_name, __('WPvivid'), __('Logs', 'wpvivid'), 'administrator', 'wpvivid-log', array($this, 'display_plugin_log_page'), false, 100);
|
136 |
}
|
137 |
|
138 |
function add_toolbar_items($wp_admin_bar){
|
179 |
|
180 |
public function add_action_links( $links ) {
|
181 |
$settings_link = array(
|
182 |
+
'<a href="' . admin_url( 'admin.php?page=' . $this->plugin_name ) . '">' . __('Settings', $this->plugin_name) . '</a>',
|
183 |
);
|
184 |
return array_merge( $settings_link, $links );
|
185 |
}
|
262 |
global $request_page;
|
263 |
return $request_page;
|
264 |
}
|
265 |
+
|
266 |
}
|
admin/css/wpvivid-admin.css
CHANGED
@@ -7,7 +7,7 @@
|
|
7 |
.list-top-chip::after{content:" "}
|
8 |
.backup-basic-info{min-width:300px; margin:10px; float:left;}
|
9 |
.list-top-chip-button{position:absolute; top:8px; right:10px;}
|
10 |
-
.quickbackup{width:calc(100% - 290px);float:left; box-sizing:border-box;margin-right:10px;}
|
11 |
.quickbackup label{display:inline-block;margin-bottom:10px;}
|
12 |
.qucikbackup-schedule{width:280px; float:left; box-sizing:border-box; min-width:280px;}
|
13 |
.quickstart-archive-block{width:33%;padding:10px; float:left; position:relative; box-sizing:border-box; }
|
@@ -15,11 +15,11 @@
|
|
15 |
.quickstart-storage-block{width:33%;padding:10px; float:left; position:relative; box-sizing:border-box;}
|
16 |
.quickstart-btn{width:33%;padding:10px; float:left; position:relative; box-sizing:border-box;}
|
17 |
.quickbackup-btn{display:block !important; margin:0 auto !important;width:150px;height:50px !important; line-height:48px !important; font-size:20px !important;}
|
18 |
-
.schedule-block{float:left;width:100%;padding:0 10px 10px 10px;}
|
19 |
.postbox:after{content: ".";display: block;height: 0;clear: both;visibility: hidden;}
|
20 |
.quickbackup-block .fieldset label{margin-bottom:5px;}
|
21 |
.custom-info{padding:10px;}
|
22 |
-
.quickstart-storage-setting{width:100%; padding-left:10px;
|
23 |
.storage-column-left{width:15%;float:left;height:100%;min-width:100px;}
|
24 |
.storage-column-right{margin-left:15%; width:auto;height:100%;position:relative;min-width:350px;box-sizing:border-box;}
|
25 |
.storage-menu{background-color: #e5e5e5;display: block;padding: 5px;text-decoration: none; }
|
@@ -51,7 +51,7 @@
|
|
51 |
.display-common-content{width:auto;position:relative;margin-top:10px;}
|
52 |
.wpvivid-common-btn-ok{width:80px;height:20px;line-height:20px;margin-top:10px;margin-bottom:10px;margin-left:10px;float:right;margin-right:10px;font-size:12px;}
|
53 |
.wpvivid-common-btn-cancel{width:80px;height:20px;line-height:20px;margin-top:10px;float:right;font-size:12px;}
|
54 |
-
.backup-log-btn{
|
55 |
.middle-loading {border-radius: 100%;border-style: solid;animation: rotate 1s infinite linear;}
|
56 |
.middle-loading.forty {border-color: #f1f1f1;border-top-color: #757575;border-width: 3px;height: 30px;width: 30px;margin-top:5px;margin-right:10px;margin-left:10px;}
|
57 |
@keyframes rotate { 0% { transform: rotate(0); } 100% { transform: rotate(359.9deg); } }
|
@@ -95,6 +95,7 @@
|
|
95 |
}
|
96 |
|
97 |
}
|
|
|
98 |
@media screen and (max-width:1315px) {
|
99 |
.quickstart-storage-block{
|
100 |
width:50%;
|
@@ -107,20 +108,9 @@
|
|
107 |
float:none;
|
108 |
width:100%;
|
109 |
}
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
float:none;
|
114 |
-
width:100%;
|
115 |
-
}
|
116 |
-
.quickstart-archive-block{
|
117 |
-
float:none;
|
118 |
-
width:100%;
|
119 |
-
}
|
120 |
-
.quickstart-btn{
|
121 |
-
float:none;
|
122 |
-
width:100%;
|
123 |
-
}
|
124 |
}
|
125 |
@media screen and (max-width:800px){
|
126 |
.tablelistcolumn{
|
@@ -147,4 +137,18 @@
|
|
147 |
.storage-account-form input{
|
148 |
width:360px;
|
149 |
}
|
150 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
.list-top-chip::after{content:" "}
|
8 |
.backup-basic-info{min-width:300px; margin:10px; float:left;}
|
9 |
.list-top-chip-button{position:absolute; top:8px; right:10px;}
|
10 |
+
.quickbackup{width:calc(100% - 290px);float:left; box-sizing:border-box;margin-right:10px; padding:10px;}
|
11 |
.quickbackup label{display:inline-block;margin-bottom:10px;}
|
12 |
.qucikbackup-schedule{width:280px; float:left; box-sizing:border-box; min-width:280px;}
|
13 |
.quickstart-archive-block{width:33%;padding:10px; float:left; position:relative; box-sizing:border-box; }
|
15 |
.quickstart-storage-block{width:33%;padding:10px; float:left; position:relative; box-sizing:border-box;}
|
16 |
.quickstart-btn{width:33%;padding:10px; float:left; position:relative; box-sizing:border-box;}
|
17 |
.quickbackup-btn{display:block !important; margin:0 auto !important;width:150px;height:50px !important; line-height:48px !important; font-size:20px !important;}
|
18 |
+
.schedule-block{float:left;width:100%;padding:0 10px 10px 10px;box-sizing:border-box;}
|
19 |
.postbox:after{content: ".";display: block;height: 0;clear: both;visibility: hidden;}
|
20 |
.quickbackup-block .fieldset label{margin-bottom:5px;}
|
21 |
.custom-info{padding:10px;}
|
22 |
+
.quickstart-storage-setting{width:100%;float:left; padding-left:10px; box-sizing:border-box;background-color:#f1f1f1; margin-bottom:10px;}
|
23 |
.storage-column-left{width:15%;float:left;height:100%;min-width:100px;}
|
24 |
.storage-column-right{margin-left:15%; width:auto;height:100%;position:relative;min-width:350px;box-sizing:border-box;}
|
25 |
.storage-menu{background-color: #e5e5e5;display: block;padding: 5px;text-decoration: none; }
|
51 |
.display-common-content{width:auto;position:relative;margin-top:10px;}
|
52 |
.wpvivid-common-btn-ok{width:80px;height:20px;line-height:20px;margin-top:10px;margin-bottom:10px;margin-left:10px;float:right;margin-right:10px;font-size:12px;}
|
53 |
.wpvivid-common-btn-cancel{width:80px;height:20px;line-height:20px;margin-top:10px;float:right;font-size:12px;}
|
54 |
+
.backup-log-btn{height:30px;float:left; margin-left:10px; margin-bottom:10px;}
|
55 |
.middle-loading {border-radius: 100%;border-style: solid;animation: rotate 1s infinite linear;}
|
56 |
.middle-loading.forty {border-color: #f1f1f1;border-top-color: #757575;border-width: 3px;height: 30px;width: 30px;margin-top:5px;margin-right:10px;margin-left:10px;}
|
57 |
@keyframes rotate { 0% { transform: rotate(0); } 100% { transform: rotate(359.9deg); } }
|
95 |
}
|
96 |
|
97 |
}
|
98 |
+
|
99 |
@media screen and (max-width:1315px) {
|
100 |
.quickstart-storage-block{
|
101 |
width:50%;
|
108 |
float:none;
|
109 |
width:100%;
|
110 |
}
|
111 |
+
/* .quickstart-archive-block{
|
112 |
+
border-left:50px solid #0073aa;
|
113 |
+
} */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
114 |
}
|
115 |
@media screen and (max-width:800px){
|
116 |
.tablelistcolumn{
|
137 |
.storage-account-form input{
|
138 |
width:360px;
|
139 |
}
|
140 |
+
}
|
141 |
+
@media screen and (max-width:600px) {
|
142 |
+
.quickstart-storage-block{
|
143 |
+
float:none;
|
144 |
+
width:100%;
|
145 |
+
}
|
146 |
+
.quickstart-archive-block{
|
147 |
+
float:none;
|
148 |
+
width:100%;
|
149 |
+
}
|
150 |
+
.quickstart-btn{
|
151 |
+
float:none;
|
152 |
+
width:100%;
|
153 |
+
}
|
154 |
+
}
|
admin/js/wpvivid-admin.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
var task_retry_times=0;
|
2 |
-
var running_backup_taskid;
|
3 |
var tmp_current_click_backupid = '';
|
4 |
var m_need_update=true;
|
5 |
var m_restore_backup_id;
|
@@ -281,10 +281,10 @@ function wpvivid_check_runningtask(){
|
|
281 |
if (value.data.doing !== '') {
|
282 |
var percent = 0;
|
283 |
if (value.data.type === 'backup') {
|
284 |
-
percent = value.data.progress
|
285 |
}
|
286 |
else if (value.data.type === 'upload') {
|
287 |
-
percent =
|
288 |
}
|
289 |
percent = percent + '%';
|
290 |
jQuery('#wpvivid_action_progress_bar_percent').css('width', percent);
|
@@ -308,10 +308,10 @@ function wpvivid_check_runningtask(){
|
|
308 |
jQuery('#wpvivid_postbox_backup_percent').show();
|
309 |
var percent = 0;
|
310 |
if (value.data.type === 'backup') {
|
311 |
-
percent = value.data.progress
|
312 |
}
|
313 |
else if (value.data.type === 'upload') {
|
314 |
-
percent =
|
315 |
}
|
316 |
percent = percent + '%';
|
317 |
jQuery('#wpvivid_action_progress_bar_percent').css('width', percent);
|
@@ -334,10 +334,10 @@ function wpvivid_check_runningtask(){
|
|
334 |
if (value.data.doing !== '') {
|
335 |
var percent = 0;
|
336 |
if (value.data.type === 'backup') {
|
337 |
-
percent = value.data.progress
|
338 |
}
|
339 |
else if (value.data.type === 'upload') {
|
340 |
-
percent =
|
341 |
}
|
342 |
percent = percent + '%';
|
343 |
jQuery('#wpvivid_action_progress_bar_percent').css('width', percent);
|
@@ -378,6 +378,20 @@ function wpvivid_check_runningtask(){
|
|
378 |
});
|
379 |
}
|
380 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
381 |
if (jsonarray.download.data.length !== 0) {
|
382 |
b_has_data = true;
|
383 |
task_retry_times = 0;
|
@@ -444,6 +458,8 @@ function wpvivid_check_runningtask(){
|
|
444 |
m_need_update = true;
|
445 |
}
|
446 |
}
|
|
|
|
|
447 |
}
|
448 |
catch(err){
|
449 |
setTimeout(function()
|
@@ -1138,7 +1154,7 @@ function wpvivid_retrieve_backup_list(){
|
|
1138 |
'<div class="common-table">' +
|
1139 |
'<span title="Lock the backup, it won\'t be deleted automatically">' +
|
1140 |
'<img src="' + wpvivid_plugurl + backup_lock_img + '" name="' + backup_lock_status + '" onclick="wpvivid_set_backup_lock(\'' + index + '\', \'' + backup_lock_status + '\');" style="vertical-align:middle; cursor:pointer;"/>' +
|
1141 |
-
'</span> | <span>Type: </span><span>' + value1.type + '</span>|<span><a href="#" onclick="wpvivid_initialize_log(\'' + index + '\');"><img src="' + wpvivid_plugurl + '/images/Log.png" name="' + backup_lock_status + '" style="vertical-align:middle;cursor:pointer;"/>Log</a></span>|<a href="#" onclick="wpvivid_initialize_restore(\'' + index + '\', \'' + value1.create_time + '\');"><img src="' + wpvivid_plugurl + '/images/Restore.png" style="vertical-align:middle;cursor:pointer;"/>Restore</a></span>' +
|
1142 |
'</div>' +
|
1143 |
'</div>' +
|
1144 |
'</td>' +
|
@@ -1151,7 +1167,7 @@ function wpvivid_retrieve_backup_list(){
|
|
1151 |
'</td>' +
|
1152 |
'<td class="tablelistcolumn">' +
|
1153 |
'<div id="wpvivid_file_part_' + index + '" style="float:left;padding:10px 10px 10px 0px;">' +
|
1154 |
-
'<div style="cursor:pointer;" onclick="wpvivid_initialize_download(\'' + index + '\');">' +
|
1155 |
'<img id="wpvivid_download_btn_' + index + '" src="' + wpvivid_plugurl + '/images/download.png" style="vertical-align:middle;" />Download' +
|
1156 |
'<div class="spinner" id="wpvivid_download_loading_' + index + '" style="float:right;width:auto;height:auto;padding:10px 180px 10px 0;background-position:0 0;"></div>' +
|
1157 |
'</div>' +
|
@@ -1320,7 +1336,6 @@ function wpvivid_set_general_settings(){
|
|
1320 |
'time': {
|
1321 |
'type': backup_time,
|
1322 |
'start_time': {
|
1323 |
-
'current_day': '00:00',
|
1324 |
'day': '01',
|
1325 |
'week': 'mon'
|
1326 |
}
|
@@ -1659,7 +1674,7 @@ function wpvivid_interface_flow_control(){
|
|
1659 |
wpvivid_settings_changed = true;
|
1660 |
});
|
1661 |
|
1662 |
-
jQuery('#settings-page input[type=text]').on("
|
1663 |
wpvivid_settings_changed = true;
|
1664 |
});
|
1665 |
|
@@ -1953,7 +1968,7 @@ function wpvivid_reset_backup_list(){
|
|
1953 |
if (j == 2) {
|
1954 |
var backup_id = jQuery(this).parent().children('th').find("input[type=checkbox]").attr("id");
|
1955 |
var download_btn = '<div id="wpvivid_file_part_' + backup_id + '" style="float:left;padding:10px 10px 10px 0px;">' +
|
1956 |
-
'<div style="cursor:pointer;" onclick="wpvivid_initialize_download(\'' + backup_id + '\');">' +
|
1957 |
'<img id="wpvivid_download_btn_' + backup_id + '" src="' + wpvivid_plugurl + '/images/download.png" style="vertical-align:middle;" />Download' +
|
1958 |
'<div class="spinner" id="wpvivid_download_loading_' + backup_id + '" style="float:right;width:auto;height:auto;padding:10px 180px 10px 0;background-position:0 0;"></div>' +
|
1959 |
'</div>' +
|
@@ -2653,8 +2668,12 @@ function wpvivid_close_main_tab(type){
|
|
2653 |
event.stopPropagation();
|
2654 |
if(type === 'log'){
|
2655 |
jQuery('#wpvivid_tab_read_log').hide();
|
|
|
|
|
|
|
|
|
|
|
2656 |
}
|
2657 |
-
wpvivid_click_switch_page('wpvivid_tab_log', '');
|
2658 |
}
|
2659 |
|
2660 |
|
@@ -3102,6 +3121,7 @@ function wpvivid_restore_lock(){
|
|
3102 |
jQuery('#wpvivid_postbox_backup_percent').css({'pointer-events': 'none', 'opacity': '1'});
|
3103 |
jQuery('#wpvivid_postbox_backup').css({'pointer-events': 'none', 'opacity': '1'});
|
3104 |
jQuery('#wpvivid_postbox_backup_schedule').css({'pointer-events': 'none', 'opacity': '1'});
|
|
|
3105 |
jQuery('#page-backups').css({'pointer-events': 'none', 'opacity': '1'});
|
3106 |
jQuery('#storage-page').css({'pointer-events': 'none', 'opacity': '1'});
|
3107 |
jQuery('#settings-page').css({'pointer-events': 'none', 'opacity': '1'});
|
@@ -3116,6 +3136,7 @@ function wpvivid_restore_unlock(){
|
|
3116 |
jQuery('#wpvivid_postbox_backup_percent').css({'pointer-events': 'auto', 'opacity': '1'});
|
3117 |
jQuery('#wpvivid_postbox_backup').css({'pointer-events': 'auto', 'opacity': '1'});
|
3118 |
jQuery('#wpvivid_postbox_backup_schedule').css({'pointer-events': 'auto', 'opacity': '1'});
|
|
|
3119 |
jQuery('#page-backups').css({'pointer-events': 'auto', 'opacity': '1'});
|
3120 |
jQuery('#storage-page').css({'pointer-events': 'auto', 'opacity': '1'});
|
3121 |
jQuery('#settings-page').css({'pointer-events': 'auto', 'opacity': '1'});
|
1 |
var task_retry_times=0;
|
2 |
+
var running_backup_taskid='';
|
3 |
var tmp_current_click_backupid = '';
|
4 |
var m_need_update=true;
|
5 |
var m_restore_backup_id;
|
281 |
if (value.data.doing !== '') {
|
282 |
var percent = 0;
|
283 |
if (value.data.type === 'backup') {
|
284 |
+
percent = value.data.progress;
|
285 |
}
|
286 |
else if (value.data.type === 'upload') {
|
287 |
+
percent = value.data.progress;
|
288 |
}
|
289 |
percent = percent + '%';
|
290 |
jQuery('#wpvivid_action_progress_bar_percent').css('width', percent);
|
308 |
jQuery('#wpvivid_postbox_backup_percent').show();
|
309 |
var percent = 0;
|
310 |
if (value.data.type === 'backup') {
|
311 |
+
percent = value.data.progress;
|
312 |
}
|
313 |
else if (value.data.type === 'upload') {
|
314 |
+
percent = value.data.progress;
|
315 |
}
|
316 |
percent = percent + '%';
|
317 |
jQuery('#wpvivid_action_progress_bar_percent').css('width', percent);
|
334 |
if (value.data.doing !== '') {
|
335 |
var percent = 0;
|
336 |
if (value.data.type === 'backup') {
|
337 |
+
percent = value.data.progress;
|
338 |
}
|
339 |
else if (value.data.type === 'upload') {
|
340 |
+
percent = value.data.progress;
|
341 |
}
|
342 |
percent = percent + '%';
|
343 |
jQuery('#wpvivid_action_progress_bar_percent').css('width', percent);
|
378 |
});
|
379 |
}
|
380 |
}
|
381 |
+
else
|
382 |
+
{
|
383 |
+
if(running_backup_taskid !== '')
|
384 |
+
{
|
385 |
+
jQuery('#wpvivid_backup_cancel_btn').css({'pointer-events': 'auto', 'opacity': '1'});
|
386 |
+
jQuery('#wpvivid_backup_log_btn').css({'pointer-events': 'auto', 'opacity': '1'});
|
387 |
+
jQuery('#wpvivid_quickbackup_btn').css({'pointer-events': 'auto', 'opacity': '1'});
|
388 |
+
jQuery('#wpvivid_postbox_backup_percent').hide();
|
389 |
+
wpvivid_retrieve_last_backup_message();
|
390 |
+
wpvivid_retrieve_log_list();
|
391 |
+
running_backup_taskid='';
|
392 |
+
}
|
393 |
+
|
394 |
+
}
|
395 |
if (jsonarray.download.data.length !== 0) {
|
396 |
b_has_data = true;
|
397 |
task_retry_times = 0;
|
458 |
m_need_update = true;
|
459 |
}
|
460 |
}
|
461 |
+
|
462 |
+
|
463 |
}
|
464 |
catch(err){
|
465 |
setTimeout(function()
|
1154 |
'<div class="common-table">' +
|
1155 |
'<span title="Lock the backup, it won\'t be deleted automatically">' +
|
1156 |
'<img src="' + wpvivid_plugurl + backup_lock_img + '" name="' + backup_lock_status + '" onclick="wpvivid_set_backup_lock(\'' + index + '\', \'' + backup_lock_status + '\');" style="vertical-align:middle; cursor:pointer;"/>' +
|
1157 |
+
'</span> | <span>Type: </span><span>' + value1.type + '</span>|<span title="Backup log"><a href="#" onclick="wpvivid_initialize_log(\'' + index + '\');"><img src="' + wpvivid_plugurl + '/images/Log.png" name="' + backup_lock_status + '" style="vertical-align:middle;cursor:pointer;"/>Log</a></span>|<span title="Restore Website from The Backup"><a href="#" onclick="wpvivid_initialize_restore(\'' + index + '\', \'' + value1.create_time + '\');"><img src="' + wpvivid_plugurl + '/images/Restore.png" style="vertical-align:middle;cursor:pointer;"/>Restore</a></span>' +
|
1158 |
'</div>' +
|
1159 |
'</div>' +
|
1160 |
'</td>' +
|
1167 |
'</td>' +
|
1168 |
'<td class="tablelistcolumn">' +
|
1169 |
'<div id="wpvivid_file_part_' + index + '" style="float:left;padding:10px 10px 10px 0px;">' +
|
1170 |
+
'<div style="cursor:pointer;" onclick="wpvivid_initialize_download(\'' + index + '\');" title="Prepare to download the backup">' +
|
1171 |
'<img id="wpvivid_download_btn_' + index + '" src="' + wpvivid_plugurl + '/images/download.png" style="vertical-align:middle;" />Download' +
|
1172 |
'<div class="spinner" id="wpvivid_download_loading_' + index + '" style="float:right;width:auto;height:auto;padding:10px 180px 10px 0;background-position:0 0;"></div>' +
|
1173 |
'</div>' +
|
1336 |
'time': {
|
1337 |
'type': backup_time,
|
1338 |
'start_time': {
|
|
|
1339 |
'day': '01',
|
1340 |
'week': 'mon'
|
1341 |
}
|
1674 |
wpvivid_settings_changed = true;
|
1675 |
});
|
1676 |
|
1677 |
+
jQuery('#settings-page input[type=text]').on("keyup", function(){
|
1678 |
wpvivid_settings_changed = true;
|
1679 |
});
|
1680 |
|
1968 |
if (j == 2) {
|
1969 |
var backup_id = jQuery(this).parent().children('th').find("input[type=checkbox]").attr("id");
|
1970 |
var download_btn = '<div id="wpvivid_file_part_' + backup_id + '" style="float:left;padding:10px 10px 10px 0px;">' +
|
1971 |
+
'<div style="cursor:pointer;" onclick="wpvivid_initialize_download(\'' + backup_id + '\');" title="Prepare to download the backup">' +
|
1972 |
'<img id="wpvivid_download_btn_' + backup_id + '" src="' + wpvivid_plugurl + '/images/download.png" style="vertical-align:middle;" />Download' +
|
1973 |
'<div class="spinner" id="wpvivid_download_loading_' + backup_id + '" style="float:right;width:auto;height:auto;padding:10px 180px 10px 0;background-position:0 0;"></div>' +
|
1974 |
'</div>' +
|
2668 |
event.stopPropagation();
|
2669 |
if(type === 'log'){
|
2670 |
jQuery('#wpvivid_tab_read_log').hide();
|
2671 |
+
wpvivid_click_switch_page('wpvivid_tab_log', '');
|
2672 |
+
}
|
2673 |
+
else if(type === 'custom'){
|
2674 |
+
jQuery('#wpvivid_tab_custom_backup').hide();
|
2675 |
+
wpvivid_click_switch_page('wpvivid_tab_general', '');
|
2676 |
}
|
|
|
2677 |
}
|
2678 |
|
2679 |
|
3121 |
jQuery('#wpvivid_postbox_backup_percent').css({'pointer-events': 'none', 'opacity': '1'});
|
3122 |
jQuery('#wpvivid_postbox_backup').css({'pointer-events': 'none', 'opacity': '1'});
|
3123 |
jQuery('#wpvivid_postbox_backup_schedule').css({'pointer-events': 'none', 'opacity': '1'});
|
3124 |
+
jQuery('#wpvivid_quickbackup_btn').css({'pointer-events': 'none', 'opacity': '1'});
|
3125 |
jQuery('#page-backups').css({'pointer-events': 'none', 'opacity': '1'});
|
3126 |
jQuery('#storage-page').css({'pointer-events': 'none', 'opacity': '1'});
|
3127 |
jQuery('#settings-page').css({'pointer-events': 'none', 'opacity': '1'});
|
3136 |
jQuery('#wpvivid_postbox_backup_percent').css({'pointer-events': 'auto', 'opacity': '1'});
|
3137 |
jQuery('#wpvivid_postbox_backup').css({'pointer-events': 'auto', 'opacity': '1'});
|
3138 |
jQuery('#wpvivid_postbox_backup_schedule').css({'pointer-events': 'auto', 'opacity': '1'});
|
3139 |
+
jQuery('#wpvivid_quickbackup_btn').css({'pointer-events': 'auto', 'opacity': '1'});
|
3140 |
jQuery('#page-backups').css({'pointer-events': 'auto', 'opacity': '1'});
|
3141 |
jQuery('#storage-page').css({'pointer-events': 'auto', 'opacity': '1'});
|
3142 |
jQuery('#settings-page').css({'pointer-events': 'auto', 'opacity': '1'});
|
admin/partials/wpvivid-admin-display.php
CHANGED
@@ -14,6 +14,8 @@ if (!defined('WPVIVID_PLUGIN_DIR')){
|
|
14 |
die;
|
15 |
}
|
16 |
|
|
|
|
|
17 |
$last_backup_message=WPvivid_Setting::get_option('wpvivid_last_msg');
|
18 |
$backuplist=WPvivid_Backuplist::get_backuplist();
|
19 |
$remoteslist=WPvivid_Setting::get_all_remote_options();
|
@@ -40,12 +42,12 @@ $wpvivid_version=WPVIVID_PLUGIN_VERSION;
|
|
40 |
<div id="wpvivid_backup_notice"></div>
|
41 |
</div>
|
42 |
<h2 class="nav-tab-wrapper">
|
43 |
-
<a href="#" id="wpvivid_tab_general" class="nav-tab wrap-nav-tab nav-tab-active" onclick="switchTabs(event,'general-page')"><?php _e('Backup', 'wpvivid'); ?></a>
|
44 |
<a href="#" id="wpvivid_tab_setting" class="nav-tab wrap-nav-tab" onclick="switchTabs(event,'settings-page')"><?php _e('Settings', 'wpvivid'); ?></a>
|
45 |
<a href="#" id="wpvivid_tab_remote_storage" class="nav-tab wrap-nav-tab" onclick="switchTabs(event,'storage-page')"><?php _e('Remote Storage', 'wpvivid'); ?></a>
|
46 |
<a href="#" id="wpvivid_tab_debug" class="nav-tab wrap-nav-tab" onclick="switchTabs(event,'debug-page')"><?php _e('Website Info', 'wpvivid'); ?></a>
|
47 |
<a href="#" id="wpvivid_tab_log" class="nav-tab wrap-nav-tab" onclick="switchTabs(event,'logs-page')"><?php _e('Logs', 'wpvivid'); ?></a>
|
48 |
-
<a href="#" id="wpvivid_tab_read_log" class="nav-tab wrap-nav-tab delete" onclick="switchTabs(event,'log-read-page')" style="display: none">
|
49 |
<div style="margin-right: 15px;"><?php _e('Log', 'wpvivid'); ?></div>
|
50 |
<div class="nav-tab-delete-img">
|
51 |
<img src="<?php echo esc_url(plugins_url( 'images/delete-tab.png', __FILE__ )); ?>" style="vertical-align:middle; cursor:pointer;" onclick="wpvivid_close_main_tab('log');" />
|
@@ -58,7 +60,6 @@ $wpvivid_version=WPVIVID_PLUGIN_VERSION;
|
|
58 |
<div id="post-body-content">
|
59 |
<div class="inside" style="margin-top:0px;">
|
60 |
<div id="general-page" class="tabcontent wpvivid_tab_general" name="tab-backup" style="width:100%;">
|
61 |
-
|
62 |
<?php
|
63 |
$btn_style = 'pointer-events: auto; opacity: 1;';
|
64 |
$estimate_db_size='';
|
@@ -111,19 +112,22 @@ $wpvivid_version=WPVIVID_PLUGIN_VERSION;
|
|
111 |
<div class="backup-basic-info"><span><?php _e('Database Size:', 'wpvivid'); ?></span><span id="wpvivid_backup_database_size"><?php _e($estimate_db_size, 'wpvivid'); ?></span></div>
|
112 |
<div class="backup-basic-info"><span><?php _e('File Size:', 'wpvivid'); ?></span><span id="wpvivid_backup_file_size"><?php _e($estimate_file_size, 'wpvivid'); ?></span></div>
|
113 |
</div>
|
|
|
|
|
114 |
<div style="clear: both;"></div>
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
|
|
121 |
<div class="postbox quickbackup" id="wpvivid_postbox_backup">
|
122 |
<h2><span><?php _e( 'Back Up Manually','wpvivid'); ?></span></h2>
|
123 |
<div class="quickstart-storage-setting">
|
124 |
-
<
|
125 |
-
<
|
126 |
-
<
|
127 |
</div>
|
128 |
<div class="quickstart-archive-block">
|
129 |
<fieldset>
|
@@ -146,8 +150,8 @@ $wpvivid_version=WPVIVID_PLUGIN_VERSION;
|
|
146 |
<fieldset>
|
147 |
<legend class="screen-reader-text"><span>input type="checkbox"</span></legend>
|
148 |
<label>
|
149 |
-
<input type="checkbox" id="wpvivid_backup_local" name="backup-storage" value="" checked />
|
150 |
-
<span><?php _e( 'Save Backups
|
151 |
</label>
|
152 |
|
153 |
<div style="clear:both;"></div>
|
@@ -155,7 +159,7 @@ $wpvivid_version=WPVIVID_PLUGIN_VERSION;
|
|
155 |
<input type="checkbox" id="wpvivid_backup_remote" name="backup-storage" value="" />
|
156 |
<span><?php _e( 'Send Backup to Remote Storage:', 'wpvivid' ); ?></span>
|
157 |
</label><br>
|
158 |
-
<div id="upload_storage" style="cursor:pointer;">
|
159 |
<?php
|
160 |
$default_amazon_s3='images/storage-amazon-s3(gray).png';
|
161 |
$default_ftp='images/storage-ftp(gray).png';
|
@@ -186,14 +190,17 @@ $wpvivid_version=WPVIVID_PLUGIN_VERSION;
|
|
186 |
<div class="quickstart-btn" style="padding-top:20px;">
|
187 |
<input class="button-primary quickbackup-btn" id="wpvivid_quickbackup_btn" type="submit" value="<?php esc_attr_e( 'Backup Now', 'wpvivid'); ?>" <?php esc_attr_e($btn_style, 'wpvivid'); ?> />
|
188 |
<div class="schedule-tab-block" style="text-align:center;">
|
|
|
189 |
<label>
|
|
|
190 |
<input type="checkbox" id="wpvivid_backup_lock" name="lock-backup" value="" />
|
191 |
-
<span><?php _e( '
|
192 |
</label>
|
|
|
193 |
</div>
|
194 |
</div>
|
195 |
<div class="custom-info" style="float:left; width:100%;">
|
196 |
-
<
|
197 |
</div>
|
198 |
</div>
|
199 |
<div class="postbox qucikbackup-schedule" id="wpvivid_postbox_backup_schedule">
|
@@ -254,10 +261,16 @@ $wpvivid_version=WPVIVID_PLUGIN_VERSION;
|
|
254 |
</h2>
|
255 |
|
256 |
<div class="table-list-content wpvivid_tab_backup" id="page-backups">
|
257 |
-
<div style="margin-top:10px; margin-bottom:10px;"
|
258 |
-
<P><?php _e('
|
259 |
<ul><li><?php _e('->If backups are stored in remote storage, our plugin will retrieve the backup to your web server. This may take a little time depending on the size of backup files. Please be patient. Then you can download them to your PC.', 'wpvivid'); ?></li>
|
260 |
-
<li><?php _e('->
|
|
|
|
|
|
|
|
|
|
|
|
|
261 |
</ul>
|
262 |
</div>
|
263 |
<div style="clear:both;"></div>
|
@@ -277,7 +290,7 @@ $wpvivid_version=WPVIVID_PLUGIN_VERSION;
|
|
277 |
<tr>
|
278 |
<th class="check-column"><input name="check_backup" type="checkbox" id="<?php esc_attr_e($key, 'wpvivid'); ?>" value="<?php esc_attr_e($key, 'wpvivid'); ?>" onclick="wpvivid_click_check_backup('<?php _e($key, 'wpvivid'); ?>');" /></th>
|
279 |
<td class="tablelistcolumn">
|
280 |
-
<div style="float:left;padding:
|
281 |
<?php
|
282 |
if(empty($value['lock'])){
|
283 |
$backup_lock='images/unlocked.png';
|
@@ -295,12 +308,14 @@ $wpvivid_version=WPVIVID_PLUGIN_VERSION;
|
|
295 |
}
|
296 |
?>
|
297 |
|
298 |
-
<strong><?php _e(date('M d, Y H:i',$value['create_time']), 'wpvivid'); ?></strong></
|
299 |
<div class="common-table">
|
300 |
-
<span title="
|
301 |
<img src="<?php echo esc_url(plugins_url($backup_lock, __FILE__)); ?>" name="<?php esc_attr_e($lock_status, 'wpvivid'); ?>" onclick="wpvivid_set_backup_lock('<?php _e($key, 'wpvivid'); ?>', '<?php _e($lock_status, 'wpvivid'); ?>');" style="vertical-align:middle; cursor:pointer;"/>
|
302 |
-
</span>
|
303 |
-
|
|
|
|
|
304 |
</div>
|
305 |
|
306 |
</div>
|
@@ -330,7 +345,7 @@ $wpvivid_version=WPVIVID_PLUGIN_VERSION;
|
|
330 |
</td>
|
331 |
<td class="tablelistcolumn">
|
332 |
<div id="wpvivid_file_part_<?php _e($key, 'wpvivid'); ?>" style="float:left;padding:10px 10px 10px 0px;">
|
333 |
-
<div style="cursor:pointer;" onclick="wpvivid_initialize_download('<?php _e($key, 'wpvivid'); ?>');">
|
334 |
<img id="wpvivid_download_btn_<?php _e($key, 'wpvivid'); ?>" src="<?php echo esc_url(plugins_url( 'images/download.png', __FILE__ )); ?>" style="vertical-align:middle;" /><?php _e('Download', 'wpvivid'); ?>
|
335 |
<div class="spinner" id="wpvivid_download_loading_<?php _e($key, 'wpvivid'); ?>" style="float:right;width:auto;height:auto;padding:10px 180px 10px 0;background-position:0 0;"></div>
|
336 |
</div>
|
@@ -361,7 +376,7 @@ $wpvivid_version=WPVIVID_PLUGIN_VERSION;
|
|
361 |
<div class="table-list-content wpvivid_tab_restore" id="page-restore" style="display:none;">
|
362 |
<div>
|
363 |
<h3><?php _e('Restore backup from:', 'wpvivid'); ?><span id="wpvivid_restore_backup_time"></span></h3>
|
364 |
-
<p><strong><?php _e('Please do not close the page or switch to other pages when a restore task is running
|
365 |
<p><?php _e('Restore function will replace the current site\'s themes, plugins, uploads, database and/or other content directories with the existing equivalents in the selected backup.', 'wpvivid'); ?></p>
|
366 |
<div class="restore-button-position"><input class="button-primary" id="wpvivid_restore_btn" type="submit" name="restore" value="<?php esc_attr_e( 'Restore', 'wpvivid' ); ?>" onclick="wpvivid_start_restore();" /></div>
|
367 |
<div class="restore-button-position"><input class="button-primary" id="wpvivid_clean_restore" type="submit" name="clear_restore" value="<?php esc_attr_e( 'Clean Restore', 'wpvivid' ); ?>" /></div>
|
@@ -406,21 +421,21 @@ $wpvivid_version=WPVIVID_PLUGIN_VERSION;
|
|
406 |
</label>
|
407 |
</div>
|
408 |
</div>
|
409 |
-
<div id="storage_account_sftp"
|
410 |
<h2><span><?php _e( 'Enter Your SFTP Account ','wpvivid'); ?></span></h2>
|
411 |
<div class="storage-account-form"><input type="text" placeholder="Custom an unique name: e.g.SFTP-001" class="regular-text" id="storage_account_sftp_storagename" /></div>
|
412 |
<div class="storage-account-form"><input type="text" placeholder="Server IP Address" class="regular-text" id="storage_account_sftp_ip" /></div>
|
413 |
<div class="storage-account-form"><input type="text" placeholder="User Name" class="regular-text" id="storage_account_sftp_username" /></div>
|
414 |
<div class="storage-account-form"><input type="password" placeholder="Root Password" class="regular-text" id="storage_account_sftp_password" /></div>
|
415 |
<div class="storage-account-form"><input type="text" placeholder="Port" class="regular-text" id="storage_account_sftp_port" onkeyup="value=value.replace(/\D/g,'')" /></div>
|
416 |
-
<div class="storage-account-form"><input type="text" placeholder="Absolute
|
417 |
<div class="remote-storage-set-default-block">
|
418 |
<label for="sftp_default">
|
419 |
<input type="checkbox" id="sftp_default" checked><?php _e('Set as the default remote storage.', 'wpvivid'); ?>
|
420 |
</label>
|
421 |
</div>
|
422 |
</div>
|
423 |
-
<div id="storage_account_amazons3"
|
424 |
<h2><span><?php _e( 'Enter Your Amazon S3 Account ','wpvivid'); ?></span></h2>
|
425 |
<div class="storage-account-form"><input type="text" placeholder="Custom an unique name: Example: Amazon S3-001" class="regular-text" id="storage_account_amazons3_storagename" /></div>
|
426 |
<div class="storage-account-form"><input type="text" placeholder="Amazon S3 access key" class="regular-text" id="storage_account_amazons3_access_key" /></div>
|
@@ -497,6 +512,104 @@ $wpvivid_version=WPVIVID_PLUGIN_VERSION;
|
|
497 |
<div>
|
498 |
<table class="widefat">
|
499 |
<tbody>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
500 |
<tr>
|
501 |
<td class="row-title wpvivid-backup-settings-table tablelistcolumn"><label for="tablecell"><?php _e('Schedule Settings', 'wpvivid'); ?></label></td>
|
502 |
<td class="tablelistcolumn">
|
@@ -586,10 +699,14 @@ $wpvivid_version=WPVIVID_PLUGIN_VERSION;
|
|
586 |
<div class="postbox schedule-tab-block">
|
587 |
<label for="wpvivid_schedule_enable">
|
588 |
<input name="" type="checkbox" id="wpvivid_schedule_enable" value="1" <?php esc_attr_e($schedule_status, 'wpvivid'); ?> />
|
589 |
-
<span><?php _e( '
|
590 |
<div>
|
591 |
-
<p
|
592 |
-
|
|
|
|
|
|
|
|
|
593 |
</div>
|
594 |
</label><br>
|
595 |
</div>
|
@@ -616,7 +733,7 @@ $wpvivid_version=WPVIVID_PLUGIN_VERSION;
|
|
616 |
<label>
|
617 |
<input type="radio" name="schedule" value="Monthly" <?php esc_attr_e($schedule_monthly, 'wpvivid'); ?> />
|
618 |
<span><?php _e( 'Monthly', 'wpvivid' ); ?></span>
|
619 |
-
</label>
|
620 |
</fieldset>
|
621 |
</div>
|
622 |
</div>
|
@@ -670,7 +787,7 @@ $wpvivid_version=WPVIVID_PLUGIN_VERSION;
|
|
670 |
</tr>
|
671 |
|
672 |
<tr>
|
673 |
-
<td class="row-title wpvivid-backup-settings-table-left tablelistcolumn"><label for="tablecell"><?php _e('Choose How to
|
674 |
<td class="tablelistcolumn">
|
675 |
<div class="postbox schedule-tab-block setting-page-content" id="wpvivid_archive_type">
|
676 |
<?php
|
@@ -687,122 +804,24 @@ $wpvivid_version=WPVIVID_PLUGIN_VERSION;
|
|
687 |
<label>
|
688 |
<input type="radio" name="choose-package-method" value="method-no-compress" <?php esc_attr_e($wpvivid_setting_no_compress, 'wpvivid'); ?> />
|
689 |
<span><?php _e( 'Only Archive without compressing', 'wpvivid' ); ?></span>
|
690 |
-
<span><?php _e( 'It will
|
691 |
</label><br>
|
692 |
<label>
|
693 |
<input type="radio" name="choose-package-method" value="method-compress" <?php esc_attr_e($wpvivid_setting_compress, 'wpvivid'); ?> />
|
694 |
<span><?php _e( 'Compress and Archive', 'wpvivid' ); ?></span>
|
695 |
-
<span><?php _e( 'It will
|
696 |
</label>
|
697 |
</fieldset>
|
698 |
</div>
|
699 |
</td>
|
700 |
</tr>
|
701 |
|
702 |
-
|
703 |
-
<td class="row-title wpvivid-backup-settings-table-left tablelistcolumn"><label for="tablecell"><?php _e('Backup Settings', 'wpvivid'); ?></label></td>
|
704 |
-
<td class="tablelistcolumn">
|
705 |
-
<div class="postbox schedule-tab-block">
|
706 |
-
<div><strong><?php _e('Maximum zip file size', 'wpvivid'); ?></strong></div>
|
707 |
-
<div class="schedule-tab-block setting-page-content">
|
708 |
-
<input type="text" placeholder="200" id="wpvivid_max_zip" class="all-options" value="<?php esc_attr_e(str_replace('M', '', $general_setting['options']['wpvivid_compress_setting']['max_file_size']), 'wpvivid'); ?>" onkeyup="value=value.replace(/\D/g,'')" />MB
|
709 |
-
<div><?php _e( 'Some web hosting/shared hosting providers limit large zip files (e.g. 200MB). Please try to lower the maximum zip size if you are encountering backup errors.', 'wpvivid' ); ?></div>
|
710 |
-
</div>
|
711 |
-
<div><strong><?php _e('Exclude the files which is larger than', 'wpvivid'); ?></strong></div>
|
712 |
-
<div class="schedule-tab-block setting-page-content">
|
713 |
-
<input type="text" placeholder="0" id="wpvivid_ignore_large" class="all-options" value="<?php esc_attr_e($general_setting['options']['wpvivid_compress_setting']['exclude_file_size'], 'wpvivid'); ?>" onkeyup="value=value.replace(/\D/g,'')" />MB
|
714 |
-
<div><?php _e( 'Using the option will ignore the file larger than the certain size in MB when backing up, \'0\' (zero) means unlimited.', 'wpvivid' ); ?></div>
|
715 |
-
</div>
|
716 |
-
<div><strong><?php _e('PHP script execution timeout', 'wpvivid'); ?></strong></div>
|
717 |
-
<div class="schedule-tab-block setting-page-content">
|
718 |
-
<input type="text" placeholder="600" id="wpvivid_option_timeout" class="all-options" value="<?php esc_attr_e($general_setting['options']['wpvivid_common_setting']['max_execution_time'], 'wpvivid'); ?>" onkeyup="value=value.replace(/\D/g,'')" />Seconds
|
719 |
-
<div><?php _e( 'When PHP maximum execution time exceeds, backup task will time out.', 'wpvivid' ); ?></div>
|
720 |
-
</div>
|
721 |
-
<div>
|
722 |
-
<select name="" id="wpvivid_max_backup_count">
|
723 |
-
<?php
|
724 |
-
$display_backup_count = $general_setting['options']['wpvivid_common_setting']['max_backup_count'];
|
725 |
-
$display_backup_count=intval($display_backup_count);
|
726 |
-
for($i=1; $i<8;$i++){
|
727 |
-
if($i === $display_backup_count){
|
728 |
-
_e('<option selected="selected" value="' . $i . '">' . $i . '</option>', 'wpvivid');
|
729 |
-
}
|
730 |
-
else {
|
731 |
-
_e('<option value="' . $i . '">' . $i . '</option>', 'wpvivid');
|
732 |
-
}
|
733 |
-
}
|
734 |
-
?>
|
735 |
-
</select><strong><?php _e('backups retained', 'wpvivid'); ?></strong>
|
736 |
-
</div>
|
737 |
-
<div>
|
738 |
-
<label for="wpvivid_estimate_backup">
|
739 |
-
<?php
|
740 |
-
$wpvivid_setting_estimate_backup='';
|
741 |
-
if($general_setting['options']['wpvivid_common_setting']['estimate_backup'] === true){
|
742 |
-
$wpvivid_setting_estimate_backup='checked';
|
743 |
-
}
|
744 |
-
else{
|
745 |
-
$wpvivid_setting_estimate_backup='';
|
746 |
-
}
|
747 |
-
?>
|
748 |
-
<input name="" type="checkbox" id="wpvivid_estimate_backup" value="1" <?php esc_attr_e($wpvivid_setting_estimate_backup, 'wpvivid'); ?> />
|
749 |
-
<span><?php _e( 'Estimate the size of files, folder, database and backup time before backing up ', 'wpvivid' ); ?></span>
|
750 |
-
</label>
|
751 |
-
</div>
|
752 |
-
</div>
|
753 |
-
<div class="postbox schedule-tab-block">
|
754 |
-
<div><strong><?php _e('Backup Folder', 'wpvivid'); ?></strong></div>
|
755 |
-
<div class="schedule-tab-block setting-page-content">
|
756 |
-
<span><?php _e('The local storage path:', 'wpvivid'); ?></span><span><?php echo WP_CONTENT_DIR.'/'; ?><span id="wpvivid_setting_local_storage_path"><?php _e($general_setting['options']['wpvivid_local_setting']['path'], 'wpvivid'); ?></span></span>
|
757 |
-
<div class="clear:both;"></div>
|
758 |
-
<input type="text" placeholder="wpvividbackups" id="wpvivid_option_backup_dir" class="all-options" value="<?php esc_attr_e($general_setting['options']['wpvivid_local_setting']['path'], 'wpvivid'); ?>" onkeyup="value=value.replace(/[^\a-\z\A-\Z0-9]/g,\'\')" onpaste="value=value.replace(/[^\a-\z\A-\Z0-9]/g,\'\')" />
|
759 |
-
<div><?php _e( 'Only one name is allowed(not path). This folder must be writable for creating backup files.', 'wpvivid' ); ?></div>
|
760 |
-
</div>
|
761 |
-
</div>
|
762 |
-
<div class="postbox schedule-tab-block">
|
763 |
-
<div class="schedule-tab-block">
|
764 |
-
<fieldset>
|
765 |
-
<label for="users_can_register">
|
766 |
-
<?php
|
767 |
-
if($out_of_date['remote_options'] === false){
|
768 |
-
$out_of_date_remote='There is no path for remote storage, please set it up first.';
|
769 |
-
}
|
770 |
-
else {
|
771 |
-
foreach ($out_of_date['remote_options'] as $value)
|
772 |
-
if($value['type'] === 'ftp' || $value['type'] === 'sftp'){
|
773 |
-
$out_of_date_remote=$value['options']['path'];
|
774 |
-
}
|
775 |
-
else if($value['type'] === 'amazonS3'){
|
776 |
-
$out_of_date_remote=$value['options']['s3Path'];
|
777 |
-
}
|
778 |
-
else{
|
779 |
-
$out_of_date_remote='There is no path for remote storage, please set it up first.';
|
780 |
-
}
|
781 |
-
}
|
782 |
-
?>
|
783 |
-
<p><strong><?php _e('Remove out-of-date backups', 'wpvivid'); ?></strong></p>
|
784 |
-
<span><?php _e('Web Server Path:', 'wpvivid'); ?></span><span id="wpvivid_out_of_date_local_path"><?php _e($out_of_date['web_server'], 'wpvivid'); ?></span></br>
|
785 |
-
<span><?php _e('Remote Storage Path:', 'wpvivid'); ?></span><span id="wpvivid_out_of_date_remote_path"><?php _e($out_of_date_remote, 'wpvivid'); ?></span>
|
786 |
-
</label>
|
787 |
-
</fieldset>
|
788 |
-
</div>
|
789 |
-
<div class="schedule-tab-block"><input class="button-primary" id="wpvivid_delete_out_of_backup" style="margin-right:10px;" type="submit" name="delete-out-of-backup" value="<?php esc_attr_e( 'Remove', 'wpvivid' ); ?>" />
|
790 |
-
<p><?php _e('The action will remove all backups which is(are) out-of-date (including local web server and remote storage) if they exist.', 'wpvivid'); ?> </p>
|
791 |
-
</div>
|
792 |
-
</div>
|
793 |
-
</td>
|
794 |
-
<tfoot>
|
795 |
-
<tr>
|
796 |
-
<th class="row-title"><input class="button-primary storage-account-button" id="wpvivid_setting_general_save" type="submit" name="" value="<?php esc_attr_e( 'Save Changes', 'wpvivid' ); ?>" /></th>
|
797 |
-
<th></th>
|
798 |
-
</tr>
|
799 |
-
</tfoot>
|
800 |
-
</tr>
|
801 |
<tr>
|
802 |
<td class="row-title wpvivid-backup-settings-table-left tablelistcolumn"><label for="tablecell"><?php _e('Email Report', 'wpvivid'); ?></label></td>
|
803 |
<td class="tablelistcolumn">
|
804 |
<div class="postbox schedule-tab-block">
|
805 |
-
<div><p><?php _e('In order to use this function, please install a ', 'wpvivid'); ?><strong><?php _e('WordPress SMTP plugin', 'wpvivid'); ?></strong><?php _e(' of your preference and configure your SMTP server
|
806 |
</div>
|
807 |
<div>
|
808 |
<label for="wpvivid_general_email_enable">
|
@@ -856,11 +875,12 @@ $wpvivid_version=WPVIVID_PLUGIN_VERSION;
|
|
856 |
</td>
|
857 |
</tr>
|
858 |
<tr>
|
859 |
-
<td class="row-title wpvivid-backup-settings-table-left tablelistcolumn"><label for="tablecell"><?php _e('
|
860 |
<td class="tablelistcolumn">
|
861 |
<div class="postbox schedule-tab-block">
|
862 |
<div><p><?php _e('Web-server disk space in use by WPvivid:', 'wpvivid'); ?></p>
|
863 |
-
<div class="schedule-tab-block"><span class="schedule-tab-block"><?php _e('Total Size:', 'wpvivid'); ?></span><span id="wpvivid_junk_sum_size"><?php _e($junk_file['sum_size'], 'wpvivid'); ?></span
|
|
|
864 |
</div>
|
865 |
<div class="schedule-tab-block">
|
866 |
<fieldset>
|
@@ -890,7 +910,7 @@ $wpvivid_version=WPVIVID_PLUGIN_VERSION;
|
|
890 |
</label>
|
891 |
</fieldset>
|
892 |
</div>
|
893 |
-
<div><input class="button-primary" id="
|
894 |
<div style="clear:both;"></div>
|
895 |
</div>
|
896 |
</td>
|
14 |
die;
|
15 |
}
|
16 |
|
17 |
+
|
18 |
+
|
19 |
$last_backup_message=WPvivid_Setting::get_option('wpvivid_last_msg');
|
20 |
$backuplist=WPvivid_Backuplist::get_backuplist();
|
21 |
$remoteslist=WPvivid_Setting::get_all_remote_options();
|
42 |
<div id="wpvivid_backup_notice"></div>
|
43 |
</div>
|
44 |
<h2 class="nav-tab-wrapper">
|
45 |
+
<a href="#" id="wpvivid_tab_general" class="nav-tab wrap-nav-tab nav-tab-active" onclick="switchTabs(event,'general-page')"><?php _e('Backup & Restore', 'wpvivid'); ?></a>
|
46 |
<a href="#" id="wpvivid_tab_setting" class="nav-tab wrap-nav-tab" onclick="switchTabs(event,'settings-page')"><?php _e('Settings', 'wpvivid'); ?></a>
|
47 |
<a href="#" id="wpvivid_tab_remote_storage" class="nav-tab wrap-nav-tab" onclick="switchTabs(event,'storage-page')"><?php _e('Remote Storage', 'wpvivid'); ?></a>
|
48 |
<a href="#" id="wpvivid_tab_debug" class="nav-tab wrap-nav-tab" onclick="switchTabs(event,'debug-page')"><?php _e('Website Info', 'wpvivid'); ?></a>
|
49 |
<a href="#" id="wpvivid_tab_log" class="nav-tab wrap-nav-tab" onclick="switchTabs(event,'logs-page')"><?php _e('Logs', 'wpvivid'); ?></a>
|
50 |
+
<a href="#" id="wpvivid_tab_read_log" class="nav-tab wrap-nav-tab delete" onclick="switchTabs(event,'log-read-page')" style="display: none;">
|
51 |
<div style="margin-right: 15px;"><?php _e('Log', 'wpvivid'); ?></div>
|
52 |
<div class="nav-tab-delete-img">
|
53 |
<img src="<?php echo esc_url(plugins_url( 'images/delete-tab.png', __FILE__ )); ?>" style="vertical-align:middle; cursor:pointer;" onclick="wpvivid_close_main_tab('log');" />
|
60 |
<div id="post-body-content">
|
61 |
<div class="inside" style="margin-top:0px;">
|
62 |
<div id="general-page" class="tabcontent wpvivid_tab_general" name="tab-backup" style="width:100%;">
|
|
|
63 |
<?php
|
64 |
$btn_style = 'pointer-events: auto; opacity: 1;';
|
65 |
$estimate_db_size='';
|
112 |
<div class="backup-basic-info"><span><?php _e('Database Size:', 'wpvivid'); ?></span><span id="wpvivid_backup_database_size"><?php _e($estimate_db_size, 'wpvivid'); ?></span></div>
|
113 |
<div class="backup-basic-info"><span><?php _e('File Size:', 'wpvivid'); ?></span><span id="wpvivid_backup_file_size"><?php _e($estimate_file_size, 'wpvivid'); ?></span></div>
|
114 |
</div>
|
115 |
+
<div style="clear:both;"></div>
|
116 |
+
<div style="margin-left:10px; float: left; width:100%;"><p id="wpvivid_current_doing"><?php _e($backup_info, 'wpvivid'); ?></p></div>
|
117 |
<div style="clear: both;"></div>
|
118 |
+
<div>
|
119 |
+
<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' ); ?>" style="<?php esc_attr_e($btn_style, 'wpvivid'); ?>" /></div>
|
120 |
+
<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>
|
121 |
+
</div>
|
122 |
+
<div style="clear: both;"></div>
|
123 |
+
</div>
|
124 |
+
<div class="meta-box-sortables ui-sortable">
|
125 |
<div class="postbox quickbackup" id="wpvivid_postbox_backup">
|
126 |
<h2><span><?php _e( 'Back Up Manually','wpvivid'); ?></span></h2>
|
127 |
<div class="quickstart-storage-setting">
|
128 |
+
<span class="list-top-chip"><?php _e('Local storage Directory: '); ?></span>
|
129 |
+
<span class="list-top-chip" id="wpvivid_local_storage_path"><?php echo WP_CONTENT_DIR.'/'.$backupdir; ?></span>
|
130 |
+
<span class="list-top-chip" id=""><a href="#" onclick="wpvivid_click_switch_page('wpvivid_tab_setting', '');"><?php _e(' rename directory', 'wpvivid'); ?></a></span>
|
131 |
</div>
|
132 |
<div class="quickstart-archive-block">
|
133 |
<fieldset>
|
150 |
<fieldset>
|
151 |
<legend class="screen-reader-text"><span>input type="checkbox"</span></legend>
|
152 |
<label>
|
153 |
+
<input type="checkbox" id="wpvivid_backup_local" name="backup-storage" value="" checked readonly/>
|
154 |
+
<span><?php _e( 'Save Backups to Local', 'wpvivid' ); ?></span>
|
155 |
</label>
|
156 |
|
157 |
<div style="clear:both;"></div>
|
159 |
<input type="checkbox" id="wpvivid_backup_remote" name="backup-storage" value="" />
|
160 |
<span><?php _e( 'Send Backup to Remote Storage:', 'wpvivid' ); ?></span>
|
161 |
</label><br>
|
162 |
+
<div id="upload_storage" style="cursor:pointer;" title="Highlighted icon illuminates that you have choosed a remote storage to store backups">
|
163 |
<?php
|
164 |
$default_amazon_s3='images/storage-amazon-s3(gray).png';
|
165 |
$default_ftp='images/storage-ftp(gray).png';
|
190 |
<div class="quickstart-btn" style="padding-top:20px;">
|
191 |
<input class="button-primary quickbackup-btn" id="wpvivid_quickbackup_btn" type="submit" value="<?php esc_attr_e( 'Backup Now', 'wpvivid'); ?>" <?php esc_attr_e($btn_style, 'wpvivid'); ?> />
|
192 |
<div class="schedule-tab-block" style="text-align:center;">
|
193 |
+
<fieldset>
|
194 |
<label>
|
195 |
+
|
196 |
<input type="checkbox" id="wpvivid_backup_lock" name="lock-backup" value="" />
|
197 |
+
<span><?php _e( 'This backup can only be deleted manually', 'wpvivid' ); ?></span>
|
198 |
</label>
|
199 |
+
</fieldset>
|
200 |
</div>
|
201 |
</div>
|
202 |
<div class="custom-info" style="float:left; width:100%;">
|
203 |
+
<strong><?php _e('Tips', 'wpvivid'); ?></strong><?php _e(': The settings is only for manual backup, which won\'t affect schedule settings.', 'wpvivid'); ?>
|
204 |
</div>
|
205 |
</div>
|
206 |
<div class="postbox qucikbackup-schedule" id="wpvivid_postbox_backup_schedule">
|
261 |
</h2>
|
262 |
|
263 |
<div class="table-list-content wpvivid_tab_backup" id="page-backups">
|
264 |
+
<div style="margin-top:10px; margin-bottom:10px;">
|
265 |
+
<P><strong><?php _e('How to download a backup', 'wpvivid'); ?></strong></p>
|
266 |
<ul><li><?php _e('->If backups are stored in remote storage, our plugin will retrieve the backup to your web server. This may take a little time depending on the size of backup files. Please be patient. Then you can download them to your PC.', 'wpvivid'); ?></li>
|
267 |
+
<li><?php _e('->If backups are stored in web server, the plugin will list all relevant files immediately.', 'wpvivid'); ?></li>
|
268 |
+
</ul>
|
269 |
+
</div>
|
270 |
+
<div style="margin-bottom:10px;">
|
271 |
+
<P><strong><?php _e('How to restore website', 'wpvivid'); ?></strong></p>
|
272 |
+
<ul><li><?php _e('Step One: Click the button called \'Restore\' which is next to \'Log\' button, then a new Tab (Restore Tab) is going to be created', 'wpvivid'); ?></li>
|
273 |
+
<li><?php _e('Step Two: Click \'Restore\' button', 'wpvivid'); ?></li>
|
274 |
</ul>
|
275 |
</div>
|
276 |
<div style="clear:both;"></div>
|
290 |
<tr>
|
291 |
<th class="check-column"><input name="check_backup" type="checkbox" id="<?php esc_attr_e($key, 'wpvivid'); ?>" value="<?php esc_attr_e($key, 'wpvivid'); ?>" onclick="wpvivid_click_check_backup('<?php _e($key, 'wpvivid'); ?>');" /></th>
|
292 |
<td class="tablelistcolumn">
|
293 |
+
<div style="float:left;padding:0px 10px 10px 0px;">
|
294 |
<?php
|
295 |
if(empty($value['lock'])){
|
296 |
$backup_lock='images/unlocked.png';
|
308 |
}
|
309 |
?>
|
310 |
|
311 |
+
<div class="backuptime"><strong><?php _e(date('M d, Y H:i',$value['create_time']), 'wpvivid'); ?></strong></div>
|
312 |
<div class="common-table">
|
313 |
+
<span title="To lock the backup, the backup can only be deleted manually">
|
314 |
<img src="<?php echo esc_url(plugins_url($backup_lock, __FILE__)); ?>" name="<?php esc_attr_e($lock_status, 'wpvivid'); ?>" onclick="wpvivid_set_backup_lock('<?php _e($key, 'wpvivid'); ?>', '<?php _e($lock_status, 'wpvivid'); ?>');" style="vertical-align:middle; cursor:pointer;"/>
|
315 |
+
</span>
|
316 |
+
| <span><?php _e('Type:', 'wpvivid'); ?></span><span><?php _e($value['type'], 'wpvivid'); ?></span>
|
317 |
+
|<span title="Backup log"><a href="#" onclick="wpvivid_initialize_log('<?php _e($key, 'wpvivid'); ?>');"><img src="<?php echo esc_url(plugins_url( 'images/Log.png', __FILE__ )); ?>" style="vertical-align:middle;cursor:pointer;"/><?php _e('Log', 'wpvivid'); ?></a></span>
|
318 |
+
|<span title="Restore Website from The Backup"><a href="#" onclick="wpvivid_initialize_restore('<?php _e($key, 'wpvivid'); ?>','<?php _e(date('M d, Y H:i',$value['create_time']), 'wpvivid'); ?>');"><img src="<?php echo esc_url(plugins_url( 'images/Restore.png', __FILE__ )); ?>" style="vertical-align:middle;cursor:pointer;"/><?php _e('Restore', 'wpvivid'); ?></a></span>
|
319 |
</div>
|
320 |
|
321 |
</div>
|
345 |
</td>
|
346 |
<td class="tablelistcolumn">
|
347 |
<div id="wpvivid_file_part_<?php _e($key, 'wpvivid'); ?>" style="float:left;padding:10px 10px 10px 0px;">
|
348 |
+
<div style="cursor:pointer;" onclick="wpvivid_initialize_download('<?php _e($key, 'wpvivid'); ?>');" title="Prepare to download the backup">
|
349 |
<img id="wpvivid_download_btn_<?php _e($key, 'wpvivid'); ?>" src="<?php echo esc_url(plugins_url( 'images/download.png', __FILE__ )); ?>" style="vertical-align:middle;" /><?php _e('Download', 'wpvivid'); ?>
|
350 |
<div class="spinner" id="wpvivid_download_loading_<?php _e($key, 'wpvivid'); ?>" style="float:right;width:auto;height:auto;padding:10px 180px 10px 0;background-position:0 0;"></div>
|
351 |
</div>
|
376 |
<div class="table-list-content wpvivid_tab_restore" id="page-restore" style="display:none;">
|
377 |
<div>
|
378 |
<h3><?php _e('Restore backup from:', 'wpvivid'); ?><span id="wpvivid_restore_backup_time"></span></h3>
|
379 |
+
<p><strong><?php _e('Please do not close the page or switch to other pages when a restore task is running, as it could trigger some unexpected errors.', 'wpvivid'); ?></strong></p>
|
380 |
<p><?php _e('Restore function will replace the current site\'s themes, plugins, uploads, database and/or other content directories with the existing equivalents in the selected backup.', 'wpvivid'); ?></p>
|
381 |
<div class="restore-button-position"><input class="button-primary" id="wpvivid_restore_btn" type="submit" name="restore" value="<?php esc_attr_e( 'Restore', 'wpvivid' ); ?>" onclick="wpvivid_start_restore();" /></div>
|
382 |
<div class="restore-button-position"><input class="button-primary" id="wpvivid_clean_restore" type="submit" name="clear_restore" value="<?php esc_attr_e( 'Clean Restore', 'wpvivid' ); ?>" /></div>
|
421 |
</label>
|
422 |
</div>
|
423 |
</div>
|
424 |
+
<div id="storage_account_sftp" style="display:none;">
|
425 |
<h2><span><?php _e( 'Enter Your SFTP Account ','wpvivid'); ?></span></h2>
|
426 |
<div class="storage-account-form"><input type="text" placeholder="Custom an unique name: e.g.SFTP-001" class="regular-text" id="storage_account_sftp_storagename" /></div>
|
427 |
<div class="storage-account-form"><input type="text" placeholder="Server IP Address" class="regular-text" id="storage_account_sftp_ip" /></div>
|
428 |
<div class="storage-account-form"><input type="text" placeholder="User Name" class="regular-text" id="storage_account_sftp_username" /></div>
|
429 |
<div class="storage-account-form"><input type="password" placeholder="Root Password" class="regular-text" id="storage_account_sftp_password" /></div>
|
430 |
<div class="storage-account-form"><input type="text" placeholder="Port" class="regular-text" id="storage_account_sftp_port" onkeyup="value=value.replace(/\D/g,'')" /></div>
|
431 |
+
<div class="storage-account-form"><input type="text" placeholder="Absolute path must exist(Example: /var/)" class="regular-text" id="storage_account_sftp_storagepath" /></div>
|
432 |
<div class="remote-storage-set-default-block">
|
433 |
<label for="sftp_default">
|
434 |
<input type="checkbox" id="sftp_default" checked><?php _e('Set as the default remote storage.', 'wpvivid'); ?>
|
435 |
</label>
|
436 |
</div>
|
437 |
</div>
|
438 |
+
<div id="storage_account_amazons3" style="display:none;">
|
439 |
<h2><span><?php _e( 'Enter Your Amazon S3 Account ','wpvivid'); ?></span></h2>
|
440 |
<div class="storage-account-form"><input type="text" placeholder="Custom an unique name: Example: Amazon S3-001" class="regular-text" id="storage_account_amazons3_storagename" /></div>
|
441 |
<div class="storage-account-form"><input type="text" placeholder="Amazon S3 access key" class="regular-text" id="storage_account_amazons3_access_key" /></div>
|
512 |
<div>
|
513 |
<table class="widefat">
|
514 |
<tbody>
|
515 |
+
<tr>
|
516 |
+
<td class="row-title wpvivid-backup-settings-table-left tablelistcolumn"><label for="tablecell"><?php _e('General Settings', 'wpvivid'); ?></label></td>
|
517 |
+
<td class="tablelistcolumn">
|
518 |
+
<div class="postbox schedule-tab-block">
|
519 |
+
<div><strong><?php _e('Compress Files Every', 'wpvivid'); ?></strong></div>
|
520 |
+
<div class="schedule-tab-block setting-page-content">
|
521 |
+
<input type="text" placeholder="400" id="wpvivid_max_zip" class="all-options" value="<?php esc_attr_e(str_replace('M', '', $general_setting['options']['wpvivid_compress_setting']['max_file_size']), 'wpvivid'); ?>" onkeyup="value=value.replace(/\D/g,'')" />MB
|
522 |
+
<div><p><?php _e( 'Some web hosting providers limit large zip files (e.g. 200MB), and therefore splitting your backup into many parts is an ideal way to avoid to hit the limitation if you are running a big website. Please try to adjust the value if you are encountering backup errors.', 'wpvivid' ); ?></div></p>
|
523 |
+
</div>
|
524 |
+
<div><strong><?php _e('Exclude the files which is larger than', 'wpvivid'); ?></strong></div>
|
525 |
+
<div class="schedule-tab-block setting-page-content">
|
526 |
+
<input type="text" placeholder="400" id="wpvivid_ignore_large" class="all-options" value="<?php esc_attr_e($general_setting['options']['wpvivid_compress_setting']['exclude_file_size'], 'wpvivid'); ?>" onkeyup="value=value.replace(/\D/g,'')" />MB
|
527 |
+
<div><p><?php _e( 'Using the option will ignore the file larger than the certain size in MB when backing up, \'0\' (zero) means unlimited.', 'wpvivid' ); ?></p></div>
|
528 |
+
</div>
|
529 |
+
<div><strong><?php _e('PHP script execution timeout', 'wpvivid'); ?></strong></div>
|
530 |
+
<div class="schedule-tab-block setting-page-content">
|
531 |
+
<input type="text" placeholder="600" id="wpvivid_option_timeout" class="all-options" value="<?php esc_attr_e($general_setting['options']['wpvivid_common_setting']['max_execution_time'], 'wpvivid'); ?>" onkeyup="value=value.replace(/\D/g,'')" />Seconds
|
532 |
+
<div><p><?php _e( 'The time-out is not your server PHP time-out. With the execution time exhausted, our plugin will shut the process of backup down. If the progress of backup encounters a time-out, that means you have a medium or large sized website, please try to scale the value bigger. ', 'wpvivid' ); ?></p></div>
|
533 |
+
</div>
|
534 |
+
<div>
|
535 |
+
<select name="" id="wpvivid_max_backup_count">
|
536 |
+
<?php
|
537 |
+
$display_backup_count = $general_setting['options']['wpvivid_common_setting']['max_backup_count'];
|
538 |
+
$display_backup_count=intval($display_backup_count);
|
539 |
+
for($i=1; $i<8;$i++){
|
540 |
+
if($i === $display_backup_count){
|
541 |
+
_e('<option selected="selected" value="' . $i . '">' . $i . '</option>', 'wpvivid');
|
542 |
+
}
|
543 |
+
else {
|
544 |
+
_e('<option value="' . $i . '">' . $i . '</option>', 'wpvivid');
|
545 |
+
}
|
546 |
+
}
|
547 |
+
?>
|
548 |
+
</select><strong><?php _e('backups retained', 'wpvivid'); ?></strong>
|
549 |
+
</div>
|
550 |
+
<div>
|
551 |
+
<label for="wpvivid_estimate_backup">
|
552 |
+
<?php
|
553 |
+
$wpvivid_setting_estimate_backup='';
|
554 |
+
if($general_setting['options']['wpvivid_common_setting']['estimate_backup'] === true){
|
555 |
+
$wpvivid_setting_estimate_backup='checked';
|
556 |
+
}
|
557 |
+
else{
|
558 |
+
$wpvivid_setting_estimate_backup='';
|
559 |
+
}
|
560 |
+
?>
|
561 |
+
<input name="" type="checkbox" id="wpvivid_estimate_backup" value="1" <?php esc_attr_e($wpvivid_setting_estimate_backup, 'wpvivid'); ?> />
|
562 |
+
<span><?php _e( 'Calculate the size of files, folder and database before backing up ', 'wpvivid' ); ?></span>
|
563 |
+
</label>
|
564 |
+
</div>
|
565 |
+
</div>
|
566 |
+
<div class="postbox schedule-tab-block">
|
567 |
+
<div><strong><?php _e('Backup Folder', 'wpvivid'); ?></strong></div>
|
568 |
+
<div class="schedule-tab-block setting-page-content">
|
569 |
+
<div><p><?php _e( 'Name your folder, this folder must be writable for creating backup files.', 'wpvivid' ); ?><p> </div>
|
570 |
+
<input type="text" placeholder="wpvividbackups" id="wpvivid_option_backup_dir" class="all-options" value="<?php esc_attr_e($general_setting['options']['wpvivid_local_setting']['path'], 'wpvivid'); ?>" onkeyup="value=value.replace(/[^\a-\z\A-\Z0-9]/g,\'\')" onpaste="value=value.replace(/[^\a-\z\A-\Z0-9]/g,\'\')" />
|
571 |
+
<p><span><?php _e('Local storage directory:', 'wpvivid'); ?></span><span><?php echo WP_CONTENT_DIR.'/'; ?><span id="wpvivid_setting_local_storage_path"><?php _e($general_setting['options']['wpvivid_local_setting']['path'], 'wpvivid'); ?></span></span></p>
|
572 |
+
</div>
|
573 |
+
</div>
|
574 |
+
<div class="postbox schedule-tab-block">
|
575 |
+
<div class="schedule-tab-block">
|
576 |
+
<fieldset>
|
577 |
+
<label for="users_can_register">
|
578 |
+
<?php
|
579 |
+
if($out_of_date['remote_options'] === false){
|
580 |
+
$out_of_date_remote='There is no path for remote storage, please set it up first.';
|
581 |
+
}
|
582 |
+
else {
|
583 |
+
foreach ($out_of_date['remote_options'] as $value)
|
584 |
+
if($value['type'] === 'ftp' || $value['type'] === 'sftp'){
|
585 |
+
$out_of_date_remote=$value['options']['path'];
|
586 |
+
}
|
587 |
+
else if($value['type'] === 'amazonS3'){
|
588 |
+
$out_of_date_remote=$value['options']['s3Path'];
|
589 |
+
}
|
590 |
+
else{
|
591 |
+
$out_of_date_remote='There is no path for remote storage, please set it up first.';
|
592 |
+
}
|
593 |
+
}
|
594 |
+
?>
|
595 |
+
<p><strong><?php _e('Remove out-of-date backups', 'wpvivid'); ?></strong></p>
|
596 |
+
<p><span><?php _e('Web Server Directory:', 'wpvivid'); ?></span><span id="wpvivid_out_of_date_local_path"><?php _e($out_of_date['web_server'], 'wpvivid'); ?></span></p>
|
597 |
+
<p><span><?php _e('Remote Storage Directory:', 'wpvivid'); ?></span><span id="wpvivid_out_of_date_remote_path"><?php _e($out_of_date_remote, 'wpvivid'); ?></span></p>
|
598 |
+
</label>
|
599 |
+
</fieldset>
|
600 |
+
</div>
|
601 |
+
<div class="schedule-tab-block"><input class="button-primary" id="wpvivid_delete_out_of_backup" style="margin-right:10px;" type="submit" name="delete-out-of-backup" value="<?php esc_attr_e( 'Remove', 'wpvivid' ); ?>" />
|
602 |
+
<p><?php _e('The action is irreversible! It will remove all backups which is(are) out-of-date (including local web server and remote storage) if they exist.', 'wpvivid'); ?> </p>
|
603 |
+
</div>
|
604 |
+
</div>
|
605 |
+
</td>
|
606 |
+
<tfoot>
|
607 |
+
<tr>
|
608 |
+
<th class="row-title"><input class="button-primary storage-account-button" id="wpvivid_setting_general_save" type="submit" name="" value="<?php esc_attr_e( 'Save Changes', 'wpvivid' ); ?>" /></th>
|
609 |
+
<th></th>
|
610 |
+
</tr>
|
611 |
+
</tfoot>
|
612 |
+
</tr>
|
613 |
<tr>
|
614 |
<td class="row-title wpvivid-backup-settings-table tablelistcolumn"><label for="tablecell"><?php _e('Schedule Settings', 'wpvivid'); ?></label></td>
|
615 |
<td class="tablelistcolumn">
|
699 |
<div class="postbox schedule-tab-block">
|
700 |
<label for="wpvivid_schedule_enable">
|
701 |
<input name="" type="checkbox" id="wpvivid_schedule_enable" value="1" <?php esc_attr_e($schedule_status, 'wpvivid'); ?> />
|
702 |
+
<span><?php _e( 'Enable backup schedule', 'wpvivid' ); ?></span>
|
703 |
<div>
|
704 |
+
<p>
|
705 |
+
<?php _e('1) Scheduled job will start at web server time: 00:00', 'wpvivid'); ?>
|
706 |
+
</p>
|
707 |
+
<p>
|
708 |
+
<?php _e('2) Being subjected to mechanisms of PHP, a scheduled backup task for your site will be triggered only when the site receives at least a visit at any page.', 'wpvivid'); ?>
|
709 |
+
</p>
|
710 |
</div>
|
711 |
</label><br>
|
712 |
</div>
|
733 |
<label>
|
734 |
<input type="radio" name="schedule" value="Monthly" <?php esc_attr_e($schedule_monthly, 'wpvivid'); ?> />
|
735 |
<span><?php _e( 'Monthly', 'wpvivid' ); ?></span>
|
736 |
+
</label><br>
|
737 |
</fieldset>
|
738 |
</div>
|
739 |
</div>
|
787 |
</tr>
|
788 |
|
789 |
<tr>
|
790 |
+
<td class="row-title wpvivid-backup-settings-table-left tablelistcolumn"><label for="tablecell"><?php _e('Choose How to Archive Your Backups', 'wpvivid'); ?></label></td>
|
791 |
<td class="tablelistcolumn">
|
792 |
<div class="postbox schedule-tab-block setting-page-content" id="wpvivid_archive_type">
|
793 |
<?php
|
804 |
<label>
|
805 |
<input type="radio" name="choose-package-method" value="method-no-compress" <?php esc_attr_e($wpvivid_setting_no_compress, 'wpvivid'); ?> />
|
806 |
<span><?php _e( 'Only Archive without compressing', 'wpvivid' ); ?></span>
|
807 |
+
<span><?php _e( 'It will cause a lower CPU Usage and is recommended in a web hosting/ shared hosting environment.', 'wpvivid' ); ?>
|
808 |
</label><br>
|
809 |
<label>
|
810 |
<input type="radio" name="choose-package-method" value="method-compress" <?php esc_attr_e($wpvivid_setting_compress, 'wpvivid'); ?> />
|
811 |
<span><?php _e( 'Compress and Archive', 'wpvivid' ); ?></span>
|
812 |
+
<span><?php _e( 'It will cause a higher CPU Usage and is recommended in a VPS/ dedicated hosting environment.', 'wpvivid' ); ?></span>
|
813 |
</label>
|
814 |
</fieldset>
|
815 |
</div>
|
816 |
</td>
|
817 |
</tr>
|
818 |
|
819 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
820 |
<tr>
|
821 |
<td class="row-title wpvivid-backup-settings-table-left tablelistcolumn"><label for="tablecell"><?php _e('Email Report', 'wpvivid'); ?></label></td>
|
822 |
<td class="tablelistcolumn">
|
823 |
<div class="postbox schedule-tab-block">
|
824 |
+
<div><p><?php _e('In order to use this function, please install a ', 'wpvivid'); ?><strong><?php _e('WordPress SMTP plugin', 'wpvivid'); ?></strong><?php _e(' of your preference and configure your SMTP server first. This is because WordPress uses the PHP Mail function to send its emails by default, which is not supported by many hosts and can cause issues if it is not set properly.', 'wpvivid'); ?></p>
|
825 |
</div>
|
826 |
<div>
|
827 |
<label for="wpvivid_general_email_enable">
|
875 |
</td>
|
876 |
</tr>
|
877 |
<tr>
|
878 |
+
<td class="row-title wpvivid-backup-settings-table-left tablelistcolumn"><label for="tablecell"><?php _e('Clean Junk', 'wpvivid'); ?></label></td>
|
879 |
<td class="tablelistcolumn">
|
880 |
<div class="postbox schedule-tab-block">
|
881 |
<div><p><?php _e('Web-server disk space in use by WPvivid:', 'wpvivid'); ?></p>
|
882 |
+
<div class="schedule-tab-block"><span class="schedule-tab-block"><?php _e('Total Size:', 'wpvivid'); ?></span><span id="wpvivid_junk_sum_size"><?php _e($junk_file['sum_size'], 'wpvivid'); ?></span><input class="button-secondary" id="wpvivid_calculate_size" style="margin-left:10px;" type="submit" name="Calculate-Sizes" value="<?php esc_attr_e( 'Calculate Sizes', 'wpvivid' ); ?>" /></div>
|
883 |
+
|
884 |
</div>
|
885 |
<div class="schedule-tab-block">
|
886 |
<fieldset>
|
910 |
</label>
|
911 |
</fieldset>
|
912 |
</div>
|
913 |
+
<div><input class="button-primary" id="wpvivid_clean_junk_file" type="submit" name="Empty-all-files" value="<?php esc_attr_e( 'Empty', 'wpvivid' ); ?>" /></div>
|
914 |
<div style="clear:both;"></div>
|
915 |
</div>
|
916 |
</td>
|
includes/class-wpvivid-backup-database.php
CHANGED
@@ -45,7 +45,8 @@ class WPvivid_Backup_Database
|
|
45 |
$this->HOST = DB_HOST;
|
46 |
$this->DOMAIN = filter_input(INPUT_SERVER, 'HTTP_HOST');
|
47 |
|
48 |
-
$basename = basename($data['path'],$data['compress_type']).'sql';
|
|
|
49 |
$backup_file = dirname($data['path']).DIRECTORY_SEPARATOR.$basename;
|
50 |
|
51 |
require_once 'class-wpvivid-mysqldump.php';
|
45 |
$this->HOST = DB_HOST;
|
46 |
$this->DOMAIN = filter_input(INPUT_SERVER, 'HTTP_HOST');
|
47 |
|
48 |
+
$basename = basename($data['path'],$data['compress']['compress_type']).'sql';
|
49 |
+
|
50 |
$backup_file = dirname($data['path']).DIRECTORY_SEPARATOR.$basename;
|
51 |
|
52 |
require_once 'class-wpvivid-mysqldump.php';
|
includes/class-wpvivid-backup-site.php
CHANGED
@@ -18,7 +18,7 @@ class WPvivid_Backup_Site
|
|
18 |
$this->TargetFileTmp = $tmpfile;
|
19 |
}
|
20 |
|
21 |
-
public function backup_files($data,$files,$task_id
|
22 |
{
|
23 |
$data['log']->WriteLog('Start compressing '.$data['type'],'notice');
|
24 |
$flag=array('result'=>'failed','error'=>'suffix is incorrect ');
|
@@ -26,7 +26,7 @@ class WPvivid_Backup_Site
|
|
26 |
switch($suffix)
|
27 |
{
|
28 |
case 'zip':
|
29 |
-
$flag = $this->compress2zip($data
|
30 |
break;
|
31 |
|
32 |
}
|
@@ -34,15 +34,16 @@ class WPvivid_Backup_Site
|
|
34 |
return $flag;
|
35 |
}
|
36 |
|
37 |
-
public function compress2zip($
|
38 |
{
|
|
|
39 |
require_once 'class-wpvivid-zipclass.php';
|
40 |
$zipclass = new WPvivid_ZipClass();
|
41 |
if(!empty($zipclass->getLastError()))
|
42 |
{
|
43 |
return array('result'=>'failed','error'=>$zipclass -> getLastError());
|
44 |
}
|
45 |
-
switch ($type)
|
46 |
{
|
47 |
case WPVIVID_BACKUP_TYPE_CORE:
|
48 |
$replace_path = ABSPATH;
|
@@ -54,21 +55,23 @@ class WPvivid_Backup_Site
|
|
54 |
$replace_path = ABSPATH;
|
55 |
break;
|
56 |
case WPVIVID_BACKUP_TYPE_DB:
|
57 |
-
|
58 |
-
|
59 |
-
break;
|
60 |
default:
|
61 |
$replace_path = WP_CONTENT_DIR;
|
62 |
break;
|
63 |
}
|
64 |
-
|
|
|
|
|
|
|
65 |
{
|
66 |
return $zipclass ->zipsplit_no_compress($path,$files,$replace_path,$size,$use_temp_file,$use_temp_size);
|
67 |
}
|
68 |
else
|
69 |
{
|
70 |
return $zipclass ->zipsplit($path,$files,$replace_path,$size,$use_temp_file,$use_temp_size);
|
71 |
-
}
|
72 |
}
|
73 |
|
74 |
public function getSuffix($basename){
|
18 |
$this->TargetFileTmp = $tmpfile;
|
19 |
}
|
20 |
|
21 |
+
public function backup_files($data,$files,$task_id)
|
22 |
{
|
23 |
$data['log']->WriteLog('Start compressing '.$data['type'],'notice');
|
24 |
$flag=array('result'=>'failed','error'=>'suffix is incorrect ');
|
26 |
switch($suffix)
|
27 |
{
|
28 |
case 'zip':
|
29 |
+
$flag = $this->compress2zip($data,$files);
|
30 |
break;
|
31 |
|
32 |
}
|
34 |
return $flag;
|
35 |
}
|
36 |
|
37 |
+
public function compress2zip($data,$files)
|
38 |
{
|
39 |
+
//$type,$path,$size,$no_compress,$use_temp_file,$use_temp_size
|
40 |
require_once 'class-wpvivid-zipclass.php';
|
41 |
$zipclass = new WPvivid_ZipClass();
|
42 |
if(!empty($zipclass->getLastError()))
|
43 |
{
|
44 |
return array('result'=>'failed','error'=>$zipclass -> getLastError());
|
45 |
}
|
46 |
+
switch ($data['type'])
|
47 |
{
|
48 |
case WPVIVID_BACKUP_TYPE_CORE:
|
49 |
$replace_path = ABSPATH;
|
55 |
$replace_path = ABSPATH;
|
56 |
break;
|
57 |
case WPVIVID_BACKUP_TYPE_DB:
|
58 |
+
$replace_path = dirname($data['path']);
|
59 |
+
break;
|
|
|
60 |
default:
|
61 |
$replace_path = WP_CONTENT_DIR;
|
62 |
break;
|
63 |
}
|
64 |
+
$data['replace_path']=$replace_path;
|
65 |
+
return $zipclass ->zipsplit($data,$files);
|
66 |
+
|
67 |
+
/*if($no_compress)
|
68 |
{
|
69 |
return $zipclass ->zipsplit_no_compress($path,$files,$replace_path,$size,$use_temp_file,$use_temp_size);
|
70 |
}
|
71 |
else
|
72 |
{
|
73 |
return $zipclass ->zipsplit($path,$files,$replace_path,$size,$use_temp_file,$use_temp_size);
|
74 |
+
}*/
|
75 |
}
|
76 |
|
77 |
public function getSuffix($basename){
|
includes/class-wpvivid-backup.php
CHANGED
@@ -4,24 +4,33 @@ if (!defined('WPVIVID_PLUGIN_DIR')){
|
|
4 |
die;
|
5 |
}
|
6 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
include_once plugin_dir_path( dirname( __FILE__ ) ) .'includes/class-wpvivid-rollback.php';
|
8 |
class WPvivid_Backup{
|
9 |
-
|
10 |
-
|
11 |
private $i_progress;
|
12 |
private $i_step;
|
13 |
-
|
14 |
-
public $backup_path;
|
15 |
-
public $file_prefix;
|
16 |
-
public $compress_type;
|
17 |
-
public $compress_limit_size;
|
18 |
public $log;
|
19 |
public $task_id;
|
20 |
-
|
21 |
-
|
22 |
-
public $
|
23 |
-
public $
|
24 |
-
public $
|
|
|
|
|
|
|
|
|
|
|
|
|
25 |
|
26 |
public function get_default_exclude_regex($type_name = '')
|
27 |
{
|
@@ -79,14 +88,18 @@ class WPvivid_Backup{
|
|
79 |
return implode(DIRECTORY_SEPARATOR,$values);
|
80 |
}
|
81 |
|
82 |
-
public function init_options($task_id
|
83 |
{
|
84 |
$this->task_id=$task_id;
|
85 |
$options_name[]='backup_options';
|
86 |
$options_name[]='ismerge';
|
87 |
$options_name[]='file_prefix';
|
88 |
-
$
|
89 |
-
$this->
|
|
|
|
|
|
|
|
|
90 |
$this->file_prefix=$options['file_prefix'];
|
91 |
$this->compress_type= $options['backup_options']['compress']['compress_type'];
|
92 |
$this->compress_limit_size= $options['backup_options']['compress']['max_file_size'];
|
@@ -106,33 +119,33 @@ class WPvivid_Backup{
|
|
106 |
$a['meta'] = array();
|
107 |
$type[]=$a;
|
108 |
}
|
109 |
-
}
|
110 |
-
|
111 |
-
return $type;
|
112 |
}
|
113 |
|
114 |
-
public function backup($
|
115 |
{
|
|
|
|
|
116 |
WPvivid_taskmanager::update_backup_main_task_progress($this->task_id,'backup',0,0);
|
117 |
$flag = true;
|
118 |
$error = '';
|
119 |
$type=array();
|
120 |
$this->i_progress=0;
|
121 |
-
if($this->ismerge)
|
122 |
{
|
123 |
-
$this->i_step=intval(1/(sizeof($
|
124 |
}
|
125 |
else
|
126 |
{
|
127 |
-
$this->i_step=intval(1/sizeof($
|
128 |
}
|
129 |
|
130 |
-
foreach ($
|
131 |
{
|
132 |
global $wpvivid_pulgin;
|
133 |
$wpvivid_pulgin->check_cancel_backup($this->task_id);
|
134 |
|
135 |
-
$backup_job=WPvivid_taskmanager::get_backup_sub_task_progress($this->task_id,'backup',$
|
136 |
if($backup_job&&$backup_job['finished']==1)
|
137 |
{
|
138 |
$result =$backup_job['job_data'];
|
@@ -141,7 +154,9 @@ class WPvivid_Backup{
|
|
141 |
{
|
142 |
global $wpvivid_pulgin;
|
143 |
$wpvivid_pulgin->set_time_limit($this->task_id);
|
144 |
-
|
|
|
|
|
145 |
}
|
146 |
|
147 |
if($result['result'] == 'succeed')
|
@@ -150,7 +165,7 @@ class WPvivid_Backup{
|
|
150 |
$this->i_progress+=$this->i_step;
|
151 |
WPvivid_taskmanager::update_backup_main_task_progress($this->task_id,'backup',$this->i_progress,0);
|
152 |
$type[] = array(
|
153 |
-
'type_name' => $
|
154 |
'files' => $result['files'],
|
155 |
);
|
156 |
}else{
|
@@ -165,14 +180,14 @@ class WPvivid_Backup{
|
|
165 |
$zip_result = array
|
166 |
(
|
167 |
'result' => 'succeed',
|
168 |
-
'ismerge' => $this->ismerge ,
|
169 |
'data' => array
|
170 |
(
|
171 |
'type' => $type ,
|
172 |
'meta' => array()
|
173 |
)
|
174 |
);
|
175 |
-
if($this->ismerge)
|
176 |
{
|
177 |
global $wpvivid_pulgin;
|
178 |
$wpvivid_pulgin->set_time_limit($this->task_id);
|
@@ -182,7 +197,6 @@ class WPvivid_Backup{
|
|
182 |
if($res['result'] == 'succeed')
|
183 |
{
|
184 |
$zip_result['data']['meta']=array('type_name' => WPVIVID_BACKUP_TYPE_MERGE , 'files' => $res['files']);
|
185 |
-
$this->writetotxt($this->backup_path,$type);
|
186 |
}
|
187 |
else
|
188 |
{
|
@@ -215,63 +229,50 @@ class WPvivid_Backup{
|
|
215 |
return $zip_result;
|
216 |
}
|
217 |
|
218 |
-
|
219 |
{
|
220 |
-
include_once 'class-wpvivid-backup-database.php';
|
221 |
-
include_once 'class-wpvivid-backup-site.php';
|
222 |
-
|
223 |
$data = array();
|
224 |
-
$data['
|
225 |
-
$data['
|
226 |
-
$data['compress_type'] = $this->compress_type;
|
227 |
$data['log'] = $this->log;
|
228 |
-
$data['compress_limit_size'] =$this->compress_limit_size;
|
229 |
|
230 |
-
$data['
|
231 |
-
$data['use_temp_size'] =$this->use_temp_size;
|
232 |
-
$data['meta'] = $backup_type_data['meta'];
|
233 |
-
$data['exclude_regex'] =$this->get_default_exclude_regex($backup_type_data['type_name']);
|
234 |
-
$data['include_regex'] =array();
|
235 |
-
$data['type'] = $backup_type_data['type_name'];
|
236 |
-
$data['check'] = $backup_type_data['check'];
|
237 |
|
238 |
-
$
|
239 |
-
$backup_site = new WPvivid_Backup_Site();
|
240 |
-
$data['path'] = $this->createCompressPath($this->backup_path,$this->file_prefix,$backup_type_data['type_name'],$this->compress_type);
|
241 |
|
242 |
-
$
|
|
|
243 |
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
$file_path = $this -> get_default_directory($data['type']);
|
249 |
-
$files = $this->getFile($file_path,$data['exclude_regex'],$data['include_regex'],$data['log']);
|
250 |
-
}
|
251 |
|
252 |
-
|
|
|
253 |
|
254 |
-
|
255 |
-
{
|
256 |
|
257 |
-
|
|
|
|
|
258 |
$result = $backup_database -> backup_database($data,$this->task_id);
|
259 |
-
$
|
260 |
if($result['result']=='succeed')
|
261 |
{
|
262 |
$files=$result['files'];
|
263 |
-
$result = $backup_site -> backup_files($data,$files,$this->task_id
|
264 |
foreach ($files as $sql_file)
|
265 |
{
|
266 |
@unlink($sql_file);
|
267 |
}
|
268 |
}
|
269 |
-
$this->writetotxt($this->backup_path,$backup_type_data['type_name']);
|
270 |
}
|
271 |
else
|
272 |
{
|
273 |
-
$
|
274 |
-
$
|
|
|
275 |
}
|
276 |
$res = array();
|
277 |
|
@@ -281,7 +282,7 @@ class WPvivid_Backup{
|
|
281 |
}else{
|
282 |
$res['result'] = 'succeed';
|
283 |
$res['files'] = $result['meta'];
|
284 |
-
WPvivid_taskmanager::update_backup_sub_task_progress($this->task_id,'backup',$
|
285 |
}
|
286 |
return $res;
|
287 |
}
|
@@ -294,20 +295,17 @@ class WPvivid_Backup{
|
|
294 |
foreach ($type as $item)
|
295 |
{
|
296 |
foreach ($item['files'] as $file){
|
297 |
-
$file_list[] = $this->
|
298 |
}
|
299 |
}
|
300 |
-
|
301 |
-
$data['path'] = $this->createCompressPath($this->
|
302 |
$data['type']=WPVIVID_BACKUP_TYPE_MERGE;
|
|
|
303 |
$data['log'] = $this->log;
|
304 |
-
$data['compress_limit_size']=$this->compress_limit_size;
|
305 |
-
$data['use_temp_file'] =$this->use_temp_file;
|
306 |
-
$data['use_temp_size'] =$this->use_temp_size;
|
307 |
|
308 |
WPvivid_taskmanager::update_backup_sub_task_progress($this->task_id,'backup',WPVIVID_BACKUP_TYPE_MERGE,0,'Start compressing backup packages for a complete backup.');
|
309 |
-
$result = $backup_site -> backup_files($data,$file_list,$this->task_id
|
310 |
-
$this->writetotxt($this->backup_path,WPVIVID_BACKUP_TYPE_MERGE);
|
311 |
$res = array();
|
312 |
if(!is_array($result))
|
313 |
{
|
@@ -322,36 +320,35 @@ class WPvivid_Backup{
|
|
322 |
{
|
323 |
foreach ($item['files'] as $file)
|
324 |
{
|
325 |
-
@unlink($this->
|
326 |
}
|
327 |
}
|
328 |
return $res;
|
329 |
}
|
330 |
|
331 |
-
public function upload($task_id,$files,$log)
|
332 |
{
|
333 |
$this->task_id=$task_id;
|
334 |
WPvivid_taskmanager::update_backup_main_task_progress($task_id,'upload',0,0);
|
335 |
$remote_options=WPvivid_taskmanager::get_task_options($task_id,'remote_options');
|
336 |
-
|
337 |
$error = array();
|
338 |
$flag = true;
|
339 |
-
|
340 |
$remote = new WPvivid_Backup_Remote();
|
|
|
341 |
foreach ($remote_options as $data)
|
342 |
{
|
343 |
global $wpvivid_pulgin;
|
344 |
$wpvivid_pulgin->set_time_limit($task_id);
|
345 |
$wpvivid_pulgin->check_cancel_backup($task_id);
|
346 |
$upload_job=WPvivid_taskmanager::get_backup_sub_task_progress($task_id,'upload',$data['type']);
|
347 |
-
|
348 |
if($upload_job&&$upload_job['finished']==1)
|
349 |
{
|
350 |
continue;
|
351 |
}
|
352 |
else
|
353 |
{
|
354 |
-
|
355 |
$data['log'] = $log;
|
356 |
$data['files'] = $files;
|
357 |
$data['task_id']=$this->task_id;
|
@@ -386,6 +383,20 @@ class WPvivid_Backup{
|
|
386 |
$flag = false;
|
387 |
break;
|
388 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
389 |
if($flag)
|
390 |
{
|
391 |
$log->WriteLog('Finished uploading '.$data['type'],'notice');
|
@@ -440,17 +451,17 @@ class WPvivid_Backup{
|
|
440 |
return $flag;
|
441 |
}
|
442 |
|
443 |
-
public function getFile($path ,$exclude_regex,$include_regex,$log)
|
444 |
{
|
445 |
$log ->WriteLog('Start getting files.','notice');
|
446 |
$files = array();
|
447 |
|
448 |
-
$this->getFileLoop($files,$path,$exclude_regex,$include_regex);
|
449 |
$log ->WriteLog('Getting files completed.','notice');
|
450 |
$log ->WriteLog('File number: '.sizeof($files),'notice');
|
451 |
return $files;
|
452 |
}
|
453 |
-
private function getFileLoop(&$files,$path,$exclude_regex,$include_regex,$include_dir = true){
|
454 |
$handler=opendir($path);
|
455 |
$count = 0;
|
456 |
while(($filename=readdir($handler))!==false)
|
@@ -470,13 +481,13 @@ class WPvivid_Backup{
|
|
470 |
}
|
471 |
}
|
472 |
else{
|
473 |
-
if($
|
474 |
{
|
475 |
$files[] = $path.DIRECTORY_SEPARATOR.$filename;
|
476 |
}
|
477 |
else
|
478 |
{
|
479 |
-
if(filesize($path.DIRECTORY_SEPARATOR.$filename)<$
|
480 |
{
|
481 |
$files[] = $path.DIRECTORY_SEPARATOR.$filename;
|
482 |
}
|
@@ -555,4 +566,24 @@ class WPvivid_Backup{
|
|
555 |
WPvivid_downloader::delete($remote,$files);
|
556 |
}
|
557 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
558 |
}
|
4 |
die;
|
5 |
}
|
6 |
|
7 |
+
define('WPVIVID_BACKUP_TYPE_DB','backup_db');
|
8 |
+
define('WPVIVID_BACKUP_TYPE_THEMES','backup_themes');
|
9 |
+
define('WPVIVID_BACKUP_TYPE_PLUGIN','backup_plugin');
|
10 |
+
define('WPVIVID_BACKUP_TYPE_UPLOADS','backup_uploads');
|
11 |
+
define('WPVIVID_BACKUP_TYPE_CONTENT','backup_content');
|
12 |
+
define('WPVIVID_BACKUP_TYPE_CORE','backup_core');
|
13 |
+
define('WPVIVID_BACKUP_TYPE_OTHERS','backup_others');
|
14 |
+
define('WPVIVID_BACKUP_TYPE_MERGE','backup_merge');
|
15 |
+
|
16 |
include_once plugin_dir_path( dirname( __FILE__ ) ) .'includes/class-wpvivid-rollback.php';
|
17 |
class WPvivid_Backup{
|
|
|
|
|
18 |
private $i_progress;
|
19 |
private $i_step;
|
20 |
+
private $options;
|
|
|
|
|
|
|
|
|
21 |
public $log;
|
22 |
public $task_id;
|
23 |
+
|
24 |
+
//public $backup_path;
|
25 |
+
//public $file_prefix;
|
26 |
+
//public $compress_type;
|
27 |
+
//public $compress_limit_size;
|
28 |
+
|
29 |
+
//public $ismerge;
|
30 |
+
//public $no_compress;
|
31 |
+
//public $exclude_file_size=0;
|
32 |
+
//public $use_temp_file=0;
|
33 |
+
//public $use_temp_size=0;
|
34 |
|
35 |
public function get_default_exclude_regex($type_name = '')
|
36 |
{
|
88 |
return implode(DIRECTORY_SEPARATOR,$values);
|
89 |
}
|
90 |
|
91 |
+
public function init_options($task_id)
|
92 |
{
|
93 |
$this->task_id=$task_id;
|
94 |
$options_name[]='backup_options';
|
95 |
$options_name[]='ismerge';
|
96 |
$options_name[]='file_prefix';
|
97 |
+
$options_name[]='log_file_name';
|
98 |
+
$this->options=WPvivid_taskmanager::get_task_options($task_id,$options_name);
|
99 |
+
|
100 |
+
$this->log=new WPvivid_Log();
|
101 |
+
$this->log->OpenLogFile($this->options['log_file_name']);
|
102 |
+
/*$this->backup_path=WP_CONTENT_DIR.'/'. $options['backup_options']['dir'];
|
103 |
$this->file_prefix=$options['file_prefix'];
|
104 |
$this->compress_type= $options['backup_options']['compress']['compress_type'];
|
105 |
$this->compress_limit_size= $options['backup_options']['compress']['max_file_size'];
|
119 |
$a['meta'] = array();
|
120 |
$type[]=$a;
|
121 |
}
|
122 |
+
}*/
|
|
|
|
|
123 |
}
|
124 |
|
125 |
+
public function backup($task_id)
|
126 |
{
|
127 |
+
add_filter('wpvivid_backup_get_files_list', array($this, 'get_files_list'),10,2);
|
128 |
+
$this->init_options($task_id);
|
129 |
WPvivid_taskmanager::update_backup_main_task_progress($this->task_id,'backup',0,0);
|
130 |
$flag = true;
|
131 |
$error = '';
|
132 |
$type=array();
|
133 |
$this->i_progress=0;
|
134 |
+
if($this->options['ismerge'])
|
135 |
{
|
136 |
+
$this->i_step=intval(1/(sizeof( $this->options['backup_options']['backup']['backup_type'])+1)*100);
|
137 |
}
|
138 |
else
|
139 |
{
|
140 |
+
$this->i_step=intval(1/sizeof($this->options['backup_options']['backup']['backup_type'])*100);
|
141 |
}
|
142 |
|
143 |
+
foreach ($this->options['backup_options']['backup']['backup_type'] as $type_name=>$extra_data)
|
144 |
{
|
145 |
global $wpvivid_pulgin;
|
146 |
$wpvivid_pulgin->check_cancel_backup($this->task_id);
|
147 |
|
148 |
+
$backup_job=WPvivid_taskmanager::get_backup_sub_task_progress($this->task_id,'backup',$type_name);
|
149 |
if($backup_job&&$backup_job['finished']==1)
|
150 |
{
|
151 |
$result =$backup_job['job_data'];
|
154 |
{
|
155 |
global $wpvivid_pulgin;
|
156 |
$wpvivid_pulgin->set_time_limit($this->task_id);
|
157 |
+
|
158 |
+
$data=$this->get_backup_needed_data($type_name,$extra_data);
|
159 |
+
$result = $this->backup_loop_ex($data);
|
160 |
}
|
161 |
|
162 |
if($result['result'] == 'succeed')
|
165 |
$this->i_progress+=$this->i_step;
|
166 |
WPvivid_taskmanager::update_backup_main_task_progress($this->task_id,'backup',$this->i_progress,0);
|
167 |
$type[] = array(
|
168 |
+
'type_name' => $type_name,
|
169 |
'files' => $result['files'],
|
170 |
);
|
171 |
}else{
|
180 |
$zip_result = array
|
181 |
(
|
182 |
'result' => 'succeed',
|
183 |
+
'ismerge' => $this->options['ismerge'] ,
|
184 |
'data' => array
|
185 |
(
|
186 |
'type' => $type ,
|
187 |
'meta' => array()
|
188 |
)
|
189 |
);
|
190 |
+
if($this->options['ismerge'])
|
191 |
{
|
192 |
global $wpvivid_pulgin;
|
193 |
$wpvivid_pulgin->set_time_limit($this->task_id);
|
197 |
if($res['result'] == 'succeed')
|
198 |
{
|
199 |
$zip_result['data']['meta']=array('type_name' => WPVIVID_BACKUP_TYPE_MERGE , 'files' => $res['files']);
|
|
|
200 |
}
|
201 |
else
|
202 |
{
|
229 |
return $zip_result;
|
230 |
}
|
231 |
|
232 |
+
private function get_backup_needed_data($type_name,$extra_data)
|
233 |
{
|
|
|
|
|
|
|
234 |
$data = array();
|
235 |
+
$data['compress']=$this->options['backup_options']['compress'];
|
236 |
+
$data['path'] = $this->createCompressPath(WP_CONTENT_DIR.'/'. $this->options['backup_options']['dir'],$this->options['file_prefix'],$type_name,$this->options['backup_options']['compress']['compress_type']);
|
|
|
237 |
$data['log'] = $this->log;
|
|
|
238 |
|
239 |
+
$data['type'] = $type_name;
|
|
|
|
|
|
|
|
|
|
|
|
|
240 |
|
241 |
+
$data=apply_filters('wpvivid_backup_set_exart_data',$data,$extra_data,$type_name);
|
|
|
|
|
242 |
|
243 |
+
return $data;
|
244 |
+
}
|
245 |
|
246 |
+
private function backup_loop_ex($data)
|
247 |
+
{
|
248 |
+
include_once 'class-wpvivid-backup-database.php';
|
249 |
+
include_once 'class-wpvivid-backup-site.php';
|
|
|
|
|
|
|
250 |
|
251 |
+
$backup_database = new WPvivid_Backup_Database();
|
252 |
+
$backup_site = new WPvivid_Backup_Site();
|
253 |
|
254 |
+
WPvivid_taskmanager::update_backup_sub_task_progress($this->task_id,'backup',$data['type'],0,'Start backing up '.$data['type'].'.');
|
|
|
255 |
|
256 |
+
if($data['type'] === WPVIVID_BACKUP_TYPE_DB)
|
257 |
+
{
|
258 |
+
$this->log->WriteLog('Start exporting database.','notice');
|
259 |
$result = $backup_database -> backup_database($data,$this->task_id);
|
260 |
+
$this->log->WriteLog('Exporting database finished.','notice');
|
261 |
if($result['result']=='succeed')
|
262 |
{
|
263 |
$files=$result['files'];
|
264 |
+
$result = $backup_site -> backup_files($data,$files,$this->task_id);
|
265 |
foreach ($files as $sql_file)
|
266 |
{
|
267 |
@unlink($sql_file);
|
268 |
}
|
269 |
}
|
|
|
270 |
}
|
271 |
else
|
272 |
{
|
273 |
+
$files=array();
|
274 |
+
$files=apply_filters('wpvivid_backup_get_files_list',$files,$data);
|
275 |
+
$result = $backup_site -> backup_files($data,$files,$this->task_id);
|
276 |
}
|
277 |
$res = array();
|
278 |
|
282 |
}else{
|
283 |
$res['result'] = 'succeed';
|
284 |
$res['files'] = $result['meta'];
|
285 |
+
WPvivid_taskmanager::update_backup_sub_task_progress($this->task_id,'backup',$data['type'],1,'Backing up '.$data['type'].' finished.',$res);
|
286 |
}
|
287 |
return $res;
|
288 |
}
|
295 |
foreach ($type as $item)
|
296 |
{
|
297 |
foreach ($item['files'] as $file){
|
298 |
+
$file_list[] = WP_CONTENT_DIR.'/'. $this->options['backup_options']['dir'].DIRECTORY_SEPARATOR.$file['file_name'];
|
299 |
}
|
300 |
}
|
301 |
+
$data=array();
|
302 |
+
$data['path'] = $this->createCompressPath(WP_CONTENT_DIR.'/'. $this->options['backup_options']['dir'],$this->options['file_prefix'],'all',$this->options['backup_options']['compress']['compress_type']);
|
303 |
$data['type']=WPVIVID_BACKUP_TYPE_MERGE;
|
304 |
+
$data['compress']=$this->options['backup_options']['compress'];
|
305 |
$data['log'] = $this->log;
|
|
|
|
|
|
|
306 |
|
307 |
WPvivid_taskmanager::update_backup_sub_task_progress($this->task_id,'backup',WPVIVID_BACKUP_TYPE_MERGE,0,'Start compressing backup packages for a complete backup.');
|
308 |
+
$result = $backup_site -> backup_files($data,$file_list,$this->task_id);
|
|
|
309 |
$res = array();
|
310 |
if(!is_array($result))
|
311 |
{
|
320 |
{
|
321 |
foreach ($item['files'] as $file)
|
322 |
{
|
323 |
+
@unlink(WP_CONTENT_DIR.'/'. $this->options['backup_options']['dir'].DIRECTORY_SEPARATOR.$file['file_name']);
|
324 |
}
|
325 |
}
|
326 |
return $res;
|
327 |
}
|
328 |
|
329 |
+
public function upload($task_id,$files,$log,$callback = '')
|
330 |
{
|
331 |
$this->task_id=$task_id;
|
332 |
WPvivid_taskmanager::update_backup_main_task_progress($task_id,'upload',0,0);
|
333 |
$remote_options=WPvivid_taskmanager::get_task_options($task_id,'remote_options');
|
|
|
334 |
$error = array();
|
335 |
$flag = true;
|
336 |
+
|
337 |
$remote = new WPvivid_Backup_Remote();
|
338 |
+
|
339 |
foreach ($remote_options as $data)
|
340 |
{
|
341 |
global $wpvivid_pulgin;
|
342 |
$wpvivid_pulgin->set_time_limit($task_id);
|
343 |
$wpvivid_pulgin->check_cancel_backup($task_id);
|
344 |
$upload_job=WPvivid_taskmanager::get_backup_sub_task_progress($task_id,'upload',$data['type']);
|
|
|
345 |
if($upload_job&&$upload_job['finished']==1)
|
346 |
{
|
347 |
continue;
|
348 |
}
|
349 |
else
|
350 |
{
|
351 |
+
$log->WriteLog('start a upload files with '.$data['type'],'notice');
|
352 |
$data['log'] = $log;
|
353 |
$data['files'] = $files;
|
354 |
$data['task_id']=$this->task_id;
|
383 |
$flag = false;
|
384 |
break;
|
385 |
}
|
386 |
+
// $class_name = 'WPvivid_'.$data['type'].'Class';
|
387 |
+
// if(!class_exists($class_name)){
|
388 |
+
// $method = new WPvivid_Remote_Defult();
|
389 |
+
// return $method -> upload($data,$files,$callback);
|
390 |
+
// }
|
391 |
+
// $method = new $class_name();
|
392 |
+
// $method -> setLog($log);
|
393 |
+
// $method -> setTaskId($this -> task_id);
|
394 |
+
// $result = $method -> upload($data,$files,$callback);
|
395 |
+
// if($result['result'] !== 'succeed'){
|
396 |
+
// $flag = false;
|
397 |
+
// $error = array('type' => $data['type'],'text' => $result['error']);
|
398 |
+
// }
|
399 |
+
|
400 |
if($flag)
|
401 |
{
|
402 |
$log->WriteLog('Finished uploading '.$data['type'],'notice');
|
451 |
return $flag;
|
452 |
}
|
453 |
|
454 |
+
public function getFile($path ,$exclude_regex,$include_regex,$exclude_file_size,$log)
|
455 |
{
|
456 |
$log ->WriteLog('Start getting files.','notice');
|
457 |
$files = array();
|
458 |
|
459 |
+
$this->getFileLoop($files,$path,$exclude_regex,$include_regex,$exclude_file_size);
|
460 |
$log ->WriteLog('Getting files completed.','notice');
|
461 |
$log ->WriteLog('File number: '.sizeof($files),'notice');
|
462 |
return $files;
|
463 |
}
|
464 |
+
private function getFileLoop(&$files,$path,$exclude_regex,$include_regex,$exclude_file_size,$include_dir = true){
|
465 |
$handler=opendir($path);
|
466 |
$count = 0;
|
467 |
while(($filename=readdir($handler))!==false)
|
481 |
}
|
482 |
}
|
483 |
else{
|
484 |
+
if($exclude_file_size==0)
|
485 |
{
|
486 |
$files[] = $path.DIRECTORY_SEPARATOR.$filename;
|
487 |
}
|
488 |
else
|
489 |
{
|
490 |
+
if(filesize($path.DIRECTORY_SEPARATOR.$filename)<$exclude_file_size*1024*1024)
|
491 |
{
|
492 |
$files[] = $path.DIRECTORY_SEPARATOR.$filename;
|
493 |
}
|
566 |
WPvivid_downloader::delete($remote,$files);
|
567 |
}
|
568 |
}
|
569 |
+
|
570 |
+
public function get_files_list($files,$data)
|
571 |
+
{
|
572 |
+
$file_path = $this -> get_default_directory($data['type']);
|
573 |
+
$data['exclude_regex'] =$this->get_default_exclude_regex($data['type']);
|
574 |
+
$data['include_regex'] =array();
|
575 |
+
|
576 |
+
if($file_path=='')
|
577 |
+
{
|
578 |
+
$_files = array();
|
579 |
+
}
|
580 |
+
else
|
581 |
+
{
|
582 |
+
$_files = $this->getFile($file_path,$data['exclude_regex'],$data['include_regex'],$data['compress']['exclude_file_size'],$data['log']);
|
583 |
+
}
|
584 |
+
|
585 |
+
|
586 |
+
$files=array_merge($_files,$files);
|
587 |
+
return $files;
|
588 |
+
}
|
589 |
}
|
includes/class-wpvivid-backuplist.php
CHANGED
@@ -36,6 +36,13 @@ class WPvivid_Backuplist
|
|
36 |
WPvivid_Setting::update_option('wpvivid_backup_list',$list);
|
37 |
}
|
38 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
39 |
public static function set_backup_file_data($file_data)
|
40 |
{
|
41 |
$ret=array();
|
36 |
WPvivid_Setting::update_option('wpvivid_backup_list',$list);
|
37 |
}
|
38 |
|
39 |
+
public static function update_backup($id,$key,$data)
|
40 |
+
{
|
41 |
+
$list = WPvivid_Setting::get_option('wpvivid_backup_list');
|
42 |
+
$list[$id][$key]=$data;
|
43 |
+
WPvivid_Setting::update_option('wpvivid_backup_list',$list);
|
44 |
+
}
|
45 |
+
|
46 |
public static function set_backup_file_data($file_data)
|
47 |
{
|
48 |
$ret=array();
|
includes/class-wpvivid-mysqldump.php
CHANGED
@@ -526,8 +526,28 @@ class WPvivid_Mysqldump
|
|
526 |
private function exportTables()
|
527 |
{
|
528 |
// Exporting tables one by one
|
529 |
-
|
530 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
531 |
continue;
|
532 |
}
|
533 |
|
@@ -547,7 +567,14 @@ class WPvivid_Mysqldump
|
|
547 |
} else {
|
548 |
$this->listValues($table);
|
549 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
550 |
}
|
|
|
551 |
}
|
552 |
|
553 |
/**
|
526 |
private function exportTables()
|
527 |
{
|
528 |
// Exporting tables one by one
|
529 |
+
$i=0;
|
530 |
+
$i_step=0;
|
531 |
+
|
532 |
+
if($this->task_id!=='')
|
533 |
+
{
|
534 |
+
$options_name[]='backup_options';
|
535 |
+
$options_name[]='ismerge';
|
536 |
+
$options=WPvivid_taskmanager::get_task_options($this->task_id,$options_name);
|
537 |
+
if($options['ismerge'])
|
538 |
+
{
|
539 |
+
$i_step=intval(1/(sizeof($options['backup_options']['backup']['backup_type'])+1)*100);
|
540 |
+
}
|
541 |
+
else
|
542 |
+
{
|
543 |
+
$i_step=intval(1/sizeof($options['backup_options']['backup']['backup_type'])*100);
|
544 |
+
}
|
545 |
+
}
|
546 |
+
|
547 |
+
foreach ($this->tables as $table)
|
548 |
+
{
|
549 |
+
if ( $this->matches($table, $this->dumpSettings['exclude-tables']) )
|
550 |
+
{
|
551 |
continue;
|
552 |
}
|
553 |
|
567 |
} else {
|
568 |
$this->listValues($table);
|
569 |
}
|
570 |
+
$i++;
|
571 |
+
if($this->task_id!=='')
|
572 |
+
{
|
573 |
+
$i_progress=intval($i/sizeof($this->tables)*$i_step);
|
574 |
+
WPvivid_taskmanager::update_backup_main_task_progress($this->task_id,'backup',$i_progress,0);
|
575 |
+
}
|
576 |
}
|
577 |
+
return ;
|
578 |
}
|
579 |
|
580 |
/**
|
includes/class-wpvivid-restore.php
CHANGED
@@ -61,7 +61,6 @@ class WPvivid_Restore{
|
|
61 |
if($result['result'] !== 'succeed')
|
62 |
return $result;
|
63 |
}
|
64 |
-
|
65 |
$temp_expath .= DIRECTORY_SEPARATOR.WPvivid_Setting::get_backupdir();
|
66 |
}
|
67 |
else
|
61 |
if($result['result'] !== 'succeed')
|
62 |
return $result;
|
63 |
}
|
|
|
64 |
$temp_expath .= DIRECTORY_SEPARATOR.WPvivid_Setting::get_backupdir();
|
65 |
}
|
66 |
else
|
includes/class-wpvivid-schedule.php
CHANGED
@@ -3,6 +3,7 @@
|
|
3 |
if (!defined('WPVIVID_PLUGIN_DIR')){
|
4 |
die;
|
5 |
}
|
|
|
6 |
class WPvivid_Schedule
|
7 |
{
|
8 |
public function wpvivid_cron_schedules($schedules)
|
@@ -72,7 +73,7 @@ class WPvivid_Schedule
|
|
72 |
|
73 |
$week=$time['start_time']['week'];
|
74 |
$day=$time['start_time']['day'];
|
75 |
-
$current_day
|
76 |
|
77 |
if($time['type']=='wpvivid_4hours'||$time['type']=='wpvivid_6hours'||$time['type']=='wpvivid_8hours'||$time['type']=='wpvivid_12hours')
|
78 |
{
|
@@ -197,32 +198,6 @@ class WPvivid_Schedule
|
|
197 |
return true;
|
198 |
}
|
199 |
|
200 |
-
public static function set_schedule_ex_test($schedule)
|
201 |
-
{
|
202 |
-
WPvivid_Setting::update_option('wpvivid_schedule_setting',$schedule);
|
203 |
-
|
204 |
-
$time=$schedule['time'];
|
205 |
-
|
206 |
-
$timestamp=time()+120;
|
207 |
-
|
208 |
-
if($timestamp===false)
|
209 |
-
{
|
210 |
-
return false;
|
211 |
-
}
|
212 |
-
|
213 |
-
if(wp_get_schedule(WPVIVID_MAIN_SCHEDULE_EVENT))
|
214 |
-
{
|
215 |
-
$timestamp = wp_next_scheduled(WPVIVID_MAIN_SCHEDULE_EVENT);
|
216 |
-
wp_unschedule_event($timestamp,WPVIVID_MAIN_SCHEDULE_EVENT);
|
217 |
-
}
|
218 |
-
if(wp_schedule_event($timestamp, $time['type'], WPVIVID_MAIN_SCHEDULE_EVENT)===false)
|
219 |
-
{
|
220 |
-
return false;
|
221 |
-
}
|
222 |
-
|
223 |
-
return true;
|
224 |
-
}
|
225 |
-
|
226 |
public static function reset_schedule()
|
227 |
{
|
228 |
$schedule=WPvivid_Setting::get_option('wpvivid_schedule_setting');
|
@@ -273,4 +248,4 @@ class WPvivid_Schedule
|
|
273 |
return false;
|
274 |
}
|
275 |
}
|
276 |
-
}
|
3 |
if (!defined('WPVIVID_PLUGIN_DIR')){
|
4 |
die;
|
5 |
}
|
6 |
+
|
7 |
class WPvivid_Schedule
|
8 |
{
|
9 |
public function wpvivid_cron_schedules($schedules)
|
73 |
|
74 |
$week=$time['start_time']['week'];
|
75 |
$day=$time['start_time']['day'];
|
76 |
+
$current_day='00:00';
|
77 |
|
78 |
if($time['type']=='wpvivid_4hours'||$time['type']=='wpvivid_6hours'||$time['type']=='wpvivid_8hours'||$time['type']=='wpvivid_12hours')
|
79 |
{
|
198 |
return true;
|
199 |
}
|
200 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
201 |
public static function reset_schedule()
|
202 |
{
|
203 |
$schedule=WPvivid_Setting::get_option('wpvivid_schedule_setting');
|
248 |
return false;
|
249 |
}
|
250 |
}
|
251 |
+
}
|
includes/class-wpvivid-setting.php
CHANGED
@@ -276,34 +276,25 @@ class WPvivid_Setting
|
|
276 |
self::check_local_options();
|
277 |
|
278 |
if($post=='files+db')
|
279 |
-
{
|
280 |
-
$backup_options['backup']['backup_type'][WPVIVID_BACKUP_TYPE_DB]=1;
|
281 |
-
$backup_options['backup']['backup_type'][WPVIVID_BACKUP_TYPE_THEMES]=1;
|
282 |
-
$backup_options['backup']['backup_type'][WPVIVID_BACKUP_TYPE_PLUGIN]=1;
|
283 |
-
$backup_options['backup']['backup_type'][WPVIVID_BACKUP_TYPE_UPLOADS]=1;
|
284 |
-
$backup_options['backup']['backup_type'][WPVIVID_BACKUP_TYPE_CONTENT]=1;
|
285 |
-
$backup_options['backup']['backup_type'][WPVIVID_BACKUP_TYPE_CORE]=1;
|
286 |
-
}
|
287 |
-
else if($post=='files')
|
288 |
{
|
289 |
$backup_options['backup']['backup_type'][WPVIVID_BACKUP_TYPE_DB]=0;
|
290 |
-
$backup_options['backup']['backup_type'][WPVIVID_BACKUP_TYPE_THEMES]=
|
291 |
-
$backup_options['backup']['backup_type'][WPVIVID_BACKUP_TYPE_PLUGIN]=
|
292 |
-
$backup_options['backup']['backup_type'][WPVIVID_BACKUP_TYPE_UPLOADS]=
|
293 |
-
$backup_options['backup']['backup_type'][WPVIVID_BACKUP_TYPE_CONTENT]=
|
294 |
-
$backup_options['backup']['backup_type'][WPVIVID_BACKUP_TYPE_CORE]=
|
295 |
}
|
296 |
-
else if($post=='
|
297 |
{
|
298 |
-
$backup_options['backup']['backup_type'][WPVIVID_BACKUP_TYPE_DB]=1;
|
299 |
$backup_options['backup']['backup_type'][WPVIVID_BACKUP_TYPE_THEMES]=0;
|
300 |
$backup_options['backup']['backup_type'][WPVIVID_BACKUP_TYPE_PLUGIN]=0;
|
301 |
$backup_options['backup']['backup_type'][WPVIVID_BACKUP_TYPE_UPLOADS]=0;
|
302 |
$backup_options['backup']['backup_type'][WPVIVID_BACKUP_TYPE_CONTENT]=0;
|
303 |
$backup_options['backup']['backup_type'][WPVIVID_BACKUP_TYPE_CORE]=0;
|
304 |
}
|
305 |
-
else if($post=='
|
306 |
{
|
|
|
307 |
}
|
308 |
else
|
309 |
{
|
276 |
self::check_local_options();
|
277 |
|
278 |
if($post=='files+db')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
279 |
{
|
280 |
$backup_options['backup']['backup_type'][WPVIVID_BACKUP_TYPE_DB]=0;
|
281 |
+
$backup_options['backup']['backup_type'][WPVIVID_BACKUP_TYPE_THEMES]=0;
|
282 |
+
$backup_options['backup']['backup_type'][WPVIVID_BACKUP_TYPE_PLUGIN]=0;
|
283 |
+
$backup_options['backup']['backup_type'][WPVIVID_BACKUP_TYPE_UPLOADS]=0;
|
284 |
+
$backup_options['backup']['backup_type'][WPVIVID_BACKUP_TYPE_CONTENT]=0;
|
285 |
+
$backup_options['backup']['backup_type'][WPVIVID_BACKUP_TYPE_CORE]=0;
|
286 |
}
|
287 |
+
else if($post=='files')
|
288 |
{
|
|
|
289 |
$backup_options['backup']['backup_type'][WPVIVID_BACKUP_TYPE_THEMES]=0;
|
290 |
$backup_options['backup']['backup_type'][WPVIVID_BACKUP_TYPE_PLUGIN]=0;
|
291 |
$backup_options['backup']['backup_type'][WPVIVID_BACKUP_TYPE_UPLOADS]=0;
|
292 |
$backup_options['backup']['backup_type'][WPVIVID_BACKUP_TYPE_CONTENT]=0;
|
293 |
$backup_options['backup']['backup_type'][WPVIVID_BACKUP_TYPE_CORE]=0;
|
294 |
}
|
295 |
+
else if($post=='db')
|
296 |
{
|
297 |
+
$backup_options['backup']['backup_type'][WPVIVID_BACKUP_TYPE_DB]=0;
|
298 |
}
|
299 |
else
|
300 |
{
|
includes/class-wpvivid-zipclass.php
CHANGED
@@ -15,6 +15,66 @@ class WPvivid_ZipClass {
|
|
15 |
}
|
16 |
}
|
17 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
18 |
public function zipsplit($path,$files,$replacepath,$size=0,$use_temp_file=1,$use_temp_size=16){
|
19 |
$filesmeta = array();
|
20 |
$backupdata = array();
|
@@ -129,7 +189,7 @@ class WPvivid_ZipClass {
|
|
129 |
@mkdir($temp_dir);
|
130 |
return $this->zip($temp_dir,$backupdata,$replacepath,true,$use_temp_file,$use_temp_size);
|
131 |
}
|
132 |
-
|
133 |
public function zipextract($path,$files){
|
134 |
define(PCLZIP_TEMPORARY_DIR,$path);
|
135 |
$flag = true;
|
15 |
}
|
16 |
}
|
17 |
|
18 |
+
public function zipsplit($zip_data,$files)
|
19 |
+
{
|
20 |
+
$filesmeta = array();
|
21 |
+
$backupdata = array();
|
22 |
+
$packages = array();
|
23 |
+
$size = $zip_data['compress']['max_file_size'];
|
24 |
+
|
25 |
+
if(empty($size) || $size == 0){
|
26 |
+
$data = array(
|
27 |
+
'path' => $zip_data['path'],
|
28 |
+
'files' => $files,
|
29 |
+
);
|
30 |
+
$backupdata[] = $data;
|
31 |
+
}else {
|
32 |
+
$floder = dirname($zip_data['path']);
|
33 |
+
$filename = basename($zip_data['path'], '.zip');
|
34 |
+
$sizenum = 0;
|
35 |
+
$flag = 0;
|
36 |
+
$pack_num = 1;
|
37 |
+
$size = $size * 1024 * 1024;
|
38 |
+
|
39 |
+
foreach ($files as $file) {
|
40 |
+
if (!file_exists($file))
|
41 |
+
return array('result' => 'failed', 'error' => $file . ' is not found when being split. Please verify the the file exists.');
|
42 |
+
$sizenum += filesize($file);
|
43 |
+
if ($sizenum > $size) {
|
44 |
+
if(empty($packages[$flag])){
|
45 |
+
$packages[$flag][] = $file;
|
46 |
+
$sizenum = filesize($file);
|
47 |
+
continue;
|
48 |
+
}else{
|
49 |
+
$flag++;
|
50 |
+
$sizenum = filesize($file);
|
51 |
+
}
|
52 |
+
}
|
53 |
+
$packages[$flag][] = $file;
|
54 |
+
}
|
55 |
+
|
56 |
+
if (sizeof($packages) == 1) {
|
57 |
+
$backupdata[] = array(
|
58 |
+
'path' => $zip_data['path'],
|
59 |
+
'files' => $packages[0],
|
60 |
+
);
|
61 |
+
} else {
|
62 |
+
foreach ($packages as $item){
|
63 |
+
$backupdata[] = array(
|
64 |
+
'path' => $floder.DIRECTORY_SEPARATOR.$filename.'.part'.sprintf('%03d',$pack_num).'.zip',
|
65 |
+
'files' => $item,
|
66 |
+
);
|
67 |
+
$pack_num ++;
|
68 |
+
}
|
69 |
+
}
|
70 |
+
}
|
71 |
+
$dir=WPvivid_Setting::get_backupdir();
|
72 |
+
$temp_dir = WP_CONTENT_DIR.DIRECTORY_SEPARATOR.$dir.DIRECTORY_SEPARATOR.'temp-'.basename($zip_data['path'], '.zip').DIRECTORY_SEPARATOR;
|
73 |
+
@mkdir($temp_dir);
|
74 |
+
return $this->zip($temp_dir,$backupdata,$zip_data['replace_path'],$zip_data['compress']['no_compress'],$zip_data['compress']['use_temp_file'],$zip_data['compress']['use_temp_size']);
|
75 |
+
}
|
76 |
+
|
77 |
+
/*
|
78 |
public function zipsplit($path,$files,$replacepath,$size=0,$use_temp_file=1,$use_temp_size=16){
|
79 |
$filesmeta = array();
|
80 |
$backupdata = array();
|
189 |
@mkdir($temp_dir);
|
190 |
return $this->zip($temp_dir,$backupdata,$replacepath,true,$use_temp_file,$use_temp_size);
|
191 |
}
|
192 |
+
*/
|
193 |
public function zipextract($path,$files){
|
194 |
define(PCLZIP_TEMPORARY_DIR,$path);
|
195 |
$flag = true;
|
includes/class-wpvivid.php
CHANGED
@@ -41,15 +41,13 @@ class WPvivid {
|
|
41 |
|
42 |
public $current_task;
|
43 |
|
|
|
|
|
44 |
public function __construct()
|
45 |
{
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
} else {
|
50 |
-
$this->version = '0.9.4';
|
51 |
-
}
|
52 |
-
$this->plugin_name = 'WPvivid';
|
53 |
|
54 |
//Load dependent files
|
55 |
$this->load_dependencies();
|
@@ -95,6 +93,12 @@ class WPvivid {
|
|
95 |
|
96 |
private function load_dependencies()
|
97 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
98 |
require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wpvivid-i18n.php';
|
99 |
require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wpvivid-admin.php';
|
100 |
|
@@ -104,11 +108,12 @@ class WPvivid {
|
|
104 |
include_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wpvivid-backuplist.php';
|
105 |
include_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wpvivid-restore-data.php';
|
106 |
include_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wpvivid-taskmanager.php';
|
107 |
-
|
108 |
include_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wpvivid-downloader.php';
|
109 |
include_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wpvivid-backup.php';
|
110 |
include_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wpvivid-mail-report.php';
|
111 |
include_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wpvivid-restore.php';
|
|
|
112 |
include_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wpvivid-backuptoremote.php';
|
113 |
}
|
114 |
|
@@ -245,6 +250,8 @@ class WPvivid {
|
|
245 |
add_action('wp_ajax_wpvivid_set_default_remote_storage',array( $this,'set_default_remote_storage'));
|
246 |
//Get default remote storage when backing up
|
247 |
add_action('wp_ajax_wpvivid_get_default_remote_storage',array( $this,'get_default_remote_storage'));
|
|
|
|
|
248 |
}
|
249 |
|
250 |
public function get_plugin_name()
|
@@ -257,6 +264,45 @@ class WPvivid {
|
|
257 |
return $this->version;
|
258 |
}
|
259 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
260 |
/**
|
261 |
* Prepare backup include what you want to backup,where you want to store.
|
262 |
*
|
@@ -267,7 +313,13 @@ class WPvivid {
|
|
267 |
public function prepare_backup()
|
268 |
{
|
269 |
$this->ajax_check_security();
|
270 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
271 |
{
|
272 |
$ret['result']='failed';
|
273 |
$ret['error']=__('Error occurred while parsing the request data. Please try to run backup again.', 'wpvivid');
|
@@ -275,24 +327,13 @@ class WPvivid {
|
|
275 |
die();
|
276 |
}
|
277 |
|
278 |
-
|
279 |
-
|
280 |
-
die();
|
281 |
-
}
|
282 |
-
|
283 |
-
//Initialization backup task;
|
284 |
-
$backup_options=$_POST;
|
285 |
-
$backup_type= array('files+db','files', 'db');
|
286 |
-
if(in_array($backup_options['backup_files'],$backup_type))
|
287 |
{
|
288 |
-
|
289 |
-
|
290 |
-
{
|
291 |
-
//Check the website data to be backed up
|
292 |
-
$ret['check']=$this->check_backup($ret['task_id'],$backup_options['backup_files']);
|
293 |
-
}
|
294 |
-
echo json_encode($ret);
|
295 |
}
|
|
|
296 |
|
297 |
die();
|
298 |
}
|
@@ -535,6 +576,14 @@ class WPvivid {
|
|
535 |
die();
|
536 |
}
|
537 |
//Initialization backup task.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
538 |
$ret=$this->pre_backup($schedule_options['backup'],'Cron');
|
539 |
if($ret['result']=='success')
|
540 |
{
|
@@ -572,6 +621,7 @@ class WPvivid {
|
|
572 |
$this->backup($task_id);
|
573 |
die();
|
574 |
}
|
|
|
575 |
/**
|
576 |
* Clean backing up data schedule.
|
577 |
*
|
@@ -720,7 +770,7 @@ class WPvivid {
|
|
720 |
*
|
721 |
* @since 0.9.1
|
722 |
*/
|
723 |
-
public function pre_backup($backup_options,$type
|
724 |
{
|
725 |
$this->clean_oldest_backup();
|
726 |
|
@@ -731,6 +781,13 @@ class WPvivid {
|
|
731 |
return $ret;
|
732 |
}
|
733 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
734 |
$task_options['backup_options']=WPvivid_Setting::get_backup_options($backup_options['backup_files']);
|
735 |
if($backup_options['ismerge']=='1')
|
736 |
{
|
@@ -753,28 +810,11 @@ class WPvivid {
|
|
753 |
|
754 |
if($backup_options['remote']=='1')
|
755 |
{
|
756 |
-
if (!isset($backup_options['remote_options']))
|
757 |
-
{
|
758 |
-
$ret['result']='failed';
|
759 |
-
$ret['error']=__('Error occurred while parsing the request data. Please try to run backup again.', 'wpvivid');
|
760 |
-
echo json_encode($ret);
|
761 |
-
die();
|
762 |
-
}
|
763 |
$remote_ids=$backup_options['remote_options'];
|
764 |
$remote_ids =stripslashes($remote_ids);
|
765 |
$remotes=json_decode($remote_ids,true);
|
766 |
-
if(is_null($remotes))
|
767 |
-
{
|
768 |
-
die();
|
769 |
-
}
|
770 |
$task_options['remote_options']=WPvivid_Setting::get_remote_options($remotes);
|
771 |
WPvivid_Setting::update_user_history('remote_selected',$remotes);
|
772 |
-
if($task_options['remote_options']==false)
|
773 |
-
{
|
774 |
-
$ret['result']='failed';
|
775 |
-
$ret['error']=__('Fail to parse the settings of remote storage while backing up. Please try to run backup again.', 'wpvivid');
|
776 |
-
return $ret;
|
777 |
-
}
|
778 |
}
|
779 |
else {
|
780 |
$task_options['remote_options']=false;
|
@@ -790,10 +830,10 @@ class WPvivid {
|
|
790 |
$task_options['save_local']=0;
|
791 |
}
|
792 |
|
793 |
-
$task_options['lock']=$lock;
|
794 |
-
|
795 |
-
return WPvivid_taskmanager::new_backup_task($task_options,$type);
|
796 |
}
|
|
|
797 |
/**
|
798 |
* start or resume a backup task.
|
799 |
*
|
@@ -817,21 +857,46 @@ class WPvivid {
|
|
817 |
//start backup
|
818 |
try
|
819 |
{
|
820 |
-
$
|
821 |
-
|
|
|
|
|
822 |
{
|
823 |
-
$
|
824 |
}
|
825 |
else
|
826 |
{
|
827 |
-
$
|
828 |
-
|
829 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
830 |
{
|
831 |
-
|
832 |
-
|
833 |
}
|
834 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
835 |
}
|
836 |
catch (Exception $e)
|
837 |
{
|
@@ -847,17 +912,8 @@ class WPvivid {
|
|
847 |
$this->wpvivid_log->CloseFile();
|
848 |
die();
|
849 |
}
|
850 |
-
|
851 |
-
|
852 |
-
{
|
853 |
-
$this->update_last_backup_task($task_id);
|
854 |
-
die();
|
855 |
-
}
|
856 |
-
else
|
857 |
-
{
|
858 |
-
$this->update_last_backup_task($task_id);
|
859 |
-
die();
|
860 |
-
}
|
861 |
}
|
862 |
/**
|
863 |
* start backup file and db.
|
@@ -880,9 +936,9 @@ class WPvivid {
|
|
880 |
else
|
881 |
{
|
882 |
//Initialization backup option
|
883 |
-
|
884 |
//start backup
|
885 |
-
$backup_ret=$backup->backup($
|
886 |
}
|
887 |
//clean temp file
|
888 |
WPvivid_tools::clearcache($task_id);
|
@@ -953,8 +1009,6 @@ class WPvivid {
|
|
953 |
$backup_data['manual_delete']=0;
|
954 |
|
955 |
$backup_options=WPvivid_taskmanager::get_task_options($task_id,'backup_options');
|
956 |
-
$remote_options=WPvivid_taskmanager::get_task_options($task_id,'remote_options');
|
957 |
-
$save_local=WPvivid_taskmanager::get_task_options($task_id,'save_local');
|
958 |
$lock=WPvivid_taskmanager::get_task_options($task_id,'lock');
|
959 |
$backup_data['local']['path']=$backup_options['dir'];
|
960 |
$backup_data['compress']['compress_type']=$backup_options['compress']['compress_type'];
|
@@ -963,16 +1017,40 @@ class WPvivid {
|
|
963 |
$backup_data['remote']=array();
|
964 |
if($lock==1)
|
965 |
$backup_data['lock']=1;
|
966 |
-
|
|
|
|
|
|
|
|
|
967 |
{
|
968 |
-
|
969 |
-
{
|
970 |
-
$temp['type']=$remote['type'];
|
971 |
-
$temp['options']=$remote['options'];
|
972 |
-
$backup_data['remote'][]=$temp;
|
973 |
-
}
|
974 |
}
|
975 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
976 |
if($save_local==0)
|
977 |
{
|
978 |
$this->wpvivid_log->WriteLog('Clean up local files after uploading to remote storages.','notice');
|
@@ -981,11 +1059,12 @@ class WPvivid {
|
|
981 |
$backup=new WPvivid_Backup();
|
982 |
$backup->clean_backup($file_prefix,$backup_options['dir']);
|
983 |
}
|
984 |
-
$this->wpvivid_log->WriteLog('
|
985 |
-
|
|
|
|
|
986 |
WPvivid_taskmanager::update_backup_task_status($task_id,false,'completed');
|
987 |
WPvivid_Schedule::clear_monitor_schedule($task_id);
|
988 |
-
WPvivid_mail_report::send_report_mail($task_id);
|
989 |
$this->wpvivid_log->CloseFile();
|
990 |
return true;
|
991 |
}
|
@@ -1356,54 +1435,51 @@ class WPvivid {
|
|
1356 |
$backup_option=WPvivid_taskmanager::get_task_options($task_id,'backup_options');
|
1357 |
}
|
1358 |
$exclude_size=$backup_option['compress']['exclude_file_size'];
|
1359 |
-
foreach ( $backup_option['backup']['backup_type'] as $type_name=>$
|
1360 |
{
|
1361 |
-
|
|
|
|
|
1362 |
{
|
1363 |
-
|
1364 |
$options = WPvivid_Setting::get_option('wpvivid_common_setting');
|
1365 |
-
|
1366 |
-
|
1367 |
-
|
1368 |
-
|
1369 |
-
|
1370 |
-
|
1371 |
-
|
1372 |
-
|
1373 |
-
|
1374 |
-
|
1375 |
-
|
1376 |
-
);
|
1377 |
-
|
1378 |
-
|
1379 |
-
|
1380 |
-
|
1381 |
-
|
1382 |
-
|
1383 |
-
|
1384 |
-
|
1385 |
-
|
1386 |
-
|
1387 |
-
|
1388 |
-
|
1389 |
-
|
1390 |
-
|
1391 |
-
|
1392 |
-
|
1393 |
-
|
1394 |
-
|
1395 |
-
|
1396 |
-
|
1397 |
-
|
1398 |
-
break;
|
1399 |
-
default:
|
1400 |
-
break;
|
1401 |
-
}
|
1402 |
|
1403 |
-
|
1404 |
-
|
1405 |
-
|
1406 |
-
}
|
1407 |
}
|
1408 |
}
|
1409 |
|
@@ -3354,12 +3430,19 @@ class WPvivid {
|
|
3354 |
else if(is_dir($path.DIRECTORY_SEPARATOR.$filename))
|
3355 |
{
|
3356 |
$this->get_dir_files($files ,$folder, $path.DIRECTORY_SEPARATOR.$filename,$except_regex,$exclude_folder);
|
3357 |
-
if(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3358 |
{
|
3359 |
$folder[]=$path.DIRECTORY_SEPARATOR.$filename;
|
3360 |
}
|
3361 |
}else {
|
3362 |
-
if($except_regex===false)
|
3363 |
{
|
3364 |
if(in_array($filename,$exclude_files))
|
3365 |
{
|
@@ -3374,24 +3457,6 @@ class WPvivid {
|
|
3374 |
$files[] = $path.DIRECTORY_SEPARATOR.$filename;
|
3375 |
}
|
3376 |
}
|
3377 |
-
else
|
3378 |
-
{
|
3379 |
-
if(preg_match($except_regex ,$filename))
|
3380 |
-
{
|
3381 |
-
if(in_array($filename,$exclude_files))
|
3382 |
-
{
|
3383 |
-
continue;
|
3384 |
-
}
|
3385 |
-
if($exclude_file_size==0)
|
3386 |
-
{
|
3387 |
-
$files[] = $path.DIRECTORY_SEPARATOR.$filename;
|
3388 |
-
}
|
3389 |
-
else if(filesize($path.DIRECTORY_SEPARATOR.$filename)<$exclude_file_size*1024*1024)
|
3390 |
-
{
|
3391 |
-
$files[] = $path.DIRECTORY_SEPARATOR.$filename;
|
3392 |
-
}
|
3393 |
-
}
|
3394 |
-
}
|
3395 |
}
|
3396 |
}
|
3397 |
}
|
@@ -4024,27 +4089,19 @@ class WPvivid {
|
|
4024 |
die();
|
4025 |
}
|
4026 |
|
4027 |
-
public function
|
4028 |
{
|
4029 |
-
$
|
4030 |
-
//$key=$_POST['key'];
|
4031 |
-
|
4032 |
-
$instance=get_option('wpvivid_instance', '');
|
4033 |
-
|
4034 |
-
$server=new WPvivid_Connect_server($email,$instance);
|
4035 |
|
4036 |
-
if($
|
4037 |
{
|
4038 |
-
$
|
4039 |
-
$
|
4040 |
-
|
4041 |
-
|
4042 |
-
|
4043 |
-
|
4044 |
-
{
|
4045 |
-
$res['result']='failed';
|
4046 |
-
echo json_encode($res);
|
4047 |
-
die();
|
4048 |
}
|
|
|
4049 |
}
|
4050 |
}
|
41 |
|
42 |
public $current_task;
|
43 |
|
44 |
+
public $updater;
|
45 |
+
|
46 |
public function __construct()
|
47 |
{
|
48 |
+
$this->version = WPVIVID_PLUGIN_VERSION;
|
49 |
+
|
50 |
+
$this->plugin_name = WPVIVID_PLUGIN_SLUG;
|
|
|
|
|
|
|
|
|
51 |
|
52 |
//Load dependent files
|
53 |
$this->load_dependencies();
|
93 |
|
94 |
private function load_dependencies()
|
95 |
{
|
96 |
+
|
97 |
+
if(!class_exists('WPvivid_Schedule'))
|
98 |
+
{
|
99 |
+
include_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wpvivid-schedule.php';
|
100 |
+
}
|
101 |
+
|
102 |
require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wpvivid-i18n.php';
|
103 |
require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wpvivid-admin.php';
|
104 |
|
108 |
include_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wpvivid-backuplist.php';
|
109 |
include_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wpvivid-restore-data.php';
|
110 |
include_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wpvivid-taskmanager.php';
|
111 |
+
|
112 |
include_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wpvivid-downloader.php';
|
113 |
include_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wpvivid-backup.php';
|
114 |
include_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wpvivid-mail-report.php';
|
115 |
include_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wpvivid-restore.php';
|
116 |
+
//include_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/customclass/class-wpvivid-remote-default.php';
|
117 |
include_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wpvivid-backuptoremote.php';
|
118 |
}
|
119 |
|
250 |
add_action('wp_ajax_wpvivid_set_default_remote_storage',array( $this,'set_default_remote_storage'));
|
251 |
//Get default remote storage when backing up
|
252 |
add_action('wp_ajax_wpvivid_get_default_remote_storage',array( $this,'get_default_remote_storage'));
|
253 |
+
//
|
254 |
+
add_action('wp_ajax_wpvivid_need_review',array( $this,'need_review'));
|
255 |
}
|
256 |
|
257 |
public function get_plugin_name()
|
264 |
return $this->version;
|
265 |
}
|
266 |
|
267 |
+
public function check_backup_options_valid($backup_options)
|
268 |
+
{
|
269 |
+
if (!isset($backup_options['backup_files']) || !isset($backup_options['local'])||!isset($backup_options['remote']) || !isset($backup_options['ismerge'])||!isset($backup_options['lock']))
|
270 |
+
{
|
271 |
+
return false;
|
272 |
+
}
|
273 |
+
|
274 |
+
if(!is_string($backup_options['backup_files'])||!is_string($backup_options['local'])||!is_string($backup_options['remote'])||!is_string($backup_options['ismerge'])||!is_string($backup_options['lock']))
|
275 |
+
{
|
276 |
+
return false;
|
277 |
+
}
|
278 |
+
|
279 |
+
$backup_type= array('files+db','files', 'db');
|
280 |
+
if(!in_array($backup_options['backup_files'],$backup_type))
|
281 |
+
{
|
282 |
+
return false;
|
283 |
+
}
|
284 |
+
|
285 |
+
if($backup_options['remote']=='1')
|
286 |
+
{
|
287 |
+
if (!isset($backup_options['remote_options']))
|
288 |
+
{
|
289 |
+
return false;
|
290 |
+
}
|
291 |
+
$remote_ids=$backup_options['remote_options'];
|
292 |
+
$remote_ids =stripslashes($remote_ids);
|
293 |
+
$remotes=json_decode($remote_ids,true);
|
294 |
+
if(is_null($remotes))
|
295 |
+
{
|
296 |
+
return false;
|
297 |
+
}
|
298 |
+
if(WPvivid_Setting::get_remote_options($remotes)===false)
|
299 |
+
{
|
300 |
+
return false;
|
301 |
+
}
|
302 |
+
}
|
303 |
+
|
304 |
+
return $backup_options;
|
305 |
+
}
|
306 |
/**
|
307 |
* Prepare backup include what you want to backup,where you want to store.
|
308 |
*
|
313 |
public function prepare_backup()
|
314 |
{
|
315 |
$this->ajax_check_security();
|
316 |
+
|
317 |
+
$backup_options=$_POST;
|
318 |
+
|
319 |
+
add_filter('wpvivid_check_backup_options_valid',array($this,'check_backup_options_valid'),10);
|
320 |
+
$backup_options=apply_filters('wpvivid_check_backup_options_valid',$backup_options);
|
321 |
+
|
322 |
+
if($backup_options===false)
|
323 |
{
|
324 |
$ret['result']='failed';
|
325 |
$ret['error']=__('Error occurred while parsing the request data. Please try to run backup again.', 'wpvivid');
|
327 |
die();
|
328 |
}
|
329 |
|
330 |
+
$ret=$this->pre_backup($backup_options,'Manual');
|
331 |
+
if($ret['result']=='success')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
332 |
{
|
333 |
+
//Check the website data to be backed up
|
334 |
+
$ret['check']=$this->check_backup($ret['task_id'],$backup_options['backup_files']);
|
|
|
|
|
|
|
|
|
|
|
335 |
}
|
336 |
+
echo json_encode($ret);
|
337 |
|
338 |
die();
|
339 |
}
|
576 |
die();
|
577 |
}
|
578 |
//Initialization backup task.
|
579 |
+
add_filter('wpvivid_check_backup_options_valid',array($this,'check_backup_options_valid'),10);
|
580 |
+
$schedule_options['backup']=apply_filters('wpvivid_check_backup_options_valid',$schedule_options['backup']);
|
581 |
+
|
582 |
+
if($schedule_options['backup']===false)
|
583 |
+
{
|
584 |
+
die();
|
585 |
+
}
|
586 |
+
|
587 |
$ret=$this->pre_backup($schedule_options['backup'],'Cron');
|
588 |
if($ret['result']=='success')
|
589 |
{
|
621 |
$this->backup($task_id);
|
622 |
die();
|
623 |
}
|
624 |
+
|
625 |
/**
|
626 |
* Clean backing up data schedule.
|
627 |
*
|
770 |
*
|
771 |
* @since 0.9.1
|
772 |
*/
|
773 |
+
public function pre_backup($backup_options,$type)
|
774 |
{
|
775 |
$this->clean_oldest_backup();
|
776 |
|
781 |
return $ret;
|
782 |
}
|
783 |
|
784 |
+
add_filter('wpvivid_set_backup_task_options',array($this,'set_backup_task_options'),10);
|
785 |
+
$task_options=apply_filters('wpvivid_set_backup_task_options',$backup_options);
|
786 |
+
|
787 |
+
return WPvivid_taskmanager::new_backup_task($task_options,$type);
|
788 |
+
}
|
789 |
+
public function set_backup_task_options($backup_options)
|
790 |
+
{
|
791 |
$task_options['backup_options']=WPvivid_Setting::get_backup_options($backup_options['backup_files']);
|
792 |
if($backup_options['ismerge']=='1')
|
793 |
{
|
810 |
|
811 |
if($backup_options['remote']=='1')
|
812 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
813 |
$remote_ids=$backup_options['remote_options'];
|
814 |
$remote_ids =stripslashes($remote_ids);
|
815 |
$remotes=json_decode($remote_ids,true);
|
|
|
|
|
|
|
|
|
816 |
$task_options['remote_options']=WPvivid_Setting::get_remote_options($remotes);
|
817 |
WPvivid_Setting::update_user_history('remote_selected',$remotes);
|
|
|
|
|
|
|
|
|
|
|
|
|
818 |
}
|
819 |
else {
|
820 |
$task_options['remote_options']=false;
|
830 |
$task_options['save_local']=0;
|
831 |
}
|
832 |
|
833 |
+
$task_options['lock']=$backup_options['lock'];
|
834 |
+
return $task_options;
|
|
|
835 |
}
|
836 |
+
|
837 |
/**
|
838 |
* start or resume a backup task.
|
839 |
*
|
857 |
//start backup
|
858 |
try
|
859 |
{
|
860 |
+
$backup_job=WPvivid_taskmanager::get_backup_main_task_progress($task_id,'backup');
|
861 |
+
$backup=new WPvivid_Backup();
|
862 |
+
|
863 |
+
if($backup_job&&$backup_job['finished']==1)
|
864 |
{
|
865 |
+
$backup_ret=$backup_job['job_data'];
|
866 |
}
|
867 |
else
|
868 |
{
|
869 |
+
$backup_ret=$backup->backup($task_id);
|
870 |
+
WPvivid_tools::clearcache($task_id);
|
871 |
+
|
872 |
+
if($backup_ret['result'] != 'succeed')
|
873 |
+
{
|
874 |
+
$this->wpvivid_log->WriteLog('Backup ends with an error '. $backup_ret['error'], 'error');
|
875 |
+
}
|
876 |
+
else
|
877 |
+
{
|
878 |
+
$this->wpvivid_log->WriteLog('Backup completed.','notice');
|
879 |
+
}
|
880 |
+
|
881 |
+
if($this->finish_backup_task($task_id,$backup_ret))
|
882 |
+
{
|
883 |
+
$this->update_last_backup_task($task_id);
|
884 |
+
}
|
885 |
+
else
|
886 |
{
|
887 |
+
$this->update_last_backup_task($task_id);
|
888 |
+
die();
|
889 |
}
|
890 |
}
|
891 |
+
//backup task finish.
|
892 |
+
|
893 |
+
$this->check_cancel_backup($task_id);
|
894 |
+
if(WPvivid_taskmanager::get_task_options($task_id,'remote_options')!=false)
|
895 |
+
{
|
896 |
+
//start upload files to remote
|
897 |
+
$this->upload_start($task_id,$backup_ret);
|
898 |
+
$this->finish_upload_task($task_id);
|
899 |
+
}
|
900 |
}
|
901 |
catch (Exception $e)
|
902 |
{
|
912 |
$this->wpvivid_log->CloseFile();
|
913 |
die();
|
914 |
}
|
915 |
+
|
916 |
+
die();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
917 |
}
|
918 |
/**
|
919 |
* start backup file and db.
|
936 |
else
|
937 |
{
|
938 |
//Initialization backup option
|
939 |
+
//$type=$backup->init_options($task_id,$this->wpvivid_log);
|
940 |
//start backup
|
941 |
+
$backup_ret=$backup->backup($task_id);
|
942 |
}
|
943 |
//clean temp file
|
944 |
WPvivid_tools::clearcache($task_id);
|
1009 |
$backup_data['manual_delete']=0;
|
1010 |
|
1011 |
$backup_options=WPvivid_taskmanager::get_task_options($task_id,'backup_options');
|
|
|
|
|
1012 |
$lock=WPvivid_taskmanager::get_task_options($task_id,'lock');
|
1013 |
$backup_data['local']['path']=$backup_options['dir'];
|
1014 |
$backup_data['compress']['compress_type']=$backup_options['compress']['compress_type'];
|
1017 |
$backup_data['remote']=array();
|
1018 |
if($lock==1)
|
1019 |
$backup_data['lock']=1;
|
1020 |
+
$this->wpvivid_log->WriteLog('Backup succeeded.','notice');
|
1021 |
+
WPvivid_Backuplist::add_new_backup($task_id,$backup_data);
|
1022 |
+
|
1023 |
+
$need_review=get_option('wpvivid_need_review','not');
|
1024 |
+
if($need_review=='not')
|
1025 |
{
|
1026 |
+
update_option('wpvivid_need_review','show');
|
|
|
|
|
|
|
|
|
|
|
1027 |
}
|
1028 |
|
1029 |
+
WPvivid_mail_report::send_report_mail($task_id);
|
1030 |
+
|
1031 |
+
$remote_options=WPvivid_taskmanager::get_task_options($task_id,'remote_options');
|
1032 |
+
if($remote_options===false)
|
1033 |
+
{
|
1034 |
+
WPvivid_taskmanager::update_backup_task_status($task_id,false,'completed');
|
1035 |
+
WPvivid_Schedule::clear_monitor_schedule($task_id);
|
1036 |
+
$this->wpvivid_log->CloseFile();
|
1037 |
+
}
|
1038 |
+
return true;
|
1039 |
+
}
|
1040 |
+
else
|
1041 |
+
{
|
1042 |
+
WPvivid_error_log::create_error_log($this->wpvivid_log->log_file);
|
1043 |
+
WPvivid_mail_report::send_report_mail($task_id);
|
1044 |
+
$this->wpvivid_log->CloseFile();
|
1045 |
+
return false;
|
1046 |
+
}
|
1047 |
+
}
|
1048 |
+
private function finish_upload_task($task_id)
|
1049 |
+
{
|
1050 |
+
$status=WPvivid_taskmanager::get_backup_task_status($task_id);
|
1051 |
+
if($status['str']=='running')
|
1052 |
+
{
|
1053 |
+
$save_local=WPvivid_taskmanager::get_task_options($task_id,'save_local');
|
1054 |
if($save_local==0)
|
1055 |
{
|
1056 |
$this->wpvivid_log->WriteLog('Clean up local files after uploading to remote storages.','notice');
|
1059 |
$backup=new WPvivid_Backup();
|
1060 |
$backup->clean_backup($file_prefix,$backup_options['dir']);
|
1061 |
}
|
1062 |
+
$this->wpvivid_log->WriteLog('Upload succeeded.','notice');
|
1063 |
+
|
1064 |
+
$remote_options=WPvivid_taskmanager::get_task_options($task_id,'remote_options');
|
1065 |
+
WPvivid_Backuplist::update_backup($task_id,'remote',$remote_options);
|
1066 |
WPvivid_taskmanager::update_backup_task_status($task_id,false,'completed');
|
1067 |
WPvivid_Schedule::clear_monitor_schedule($task_id);
|
|
|
1068 |
$this->wpvivid_log->CloseFile();
|
1069 |
return true;
|
1070 |
}
|
1435 |
$backup_option=WPvivid_taskmanager::get_task_options($task_id,'backup_options');
|
1436 |
}
|
1437 |
$exclude_size=$backup_option['compress']['exclude_file_size'];
|
1438 |
+
foreach ( $backup_option['backup']['backup_type'] as $type_name=>$data)
|
1439 |
{
|
1440 |
+
$path=false;
|
1441 |
+
$options = WPvivid_Setting::get_option('wpvivid_common_setting');
|
1442 |
+
if(!isset($options['log_save_location']))
|
1443 |
{
|
1444 |
+
WPvivid_Setting::set_default_common_option();
|
1445 |
$options = WPvivid_Setting::get_option('wpvivid_common_setting');
|
1446 |
+
}
|
1447 |
+
$exclude_folder = array(
|
1448 |
+
$backup->get_default_directory(WPVIVID_BACKUP_TYPE_CONTENT).DIRECTORY_SEPARATOR.'updraft',
|
1449 |
+
$backup->get_default_directory(WPVIVID_BACKUP_TYPE_CONTENT).DIRECTORY_SEPARATOR.'upgrade',
|
1450 |
+
$backup->get_default_directory(WPVIVID_BACKUP_TYPE_CONTENT).DIRECTORY_SEPARATOR.WPvivid_Setting::get_backupdir(),
|
1451 |
+
WPVIVID_PLUGIN_DIR,
|
1452 |
+
$backup->get_default_directory(WPVIVID_BACKUP_TYPE_CONTENT).DIRECTORY_SEPARATOR.$options['log_save_location'],
|
1453 |
+
);
|
1454 |
+
switch ($type_name)
|
1455 |
+
{
|
1456 |
+
case WPVIVID_BACKUP_TYPE_PLUGIN:
|
1457 |
+
$path = $backup->get_default_directory(WPVIVID_BACKUP_TYPE_PLUGIN);
|
1458 |
+
break;
|
1459 |
+
case WPVIVID_BACKUP_TYPE_THEMES:
|
1460 |
+
$path = $backup->get_default_directory(WPVIVID_BACKUP_TYPE_THEMES);
|
1461 |
+
break;
|
1462 |
+
case WPVIVID_BACKUP_TYPE_UPLOADS:
|
1463 |
+
$path = $backup->get_default_directory(WPVIVID_BACKUP_TYPE_UPLOADS);
|
1464 |
+
break;
|
1465 |
+
case WPVIVID_BACKUP_TYPE_CONTENT:
|
1466 |
+
$path = $backup -> get_default_directory(WPVIVID_BACKUP_TYPE_CONTENT);
|
1467 |
+
$exclude_folder[] = $backup->get_default_directory(WPVIVID_BACKUP_TYPE_PLUGIN);
|
1468 |
+
$exclude_folder[] = $backup->get_default_directory(WPVIVID_BACKUP_TYPE_THEMES);
|
1469 |
+
$exclude_folder[] = $backup->get_default_directory(WPVIVID_BACKUP_TYPE_UPLOADS);
|
1470 |
+
break;
|
1471 |
+
case WPVIVID_BACKUP_TYPE_CORE:
|
1472 |
+
$path = dirname(WP_CONTENT_DIR);
|
1473 |
+
$exclude_folder[] = $path;
|
1474 |
+
$exclude_folder[] = $backup -> get_default_directory(WPVIVID_BACKUP_TYPE_CONTENT);
|
1475 |
+
break;
|
1476 |
+
default:
|
1477 |
+
break;
|
1478 |
+
}
|
|
|
|
|
|
|
|
|
1479 |
|
1480 |
+
if($path!==false)
|
1481 |
+
{
|
1482 |
+
$this->get_dir_files($files[$type_name],$temp,$path,false,array(),$exclude_folder,$exclude_size);
|
|
|
1483 |
}
|
1484 |
}
|
1485 |
|
3430 |
else if(is_dir($path.DIRECTORY_SEPARATOR.$filename))
|
3431 |
{
|
3432 |
$this->get_dir_files($files ,$folder, $path.DIRECTORY_SEPARATOR.$filename,$except_regex,$exclude_folder);
|
3433 |
+
if($except_regex!==false)
|
3434 |
+
{
|
3435 |
+
if(preg_match($except_regex ,$filename))
|
3436 |
+
{
|
3437 |
+
$folder[]=$path.DIRECTORY_SEPARATOR.$filename;
|
3438 |
+
}
|
3439 |
+
}
|
3440 |
+
else
|
3441 |
{
|
3442 |
$folder[]=$path.DIRECTORY_SEPARATOR.$filename;
|
3443 |
}
|
3444 |
}else {
|
3445 |
+
if($except_regex===false||preg_match($except_regex ,$filename))
|
3446 |
{
|
3447 |
if(in_array($filename,$exclude_files))
|
3448 |
{
|
3457 |
$files[] = $path.DIRECTORY_SEPARATOR.$filename;
|
3458 |
}
|
3459 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3460 |
}
|
3461 |
}
|
3462 |
}
|
4089 |
die();
|
4090 |
}
|
4091 |
|
4092 |
+
public function need_review()
|
4093 |
{
|
4094 |
+
$this->ajax_check_security();
|
|
|
|
|
|
|
|
|
|
|
4095 |
|
4096 |
+
if(isset($_POST['review']))
|
4097 |
{
|
4098 |
+
$review=$_POST['review'];
|
4099 |
+
if($review=='next_time')
|
4100 |
+
{
|
4101 |
+
$review=time()+60;//604800;
|
4102 |
+
}
|
4103 |
+
update_option('wpvivid_need_review',$review);
|
|
|
|
|
|
|
|
|
4104 |
}
|
4105 |
+
die();
|
4106 |
}
|
4107 |
}
|
readme.txt
CHANGED
@@ -1,10 +1,10 @@
|
|
1 |
-
===
|
2 |
Contributors: wpvivid
|
3 |
Tags: backup, cloud backup, restore, database backup, wordpress backup, backups, custom backups, s3, FTP, SFTP
|
4 |
Requires at least: 4.5
|
5 |
Tested up to: 5.0.2
|
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 |
|
@@ -47,15 +47,18 @@ Free and responsive expert support is available to all users via multiple channe
|
|
47 |
* Split the large size files when backing up
|
48 |
* Download backups to your computer
|
49 |
* Set how many backups to be kept in your storage
|
|
|
50 |
* Sweep junk file off your server disk
|
51 |
* Live progress
|
52 |
* Instant email report
|
53 |
* Thorough Log files
|
|
|
54 |
|
55 |
== Minimum Requirements ==
|
56 |
* PHP version 5.3
|
57 |
* MySQL version 4.1
|
58 |
* WordPress 4.5
|
|
|
59 |
|
60 |
== Support ==
|
61 |
We offer responsive and completely free support through 3 channels to ensure your issues get received and resolved in the first time:
|
@@ -135,8 +138,12 @@ Initial release of WPvivid Backup/Restore plugin. Now you see it.
|
|
135 |
= 0.9.2 =
|
136 |
Fixed image path display error.
|
137 |
= 0.9.3 =
|
138 |
-
Fixed some display errors on the user interface.
|
139 |
-
Fixed a bug where backups cannot be completed in exceptional cases.
|
140 |
= 0.9.4 =
|
141 |
-
Added support for responsive design. Now the plugin is compatible with smartphones, tablets and PC.
|
142 |
-
Fixed some UI bugs.
|
|
|
|
|
|
|
|
1 |
+
=== WordPress Backup/Restore by WPvivid ===
|
2 |
Contributors: wpvivid
|
3 |
Tags: backup, cloud backup, restore, database backup, wordpress backup, backups, custom backups, s3, FTP, SFTP
|
4 |
Requires at least: 4.5
|
5 |
Tested up to: 5.0.2
|
6 |
Requires PHP: 5.3
|
7 |
+
Stable tag: 0.9.5
|
8 |
License: GPLv3 or later
|
9 |
License URI: https://www.gnu.org/licenses/gpl-3.0.en.html
|
10 |
|
47 |
* Split the large size files when backing up
|
48 |
* Download backups to your computer
|
49 |
* Set how many backups to be kept in your storage
|
50 |
+
* Lock backups to avoid being deleted automatically
|
51 |
* Sweep junk file off your server disk
|
52 |
* Live progress
|
53 |
* Instant email report
|
54 |
* Thorough Log files
|
55 |
+
* Responsive design - compatible with smartphones, tablets, PC
|
56 |
|
57 |
== Minimum Requirements ==
|
58 |
* PHP version 5.3
|
59 |
* MySQL version 4.1
|
60 |
* WordPress 4.5
|
61 |
+
* Character Encoding UTF-8
|
62 |
|
63 |
== Support ==
|
64 |
We offer responsive and completely free support through 3 channels to ensure your issues get received and resolved in the first time:
|
138 |
= 0.9.2 =
|
139 |
Fixed image path display error.
|
140 |
= 0.9.3 =
|
141 |
+
- Fixed some display errors on the user interface.
|
142 |
+
- Fixed a bug where backups cannot be completed in exceptional cases.
|
143 |
= 0.9.4 =
|
144 |
+
- Added support for responsive design. Now the plugin is compatible with smartphones, tablets and PC.
|
145 |
+
- Fixed some UI bugs.
|
146 |
+
= 0.9.5 =
|
147 |
+
- Refined descriptions on the user interface.
|
148 |
+
- Fixed a few interface errors.
|
149 |
+
- Fixed a bug where backup is runnable in some cases during the process of a restoration.
|
wpvivid-backuprestore.php
CHANGED
@@ -7,7 +7,7 @@
|
|
7 |
* @wordpress-plugin
|
8 |
* Plugin Name: WPvivid - Backup/Restore
|
9 |
* Description: Free, simple and easy to use backup plugin for WordPress. Create manual and scheduled backups. Back up to Amazon S3, FTP and SFTP. Restore with one click.
|
10 |
-
* Version: 0.9.
|
11 |
* Author: wpvivid.com
|
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');
|
@@ -32,7 +32,9 @@ define('WPVIVID_RESTORE_WAIT','wait');
|
|
32 |
define('WPVIVID_RESTORE_TIMEOUT',180);
|
33 |
define('WPVIVID_ROLLBACK_TIMEOUT',180);
|
34 |
|
35 |
-
define('
|
|
|
|
|
36 |
define('WPVIVID_PLUGIN_DIR',dirname(__FILE__));
|
37 |
//We set a long enough default execution time (10 min) to ensure that the backup process can be completed.
|
38 |
define('WPVIVID_MAX_EXECUTION_TIME',600);
|
@@ -43,13 +45,13 @@ define('WPVIVID_MAX_BACKUP_COUNT',7);
|
|
43 |
define('WPVIVID_DEFAULT_BACKUP_COUNT',3);
|
44 |
define('WPVIVID_DEFAULT_COMPRESS_TYPE','zip');
|
45 |
//Max zip file size.
|
46 |
-
define('WPVIVID_DEFAULT_MAX_FILE_SIZE',
|
47 |
//Instruct PclZip to use all the time temporary files to create the zip archive or not.The default value is 1.
|
48 |
define('WPVIVID_DEFAULT_USE_TEMP',1);
|
49 |
//Instruct PclZip to use temporary files for files with size greater than.The default value is 16M.
|
50 |
define('WPVIVID_DEFAULT_USE_TEMP_SIZE',16);
|
51 |
//Exclude the files which is larger than.The default value is 0 means unlimited.
|
52 |
-
define('WPVIVID_DEFAULT_EXCLUDE_FILE_SIZE',
|
53 |
//Add a file in an archive without compressing the file.The default value is 200.
|
54 |
define('WPVIVID_DEFAULT_NO_COMPRESS',true);
|
55 |
//Backup save folder under WP_CONTENT_DIR
|
@@ -63,15 +65,7 @@ define('WPVIVID_DEFAULT_ADMIN_BAR', true);
|
|
63 |
//
|
64 |
define('WPVIVID_DEFAULT_ESTIMATE_BACKUP', true);
|
65 |
//Specify the folder and database to be backed up
|
66 |
-
|
67 |
-
define('WPVIVID_BACKUP_TYPE_OPTIONS','backup_options');
|
68 |
-
define('WPVIVID_BACKUP_TYPE_THEMES','backup_themes');
|
69 |
-
define('WPVIVID_BACKUP_TYPE_PLUGIN','backup_plugin');
|
70 |
-
define('WPVIVID_BACKUP_TYPE_UPLOADS','backup_uploads');
|
71 |
-
define('WPVIVID_BACKUP_TYPE_CONTENT','backup_content');
|
72 |
-
define('WPVIVID_BACKUP_TYPE_CORE','backup_core');
|
73 |
-
define('WPVIVID_BACKUP_TYPE_OTHERS','backup_others');
|
74 |
-
define('WPVIVID_BACKUP_TYPE_MERGE','backup_merge');
|
75 |
//remote storage
|
76 |
define('WPVIVID_REMOTE_SFTP','sftp');
|
77 |
define('WPVIVID_REMOTE_FTP','ftp');
|
@@ -95,8 +89,6 @@ define('WPVIVID_PACK_SIZE',1 << 20);
|
|
95 |
* The core plugin class that is used to define internationalization,
|
96 |
* admin-specific hooks, and public-facing site hooks.
|
97 |
*/
|
98 |
-
require plugin_dir_path( __FILE__ ) . 'includes/class-wpvivid.php';
|
99 |
-
|
100 |
//when active plugin redirect plugin page.
|
101 |
|
102 |
function wpvivid_plugin_activate()
|
@@ -113,7 +105,6 @@ function wpvivid_init_plugin_redirect() {
|
|
113 |
register_activation_hook(__FILE__, 'wpvivid_plugin_activate');
|
114 |
add_action('admin_init', 'wpvivid_init_plugin_redirect');
|
115 |
|
116 |
-
|
117 |
/**
|
118 |
* Begins execution of the plugin.
|
119 |
*
|
@@ -128,6 +119,8 @@ if(isset($wpvivid_pulgin)&&is_a($wpvivid_pulgin,'WPvivid'))
|
|
128 |
return ;
|
129 |
}
|
130 |
|
|
|
|
|
131 |
function run_wpvivid()
|
132 |
{
|
133 |
$wpvivid_pulgin = new WPvivid();
|
7 |
* @wordpress-plugin
|
8 |
* Plugin Name: WPvivid - Backup/Restore
|
9 |
* Description: Free, simple and easy to use backup plugin for WordPress. Create manual and scheduled backups. Back up to Amazon S3, FTP and SFTP. Restore with one click.
|
10 |
+
* Version: 0.9.5
|
11 |
* Author: wpvivid.com
|
12 |
* Author URI: https://wpvivid.com
|
13 |
* License: GPL-3.0+
|
21 |
die;
|
22 |
}
|
23 |
|
24 |
+
define( 'WPVIVID_PLUGIN_VERSION', '0.9.5' );
|
25 |
//
|
26 |
define('WPVIVID_RESTORE_INIT','init');
|
27 |
define('WPVIVID_RESTORE_READY','ready');
|
32 |
define('WPVIVID_RESTORE_TIMEOUT',180);
|
33 |
define('WPVIVID_ROLLBACK_TIMEOUT',180);
|
34 |
|
35 |
+
define('WPVIVID_PLUGIN_SLUG','WPvivid');
|
36 |
+
define('WPVIVID_PLUGIN_NAME',plugin_basename(__FILE__));
|
37 |
+
define('WPVIVID_PLUGIN_URL',plugins_url('',__FILE__));
|
38 |
define('WPVIVID_PLUGIN_DIR',dirname(__FILE__));
|
39 |
//We set a long enough default execution time (10 min) to ensure that the backup process can be completed.
|
40 |
define('WPVIVID_MAX_EXECUTION_TIME',600);
|
45 |
define('WPVIVID_DEFAULT_BACKUP_COUNT',3);
|
46 |
define('WPVIVID_DEFAULT_COMPRESS_TYPE','zip');
|
47 |
//Max zip file size.
|
48 |
+
define('WPVIVID_DEFAULT_MAX_FILE_SIZE',400);
|
49 |
//Instruct PclZip to use all the time temporary files to create the zip archive or not.The default value is 1.
|
50 |
define('WPVIVID_DEFAULT_USE_TEMP',1);
|
51 |
//Instruct PclZip to use temporary files for files with size greater than.The default value is 16M.
|
52 |
define('WPVIVID_DEFAULT_USE_TEMP_SIZE',16);
|
53 |
//Exclude the files which is larger than.The default value is 0 means unlimited.
|
54 |
+
define('WPVIVID_DEFAULT_EXCLUDE_FILE_SIZE',400);
|
55 |
//Add a file in an archive without compressing the file.The default value is 200.
|
56 |
define('WPVIVID_DEFAULT_NO_COMPRESS',true);
|
57 |
//Backup save folder under WP_CONTENT_DIR
|
65 |
//
|
66 |
define('WPVIVID_DEFAULT_ESTIMATE_BACKUP', true);
|
67 |
//Specify the folder and database to be backed up
|
68 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
69 |
//remote storage
|
70 |
define('WPVIVID_REMOTE_SFTP','sftp');
|
71 |
define('WPVIVID_REMOTE_FTP','ftp');
|
89 |
* The core plugin class that is used to define internationalization,
|
90 |
* admin-specific hooks, and public-facing site hooks.
|
91 |
*/
|
|
|
|
|
92 |
//when active plugin redirect plugin page.
|
93 |
|
94 |
function wpvivid_plugin_activate()
|
105 |
register_activation_hook(__FILE__, 'wpvivid_plugin_activate');
|
106 |
add_action('admin_init', 'wpvivid_init_plugin_redirect');
|
107 |
|
|
|
108 |
/**
|
109 |
* Begins execution of the plugin.
|
110 |
*
|
119 |
return ;
|
120 |
}
|
121 |
|
122 |
+
require plugin_dir_path( __FILE__ ) . 'includes/class-wpvivid.php';
|
123 |
+
|
124 |
function run_wpvivid()
|
125 |
{
|
126 |
$wpvivid_pulgin = new WPvivid();
|