Version Description
- Fixed some bugs in the plugin code.
- Fixed: Could not restore files to proper directories if one had customized the sites file structure.
- Fixed: The page could not properly display when one chose Remote Storage option from the admin sidebar menu.
- Optimized backup process, now it saves more disk space.
- Optimized the plugin code.
Download this release
Release Info
Developer | wpvivid |
Plugin | Migration, Backup, Staging – WPvivid |
Version | 0.9.24 |
Comparing to | |
See all releases |
Code changes from version 0.9.23 to 0.9.24
- admin/class-wpvivid-admin.php +213 -36
- admin/css/wpvivid-admin.css +27 -32
- admin/js/wpvivid-admin.js +0 -2
- admin/partials/wpvivid-admin-display.php +21 -33
- admin/partials/wpvivid-backup-restore-page-display.php +3 -2
- admin/partials/wpvivid-settings-page-display.php +263 -253
- admin/partials/wpvivid-website-info-page-display.php +5 -2
- includes/class-wpvivid-backup-uploader.php +41 -4
- includes/class-wpvivid-backup.php +200 -146
- includes/class-wpvivid-backuplist.php +2 -2
- includes/class-wpvivid-crypt.php +9 -0
- includes/class-wpvivid-downloader.php +30 -41
- includes/class-wpvivid-function-realize.php +23 -11
- includes/class-wpvivid-mail-report.php +356 -314
- includes/class-wpvivid-migrate.php +7 -5
- includes/class-wpvivid-public-interface.php +10 -3
- includes/class-wpvivid-restore-data.php +4 -4
- includes/class-wpvivid-restore-database.php +187 -2
- includes/class-wpvivid-restore-site.php +73 -12
- includes/class-wpvivid-taskmanager.php +5 -0
- includes/class-wpvivid-zipclass.php +122 -34
- includes/class-wpvivid.php +175 -119
- includes/customclass/class-wpvivid-amazons3-plus.php +6 -11
- includes/customclass/class-wpvivid-dropbox.php +15 -19
- includes/customclass/class-wpvivid-ftpclass.php +8 -12
- includes/customclass/class-wpvivid-google-drive.php +26 -20
- includes/customclass/class-wpvivid-one-drive.php +42 -32
- includes/customclass/class-wpvivid-s3compat.php +6 -10
- includes/customclass/class-wpvivid-send-to-site.php +47 -7
- includes/customclass/class-wpvivid-sftpclass.php +6 -11
- readme.txt +7 -1
- wpvivid-backuprestore.php +2 -2
admin/class-wpvivid-admin.php
CHANGED
@@ -47,6 +47,7 @@ class WPvivid_Admin {
|
|
47 |
|
48 |
private $toolbar_menus;
|
49 |
|
|
|
50 |
/**
|
51 |
* Initialize the class and set its properties.
|
52 |
*
|
@@ -56,19 +57,31 @@ class WPvivid_Admin {
|
|
56 |
*/
|
57 |
public function __construct($plugin_name, $version)
|
58 |
{
|
|
|
|
|
|
|
59 |
$this->plugin_name = $plugin_name;
|
60 |
$this->version = $version;
|
61 |
-
|
62 |
-
$this->screen_ids[]='wpvivid-backup_page_wpvivid-transfer';
|
63 |
-
$this->screen_ids[]='wpvivid-backup_page_wpvivid-setting';
|
64 |
-
$this->screen_ids[]='wpvivid-backup_page_wpvivid-schedule';
|
65 |
-
$this->screen_ids[]='wpvivid-backup_page_wpvivid-website';
|
66 |
-
$this->screen_ids[]='wpvivid-backup_page_wpvivid-log';
|
67 |
-
$this->screen_ids[]='wpvivid-backup_page_wpvivid-key';
|
68 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
69 |
$menu['id']='wpvivid_admin_menu';
|
70 |
$menu['title']='WPvivid Backup';
|
71 |
-
$
|
72 |
|
73 |
$admin_url = admin_url();
|
74 |
|
@@ -77,57 +90,144 @@ class WPvivid_Admin {
|
|
77 |
$menu['title']='Backup & Restore';
|
78 |
$menu['tab']='admin.php?page=WPvivid&tab-backup';
|
79 |
$menu['href']=$admin_url . 'admin.php?page=WPvivid&tab-backup';
|
80 |
-
$
|
|
|
81 |
|
82 |
$menu['id']='wpvivid_admin_menu_schedule';
|
83 |
$menu['parent']='wpvivid_admin_menu';
|
84 |
$menu['title']='Schedule';
|
85 |
$menu['tab']='admin.php?page=WPvivid&tab-schedule';
|
86 |
$menu['href']=$admin_url . 'admin.php?page=WPvivid&tab-schedule';
|
87 |
-
$
|
|
|
88 |
|
89 |
$menu['id']='wpvivid_admin_menu_transfer';
|
90 |
$menu['parent']='wpvivid_admin_menu';
|
91 |
$menu['title']='Auto-Migration';
|
92 |
$menu['tab']='admin.php?page=WPvivid&tab-transfer';
|
93 |
$menu['href']=$admin_url . 'admin.php?page=WPvivid&tab-transfer';
|
94 |
-
$
|
|
|
95 |
|
96 |
-
$menu['id']='
|
97 |
$menu['parent']='wpvivid_admin_menu';
|
98 |
$menu['title']='Remote Storage';
|
99 |
$menu['tab']='admin.php?page=WPvivid&tab-remote-storage';
|
100 |
$menu['href']=$admin_url . 'admin.php?page=WPvivid&tab-remote-storage';
|
101 |
-
$
|
|
|
102 |
|
103 |
$menu['id']='wpvivid_admin_menu_settings';
|
104 |
$menu['parent']='wpvivid_admin_menu';
|
105 |
$menu['title']='Settings';
|
106 |
$menu['tab']= 'admin.php?page=WPvivid&tab-settings';
|
107 |
$menu['href']=$admin_url . 'admin.php?page=WPvivid&tab-settings';
|
108 |
-
$
|
|
|
109 |
|
110 |
$menu['id']='wpvivid_admin_menu_debug';
|
111 |
$menu['parent']='wpvivid_admin_menu';
|
112 |
-
$menu['title']='
|
113 |
$menu['tab']= 'admin.php?page=WPvivid&tab-website-info';
|
114 |
$menu['href']=$admin_url . 'admin.php?page=WPvivid&tab-website-info';
|
115 |
-
$
|
|
|
116 |
|
117 |
$menu['id']='wpvivid_admin_menu_logs';
|
118 |
$menu['parent']='wpvivid_admin_menu';
|
119 |
$menu['title']='Logs';
|
120 |
$menu['tab']='admin.php?page=WPvivid&tab-logs';
|
121 |
$menu['href']=$admin_url . 'admin.php?page=WPvivid&tab-logs';
|
122 |
-
$
|
|
|
123 |
|
124 |
$menu['id']='wpvivid_admin_menu_key';
|
125 |
$menu['parent']='wpvivid_admin_menu';
|
126 |
$menu['title']='Key';
|
127 |
$menu['tab']= 'admin.php?page=WPvivid&tab-key';
|
128 |
$menu['href']=$admin_url . 'admin.php?page=WPvivid&tab-key';
|
129 |
-
$
|
|
|
|
|
130 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
131 |
/**
|
132 |
* Register the stylesheets for the admin area.
|
133 |
*
|
@@ -188,15 +288,31 @@ class WPvivid_Admin {
|
|
188 |
$wpvivid_show_tab_menu=false;
|
189 |
}
|
190 |
}
|
191 |
-
if($wpvivid_show_tab_menu)
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
200 |
}
|
201 |
}
|
202 |
|
@@ -205,14 +321,27 @@ class WPvivid_Admin {
|
|
205 |
global $wpvivid_plugin;
|
206 |
if(is_admin() && current_user_can('administrator')) {
|
207 |
$show_admin_bar = $wpvivid_plugin->get_admin_bar_setting();
|
208 |
-
if ($show_admin_bar === true)
|
|
|
209 |
$this->toolbar_menus = apply_filters('wpvivid_get_toolbar_menus', $this->toolbar_menus);
|
210 |
-
foreach ($this->toolbar_menus as $menu)
|
|
|
211 |
$wp_admin_bar->add_menu(array(
|
212 |
'id' => $menu['id'],
|
213 |
'title' => $menu['title']
|
214 |
));
|
215 |
-
if (isset($menu['child']))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
216 |
foreach ($menu['child'] as $child_menu) {
|
217 |
$wp_admin_bar->add_menu(array(
|
218 |
'id' => $child_menu['id'],
|
@@ -248,7 +377,8 @@ class WPvivid_Admin {
|
|
248 |
*/
|
249 |
public function display_plugin_setup_page()
|
250 |
{
|
251 |
-
if(isset($_REQUEST['tab-backup']))
|
|
|
252 |
self::wpvivid_set_page_request('backup');
|
253 |
}
|
254 |
else if(isset($_REQUEST['tab-transfer'])){
|
@@ -272,10 +402,15 @@ class WPvivid_Admin {
|
|
272 |
else if(isset($_REQUEST['tab-key'])){
|
273 |
self::wpvivid_set_page_request('key');
|
274 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
275 |
global $wpvivid_plugin;
|
276 |
$wpvivid_plugin->clean_cache();
|
277 |
|
278 |
-
|
279 |
//
|
280 |
$migrate_notice=false;
|
281 |
$migrate_status=WPvivid_Setting::get_option('wpvivid_migrate_status');
|
@@ -387,7 +522,36 @@ class WPvivid_Admin {
|
|
387 |
|
388 |
public function wpvivid_set_page_request($page){
|
389 |
global $request_page;
|
390 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
391 |
}
|
392 |
|
393 |
public static function wpvivid_get_page_request(){
|
@@ -524,7 +688,7 @@ class WPvivid_Admin {
|
|
524 |
|
525 |
public function wpvivid_add_tab_website_info(){
|
526 |
?>
|
527 |
-
<a href="#" id="wpvivid_tab_debug" class="nav-tab wrap-nav-tab" onclick="switchTabs(event,'debug-page')"><?php _e('
|
528 |
<?php
|
529 |
}
|
530 |
|
@@ -657,7 +821,20 @@ class WPvivid_Admin {
|
|
657 |
?>
|
658 |
<div id="settings-page" class="wrap-tab-content wpvivid_tab_setting" name="tab-setting" style="display:none;">
|
659 |
<div>
|
660 |
-
<
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
661 |
<tbody>
|
662 |
<?php do_action('wpvivid_setting_add_cell'); ?>
|
663 |
<tfoot>
|
@@ -667,7 +844,7 @@ class WPvivid_Admin {
|
|
667 |
</tr>
|
668 |
</tfoot>
|
669 |
</tbody>
|
670 |
-
</table
|
671 |
</div>
|
672 |
</div>
|
673 |
<script>
|
47 |
|
48 |
private $toolbar_menus;
|
49 |
|
50 |
+
private $submenus;
|
51 |
/**
|
52 |
* Initialize the class and set its properties.
|
53 |
*
|
57 |
*/
|
58 |
public function __construct($plugin_name, $version)
|
59 |
{
|
60 |
+
add_filter('wpvivid_get_screen_ids',array($this,'get_screen_ids'),10);
|
61 |
+
add_filter('wpvivid_get_toolbar_menus',array($this,'get_toolbar_menus'),10);
|
62 |
+
add_filter('wpvivid_get_admin_menus',array($this,'get_admin_menus'),10);
|
63 |
$this->plugin_name = $plugin_name;
|
64 |
$this->version = $version;
|
65 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
66 |
|
67 |
+
public function get_screen_ids($screen_ids)
|
68 |
+
{
|
69 |
+
$screen_ids[]='toplevel_page_'.$this->plugin_name;
|
70 |
+
$screen_ids[]='wpvivid-backup_page_wpvivid-transfer';
|
71 |
+
$screen_ids[]='wpvivid-backup_page_wpvivid-setting';
|
72 |
+
$screen_ids[]='wpvivid-backup_page_wpvivid-schedule';
|
73 |
+
$screen_ids[]='wpvivid-backup_page_wpvivid-remote';
|
74 |
+
$screen_ids[]='wpvivid-backup_page_wpvivid-website';
|
75 |
+
$screen_ids[]='wpvivid-backup_page_wpvivid-log';
|
76 |
+
$screen_ids[]='wpvivid-backup_page_wpvivid-key';
|
77 |
+
return $screen_ids;
|
78 |
+
}
|
79 |
+
|
80 |
+
public function get_toolbar_menus($toolbar_menus)
|
81 |
+
{
|
82 |
$menu['id']='wpvivid_admin_menu';
|
83 |
$menu['title']='WPvivid Backup';
|
84 |
+
$toolbar_menus[$menu['id']]=$menu;
|
85 |
|
86 |
$admin_url = admin_url();
|
87 |
|
90 |
$menu['title']='Backup & Restore';
|
91 |
$menu['tab']='admin.php?page=WPvivid&tab-backup';
|
92 |
$menu['href']=$admin_url . 'admin.php?page=WPvivid&tab-backup';
|
93 |
+
$menu['index']=1;
|
94 |
+
$toolbar_menus[$menu['parent']]['child'][$menu['id']]=$menu;
|
95 |
|
96 |
$menu['id']='wpvivid_admin_menu_schedule';
|
97 |
$menu['parent']='wpvivid_admin_menu';
|
98 |
$menu['title']='Schedule';
|
99 |
$menu['tab']='admin.php?page=WPvivid&tab-schedule';
|
100 |
$menu['href']=$admin_url . 'admin.php?page=WPvivid&tab-schedule';
|
101 |
+
$menu['index']=2;
|
102 |
+
$toolbar_menus[$menu['parent']]['child'][$menu['id']]=$menu;
|
103 |
|
104 |
$menu['id']='wpvivid_admin_menu_transfer';
|
105 |
$menu['parent']='wpvivid_admin_menu';
|
106 |
$menu['title']='Auto-Migration';
|
107 |
$menu['tab']='admin.php?page=WPvivid&tab-transfer';
|
108 |
$menu['href']=$admin_url . 'admin.php?page=WPvivid&tab-transfer';
|
109 |
+
$menu['index']=3;
|
110 |
+
$toolbar_menus[$menu['parent']]['child'][$menu['id']]=$menu;
|
111 |
|
112 |
+
$menu['id']='wpvivid_admin_menu_remote';
|
113 |
$menu['parent']='wpvivid_admin_menu';
|
114 |
$menu['title']='Remote Storage';
|
115 |
$menu['tab']='admin.php?page=WPvivid&tab-remote-storage';
|
116 |
$menu['href']=$admin_url . 'admin.php?page=WPvivid&tab-remote-storage';
|
117 |
+
$menu['index']=4;
|
118 |
+
$toolbar_menus[$menu['parent']]['child'][$menu['id']]=$menu;
|
119 |
|
120 |
$menu['id']='wpvivid_admin_menu_settings';
|
121 |
$menu['parent']='wpvivid_admin_menu';
|
122 |
$menu['title']='Settings';
|
123 |
$menu['tab']= 'admin.php?page=WPvivid&tab-settings';
|
124 |
$menu['href']=$admin_url . 'admin.php?page=WPvivid&tab-settings';
|
125 |
+
$menu['index']=5;
|
126 |
+
$toolbar_menus[$menu['parent']]['child'][$menu['id']]=$menu;
|
127 |
|
128 |
$menu['id']='wpvivid_admin_menu_debug';
|
129 |
$menu['parent']='wpvivid_admin_menu';
|
130 |
+
$menu['title']='Debug';
|
131 |
$menu['tab']= 'admin.php?page=WPvivid&tab-website-info';
|
132 |
$menu['href']=$admin_url . 'admin.php?page=WPvivid&tab-website-info';
|
133 |
+
$menu['index']=6;
|
134 |
+
$toolbar_menus[$menu['parent']]['child'][$menu['id']]=$menu;
|
135 |
|
136 |
$menu['id']='wpvivid_admin_menu_logs';
|
137 |
$menu['parent']='wpvivid_admin_menu';
|
138 |
$menu['title']='Logs';
|
139 |
$menu['tab']='admin.php?page=WPvivid&tab-logs';
|
140 |
$menu['href']=$admin_url . 'admin.php?page=WPvivid&tab-logs';
|
141 |
+
$menu['index']=7;
|
142 |
+
$toolbar_menus[$menu['parent']]['child'][$menu['id']]=$menu;
|
143 |
|
144 |
$menu['id']='wpvivid_admin_menu_key';
|
145 |
$menu['parent']='wpvivid_admin_menu';
|
146 |
$menu['title']='Key';
|
147 |
$menu['tab']= 'admin.php?page=WPvivid&tab-key';
|
148 |
$menu['href']=$admin_url . 'admin.php?page=WPvivid&tab-key';
|
149 |
+
$menu['index']=8;
|
150 |
+
$toolbar_menus[$menu['parent']]['child'][$menu['id']]=$menu;
|
151 |
+
return $toolbar_menus;
|
152 |
}
|
153 |
+
|
154 |
+
public function get_admin_menus($submenus)
|
155 |
+
{
|
156 |
+
$submenu['parent_slug']=$this->plugin_name;
|
157 |
+
$submenu['page_title']= __('WPvivid Backup');
|
158 |
+
$submenu['menu_title']=__('Backup & Restore', 'wpvivid');
|
159 |
+
$submenu['capability']='administrator';
|
160 |
+
$submenu['menu_slug']=$this->plugin_name;
|
161 |
+
$submenu['function']=array($this, 'display_plugin_backup_page');
|
162 |
+
$submenu['index']=1;
|
163 |
+
$submenus[$submenu['menu_slug']]=$submenu;
|
164 |
+
|
165 |
+
$submenu['parent_slug']=$this->plugin_name;
|
166 |
+
$submenu['page_title']= __('WPvivid Backup');
|
167 |
+
$submenu['menu_title']=__('Schedule', 'wpvivid');
|
168 |
+
$submenu['capability']='administrator';
|
169 |
+
$submenu['menu_slug']='wpvivid-schedule';
|
170 |
+
$submenu['function']=array($this, 'display_plugin_schedule_page');
|
171 |
+
$submenu['index']=2;
|
172 |
+
$submenus[$submenu['menu_slug']]=$submenu;
|
173 |
+
|
174 |
+
$submenu['parent_slug']=$this->plugin_name;
|
175 |
+
$submenu['page_title']= __('WPvivid Backup');
|
176 |
+
$submenu['menu_title']=__('Auto-Migration', 'wpvivid');
|
177 |
+
$submenu['capability']='administrator';
|
178 |
+
$submenu['menu_slug']='wpvivid-transfer';
|
179 |
+
$submenu['function']=array($this, 'display_plugin_transfer_page');
|
180 |
+
$submenu['index']=3;
|
181 |
+
$submenus[$submenu['menu_slug']]=$submenu;
|
182 |
+
|
183 |
+
$submenu['parent_slug']=$this->plugin_name;
|
184 |
+
$submenu['page_title']= __('WPvivid Backup');
|
185 |
+
$submenu['menu_title']=__('Remote Storage', 'wpvivid');
|
186 |
+
$submenu['capability']='administrator';
|
187 |
+
$submenu['menu_slug']='wpvivid-remote';
|
188 |
+
$submenu['function']=array($this, 'display_plugin_remote_page');
|
189 |
+
$submenu['index']=4;
|
190 |
+
$submenus[$submenu['menu_slug']]=$submenu;
|
191 |
+
|
192 |
+
$submenu['parent_slug']=$this->plugin_name;
|
193 |
+
$submenu['page_title']= __('WPvivid Backup');
|
194 |
+
$submenu['menu_title']=__('Settings', 'wpvivid');
|
195 |
+
$submenu['capability']='administrator';
|
196 |
+
$submenu['menu_slug']='wpvivid-setting';
|
197 |
+
$submenu['function']=array($this, 'display_plugin_setting_page');
|
198 |
+
$submenu['index']=5;
|
199 |
+
$submenus[$submenu['menu_slug']]=$submenu;
|
200 |
+
|
201 |
+
$submenu['parent_slug']=$this->plugin_name;
|
202 |
+
$submenu['page_title']= __('WPvivid Backup');
|
203 |
+
$submenu['menu_title']=__('Debug', 'wpvivid');
|
204 |
+
$submenu['capability']='administrator';
|
205 |
+
$submenu['menu_slug']='wpvivid-website';
|
206 |
+
$submenu['function']=array($this, 'display_plugin_website_page');
|
207 |
+
$submenu['index']=6;
|
208 |
+
$submenus[$submenu['menu_slug']]=$submenu;
|
209 |
+
|
210 |
+
$submenu['parent_slug']=$this->plugin_name;
|
211 |
+
$submenu['page_title']= __('WPvivid Backup');
|
212 |
+
$submenu['menu_title']=__('Logs', 'wpvivid');
|
213 |
+
$submenu['capability']='administrator';
|
214 |
+
$submenu['menu_slug']='wpvivid-log';
|
215 |
+
$submenu['function']=array($this, 'display_plugin_log_page');
|
216 |
+
$submenu['index']=7;
|
217 |
+
$submenus[$submenu['menu_slug']]=$submenu;
|
218 |
+
|
219 |
+
$submenu['parent_slug']=$this->plugin_name;
|
220 |
+
$submenu['page_title']= __('WPvivid Backup');
|
221 |
+
$submenu['menu_title']=__('Key', 'wpvivid');
|
222 |
+
$submenu['capability']='administrator';
|
223 |
+
$submenu['menu_slug']='wpvivid-key';
|
224 |
+
$submenu['function']=array($this, 'display_plugin_key_page');
|
225 |
+
$submenu['index']=8;
|
226 |
+
$submenus[$submenu['menu_slug']]=$submenu;
|
227 |
+
|
228 |
+
return $submenus;
|
229 |
+
}
|
230 |
+
|
231 |
/**
|
232 |
* Register the stylesheets for the admin area.
|
233 |
*
|
288 |
$wpvivid_show_tab_menu=false;
|
289 |
}
|
290 |
}
|
291 |
+
if($wpvivid_show_tab_menu)
|
292 |
+
{
|
293 |
+
$this->submenus = apply_filters('wpvivid_get_admin_menus', $this->submenus);
|
294 |
+
|
295 |
+
usort($this->submenus, function ($a, $b)
|
296 |
+
{
|
297 |
+
if($a['index']==$b['index'])
|
298 |
+
return 0;
|
299 |
+
|
300 |
+
if($a['index']>$b['index'])
|
301 |
+
return 1;
|
302 |
+
else
|
303 |
+
return -1;
|
304 |
+
});
|
305 |
+
|
306 |
+
foreach ($this->submenus as $submenu)
|
307 |
+
{
|
308 |
+
add_submenu_page(
|
309 |
+
$submenu['parent_slug'],
|
310 |
+
$submenu['page_title'],
|
311 |
+
$submenu['menu_title'],
|
312 |
+
$submenu['capability'],
|
313 |
+
$submenu['menu_slug'],
|
314 |
+
$submenu['function'], false, 100);
|
315 |
+
}
|
316 |
}
|
317 |
}
|
318 |
|
321 |
global $wpvivid_plugin;
|
322 |
if(is_admin() && current_user_can('administrator')) {
|
323 |
$show_admin_bar = $wpvivid_plugin->get_admin_bar_setting();
|
324 |
+
if ($show_admin_bar === true)
|
325 |
+
{
|
326 |
$this->toolbar_menus = apply_filters('wpvivid_get_toolbar_menus', $this->toolbar_menus);
|
327 |
+
foreach ($this->toolbar_menus as $menu)
|
328 |
+
{
|
329 |
$wp_admin_bar->add_menu(array(
|
330 |
'id' => $menu['id'],
|
331 |
'title' => $menu['title']
|
332 |
));
|
333 |
+
if (isset($menu['child']))
|
334 |
+
{
|
335 |
+
usort($menu['child'], function ($a, $b)
|
336 |
+
{
|
337 |
+
if($a['index']==$b['index'])
|
338 |
+
return 0;
|
339 |
+
|
340 |
+
if($a['index']>$b['index'])
|
341 |
+
return 1;
|
342 |
+
else
|
343 |
+
return -1;
|
344 |
+
});
|
345 |
foreach ($menu['child'] as $child_menu) {
|
346 |
$wp_admin_bar->add_menu(array(
|
347 |
'id' => $child_menu['id'],
|
377 |
*/
|
378 |
public function display_plugin_setup_page()
|
379 |
{
|
380 |
+
if(isset($_REQUEST['tab-backup']))
|
381 |
+
{
|
382 |
self::wpvivid_set_page_request('backup');
|
383 |
}
|
384 |
else if(isset($_REQUEST['tab-transfer'])){
|
402 |
else if(isset($_REQUEST['tab-key'])){
|
403 |
self::wpvivid_set_page_request('key');
|
404 |
}
|
405 |
+
else
|
406 |
+
{
|
407 |
+
global $request_page;
|
408 |
+
$request_page=apply_filters('wpvivid_set_page_request',$request_page);
|
409 |
+
}
|
410 |
+
|
411 |
global $wpvivid_plugin;
|
412 |
$wpvivid_plugin->clean_cache();
|
413 |
|
|
|
414 |
//
|
415 |
$migrate_notice=false;
|
416 |
$migrate_status=WPvivid_Setting::get_option('wpvivid_migrate_status');
|
522 |
|
523 |
public function wpvivid_set_page_request($page){
|
524 |
global $request_page;
|
525 |
+
switch($page)
|
526 |
+
{
|
527 |
+
case "backup":
|
528 |
+
$request_page='wpvivid_tab_general';
|
529 |
+
break;
|
530 |
+
case "transfer":
|
531 |
+
$request_page='wpvivid_tab_migrate';
|
532 |
+
break;
|
533 |
+
case "settings":
|
534 |
+
$request_page='wpvivid_tab_setting';
|
535 |
+
break;
|
536 |
+
case "schedule":
|
537 |
+
$request_page='wpvivid_tab_schedule';
|
538 |
+
break;
|
539 |
+
case "remote":
|
540 |
+
$request_page='wpvivid_tab_remote_storage';
|
541 |
+
break;
|
542 |
+
case "website":
|
543 |
+
$request_page='wpvivid_tab_debug';
|
544 |
+
break;
|
545 |
+
case "log":
|
546 |
+
$request_page='wpvivid_tab_log';
|
547 |
+
break;
|
548 |
+
case "key":
|
549 |
+
$request_page='wpvivid_tab_key';
|
550 |
+
break;
|
551 |
+
default:
|
552 |
+
$request_page='wpvivid_tab_general';
|
553 |
+
break;
|
554 |
+
}
|
555 |
}
|
556 |
|
557 |
public static function wpvivid_get_page_request(){
|
688 |
|
689 |
public function wpvivid_add_tab_website_info(){
|
690 |
?>
|
691 |
+
<a href="#" id="wpvivid_tab_debug" class="nav-tab wrap-nav-tab" onclick="switchTabs(event,'debug-page')"><?php _e('Debug', 'wpvivid'); ?></a>
|
692 |
<?php
|
693 |
}
|
694 |
|
821 |
?>
|
822 |
<div id="settings-page" class="wrap-tab-content wpvivid_tab_setting" name="tab-setting" style="display:none;">
|
823 |
<div>
|
824 |
+
<h2 class="nav-tab-wrapper" style="padding-bottom:0!important;">
|
825 |
+
<?php
|
826 |
+
$setting_array = array();
|
827 |
+
$setting_array = apply_filters('wpvivid_add_setting_tab_page', $setting_array);
|
828 |
+
foreach ($setting_array as $setting_name) {
|
829 |
+
add_action('wpvivid_settingpage_add_tab', $setting_name['tab_func'], $setting_name['index']);
|
830 |
+
add_action('wpvivid_settingpage_add_page', $setting_name['page_func'], $setting_name['index']);
|
831 |
+
}
|
832 |
+
do_action('wpvivid_settingpage_add_tab');
|
833 |
+
?>
|
834 |
+
</h2>
|
835 |
+
<?php do_action('wpvivid_settingpage_add_page'); ?>
|
836 |
+
<div><input class="button-primary" id="wpvivid_setting_general_save" type="submit" value="<?php esc_attr_e( 'Save Changes', 'wpvivid' ); ?>" style="float: right;" /></div>
|
837 |
+
<!--<table class="widefat">
|
838 |
<tbody>
|
839 |
<?php do_action('wpvivid_setting_add_cell'); ?>
|
840 |
<tfoot>
|
844 |
</tr>
|
845 |
</tfoot>
|
846 |
</tbody>
|
847 |
+
</table>-->
|
848 |
</div>
|
849 |
</div>
|
850 |
<script>
|
admin/css/wpvivid-admin.css
CHANGED
@@ -2,36 +2,22 @@
|
|
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 |
-
/*.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,22 +25,12 @@
|
|
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 |
-
|
49 |
-
.
|
50 |
-
.setting-page-content{padding-left:
|
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,7 +54,6 @@
|
|
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;}
|
@@ -118,9 +93,6 @@
|
|
118 |
float:none;
|
119 |
width:100%;
|
120 |
}
|
121 |
-
/* .quickstart-archive-block{
|
122 |
-
border-left:50px solid #0073aa;
|
123 |
-
} */
|
124 |
}
|
125 |
@media screen and (max-width:800px){
|
126 |
.tablelistcolumn{
|
@@ -219,4 +191,27 @@
|
|
219 |
@keyframes fadeIn {
|
220 |
from {opacity: 0;}
|
221 |
to {opacity:1 ;}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
222 |
}
|
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 |
.quickbackup{width:calc(100% - 290px);float:left; box-sizing:border-box;margin-right:10px; padding:10px;}
|
10 |
.quickbackup label{display:inline-block;margin-bottom:10px;}
|
11 |
.qucikbackup-schedule{width:280px; float:left; box-sizing:border-box; min-width:280px;}
|
12 |
.quickstart-archive-block{width:33%;padding:10px; float:left; position:relative; box-sizing:border-box; }
|
|
|
13 |
.quickstart-storage-block{width:33%;padding:10px; float:left; position:relative; box-sizing:border-box;}
|
14 |
.quickstart-btn{width:33%;padding:10px; float:left; position:relative; box-sizing:border-box;}
|
15 |
.quickbackup-btn{display:block !important; margin:0 auto !important;width:150px;height:50px !important; line-height:48px !important; font-size:20px !important;}
|
|
|
|
|
16 |
.schedule-block{float:left;width:100%;padding:0 10px 10px 10px;box-sizing:border-box;}
|
17 |
.postbox:after{content: ".";display: block;height: 0;clear: both;visibility: hidden;}
|
18 |
.quickbackup-block .fieldset label{margin-bottom:5px;}
|
19 |
.custom-info{padding:10px;}
|
20 |
.quickstart-storage-setting{width:100%;float:left; padding-left:10px; box-sizing:border-box;background-color:#f1f1f1; margin-bottom:10px;}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
.action-progress-bar{background-color:#f1f1f1 !important;margin:10px;color:#000;}
|
22 |
.action-progress-bar-percent{background-color:#0085ba !important;color:#fff;}
|
23 |
.storage-providers{float:left;padding:10px;cursor:pointer;}
|
25 |
.storage-providers-active{background-color:#0085ba !important; color:#fff !important;}
|
26 |
.storage-account-block{padding:10px;}
|
27 |
.storage-account-button{margin:10px 10px 10px 0 !important;display:block !important; float:left;}
|
|
|
|
|
|
|
|
|
28 |
.schedule-tab-block{padding:10px;}
|
29 |
.schedule-tab-block input, span{display:line-block; margin-top:10px; margin-bottom:10px;margin-right:10px;}
|
30 |
+
.setting-tab-block{padding: 10px 10px 10px 0;}
|
31 |
+
.setting-tab-block input, span{display:line-block; margin-top:10px; margin-bottom:10px;margin-right:10px;}
|
32 |
+
.setting-page-content{padding-left:10px;}
|
|
|
|
|
|
|
|
|
33 |
.backup-log-btn{height:30px;float:left; margin-left:10px; margin-bottom:10px;}
|
|
|
|
|
34 |
@keyframes rotate { 0% { transform: rotate(0); } 100% { transform: rotate(359.9deg); } }
|
35 |
.wpvivid-backup-storage-list tr:hover,
|
36 |
.wpvivid-websiteinfo-list tr:hover,
|
54 |
.remote-storage-amazons3-storage-class input, span,
|
55 |
.remote-storage-amazons3-encryption input, span{display:line-block; margin-top:10px; margin-bottom:10px;margin-right:10px;}
|
56 |
.backup-list-head{}
|
|
|
57 |
.storage-account-form {padding-top: 1px; padding-bottom: 1px;}
|
58 |
|
59 |
.quicktransfer{width:100%; float:left; box-sizing:border-box;margin-right:10px; padding:10px;}
|
93 |
float:none;
|
94 |
width:100%;
|
95 |
}
|
|
|
|
|
|
|
96 |
}
|
97 |
@media screen and (max-width:800px){
|
98 |
.tablelistcolumn{
|
191 |
@keyframes fadeIn {
|
192 |
from {opacity: 0;}
|
193 |
to {opacity:1 ;}
|
194 |
+
}
|
195 |
+
|
196 |
+
.wpvivid-storage-form{
|
197 |
+
margin-top:10px;
|
198 |
+
margin-bottom:5px;
|
199 |
+
}
|
200 |
+
|
201 |
+
.wpvivid-storage-select{
|
202 |
+
margin-top:10px;
|
203 |
+
margin-bottom:5px;
|
204 |
+
padding-bottom:8px;
|
205 |
+
padding-left:2px;
|
206 |
+
}
|
207 |
+
|
208 |
+
.wpvivid-storage-form input[type=text],
|
209 |
+
.wpvivid-storage-form input[type=password]{
|
210 |
+
width: 350px;
|
211 |
+
}
|
212 |
+
|
213 |
+
.wpvivid-storage-form-desc{
|
214 |
+
background-color:#f5f5f5;
|
215 |
+
margin-top:10px;
|
216 |
+
padding:4px 5px;
|
217 |
}
|
admin/js/wpvivid-admin.js
CHANGED
@@ -474,8 +474,6 @@ function wpvivid_retrieve_last_backup_message(){
|
|
474 |
* This function will control interface flow.
|
475 |
*/
|
476 |
function wpvivid_interface_flow_control(){
|
477 |
-
|
478 |
-
|
479 |
jQuery('#wpvivid_general_email_enable').click(function(){
|
480 |
if(jQuery('#wpvivid_general_email_enable').prop('checked') === true){
|
481 |
jQuery('#wpvivid_general_email_setting').show();
|
474 |
* This function will control interface flow.
|
475 |
*/
|
476 |
function wpvivid_interface_flow_control(){
|
|
|
|
|
477 |
jQuery('#wpvivid_general_email_enable').click(function(){
|
478 |
if(jQuery('#wpvivid_general_email_enable').prop('checked') === true){
|
479 |
jQuery('#wpvivid_general_email_setting').show();
|
admin/partials/wpvivid-admin-display.php
CHANGED
@@ -33,13 +33,10 @@ $last_msg=WPvivid_Setting::get_last_backup_message('wpvivid_last_msg');
|
|
33 |
$out_of_date=$wpvivid_plugin->_get_out_of_date_info();
|
34 |
$junk_file=$wpvivid_plugin->_junk_files_info();
|
35 |
$website_info=$wpvivid_plugin->get_website_info();
|
36 |
-
|
37 |
-
$backup_task=$wpvivid_plugin->_list_tasks(false);
|
38 |
$wpvivid_version=WPVIVID_PLUGIN_VERSION;
|
39 |
|
40 |
do_action('show_notice');
|
41 |
|
42 |
-
|
43 |
function wpvivid_schedule_module($html){
|
44 |
$html = '';
|
45 |
return $html;
|
@@ -179,38 +176,29 @@ foreach ($page_array as $page_name){
|
|
179 |
document.getElementById(contentName).style.display = "block";
|
180 |
evt.currentTarget.className += " nav-tab-active";
|
181 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
182 |
function wpvivid_getrequest()
|
183 |
{
|
184 |
-
|
185 |
-
{
|
186 |
-
case "backup":
|
187 |
-
wpvivid_click_switch_page('wrap', 'wpvivid_tab_general', false);
|
188 |
-
break;
|
189 |
-
case "transfer":
|
190 |
-
wpvivid_click_switch_page('wrap', 'wpvivid_tab_migrate', false);
|
191 |
-
break;
|
192 |
-
case "settings":
|
193 |
-
wpvivid_click_switch_page('wrap', 'wpvivid_tab_setting', false);
|
194 |
-
break;
|
195 |
-
case "schedule":
|
196 |
-
wpvivid_click_switch_page('wrap', 'wpvivid_tab_schedule', false);
|
197 |
-
break;
|
198 |
-
case "remote":
|
199 |
-
wpvivid_click_switch_page('wrap', 'wpvivid_tab_remote_storage', false);
|
200 |
-
break;
|
201 |
-
case "website":
|
202 |
-
wpvivid_click_switch_page('wrap', 'wpvivid_tab_debug', false);
|
203 |
-
break;
|
204 |
-
case "log":
|
205 |
-
wpvivid_click_switch_page('wrap', 'wpvivid_tab_log', false);
|
206 |
-
break;
|
207 |
-
case "key":
|
208 |
-
wpvivid_click_switch_page('wrap', 'wpvivid_tab_key', false);
|
209 |
-
break;
|
210 |
-
default:
|
211 |
-
wpvivid_click_switch_page('wrap', 'wpvivid_tab_general', false);
|
212 |
-
break;
|
213 |
-
}
|
214 |
}
|
215 |
|
216 |
jQuery(document).ready(function ()
|
33 |
$out_of_date=$wpvivid_plugin->_get_out_of_date_info();
|
34 |
$junk_file=$wpvivid_plugin->_junk_files_info();
|
35 |
$website_info=$wpvivid_plugin->get_website_info();
|
|
|
|
|
36 |
$wpvivid_version=WPVIVID_PLUGIN_VERSION;
|
37 |
|
38 |
do_action('show_notice');
|
39 |
|
|
|
40 |
function wpvivid_schedule_module($html){
|
41 |
$html = '';
|
42 |
return $html;
|
176 |
document.getElementById(contentName).style.display = "block";
|
177 |
evt.currentTarget.className += " nav-tab-active";
|
178 |
}
|
179 |
+
function switchsettingTabs(evt,contentName) {
|
180 |
+
// Declare all variables
|
181 |
+
var i, tabcontent, tablinks;
|
182 |
+
|
183 |
+
// Get all elements with class="table-list-content" and hide them
|
184 |
+
tabcontent = document.getElementsByClassName("setting-tab-content");
|
185 |
+
for (i = 0; i < tabcontent.length; i++) {
|
186 |
+
tabcontent[i].style.display = "none";
|
187 |
+
}
|
188 |
+
|
189 |
+
// Get all elements with class="table-nav-tab" and remove the class "nav-tab-active"
|
190 |
+
tablinks = document.getElementsByClassName("setting-nav-tab");
|
191 |
+
for (i = 0; i < tablinks.length; i++) {
|
192 |
+
tablinks[i].className = tablinks[i].className.replace(" nav-tab-active", "");
|
193 |
+
}
|
194 |
+
|
195 |
+
// Show the current tab, and add an "storage-menu-active" class to the button that opened the tab
|
196 |
+
document.getElementById(contentName).style.display = "block";
|
197 |
+
evt.currentTarget.className += " nav-tab-active";
|
198 |
+
}
|
199 |
function wpvivid_getrequest()
|
200 |
{
|
201 |
+
wpvivid_click_switch_page('wrap', wpvivid_page_request, false);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
202 |
}
|
203 |
|
204 |
jQuery(document).ready(function ()
|
admin/partials/wpvivid-backup-restore-page-display.php
CHANGED
@@ -19,7 +19,8 @@ function wpvivid_add_backup_type($html, $type_name)
|
|
19 |
|
20 |
function wpvivid_backup_do_js(){
|
21 |
global $wpvivid_plugin;
|
22 |
-
$backup_task
|
|
|
23 |
$general_setting=WPvivid_Setting::get_setting(true, "");
|
24 |
if($general_setting['options']['wpvivid_common_setting']['estimate_backup'] == 0){
|
25 |
?>
|
@@ -1180,7 +1181,7 @@ function wpvivid_backuppage_add_page_restore(){
|
|
1180 |
wpvivid_restore_unlock();
|
1181 |
wpvivid_restoring = false;
|
1182 |
jQuery('#wpvivid_restore_' + restore_method + 'btn').css({'pointer-events': 'auto', 'opacity': '1'});
|
1183 |
-
alert(
|
1184 |
}
|
1185 |
else {
|
1186 |
setTimeout(function () {
|
19 |
|
20 |
function wpvivid_backup_do_js(){
|
21 |
global $wpvivid_plugin;
|
22 |
+
$backup_task = array();
|
23 |
+
$backup_task=$wpvivid_plugin->_list_tasks($backup_task, false);
|
24 |
$general_setting=WPvivid_Setting::get_setting(true, "");
|
25 |
if($general_setting['options']['wpvivid_common_setting']['estimate_backup'] == 0){
|
26 |
?>
|
1181 |
wpvivid_restore_unlock();
|
1182 |
wpvivid_restoring = false;
|
1183 |
jQuery('#wpvivid_restore_' + restore_method + 'btn').css({'pointer-events': 'auto', 'opacity': '1'});
|
1184 |
+
alert(jsonarray.error);
|
1185 |
}
|
1186 |
else {
|
1187 |
setTimeout(function () {
|
admin/partials/wpvivid-settings-page-display.php
CHANGED
@@ -46,80 +46,76 @@ function wpvivid_general_settings()
|
|
46 |
global $wpvivid_plugin;
|
47 |
$out_of_date=$wpvivid_plugin->_get_out_of_date_info();
|
48 |
?>
|
49 |
-
<
|
50 |
-
<
|
51 |
-
|
52 |
-
|
53 |
-
<
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
<
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
<
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
<
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
<div
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
<
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
<
|
101 |
-
<
|
102 |
-
|
103 |
-
<
|
104 |
-
<label for="users_can_register">
|
105 |
-
<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>
|
106 |
-
<p><span><?php _e('Remote Storage Directory:', 'wpvivid'); ?></span><span id="wpvivid_out_of_date_remote_path">
|
107 |
<?php
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
?>
|
112 |
</span>
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
</tr>
|
123 |
<script>
|
124 |
jQuery('#wpvivid_delete_out_of_backup').click(function(){
|
125 |
wpvivid_delete_out_of_date_backups();
|
@@ -176,41 +172,36 @@ function wpvivid_email_report()
|
|
176 |
$wpvivid_setting_email_failed='checked';
|
177 |
}
|
178 |
?>
|
179 |
-
<
|
180 |
-
<
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
<
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
<
|
200 |
-
<
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
</fieldset>
|
210 |
-
</div>
|
211 |
-
</div>
|
212 |
-
</td>
|
213 |
-
</tr>
|
214 |
<script>
|
215 |
jQuery('#wpvivid_send_email_test').click(function(){
|
216 |
wpvivid_email_test();
|
@@ -252,47 +243,46 @@ function wpvivid_clean_junk()
|
|
252 |
global $wpvivid_plugin;
|
253 |
$junk_file=$wpvivid_plugin->_junk_files_info();
|
254 |
?>
|
255 |
-
<
|
256 |
-
<
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
<
|
264 |
-
<fieldset>
|
265 |
-
<label for="wpvivid_junk_log">
|
266 |
-
<input type="checkbox" id="wpvivid_junk_log" option="junk-files" name="log" value="junk-log" />
|
267 |
-
<span><?php _e( 'logs', 'wpvivid' ); ?></span>
|
268 |
-
<span><?php _e('Path:', 'wpvivid' ); ?></span><span id="wpvivid_junk_log_path"><?php _e($junk_file['log_path'], 'wpvivid'); ?></span>
|
269 |
-
</label>
|
270 |
-
</fieldset>
|
271 |
-
<fieldset>
|
272 |
-
<label for="wpvivid_junk_backup_cache">
|
273 |
-
<input type="checkbox" id="wpvivid_junk_backup_cache" option="junk-files" name="backup_cache" value="junk-backup-cache" />
|
274 |
-
<span><?php _e( 'Backup Cache', 'wpvivid' ); ?></span>
|
275 |
-
</label>
|
276 |
-
<label for="wpvivid_junk_file">
|
277 |
-
<input type="checkbox" id="wpvivid_junk_file" option="junk-files" name="junk_files" value="junk-files" />
|
278 |
-
<span><?php _e( 'Junk', 'wpvivid' ); ?></span>
|
279 |
-
<span><?php _e('Path:', 'wpvivid' ); ?></span><span id="wpvivid_junk_file_path"><?php _e($junk_file['junk_path'], 'wpvivid'); ?></span>
|
280 |
-
</label>
|
281 |
-
</fieldset>
|
282 |
-
<fieldset>
|
283 |
-
<label for="wpvivid_junk_temporary_file">
|
284 |
-
<input type="checkbox" id="wpvivid_junk_temporary_file" option="junk-files" name="old_files" value="junk-temporary-files" />
|
285 |
-
<span><?php _e( 'Temporary Files', 'wpvivid' ); ?></span>
|
286 |
-
<span><?php _e('Path:', 'wpvivid'); ?></span><span id="wpvivid_restore_temp_file_path"><?php _e($junk_file['old_files_path'], 'wpvivid'); ?></span>
|
287 |
-
<p><?php _e('Temporary Files are created by wpvivid when restoring a website.', 'wpvivid'); ?></p>
|
288 |
-
</label>
|
289 |
-
</fieldset>
|
290 |
-
</div>
|
291 |
-
<div><input class="button-primary" id="wpvivid_clean_junk_file" type="submit" name="Empty-all-files" value="<?php esc_attr_e( 'Empty', 'wpvivid' ); ?>" /></div>
|
292 |
-
<div style="clear:both;"></div>
|
293 |
</div>
|
294 |
-
|
295 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
296 |
<script>
|
297 |
jQuery('#wpvivid_calculate_size').click(function(){
|
298 |
wpvivid_calculate_diskspaceused();
|
@@ -390,23 +380,18 @@ function wpvivid_clean_junk()
|
|
390 |
function wpvivid_export_import_settings()
|
391 |
{
|
392 |
?>
|
393 |
-
<
|
394 |
-
<
|
395 |
-
|
396 |
-
<
|
397 |
-
|
398 |
-
|
399 |
-
|
400 |
-
|
401 |
-
|
402 |
-
|
403 |
-
|
404 |
-
|
405 |
-
</div>
|
406 |
-
<div style="clear:both;"></div>
|
407 |
-
</div>
|
408 |
-
</td>
|
409 |
-
</tr>
|
410 |
<script>
|
411 |
jQuery('#wpvivid_setting_export').click(function(){
|
412 |
wpvivid_export_settings();
|
@@ -416,17 +401,11 @@ function wpvivid_export_import_settings()
|
|
416 |
wpvivid_import_settings();
|
417 |
});
|
418 |
|
419 |
-
/**
|
420 |
-
* This function will export settings to local folder
|
421 |
-
*/
|
422 |
function wpvivid_export_settings() {
|
423 |
wpvivid_location_href=true;
|
424 |
location.href =ajaxurl+'?action=wpvivid_export_setting&setting=1&history=1&review=0';
|
425 |
}
|
426 |
|
427 |
-
/**
|
428 |
-
* This function will import the previous exported settings
|
429 |
-
*/
|
430 |
function wpvivid_import_settings(){
|
431 |
var files = jQuery('input[name="fileTrans"]').prop('files');
|
432 |
|
@@ -506,96 +485,127 @@ function wpvivid_advanced_settings()
|
|
506 |
$general_setting['options']['wpvivid_common_setting']['migrate_size']=WPVIVID_MIGRATE_SIZE;
|
507 |
}
|
508 |
?>
|
509 |
-
<
|
510 |
-
<
|
511 |
-
|
512 |
-
<div
|
|
|
|
|
|
|
|
|
513 |
<div>
|
514 |
-
<p
|
515 |
-
<div>
|
516 |
-
<label>
|
517 |
-
<input type="checkbox" option="setting" name="subpackage_plugin_upload" <?php esc_attr_e($subpackage_plugin_upload); ?> />
|
518 |
-
<span><strong><?php _e('Enable optimization mode for web hosting/shared hosting', 'wpvivid'); ?></strong></span>
|
519 |
-
</label>
|
520 |
-
<div>
|
521 |
-
<p><?php _e('Enabling this option can improve the backup success rate, but it will take more time for backup.', 'wpvivid'); ?></p>
|
522 |
-
</div>
|
523 |
-
</div>
|
524 |
</div>
|
525 |
</div>
|
526 |
-
|
527 |
-
|
528 |
-
|
529 |
-
|
530 |
-
|
531 |
-
|
532 |
-
|
533 |
-
|
534 |
-
|
535 |
-
|
536 |
-
|
537 |
-
|
538 |
-
|
539 |
-
|
540 |
-
|
541 |
-
|
|
|
|
|
542 |
|
543 |
-
|
544 |
-
|
545 |
-
|
546 |
-
|
547 |
-
|
548 |
-
|
549 |
-
|
550 |
-
|
551 |
-
|
552 |
-
|
553 |
-
|
554 |
-
|
555 |
-
|
556 |
-
|
557 |
-
|
558 |
-
</div>
|
559 |
-
<div><strong><?php _e('PHP Memory Limit for backup', 'wpvivid'); ?></strong></div>
|
560 |
-
<div class="schedule-tab-block setting-page-content">
|
561 |
-
<input type="text" placeholder="256" option="setting" name="memory_limit" class="all-options" value="<?php esc_attr_e(str_replace('M', '', $general_setting['options']['wpvivid_common_setting']['memory_limit']), 'wpvivid'); ?>" onkeyup="value=value.replace(/\D/g,'')" />MB
|
562 |
-
<div><p><?php _e('Adjust this value to apply for a temporary PHP memory limit for WPvivid backup plugin to run a backup. We set this value to 256M by default. Increase the value if you encounter a memory exhausted error. Note: some web hosting providers may not support this.', 'wpvivid'); ?></p></div>
|
563 |
-
</div>
|
564 |
-
<div><strong><?php _e('PHP Memory Limit for restoration', 'wpvivid'); ?></strong></div>
|
565 |
-
<div class="schedule-tab-block setting-page-content">
|
566 |
-
<input type="text" placeholder="256" option="setting" name="restore_memory_limit" class="all-options" value="<?php esc_attr_e(str_replace('M', '', $general_setting['options']['wpvivid_common_setting']['restore_memory_limit']), 'wpvivid'); ?>" onkeyup="value=value.replace(/\D/g,'')" />MB
|
567 |
-
<div><p><?php _e('Adjust this value to apply for a temporary PHP memory limit for WPvivid backup plugin in restore process. We set this value to 256M by default. Increase the value if you encounter a memory exhausted error. Note: some web hosting providers may not support this.', 'wpvivid'); ?></p></div>
|
568 |
-
</div>
|
569 |
-
<div><strong><?php _e('Chunk Size', 'wpvivid'); ?></strong></div>
|
570 |
-
<div class="schedule-tab-block setting-page-content">
|
571 |
-
<input type="text" placeholder="2" option="setting" name="migrate_size" class="all-options" value="<?php esc_attr_e($general_setting['options']['wpvivid_common_setting']['migrate_size']); ?>" onkeyup="value=value.replace(/\D/g,'')" />KB
|
572 |
-
<div><p><?php _e('e.g. if you choose a chunk size of 2MB, a 8MB file will use 4 chunks. Decreasing this value will break the ISP\'s transmission limit, for example:512KB', 'wpvivid'); ?></p></div>
|
573 |
-
</div>
|
574 |
-
<div>
|
575 |
-
<strong>Retrying </strong>
|
576 |
-
<select option="setting" name="max_resume_count">
|
577 |
-
<?php
|
578 |
-
for($resume_count=3; $resume_count<10; $resume_count++){
|
579 |
-
if($resume_count === $wpvivid_max_resume_count){
|
580 |
-
_e('<option selected="selected" value="'.$resume_count.'">'.$resume_count.'</option>');
|
581 |
-
}
|
582 |
-
else{
|
583 |
-
_e('<option value="'.$resume_count.'">'.$resume_count.'</option>');
|
584 |
-
}
|
585 |
-
}
|
586 |
-
?>
|
587 |
-
</select><strong><?php _e(' times when encountering a time-out error', 'wpvivid'); ?></strong>
|
588 |
-
</div>
|
589 |
-
</div>
|
590 |
</div>
|
591 |
-
|
592 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
593 |
<?php
|
594 |
}
|
595 |
|
596 |
-
|
597 |
-
|
598 |
-
|
599 |
-
|
600 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
601 |
?>
|
46 |
global $wpvivid_plugin;
|
47 |
$out_of_date=$wpvivid_plugin->_get_out_of_date_info();
|
48 |
?>
|
49 |
+
<div class="postbox schedule-tab-block">
|
50 |
+
<div>
|
51 |
+
<select option="setting" name="max_backup_count" id="wpvivid_max_backup_count">
|
52 |
+
<?php
|
53 |
+
for($i=1; $i<8;$i++){
|
54 |
+
if($i === $display_backup_count){
|
55 |
+
_e('<option selected="selected" value="' . $i . '">' . $i . '</option>', 'wpvivid');
|
56 |
+
}
|
57 |
+
else {
|
58 |
+
_e('<option value="' . $i . '">' . $i . '</option>', 'wpvivid');
|
59 |
+
}
|
60 |
+
}
|
61 |
+
?>
|
62 |
+
</select><strong><?php _e('backups retained', 'wpvivid'); ?></strong>
|
63 |
+
</div>
|
64 |
+
<div>
|
65 |
+
<label for="wpvivid_estimate_backup">
|
66 |
+
<input type="checkbox" option="setting" name="estimate_backup" id="wpvivid_estimate_backup" value="1" <?php esc_attr_e($wpvivid_setting_estimate_backup, 'wpvivid'); ?> />
|
67 |
+
<span><?php _e( 'Calculate the size of files, folder and database before backing up ', 'wpvivid' ); ?></span>
|
68 |
+
</label>
|
69 |
+
</div>
|
70 |
+
<div>
|
71 |
+
<label>
|
72 |
+
<input type="checkbox" option="setting" name="show_tab_menu" <?php esc_attr_e($wpvivid_show_tab_menu); ?> />
|
73 |
+
<span><?php _e('Display the tab pages in admin navigation menu', 'wpvivid'); ?></span>
|
74 |
+
</label>
|
75 |
+
</div>
|
76 |
+
<div>
|
77 |
+
<label>
|
78 |
+
<input type="checkbox" option="setting" name="show_admin_bar" <?php esc_attr_e($show_admin_bar); ?> />
|
79 |
+
<span><?php _e('Show WPvivid backup plugin on top admin bar', 'wpvivid'); ?></span>
|
80 |
+
</label>
|
81 |
+
</div>
|
82 |
+
</div>
|
83 |
+
<div class="postbox schedule-tab-block">
|
84 |
+
<div><strong><?php _e('Backup Folder', 'wpvivid'); ?></strong></div>
|
85 |
+
<div class="setting-tab-block">
|
86 |
+
<div><p><?php _e( 'Name your folder, this folder must be writable for creating backup files.', 'wpvivid' ); ?><p> </div>
|
87 |
+
<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,'')" />
|
88 |
+
<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>
|
89 |
+
</div>
|
90 |
+
<div>
|
91 |
+
<label>
|
92 |
+
<input type="checkbox" option="setting" name="domain_include" <?php esc_attr_e($wpvivid_domain_include); ?> />
|
93 |
+
<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>
|
94 |
+
</label>
|
95 |
+
</div>
|
96 |
+
</div>
|
97 |
+
<div class="postbox schedule-tab-block">
|
98 |
+
<div><strong><?php _e('Remove out-of-date backups', 'wpvivid'); ?></strong></div>
|
99 |
+
<div class="setting-tab-block">
|
100 |
+
<fieldset>
|
101 |
+
<label for="users_can_register">
|
102 |
+
<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>
|
103 |
+
<p><span><?php _e('Remote Storage Directory:', 'wpvivid'); ?></span><span id="wpvivid_out_of_date_remote_path">
|
|
|
|
|
|
|
104 |
<?php
|
105 |
+
$wpvivid_get_remote_directory = '';
|
106 |
+
$wpvivid_get_remote_directory = apply_filters('wpvivid_get_remote_directory', $wpvivid_get_remote_directory);
|
107 |
+
echo $wpvivid_get_remote_directory;
|
108 |
?>
|
109 |
</span>
|
110 |
+
</p>
|
111 |
+
</label>
|
112 |
+
</fieldset>
|
113 |
+
</div>
|
114 |
+
<div class="setting-tab-block" style="padding: 10px 10px 0 0;">
|
115 |
+
<input class="button-primary" id="wpvivid_delete_out_of_backup" style="margin-right:10px;" type="submit" name="delete-out-of-backup" value="<?php esc_attr_e( 'Remove', 'wpvivid' ); ?>" />
|
116 |
+
<p><?php _e('The action is irreversible! It will remove all backups which is(are) out-of-date (including local web server and remote storage) if they exist.', 'wpvivid'); ?> </p>
|
117 |
+
</div>
|
118 |
+
</div>
|
|
|
119 |
<script>
|
120 |
jQuery('#wpvivid_delete_out_of_backup').click(function(){
|
121 |
wpvivid_delete_out_of_date_backups();
|
172 |
$wpvivid_setting_email_failed='checked';
|
173 |
}
|
174 |
?>
|
175 |
+
<div class="postbox schedule-tab-block" id="wpvivid_email_report">
|
176 |
+
<div><p><?php _e('In order to use this function, please install a ', 'wpvivid'); ?><strong><a target="_blank" href="https://wpvivid.com/8-best-smtp-plugins-for-wordpress.html"><?php _e('WordPress SMTP plugin', 'wpvivid'); ?></a></strong><?php _e(' of your preference and configure your SMTP server first. This is because WordPress uses the PHP Mail function to send its emails by default, which is not supported by many hosts and can cause issues if it is not set properly.', 'wpvivid'); ?></p>
|
177 |
+
</div>
|
178 |
+
<div>
|
179 |
+
<label for="wpvivid_general_email_enable">
|
180 |
+
<input type="checkbox" option="setting" name="email_enable" id="wpvivid_general_email_enable" value="1" <?php esc_attr_e($setting_email_enable, 'wpvivid'); ?> />
|
181 |
+
<span><strong><?php _e( 'Enable email report', 'wpvivid' ); ?></strong></span>
|
182 |
+
</label>
|
183 |
+
</div>
|
184 |
+
<div id="wpvivid_general_email_setting" style="<?php esc_attr_e($setting_email_display, 'wpvivid'); ?>" >
|
185 |
+
<input type="text" placeholder="example@yourdomain.com" option="setting" name="send_to" class="regular-text" id="wpvivid_mail" value="<?php
|
186 |
+
foreach ($general_setting['options']['wpvivid_email_setting']['send_to'] as $mail) {
|
187 |
+
_e($mail, 'wpvivid');
|
188 |
+
break;
|
189 |
+
}
|
190 |
+
?>" />
|
191 |
+
<input class="button-secondary" id="wpvivid_send_email_test" style="margin-top:10px;" type="submit" name="" value="<?php esc_attr_e( 'Test Email', 'wpvivid' ); ?>" title="Send an email for testing mail function"/>
|
192 |
+
<div id="wpvivid_send_email_res"></div>
|
193 |
+
<fieldset class="setting-tab-block">
|
194 |
+
<label >
|
195 |
+
<input type="radio" option="setting" name="always" value="1" <?php esc_attr_e($wpvivid_setting_email_always, 'wpvivid'); ?> />
|
196 |
+
<span><?php _e( 'Always send an email notification when a backup is complete', 'wpvivid' ); ?></span>
|
197 |
+
</label><br>
|
198 |
+
<label >
|
199 |
+
<input type="radio" option="setting" name="always" value="0" <?php esc_attr_e($wpvivid_setting_email_failed, 'wpvivid'); ?> />
|
200 |
+
<span><?php _e( 'Only send an email notification when a backup fails', 'wpvivid' ); ?></span>
|
201 |
+
</label>
|
202 |
+
</fieldset>
|
203 |
+
</div>
|
204 |
+
</div>
|
|
|
|
|
|
|
|
|
|
|
205 |
<script>
|
206 |
jQuery('#wpvivid_send_email_test').click(function(){
|
207 |
wpvivid_email_test();
|
243 |
global $wpvivid_plugin;
|
244 |
$junk_file=$wpvivid_plugin->_junk_files_info();
|
245 |
?>
|
246 |
+
<div class="postbox schedule-tab-block" id="wpvivid_clean_junk">
|
247 |
+
<div>
|
248 |
+
<strong><?php _e('Web-server disk space in use by WPvivid', 'wpvivid'); ?></strong>
|
249 |
+
</div>
|
250 |
+
<div class="setting-tab-block">
|
251 |
+
<div class="setting-tab-block">
|
252 |
+
<span><?php _e('Total Size:', 'wpvivid'); ?></span>
|
253 |
+
<span id="wpvivid_junk_sum_size"><?php _e($junk_file['sum_size'], 'wpvivid'); ?></span>
|
254 |
+
<input class="button-secondary" id="wpvivid_calculate_size" style="margin-left:10px;" type="submit" name="Calculate-Sizes" value="<?php esc_attr_e( 'Calculate Sizes', 'wpvivid' ); ?>" />
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
255 |
</div>
|
256 |
+
<fieldset>
|
257 |
+
<label for="wpvivid_junk_log">
|
258 |
+
<input type="checkbox" id="wpvivid_junk_log" option="junk-files" name="log" value="junk-log" />
|
259 |
+
<span><?php _e( 'logs', 'wpvivid' ); ?></span>
|
260 |
+
<span><?php _e('Path:', 'wpvivid' ); ?></span><span id="wpvivid_junk_log_path"><?php _e($junk_file['log_path'], 'wpvivid'); ?></span>
|
261 |
+
</label>
|
262 |
+
</fieldset>
|
263 |
+
<fieldset>
|
264 |
+
<label for="wpvivid_junk_backup_cache">
|
265 |
+
<input type="checkbox" id="wpvivid_junk_backup_cache" option="junk-files" name="backup_cache" value="junk-backup-cache" />
|
266 |
+
<span><?php _e( 'Backup Cache', 'wpvivid' ); ?></span>
|
267 |
+
</label>
|
268 |
+
<label for="wpvivid_junk_file">
|
269 |
+
<input type="checkbox" id="wpvivid_junk_file" option="junk-files" name="junk_files" value="junk-files" />
|
270 |
+
<span><?php _e( 'Junk', 'wpvivid' ); ?></span>
|
271 |
+
<span><?php _e('Path:', 'wpvivid' ); ?></span><span id="wpvivid_junk_file_path"><?php _e($junk_file['junk_path'], 'wpvivid'); ?></span>
|
272 |
+
</label>
|
273 |
+
</fieldset>
|
274 |
+
<fieldset>
|
275 |
+
<label for="wpvivid_junk_temporary_file">
|
276 |
+
<input type="checkbox" id="wpvivid_junk_temporary_file" option="junk-files" name="old_files" value="junk-temporary-files" />
|
277 |
+
<span><?php _e( 'Temporary Files', 'wpvivid' ); ?></span>
|
278 |
+
<span><?php _e('Path:', 'wpvivid'); ?></span><span id="wpvivid_restore_temp_file_path"><?php _e($junk_file['old_files_path'], 'wpvivid'); ?></span>
|
279 |
+
<p><?php _e('Temporary Files are created by wpvivid when restoring a website.', 'wpvivid'); ?></p>
|
280 |
+
</label>
|
281 |
+
</fieldset>
|
282 |
+
</div>
|
283 |
+
<div><input class="button-primary" id="wpvivid_clean_junk_file" type="submit" name="Empty-all-files" value="<?php esc_attr_e( 'Empty', 'wpvivid' ); ?>" /></div>
|
284 |
+
<div style="clear:both;"></div>
|
285 |
+
</div>
|
286 |
<script>
|
287 |
jQuery('#wpvivid_calculate_size').click(function(){
|
288 |
wpvivid_calculate_diskspaceused();
|
380 |
function wpvivid_export_import_settings()
|
381 |
{
|
382 |
?>
|
383 |
+
<div class="postbox schedule-tab-block" id="wpvivid_export_import">
|
384 |
+
<div class="setting-tab-block" style="padding-bottom: 0;">
|
385 |
+
<input class="button-primary" id="wpvivid_setting_export" type="button" name="" value="<?php esc_attr_e( 'Export', 'wpvivid' ); ?>" />
|
386 |
+
<p><?php _e('Click \'Export\' button to save WPvivid settings on your local computer.', 'wpvivid'); ?> </p>
|
387 |
+
</div>
|
388 |
+
<div class="setting-tab-block" style="padding: 0 10px 0 0;">
|
389 |
+
<input type="file" name="fileTrans" id="wpvivid_select_import_file"></br>
|
390 |
+
<input class="button-primary" id="wpvivid_setting_import" type="button" name="" value="<?php esc_attr_e( 'Import', 'wpvivid' ); ?>" />
|
391 |
+
<p><?php _e('Importing the json file can help you set WPvivid\'s configuration on another wordpress site quickly.', 'wpvivid'); ?></p>
|
392 |
+
</div>
|
393 |
+
<div style="clear:both;"></div>
|
394 |
+
</div>
|
|
|
|
|
|
|
|
|
|
|
395 |
<script>
|
396 |
jQuery('#wpvivid_setting_export').click(function(){
|
397 |
wpvivid_export_settings();
|
401 |
wpvivid_import_settings();
|
402 |
});
|
403 |
|
|
|
|
|
|
|
404 |
function wpvivid_export_settings() {
|
405 |
wpvivid_location_href=true;
|
406 |
location.href =ajaxurl+'?action=wpvivid_export_setting&setting=1&history=1&review=0';
|
407 |
}
|
408 |
|
|
|
|
|
|
|
409 |
function wpvivid_import_settings(){
|
410 |
var files = jQuery('input[name="fileTrans"]').prop('files');
|
411 |
|
485 |
$general_setting['options']['wpvivid_common_setting']['migrate_size']=WPVIVID_MIGRATE_SIZE;
|
486 |
}
|
487 |
?>
|
488 |
+
<div class="postbox schedule-tab-block setting-page-content">
|
489 |
+
<div>
|
490 |
+
<p><strong><?php _e('Enable the option when backup failed.', 'wpvivid'); ?></strong><?php _e(' Special optimization for web hosting/shared hosting', 'wpvivid'); ?></p>
|
491 |
+
<div>
|
492 |
+
<label>
|
493 |
+
<input type="checkbox" option="setting" name="subpackage_plugin_upload" <?php esc_attr_e($subpackage_plugin_upload); ?> />
|
494 |
+
<span><strong><?php _e('Enable optimization mode for web hosting/shared hosting', 'wpvivid'); ?></strong></span>
|
495 |
+
</label>
|
496 |
<div>
|
497 |
+
<p><?php _e('Enabling this option can improve the backup success rate, but it will take more time for backup.', 'wpvivid'); ?></p>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
498 |
</div>
|
499 |
</div>
|
500 |
+
</div>
|
501 |
+
</div>
|
502 |
+
<div class="postbox schedule-tab-block setting-page-content">
|
503 |
+
<fieldset>
|
504 |
+
<label>
|
505 |
+
<input type="radio" option="setting" name="no_compress" value="1" <?php esc_attr_e($wpvivid_setting_no_compress, 'wpvivid'); ?> />
|
506 |
+
<span title="<?php _e( 'It will cause a lower CPU Usage and is recommended in a web hosting/ shared hosting environment.', 'wpvivid' ); ?>"><?php _e( 'Only Archive without compressing', 'wpvivid' ); ?></span>
|
507 |
+
</label>
|
508 |
+
<label>
|
509 |
+
<input type="radio" option="setting" name="no_compress" value="0" <?php esc_attr_e($wpvivid_setting_compress, 'wpvivid'); ?> />
|
510 |
+
<span title="<?php _e( 'It will cause a higher CPU Usage and is recommended in a VPS/ dedicated hosting environment.', 'wpvivid' ); ?>"><?php _e( 'Compress and Archive', 'wpvivid' ); ?></span>
|
511 |
+
</label>
|
512 |
+
<label style="display: none;">
|
513 |
+
<input type="radio" option="setting" name="compress_type" value="zip" checked />
|
514 |
+
<input type="radio" option="setting" name="use_temp_file" value="1" checked />
|
515 |
+
<input type="radio" option="setting" name="use_temp_size" value="16" checked />
|
516 |
+
</label>
|
517 |
+
</fieldset>
|
518 |
|
519 |
+
<div style="padding-top: 10px;">
|
520 |
+
<div><strong><?php _e('Compress Files Every', 'wpvivid'); ?></strong></div>
|
521 |
+
<div class="setting-tab-block">
|
522 |
+
<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
|
523 |
+
<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 hitting 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>
|
524 |
+
</div>
|
525 |
+
<div><strong><?php _e('Exclude the files which are larger than', 'wpvivid'); ?></strong></div>
|
526 |
+
<div class="setting-tab-block">
|
527 |
+
<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
|
528 |
+
<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>
|
529 |
+
</div>
|
530 |
+
<div><strong><?php _e('PHP script execution timeout', 'wpvivid'); ?></strong></div>
|
531 |
+
<div class="setting-tab-block">
|
532 |
+
<input type="text" placeholder="600" option="setting" name="max_execution_time" id="wpvivid_option_timeout" class="all-options" value="<?php esc_attr_e($general_setting['options']['wpvivid_common_setting']['max_execution_time'], 'wpvivid'); ?>" onkeyup="value=value.replace(/\D/g,'')" />Seconds
|
533 |
+
<div><p><?php _e( 'The time-out is not your server PHP time-out. With the execution time exhausted, our plugin will shut the process of backup down. If the progress of backup encounters a time-out, that means you have a medium or large sized website, please try to scale the value bigger. ', 'wpvivid' ); ?></p></div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
534 |
</div>
|
535 |
+
<div><strong><?php _e('PHP Memory Limit for backup', 'wpvivid'); ?></strong></div>
|
536 |
+
<div class="setting-tab-block">
|
537 |
+
<input type="text" placeholder="256" option="setting" name="memory_limit" class="all-options" value="<?php esc_attr_e(str_replace('M', '', $general_setting['options']['wpvivid_common_setting']['memory_limit']), 'wpvivid'); ?>" onkeyup="value=value.replace(/\D/g,'')" />MB
|
538 |
+
<div><p><?php _e('Adjust this value to apply for a temporary PHP memory limit for WPvivid backup plugin to run a backup. We set this value to 256M by default. Increase the value if you encounter a memory exhausted error. Note: some web hosting providers may not support this.', 'wpvivid'); ?></p></div>
|
539 |
+
</div>
|
540 |
+
<div><strong><?php _e('PHP Memory Limit for restoration', 'wpvivid'); ?></strong></div>
|
541 |
+
<div class="setting-tab-block">
|
542 |
+
<input type="text" placeholder="256" option="setting" name="restore_memory_limit" class="all-options" value="<?php esc_attr_e(str_replace('M', '', $general_setting['options']['wpvivid_common_setting']['restore_memory_limit']), 'wpvivid'); ?>" onkeyup="value=value.replace(/\D/g,'')" />MB
|
543 |
+
<div><p><?php _e('Adjust this value to apply for a temporary PHP memory limit for WPvivid backup plugin in restore process. We set this value to 256M by default. Increase the value if you encounter a memory exhausted error. Note: some web hosting providers may not support this.', 'wpvivid'); ?></p></div>
|
544 |
+
</div>
|
545 |
+
<div><strong><?php _e('Chunk Size', 'wpvivid'); ?></strong></div>
|
546 |
+
<div class="setting-tab-block">
|
547 |
+
<input type="text" placeholder="2" option="setting" name="migrate_size" class="all-options" value="<?php esc_attr_e($general_setting['options']['wpvivid_common_setting']['migrate_size']); ?>" onkeyup="value=value.replace(/\D/g,'')" />KB
|
548 |
+
<div><p><?php _e('e.g. if you choose a chunk size of 2MB, a 8MB file will use 4 chunks. Decreasing this value will break the ISP\'s transmission limit, for example:512KB', 'wpvivid'); ?></p></div>
|
549 |
+
</div>
|
550 |
+
<div>
|
551 |
+
<strong>Retrying </strong>
|
552 |
+
<select option="setting" name="max_resume_count">
|
553 |
+
<?php
|
554 |
+
for($resume_count=3; $resume_count<10; $resume_count++){
|
555 |
+
if($resume_count === $wpvivid_max_resume_count){
|
556 |
+
_e('<option selected="selected" value="'.$resume_count.'">'.$resume_count.'</option>');
|
557 |
+
}
|
558 |
+
else{
|
559 |
+
_e('<option value="'.$resume_count.'">'.$resume_count.'</option>');
|
560 |
+
}
|
561 |
+
}
|
562 |
+
?>
|
563 |
+
</select><strong><?php _e(' times when encountering a time-out error', 'wpvivid'); ?></strong>
|
564 |
+
</div>
|
565 |
+
</div>
|
566 |
+
</div>
|
567 |
<?php
|
568 |
}
|
569 |
|
570 |
+
function wpvivid_add_setting_tab_page($setting_array){
|
571 |
+
$setting_array['general_setting'] = array('index' => '1', 'tab_func' => 'wpvivid_settingpage_add_tab_general', 'page_func' => 'wpvivid_settingpage_add_page_general');
|
572 |
+
$setting_array['advance_setting'] = array('index' => '2', 'tab_func' => 'wpvivid_settingpage_add_tab_advance', 'page_func' => 'wpvivid_settingpage_add_page_advance');
|
573 |
+
return $setting_array;
|
574 |
+
}
|
575 |
+
|
576 |
+
function wpvivid_settingpage_add_tab_general(){
|
577 |
+
?>
|
578 |
+
<a href="#" id="wpvivid_tab_general_setting" class="nav-tab setting-nav-tab nav-tab-active" onclick="switchsettingTabs(event,'page-general-setting')"><?php _e('General Settings', 'wpvivid'); ?></a>
|
579 |
+
<?php
|
580 |
+
}
|
581 |
+
|
582 |
+
function wpvivid_settingpage_add_tab_advance(){
|
583 |
+
?>
|
584 |
+
<a href="#" id="wpvivid_tab_advance_setting" class="nav-tab setting-nav-tab" onclick="switchsettingTabs(event,'page-advance-setting')"><?php _e('Advanced Settings', 'wpvivid'); ?></a>
|
585 |
+
<?php
|
586 |
+
}
|
587 |
+
|
588 |
+
function wpvivid_settingpage_add_page_general(){
|
589 |
+
?>
|
590 |
+
<div class="setting-tab-content wpvivid_tab_general_setting" id="page-general-setting" style="margin-top: 10px;">
|
591 |
+
<?php do_action('wpvivid_setting_add_general_cell'); ?>
|
592 |
+
</div>
|
593 |
+
<?php
|
594 |
+
}
|
595 |
+
|
596 |
+
function wpvivid_settingpage_add_page_advance(){
|
597 |
+
?>
|
598 |
+
<div class="setting-tab-content wpvivid_tab_advance_setting" id="page-advance-setting" style="margin-top: 10px; display: none;">
|
599 |
+
<?php do_action('wpvivid_setting_add_advance_cell'); ?>
|
600 |
+
</div>
|
601 |
+
<?php
|
602 |
+
}
|
603 |
+
|
604 |
+
add_filter('wpvivid_add_setting_tab_page', 'wpvivid_add_setting_tab_page', 10);
|
605 |
+
|
606 |
+
add_action('wpvivid_setting_add_general_cell','wpvivid_general_settings',10);
|
607 |
+
add_action('wpvivid_setting_add_advance_cell','wpvivid_advanced_settings',13);
|
608 |
+
add_action('wpvivid_setting_add_general_cell','wpvivid_email_report',14);
|
609 |
+
add_action('wpvivid_setting_add_general_cell','wpvivid_clean_junk',15);
|
610 |
+
add_action('wpvivid_setting_add_general_cell','wpvivid_export_import_settings',16);
|
611 |
?>
|
admin/partials/wpvivid-website-info-page-display.php
CHANGED
@@ -26,5 +26,8 @@
|
|
26 |
}, 3000);
|
27 |
});
|
28 |
}
|
29 |
-
|
30 |
-
|
|
|
|
|
|
26 |
}, 3000);
|
27 |
});
|
28 |
}
|
29 |
+
jQuery(document).ready(function ()
|
30 |
+
{
|
31 |
+
wpvivid_get_ini_memory_limit();
|
32 |
+
});
|
33 |
+
</script>
|
includes/class-wpvivid-backup-uploader.php
CHANGED
@@ -175,9 +175,23 @@ class Wpvivid_BackupUploader
|
|
175 |
$backup_data['files']=array();
|
176 |
if(preg_match('/wpvivid-.*_.*_.*\.zip$/',$files[0]['name']))
|
177 |
{
|
178 |
-
if(preg_match('/wpvivid-(.*?)_/',$files[0]['name'],$
|
179 |
{
|
180 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
181 |
$id=substr($id,0,strlen($id)-1);
|
182 |
$unlinked_file = '';
|
183 |
$check_result=true;
|
@@ -202,7 +216,8 @@ class Wpvivid_BackupUploader
|
|
202 |
$wpvivid_plugin->wpvivid_log->CreateLogFile($id.'_upload','no_folder','upload');
|
203 |
$wpvivid_plugin->wpvivid_log->WriteLogHander();
|
204 |
$wpvivid_plugin->wpvivid_log->WriteLog('Upload finished.','notice');
|
205 |
-
|
|
|
206 |
$html = '';
|
207 |
$html = apply_filters('wpvivid_add_backup_list', $html);
|
208 |
$ret['result']=WPVIVID_SUCCESS;
|
@@ -310,18 +325,40 @@ class Wpvivid_BackupUploader
|
|
310 |
{
|
311 |
$backup_data['result']='success';
|
312 |
$backup_data['files']=array();
|
|
|
|
|
|
|
313 |
foreach ($backup['files'] as $file)
|
314 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
315 |
$add_file['file_name']=$file;
|
316 |
$add_file['size']=filesize($path.$file);
|
317 |
$backup_data['files'][]=$add_file;
|
318 |
}
|
|
|
319 |
global $wpvivid_plugin;
|
320 |
$wpvivid_plugin->wpvivid_log=new WPvivid_Log();
|
321 |
$wpvivid_plugin->wpvivid_log->CreateLogFile($backup_id.'_scan','no_folder','scan');
|
322 |
$wpvivid_plugin->wpvivid_log->WriteLogHander();
|
323 |
$wpvivid_plugin->wpvivid_log->WriteLog('Upload finished.','notice');
|
324 |
-
WPvivid_Backuplist::add_new_upload_backup($backup_id,$backup_data,$wpvivid_plugin->wpvivid_log->log_file);
|
325 |
}
|
326 |
}
|
327 |
$ret['result']=WPVIVID_SUCCESS;
|
175 |
$backup_data['files']=array();
|
176 |
if(preg_match('/wpvivid-.*_.*_.*\.zip$/',$files[0]['name']))
|
177 |
{
|
178 |
+
if(preg_match('/wpvivid-(.*?)_/',$files[0]['name'],$matches_id))
|
179 |
{
|
180 |
+
if(preg_match('/[0-9]{4}-[0-9]{2}-[0-9]{2}-[0-9]{2}-[0-9]{2}/',$files[0]['name'],$matches))
|
181 |
+
{
|
182 |
+
$backup_time=$matches[0];
|
183 |
+
$time_array=explode('-',$backup_time);
|
184 |
+
if(sizeof($time_array)>4)
|
185 |
+
$time=$time_array[0].'-'.$time_array[1].'-'.$time_array[2].' '.$time_array[3].':'.$time_array[4];
|
186 |
+
else
|
187 |
+
$time=$backup_time;
|
188 |
+
$time=strtotime($time);
|
189 |
+
}
|
190 |
+
else
|
191 |
+
{
|
192 |
+
$time=time();
|
193 |
+
}
|
194 |
+
$id= $matches_id[0];
|
195 |
$id=substr($id,0,strlen($id)-1);
|
196 |
$unlinked_file = '';
|
197 |
$check_result=true;
|
216 |
$wpvivid_plugin->wpvivid_log->CreateLogFile($id.'_upload','no_folder','upload');
|
217 |
$wpvivid_plugin->wpvivid_log->WriteLogHander();
|
218 |
$wpvivid_plugin->wpvivid_log->WriteLog('Upload finished.','notice');
|
219 |
+
file_put_contents('D:\test1.txt', 'id->'.$id);
|
220 |
+
WPvivid_Backuplist::add_new_upload_backup($id,$backup_data,$time,$wpvivid_plugin->wpvivid_log->log_file);
|
221 |
$html = '';
|
222 |
$html = apply_filters('wpvivid_add_backup_list', $html);
|
223 |
$ret['result']=WPVIVID_SUCCESS;
|
325 |
{
|
326 |
$backup_data['result']='success';
|
327 |
$backup_data['files']=array();
|
328 |
+
if(empty($backup['files']))
|
329 |
+
continue;
|
330 |
+
$time=false;
|
331 |
foreach ($backup['files'] as $file)
|
332 |
{
|
333 |
+
if($time===false)
|
334 |
+
{
|
335 |
+
if(preg_match('/[0-9]{4}-[0-9]{2}-[0-9]{2}-[0-9]{2}-[0-9]{2}/',$file,$matches))
|
336 |
+
{
|
337 |
+
$backup_time=$matches[0];
|
338 |
+
$time_array=explode('-',$backup_time);
|
339 |
+
if(sizeof($time_array)>4)
|
340 |
+
$time=$time_array[0].'-'.$time_array[1].'-'.$time_array[2].' '.$time_array[3].':'.$time_array[4];
|
341 |
+
else
|
342 |
+
$time=$backup_time;
|
343 |
+
$time=strtotime($time);
|
344 |
+
}
|
345 |
+
else
|
346 |
+
{
|
347 |
+
$time=time();
|
348 |
+
}
|
349 |
+
}
|
350 |
+
|
351 |
$add_file['file_name']=$file;
|
352 |
$add_file['size']=filesize($path.$file);
|
353 |
$backup_data['files'][]=$add_file;
|
354 |
}
|
355 |
+
|
356 |
global $wpvivid_plugin;
|
357 |
$wpvivid_plugin->wpvivid_log=new WPvivid_Log();
|
358 |
$wpvivid_plugin->wpvivid_log->CreateLogFile($backup_id.'_scan','no_folder','scan');
|
359 |
$wpvivid_plugin->wpvivid_log->WriteLogHander();
|
360 |
$wpvivid_plugin->wpvivid_log->WriteLog('Upload finished.','notice');
|
361 |
+
WPvivid_Backuplist::add_new_upload_backup($backup_id,$backup_data,$time,$wpvivid_plugin->wpvivid_log->log_file);
|
362 |
}
|
363 |
}
|
364 |
$ret['result']=WPVIVID_SUCCESS;
|
includes/class-wpvivid-backup.php
CHANGED
@@ -16,6 +16,10 @@ define('WPVIVID_BACKUP_TYPE_CORE','backup_core');
|
|
16 |
define('WPVIVID_BACKUP_TYPE_OTHERS','backup_others');
|
17 |
define('WPVIVID_BACKUP_TYPE_MERGE','backup_merge');
|
18 |
|
|
|
|
|
|
|
|
|
19 |
class WPvivid_Backup_Task
|
20 |
{
|
21 |
private $task;
|
@@ -117,6 +121,9 @@ class WPvivid_Backup_Task
|
|
117 |
$this->task['options']['lock']=0;
|
118 |
}
|
119 |
|
|
|
|
|
|
|
120 |
if(isset($options['ismerge']))
|
121 |
{
|
122 |
if($options['ismerge']=='1')
|
@@ -129,7 +136,7 @@ class WPvivid_Backup_Task
|
|
129 |
}
|
130 |
else {
|
131 |
$this->task['options']['backup_options']['ismerge']=1;
|
132 |
-
}
|
133 |
|
134 |
$home_url_prefix=get_home_url();
|
135 |
$home_url_prefix=$this->parse_url_all($home_url_prefix);
|
@@ -253,38 +260,55 @@ class WPvivid_Backup_Task
|
|
253 |
$backup_data['path']=WP_CONTENT_DIR.DIRECTORY_SEPARATOR. $this->task['options']['backup_options']['dir'].DIRECTORY_SEPARATOR;
|
254 |
if($backup==WPVIVID_BACKUP_TYPE_DB)
|
255 |
{
|
256 |
-
|
|
|
257 |
$backup_data['dump_db']=1;
|
258 |
$backup_data['sql_file_name']=WP_CONTENT_DIR.DIRECTORY_SEPARATOR.$this->task['options']['backup_options']['dir'].DIRECTORY_SEPARATOR.$this->get_prefix().'_backup_db.sql';
|
259 |
$backup_data['json_info']['dump_db']=1;
|
|
|
260 |
$backup_data['prefix']=$this->get_prefix().'_backup_db';
|
261 |
$this->task['options']['backup_options']['backup'][$backup_data['key']]=$backup_data;
|
262 |
}
|
263 |
else if($backup==WPVIVID_BACKUP_TYPE_THEMES)
|
264 |
{
|
265 |
-
|
|
|
266 |
$backup_data['prefix']=$this->get_prefix().'_backup_themes';
|
267 |
$backup_data['files_root']=$this->transfer_path(get_theme_root());
|
268 |
$backup_data['exclude_regex']=array();
|
269 |
$backup_data['include_regex']=array();
|
|
|
|
|
270 |
$this->task['options']['backup_options']['backup'][$backup_data['key']]=$backup_data;
|
271 |
}
|
272 |
else if($backup==WPVIVID_BACKUP_TYPE_PLUGIN)
|
273 |
{
|
274 |
-
|
|
|
275 |
$backup_data['prefix']=$this->get_prefix().'_backup_plugin';
|
276 |
if(isset($backup_data['compress']['subpackage_plugin_upload'])&&$backup_data['compress']['subpackage_plugin_upload'])
|
277 |
{
|
278 |
$backup_data['plugin_subpackage']=1;
|
279 |
}
|
280 |
$backup_data['files_root']=$this->transfer_path(WP_PLUGIN_DIR);
|
281 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
282 |
$backup_data['exclude_regex']=$exclude_regex;
|
283 |
$backup_data['include_regex']=array();
|
|
|
|
|
284 |
}
|
285 |
else if($backup==WPVIVID_BACKUP_TYPE_UPLOADS)
|
286 |
{
|
287 |
-
|
|
|
288 |
$backup_data['prefix']=$this->get_prefix().'_backup_uploads';
|
289 |
$upload_dir = wp_upload_dir();
|
290 |
$backup_data['files_root']=$this -> transfer_path($upload_dir['basedir']);
|
@@ -293,10 +317,12 @@ class WPvivid_Backup_Task
|
|
293 |
$exclude_regex[]='#^'.preg_quote($this -> transfer_path($upload_dir['basedir']).DIRECTORY_SEPARATOR.'ShortpixelBackups', '/').'#';//ShortpixelBackups
|
294 |
$backup_data['exclude_regex']=$exclude_regex;
|
295 |
$backup_data['include_regex']=array();
|
|
|
296 |
}
|
297 |
else if($backup==WPVIVID_BACKUP_TYPE_UPLOADS_FILES)
|
298 |
{
|
299 |
-
|
|
|
300 |
$backup_data['prefix']=$this->get_prefix().'_backup_uploads';
|
301 |
$backup_data['uploads_subpackage']=1;
|
302 |
$upload_dir = wp_upload_dir();
|
@@ -306,10 +332,12 @@ class WPvivid_Backup_Task
|
|
306 |
$exclude_regex[]='#^'.preg_quote($this -> transfer_path($upload_dir['basedir']).DIRECTORY_SEPARATOR.'ShortpixelBackups', '/').'#';
|
307 |
$backup_data['exclude_regex']=$exclude_regex;
|
308 |
$backup_data['include_regex'][]='#^'.preg_quote($this -> transfer_path($upload_dir['basedir']).DIRECTORY_SEPARATOR, '/').'[0-9]{4}#';
|
|
|
309 |
}
|
310 |
else if($backup==WPVIVID_BACKUP_TYPE_UPLOADS_FILES_OTHER)
|
311 |
{
|
312 |
-
|
|
|
313 |
$backup_data['prefix']=$this->get_prefix().'_backup_uploads_other';
|
314 |
$upload_dir = wp_upload_dir();
|
315 |
$backup_data['files_root']=$this -> transfer_path($upload_dir['basedir']);
|
@@ -319,10 +347,12 @@ class WPvivid_Backup_Task
|
|
319 |
$exclude_regex[]='#^'.preg_quote($this -> transfer_path($upload_dir['basedir']).DIRECTORY_SEPARATOR, '/').'[0-9]{4}#';
|
320 |
$backup_data['exclude_regex']=$exclude_regex;
|
321 |
$backup_data['include_regex']=array();
|
|
|
322 |
}
|
323 |
else if($backup==WPVIVID_BACKUP_TYPE_CONTENT)
|
324 |
{
|
325 |
-
|
|
|
326 |
$backup_data['prefix']=$this->get_prefix().'_backup_content';
|
327 |
$backup_data['files_root']=$this -> transfer_path(WP_CONTENT_DIR);
|
328 |
$exclude_regex[]='#^'.preg_quote($this -> transfer_path(WP_CONTENT_DIR).DIRECTORY_SEPARATOR.'updraft', '/').'#'; // Updraft Plus backup directory
|
@@ -339,33 +369,37 @@ class WPvivid_Backup_Task
|
|
339 |
$exclude_regex[]='#^'.preg_quote($this->transfer_path(get_theme_root()), '/').'#';
|
340 |
$backup_data['exclude_regex']=$exclude_regex;
|
341 |
$backup_data['include_regex']=array();
|
|
|
342 |
}
|
343 |
else if($backup==WPVIVID_BACKUP_TYPE_CORE)
|
344 |
{
|
345 |
-
|
|
|
346 |
$backup_data['prefix']=$this->get_prefix().'_backup_core';
|
347 |
-
$backup_data['files_root']=$this -> transfer_path(
|
348 |
$backup_data['json_info']['include_path'][]='wp-includes';
|
349 |
$backup_data['json_info']['include_path'][]='wp-admin';
|
350 |
$backup_data['json_info']['wp_core']=1;
|
351 |
$backup_data['json_info']['home_url']=home_url();
|
352 |
-
$include_regex[]='#^'.preg_quote($this -> transfer_path(
|
353 |
-
$include_regex[]='#^'.preg_quote($this->transfer_path(
|
354 |
-
$exclude_regex[]='#^'.preg_quote($this->transfer_path(
|
355 |
-
$exclude_regex[]='#^'.preg_quote($this->transfer_path(
|
356 |
$backup_data['exclude_regex']=$exclude_regex;
|
357 |
$backup_data['include_regex']=$include_regex;
|
|
|
358 |
}
|
359 |
else if($backup==WPVIVID_BACKUP_TYPE_MERGE)
|
360 |
{
|
361 |
-
|
|
|
362 |
$backup_data['prefix']=$this->get_prefix().'_backup_all';
|
363 |
$backup_data['files']=array();
|
|
|
364 |
foreach ($this->task['options']['backup_options']['backup'] as $backup_finished_data)
|
365 |
{
|
366 |
$backup_data['files']=array_merge($backup_data['files'],$this->get_backup_file($backup_finished_data['key']));
|
367 |
}
|
368 |
-
$backup_data['json_info']['has_child']=1;
|
369 |
$backup_data['json_info']['home_url']=home_url();
|
370 |
}
|
371 |
else
|
@@ -380,6 +414,71 @@ class WPvivid_Backup_Task
|
|
380 |
}
|
381 |
}
|
382 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
383 |
public function wpvivid_set_backup($backup_data)
|
384 |
{
|
385 |
if(isset($backup_data['uploads_subpackage'])||isset($backup_data['plugin_subpackage']))
|
@@ -499,6 +598,10 @@ class WPvivid_Backup_Task
|
|
499 |
}
|
500 |
else
|
501 |
{
|
|
|
|
|
|
|
|
|
502 |
$backup_data['files'] =apply_filters('wpvivid_get_custom_need_backup_files', $backup_data['files'],$backup_data,$this->task['options']['backup_options']['compress']);
|
503 |
}
|
504 |
|
@@ -596,6 +699,7 @@ class WPvivid_Backup_Task
|
|
596 |
public function get_backup_result()
|
597 |
{
|
598 |
$ret['result']=WPVIVID_SUCCESS;
|
|
|
599 |
foreach ($this->task['options']['backup_options']['backup'] as $backup_data)
|
600 |
{
|
601 |
if($this->task['options']['backup_options']['ismerge']==1)
|
@@ -611,7 +715,7 @@ class WPvivid_Backup_Task
|
|
611 |
}
|
612 |
else
|
613 |
{
|
614 |
-
|
615 |
}
|
616 |
}
|
617 |
|
@@ -651,12 +755,30 @@ class WPvivid_Backup_Task
|
|
651 |
}
|
652 |
} else {
|
653 |
if($this->regex_match($exclude_regex, $path . DIRECTORY_SEPARATOR . $filename, 0)){
|
654 |
-
if ($exclude_file_size == 0)
|
655 |
-
|
656 |
-
|
657 |
-
|
658 |
$files[] = $path . DIRECTORY_SEPARATOR . $filename;
|
659 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
660 |
}
|
661 |
}
|
662 |
}
|
@@ -1145,12 +1267,28 @@ class WPvivid_Backup_Task
|
|
1145 |
if($this->regex_match($exclude_regex, $path . DIRECTORY_SEPARATOR . $filename, 0)){
|
1146 |
if ($exclude_file_size == 0)
|
1147 |
{
|
1148 |
-
$
|
1149 |
-
} else {
|
1150 |
-
if (filesize($path . DIRECTORY_SEPARATOR . $filename) < $exclude_file_size * 1024 * 1024)
|
1151 |
{
|
1152 |
$files[] = $path . DIRECTORY_SEPARATOR . $filename;
|
1153 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1154 |
}
|
1155 |
}
|
1156 |
}
|
@@ -1209,20 +1347,7 @@ class WPvivid_Backup_Task
|
|
1209 |
}
|
1210 |
}
|
1211 |
} else {
|
1212 |
-
|
1213 |
-
{
|
1214 |
-
if ($exclude_file_size == 0)
|
1215 |
-
{
|
1216 |
-
//if($subdir)
|
1217 |
-
// $files[] = $path . DIRECTORY_SEPARATOR . $filename;
|
1218 |
-
} else {
|
1219 |
-
if (filesize($path . DIRECTORY_SEPARATOR . $filename) < $exclude_file_size * 1024 * 1024)
|
1220 |
-
{
|
1221 |
-
//if($subdir)
|
1222 |
-
// $files[] = $path . DIRECTORY_SEPARATOR . $filename;
|
1223 |
-
}
|
1224 |
-
}
|
1225 |
-
}
|
1226 |
}
|
1227 |
}
|
1228 |
}
|
@@ -1623,7 +1748,8 @@ class WPvivid_Backup_Item
|
|
1623 |
if(isset($this->config['backup']['ismerge'])&&$this->config['backup']['ismerge']==1)
|
1624 |
{
|
1625 |
$packages[$index]['option']['has_child']=1;
|
1626 |
-
|
|
|
1627 |
foreach ($this->config['backup']['data']['meta']['files'] as $file)
|
1628 |
{
|
1629 |
$packages[$index]['files'][]=$file['file_name'];
|
@@ -1636,27 +1762,33 @@ class WPvivid_Backup_Item
|
|
1636 |
if($type['type_name']=='backup_db')
|
1637 |
{
|
1638 |
$packages[$index]['option']['dump_db']=1;
|
1639 |
-
|
|
|
1640 |
}
|
1641 |
else if($type['type_name']=='backup_themes')
|
1642 |
{
|
1643 |
-
|
|
|
1644 |
}
|
1645 |
else if($type['type_name']=='backup_plugin')
|
1646 |
{
|
1647 |
-
|
|
|
1648 |
}
|
1649 |
else if($type['type_name']=='backup_uploads')
|
1650 |
{
|
1651 |
-
|
|
|
1652 |
}
|
1653 |
else if($type['type_name']=='backup_content')
|
1654 |
{
|
1655 |
-
|
|
|
1656 |
}
|
1657 |
else if($type['type_name']=='backup_core')
|
1658 |
{
|
1659 |
-
|
|
|
1660 |
$packages[$index]['option']['include_path'][]='wp-includes';
|
1661 |
$packages[$index]['option']['include_path'][]='wp-admin';
|
1662 |
}
|
@@ -1845,6 +1977,7 @@ class WPvivid_Backup_Item
|
|
1845 |
}
|
1846 |
else{
|
1847 |
$task = WPvivid_taskmanager::get_download_task_v2($file['file_name']);
|
|
|
1848 |
if ($task === false) {
|
1849 |
$ret['result'] = WPVIVID_SUCCESS;
|
1850 |
$ret['files'][$file['file_name']]['status']='need_download';
|
@@ -2050,7 +2183,10 @@ class WPvivid_Backup
|
|
2050 |
}
|
2051 |
else
|
2052 |
{
|
2053 |
-
|
|
|
|
|
|
|
2054 |
}
|
2055 |
|
2056 |
$packages=$this->task->get_packages_info($data['key']);
|
@@ -2066,6 +2202,7 @@ class WPvivid_Backup
|
|
2066 |
|
2067 |
foreach ($packages as $package)
|
2068 |
{
|
|
|
2069 |
if(!empty($package['files'])&&$package['backup']==false)
|
2070 |
{
|
2071 |
$zip_ret=$zip->_zip($package['path'],$package['files'], $data,$package['json']);
|
@@ -2074,6 +2211,10 @@ class WPvivid_Backup
|
|
2074 |
$result['files'][] = $zip_ret['file_data'];
|
2075 |
$package['backup']=true;
|
2076 |
$this->task->update_packages_info($data['key'],$package,$zip_ret['file_data']);
|
|
|
|
|
|
|
|
|
2077 |
}
|
2078 |
else
|
2079 |
{
|
@@ -2101,115 +2242,28 @@ class WPvivid_Backup
|
|
2101 |
}
|
2102 |
|
2103 |
return $result;
|
|
|
2104 |
|
2105 |
-
|
2106 |
-
|
2107 |
-
|
2108 |
-
global $wpvivid_plugin;
|
2109 |
-
$wpvivid_plugin->wpvivid_log->WriteLog('Start compressing '.$data['key'],'notice');
|
2110 |
-
$wpvivid_plugin->wpvivid_log->WriteLog('has_child','notice');
|
2111 |
-
|
2112 |
-
$ret =$zip->get_packages($data);
|
2113 |
-
|
2114 |
-
$packages=$this->task->get_packages_info(WPVIVID_BACKUP_TYPE_MERGE);
|
2115 |
-
if($packages===false)
|
2116 |
-
{
|
2117 |
-
$packages=$this->task->set_packages_info(WPVIVID_BACKUP_TYPE_MERGE,$ret['packages']);
|
2118 |
-
}
|
2119 |
-
|
2120 |
-
define(PCLZIP_TEMPORARY_DIR,$ret['temp_dir']);
|
2121 |
-
|
2122 |
-
$result['result']=WPVIVID_SUCCESS;
|
2123 |
-
$result['files']=array();
|
2124 |
-
|
2125 |
-
foreach ($packages as $package)
|
2126 |
-
{
|
2127 |
-
if(!empty($package['files'])&&$package['backup']==false)
|
2128 |
-
{
|
2129 |
-
$zip_ret=$zip->_zip($package['path'],$package['files'], $data,$package['json']);
|
2130 |
-
if($zip_ret['result']==WPVIVID_SUCCESS)
|
2131 |
-
{
|
2132 |
-
$result['files'][] = $zip_ret['file_data'];
|
2133 |
-
$package['backup']=true;
|
2134 |
-
$this->task->update_packages_info(WPVIVID_BACKUP_TYPE_MERGE,$package);
|
2135 |
-
}
|
2136 |
-
else
|
2137 |
-
{
|
2138 |
-
$result=$zip_ret;
|
2139 |
-
break;
|
2140 |
-
}
|
2141 |
-
}else {
|
2142 |
-
continue;
|
2143 |
-
}
|
2144 |
-
}
|
2145 |
-
$wpvivid_plugin->wpvivid_log->WriteLog('Compressing '.$data['key'].' completed','notice');
|
2146 |
-
return $result;
|
2147 |
-
}
|
2148 |
-
else if(isset($data['wp_plugin']))
|
2149 |
-
{
|
2150 |
-
global $wpvivid_plugin;
|
2151 |
-
$wpvivid_plugin->wpvivid_log->WriteLog('Start compressing '.$data['key'],'notice');
|
2152 |
-
|
2153 |
-
$ret =$zip->get_plugin_packages($data);
|
2154 |
-
|
2155 |
-
$packages=$this->task->get_packages_info(WPVIVID_BACKUP_TYPE_PLUGIN);
|
2156 |
-
if($packages===false)
|
2157 |
-
{
|
2158 |
-
$packages=$this->task->set_packages_info(WPVIVID_BACKUP_TYPE_PLUGIN,$ret['packages']);
|
2159 |
-
}
|
2160 |
-
|
2161 |
-
define(PCLZIP_TEMPORARY_DIR,$ret['temp_dir']);
|
2162 |
-
|
2163 |
-
$result['result']=WPVIVID_SUCCESS;
|
2164 |
-
$result['files']=array();
|
2165 |
|
2166 |
-
|
2167 |
-
{
|
2168 |
-
if(!empty($package['files'])&&$package['backup']==false)
|
2169 |
-
{
|
2170 |
-
$zip_ret=$zip->_zip($package['path'],$package['files'], $data,$package['json']);
|
2171 |
-
if($zip_ret['result']==WPVIVID_SUCCESS)
|
2172 |
-
{
|
2173 |
-
$result['files'][] = $zip_ret['file_data'];
|
2174 |
-
$package['backup']=true;
|
2175 |
-
$this->task->update_packages_info(WPVIVID_BACKUP_TYPE_PLUGIN,$package,$zip_ret['file_data']);
|
2176 |
-
}
|
2177 |
-
else
|
2178 |
-
{
|
2179 |
-
$result=$zip_ret;
|
2180 |
-
break;
|
2181 |
-
}
|
2182 |
-
}else {
|
2183 |
-
continue;
|
2184 |
-
}
|
2185 |
-
}
|
2186 |
-
$wpvivid_plugin->wpvivid_log->WriteLog('Compressing '.$data['key'].' completed','notice');
|
2187 |
-
return $result;
|
2188 |
-
}
|
2189 |
-
else
|
2190 |
{
|
2191 |
-
|
2192 |
-
|
2193 |
-
|
2194 |
-
|
2195 |
-
foreach ($data['files'] as $sql_file)
|
2196 |
-
{
|
2197 |
-
@unlink($sql_file);
|
2198 |
-
}
|
2199 |
}
|
2200 |
}
|
2201 |
-
|
2202 |
-
return $result;
|
2203 |
-
*/
|
2204 |
}
|
2205 |
|
2206 |
-
public function
|
2207 |
{
|
2208 |
-
$files=$this->task->get_need_cleanup_files();
|
2209 |
-
|
2210 |
foreach ($files as $file)
|
2211 |
{
|
2212 |
-
if(file_exists($file))
|
|
|
2213 |
global $wpvivid_plugin;
|
2214 |
$wpvivid_plugin->wpvivid_log->WriteLog('Cleaned up file, filename: '.$file,'notice');
|
2215 |
@unlink($file);
|
16 |
define('WPVIVID_BACKUP_TYPE_OTHERS','backup_others');
|
17 |
define('WPVIVID_BACKUP_TYPE_MERGE','backup_merge');
|
18 |
|
19 |
+
define('WPVIVID_BACKUP_ROOT_WP_CONTENT','wp-content');
|
20 |
+
define('WPVIVID_BACKUP_ROOT_CUSTOM','custom');
|
21 |
+
define('WPVIVID_BACKUP_ROOT_WP_ROOT','root');
|
22 |
+
|
23 |
class WPvivid_Backup_Task
|
24 |
{
|
25 |
private $task;
|
121 |
$this->task['options']['lock']=0;
|
122 |
}
|
123 |
|
124 |
+
$this->task['options']['backup_options']['ismerge']=1;
|
125 |
+
|
126 |
+
/*
|
127 |
if(isset($options['ismerge']))
|
128 |
{
|
129 |
if($options['ismerge']=='1')
|
136 |
}
|
137 |
else {
|
138 |
$this->task['options']['backup_options']['ismerge']=1;
|
139 |
+
}*/
|
140 |
|
141 |
$home_url_prefix=get_home_url();
|
142 |
$home_url_prefix=$this->parse_url_all($home_url_prefix);
|
260 |
$backup_data['path']=WP_CONTENT_DIR.DIRECTORY_SEPARATOR. $this->task['options']['backup_options']['dir'].DIRECTORY_SEPARATOR;
|
261 |
if($backup==WPVIVID_BACKUP_TYPE_DB)
|
262 |
{
|
263 |
+
//$backup_data['root_path']=WP_CONTENT_DIR.DIRECTORY_SEPARATOR.$this->task['options']['backup_options']['dir'];
|
264 |
+
$backup_data['root_flag']=WPVIVID_BACKUP_ROOT_CUSTOM;
|
265 |
$backup_data['dump_db']=1;
|
266 |
$backup_data['sql_file_name']=WP_CONTENT_DIR.DIRECTORY_SEPARATOR.$this->task['options']['backup_options']['dir'].DIRECTORY_SEPARATOR.$this->get_prefix().'_backup_db.sql';
|
267 |
$backup_data['json_info']['dump_db']=1;
|
268 |
+
$backup_data['json_info']['file_type']='databases';
|
269 |
$backup_data['prefix']=$this->get_prefix().'_backup_db';
|
270 |
$this->task['options']['backup_options']['backup'][$backup_data['key']]=$backup_data;
|
271 |
}
|
272 |
else if($backup==WPVIVID_BACKUP_TYPE_THEMES)
|
273 |
{
|
274 |
+
//$backup_data['root_path']=WP_CONTENT_DIR;
|
275 |
+
$backup_data['root_flag']=WPVIVID_BACKUP_ROOT_WP_CONTENT;
|
276 |
$backup_data['prefix']=$this->get_prefix().'_backup_themes';
|
277 |
$backup_data['files_root']=$this->transfer_path(get_theme_root());
|
278 |
$backup_data['exclude_regex']=array();
|
279 |
$backup_data['include_regex']=array();
|
280 |
+
$backup_data['json_info']['file_type']='themes';
|
281 |
+
$backup_data['json_info']['themes']=$this->get_themes_list();
|
282 |
$this->task['options']['backup_options']['backup'][$backup_data['key']]=$backup_data;
|
283 |
}
|
284 |
else if($backup==WPVIVID_BACKUP_TYPE_PLUGIN)
|
285 |
{
|
286 |
+
//$backup_data['root_path']=WP_CONTENT_DIR;
|
287 |
+
$backup_data['root_flag']=WPVIVID_BACKUP_ROOT_WP_CONTENT;
|
288 |
$backup_data['prefix']=$this->get_prefix().'_backup_plugin';
|
289 |
if(isset($backup_data['compress']['subpackage_plugin_upload'])&&$backup_data['compress']['subpackage_plugin_upload'])
|
290 |
{
|
291 |
$backup_data['plugin_subpackage']=1;
|
292 |
}
|
293 |
$backup_data['files_root']=$this->transfer_path(WP_PLUGIN_DIR);
|
294 |
+
|
295 |
+
$exclude_plugins[]='wpvivid-backuprestore';
|
296 |
+
$exclude_plugins[]='wp-cerber';
|
297 |
+
$exclude_plugins=apply_filters('wpvivid_exclude_plugins',$exclude_plugins);
|
298 |
+
$exclude_regex=array();
|
299 |
+
foreach ($exclude_plugins as $exclude_plugin)
|
300 |
+
{
|
301 |
+
$exclude_regex[]='#^'.preg_quote($this -> transfer_path(WP_PLUGIN_DIR.DIRECTORY_SEPARATOR.$exclude_plugin), '/').'#';
|
302 |
+
}
|
303 |
$backup_data['exclude_regex']=$exclude_regex;
|
304 |
$backup_data['include_regex']=array();
|
305 |
+
$backup_data['json_info']['file_type']='plugin';
|
306 |
+
$backup_data['json_info']['plugin']=$this->get_plugins_list();
|
307 |
}
|
308 |
else if($backup==WPVIVID_BACKUP_TYPE_UPLOADS)
|
309 |
{
|
310 |
+
//$backup_data['root_path']=WP_CONTENT_DIR;
|
311 |
+
$backup_data['root_flag']=WPVIVID_BACKUP_ROOT_WP_CONTENT;
|
312 |
$backup_data['prefix']=$this->get_prefix().'_backup_uploads';
|
313 |
$upload_dir = wp_upload_dir();
|
314 |
$backup_data['files_root']=$this -> transfer_path($upload_dir['basedir']);
|
317 |
$exclude_regex[]='#^'.preg_quote($this -> transfer_path($upload_dir['basedir']).DIRECTORY_SEPARATOR.'ShortpixelBackups', '/').'#';//ShortpixelBackups
|
318 |
$backup_data['exclude_regex']=$exclude_regex;
|
319 |
$backup_data['include_regex']=array();
|
320 |
+
$backup_data['json_info']['file_type']='upload';
|
321 |
}
|
322 |
else if($backup==WPVIVID_BACKUP_TYPE_UPLOADS_FILES)
|
323 |
{
|
324 |
+
//$backup_data['root_path']=WP_CONTENT_DIR;
|
325 |
+
$backup_data['root_flag']=WPVIVID_BACKUP_ROOT_WP_CONTENT;
|
326 |
$backup_data['prefix']=$this->get_prefix().'_backup_uploads';
|
327 |
$backup_data['uploads_subpackage']=1;
|
328 |
$upload_dir = wp_upload_dir();
|
332 |
$exclude_regex[]='#^'.preg_quote($this -> transfer_path($upload_dir['basedir']).DIRECTORY_SEPARATOR.'ShortpixelBackups', '/').'#';
|
333 |
$backup_data['exclude_regex']=$exclude_regex;
|
334 |
$backup_data['include_regex'][]='#^'.preg_quote($this -> transfer_path($upload_dir['basedir']).DIRECTORY_SEPARATOR, '/').'[0-9]{4}#';
|
335 |
+
$backup_data['json_info']['file_type']='upload';
|
336 |
}
|
337 |
else if($backup==WPVIVID_BACKUP_TYPE_UPLOADS_FILES_OTHER)
|
338 |
{
|
339 |
+
//$backup_data['root_path']=WP_CONTENT_DIR;
|
340 |
+
$backup_data['root_flag']=WPVIVID_BACKUP_ROOT_WP_CONTENT;
|
341 |
$backup_data['prefix']=$this->get_prefix().'_backup_uploads_other';
|
342 |
$upload_dir = wp_upload_dir();
|
343 |
$backup_data['files_root']=$this -> transfer_path($upload_dir['basedir']);
|
347 |
$exclude_regex[]='#^'.preg_quote($this -> transfer_path($upload_dir['basedir']).DIRECTORY_SEPARATOR, '/').'[0-9]{4}#';
|
348 |
$backup_data['exclude_regex']=$exclude_regex;
|
349 |
$backup_data['include_regex']=array();
|
350 |
+
$backup_data['json_info']['file_type']='upload';
|
351 |
}
|
352 |
else if($backup==WPVIVID_BACKUP_TYPE_CONTENT)
|
353 |
{
|
354 |
+
//$backup_data['root_path']=get_home_path();
|
355 |
+
$backup_data['root_flag']=WPVIVID_BACKUP_ROOT_WP_ROOT;
|
356 |
$backup_data['prefix']=$this->get_prefix().'_backup_content';
|
357 |
$backup_data['files_root']=$this -> transfer_path(WP_CONTENT_DIR);
|
358 |
$exclude_regex[]='#^'.preg_quote($this -> transfer_path(WP_CONTENT_DIR).DIRECTORY_SEPARATOR.'updraft', '/').'#'; // Updraft Plus backup directory
|
369 |
$exclude_regex[]='#^'.preg_quote($this->transfer_path(get_theme_root()), '/').'#';
|
370 |
$backup_data['exclude_regex']=$exclude_regex;
|
371 |
$backup_data['include_regex']=array();
|
372 |
+
$backup_data['json_info']['file_type']='wp-content';
|
373 |
}
|
374 |
else if($backup==WPVIVID_BACKUP_TYPE_CORE)
|
375 |
{
|
376 |
+
//$backup_data['root_path']=ABSPATH;
|
377 |
+
$backup_data['root_flag']=WPVIVID_BACKUP_ROOT_WP_ROOT;
|
378 |
$backup_data['prefix']=$this->get_prefix().'_backup_core';
|
379 |
+
$backup_data['files_root']=$this -> transfer_path(ABSPATH);
|
380 |
$backup_data['json_info']['include_path'][]='wp-includes';
|
381 |
$backup_data['json_info']['include_path'][]='wp-admin';
|
382 |
$backup_data['json_info']['wp_core']=1;
|
383 |
$backup_data['json_info']['home_url']=home_url();
|
384 |
+
$include_regex[]='#^'.preg_quote($this -> transfer_path(ABSPATH.DIRECTORY_SEPARATOR.'wp-admin'), '/').'#';
|
385 |
+
$include_regex[]='#^'.preg_quote($this->transfer_path(ABSPATH.DIRECTORY_SEPARATOR.'wp-includes'), '/').'#';
|
386 |
+
$exclude_regex[]='#^'.preg_quote($this->transfer_path(ABSPATH.DIRECTORY_SEPARATOR.'wp-admin'.DIRECTORY_SEPARATOR), '/').'pclzip-.*\.tmp#';
|
387 |
+
$exclude_regex[]='#^'.preg_quote($this->transfer_path(ABSPATH.DIRECTORY_SEPARATOR.'wp-admin'.DIRECTORY_SEPARATOR), '/').'pclzip-.*\.gz#';
|
388 |
$backup_data['exclude_regex']=$exclude_regex;
|
389 |
$backup_data['include_regex']=$include_regex;
|
390 |
+
$backup_data['json_info']['file_type']='wp-core';
|
391 |
}
|
392 |
else if($backup==WPVIVID_BACKUP_TYPE_MERGE)
|
393 |
{
|
394 |
+
//$backup_data['root_path']=WP_CONTENT_DIR.DIRECTORY_SEPARATOR.$this->task['options']['backup_options']['dir'];
|
395 |
+
$backup_data['root_flag']=WPVIVID_BACKUP_ROOT_CUSTOM;
|
396 |
$backup_data['prefix']=$this->get_prefix().'_backup_all';
|
397 |
$backup_data['files']=array();
|
398 |
+
$backup_data['json_info']['has_child']=1;
|
399 |
foreach ($this->task['options']['backup_options']['backup'] as $backup_finished_data)
|
400 |
{
|
401 |
$backup_data['files']=array_merge($backup_data['files'],$this->get_backup_file($backup_finished_data['key']));
|
402 |
}
|
|
|
403 |
$backup_data['json_info']['home_url']=home_url();
|
404 |
}
|
405 |
else
|
414 |
}
|
415 |
}
|
416 |
|
417 |
+
public function get_themes_list()
|
418 |
+
{
|
419 |
+
$themes_list=array();
|
420 |
+
$list=wp_get_themes();
|
421 |
+
foreach ($list as $key=>$item)
|
422 |
+
{
|
423 |
+
$themes_list[$key]['slug']=$key;
|
424 |
+
$themes_list[$key]['size']=$this->get_folder_size(get_theme_root().DIRECTORY_SEPARATOR.$key,0);
|
425 |
+
}
|
426 |
+
return $themes_list;
|
427 |
+
}
|
428 |
+
|
429 |
+
public function get_plugins_list()
|
430 |
+
{
|
431 |
+
$plugins_list=array();
|
432 |
+
|
433 |
+
if(!function_exists('get_plugins'))
|
434 |
+
require_once(ABSPATH . 'wp-admin/includes/plugin.php');
|
435 |
+
|
436 |
+
$list=get_plugins();
|
437 |
+
|
438 |
+
$exclude_plugins[]='wpvivid-backuprestore';
|
439 |
+
$exclude_plugins[]='wp-cerber';
|
440 |
+
$exclude_plugins[]='.';
|
441 |
+
$exclude_plugins=apply_filters('wpvivid_exclude_plugins',$exclude_plugins);
|
442 |
+
|
443 |
+
foreach ($list as $key=>$item)
|
444 |
+
{
|
445 |
+
if(in_array(dirname($key),$exclude_plugins))
|
446 |
+
{
|
447 |
+
continue;
|
448 |
+
}
|
449 |
+
|
450 |
+
$plugins_list[dirname($key)]['slug']=dirname($key);
|
451 |
+
$plugins_list[dirname($key)]['size']=$this->get_folder_size(WP_PLUGIN_DIR.DIRECTORY_SEPARATOR.dirname($key),0);
|
452 |
+
//
|
453 |
+
}
|
454 |
+
return $plugins_list;
|
455 |
+
}
|
456 |
+
|
457 |
+
public function get_folder_size($root,$size)
|
458 |
+
{
|
459 |
+
$count = 0;
|
460 |
+
if(is_dir($root))
|
461 |
+
{
|
462 |
+
$handler = opendir($root);
|
463 |
+
while (($filename = readdir($handler)) !== false)
|
464 |
+
{
|
465 |
+
if ($filename != "." && $filename != "..") {
|
466 |
+
$count++;
|
467 |
+
|
468 |
+
if (is_dir($root . DIRECTORY_SEPARATOR . $filename))
|
469 |
+
{
|
470 |
+
$size=$this->get_folder_size($root . DIRECTORY_SEPARATOR . $filename,$size);
|
471 |
+
} else {
|
472 |
+
$size+=filesize($root . DIRECTORY_SEPARATOR . $filename);
|
473 |
+
}
|
474 |
+
}
|
475 |
+
}
|
476 |
+
if($handler)
|
477 |
+
@closedir($handler);
|
478 |
+
}
|
479 |
+
return $size;
|
480 |
+
}
|
481 |
+
|
482 |
public function wpvivid_set_backup($backup_data)
|
483 |
{
|
484 |
if(isset($backup_data['uploads_subpackage'])||isset($backup_data['plugin_subpackage']))
|
598 |
}
|
599 |
else
|
600 |
{
|
601 |
+
if(!isset($backup_data['files']))
|
602 |
+
{
|
603 |
+
$backup_data['files']=array();
|
604 |
+
}
|
605 |
$backup_data['files'] =apply_filters('wpvivid_get_custom_need_backup_files', $backup_data['files'],$backup_data,$this->task['options']['backup_options']['compress']);
|
606 |
}
|
607 |
|
699 |
public function get_backup_result()
|
700 |
{
|
701 |
$ret['result']=WPVIVID_SUCCESS;
|
702 |
+
$ret['files']=array();
|
703 |
foreach ($this->task['options']['backup_options']['backup'] as $backup_data)
|
704 |
{
|
705 |
if($this->task['options']['backup_options']['ismerge']==1)
|
715 |
}
|
716 |
else
|
717 |
{
|
718 |
+
$ret['files']=array_merge($ret['files'],$backup_data['result']['files']);
|
719 |
}
|
720 |
}
|
721 |
|
755 |
}
|
756 |
} else {
|
757 |
if($this->regex_match($exclude_regex, $path . DIRECTORY_SEPARATOR . $filename, 0)){
|
758 |
+
if ($exclude_file_size == 0)
|
759 |
+
{
|
760 |
+
if(is_readable($path . DIRECTORY_SEPARATOR . $filename))
|
761 |
+
{
|
762 |
$files[] = $path . DIRECTORY_SEPARATOR . $filename;
|
763 |
}
|
764 |
+
else
|
765 |
+
{
|
766 |
+
global $wpvivid_plugin;
|
767 |
+
$wpvivid_plugin->wpvivid_log->WriteLog('file not readable:' . $path . DIRECTORY_SEPARATOR . $filename, 'notice');
|
768 |
+
}
|
769 |
+
|
770 |
+
} else {
|
771 |
+
if(is_readable($path . DIRECTORY_SEPARATOR . $filename))
|
772 |
+
{
|
773 |
+
if (filesize($path . DIRECTORY_SEPARATOR . $filename) < $exclude_file_size * 1024 * 1024) {
|
774 |
+
$files[] = $path . DIRECTORY_SEPARATOR . $filename;
|
775 |
+
}
|
776 |
+
}
|
777 |
+
else
|
778 |
+
{
|
779 |
+
global $wpvivid_plugin;
|
780 |
+
$wpvivid_plugin->wpvivid_log->WriteLog('file not readable:' . $path . DIRECTORY_SEPARATOR . $filename, 'notice');
|
781 |
+
}
|
782 |
}
|
783 |
}
|
784 |
}
|
1267 |
if($this->regex_match($exclude_regex, $path . DIRECTORY_SEPARATOR . $filename, 0)){
|
1268 |
if ($exclude_file_size == 0)
|
1269 |
{
|
1270 |
+
if(is_readable($path . DIRECTORY_SEPARATOR . $filename))
|
|
|
|
|
1271 |
{
|
1272 |
$files[] = $path . DIRECTORY_SEPARATOR . $filename;
|
1273 |
}
|
1274 |
+
else
|
1275 |
+
{
|
1276 |
+
global $wpvivid_plugin;
|
1277 |
+
$wpvivid_plugin->wpvivid_log->WriteLog('file not readable:' . $path . DIRECTORY_SEPARATOR . $filename, 'notice');
|
1278 |
+
}
|
1279 |
+
} else {
|
1280 |
+
if(is_readable($path . DIRECTORY_SEPARATOR . $filename))
|
1281 |
+
{
|
1282 |
+
if (filesize($path . DIRECTORY_SEPARATOR . $filename) < $exclude_file_size * 1024 * 1024)
|
1283 |
+
{
|
1284 |
+
$files[] = $path . DIRECTORY_SEPARATOR . $filename;
|
1285 |
+
}
|
1286 |
+
}
|
1287 |
+
else
|
1288 |
+
{
|
1289 |
+
global $wpvivid_plugin;
|
1290 |
+
$wpvivid_plugin->wpvivid_log->WriteLog('file not readable:' . $path . DIRECTORY_SEPARATOR . $filename, 'notice');
|
1291 |
+
}
|
1292 |
}
|
1293 |
}
|
1294 |
}
|
1347 |
}
|
1348 |
}
|
1349 |
} else {
|
1350 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1351 |
}
|
1352 |
}
|
1353 |
}
|
1748 |
if(isset($this->config['backup']['ismerge'])&&$this->config['backup']['ismerge']==1)
|
1749 |
{
|
1750 |
$packages[$index]['option']['has_child']=1;
|
1751 |
+
//$packages[$index]['option']['root']='wp-content';
|
1752 |
+
$packages[$index]['option']['root_flag']=WPVIVID_BACKUP_ROOT_WP_CONTENT;
|
1753 |
foreach ($this->config['backup']['data']['meta']['files'] as $file)
|
1754 |
{
|
1755 |
$packages[$index]['files'][]=$file['file_name'];
|
1762 |
if($type['type_name']=='backup_db')
|
1763 |
{
|
1764 |
$packages[$index]['option']['dump_db']=1;
|
1765 |
+
//$packages[$index]['option']['root']='wp-content\\'.$this->config['local']['path'];
|
1766 |
+
$packages[$index]['option']['root_flag']=WPVIVID_BACKUP_ROOT_CUSTOM;
|
1767 |
}
|
1768 |
else if($type['type_name']=='backup_themes')
|
1769 |
{
|
1770 |
+
//$packages[$index]['option']['root']='wp-content';
|
1771 |
+
$packages[$index]['option']['root_flag']=WPVIVID_BACKUP_ROOT_WP_CONTENT;
|
1772 |
}
|
1773 |
else if($type['type_name']=='backup_plugin')
|
1774 |
{
|
1775 |
+
//$packages[$index]['option']['root']='wp-content';
|
1776 |
+
$packages[$index]['option']['root_flag']=WPVIVID_BACKUP_ROOT_WP_CONTENT;
|
1777 |
}
|
1778 |
else if($type['type_name']=='backup_uploads')
|
1779 |
{
|
1780 |
+
//$packages[$index]['option']['root']='wp-content';
|
1781 |
+
$packages[$index]['option']['root_flag']=WPVIVID_BACKUP_ROOT_WP_CONTENT;
|
1782 |
}
|
1783 |
else if($type['type_name']=='backup_content')
|
1784 |
{
|
1785 |
+
//$packages[$index]['option']['root']='';
|
1786 |
+
$packages[$index]['option']['root_flag']=WPVIVID_BACKUP_ROOT_WP_ROOT;
|
1787 |
}
|
1788 |
else if($type['type_name']=='backup_core')
|
1789 |
{
|
1790 |
+
//$packages[$index]['option']['root']='';
|
1791 |
+
$packages[$index]['option']['root_flag']=WPVIVID_BACKUP_ROOT_WP_ROOT;
|
1792 |
$packages[$index]['option']['include_path'][]='wp-includes';
|
1793 |
$packages[$index]['option']['include_path'][]='wp-admin';
|
1794 |
}
|
1977 |
}
|
1978 |
else{
|
1979 |
$task = WPvivid_taskmanager::get_download_task_v2($file['file_name']);
|
1980 |
+
$ret['task']=$task;
|
1981 |
if ($task === false) {
|
1982 |
$ret['result'] = WPVIVID_SUCCESS;
|
1983 |
$ret['files'][$file['file_name']]['status']='need_download';
|
2183 |
}
|
2184 |
else
|
2185 |
{
|
2186 |
+
if($data['key']==WPVIVID_BACKUP_TYPE_MERGE)
|
2187 |
+
$ret =$zip->get_packages($data,true);
|
2188 |
+
else
|
2189 |
+
$ret =$zip->get_packages($data);
|
2190 |
}
|
2191 |
|
2192 |
$packages=$this->task->get_packages_info($data['key']);
|
2202 |
|
2203 |
foreach ($packages as $package)
|
2204 |
{
|
2205 |
+
$wpvivid_plugin->set_time_limit($this->task->get_id());
|
2206 |
if(!empty($package['files'])&&$package['backup']==false)
|
2207 |
{
|
2208 |
$zip_ret=$zip->_zip($package['path'],$package['files'], $data,$package['json']);
|
2211 |
$result['files'][] = $zip_ret['file_data'];
|
2212 |
$package['backup']=true;
|
2213 |
$this->task->update_packages_info($data['key'],$package,$zip_ret['file_data']);
|
2214 |
+
if($data['key']==WPVIVID_BACKUP_TYPE_MERGE)
|
2215 |
+
{
|
2216 |
+
$this->cleanup_finished_package($package['files']);
|
2217 |
+
}
|
2218 |
}
|
2219 |
else
|
2220 |
{
|
2242 |
}
|
2243 |
|
2244 |
return $result;
|
2245 |
+
}
|
2246 |
|
2247 |
+
public function cleanup()
|
2248 |
+
{
|
2249 |
+
$files=$this->task->get_need_cleanup_files();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2250 |
|
2251 |
+
foreach ($files as $file)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2252 |
{
|
2253 |
+
if(file_exists($file)) {
|
2254 |
+
global $wpvivid_plugin;
|
2255 |
+
$wpvivid_plugin->wpvivid_log->WriteLog('Cleaned up file, filename: '.$file,'notice');
|
2256 |
+
@unlink($file);
|
|
|
|
|
|
|
|
|
2257 |
}
|
2258 |
}
|
|
|
|
|
|
|
2259 |
}
|
2260 |
|
2261 |
+
public function cleanup_finished_package($files)
|
2262 |
{
|
|
|
|
|
2263 |
foreach ($files as $file)
|
2264 |
{
|
2265 |
+
if(file_exists($file))
|
2266 |
+
{
|
2267 |
global $wpvivid_plugin;
|
2268 |
$wpvivid_plugin->wpvivid_log->WriteLog('Cleaned up file, filename: '.$file,'notice');
|
2269 |
@unlink($file);
|
includes/class-wpvivid-backuplist.php
CHANGED
@@ -117,11 +117,11 @@ class WPvivid_Backuplist
|
|
117 |
}
|
118 |
}
|
119 |
|
120 |
-
public static function add_new_upload_backup($task_id,$backup,$log='')
|
121 |
{
|
122 |
$backup_data=array();
|
123 |
$backup_data['type']='Upload';
|
124 |
-
$backup_data['create_time']
|
125 |
$backup_data['manual_delete']=0;
|
126 |
$backup_data['local']['path']=WPvivid_Setting::get_backupdir();
|
127 |
$backup_data['compress']['compress_type']='zip';
|
117 |
}
|
118 |
}
|
119 |
|
120 |
+
public static function add_new_upload_backup($task_id,$backup,$time,$log='')
|
121 |
{
|
122 |
$backup_data=array();
|
123 |
$backup_data['type']='Upload';
|
124 |
+
$backup_data['create_time']=$time;
|
125 |
$backup_data['manual_delete']=0;
|
126 |
$backup_data['local']['path']=WPvivid_Setting::get_backupdir();
|
127 |
$backup_data['compress']['compress_type']='zip';
|
includes/class-wpvivid-crypt.php
CHANGED
@@ -61,4 +61,13 @@ class WPvivid_crypt
|
|
61 |
$rij->setKey($key);
|
62 |
return $rij->decrypt($data);
|
63 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
64 |
}
|
61 |
$rij->setKey($key);
|
62 |
return $rij->decrypt($data);
|
63 |
}
|
64 |
+
|
65 |
+
public function encrypt_user_info($user,$pw)
|
66 |
+
{
|
67 |
+
$user_info['user']=$user;
|
68 |
+
$user_info['pw']=$pw;
|
69 |
+
$info=json_encode($user_info);
|
70 |
+
$this->rsa->loadKey($this->public_key);
|
71 |
+
return $this->rsa->encrypt($info);
|
72 |
+
}
|
73 |
}
|
includes/class-wpvivid-downloader.php
CHANGED
@@ -12,48 +12,51 @@ class WPvivid_downloader
|
|
12 |
|
13 |
public function ready_download($download_info)
|
14 |
{
|
15 |
-
$files=array();
|
16 |
$backup=WPvivid_Backuplist::get_backup_by_id($download_info['backup_id']);
|
17 |
if(!$backup)
|
18 |
{
|
19 |
return false;
|
20 |
}
|
21 |
-
|
|
|
|
|
22 |
if(isset($backup['backup']['files']))
|
23 |
{
|
24 |
foreach ($backup['backup']['files'] as $file)
|
25 |
{
|
26 |
if ($file['file_name'] == $download_info['file_name'])
|
27 |
{
|
28 |
-
$
|
29 |
-
$files[] = $file;
|
30 |
break;
|
31 |
}
|
32 |
}
|
33 |
}
|
34 |
-
else if ($backup['backup']['ismerge'] == 1)
|
|
|
35 |
$backup_files = $backup['backup']['data']['meta']['files'];
|
36 |
-
foreach ($backup_files as $file)
|
37 |
-
|
38 |
-
|
39 |
-
|
|
|
40 |
break;
|
41 |
}
|
42 |
}
|
43 |
} else {
|
44 |
-
foreach ($backup['backup']['data']['type'] as $type)
|
|
|
45 |
$backup_files = $type['files'];
|
46 |
foreach ($backup_files as $file) {
|
47 |
-
if ($file['file_name'] == $download_info['file_name'])
|
48 |
-
|
49 |
-
$
|
50 |
break;
|
51 |
}
|
52 |
}
|
53 |
}
|
54 |
}
|
55 |
|
56 |
-
if(
|
57 |
{
|
58 |
return false;
|
59 |
}
|
@@ -61,34 +64,23 @@ class WPvivid_downloader
|
|
61 |
|
62 |
$local_path=WP_CONTENT_DIR.DIRECTORY_SEPARATOR.$backup['local']['path'].DIRECTORY_SEPARATOR;
|
63 |
$need_download_files=array();
|
64 |
-
|
|
|
|
|
65 |
{
|
66 |
-
$local_file
|
67 |
-
if(file_exists($local_file))
|
68 |
{
|
69 |
-
if(filesize($local_file)
|
70 |
{
|
71 |
-
|
72 |
-
if($file['md5']!=$new_md5)
|
73 |
-
{
|
74 |
-
$need_download_files[$file['file_name']]=$file;
|
75 |
-
unlink($local_file);
|
76 |
-
}
|
77 |
}
|
78 |
-
|
79 |
-
{
|
80 |
-
if(filesize($local_file)>$file['size'])
|
81 |
-
{
|
82 |
-
unlink($local_file);
|
83 |
-
}
|
84 |
-
$need_download_files[$file['file_name']]=$file;
|
85 |
-
}
|
86 |
-
}
|
87 |
-
else
|
88 |
-
{
|
89 |
-
$need_download_files[$file['file_name']]=$file;
|
90 |
}
|
91 |
}
|
|
|
|
|
|
|
|
|
92 |
|
93 |
if(empty($need_download_files))
|
94 |
{
|
@@ -104,11 +96,8 @@ class WPvivid_downloader
|
|
104 |
}
|
105 |
else
|
106 |
{
|
107 |
-
|
108 |
-
|
109 |
-
$filename=$file['file_name'];
|
110 |
-
}
|
111 |
-
$task=WPvivid_taskmanager::new_download_task_v2($filename);
|
112 |
}
|
113 |
}
|
114 |
|
12 |
|
13 |
public function ready_download($download_info)
|
14 |
{
|
|
|
15 |
$backup=WPvivid_Backuplist::get_backup_by_id($download_info['backup_id']);
|
16 |
if(!$backup)
|
17 |
{
|
18 |
return false;
|
19 |
}
|
20 |
+
|
21 |
+
$file_info=false;
|
22 |
+
|
23 |
if(isset($backup['backup']['files']))
|
24 |
{
|
25 |
foreach ($backup['backup']['files'] as $file)
|
26 |
{
|
27 |
if ($file['file_name'] == $download_info['file_name'])
|
28 |
{
|
29 |
+
$file_info= $file;
|
|
|
30 |
break;
|
31 |
}
|
32 |
}
|
33 |
}
|
34 |
+
else if ($backup['backup']['ismerge'] == 1)
|
35 |
+
{
|
36 |
$backup_files = $backup['backup']['data']['meta']['files'];
|
37 |
+
foreach ($backup_files as $file)
|
38 |
+
{
|
39 |
+
if ($file['file_name'] == $download_info['file_name'])
|
40 |
+
{
|
41 |
+
$file_info = $file;
|
42 |
break;
|
43 |
}
|
44 |
}
|
45 |
} else {
|
46 |
+
foreach ($backup['backup']['data']['type'] as $type)
|
47 |
+
{
|
48 |
$backup_files = $type['files'];
|
49 |
foreach ($backup_files as $file) {
|
50 |
+
if ($file['file_name'] == $download_info['file_name'])
|
51 |
+
{
|
52 |
+
$file_info = $file;
|
53 |
break;
|
54 |
}
|
55 |
}
|
56 |
}
|
57 |
}
|
58 |
|
59 |
+
if($file_info==false)
|
60 |
{
|
61 |
return false;
|
62 |
}
|
64 |
|
65 |
$local_path=WP_CONTENT_DIR.DIRECTORY_SEPARATOR.$backup['local']['path'].DIRECTORY_SEPARATOR;
|
66 |
$need_download_files=array();
|
67 |
+
|
68 |
+
$local_file=$local_path.$file_info['file_name'];
|
69 |
+
if(file_exists($local_file))
|
70 |
{
|
71 |
+
if(filesize($local_file)!=$file_info['size'])
|
|
|
72 |
{
|
73 |
+
if(filesize($local_file)>$file_info['size'])
|
74 |
{
|
75 |
+
unlink($local_file);
|
|
|
|
|
|
|
|
|
|
|
76 |
}
|
77 |
+
$need_download_files[$file_info['file_name']]=$file_info;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
78 |
}
|
79 |
}
|
80 |
+
else {
|
81 |
+
$need_download_files[$file_info['file_name']]=$file_info;
|
82 |
+
}
|
83 |
+
|
84 |
|
85 |
if(empty($need_download_files))
|
86 |
{
|
96 |
}
|
97 |
else
|
98 |
{
|
99 |
+
WPvivid_taskmanager::delete_download_task_v2($download_info['file_name']);
|
100 |
+
$task=WPvivid_taskmanager::new_download_task_v2($download_info['file_name']);
|
|
|
|
|
|
|
101 |
}
|
102 |
}
|
103 |
|
includes/class-wpvivid-function-realize.php
CHANGED
@@ -10,20 +10,32 @@ class WPvivid_Function_Realize
|
|
10 |
public function _backup_cancel($task_id)
|
11 |
{
|
12 |
global $wpvivid_plugin;
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
|
|
19 |
|
20 |
-
|
21 |
|
22 |
-
|
23 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
24 |
}
|
25 |
-
$ret['result'] = 'success';
|
26 |
-
$ret['msg'] = __('The backup will be canceled after backing up the current chunk ends.', 'wpvivid');
|
27 |
return $ret;
|
28 |
}
|
29 |
|
10 |
public function _backup_cancel($task_id)
|
11 |
{
|
12 |
global $wpvivid_plugin;
|
13 |
+
try {
|
14 |
+
if (WPvivid_taskmanager::get_task($task_id) !== false) {
|
15 |
+
$file_name = WPvivid_taskmanager::get_task_options($task_id, 'file_prefix');
|
16 |
+
$backup_options = WPvivid_taskmanager::get_task_options($task_id, 'backup_options');
|
17 |
+
$file = WP_CONTENT_DIR . DIRECTORY_SEPARATOR . $backup_options['dir'] . DIRECTORY_SEPARATOR . $file_name . '_cancel';
|
18 |
+
touch($file);
|
19 |
+
}
|
20 |
|
21 |
+
$timestamp = wp_next_scheduled(WPVIVID_TASK_MONITOR_EVENT, array($task_id));
|
22 |
|
23 |
+
if ($timestamp === false) {
|
24 |
+
$wpvivid_plugin->add_monitor_event($task_id, 10);
|
25 |
+
}
|
26 |
+
$ret['result'] = 'success';
|
27 |
+
$ret['msg'] = __('The backup will be canceled after backing up the current chunk ends.', 'wpvivid');
|
28 |
+
}
|
29 |
+
catch (Exception $error) {
|
30 |
+
$message = 'An exception has occurred. class: '.get_class($error).';msg: '.$error->getMessage().';code: '.$error->getCode().';line: '.$error->getLine().';in_file: '.$error->getFile().';';
|
31 |
+
error_log($message);
|
32 |
+
return array('result'=>'failed','error'=>$message);
|
33 |
+
}
|
34 |
+
catch (Error $error) {
|
35 |
+
$message = 'An exception has occurred. class: '.get_class($error).';msg: '.$error->getMessage().';code: '.$error->getCode().';line: '.$error->getLine().';in_file: '.$error->getFile().';';
|
36 |
+
error_log($message);
|
37 |
+
return array('result'=>'failed','error'=>$message);
|
38 |
}
|
|
|
|
|
39 |
return $ret;
|
40 |
}
|
41 |
|
includes/class-wpvivid-mail-report.php
CHANGED
@@ -115,338 +115,380 @@ class WPvivid_mail_report
|
|
115 |
$content='Upload';
|
116 |
}
|
117 |
|
118 |
-
$body='
|
119 |
-
<
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
<
|
124 |
-
|
125 |
-
|
126 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
127 |
<tbody>
|
128 |
-
|
129 |
-
<td style="padding-top:
|
130 |
-
<
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
131 |
</td>
|
132 |
</tr>
|
133 |
</tbody>
|
134 |
-
|
135 |
-
</
|
136 |
-
<td width="100%" bgcolor="#F5F7F8" style="padding-top:0;padding-bottom:0;padding-right:0;padding-left:0">
|
137 |
-
<table width="100%" style="border-spacing:0;color:#111111" bgcolor="#F5F7F8">
|
138 |
-
<tbody><tr>
|
139 |
-
<td style="padding-top:10px;padding-bottom:0px;padding-left:10px;padding-right:0px;background-color:#f5f7f8;width:100%;text-align:right">
|
140 |
-
<p style="Margin-top:0px;margin-bottom:0px;font-size:13px;line-height:16px"><strong><a href="https://twitter.com/wpvividcom" style="text-decoration:none;color:#111111" target="_blank">24/7 Support: <u></u>Twitter<u></u></a></strong></p>
|
141 |
</td>
|
142 |
</tr>
|
|
|
|
|
|
|
|
|
|
|
143 |
<tr>
|
144 |
-
<td style="padding-top:0px;padding-bottom:0px
|
145 |
-
<
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
146 |
</td>
|
147 |
</tr>
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
<
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
</td>
|
247 |
-
</tr>
|
248 |
-
</tbody></table>
|
249 |
-
|
250 |
-
|
251 |
-
<table width="100%" border="0" cellspacing="0" cellpadding="0" bgcolor="#F5F7F8">
|
252 |
-
<tbody><tr>
|
253 |
-
<td bgcolor="#F5F7F8" style="background-color:#f5f7f8;padding-top:0;padding-right:0;padding-left:0;padding-bottom:0">
|
254 |
-
<div style="max-width:600px;margin-top:0;margin-bottom:0;margin-right:auto;margin-left:auto;padding-left:20px;padding-right:20px">
|
255 |
-
<table bgcolor="#ffffff" width="100%" align="left" border="0" cellspacing="0" cellpadding="0" style="color:#111111">
|
256 |
-
<tbody><tr>
|
257 |
-
<td bgcolor="#ffffff" align="left" style="padding-top:10px;padding-bottom:0;padding-right:40px;padding-left:40px;background-color:#ffffff">
|
258 |
-
|
259 |
-
|
260 |
-
<table border="0" cellpadding="0" cellspacing="0" align="left" width="100%">
|
261 |
-
<tbody><tr>
|
262 |
-
<td style="padding-top:10px;padding-right:0;padding-bottom:0;padding-left:20px">
|
263 |
-
<table border="0" cellpadding="0" cellspacing="0" align="left">
|
264 |
-
<tbody>
|
265 |
-
<tr>
|
266 |
-
<td valign="top" align="left" style="padding-top:0px;padding-right:0px;padding-bottom:0px;padding-left:0px">
|
267 |
-
<p style="text-align:left;Margin-top:0px;Margin-bottom:0px;gdsherpa-regular;font-size:14px;line-height:24px"><label>Backup:</label><label>'.$status.'</label></p>
|
268 |
-
</td>
|
269 |
-
</tr>
|
270 |
-
<tr>
|
271 |
-
<td valign="top" align="left" style="padding-top:0px;padding-right:0px;padding-bottom:0px;padding-left:0px">
|
272 |
-
<p style="text-align:left;Margin-top:0px;Margin-bottom:0px;gdsherpa-regular;font-size:14px;line-height:24px"><label>Backup Type:</label><label>'.$type.'</label></p>
|
273 |
-
</td>
|
274 |
-
</tr>
|
275 |
-
<tr>
|
276 |
-
<td valign="top" align="left" style="padding-top:0px;padding-right:0px;padding-bottom:0px;padding-left:0px">
|
277 |
-
<p style="text-align:left;Margin-top:0px;Margin-bottom:0px;gdsherpa-regular;font-size:14px;line-height:24px"><label>Start Time:</label><label>'.$start_time.'</label></p>
|
278 |
-
</td>
|
279 |
-
</tr>
|
280 |
-
<tr>
|
281 |
-
<td valign="top" align="left" style="padding-top:0px;padding-right:0px;padding-bottom:0px;padding-left:0px">
|
282 |
-
<p style="text-align:left;Margin-top:0px;Margin-bottom:0px;gdsherpa-regular;font-size:14px;line-height:24px"><label>End Time:</label><label>'.$end_time.'</label></p>
|
283 |
-
</td>
|
284 |
-
</tr>
|
285 |
-
<tr>
|
286 |
-
<td valign="top" align="left" style="padding-top:0px;padding-right:0px;padding-bottom:0px;padding-left:0px">
|
287 |
-
<p style="text-align:left;Margin-top:0px;Margin-bottom:0px;gdsherpa-regular;font-size:14px;line-height:24px"><label>Running Time:</label><label>'.$running_time.'</label></p>
|
288 |
-
</td>
|
289 |
-
</tr>
|
290 |
-
<tr>
|
291 |
-
<td valign="top" align="left" style="padding-top:0px;padding-right:0px;padding-bottom:0px;padding-left:0px">
|
292 |
-
<p style="text-align:left;Margin-top:0px;Margin-bottom:0px;gdsherpa-regular;font-size:14px;line-height:24px"><label>Back up to:</label><label>'.$remote.'</label></p>
|
293 |
-
</td>
|
294 |
-
</tr>
|
295 |
-
<tr>
|
296 |
-
<td valign="top" align="left" style="padding-top:0px;padding-right:0px;padding-bottom:0px;padding-left:0px">
|
297 |
-
<p style="text-align:left;Margin-top:0px;Margin-bottom:0px;gdsherpa-regular;font-size:14px;line-height:24px"><label>Backup Content:</label><label>'.$content.'</label></p>
|
298 |
-
</td>
|
299 |
-
</tr>
|
300 |
-
</tbody></table>
|
301 |
-
</td>
|
302 |
-
</tr>
|
303 |
-
</tbody></table>
|
304 |
-
</td>
|
305 |
-
</tr>
|
306 |
-
</tbody></table>
|
307 |
-
|
308 |
-
</div>
|
309 |
-
</td>
|
310 |
-
</tr>
|
311 |
-
</tbody></table>
|
312 |
-
<table width="100%" border="0" cellspacing="0" cellpadding="0" bgcolor="#F5F7F8">
|
313 |
-
<tbody><tr>
|
314 |
-
<td bgcolor="#F5F7F8" style="padding-top:0px;padding-bottom:0px">
|
315 |
-
<div style="max-width:600px;margin-top:0;margin-bottom:0;margin-right:auto;margin-left:auto;padding-left:20px;padding-right:20px">
|
316 |
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
<
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
|
326 |
-
|
327 |
-
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
|
333 |
-
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
</tbody></table>
|
338 |
-
|
339 |
-
<table width="100%" border="0" cellspacing="0" cellpadding="0" bgcolor="#F5F7F8">
|
340 |
-
<tbody><tr>
|
341 |
-
<td bgcolor="#F5F7F8" style="padding-top:0px;padding-bottom:0px">
|
342 |
-
<div style="max-width:600px;margin-top:0;margin-bottom:0;margin-right:auto;margin-left:auto;padding-left:20px;padding-right:20px">
|
343 |
-
|
344 |
-
<table bgcolor="#FFFFFF" align="center" style="border-spacing:0;color:#111111;margin:0 auto;width:100%;max-width:600px">
|
345 |
-
<tbody><tr>
|
346 |
-
<td style="padding-top:0;padding-bottom:0;padding-right:0;padding-left:0">
|
347 |
-
<table width="100%" style="border-spacing:0;color:#111111">
|
348 |
-
<tbody><tr>
|
349 |
-
<td style="padding-top:40px;padding-bottom:0px;padding-left:40px;padding-right:40px;background-color:#ffffff;width:100%;text-align:left">
|
350 |
-
<p style="margin-top:0px;line-height:0px;margin-bottom:0px;font-size:4px"></p>
|
351 |
-
</td>
|
352 |
-
</tr>
|
353 |
-
</tbody></table>
|
354 |
-
</td>
|
355 |
-
</tr>
|
356 |
-
</tbody></table>
|
357 |
-
|
358 |
-
</div>
|
359 |
-
</td>
|
360 |
-
</tr>
|
361 |
-
</tbody></table>
|
362 |
-
|
363 |
-
|
364 |
-
<table width="100%" border="0" cellspacing="0" cellpadding="0" bgcolor="#F5F7F8">
|
365 |
-
<tbody><tr>
|
366 |
-
<td bgcolor="#F5F7F8" style="background-color:#f5f7f8;padding-top:0;padding-right:0;padding-left:0;padding-bottom:0">
|
367 |
-
<div style="max-width:600px;margin-top:0;margin-bottom:0;margin-right:auto;margin-left:auto;padding-left:20px;padding-right:20px">
|
368 |
-
|
369 |
-
<table width="100%" align="center" border="0" cellspacing="0" cellpadding="0" style="color:#111111">
|
370 |
-
<tbody><tr>
|
371 |
-
<td align="center" style="padding-top:40px;padding-bottom:0;padding-right:0px;padding-left:0px">
|
372 |
-
|
373 |
-
<table border="0" cellpadding="0" cellspacing="0" width="100%">
|
374 |
-
<tbody><tr>
|
375 |
-
<td align="left" valign="bottom">
|
376 |
-
<img src="https://wpvivid.com/wp-content/uploads/2019/03/report-background.png" width="270" height="60" style="display:block;width:100%;max-width:270px;min-width:10px;height:60px" class="CToWUd">
|
377 |
-
</td>
|
378 |
-
<td width="60" valign="bottom">
|
379 |
-
<img src="https://wpvivid.com/wp-content/uploads/2019/03/female.png" width="60" height="60" style="display:block" class="CToWUd">
|
380 |
-
</td>
|
381 |
-
<td align="right" valign="bottom">
|
382 |
-
<img src="https://wpvivid.com/wp-content/uploads/2019/03/report-background.png" width="270" height="60" style="display:block;width:100%;max-width:270px;min-width:10px;height:60px" class="CToWUd">
|
383 |
-
</td>
|
384 |
</tr>
|
385 |
-
</tbody
|
386 |
-
|
387 |
</td>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
388 |
</tr>
|
389 |
-
|
390 |
-
|
391 |
-
|
392 |
-
<
|
393 |
-
|
|
|
394 |
<table border="0" cellpadding="0" cellspacing="0" width="100%" align="center">
|
395 |
-
|
|
|
396 |
<td align="center" style="padding-top:0px;padding-bottom:10px;padding-right:0;padding-left:0;text-align:center;font-size:18px;line-height:28px;font-weight:bold;">
|
397 |
-
|
398 |
-
|
399 |
-
|
400 |
-
|
401 |
<td align="center" style="padding-top:0px;padding-bottom:0px;padding-right:0;padding-left:0;text-align:center">
|
402 |
-
|
403 |
-
|
404 |
-
|
405 |
-
|
406 |
-
|
407 |
-
|
|
|
|
|
408 |
</tr>
|
409 |
-
|
410 |
-
|
411 |
-
|
412 |
-
<
|
413 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
414 |
</td>
|
415 |
-
|
416 |
-
|
417 |
-
|
418 |
-
|
419 |
-
|
420 |
-
|
421 |
-
</tbody
|
422 |
-
|
423 |
-
|
424 |
-
|
425 |
-
|
426 |
-
|
427 |
-
<table width="100%" border="0" cellspacing="0" cellpadding="0" bgcolor="#F5F7F8">
|
428 |
-
<tbody><tr>
|
429 |
-
<td bgcolor="#F5F7F8" style="padding-top:0px;padding-bottom:0px">
|
430 |
-
<div style="max-width:600px;margin-top:0;margin-bottom:0;margin-right:auto;margin-left:auto;padding-left:20px;padding-right:20px">
|
431 |
-
|
432 |
-
<table bgcolor="#F5F7F8" align="center" style="border-spacing:0;color:#111111;margin:0 auto;width:100%;max-width:600px">
|
433 |
-
<tbody><tr>
|
434 |
-
<td style="padding-top:0;padding-bottom:0;padding-right:0;padding-left:0">
|
435 |
-
<table width="100%" style="border-spacing:0;color:#111111">
|
436 |
-
<tbody><tr>
|
437 |
-
<td style="padding-top:40px;padding-bottom:0px;padding-left:40px;padding-right:40px;background-color:#f5f7f8;width:100%;text-align:left">
|
438 |
-
<p style="margin-top:0px;line-height:0px;margin-bottom:0px;font-size:4px"> </p>
|
439 |
-
</td>
|
440 |
-
</tr>
|
441 |
-
</tbody></table>
|
442 |
-
</td>
|
443 |
-
</tr>
|
444 |
-
</tbody></table>
|
445 |
-
|
446 |
-
</div>
|
447 |
-
</td>
|
448 |
-
</tr>
|
449 |
-
</tbody></table> ';
|
450 |
return $body;
|
451 |
}
|
452 |
|
115 |
$content='Upload';
|
116 |
}
|
117 |
|
118 |
+
$body='
|
119 |
+
<table width="100%" cellpadding="0" cellspacing="0" bgcolor="#F5F7F8">
|
120 |
+
<tbody>
|
121 |
+
<tr>
|
122 |
+
<td style="padding-bottom:20px">
|
123 |
+
<div style="max-width:600px;margin-top:0;margin-bottom:0;margin-right:auto;margin-left:auto;padding-left:20px;padding-right:20px">
|
124 |
+
<table align="center" style="border-spacing:0;color:#111111;Margin:0 auto;width:100%;max-width:600px" bgcolor="#F5F7F8">
|
125 |
+
<tbody>
|
126 |
+
<tr>
|
127 |
+
<td bgcolor="#F5F7F8" style="padding-top:0;padding-bottom:0;padding-right:0;padding-left:0">
|
128 |
+
<table width="73%" style="border-spacing:0;color:#111111" bgcolor="#F5F7F8">
|
129 |
+
<tbody>
|
130 |
+
<tr>
|
131 |
+
<td style="padding-top:20px;padding-bottom:0px;padding-left:10px;padding-right:40px;width:100%;text-align:center;font-size:32px;color:#2ea3f2;line-height:32px;font-weight:bold;">
|
132 |
+
<span><img src="https://wpvivid.com/wp-content/uploads/2019/02/wpvivid-logo.png" title="WPvivid.com"></span>
|
133 |
+
</td>
|
134 |
+
</tr>
|
135 |
+
</tbody>
|
136 |
+
</table>
|
137 |
+
</td>
|
138 |
+
<td width="100%" bgcolor="#F5F7F8" style="padding-top:0;padding-bottom:0;padding-right:0;padding-left:0">
|
139 |
+
<table width="100%" style="border-spacing:0;color:#111111" bgcolor="#F5F7F8">
|
140 |
+
<tbody>
|
141 |
+
<tr>
|
142 |
+
<td style="padding-top:10px;padding-bottom:0px;padding-left:10px;padding-right:0px;background-color:#f5f7f8;width:100%;text-align:right">
|
143 |
+
<p style="Margin-top:0px;margin-bottom:0px;font-size:13px;line-height:16px"><strong><a href="https://twitter.com/wpvividcom" style="text-decoration:none;color:#111111" target="_blank">24/7 Support: <u></u>Twitter<u></u></a></strong></p>
|
144 |
+
</td>
|
145 |
+
</tr>
|
146 |
+
<tr>
|
147 |
+
<td style="padding-top:0px;padding-bottom:0px;padding-left:10px;padding-right:0px;background-color:#f5f7f8;width:100%;text-align:right">
|
148 |
+
<p class="m_764812426175198487customerinfo" style="Margin-top:5px;margin-bottom:0px;font-size:13px;line-height:16px">Or <u></u><a href="https://wpvivid.com/contact-us">Email Us</a><u></u></p>
|
149 |
+
</td>
|
150 |
+
</tr>
|
151 |
+
</tbody>
|
152 |
+
</table>
|
153 |
+
</td>
|
154 |
+
</tr>
|
155 |
+
</tbody>
|
156 |
+
</table>
|
157 |
+
</div>
|
158 |
+
</td>
|
159 |
+
</tr>
|
160 |
+
</tbody>
|
161 |
+
</table>
|
162 |
+
|
163 |
+
<table width="100%" border="0" cellspacing="0" cellpadding="0" bgcolor="#F5F7F8">
|
164 |
+
<tbody>
|
165 |
+
<tr>
|
166 |
+
<td bgcolor="#F5F7F8" style="padding-top:0px;padding-bottom:0px">
|
167 |
+
<div style="max-width:600px;margin-top:0;margin-bottom:0;margin-right:auto;margin-left:auto;padding-left:20px;padding-right:20px">
|
168 |
+
<table bgcolor="#FFFFFF" align="center" style="border-spacing:0;color:#111111;margin:0 auto;width:100%;max-width:600px">
|
169 |
<tbody>
|
170 |
+
<tr>
|
171 |
+
<td style="padding-top:0;padding-bottom:0;padding-right:0;padding-left:0">
|
172 |
+
<table width="100%" style="border-spacing:0;color:#111111">
|
173 |
+
<tbody>
|
174 |
+
<tr>
|
175 |
+
<td style="padding-top:40px;padding-bottom:0px;padding-left:40px;padding-right:40px;background-color:#ffffff;width:100%;text-align:center;font-size:32px;line-height:42px;font-weight:bold;">
|
176 |
+
<span>Wordpress Backup Report</span>
|
177 |
+
</td>
|
178 |
+
</tr>
|
179 |
+
</tbody>
|
180 |
+
</table>
|
181 |
</td>
|
182 |
</tr>
|
183 |
</tbody>
|
184 |
+
</table>
|
185 |
+
</div>
|
|
|
|
|
|
|
|
|
|
|
186 |
</td>
|
187 |
</tr>
|
188 |
+
</tbody>
|
189 |
+
</table>
|
190 |
+
|
191 |
+
<table width="100%" border="0" cellspacing="0" cellpadding="0" bgcolor="#F5F7F8">
|
192 |
+
<tbody>
|
193 |
<tr>
|
194 |
+
<td bgcolor="#F5F7F8" style="padding-top:0px;padding-bottom:0px">
|
195 |
+
<div style="max-width:600px;margin-top:0;margin-bottom:0;margin-right:auto;margin-left:auto;padding-left:20px;padding-right:20px">
|
196 |
+
<table bgcolor="#FFFFFF" align="center" style="border-spacing:0;color:#111111;margin:0 auto;width:100%;max-width:600px">
|
197 |
+
<tbody>
|
198 |
+
<tr>
|
199 |
+
<td style="padding-top:0;padding-bottom:0;padding-right:0;padding-left:0">
|
200 |
+
<table width="100%" style="border-spacing:0;color:#111111">
|
201 |
+
<tbody>
|
202 |
+
<tr>
|
203 |
+
<td style="padding-top:20px;padding-bottom:0px;padding-left:0px;padding-right:0px;background-color:#ffffff;width:100%;text-align:left">
|
204 |
+
<p style="margin-top:0px;line-height:0px;margin-bottom:0px;font-size:4px"> </p>
|
205 |
+
</td>
|
206 |
+
</tr>
|
207 |
+
</tbody>
|
208 |
+
</table>
|
209 |
+
</td>
|
210 |
+
<td width="80" style="padding-top:0;padding-bottom:0;padding-right:0;padding-left:0">
|
211 |
+
<table width="80" style="border-spacing:0;color:#111111;border-bottom-color:#ffcca8;border-bottom-width:2px;border-bottom-style:solid">
|
212 |
+
<tbody>
|
213 |
+
<tr>
|
214 |
+
<td style="padding-top:20px;padding-bottom:0px;padding-left:0px;padding-right:0px;background-color:#ffffff;width:100%;text-align:left">
|
215 |
+
<p style="margin-top:0px;line-height:0px;margin-bottom:0px;font-size:4px"></p>
|
216 |
+
</td>
|
217 |
+
</tr>
|
218 |
+
</tbody>
|
219 |
+
</table>
|
220 |
+
</td>
|
221 |
+
<td style="padding-top:0;padding-bottom:0;padding-right:0;padding-left:0">
|
222 |
+
<table width="100%" style="border-spacing:0;color:#111111">
|
223 |
+
<tbody>
|
224 |
+
<tr>
|
225 |
+
<td style="padding-top:20px;padding-bottom:0px;padding-left:0px;padding-right:0px;background-color:#ffffff;width:100%;text-align:left">
|
226 |
+
<p style="margin-top:0px;line-height:0px;margin-bottom:0px;font-size:4px"> </p>
|
227 |
+
</td>
|
228 |
+
</tr>
|
229 |
+
</tbody>
|
230 |
+
</table>
|
231 |
+
</td>
|
232 |
+
</tr>
|
233 |
+
</tbody>
|
234 |
+
</table>
|
235 |
+
</div>
|
236 |
</td>
|
237 |
</tr>
|
238 |
+
</tbody>
|
239 |
+
</table>
|
240 |
+
|
241 |
+
<table width="100%" border="0" cellspacing="0" cellpadding="0" bgcolor="#F5F7F8">
|
242 |
+
<tbody>
|
243 |
+
<tr>
|
244 |
+
<td bgcolor="#F5F7F8" style="padding-top:0px;padding-bottom:0px">
|
245 |
+
<div style="max-width:600px;margin-top:0;margin-bottom:0;margin-right:auto;margin-left:auto;padding-left:20px;padding-right:20px">
|
246 |
+
<table bgcolor="#FFFFFF" align="center" style="border-spacing:0;color:#111111;margin:0 auto;width:100%;max-width:600px">
|
247 |
+
<tbody>
|
248 |
+
<tr>
|
249 |
+
<td style="padding-top:0;padding-bottom:0;padding-right:0;padding-left:0">
|
250 |
+
<table width="100%" style="border-spacing:0;color:#111111">
|
251 |
+
<tbody>
|
252 |
+
<tr>
|
253 |
+
<td style="padding-top:40px;padding-bottom:0px;padding-left:40px;padding-right:40px;background-color:#ffffff;width:100%;text-align:left">
|
254 |
+
<p style="gdsherpa-regular;margin-top:0px;font-size:14px;line-height:24px;margin-bottom:0px">
|
255 |
+
You receive this email because you have enabled the email notification feature in WPvivid plugin. Backup Details:
|
256 |
+
</p>
|
257 |
+
</td>
|
258 |
+
</tr>
|
259 |
+
</tbody>
|
260 |
+
</table>
|
261 |
+
</td>
|
262 |
+
</tr>
|
263 |
+
</tbody>
|
264 |
+
</table>
|
265 |
+
</div>
|
266 |
+
</td>
|
267 |
+
</tr>
|
268 |
+
</tbody>
|
269 |
+
</table>
|
270 |
+
|
271 |
+
<table width="100%" border="0" cellspacing="0" cellpadding="0" bgcolor="#F5F7F8">
|
272 |
+
<tbody>
|
273 |
+
<tr>
|
274 |
+
<td bgcolor="#F5F7F8" style="background-color:#f5f7f8;padding-top:0;padding-right:0;padding-left:0;padding-bottom:0">
|
275 |
+
<div style="max-width:600px;margin-top:0;margin-bottom:0;margin-right:auto;margin-left:auto;padding-left:20px;padding-right:20px">
|
276 |
+
<table bgcolor="#ffffff" width="100%" align="left" border="0" cellspacing="0" cellpadding="0" style="color:#111111">
|
277 |
+
<tbody>
|
278 |
+
<tr>
|
279 |
+
<td bgcolor="#ffffff" align="left" style="padding-top:10px;padding-bottom:0;padding-right:40px;padding-left:40px;background-color:#ffffff">
|
280 |
+
<table border="0" cellpadding="0" cellspacing="0" align="left" width="100%">
|
281 |
+
<tbody>
|
282 |
+
<tr>
|
283 |
+
<td style="padding-top:10px;padding-right:0;padding-bottom:0;padding-left:20px">
|
284 |
+
<table border="0" cellpadding="0" cellspacing="0" align="left">
|
285 |
+
<tbody>
|
286 |
+
<tr>
|
287 |
+
<td valign="top" align="left" style="padding-top:0px;padding-right:0px;padding-bottom:0px;padding-left:0px">
|
288 |
+
<p style="text-align:left;Margin-top:0px;Margin-bottom:0px;gdsherpa-regular;font-size:14px;line-height:24px"><label>Backup:</label><label>'.$status.'</label></p>
|
289 |
+
</td>
|
290 |
+
</tr>
|
291 |
+
<tr>
|
292 |
+
<td valign="top" align="left" style="padding-top:0px;padding-right:0px;padding-bottom:0px;padding-left:0px">
|
293 |
+
<p style="text-align:left;Margin-top:0px;Margin-bottom:0px;gdsherpa-regular;font-size:14px;line-height:24px"><label>Backup Type:</label><label>'.$type.'</label></p>
|
294 |
+
</td>
|
295 |
+
</tr>
|
296 |
+
<tr>
|
297 |
+
<td valign="top" align="left" style="padding-top:0px;padding-right:0px;padding-bottom:0px;padding-left:0px">
|
298 |
+
<p style="text-align:left;Margin-top:0px;Margin-bottom:0px;gdsherpa-regular;font-size:14px;line-height:24px"><label>Start Time:</label><label>'.$start_time.'</label></p>
|
299 |
+
</td>
|
300 |
+
</tr>
|
301 |
+
<tr>
|
302 |
+
<td valign="top" align="left" style="padding-top:0px;padding-right:0px;padding-bottom:0px;padding-left:0px">
|
303 |
+
<p style="text-align:left;Margin-top:0px;Margin-bottom:0px;gdsherpa-regular;font-size:14px;line-height:24px"><label>End Time:</label><label>'.$end_time.'</label></p>
|
304 |
+
</td>
|
305 |
+
</tr>
|
306 |
+
<tr>
|
307 |
+
<td valign="top" align="left" style="padding-top:0px;padding-right:0px;padding-bottom:0px;padding-left:0px">
|
308 |
+
<p style="text-align:left;Margin-top:0px;Margin-bottom:0px;gdsherpa-regular;font-size:14px;line-height:24px"><label>Running Time:</label><label>'.$running_time.'</label></p>
|
309 |
+
</td>
|
310 |
+
</tr>
|
311 |
+
<tr>
|
312 |
+
<td valign="top" align="left" style="padding-top:0px;padding-right:0px;padding-bottom:0px;padding-left:0px">
|
313 |
+
<p style="text-align:left;Margin-top:0px;Margin-bottom:0px;gdsherpa-regular;font-size:14px;line-height:24px"><label>Back up to:</label><label>'.$remote.'</label></p>
|
314 |
+
</td>
|
315 |
+
</tr>
|
316 |
+
<tr>
|
317 |
+
<td valign="top" align="left" style="padding-top:0px;padding-right:0px;padding-bottom:0px;padding-left:0px">
|
318 |
+
<p style="text-align:left;Margin-top:0px;Margin-bottom:0px;gdsherpa-regular;font-size:14px;line-height:24px"><label>Backup Content:</label><label>'.$content.'</label></p>
|
319 |
+
</td>
|
320 |
+
</tr>
|
321 |
+
</tbody>
|
322 |
+
</table>
|
323 |
+
</td>
|
324 |
+
</tr>
|
325 |
+
</tbody>
|
326 |
+
</table>
|
327 |
+
</td>
|
328 |
+
</tr>
|
329 |
+
</tbody>
|
330 |
+
</table>
|
331 |
+
</div>
|
332 |
+
</td>
|
333 |
+
</tr>
|
334 |
+
</tbody>
|
335 |
+
</table>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
336 |
|
337 |
+
<table width="100%" border="0" cellspacing="0" cellpadding="0" bgcolor="#F5F7F8">
|
338 |
+
<tbody>
|
339 |
+
<tr>
|
340 |
+
<td bgcolor="#F5F7F8" style="padding-top:0px;padding-bottom:0px">
|
341 |
+
<div style="max-width:600px;margin-top:0;margin-bottom:0;margin-right:auto;margin-left:auto;padding-left:20px;padding-right:20px">
|
342 |
+
<table bgcolor="#FFFFFF" align="center" style="border-spacing:0;color:#111111;margin:0 auto;width:100%;max-width:600px">
|
343 |
+
<tbody>
|
344 |
+
<tr>
|
345 |
+
<td style="padding-top:0;padding-bottom:0;padding-right:0;padding-left:0">
|
346 |
+
<table width="100%" style="border-spacing:0;color:#757575">
|
347 |
+
<tbody>
|
348 |
+
<tr>
|
349 |
+
<td style="padding-top:20px;padding-bottom:0px;padding-left:40px;padding-right:40px;background-color:#ffffff;width:100%;text-align:left">
|
350 |
+
<p style="gdsherpa-regular;margin-top:0px;font-size:14px;line-height:24px;margin-bottom:0px">
|
351 |
+
*WPvivd Backup plugin is a Wordpress plugin that it will help you back up your site to the leading cloud storage providers like Dropbox, Google Drive, Amazon S3, Microsoft OneDrive, FTP and SFTP.
|
352 |
+
</p>
|
353 |
+
<p style="gdsherpa-regular;margin-top:0px;font-size:14px;line-height:24px;margin-bottom:0px">
|
354 |
+
Plugin Page: <a href="https://wordpress.org/plugins/wpvivid-backuprestore/">https://wordpress.org/plugins/wpvivid-backuprestore/</a>
|
355 |
+
</p>
|
356 |
+
</td>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
357 |
</tr>
|
358 |
+
</tbody>
|
359 |
+
</table>
|
360 |
</td>
|
361 |
+
</tr>
|
362 |
+
</tbody>
|
363 |
+
</table>
|
364 |
+
</div>
|
365 |
+
</td>
|
366 |
+
</tr>
|
367 |
+
</tbody>
|
368 |
+
</table>
|
369 |
+
|
370 |
+
<table width="100%" border="0" cellspacing="0" cellpadding="0" bgcolor="#F5F7F8">
|
371 |
+
<tbody>
|
372 |
+
<tr>
|
373 |
+
<td bgcolor="#F5F7F8" style="padding-top:0px;padding-bottom:0px">
|
374 |
+
<div style="max-width:600px;margin-top:0;margin-bottom:0;margin-right:auto;margin-left:auto;padding-left:20px;padding-right:20px">
|
375 |
+
<table bgcolor="#FFFFFF" align="center" style="border-spacing:0;color:#111111;margin:0 auto;width:100%;max-width:600px">
|
376 |
+
<tbody>
|
377 |
+
<tr>
|
378 |
+
<td style="padding-top:0;padding-bottom:0;padding-right:0;padding-left:0">
|
379 |
+
<table width="100%" style="border-spacing:0;color:#111111">
|
380 |
+
<tbody>
|
381 |
+
<tr>
|
382 |
+
<td style="padding-top:40px;padding-bottom:0px;padding-left:40px;padding-right:40px;background-color:#ffffff;width:100%;text-align:left">
|
383 |
+
<p style="margin-top:0px;line-height:0px;margin-bottom:0px;font-size:4px"></p>
|
384 |
+
</td>
|
385 |
+
</tr>
|
386 |
+
</tbody>
|
387 |
+
</table>
|
388 |
+
</td>
|
389 |
+
</tr>
|
390 |
+
</tbody>
|
391 |
+
</table>
|
392 |
+
</div>
|
393 |
+
</td>
|
394 |
+
</tr>
|
395 |
+
</tbody>
|
396 |
+
</table>
|
397 |
+
|
398 |
+
<table width="100%" border="0" cellspacing="0" cellpadding="0" bgcolor="#F5F7F8">
|
399 |
+
<tbody>
|
400 |
+
<tr>
|
401 |
+
<td bgcolor="#F5F7F8" style="background-color:#f5f7f8;padding-top:0;padding-right:0;padding-left:0;padding-bottom:0">
|
402 |
+
<div style="max-width:600px;margin-top:0;margin-bottom:0;margin-right:auto;margin-left:auto;padding-left:20px;padding-right:20px">
|
403 |
+
<table width="100%" align="center" border="0" cellspacing="0" cellpadding="0" style="color:#111111">
|
404 |
+
<tbody>
|
405 |
+
<tr>
|
406 |
+
<td align="center" style="padding-top:40px;padding-bottom:0;padding-right:0px;padding-left:0px">
|
407 |
+
<table border="0" cellpadding="0" cellspacing="0" width="100%">
|
408 |
+
<tbody>
|
409 |
+
<tr>
|
410 |
+
<td align="left" valign="bottom">
|
411 |
+
<img src="https://wpvivid.com/wp-content/uploads/2019/03/report-background.png" width="270" height="60" style="display:block;width:100%;max-width:270px;min-width:10px;height:60px" class="CToWUd">
|
412 |
+
</td>
|
413 |
+
<td width="60" valign="bottom">
|
414 |
+
<img src="https://wpvivid.com/wp-content/uploads/2019/03/female.png" width="60" height="60" style="display:block" class="CToWUd">
|
415 |
+
</td>
|
416 |
+
<td align="right" valign="bottom">
|
417 |
+
<img src="https://wpvivid.com/wp-content/uploads/2019/03/report-background.png" width="270" height="60" style="display:block;width:100%;max-width:270px;min-width:10px;height:60px" class="CToWUd">
|
418 |
+
</td>
|
419 |
+
</tr>
|
420 |
+
</tbody>
|
421 |
+
</table>
|
422 |
+
</td>
|
423 |
</tr>
|
424 |
+
</tbody>
|
425 |
+
</table>
|
426 |
+
<table bgcolor="#FFFFFF" width="100%" align="left" border="0" cellspacing="0" cellpadding="0" style="color:#111111">
|
427 |
+
<tbody>
|
428 |
+
<tr>
|
429 |
+
<td bgcolor="#FFFFFF" align="left" style="padding-top:20px;padding-bottom:40px;padding-right:40px;padding-left:40px;background-color:#ffffff">
|
430 |
<table border="0" cellpadding="0" cellspacing="0" width="100%" align="center">
|
431 |
+
<tbody>
|
432 |
+
<tr>
|
433 |
<td align="center" style="padding-top:0px;padding-bottom:10px;padding-right:0;padding-left:0;text-align:center;font-size:18px;line-height:28px;font-weight:bold;">
|
434 |
+
<span>We\'re here to help you do your thing.</span>
|
435 |
+
</td>
|
436 |
+
</tr>
|
437 |
+
<tr>
|
438 |
<td align="center" style="padding-top:0px;padding-bottom:0px;padding-right:0;padding-left:0;text-align:center">
|
439 |
+
<p style="text-align:center;margin-top:0px;margin-bottom:0px;gdsherpa-regular;;font-size:14px;line-height:24px">
|
440 |
+
<a href="https://wpvivid.com/contact-us">Contact Us</a> or <a href="https://twitter.com/wpvividcom">Twitter</a>
|
441 |
+
</p>
|
442 |
+
</td>
|
443 |
+
</tr>
|
444 |
+
</tbody>
|
445 |
+
</table>
|
446 |
+
</td>
|
447 |
</tr>
|
448 |
+
</tbody>
|
449 |
+
</table>
|
450 |
+
<table border="0" cellpadding="0" cellspacing="0" width="100%">
|
451 |
+
<tbody>
|
452 |
+
<tr>
|
453 |
+
<td valign="top" style="font-size:0px;line-height:0px;padding-top:0px;padding-right:0px;padding-bottom:0px;padding-left:0px">
|
454 |
+
<img src="https://wpvivid.com/wp-content/uploads/2019/03/unnamed6.jpg" width="600" height="5" style="display:block;width:100%;max-width:600px;min-width:10px;height:5px">
|
455 |
+
</td>
|
456 |
+
</tr>
|
457 |
+
</tbody>
|
458 |
+
</table>
|
459 |
+
</div>
|
460 |
+
</td>
|
461 |
+
</tr>
|
462 |
+
</tbody>
|
463 |
+
</table>
|
464 |
+
|
465 |
+
<table width="100%" border="0" cellspacing="0" cellpadding="0" bgcolor="#F5F7F8">
|
466 |
+
<tbody>
|
467 |
+
<tr>
|
468 |
+
<td bgcolor="#F5F7F8" style="padding-top:0px;padding-bottom:0px">
|
469 |
+
<div style="max-width:600px;margin-top:0;margin-bottom:0;margin-right:auto;margin-left:auto;padding-left:20px;padding-right:20px">
|
470 |
+
<table bgcolor="#F5F7F8" align="center" style="border-spacing:0;color:#111111;margin:0 auto;width:100%;max-width:600px">
|
471 |
+
<tbody>
|
472 |
+
<tr>
|
473 |
+
<td style="padding-top:0;padding-bottom:0;padding-right:0;padding-left:0">
|
474 |
+
<table width="100%" style="border-spacing:0;color:#111111">
|
475 |
+
<tbody>
|
476 |
+
<tr>
|
477 |
+
<td style="padding-top:40px;padding-bottom:0px;padding-left:40px;padding-right:40px;background-color:#f5f7f8;width:100%;text-align:left">
|
478 |
+
<p style="margin-top:0px;line-height:0px;margin-bottom:0px;font-size:4px"> </p>
|
479 |
+
</td>
|
480 |
+
</tr>
|
481 |
+
</tbody>
|
482 |
+
</table>
|
483 |
</td>
|
484 |
+
</tr>
|
485 |
+
</tbody>
|
486 |
+
</table>
|
487 |
+
</div>
|
488 |
+
</td>
|
489 |
+
</tr>
|
490 |
+
</tbody>
|
491 |
+
</table>';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
492 |
return $body;
|
493 |
}
|
494 |
|
includes/class-wpvivid-migrate.php
CHANGED
@@ -282,8 +282,6 @@ class WPvivid_Migrate
|
|
282 |
}
|
283 |
}
|
284 |
|
285 |
-
wpvivid_manage_upload_task();
|
286 |
-
|
287 |
function wpvivid_activate_migrate_cron(){
|
288 |
var next_get_time = 3 * 60 * 1000;
|
289 |
jQuery.get(wpvivid_home_url+'/wp-cron.php');
|
@@ -293,8 +291,6 @@ class WPvivid_Migrate
|
|
293 |
}, 10000);
|
294 |
}
|
295 |
|
296 |
-
wpvivid_activate_migrate_cron();
|
297 |
-
|
298 |
function switchmigrateTabs(evt,contentName,storage_page_id) {
|
299 |
// Declare all variables
|
300 |
var i, tabcontent, tablinks;
|
@@ -318,6 +314,12 @@ class WPvivid_Migrate
|
|
318 |
var top = jQuery('#'+storage_page_id).offset().top-jQuery('#'+storage_page_id).height();
|
319 |
jQuery('html, body').animate({scrollTop:top}, 'slow');
|
320 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
321 |
</script>
|
322 |
<?php
|
323 |
}
|
@@ -672,7 +674,7 @@ class WPvivid_Migrate
|
|
672 |
$task_id = $ret['task_id'];
|
673 |
|
674 |
global $wpvivid_plugin;
|
675 |
-
$wpvivid_plugin->check_backup($task_id, $backup
|
676 |
echo json_encode($ret);
|
677 |
die();
|
678 |
}
|
282 |
}
|
283 |
}
|
284 |
|
|
|
|
|
285 |
function wpvivid_activate_migrate_cron(){
|
286 |
var next_get_time = 3 * 60 * 1000;
|
287 |
jQuery.get(wpvivid_home_url+'/wp-cron.php');
|
291 |
}, 10000);
|
292 |
}
|
293 |
|
|
|
|
|
294 |
function switchmigrateTabs(evt,contentName,storage_page_id) {
|
295 |
// Declare all variables
|
296 |
var i, tabcontent, tablinks;
|
314 |
var top = jQuery('#'+storage_page_id).offset().top-jQuery('#'+storage_page_id).height();
|
315 |
jQuery('html, body').animate({scrollTop:top}, 'slow');
|
316 |
}
|
317 |
+
|
318 |
+
jQuery(document).ready(function ()
|
319 |
+
{
|
320 |
+
wpvivid_activate_migrate_cron();
|
321 |
+
wpvivid_manage_upload_task();
|
322 |
+
});
|
323 |
</script>
|
324 |
<?php
|
325 |
}
|
674 |
$task_id = $ret['task_id'];
|
675 |
|
676 |
global $wpvivid_plugin;
|
677 |
+
$wpvivid_plugin->check_backup($task_id, $backup);
|
678 |
echo json_encode($ret);
|
679 |
die();
|
680 |
}
|
includes/class-wpvivid-public-interface.php
CHANGED
@@ -14,14 +14,21 @@ class WPvivid_Public_Interface
|
|
14 |
$ret['error']='Invalid parameter param:'.$backup_options;
|
15 |
return $ret;
|
16 |
}
|
17 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
18 |
if($ret['result']!='success') {
|
19 |
return $ret;
|
20 |
}
|
21 |
-
$ret=$wpvivid_plugin->pre_backup($backup_options
|
22 |
if($ret['result']=='success') {
|
23 |
//Check the website data to be backed up
|
24 |
-
$ret['check']=$wpvivid_plugin->check_backup($ret['task_id'],$backup_options
|
25 |
if(isset($ret['check']['result']) && $ret['check']['result'] == 'failed') {
|
26 |
$ret['error']=$ret['check']['error'];
|
27 |
return $ret;
|
14 |
$ret['error']='Invalid parameter param:'.$backup_options;
|
15 |
return $ret;
|
16 |
}
|
17 |
+
$backup_options = apply_filters('wpvivid_custom_backup_options', $backup_options);
|
18 |
+
|
19 |
+
if(!isset($backup_options['type']))
|
20 |
+
{
|
21 |
+
$backup_options['type']='Manual';
|
22 |
+
$backup_options['action']='backup';
|
23 |
+
}
|
24 |
+
$ret = $wpvivid_plugin->check_backup_option($backup_options, $backup_options['type']);
|
25 |
if($ret['result']!='success') {
|
26 |
return $ret;
|
27 |
}
|
28 |
+
$ret=$wpvivid_plugin->pre_backup($backup_options);
|
29 |
if($ret['result']=='success') {
|
30 |
//Check the website data to be backed up
|
31 |
+
$ret['check']=$wpvivid_plugin->check_backup($ret['task_id'],$backup_options);
|
32 |
if(isset($ret['check']['result']) && $ret['check']['result'] == 'failed') {
|
33 |
$ret['error']=$ret['check']['error'];
|
34 |
return $ret;
|
includes/class-wpvivid-restore-data.php
CHANGED
@@ -5,12 +5,12 @@ if (!defined('WPVIVID_PLUGIN_DIR')){
|
|
5 |
}
|
6 |
class WPvivid_restore_data
|
7 |
{
|
8 |
-
|
9 |
private $rollback_file;
|
10 |
private $rollback_data_file;
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
private $rollback_log_file;
|
15 |
private $rollback_log=false;
|
16 |
private $rollback_cache=false;
|
5 |
}
|
6 |
class WPvivid_restore_data
|
7 |
{
|
8 |
+
public $restore_data_file;
|
9 |
private $rollback_file;
|
10 |
private $rollback_data_file;
|
11 |
+
public $restore_log_file;
|
12 |
+
public $restore_log=false;
|
13 |
+
public $restore_cache=false;
|
14 |
private $rollback_log_file;
|
15 |
private $rollback_log=false;
|
16 |
private $rollback_cache=false;
|
includes/class-wpvivid-restore-database.php
CHANGED
@@ -77,6 +77,7 @@ class WPvivid_RestoreDB
|
|
77 |
|
78 |
$this->db_method->init_sql_mode();
|
79 |
$result=$this->execute_sql_file($path.$sql_file,$options);
|
|
|
80 |
unset($this->db_method);
|
81 |
return $result;
|
82 |
}else {
|
@@ -84,6 +85,17 @@ class WPvivid_RestoreDB
|
|
84 |
}
|
85 |
}
|
86 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
87 |
private function execute_sql_file($file,$option)
|
88 |
{
|
89 |
global $wpdb,$wpvivid_plugin;
|
@@ -112,7 +124,7 @@ class WPvivid_RestoreDB
|
|
112 |
}
|
113 |
else
|
114 |
{
|
115 |
-
$this->default_charsets[]=
|
116 |
}
|
117 |
|
118 |
if(isset($option['default_collations']))
|
@@ -121,7 +133,7 @@ class WPvivid_RestoreDB
|
|
121 |
}
|
122 |
else
|
123 |
{
|
124 |
-
$this->default_collates[]=
|
125 |
}
|
126 |
|
127 |
$this->old_prefix='';
|
@@ -360,6 +372,151 @@ class WPvivid_RestoreDB
|
|
360 |
}
|
361 |
}
|
362 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
363 |
$charset='';
|
364 |
if (preg_match('/CHARSET=([^\s;]+)/', $query, $matches))
|
365 |
{
|
@@ -417,7 +574,20 @@ class WPvivid_RestoreDB
|
|
417 |
else
|
418 |
{
|
419 |
if(!empty($this->default_collates))
|
|
|
420 |
$replace_collate=$this->default_collates[0];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
421 |
}
|
422 |
}
|
423 |
|
@@ -456,7 +626,20 @@ class WPvivid_RestoreDB
|
|
456 |
else
|
457 |
{
|
458 |
if(!empty($this->default_collates))
|
|
|
459 |
$replace_collate=$this->default_collates[0];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
460 |
}
|
461 |
}
|
462 |
|
@@ -466,6 +649,8 @@ class WPvivid_RestoreDB
|
|
466 |
$query=str_replace("COLLATE=$collate", "COLLATE=$replace_collate", $query);
|
467 |
}
|
468 |
}
|
|
|
|
|
469 |
$this->execute_sql($query);
|
470 |
|
471 |
return $table_name;
|
77 |
|
78 |
$this->db_method->init_sql_mode();
|
79 |
$result=$this->execute_sql_file($path.$sql_file,$options);
|
80 |
+
$this->enable_plugins();
|
81 |
unset($this->db_method);
|
82 |
return $result;
|
83 |
}else {
|
85 |
}
|
86 |
}
|
87 |
|
88 |
+
private function enable_plugins()
|
89 |
+
{
|
90 |
+
include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
|
91 |
+
$plugin_list=array();
|
92 |
+
$plugin_list[]='wpvivid-backuprestore/wpvivid-backuprestore.php';
|
93 |
+
$plugin_list=apply_filters('wpvivid_enable_plugins_list',$plugin_list);
|
94 |
+
//$plugin_list[]='WPvivid_backup_premium/WPvivid_backup_premium.php';
|
95 |
+
|
96 |
+
activate_plugins($plugin_list,'',false,true);
|
97 |
+
}
|
98 |
+
|
99 |
private function execute_sql_file($file,$option)
|
100 |
{
|
101 |
global $wpdb,$wpvivid_plugin;
|
124 |
}
|
125 |
else
|
126 |
{
|
127 |
+
$this->default_charsets[]=DB_CHARSET;
|
128 |
}
|
129 |
|
130 |
if(isset($option['default_collations']))
|
133 |
}
|
134 |
else
|
135 |
{
|
136 |
+
$this->default_collates[]=DB_COLLATE;
|
137 |
}
|
138 |
|
139 |
$this->old_prefix='';
|
372 |
}
|
373 |
}
|
374 |
|
375 |
+
|
376 |
+
if (preg_match('/CHARSET ([^\s;]+)/', $query, $matches)||preg_match('/CHARSET=([^\s;]+)/', $query, $matches))
|
377 |
+
{
|
378 |
+
$charset = $matches[1];
|
379 |
+
$replace_charset=true;
|
380 |
+
foreach ($this->support_charsets as $support_charset)
|
381 |
+
{
|
382 |
+
if(strtolower($charset)==strtolower($support_charset))
|
383 |
+
{
|
384 |
+
$replace_charset=false;
|
385 |
+
break;
|
386 |
+
}
|
387 |
+
}
|
388 |
+
|
389 |
+
if($replace_charset)
|
390 |
+
{
|
391 |
+
$replace_charset=$this->default_charsets[0];
|
392 |
+
}
|
393 |
+
|
394 |
+
if($replace_charset!==false)
|
395 |
+
{
|
396 |
+
$wpvivid_plugin->restore_data->write_log('create table replace charset:'.$charset.' to :'.$replace_charset,'notice');
|
397 |
+
$query=str_replace("CHARSET=$charset", "CHARSET=$replace_charset", $query);
|
398 |
+
$query=str_replace("CHARSET $charset", "CHARSET=$replace_charset", $query);
|
399 |
+
$charset=$replace_charset;
|
400 |
+
}
|
401 |
+
|
402 |
+
$collate='';
|
403 |
+
|
404 |
+
if (preg_match('/ COLLATE ([a-zA-Z0-9._-]+)/i', $query, $matches))
|
405 |
+
{
|
406 |
+
$collate = $matches[1];
|
407 |
+
}
|
408 |
+
else if(preg_match('/ COLLATE=([a-zA-Z0-9._-]+)/i', $query, $matches))
|
409 |
+
{
|
410 |
+
$collate = $matches[1];
|
411 |
+
}
|
412 |
+
|
413 |
+
if(!empty($collate))
|
414 |
+
{
|
415 |
+
$replace_collate=true;
|
416 |
+
foreach ($this->support_collates as $key=>$support_collate)
|
417 |
+
{
|
418 |
+
if(strtolower($charset)==strtolower($support_collate->Charset)&&strtolower($collate)==strtolower($key))
|
419 |
+
{
|
420 |
+
$replace_collate=false;
|
421 |
+
break;
|
422 |
+
}
|
423 |
+
}
|
424 |
+
|
425 |
+
if($replace_collate)
|
426 |
+
{
|
427 |
+
$replace_collate=false;
|
428 |
+
foreach ($this->support_collates as $key=>$support_collate)
|
429 |
+
{
|
430 |
+
if(strtolower($charset)==strtolower($support_collate->Charset))
|
431 |
+
{
|
432 |
+
if($support_collate->Default=='Yes')
|
433 |
+
{
|
434 |
+
$replace_collate=$key;
|
435 |
+
}
|
436 |
+
}
|
437 |
+
}
|
438 |
+
|
439 |
+
if($replace_collate==false)
|
440 |
+
{
|
441 |
+
foreach ($this->support_collates as $key=>$support_collate)
|
442 |
+
{
|
443 |
+
if(strtolower($charset)==strtolower($support_collate->Charset))
|
444 |
+
{
|
445 |
+
$replace_collate=$key;
|
446 |
+
break;
|
447 |
+
}
|
448 |
+
}
|
449 |
+
}
|
450 |
+
}
|
451 |
+
|
452 |
+
if($replace_collate!==false)
|
453 |
+
{
|
454 |
+
$wpvivid_plugin->restore_data->write_log('create table replace collate:'.$collate.' to :'.$replace_collate,'notice');
|
455 |
+
$query=str_replace("COLLATE $collate", "COLLATE $replace_collate", $query);
|
456 |
+
$query=str_replace("COLLATE=$collate", "COLLATE=$replace_collate", $query);
|
457 |
+
}
|
458 |
+
}
|
459 |
+
}
|
460 |
+
else
|
461 |
+
{
|
462 |
+
if (preg_match('/ COLLATE ([a-zA-Z0-9._-]+)/i', $query, $matches))
|
463 |
+
{
|
464 |
+
$collate = $matches[1];
|
465 |
+
}
|
466 |
+
else if(preg_match('/ COLLATE=([a-zA-Z0-9._-]+)/i', $query, $matches))
|
467 |
+
{
|
468 |
+
$collate = $matches[1];
|
469 |
+
}
|
470 |
+
|
471 |
+
if(!empty($collate))
|
472 |
+
{
|
473 |
+
$replace_collate=true;
|
474 |
+
foreach ($this->support_collates as $key=>$support_collate)
|
475 |
+
{
|
476 |
+
if(strtolower($collate)==strtolower($key))
|
477 |
+
{
|
478 |
+
$replace_collate=false;
|
479 |
+
break;
|
480 |
+
}
|
481 |
+
}
|
482 |
+
|
483 |
+
if($replace_collate)
|
484 |
+
{
|
485 |
+
$replace_collate=false;
|
486 |
+
foreach ($this->support_collates as $key=>$support_collate)
|
487 |
+
{
|
488 |
+
if(strtolower($this->default_charsets[0])==strtolower($support_collate->Charset))
|
489 |
+
{
|
490 |
+
if($support_collate->Default=='Yes')
|
491 |
+
{
|
492 |
+
$replace_collate=$key;
|
493 |
+
}
|
494 |
+
}
|
495 |
+
}
|
496 |
+
|
497 |
+
if($replace_collate==false)
|
498 |
+
{
|
499 |
+
foreach ($this->support_collates as $key=>$support_collate)
|
500 |
+
{
|
501 |
+
if(strtolower($this->default_charsets[0])==strtolower($support_collate->Charset))
|
502 |
+
{
|
503 |
+
$replace_collate=$key;
|
504 |
+
break;
|
505 |
+
}
|
506 |
+
}
|
507 |
+
}
|
508 |
+
}
|
509 |
+
|
510 |
+
if($replace_collate!==false)
|
511 |
+
{
|
512 |
+
$wpvivid_plugin->restore_data->write_log('create table replace collate:'.$collate.' to :'.$replace_collate,'notice');
|
513 |
+
$query=str_replace("COLLATE $collate", "COLLATE $replace_collate", $query);
|
514 |
+
$query=str_replace("COLLATE=$collate", "COLLATE=$replace_collate", $query);
|
515 |
+
}
|
516 |
+
}
|
517 |
+
}
|
518 |
+
|
519 |
+
/*
|
520 |
$charset='';
|
521 |
if (preg_match('/CHARSET=([^\s;]+)/', $query, $matches))
|
522 |
{
|
574 |
else
|
575 |
{
|
576 |
if(!empty($this->default_collates))
|
577 |
+
{
|
578 |
$replace_collate=$this->default_collates[0];
|
579 |
+
if(empty($replace_collate))
|
580 |
+
{
|
581 |
+
foreach ($this->support_collates as $key=>$support_collate)
|
582 |
+
{
|
583 |
+
if(strtolower($this->default_charsets[0])==strtolower($support_collate->Charset))
|
584 |
+
{
|
585 |
+
$replace_collate=$key;
|
586 |
+
break;
|
587 |
+
}
|
588 |
+
}
|
589 |
+
}
|
590 |
+
}
|
591 |
}
|
592 |
}
|
593 |
|
626 |
else
|
627 |
{
|
628 |
if(!empty($this->default_collates))
|
629 |
+
{
|
630 |
$replace_collate=$this->default_collates[0];
|
631 |
+
if(empty($replace_collate))
|
632 |
+
{
|
633 |
+
foreach ($this->support_collates as $key=>$support_collate)
|
634 |
+
{
|
635 |
+
if(strtolower($this->default_charsets[0])==strtolower($support_collate->Charset))
|
636 |
+
{
|
637 |
+
$replace_collate=$key;
|
638 |
+
break;
|
639 |
+
}
|
640 |
+
}
|
641 |
+
}
|
642 |
+
}
|
643 |
}
|
644 |
}
|
645 |
|
649 |
$query=str_replace("COLLATE=$collate", "COLLATE=$replace_collate", $query);
|
650 |
}
|
651 |
}
|
652 |
+
*/
|
653 |
+
|
654 |
$this->execute_sql($query);
|
655 |
|
656 |
return $table_name;
|
includes/class-wpvivid-restore-site.php
CHANGED
@@ -29,7 +29,14 @@ class WPvivid_RestoreSite
|
|
29 |
$all_files[] =WP_CONTENT_DIR.DIRECTORY_SEPARATOR.WPvivid_Setting::get_backupdir().DIRECTORY_SEPARATOR.$file;
|
30 |
}
|
31 |
|
32 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
33 |
}
|
34 |
else if(isset($option['dump_db']))
|
35 |
{
|
@@ -54,13 +61,30 @@ class WPvivid_RestoreSite
|
|
54 |
}
|
55 |
else
|
56 |
{
|
57 |
-
$root_path
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
58 |
|
59 |
$root_path = rtrim($root_path, '/');
|
60 |
$root_path = rtrim($root_path, DIRECTORY_SEPARATOR);
|
61 |
|
62 |
-
$old_path=WP_CONTENT_DIR.DIRECTORY_SEPARATOR.WPvivid_Setting::get_backupdir().DIRECTORY_SEPARATOR.WPVIVID_DEFAULT_ROLLBACK_DIR.DIRECTORY_SEPARATOR.'wpvivid_old_site'.DIRECTORY_SEPARATOR.$option['root'];
|
63 |
-
|
64 |
$exclude_path[]=$this->transfer_path(WP_CONTENT_DIR.DIRECTORY_SEPARATOR.WPvivid_Setting::get_backupdir());
|
65 |
|
66 |
if(isset($option['include_path']))
|
@@ -72,13 +96,6 @@ class WPvivid_RestoreSite
|
|
72 |
$include_path=array();
|
73 |
}
|
74 |
|
75 |
-
if(!isset($option['skip_backup_old_site']))
|
76 |
-
{
|
77 |
-
$wpvivid_plugin->restore_data->write_log('backup old file site','notice');
|
78 |
-
$this->pre_restore($root_path,$old_path,$include_path,$exclude_path);
|
79 |
-
}
|
80 |
-
|
81 |
-
|
82 |
$zip = new WPvivid_ZipClass();
|
83 |
$all_files = array();
|
84 |
foreach ($files as $file)
|
@@ -90,11 +107,44 @@ class WPvivid_RestoreSite
|
|
90 |
|
91 |
$ret= $zip->extract($all_files,$root_path);
|
92 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
93 |
unset($zip);
|
94 |
|
95 |
if(isset($option['wp_core'])&&isset($option['is_migrate']))
|
96 |
{
|
97 |
-
if($option['is_migrate'] == 1)
|
|
|
98 |
@rename(get_home_path() . '.htaccess', get_home_path() . '.htaccess_old');
|
99 |
if (function_exists('save_mod_rewrite_rules')) {
|
100 |
save_mod_rewrite_rules();
|
@@ -102,10 +152,21 @@ class WPvivid_RestoreSite
|
|
102 |
WPvivid_Setting::update_option('wpvivid_migrate_status', 'completed');
|
103 |
}
|
104 |
}
|
|
|
105 |
return $ret;
|
106 |
}
|
107 |
}
|
108 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
109 |
public function pre_restore($path,$save_old_path,$include_path,$exclude_path)
|
110 |
{
|
111 |
if(!file_exists($save_old_path))
|
29 |
$all_files[] =WP_CONTENT_DIR.DIRECTORY_SEPARATOR.WPvivid_Setting::get_backupdir().DIRECTORY_SEPARATOR.$file;
|
30 |
}
|
31 |
|
32 |
+
if(isset($option['extract_child_files']))
|
33 |
+
{
|
34 |
+
return $zip -> extract_ex($all_files,$root_path,$option['extract_child_files']);
|
35 |
+
}
|
36 |
+
else
|
37 |
+
{
|
38 |
+
return $zip -> extract($all_files,$root_path);
|
39 |
+
}
|
40 |
}
|
41 |
else if(isset($option['dump_db']))
|
42 |
{
|
61 |
}
|
62 |
else
|
63 |
{
|
64 |
+
$root_path='';
|
65 |
+
if(isset($option['root']))
|
66 |
+
{
|
67 |
+
$root_path=$this->transfer_path(get_home_path().$option['root']);
|
68 |
+
}
|
69 |
+
else if(isset($option['root_flag']))
|
70 |
+
{
|
71 |
+
if($option['root_flag']==WPVIVID_BACKUP_ROOT_WP_CONTENT)
|
72 |
+
{
|
73 |
+
$root_path=$this->transfer_path(WP_CONTENT_DIR);
|
74 |
+
}
|
75 |
+
else if($option['root_flag']==WPVIVID_BACKUP_ROOT_CUSTOM)
|
76 |
+
{
|
77 |
+
$root_path=$this->transfer_path(WP_CONTENT_DIR.DIRECTORY_SEPARATOR.WPvivid_Setting::get_backupdir());
|
78 |
+
}
|
79 |
+
else if($option['root_flag']==WPVIVID_BACKUP_ROOT_WP_ROOT)
|
80 |
+
{
|
81 |
+
$root_path=$this->transfer_path(ABSPATH);
|
82 |
+
}
|
83 |
+
}
|
84 |
|
85 |
$root_path = rtrim($root_path, '/');
|
86 |
$root_path = rtrim($root_path, DIRECTORY_SEPARATOR);
|
87 |
|
|
|
|
|
88 |
$exclude_path[]=$this->transfer_path(WP_CONTENT_DIR.DIRECTORY_SEPARATOR.WPvivid_Setting::get_backupdir());
|
89 |
|
90 |
if(isset($option['include_path']))
|
96 |
$include_path=array();
|
97 |
}
|
98 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
99 |
$zip = new WPvivid_ZipClass();
|
100 |
$all_files = array();
|
101 |
foreach ($files as $file)
|
107 |
|
108 |
$ret= $zip->extract($all_files,$root_path);
|
109 |
|
110 |
+
if(isset($option['file_type']))
|
111 |
+
{
|
112 |
+
if($option['file_type']=='themes')
|
113 |
+
{
|
114 |
+
if(isset($option['remove_themes']))
|
115 |
+
{
|
116 |
+
foreach ($option['remove_themes'] as $slug=>$themes)
|
117 |
+
{
|
118 |
+
if(empty($slug))
|
119 |
+
continue;
|
120 |
+
$wpvivid_plugin->restore_data->write_log('remove '.get_theme_root().DIRECTORY_SEPARATOR.$slug,'notice');
|
121 |
+
$this->delTree(get_theme_root().DIRECTORY_SEPARATOR.$slug);
|
122 |
+
}
|
123 |
+
}
|
124 |
+
|
125 |
+
}
|
126 |
+
else if($option['file_type']=='plugin')
|
127 |
+
{
|
128 |
+
if(isset($option['remove_plugin']))
|
129 |
+
{
|
130 |
+
foreach ($option['remove_plugin'] as $slug=>$plugin)
|
131 |
+
{
|
132 |
+
if(empty($slug))
|
133 |
+
continue;
|
134 |
+
$wpvivid_plugin->restore_data->write_log('remove '.WP_PLUGIN_DIR.DIRECTORY_SEPARATOR.$slug,'notice');
|
135 |
+
$this->delTree(WP_PLUGIN_DIR.DIRECTORY_SEPARATOR.$slug);
|
136 |
+
}
|
137 |
+
}
|
138 |
+
}
|
139 |
+
}
|
140 |
+
|
141 |
+
|
142 |
unset($zip);
|
143 |
|
144 |
if(isset($option['wp_core'])&&isset($option['is_migrate']))
|
145 |
{
|
146 |
+
if($option['is_migrate'] == 1)
|
147 |
+
{
|
148 |
@rename(get_home_path() . '.htaccess', get_home_path() . '.htaccess_old');
|
149 |
if (function_exists('save_mod_rewrite_rules')) {
|
150 |
save_mod_rewrite_rules();
|
152 |
WPvivid_Setting::update_option('wpvivid_migrate_status', 'completed');
|
153 |
}
|
154 |
}
|
155 |
+
|
156 |
return $ret;
|
157 |
}
|
158 |
}
|
159 |
|
160 |
+
public function delTree($dir)
|
161 |
+
{
|
162 |
+
$files = array_diff(scandir($dir), array('.','..'));
|
163 |
+
foreach ($files as $file)
|
164 |
+
{
|
165 |
+
(is_dir("$dir/$file")) ? $this->delTree("$dir/$file") : unlink("$dir/$file");
|
166 |
+
}
|
167 |
+
return rmdir($dir);
|
168 |
+
}
|
169 |
+
|
170 |
public function pre_restore($path,$save_old_path,$include_path,$exclude_path)
|
171 |
{
|
172 |
if(!file_exists($save_old_path))
|
includes/class-wpvivid-taskmanager.php
CHANGED
@@ -645,6 +645,11 @@ class WPvivid_taskmanager
|
|
645 |
{
|
646 |
$task=$options[$file_name];
|
647 |
|
|
|
|
|
|
|
|
|
|
|
648 |
if(time()-$task['run_time']>60)
|
649 |
{
|
650 |
return false;
|
645 |
{
|
646 |
$task=$options[$file_name];
|
647 |
|
648 |
+
if($task['status'] === 'error')
|
649 |
+
{
|
650 |
+
return false;
|
651 |
+
}
|
652 |
+
|
653 |
if(time()-$task['run_time']>60)
|
654 |
{
|
655 |
return false;
|
includes/class-wpvivid-zipclass.php
CHANGED
@@ -21,7 +21,7 @@ class WPvivid_ZipClass extends Wpvivid_Compress_Default
|
|
21 |
}
|
22 |
}
|
23 |
|
24 |
-
public function get_packages($data)
|
25 |
{
|
26 |
if(!function_exists('get_home_path'))
|
27 |
require_once(ABSPATH . 'wp-admin/includes/file.php');
|
@@ -38,14 +38,28 @@ class WPvivid_ZipClass extends Wpvivid_Compress_Default
|
|
38 |
$package = array();
|
39 |
$path = $data['path'].$data['prefix'].'.part'.sprintf('%03d',($i +1)).'.zip';
|
40 |
|
41 |
-
$remove_path_size = strlen( $this -> transfer_path(get_home_path()));
|
42 |
-
|
43 |
if(isset($data['json_info']))
|
44 |
{
|
45 |
$package['json']=$data['json_info'];
|
46 |
}
|
47 |
-
|
|
|
48 |
$package['json']['root'] = substr($data['root_path'], $remove_path_size);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
49 |
$package['json']['file']=basename($path);
|
50 |
$package['path'] = $path;
|
51 |
$package['files'] = $files[$i];
|
@@ -55,14 +69,30 @@ class WPvivid_ZipClass extends Wpvivid_Compress_Default
|
|
55 |
$package = array();
|
56 |
$path = $data['path'].$data['prefix'].'.zip';
|
57 |
|
58 |
-
$remove_path_size = strlen( $this -> transfer_path(get_home_path()));
|
59 |
-
|
60 |
if(isset($data['json_info']))
|
61 |
{
|
62 |
$package['json']=$data['json_info'];
|
63 |
}
|
64 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
65 |
$package['json']['root'] = substr($data['root_path'], $remove_path_size);
|
|
|
|
|
|
|
66 |
$package['json']['file']=basename($path);
|
67 |
$package['path'] = $path;
|
68 |
$package['files'] = $files[0];
|
@@ -91,15 +121,15 @@ class WPvivid_ZipClass extends Wpvivid_Compress_Default
|
|
91 |
{
|
92 |
$package = array();
|
93 |
$path = $data['path'].$data['prefix'].'.part'.sprintf('%03d',($i +1)).'.zip';
|
94 |
-
|
95 |
-
$remove_path_size = strlen( $this -> transfer_path(get_home_path()));
|
96 |
-
|
97 |
if(isset($data['json_info']))
|
98 |
{
|
99 |
$package['json']=$data['json_info'];
|
100 |
}
|
101 |
-
|
|
|
102 |
$package['json']['root'] = substr($data['root_path'], $remove_path_size);
|
|
|
|
|
103 |
$package['json']['file']=basename($path);
|
104 |
$package['path'] = $path;
|
105 |
$package['files'] = $files[$i];
|
@@ -109,14 +139,15 @@ class WPvivid_ZipClass extends Wpvivid_Compress_Default
|
|
109 |
$package = array();
|
110 |
$path = $data['path'].$data['prefix'].'.zip';
|
111 |
|
112 |
-
$remove_path_size = strlen( $this -> transfer_path(get_home_path()));
|
113 |
-
|
114 |
if(isset($data['json_info']))
|
115 |
{
|
116 |
$package['json']=$data['json_info'];
|
117 |
}
|
118 |
-
|
|
|
119 |
$package['json']['root'] = substr($data['root_path'], $remove_path_size);
|
|
|
|
|
120 |
$package['json']['file']=basename($path);
|
121 |
$package['path'] = $path;
|
122 |
$package['files'] = $files[0];
|
@@ -150,15 +181,15 @@ class WPvivid_ZipClass extends Wpvivid_Compress_Default
|
|
150 |
{
|
151 |
$package = array();
|
152 |
$path = $data['path'].$data['prefix'].'.part'.sprintf('%03d',($i +1)).'.zip';
|
153 |
-
|
154 |
-
$remove_path_size = strlen( $this -> transfer_path(get_home_path()));
|
155 |
-
|
156 |
if(isset($data['json_info']))
|
157 |
{
|
158 |
$package['json']=$data['json_info'];
|
159 |
}
|
160 |
-
|
|
|
161 |
$package['json']['root'] = substr($data['root_path'], $remove_path_size);
|
|
|
|
|
162 |
$package['json']['file']=basename($path);
|
163 |
$package['path'] = $path;
|
164 |
$package['files'] = $files[$i];
|
@@ -167,15 +198,15 @@ class WPvivid_ZipClass extends Wpvivid_Compress_Default
|
|
167 |
}else {
|
168 |
$package = array();
|
169 |
$path = $data['path'].$data['prefix'].'.zip';
|
170 |
-
|
171 |
-
$remove_path_size = strlen( $this -> transfer_path(get_home_path()));
|
172 |
-
|
173 |
if(isset($data['json_info']))
|
174 |
{
|
175 |
$package['json']=$data['json_info'];
|
176 |
}
|
177 |
-
|
|
|
178 |
$package['json']['root'] = substr($data['root_path'], $remove_path_size);
|
|
|
|
|
179 |
$package['json']['file']=basename($path);
|
180 |
$package['path'] = $path;
|
181 |
$package['files'] = $files[0];
|
@@ -187,7 +218,7 @@ class WPvivid_ZipClass extends Wpvivid_Compress_Default
|
|
187 |
return $ret;
|
188 |
}
|
189 |
|
190 |
-
public function compress($data)
|
191 |
{
|
192 |
if(!function_exists('get_home_path'))
|
193 |
require_once(ABSPATH . 'wp-admin/includes/file.php');
|
@@ -205,15 +236,15 @@ class WPvivid_ZipClass extends Wpvivid_Compress_Default
|
|
205 |
{
|
206 |
$package = array();
|
207 |
$path = $data['path'].$data['prefix'].'.part'.sprintf('%03d',($i +1)).'.zip';
|
208 |
-
|
209 |
-
$remove_path_size = strlen( $this -> transfer_path(get_home_path()));
|
210 |
-
|
211 |
if(isset($data['json_info']))
|
212 |
{
|
213 |
$package['json']=$data['json_info'];
|
214 |
}
|
215 |
-
|
|
|
216 |
$package['json']['root'] = substr($data['root_path'], $remove_path_size);
|
|
|
|
|
217 |
$package['json']['file']=basename($path);
|
218 |
$package['path'] = $path;
|
219 |
$package['files'] = $files[$i];
|
@@ -222,15 +253,15 @@ class WPvivid_ZipClass extends Wpvivid_Compress_Default
|
|
222 |
}else {
|
223 |
$package = array();
|
224 |
$path = $data['path'].$data['prefix'].'.zip';
|
225 |
-
|
226 |
-
$remove_path_size = strlen( $this -> transfer_path(get_home_path()));
|
227 |
-
|
228 |
if(isset($data['json_info']))
|
229 |
{
|
230 |
$package['json']=$data['json_info'];
|
231 |
}
|
232 |
-
|
|
|
233 |
$package['json']['root'] = substr($data['root_path'], $remove_path_size);
|
|
|
|
|
234 |
$package['json']['file']=basename($path);
|
235 |
$package['path'] = $path;
|
236 |
$package['files'] = $files[0];
|
@@ -244,6 +275,7 @@ class WPvivid_ZipClass extends Wpvivid_Compress_Default
|
|
244 |
{
|
245 |
if(!empty($package['files']))
|
246 |
{
|
|
|
247 |
$zip_ret=$this -> _zip($package['path'],$package['files'], $data,$package['json']);
|
248 |
if($zip_ret['result']==WPVIVID_SUCCESS)
|
249 |
{
|
@@ -291,16 +323,50 @@ class WPvivid_ZipClass extends Wpvivid_Compress_Default
|
|
291 |
return $ret;
|
292 |
}
|
293 |
|
294 |
-
public function
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
295 |
define(PCLZIP_TEMPORARY_DIR,$path);
|
296 |
$flag = true;
|
297 |
$table = array();
|
298 |
$archive = new PclZip($zip);
|
299 |
$list = $archive -> listContent();
|
300 |
-
foreach ($list as $item)
|
301 |
-
|
|
|
|
|
302 |
$result = $archive->extract(PCLZIP_OPT_BY_NAME, WPVIVID_ZIPCLASS_JSONFILE_NAME);
|
303 |
-
if($result)
|
|
|
304 |
$json = json_decode(file_get_contents(dirname($zip).WPVIVID_ZIPCLASS_JSONFILE_NAME),true);
|
305 |
$path = $json['root_path'];
|
306 |
}
|
@@ -391,6 +457,10 @@ class WPvivid_ZipClass extends Wpvivid_Compress_Default
|
|
391 |
{
|
392 |
$replace_path=$options['root_path'];
|
393 |
}
|
|
|
|
|
|
|
|
|
394 |
else
|
395 |
{
|
396 |
$replace_path=WP_CONTENT_DIR.DIRECTORY_SEPARATOR.WPvivid_Setting::get_backupdir();
|
@@ -665,6 +735,24 @@ class WPvivid_ZipClass extends Wpvivid_Compress_Default
|
|
665 |
if($handler)
|
666 |
@closedir($handler);
|
667 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
668 |
}
|
669 |
|
670 |
$wpvivid_old_time=0;
|
21 |
}
|
22 |
}
|
23 |
|
24 |
+
public function get_packages($data,$write_child_files_json=false)
|
25 |
{
|
26 |
if(!function_exists('get_home_path'))
|
27 |
require_once(ABSPATH . 'wp-admin/includes/file.php');
|
38 |
$package = array();
|
39 |
$path = $data['path'].$data['prefix'].'.part'.sprintf('%03d',($i +1)).'.zip';
|
40 |
|
|
|
|
|
41 |
if(isset($data['json_info']))
|
42 |
{
|
43 |
$package['json']=$data['json_info'];
|
44 |
}
|
45 |
+
/*
|
46 |
+
$remove_path_size = strlen( $this -> transfer_path(get_home_path()));
|
47 |
$package['json']['root'] = substr($data['root_path'], $remove_path_size);
|
48 |
+
*/
|
49 |
+
if($write_child_files_json)
|
50 |
+
{
|
51 |
+
foreach ($files[$i] as $file)
|
52 |
+
{
|
53 |
+
$ret_file=$this->get_json_data($file);
|
54 |
+
if($ret_file['result']==WPVIVID_SUCCESS)
|
55 |
+
{
|
56 |
+
$json=$ret_file['json_data'];
|
57 |
+
$json = json_decode($json, 1);
|
58 |
+
$package['json']['child_file'][basename($file)]=$json;
|
59 |
+
}
|
60 |
+
}
|
61 |
+
}
|
62 |
+
$package['json']['root_flag'] = $data['root_flag'];
|
63 |
$package['json']['file']=basename($path);
|
64 |
$package['path'] = $path;
|
65 |
$package['files'] = $files[$i];
|
69 |
$package = array();
|
70 |
$path = $data['path'].$data['prefix'].'.zip';
|
71 |
|
|
|
|
|
72 |
if(isset($data['json_info']))
|
73 |
{
|
74 |
$package['json']=$data['json_info'];
|
75 |
}
|
76 |
|
77 |
+
if($write_child_files_json)
|
78 |
+
{
|
79 |
+
foreach ($files[0] as $file)
|
80 |
+
{
|
81 |
+
$ret_file=$this->get_json_data($file);
|
82 |
+
if($ret_file['result']==WPVIVID_SUCCESS)
|
83 |
+
{
|
84 |
+
$json=$ret_file['json_data'];
|
85 |
+
$json = json_decode($json, 1);
|
86 |
+
$package['json']['child_file'][basename($file)]=$json;
|
87 |
+
}
|
88 |
+
}
|
89 |
+
}
|
90 |
+
/*
|
91 |
+
$remove_path_size = strlen( $this -> transfer_path(get_home_path()));
|
92 |
$package['json']['root'] = substr($data['root_path'], $remove_path_size);
|
93 |
+
*/
|
94 |
+
|
95 |
+
$package['json']['root_flag'] = $data['root_flag'];
|
96 |
$package['json']['file']=basename($path);
|
97 |
$package['path'] = $path;
|
98 |
$package['files'] = $files[0];
|
121 |
{
|
122 |
$package = array();
|
123 |
$path = $data['path'].$data['prefix'].'.part'.sprintf('%03d',($i +1)).'.zip';
|
|
|
|
|
|
|
124 |
if(isset($data['json_info']))
|
125 |
{
|
126 |
$package['json']=$data['json_info'];
|
127 |
}
|
128 |
+
/*
|
129 |
+
$remove_path_size = strlen( $this -> transfer_path(get_home_path()));
|
130 |
$package['json']['root'] = substr($data['root_path'], $remove_path_size);
|
131 |
+
*/
|
132 |
+
$package['json']['root_flag'] = $data['root_flag'];
|
133 |
$package['json']['file']=basename($path);
|
134 |
$package['path'] = $path;
|
135 |
$package['files'] = $files[$i];
|
139 |
$package = array();
|
140 |
$path = $data['path'].$data['prefix'].'.zip';
|
141 |
|
|
|
|
|
142 |
if(isset($data['json_info']))
|
143 |
{
|
144 |
$package['json']=$data['json_info'];
|
145 |
}
|
146 |
+
/*
|
147 |
+
$remove_path_size = strlen( $this -> transfer_path(get_home_path()));
|
148 |
$package['json']['root'] = substr($data['root_path'], $remove_path_size);
|
149 |
+
*/
|
150 |
+
$package['json']['root_flag'] = $data['root_flag'];
|
151 |
$package['json']['file']=basename($path);
|
152 |
$package['path'] = $path;
|
153 |
$package['files'] = $files[0];
|
181 |
{
|
182 |
$package = array();
|
183 |
$path = $data['path'].$data['prefix'].'.part'.sprintf('%03d',($i +1)).'.zip';
|
|
|
|
|
|
|
184 |
if(isset($data['json_info']))
|
185 |
{
|
186 |
$package['json']=$data['json_info'];
|
187 |
}
|
188 |
+
/*
|
189 |
+
$remove_path_size = strlen( $this -> transfer_path(get_home_path()));
|
190 |
$package['json']['root'] = substr($data['root_path'], $remove_path_size);
|
191 |
+
*/
|
192 |
+
$package['json']['root_flag'] = $data['root_flag'];
|
193 |
$package['json']['file']=basename($path);
|
194 |
$package['path'] = $path;
|
195 |
$package['files'] = $files[$i];
|
198 |
}else {
|
199 |
$package = array();
|
200 |
$path = $data['path'].$data['prefix'].'.zip';
|
|
|
|
|
|
|
201 |
if(isset($data['json_info']))
|
202 |
{
|
203 |
$package['json']=$data['json_info'];
|
204 |
}
|
205 |
+
/*
|
206 |
+
$remove_path_size = strlen( $this -> transfer_path(get_home_path()));
|
207 |
$package['json']['root'] = substr($data['root_path'], $remove_path_size);
|
208 |
+
*/
|
209 |
+
$package['json']['root_flag'] = $data['root_flag'];
|
210 |
$package['json']['file']=basename($path);
|
211 |
$package['path'] = $path;
|
212 |
$package['files'] = $files[0];
|
218 |
return $ret;
|
219 |
}
|
220 |
|
221 |
+
public function compress($data,$write_child_files_json=false)
|
222 |
{
|
223 |
if(!function_exists('get_home_path'))
|
224 |
require_once(ABSPATH . 'wp-admin/includes/file.php');
|
236 |
{
|
237 |
$package = array();
|
238 |
$path = $data['path'].$data['prefix'].'.part'.sprintf('%03d',($i +1)).'.zip';
|
|
|
|
|
|
|
239 |
if(isset($data['json_info']))
|
240 |
{
|
241 |
$package['json']=$data['json_info'];
|
242 |
}
|
243 |
+
/*
|
244 |
+
$remove_path_size = strlen( $this -> transfer_path(get_home_path()));
|
245 |
$package['json']['root'] = substr($data['root_path'], $remove_path_size);
|
246 |
+
*/
|
247 |
+
$package['json']['root_flag'] = $data['root_flag'];
|
248 |
$package['json']['file']=basename($path);
|
249 |
$package['path'] = $path;
|
250 |
$package['files'] = $files[$i];
|
253 |
}else {
|
254 |
$package = array();
|
255 |
$path = $data['path'].$data['prefix'].'.zip';
|
|
|
|
|
|
|
256 |
if(isset($data['json_info']))
|
257 |
{
|
258 |
$package['json']=$data['json_info'];
|
259 |
}
|
260 |
+
/*
|
261 |
+
$remove_path_size = strlen( $this -> transfer_path(get_home_path()));
|
262 |
$package['json']['root'] = substr($data['root_path'], $remove_path_size);
|
263 |
+
*/
|
264 |
+
$package['json']['root_flag'] = $data['root_flag'];
|
265 |
$package['json']['file']=basename($path);
|
266 |
$package['path'] = $path;
|
267 |
$package['files'] = $files[0];
|
275 |
{
|
276 |
if(!empty($package['files']))
|
277 |
{
|
278 |
+
$wpvivid_plugin->set_time_limit($wpvivid_plugin->current_task['id']);
|
279 |
$zip_ret=$this -> _zip($package['path'],$package['files'], $data,$package['json']);
|
280 |
if($zip_ret['result']==WPVIVID_SUCCESS)
|
281 |
{
|
323 |
return $ret;
|
324 |
}
|
325 |
|
326 |
+
public function extract_ex($files,$path = '',$extract_files=array())
|
327 |
+
{
|
328 |
+
global $wpvivid_plugin;
|
329 |
+
//$wpvivid_plugin->restore_data->write_log('start prepare extract','notice');
|
330 |
+
define(PCLZIP_TEMPORARY_DIR,dirname($path));
|
331 |
+
|
332 |
+
$ret['result']=WPVIVID_SUCCESS;
|
333 |
+
foreach ($files as $file)
|
334 |
+
{
|
335 |
+
$wpvivid_plugin->restore_data->write_log('start extract file:'.$file,'notice');
|
336 |
+
$wpvivid_plugin->restore_data->write_log('extract child file:'.json_encode($extract_files),'notice');
|
337 |
+
$archive = new PclZip($file);
|
338 |
+
$zip_ret = $archive->extract(PCLZIP_OPT_BY_NAME,$extract_files,PCLZIP_OPT_PATH, $path,PCLZIP_OPT_REPLACE_NEWER,PCLZIP_CB_PRE_EXTRACT,'wpvivid_function_pre_extract_callback',PCLZIP_OPT_TEMP_FILE_THRESHOLD,16);
|
339 |
+
if(!$zip_ret)
|
340 |
+
{
|
341 |
+
$ret['result']=WPVIVID_FAILED;
|
342 |
+
$ret['error'] = $archive->errorInfo(true);
|
343 |
+
$wpvivid_plugin->restore_data->write_log('extract finished:'.json_encode($ret),'notice');
|
344 |
+
break;
|
345 |
+
}
|
346 |
+
else
|
347 |
+
{
|
348 |
+
$wpvivid_plugin->restore_data->write_log('extract finished file:'.$file,'notice');
|
349 |
+
}
|
350 |
+
}
|
351 |
+
//$this->restore_data->write_log('extract finished files:'.json_encode($all_files),'notice');
|
352 |
+
|
353 |
+
return $ret;
|
354 |
+
}
|
355 |
+
|
356 |
+
public function extract_by_files($files,$zip,$path = '')
|
357 |
+
{
|
358 |
define(PCLZIP_TEMPORARY_DIR,$path);
|
359 |
$flag = true;
|
360 |
$table = array();
|
361 |
$archive = new PclZip($zip);
|
362 |
$list = $archive -> listContent();
|
363 |
+
foreach ($list as $item)
|
364 |
+
{
|
365 |
+
if(strstr($item['filename'],WPVIVID_ZIPCLASS_JSONFILE_NAME))
|
366 |
+
{
|
367 |
$result = $archive->extract(PCLZIP_OPT_BY_NAME, WPVIVID_ZIPCLASS_JSONFILE_NAME);
|
368 |
+
if($result)
|
369 |
+
{
|
370 |
$json = json_decode(file_get_contents(dirname($zip).WPVIVID_ZIPCLASS_JSONFILE_NAME),true);
|
371 |
$path = $json['root_path'];
|
372 |
}
|
457 |
{
|
458 |
$replace_path=$options['root_path'];
|
459 |
}
|
460 |
+
else if(isset($options['root_flag']))
|
461 |
+
{
|
462 |
+
$replace_path=$this->get_root_flag_path($options['root_flag']);
|
463 |
+
}
|
464 |
else
|
465 |
{
|
466 |
$replace_path=WP_CONTENT_DIR.DIRECTORY_SEPARATOR.WPvivid_Setting::get_backupdir();
|
735 |
if($handler)
|
736 |
@closedir($handler);
|
737 |
}
|
738 |
+
|
739 |
+
public function get_root_flag_path($flag)
|
740 |
+
{
|
741 |
+
$path='';
|
742 |
+
if($flag==WPVIVID_BACKUP_ROOT_WP_CONTENT)
|
743 |
+
{
|
744 |
+
$path=WP_CONTENT_DIR;
|
745 |
+
}
|
746 |
+
else if($flag==WPVIVID_BACKUP_ROOT_CUSTOM)
|
747 |
+
{
|
748 |
+
$path=WP_CONTENT_DIR.DIRECTORY_SEPARATOR.WPvivid_Setting::get_backupdir();
|
749 |
+
}
|
750 |
+
else if($flag==WPVIVID_BACKUP_ROOT_WP_ROOT)
|
751 |
+
{
|
752 |
+
$path=ABSPATH;
|
753 |
+
}
|
754 |
+
return $path;
|
755 |
+
}
|
756 |
}
|
757 |
|
758 |
$wpvivid_old_time=0;
|
includes/class-wpvivid.php
CHANGED
@@ -55,6 +55,8 @@ class WPvivid {
|
|
55 |
public $migrate;
|
56 |
public $backup_uploader;
|
57 |
|
|
|
|
|
58 |
public function __construct()
|
59 |
{
|
60 |
$this->version = WPVIVID_PLUGIN_VERSION;
|
@@ -118,8 +120,8 @@ class WPvivid {
|
|
118 |
|
119 |
add_action('wpvivid_handle_backup_failed',array($this,'wpvivid_mark_task'),20);
|
120 |
add_action('init', array($this, 'init_pclzip_tmp_folder'));
|
121 |
-
|
122 |
-
add_filter('wpvivid_list_task', array($this, '_list_tasks'), 10);
|
123 |
|
124 |
//Initialisation schedule hook
|
125 |
$this->init_cron();
|
@@ -172,10 +174,10 @@ class WPvivid {
|
|
172 |
|
173 |
include_once WPVIVID_PLUGIN_DIR . '/includes/class-wpvivid-public-interface.php';
|
174 |
|
175 |
-
$this->remote_collection=new WPvivid_Remote_collection();
|
176 |
$this->function_realize=new WPvivid_Function_Realize();
|
177 |
$this->migrate=new WPvivid_Migrate();
|
178 |
$this->backup_uploader=new Wpvivid_BackupUploader();
|
|
|
179 |
}
|
180 |
|
181 |
public function init_pclzip_tmp_folder()
|
@@ -186,6 +188,10 @@ class WPvivid {
|
|
186 |
}
|
187 |
}
|
188 |
|
|
|
|
|
|
|
|
|
189 |
private function set_locale()
|
190 |
{
|
191 |
$plugin_i18n = new WPvivid_i18n();
|
@@ -194,32 +200,32 @@ class WPvivid {
|
|
194 |
|
195 |
private function define_admin_hook()
|
196 |
{
|
197 |
-
$
|
198 |
|
199 |
-
add_action('admin_enqueue_scripts',array( $
|
200 |
-
add_action('admin_enqueue_scripts',array( $
|
201 |
// Add menu item
|
202 |
|
203 |
if(is_multisite())
|
204 |
{
|
205 |
-
add_action('network_admin_menu',array( $
|
206 |
}
|
207 |
else
|
208 |
{
|
209 |
-
add_action('admin_menu',array( $
|
210 |
}
|
211 |
|
212 |
-
add_action('admin_bar_menu',array( $
|
213 |
//show admin bar
|
214 |
-
add_action('admin_head',array( $
|
215 |
|
216 |
// Add Settings link to the plugin
|
217 |
$plugin_basename = plugin_basename( plugin_dir_path( __DIR__ ) . 'wpvivid-backuprestore.php' );
|
218 |
-
add_filter('plugin_action_links_' . $plugin_basename, array( $
|
219 |
|
220 |
add_filter('wpvivid_pre_add_remote',array($this, 'pre_add_remote'),10,2);
|
221 |
|
222 |
-
add_filter('wpvivid_add_tab_page', array($
|
223 |
//
|
224 |
}
|
225 |
|
@@ -435,13 +441,30 @@ class WPvivid {
|
|
435 |
echo json_encode($ret);
|
436 |
die();
|
437 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
438 |
}
|
439 |
|
440 |
public function deal_prepare_shutdown_error()
|
441 |
{
|
442 |
if($this->end_shutdown_function==false) {
|
443 |
$last_error = error_get_last();
|
444 |
-
if (!empty($last_error) && !in_array($last_error['type'], array(E_NOTICE), true)) {
|
445 |
$error = $last_error;
|
446 |
} else {
|
447 |
$error = false;
|
@@ -568,7 +591,6 @@ class WPvivid {
|
|
568 |
echo json_encode($ret);
|
569 |
die();
|
570 |
}
|
571 |
-
|
572 |
$this->backup($task_id);
|
573 |
}
|
574 |
catch (Exception $error) {
|
@@ -577,6 +599,12 @@ class WPvivid {
|
|
577 |
echo json_encode(array('result'=>'failed','error'=>$message));
|
578 |
die();
|
579 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
580 |
die();
|
581 |
}
|
582 |
/**
|
@@ -1393,6 +1421,33 @@ class WPvivid {
|
|
1393 |
$this->wpvivid_log->WriteLog($message, 'error');
|
1394 |
}
|
1395 |
else
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1396 |
{
|
1397 |
if ($status['str'] != 'error')
|
1398 |
{
|
@@ -1400,20 +1455,14 @@ class WPvivid {
|
|
1400 |
{
|
1401 |
$message = 'type: '. $error['type'] . ', ' . $error['message'] . ' file:' . $error['file'] . ' line:' . $error['line'];
|
1402 |
} else {
|
1403 |
-
|
1404 |
-
{
|
1405 |
-
$message = __('Backup timed out since there may be no enough resource to complete the backup. Please contact your web hosting provider and ask for more server resource. Then try to backup again.', 'wpvivid');
|
1406 |
-
}
|
1407 |
-
else
|
1408 |
-
{
|
1409 |
-
$message = __('Backup timed out. Please set the value of PHP script execution timeout to '.$time_start.' in plugin settings.', 'wpvivid');
|
1410 |
-
}
|
1411 |
}
|
1412 |
WPvivid_taskmanager::update_backup_task_status($task_id, false, 'error', false, $status['resume_count'], $message);
|
1413 |
}
|
1414 |
$task = WPvivid_taskmanager::get_task($task_id);
|
1415 |
do_action('wpvivid_handle_backup_failed', $task, false);
|
1416 |
}
|
|
|
1417 |
}
|
1418 |
}
|
1419 |
die();
|
@@ -1737,7 +1786,7 @@ class WPvivid {
|
|
1737 |
*
|
1738 |
* @since 0.9.1
|
1739 |
*/
|
1740 |
-
|
1741 |
{
|
1742 |
$task=WPvivid_taskmanager::get_task($task_id);
|
1743 |
$tasks=WPvivid_Setting::get_option('clean_task');
|
@@ -1822,7 +1871,7 @@ class WPvivid {
|
|
1822 |
*
|
1823 |
* @since 0.9.1
|
1824 |
*/
|
1825 |
-
|
1826 |
{
|
1827 |
$resume_time=time()+$next_time;
|
1828 |
|
@@ -2005,7 +2054,7 @@ class WPvivid {
|
|
2005 |
{
|
2006 |
if($this->end_shutdown_function==false) {
|
2007 |
$last_error = error_get_last();
|
2008 |
-
if (!empty($last_error) && !in_array($last_error['type'], array(E_NOTICE), true)) {
|
2009 |
$error = $last_error;
|
2010 |
} else {
|
2011 |
$error = false;
|
@@ -2740,8 +2789,10 @@ class WPvivid {
|
|
2740 |
public function init_restore_page()
|
2741 |
{
|
2742 |
$this->ajax_check_security();
|
2743 |
-
try
|
2744 |
-
|
|
|
|
|
2745 |
die();
|
2746 |
}
|
2747 |
|
@@ -2761,10 +2812,11 @@ class WPvivid {
|
|
2761 |
if ($backup_item->get_backup_type() == 'Upload' || $backup_item->get_backup_type() == 'Migration')
|
2762 |
{
|
2763 |
$is_display = $backup_item->is_display_migrate_option();
|
2764 |
-
if($is_display === true)
|
|
|
2765 |
$ret['is_migrate_ui'] = 1;
|
2766 |
}
|
2767 |
-
else{
|
2768 |
$ret['is_migrate_ui'] = 0;
|
2769 |
}
|
2770 |
} else {
|
@@ -2783,26 +2835,34 @@ class WPvivid {
|
|
2783 |
|
2784 |
$memory_limit = ini_get('memory_limit');
|
2785 |
$unit = substr($memory_limit, -1);
|
2786 |
-
if ($unit == 'K')
|
|
|
2787 |
$memory_limit_tmp = intval($memory_limit) * 1024;
|
2788 |
-
}
|
|
|
|
|
2789 |
$memory_limit_tmp = intval($memory_limit) * 1024 * 1024;
|
2790 |
-
}
|
|
|
|
|
2791 |
$memory_limit_tmp = intval($memory_limit) * 1024 * 1024 * 1024;
|
2792 |
}
|
2793 |
-
if ($memory_limit_tmp < 256 * 1024 * 1024)
|
|
|
2794 |
$ret['memory_limit_warning'] = 'memory_limit = ' . $memory_limit . ' is too small. The recommended value is 256M or higher. Too small value could result in a failure of website restore.';
|
2795 |
} else {
|
2796 |
$ret['memory_limit_warning'] = false;
|
2797 |
}
|
2798 |
|
2799 |
-
if ($ret['result'] == WPVIVID_FAILED)
|
|
|
2800 |
$this->wpvivid_handle_restore_error($ret['error'], 'Init restore page');
|
2801 |
}
|
2802 |
|
2803 |
echo json_encode($ret);
|
2804 |
}
|
2805 |
-
catch (Exception $error)
|
|
|
2806 |
$message = 'An exception has occurred. class: '.get_class($error).';msg: '.$error->getMessage().';code: '.$error->getCode().';line: '.$error->getLine().';in_file: '.$error->getFile().';';
|
2807 |
error_log($message);
|
2808 |
echo json_encode(array('result'=>'failed','error'=>$message));
|
@@ -3142,6 +3202,7 @@ class WPvivid {
|
|
3142 |
if($ret['result']==WPVIVID_FAILED&&$ret['error']=='A restore task is already running.')
|
3143 |
{
|
3144 |
echo json_encode($ret);
|
|
|
3145 |
die();
|
3146 |
}
|
3147 |
$this->_disable_maintenance_mode();
|
@@ -3187,7 +3248,7 @@ class WPvivid {
|
|
3187 |
if($this->end_shutdown_function===false)
|
3188 |
{
|
3189 |
$last_error = error_get_last();
|
3190 |
-
if (!empty($last_error) && !in_array($last_error['type'], array(E_NOTICE), true))
|
3191 |
{
|
3192 |
$error = $last_error;
|
3193 |
} else {
|
@@ -3197,7 +3258,7 @@ class WPvivid {
|
|
3197 |
|
3198 |
if ($error !== false)
|
3199 |
{
|
3200 |
-
$message = $error['message'] . ' file:' . $error['file'] . ' line:' . $error['line'];
|
3201 |
$this->restore_data->delete_temp_files();
|
3202 |
$this->restore_data->update_error($message);
|
3203 |
$this->restore_data->write_log($message,'error');
|
@@ -3509,7 +3570,8 @@ class WPvivid {
|
|
3509 |
$backup_id=false;
|
3510 |
}
|
3511 |
|
3512 |
-
$ret =
|
|
|
3513 |
|
3514 |
$backup_success_count=WPvivid_Setting::get_option('wpvivid_backup_success_count');
|
3515 |
if(!empty($backup_success_count)){
|
@@ -3534,7 +3596,7 @@ class WPvivid {
|
|
3534 |
die();
|
3535 |
}
|
3536 |
|
3537 |
-
public function _list_tasks($backup_id){
|
3538 |
$tasks=WPvivid_Setting::get_tasks();
|
3539 |
$ret=array();
|
3540 |
$list_tasks=array();
|
@@ -4959,117 +5021,111 @@ class WPvivid {
|
|
4959 |
$remote=apply_filters('wpvivid_remote_pic', $remote);
|
4960 |
|
4961 |
foreach ($backuplist as $key=>$value) {
|
4962 |
-
$
|
4963 |
-
if($value['type'] == 'Migration' || $value['type'] == 'Upload'){
|
4964 |
-
if($value['type'] == 'Migration'){
|
4965 |
-
$upload_title = 'Received Backup: ';
|
4966 |
-
}
|
4967 |
-
else if($value['type'] == 'Upload') {
|
4968 |
-
$upload_title = 'Uploaded Backup: ';
|
4969 |
-
}
|
4970 |
-
$row_style = 'border: 2px solid #006799; box-sizing:border-box; -moz-box-sizing:border-box; -webkit-box-sizing:border-box;';
|
4971 |
-
}
|
4972 |
-
else if($value['type'] == 'Manual' || $value['type'] == 'Cron'){
|
4973 |
$row_style = '';
|
4974 |
-
$
|
4975 |
-
|
4976 |
-
|
4977 |
-
|
4978 |
-
|
4979 |
-
|
4980 |
-
|
4981 |
-
|
4982 |
-
|
4983 |
-
|
4984 |
-
|
4985 |
-
|
4986 |
-
if($value['lock'] == 0){
|
4987 |
-
$backup_lock='/admin/partials/images/unlocked.png';
|
4988 |
-
$lock_status='unlock';
|
4989 |
}
|
4990 |
-
|
4991 |
-
|
4992 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4993 |
}
|
4994 |
-
}
|
4995 |
|
4996 |
-
|
4997 |
-
|
4998 |
-
|
4999 |
-
|
5000 |
-
|
5001 |
-
|
5002 |
-
|
5003 |
-
|
5004 |
-
|
5005 |
-
|
5006 |
-
|
5007 |
-
|
5008 |
-
|
5009 |
-
|
5010 |
-
|
5011 |
-
|
5012 |
-
|
5013 |
-
|
|
|
|
|
|
|
5014 |
$pic = $value1['default_pic'];
|
5015 |
}
|
|
|
|
|
5016 |
}
|
5017 |
-
if(!$b_has_remote){
|
5018 |
-
$pic = $value1['default_pic'];
|
5019 |
-
}
|
5020 |
-
$title = $value1['title'];
|
5021 |
-
$remote_pic_html .= '<img src="' . esc_url(WPVIVID_PLUGIN_URL . $pic) . '" style="vertical-align:middle; " title="' . $title . '"/>';
|
5022 |
}
|
5023 |
-
|
5024 |
-
|
5025 |
-
|
5026 |
-
|
5027 |
-
|
5028 |
-
|
5029 |
-
|
5030 |
-
|
5031 |
-
$tour_class = '';
|
5032 |
-
}
|
5033 |
|
5034 |
-
|
5035 |
-
|
5036 |
-
<th class="check-column"><input name="check_backup" type="checkbox" id="'.esc_attr($key, 'wpvivid').'" value="'.esc_attr($key, 'wpvivid').'" onclick="wpvivid_click_check_backup(\''
|
5037 |
<td class="tablelistcolumn">
|
5038 |
<div style="float:left;padding:0 10px 10px 0;">
|
5039 |
-
<div class="backuptime"><strong>'
|
5040 |
<div class="common-table">
|
5041 |
-
<span title="To lock the backup, the backup can only be deleted manually" id="wpvivid_lock_'
|
5042 |
-
<img src="'.esc_url(WPVIVID_PLUGIN_URL
|
5043 |
</span>
|
5044 |
-
<span style="margin:0;">|</span> <span>'.__('Type:', 'wpvivid').'</span><span>'.__($value['type'], 'wpvivid').'</span>
|
5045 |
-
<span style="margin:0;">|</span> <span title="Backup log"><a href="#" onclick="wpvivid_read_log(\''.__('wpvivid_view_backup_log').'\', \''.__($key).'\');"><img src="'.esc_url(WPVIVID_PLUGIN_URL.'/admin/partials/images/Log.png').'" style="vertical-align:middle;cursor:pointer;"/><span style="margin:0;">'.__('Log', 'wpvivid').'</span></a></span>
|
5046 |
</div>
|
5047 |
</div>
|
5048 |
</td>
|
5049 |
<td class="tablelistcolumn">
|
5050 |
-
<div style="float:left;padding:10px 10px 10px 0;">'
|
5051 |
</td>
|
5052 |
<td class="tablelistcolumn" style="min-width:100px;">
|
5053 |
-
<div id="wpvivid_file_part_'.__($key, 'wpvivid').'" style="float:left;padding:10px 10px 10px 0;">
|
5054 |
-
<div style="cursor:pointer;" onclick="wpvivid_initialize_download(\''
|
5055 |
-
<img id="wpvivid_download_btn_'.__($key, 'wpvivid').'" src="'.esc_url(WPVIVID_PLUGIN_URL.'/admin/partials/images/download.png').'" style="vertical-align:middle;" /><span>'.__('Download', 'wpvivid').'</span>
|
5056 |
-
<div class="spinner" id="wpvivid_download_loading_'.__($key, 'wpvivid').'" style="float:right;width:auto;height:auto;padding:10px 180px 10px 0;background-position:0 0;"></div>
|
5057 |
</div>
|
5058 |
</div>
|
5059 |
</td>
|
5060 |
<td class="tablelistcolumn" style="min-width:100px;">
|
5061 |
-
<div class="'
|
5062 |
-
'
|
5063 |
-
<img src="'.esc_url(WPVIVID_PLUGIN_URL. '/admin/partials/images/Restore.png').'" style="vertical-align:middle;" /><span>'.__('Restore', 'wpvivid').'</span>
|
5064 |
</div>
|
5065 |
</div>
|
5066 |
</td>
|
5067 |
<td class="tablelistcolumn">
|
5068 |
<div class="backuplist-delete-backup" style="padding:10px 0 10px 0;">
|
5069 |
-
<img src="'.esc_url(WPVIVID_PLUGIN_URL.'/admin/partials/images/Delete.png').'" style="vertical-align:middle; cursor:pointer;" title="Delete the backup" onclick="wpvivid_delete_selected_backup(\''
|
5070 |
</div>
|
5071 |
</td>
|
5072 |
</tr>';
|
|
|
5073 |
}
|
5074 |
return $html;
|
5075 |
}
|
55 |
public $migrate;
|
56 |
public $backup_uploader;
|
57 |
|
58 |
+
public $admin;
|
59 |
+
|
60 |
public function __construct()
|
61 |
{
|
62 |
$this->version = WPVIVID_PLUGIN_VERSION;
|
120 |
|
121 |
add_action('wpvivid_handle_backup_failed',array($this,'wpvivid_mark_task'),20);
|
122 |
add_action('init', array($this, 'init_pclzip_tmp_folder'));
|
123 |
+
add_action('plugins_loaded', array($this, 'load_remote_storage'),10);
|
124 |
+
add_filter('wpvivid_list_task', array($this, '_list_tasks'), 10, 2);
|
125 |
|
126 |
//Initialisation schedule hook
|
127 |
$this->init_cron();
|
174 |
|
175 |
include_once WPVIVID_PLUGIN_DIR . '/includes/class-wpvivid-public-interface.php';
|
176 |
|
|
|
177 |
$this->function_realize=new WPvivid_Function_Realize();
|
178 |
$this->migrate=new WPvivid_Migrate();
|
179 |
$this->backup_uploader=new Wpvivid_BackupUploader();
|
180 |
+
$send_to_site=new WPvivid_Send_to_site();
|
181 |
}
|
182 |
|
183 |
public function init_pclzip_tmp_folder()
|
188 |
}
|
189 |
}
|
190 |
|
191 |
+
public function load_remote_storage(){
|
192 |
+
$this->remote_collection=new WPvivid_Remote_collection();
|
193 |
+
}
|
194 |
+
|
195 |
private function set_locale()
|
196 |
{
|
197 |
$plugin_i18n = new WPvivid_i18n();
|
200 |
|
201 |
private function define_admin_hook()
|
202 |
{
|
203 |
+
$this->admin = new WPvivid_Admin($this->get_plugin_name(), $this->get_version());
|
204 |
|
205 |
+
add_action('admin_enqueue_scripts',array( $this->admin,'enqueue_styles'));
|
206 |
+
add_action('admin_enqueue_scripts',array( $this->admin,'enqueue_scripts'));
|
207 |
// Add menu item
|
208 |
|
209 |
if(is_multisite())
|
210 |
{
|
211 |
+
add_action('network_admin_menu',array( $this->admin,'add_plugin_admin_menu'));
|
212 |
}
|
213 |
else
|
214 |
{
|
215 |
+
add_action('admin_menu',array( $this->admin,'add_plugin_admin_menu'));
|
216 |
}
|
217 |
|
218 |
+
add_action('admin_bar_menu',array( $this->admin,'add_toolbar_items'),100);
|
219 |
//show admin bar
|
220 |
+
add_action('admin_head',array( $this->admin,'wpvivid_get_siteurl'),100);
|
221 |
|
222 |
// Add Settings link to the plugin
|
223 |
$plugin_basename = plugin_basename( plugin_dir_path( __DIR__ ) . 'wpvivid-backuprestore.php' );
|
224 |
+
add_filter('plugin_action_links_' . $plugin_basename, array( $this->admin,'add_action_links'));
|
225 |
|
226 |
add_filter('wpvivid_pre_add_remote',array($this, 'pre_add_remote'),10,2);
|
227 |
|
228 |
+
add_filter('wpvivid_add_tab_page', array($this->admin, 'wpvivid_add_default_tab_page'));
|
229 |
//
|
230 |
}
|
231 |
|
441 |
echo json_encode($ret);
|
442 |
die();
|
443 |
}
|
444 |
+
catch (Error $error)
|
445 |
+
{
|
446 |
+
$this->end_shutdown_function=true;
|
447 |
+
$ret['result']='failed';
|
448 |
+
$message = 'An exception has occurred. class:'.get_class($error).';msg:'.$error->getMessage().';code:'.$error->getCode().';line:'.$error->getLine().';in_file:'.$error->getFile().';';
|
449 |
+
$ret['error'] = $message;
|
450 |
+
$id=uniqid('wpvivid-');
|
451 |
+
$log_file_name=$id.'_backup';
|
452 |
+
$log=new WPvivid_Log();
|
453 |
+
$log->CreateLogFile($log_file_name,'no_folder','backup');
|
454 |
+
$log->WriteLog($message,'notice');
|
455 |
+
WPvivid_error_log::create_error_log($log->log_file);
|
456 |
+
$log->CloseFile();
|
457 |
+
error_log($message);
|
458 |
+
echo json_encode($ret);
|
459 |
+
die();
|
460 |
+
}
|
461 |
}
|
462 |
|
463 |
public function deal_prepare_shutdown_error()
|
464 |
{
|
465 |
if($this->end_shutdown_function==false) {
|
466 |
$last_error = error_get_last();
|
467 |
+
if (!empty($last_error) && !in_array($last_error['type'], array(E_NOTICE,E_WARNING,E_USER_NOTICE,E_USER_WARNING,E_DEPRECATED), true)) {
|
468 |
$error = $last_error;
|
469 |
} else {
|
470 |
$error = false;
|
591 |
echo json_encode($ret);
|
592 |
die();
|
593 |
}
|
|
|
594 |
$this->backup($task_id);
|
595 |
}
|
596 |
catch (Exception $error) {
|
599 |
echo json_encode(array('result'=>'failed','error'=>$message));
|
600 |
die();
|
601 |
}
|
602 |
+
catch (Error $error) {
|
603 |
+
$message = 'An exception has occurred. class: '.get_class($error).';msg: '.$error->getMessage().';code: '.$error->getCode().';line: '.$error->getLine().';in_file: '.$error->getFile().';';
|
604 |
+
error_log($message);
|
605 |
+
echo json_encode(array('result'=>'failed','error'=>$message));
|
606 |
+
die();
|
607 |
+
}
|
608 |
die();
|
609 |
}
|
610 |
/**
|
1421 |
$this->wpvivid_log->WriteLog($message, 'error');
|
1422 |
}
|
1423 |
else
|
1424 |
+
{
|
1425 |
+
$status['resume_count']++;
|
1426 |
+
if ($status['resume_count'] > $max_resume_count)
|
1427 |
+
{
|
1428 |
+
$message = __('Too many resumption attempts.', 'wpvivid');
|
1429 |
+
if ($error !== false)
|
1430 |
+
{
|
1431 |
+
$message.= 'type: '. $error['type'] . ', ' . $error['message'] . ' file:' . $error['file'] . ' line:' . $error['line'];
|
1432 |
+
}
|
1433 |
+
$task = WPvivid_taskmanager::update_backup_task_status($task_id, false, 'error', false, $status['resume_count'], $message);
|
1434 |
+
do_action('wpvivid_handle_backup_failed', $task ,true);
|
1435 |
+
} else {
|
1436 |
+
$this->check_cancel_backup($task_id);
|
1437 |
+
$message = 'Task timed out (WebHosting).';
|
1438 |
+
if ($this->add_resume_event($task_id))
|
1439 |
+
{
|
1440 |
+
WPvivid_taskmanager::update_backup_task_status($task_id, false, 'wait_resume', false, $status['resume_count']);
|
1441 |
+
} else {
|
1442 |
+
$task = WPvivid_taskmanager::update_backup_task_status($task_id, false, 'error', false, $status['resume_count'], $message);
|
1443 |
+
do_action('wpvivid_handle_backup_failed', $task, true);
|
1444 |
+
}
|
1445 |
+
}
|
1446 |
+
if ($this->wpvivid_log)
|
1447 |
+
$this->wpvivid_log->WriteLog($message, 'error');
|
1448 |
+
}
|
1449 |
+
/*
|
1450 |
+
else
|
1451 |
{
|
1452 |
if ($status['str'] != 'error')
|
1453 |
{
|
1455 |
{
|
1456 |
$message = 'type: '. $error['type'] . ', ' . $error['message'] . ' file:' . $error['file'] . ' line:' . $error['line'];
|
1457 |
} else {
|
1458 |
+
$message = __('Backup timed out. Please set the value of PHP script execution timeout to '.$time_start.' in plugin settings.', 'wpvivid');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1459 |
}
|
1460 |
WPvivid_taskmanager::update_backup_task_status($task_id, false, 'error', false, $status['resume_count'], $message);
|
1461 |
}
|
1462 |
$task = WPvivid_taskmanager::get_task($task_id);
|
1463 |
do_action('wpvivid_handle_backup_failed', $task, false);
|
1464 |
}
|
1465 |
+
*/
|
1466 |
}
|
1467 |
}
|
1468 |
die();
|
1786 |
*
|
1787 |
* @since 0.9.1
|
1788 |
*/
|
1789 |
+
public function add_clean_backing_up_data_event($task_id)
|
1790 |
{
|
1791 |
$task=WPvivid_taskmanager::get_task($task_id);
|
1792 |
$tasks=WPvivid_Setting::get_option('clean_task');
|
1871 |
*
|
1872 |
* @since 0.9.1
|
1873 |
*/
|
1874 |
+
public function add_monitor_event($task_id,$next_time=120)
|
1875 |
{
|
1876 |
$resume_time=time()+$next_time;
|
1877 |
|
2054 |
{
|
2055 |
if($this->end_shutdown_function==false) {
|
2056 |
$last_error = error_get_last();
|
2057 |
+
if (!empty($last_error) && !in_array($last_error['type'], array(E_NOTICE,E_WARNING,E_USER_NOTICE,E_USER_WARNING,E_DEPRECATED), true)) {
|
2058 |
$error = $last_error;
|
2059 |
} else {
|
2060 |
$error = false;
|
2789 |
public function init_restore_page()
|
2790 |
{
|
2791 |
$this->ajax_check_security();
|
2792 |
+
try
|
2793 |
+
{
|
2794 |
+
if (!isset($_POST['backup_id']) || empty($_POST['backup_id']) || !is_string($_POST['backup_id']))
|
2795 |
+
{
|
2796 |
die();
|
2797 |
}
|
2798 |
|
2812 |
if ($backup_item->get_backup_type() == 'Upload' || $backup_item->get_backup_type() == 'Migration')
|
2813 |
{
|
2814 |
$is_display = $backup_item->is_display_migrate_option();
|
2815 |
+
if($is_display === true)
|
2816 |
+
{
|
2817 |
$ret['is_migrate_ui'] = 1;
|
2818 |
}
|
2819 |
+
else {
|
2820 |
$ret['is_migrate_ui'] = 0;
|
2821 |
}
|
2822 |
} else {
|
2835 |
|
2836 |
$memory_limit = ini_get('memory_limit');
|
2837 |
$unit = substr($memory_limit, -1);
|
2838 |
+
if ($unit == 'K')
|
2839 |
+
{
|
2840 |
$memory_limit_tmp = intval($memory_limit) * 1024;
|
2841 |
+
}
|
2842 |
+
else if ($unit == 'M')
|
2843 |
+
{
|
2844 |
$memory_limit_tmp = intval($memory_limit) * 1024 * 1024;
|
2845 |
+
}
|
2846 |
+
else if ($unit == 'G')
|
2847 |
+
{
|
2848 |
$memory_limit_tmp = intval($memory_limit) * 1024 * 1024 * 1024;
|
2849 |
}
|
2850 |
+
if ($memory_limit_tmp < 256 * 1024 * 1024)
|
2851 |
+
{
|
2852 |
$ret['memory_limit_warning'] = 'memory_limit = ' . $memory_limit . ' is too small. The recommended value is 256M or higher. Too small value could result in a failure of website restore.';
|
2853 |
} else {
|
2854 |
$ret['memory_limit_warning'] = false;
|
2855 |
}
|
2856 |
|
2857 |
+
if ($ret['result'] == WPVIVID_FAILED)
|
2858 |
+
{
|
2859 |
$this->wpvivid_handle_restore_error($ret['error'], 'Init restore page');
|
2860 |
}
|
2861 |
|
2862 |
echo json_encode($ret);
|
2863 |
}
|
2864 |
+
catch (Exception $error)
|
2865 |
+
{
|
2866 |
$message = 'An exception has occurred. class: '.get_class($error).';msg: '.$error->getMessage().';code: '.$error->getCode().';line: '.$error->getLine().';in_file: '.$error->getFile().';';
|
2867 |
error_log($message);
|
2868 |
echo json_encode(array('result'=>'failed','error'=>$message));
|
3202 |
if($ret['result']==WPVIVID_FAILED&&$ret['error']=='A restore task is already running.')
|
3203 |
{
|
3204 |
echo json_encode($ret);
|
3205 |
+
$this->end_shutdown_function=true;
|
3206 |
die();
|
3207 |
}
|
3208 |
$this->_disable_maintenance_mode();
|
3248 |
if($this->end_shutdown_function===false)
|
3249 |
{
|
3250 |
$last_error = error_get_last();
|
3251 |
+
if (!empty($last_error) && !in_array($last_error['type'], array(E_NOTICE,E_WARNING,E_USER_NOTICE,E_USER_WARNING,E_DEPRECATED), true))
|
3252 |
{
|
3253 |
$error = $last_error;
|
3254 |
} else {
|
3258 |
|
3259 |
if ($error !== false)
|
3260 |
{
|
3261 |
+
$message = 'type: '. $error['type'] . ', ' . $error['message'] . ' file:' . $error['file'] . ' line:' . $error['line'];
|
3262 |
$this->restore_data->delete_temp_files();
|
3263 |
$this->restore_data->update_error($message);
|
3264 |
$this->restore_data->write_log($message,'error');
|
3570 |
$backup_id=false;
|
3571 |
}
|
3572 |
|
3573 |
+
$ret = array();
|
3574 |
+
$ret = apply_filters('wpvivid_list_task', $ret, $backup_id);
|
3575 |
|
3576 |
$backup_success_count=WPvivid_Setting::get_option('wpvivid_backup_success_count');
|
3577 |
if(!empty($backup_success_count)){
|
3596 |
die();
|
3597 |
}
|
3598 |
|
3599 |
+
public function _list_tasks($ret, $backup_id){
|
3600 |
$tasks=WPvivid_Setting::get_tasks();
|
3601 |
$ret=array();
|
3602 |
$list_tasks=array();
|
5021 |
$remote=apply_filters('wpvivid_remote_pic', $remote);
|
5022 |
|
5023 |
foreach ($backuplist as $key=>$value) {
|
5024 |
+
if($value['type'] !== 'Rollback') {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5025 |
$row_style = '';
|
5026 |
+
if ($value['type'] == 'Migration' || $value['type'] == 'Upload') {
|
5027 |
+
if ($value['type'] == 'Migration') {
|
5028 |
+
$upload_title = 'Received Backup: ';
|
5029 |
+
} else if ($value['type'] == 'Upload') {
|
5030 |
+
$upload_title = 'Uploaded Backup: ';
|
5031 |
+
}
|
5032 |
+
$row_style = 'border: 2px solid #006799; box-sizing:border-box; -moz-box-sizing:border-box; -webkit-box-sizing:border-box;';
|
5033 |
+
} else if ($value['type'] == 'Manual' || $value['type'] == 'Cron') {
|
5034 |
+
$row_style = '';
|
5035 |
+
$upload_title = '';
|
5036 |
+
} else {
|
5037 |
+
$upload_title = '';
|
|
|
|
|
|
|
5038 |
}
|
5039 |
+
|
5040 |
+
if (empty($value['lock'])) {
|
5041 |
+
$backup_lock = '/admin/partials/images/unlocked.png';
|
5042 |
+
$lock_status = 'unlock';
|
5043 |
+
} else {
|
5044 |
+
if ($value['lock'] == 0) {
|
5045 |
+
$backup_lock = '/admin/partials/images/unlocked.png';
|
5046 |
+
$lock_status = 'unlock';
|
5047 |
+
} else {
|
5048 |
+
$backup_lock = '/admin/partials/images/locked.png';
|
5049 |
+
$lock_status = 'lock';
|
5050 |
+
}
|
5051 |
}
|
|
|
5052 |
|
5053 |
+
$remote_pic_html = '';
|
5054 |
+
$save_local_pic_y = '/admin/partials/images/storage-local.png';
|
5055 |
+
$save_local_pic_n = '/admin/partials/images/storage-local(gray).png';
|
5056 |
+
$local_title = 'Localhost';
|
5057 |
+
if ($value['save_local'] == 1 || $value['type'] == 'Migration') {
|
5058 |
+
$remote_pic_html .= '<img src="' . esc_url(WPVIVID_PLUGIN_URL . $save_local_pic_y) . '" style="vertical-align:middle; " title="' . $local_title . '"/>';
|
5059 |
+
} else {
|
5060 |
+
$remote_pic_html .= '<img src="' . esc_url(WPVIVID_PLUGIN_URL . $save_local_pic_n) . '" style="vertical-align:middle; " title="' . $local_title . '"/>';
|
5061 |
+
}
|
5062 |
+
$b_has_remote = false;
|
5063 |
+
if (is_array($remote)) {
|
5064 |
+
foreach ($remote as $key1 => $value1) {
|
5065 |
+
foreach ($value['remote'] as $storage_type) {
|
5066 |
+
$b_has_remote = true;
|
5067 |
+
if ($key1 === $storage_type['type']) {
|
5068 |
+
$pic = $value1['selected_pic'];
|
5069 |
+
} else {
|
5070 |
+
$pic = $value1['default_pic'];
|
5071 |
+
}
|
5072 |
+
}
|
5073 |
+
if (!$b_has_remote) {
|
5074 |
$pic = $value1['default_pic'];
|
5075 |
}
|
5076 |
+
$title = $value1['title'];
|
5077 |
+
$remote_pic_html .= '<img src="' . esc_url(WPVIVID_PLUGIN_URL . $pic) . '" style="vertical-align:middle; " title="' . $title . '"/>';
|
5078 |
}
|
|
|
|
|
|
|
|
|
|
|
5079 |
}
|
5080 |
+
if ($tour) {
|
5081 |
+
$tour = false;
|
5082 |
+
$tour_message = '<div class="wpvivid-popuptext" id="wpvivid_popup_tour">Click the button to complete website restore or migration</div>';
|
5083 |
+
$tour_class = 'wpvivid-popup';
|
5084 |
+
} else {
|
5085 |
+
$tour_message = '';
|
5086 |
+
$tour_class = '';
|
5087 |
+
}
|
|
|
|
|
5088 |
|
5089 |
+
$hide = 'hide';
|
5090 |
+
$html .= '<tr style="' . $row_style . '">
|
5091 |
+
<th class="check-column"><input name="check_backup" type="checkbox" id="' . esc_attr($key, 'wpvivid') . '" value="' . esc_attr($key, 'wpvivid') . '" onclick="wpvivid_click_check_backup(\'' . $key . '\', \'' . $list_name . '\');" /></th>
|
5092 |
<td class="tablelistcolumn">
|
5093 |
<div style="float:left;padding:0 10px 10px 0;">
|
5094 |
+
<div class="backuptime"><strong>' . $upload_title . '</strong>' . __(date('M d, Y H:i', $value['create_time']), 'wpvivid') . '</div>
|
5095 |
<div class="common-table">
|
5096 |
+
<span title="To lock the backup, the backup can only be deleted manually" id="wpvivid_lock_' . $key . '">
|
5097 |
+
<img src="' . esc_url(WPVIVID_PLUGIN_URL . $backup_lock) . '" name="' . esc_attr($lock_status, 'wpvivid') . '" onclick="wpvivid_set_backup_lock(\'' . $key . '\', \'' . $lock_status . '\');" style="vertical-align:middle; cursor:pointer;"/>
|
5098 |
</span>
|
5099 |
+
<span style="margin:0;">|</span> <span>' . __('Type:', 'wpvivid') . '</span><span>' . __($value['type'], 'wpvivid') . '</span>
|
5100 |
+
<span style="margin:0;">|</span> <span title="Backup log"><a href="#" onclick="wpvivid_read_log(\'' . __('wpvivid_view_backup_log') . '\', \'' . __($key) . '\');"><img src="' . esc_url(WPVIVID_PLUGIN_URL . '/admin/partials/images/Log.png') . '" style="vertical-align:middle;cursor:pointer;"/><span style="margin:0;">' . __('Log', 'wpvivid') . '</span></a></span>
|
5101 |
</div>
|
5102 |
</div>
|
5103 |
</td>
|
5104 |
<td class="tablelistcolumn">
|
5105 |
+
<div style="float:left;padding:10px 10px 10px 0;">' . $remote_pic_html . '</div>
|
5106 |
</td>
|
5107 |
<td class="tablelistcolumn" style="min-width:100px;">
|
5108 |
+
<div id="wpvivid_file_part_' . __($key, 'wpvivid') . '" style="float:left;padding:10px 10px 10px 0;">
|
5109 |
+
<div style="cursor:pointer;" onclick="wpvivid_initialize_download(\'' . $key . '\', \'' . $list_name . '\');" title="Prepare to download the backup">
|
5110 |
+
<img id="wpvivid_download_btn_' . __($key, 'wpvivid') . '" src="' . esc_url(WPVIVID_PLUGIN_URL . '/admin/partials/images/download.png') . '" style="vertical-align:middle;" /><span>' . __('Download', 'wpvivid') . '</span>
|
5111 |
+
<div class="spinner" id="wpvivid_download_loading_' . __($key, 'wpvivid') . '" style="float:right;width:auto;height:auto;padding:10px 180px 10px 0;background-position:0 0;"></div>
|
5112 |
</div>
|
5113 |
</div>
|
5114 |
</td>
|
5115 |
<td class="tablelistcolumn" style="min-width:100px;">
|
5116 |
+
<div class="' . $tour_class . '" onclick="wpvivid_popup_tour(\'' . $hide . '\');">
|
5117 |
+
' . $tour_message . '<div style="cursor:pointer;padding:10px 0 10px 0;" onclick="wpvivid_initialize_restore(\'' . __($key, 'wpvivid') . '\',\'' . __(date('M d, Y H:i', $value['create_time']), 'wpvivid') . '\',\'' . __($value['type'], 'wpvivid') . '\');" style="float:left;padding:10px 10px 10px 0;">
|
5118 |
+
<img src="' . esc_url(WPVIVID_PLUGIN_URL . '/admin/partials/images/Restore.png') . '" style="vertical-align:middle;" /><span>' . __('Restore', 'wpvivid') . '</span>
|
5119 |
</div>
|
5120 |
</div>
|
5121 |
</td>
|
5122 |
<td class="tablelistcolumn">
|
5123 |
<div class="backuplist-delete-backup" style="padding:10px 0 10px 0;">
|
5124 |
+
<img src="' . esc_url(WPVIVID_PLUGIN_URL . '/admin/partials/images/Delete.png') . '" style="vertical-align:middle; cursor:pointer;" title="Delete the backup" onclick="wpvivid_delete_selected_backup(\'' . $key . '\', \'' . $list_name . '\');"/>
|
5125 |
</div>
|
5126 |
</td>
|
5127 |
</tr>';
|
5128 |
+
}
|
5129 |
}
|
5130 |
return $html;
|
5131 |
}
|
includes/customclass/class-wpvivid-amazons3-plus.php
CHANGED
@@ -21,7 +21,12 @@ class WPvivid_AMAZONS3Class extends WPvivid_Remote{
|
|
21 |
{
|
22 |
if(empty($options))
|
23 |
{
|
24 |
-
add_action('
|
|
|
|
|
|
|
|
|
|
|
25 |
}
|
26 |
else
|
27 |
{
|
@@ -29,16 +34,6 @@ class WPvivid_AMAZONS3Class extends WPvivid_Remote{
|
|
29 |
}
|
30 |
}
|
31 |
|
32 |
-
public function plugins_loaded()
|
33 |
-
{
|
34 |
-
add_action('wpvivid_add_storage_tab',array($this,'wpvivid_add_storage_tab_amazons3'), 11);
|
35 |
-
add_action('wpvivid_add_storage_page',array($this,'wpvivid_add_storage_page_amazons3'), 11);
|
36 |
-
add_action('wpvivid_edit_remote_page',array($this,'wpvivid_edit_storage_page_amazons3'), 11);
|
37 |
-
add_filter('wpvivid_remote_pic',array($this,'wpvivid_remote_pic_amazons3'),11);
|
38 |
-
add_filter('wpvivid_get_out_of_date_remote',array($this,'wpvivid_get_out_of_date_amazons3'),10,2);
|
39 |
-
add_filter('wpvivid_storage_provider_tran',array($this,'wpvivid_storage_provider_amazons3'),10);
|
40 |
-
}
|
41 |
-
|
42 |
public function wpvivid_add_storage_tab_amazons3()
|
43 |
{
|
44 |
?>
|
21 |
{
|
22 |
if(empty($options))
|
23 |
{
|
24 |
+
add_action('wpvivid_add_storage_tab',array($this,'wpvivid_add_storage_tab_amazons3'), 13);
|
25 |
+
add_action('wpvivid_add_storage_page',array($this,'wpvivid_add_storage_page_amazons3'), 13);
|
26 |
+
add_action('wpvivid_edit_remote_page',array($this,'wpvivid_edit_storage_page_amazons3'), 13);
|
27 |
+
add_filter('wpvivid_remote_pic',array($this,'wpvivid_remote_pic_amazons3'),11);
|
28 |
+
add_filter('wpvivid_get_out_of_date_remote',array($this,'wpvivid_get_out_of_date_amazons3'),10,2);
|
29 |
+
add_filter('wpvivid_storage_provider_tran',array($this,'wpvivid_storage_provider_amazons3'),10);
|
30 |
}
|
31 |
else
|
32 |
{
|
34 |
}
|
35 |
}
|
36 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
37 |
public function wpvivid_add_storage_tab_amazons3()
|
38 |
{
|
39 |
?>
|
includes/customclass/class-wpvivid-dropbox.php
CHANGED
@@ -19,30 +19,26 @@ class WPvivid_Dropbox extends WPvivid_Remote {
|
|
19 |
public function __construct($options = array())
|
20 |
{
|
21 |
if(empty($options)){
|
22 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
23 |
}else{
|
24 |
$this -> options = $options;
|
25 |
}
|
26 |
}
|
27 |
|
28 |
-
public function plugins_loaded(){
|
29 |
-
if(!defined('WPVIVID_INIT_STORAGE_TAB_DROPBOX')){
|
30 |
-
add_action('init', array($this, 'handle_auth_actions'));
|
31 |
-
add_action('wpvivid_delete_remote_token',array($this,'revoke'));
|
32 |
-
|
33 |
-
add_filter('wpvivid_remote_register', array($this, 'init_remotes'),10);
|
34 |
-
add_action('wpvivid_add_storage_tab',array($this,'wpvivid_add_storage_tab_dropbox'), 10);
|
35 |
-
add_action('wpvivid_add_storage_page',array($this,'wpvivid_add_storage_page_dropbox'), 10);
|
36 |
-
add_action('wpvivid_edit_remote_page',array($this,'wpvivid_edit_storage_page_dropbox'), 10);
|
37 |
-
add_filter('wpvivid_remote_pic',array($this,'wpvivid_remote_pic_dropbox'),10);
|
38 |
-
add_filter('wpvivid_get_out_of_date_remote',array($this,'wpvivid_get_out_of_date_dropbox'),10,2);
|
39 |
-
add_filter('wpvivid_storage_provider_tran',array($this,'wpvivid_storage_provider_dropbox'),10);
|
40 |
-
add_filter('wpvivid_get_root_path',array($this,'wpvivid_get_root_path_dropbox'),10);
|
41 |
-
|
42 |
-
define('WPVIVID_INIT_STORAGE_TAB_DROPBOX',1);
|
43 |
-
}
|
44 |
-
}
|
45 |
-
|
46 |
public function test_connect()
|
47 |
{
|
48 |
return array('result' => WPVIVID_SUCCESS);
|
19 |
public function __construct($options = array())
|
20 |
{
|
21 |
if(empty($options)){
|
22 |
+
if(!defined('WPVIVID_INIT_STORAGE_TAB_DROPBOX')){
|
23 |
+
add_action('init', array($this, 'handle_auth_actions'));
|
24 |
+
add_action('wpvivid_delete_remote_token',array($this,'revoke'));
|
25 |
+
|
26 |
+
add_filter('wpvivid_remote_register', array($this, 'init_remotes'),10);
|
27 |
+
add_action('wpvivid_add_storage_tab',array($this,'wpvivid_add_storage_tab_dropbox'), 11);
|
28 |
+
add_action('wpvivid_add_storage_page',array($this,'wpvivid_add_storage_page_dropbox'), 11);
|
29 |
+
add_action('wpvivid_edit_remote_page',array($this,'wpvivid_edit_storage_page_dropbox'), 11);
|
30 |
+
add_filter('wpvivid_remote_pic',array($this,'wpvivid_remote_pic_dropbox'),10);
|
31 |
+
add_filter('wpvivid_get_out_of_date_remote',array($this,'wpvivid_get_out_of_date_dropbox'),10,2);
|
32 |
+
add_filter('wpvivid_storage_provider_tran',array($this,'wpvivid_storage_provider_dropbox'),10);
|
33 |
+
add_filter('wpvivid_get_root_path',array($this,'wpvivid_get_root_path_dropbox'),10);
|
34 |
+
|
35 |
+
define('WPVIVID_INIT_STORAGE_TAB_DROPBOX',1);
|
36 |
+
}
|
37 |
}else{
|
38 |
$this -> options = $options;
|
39 |
}
|
40 |
}
|
41 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
42 |
public function test_connect()
|
43 |
{
|
44 |
return array('result' => WPVIVID_SUCCESS);
|
includes/customclass/class-wpvivid-ftpclass.php
CHANGED
@@ -17,26 +17,22 @@ class WPvivid_FTPClass extends WPvivid_Remote{
|
|
17 |
{
|
18 |
if(empty($options))
|
19 |
{
|
20 |
-
add_action('
|
|
|
|
|
|
|
|
|
|
|
21 |
|
22 |
}else{
|
23 |
$this->options = $options;
|
24 |
}
|
25 |
}
|
26 |
|
27 |
-
public function plugins_loaded(){
|
28 |
-
add_action('wpvivid_add_storage_tab',array($this,'wpvivid_add_storage_tab_ftp'), 9);
|
29 |
-
add_action('wpvivid_add_storage_page',array($this,'wpvivid_add_storage_page_ftp'), 9);
|
30 |
-
add_action('wpvivid_edit_remote_page',array($this,'wpvivid_edit_storage_page_ftp'), 9);
|
31 |
-
add_filter('wpvivid_remote_pic',array($this,'wpvivid_remote_pic_ftp'),9);
|
32 |
-
add_filter('wpvivid_get_out_of_date_remote',array($this,'wpvivid_get_out_of_date_ftp'),10,2);
|
33 |
-
add_filter('wpvivid_storage_provider_tran',array($this,'wpvivid_storage_provider_ftp'),10);
|
34 |
-
}
|
35 |
-
|
36 |
public function wpvivid_add_storage_tab_ftp()
|
37 |
{
|
38 |
?>
|
39 |
-
<div class="storage-providers
|
40 |
<img src="<?php echo esc_url(WPVIVID_PLUGIN_URL.'/admin/partials/images/storage-ftp.png'); ?>" style="vertical-align:middle;"/><?php _e('FTP', 'wpvivid'); ?>
|
41 |
</div>
|
42 |
<?php
|
@@ -45,7 +41,7 @@ class WPvivid_FTPClass extends WPvivid_Remote{
|
|
45 |
public function wpvivid_add_storage_page_ftp()
|
46 |
{
|
47 |
?>
|
48 |
-
<div id="storage_account_ftp" class="storage-account-page">
|
49 |
<h2><span><?php _e( 'Enter Your FTP Account ','wpvivid'); ?></span></h2>
|
50 |
<div class="storage-account-form">
|
51 |
<input type="text" autocomplete="off" option="ftp" name="name" placeholder="Enter an unique alias: e.g. FTP-001" class="regular-text" onkeyup="value=value.replace(/[^a-zA-Z0-9\-_]/g,'')" />
|
17 |
{
|
18 |
if(empty($options))
|
19 |
{
|
20 |
+
add_action('wpvivid_add_storage_tab',array($this,'wpvivid_add_storage_tab_ftp'), 15);
|
21 |
+
add_action('wpvivid_add_storage_page',array($this,'wpvivid_add_storage_page_ftp'), 15);
|
22 |
+
add_action('wpvivid_edit_remote_page',array($this,'wpvivid_edit_storage_page_ftp'), 15);
|
23 |
+
add_filter('wpvivid_remote_pic',array($this,'wpvivid_remote_pic_ftp'),9);
|
24 |
+
add_filter('wpvivid_get_out_of_date_remote',array($this,'wpvivid_get_out_of_date_ftp'),10,2);
|
25 |
+
add_filter('wpvivid_storage_provider_tran',array($this,'wpvivid_storage_provider_ftp'),10);
|
26 |
|
27 |
}else{
|
28 |
$this->options = $options;
|
29 |
}
|
30 |
}
|
31 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
32 |
public function wpvivid_add_storage_tab_ftp()
|
33 |
{
|
34 |
?>
|
35 |
+
<div class="storage-providers" remote_type="ftp" onclick="select_remote_storage(event, 'storage_account_ftp');">
|
36 |
<img src="<?php echo esc_url(WPVIVID_PLUGIN_URL.'/admin/partials/images/storage-ftp.png'); ?>" style="vertical-align:middle;"/><?php _e('FTP', 'wpvivid'); ?>
|
37 |
</div>
|
38 |
<?php
|
41 |
public function wpvivid_add_storage_page_ftp()
|
42 |
{
|
43 |
?>
|
44 |
+
<div id="storage_account_ftp" class="storage-account-page" style="display:none;">
|
45 |
<h2><span><?php _e( 'Enter Your FTP Account ','wpvivid'); ?></span></h2>
|
46 |
<div class="storage-account-form">
|
47 |
<input type="text" autocomplete="off" option="ftp" name="name" placeholder="Enter an unique alias: e.g. FTP-001" class="regular-text" onkeyup="value=value.replace(/[^a-zA-Z0-9\-_]/g,'')" />
|
includes/customclass/class-wpvivid-google-drive.php
CHANGED
@@ -26,7 +26,20 @@ class Wpvivid_Google_drive extends WPvivid_Remote
|
|
26 |
{
|
27 |
if(empty($options))
|
28 |
{
|
29 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
30 |
|
31 |
}
|
32 |
else
|
@@ -44,23 +57,6 @@ class Wpvivid_Google_drive extends WPvivid_Remote
|
|
44 |
));
|
45 |
}
|
46 |
|
47 |
-
public function plugins_loaded(){
|
48 |
-
if(!defined('WPVIVID_INIT_STORAGE_TAB_GOOGLE_DRIVE'))
|
49 |
-
{
|
50 |
-
add_action('init', array($this, 'handle_auth_actions'));
|
51 |
-
|
52 |
-
add_action('wpvivid_add_storage_tab',array($this,'wpvivid_add_storage_tab_google_drive'), 10);
|
53 |
-
add_action('wpvivid_add_storage_page',array($this,'wpvivid_add_storage_page_google_drive'), 10);
|
54 |
-
add_filter('wpvivid_pre_add_remote',array($this, 'pre_add_remote'),10,2);
|
55 |
-
add_action('wpvivid_edit_remote_page',array($this,'wpvivid_edit_storage_page_google_drive'), 10);
|
56 |
-
add_filter('wpvivid_remote_pic',array($this,'wpvivid_remote_pic_google_drive'),10);
|
57 |
-
add_filter('wpvivid_get_out_of_date_remote',array($this,'wpvivid_get_out_of_date_google_drive'),10,2);
|
58 |
-
add_filter('wpvivid_storage_provider_tran',array($this,'wpvivid_storage_provider_google_drive'),10);
|
59 |
-
add_filter('wpvivid_get_root_path',array($this,'wpvivid_get_root_path_google_drive'),10);
|
60 |
-
define('WPVIVID_INIT_STORAGE_TAB_GOOGLE_DRIVE',1);
|
61 |
-
}
|
62 |
-
}
|
63 |
-
|
64 |
public function pre_add_remote($remote,$id)
|
65 |
{
|
66 |
if($remote['type']==WPVIVID_REMOTE_GOOGLEDRIVE)
|
@@ -292,7 +288,7 @@ class Wpvivid_Google_drive extends WPvivid_Remote
|
|
292 |
public function wpvivid_add_storage_tab_google_drive()
|
293 |
{
|
294 |
?>
|
295 |
-
<div class="storage-providers" remote_type="googledrive" onclick="select_remote_storage(event, 'storage_account_google_drive');">
|
296 |
<img src="<?php echo esc_url(WPVIVID_PLUGIN_URL.'/admin/partials/images/stroage-google-drive.png'); ?>" style="vertical-align:middle;"/><?php _e('Google Drive', 'wpvivid'); ?>
|
297 |
</div>
|
298 |
<?php
|
@@ -301,7 +297,7 @@ class Wpvivid_Google_drive extends WPvivid_Remote
|
|
301 |
public function wpvivid_add_storage_page_google_drive()
|
302 |
{
|
303 |
?>
|
304 |
-
<div id="storage_account_google_drive" class="storage-account-page"
|
305 |
<p style="padding-left: 10px;">Please read <a target="_blank" href="https://wpvivid.com/privacy-policy">this privacy policy</a> for use of our Google Drive authorization app (none of your backup data is sent to us).</p>
|
306 |
<h2><span><?php _e( 'Enter Your Google Drive Information','wpvivid'); ?></span></h2>
|
307 |
<div class="storage-account-form">
|
@@ -658,6 +654,15 @@ class Wpvivid_Google_drive extends WPvivid_Remote
|
|
658 |
return false;
|
659 |
}
|
660 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
661 |
public function download( $file, $local_path, $callback = '')
|
662 |
{
|
663 |
try
|
@@ -665,6 +670,7 @@ class Wpvivid_Google_drive extends WPvivid_Remote
|
|
665 |
global $wpvivid_plugin;
|
666 |
$this -> current_file_name = $file['file_name'];
|
667 |
$this -> current_file_size = $file['size'];
|
|
|
668 |
$wpvivid_plugin->wpvivid_download_log->WriteLog('Google Drive get client.','notice');
|
669 |
$client=$this->get_client();
|
670 |
if($client['result'] == WPVIVID_FAILED) {
|
26 |
{
|
27 |
if(empty($options))
|
28 |
{
|
29 |
+
if(!defined('WPVIVID_INIT_STORAGE_TAB_GOOGLE_DRIVE'))
|
30 |
+
{
|
31 |
+
add_action('init', array($this, 'handle_auth_actions'));
|
32 |
+
|
33 |
+
add_action('wpvivid_add_storage_tab',array($this,'wpvivid_add_storage_tab_google_drive'), 10);
|
34 |
+
add_action('wpvivid_add_storage_page',array($this,'wpvivid_add_storage_page_google_drive'), 10);
|
35 |
+
add_filter('wpvivid_pre_add_remote',array($this, 'pre_add_remote'),10,2);
|
36 |
+
add_action('wpvivid_edit_remote_page',array($this,'wpvivid_edit_storage_page_google_drive'), 10);
|
37 |
+
add_filter('wpvivid_remote_pic',array($this,'wpvivid_remote_pic_google_drive'),10);
|
38 |
+
add_filter('wpvivid_get_out_of_date_remote',array($this,'wpvivid_get_out_of_date_google_drive'),10,2);
|
39 |
+
add_filter('wpvivid_storage_provider_tran',array($this,'wpvivid_storage_provider_google_drive'),10);
|
40 |
+
add_filter('wpvivid_get_root_path',array($this,'wpvivid_get_root_path_google_drive'),10);
|
41 |
+
define('WPVIVID_INIT_STORAGE_TAB_GOOGLE_DRIVE',1);
|
42 |
+
}
|
43 |
|
44 |
}
|
45 |
else
|
57 |
));
|
58 |
}
|
59 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
60 |
public function pre_add_remote($remote,$id)
|
61 |
{
|
62 |
if($remote['type']==WPVIVID_REMOTE_GOOGLEDRIVE)
|
288 |
public function wpvivid_add_storage_tab_google_drive()
|
289 |
{
|
290 |
?>
|
291 |
+
<div class="storage-providers storage-providers-active" remote_type="googledrive" onclick="select_remote_storage(event, 'storage_account_google_drive');">
|
292 |
<img src="<?php echo esc_url(WPVIVID_PLUGIN_URL.'/admin/partials/images/stroage-google-drive.png'); ?>" style="vertical-align:middle;"/><?php _e('Google Drive', 'wpvivid'); ?>
|
293 |
</div>
|
294 |
<?php
|
297 |
public function wpvivid_add_storage_page_google_drive()
|
298 |
{
|
299 |
?>
|
300 |
+
<div id="storage_account_google_drive" class="storage-account-page">
|
301 |
<p style="padding-left: 10px;">Please read <a target="_blank" href="https://wpvivid.com/privacy-policy">this privacy policy</a> for use of our Google Drive authorization app (none of your backup data is sent to us).</p>
|
302 |
<h2><span><?php _e( 'Enter Your Google Drive Information','wpvivid'); ?></span></h2>
|
303 |
<div class="storage-account-form">
|
654 |
return false;
|
655 |
}
|
656 |
|
657 |
+
public function set_token()
|
658 |
+
{
|
659 |
+
$remote_options=WPvivid_Setting::get_remote_option($this->options['id']);
|
660 |
+
if($remote_options!==false)
|
661 |
+
{
|
662 |
+
$this->options['token']=$remote_options['token'];
|
663 |
+
}
|
664 |
+
}
|
665 |
+
|
666 |
public function download( $file, $local_path, $callback = '')
|
667 |
{
|
668 |
try
|
670 |
global $wpvivid_plugin;
|
671 |
$this -> current_file_name = $file['file_name'];
|
672 |
$this -> current_file_size = $file['size'];
|
673 |
+
$this->set_token();
|
674 |
$wpvivid_plugin->wpvivid_download_log->WriteLog('Google Drive get client.','notice');
|
675 |
$client=$this->get_client();
|
676 |
if($client['result'] == WPVIVID_FAILED) {
|
includes/customclass/class-wpvivid-one-drive.php
CHANGED
@@ -40,12 +40,24 @@ if(!defined('WPVIVID_ONEDRIVE_RETRY_TIMES'))
|
|
40 |
class WPvivid_one_drive extends WPvivid_Remote
|
41 |
{
|
42 |
public $options;
|
43 |
-
|
44 |
public function __construct($options=array())
|
45 |
{
|
46 |
if(empty($options))
|
47 |
{
|
48 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
49 |
}
|
50 |
else
|
51 |
{
|
@@ -53,23 +65,6 @@ class WPvivid_one_drive extends WPvivid_Remote
|
|
53 |
}
|
54 |
}
|
55 |
|
56 |
-
public function plugins_loaded()
|
57 |
-
{
|
58 |
-
if(!defined('WPVIVID_INIT_STORAGE_TAB_ONE_DRIVE'))
|
59 |
-
{
|
60 |
-
add_action('init', array($this, 'handle_auth_actions'));
|
61 |
-
add_action('wpvivid_add_storage_tab',array($this,'wpvivid_add_storage_tab_one_drive'), 10);
|
62 |
-
add_action('wpvivid_add_storage_page',array($this,'wpvivid_add_storage_page_one_drive'), 10);
|
63 |
-
add_action('wpvivid_edit_remote_page',array($this,'wpvivid_edit_storage_page_one_drive'), 10);
|
64 |
-
add_filter('wpvivid_remote_pic',array($this,'wpvivid_remote_pic_one_drive'),10);
|
65 |
-
add_filter('wpvivid_get_out_of_date_remote',array($this,'wpvivid_get_out_of_date_one_drive'),10,2);
|
66 |
-
add_filter('wpvivid_storage_provider_tran',array($this,'wpvivid_storage_provider_one_drive'),10);
|
67 |
-
add_filter('wpvivid_get_root_path',array($this,'wpvivid_get_root_path_one_drive'),10);
|
68 |
-
add_filter('wpvivid_pre_add_remote',array($this, 'pre_add_remote'),10,2);
|
69 |
-
define('WPVIVID_INIT_STORAGE_TAB_ONE_DRIVE',1);
|
70 |
-
}
|
71 |
-
}
|
72 |
-
|
73 |
public function pre_add_remote($remote,$id)
|
74 |
{
|
75 |
if($remote['type']==WPVIVID_REMOTE_ONEDRIVE)
|
@@ -511,14 +506,24 @@ class WPvivid_one_drive extends WPvivid_Remote
|
|
511 |
return array('result' =>WPVIVID_SUCCESS);
|
512 |
}
|
513 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
514 |
public function download($file, $local_path, $callback = '')
|
515 |
{
|
516 |
try {
|
517 |
$this->current_file_name = $file['file_name'];
|
518 |
$this->current_file_size = $file['size'];
|
519 |
-
|
520 |
global $wpvivid_plugin;
|
521 |
$wpvivid_plugin->wpvivid_download_log->WriteLog('Remote type: OneDrive.','notice');
|
|
|
522 |
if ($this->need_refresh()) {
|
523 |
$ret = $this->refresh_token();
|
524 |
if ($ret['result'] === WPVIVID_FAILED) {
|
@@ -548,15 +553,6 @@ class WPvivid_one_drive extends WPvivid_Remote
|
|
548 |
}
|
549 |
|
550 |
fwrite($fh, $ret['body']);
|
551 |
-
|
552 |
-
if ((time() - $this->last_time) > 3) {
|
553 |
-
if (is_callable($callback)) {
|
554 |
-
call_user_func_array($callback, array($downloaded_start, $this->current_file_name,
|
555 |
-
$this->current_file_size, $this->last_time, $this->last_size));
|
556 |
-
}
|
557 |
-
$this->last_size = $downloaded_start;
|
558 |
-
$this->last_time = time();
|
559 |
-
}
|
560 |
}
|
561 |
|
562 |
fclose($fh);
|
@@ -575,8 +571,15 @@ class WPvivid_one_drive extends WPvivid_Remote
|
|
575 |
|
576 |
$downloaded_end=min($downloaded_start+$download_size-1,$file_size-1);
|
577 |
$headers['Range']="bytes=$downloaded_start-$downloaded_end";
|
578 |
-
$response=$this->remote_get($url,$headers,false,
|
579 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
580 |
if($response['result']==WPVIVID_SUCCESS)
|
581 |
{
|
582 |
$downloaded_start=$downloaded_end+1;
|
@@ -614,6 +617,7 @@ class WPvivid_one_drive extends WPvivid_Remote
|
|
614 |
{
|
615 |
$args['method']='POST';
|
616 |
$args['wpvivid_refresh_token']=1;
|
|
|
617 |
$args['body']=array( 'wpvivid_refresh_token' => '1', 'refresh_token' => $this->options['token']['refresh_token']);
|
618 |
$response=wp_remote_post('https://auth.wpvivid.com/onedrive_v2/',$args);
|
619 |
if(!is_wp_error($response) && ($response['response']['code'] == 200))
|
@@ -622,9 +626,15 @@ class WPvivid_one_drive extends WPvivid_Remote
|
|
622 |
$json_ret =json_decode($json,true);
|
623 |
if($json_ret['result']=='success')
|
624 |
{
|
|
|
625 |
$this->options['token']=$json_ret['token'];
|
626 |
$this->options['token']['expires']=time()+ $json_ret['token']['expires_in'];
|
627 |
-
|
|
|
|
|
|
|
|
|
|
|
628 |
$ret['result']=WPVIVID_SUCCESS;
|
629 |
return $ret;
|
630 |
}
|
40 |
class WPvivid_one_drive extends WPvivid_Remote
|
41 |
{
|
42 |
public $options;
|
43 |
+
public $callback;
|
44 |
public function __construct($options=array())
|
45 |
{
|
46 |
if(empty($options))
|
47 |
{
|
48 |
+
if(!defined('WPVIVID_INIT_STORAGE_TAB_ONE_DRIVE'))
|
49 |
+
{
|
50 |
+
add_action('init', array($this, 'handle_auth_actions'));
|
51 |
+
add_action('wpvivid_add_storage_tab',array($this,'wpvivid_add_storage_tab_one_drive'), 12);
|
52 |
+
add_action('wpvivid_add_storage_page',array($this,'wpvivid_add_storage_page_one_drive'), 12);
|
53 |
+
add_action('wpvivid_edit_remote_page',array($this,'wpvivid_edit_storage_page_one_drive'), 12);
|
54 |
+
add_filter('wpvivid_remote_pic',array($this,'wpvivid_remote_pic_one_drive'),10);
|
55 |
+
add_filter('wpvivid_get_out_of_date_remote',array($this,'wpvivid_get_out_of_date_one_drive'),10,2);
|
56 |
+
add_filter('wpvivid_storage_provider_tran',array($this,'wpvivid_storage_provider_one_drive'),10);
|
57 |
+
add_filter('wpvivid_get_root_path',array($this,'wpvivid_get_root_path_one_drive'),10);
|
58 |
+
add_filter('wpvivid_pre_add_remote',array($this, 'pre_add_remote'),10,2);
|
59 |
+
define('WPVIVID_INIT_STORAGE_TAB_ONE_DRIVE',1);
|
60 |
+
}
|
61 |
}
|
62 |
else
|
63 |
{
|
65 |
}
|
66 |
}
|
67 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
68 |
public function pre_add_remote($remote,$id)
|
69 |
{
|
70 |
if($remote['type']==WPVIVID_REMOTE_ONEDRIVE)
|
506 |
return array('result' =>WPVIVID_SUCCESS);
|
507 |
}
|
508 |
|
509 |
+
public function set_token()
|
510 |
+
{
|
511 |
+
$remote_options=WPvivid_Setting::get_remote_option($this->options['id']);
|
512 |
+
if($remote_options!==false)
|
513 |
+
{
|
514 |
+
$this->options['token']=$remote_options['token'];
|
515 |
+
}
|
516 |
+
}
|
517 |
+
|
518 |
public function download($file, $local_path, $callback = '')
|
519 |
{
|
520 |
try {
|
521 |
$this->current_file_name = $file['file_name'];
|
522 |
$this->current_file_size = $file['size'];
|
523 |
+
$this->callback=$callback;
|
524 |
global $wpvivid_plugin;
|
525 |
$wpvivid_plugin->wpvivid_download_log->WriteLog('Remote type: OneDrive.','notice');
|
526 |
+
$this->set_token();
|
527 |
if ($this->need_refresh()) {
|
528 |
$ret = $this->refresh_token();
|
529 |
if ($ret['result'] === WPVIVID_FAILED) {
|
553 |
}
|
554 |
|
555 |
fwrite($fh, $ret['body']);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
556 |
}
|
557 |
|
558 |
fclose($fh);
|
571 |
|
572 |
$downloaded_end=min($downloaded_start+$download_size-1,$file_size-1);
|
573 |
$headers['Range']="bytes=$downloaded_start-$downloaded_end";
|
574 |
+
$response=$this->remote_get($url,$headers,false,30);
|
575 |
+
if ((time() - $this->last_time) > 3) {
|
576 |
+
if (is_callable($this->callback)) {
|
577 |
+
call_user_func_array($this->callback, array($downloaded_start, $this->current_file_name,
|
578 |
+
$this->current_file_size, $this->last_time, $this->last_size));
|
579 |
+
}
|
580 |
+
$this->last_size = $downloaded_start;
|
581 |
+
$this->last_time = time();
|
582 |
+
}
|
583 |
if($response['result']==WPVIVID_SUCCESS)
|
584 |
{
|
585 |
$downloaded_start=$downloaded_end+1;
|
617 |
{
|
618 |
$args['method']='POST';
|
619 |
$args['wpvivid_refresh_token']=1;
|
620 |
+
$args['timeout']=15;
|
621 |
$args['body']=array( 'wpvivid_refresh_token' => '1', 'refresh_token' => $this->options['token']['refresh_token']);
|
622 |
$response=wp_remote_post('https://auth.wpvivid.com/onedrive_v2/',$args);
|
623 |
if(!is_wp_error($response) && ($response['response']['code'] == 200))
|
626 |
$json_ret =json_decode($json,true);
|
627 |
if($json_ret['result']=='success')
|
628 |
{
|
629 |
+
$remote_options=WPvivid_Setting::get_remote_option($this->options['id']);
|
630 |
$this->options['token']=$json_ret['token'];
|
631 |
$this->options['token']['expires']=time()+ $json_ret['token']['expires_in'];
|
632 |
+
if($remote_options!==false)
|
633 |
+
{
|
634 |
+
$remote_options['token']=$json_ret['token'];
|
635 |
+
$remote_options['token']['expires']=time()+ $json_ret['token']['expires_in'];
|
636 |
+
WPvivid_Setting::update_remote_option($this->options['id'],$remote_options);
|
637 |
+
}
|
638 |
$ret['result']=WPVIVID_SUCCESS;
|
639 |
return $ret;
|
640 |
}
|
includes/customclass/class-wpvivid-s3compat.php
CHANGED
@@ -23,22 +23,18 @@ class Wpvivid_S3Compat extends WPvivid_Remote{
|
|
23 |
public function __construct($options = array())
|
24 |
{
|
25 |
if(empty($options)){
|
26 |
-
add_action('
|
|
|
|
|
|
|
|
|
|
|
27 |
|
28 |
}else{
|
29 |
$this -> options = $options;
|
30 |
}
|
31 |
}
|
32 |
|
33 |
-
public function plugins_loaded(){
|
34 |
-
add_action('wpvivid_add_storage_tab',array($this,'wpvivid_add_storage_tab_s3compat'), 11);
|
35 |
-
add_action('wpvivid_add_storage_page',array($this,'wpvivid_add_storage_page_s3compat'), 11);
|
36 |
-
add_action('wpvivid_edit_remote_page',array($this,'wpvivid_edit_storage_page_s3compat'), 11);
|
37 |
-
add_filter('wpvivid_remote_pic',array($this,'wpvivid_remote_pic_s3compat'),11);
|
38 |
-
add_filter('wpvivid_get_out_of_date_remote',array($this,'wpvivid_get_out_of_date_s3compat'),10,2);
|
39 |
-
add_filter('wpvivid_storage_provider_tran',array($this,'wpvivid_storage_provider_s3compat'),10);
|
40 |
-
}
|
41 |
-
|
42 |
public function getClient(){
|
43 |
$res = $this -> compare_php_version();
|
44 |
if($res['result'] == WPVIVID_FAILED)
|
23 |
public function __construct($options = array())
|
24 |
{
|
25 |
if(empty($options)){
|
26 |
+
add_action('wpvivid_add_storage_tab',array($this,'wpvivid_add_storage_tab_s3compat'), 14);
|
27 |
+
add_action('wpvivid_add_storage_page',array($this,'wpvivid_add_storage_page_s3compat'), 14);
|
28 |
+
add_action('wpvivid_edit_remote_page',array($this,'wpvivid_edit_storage_page_s3compat'), 14);
|
29 |
+
add_filter('wpvivid_remote_pic',array($this,'wpvivid_remote_pic_s3compat'),11);
|
30 |
+
add_filter('wpvivid_get_out_of_date_remote',array($this,'wpvivid_get_out_of_date_s3compat'),10,2);
|
31 |
+
add_filter('wpvivid_storage_provider_tran',array($this,'wpvivid_storage_provider_s3compat'),10);
|
32 |
|
33 |
}else{
|
34 |
$this -> options = $options;
|
35 |
}
|
36 |
}
|
37 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
38 |
public function getClient(){
|
39 |
$res = $this -> compare_php_version();
|
40 |
if($res['result'] == WPVIVID_FAILED)
|
includes/customclass/class-wpvivid-send-to-site.php
CHANGED
@@ -113,6 +113,7 @@ class WPvivid_Send_to_site extends WPvivid_Remote
|
|
113 |
|
114 |
foreach ($files as $file)
|
115 |
{
|
|
|
116 |
if(array_key_exists(basename($file),$upload_job['job_data']))
|
117 |
{
|
118 |
if($upload_job['job_data'][basename($file)]['uploaded']==1)
|
@@ -403,7 +404,7 @@ class WPvivid_Send_to_site extends WPvivid_Remote
|
|
403 |
$task=WPvivid_taskmanager::get_task($task_id);
|
404 |
$json=array();
|
405 |
|
406 |
-
$json['backup']=$task
|
407 |
$json['backup_id']=$task_id;
|
408 |
$json=json_encode($json);
|
409 |
|
@@ -673,13 +674,11 @@ class WPvivid_Send_to_site extends WPvivid_Remote
|
|
673 |
$wpvivid_plugin->wpvivid_log = new WPvivid_Log();
|
674 |
$wpvivid_plugin->wpvivid_log->OpenLogFile($params['backup_id'] . '_backup', 'no_folder', 'backup');
|
675 |
$wpvivid_plugin->wpvivid_log->WriteLog('upload finished', 'notice');
|
676 |
-
|
677 |
-
|
678 |
-
$params['backup']['type'] = 'Migration';
|
679 |
-
$params['backup']['local']['path']=WPvivid_Setting::get_backupdir();
|
680 |
$list = WPvivid_Setting::get_option('wpvivid_backup_list');
|
681 |
-
$
|
682 |
-
$list[$params['backup_id']]
|
683 |
WPvivid_Setting::update_option('wpvivid_backup_list', $list);
|
684 |
}
|
685 |
|
@@ -696,6 +695,47 @@ class WPvivid_Send_to_site extends WPvivid_Remote
|
|
696 |
die();
|
697 |
}
|
698 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
699 |
public function cleanup($files)
|
700 |
{
|
701 |
return array('result' => WPVIVID_SUCCESS);
|
113 |
|
114 |
foreach ($files as $file)
|
115 |
{
|
116 |
+
$wpvivid_plugin->set_time_limit($task_id);
|
117 |
if(array_key_exists(basename($file),$upload_job['job_data']))
|
118 |
{
|
119 |
if($upload_job['job_data'][basename($file)]['uploaded']==1)
|
404 |
$task=WPvivid_taskmanager::get_task($task_id);
|
405 |
$json=array();
|
406 |
|
407 |
+
$json['backup']=$task;
|
408 |
$json['backup_id']=$task_id;
|
409 |
$json=json_encode($json);
|
410 |
|
674 |
$wpvivid_plugin->wpvivid_log = new WPvivid_Log();
|
675 |
$wpvivid_plugin->wpvivid_log->OpenLogFile($params['backup_id'] . '_backup', 'no_folder', 'backup');
|
676 |
$wpvivid_plugin->wpvivid_log->WriteLog('upload finished', 'notice');
|
677 |
+
if (isset($params['backup']) && isset($params['backup_id']))
|
678 |
+
{
|
|
|
|
|
679 |
$list = WPvivid_Setting::get_option('wpvivid_backup_list');
|
680 |
+
$backup_data = $this->get_backup_data_by_task($params['backup']);
|
681 |
+
$list[$params['backup_id']] = $backup_data;
|
682 |
WPvivid_Setting::update_option('wpvivid_backup_list', $list);
|
683 |
}
|
684 |
|
695 |
die();
|
696 |
}
|
697 |
|
698 |
+
public function get_backup_data_by_task($task){
|
699 |
+
global $wpvivid_plugin;
|
700 |
+
$backup_data=array();
|
701 |
+
$backup_data['type']='Migration';
|
702 |
+
$backup_data['create_time']=$task['status']['start_time'];
|
703 |
+
$backup_data['manual_delete']=0;
|
704 |
+
$backup_data['local']['path']=WPvivid_Setting::get_backupdir();
|
705 |
+
$backup_data['compress']['compress_type']=$task['options']['backup_options']['compress']['compress_type'];
|
706 |
+
$backup_data['save_local']=$task['options']['save_local'];
|
707 |
+
$backup_data['log']=$wpvivid_plugin->wpvivid_log->log_file;
|
708 |
+
$backup_data['backup']=$this->get_backup_result_by_task($task);
|
709 |
+
$backup_data['remote']=array();
|
710 |
+
$backup_data['lock']=0;
|
711 |
+
return $backup_data;
|
712 |
+
}
|
713 |
+
|
714 |
+
public function get_backup_result_by_task($task)
|
715 |
+
{
|
716 |
+
$ret['result']=WPVIVID_SUCCESS;
|
717 |
+
$ret['files']=array();
|
718 |
+
foreach ($task['options']['backup_options']['backup'] as $backup_data)
|
719 |
+
{
|
720 |
+
if($task['options']['backup_options']['ismerge']==1)
|
721 |
+
{
|
722 |
+
if(WPVIVID_BACKUP_TYPE_MERGE==$backup_data['key'])
|
723 |
+
{
|
724 |
+
$ret=$backup_data['result'];
|
725 |
+
if($ret['result']!==WPVIVID_SUCCESS)
|
726 |
+
{
|
727 |
+
return $ret;
|
728 |
+
}
|
729 |
+
}
|
730 |
+
}
|
731 |
+
else
|
732 |
+
{
|
733 |
+
$ret['files']=array_merge($ret['files'],$backup_data['result']['files']);
|
734 |
+
}
|
735 |
+
}
|
736 |
+
return $ret;
|
737 |
+
}
|
738 |
+
|
739 |
public function cleanup($files)
|
740 |
{
|
741 |
return array('result' => WPVIVID_SUCCESS);
|
includes/customclass/class-wpvivid-sftpclass.php
CHANGED
@@ -18,8 +18,12 @@ class WPvivid_SFTPClass extends WPvivid_Remote{
|
|
18 |
{
|
19 |
if(empty($options))
|
20 |
{
|
21 |
-
add_action('
|
22 |
-
|
|
|
|
|
|
|
|
|
23 |
}
|
24 |
else
|
25 |
{
|
@@ -27,15 +31,6 @@ class WPvivid_SFTPClass extends WPvivid_Remote{
|
|
27 |
}
|
28 |
}
|
29 |
|
30 |
-
public function plugins_loaded(){
|
31 |
-
add_action('wpvivid_add_storage_tab',array($this,'wpvivid_add_storage_tab_sftp'), 10);
|
32 |
-
add_action('wpvivid_add_storage_page',array($this,'wpvivid_add_storage_page_sftp'), 10);
|
33 |
-
add_action('wpvivid_edit_remote_page',array($this,'wpvivid_edit_storage_page_sftp'), 10);
|
34 |
-
add_filter('wpvivid_remote_pic',array($this,'wpvivid_remote_pic_sftp'),10);
|
35 |
-
add_filter('wpvivid_get_out_of_date_remote',array($this,'wpvivid_get_out_of_date_sftp'),10,2);
|
36 |
-
add_filter('wpvivid_storage_provider_tran',array($this,'wpvivid_storage_provider_sftp'),10);
|
37 |
-
}
|
38 |
-
|
39 |
public function wpvivid_add_storage_tab_sftp()
|
40 |
{
|
41 |
?>
|
18 |
{
|
19 |
if(empty($options))
|
20 |
{
|
21 |
+
add_action('wpvivid_add_storage_tab',array($this,'wpvivid_add_storage_tab_sftp'), 16);
|
22 |
+
add_action('wpvivid_add_storage_page',array($this,'wpvivid_add_storage_page_sftp'), 16);
|
23 |
+
add_action('wpvivid_edit_remote_page',array($this,'wpvivid_edit_storage_page_sftp'), 16);
|
24 |
+
add_filter('wpvivid_remote_pic',array($this,'wpvivid_remote_pic_sftp'),10);
|
25 |
+
add_filter('wpvivid_get_out_of_date_remote',array($this,'wpvivid_get_out_of_date_sftp'),10,2);
|
26 |
+
add_filter('wpvivid_storage_provider_tran',array($this,'wpvivid_storage_provider_sftp'),10);
|
27 |
}
|
28 |
else
|
29 |
{
|
31 |
}
|
32 |
}
|
33 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
34 |
public function wpvivid_add_storage_tab_sftp()
|
35 |
{
|
36 |
?>
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Tags: move, clone, migrate, copy, backup, restore, auto backup, cloud backup
|
|
4 |
Requires at least: 4.5
|
5 |
Tested up to: 5.2
|
6 |
Requires PHP: 5.3
|
7 |
-
Stable tag: 0.9.
|
8 |
License: GPLv3 or later
|
9 |
License URI: https://www.gnu.org/licenses/gpl-3.0.en.html
|
10 |
|
@@ -146,6 +146,12 @@ Yes, we do. Here are the guides for [copying your site to a new host](https://wp
|
|
146 |
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).
|
147 |
|
148 |
== Changelog ==
|
|
|
|
|
|
|
|
|
|
|
|
|
149 |
= 0.9.23 =
|
150 |
- Added an option to hide the plugin menu on the top admin bar.
|
151 |
- Fixed: Always sent email notifications even the Only send an email notification when a backup fails option was selected.
|
4 |
Requires at least: 4.5
|
5 |
Tested up to: 5.2
|
6 |
Requires PHP: 5.3
|
7 |
+
Stable tag: 0.9.24
|
8 |
License: GPLv3 or later
|
9 |
License URI: https://www.gnu.org/licenses/gpl-3.0.en.html
|
10 |
|
146 |
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).
|
147 |
|
148 |
== Changelog ==
|
149 |
+
= 0.9.24 =
|
150 |
+
- Fixed some bugs in the plugin code.
|
151 |
+
- Fixed: Could not restore files to proper directories if one had customized the sites file structure.
|
152 |
+
- Fixed: The page could not properly display when one chose Remote Storage option from the admin sidebar menu.
|
153 |
+
- Optimized backup process, now it saves more disk space.
|
154 |
+
- Optimized the plugin code.
|
155 |
= 0.9.23 =
|
156 |
- Added an option to hide the plugin menu on the top admin bar.
|
157 |
- Fixed: Always sent email notifications even the Only send an email notification when a backup fails option was selected.
|
wpvivid-backuprestore.php
CHANGED
@@ -7,7 +7,7 @@
|
|
7 |
* @wordpress-plugin
|
8 |
* Plugin Name: WPvivid Backup Plugin
|
9 |
* Description: Clone or copy WP sites then move or migrate them to new host (new domain), schedule backups, transfer backups to leading remote storage. All in one.
|
10 |
-
* Version: 0.9.
|
11 |
* Author: WPvivid Team
|
12 |
* Author URI: https://wpvivid.com
|
13 |
* License: GPL-3.0+
|
@@ -21,7 +21,7 @@ if ( ! defined( 'WPINC' ) ) {
|
|
21 |
die;
|
22 |
}
|
23 |
|
24 |
-
define( 'WPVIVID_PLUGIN_VERSION', '0.9.
|
25 |
//
|
26 |
define('WPVIVID_RESTORE_INIT','init');
|
27 |
define('WPVIVID_RESTORE_READY','ready');
|
7 |
* @wordpress-plugin
|
8 |
* Plugin Name: WPvivid Backup Plugin
|
9 |
* Description: Clone or copy WP sites then move or migrate them to new host (new domain), schedule backups, transfer backups to leading remote storage. All in one.
|
10 |
+
* Version: 0.9.24
|
11 |
* Author: WPvivid Team
|
12 |
* Author URI: https://wpvivid.com
|
13 |
* License: GPL-3.0+
|
21 |
die;
|
22 |
}
|
23 |
|
24 |
+
define( 'WPVIVID_PLUGIN_VERSION', '0.9.24' );
|
25 |
//
|
26 |
define('WPVIVID_RESTORE_INIT','init');
|
27 |
define('WPVIVID_RESTORE_READY','ready');
|