Version Description
- Added support for Dropbox's new API.
- Fixed: some images used in Elementor would be scanned as 'unused'.
- Fixed some bugs in the plugin code.
- Optimized the plugin code.
Download this release
Release Info
Developer | wpvivid |
Plugin | Migration, Backup, Staging – WPvivid |
Version | 0.9.63 |
Comparing to | |
See all releases |
Code changes from version 0.9.62 to 0.9.63
- admin/class-wpvivid-admin.php +71 -0
- admin/partials/wpvivid-backup-restore-page-display.php +0 -9
- includes/class-wpvivid-backup-uploader.php +1 -1
- includes/class-wpvivid-backup.php +6 -1
- includes/customclass/class-wpvivid-base-dropbox.php +135 -8
- includes/customclass/class-wpvivid-dropbox.php +54 -12
- includes/staging/class-wpvivid-staging.php +2 -2
- includes/upload-cleaner/class-wpvivid-uploads-cleaner.php +2 -2
- includes/upload-cleaner/class-wpvivid-uploads-scanner.php +15 -0
- readme.txt +9 -4
- wpvivid-backuprestore.php +2 -2
admin/class-wpvivid-admin.php
CHANGED
@@ -66,6 +66,7 @@ class WPvivid_Admin {
|
|
66 |
add_action('wpvivid_before_setup_page',array($this,'show_add_my_review'));
|
67 |
add_action('wpvivid_before_setup_page',array($this,'check_extensions'));
|
68 |
add_action('wpvivid_before_setup_page',array($this,'check_amazons3'));
|
|
|
69 |
add_action('wpvivid_before_setup_page',array($this,'init_js_var'));
|
70 |
|
71 |
add_filter('wpvivid_add_log_tab_page', array($this, 'add_log_tab_page'), 10);
|
@@ -545,6 +546,76 @@ class WPvivid_Admin {
|
|
545 |
}
|
546 |
}
|
547 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
548 |
public function check_extensions()
|
549 |
{
|
550 |
$common_setting = WPvivid_Setting::get_setting(false, 'wpvivid_common_setting');
|
66 |
add_action('wpvivid_before_setup_page',array($this,'show_add_my_review'));
|
67 |
add_action('wpvivid_before_setup_page',array($this,'check_extensions'));
|
68 |
add_action('wpvivid_before_setup_page',array($this,'check_amazons3'));
|
69 |
+
add_action('wpvivid_before_setup_page',array($this,'check_dropbox'));
|
70 |
add_action('wpvivid_before_setup_page',array($this,'init_js_var'));
|
71 |
|
72 |
add_filter('wpvivid_add_log_tab_page', array($this, 'add_log_tab_page'), 10);
|
546 |
}
|
547 |
}
|
548 |
|
549 |
+
public function check_dropbox()
|
550 |
+
{
|
551 |
+
if (is_multisite())
|
552 |
+
{
|
553 |
+
if(!is_network_admin())
|
554 |
+
{
|
555 |
+
return ;
|
556 |
+
}
|
557 |
+
}
|
558 |
+
|
559 |
+
if(!function_exists('get_plugins'))
|
560 |
+
require_once(ABSPATH . 'wp-admin/includes/plugin.php');
|
561 |
+
$pro_wpvivid_slug='wpvivid-backup-pro/wpvivid-backup-pro.php';
|
562 |
+
if (is_multisite())
|
563 |
+
{
|
564 |
+
$active_plugins = array();
|
565 |
+
//network active
|
566 |
+
$mu_active_plugins = get_site_option( 'active_sitewide_plugins', array() );
|
567 |
+
if(!empty($mu_active_plugins)){
|
568 |
+
foreach ($mu_active_plugins as $plugin_name => $data){
|
569 |
+
$active_plugins[] = $plugin_name;
|
570 |
+
}
|
571 |
+
}
|
572 |
+
$plugins=get_mu_plugins();
|
573 |
+
if(count($plugins) == 0 || !isset($plugins[$pro_wpvivid_slug])){
|
574 |
+
$plugins=get_plugins();
|
575 |
+
}
|
576 |
+
}
|
577 |
+
else
|
578 |
+
{
|
579 |
+
$active_plugins = get_option('active_plugins');
|
580 |
+
$plugins=get_plugins();
|
581 |
+
}
|
582 |
+
|
583 |
+
if(!empty($plugins))
|
584 |
+
{
|
585 |
+
if(isset($plugins[$pro_wpvivid_slug]))
|
586 |
+
{
|
587 |
+
if(in_array($pro_wpvivid_slug, $active_plugins))
|
588 |
+
{
|
589 |
+
return;
|
590 |
+
}
|
591 |
+
}
|
592 |
+
|
593 |
+
$remoteslist=WPvivid_Setting::get_all_remote_options();
|
594 |
+
$need_dropbox_notice = false;
|
595 |
+
if(isset($remoteslist) && !empty($remoteslist))
|
596 |
+
{
|
597 |
+
foreach ($remoteslist as $remote_id => $value)
|
598 |
+
{
|
599 |
+
if($remote_id === 'remote_selected')
|
600 |
+
{
|
601 |
+
continue;
|
602 |
+
}
|
603 |
+
if($value['type'] == 'dropbox' && !isset($value['refresh_token']))
|
604 |
+
{
|
605 |
+
$need_dropbox_notice = true;
|
606 |
+
}
|
607 |
+
}
|
608 |
+
}
|
609 |
+
if($need_dropbox_notice)
|
610 |
+
{
|
611 |
+
$notice_message = __('Because Dropbox has upgraded their API on September 30, 2021, the new API is no longer compatible with the previous app\'s settings. Please re-add your Dropbox storage to ensure that it works properly.', 'wpvivid-backuprestore');
|
612 |
+
echo '<div class="notice notice-warning">
|
613 |
+
<p>' . $notice_message . '</p>
|
614 |
+
</div>';
|
615 |
+
}
|
616 |
+
}
|
617 |
+
}
|
618 |
+
|
619 |
public function check_extensions()
|
620 |
{
|
621 |
$common_setting = WPvivid_Setting::get_setting(false, 'wpvivid_common_setting');
|
admin/partials/wpvivid-backup-restore-page-display.php
CHANGED
@@ -399,15 +399,6 @@ function wpvivid_add_backup_type($html, $type_name)
|
|
399 |
<input type="radio" option="backup" name="'.$type_name.'" value="db" />
|
400 |
<span>'.__( 'Only Database', 'wpvivid-backuprestore' ).'</span>
|
401 |
</label><br>
|
402 |
-
<label>
|
403 |
-
<div style="float: left;">
|
404 |
-
<input type="radio" disabled />
|
405 |
-
<span class="wpvivid-element-space-right" style="color: #ddd;">'.__('Create a staging site', 'wpvivid-backuprestore').'</span>
|
406 |
-
</div>
|
407 |
-
<span class="wpvivid-feature-pro">
|
408 |
-
<a href="https://docs.wpvivid.com/wpvivid-backup-pro-create-staging-site.html" style="text-decoration: none;">'.__('Pro feature: learn more', 'wpvivid-backuprestore').'</a>
|
409 |
-
</span>
|
410 |
-
</label><br>
|
411 |
<label>
|
412 |
<div style="float: left;">
|
413 |
<input type="radio" disabled />
|
399 |
<input type="radio" option="backup" name="'.$type_name.'" value="db" />
|
400 |
<span>'.__( 'Only Database', 'wpvivid-backuprestore' ).'</span>
|
401 |
</label><br>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
402 |
<label>
|
403 |
<div style="float: left;">
|
404 |
<input type="radio" disabled />
|
includes/class-wpvivid-backup-uploader.php
CHANGED
@@ -748,7 +748,7 @@ class Wpvivid_BackupUploader
|
|
748 |
wpvivid_post_request(ajax_data, function (data)
|
749 |
{
|
750 |
var backuplist_count = data;
|
751 |
-
if(backuplist_count >= backup_max_count){
|
752 |
alert("The backup retention limit for localhost(web server) is reached, please either increase the retention from WPvivid General Settings, or manually delete some old backups.");
|
753 |
}
|
754 |
else {
|
748 |
wpvivid_post_request(ajax_data, function (data)
|
749 |
{
|
750 |
var backuplist_count = data;
|
751 |
+
if(parseInt(backuplist_count) >= parseInt(backup_max_count)){
|
752 |
alert("The backup retention limit for localhost(web server) is reached, please either increase the retention from WPvivid General Settings, or manually delete some old backups.");
|
753 |
}
|
754 |
else {
|
includes/class-wpvivid-backup.php
CHANGED
@@ -321,7 +321,12 @@ class WPvivid_Backup_Task
|
|
321 |
protected function parse_url_all($url)
|
322 |
{
|
323 |
$parse = parse_url($url);
|
324 |
-
|
|
|
|
|
|
|
|
|
|
|
325 |
return $parse['host'].$path;
|
326 |
}
|
327 |
|
321 |
protected function parse_url_all($url)
|
322 |
{
|
323 |
$parse = parse_url($url);
|
324 |
+
//$path=str_replace('/','_',$parse['path']);
|
325 |
+
$path = '';
|
326 |
+
if(isset($parse['path'])) {
|
327 |
+
$parse['path'] = str_replace('/', '_', $parse['path']);
|
328 |
+
$path = $parse['path'];
|
329 |
+
}
|
330 |
return $parse['host'].$path;
|
331 |
}
|
332 |
|
includes/customclass/class-wpvivid-base-dropbox.php
CHANGED
@@ -10,14 +10,59 @@ class Dropbox_Base{
|
|
10 |
const API_ID = 'cwn4z5jg8wy7b4u';
|
11 |
|
12 |
private $access_token;
|
|
|
|
|
|
|
13 |
private $option;
|
14 |
|
15 |
-
public function __construct($option)
|
|
|
16 |
$this -> option = $option;
|
17 |
-
$this -> access_token = $option['
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
18 |
}
|
19 |
|
20 |
-
public function upload($target_path, $file_data, $mode = "add")
|
|
|
21 |
$endpoint = self::CONTENT_URL_V2."files/upload";
|
22 |
$headers = array(
|
23 |
"Content-Type: application/octet-stream",
|
@@ -33,7 +78,8 @@ class Dropbox_Base{
|
|
33 |
return $returnData;
|
34 |
}
|
35 |
|
36 |
-
public function upload_session_start()
|
|
|
37 |
$endpoint = self::CONTENT_URL_V2."files/upload_session/start";
|
38 |
$headers = array(
|
39 |
"Content-Type: application/octet-stream",
|
@@ -114,11 +160,13 @@ class Dropbox_Base{
|
|
114 |
return $returnData;
|
115 |
}
|
116 |
|
117 |
-
public static function getUrl($url,$state = '')
|
|
|
118 |
$params = array(
|
119 |
'client_id' => self::API_ID,
|
120 |
'response_type' => 'code',
|
121 |
'redirect_uri' => $url,
|
|
|
122 |
'state' => $state,
|
123 |
);
|
124 |
$url = 'https://www.dropbox.com/oauth2/authorize?';
|
@@ -145,9 +193,45 @@ class Dropbox_Base{
|
|
145 |
if($r === false){
|
146 |
$r['error_summary'] = $error;
|
147 |
}else{
|
148 |
-
if($chinfo['http_code'] === 401)
|
149 |
-
|
150 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
151 |
}elseif($chinfo['http_code'] !== 200 && $chinfo['http_code'] !== 206){
|
152 |
$r = json_decode($r,true);
|
153 |
}
|
@@ -160,4 +244,47 @@ class Dropbox_Base{
|
|
160 |
public function setAccessToken($access_token){
|
161 |
$this -> access_token = $access_token;
|
162 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
163 |
}
|
10 |
const API_ID = 'cwn4z5jg8wy7b4u';
|
11 |
|
12 |
private $access_token;
|
13 |
+
private $created;
|
14 |
+
private $expires_in;
|
15 |
+
private $refresh_token;
|
16 |
private $option;
|
17 |
|
18 |
+
public function __construct($option)
|
19 |
+
{
|
20 |
$this -> option = $option;
|
21 |
+
$this -> access_token = $option['access_token'];
|
22 |
+
|
23 |
+
$this -> created = $option['created'];
|
24 |
+
$this -> expires_in = $option['expires_in'];
|
25 |
+
$this -> refresh_token = $option['refresh_token'];
|
26 |
+
}
|
27 |
+
|
28 |
+
public function check_token()
|
29 |
+
{
|
30 |
+
if(!isset($this->option['refresh_token']))
|
31 |
+
{
|
32 |
+
return array('result' => WPVIVID_FAILED,'error' => 'Invalid or expired token. Please remove '.$this -> option['name'].' from the storage list and re-authenticate it.');
|
33 |
+
}
|
34 |
+
$now=time()-10;
|
35 |
+
if ($now>$this->option['created']+$this->option['expires_in'])
|
36 |
+
{
|
37 |
+
$result=$this->getRefreshToken();
|
38 |
+
if($result['result']=='failed')
|
39 |
+
{
|
40 |
+
return array('result' => WPVIVID_FAILED,'error' => $result['error']);
|
41 |
+
}
|
42 |
+
else
|
43 |
+
{
|
44 |
+
$this->option['access_token']= $result['data']['access_token'];
|
45 |
+
$this->option['expires_in'] = $result['data']['expires_in'];
|
46 |
+
$this->option['created'] = time();
|
47 |
+
WPvivid_Setting::update_remote_option($this->option['id'],$this->option);
|
48 |
+
$this -> access_token = $this->option['access_token'];
|
49 |
+
$this -> created = $this->option['created'];
|
50 |
+
$this -> expires_in = $this->option['expires_in'];
|
51 |
+
$this -> refresh_token = $this->option['refresh_token'];
|
52 |
+
|
53 |
+
$ret['result']='success';
|
54 |
+
return $ret;
|
55 |
+
}
|
56 |
+
}
|
57 |
+
else
|
58 |
+
{
|
59 |
+
$ret['result']='success';
|
60 |
+
return $ret;
|
61 |
+
}
|
62 |
}
|
63 |
|
64 |
+
public function upload($target_path, $file_data, $mode = "add")
|
65 |
+
{
|
66 |
$endpoint = self::CONTENT_URL_V2."files/upload";
|
67 |
$headers = array(
|
68 |
"Content-Type: application/octet-stream",
|
78 |
return $returnData;
|
79 |
}
|
80 |
|
81 |
+
public function upload_session_start()
|
82 |
+
{
|
83 |
$endpoint = self::CONTENT_URL_V2."files/upload_session/start";
|
84 |
$headers = array(
|
85 |
"Content-Type: application/octet-stream",
|
160 |
return $returnData;
|
161 |
}
|
162 |
|
163 |
+
public static function getUrl($url,$state = '')
|
164 |
+
{
|
165 |
$params = array(
|
166 |
'client_id' => self::API_ID,
|
167 |
'response_type' => 'code',
|
168 |
'redirect_uri' => $url,
|
169 |
+
'token_access_type'=>'offline',
|
170 |
'state' => $state,
|
171 |
);
|
172 |
$url = 'https://www.dropbox.com/oauth2/authorize?';
|
193 |
if($r === false){
|
194 |
$r['error_summary'] = $error;
|
195 |
}else{
|
196 |
+
if($chinfo['http_code'] === 401)
|
197 |
+
{
|
198 |
+
$ret=$this->check_token();
|
199 |
+
if($ret['result']=='success')
|
200 |
+
{
|
201 |
+
$ch = curl_init($endpoint);
|
202 |
+
array_push($headers, "Authorization: Bearer " . $this -> access_token);
|
203 |
+
|
204 |
+
curl_setopt($ch, CURLOPT_POST, TRUE);
|
205 |
+
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
206 |
+
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
|
207 |
+
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
|
208 |
+
$r = curl_exec($ch);
|
209 |
+
$chinfo = curl_getinfo($ch);
|
210 |
+
$error = curl_error($ch);
|
211 |
+
curl_close($ch);
|
212 |
+
if($r === false)
|
213 |
+
{
|
214 |
+
$r['error_summary'] = $error;
|
215 |
+
}
|
216 |
+
else
|
217 |
+
{
|
218 |
+
if($chinfo['http_code'] === 401)
|
219 |
+
{
|
220 |
+
$r = array();
|
221 |
+
$r['error_summary'] = 'Invalid or expired token. Please remove '.$this -> option['name'].' from the storage list and re-authenticate it.';
|
222 |
+
}
|
223 |
+
elseif($chinfo['http_code'] !== 200 && $chinfo['http_code'] !== 206)
|
224 |
+
{
|
225 |
+
$r = json_decode($r,true);
|
226 |
+
}
|
227 |
+
}
|
228 |
+
}
|
229 |
+
else
|
230 |
+
{
|
231 |
+
$r = array();
|
232 |
+
$r['error_summary'] = 'Invalid or expired token. Please remove '.$this -> option['name'].' from the storage list and re-authenticate it.';
|
233 |
+
}
|
234 |
+
|
235 |
}elseif($chinfo['http_code'] !== 200 && $chinfo['http_code'] !== 206){
|
236 |
$r = json_decode($r,true);
|
237 |
}
|
244 |
public function setAccessToken($access_token){
|
245 |
$this -> access_token = $access_token;
|
246 |
}
|
247 |
+
|
248 |
+
public function getRefreshToken()
|
249 |
+
{
|
250 |
+
$options=array();
|
251 |
+
$options['timeout']=30;
|
252 |
+
|
253 |
+
$params = array(
|
254 |
+
'client_id' => self::API_ID,
|
255 |
+
'refresh_token' => $this -> refresh_token,
|
256 |
+
'version'=>1
|
257 |
+
);
|
258 |
+
$url = 'https://auth.wpvivid.com/dropbox_v3/?';
|
259 |
+
$url .= http_build_query($params,'','&');
|
260 |
+
|
261 |
+
$request = wp_remote_request( $url,$options);
|
262 |
+
|
263 |
+
if(!is_wp_error($request) && ($request['response']['code'] == 200))
|
264 |
+
{
|
265 |
+
$json= wp_remote_retrieve_body($request);
|
266 |
+
$body=json_decode($json,true);
|
267 |
+
if(is_null($body))
|
268 |
+
{
|
269 |
+
$ret['result']='failed';
|
270 |
+
$ret['error']='Get refresh token failed';
|
271 |
+
return $ret;
|
272 |
+
}
|
273 |
+
|
274 |
+
if($body['result']=='success')
|
275 |
+
{
|
276 |
+
return $body;
|
277 |
+
}
|
278 |
+
else
|
279 |
+
{
|
280 |
+
return $body;
|
281 |
+
}
|
282 |
+
}
|
283 |
+
else
|
284 |
+
{
|
285 |
+
$ret['result']='failed';
|
286 |
+
$ret['error']='Get refresh token failed';
|
287 |
+
return $ret;
|
288 |
+
}
|
289 |
+
}
|
290 |
}
|
includes/customclass/class-wpvivid-dropbox.php
CHANGED
@@ -10,16 +10,19 @@ if(!defined('WPVIVID_DROPBOX_DEFAULT_FOLDER'))
|
|
10 |
define('WPVIVID_DROPBOX_DEFAULT_FOLDER','/');
|
11 |
require_once WPVIVID_PLUGIN_DIR . '/includes/customclass/class-wpvivid-base-dropbox.php';
|
12 |
require_once WPVIVID_PLUGIN_DIR . '/includes/customclass/class-wpvivid-remote.php';
|
13 |
-
class WPvivid_Dropbox extends WPvivid_Remote
|
|
|
14 |
|
15 |
private $options;
|
16 |
private $upload_chunk_size = 2097152;
|
17 |
private $download_chunk_size = 2097152;
|
18 |
-
private $redirect_url = 'https://auth.wpvivid.com/
|
19 |
public function __construct($options = array())
|
20 |
{
|
21 |
-
if(empty($options))
|
22 |
-
|
|
|
|
|
23 |
add_action('init', array($this, 'handle_auth_actions'));
|
24 |
add_action('wpvivid_delete_remote_token',array($this,'revoke'));
|
25 |
|
@@ -31,7 +34,7 @@ class WPvivid_Dropbox extends WPvivid_Remote {
|
|
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{
|
@@ -39,6 +42,16 @@ class WPvivid_Dropbox extends WPvivid_Remote {
|
|
39 |
}
|
40 |
}
|
41 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
42 |
public function test_connect()
|
43 |
{
|
44 |
return array('result' => WPVIVID_SUCCESS);
|
@@ -82,6 +95,11 @@ class WPvivid_Dropbox extends WPvivid_Remote {
|
|
82 |
|
83 |
$options = $this -> options;
|
84 |
$dropbox = new Dropbox_Base($options);
|
|
|
|
|
|
|
|
|
|
|
85 |
$upload_job=WPvivid_taskmanager::get_backup_sub_task_progress($task_id,'upload',WPVIVID_REMOTE_DROPBOX);
|
86 |
if(empty($upload_job))
|
87 |
{
|
@@ -96,12 +114,18 @@ class WPvivid_Dropbox extends WPvivid_Remote {
|
|
96 |
$upload_job=WPvivid_taskmanager::get_backup_sub_task_progress($task_id,'upload',WPVIVID_REMOTE_DROPBOX);
|
97 |
}
|
98 |
|
99 |
-
foreach ($files as $file)
|
|
|
100 |
if(is_array($upload_job['job_data']) &&array_key_exists(basename($file),$upload_job['job_data']))
|
101 |
{
|
102 |
if($upload_job['job_data'][basename($file)]['uploaded']==1)
|
103 |
continue;
|
104 |
}
|
|
|
|
|
|
|
|
|
|
|
105 |
|
106 |
$this -> last_time = time();
|
107 |
$this -> last_size = 0;
|
@@ -221,7 +245,11 @@ class WPvivid_Dropbox extends WPvivid_Remote {
|
|
221 |
$this->current_file_size = $file['size'];
|
222 |
$options = $this->options;
|
223 |
$dropbox = new Dropbox_Base($options);
|
224 |
-
|
|
|
|
|
|
|
|
|
225 |
$file_path = trailingslashit($local_path) . $this->current_file_name;
|
226 |
$start_offset = file_exists($file_path) ? filesize($file_path) : 0;
|
227 |
$wpvivid_plugin->wpvivid_download_log->WriteLog('Create local file.','notice');
|
@@ -281,6 +309,11 @@ class WPvivid_Dropbox extends WPvivid_Remote {
|
|
281 |
{
|
282 |
$options = $this -> options;
|
283 |
$dropbox = new Dropbox_Base($options);
|
|
|
|
|
|
|
|
|
|
|
284 |
foreach ($files as $file){
|
285 |
$dropbox -> delete(trailingslashit($options['path']).$file);
|
286 |
}
|
@@ -299,7 +332,8 @@ class WPvivid_Dropbox extends WPvivid_Remote {
|
|
299 |
if($_GET['action'] === 'wpvivid_dropbox_auth')
|
300 |
{
|
301 |
try {
|
302 |
-
if (!isset($_GET['name']) || empty($_GET['name']))
|
|
|
303 |
echo '<div class="notice notice-warning is-dismissible"><p>'.__('Warning: An alias for remote storage is required.', 'wpvivid-backuprestore').'</p></div>';
|
304 |
return;
|
305 |
}
|
@@ -307,8 +341,10 @@ class WPvivid_Dropbox extends WPvivid_Remote {
|
|
307 |
$_GET['name'] = sanitize_text_field($_GET['name']);
|
308 |
|
309 |
$remoteslist = WPvivid_Setting::get_all_remote_options();
|
310 |
-
foreach ($remoteslist as $key => $value)
|
311 |
-
|
|
|
|
|
312 |
echo '<div class="notice notice-warning is-dismissible"><p>'.__('Warning: The alias already exists in storage list.', 'wpvivid-backuprestore').'</p></div>';
|
313 |
return;
|
314 |
}
|
@@ -337,7 +373,10 @@ class WPvivid_Dropbox extends WPvivid_Remote {
|
|
337 |
} else {
|
338 |
global $wpvivid_plugin;
|
339 |
$remote_options['type'] = WPVIVID_REMOTE_DROPBOX;
|
340 |
-
$remote_options['
|
|
|
|
|
|
|
341 |
$remote_options['name'] = $_GET['name'];
|
342 |
$remote_options['path'] = WPVIVID_DROPBOX_DEFAULT_FOLDER;
|
343 |
$remote_options['default'] = $_GET['bdefault'];
|
@@ -411,7 +450,10 @@ class WPvivid_Dropbox extends WPvivid_Remote {
|
|
411 |
} else {
|
412 |
global $wpvivid_plugin;
|
413 |
$remote_options['type'] = WPVIVID_REMOTE_DROPBOX;
|
414 |
-
$remote_options['
|
|
|
|
|
|
|
415 |
$remote_options['name'] = $_GET['name'];
|
416 |
$remote_options['path'] = WPVIVID_DROPBOX_DEFAULT_FOLDER;
|
417 |
$remote_options['auth_id'] = $_GET['auth_id'];
|
10 |
define('WPVIVID_DROPBOX_DEFAULT_FOLDER','/');
|
11 |
require_once WPVIVID_PLUGIN_DIR . '/includes/customclass/class-wpvivid-base-dropbox.php';
|
12 |
require_once WPVIVID_PLUGIN_DIR . '/includes/customclass/class-wpvivid-remote.php';
|
13 |
+
class WPvivid_Dropbox extends WPvivid_Remote
|
14 |
+
{
|
15 |
|
16 |
private $options;
|
17 |
private $upload_chunk_size = 2097152;
|
18 |
private $download_chunk_size = 2097152;
|
19 |
+
private $redirect_url = 'https://auth.wpvivid.com/dropbox_v3/';
|
20 |
public function __construct($options = array())
|
21 |
{
|
22 |
+
if(empty($options))
|
23 |
+
{
|
24 |
+
if(!defined('WPVIVID_INIT_STORAGE_TAB_DROPBOX'))
|
25 |
+
{
|
26 |
add_action('init', array($this, 'handle_auth_actions'));
|
27 |
add_action('wpvivid_delete_remote_token',array($this,'revoke'));
|
28 |
|
34 |
add_filter('wpvivid_get_out_of_date_remote',array($this,'wpvivid_get_out_of_date_dropbox'),10,2);
|
35 |
add_filter('wpvivid_storage_provider_tran',array($this,'wpvivid_storage_provider_dropbox'),10);
|
36 |
add_filter('wpvivid_get_root_path',array($this,'wpvivid_get_root_path_dropbox'),10);
|
37 |
+
add_filter('wpvivid_pre_add_remote',array($this, 'pre_add_remote'),10,2);
|
38 |
define('WPVIVID_INIT_STORAGE_TAB_DROPBOX',1);
|
39 |
}
|
40 |
}else{
|
42 |
}
|
43 |
}
|
44 |
|
45 |
+
public function pre_add_remote($remote,$id)
|
46 |
+
{
|
47 |
+
if($remote['type']==WPVIVID_REMOTE_DROPBOX)
|
48 |
+
{
|
49 |
+
$remote['id']=$id;
|
50 |
+
}
|
51 |
+
|
52 |
+
return $remote;
|
53 |
+
}
|
54 |
+
|
55 |
public function test_connect()
|
56 |
{
|
57 |
return array('result' => WPVIVID_SUCCESS);
|
95 |
|
96 |
$options = $this -> options;
|
97 |
$dropbox = new Dropbox_Base($options);
|
98 |
+
$ret=$dropbox->check_token();
|
99 |
+
if($ret['result']=='failed')
|
100 |
+
{
|
101 |
+
return $ret;
|
102 |
+
}
|
103 |
$upload_job=WPvivid_taskmanager::get_backup_sub_task_progress($task_id,'upload',WPVIVID_REMOTE_DROPBOX);
|
104 |
if(empty($upload_job))
|
105 |
{
|
114 |
$upload_job=WPvivid_taskmanager::get_backup_sub_task_progress($task_id,'upload',WPVIVID_REMOTE_DROPBOX);
|
115 |
}
|
116 |
|
117 |
+
foreach ($files as $file)
|
118 |
+
{
|
119 |
if(is_array($upload_job['job_data']) &&array_key_exists(basename($file),$upload_job['job_data']))
|
120 |
{
|
121 |
if($upload_job['job_data'][basename($file)]['uploaded']==1)
|
122 |
continue;
|
123 |
}
|
124 |
+
$ret=$dropbox->check_token();
|
125 |
+
if($ret['result']=='failed')
|
126 |
+
{
|
127 |
+
return $ret;
|
128 |
+
}
|
129 |
|
130 |
$this -> last_time = time();
|
131 |
$this -> last_size = 0;
|
245 |
$this->current_file_size = $file['size'];
|
246 |
$options = $this->options;
|
247 |
$dropbox = new Dropbox_Base($options);
|
248 |
+
$ret=$dropbox->check_token();
|
249 |
+
if($ret['result']=='failed')
|
250 |
+
{
|
251 |
+
return $ret;
|
252 |
+
}
|
253 |
$file_path = trailingslashit($local_path) . $this->current_file_name;
|
254 |
$start_offset = file_exists($file_path) ? filesize($file_path) : 0;
|
255 |
$wpvivid_plugin->wpvivid_download_log->WriteLog('Create local file.','notice');
|
309 |
{
|
310 |
$options = $this -> options;
|
311 |
$dropbox = new Dropbox_Base($options);
|
312 |
+
$ret=$dropbox->check_token();
|
313 |
+
if($ret['result']=='failed')
|
314 |
+
{
|
315 |
+
return $ret;
|
316 |
+
}
|
317 |
foreach ($files as $file){
|
318 |
$dropbox -> delete(trailingslashit($options['path']).$file);
|
319 |
}
|
332 |
if($_GET['action'] === 'wpvivid_dropbox_auth')
|
333 |
{
|
334 |
try {
|
335 |
+
if (!isset($_GET['name']) || empty($_GET['name']))
|
336 |
+
{
|
337 |
echo '<div class="notice notice-warning is-dismissible"><p>'.__('Warning: An alias for remote storage is required.', 'wpvivid-backuprestore').'</p></div>';
|
338 |
return;
|
339 |
}
|
341 |
$_GET['name'] = sanitize_text_field($_GET['name']);
|
342 |
|
343 |
$remoteslist = WPvivid_Setting::get_all_remote_options();
|
344 |
+
foreach ($remoteslist as $key => $value)
|
345 |
+
{
|
346 |
+
if (isset($value['name']) && $value['name'] == $_GET['name'])
|
347 |
+
{
|
348 |
echo '<div class="notice notice-warning is-dismissible"><p>'.__('Warning: The alias already exists in storage list.', 'wpvivid-backuprestore').'</p></div>';
|
349 |
return;
|
350 |
}
|
373 |
} else {
|
374 |
global $wpvivid_plugin;
|
375 |
$remote_options['type'] = WPVIVID_REMOTE_DROPBOX;
|
376 |
+
$remote_options['access_token']= $_POST['code'];
|
377 |
+
$remote_options['expires_in'] = $_POST['expires_in'];
|
378 |
+
$remote_options['refresh_token'] = $_POST['refresh_token'];
|
379 |
+
$remote_options['created']=time();
|
380 |
$remote_options['name'] = $_GET['name'];
|
381 |
$remote_options['path'] = WPVIVID_DROPBOX_DEFAULT_FOLDER;
|
382 |
$remote_options['default'] = $_GET['bdefault'];
|
450 |
} else {
|
451 |
global $wpvivid_plugin;
|
452 |
$remote_options['type'] = WPVIVID_REMOTE_DROPBOX;
|
453 |
+
$remote_options['access_token']= $_POST['code'];
|
454 |
+
$remote_options['expires_in'] = $_POST['expires_in'];
|
455 |
+
$remote_options['refresh_token'] = $_POST['refresh_token'];
|
456 |
+
$remote_options['created']=time();
|
457 |
$remote_options['name'] = $_GET['name'];
|
458 |
$remote_options['path'] = WPVIVID_DROPBOX_DEFAULT_FOLDER;
|
459 |
$remote_options['auth_id'] = $_GET['auth_id'];
|
includes/staging/class-wpvivid-staging.php
CHANGED
@@ -218,7 +218,7 @@ class WPvivid_Staging_Free
|
|
218 |
$menu['tab']= 'admin.php?page='.apply_filters('wpvivid_white_label_plugin_name', 'wpvivid-staging');
|
219 |
$menu['href']=$admin_url . 'admin.php?page='.apply_filters('wpvivid_white_label_plugin_name', 'wpvivid-staging');
|
220 |
$menu['capability']='administrator';
|
221 |
-
$menu['index']=
|
222 |
$toolbar_menus[$menu['parent']]['child'][$menu['id']]=$menu;
|
223 |
return $toolbar_menus;
|
224 |
}
|
@@ -230,7 +230,7 @@ class WPvivid_Staging_Free
|
|
230 |
$submenu['menu_title']=__('Staging', 'wpvivid-backuprestore');
|
231 |
$submenu['capability']='administrator';
|
232 |
$submenu['menu_slug']=strtolower(sprintf('%s-staging', apply_filters('wpvivid_white_label_slug', 'wpvivid')));
|
233 |
-
$submenu['index']=
|
234 |
$submenu['function']=array($this, 'display_plugin_setup_page');
|
235 |
$submenus[$submenu['menu_slug']]=$submenu;
|
236 |
return $submenus;
|
218 |
$menu['tab']= 'admin.php?page='.apply_filters('wpvivid_white_label_plugin_name', 'wpvivid-staging');
|
219 |
$menu['href']=$admin_url . 'admin.php?page='.apply_filters('wpvivid_white_label_plugin_name', 'wpvivid-staging');
|
220 |
$menu['capability']='administrator';
|
221 |
+
$menu['index']=2;
|
222 |
$toolbar_menus[$menu['parent']]['child'][$menu['id']]=$menu;
|
223 |
return $toolbar_menus;
|
224 |
}
|
230 |
$submenu['menu_title']=__('Staging', 'wpvivid-backuprestore');
|
231 |
$submenu['capability']='administrator';
|
232 |
$submenu['menu_slug']=strtolower(sprintf('%s-staging', apply_filters('wpvivid_white_label_slug', 'wpvivid')));
|
233 |
+
$submenu['index']=2;
|
234 |
$submenu['function']=array($this, 'display_plugin_setup_page');
|
235 |
$submenus[$submenu['menu_slug']]=$submenu;
|
236 |
return $submenus;
|
includes/upload-cleaner/class-wpvivid-uploads-cleaner.php
CHANGED
@@ -1031,7 +1031,7 @@ class WPvivid_Uploads_Cleaner
|
|
1031 |
$menu['tab']= 'admin.php?page='.apply_filters('wpvivid_white_label_plugin_name', 'wpvivid-cleaner');
|
1032 |
$menu['href']=$admin_url . 'admin.php?page='.apply_filters('wpvivid_white_label_plugin_name', 'wpvivid-cleaner');
|
1033 |
$menu['capability']='administrator';
|
1034 |
-
$menu['index']=
|
1035 |
$toolbar_menus[$menu['parent']]['child'][$menu['id']]=$menu;
|
1036 |
return $toolbar_menus;
|
1037 |
}
|
@@ -1043,7 +1043,7 @@ class WPvivid_Uploads_Cleaner
|
|
1043 |
$submenu['menu_title']=__('Image Cleaner', 'wpvivid-backuprestore');
|
1044 |
$submenu['capability']='administrator';
|
1045 |
$submenu['menu_slug']=strtolower(sprintf('%s-cleaner', apply_filters('wpvivid_white_label_slug', 'wpvivid')));
|
1046 |
-
$submenu['index']=
|
1047 |
$submenu['function']=array($this, 'display');
|
1048 |
$submenus[$submenu['menu_slug']]=$submenu;
|
1049 |
return $submenus;
|
1031 |
$menu['tab']= 'admin.php?page='.apply_filters('wpvivid_white_label_plugin_name', 'wpvivid-cleaner');
|
1032 |
$menu['href']=$admin_url . 'admin.php?page='.apply_filters('wpvivid_white_label_plugin_name', 'wpvivid-cleaner');
|
1033 |
$menu['capability']='administrator';
|
1034 |
+
$menu['index']=4;
|
1035 |
$toolbar_menus[$menu['parent']]['child'][$menu['id']]=$menu;
|
1036 |
return $toolbar_menus;
|
1037 |
}
|
1043 |
$submenu['menu_title']=__('Image Cleaner', 'wpvivid-backuprestore');
|
1044 |
$submenu['capability']='administrator';
|
1045 |
$submenu['menu_slug']=strtolower(sprintf('%s-cleaner', apply_filters('wpvivid_white_label_slug', 'wpvivid')));
|
1046 |
+
$submenu['index']=4;
|
1047 |
$submenu['function']=array($this, 'display');
|
1048 |
$submenus[$submenu['menu_slug']]=$submenu;
|
1049 |
return $submenus;
|
includes/upload-cleaner/class-wpvivid-uploads-scanner.php
CHANGED
@@ -846,6 +846,21 @@ class WPvivid_Uploads_Scanner
|
|
846 |
}
|
847 |
|
848 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
849 |
}
|
850 |
|
851 |
if(!empty($element_data['elements']))
|
846 |
}
|
847 |
|
848 |
}
|
849 |
+
|
850 |
+
if(isset($settings['logo_items']))
|
851 |
+
{
|
852 |
+
foreach ($settings['logo_items'] as $item)
|
853 |
+
{
|
854 |
+
if(isset($item['logo_image']))
|
855 |
+
{
|
856 |
+
if(!in_array($item['logo_image']['id'],$attachment_added_ids))
|
857 |
+
{
|
858 |
+
$element_image[]=$item['logo_image']['id'];
|
859 |
+
$attachment_added_ids[]=$item['logo_image']['id'];
|
860 |
+
}
|
861 |
+
}
|
862 |
+
}
|
863 |
+
}
|
864 |
}
|
865 |
|
866 |
if(!empty($element_data['elements']))
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Tags: move, clone, migrate, staging, backup, restore, auto backup, cloud backup
|
|
4 |
Requires at least: 4.5
|
5 |
Tested up to: 5.8.1
|
6 |
Requires PHP: 5.3
|
7 |
-
Stable tag: 0.9.
|
8 |
License: GPLv3 or later
|
9 |
License URI: https://www.gnu.org/licenses/gpl-3.0.en.html
|
10 |
|
@@ -29,7 +29,7 @@ Click to download **[WPvivid Backup for MainWP](https://wordpress.org/plugins/wp
|
|
29 |
* Incremental backups
|
30 |
* Database backups encryption
|
31 |
* Auto backup WordPress core, themes, and plugins
|
32 |
-
* Unused images cleaner
|
33 |
* WordPress Multisite backup
|
34 |
* Create a staging for a WordPress MU
|
35 |
* Create a fresh WP install
|
@@ -73,7 +73,7 @@ Set a schedule to run backups automatically on your website. You can set the bac
|
|
73 |
Send your backups offsite to a remote location. WPvivid Backup Plugin supports the leading cloud storage providers: Dropbox, Google Drive, Amazon S3, Microsoft OneDrive, DigitalOcean Spaces, FTP and SFTP.
|
74 |
= 6. One-Click Restore =
|
75 |
Restore your WordPress site from a backup with a single click.
|
76 |
-
= 7. Unused Images Cleaner
|
77 |
Scan your WP media library to find unused images, then you can choose to clean specific or all unused images.
|
78 |
|
79 |
== Cloud Storage Supported ==
|
@@ -85,7 +85,7 @@ The pro version also supports Wasabi, pCloud, Backblaze and more are coming soon
|
|
85 |
* One-Click Site Move or Migration
|
86 |
* Create A Staging Site
|
87 |
* Upload Backups to Restore or Migrate
|
88 |
-
* Unused Images Cleaner
|
89 |
* Schedule Automated Backups
|
90 |
* Restore A Backup with One Click
|
91 |
* Create A Manual Backup
|
@@ -192,6 +192,11 @@ Thank you for translating WPvivid Backup Plugin to your languages!
|
|
192 |
* [Nima](https://profiles.wordpress.org/nima78600/) (Persian)
|
193 |
|
194 |
== Changelog ==
|
|
|
|
|
|
|
|
|
|
|
195 |
= 0.9.62 =
|
196 |
- Added a check to the permissions of the staging folder before creating a staging site.
|
197 |
- Fixed some bugs in the plugin code.
|
4 |
Requires at least: 4.5
|
5 |
Tested up to: 5.8.1
|
6 |
Requires PHP: 5.3
|
7 |
+
Stable tag: 0.9.63
|
8 |
License: GPLv3 or later
|
9 |
License URI: https://www.gnu.org/licenses/gpl-3.0.en.html
|
10 |
|
29 |
* Incremental backups
|
30 |
* Database backups encryption
|
31 |
* Auto backup WordPress core, themes, and plugins
|
32 |
+
* Unused images cleaner
|
33 |
* WordPress Multisite backup
|
34 |
* Create a staging for a WordPress MU
|
35 |
* Create a fresh WP install
|
73 |
Send your backups offsite to a remote location. WPvivid Backup Plugin supports the leading cloud storage providers: Dropbox, Google Drive, Amazon S3, Microsoft OneDrive, DigitalOcean Spaces, FTP and SFTP.
|
74 |
= 6. One-Click Restore =
|
75 |
Restore your WordPress site from a backup with a single click.
|
76 |
+
= 7. Unused Images Cleaner =
|
77 |
Scan your WP media library to find unused images, then you can choose to clean specific or all unused images.
|
78 |
|
79 |
== Cloud Storage Supported ==
|
85 |
* One-Click Site Move or Migration
|
86 |
* Create A Staging Site
|
87 |
* Upload Backups to Restore or Migrate
|
88 |
+
* Unused Images Cleaner
|
89 |
* Schedule Automated Backups
|
90 |
* Restore A Backup with One Click
|
91 |
* Create A Manual Backup
|
192 |
* [Nima](https://profiles.wordpress.org/nima78600/) (Persian)
|
193 |
|
194 |
== Changelog ==
|
195 |
+
= 0.9.63 =
|
196 |
+
- Added support for Dropbox's new API.
|
197 |
+
- Fixed: some images used in Elementor would be scanned as 'unused'.
|
198 |
+
- Fixed some bugs in the plugin code.
|
199 |
+
- Optimized the plugin code.
|
200 |
= 0.9.62 =
|
201 |
- Added a check to the permissions of the staging folder before creating a staging site.
|
202 |
- Fixed some bugs in the plugin code.
|
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.63
|
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.63' );
|
25 |
//
|
26 |
define('WPVIVID_RESTORE_INIT','init');
|
27 |
define('WPVIVID_RESTORE_READY','ready');
|