Version Description
- Added support for migration of unconventional save of the media paths.
- 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.61 |
Comparing to | |
See all releases |
Code changes from version 0.9.60 to 0.9.61
- includes/class-wpvivid-backup.php +38 -9
- includes/class-wpvivid-downloader.php +3 -2
- includes/class-wpvivid-restore-data.php +3 -1
- includes/class-wpvivid-restore-database.php +3 -0
- includes/class-wpvivid-restore-site.php +4 -2
- includes/class-wpvivid-restore.php +3 -2
- includes/class-wpvivid-setting.php +2 -3
- includes/class-wpvivid.php +70 -6
- readme.txt +5 -1
- wpvivid-backuprestore.php +2 -2
includes/class-wpvivid-backup.php
CHANGED
@@ -1512,8 +1512,29 @@ class WPvivid_Backup_Item
|
|
1512 |
return $this->config['type'];
|
1513 |
}
|
1514 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1515 |
public function get_files($has_dir=true)
|
1516 |
{
|
|
|
1517 |
$files=array();
|
1518 |
if(isset($this->config['backup']['files']))
|
1519 |
{
|
@@ -1521,7 +1542,7 @@ class WPvivid_Backup_Item
|
|
1521 |
foreach ($this->config['backup']['files'] as $file)
|
1522 |
{
|
1523 |
if($has_dir)
|
1524 |
-
$files[]=$this->get_local_path().$file['file_name'];
|
1525 |
else
|
1526 |
$files[]=$file['file_name'];
|
1527 |
}
|
@@ -1532,7 +1553,7 @@ class WPvivid_Backup_Item
|
|
1532 |
foreach ($this->config['backup']['data']['meta']['files'] as $file)
|
1533 |
{
|
1534 |
if($has_dir)
|
1535 |
-
$files[]=$this->get_local_path().$file['file_name'];
|
1536 |
else
|
1537 |
$files[]=$file['file_name'];
|
1538 |
}
|
@@ -1576,7 +1597,7 @@ class WPvivid_Backup_Item
|
|
1576 |
foreach ($tmp_data as $file)
|
1577 |
{
|
1578 |
$need_download=false;
|
1579 |
-
$path=$this->get_local_path().$file['file_name'];
|
1580 |
if(file_exists($path))
|
1581 |
{
|
1582 |
if(filesize($path) == $file['size'])
|
@@ -1658,7 +1679,7 @@ class WPvivid_Backup_Item
|
|
1658 |
|
1659 |
foreach ($tmp_data as $file)
|
1660 |
{
|
1661 |
-
$path=$this->get_local_path().$file['file_name'];
|
1662 |
if(file_exists($path))
|
1663 |
{
|
1664 |
$ret=$zip->get_json_data($path);
|
@@ -1696,7 +1717,7 @@ class WPvivid_Backup_Item
|
|
1696 |
|
1697 |
foreach ($tmp_data as $file)
|
1698 |
{
|
1699 |
-
$path=$this->get_local_path().$file['file_name'];
|
1700 |
if(file_exists($path))
|
1701 |
{
|
1702 |
$ret=$zip->get_json_data($path);
|
@@ -1941,7 +1962,7 @@ class WPvivid_Backup_Item
|
|
1941 |
{
|
1942 |
$zip=new WPvivid_ZipClass();
|
1943 |
|
1944 |
-
$path=$this->get_local_path().$file_name;
|
1945 |
|
1946 |
$files = array();
|
1947 |
|
@@ -1961,7 +1982,7 @@ class WPvivid_Backup_Item
|
|
1961 |
{
|
1962 |
$zip=new WPvivid_ZipClass();
|
1963 |
|
1964 |
-
$path=$this->get_local_path().$file_name;
|
1965 |
|
1966 |
$ret=$zip->get_json_data($path);
|
1967 |
if($ret['result'] === WPVIVID_SUCCESS) {
|
@@ -2000,7 +2021,7 @@ class WPvivid_Backup_Item
|
|
2000 |
public function get_sql_file($file_name)
|
2001 |
{
|
2002 |
$zip=new WPvivid_ZipClass();
|
2003 |
-
$path=$this->get_local_path().$file_name;
|
2004 |
$files=$zip->list_file($path);
|
2005 |
return $files[0]['file_name'];
|
2006 |
}
|
@@ -2081,7 +2102,7 @@ class WPvivid_Backup_Item
|
|
2081 |
foreach ($files as $file)
|
2082 |
{
|
2083 |
$need_download=false;
|
2084 |
-
$path=$this->get_local_path().$file['file_name'];
|
2085 |
$download_url=content_url().DIRECTORY_SEPARATOR.$this->config['local']['path'].DIRECTORY_SEPARATOR.$file['file_name'];
|
2086 |
if(file_exists($path)) {
|
2087 |
if(filesize($path) == $file['size']){
|
@@ -2240,6 +2261,14 @@ class WPvivid_Backup_Item
|
|
2240 |
{
|
2241 |
@unlink($download_path);
|
2242 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2243 |
}
|
2244 |
}
|
2245 |
|
1512 |
return $this->config['type'];
|
1513 |
}
|
1514 |
|
1515 |
+
public function get_backup_path($file_name)
|
1516 |
+
{
|
1517 |
+
$path = $this->get_local_path() . $file_name;
|
1518 |
+
|
1519 |
+
if (file_exists($path)) {
|
1520 |
+
return $path;
|
1521 |
+
}
|
1522 |
+
else{
|
1523 |
+
$local_setting = get_option('wpvivid_local_setting', array());
|
1524 |
+
if(!empty($local_setting))
|
1525 |
+
{
|
1526 |
+
$path = WP_CONTENT_DIR . DIRECTORY_SEPARATOR . $local_setting['path'] . DIRECTORY_SEPARATOR . $file_name;
|
1527 |
+
}
|
1528 |
+
else {
|
1529 |
+
$path = WP_CONTENT_DIR . DIRECTORY_SEPARATOR . 'wpvividbackups' . DIRECTORY_SEPARATOR . $file_name;
|
1530 |
+
}
|
1531 |
+
}
|
1532 |
+
return $path;
|
1533 |
+
}
|
1534 |
+
|
1535 |
public function get_files($has_dir=true)
|
1536 |
{
|
1537 |
+
global $wpvivid_plugin;
|
1538 |
$files=array();
|
1539 |
if(isset($this->config['backup']['files']))
|
1540 |
{
|
1542 |
foreach ($this->config['backup']['files'] as $file)
|
1543 |
{
|
1544 |
if($has_dir)
|
1545 |
+
$files[]=$this->get_backup_path($file['file_name']);//$this->get_local_path().$file['file_name'];
|
1546 |
else
|
1547 |
$files[]=$file['file_name'];
|
1548 |
}
|
1553 |
foreach ($this->config['backup']['data']['meta']['files'] as $file)
|
1554 |
{
|
1555 |
if($has_dir)
|
1556 |
+
$files[]=$this->get_backup_path($file['file_name']);//$this->get_local_path().$file['file_name'];
|
1557 |
else
|
1558 |
$files[]=$file['file_name'];
|
1559 |
}
|
1597 |
foreach ($tmp_data as $file)
|
1598 |
{
|
1599 |
$need_download=false;
|
1600 |
+
$path=$this->get_backup_path($file['file_name']);//$this->get_local_path().$file['file_name'];
|
1601 |
if(file_exists($path))
|
1602 |
{
|
1603 |
if(filesize($path) == $file['size'])
|
1679 |
|
1680 |
foreach ($tmp_data as $file)
|
1681 |
{
|
1682 |
+
$path=$this->get_backup_path($file['file_name']);//$this->get_local_path().$file['file_name'];
|
1683 |
if(file_exists($path))
|
1684 |
{
|
1685 |
$ret=$zip->get_json_data($path);
|
1717 |
|
1718 |
foreach ($tmp_data as $file)
|
1719 |
{
|
1720 |
+
$path=$this->get_backup_path($file['file_name']);//$this->get_local_path().$file['file_name'];
|
1721 |
if(file_exists($path))
|
1722 |
{
|
1723 |
$ret=$zip->get_json_data($path);
|
1962 |
{
|
1963 |
$zip=new WPvivid_ZipClass();
|
1964 |
|
1965 |
+
$path=$this->get_backup_path($file_name);//$this->get_local_path().$file_name;
|
1966 |
|
1967 |
$files = array();
|
1968 |
|
1982 |
{
|
1983 |
$zip=new WPvivid_ZipClass();
|
1984 |
|
1985 |
+
$path=$this->get_backup_path($file_name);//$this->get_local_path().$file_name;
|
1986 |
|
1987 |
$ret=$zip->get_json_data($path);
|
1988 |
if($ret['result'] === WPVIVID_SUCCESS) {
|
2021 |
public function get_sql_file($file_name)
|
2022 |
{
|
2023 |
$zip=new WPvivid_ZipClass();
|
2024 |
+
$path=$this->get_backup_path($file_name);//$this->get_local_path().$file_name;
|
2025 |
$files=$zip->list_file($path);
|
2026 |
return $files[0]['file_name'];
|
2027 |
}
|
2102 |
foreach ($files as $file)
|
2103 |
{
|
2104 |
$need_download=false;
|
2105 |
+
$path=$this->get_backup_path($file['file_name']);//$this->get_local_path().$file['file_name'];
|
2106 |
$download_url=content_url().DIRECTORY_SEPARATOR.$this->config['local']['path'].DIRECTORY_SEPARATOR.$file['file_name'];
|
2107 |
if(file_exists($path)) {
|
2108 |
if(filesize($path) == $file['size']){
|
2261 |
{
|
2262 |
@unlink($download_path);
|
2263 |
}
|
2264 |
+
else{
|
2265 |
+
$backup_dir=WPvivid_Setting::get_backupdir();
|
2266 |
+
$download_path = WP_CONTENT_DIR .DIRECTORY_SEPARATOR . $backup_dir . DIRECTORY_SEPARATOR . $file;
|
2267 |
+
if (file_exists($download_path))
|
2268 |
+
{
|
2269 |
+
@unlink($download_path);
|
2270 |
+
}
|
2271 |
+
}
|
2272 |
}
|
2273 |
}
|
2274 |
|
includes/class-wpvivid-downloader.php
CHANGED
@@ -59,8 +59,9 @@ class WPvivid_downloader
|
|
59 |
return false;
|
60 |
}
|
61 |
|
62 |
-
|
63 |
-
$local_path=WP_CONTENT_DIR.DIRECTORY_SEPARATOR.$
|
|
|
64 |
$need_download_files=array();
|
65 |
|
66 |
$local_file=$local_path.$file_info['file_name'];
|
59 |
return false;
|
60 |
}
|
61 |
|
62 |
+
$backup_dir = WPvivid_Setting::get_backupdir();
|
63 |
+
$local_path=WP_CONTENT_DIR.DIRECTORY_SEPARATOR.$backup_dir.DIRECTORY_SEPARATOR;
|
64 |
+
//$local_path=WP_CONTENT_DIR.DIRECTORY_SEPARATOR.$backup['local']['path'].DIRECTORY_SEPARATOR;
|
65 |
$need_download_files=array();
|
66 |
|
67 |
$local_file=$local_path.$file_info['file_name'];
|
includes/class-wpvivid-restore-data.php
CHANGED
@@ -32,6 +32,7 @@ class WPvivid_restore_data
|
|
32 |
|
33 |
public function delete_temp_files()
|
34 |
{
|
|
|
35 |
$backup=$this->get_backup_data();
|
36 |
$backup_item=new WPvivid_Backup_Item($backup);
|
37 |
foreach($this->restore_cache['restore_tasks'] as $index => $task)
|
@@ -60,7 +61,8 @@ class WPvivid_restore_data
|
|
60 |
$temp_files=$backup_item->get_child_files($file);
|
61 |
foreach ($temp_files as $delete_file)
|
62 |
{
|
63 |
-
$path= $
|
|
|
64 |
if(file_exists($path))
|
65 |
{
|
66 |
$this->write_log('clean file:'.$path,'notice');
|
32 |
|
33 |
public function delete_temp_files()
|
34 |
{
|
35 |
+
global $wpvivid_plugin;
|
36 |
$backup=$this->get_backup_data();
|
37 |
$backup_item=new WPvivid_Backup_Item($backup);
|
38 |
foreach($this->restore_cache['restore_tasks'] as $index => $task)
|
61 |
$temp_files=$backup_item->get_child_files($file);
|
62 |
foreach ($temp_files as $delete_file)
|
63 |
{
|
64 |
+
$path = $wpvivid_plugin->get_backup_path($backup_item, $delete_file['file_name']);
|
65 |
+
//$path= $backup_item->get_local_path().$delete_file['file_name'];
|
66 |
if(file_exists($path))
|
67 |
{
|
68 |
$this->write_log('clean file:'.$path,'notice');
|
includes/class-wpvivid-restore-database.php
CHANGED
@@ -1382,6 +1382,9 @@ class WPvivid_RestoreDB
|
|
1382 |
{
|
1383 |
$from[]=$this->old_site_url;
|
1384 |
$to[]=$this->new_site_url;
|
|
|
|
|
|
|
1385 |
}
|
1386 |
}
|
1387 |
|
1382 |
{
|
1383 |
$from[]=$this->old_site_url;
|
1384 |
$to[]=$this->new_site_url;
|
1385 |
+
|
1386 |
+
$from[]=str_replace('/', '\/', $this->old_site_url);
|
1387 |
+
$to[]=str_replace('/', '\/', $this->new_site_url);
|
1388 |
}
|
1389 |
}
|
1390 |
|
includes/class-wpvivid-restore-site.php
CHANGED
@@ -15,7 +15,8 @@ class WPvivid_RestoreSite
|
|
15 |
{
|
16 |
$backup=$wpvivid_plugin->restore_data->get_backup_data();
|
17 |
$backup_item=new WPvivid_Backup_Item($backup);
|
18 |
-
$root_path
|
|
|
19 |
|
20 |
if(!file_exists($root_path))
|
21 |
{
|
@@ -42,7 +43,8 @@ class WPvivid_RestoreSite
|
|
42 |
{
|
43 |
$backup=$wpvivid_plugin->restore_data->get_backup_data();
|
44 |
$backup_item=new WPvivid_Backup_Item($backup);
|
45 |
-
$local_path
|
|
|
46 |
|
47 |
$is_type_db = false;
|
48 |
$is_type_db = apply_filters('wpvivid_check_type_database', $is_type_db, $option);
|
15 |
{
|
16 |
$backup=$wpvivid_plugin->restore_data->get_backup_data();
|
17 |
$backup_item=new WPvivid_Backup_Item($backup);
|
18 |
+
$root_path = $wpvivid_plugin->get_backup_folder();
|
19 |
+
//$root_path=$backup_item->get_local_path();
|
20 |
|
21 |
if(!file_exists($root_path))
|
22 |
{
|
43 |
{
|
44 |
$backup=$wpvivid_plugin->restore_data->get_backup_data();
|
45 |
$backup_item=new WPvivid_Backup_Item($backup);
|
46 |
+
$local_path = $wpvivid_plugin->get_backup_folder();
|
47 |
+
//$local_path=$backup_item->get_local_path();
|
48 |
|
49 |
$is_type_db = false;
|
50 |
$is_type_db = apply_filters('wpvivid_check_type_database', $is_type_db, $option);
|
includes/class-wpvivid-restore.php
CHANGED
@@ -88,11 +88,12 @@ class WPvivid_Restore
|
|
88 |
if(isset($option['is_crypt'])&&$option['is_crypt']=='1')
|
89 |
{
|
90 |
$sql_file = $backup_item->get_sql_file($restore_task['files'][0]);
|
91 |
-
$local_path
|
92 |
$ret=$this->restore_crypt_db($sql_file,$restore_task,$option,$local_path);
|
93 |
return $ret;
|
94 |
}
|
95 |
-
$path = $
|
|
|
96 |
$sql_file = $backup_item->get_sql_file($restore_task['files'][0]);
|
97 |
$wpvivid_plugin->restore_data->write_log('sql file: '.$sql_file,'notice');
|
98 |
$restore_db=new WPvivid_RestoreDB();
|
88 |
if(isset($option['is_crypt'])&&$option['is_crypt']=='1')
|
89 |
{
|
90 |
$sql_file = $backup_item->get_sql_file($restore_task['files'][0]);
|
91 |
+
$local_path= $wpvivid_plugin->get_backup_folder(); //$backup_item->get_local_path();
|
92 |
$ret=$this->restore_crypt_db($sql_file,$restore_task,$option,$local_path);
|
93 |
return $ret;
|
94 |
}
|
95 |
+
$path = $wpvivid_plugin->get_backup_folder().WPVIVID_DEFAULT_ROLLBACK_DIR.DIRECTORY_SEPARATOR.'wpvivid_old_database'.DIRECTORY_SEPARATOR;
|
96 |
+
//$path = $backup_item->get_local_path().WPVIVID_DEFAULT_ROLLBACK_DIR.DIRECTORY_SEPARATOR.'wpvivid_old_database'.DIRECTORY_SEPARATOR;
|
97 |
$sql_file = $backup_item->get_sql_file($restore_task['files'][0]);
|
98 |
$wpvivid_plugin->restore_data->write_log('sql file: '.$sql_file,'notice');
|
99 |
$restore_db=new WPvivid_RestoreDB();
|
includes/class-wpvivid-setting.php
CHANGED
@@ -167,7 +167,6 @@ class WPvivid_Setting
|
|
167 |
{
|
168 |
$dir=self::set_default_local_option();
|
169 |
}
|
170 |
-
|
171 |
if(!is_dir(WP_CONTENT_DIR.DIRECTORY_SEPARATOR.$dir['path']))
|
172 |
{
|
173 |
@mkdir(WP_CONTENT_DIR.DIRECTORY_SEPARATOR.$dir['path'],0777,true);
|
@@ -497,9 +496,9 @@ class WPvivid_Setting
|
|
497 |
$json['data']['wpvivid_email_setting']=self::get_option('wpvivid_email_setting');
|
498 |
$json['data']['wpvivid_saved_api_token']=self::get_option('wpvivid_saved_api_token');
|
499 |
$json = apply_filters('wpvivid_export_setting_addon', $json);
|
500 |
-
if(isset($json['data']['wpvivid_local_setting']['path'])){
|
501 |
unset($json['data']['wpvivid_local_setting']['path']);
|
502 |
-
}
|
503 |
if(isset($json['data']['wpvivid_common_setting']['log_save_location'])){
|
504 |
unset($json['data']['wpvivid_common_setting']['log_save_location']);
|
505 |
}
|
167 |
{
|
168 |
$dir=self::set_default_local_option();
|
169 |
}
|
|
|
170 |
if(!is_dir(WP_CONTENT_DIR.DIRECTORY_SEPARATOR.$dir['path']))
|
171 |
{
|
172 |
@mkdir(WP_CONTENT_DIR.DIRECTORY_SEPARATOR.$dir['path'],0777,true);
|
496 |
$json['data']['wpvivid_email_setting']=self::get_option('wpvivid_email_setting');
|
497 |
$json['data']['wpvivid_saved_api_token']=self::get_option('wpvivid_saved_api_token');
|
498 |
$json = apply_filters('wpvivid_export_setting_addon', $json);
|
499 |
+
/*if(isset($json['data']['wpvivid_local_setting']['path'])){
|
500 |
unset($json['data']['wpvivid_local_setting']['path']);
|
501 |
+
}*/
|
502 |
if(isset($json['data']['wpvivid_common_setting']['log_save_location'])){
|
503 |
unset($json['data']['wpvivid_common_setting']['log_save_location']);
|
504 |
}
|
includes/class-wpvivid.php
CHANGED
@@ -2306,7 +2306,8 @@ class WPvivid {
|
|
2306 |
$remote = $backup_item->get_remote();
|
2307 |
|
2308 |
foreach ($backup_files['files'] as $file) {
|
2309 |
-
$path = $
|
|
|
2310 |
|
2311 |
if (file_exists($path)) {
|
2312 |
if (filesize($path) == $file['size']) {
|
@@ -2315,7 +2316,7 @@ class WPvivid {
|
|
2315 |
$ret['files'][$file['file_name']]['status'] = 'completed';
|
2316 |
$ret['files'][$file['file_name']]['size'] = size_format(filesize($path), 2);
|
2317 |
$ret['files'][$file['file_name']]['download_path'] = $path;
|
2318 |
-
$download_url = $
|
2319 |
$ret['files'][$file['file_name']]['download_url'] = $download_url;
|
2320 |
|
2321 |
continue;
|
@@ -2411,8 +2412,8 @@ class WPvivid {
|
|
2411 |
$remote = $backup_item->get_remote();
|
2412 |
|
2413 |
foreach ($backup_files['files'] as $file) {
|
2414 |
-
$path = $
|
2415 |
-
|
2416 |
if (file_exists($path)) {
|
2417 |
if (filesize($path) == $file['size']) {
|
2418 |
if (WPvivid_taskmanager::get_download_task_v2($file['file_name']))
|
@@ -2420,7 +2421,7 @@ class WPvivid {
|
|
2420 |
$ret['files'][$file['file_name']]['status'] = 'completed';
|
2421 |
$ret['files'][$file['file_name']]['size'] = size_format(filesize($path), 2);
|
2422 |
$ret['files'][$file['file_name']]['download_path'] = $path;
|
2423 |
-
$download_url = $
|
2424 |
$ret['files'][$file['file_name']]['download_url'] = $download_url;
|
2425 |
|
2426 |
continue;
|
@@ -2572,7 +2573,8 @@ class WPvivid {
|
|
2572 |
$backup_files = $backup_item->get_download_backup_files($backup_id);
|
2573 |
|
2574 |
foreach ($backup_files['files'] as $file) {
|
2575 |
-
$path = $
|
|
|
2576 |
if (file_exists($path)) {
|
2577 |
$downloaded_size = size_format(filesize($path), 2);
|
2578 |
} else {
|
@@ -4771,6 +4773,15 @@ class WPvivid {
|
|
4771 |
$setting_data['wpvivid_compress_setting']['subpackage_plugin_upload'] = $setting['subpackage_plugin_upload'];
|
4772 |
|
4773 |
$setting_data['wpvivid_local_setting']['path'] = $setting['path'];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4774 |
$setting_data['wpvivid_local_setting']['save_local'] = $options['options']['wpvivid_local_setting']['save_local'];
|
4775 |
|
4776 |
$setting_data['wpvivid_common_setting']['max_execution_time'] = $setting['max_execution_time'];
|
@@ -6201,4 +6212,57 @@ class WPvivid {
|
|
6201 |
}
|
6202 |
return $class;
|
6203 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6204 |
}
|
2306 |
$remote = $backup_item->get_remote();
|
2307 |
|
2308 |
foreach ($backup_files['files'] as $file) {
|
2309 |
+
$path = $this->get_backup_path($backup_item, $file['file_name']);
|
2310 |
+
//$path = $backup_item->get_local_path() . $file['file_name'];
|
2311 |
|
2312 |
if (file_exists($path)) {
|
2313 |
if (filesize($path) == $file['size']) {
|
2316 |
$ret['files'][$file['file_name']]['status'] = 'completed';
|
2317 |
$ret['files'][$file['file_name']]['size'] = size_format(filesize($path), 2);
|
2318 |
$ret['files'][$file['file_name']]['download_path'] = $path;
|
2319 |
+
$download_url = $this->get_backup_url($backup_item, $file['file_name']);
|
2320 |
$ret['files'][$file['file_name']]['download_url'] = $download_url;
|
2321 |
|
2322 |
continue;
|
2412 |
$remote = $backup_item->get_remote();
|
2413 |
|
2414 |
foreach ($backup_files['files'] as $file) {
|
2415 |
+
$path = $this->get_backup_path($backup_item, $file['file_name']);
|
2416 |
+
//$path = $backup_item->get_local_path() . $file['file_name'];
|
2417 |
if (file_exists($path)) {
|
2418 |
if (filesize($path) == $file['size']) {
|
2419 |
if (WPvivid_taskmanager::get_download_task_v2($file['file_name']))
|
2421 |
$ret['files'][$file['file_name']]['status'] = 'completed';
|
2422 |
$ret['files'][$file['file_name']]['size'] = size_format(filesize($path), 2);
|
2423 |
$ret['files'][$file['file_name']]['download_path'] = $path;
|
2424 |
+
$download_url = $this->get_backup_url($backup_item, $file['file_name']);
|
2425 |
$ret['files'][$file['file_name']]['download_url'] = $download_url;
|
2426 |
|
2427 |
continue;
|
2573 |
$backup_files = $backup_item->get_download_backup_files($backup_id);
|
2574 |
|
2575 |
foreach ($backup_files['files'] as $file) {
|
2576 |
+
$path = $this->get_backup_path($backup_item, $file['file_name']);
|
2577 |
+
//$path = $backup_item->get_local_path() . $file['file_name'];
|
2578 |
if (file_exists($path)) {
|
2579 |
$downloaded_size = size_format(filesize($path), 2);
|
2580 |
} else {
|
4773 |
$setting_data['wpvivid_compress_setting']['subpackage_plugin_upload'] = $setting['subpackage_plugin_upload'];
|
4774 |
|
4775 |
$setting_data['wpvivid_local_setting']['path'] = $setting['path'];
|
4776 |
+
|
4777 |
+
if($options['options']['wpvivid_local_setting']['path'] !== $setting['path'])
|
4778 |
+
{
|
4779 |
+
if(file_exists(WP_CONTENT_DIR.DIRECTORY_SEPARATOR.$options['options']['wpvivid_local_setting']['path']))
|
4780 |
+
{
|
4781 |
+
@rename(WP_CONTENT_DIR.DIRECTORY_SEPARATOR.$options['options']['wpvivid_local_setting']['path'], WP_CONTENT_DIR.DIRECTORY_SEPARATOR.$setting['path']);
|
4782 |
+
}
|
4783 |
+
}
|
4784 |
+
|
4785 |
$setting_data['wpvivid_local_setting']['save_local'] = $options['options']['wpvivid_local_setting']['save_local'];
|
4786 |
|
4787 |
$setting_data['wpvivid_common_setting']['max_execution_time'] = $setting['max_execution_time'];
|
6212 |
}
|
6213 |
return $class;
|
6214 |
}
|
6215 |
+
|
6216 |
+
public function get_backup_path($backup_item, $file_name)
|
6217 |
+
{
|
6218 |
+
$path = $backup_item->get_local_path() . $file_name;
|
6219 |
+
|
6220 |
+
if (file_exists($path)) {
|
6221 |
+
return $path;
|
6222 |
+
}
|
6223 |
+
else{
|
6224 |
+
$local_setting = get_option('wpvivid_local_setting', array());
|
6225 |
+
if(!empty($local_setting))
|
6226 |
+
{
|
6227 |
+
$path = WP_CONTENT_DIR . DIRECTORY_SEPARATOR . $local_setting['path'] . DIRECTORY_SEPARATOR . $file_name;
|
6228 |
+
}
|
6229 |
+
else {
|
6230 |
+
$path = WP_CONTENT_DIR . DIRECTORY_SEPARATOR . 'wpvividbackups' . DIRECTORY_SEPARATOR . $file_name;
|
6231 |
+
}
|
6232 |
+
}
|
6233 |
+
return $path;
|
6234 |
+
}
|
6235 |
+
|
6236 |
+
public function get_backup_folder()
|
6237 |
+
{
|
6238 |
+
$local_setting = get_option('wpvivid_local_setting', array());
|
6239 |
+
if(!empty($local_setting))
|
6240 |
+
{
|
6241 |
+
$path = WP_CONTENT_DIR . DIRECTORY_SEPARATOR . $local_setting['path'] . DIRECTORY_SEPARATOR;
|
6242 |
+
}
|
6243 |
+
else {
|
6244 |
+
$path = WP_CONTENT_DIR . DIRECTORY_SEPARATOR . 'wpvividbackups' . DIRECTORY_SEPARATOR;
|
6245 |
+
}
|
6246 |
+
return $path;
|
6247 |
+
}
|
6248 |
+
|
6249 |
+
public function get_backup_url($backup_item, $file_name)
|
6250 |
+
{
|
6251 |
+
$path = $backup_item->get_local_path() . $file_name;
|
6252 |
+
|
6253 |
+
if (file_exists($path)) {
|
6254 |
+
return $backup_item->get_local_url() . $file_name;
|
6255 |
+
}
|
6256 |
+
else{
|
6257 |
+
$local_setting = get_option('wpvivid_local_setting', array());
|
6258 |
+
if(!empty($local_setting))
|
6259 |
+
{
|
6260 |
+
$url = content_url().DIRECTORY_SEPARATOR.$local_setting['path'].DIRECTORY_SEPARATOR.$file_name;
|
6261 |
+
}
|
6262 |
+
else {
|
6263 |
+
$url = content_url().DIRECTORY_SEPARATOR.'wpvividbackups'.DIRECTORY_SEPARATOR.$file_name;
|
6264 |
+
}
|
6265 |
+
}
|
6266 |
+
return $url;
|
6267 |
+
}
|
6268 |
}
|
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
|
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 |
|
@@ -192,6 +192,10 @@ Thank you for translating WPvivid Backup Plugin to your languages!
|
|
192 |
* [Nima](https://profiles.wordpress.org/nima78600/) (Persian)
|
193 |
|
194 |
== Changelog ==
|
|
|
|
|
|
|
|
|
195 |
= 0.9.60 =
|
196 |
- Fixed: Failed to back up files of 0 KB in PHP 8 environment.
|
197 |
- Changed: The information of backup folder name will not be included when you export the plugin settings.
|
4 |
Requires at least: 4.5
|
5 |
Tested up to: 5.8
|
6 |
Requires PHP: 5.3
|
7 |
+
Stable tag: 0.9.61
|
8 |
License: GPLv3 or later
|
9 |
License URI: https://www.gnu.org/licenses/gpl-3.0.en.html
|
10 |
|
192 |
* [Nima](https://profiles.wordpress.org/nima78600/) (Persian)
|
193 |
|
194 |
== Changelog ==
|
195 |
+
= 0.9.61 =
|
196 |
+
- Added support for migration of unconventional save of the media paths.
|
197 |
+
- Fixed some bugs in the plugin code.
|
198 |
+
- Optimized the plugin code.
|
199 |
= 0.9.60 =
|
200 |
- Fixed: Failed to back up files of 0 KB in PHP 8 environment.
|
201 |
- Changed: The information of backup folder name will not be included when you export the plugin settings.
|
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.61
|
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.61' );
|
25 |
//
|
26 |
define('WPVIVID_RESTORE_INIT','init');
|
27 |
define('WPVIVID_RESTORE_READY','ready');
|