Version Description
- Optimized migration process, improved compatibility for migration. Old keys will be expired after you update to the new version.
- Added an option to retry the backup operation when encountering a timeout error.
- Added an option to hide settings in admin menu.
- Changed the plugin icon showing in admin menu.
- Included more info in the error log when sending to support.
- Improved compatibility with few hostings like GoDaddy.
- Optimized the cache directory in backup process.
- Fixed errors occurred in some cases during the authentication process with Google Drive, Dropbox, Microsoft OneDrive.
- Optimized plugin code.
Download this release
Release Info
Developer | wpvivid |
Plugin | Migration, Backup, Staging – WPvivid |
Version | 0.9.18 |
Comparing to | |
See all releases |
Code changes from version 0.9.17 to 0.9.18
- admin/class-wpvivid-admin.php +56 -37
- admin/css/wpvivid-admin.css +23 -23
- admin/js/wpvivid-admin.js +1 -2
- admin/partials/wpvivid-backup-restore-page-display.php +1 -1
- admin/partials/wpvivid-schedule-page-display.php +0 -1
- admin/partials/wpvivid-settings-page-display.php +56 -2
- admin/partials/wpvivid-website-info-page-display.php +34 -2
- includes/class-wpvivid-backup-database.php +6 -2
- includes/class-wpvivid-backup-uploader.php +40 -25
- includes/class-wpvivid-backup.php +35 -7
- includes/class-wpvivid-crypt.php +1 -1
- includes/class-wpvivid-error-log.php +20 -0
- includes/class-wpvivid-log.php +17 -1
- includes/class-wpvivid-migrate.php +7 -5
- includes/class-wpvivid-mysqldump.php +37 -0
- includes/class-wpvivid-remote-collection.php +12 -0
- includes/class-wpvivid-restore-data.php +16 -0
- includes/class-wpvivid-restore-database.php +0 -1
- includes/class-wpvivid-setting.php +18 -0
- includes/class-wpvivid-tools.php +5 -1
- includes/class-wpvivid.php +251 -103
- includes/customclass/class-wpvivid-dropbox.php +13 -7
- includes/customclass/class-wpvivid-google-drive.php +17 -7
- includes/customclass/class-wpvivid-one-drive.php +26 -14
- includes/customclass/class-wpvivid-send-to-site.php +61 -33
- readme.txt +11 -1
- wpvivid-backuprestore.php +5 -3
admin/class-wpvivid-admin.php
CHANGED
@@ -77,13 +77,13 @@ class WPvivid_Admin {
|
|
77 |
* class.
|
78 |
*/
|
79 |
if ('toplevel_page_'.$this->plugin_name == get_current_screen()->id ||
|
80 |
-
'
|
81 |
-
'
|
82 |
-
'
|
83 |
-
'
|
84 |
-
'
|
85 |
-
'
|
86 |
-
'
|
87 |
wp_enqueue_style($this->plugin_name, plugin_dir_url(__FILE__) . 'css/wpvivid-admin.css', array(), $this->version, 'all');
|
88 |
}
|
89 |
}
|
@@ -107,13 +107,13 @@ class WPvivid_Admin {
|
|
107 |
* class.
|
108 |
*/
|
109 |
if ('toplevel_page_'.$this->plugin_name == get_current_screen()->id ||
|
110 |
-
'
|
111 |
-
'
|
112 |
-
'
|
113 |
-
'
|
114 |
-
'
|
115 |
-
'
|
116 |
-
'
|
117 |
wp_enqueue_script($this->plugin_name, plugin_dir_url(__FILE__) . 'js/wpvivid-admin.js', array('jquery'), $this->version, false);
|
118 |
wp_localize_script($this->plugin_name, 'ajax_object', array('ajax_url' => admin_url('admin-ajax.php')));
|
119 |
|
@@ -136,15 +136,28 @@ class WPvivid_Admin {
|
|
136 |
* Administration Menus: http://codex.wordpress.org/Administration_Menus
|
137 |
*
|
138 |
*/
|
139 |
-
add_menu_page(__('WPvivid'), __('WPvivid'), 'administrator', $this->plugin_name, array($this, 'display_plugin_backup_page'),
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
148 |
}
|
149 |
|
150 |
function add_toolbar_items($wp_admin_bar){
|
@@ -154,38 +167,38 @@ class WPvivid_Admin {
|
|
154 |
$admin_url = admin_url();
|
155 |
$wp_admin_bar->add_menu(array(
|
156 |
'id' => 'wpvivid_admin_menu',
|
157 |
-
'title' => 'WPvivid'
|
158 |
));
|
159 |
$wp_admin_bar->add_menu(array(
|
160 |
'id' => 'wpvivid_admin_menu_backup',
|
161 |
'parent' => 'wpvivid_admin_menu',
|
162 |
-
'title' => 'Backup
|
163 |
'href' => $admin_url . 'admin.php?page=WPvivid&tab-backup'
|
164 |
));
|
165 |
-
$wp_admin_bar->add_menu(array(
|
166 |
-
'id' => 'wpvivid_admin_menu_transfer',
|
167 |
-
'parent' => 'wpvivid_admin_menu',
|
168 |
-
'title' => 'Auto-Migration',
|
169 |
-
'href' => $admin_url . 'admin.php?page=WPvivid&tab-transfer'
|
170 |
-
));
|
171 |
-
$wp_admin_bar->add_menu(array(
|
172 |
-
'id' => 'wpvivid_admin_menu_settings',
|
173 |
-
'parent' => 'wpvivid_admin_menu',
|
174 |
-
'title' => 'Settings',
|
175 |
-
'href' => $admin_url . 'admin.php?page=WPvivid&tab-settings'
|
176 |
-
));
|
177 |
$wp_admin_bar->add_menu(array(
|
178 |
'id' => 'wpvivid_admin_menu_schedule',
|
179 |
'parent' => 'wpvivid_admin_menu',
|
180 |
'title' => 'Schedule',
|
181 |
'href' => $admin_url . 'admin.php?page=WPvivid&tab-schedule'
|
182 |
));
|
|
|
|
|
|
|
|
|
|
|
|
|
183 |
$wp_admin_bar->add_menu(array(
|
184 |
'id' => 'wpvivid_admin_menu_addons',
|
185 |
'parent' => 'wpvivid_admin_menu',
|
186 |
'title' => 'Remote Storage',
|
187 |
'href' => $admin_url . 'admin.php?page=WPvivid&tab-remote-storage'
|
188 |
));
|
|
|
|
|
|
|
|
|
|
|
|
|
189 |
$wp_admin_bar->add_menu(array(
|
190 |
'id' => 'wpvivid_admin_menu_debug',
|
191 |
'parent' => 'wpvivid_admin_menu',
|
@@ -382,6 +395,7 @@ class WPvivid_Admin {
|
|
382 |
public static function wpvivid_check_extensions(){
|
383 |
$need_php_extensions = array();
|
384 |
$need_extensions_count = 0;
|
|
|
385 |
if(!function_exists("curl_init")){
|
386 |
$need_php_extensions[$need_extensions_count] = 'curl';
|
387 |
$need_extensions_count++;
|
@@ -394,6 +408,11 @@ class WPvivid_Admin {
|
|
394 |
$need_php_extensions[$need_extensions_count] = 'zlib';
|
395 |
$need_extensions_count++;
|
396 |
}
|
|
|
|
|
|
|
|
|
|
|
397 |
if(!empty($need_php_extensions)){
|
398 |
$msg = '';
|
399 |
$figure = 0;
|
77 |
* class.
|
78 |
*/
|
79 |
if ('toplevel_page_'.$this->plugin_name == get_current_screen()->id ||
|
80 |
+
'wpvivid-backup_page_wpvivid-transfer' == get_current_screen()->id ||
|
81 |
+
'wpvivid-backup_page_wpvivid-setting' == get_current_screen()->id ||
|
82 |
+
'wpvivid-backup_page_wpvivid-schedule' == get_current_screen()->id ||
|
83 |
+
'wpvivid-backup_page_wpvivid-remote' == get_current_screen()->id ||
|
84 |
+
'wpvivid-backup_page_wpvivid-website' == get_current_screen()->id ||
|
85 |
+
'wpvivid-backup_page_wpvivid-log' == get_current_screen()->id ||
|
86 |
+
'wpvivid-backup_page_wpvivid-key' == get_current_screen()->id) {
|
87 |
wp_enqueue_style($this->plugin_name, plugin_dir_url(__FILE__) . 'css/wpvivid-admin.css', array(), $this->version, 'all');
|
88 |
}
|
89 |
}
|
107 |
* class.
|
108 |
*/
|
109 |
if ('toplevel_page_'.$this->plugin_name == get_current_screen()->id ||
|
110 |
+
'wpvivid-backup_page_wpvivid-transfer' == get_current_screen()->id ||
|
111 |
+
'wpvivid-backup_page_wpvivid-setting' == get_current_screen()->id ||
|
112 |
+
'wpvivid-backup_page_wpvivid-schedule' == get_current_screen()->id ||
|
113 |
+
'wpvivid-backup_page_wpvivid-remote' == get_current_screen()->id ||
|
114 |
+
'wpvivid-backup_page_wpvivid-website' == get_current_screen()->id ||
|
115 |
+
'wpvivid-backup_page_wpvivid-log' == get_current_screen()->id ||
|
116 |
+
'wpvivid-backup_page_wpvivid-key' == get_current_screen()->id) {
|
117 |
wp_enqueue_script($this->plugin_name, plugin_dir_url(__FILE__) . 'js/wpvivid-admin.js', array('jquery'), $this->version, false);
|
118 |
wp_localize_script($this->plugin_name, 'ajax_object', array('ajax_url' => admin_url('admin-ajax.php')));
|
119 |
|
136 |
* Administration Menus: http://codex.wordpress.org/Administration_Menus
|
137 |
*
|
138 |
*/
|
139 |
+
add_menu_page(__('WPvivid Backup'), __('WPvivid Backup'), 'administrator', $this->plugin_name, array($this, 'display_plugin_backup_page'), 'dashicons-cloud', 100);
|
140 |
+
$general_setting=WPvivid_Setting::get_setting(true, "");
|
141 |
+
if(!isset($general_setting['options']['wpvivid_common_setting']['show_tab_menu'])){
|
142 |
+
$wpvivid_show_tab_menu=true;
|
143 |
+
}
|
144 |
+
else {
|
145 |
+
if ($general_setting['options']['wpvivid_common_setting']['show_tab_menu']) {
|
146 |
+
$wpvivid_show_tab_menu=true;
|
147 |
+
} else {
|
148 |
+
$wpvivid_show_tab_menu=false;
|
149 |
+
}
|
150 |
+
}
|
151 |
+
if($wpvivid_show_tab_menu) {
|
152 |
+
add_submenu_page($this->plugin_name, __('WPvivid Backup'), __('Backup & Restore', 'wpvivid'), 'administrator', $this->plugin_name, array($this, 'display_plugin_backup_page'), false, 100);
|
153 |
+
add_submenu_page($this->plugin_name, __('WPvivid Backup'), __('Schedule', 'wpvivid'), 'administrator', 'wpvivid-schedule', array($this, 'display_plugin_schedule_page'), false, 100);
|
154 |
+
add_submenu_page($this->plugin_name, __('WPvivid Backup'), __('Auto-Migration', 'wpvivid'), 'administrator', 'wpvivid-transfer', array($this, 'display_plugin_transfer_page'), false, 100);
|
155 |
+
add_submenu_page($this->plugin_name, __('WPvivid Backup'), __('Remote Storage', 'wpvivid'), 'administrator', 'wpvivid-remote', array($this, 'display_plugin_remote_page'), false, 100);
|
156 |
+
add_submenu_page($this->plugin_name, __('WPvivid Backup'), __('Settings', 'wpvivid'), 'administrator', 'wpvivid-setting', array($this, 'display_plugin_setting_page'), false, 100);
|
157 |
+
add_submenu_page($this->plugin_name, __('WPvivid Backup'), __('Website Info', 'wpvivid'), 'administrator', 'wpvivid-website', array($this, 'display_plugin_website_page'), false, 100);
|
158 |
+
add_submenu_page($this->plugin_name, __('WPvivid Backup'), __('Logs', 'wpvivid'), 'administrator', 'wpvivid-log', array($this, 'display_plugin_log_page'), false, 100);
|
159 |
+
add_submenu_page($this->plugin_name, __('WPvivid Backup'), __('Key', 'wpvivid'), 'administrator', 'wpvivid-key', array($this, 'display_plugin_key_page'), false, 100);
|
160 |
+
}
|
161 |
}
|
162 |
|
163 |
function add_toolbar_items($wp_admin_bar){
|
167 |
$admin_url = admin_url();
|
168 |
$wp_admin_bar->add_menu(array(
|
169 |
'id' => 'wpvivid_admin_menu',
|
170 |
+
'title' => 'WPvivid Backup'
|
171 |
));
|
172 |
$wp_admin_bar->add_menu(array(
|
173 |
'id' => 'wpvivid_admin_menu_backup',
|
174 |
'parent' => 'wpvivid_admin_menu',
|
175 |
+
'title' => 'Backup & Restore',
|
176 |
'href' => $admin_url . 'admin.php?page=WPvivid&tab-backup'
|
177 |
));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
178 |
$wp_admin_bar->add_menu(array(
|
179 |
'id' => 'wpvivid_admin_menu_schedule',
|
180 |
'parent' => 'wpvivid_admin_menu',
|
181 |
'title' => 'Schedule',
|
182 |
'href' => $admin_url . 'admin.php?page=WPvivid&tab-schedule'
|
183 |
));
|
184 |
+
$wp_admin_bar->add_menu(array(
|
185 |
+
'id' => 'wpvivid_admin_menu_transfer',
|
186 |
+
'parent' => 'wpvivid_admin_menu',
|
187 |
+
'title' => 'Auto-Migration',
|
188 |
+
'href' => $admin_url . 'admin.php?page=WPvivid&tab-transfer'
|
189 |
+
));
|
190 |
$wp_admin_bar->add_menu(array(
|
191 |
'id' => 'wpvivid_admin_menu_addons',
|
192 |
'parent' => 'wpvivid_admin_menu',
|
193 |
'title' => 'Remote Storage',
|
194 |
'href' => $admin_url . 'admin.php?page=WPvivid&tab-remote-storage'
|
195 |
));
|
196 |
+
$wp_admin_bar->add_menu(array(
|
197 |
+
'id' => 'wpvivid_admin_menu_settings',
|
198 |
+
'parent' => 'wpvivid_admin_menu',
|
199 |
+
'title' => 'Settings',
|
200 |
+
'href' => $admin_url . 'admin.php?page=WPvivid&tab-settings'
|
201 |
+
));
|
202 |
$wp_admin_bar->add_menu(array(
|
203 |
'id' => 'wpvivid_admin_menu_debug',
|
204 |
'parent' => 'wpvivid_admin_menu',
|
395 |
public static function wpvivid_check_extensions(){
|
396 |
$need_php_extensions = array();
|
397 |
$need_extensions_count = 0;
|
398 |
+
$extensions=get_loaded_extensions();
|
399 |
if(!function_exists("curl_init")){
|
400 |
$need_php_extensions[$need_extensions_count] = 'curl';
|
401 |
$need_extensions_count++;
|
408 |
$need_php_extensions[$need_extensions_count] = 'zlib';
|
409 |
$need_extensions_count++;
|
410 |
}
|
411 |
+
if(!array_search('pdo_mysql',$extensions))
|
412 |
+
{
|
413 |
+
$need_php_extensions[$need_extensions_count] = 'pdo_mysql';
|
414 |
+
$need_extensions_count++;
|
415 |
+
}
|
416 |
if(!empty($need_php_extensions)){
|
417 |
$msg = '';
|
418 |
$figure = 0;
|
admin/css/wpvivid-admin.css
CHANGED
@@ -2,36 +2,36 @@
|
|
2 |
* All of the CSS for your admin-specific functionality should be
|
3 |
* included in this file.
|
4 |
*/
|
5 |
-
|
6 |
.list-top-chip{float:left;display:block; vertical-align:middle; }
|
7 |
.list-top-chip::after{content:" "}
|
8 |
.backup-basic-info{min-width:100px; margin:10px; float:left;}
|
9 |
-
|
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; }
|
14 |
-
|
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 |
-
|
19 |
-
|
20 |
.schedule-block{float:left;width:100%;padding:0 10px 10px 10px;box-sizing:border-box;}
|
21 |
.postbox:after{content: ".";display: block;height: 0;clear: both;visibility: hidden;}
|
22 |
.quickbackup-block .fieldset label{margin-bottom:5px;}
|
23 |
.custom-info{padding:10px;}
|
24 |
.quickstart-storage-setting{width:100%;float:left; padding-left:10px; box-sizing:border-box;background-color:#f1f1f1; margin-bottom:10px;}
|
25 |
-
|
26 |
-
.storage-column-right{margin-left:15%; width:auto;height:100%;position:relative;min-width:350px;box-sizing:border-box;}
|
27 |
-
|
28 |
.storage-menu img{margin-right:5px;}
|
29 |
.storage-menu:hover{background-color:#f1f1f1;}
|
30 |
.storage-menu-idle{border-right:1px solid #ccc;}
|
31 |
-
.storage-menu-active{background-color:#fff;color:#000; border-right:none;border-top:1px solid #ccc;border-left:1px solid #ccc;border-bottom:1px solid #ccc;}
|
32 |
-
|
33 |
-
.storage-column-right{margin-left:200px; width:auto;height:100%;position:relative; padding:10px 10px 10px 10px;}
|
34 |
-
|
35 |
.action-progress-bar{background-color:#f1f1f1 !important;margin:10px;color:#000;}
|
36 |
.action-progress-bar-percent{background-color:#0085ba !important;color:#fff;}
|
37 |
.storage-providers{float:left;padding:10px;cursor:pointer;}
|
@@ -39,22 +39,22 @@
|
|
39 |
.storage-providers-active{background-color:#0085ba !important; color:#fff !important;}
|
40 |
.storage-account-block{padding:10px;}
|
41 |
.storage-account-button{margin:10px 10px 10px 0 !important;display:block !important; float:left;}
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
.tr-progress-bar{width:100%;height:2px;background-color:#0085ba;}
|
46 |
.schedule-tab-block{padding:10px;}
|
47 |
.schedule-tab-block input, span{display:line-block; margin-top:10px; margin-bottom:10px;margin-right:10px;}
|
48 |
-
|
49 |
-
.choose-storage-list{width:100%;box-sizing:border-box;}
|
50 |
.setting-page-content{padding-left:20px;}
|
51 |
-
|
52 |
.display-common-content{width:auto;position:relative;margin-top:10px;}
|
53 |
.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;}
|
54 |
-
.wpvivid-common-btn-cancel{width:80px;height:20px;line-height:20px;margin-top:10px;float:right;font-size:12px;}
|
55 |
.backup-log-btn{height:30px;float:left; margin-left:10px; margin-bottom:10px;}
|
56 |
-
|
57 |
-
.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;}
|
58 |
@keyframes rotate { 0% { transform: rotate(0); } 100% { transform: rotate(359.9deg); } }
|
59 |
.wpvivid-backup-storage-list tr:hover,
|
60 |
.wpvivid-websiteinfo-list tr:hover,
|
@@ -78,7 +78,7 @@
|
|
78 |
.remote-storage-amazons3-storage-class input, span,
|
79 |
.remote-storage-amazons3-encryption input, span{display:line-block; margin-top:10px; margin-bottom:10px;margin-right:10px;}
|
80 |
.backup-list-head{}
|
81 |
-
|
82 |
.storage-account-form {padding-top: 1px; padding-bottom: 1px;}
|
83 |
|
84 |
.quicktransfer{width:100%; float:left; box-sizing:border-box;margin-right:10px; padding:10px;}
|
2 |
* All of the CSS for your admin-specific functionality should be
|
3 |
* included in this file.
|
4 |
*/
|
5 |
+
/*.list-top-block{height:40px; line-height:40px; display:block; float:left; position:relative; width:100%;}*/
|
6 |
.list-top-chip{float:left;display:block; vertical-align:middle; }
|
7 |
.list-top-chip::after{content:" "}
|
8 |
.backup-basic-info{min-width:100px; 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; }
|
14 |
+
/*.schedule-archive-block{width:100%;padding:10px 10px 10px 0;float:left;box-sizing:border-box; min-width:260px;}*/
|
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 |
+
/*.quickmigrate-btn{width:33%;padding:10px; float:left; position:relative; box-sizing:border-box;}*/
|
19 |
+
/*.migrate-btn{display:block !important; margin:0 auto !important;width:90px;height:50px !important; line-height:48px !important; font-size:20px !important;}*/
|
20 |
.schedule-block{float:left;width:100%;padding:0 10px 10px 10px;box-sizing:border-box;}
|
21 |
.postbox:after{content: ".";display: block;height: 0;clear: both;visibility: hidden;}
|
22 |
.quickbackup-block .fieldset label{margin-bottom:5px;}
|
23 |
.custom-info{padding:10px;}
|
24 |
.quickstart-storage-setting{width:100%;float:left; padding-left:10px; box-sizing:border-box;background-color:#f1f1f1; margin-bottom:10px;}
|
25 |
+
/*.storage-column-left{width:15%;float:left;height:100%;min-width:100px;}
|
26 |
+
.storage-column-right{margin-left:15%; width:auto;height:100%;position:relative;min-width:350px;box-sizing:border-box;}*/
|
27 |
+
/*.storage-menu{background-color: #e5e5e5;display: block;padding: 5px;text-decoration: none; }
|
28 |
.storage-menu img{margin-right:5px;}
|
29 |
.storage-menu:hover{background-color:#f1f1f1;}
|
30 |
.storage-menu-idle{border-right:1px solid #ccc;}
|
31 |
+
.storage-menu-active{background-color:#fff;color:#000; border-right:none;border-top:1px solid #ccc;border-left:1px solid #ccc;border-bottom:1px solid #ccc;}*/
|
32 |
+
/*.storage-colum-left{width:200px;float:left;height:100%;}
|
33 |
+
.storage-column-right{margin-left:200px; width:auto;height:100%;position:relative; padding:10px 10px 10px 10px;}*/
|
34 |
+
/*.storage-last-menu{border-bottom:1px solid #ccc;}*/
|
35 |
.action-progress-bar{background-color:#f1f1f1 !important;margin:10px;color:#000;}
|
36 |
.action-progress-bar-percent{background-color:#0085ba !important;color:#fff;}
|
37 |
.storage-providers{float:left;padding:10px;cursor:pointer;}
|
39 |
.storage-providers-active{background-color:#0085ba !important; color:#fff !important;}
|
40 |
.storage-account-block{padding:10px;}
|
41 |
.storage-account-button{margin:10px 10px 10px 0 !important;display:block !important; float:left;}
|
42 |
+
/*.download_backup_dialog, .restore_backup_dialog{width:700px !important;display:block; background-color:#fff;float:left; box-sizing:border-box;}*/
|
43 |
+
/*.inside-instruction{width:200px !important;float:left;background-color:#fff;box-sizing:border-box;border-left:1px solid #f1f1f1; height:100%;display:block;}*/
|
44 |
+
/*.backup-download-restore-table{height:500px; overflow:auto;}
|
45 |
+
.tr-progress-bar{width:100%;height:2px;background-color:#0085ba;}*/
|
46 |
.schedule-tab-block{padding:10px;}
|
47 |
.schedule-tab-block input, span{display:line-block; margin-top:10px; margin-bottom:10px;margin-right:10px;}
|
48 |
+
/*.choose-backup-schedule{padding-left:50px; width:auto;padding-right:50px;}
|
49 |
+
.choose-storage-list{width:100%;box-sizing:border-box;}*/
|
50 |
.setting-page-content{padding-left:20px;}
|
51 |
+
/*.api-key-block{background-color:#f1f1f1;border-radius:10px;margin-bottom:10px;}
|
52 |
.display-common-content{width:auto;position:relative;margin-top:10px;}
|
53 |
.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;}
|
54 |
+
.wpvivid-common-btn-cancel{width:80px;height:20px;line-height:20px;margin-top:10px;float:right;font-size:12px;}*/
|
55 |
.backup-log-btn{height:30px;float:left; margin-left:10px; margin-bottom:10px;}
|
56 |
+
/*.middle-loading {border-radius: 100%;border-style: solid;animation: rotate 1s infinite linear;}
|
57 |
+
.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;}*/
|
58 |
@keyframes rotate { 0% { transform: rotate(0); } 100% { transform: rotate(359.9deg); } }
|
59 |
.wpvivid-backup-storage-list tr:hover,
|
60 |
.wpvivid-websiteinfo-list tr:hover,
|
78 |
.remote-storage-amazons3-storage-class input, span,
|
79 |
.remote-storage-amazons3-encryption input, span{display:line-block; margin-top:10px; margin-bottom:10px;margin-right:10px;}
|
80 |
.backup-list-head{}
|
81 |
+
/*.download-website-info{float:left;}*/
|
82 |
.storage-account-form {padding-top: 1px; padding-bottom: 1px;}
|
83 |
|
84 |
.quicktransfer{width:100%; float:left; box-sizing:border-box;margin-right:10px; padding:10px;}
|
admin/js/wpvivid-admin.js
CHANGED
@@ -442,8 +442,6 @@ function wpvivid_check_runningtask(){
|
|
442 |
m_need_update = true;
|
443 |
}
|
444 |
}
|
445 |
-
|
446 |
-
|
447 |
}
|
448 |
catch(err){
|
449 |
alert(err);
|
@@ -1849,6 +1847,7 @@ function wpvivid_init_restore_data(restore_type){
|
|
1849 |
wpvivid_restore_need_download = true;
|
1850 |
}
|
1851 |
else if (jsonarray.result === "failed") {
|
|
|
1852 |
wpvivid_display_restore_msg(jsonarray.error, restore_type);
|
1853 |
}
|
1854 |
|
442 |
m_need_update = true;
|
443 |
}
|
444 |
}
|
|
|
|
|
445 |
}
|
446 |
catch(err){
|
447 |
alert(err);
|
1847 |
wpvivid_restore_need_download = true;
|
1848 |
}
|
1849 |
else if (jsonarray.result === "failed") {
|
1850 |
+
jQuery('#wpvivid_init_restore_data').removeClass('is-active');
|
1851 |
wpvivid_display_restore_msg(jsonarray.error, restore_type);
|
1852 |
}
|
1853 |
|
admin/partials/wpvivid-backup-restore-page-display.php
CHANGED
@@ -96,7 +96,7 @@ function wpvivid_backup_manual(){
|
|
96 |
</div>
|
97 |
</div>
|
98 |
<div class="custom-info" style="float:left; width:100%;">
|
99 |
-
<strong><?php _e('Tips', 'wpvivid'); ?></strong><?php _e(': The settings
|
100 |
</div>
|
101 |
</div>
|
102 |
<?php
|
96 |
</div>
|
97 |
</div>
|
98 |
<div class="custom-info" style="float:left; width:100%;">
|
99 |
+
<strong><?php _e('Tips', 'wpvivid'); ?></strong><?php _e(': The settings are only for manual backup, which won\'t affect schedule settings.', 'wpvivid'); ?>
|
100 |
</div>
|
101 |
</div>
|
102 |
<?php
|
admin/partials/wpvivid-schedule-page-display.php
CHANGED
@@ -22,7 +22,6 @@ function wpvivid_schedule_settings()
|
|
22 |
?>
|
23 |
</div>
|
24 |
</div>
|
25 |
-
<div id="wpvivid_schedule_backup_schedule"">
|
26 |
<div class="postbox schedule-tab-block">
|
27 |
<fieldset>
|
28 |
<legend class="screen-reader-text"><span>input type="radio"</span></legend>
|
22 |
?>
|
23 |
</div>
|
24 |
</div>
|
|
|
25 |
<div class="postbox schedule-tab-block">
|
26 |
<fieldset>
|
27 |
<legend class="screen-reader-text"><span>input type="radio"</span></legend>
|
admin/partials/wpvivid-settings-page-display.php
CHANGED
@@ -11,6 +11,33 @@ function wpvivid_general_settings()
|
|
11 |
else{
|
12 |
$wpvivid_setting_estimate_backup='';
|
13 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
14 |
global $wpvivid_pulgin;
|
15 |
$out_of_date=$wpvivid_pulgin->_get_out_of_date_info();
|
16 |
?>
|
@@ -23,7 +50,7 @@ function wpvivid_general_settings()
|
|
23 |
<input type="text" placeholder="400" option="setting" name="max_file_size" 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
|
24 |
<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. If you use a value of 0 MB, any backup files won\'t be split.', 'wpvivid' ); ?></div></p>
|
25 |
</div>
|
26 |
-
<div><strong><?php _e('Exclude the files which
|
27 |
<div class="schedule-tab-block setting-page-content">
|
28 |
<input type="text" placeholder="400" option="setting" name="exclude_file_size" 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
|
29 |
<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>
|
@@ -47,12 +74,33 @@ function wpvivid_general_settings()
|
|
47 |
?>
|
48 |
</select><strong><?php _e('backups retained', 'wpvivid'); ?></strong>
|
49 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
50 |
<div>
|
51 |
<label for="wpvivid_estimate_backup">
|
52 |
<input type="checkbox" option="setting" name="estimate_backup" id="wpvivid_estimate_backup" value="1" <?php esc_attr_e($wpvivid_setting_estimate_backup, 'wpvivid'); ?> />
|
53 |
<span><?php _e( 'Calculate the size of files, folder and database before backing up ', 'wpvivid' ); ?></span>
|
54 |
</label>
|
55 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
56 |
</div>
|
57 |
<div class="postbox schedule-tab-block">
|
58 |
<div><strong><?php _e('Backup Folder', 'wpvivid'); ?></strong></div>
|
@@ -61,12 +109,18 @@ function wpvivid_general_settings()
|
|
61 |
<input type="text" placeholder="wpvividbackups" option="setting" name="path" 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,'')" />
|
62 |
<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>
|
63 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
64 |
</div>
|
65 |
<div class="postbox schedule-tab-block">
|
|
|
66 |
<div class="schedule-tab-block">
|
67 |
<fieldset>
|
68 |
<label for="users_can_register">
|
69 |
-
<p><strong><?php _e('Remove out-of-date backups', 'wpvivid'); ?></strong></p>
|
70 |
<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>
|
71 |
<p><span><?php _e('Remote Storage Directory:', 'wpvivid'); ?></span><span id="wpvivid_out_of_date_remote_path">
|
72 |
<?php
|
11 |
else{
|
12 |
$wpvivid_setting_estimate_backup='';
|
13 |
}
|
14 |
+
if(!isset($general_setting['options']['wpvivid_common_setting']['show_tab_menu'])){
|
15 |
+
$wpvivid_show_tab_menu='checked';
|
16 |
+
}
|
17 |
+
else {
|
18 |
+
if ($general_setting['options']['wpvivid_common_setting']['show_tab_menu']) {
|
19 |
+
$wpvivid_show_tab_menu = 'checked';
|
20 |
+
} else {
|
21 |
+
$wpvivid_show_tab_menu = '';
|
22 |
+
}
|
23 |
+
}
|
24 |
+
if(!isset($general_setting['options']['wpvivid_common_setting']['max_resume_count'])){
|
25 |
+
$wpvivid_max_resume_count = WPVIVID_RESUME_RETRY_TIMES;
|
26 |
+
}
|
27 |
+
else{
|
28 |
+
$wpvivid_max_resume_count = intval($general_setting['options']['wpvivid_common_setting']['max_resume_count']);
|
29 |
+
}
|
30 |
+
if(!isset($general_setting['options']['wpvivid_common_setting']['domain_include'])){
|
31 |
+
$wpvivid_domain_include = 'checked';
|
32 |
+
}
|
33 |
+
else{
|
34 |
+
if($general_setting['options']['wpvivid_common_setting']['domain_include']){
|
35 |
+
$wpvivid_domain_include = 'checked';
|
36 |
+
}
|
37 |
+
else{
|
38 |
+
$wpvivid_domain_include = '';
|
39 |
+
}
|
40 |
+
}
|
41 |
global $wpvivid_pulgin;
|
42 |
$out_of_date=$wpvivid_pulgin->_get_out_of_date_info();
|
43 |
?>
|
50 |
<input type="text" placeholder="400" option="setting" name="max_file_size" 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
|
51 |
<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. If you use a value of 0 MB, any backup files won\'t be split.', 'wpvivid' ); ?></div></p>
|
52 |
</div>
|
53 |
+
<div><strong><?php _e('Exclude the files which are larger than', 'wpvivid'); ?></strong></div>
|
54 |
<div class="schedule-tab-block setting-page-content">
|
55 |
<input type="text" placeholder="400" option="setting" name="exclude_file_size" 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
|
56 |
<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>
|
74 |
?>
|
75 |
</select><strong><?php _e('backups retained', 'wpvivid'); ?></strong>
|
76 |
</div>
|
77 |
+
<div>
|
78 |
+
<strong>Retrying </strong>
|
79 |
+
<select option="setting" name="max_resume_count">
|
80 |
+
<?php
|
81 |
+
for($resume_count=3; $resume_count<10; $resume_count++){
|
82 |
+
if($resume_count === $wpvivid_max_resume_count){
|
83 |
+
_e('<option selected="selected" value="'.$resume_count.'">'.$resume_count.'</option>');
|
84 |
+
}
|
85 |
+
else{
|
86 |
+
_e('<option value="'.$resume_count.'">'.$resume_count.'</option>');
|
87 |
+
}
|
88 |
+
}
|
89 |
+
?>
|
90 |
+
</select><strong><?php _e(' times when encountering a time-out error', 'wpvivid'); ?></strong>
|
91 |
+
</div>
|
92 |
<div>
|
93 |
<label for="wpvivid_estimate_backup">
|
94 |
<input type="checkbox" option="setting" name="estimate_backup" id="wpvivid_estimate_backup" value="1" <?php esc_attr_e($wpvivid_setting_estimate_backup, 'wpvivid'); ?> />
|
95 |
<span><?php _e( 'Calculate the size of files, folder and database before backing up ', 'wpvivid' ); ?></span>
|
96 |
</label>
|
97 |
</div>
|
98 |
+
<div>
|
99 |
+
<label>
|
100 |
+
<input type="checkbox" option="setting" name="show_tab_menu" <?php esc_attr_e($wpvivid_show_tab_menu); ?> />
|
101 |
+
<span><?php _e('Display the tab pages in admin navigation menu', 'wpvivid'); ?></span>
|
102 |
+
</label>
|
103 |
+
</div>
|
104 |
</div>
|
105 |
<div class="postbox schedule-tab-block">
|
106 |
<div><strong><?php _e('Backup Folder', 'wpvivid'); ?></strong></div>
|
109 |
<input type="text" placeholder="wpvividbackups" option="setting" name="path" 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,'')" />
|
110 |
<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>
|
111 |
</div>
|
112 |
+
<div>
|
113 |
+
<label>
|
114 |
+
<input type="checkbox" option="setting" name="domain_include" <?php esc_attr_e($wpvivid_domain_include); ?> />
|
115 |
+
<span><?php _e('Display domain(url) of current site in backup name. (e.g. domain_wpvivid-5ceb938b6dca9_2019-05-27-07-36_backup_all.zip)', 'wpvivid'); ?></span>
|
116 |
+
</label>
|
117 |
+
</div>
|
118 |
</div>
|
119 |
<div class="postbox schedule-tab-block">
|
120 |
+
<div><strong><?php _e('Remove out-of-date backups', 'wpvivid'); ?></strong></div>
|
121 |
<div class="schedule-tab-block">
|
122 |
<fieldset>
|
123 |
<label for="users_can_register">
|
|
|
124 |
<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>
|
125 |
<p><span><?php _e('Remote Storage Directory:', 'wpvivid'); ?></span><span id="wpvivid_out_of_date_remote_path">
|
126 |
<?php
|
admin/partials/wpvivid-website-info-page-display.php
CHANGED
@@ -23,7 +23,7 @@
|
|
23 |
<th><?php _e( 'Website Info Value', 'wpvivid' ); ?></th>
|
24 |
</tr>
|
25 |
</thead>
|
26 |
-
<tbody class="wpvivid-websiteinfo-list">
|
27 |
<?php
|
28 |
if(!empty($website_info['data'])){
|
29 |
foreach ($website_info['data'] as $key=>$value) { ?>
|
@@ -58,4 +58,36 @@
|
|
58 |
</tr>
|
59 |
<?php }} ?>
|
60 |
</tbody>
|
61 |
-
</table>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
23 |
<th><?php _e( 'Website Info Value', 'wpvivid' ); ?></th>
|
24 |
</tr>
|
25 |
</thead>
|
26 |
+
<tbody class="wpvivid-websiteinfo-list" id="wpvivid_websiteinfo_list">
|
27 |
<?php
|
28 |
if(!empty($website_info['data'])){
|
29 |
foreach ($website_info['data'] as $key=>$value) { ?>
|
58 |
</tr>
|
59 |
<?php }} ?>
|
60 |
</tbody>
|
61 |
+
</table>
|
62 |
+
<script>
|
63 |
+
function wpvivid_get_ini_memory_limit() {
|
64 |
+
var ajax_data = {
|
65 |
+
'action': 'wpvivid_get_ini_memory_limit'
|
66 |
+
};
|
67 |
+
wpvivid_post_request(ajax_data, function (data) {
|
68 |
+
try {
|
69 |
+
jQuery('#wpvivid_websiteinfo_list tr').each(function (i) {
|
70 |
+
jQuery(this).children('td').each(function (j) {
|
71 |
+
if (j == 0) {
|
72 |
+
if (jQuery(this).html().indexOf('memory_limit') >= 0) {
|
73 |
+
//var wp_mem_limit = jQuery(this).next().html() + '<span title="This is the value in php.ini" style="cursor: pointer;"> (' + data + ') </span>';
|
74 |
+
//jQuery(this).next().html(wp_mem_limit);
|
75 |
+
jQuery(this).next().html(data);
|
76 |
+
}
|
77 |
+
}
|
78 |
+
});
|
79 |
+
});
|
80 |
+
}
|
81 |
+
catch (err) {
|
82 |
+
setTimeout(function () {
|
83 |
+
wpvivid_get_ini_memory_limit();
|
84 |
+
}, 3000);
|
85 |
+
}
|
86 |
+
}, function (XMLHttpRequest, textStatus, errorThrown) {
|
87 |
+
setTimeout(function () {
|
88 |
+
wpvivid_get_ini_memory_limit();
|
89 |
+
}, 3000);
|
90 |
+
});
|
91 |
+
}
|
92 |
+
wpvivid_get_ini_memory_limit();
|
93 |
+
</script>
|
includes/class-wpvivid-backup-database.php
CHANGED
@@ -172,6 +172,7 @@ class WPvivid_Backup_Database
|
|
172 |
public function check_privilege($type,$pdo)
|
173 |
{
|
174 |
global $wpvivid_pulgin;
|
|
|
175 |
$temp_privileges = array();
|
176 |
foreach ($this -> must_privilege[$type] as $key => $value){
|
177 |
$temp_privileges[$key] = 0;
|
@@ -203,7 +204,10 @@ class WPvivid_Backup_Database
|
|
203 |
$results = explode(' ON ',$result[1][0]);
|
204 |
|
205 |
$tables = explode('.',$results[1]);
|
206 |
-
|
|
|
|
|
|
|
207 |
{
|
208 |
$privileges = trim($results[0]);
|
209 |
$privileges = strtoupper($privileges);
|
@@ -272,7 +276,7 @@ class WPvivid_Backup_Database
|
|
272 |
if($max_rows>7000000)
|
273 |
{
|
274 |
$message='Exporting a large database with more than '.$max_rows.' rows may cause an error when performing dump action.';
|
275 |
-
$wpvivid_pulgin->wpvivid_log->WriteLog($message);
|
276 |
WPvivid_taskmanager::update_backup_sub_task_progress($this->task_id,'backup',WPVIVID_BACKUP_TYPE_DB,0,$message);
|
277 |
}
|
278 |
}
|
172 |
public function check_privilege($type,$pdo)
|
173 |
{
|
174 |
global $wpvivid_pulgin;
|
175 |
+
|
176 |
$temp_privileges = array();
|
177 |
foreach ($this -> must_privilege[$type] as $key => $value){
|
178 |
$temp_privileges[$key] = 0;
|
204 |
$results = explode(' ON ',$result[1][0]);
|
205 |
|
206 |
$tables = explode('.',$results[1]);
|
207 |
+
$table_fix_name=trim($tables[0],'`');
|
208 |
+
$table_fix_name=str_replace('\\','',$table_fix_name);
|
209 |
+
$wpvivid_pulgin->wpvivid_log->WriteLog('check table:'.$table_fix_name.' DB_NAME:'.DB_NAME,'notice');
|
210 |
+
if(trim($tables[0],'`') == '*' || trim($tables[0],'`') == DB_NAME||$table_fix_name== DB_NAME)
|
211 |
{
|
212 |
$privileges = trim($results[0]);
|
213 |
$privileges = strtoupper($privileges);
|
276 |
if($max_rows>7000000)
|
277 |
{
|
278 |
$message='Exporting a large database with more than '.$max_rows.' rows may cause an error when performing dump action.';
|
279 |
+
$wpvivid_pulgin->wpvivid_log->WriteLog($message, 'notice');
|
280 |
WPvivid_taskmanager::update_backup_sub_task_progress($this->task_id,'backup',WPVIVID_BACKUP_TYPE_DB,0,$message);
|
281 |
}
|
282 |
}
|
includes/class-wpvivid-backup-uploader.php
CHANGED
@@ -21,9 +21,9 @@ class Wpvivid_BackupUploader
|
|
21 |
{
|
22 |
if(isset($_POST['file_name']))
|
23 |
{
|
24 |
-
if(preg_match('
|
25 |
{
|
26 |
-
if(preg_match('
|
27 |
{
|
28 |
$id= $matches[0];
|
29 |
$id=substr($id,0,strlen($id)-1);
|
@@ -62,9 +62,9 @@ class Wpvivid_BackupUploader
|
|
62 |
|
63 |
function check_file_is_a_wpvivid_backup($file_name,&$backup_id)
|
64 |
{
|
65 |
-
if(preg_match('
|
66 |
{
|
67 |
-
if(preg_match('
|
68 |
{
|
69 |
$id= $matches[0];
|
70 |
$id=substr($id,0,strlen($id)-1);
|
@@ -158,34 +158,49 @@ class Wpvivid_BackupUploader
|
|
158 |
|
159 |
$backup_data['result']='success';
|
160 |
$backup_data['files']=array();
|
161 |
-
|
162 |
-
$i=strpos($first_file_name,'_');
|
163 |
-
$id=substr($first_file_name,0,$i);
|
164 |
-
foreach ($files as $file)
|
165 |
{
|
166 |
-
if(
|
167 |
{
|
168 |
-
$
|
169 |
-
$
|
170 |
-
|
171 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
172 |
}
|
173 |
else
|
174 |
{
|
175 |
-
|
|
|
176 |
}
|
177 |
}
|
178 |
-
|
179 |
{
|
180 |
-
|
181 |
-
$
|
182 |
-
$wpvivid_pulgin->wpvivid_log->CreateLogFile($id.'_backup','no_folder','backup');
|
183 |
-
$wpvivid_pulgin->wpvivid_log->WriteLogHander();
|
184 |
-
$wpvivid_pulgin->wpvivid_log->WriteLog('Upload finished.','notice');
|
185 |
-
WPvivid_Backuplist::add_new_upload_backup($id,$backup_data,$wpvivid_pulgin->wpvivid_log->log_file);
|
186 |
-
$html = '';
|
187 |
-
$html = apply_filters('wpvivid_add_backup_list', $html);
|
188 |
-
$ret['html'] = $html;
|
189 |
}
|
190 |
}
|
191 |
echo json_encode($ret);
|
@@ -424,7 +439,7 @@ class Wpvivid_BackupUploader
|
|
424 |
}
|
425 |
});
|
426 |
if(!brepeat) {
|
427 |
-
var wpvivid_file_regex = new RegExp(
|
428 |
if (wpvivid_file_regex.test(file.name)) {
|
429 |
jQuery('#wpvivid_upload_file_list').append(
|
430 |
'<div id="' + file.id + '" style="width: 100%; height: 36px; background: #fff; margin-bottom: 1px;">' +
|
21 |
{
|
22 |
if(isset($_POST['file_name']))
|
23 |
{
|
24 |
+
if(preg_match('/wpvivid-.*_.*_.*\.zip$/',$_POST['file_name']))
|
25 |
{
|
26 |
+
if(preg_match('/wpvivid-(.*?)_/',$_POST['file_name'],$matches))
|
27 |
{
|
28 |
$id= $matches[0];
|
29 |
$id=substr($id,0,strlen($id)-1);
|
62 |
|
63 |
function check_file_is_a_wpvivid_backup($file_name,&$backup_id)
|
64 |
{
|
65 |
+
if(preg_match('/wpvivid-.*_.*_.*\.zip$/',$file_name))
|
66 |
{
|
67 |
+
if(preg_match('/wpvivid-(.*?)_/',$file_name,$matches))
|
68 |
{
|
69 |
$id= $matches[0];
|
70 |
$id=substr($id,0,strlen($id)-1);
|
158 |
|
159 |
$backup_data['result']='success';
|
160 |
$backup_data['files']=array();
|
161 |
+
if(preg_match('/wpvivid-.*_.*_.*\.zip$/',$files[0]['name']))
|
|
|
|
|
|
|
162 |
{
|
163 |
+
if(preg_match('/wpvivid-(.*?)_/',$files[0]['name'],$matches))
|
164 |
{
|
165 |
+
$id= $matches[0];
|
166 |
+
$id=substr($id,0,strlen($id)-1);
|
167 |
+
foreach ($files as $file)
|
168 |
+
{
|
169 |
+
if($this->check_is_a_wpvivid_backup($path.$file['name']))
|
170 |
+
{
|
171 |
+
$add_file['file_name']=$file['name'];
|
172 |
+
$add_file['size']=filesize($path.$file['name']);
|
173 |
+
$add_file['md5']=md5_file($path.$file['name']);
|
174 |
+
$backup_data['files'][]=$add_file;
|
175 |
+
}
|
176 |
+
else
|
177 |
+
{
|
178 |
+
@unlink($path.$file['name']);
|
179 |
+
}
|
180 |
+
}
|
181 |
+
if(!empty($backup_data['files']))
|
182 |
+
{
|
183 |
+
global $wpvivid_pulgin;
|
184 |
+
$wpvivid_pulgin->wpvivid_log=new WPvivid_Log();
|
185 |
+
$wpvivid_pulgin->wpvivid_log->CreateLogFile($id.'_backup','no_folder','backup');
|
186 |
+
$wpvivid_pulgin->wpvivid_log->WriteLogHander();
|
187 |
+
$wpvivid_pulgin->wpvivid_log->WriteLog('Upload finished.','notice');
|
188 |
+
WPvivid_Backuplist::add_new_upload_backup($id,$backup_data,$wpvivid_pulgin->wpvivid_log->log_file);
|
189 |
+
$html = '';
|
190 |
+
$html = apply_filters('wpvivid_add_backup_list', $html);
|
191 |
+
$ret['html'] = $html;
|
192 |
+
}
|
193 |
}
|
194 |
else
|
195 |
{
|
196 |
+
$ret['result']=WPVIVID_FAILED;
|
197 |
+
$ret['error']='The backup is not created by WPvivid backup plugin.';
|
198 |
}
|
199 |
}
|
200 |
+
else
|
201 |
{
|
202 |
+
$ret['result']=WPVIVID_FAILED;
|
203 |
+
$ret['error']='The backup is not created by WPvivid backup plugin.';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
204 |
}
|
205 |
}
|
206 |
echo json_encode($ret);
|
439 |
}
|
440 |
});
|
441 |
if(!brepeat) {
|
442 |
+
var wpvivid_file_regex = new RegExp(wpvivid_upload_id + '_.*_.*\\.zip$');
|
443 |
if (wpvivid_file_regex.test(file.name)) {
|
444 |
jQuery('#wpvivid_upload_file_list').append(
|
445 |
'<div id="' + file.id + '" style="width: 100%; height: 36px; background: #fff; margin-bottom: 1px;">' +
|
includes/class-wpvivid-backup.php
CHANGED
@@ -112,11 +112,25 @@ class WPvivid_Backup_Task
|
|
112 |
$this->task['options']['backup_options']['ismerge']=1;
|
113 |
}
|
114 |
|
115 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
116 |
$this->task['options']['log_file_name']=$id.'_backup';
|
117 |
$log=new WPvivid_Log();
|
118 |
$log->CreateLogFile($this->task['options']['log_file_name'],'no_folder','backup');
|
119 |
-
|
120 |
$this->task['options']['backup_options']['prefix']=$this->task['options']['file_prefix'];
|
121 |
$this->task['options']['backup_options']['compress']=WPvivid_Setting::get_option('wpvivid_compress_setting');
|
122 |
$this->task['options']['backup_options']['dir']=WPvivid_Setting::get_backupdir();
|
@@ -186,6 +200,13 @@ class WPvivid_Backup_Task
|
|
186 |
return $ret;
|
187 |
}
|
188 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
189 |
public function set_backup($backup)
|
190 |
{
|
191 |
if(is_string($backup))
|
@@ -246,7 +267,8 @@ class WPvivid_Backup_Task
|
|
246 |
$exclude_regex[]='#^'.preg_quote($this -> transfer_path(WP_CONTENT_DIR).DIRECTORY_SEPARATOR.'upgrade', '/').'#';
|
247 |
$exclude_regex[]='#^'.preg_quote($this -> transfer_path(WP_CONTENT_DIR).DIRECTORY_SEPARATOR.'wpvivid', '/').'#';
|
248 |
$exclude_regex[]='#^'.preg_quote($this -> transfer_path(WP_CONTENT_DIR).DIRECTORY_SEPARATOR.WPvivid_Setting::get_backupdir(), '/').'#';
|
249 |
-
$exclude_regex[]='#^'.preg_quote($this -> transfer_path(WP_CONTENT_DIR.DIRECTORY_SEPARATOR.'plugins'
|
|
|
250 |
$upload_dir = wp_upload_dir();
|
251 |
$exclude_regex[]='#^'.preg_quote($this -> transfer_path($upload_dir['basedir']), '/').'#';$exclude_regex[]='#^'.preg_quote($this->transfer_path(get_theme_root()), '/').'#';
|
252 |
$backup_data['exclude_regex']=$exclude_regex;
|
@@ -1213,6 +1235,7 @@ class WPvivid_Backup_Item
|
|
1213 |
<span>size:</span><span>'.$wpvivid_pulgin->formatBytes($file['size']).'</span>
|
1214 |
</div>';
|
1215 |
$ret['files'][$file['file_name']]['progress_text']=$task['progress_text'];
|
|
|
1216 |
}
|
1217 |
elseif($task['status'] === 'completed'){
|
1218 |
$ret['files'][$file['file_name']]['status']='completed';
|
@@ -1340,6 +1363,7 @@ class WPvivid_Backup
|
|
1340 |
$wpvivid_pulgin->wpvivid_log->WriteLog('Backing up '.$next_backup['key'].' completed.','notice');
|
1341 |
WPvivid_taskmanager::update_backup_sub_task_progress($task_id,'backup', $next_backup['key'],1,'Backing up '.$next_backup['key'].' finished.',$result);
|
1342 |
$this->task->update_backup_result($next_backup,$result);
|
|
|
1343 |
$next_backup=$this->task->get_need_backup();
|
1344 |
}
|
1345 |
|
@@ -1407,12 +1431,16 @@ class WPvivid_Backup
|
|
1407 |
|
1408 |
public function clean_backup()
|
1409 |
{
|
1410 |
-
$
|
1411 |
-
|
|
|
1412 |
{
|
1413 |
-
if(
|
1414 |
-
|
|
|
|
|
1415 |
}
|
|
|
1416 |
WPvivid_tools::clearcache($this->task->get_prefix());
|
1417 |
}
|
1418 |
|
112 |
$this->task['options']['backup_options']['ismerge']=1;
|
113 |
}
|
114 |
|
115 |
+
$home_url_prefix=get_home_url();
|
116 |
+
$home_url_prefix=$this->parse_url_all($home_url_prefix);
|
117 |
+
|
118 |
+
$general_setting=WPvivid_Setting::get_setting(true, "");
|
119 |
+
if(!isset($general_setting['options']['wpvivid_common_setting']['domain_include'])){
|
120 |
+
$this->task['options']['file_prefix']=$home_url_prefix.'_'.$this->task['id'].'_'.date('Y-m-d-H-i',$this->task['status']['start_time']);
|
121 |
+
}
|
122 |
+
else{
|
123 |
+
if($general_setting['options']['wpvivid_common_setting']['domain_include']){
|
124 |
+
$this->task['options']['file_prefix']=$home_url_prefix.'_'.$this->task['id'].'_'.date('Y-m-d-H-i',$this->task['status']['start_time']);
|
125 |
+
}
|
126 |
+
else{
|
127 |
+
$this->task['options']['file_prefix']=$this->task['id'].'_'.date('Y-m-d-H-i',$this->task['status']['start_time']);
|
128 |
+
}
|
129 |
+
}
|
130 |
$this->task['options']['log_file_name']=$id.'_backup';
|
131 |
$log=new WPvivid_Log();
|
132 |
$log->CreateLogFile($this->task['options']['log_file_name'],'no_folder','backup');
|
133 |
+
//$log->WriteLog(get_home_path(),'test');
|
134 |
$this->task['options']['backup_options']['prefix']=$this->task['options']['file_prefix'];
|
135 |
$this->task['options']['backup_options']['compress']=WPvivid_Setting::get_option('wpvivid_compress_setting');
|
136 |
$this->task['options']['backup_options']['dir']=WPvivid_Setting::get_backupdir();
|
200 |
return $ret;
|
201 |
}
|
202 |
|
203 |
+
private function parse_url_all($url)
|
204 |
+
{
|
205 |
+
$parse = parse_url($url);
|
206 |
+
$path=str_replace('/','_',$parse['path']);
|
207 |
+
return $parse['host'].$path;
|
208 |
+
}
|
209 |
+
|
210 |
public function set_backup($backup)
|
211 |
{
|
212 |
if(is_string($backup))
|
267 |
$exclude_regex[]='#^'.preg_quote($this -> transfer_path(WP_CONTENT_DIR).DIRECTORY_SEPARATOR.'upgrade', '/').'#';
|
268 |
$exclude_regex[]='#^'.preg_quote($this -> transfer_path(WP_CONTENT_DIR).DIRECTORY_SEPARATOR.'wpvivid', '/').'#';
|
269 |
$exclude_regex[]='#^'.preg_quote($this -> transfer_path(WP_CONTENT_DIR).DIRECTORY_SEPARATOR.WPvivid_Setting::get_backupdir(), '/').'#';
|
270 |
+
$exclude_regex[]='#^'.preg_quote($this -> transfer_path(WP_CONTENT_DIR).DIRECTORY_SEPARATOR.'plugins', '/').'#';
|
271 |
+
$exclude_regex[]='#^'.preg_quote($this -> transfer_path(WP_CONTENT_DIR).DIRECTORY_SEPARATOR.'cache', '/').'#';
|
272 |
$upload_dir = wp_upload_dir();
|
273 |
$exclude_regex[]='#^'.preg_quote($this -> transfer_path($upload_dir['basedir']), '/').'#';$exclude_regex[]='#^'.preg_quote($this->transfer_path(get_theme_root()), '/').'#';
|
274 |
$backup_data['exclude_regex']=$exclude_regex;
|
1235 |
<span>size:</span><span>'.$wpvivid_pulgin->formatBytes($file['size']).'</span>
|
1236 |
</div>';
|
1237 |
$ret['files'][$file['file_name']]['progress_text']=$task['progress_text'];
|
1238 |
+
WPvivid_taskmanager::delete_download_task_v2($file['file_name']);
|
1239 |
}
|
1240 |
elseif($task['status'] === 'completed'){
|
1241 |
$ret['files'][$file['file_name']]['status']='completed';
|
1363 |
$wpvivid_pulgin->wpvivid_log->WriteLog('Backing up '.$next_backup['key'].' completed.','notice');
|
1364 |
WPvivid_taskmanager::update_backup_sub_task_progress($task_id,'backup', $next_backup['key'],1,'Backing up '.$next_backup['key'].' finished.',$result);
|
1365 |
$this->task->update_backup_result($next_backup,$result);
|
1366 |
+
$wpvivid_pulgin->check_cancel_backup($task_id);
|
1367 |
$next_backup=$this->task->get_need_backup();
|
1368 |
}
|
1369 |
|
1431 |
|
1432 |
public function clean_backup()
|
1433 |
{
|
1434 |
+
$path = WP_CONTENT_DIR.DIRECTORY_SEPARATOR.WPvivid_Setting::get_backupdir();
|
1435 |
+
$handler=opendir($path);
|
1436 |
+
while(($filename=readdir($handler))!==false)
|
1437 |
{
|
1438 |
+
if(preg_match('#'.$this->task->get_id().'#',$filename))
|
1439 |
+
{
|
1440 |
+
@unlink($path.DIRECTORY_SEPARATOR.$filename);
|
1441 |
+
}
|
1442 |
}
|
1443 |
+
@closedir($handler);
|
1444 |
WPvivid_tools::clearcache($this->task->get_prefix());
|
1445 |
}
|
1446 |
|
includes/class-wpvivid-crypt.php
CHANGED
@@ -33,7 +33,7 @@ class WPvivid_crypt
|
|
33 |
$len=str_pad(dechex(strlen($key)),3,'0', STR_PAD_LEFT);
|
34 |
$message=$this->rij->encrypt($message);
|
35 |
$message_len = str_pad(dechex(strlen($message)), 16, '0', STR_PAD_LEFT);
|
36 |
-
return $len.$key.$message_len.$message
|
37 |
}
|
38 |
|
39 |
public function encrypt_key()
|
33 |
$len=str_pad(dechex(strlen($key)),3,'0', STR_PAD_LEFT);
|
34 |
$message=$this->rij->encrypt($message);
|
35 |
$message_len = str_pad(dechex(strlen($message)), 16, '0', STR_PAD_LEFT);
|
36 |
+
return $len.$key.$message_len.$message;
|
37 |
}
|
38 |
|
39 |
public function encrypt_key()
|
includes/class-wpvivid-error-log.php
CHANGED
@@ -25,6 +25,26 @@ class WPvivid_error_log
|
|
25 |
self::delete_oldest_error_log();
|
26 |
}
|
27 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
28 |
public static function delete_oldest_error_log()
|
29 |
{
|
30 |
$files=array();
|
25 |
self::delete_oldest_error_log();
|
26 |
}
|
27 |
|
28 |
+
public static function create_restore_error_log($log_file_name)
|
29 |
+
{
|
30 |
+
$dir=dirname($log_file_name);
|
31 |
+
if(!is_dir($dir.DIRECTORY_SEPARATOR.'wpvivid_log'.DIRECTORY_SEPARATOR.'error')){
|
32 |
+
@mkdir($dir.DIRECTORY_SEPARATOR.'wpvivid_log'.DIRECTORY_SEPARATOR.'error',0777,true);
|
33 |
+
@fopen($dir.DIRECTORY_SEPARATOR.'wpvivid_log'.DIRECTORY_SEPARATOR.'error'.'/index.html', 'x');
|
34 |
+
$tempfile=@fopen($dir.DIRECTORY_SEPARATOR.'wpvivid_log'.DIRECTORY_SEPARATOR.'error'.'/.htaccess', 'x');
|
35 |
+
if($tempfile)
|
36 |
+
{
|
37 |
+
$text="deny from all";
|
38 |
+
fwrite($tempfile,$text );
|
39 |
+
@fclose($tempfile);
|
40 |
+
}
|
41 |
+
}
|
42 |
+
$id = uniqid('wpvivid-');
|
43 |
+
$file=$id.'_restore_log.txt';
|
44 |
+
@copy($log_file_name,$dir.DIRECTORY_SEPARATOR.'wpvivid_log'.DIRECTORY_SEPARATOR.'error'.DIRECTORY_SEPARATOR.$file);
|
45 |
+
self::delete_oldest_error_log();
|
46 |
+
}
|
47 |
+
|
48 |
public static function delete_oldest_error_log()
|
49 |
{
|
50 |
$files=array();
|
includes/class-wpvivid-log.php
CHANGED
@@ -108,7 +108,23 @@ class WPvivid_Log
|
|
108 |
global $wp_version;
|
109 |
global $wpdb;
|
110 |
|
111 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
112 |
$log.='memory_limit:'.ini_get('memory_limit').' memory_get_usage:'.size_format(memory_get_usage(),2).' memory_get_peak_usage:'.size_format(memory_get_peak_usage(),2);
|
113 |
$log.=' extensions:';
|
114 |
$loaded_extensions = get_loaded_extensions();
|
108 |
global $wp_version;
|
109 |
global $wpdb;
|
110 |
|
111 |
+
$sapi_type=php_sapi_name();
|
112 |
+
if($sapi_type=='cgi-fcgi'||$sapi_type==' fpm-fcgi') {
|
113 |
+
$fcgi='On';
|
114 |
+
}
|
115 |
+
else {
|
116 |
+
$fcgi='Off';
|
117 |
+
}
|
118 |
+
|
119 |
+
$options=WPvivid_Setting::get_option('wpvivid_common_setting');
|
120 |
+
if(isset($options['max_execution_time'])) {
|
121 |
+
$max_execution_time=$options['max_execution_time'];
|
122 |
+
}
|
123 |
+
else {
|
124 |
+
$max_execution_time=WPVIVID_MAX_EXECUTION_TIME;
|
125 |
+
}
|
126 |
+
|
127 |
+
$log='server info fcgi:'.$fcgi.' max execution time: '.$max_execution_time.' wp version:'.$wp_version.' php version:'.phpversion().' db version:'.$wpdb->db_version().' php ini:safe_mode:'.ini_get('safe_mode').' ';
|
128 |
$log.='memory_limit:'.ini_get('memory_limit').' memory_get_usage:'.size_format(memory_get_usage(),2).' memory_get_peak_usage:'.size_format(memory_get_peak_usage(),2);
|
129 |
$log.=' extensions:';
|
130 |
$loaded_extensions = get_loaded_extensions();
|
includes/class-wpvivid-migrate.php
CHANGED
@@ -47,7 +47,7 @@ class WPvivid_Migrate
|
|
47 |
die();
|
48 |
}
|
49 |
|
50 |
-
if($url==
|
51 |
{
|
52 |
$ret['result']=WPVIVID_FAILED;
|
53 |
$ret['error']='The key generated by this site cannot be added into this site.';
|
@@ -74,7 +74,7 @@ class WPvivid_Migrate
|
|
74 |
|
75 |
$data=base64_encode($data);
|
76 |
|
77 |
-
$args['body']=array('
|
78 |
$response=wp_remote_post($url,$args);
|
79 |
|
80 |
if ( is_wp_error( $response ) )
|
@@ -309,7 +309,7 @@ class WPvivid_Migrate
|
|
309 |
$crypt=new WPvivid_crypt(base64_decode($options[$url]['token']));
|
310 |
$data=$crypt->encrypt_message($json);
|
311 |
$data=base64_encode($data);
|
312 |
-
$args['body']=array('
|
313 |
$response=wp_remote_post($url,$args);
|
314 |
|
315 |
if ( is_wp_error( $response ) )
|
@@ -515,7 +515,7 @@ class WPvivid_Migrate
|
|
515 |
|
516 |
update_option('wpvivid_api_token',$options);
|
517 |
|
518 |
-
$url=
|
519 |
$url=$url.'?domain='.$options['domain'].'&token='.$options['public_key'].'&expires='.$expires;
|
520 |
echo $url;
|
521 |
die();
|
@@ -620,7 +620,9 @@ class WPvivid_Migrate
|
|
620 |
</div>
|
621 |
</div>
|
622 |
|
623 |
-
<p
|
|
|
|
|
624 |
|
625 |
<div style="padding: 0 0 10px 0;">
|
626 |
<div id="wpvivid_transfer_btn" style="float: left;">
|
47 |
die();
|
48 |
}
|
49 |
|
50 |
+
if($url==home_url())
|
51 |
{
|
52 |
$ret['result']=WPVIVID_FAILED;
|
53 |
$ret['error']='The key generated by this site cannot be added into this site.';
|
74 |
|
75 |
$data=base64_encode($data);
|
76 |
|
77 |
+
$args['body']=array('wpvivid_content'=>$data,'wpvivid_action'=>'send_to_site_connect');
|
78 |
$response=wp_remote_post($url,$args);
|
79 |
|
80 |
if ( is_wp_error( $response ) )
|
309 |
$crypt=new WPvivid_crypt(base64_decode($options[$url]['token']));
|
310 |
$data=$crypt->encrypt_message($json);
|
311 |
$data=base64_encode($data);
|
312 |
+
$args['body']=array('wpvivid_content'=>$data,'wpvivid_action'=>'send_to_site_connect');
|
313 |
$response=wp_remote_post($url,$args);
|
314 |
|
315 |
if ( is_wp_error( $response ) )
|
515 |
|
516 |
update_option('wpvivid_api_token',$options);
|
517 |
|
518 |
+
$url= $options['domain'];
|
519 |
$url=$url.'?domain='.$options['domain'].'&token='.$options['public_key'].'&expires='.$expires;
|
520 |
echo $url;
|
521 |
die();
|
620 |
</div>
|
621 |
</div>
|
622 |
|
623 |
+
<p>Note: </p>
|
624 |
+
<p>1. In order to successfully complete the migration, you'd better deactivate <a href="https://wpvivid.com/best-redirect-plugins.html" target="_blank">301 redirect plugin</a>, <a href="https://wpvivid.com/8-best-wordpress-firewall-plugins.html" target="_blank">firewall and security plugin</a>, and <a href="https://wpvivid.com/best-free-wordpress-caching-plugins.html" target="_blank">caching plugin</a> (if they exist) before transferring website.</p>
|
625 |
+
<p>2. Please migrate website with the manual way when using <strong>Local by Flywheel</strong> environment.</p>
|
626 |
|
627 |
<div style="padding: 0 0 10px 0;">
|
628 |
<div id="wpvivid_transfer_btn" style="float: left;">
|
includes/class-wpvivid-mysqldump.php
CHANGED
@@ -611,6 +611,13 @@ class WPvivid_Mysqldump
|
|
611 |
}
|
612 |
|
613 |
$this->getTableStructure($table);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
614 |
if ( false === $this->dumpSettings['no-data'] ) { // don't break compatibility with old trigger
|
615 |
$this->listValues($table);
|
616 |
} else if ( true === $this->dumpSettings['no-data']
|
@@ -742,6 +749,36 @@ class WPvivid_Mysqldump
|
|
742 |
$columns = $this->query(
|
743 |
$this->typeAdapter->show_columns($tableName)
|
744 |
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
745 |
$columns->setFetchMode(PDO::FETCH_ASSOC);
|
746 |
|
747 |
foreach($columns as $key => $col) {
|
611 |
}
|
612 |
|
613 |
$this->getTableStructure($table);
|
614 |
+
if($this->tableColumnTypes[$table]===false)
|
615 |
+
{
|
616 |
+
global $wpvivid_pulgin;
|
617 |
+
$message='get Table Structure failed. table:'.$table;
|
618 |
+
$wpvivid_pulgin->wpvivid_log->WriteLog($message,'notice');
|
619 |
+
continue;
|
620 |
+
}
|
621 |
if ( false === $this->dumpSettings['no-data'] ) { // don't break compatibility with old trigger
|
622 |
$this->listValues($table);
|
623 |
} else if ( true === $this->dumpSettings['no-data']
|
749 |
$columns = $this->query(
|
750 |
$this->typeAdapter->show_columns($tableName)
|
751 |
);
|
752 |
+
if($columns===false)
|
753 |
+
{
|
754 |
+
global $wpvivid_pulgin;
|
755 |
+
$error=$this->dbHandler->errorInfo();
|
756 |
+
if(isset($error[2])){
|
757 |
+
$error = 'Error: '.$error[2];
|
758 |
+
}
|
759 |
+
else{
|
760 |
+
$error = '';
|
761 |
+
}
|
762 |
+
$message='Show columns failed. '.$error;
|
763 |
+
$wpvivid_pulgin->wpvivid_log->WriteLog($message, 'warning');
|
764 |
+
$columns = $this->query(
|
765 |
+
'DESCRIBE '.$tableName
|
766 |
+
);
|
767 |
+
if($columns===false)
|
768 |
+
{
|
769 |
+
$error=$this->dbHandler->errorInfo();
|
770 |
+
if(isset($error[2])){
|
771 |
+
$error = 'Error: '.$error[2];
|
772 |
+
}
|
773 |
+
else{
|
774 |
+
$error = '';
|
775 |
+
}
|
776 |
+
$message='DESCRIBE failed. '.$error;
|
777 |
+
$wpvivid_pulgin->wpvivid_log->WriteLog($message, 'warning');
|
778 |
+
return false;
|
779 |
+
}
|
780 |
+
}
|
781 |
+
|
782 |
$columns->setFetchMode(PDO::FETCH_ASSOC);
|
783 |
|
784 |
foreach($columns as $key => $col) {
|
includes/class-wpvivid-remote-collection.php
CHANGED
@@ -73,6 +73,18 @@ class WPvivid_Remote_collection
|
|
73 |
}
|
74 |
$ret['result']=WPVIVID_SUCCESS;
|
75 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
76 |
}
|
77 |
|
78 |
return $ret;
|
73 |
}
|
74 |
$ret['result']=WPVIVID_SUCCESS;
|
75 |
}
|
76 |
+
else{
|
77 |
+
$id = uniqid('wpvivid-');
|
78 |
+
$log_file_name = $id . '_add_remote';
|
79 |
+
$log = new WPvivid_Log();
|
80 |
+
$log->CreateLogFile($log_file_name, 'no_folder', 'Add Remote Test Connection');
|
81 |
+
$log->WriteLog('Remote Type: '.$remote_option['type'], 'notice');
|
82 |
+
if(isset($ret['error'])) {
|
83 |
+
$log->WriteLog($ret['error'], 'notice');
|
84 |
+
}
|
85 |
+
WPvivid_error_log::create_error_log($log->log_file);
|
86 |
+
$log->CloseFile();
|
87 |
+
}
|
88 |
}
|
89 |
|
90 |
return $ret;
|
includes/class-wpvivid-restore-data.php
CHANGED
@@ -266,6 +266,22 @@ class WPvivid_restore_data
|
|
266 |
$this->restore_log->WriteLog($message,$type);
|
267 |
}
|
268 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
269 |
public function write_rollback_log($message,$type)
|
270 |
{
|
271 |
if($this->rollback_log===false)
|
266 |
$this->restore_log->WriteLog($message,$type);
|
267 |
}
|
268 |
|
269 |
+
public function delete_restore_log()
|
270 |
+
{
|
271 |
+
if(file_exists($this->restore_log_file)) {
|
272 |
+
@unlink($this->restore_log_file);
|
273 |
+
}
|
274 |
+
}
|
275 |
+
|
276 |
+
public function save_error_log_to_debug()
|
277 |
+
{
|
278 |
+
if($this->restore_log===false) {
|
279 |
+
$this->restore_log=new WPvivid_Log();
|
280 |
+
$this->restore_log->OpenLogFile($this->restore_log_file,'has_folder');
|
281 |
+
}
|
282 |
+
WPvivid_error_log::create_restore_error_log($this->restore_log->log_file);
|
283 |
+
}
|
284 |
+
|
285 |
public function write_rollback_log($message,$type)
|
286 |
{
|
287 |
if($this->rollback_log===false)
|
includes/class-wpvivid-restore-database.php
CHANGED
@@ -10,7 +10,6 @@ require_once plugin_dir_path( dirname( __FILE__ ) ) .'includes/class-wpvivid-set
|
|
10 |
require_once plugin_dir_path( dirname( __FILE__ ) ) .'includes/class-wpvivid-rollback.php';
|
11 |
class WPvivid_RestoreDB
|
12 |
{
|
13 |
-
private $privileges;
|
14 |
private $max_allow_packet;
|
15 |
|
16 |
private $support_engines;
|
10 |
require_once plugin_dir_path( dirname( __FILE__ ) ) .'includes/class-wpvivid-rollback.php';
|
11 |
class WPvivid_RestoreDB
|
12 |
{
|
|
|
13 |
private $max_allow_packet;
|
14 |
|
15 |
private $support_engines;
|
includes/class-wpvivid-setting.php
CHANGED
@@ -120,7 +120,10 @@ class WPvivid_Setting
|
|
120 |
$common_option['log_save_location']=WPVIVID_DEFAULT_LOG_DIR;
|
121 |
$common_option['max_backup_count']=WPVIVID_DEFAULT_BACKUP_COUNT;
|
122 |
$common_option['show_admin_bar']=WPVIVID_DEFAULT_ADMIN_BAR;
|
|
|
|
|
123 |
$common_option['estimate_backup']=WPVIVID_DEFAULT_ESTIMATE_BACKUP;
|
|
|
124 |
self::update_option('wpvivid_common_setting',$common_option);
|
125 |
return $common_option;
|
126 |
}
|
@@ -567,4 +570,19 @@ class WPvivid_Setting
|
|
567 |
return array();
|
568 |
}
|
569 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
570 |
}
|
120 |
$common_option['log_save_location']=WPVIVID_DEFAULT_LOG_DIR;
|
121 |
$common_option['max_backup_count']=WPVIVID_DEFAULT_BACKUP_COUNT;
|
122 |
$common_option['show_admin_bar']=WPVIVID_DEFAULT_ADMIN_BAR;
|
123 |
+
$common_option['show_tab_menu']=WPVIVID_DEFAULT_TAB_MENU;
|
124 |
+
$common_option['domain_include']=WPVIVID_DEFAULT_DOMAIN_INCLUDE;
|
125 |
$common_option['estimate_backup']=WPVIVID_DEFAULT_ESTIMATE_BACKUP;
|
126 |
+
$common_option['max_resume_count']=WPVIVID_RESUME_RETRY_TIMES;
|
127 |
self::update_option('wpvivid_common_setting',$common_option);
|
128 |
return $common_option;
|
129 |
}
|
570 |
return array();
|
571 |
}
|
572 |
}
|
573 |
+
|
574 |
+
public static function get_sync_data()
|
575 |
+
{
|
576 |
+
$data['setting']['wpvivid_compress_setting']=self::get_option('wpvivid_compress_setting');
|
577 |
+
$data['setting']['wpvivid_local_setting']=self::get_option('wpvivid_local_setting');
|
578 |
+
$data['setting']['wpvivid_common_setting']=self::get_option('wpvivid_common_setting');
|
579 |
+
$data['setting']['wpvivid_email_setting']=self::get_option('wpvivid_email_setting');
|
580 |
+
$data['setting']['cron_backup_count']=self::get_option('cron_backup_count');
|
581 |
+
|
582 |
+
$data['schedule']=self::get_option('wpvivid_schedule_setting');
|
583 |
+
$data['remote']['upload']=self::get_option('wpvivid_upload_setting');
|
584 |
+
$data['remote']['history']=self::get_option('wpvivid_user_history');
|
585 |
+
|
586 |
+
return $data;
|
587 |
+
}
|
588 |
}
|
includes/class-wpvivid-tools.php
CHANGED
@@ -34,11 +34,15 @@ class WPvivid_tools
|
|
34 |
}
|
35 |
|
36 |
public static function clearcache($task_id){
|
|
|
|
|
|
|
|
|
37 |
$path = WP_CONTENT_DIR.DIRECTORY_SEPARATOR.WPvivid_Setting::get_backupdir();
|
38 |
$handler=opendir($path);
|
39 |
while(($filename=readdir($handler))!==false)
|
40 |
{
|
41 |
-
if(is_dir($path.DIRECTORY_SEPARATOR.$filename) && preg_match('#temp-'.$task_id.'#',$filename))
|
42 |
{
|
43 |
WPvivid_tools::deldir($path.DIRECTORY_SEPARATOR.$filename,'',true);
|
44 |
}
|
34 |
}
|
35 |
|
36 |
public static function clearcache($task_id){
|
37 |
+
$home_url_prefix=get_home_url();
|
38 |
+
$parse = parse_url($home_url_prefix);
|
39 |
+
$tmppath=str_replace('/','_',$parse['path']);
|
40 |
+
$home_url_prefix = $parse['host'].$tmppath;
|
41 |
$path = WP_CONTENT_DIR.DIRECTORY_SEPARATOR.WPvivid_Setting::get_backupdir();
|
42 |
$handler=opendir($path);
|
43 |
while(($filename=readdir($handler))!==false)
|
44 |
{
|
45 |
+
if(is_dir($path.DIRECTORY_SEPARATOR.$filename) && preg_match('#temp-'.$home_url_prefix.'_'.$task_id.'#',$filename))
|
46 |
{
|
47 |
WPvivid_tools::deldir($path.DIRECTORY_SEPARATOR.$filename,'',true);
|
48 |
}
|
includes/class-wpvivid.php
CHANGED
@@ -100,6 +100,8 @@ class WPvivid {
|
|
100 |
add_filter('wpvivid_get_last_backup_message', array( $this, 'wpvivid_get_last_backup_message' ), 10);
|
101 |
add_filter('wpvivid_schedule_local_remote', array( $this, 'wpvivid_schedule_local_remote' ), 10);
|
102 |
add_filter('wpvivid_remote_storage', array( $this, 'wpvivid_remote_storage'), 10);
|
|
|
|
|
103 |
add_action('wpvivid_handle_backup_succeed',array($this,'wpvivid_handle_backup_succeed'),10);
|
104 |
add_action('wpvivid_handle_upload_succeed',array($this,'wpvivid_handle_backup_succeed'),10);
|
105 |
|
@@ -310,6 +312,7 @@ class WPvivid {
|
|
310 |
add_action('wp_ajax_wpvivid_get_default_remote_storage',array( $this,'get_default_remote_storage'));
|
311 |
add_action('wp_ajax_wpvivid_need_review',array( $this,'need_review'));
|
312 |
add_action('wp_ajax_wpvivid_send_debug_info',array($this,'wpvivid_send_debug_info'));
|
|
|
313 |
}
|
314 |
|
315 |
public function get_plugin_name()
|
@@ -332,44 +335,97 @@ class WPvivid {
|
|
332 |
public function prepare_backup()
|
333 |
{
|
334 |
$this->ajax_check_security();
|
335 |
-
|
336 |
-
|
|
|
337 |
{
|
338 |
-
$
|
339 |
-
$json = stripslashes($json);
|
340 |
-
$backup_options = json_decode($json, true);
|
341 |
-
if (is_null($backup_options))
|
342 |
{
|
343 |
-
|
344 |
-
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
-
|
349 |
-
|
350 |
-
|
351 |
-
}
|
352 |
|
353 |
-
|
354 |
-
|
355 |
-
{
|
356 |
-
//Check the website data to be backed up
|
357 |
-
$ret['check']=$this->check_backup($ret['task_id'],$backup_options['backup_files']);
|
358 |
-
if(isset($ret['check']['result']) && $ret['check']['result'] == WPVIVID_FAILED)
|
359 |
{
|
360 |
-
|
|
|
361 |
die();
|
362 |
}
|
363 |
|
364 |
-
$
|
365 |
-
$
|
366 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
367 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
368 |
echo json_encode($ret);
|
|
|
|
|
|
|
369 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
370 |
die();
|
371 |
}
|
372 |
}
|
|
|
373 |
public function check_backup_option($data, $backup_method = 'Manual')
|
374 |
{
|
375 |
$ret['result']=WPVIVID_FAILED;
|
@@ -452,6 +508,14 @@ class WPvivid {
|
|
452 |
$task_id=sanitize_key($_POST['task_id']);
|
453 |
|
454 |
//Start backup site
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
455 |
$this->backup($task_id);
|
456 |
die();
|
457 |
}
|
@@ -631,20 +695,20 @@ class WPvivid {
|
|
631 |
if (isset($_POST['task_id'])&&!empty($_POST['task_id'])&&is_string($_POST['task_id']))
|
632 |
{
|
633 |
$task_id=sanitize_key($_POST['task_id']);
|
634 |
-
|
635 |
-
|
636 |
-
|
637 |
-
|
638 |
-
|
639 |
-
|
640 |
-
|
641 |
-
|
642 |
-
|
643 |
-
|
644 |
-
|
645 |
-
|
646 |
-
|
647 |
-
|
648 |
$json['result']='success';
|
649 |
$json['msg']=__('The backup will be canceled after backing up the current chunk ends.', 'wpvivid');
|
650 |
echo json_encode($json);
|
@@ -661,33 +725,54 @@ class WPvivid {
|
|
661 |
public function main_schedule()
|
662 |
{
|
663 |
//get backup options
|
|
|
|
|
664 |
$schedule_options=WPvivid_Schedule::get_schedule();
|
665 |
if(empty($schedule_options))
|
666 |
{
|
|
|
667 |
die();
|
668 |
}
|
669 |
-
|
670 |
-
|
671 |
-
|
672 |
-
|
|
|
673 |
|
674 |
-
|
675 |
-
|
676 |
-
|
677 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
678 |
die();
|
679 |
}
|
680 |
-
|
681 |
-
$ret=$this->pre_backup($schedule_options['backup'],'Cron');
|
682 |
-
if($ret['result']=='success')
|
683 |
{
|
684 |
-
|
685 |
-
$
|
686 |
-
|
687 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
688 |
}
|
689 |
-
|
690 |
-
die();
|
691 |
}
|
692 |
/**
|
693 |
* Resume backup schedule.
|
@@ -864,6 +949,7 @@ class WPvivid {
|
|
864 |
public function backup($task_id)
|
865 |
{
|
866 |
//register shutdown function to catch php fatal error such as script time out and memory limit
|
|
|
867 |
$this->end_shutdown_function=false;
|
868 |
register_shutdown_function(array($this,'deal_shutdown_error'),$task_id);
|
869 |
@ignore_user_abort(true);
|
@@ -1123,13 +1209,23 @@ class WPvivid {
|
|
1123 |
$limit=WPVIVID_MAX_EXECUTION_TIME;
|
1124 |
}
|
1125 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1126 |
$time_spend = time() - $status['timeout'];
|
1127 |
-
|
|
|
1128 |
if ($time_spend >= $limit)
|
1129 |
{
|
1130 |
//time out
|
1131 |
$status['resume_count']++;
|
1132 |
-
|
|
|
1133 |
{
|
1134 |
$message = __('Too many resumption attempts.', 'wpvivid');
|
1135 |
$task = WPvivid_taskmanager::update_backup_task_status($task_id, false, 'error', false, $status['resume_count'], $message);
|
@@ -1147,14 +1243,42 @@ class WPvivid {
|
|
1147 |
}
|
1148 |
if ($this->wpvivid_log)
|
1149 |
$this->wpvivid_log->WriteLog($message, 'error');
|
1150 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1151 |
if ($status['str'] != 'error')
|
1152 |
{
|
1153 |
if ($error !== false)
|
1154 |
{
|
1155 |
-
$message = $error['message'] . ' file:' . $error['file'] . ' line:' . $error['line'];
|
1156 |
} else {
|
1157 |
-
$message = __('backup failed error unknown', 'wpvivid');
|
1158 |
}
|
1159 |
WPvivid_taskmanager::update_backup_task_status($task_id, false, 'error', false, $status['resume_count'], $message);
|
1160 |
}
|
@@ -1237,8 +1361,16 @@ class WPvivid {
|
|
1237 |
if($time_spend>=$limit)
|
1238 |
{
|
1239 |
//time out
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1240 |
$status['resume_count']++;
|
1241 |
-
if($status['resume_count']
|
1242 |
{
|
1243 |
$message=__('Too many resumption attempts.', 'wpvivid');
|
1244 |
$task=WPvivid_taskmanager::update_backup_task_status($task_id,false,'error',false,$status['resume_count'],$message);
|
@@ -2443,38 +2575,6 @@ class WPvivid {
|
|
2443 |
$files[] = $filename;
|
2444 |
}
|
2445 |
|
2446 |
-
/*if(isset($backup['backup']['files'])){
|
2447 |
-
foreach ($backup['backup']['files'] as $file) {
|
2448 |
-
$files[] = $file['file_name'];
|
2449 |
-
}
|
2450 |
-
}
|
2451 |
-
else if($backup['backup']['ismerge'])
|
2452 |
-
{
|
2453 |
-
foreach ($backup['backup']['data']['meta']['files'] as $file)
|
2454 |
-
{
|
2455 |
-
$files[]=$file['file_name'];
|
2456 |
-
$files[]=$file['file_name'].'.txt';
|
2457 |
-
}
|
2458 |
-
|
2459 |
-
foreach ($backup['backup']['data']['type'] as $type)
|
2460 |
-
{
|
2461 |
-
foreach ($type['files'] as $file)
|
2462 |
-
{
|
2463 |
-
$files[]=$file['file_name'].'.txt';
|
2464 |
-
}
|
2465 |
-
}
|
2466 |
-
}
|
2467 |
-
else
|
2468 |
-
{
|
2469 |
-
foreach ($backup['backup']['data']['type'] as $type)
|
2470 |
-
{
|
2471 |
-
foreach ($type['files'] as $file)
|
2472 |
-
{
|
2473 |
-
$files[]=$file['file_name'];
|
2474 |
-
}
|
2475 |
-
}
|
2476 |
-
}*/
|
2477 |
-
|
2478 |
foreach ($files as $file)
|
2479 |
{
|
2480 |
$download_path = WP_CONTENT_DIR .DIRECTORY_SEPARATOR . $download_dir . DIRECTORY_SEPARATOR . $file;
|
@@ -2840,6 +2940,10 @@ class WPvivid {
|
|
2840 |
$ret['memory_limit_warning']=false;
|
2841 |
}
|
2842 |
|
|
|
|
|
|
|
|
|
2843 |
echo json_encode($ret);
|
2844 |
die();
|
2845 |
}
|
@@ -2878,13 +2982,7 @@ class WPvivid {
|
|
2878 |
}
|
2879 |
|
2880 |
$backup_id =sanitize_key($_POST['backup_id']);
|
2881 |
-
|
2882 |
-
//$json = stripslashes($json);
|
2883 |
-
//$restore_options = json_decode($json, 1);
|
2884 |
-
//if(is_null($restore_options))
|
2885 |
-
//{
|
2886 |
-
// die();
|
2887 |
-
//}
|
2888 |
$backup = WPvivid_Backuplist::get_backuplist_by_key($backup_id);
|
2889 |
|
2890 |
$backup_item=new WPvivid_Backup_Item($backup);
|
@@ -2964,6 +3062,7 @@ class WPvivid {
|
|
2964 |
{
|
2965 |
$ret['result']=WPVIVID_FAILED;
|
2966 |
$ret['error']='not found download file';
|
|
|
2967 |
echo json_encode($ret);
|
2968 |
}
|
2969 |
else
|
@@ -2977,6 +3076,29 @@ class WPvivid {
|
|
2977 |
die();
|
2978 |
}
|
2979 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2980 |
/**
|
2981 |
* Start restore
|
2982 |
*
|
@@ -3006,7 +3128,6 @@ class WPvivid {
|
|
3006 |
$restore_options=array();
|
3007 |
}
|
3008 |
}
|
3009 |
-
|
3010 |
try
|
3011 |
{
|
3012 |
if ($this->restore_data->has_restore())
|
@@ -3237,6 +3358,9 @@ class WPvivid {
|
|
3237 |
{
|
3238 |
$ret['result']='success';
|
3239 |
$ret['status']= $this->restore_data->get_restore_status();
|
|
|
|
|
|
|
3240 |
$ret['log']=$this->restore_data->get_log_content();
|
3241 |
echo json_encode($ret);
|
3242 |
die();
|
@@ -4102,6 +4226,7 @@ class WPvivid {
|
|
4102 |
$setting['exclude_file_size'] = intval($setting['exclude_file_size']);
|
4103 |
$setting['max_execution_time'] = intval($setting['max_execution_time']);
|
4104 |
$setting['max_backup_count'] = intval($setting['max_backup_count']);
|
|
|
4105 |
|
4106 |
$setting_data['wpvivid_email_setting']['send_to'][] = $setting['send_to'];
|
4107 |
$setting_data['wpvivid_email_setting']['always'] = $setting['always'];
|
@@ -4121,7 +4246,10 @@ class WPvivid {
|
|
4121 |
$setting_data['wpvivid_common_setting']['log_save_location'] = $setting['path'].'/wpvivid_log';
|
4122 |
$setting_data['wpvivid_common_setting']['max_backup_count'] = $setting['max_backup_count'];
|
4123 |
$setting_data['wpvivid_common_setting']['show_admin_bar'] = $options['options']['wpvivid_common_setting']['show_admin_bar'];
|
|
|
|
|
4124 |
$setting_data['wpvivid_common_setting']['estimate_backup'] = $setting['estimate_backup'];
|
|
|
4125 |
return $setting_data;
|
4126 |
}
|
4127 |
|
@@ -4147,7 +4275,7 @@ class WPvivid {
|
|
4147 |
echo json_encode($ret);
|
4148 |
die();
|
4149 |
}
|
4150 |
-
|
4151 |
$options=WPvivid_Setting::get_setting(true, "");
|
4152 |
$setting_data = array();
|
4153 |
$setting_data= apply_filters('wpvivid_set_general_setting',$setting_data, $setting, $options);
|
@@ -4699,6 +4827,19 @@ class WPvivid {
|
|
4699 |
}
|
4700 |
$ret['data']['language']=get_bloginfo('language');
|
4701 |
$ret['data']['upload_max_filesize']=ini_get("upload_max_filesize");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4702 |
$ret['data']['max_execution_time']=ini_get("max_execution_time");
|
4703 |
$ret['data']['max_input_vars']=ini_get("max_input_vars");
|
4704 |
$ret['data']['max_input_vars']=ini_get("max_input_vars");
|
@@ -5238,4 +5379,11 @@ class WPvivid {
|
|
5238 |
echo json_encode($ret);
|
5239 |
die();
|
5240 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5241 |
}
|
100 |
add_filter('wpvivid_get_last_backup_message', array( $this, 'wpvivid_get_last_backup_message' ), 10);
|
101 |
add_filter('wpvivid_schedule_local_remote', array( $this, 'wpvivid_schedule_local_remote' ), 10);
|
102 |
add_filter('wpvivid_remote_storage', array( $this, 'wpvivid_remote_storage'), 10);
|
103 |
+
add_filter('wpvivid_set_general_setting', array($this, 'wpvivid_set_general_setting'), 10, 3);
|
104 |
+
|
105 |
add_action('wpvivid_handle_backup_succeed',array($this,'wpvivid_handle_backup_succeed'),10);
|
106 |
add_action('wpvivid_handle_upload_succeed',array($this,'wpvivid_handle_backup_succeed'),10);
|
107 |
|
312 |
add_action('wp_ajax_wpvivid_get_default_remote_storage',array( $this,'get_default_remote_storage'));
|
313 |
add_action('wp_ajax_wpvivid_need_review',array( $this,'need_review'));
|
314 |
add_action('wp_ajax_wpvivid_send_debug_info',array($this,'wpvivid_send_debug_info'));
|
315 |
+
add_action('wp_ajax_wpvivid_get_ini_memory_limit',array($this,'get_ini_memory_limit'));
|
316 |
}
|
317 |
|
318 |
public function get_plugin_name()
|
335 |
public function prepare_backup()
|
336 |
{
|
337 |
$this->ajax_check_security();
|
338 |
+
$this->end_shutdown_function=false;
|
339 |
+
register_shutdown_function(array($this,'deal_prepare_shutdown_error'));
|
340 |
+
try
|
341 |
{
|
342 |
+
if(isset($_POST['backup'])&&!empty($_POST['backup']))
|
|
|
|
|
|
|
343 |
{
|
344 |
+
$json = $_POST['backup'];
|
345 |
+
$json = stripslashes($json);
|
346 |
+
$backup_options = json_decode($json, true);
|
347 |
+
if (is_null($backup_options))
|
348 |
+
{
|
349 |
+
$this->end_shutdown_function=true;
|
350 |
+
die();
|
351 |
+
}
|
|
|
352 |
|
353 |
+
$ret = $this->check_backup_option($backup_options, 'Manual');
|
354 |
+
if($ret['result']!=WPVIVID_SUCCESS)
|
|
|
|
|
|
|
|
|
355 |
{
|
356 |
+
$this->end_shutdown_function=true;
|
357 |
+
echo json_encode($ret);
|
358 |
die();
|
359 |
}
|
360 |
|
361 |
+
$ret=$this->pre_backup($backup_options,'Manual');
|
362 |
+
if($ret['result']=='success')
|
363 |
+
{
|
364 |
+
//Check the website data to be backed up
|
365 |
+
$ret['check']=$this->check_backup($ret['task_id'],$backup_options['backup_files']);
|
366 |
+
if(isset($ret['check']['result']) && $ret['check']['result'] == WPVIVID_FAILED)
|
367 |
+
{
|
368 |
+
$this->end_shutdown_function=true;
|
369 |
+
echo json_encode(array('result' => WPVIVID_FAILED,'error' => $ret['check']['error']));
|
370 |
+
die();
|
371 |
+
}
|
372 |
+
|
373 |
+
$html = '';
|
374 |
+
$html = apply_filters('wpvivid_add_backup_list', $html);
|
375 |
+
$ret['html'] = $html;
|
376 |
+
}
|
377 |
+
$this->end_shutdown_function=true;
|
378 |
+
echo json_encode($ret);
|
379 |
+
die();
|
380 |
}
|
381 |
+
}
|
382 |
+
catch (Exception $error)
|
383 |
+
{
|
384 |
+
$this->end_shutdown_function=true;
|
385 |
+
$ret['result']='failed';
|
386 |
+
$message = 'An exception has occurred. class:'.get_class($error).';msg:'.$error->getMessage().';code:'.$error->getCode().';line:'.$error->getLine().';in_file:'.$error->getFile().';';
|
387 |
+
$ret['error'] = $message;
|
388 |
+
$id=uniqid('wpvivid-');
|
389 |
+
$log_file_name=$id.'_backup';
|
390 |
+
$log=new WPvivid_Log();
|
391 |
+
$log->CreateLogFile($log_file_name,'no_folder','backup');
|
392 |
+
$log->WriteLog($message,'notice');
|
393 |
+
WPvivid_error_log::create_error_log($log->log_file);
|
394 |
+
$log->CloseFile();
|
395 |
+
error_log($message);
|
396 |
echo json_encode($ret);
|
397 |
+
die();
|
398 |
+
}
|
399 |
+
}
|
400 |
|
401 |
+
public function deal_prepare_shutdown_error()
|
402 |
+
{
|
403 |
+
if($this->end_shutdown_function==false) {
|
404 |
+
$last_error = error_get_last();
|
405 |
+
if (!empty($last_error) && !in_array($last_error['type'], array(E_NOTICE), true)) {
|
406 |
+
$error = $last_error;
|
407 |
+
} else {
|
408 |
+
$error = false;
|
409 |
+
}
|
410 |
+
$ret['result'] = 'failed';
|
411 |
+
if ($error === false) {
|
412 |
+
$ret['error'] = 'unknown Error';
|
413 |
+
} else {
|
414 |
+
$ret['error'] = 'type: '. $error['type'] . ', ' . $error['message'] . ' file:' . $error['file'] . ' line:' . $error['line'];
|
415 |
+
error_log($ret['error']);
|
416 |
+
}
|
417 |
+
$id = uniqid('wpvivid-');
|
418 |
+
$log_file_name = $id . '_backup';
|
419 |
+
$log = new WPvivid_Log();
|
420 |
+
$log->CreateLogFile($log_file_name, 'no_folder', 'backup');
|
421 |
+
$log->WriteLog($ret['error'], 'notice');
|
422 |
+
WPvivid_error_log::create_error_log($log->log_file);
|
423 |
+
$log->CloseFile();
|
424 |
+
echo json_encode($ret);
|
425 |
die();
|
426 |
}
|
427 |
}
|
428 |
+
|
429 |
public function check_backup_option($data, $backup_method = 'Manual')
|
430 |
{
|
431 |
$ret['result']=WPVIVID_FAILED;
|
508 |
$task_id=sanitize_key($_POST['task_id']);
|
509 |
|
510 |
//Start backup site
|
511 |
+
if(WPvivid_taskmanager::is_tasks_backup_running())
|
512 |
+
{
|
513 |
+
$ret['result']='failed';
|
514 |
+
$ret['error']=__('A task is already running. Please wait until the running task is complete, and try again.', 'wpvivid');
|
515 |
+
echo json_encode($ret);
|
516 |
+
die();
|
517 |
+
}
|
518 |
+
|
519 |
$this->backup($task_id);
|
520 |
die();
|
521 |
}
|
695 |
if (isset($_POST['task_id'])&&!empty($_POST['task_id'])&&is_string($_POST['task_id']))
|
696 |
{
|
697 |
$task_id=sanitize_key($_POST['task_id']);
|
698 |
+
if(WPvivid_taskmanager::get_task($task_id)!==false)
|
699 |
+
{
|
700 |
+
$file_name=WPvivid_taskmanager::get_task_options($task_id,'file_prefix');
|
701 |
+
$backup_options=WPvivid_taskmanager::get_task_options($task_id,'backup_options');
|
702 |
+
$file=WP_CONTENT_DIR.DIRECTORY_SEPARATOR.$backup_options['dir'].DIRECTORY_SEPARATOR.$file_name.'_cancel';
|
703 |
+
touch($file);
|
704 |
+
}
|
705 |
+
|
706 |
+
$timestamp = wp_next_scheduled(WPVIVID_TASK_MONITOR_EVENT,array($task_id));
|
707 |
+
|
708 |
+
if($timestamp===false)
|
709 |
+
{
|
710 |
+
$this->add_monitor_event($task_id,10);
|
711 |
+
}
|
712 |
$json['result']='success';
|
713 |
$json['msg']=__('The backup will be canceled after backing up the current chunk ends.', 'wpvivid');
|
714 |
echo json_encode($json);
|
725 |
public function main_schedule()
|
726 |
{
|
727 |
//get backup options
|
728 |
+
$this->end_shutdown_function=false;
|
729 |
+
register_shutdown_function(array($this,'deal_prepare_shutdown_error'));
|
730 |
$schedule_options=WPvivid_Schedule::get_schedule();
|
731 |
if(empty($schedule_options))
|
732 |
{
|
733 |
+
$this->end_shutdown_function=true;
|
734 |
die();
|
735 |
}
|
736 |
+
try {
|
737 |
+
$schedule_options['backup']['local'] = strval($schedule_options['backup']['local']);
|
738 |
+
$schedule_options['backup']['remote'] = strval($schedule_options['backup']['remote']);
|
739 |
+
$schedule_options['backup']['ismerge'] = strval($schedule_options['backup']['ismerge']);
|
740 |
+
$schedule_options['backup']['lock'] = strval($schedule_options['backup']['lock']);
|
741 |
|
742 |
+
$ret = $this->check_backup_option($schedule_options['backup'], 'Cron');
|
743 |
+
if ($ret['result'] != WPVIVID_SUCCESS) {
|
744 |
+
$this->end_shutdown_function=true;
|
745 |
+
echo json_encode($ret);
|
746 |
+
die();
|
747 |
+
}
|
748 |
+
|
749 |
+
$ret = $this->pre_backup($schedule_options['backup'], 'Cron');
|
750 |
+
if ($ret['result'] == 'success') {
|
751 |
+
//Check the website data to be backed up.
|
752 |
+
$this->check_backup($ret['task_id'], $schedule_options['backup']['backup_files']);
|
753 |
+
//start backup task.
|
754 |
+
$this->backup($ret['task_id']);
|
755 |
+
}
|
756 |
+
$this->end_shutdown_function=true;
|
757 |
die();
|
758 |
}
|
759 |
+
catch (Exception $error)
|
|
|
|
|
760 |
{
|
761 |
+
$this->end_shutdown_function=true;
|
762 |
+
$ret['result']='failed';
|
763 |
+
$message = 'An exception has occurred. class:'.get_class($error).';msg:'.$error->getMessage().';code:'.$error->getCode().';line:'.$error->getLine().';in_file:'.$error->getFile().';';
|
764 |
+
$ret['error'] = $message;
|
765 |
+
$id=uniqid('wpvivid-');
|
766 |
+
$log_file_name=$id.'_backup';
|
767 |
+
$log=new WPvivid_Log();
|
768 |
+
$log->CreateLogFile($log_file_name,'no_folder','backup');
|
769 |
+
$log->WriteLog($message,'notice');
|
770 |
+
WPvivid_error_log::create_error_log($log->log_file);
|
771 |
+
$log->CloseFile();
|
772 |
+
error_log($message);
|
773 |
+
echo json_encode($ret);
|
774 |
+
die();
|
775 |
}
|
|
|
|
|
776 |
}
|
777 |
/**
|
778 |
* Resume backup schedule.
|
949 |
public function backup($task_id)
|
950 |
{
|
951 |
//register shutdown function to catch php fatal error such as script time out and memory limit
|
952 |
+
|
953 |
$this->end_shutdown_function=false;
|
954 |
register_shutdown_function(array($this,'deal_shutdown_error'),$task_id);
|
955 |
@ignore_user_abort(true);
|
1209 |
$limit=WPVIVID_MAX_EXECUTION_TIME;
|
1210 |
}
|
1211 |
|
1212 |
+
if(isset($options['max_resume_count']))
|
1213 |
+
{
|
1214 |
+
$max_resume_count=$options['max_resume_count'];
|
1215 |
+
}
|
1216 |
+
else
|
1217 |
+
{
|
1218 |
+
$max_resume_count=WPVIVID_RESUME_RETRY_TIMES;
|
1219 |
+
}
|
1220 |
$time_spend = time() - $status['timeout'];
|
1221 |
+
$time_start = time() - $status['start_time'];
|
1222 |
+
$time_min=min($limit, 300);
|
1223 |
if ($time_spend >= $limit)
|
1224 |
{
|
1225 |
//time out
|
1226 |
$status['resume_count']++;
|
1227 |
+
|
1228 |
+
if ($status['resume_count'] > $max_resume_count)
|
1229 |
{
|
1230 |
$message = __('Too many resumption attempts.', 'wpvivid');
|
1231 |
$task = WPvivid_taskmanager::update_backup_task_status($task_id, false, 'error', false, $status['resume_count'], $message);
|
1243 |
}
|
1244 |
if ($this->wpvivid_log)
|
1245 |
$this->wpvivid_log->WriteLog($message, 'error');
|
1246 |
+
}
|
1247 |
+
else if($time_start>=$time_min)
|
1248 |
+
{
|
1249 |
+
$status['resume_count']++;
|
1250 |
+
if ($status['resume_count'] > $max_resume_count)
|
1251 |
+
{
|
1252 |
+
$message = __('Too many resumption attempts.', 'wpvivid');
|
1253 |
+
if ($error !== false)
|
1254 |
+
{
|
1255 |
+
$message.= 'type: '. $error['type'] . ', ' . $error['message'] . ' file:' . $error['file'] . ' line:' . $error['line'];
|
1256 |
+
}
|
1257 |
+
$task = WPvivid_taskmanager::update_backup_task_status($task_id, false, 'error', false, $status['resume_count'], $message);
|
1258 |
+
do_action('wpvivid_handle_backup_failed', $task);
|
1259 |
+
} else {
|
1260 |
+
$this->check_cancel_backup($task_id);
|
1261 |
+
$message = 'Task timed out.(WebHosting)';
|
1262 |
+
if ($this->add_resume_event($task_id))
|
1263 |
+
{
|
1264 |
+
WPvivid_taskmanager::update_backup_task_status($task_id, false, 'wait_resume', false, $status['resume_count']);
|
1265 |
+
} else {
|
1266 |
+
$task = WPvivid_taskmanager::update_backup_task_status($task_id, false, 'error', false, $status['resume_count'], $message);
|
1267 |
+
do_action('wpvivid_handle_backup_failed', $task);
|
1268 |
+
}
|
1269 |
+
}
|
1270 |
+
if ($this->wpvivid_log)
|
1271 |
+
$this->wpvivid_log->WriteLog($message, 'error');
|
1272 |
+
}
|
1273 |
+
else
|
1274 |
+
{
|
1275 |
if ($status['str'] != 'error')
|
1276 |
{
|
1277 |
if ($error !== false)
|
1278 |
{
|
1279 |
+
$message = 'type: '. $error['type'] . ', ' . $error['message'] . ' file:' . $error['file'] . ' line:' . $error['line'];
|
1280 |
} else {
|
1281 |
+
$message = __('backup failed error unknown time spend:'.$time_start, 'wpvivid');
|
1282 |
}
|
1283 |
WPvivid_taskmanager::update_backup_task_status($task_id, false, 'error', false, $status['resume_count'], $message);
|
1284 |
}
|
1361 |
if($time_spend>=$limit)
|
1362 |
{
|
1363 |
//time out
|
1364 |
+
if(isset($options['max_resume_count']))
|
1365 |
+
{
|
1366 |
+
$max_resume_count=$options['max_resume_count'];
|
1367 |
+
}
|
1368 |
+
else
|
1369 |
+
{
|
1370 |
+
$max_resume_count=WPVIVID_RESUME_RETRY_TIMES;
|
1371 |
+
}
|
1372 |
$status['resume_count']++;
|
1373 |
+
if($status['resume_count']>$max_resume_count)
|
1374 |
{
|
1375 |
$message=__('Too many resumption attempts.', 'wpvivid');
|
1376 |
$task=WPvivid_taskmanager::update_backup_task_status($task_id,false,'error',false,$status['resume_count'],$message);
|
2575 |
$files[] = $filename;
|
2576 |
}
|
2577 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2578 |
foreach ($files as $file)
|
2579 |
{
|
2580 |
$download_path = WP_CONTENT_DIR .DIRECTORY_SEPARATOR . $download_dir . DIRECTORY_SEPARATOR . $file;
|
2940 |
$ret['memory_limit_warning']=false;
|
2941 |
}
|
2942 |
|
2943 |
+
if($ret['result'] == WPVIVID_FAILED) {
|
2944 |
+
$this->wpvivid_handle_restore_error($ret['error'], 'Init restore page');
|
2945 |
+
}
|
2946 |
+
|
2947 |
echo json_encode($ret);
|
2948 |
die();
|
2949 |
}
|
2982 |
}
|
2983 |
|
2984 |
$backup_id =sanitize_key($_POST['backup_id']);
|
2985 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
2986 |
$backup = WPvivid_Backuplist::get_backuplist_by_key($backup_id);
|
2987 |
|
2988 |
$backup_item=new WPvivid_Backup_Item($backup);
|
3062 |
{
|
3063 |
$ret['result']=WPVIVID_FAILED;
|
3064 |
$ret['error']='not found download file';
|
3065 |
+
$this->wpvivid_handle_restore_error($ret['error'], 'Downloading backup file');
|
3066 |
echo json_encode($ret);
|
3067 |
}
|
3068 |
else
|
3076 |
die();
|
3077 |
}
|
3078 |
|
3079 |
+
public function wpvivid_handle_restore_error($error_message, $error_type)
|
3080 |
+
{
|
3081 |
+
$this->restore_data=new WPvivid_restore_data();
|
3082 |
+
$this->restore_data->delete_restore_log();
|
3083 |
+
$this->restore_data->write_log($error_type, 'error');
|
3084 |
+
$this->restore_data->write_log($error_message, 'error');
|
3085 |
+
$this->restore_data->save_error_log_to_debug();
|
3086 |
+
}
|
3087 |
+
|
3088 |
+
public function wpvivid_handle_remote_storage_error($error_message, $error_type)
|
3089 |
+
{
|
3090 |
+
$id = uniqid('wpvivid-');
|
3091 |
+
$log_file_name = $id . '_add_remote';
|
3092 |
+
$log = new WPvivid_Log();
|
3093 |
+
$log->CreateLogFile($log_file_name, 'no_folder', 'Add Remote Test Connection');
|
3094 |
+
$log->WriteLog('Remote Type: '.$error_type, 'notice');
|
3095 |
+
if(isset($ret['error'])) {
|
3096 |
+
$log->WriteLog($error_message, 'notice');
|
3097 |
+
}
|
3098 |
+
WPvivid_error_log::create_error_log($log->log_file);
|
3099 |
+
$log->CloseFile();
|
3100 |
+
}
|
3101 |
+
|
3102 |
/**
|
3103 |
* Start restore
|
3104 |
*
|
3128 |
$restore_options=array();
|
3129 |
}
|
3130 |
}
|
|
|
3131 |
try
|
3132 |
{
|
3133 |
if ($this->restore_data->has_restore())
|
3358 |
{
|
3359 |
$ret['result']='success';
|
3360 |
$ret['status']= $this->restore_data->get_restore_status();
|
3361 |
+
if($ret['status'] == WPVIVID_RESTORE_ERROR){
|
3362 |
+
$this->restore_data->save_error_log_to_debug();
|
3363 |
+
}
|
3364 |
$ret['log']=$this->restore_data->get_log_content();
|
3365 |
echo json_encode($ret);
|
3366 |
die();
|
4226 |
$setting['exclude_file_size'] = intval($setting['exclude_file_size']);
|
4227 |
$setting['max_execution_time'] = intval($setting['max_execution_time']);
|
4228 |
$setting['max_backup_count'] = intval($setting['max_backup_count']);
|
4229 |
+
$setting['max_resume_count'] = intval($setting['max_resume_count']);
|
4230 |
|
4231 |
$setting_data['wpvivid_email_setting']['send_to'][] = $setting['send_to'];
|
4232 |
$setting_data['wpvivid_email_setting']['always'] = $setting['always'];
|
4246 |
$setting_data['wpvivid_common_setting']['log_save_location'] = $setting['path'].'/wpvivid_log';
|
4247 |
$setting_data['wpvivid_common_setting']['max_backup_count'] = $setting['max_backup_count'];
|
4248 |
$setting_data['wpvivid_common_setting']['show_admin_bar'] = $options['options']['wpvivid_common_setting']['show_admin_bar'];
|
4249 |
+
$setting_data['wpvivid_common_setting']['show_tab_menu'] = $setting['show_tab_menu'];
|
4250 |
+
$setting_data['wpvivid_common_setting']['domain_include'] = $setting['domain_include'];
|
4251 |
$setting_data['wpvivid_common_setting']['estimate_backup'] = $setting['estimate_backup'];
|
4252 |
+
$setting_data['wpvivid_common_setting']['max_resume_count'] = $setting['max_resume_count'];
|
4253 |
return $setting_data;
|
4254 |
}
|
4255 |
|
4275 |
echo json_encode($ret);
|
4276 |
die();
|
4277 |
}
|
4278 |
+
|
4279 |
$options=WPvivid_Setting::get_setting(true, "");
|
4280 |
$setting_data = array();
|
4281 |
$setting_data= apply_filters('wpvivid_set_general_setting',$setting_data, $setting, $options);
|
4827 |
}
|
4828 |
$ret['data']['language']=get_bloginfo('language');
|
4829 |
$ret['data']['upload_max_filesize']=ini_get("upload_max_filesize");
|
4830 |
+
|
4831 |
+
$options=WPvivid_Setting::get_option('wpvivid_common_setting');
|
4832 |
+
if(isset($options['max_execution_time']))
|
4833 |
+
{
|
4834 |
+
$limit=$options['max_execution_time'];
|
4835 |
+
}
|
4836 |
+
else
|
4837 |
+
{
|
4838 |
+
$limit=WPVIVID_MAX_EXECUTION_TIME;
|
4839 |
+
}
|
4840 |
+
ini_set('max_execution_time',$limit);
|
4841 |
+
|
4842 |
+
|
4843 |
$ret['data']['max_execution_time']=ini_get("max_execution_time");
|
4844 |
$ret['data']['max_input_vars']=ini_get("max_input_vars");
|
4845 |
$ret['data']['max_input_vars']=ini_get("max_input_vars");
|
5379 |
echo json_encode($ret);
|
5380 |
die();
|
5381 |
}
|
5382 |
+
|
5383 |
+
public function get_ini_memory_limit(){
|
5384 |
+
$this->ajax_check_security();
|
5385 |
+
$memory_limit = @ini_get('memory_limit');
|
5386 |
+
echo $memory_limit;
|
5387 |
+
die();
|
5388 |
+
}
|
5389 |
}
|
includes/customclass/class-wpvivid-dropbox.php
CHANGED
@@ -14,7 +14,7 @@ class WPvivid_Dropbox extends WPvivid_Remote {
|
|
14 |
private $options;
|
15 |
private $upload_chunk_size = 2097152;
|
16 |
private $download_chunk_size = 2097152;
|
17 |
-
private $redirect_url = 'https://auth.wpvivid.com/
|
18 |
|
19 |
public function __construct($options = array())
|
20 |
{
|
@@ -254,7 +254,9 @@ class WPvivid_Dropbox extends WPvivid_Remote {
|
|
254 |
$remote_collection[WPVIVID_REMOTE_DROPBOX] = 'WPvivid_Dropbox';
|
255 |
return $remote_collection;
|
256 |
}
|
257 |
-
|
|
|
|
|
258 |
if(isset($_GET['action']))
|
259 |
{
|
260 |
if($_GET['action'] === 'wpvivid_dropbox_auth')
|
@@ -285,15 +287,15 @@ class WPvivid_Dropbox extends WPvivid_Remote {
|
|
285 |
else if($_GET['action'] === 'wpvivid_dropbox_finish_auth')
|
286 |
{
|
287 |
try {
|
288 |
-
if (!isset($
|
289 |
header('Location: ' . admin_url() . 'admin.php?page=' . WPVIVID_PLUGIN_SLUG . '&action=wpvivid_dropbox_drive&result=error&resp_msg=' . 'Get Dropbox token failed.');
|
290 |
} else {
|
291 |
global $wpvivid_pulgin;
|
292 |
$remote_options['type'] = WPVIVID_REMOTE_DROPBOX;
|
293 |
-
$remote_options['token'] = $
|
294 |
$remote_options['name'] = $_GET['name'];
|
295 |
$remote_options['path'] = WPVIVID_DROPBOX_DEFAULT_FOLDER;
|
296 |
-
$remote_options['default'] = $_GET['
|
297 |
$ret = $wpvivid_pulgin->remote_collection->add_remote($remote_options);
|
298 |
if ($ret['result'] == 'success') {
|
299 |
header('Location: ' . admin_url() . 'admin.php?page=' . WPVIVID_PLUGIN_SLUG . '&action=wpvivid_dropbox_drive&result=success');
|
@@ -351,12 +353,12 @@ class WPvivid_Dropbox extends WPvivid_Remote {
|
|
351 |
else if($_GET['action'] === 'wpvivid_dropbox_finish_update_auth')
|
352 |
{
|
353 |
try {
|
354 |
-
if (!isset($
|
355 |
header('Location: ' . admin_url() . 'admin.php?page=' . WPVIVID_PLUGIN_SLUG . '&action=wpvivid_dropbox_drive_update&result=error&resp_msg=' . 'Get Dropbox token failed.');
|
356 |
} else {
|
357 |
global $wpvivid_pulgin;
|
358 |
$remote_options['type'] = WPVIVID_REMOTE_DROPBOX;
|
359 |
-
$remote_options['token'] = $
|
360 |
$remote_options['name'] = $_GET['name'];
|
361 |
$remote_options['path'] = WPVIVID_DROPBOX_DEFAULT_FOLDER;
|
362 |
$ret = $wpvivid_pulgin->remote_collection->update_remote($_GET['id'], $remote_options);
|
@@ -394,12 +396,16 @@ class WPvivid_Dropbox extends WPvivid_Remote {
|
|
394 |
_e('<div class="notice notice-success is-dismissible"><p>You have authenticated the Dropbox account as your remote storage.</p></div>');
|
395 |
}
|
396 |
public function wpvivid_show_notice_add_dropbox_error(){
|
|
|
|
|
397 |
_e('<div class="notice notice-error"><p>'.$_GET['resp_msg'].'</p></div>');
|
398 |
}
|
399 |
public function wpvivid_show_notice_edit_dropbox_success(){
|
400 |
_e('<div class="notice notice-success is-dismissible"><p>You have successfully updated the storage alias.</p></div>');
|
401 |
}
|
402 |
public function wpvivid_show_notice_edit_dropbox_error(){
|
|
|
|
|
403 |
_e('<div class="notice notice-error"><p>'.$_GET['resp_msg'].'</p></div>');
|
404 |
}
|
405 |
|
14 |
private $options;
|
15 |
private $upload_chunk_size = 2097152;
|
16 |
private $download_chunk_size = 2097152;
|
17 |
+
private $redirect_url = 'https://auth.wpvivid.com/dropbox_v2/';
|
18 |
|
19 |
public function __construct($options = array())
|
20 |
{
|
254 |
$remote_collection[WPVIVID_REMOTE_DROPBOX] = 'WPvivid_Dropbox';
|
255 |
return $remote_collection;
|
256 |
}
|
257 |
+
|
258 |
+
public function handle_auth_actions()
|
259 |
+
{
|
260 |
if(isset($_GET['action']))
|
261 |
{
|
262 |
if($_GET['action'] === 'wpvivid_dropbox_auth')
|
287 |
else if($_GET['action'] === 'wpvivid_dropbox_finish_auth')
|
288 |
{
|
289 |
try {
|
290 |
+
if (!isset($_POST['code'])) {
|
291 |
header('Location: ' . admin_url() . 'admin.php?page=' . WPVIVID_PLUGIN_SLUG . '&action=wpvivid_dropbox_drive&result=error&resp_msg=' . 'Get Dropbox token failed.');
|
292 |
} else {
|
293 |
global $wpvivid_pulgin;
|
294 |
$remote_options['type'] = WPVIVID_REMOTE_DROPBOX;
|
295 |
+
$remote_options['token'] = $_POST['code'];
|
296 |
$remote_options['name'] = $_GET['name'];
|
297 |
$remote_options['path'] = WPVIVID_DROPBOX_DEFAULT_FOLDER;
|
298 |
+
$remote_options['default'] = $_GET['default'];
|
299 |
$ret = $wpvivid_pulgin->remote_collection->add_remote($remote_options);
|
300 |
if ($ret['result'] == 'success') {
|
301 |
header('Location: ' . admin_url() . 'admin.php?page=' . WPVIVID_PLUGIN_SLUG . '&action=wpvivid_dropbox_drive&result=success');
|
353 |
else if($_GET['action'] === 'wpvivid_dropbox_finish_update_auth')
|
354 |
{
|
355 |
try {
|
356 |
+
if (!isset($_POST['code'])) {
|
357 |
header('Location: ' . admin_url() . 'admin.php?page=' . WPVIVID_PLUGIN_SLUG . '&action=wpvivid_dropbox_drive_update&result=error&resp_msg=' . 'Get Dropbox token failed.');
|
358 |
} else {
|
359 |
global $wpvivid_pulgin;
|
360 |
$remote_options['type'] = WPVIVID_REMOTE_DROPBOX;
|
361 |
+
$remote_options['token'] = $_POST['code'];
|
362 |
$remote_options['name'] = $_GET['name'];
|
363 |
$remote_options['path'] = WPVIVID_DROPBOX_DEFAULT_FOLDER;
|
364 |
$ret = $wpvivid_pulgin->remote_collection->update_remote($_GET['id'], $remote_options);
|
396 |
_e('<div class="notice notice-success is-dismissible"><p>You have authenticated the Dropbox account as your remote storage.</p></div>');
|
397 |
}
|
398 |
public function wpvivid_show_notice_add_dropbox_error(){
|
399 |
+
global $wpvivid_pulgin;
|
400 |
+
$wpvivid_pulgin->wpvivid_handle_remote_storage_error($_GET['resp_msg'], 'Add Dropbox Remote');
|
401 |
_e('<div class="notice notice-error"><p>'.$_GET['resp_msg'].'</p></div>');
|
402 |
}
|
403 |
public function wpvivid_show_notice_edit_dropbox_success(){
|
404 |
_e('<div class="notice notice-success is-dismissible"><p>You have successfully updated the storage alias.</p></div>');
|
405 |
}
|
406 |
public function wpvivid_show_notice_edit_dropbox_error(){
|
407 |
+
global $wpvivid_pulgin;
|
408 |
+
$wpvivid_pulgin->wpvivid_handle_remote_storage_error($_GET['resp_msg'], 'Update Dropbox Remote');
|
409 |
_e('<div class="notice notice-error"><p>'.$_GET['resp_msg'].'</p></div>');
|
410 |
}
|
411 |
|
includes/customclass/class-wpvivid-google-drive.php
CHANGED
@@ -47,7 +47,7 @@ class Wpvivid_Google_drive extends WPvivid_Remote
|
|
47 |
"token_uri"=>"https://oauth2.googleapis.com/token",
|
48 |
"auth_provider_x509_cert_url"=>"https://www.googleapis.com/oauth2/v1/certs",
|
49 |
"client_secret"=>"GmD5Kmg_1fTcf0ciNEomposy",
|
50 |
-
"redirect_uris"=>array("https://auth.wpvivid.com/
|
51 |
));
|
52 |
}
|
53 |
|
@@ -127,9 +127,12 @@ class Wpvivid_Google_drive extends WPvivid_Remote
|
|
127 |
global $wpvivid_pulgin;
|
128 |
|
129 |
$remote_options['type'] = WPVIVID_REMOTE_GOOGLEDRIVE;
|
130 |
-
$token = $
|
131 |
-
$token =
|
132 |
-
$remote_options['token'] =
|
|
|
|
|
|
|
133 |
$remote_options['name'] = $_GET['name'];
|
134 |
$remote_options['default'] = $_GET['default'];
|
135 |
$remote_options['path'] = WPVIVID_GOOGLEDRIVE_DEFAULT_FOLDER;
|
@@ -220,9 +223,12 @@ class Wpvivid_Google_drive extends WPvivid_Remote
|
|
220 |
global $wpvivid_pulgin;
|
221 |
|
222 |
$remote_options['type'] = WPVIVID_REMOTE_GOOGLEDRIVE;
|
223 |
-
$token = $
|
224 |
-
$token =
|
225 |
-
$remote_options['token'] =
|
|
|
|
|
|
|
226 |
$remote_options['name'] = $_GET['name'];
|
227 |
$remote_options['path'] = WPVIVID_GOOGLEDRIVE_DEFAULT_FOLDER;
|
228 |
$ret = $wpvivid_pulgin->remote_collection->update_remote($_GET['id'], $remote_options);
|
@@ -260,12 +266,16 @@ class Wpvivid_Google_drive extends WPvivid_Remote
|
|
260 |
_e('<div class="notice notice-success is-dismissible"><p>You have authenticated the Google Drive account as your remote storage.</p></div>');
|
261 |
}
|
262 |
public function wpvivid_show_notice_add_google_drive_error(){
|
|
|
|
|
263 |
_e('<div class="notice notice-error"><p>'.$_GET['resp_msg'].'</p></div>');
|
264 |
}
|
265 |
public function wpvivid_show_notice_edit_google_drive_success(){
|
266 |
_e('<div class="notice notice-success is-dismissible"><p>You have successfully updated the storage alias.</p></div>');
|
267 |
}
|
268 |
public function wpvivid_show_notice_edit_google_drive_error(){
|
|
|
|
|
269 |
_e('<div class="notice notice-error"><p>'.$_GET['resp_msg'].'</p></div>');
|
270 |
}
|
271 |
|
47 |
"token_uri"=>"https://oauth2.googleapis.com/token",
|
48 |
"auth_provider_x509_cert_url"=>"https://www.googleapis.com/oauth2/v1/certs",
|
49 |
"client_secret"=>"GmD5Kmg_1fTcf0ciNEomposy",
|
50 |
+
"redirect_uris"=>array("https://auth.wpvivid.com/google_drive_v2/")
|
51 |
));
|
52 |
}
|
53 |
|
127 |
global $wpvivid_pulgin;
|
128 |
|
129 |
$remote_options['type'] = WPVIVID_REMOTE_GOOGLEDRIVE;
|
130 |
+
$remote_options['token']['access_token'] = $_POST['access_token'];
|
131 |
+
$remote_options['token']['expires_in'] = $_POST['expires_in'];
|
132 |
+
$remote_options['token']['refresh_token'] = $_POST['refresh_token'];
|
133 |
+
$remote_options['token']['scope'] = $_POST['scope'];
|
134 |
+
$remote_options['token']['token_type'] = $_POST['token_type'];
|
135 |
+
$remote_options['token']['created'] = $_POST['created'];
|
136 |
$remote_options['name'] = $_GET['name'];
|
137 |
$remote_options['default'] = $_GET['default'];
|
138 |
$remote_options['path'] = WPVIVID_GOOGLEDRIVE_DEFAULT_FOLDER;
|
223 |
global $wpvivid_pulgin;
|
224 |
|
225 |
$remote_options['type'] = WPVIVID_REMOTE_GOOGLEDRIVE;
|
226 |
+
$remote_options['token']['access_token'] = $_POST['access_token'];
|
227 |
+
$remote_options['token']['expires_in'] = $_POST['expires_in'];
|
228 |
+
$remote_options['token']['refresh_token'] = $_POST['refresh_token'];
|
229 |
+
$remote_options['token']['scope'] = $_POST['scope'];
|
230 |
+
$remote_options['token']['token_type'] = $_POST['token_type'];
|
231 |
+
$remote_options['token']['created'] = $_POST['created'];
|
232 |
$remote_options['name'] = $_GET['name'];
|
233 |
$remote_options['path'] = WPVIVID_GOOGLEDRIVE_DEFAULT_FOLDER;
|
234 |
$ret = $wpvivid_pulgin->remote_collection->update_remote($_GET['id'], $remote_options);
|
266 |
_e('<div class="notice notice-success is-dismissible"><p>You have authenticated the Google Drive account as your remote storage.</p></div>');
|
267 |
}
|
268 |
public function wpvivid_show_notice_add_google_drive_error(){
|
269 |
+
global $wpvivid_pulgin;
|
270 |
+
$wpvivid_pulgin->wpvivid_handle_remote_storage_error($_GET['resp_msg'], 'Add Google Drive Remote');
|
271 |
_e('<div class="notice notice-error"><p>'.$_GET['resp_msg'].'</p></div>');
|
272 |
}
|
273 |
public function wpvivid_show_notice_edit_google_drive_success(){
|
274 |
_e('<div class="notice notice-success is-dismissible"><p>You have successfully updated the storage alias.</p></div>');
|
275 |
}
|
276 |
public function wpvivid_show_notice_edit_google_drive_error(){
|
277 |
+
global $wpvivid_pulgin;
|
278 |
+
$wpvivid_pulgin->wpvivid_handle_remote_storage_error($_GET['resp_msg'], 'Update Google Drive Remote');
|
279 |
_e('<div class="notice notice-error"><p>'.$_GET['resp_msg'].'</p></div>');
|
280 |
}
|
281 |
|
includes/customclass/class-wpvivid-one-drive.php
CHANGED
@@ -82,7 +82,7 @@ class WPvivid_one_drive extends WPvivid_Remote
|
|
82 |
. '?client_id=' . urlencode('37668be9-b55f-458f-b6a3-97e6f8aa10c9')
|
83 |
. '&scope=' . urlencode('offline_access files.readwrite')
|
84 |
. '&response_type=code'
|
85 |
-
. '&redirect_uri=' . urlencode('https://auth.wpvivid.com/
|
86 |
. '&state=' . urlencode(admin_url() . 'admin.php?page=WPvivid' . '&action=wpvivid_one_drive_finish_auth&name=' . $_GET['name'] . '&default=' . $_GET['default'])
|
87 |
. '&display=popup'
|
88 |
. '&locale=en';
|
@@ -94,22 +94,27 @@ class WPvivid_one_drive extends WPvivid_Remote
|
|
94 |
}
|
95 |
else if($_GET['action']=='wpvivid_one_drive_finish_auth')
|
96 |
{
|
97 |
-
try
|
98 |
-
|
|
|
|
|
99 |
$error = urldecode($_GET['auth_error']);
|
100 |
header('Location: ' . admin_url() . 'admin.php?page=' . WPVIVID_PLUGIN_SLUG . '&action=wpvivid_one_drive&result=error&resp_msg=' . $error);
|
101 |
-
|
102 |
return;
|
103 |
}
|
104 |
|
105 |
global $wpvivid_pulgin;
|
106 |
|
107 |
$remote_options['type'] = WPVIVID_REMOTE_ONEDRIVE;
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
//
|
|
|
|
|
|
|
|
|
113 |
$remote_options['name'] = $_GET['name'];
|
114 |
$remote_options['default'] = $_GET['default'];
|
115 |
$remote_options['path'] = WPVIVID_ONEDRIVE_DEFAULT_FOLDER;
|
@@ -164,7 +169,7 @@ class WPvivid_one_drive extends WPvivid_Remote
|
|
164 |
. '?client_id=' . urlencode('37668be9-b55f-458f-b6a3-97e6f8aa10c9')
|
165 |
. '&scope=' . urlencode('offline_access files.readwrite')
|
166 |
. '&response_type=code'
|
167 |
-
. '&redirect_uri=' . urlencode('https://auth.wpvivid.com/
|
168 |
. '&state=' . urlencode(admin_url() . 'admin.php?page=WPvivid' . '&action=wpvivid_one_drive_update_finish_auth&name=' . $_GET['name'] . '&id=' . $_GET['id'])
|
169 |
. '&display=popup'
|
170 |
. '&locale=en';
|
@@ -187,11 +192,14 @@ class WPvivid_one_drive extends WPvivid_Remote
|
|
187 |
global $wpvivid_pulgin;
|
188 |
|
189 |
$remote_options['type'] = WPVIVID_REMOTE_ONEDRIVE;
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
//
|
|
|
|
|
|
|
195 |
$remote_options['name'] = $_GET['name'];
|
196 |
$remote_options['path'] = WPVIVID_ONEDRIVE_DEFAULT_FOLDER;
|
197 |
$ret = $wpvivid_pulgin->remote_collection->update_remote($_GET['id'], $remote_options);
|
@@ -229,12 +237,16 @@ class WPvivid_one_drive extends WPvivid_Remote
|
|
229 |
_e('<div class="notice notice-success is-dismissible"><p>You have authenticated the Microsoft OneDrive account as your remote storage.</p></div>');
|
230 |
}
|
231 |
public function wpvivid_show_notice_add_onedrive_error(){
|
|
|
|
|
232 |
_e('<div class="notice notice-error"><p>'.$_GET['resp_msg'].'</p></div>');
|
233 |
}
|
234 |
public function wpvivid_show_notice_edit_onedrive_success(){
|
235 |
_e('<div class="notice notice-success is-dismissible"><p>You have successfully updated the storage alias.</p></div>');
|
236 |
}
|
237 |
public function wpvivid_show_notice_edit_onedrive_error(){
|
|
|
|
|
238 |
_e('<div class="notice notice-error"><p>'.$_GET['resp_msg'].'</p></div>');
|
239 |
}
|
240 |
|
@@ -581,7 +593,7 @@ class WPvivid_one_drive extends WPvivid_Remote
|
|
581 |
$args['method']='POST';
|
582 |
$args['wpvivid_refresh_token']=1;
|
583 |
$args['body']=array( 'wpvivid_refresh_token' => '1', 'refresh_token' => $this->options['token']['refresh_token']);
|
584 |
-
$response=wp_remote_post('https://auth.wpvivid.com/
|
585 |
if(!is_wp_error($response) && ($response['response']['code'] == 200))
|
586 |
{
|
587 |
$json =stripslashes($response['body']);
|
82 |
. '?client_id=' . urlencode('37668be9-b55f-458f-b6a3-97e6f8aa10c9')
|
83 |
. '&scope=' . urlencode('offline_access files.readwrite')
|
84 |
. '&response_type=code'
|
85 |
+
. '&redirect_uri=' . urlencode('https://auth.wpvivid.com/onedrive_v2/')
|
86 |
. '&state=' . urlencode(admin_url() . 'admin.php?page=WPvivid' . '&action=wpvivid_one_drive_finish_auth&name=' . $_GET['name'] . '&default=' . $_GET['default'])
|
87 |
. '&display=popup'
|
88 |
. '&locale=en';
|
94 |
}
|
95 |
else if($_GET['action']=='wpvivid_one_drive_finish_auth')
|
96 |
{
|
97 |
+
try
|
98 |
+
{
|
99 |
+
if (isset($_GET['auth_error']))
|
100 |
+
{
|
101 |
$error = urldecode($_GET['auth_error']);
|
102 |
header('Location: ' . admin_url() . 'admin.php?page=' . WPVIVID_PLUGIN_SLUG . '&action=wpvivid_one_drive&result=error&resp_msg=' . $error);
|
|
|
103 |
return;
|
104 |
}
|
105 |
|
106 |
global $wpvivid_pulgin;
|
107 |
|
108 |
$remote_options['type'] = WPVIVID_REMOTE_ONEDRIVE;
|
109 |
+
//$token = $_POST['token'];
|
110 |
+
//$token = stripslashes($token);
|
111 |
+
//$remote_options['token'] = json_decode($token, 1);
|
112 |
+
//$remote_options['token']['expires'] = time() + $remote_options['token']['expires_in'];
|
113 |
//
|
114 |
+
$remote_options['token']['access_token']=$_POST['access_token'];
|
115 |
+
$remote_options['token']['refresh_token']=$_POST['refresh_token'];
|
116 |
+
$remote_options['token']['expires']=time()+$_POST['expires_in'];
|
117 |
+
|
118 |
$remote_options['name'] = $_GET['name'];
|
119 |
$remote_options['default'] = $_GET['default'];
|
120 |
$remote_options['path'] = WPVIVID_ONEDRIVE_DEFAULT_FOLDER;
|
169 |
. '?client_id=' . urlencode('37668be9-b55f-458f-b6a3-97e6f8aa10c9')
|
170 |
. '&scope=' . urlencode('offline_access files.readwrite')
|
171 |
. '&response_type=code'
|
172 |
+
. '&redirect_uri=' . urlencode('https://auth.wpvivid.com/onedrive_v2/')
|
173 |
. '&state=' . urlencode(admin_url() . 'admin.php?page=WPvivid' . '&action=wpvivid_one_drive_update_finish_auth&name=' . $_GET['name'] . '&id=' . $_GET['id'])
|
174 |
. '&display=popup'
|
175 |
. '&locale=en';
|
192 |
global $wpvivid_pulgin;
|
193 |
|
194 |
$remote_options['type'] = WPVIVID_REMOTE_ONEDRIVE;
|
195 |
+
//$token = $_GET['token'];
|
196 |
+
//$token = stripslashes($token);
|
197 |
+
//$remote_options['token'] = json_decode($token, 1);
|
198 |
+
//$remote_options['token']['expires'] = time() + $remote_options['token']['expires_in'];
|
199 |
//
|
200 |
+
$remote_options['token']['access_token']=$_POST['access_token'];
|
201 |
+
$remote_options['token']['refresh_token']=$_POST['refresh_token'];
|
202 |
+
$remote_options['token']['expires']=time()+$_POST['expires_in'];
|
203 |
$remote_options['name'] = $_GET['name'];
|
204 |
$remote_options['path'] = WPVIVID_ONEDRIVE_DEFAULT_FOLDER;
|
205 |
$ret = $wpvivid_pulgin->remote_collection->update_remote($_GET['id'], $remote_options);
|
237 |
_e('<div class="notice notice-success is-dismissible"><p>You have authenticated the Microsoft OneDrive account as your remote storage.</p></div>');
|
238 |
}
|
239 |
public function wpvivid_show_notice_add_onedrive_error(){
|
240 |
+
global $wpvivid_pulgin;
|
241 |
+
$wpvivid_pulgin->wpvivid_handle_remote_storage_error($_GET['resp_msg'], 'Add OneDrive Remote');
|
242 |
_e('<div class="notice notice-error"><p>'.$_GET['resp_msg'].'</p></div>');
|
243 |
}
|
244 |
public function wpvivid_show_notice_edit_onedrive_success(){
|
245 |
_e('<div class="notice notice-success is-dismissible"><p>You have successfully updated the storage alias.</p></div>');
|
246 |
}
|
247 |
public function wpvivid_show_notice_edit_onedrive_error(){
|
248 |
+
global $wpvivid_pulgin;
|
249 |
+
$wpvivid_pulgin->wpvivid_handle_remote_storage_error($_GET['resp_msg'], 'Update OneDrive Remote');
|
250 |
_e('<div class="notice notice-error"><p>'.$_GET['resp_msg'].'</p></div>');
|
251 |
}
|
252 |
|
593 |
$args['method']='POST';
|
594 |
$args['wpvivid_refresh_token']=1;
|
595 |
$args['body']=array( 'wpvivid_refresh_token' => '1', 'refresh_token' => $this->options['token']['refresh_token']);
|
596 |
+
$response=wp_remote_post('https://auth.wpvivid.com/onedrive_v2/',$args);
|
597 |
if(!is_wp_error($response) && ($response['response']['code'] == 200))
|
598 |
{
|
599 |
$json =stripslashes($response['body']);
|
includes/customclass/class-wpvivid-send-to-site.php
CHANGED
@@ -20,14 +20,16 @@ class WPvivid_Send_to_site extends WPvivid_Remote
|
|
20 |
{
|
21 |
if(!defined('WPVIVID_INIT_SEND_TO_SITE'))
|
22 |
{
|
23 |
-
add_action('
|
24 |
-
|
25 |
-
add_action('
|
26 |
-
add_action('
|
27 |
-
add_action('
|
28 |
-
add_action('
|
29 |
-
add_action('
|
30 |
-
add_action('
|
|
|
|
|
31 |
//add_filter('wpvivid_remote_register', array($this, 'init_remotes'),11);
|
32 |
|
33 |
define('WPVIVID_INIT_SEND_TO_SITE',1);
|
@@ -39,6 +41,31 @@ class WPvivid_Send_to_site extends WPvivid_Remote
|
|
39 |
}
|
40 |
}
|
41 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
42 |
public function init_remotes($remote_collection)
|
43 |
{
|
44 |
$remote_collection[WPVIVID_REMOTE_SEND_TO_SITE] = 'WPvivid_Send_to_site';
|
@@ -52,7 +79,7 @@ class WPvivid_Send_to_site extends WPvivid_Remote
|
|
52 |
|
53 |
public function upload($task_id, $files, $callback = '')
|
54 |
{
|
55 |
-
include_once WPVIVID_PLUGIN_DIR . '/
|
56 |
|
57 |
global $wpvivid_pulgin;
|
58 |
$wpvivid_pulgin->wpvivid_log->WriteLog('Connect site ','notice');
|
@@ -222,8 +249,9 @@ class WPvivid_Send_to_site extends WPvivid_Remote
|
|
222 |
$data=$crypt->encrypt_message($json);
|
223 |
|
224 |
$data=base64_encode($data);
|
225 |
-
|
226 |
-
$args['
|
|
|
227 |
$args['timeout']=30;
|
228 |
$response=wp_remote_post($this->options['url'],$args);
|
229 |
|
@@ -297,7 +325,9 @@ class WPvivid_Send_to_site extends WPvivid_Remote
|
|
297 |
|
298 |
$data=base64_encode($data);
|
299 |
|
300 |
-
$
|
|
|
|
|
301 |
$args['timeout']=30;
|
302 |
|
303 |
global $wpvivid_pulgin;
|
@@ -344,8 +374,9 @@ class WPvivid_Send_to_site extends WPvivid_Remote
|
|
344 |
$data=$crypt->encrypt_message($json);
|
345 |
|
346 |
$data=base64_encode($data);
|
347 |
-
|
348 |
-
$args['
|
|
|
349 |
$args['timeout']=30;
|
350 |
$response=wp_remote_post($this->options['url'],$args);
|
351 |
|
@@ -372,8 +403,8 @@ class WPvivid_Send_to_site extends WPvivid_Remote
|
|
372 |
|
373 |
public function send_to_site_connect()
|
374 |
{
|
375 |
-
include_once WPVIVID_PLUGIN_DIR . '/
|
376 |
-
if(isset($_POST['
|
377 |
{
|
378 |
$default=array();
|
379 |
$option=get_option('wpvivid_api_token',$default);
|
@@ -387,7 +418,7 @@ class WPvivid_Send_to_site extends WPvivid_Remote
|
|
387 |
}
|
388 |
|
389 |
$crypt=new WPvivid_crypt(base64_decode($option['private_key']));
|
390 |
-
$body=base64_decode($_POST['
|
391 |
$data=$crypt->decrypt_message($body);
|
392 |
if (!is_string($data))
|
393 |
{
|
@@ -445,8 +476,8 @@ class WPvivid_Send_to_site extends WPvivid_Remote
|
|
445 |
|
446 |
public function send_to_site()
|
447 |
{
|
448 |
-
include_once WPVIVID_PLUGIN_DIR . '/
|
449 |
-
if(isset($_POST['
|
450 |
{
|
451 |
global $wpvivid_pulgin;
|
452 |
$wpvivid_pulgin->wpvivid_log=new WPvivid_Log();
|
@@ -462,7 +493,7 @@ class WPvivid_Send_to_site extends WPvivid_Remote
|
|
462 |
die();
|
463 |
}
|
464 |
$crypt=new WPvivid_crypt(base64_decode($option['private_key']));
|
465 |
-
$body=base64_decode($_POST['
|
466 |
$data=$crypt->decrypt_message($body);
|
467 |
if (!is_string($data))
|
468 |
{
|
@@ -546,8 +577,8 @@ class WPvivid_Send_to_site extends WPvivid_Remote
|
|
546 |
|
547 |
public function send_to_site_finish()
|
548 |
{
|
549 |
-
include_once WPVIVID_PLUGIN_DIR . '/
|
550 |
-
if(isset($_POST['
|
551 |
{
|
552 |
$default=array();
|
553 |
$option=get_option('wpvivid_api_token',$default);
|
@@ -561,7 +592,7 @@ class WPvivid_Send_to_site extends WPvivid_Remote
|
|
561 |
}
|
562 |
|
563 |
$crypt=new WPvivid_crypt(base64_decode($option['private_key']));
|
564 |
-
$body=base64_decode($_POST['
|
565 |
$data=$crypt->decrypt_message($body);
|
566 |
if (!is_string($data))
|
567 |
{
|
@@ -621,10 +652,10 @@ class WPvivid_Send_to_site extends WPvivid_Remote
|
|
621 |
$json=json_encode($json);
|
622 |
$crypt=new WPvivid_crypt(base64_decode($this->options['token']));
|
623 |
$data=$crypt->encrypt_message($json);
|
624 |
-
|
625 |
$data=base64_encode($data);
|
626 |
-
|
627 |
-
$args['
|
|
|
628 |
$args['timeout']=30;
|
629 |
$response=wp_remote_post($this->options['url'],$args);
|
630 |
|
@@ -665,14 +696,13 @@ class WPvivid_Send_to_site extends WPvivid_Remote
|
|
665 |
$ret['error']= 'Upload error '.$response['response']['code'].' '.$response['body'];
|
666 |
}
|
667 |
}
|
668 |
-
|
669 |
return $ret;
|
670 |
}
|
671 |
|
672 |
public function send_to_site_file_status()
|
673 |
{
|
674 |
-
include_once WPVIVID_PLUGIN_DIR . '/
|
675 |
-
if(isset($_POST['
|
676 |
{
|
677 |
$default=array();
|
678 |
$option=get_option('wpvivid_api_token',$default);
|
@@ -686,7 +716,7 @@ class WPvivid_Send_to_site extends WPvivid_Remote
|
|
686 |
}
|
687 |
|
688 |
$crypt=new WPvivid_crypt(base64_decode($option['private_key']));
|
689 |
-
$body=base64_decode($_POST['
|
690 |
$data=$crypt->decrypt_message($body);
|
691 |
if (!is_string($data))
|
692 |
{
|
@@ -715,9 +745,7 @@ class WPvivid_Send_to_site extends WPvivid_Remote
|
|
715 |
$file_path=WP_CONTENT_DIR.DIRECTORY_SEPARATOR.$dir.DIRECTORY_SEPARATOR.$params['name'];
|
716 |
$rename=false;
|
717 |
}
|
718 |
-
|
719 |
-
$offset=filesize($file_path);
|
720 |
-
|
721 |
if(!$offset)
|
722 |
{
|
723 |
$ret['result']=WPVIVID_SUCCESS;
|
20 |
{
|
21 |
if(!defined('WPVIVID_INIT_SEND_TO_SITE'))
|
22 |
{
|
23 |
+
add_action('plugins_loaded', array($this, 'plugins_loaded'));
|
24 |
+
|
25 |
+
//add_action('wp_ajax_wpvivid_send_to_site_connect',array( $this,'send_to_site_connect'));
|
26 |
+
//add_action('wp_ajax_nopriv_wpvivid_send_to_site_finish',array( $this,'send_to_site_finish'));
|
27 |
+
//add_action('wp_ajax_wpvivid_send_to_site_finish',array( $this,'send_to_site_finish'));
|
28 |
+
//add_action('wp_ajax_nopriv_wpvivid_send_to_site_connect',array( $this,'send_to_site_connect'));
|
29 |
+
//add_action('wp_ajax_nopriv_wpvivid_send_to_site',array( $this,'send_to_site'));
|
30 |
+
//add_action('wp_ajax_wpvivid_send_to_site',array( $this,'send_to_site'));
|
31 |
+
//add_action('wp_ajax_nopriv_wpvivid_send_to_site_file_status',array( $this,'send_to_site_file_status'));
|
32 |
+
//add_action('wp_ajax_wpvivid_send_to_site_file_status',array( $this,'send_to_site_file_status'));
|
33 |
//add_filter('wpvivid_remote_register', array($this, 'init_remotes'),11);
|
34 |
|
35 |
define('WPVIVID_INIT_SEND_TO_SITE',1);
|
41 |
}
|
42 |
}
|
43 |
|
44 |
+
public function plugins_loaded()
|
45 |
+
{
|
46 |
+
if (!empty($_POST) &&isset($_POST['wpvivid_action']))
|
47 |
+
{
|
48 |
+
@ini_set( 'display_errors', 0 );
|
49 |
+
if($_POST['wpvivid_action']=='send_to_site_connect')
|
50 |
+
{
|
51 |
+
$this->send_to_site_connect();
|
52 |
+
}
|
53 |
+
else if($_POST['wpvivid_action']=='send_to_site_finish')
|
54 |
+
{
|
55 |
+
$this->send_to_site_finish();
|
56 |
+
}
|
57 |
+
else if($_POST['wpvivid_action']=='send_to_site')
|
58 |
+
{
|
59 |
+
$this->send_to_site();
|
60 |
+
}
|
61 |
+
else if($_POST['wpvivid_action']=='send_to_site_file_status')
|
62 |
+
{
|
63 |
+
$this->send_to_site_file_status();
|
64 |
+
}
|
65 |
+
die();
|
66 |
+
}
|
67 |
+
}
|
68 |
+
|
69 |
public function init_remotes($remote_collection)
|
70 |
{
|
71 |
$remote_collection[WPVIVID_REMOTE_SEND_TO_SITE] = 'WPvivid_Send_to_site';
|
79 |
|
80 |
public function upload($task_id, $files, $callback = '')
|
81 |
{
|
82 |
+
include_once WPVIVID_PLUGIN_DIR . '/includes/class-wpvivid-crypt.php';
|
83 |
|
84 |
global $wpvivid_pulgin;
|
85 |
$wpvivid_pulgin->wpvivid_log->WriteLog('Connect site ','notice');
|
249 |
$data=$crypt->encrypt_message($json);
|
250 |
|
251 |
$data=base64_encode($data);
|
252 |
+
global $wp_version;
|
253 |
+
$args['user-agent'] ='WordPress/' . $wp_version . '; ' . get_bloginfo('url');
|
254 |
+
$args['body']=array('wpvivid_content'=>$data,'wpvivid_action'=>'send_to_site_connect');
|
255 |
$args['timeout']=30;
|
256 |
$response=wp_remote_post($this->options['url'],$args);
|
257 |
|
325 |
|
326 |
$data=base64_encode($data);
|
327 |
|
328 |
+
global $wp_version;
|
329 |
+
$args['user-agent'] ='WordPress/' . $wp_version . '; ' . get_bloginfo('url');
|
330 |
+
$args['body']=array('wpvivid_content'=>$data,'wpvivid_action'=>'send_to_site');
|
331 |
$args['timeout']=30;
|
332 |
|
333 |
global $wpvivid_pulgin;
|
374 |
$data=$crypt->encrypt_message($json);
|
375 |
|
376 |
$data=base64_encode($data);
|
377 |
+
global $wp_version;
|
378 |
+
$args['user-agent'] ='WordPress/' . $wp_version . '; ' . get_bloginfo('url');
|
379 |
+
$args['body']=array('wpvivid_content'=>$data,'wpvivid_action'=>'send_to_site_finish');
|
380 |
$args['timeout']=30;
|
381 |
$response=wp_remote_post($this->options['url'],$args);
|
382 |
|
403 |
|
404 |
public function send_to_site_connect()
|
405 |
{
|
406 |
+
include_once WPVIVID_PLUGIN_DIR . '/includes/class-wpvivid-crypt.php';
|
407 |
+
if(isset($_POST['wpvivid_content']))
|
408 |
{
|
409 |
$default=array();
|
410 |
$option=get_option('wpvivid_api_token',$default);
|
418 |
}
|
419 |
|
420 |
$crypt=new WPvivid_crypt(base64_decode($option['private_key']));
|
421 |
+
$body=base64_decode($_POST['wpvivid_content']);
|
422 |
$data=$crypt->decrypt_message($body);
|
423 |
if (!is_string($data))
|
424 |
{
|
476 |
|
477 |
public function send_to_site()
|
478 |
{
|
479 |
+
include_once WPVIVID_PLUGIN_DIR . '/includes/class-wpvivid-crypt.php';
|
480 |
+
if(isset($_POST['wpvivid_content']))
|
481 |
{
|
482 |
global $wpvivid_pulgin;
|
483 |
$wpvivid_pulgin->wpvivid_log=new WPvivid_Log();
|
493 |
die();
|
494 |
}
|
495 |
$crypt=new WPvivid_crypt(base64_decode($option['private_key']));
|
496 |
+
$body=base64_decode($_POST['wpvivid_content']);
|
497 |
$data=$crypt->decrypt_message($body);
|
498 |
if (!is_string($data))
|
499 |
{
|
577 |
|
578 |
public function send_to_site_finish()
|
579 |
{
|
580 |
+
include_once WPVIVID_PLUGIN_DIR . '/includes/class-wpvivid-crypt.php';
|
581 |
+
if(isset($_POST['wpvivid_content']))
|
582 |
{
|
583 |
$default=array();
|
584 |
$option=get_option('wpvivid_api_token',$default);
|
592 |
}
|
593 |
|
594 |
$crypt=new WPvivid_crypt(base64_decode($option['private_key']));
|
595 |
+
$body=base64_decode($_POST['wpvivid_content']);
|
596 |
$data=$crypt->decrypt_message($body);
|
597 |
if (!is_string($data))
|
598 |
{
|
652 |
$json=json_encode($json);
|
653 |
$crypt=new WPvivid_crypt(base64_decode($this->options['token']));
|
654 |
$data=$crypt->encrypt_message($json);
|
|
|
655 |
$data=base64_encode($data);
|
656 |
+
global $wp_version;
|
657 |
+
$args['user-agent'] ='WordPress/' . $wp_version . '; ' . get_bloginfo('url');
|
658 |
+
$args['body']=array('wpvivid_content'=>$data,'wpvivid_action'=>'send_to_site_file_status');
|
659 |
$args['timeout']=30;
|
660 |
$response=wp_remote_post($this->options['url'],$args);
|
661 |
|
696 |
$ret['error']= 'Upload error '.$response['response']['code'].' '.$response['body'];
|
697 |
}
|
698 |
}
|
|
|
699 |
return $ret;
|
700 |
}
|
701 |
|
702 |
public function send_to_site_file_status()
|
703 |
{
|
704 |
+
include_once WPVIVID_PLUGIN_DIR . '/includes/class-wpvivid-crypt.php';
|
705 |
+
if(isset($_POST['wpvivid_content']))
|
706 |
{
|
707 |
$default=array();
|
708 |
$option=get_option('wpvivid_api_token',$default);
|
716 |
}
|
717 |
|
718 |
$crypt=new WPvivid_crypt(base64_decode($option['private_key']));
|
719 |
+
$body=base64_decode($_POST['wpvivid_content']);
|
720 |
$data=$crypt->decrypt_message($body);
|
721 |
if (!is_string($data))
|
722 |
{
|
745 |
$file_path=WP_CONTENT_DIR.DIRECTORY_SEPARATOR.$dir.DIRECTORY_SEPARATOR.$params['name'];
|
746 |
$rename=false;
|
747 |
}
|
748 |
+
$offset = filesize($file_path);
|
|
|
|
|
749 |
if(!$offset)
|
750 |
{
|
751 |
$ret['result']=WPVIVID_SUCCESS;
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Tags: transfer, move, duplicate, clone, backup, migrate, restore, auto backup, c
|
|
4 |
Requires at least: 4.5
|
5 |
Tested up to: 5.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 |
|
@@ -144,6 +144,16 @@ Please try to contact your web hosting provider for changing PHP memory limit, o
|
|
144 |
Feel free to let us know how we can help using the [support forum](https://wordpress.org/support/plugin/wpvivid-backuprestore) for the plugin on WordPress.org or our [contact form](https://wpvivid.com/contact-us). You can also reach us with a direct message on [Twitter](https://twitter.com/WPvividcom).
|
145 |
|
146 |
== Changelog ==
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
147 |
= 0.9.17 =
|
148 |
- Added a sole tab for backup schedules.
|
149 |
- Refined descriptions in the UI.
|
4 |
Requires at least: 4.5
|
5 |
Tested up to: 5.2
|
6 |
Requires PHP: 5.3
|
7 |
+
Stable tag: 0.9.18
|
8 |
License: GPLv3 or later
|
9 |
License URI: https://www.gnu.org/licenses/gpl-3.0.en.html
|
10 |
|
144 |
Feel free to let us know how we can help using the [support forum](https://wordpress.org/support/plugin/wpvivid-backuprestore) for the plugin on WordPress.org or our [contact form](https://wpvivid.com/contact-us). You can also reach us with a direct message on [Twitter](https://twitter.com/WPvividcom).
|
145 |
|
146 |
== Changelog ==
|
147 |
+
= 0.9.18 =
|
148 |
+
- Optimized migration process, improved compatibility for migration. Old keys will be expired after you update to the new version.
|
149 |
+
- Added an option to retry the backup operation when encountering a timeout error.
|
150 |
+
- Added an option to hide settings in admin menu.
|
151 |
+
- Changed the plugin icon showing in admin menu.
|
152 |
+
- Included more info in the error log when sending to support.
|
153 |
+
- Improved compatibility with few hostings like GoDaddy.
|
154 |
+
- Optimized the cache directory in backup process.
|
155 |
+
- Fixed errors occurred in some cases during the authentication process with Google Drive, Dropbox, Microsoft OneDrive.
|
156 |
+
- Optimized plugin code.
|
157 |
= 0.9.17 =
|
158 |
- Added a sole tab for backup schedules.
|
159 |
- Refined descriptions in the UI.
|
wpvivid-backuprestore.php
CHANGED
@@ -7,8 +7,8 @@
|
|
7 |
* @wordpress-plugin
|
8 |
* Plugin Name: WPvivid Backup Plugin
|
9 |
* Description: Transfer site to a new domain. Off-site backup schedule, transfer backups to leading remote storage (dropbox, onedrive, google drive etc). All in one.
|
10 |
-
* Version: 0.9.
|
11 |
-
* Author:
|
12 |
* Author URI: https://wpvivid.com
|
13 |
* License: GPL-3.0+
|
14 |
* License URI: http://www.gnu.org/copyleft/gpl.html
|
@@ -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');
|
@@ -62,6 +62,8 @@ define('WPVIVID_DEFAULT_LOG_DIR','wpvividbackups'.DIRECTORY_SEPARATOR.'wpvivid_l
|
|
62 |
define('WPVIVID_DEFAULT_ROLLBACK_DIR','wpvivid-old-files');
|
63 |
//
|
64 |
define('WPVIVID_DEFAULT_ADMIN_BAR', true);
|
|
|
|
|
65 |
//
|
66 |
define('WPVIVID_DEFAULT_ESTIMATE_BACKUP', true);
|
67 |
//Specify the folder and database to be backed up
|
7 |
* @wordpress-plugin
|
8 |
* Plugin Name: WPvivid Backup Plugin
|
9 |
* Description: Transfer site to a new domain. Off-site backup schedule, transfer backups to leading remote storage (dropbox, onedrive, google drive etc). All in one.
|
10 |
+
* Version: 0.9.18
|
11 |
+
* Author: WPvivid Team
|
12 |
* Author URI: https://wpvivid.com
|
13 |
* License: GPL-3.0+
|
14 |
* License URI: http://www.gnu.org/copyleft/gpl.html
|
21 |
die;
|
22 |
}
|
23 |
|
24 |
+
define( 'WPVIVID_PLUGIN_VERSION', '0.9.18' );
|
25 |
//
|
26 |
define('WPVIVID_RESTORE_INIT','init');
|
27 |
define('WPVIVID_RESTORE_READY','ready');
|
62 |
define('WPVIVID_DEFAULT_ROLLBACK_DIR','wpvivid-old-files');
|
63 |
//
|
64 |
define('WPVIVID_DEFAULT_ADMIN_BAR', true);
|
65 |
+
define('WPVIVID_DEFAULT_TAB_MENU', true);
|
66 |
+
define('WPVIVID_DEFAULT_DOMAIN_INCLUDE', true);
|
67 |
//
|
68 |
define('WPVIVID_DEFAULT_ESTIMATE_BACKUP', true);
|
69 |
//Specify the folder and database to be backed up
|