Migration, Backup, Staging – WPvivid - Version 0.9.80

Version Description

  • Optimized backup process on Litespeed web server.
  • Staging error logs were not included in the Debug zip.
  • Fixed some bugs in the plugin code.
  • Optimized the plugin code.
  • Successfully tested with WordPress 6.1.1.
Download this release

Release Info

Developer wpvivid
Plugin Icon 128x128 Migration, Backup, Staging – WPvivid
Version 0.9.80
Comparing to
See all releases

Code changes from version 0.9.79 to 0.9.80

includes/class-wpvivid-error-log.php CHANGED
@@ -150,4 +150,36 @@ class WPvivid_error_log
150
  @closedir($handler);
151
  return $files;
152
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
153
  }
150
  @closedir($handler);
151
  return $files;
152
  }
153
+
154
+ public static function get_staging_error_log()
155
+ {
156
+ $log=new WPvivid_Staging_Log_Free();
157
+ $dir=$log->GetSaveLogFolder();
158
+ $dir=$dir.'error';
159
+ $files=array();
160
+ $handler=opendir($dir);
161
+ if($handler === false){
162
+ return $files;
163
+ }
164
+ $regex='#^wpvivid.*_log.txt#';
165
+ while(($filename=readdir($handler))!==false)
166
+ {
167
+ if($filename != "." && $filename != "..")
168
+ {
169
+ if(is_dir($dir.$filename))
170
+ {
171
+ continue;
172
+ }
173
+ else{
174
+ if(preg_match($regex,$filename))
175
+ {
176
+ $files[] = $dir.DIRECTORY_SEPARATOR.$filename;
177
+ }
178
+ }
179
+ }
180
+ }
181
+ if($handler)
182
+ @closedir($handler);
183
+ return $files;
184
+ }
185
  }
includes/class-wpvivid-function-realize.php CHANGED
@@ -54,6 +54,7 @@ class WPvivid_Function_Realize
54
  $wpvivid_plugin->add_monitor_event($task_id, 10);
55
  }
56
  }
 
57
  }
58
 
