Version Description
- Geo-blocking with advanced firewall
- Activity log improvements and bug fixes
- Woocommerce custom order table support for real-time backups
Download this release
Release Info
Developer | ritesh.soni36 |
Plugin | WordPress Backup & Security Plugin – BlogVault |
Version | 4.83 |
Comparing to | |
See all releases |
Code changes from version 4.82 to 4.83
- blogvault.php +13 -10
- callback/base.php +1 -1
- callback/wings/manage.php +18 -5
- callback/wings/watch.php +14 -1
- info.php +10 -5
- protect/fw/config.php +2 -0
- protect/fw/fw.php +16 -7
- protect/fw/rule_evaluator.php +1 -1
- protect/wp/protect.php +3 -0
- readme.txt +6 -1
- wp_actlog.php +33 -0
- wp_dynsync.php +22 -0
- wp_site_info.php +2 -2
blogvault.php
CHANGED
@@ -5,7 +5,7 @@ Plugin URI: https://blogvault.net
|
|
5 |
Description: Easiest way to backup & secure your WordPress site
|
6 |
Author: Backup by BlogVault
|
7 |
Author URI: https://blogvault.net
|
8 |
-
Version: 4.
|
9 |
Network: True
|
10 |
*/
|
11 |
|
@@ -73,14 +73,24 @@ if (is_admin()) {
|
|
73 |
add_action('admin_head', array($wpadmin, 'removeAdminNotices'), 3);
|
74 |
add_action('admin_notices', array($wpadmin, 'activateWarning'));
|
75 |
add_action('admin_enqueue_scripts', array($wpadmin, 'bvsecAdminMenu'));
|
76 |
-
##
|
|
|
77 |
}
|
78 |
|
79 |
-
|
80 |
if ((array_key_exists('bvreqmerge', $_POST)) || (array_key_exists('bvreqmerge', $_GET))) {
|
81 |
$_REQUEST = array_merge($_GET, $_POST);
|
82 |
}
|
83 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
84 |
if ((array_key_exists('bvplugname', $_REQUEST)) && ($_REQUEST['bvplugname'] == "bvbackup")) {
|
85 |
require_once dirname( __FILE__ ) . '/callback/base.php';
|
86 |
require_once dirname( __FILE__ ) . '/callback/response.php';
|
@@ -153,13 +163,6 @@ if ((array_key_exists('bvplugname', $_REQUEST)) && ($_REQUEST['bvplugname'] == "
|
|
153 |
$dynsync->init();
|
154 |
}
|
155 |
|
156 |
-
if ($bvinfo->isServiceActive('activity_log')) {
|
157 |
-
require_once dirname( __FILE__ ) . '/wp_actlog.php';
|
158 |
-
$bvconfig = $bvinfo->config;
|
159 |
-
$actlog = new BVWPActLog($bvdb, $bvsettings, $bvinfo, $bvconfig['activity_log']);
|
160 |
-
$actlog->init();
|
161 |
-
}
|
162 |
-
|
163 |
}
|
164 |
$bv_site_settings = $bvsettings->getOption('bv_site_settings');
|
165 |
if (isset($bv_site_settings)) {
|
5 |
Description: Easiest way to backup & secure your WordPress site
|
6 |
Author: Backup by BlogVault
|
7 |
Author URI: https://blogvault.net
|
8 |
+
Version: 4.83
|
9 |
Network: True
|
10 |
*/
|
11 |
|
73 |
add_action('admin_head', array($wpadmin, 'removeAdminNotices'), 3);
|
74 |
add_action('admin_notices', array($wpadmin, 'activateWarning'));
|
75 |
add_action('admin_enqueue_scripts', array($wpadmin, 'bvsecAdminMenu'));
|
76 |
+
##ALPURGECACHEFUNCTION##
|
77 |
+
##ALADMINMENU##
|
78 |
}
|
79 |
|
|
|
80 |
if ((array_key_exists('bvreqmerge', $_POST)) || (array_key_exists('bvreqmerge', $_GET))) {
|
81 |
$_REQUEST = array_merge($_GET, $_POST);
|
82 |
}
|
83 |
|
84 |
+
if ($bvinfo->hasValidDBVersion()) {
|
85 |
+
if ($bvinfo->isServiceActive('activity_log')) {
|
86 |
+
require_once dirname( __FILE__ ) . '/wp_actlog.php';
|
87 |
+
$bvconfig = $bvinfo->config;
|
88 |
+
$actlog = new BVWPActLog($bvdb, $bvsettings, $bvinfo, $bvconfig['activity_log']);
|
89 |
+
$actlog->init();
|
90 |
+
}
|
91 |
+
|
92 |
+
}
|
93 |
+
|
94 |
if ((array_key_exists('bvplugname', $_REQUEST)) && ($_REQUEST['bvplugname'] == "bvbackup")) {
|
95 |
require_once dirname( __FILE__ ) . '/callback/base.php';
|
96 |
require_once dirname( __FILE__ ) . '/callback/response.php';
|
163 |
$dynsync->init();
|
164 |
}
|
165 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
166 |
}
|
167 |
$bv_site_settings = $bvsettings->getOption('bv_site_settings');
|
168 |
if (isset($bv_site_settings)) {
|
callback/base.php
CHANGED
@@ -15,7 +15,7 @@ class BVCallbackBase {
|
|
15 |
"MISC_WING_VERSION" => '1.2',
|
16 |
"FS_WING_VERSION" => '1.2',
|
17 |
"INFO_WING_VERSION" => '1.5',
|
18 |
-
"WATCH_WING_VERSION" => '1.
|
19 |
"FS_WRITE_WING_VERSION" => '1.0',
|
20 |
"IPSTORE_WING_VERSION" => '1.0',
|
21 |
"PROTECT_WING_VERSION" => '1.0',
|
15 |
"MISC_WING_VERSION" => '1.2',
|
16 |
"FS_WING_VERSION" => '1.2',
|
17 |
"INFO_WING_VERSION" => '1.5',
|
18 |
+
"WATCH_WING_VERSION" => '1.1',
|
19 |
"FS_WRITE_WING_VERSION" => '1.0',
|
20 |
"IPSTORE_WING_VERSION" => '1.0',
|
21 |
"PROTECT_WING_VERSION" => '1.0',
|
callback/wings/manage.php
CHANGED
@@ -40,6 +40,8 @@ class BVManageCallback extends BVCallbackBase {
|
|
40 |
@include_once ABSPATH.'wp-admin/includes/template.php';
|
41 |
@include_once ABSPATH.'wp-includes/pluggable.php';
|
42 |
@include_once ABSPATH.'wp-admin/includes/class-wp-upgrader.php';
|
|
|
|
|
43 |
@include_once ABSPATH.'wp-admin/includes/user.php';
|
44 |
@include_once ABSPATH.'wp-includes/registration.php';
|
45 |
@include_once ABSPATH.'wp-admin/includes/upgrade.php';
|
@@ -400,7 +402,7 @@ class BVManageCallback extends BVCallbackBase {
|
|
400 |
if (!array_key_exists('plugins', $result))
|
401 |
$result["plugins"] = array();
|
402 |
$plugin['dest'] = WP_PLUGIN_DIR;
|
403 |
-
$res = $this->installPackage($plugin, $has_bv_skin);
|
404 |
$pluginName = $plugin['package'];
|
405 |
$result["plugins"][$pluginName] = $res;
|
406 |
}
|
@@ -410,7 +412,7 @@ class BVManageCallback extends BVCallbackBase {
|
|
410 |
if (!array_key_exists('themes', $result))
|
411 |
$result["themes"] = array();
|
412 |
$theme['dest'] = WP_CONTENT_DIR.'/themes';
|
413 |
-
$res = $this->installPackage($theme, $has_bv_skin);
|
414 |
$themeName = $theme['package'];
|
415 |
$result["themes"][$themeName] = $res;
|
416 |
}
|
@@ -418,7 +420,7 @@ class BVManageCallback extends BVCallbackBase {
|
|
418 |
return $result;
|
419 |
}
|
420 |
|
421 |
-
function installPackage($params, $has_bv_skin = false) {
|
422 |
global $wp_filesystem;
|
423 |
|
424 |
if (!isset($params['package']) || empty($params['package'])) {
|
@@ -435,21 +437,32 @@ class BVManageCallback extends BVCallbackBase {
|
|
435 |
} else {
|
436 |
$skin = new WP_Upgrader_Skin();
|
437 |
}
|
438 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
439 |
$upgrader->init();
|
440 |
$destination = $params['dest'];
|
441 |
$clear_destination = isset($params['cleardest']) ? $params['cleardest'] : false;
|
442 |
$package_url = $params['package'];
|
443 |
$key = basename($package_url);
|
|
|
444 |
$res = $upgrader->run(
|
445 |
array(
|
446 |
'package' => $package_url,
|
447 |
'destination' => $destination,
|
448 |
'clear_destination' => $clear_destination,
|
449 |
'clear_working' => true,
|
450 |
-
'hook_extra' => array(
|
|
|
|
|
|
|
451 |
)
|
452 |
);
|
|
|
453 |
if (is_wp_error($res)) {
|
454 |
$res = array('status' => "Error", 'message' => $this->getError($res));
|
455 |
} else {
|
40 |
@include_once ABSPATH.'wp-admin/includes/template.php';
|
41 |
@include_once ABSPATH.'wp-includes/pluggable.php';
|
42 |
@include_once ABSPATH.'wp-admin/includes/class-wp-upgrader.php';
|
43 |
+
@include_once ABSPATH.'wp-admin/includes/class-theme-upgrader.php';
|
44 |
+
@include_once ABSPATH.'wp-admin/includes/class-plugin-upgrader.php';
|
45 |
@include_once ABSPATH.'wp-admin/includes/user.php';
|
46 |
@include_once ABSPATH.'wp-includes/registration.php';
|
47 |
@include_once ABSPATH.'wp-admin/includes/upgrade.php';
|
402 |
if (!array_key_exists('plugins', $result))
|
403 |
$result["plugins"] = array();
|
404 |
$plugin['dest'] = WP_PLUGIN_DIR;
|
405 |
+
$res = $this->installPackage("plugin", $plugin, $has_bv_skin);
|
406 |
$pluginName = $plugin['package'];
|
407 |
$result["plugins"][$pluginName] = $res;
|
408 |
}
|
412 |
if (!array_key_exists('themes', $result))
|
413 |
$result["themes"] = array();
|
414 |
$theme['dest'] = WP_CONTENT_DIR.'/themes';
|
415 |
+
$res = $this->installPackage("theme", $theme, $has_bv_skin);
|
416 |
$themeName = $theme['package'];
|
417 |
$result["themes"][$themeName] = $res;
|
418 |
}
|
420 |
return $result;
|
421 |
}
|
422 |
|
423 |
+
function installPackage($type, $params, $has_bv_skin = false) {
|
424 |
global $wp_filesystem;
|
425 |
|
426 |
if (!isset($params['package']) || empty($params['package'])) {
|
437 |
} else {
|
438 |
$skin = new WP_Upgrader_Skin();
|
439 |
}
|
440 |
+
if ("plugin" === $type) {
|
441 |
+
$upgrader = new Plugin_Upgrader($skin);
|
442 |
+
} elseif ("theme" === $type) {
|
443 |
+
$upgrader = new Theme_Upgrader($skin);
|
444 |
+
} else {
|
445 |
+
$upgrader = new WP_Upgrader($skin);
|
446 |
+
}
|
447 |
$upgrader->init();
|
448 |
$destination = $params['dest'];
|
449 |
$clear_destination = isset($params['cleardest']) ? $params['cleardest'] : false;
|
450 |
$package_url = $params['package'];
|
451 |
$key = basename($package_url);
|
452 |
+
add_filter('upgrader_source_selection', array($upgrader, 'check_package'));
|
453 |
$res = $upgrader->run(
|
454 |
array(
|
455 |
'package' => $package_url,
|
456 |
'destination' => $destination,
|
457 |
'clear_destination' => $clear_destination,
|
458 |
'clear_working' => true,
|
459 |
+
'hook_extra' => array(
|
460 |
+
"type" => $type,
|
461 |
+
"action" => "install"
|
462 |
+
),
|
463 |
)
|
464 |
);
|
465 |
+
remove_filter('upgrader_source_selection', array($upgrader, 'check_package'));
|
466 |
if (is_wp_error($res)) {
|
467 |
$res = array('status' => "Error", 'message' => $this->getError($res));
|
468 |
} else {
|
callback/wings/watch.php
CHANGED
@@ -7,7 +7,7 @@ class BVWatchCallback extends BVCallbackBase {
|
|
7 |
public $db;
|
8 |
public $settings;
|
9 |
|
10 |
-
const WATCH_WING_VERSION = 1.
|
11 |
|
12 |
public function __construct($callback_handler) {
|
13 |
$this->db = $callback_handler->db;
|
@@ -155,6 +155,19 @@ class BVWatchCallback extends BVCallbackBase {
|
|
155 |
}
|
156 |
}
|
157 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
158 |
$resp["status"] = "done";
|
159 |
break;
|
160 |
case "rmdata":
|
7 |
public $db;
|
8 |
public $settings;
|
9 |
|
10 |
+
const WATCH_WING_VERSION = 1.1;
|
11 |
|
12 |
public function __construct($callback_handler) {
|
13 |
$this->db = $callback_handler->db;
|
155 |
}
|
156 |
}
|
157 |
|
158 |
+
if (array_key_exists('airlift_stats', $params)) {
|
159 |
+
$airlift_stats_table = "airlift_stats";
|
160 |
+
$airlift_stats_params = $params['airlift_stats'];
|
161 |
+
$table = $db->getBVTable($airlift_stats_table);
|
162 |
+
if (!isset($airlift_stats_params['bv_check_table']) || $db->isTablePresent($table)) {
|
163 |
+
$limit = intval(urldecode($airlift_stats_params['limit']));
|
164 |
+
$filter = urldecode($airlift_stats_params['filter']);
|
165 |
+
$db->deleteBVTableContent($airlift_stats_table, $airlift_stats_params['rmfilter']);
|
166 |
+
$resp["airlift_stats"] = $this->getData($table, $limit, $filter);
|
167 |
+
} else {
|
168 |
+
$resp["airlift_stats"] = array("status" => "TABLE_NOT_PRESENT");
|
169 |
+
}
|
170 |
+
}
|
171 |
$resp["status"] = "done";
|
172 |
break;
|
173 |
case "rmdata":
|
info.php
CHANGED
@@ -10,7 +10,7 @@ if (!class_exists('BVInfo')) :
|
|
10 |
public $badgeinfo = 'bvbadge';
|
11 |
public $ip_header_option = 'bvipheader';
|
12 |
public $brand_option = 'bvbrand';
|
13 |
-
public $version = '4.
|
14 |
public $webpage = 'https://blogvault.net';
|
15 |
public $appurl = 'https://app.blogvault.net';
|
16 |
public $slug = 'blogvault-real-time-backup/blogvault.php';
|
@@ -105,11 +105,16 @@ if (!class_exists('BVInfo')) :
|
|
105 |
|
106 |
public function isValidEnvironment(){
|
107 |
$bvsiteinfo = new BVWPSiteInfo();
|
108 |
-
$siteurl = $bvsiteinfo->siteurl();
|
109 |
$bvconfig = $this->config;
|
110 |
-
|
111 |
-
|
112 |
-
return
|
|
|
|
|
|
|
|
|
|
|
|
|
113 |
}
|
114 |
return true;
|
115 |
}
|
10 |
public $badgeinfo = 'bvbadge';
|
11 |
public $ip_header_option = 'bvipheader';
|
12 |
public $brand_option = 'bvbrand';
|
13 |
+
public $version = '4.83';
|
14 |
public $webpage = 'https://blogvault.net';
|
15 |
public $appurl = 'https://app.blogvault.net';
|
16 |
public $slug = 'blogvault-real-time-backup/blogvault.php';
|
105 |
|
106 |
public function isValidEnvironment(){
|
107 |
$bvsiteinfo = new BVWPSiteInfo();
|
|
|
108 |
$bvconfig = $this->config;
|
109 |
+
|
110 |
+
if (is_multisite()) {
|
111 |
+
return true;
|
112 |
+
} elseif ($bvconfig && array_key_exists("siteurl_scheme", $bvconfig)) {
|
113 |
+
$siteurl = $bvsiteinfo->siteurl('', $bvconfig["siteurl_scheme"]);
|
114 |
+
if (array_key_exists("abspath", $bvconfig) &&
|
115 |
+
array_key_exists("siteurl", $bvconfig) && !empty($siteurl)) {
|
116 |
+
return ($bvconfig["abspath"] == ABSPATH && $bvconfig["siteurl"] == $siteurl);
|
117 |
+
}
|
118 |
}
|
119 |
return true;
|
120 |
}
|
protect/fw/config.php
CHANGED
@@ -16,6 +16,7 @@ class BVFWConfig {
|
|
16 |
public $cookieDomain;
|
17 |
public $loggingMode;
|
18 |
public $rulesMode;
|
|
|
19 |
|
20 |
public static $requests_table = 'fw_requests';
|
21 |
public static $roleLevels = array(
|
@@ -40,6 +41,7 @@ class BVFWConfig {
|
|
40 |
$this->canSetCachePreventionCookie = array_key_exists('cansetcachepreventioncookie', $confHash) ?
|
41 |
$confHash['cansetcachepreventioncookie'] : false;
|
42 |
$this->rulesMode = array_key_exists('rulesmode', $confHash) ? intval($confHash['rulesmode']) : BVFWConfig::DISABLED;
|
|
|
43 |
}
|
44 |
|
45 |
#mode
|
16 |
public $cookieDomain;
|
17 |
public $loggingMode;
|
18 |
public $rulesMode;
|
19 |
+
public $isGeoBlocking;
|
20 |
|
21 |
public static $requests_table = 'fw_requests';
|
22 |
public static $roleLevels = array(
|
41 |
$this->canSetCachePreventionCookie = array_key_exists('cansetcachepreventioncookie', $confHash) ?
|
42 |
$confHash['cansetcachepreventioncookie'] : false;
|
43 |
$this->rulesMode = array_key_exists('rulesmode', $confHash) ? intval($confHash['rulesmode']) : BVFWConfig::DISABLED;
|
44 |
+
$this->isGeoBlocking = array_key_exists('isgeoblocking', $confHash) ? $confHash['isgeoblocking'] : false;
|
45 |
}
|
46 |
|
47 |
#mode
|
protect/fw/fw.php
CHANGED
@@ -75,8 +75,9 @@ class BVFW {
|
|
75 |
public static function getInstance($logger, $confHash, $ip, $bvinfo, $ipstore, $ruleSet) {
|
76 |
if (!isset(self::$instance)) {
|
77 |
self::$instance = new BVFW($logger, $confHash, $ip, $bvinfo, $ipstore, $ruleSet);
|
|
|
|
|
78 |
}
|
79 |
-
|
80 |
return self::$instance;
|
81 |
}
|
82 |
|
@@ -155,6 +156,11 @@ class BVFW {
|
|
155 |
public function isActive() {
|
156 |
return $this->config->isActive();
|
157 |
}
|
|
|
|
|
|
|
|
|
|
|
158 |
public function canSetAdminCookie() {
|
159 |
return ($this->config->adminCookieMode === BVFWConfig::ADMIN_COOKIE_MODE_ENABLED);
|
160 |
}
|
@@ -247,6 +253,14 @@ class BVFW {
|
|
247 |
return true;
|
248 |
}
|
249 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
250 |
public function execute() {
|
251 |
if ($this->config->canProfileReqInfo()) {
|
252 |
$result = array();
|
@@ -266,12 +280,7 @@ class BVFW {
|
|
266 |
$result += $this->profileRequestInfo($cookies, true, 'COOKIES[');
|
267 |
$this->request->updateReqInfo($result);
|
268 |
}
|
269 |
-
|
270 |
-
if (!$this->canBypassFirewall() && $this->config->isProtecting()) {
|
271 |
-
if ($this->isBlacklistedIP()) {
|
272 |
-
$this->terminateRequest(BVWPRequest::BLACKLISTED);
|
273 |
-
}
|
274 |
-
}
|
275 |
}
|
276 |
|
277 |
public function canExecuteRules() {
|
75 |
public static function getInstance($logger, $confHash, $ip, $bvinfo, $ipstore, $ruleSet) {
|
76 |
if (!isset(self::$instance)) {
|
77 |
self::$instance = new BVFW($logger, $confHash, $ip, $bvinfo, $ipstore, $ruleSet);
|
78 |
+
} else {
|
79 |
+
self::$instance->ipstore = $ipstore;
|
80 |
}
|
|
|
81 |
return self::$instance;
|
82 |
}
|
83 |
|
156 |
public function isActive() {
|
157 |
return $this->config->isActive();
|
158 |
}
|
159 |
+
|
160 |
+
public function isGeoBlocking() {
|
161 |
+
return $this->config->isGeoBlocking;
|
162 |
+
}
|
163 |
+
|
164 |
public function canSetAdminCookie() {
|
165 |
return ($this->config->adminCookieMode === BVFWConfig::ADMIN_COOKIE_MODE_ENABLED);
|
166 |
}
|
253 |
return true;
|
254 |
}
|
255 |
|
256 |
+
public function blockIfBlacklisted() {
|
257 |
+
if (!$this->canBypassFirewall() && $this->config->isProtecting()) {
|
258 |
+
if ($this->isBlacklistedIP()) {
|
259 |
+
$this->terminateRequest(BVWPRequest::BLACKLISTED);
|
260 |
+
}
|
261 |
+
}
|
262 |
+
}
|
263 |
+
|
264 |
public function execute() {
|
265 |
if ($this->config->canProfileReqInfo()) {
|
266 |
$result = array();
|
280 |
$result += $this->profileRequestInfo($cookies, true, 'COOKIES[');
|
281 |
$this->request->updateReqInfo($result);
|
282 |
}
|
283 |
+
$this->blockIfBlacklisted();
|
|
|
|
|
|
|
|
|
|
|
284 |
}
|
285 |
|
286 |
public function canExecuteRules() {
|
protect/fw/rule_evaluator.php
CHANGED
@@ -447,7 +447,7 @@ class BVFWRuleEvaluator {
|
|
447 |
if (isset($post->post_type) && isset($post->post_status) &&
|
448 |
in_array(array($post->post_type, $post->post_status), $posts_to_consider) &&
|
449 |
!current_user_can("delete_{$post->post_type}", $post->ID)) {
|
450 |
-
$log_data = array($post->ID, $post->post_type, $post->
|
451 |
$this->request->updateRulesInfo("wp_hook_info", $curr_hook, $log_data);
|
452 |
$this->fw->handleMatchedRule($rule_id);
|
453 |
}
|
447 |
if (isset($post->post_type) && isset($post->post_status) &&
|
448 |
in_array(array($post->post_type, $post->post_status), $posts_to_consider) &&
|
449 |
!current_user_can("delete_{$post->post_type}", $post->ID)) {
|
450 |
+
$log_data = array($post->ID, $post->post_type, $post->post_status);
|
451 |
$this->request->updateRulesInfo("wp_hook_info", $curr_hook, $log_data);
|
452 |
$this->fw->handleMatchedRule($rule_id);
|
453 |
}
|
protect/wp/protect.php
CHANGED
@@ -61,7 +61,10 @@ class BVProtect {
|
|
61 |
register_shutdown_function(array($fw, 'log'));
|
62 |
|
63 |
$fw->execute();
|
|
|
|
|
64 |
}
|
|
|
65 |
$fw->executeRules();
|
66 |
}
|
67 |
|
61 |
register_shutdown_function(array($fw, 'log'));
|
62 |
|
63 |
$fw->execute();
|
64 |
+
} elseif ($fw->isGeoBlocking()) {
|
65 |
+
$fw->blockIfBlacklisted();
|
66 |
}
|
67 |
+
|
68 |
$fw->executeRules();
|
69 |
}
|
70 |
|
readme.txt
CHANGED
@@ -6,7 +6,7 @@ Donate link: https://app.blogvault.net/home/signup
|
|
6 |
Requires at least: 4.0
|
7 |
Tested up to: 6.1
|
8 |
Requires PHP: 5.4.0
|
9 |
-
Stable tag: 4.
|
10 |
License: GPLv2 or later
|
11 |
License URI: [http://www.gnu.org/licenses/gpl-2.0.html](http://www.gnu.org/licenses/gpl-2.0.html)
|
12 |
|
@@ -252,6 +252,11 @@ These are available on our website: [Terms of Service](https://blogvault.net/tos
|
|
252 |
9. We power WordPress migration for WPEngine, Pantheon, FlyWheel, LiquidWeb, Cloudways, Savvii, and many more. Need we say more?
|
253 |
|
254 |
== CHANGELOG ==
|
|
|
|
|
|
|
|
|
|
|
255 |
= 4.82 =
|
256 |
* Firewall Improvements
|
257 |
* Realtime Improvements
|
6 |
Requires at least: 4.0
|
7 |
Tested up to: 6.1
|
8 |
Requires PHP: 5.4.0
|
9 |
+
Stable tag: 4.83
|
10 |
License: GPLv2 or later
|
11 |
License URI: [http://www.gnu.org/licenses/gpl-2.0.html](http://www.gnu.org/licenses/gpl-2.0.html)
|
12 |
|
252 |
9. We power WordPress migration for WPEngine, Pantheon, FlyWheel, LiquidWeb, Cloudways, Savvii, and many more. Need we say more?
|
253 |
|
254 |
== CHANGELOG ==
|
255 |
+
= 4.83 =
|
256 |
+
* Geo-blocking with advanced firewall
|
257 |
+
* Activity log improvements and bug fixes
|
258 |
+
* Woocommerce custom order table support for real-time backups
|
259 |
+
|
260 |
= 4.82 =
|
261 |
* Firewall Improvements
|
262 |
* Realtime Improvements
|
wp_actlog.php
CHANGED
@@ -16,6 +16,7 @@ if (!class_exists('BVWPActLog')) :
|
|
16 |
$this->bvinfo = $info;
|
17 |
$this->request_id = BVInfo::getRequestID();
|
18 |
$this->ip_header = array_key_exists('ip_header', $config) ? $config['ip_header'] : false;
|
|
|
19 |
}
|
20 |
|
21 |
function init() {
|
@@ -62,6 +63,7 @@ if (!class_exists('BVWPActLog')) :
|
|
62 |
if (!empty($user)) {
|
63 |
$data['username'] = $user->user_login;
|
64 |
$data['email'] = $user->user_email;
|
|
|
65 |
}
|
66 |
return $data;
|
67 |
}
|
@@ -144,6 +146,25 @@ if (!class_exists('BVWPActLog')) :
|
|
144 |
$this->db->replaceIntoBVTable(BVWPActLog::$actlog_table, $values);
|
145 |
}
|
146 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
147 |
function user_login_handler($user_login, $user) {
|
148 |
$event_data = array("user" => $this->get_user($user->ID));
|
149 |
$this->add_activity($event_data);
|
@@ -185,6 +206,8 @@ if (!class_exists('BVWPActLog')) :
|
|
185 |
|
186 |
function post_handler($post_id) {
|
187 |
$post = $this->get_post($post_id);
|
|
|
|
|
188 |
$event_data = array();
|
189 |
if ($post["type"] === "product") {
|
190 |
$event_data["product"] = $post;
|
@@ -198,6 +221,8 @@ if (!class_exists('BVWPActLog')) :
|
|
198 |
|
199 |
function post_saved_handler($post_id, $post, $update) {
|
200 |
$post = $this->get_post($post_id);
|
|
|
|
|
201 |
$event_data = array();
|
202 |
if ($post["type"] === "product") {
|
203 |
$event_data["product"] = $post;
|
@@ -380,10 +405,18 @@ if (!class_exists('BVWPActLog')) :
|
|
380 |
$event_data = array('action' => 'update');
|
381 |
if ($options['type'] === 'plugin') {
|
382 |
$event_data['type'] = 'plugin';
|
|
|
|
|
|
|
|
|
383 |
$event_data['plugins'] = $this->get_plugin_update_data($options['plugins']);
|
384 |
}
|
385 |
else if ($options['type'] === 'theme') {
|
386 |
$event_data['type'] = 'theme';
|
|
|
|
|
|
|
|
|
387 |
$event_data['themes'] = $this->get_theme_update_data($options['themes']);
|
388 |
}
|
389 |
else if ($options['type'] === 'core') {
|
16 |
$this->bvinfo = $info;
|
17 |
$this->request_id = BVInfo::getRequestID();
|
18 |
$this->ip_header = array_key_exists('ip_header', $config) ? $config['ip_header'] : false;
|
19 |
+
$this->ignored_events = array_key_exists('ignored_events', $config) ? $config['ignored_events'] : array();
|
20 |
}
|
21 |
|
22 |
function init() {
|
63 |
if (!empty($user)) {
|
64 |
$data['username'] = $user->user_login;
|
65 |
$data['email'] = $user->user_email;
|
66 |
+
$data['role'] = $user->roles;
|
67 |
}
|
68 |
return $data;
|
69 |
}
|
146 |
$this->db->replaceIntoBVTable(BVWPActLog::$actlog_table, $values);
|
147 |
}
|
148 |
|
149 |
+
function is_key_ignored($ignored_keys, $value) {
|
150 |
+
$is_ignored = false;
|
151 |
+
if (array_key_exists("post_types_regex", $ignored_keys)) {
|
152 |
+
foreach ($ignored_keys['post_types_regex'] as $val) {
|
153 |
+
if (preg_match($val, $value)) {
|
154 |
+
return true;
|
155 |
+
}
|
156 |
+
}
|
157 |
+
}
|
158 |
+
if (array_key_exists("post_types", $ignored_keys)) {
|
159 |
+
foreach ($ignored_keys['post_types'] as $val) {
|
160 |
+
if ($val == $value) {
|
161 |
+
return true;
|
162 |
+
}
|
163 |
+
}
|
164 |
+
}
|
165 |
+
return $is_ignored;
|
166 |
+
}
|
167 |
+
|
168 |
function user_login_handler($user_login, $user) {
|
169 |
$event_data = array("user" => $this->get_user($user->ID));
|
170 |
$this->add_activity($event_data);
|
206 |
|
207 |
function post_handler($post_id) {
|
208 |
$post = $this->get_post($post_id);
|
209 |
+
if ($this->is_key_ignored($this->ignored_events, $post["type"]))
|
210 |
+
return;
|
211 |
$event_data = array();
|
212 |
if ($post["type"] === "product") {
|
213 |
$event_data["product"] = $post;
|
221 |
|
222 |
function post_saved_handler($post_id, $post, $update) {
|
223 |
$post = $this->get_post($post_id);
|
224 |
+
if ($this->is_key_ignored($this->ignored_events, $post["type"]))
|
225 |
+
return;
|
226 |
$event_data = array();
|
227 |
if ($post["type"] === "product") {
|
228 |
$event_data["product"] = $post;
|
405 |
$event_data = array('action' => 'update');
|
406 |
if ($options['type'] === 'plugin') {
|
407 |
$event_data['type'] = 'plugin';
|
408 |
+
if (array_key_exists("plugin", $options)) {
|
409 |
+
$options['plugins'] = array($options['plugin']);
|
410 |
+
unset($options['plugin']);
|
411 |
+
}
|
412 |
$event_data['plugins'] = $this->get_plugin_update_data($options['plugins']);
|
413 |
}
|
414 |
else if ($options['type'] === 'theme') {
|
415 |
$event_data['type'] = 'theme';
|
416 |
+
if (array_key_exists("theme", $options)) {
|
417 |
+
$options['themes'] = array($options['theme']);
|
418 |
+
unset($options['theme']);
|
419 |
+
}
|
420 |
$event_data['themes'] = $this->get_theme_update_data($options['themes']);
|
421 |
}
|
422 |
else if ($options['type'] === 'core') {
|
wp_dynsync.php
CHANGED
@@ -267,6 +267,25 @@ class BVWPDynSync {
|
|
267 |
}
|
268 |
}
|
269 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
270 |
function woocommerce_new_order_item_handler($item_id, $item, $order_id) {
|
271 |
$this->add_db_event('woocommerce_order_items', array('order_item_id' => $item_id));
|
272 |
$this->add_db_event('woocommerce_order_itemmeta', array('order_item_id' => $item_id));
|
@@ -598,6 +617,9 @@ class BVWPDynSync {
|
|
598 |
add_action('update_site_option', array($this, 'sitemeta_handler'), 10, 1);
|
599 |
|
600 |
/* CAPTURING EVENTS FOR WOOCOMMERCE */
|
|
|
|
|
|
|
601 |
add_action('woocommerce_resume_order', array($this, 'woocommerce_resume_order_handler'), 10, 1);
|
602 |
add_action('woocommerce_new_order_item', array($this, 'woocommerce_new_order_item_handler'), 10, 3);
|
603 |
add_action('woocommerce_update_order_item', array($this, 'woocommerce_update_order_item_handler'), 10, 2);
|
267 |
}
|
268 |
}
|
269 |
|
270 |
+
function woocommerce_update_order_handler($order_id, $order) {
|
271 |
+
$this->add_db_event('wc_orders', array('id' => $order_id));
|
272 |
+
$this->add_db_event('wc_orders_meta', array('order_id' => $order_id));
|
273 |
+
$this->add_db_event('wc_order_addresses', array('order_id' => $order_id));
|
274 |
+
$this->add_db_event('wc_order_operational_data', array('order_id' => $order_id));
|
275 |
+
}
|
276 |
+
|
277 |
+
function woocommerce_trash_order_handler($order_id) {
|
278 |
+
$this->add_db_event('wc_orders', array('id' => $order_id));
|
279 |
+
$this->add_db_event('wc_orders_meta', array('order_id' => $order_id));
|
280 |
+
}
|
281 |
+
|
282 |
+
function woocommerce_delete_order_handler($order_id) {
|
283 |
+
$this->add_db_event('wc_orders', array('id' => $order_id, 'msg_type' => 'delete'));
|
284 |
+
$this->add_db_event('wc_orders_meta', array('order_id' => $order_id, 'msg_type' => 'delete'));
|
285 |
+
$this->add_db_event('wc_order_addresses', array('order_id' => $order_id, 'msg_type' => 'delete'));
|
286 |
+
$this->add_db_event('wc_order_operational_data', array('order_id' => $order_id, 'msg_type' => 'delete'));
|
287 |
+
}
|
288 |
+
|
289 |
function woocommerce_new_order_item_handler($item_id, $item, $order_id) {
|
290 |
$this->add_db_event('woocommerce_order_items', array('order_item_id' => $item_id));
|
291 |
$this->add_db_event('woocommerce_order_itemmeta', array('order_item_id' => $item_id));
|
617 |
add_action('update_site_option', array($this, 'sitemeta_handler'), 10, 1);
|
618 |
|
619 |
/* CAPTURING EVENTS FOR WOOCOMMERCE */
|
620 |
+
add_action('woocommerce_update_order', array($this, 'woocommerce_update_order_handler'), 10, 2);
|
621 |
+
add_action('woocommerce_delete_order', array($this, 'woocommerce_delete_order_handler'), 10, 1);
|
622 |
+
add_action('woocommerce_trash_order', array($this, 'woocommerce_trash_order_handler'), 10, 1);
|
623 |
add_action('woocommerce_resume_order', array($this, 'woocommerce_resume_order_handler'), 10, 1);
|
624 |
add_action('woocommerce_new_order_item', array($this, 'woocommerce_new_order_item_handler'), 10, 3);
|
625 |
add_action('woocommerce_update_order_item', array($this, 'woocommerce_update_order_item_handler'), 10, 2);
|
wp_site_info.php
CHANGED
@@ -11,9 +11,9 @@ class BVWPSiteInfo {
|
|
11 |
return get_bloginfo('wpurl');
|
12 |
}
|
13 |
|
14 |
-
public function siteurl() {
|
15 |
if (function_exists('site_url')) {
|
16 |
-
return site_url();
|
17 |
} else {
|
18 |
return get_bloginfo('wpurl');
|
19 |
}
|
11 |
return get_bloginfo('wpurl');
|
12 |
}
|
13 |
|
14 |
+
public function siteurl($path = '', $scheme = null) {
|
15 |
if (function_exists('site_url')) {
|
16 |
+
return site_url($path, $scheme);
|
17 |
} else {
|
18 |
return get_bloginfo('wpurl');
|
19 |
}
|