59
  /*if (WPvivid_taskmanager::get_task($task_id) !== false) {
54
  $wpvivid_plugin->add_monitor_event($task_id, 10);
55
  }
56
  }
57
+ $wpvivid_plugin->wpvivid_check_clear_litespeed_rule($task_id);
58
  }
59
 
60
  /*if (WPvivid_taskmanager::get_task($task_id) !== false) {
includes/class-wpvivid.php CHANGED
@@ -1205,6 +1205,7 @@ class WPvivid {
1205
  //start backup
1206
  try
1207
  {
 
1208
  $backup=new WPvivid_Backup();
1209
 
1210
  //$backup->clearcache();
@@ -1403,6 +1404,7 @@ class WPvivid {
1403
  {
1404
  WPvivid_mail_report::send_report_mail($task);
1405
  }
 
1406
  }
1407
 
1408
  function wpvivid_mark_task($task)
@@ -1472,6 +1474,7 @@ class WPvivid {
1472
  WPvivid_Schedule::clear_monitor_schedule($task['id']);
1473
  $this->add_clean_backing_up_data_event($task['id']);
1474
  WPvivid_mail_report::send_report_mail($task);
 
1475
  }
1476
 
1477
  public function deal_shutdown_error($task_id)
@@ -5569,6 +5572,7 @@ class WPvivid {
5569
  $this->ajax_check_security();
5570
  try {
5571
  $files = WPvivid_error_log::get_error_log();
 
5572
 
5573
  if (!class_exists('PclZip'))
5574
  include_once(ABSPATH . '/wp-admin/includes/class-pclzip.php');
@@ -5588,6 +5592,13 @@ class WPvivid {
5588
  }
5589
  }
5590
 
 
 
 
 
 
 
 
5591
  $server_info = json_encode($this->get_website_info());
5592
  $server_file_path = WP_CONTENT_DIR . DIRECTORY_SEPARATOR . $backup_path . DIRECTORY_SEPARATOR . 'wpvivid_server_info.json';
5593
  if (file_exists($server_file_path)) {
@@ -6755,4 +6766,124 @@ class WPvivid {
6755
  }
6756
  return $url;
6757
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6758
  }
1205
  //start backup
1206
  try
1207
  {
1208
+ $this->wpvivid_check_add_litespeed_server($task_id);
1209
  $backup=new WPvivid_Backup();
1210
 
1211
  //$backup->clearcache();
1404
  {
1405
  WPvivid_mail_report::send_report_mail($task);
1406
  }
1407
+ $this->wpvivid_check_clear_litespeed_rule($task['id']);
1408
  }
1409
 
1410
  function wpvivid_mark_task($task)
1474
  WPvivid_Schedule::clear_monitor_schedule($task['id']);
1475
  $this->add_clean_backing_up_data_event($task['id']);
1476
  WPvivid_mail_report::send_report_mail($task);
1477
+ $this->wpvivid_check_clear_litespeed_rule($task['id']);
1478
  }
1479
 
1480
  public function deal_shutdown_error($task_id)
5572
  $this->ajax_check_security();
5573
  try {
5574
  $files = WPvivid_error_log::get_error_log();
5575
+ $staging_files = WPvivid_error_log::get_staging_error_log();
5576
 
5577
  if (!class_exists('PclZip'))
5578
  include_once(ABSPATH . '/wp-admin/includes/class-pclzip.php');
5592
  }
5593
  }
5594
 
5595
+ if (!empty($staging_files)) {
5596
+ if (!$archive->add($staging_files, PCLZIP_OPT_REMOVE_ALL_PATH)) {
5597
+ echo $archive->errorInfo(true) . ' <a href="' . admin_url() . 'admin.php?page=WPvivid">retry</a>.';
5598
+ exit;
5599
+ }
5600
+ }
5601
+
5602
  $server_info = json_encode($this->get_website_info());
5603
  $server_file_path = WP_CONTENT_DIR . DIRECTORY_SEPARATOR . $backup_path . DIRECTORY_SEPARATOR . 'wpvivid_server_info.json';
5604
  if (file_exists($server_file_path)) {
6766
  }
6767
  return $url;
6768
  }
6769
+
6770
+ public function wpvivid_check_add_litespeed_server($task_id)
6771
+ {
6772
+ $litespeed=false;
6773
+ if ( isset( $_SERVER['HTTP_X_LSCACHE'] ) && $_SERVER['HTTP_X_LSCACHE'] )
6774
+ {
6775
+ $litespeed=true;
6776
+ }
6777
+ elseif ( isset( $_SERVER['LSWS_EDITION'] ) && strpos( $_SERVER['LSWS_EDITION'], 'Openlitespeed' ) === 0 ) {
6778
+ $litespeed=true;
6779
+ }
6780
+ elseif ( isset( $_SERVER['SERVER_SOFTWARE'] ) && $_SERVER['SERVER_SOFTWARE'] == 'LiteSpeed' ) {
6781
+ $litespeed=true;
6782
+ }
6783
+
6784
+ if($litespeed)
6785
+ {
6786
+ if($this->wpvivid_log->log_file_handle==false)
6787
+ {
6788
+ $this->wpvivid_log->OpenLogFile(WPvivid_taskmanager::get_task_options($task_id,'log_file_name'));
6789
+ }
6790
+ $this->wpvivid_log->WriteLog('LiteSpeed Server.','notice');
6791
+
6792
+ if ( ! function_exists( 'got_mod_rewrite' ) )
6793
+ {
6794
+ require_once ABSPATH . 'wp-admin/includes/misc.php';
6795
+ }
6796
+
6797
+ if(function_exists('insert_with_markers'))
6798
+ {
6799
+ if(!function_exists('get_home_path'))
6800
+ require_once(ABSPATH . 'wp-admin/includes/file.php');
6801
+ $home_path = get_home_path();
6802
+ $htaccess_file = $home_path . '.htaccess';
6803
+
6804
+ if ( ( ! file_exists( $htaccess_file ) && is_writable( $home_path ) ) || is_writable( $htaccess_file ) )
6805
+ {
6806
+ if ( got_mod_rewrite() )
6807
+ {
6808
+ $line[]='<IfModule Litespeed>';
6809
+ $line[]='RewriteEngine On';
6810
+ $line[]='RewriteRule .* - [E=noabort:1, E=noconntimeout:1]';
6811
+ $line[]='</IfModule>';
6812
+ insert_with_markers($htaccess_file,'WPvivid Rewrite Rule for LiteSpeed',$line);
6813
+ $this->wpvivid_log->WriteLog('Add LiteSpeed Rule','notice');
6814
+ }
6815
+ else
6816
+ {
6817
+ $this->wpvivid_log->WriteLog('mod_rewrite not found.','notice');
6818
+ }
6819
+ }
6820
+ else
6821
+ {
6822
+ $this->wpvivid_log->WriteLog('.htaccess file not exists or not writable.','notice');
6823
+ }
6824
+ }
6825
+ else
6826
+ {
6827
+ $this->wpvivid_log->WriteLog('insert_with_markers function not exists.','notice');
6828
+ }
6829
+ }
6830
+ }
6831
+
6832
+ public function wpvivid_check_clear_litespeed_rule($task_id)
6833
+ {
6834
+ $litespeed=false;
6835
+ if ( isset( $_SERVER['HTTP_X_LSCACHE'] ) && $_SERVER['HTTP_X_LSCACHE'] )
6836
+ {
6837
+ $litespeed=true;
6838
+ }
6839
+ elseif ( isset( $_SERVER['LSWS_EDITION'] ) && strpos( $_SERVER['LSWS_EDITION'], 'Openlitespeed' ) === 0 ) {
6840
+ $litespeed=true;
6841
+ }
6842
+ elseif ( isset( $_SERVER['SERVER_SOFTWARE'] ) && $_SERVER['SERVER_SOFTWARE'] == 'LiteSpeed' ) {
6843
+ $litespeed=true;
6844
+ }
6845
+
6846
+ if($litespeed)
6847
+ {
6848
+ if($this->wpvivid_log->log_file_handle==false)
6849
+ {
6850
+ $this->wpvivid_log->OpenLogFile(WPvivid_taskmanager::get_task_options($task_id,'log_file_name'));
6851
+ }
6852
+ $this->wpvivid_log->WriteLog('LiteSpeed Server.','notice');
6853
+
6854
+ if ( ! function_exists( 'got_mod_rewrite' ) )
6855
+ {
6856
+ require_once ABSPATH . 'wp-admin/includes/misc.php';
6857
+ }
6858
+
6859
+ if(function_exists('insert_with_markers'))
6860
+ {
6861
+ if(!function_exists('get_home_path'))
6862
+ require_once(ABSPATH . 'wp-admin/includes/file.php');
6863
+ $home_path = get_home_path();
6864
+ $htaccess_file = $home_path . '.htaccess';
6865
+
6866
+ if ( ( ! file_exists( $htaccess_file ) && is_writable( $home_path ) ) || is_writable( $htaccess_file ) )
6867
+ {
6868
+ if ( got_mod_rewrite() )
6869
+ {
6870
+ insert_with_markers($htaccess_file,'WPvivid Rewrite Rule for LiteSpeed','');
6871
+ $this->wpvivid_log->WriteLog('Clear LiteSpeed Rule','notice');
6872
+ }
6873
+ else
6874
+ {
6875
+ $this->wpvivid_log->WriteLog('mod_rewrite not found.','notice');
6876
+ }
6877
+ }
6878
+ else
6879
+ {
6880
+ $this->wpvivid_log->WriteLog('.htaccess file not exists or not writable.','notice');
6881
+ }
6882
+ }
6883
+ else
6884
+ {
6885
+ $this->wpvivid_log->WriteLog('insert_with_markers function not exists.','notice');
6886
+ }
6887
+ }
6888
+ }
6889
  }
readme.txt CHANGED
@@ -2,9 +2,9 @@
2
  Contributors: wpvivid
3
  Tags: move, clone, migrate, staging, backup, restore, auto backup, cloud backup
4
  Requires at least: 4.5
5
- Tested up to: 6.1
6
  Requires PHP: 5.3
7
- Stable tag: 0.9.79
8
  License: GPLv3 or later
9
  License URI: https://www.gnu.org/licenses/gpl-3.0.en.html
10
 
@@ -20,11 +20,9 @@ Clone and migrate a copy of WP site to a new host (a new domain), schedule backu
20
  Create a snapshot for a WordPress database quickly before testing database related changes.
21
 
22
  == WPvivid Backup for MainWP ==
23
- [WPvivid Backup for MainWP](https://wpvivid.com/wpvivid-backup-for-mainwp) is now available to download.
24
  This extension allows you to set up and control WPvivid Backup Free and Pro for all child sites directly from your MainWP dashboard.
25
 
26
- Click to download **[WPvivid Backup for MainWP](https://wordpress.org/plugins/wpvivid-backup-mainwp/)**
27
-
28
  == WPvivid Backup Pro is Now Available ==
29
  * Customize everything to backup
30
  * Create staging sites and push staging to live site
@@ -201,6 +199,12 @@ Thank you so much for translating WPvivid Backup Plugin to your languages!
201
  * [Yordan Soares](https://profiles.wordpress.org/yordansoares/) (Spanish(all locales))
202
  * [Chun-Chih Cheng](https://www.facebook.com/groups/wordpresstwhant) (Chinese (Taiwan))
203
  == Changelog ==
 
 
 
 
 
 
204
  = 0.9.79 =
205
  - Fixed: All target pages except for home page showed 404 error in some cases after migration.
206
  - Fixed some bugs in the plugin code.
2
  Contributors: wpvivid
3
  Tags: move, clone, migrate, staging, backup, restore, auto backup, cloud backup
4
  Requires at least: 4.5
5
+ Tested up to: 6.1.1
6
  Requires PHP: 5.3
7
+ Stable tag: 0.9.80
8
  License: GPLv3 or later
9
  License URI: https://www.gnu.org/licenses/gpl-3.0.en.html
10
 
20
  Create a snapshot for a WordPress database quickly before testing database related changes.
21
 
22
  == WPvivid Backup for MainWP ==
23
+ [WPvivid Backup for MainWP](https://wordpress.org/plugins/wpvivid-backup-mainwp/) is now available to download.
24
  This extension allows you to set up and control WPvivid Backup Free and Pro for all child sites directly from your MainWP dashboard.
25
 
 
 
26
  == WPvivid Backup Pro is Now Available ==
27
  * Customize everything to backup
28
  * Create staging sites and push staging to live site
199
  * [Yordan Soares](https://profiles.wordpress.org/yordansoares/) (Spanish(all locales))
200
  * [Chun-Chih Cheng](https://www.facebook.com/groups/wordpresstwhant) (Chinese (Taiwan))
201
  == Changelog ==
202
+ = 0.9.80 =
203
+ - Optimized backup process on Litespeed web server.
204
+ - Staging error logs were not included in the Debug zip.
205
+ - Fixed some bugs in the plugin code.
206
+ - Optimized the plugin code.
207
+ - Successfully tested with WordPress 6.1.1.
208
  = 0.9.79 =
209
  - Fixed: All target pages except for home page showed 404 error in some cases after migration.
210
  - Fixed some bugs in the plugin code.
vendor/guzzle/guzzle/src/Guzzle/Http/Message/Response.php CHANGED
@@ -879,7 +879,8 @@ class Response extends AbstractMessage implements \Serializable
879
  {
880
  $errorMessage = null;
881
  $internalErrors = libxml_use_internal_errors(true);
882
- $disableEntities = libxml_disable_entity_loader(true);
 
883
  libxml_clear_errors();
884
 
885
  try {
@@ -893,7 +894,8 @@ class Response extends AbstractMessage implements \Serializable
893
 
894
  libxml_clear_errors();
895
  libxml_use_internal_errors($internalErrors);
896
- libxml_disable_entity_loader($disableEntities);
 
897
 
898
  if ($errorMessage) {
899
  throw new RuntimeException('Unable to parse response body into XML: ' . $errorMessage);
879
  {
880
  $errorMessage = null;
881
  $internalErrors = libxml_use_internal_errors(true);
882
+ if (PHP_VERSION_ID < 80000)
883
+ $disableEntities = libxml_disable_entity_loader(true);
884
  libxml_clear_errors();
885
 
886
  try {
894
 
895
  libxml_clear_errors();
896
  libxml_use_internal_errors($internalErrors);
897
+ if (PHP_VERSION_ID < 80000)
898
+ libxml_disable_entity_loader($disableEntities);
899
 
900
  if ($errorMessage) {
901
  throw new RuntimeException('Unable to parse response body into XML: ' . $errorMessage);
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.79
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.79' );
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.80
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.80' );
25
  //
26
  define('WPVIVID_RESTORE_INIT','init');
27
  define('WPVIVID_RESTORE_READY','ready');