VaultPress - Version 1.9.8

Version Description

  • 7 February 2019 =
  • Limit the size of vp_ai_ping% entries when a site gets disconnected from VaultPress.com
Download this release

Release Info

Developer thingalon
Plugin Icon 128x128 VaultPress
Version 1.9.8
Comparing to
See all releases

Code changes from version 1.9.7 to 1.9.8

Files changed (2) hide show
  1. readme.txt +4 -1
  2. vaultpress.php +19 -7
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: automattic, apokalyptik, briancolinger, josephscott, shaunandrews,
3
  Tags: security, malware, virus, archive, back up, back ups, backup, backups, scanning, restore, wordpress backup, site backup, website backup
4
  Requires at least: 3.2
5
  Tested up to: 5.0
6
- Stable tag: 1.9.7
7
  License: GPLv2
8
 
9
  VaultPress is a subscription service offering real-time backup, automated security scanning, and support from WordPress experts.
@@ -47,6 +47,9 @@ A VaultPress subscription is for a single WordPress site. You can purchase addit
47
  Yes, VaultPress supports Multisite installs. Each site will require its own subscription.
48
 
49
  == Changelog ==
 
 
 
50
  = 1.9.7 - 11 December 2018 =
51
  * Update firewall IP detection rules to autodetect various reverse proxy setups
52
 
3
  Tags: security, malware, virus, archive, back up, back ups, backup, backups, scanning, restore, wordpress backup, site backup, website backup
4
  Requires at least: 3.2
5
  Tested up to: 5.0
6
+ Stable tag: 1.9.8
7
  License: GPLv2
8
 
9
  VaultPress is a subscription service offering real-time backup, automated security scanning, and support from WordPress experts.
47
  Yes, VaultPress supports Multisite installs. Each site will require its own subscription.
48
 
49
  == Changelog ==
50
+ = 1.9.8 - 7 February 2019 =
51
+ * Limit the size of _vp_ai_ping_% entries when a site gets disconnected from VaultPress.com
52
+
53
  = 1.9.7 - 11 December 2018 =
54
  * Update firewall IP detection rules to autodetect various reverse proxy setups
55
 
vaultpress.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: VaultPress
4
  * Plugin URI: http://vaultpress.com/?utm_source=plugin-uri&utm_medium=plugin-description&utm_campaign=1.0
5
  * Description: Protect your content, themes, plugins, and settings with <strong>realtime backup</strong> and <strong>automated security scanning</strong> from <a href="http://vaultpress.com/?utm_source=wp-admin&amp;utm_medium=plugin-description&amp;utm_campaign=1.0" rel="nofollow">VaultPress</a>. Activate, enter your registration key, and never worry again. <a href="http://vaultpress.com/help/?utm_source=wp-admin&amp;utm_medium=plugin-description&amp;utm_campaign=1.0" rel="nofollow">Need some help?</a>
6
- * Version: 1.9.7
7
  * Author: Automattic
8
  * Author URI: http://vaultpress.com/?utm_source=author-uri&amp;utm_medium=plugin-description&amp;utm_campaign=1.0
9
  * License: GPL2+
@@ -18,7 +18,7 @@ class VaultPress {
18
  var $option_name = 'vaultpress';
19
  var $auto_register_option = 'vaultpress_auto_register';
20
  var $db_version = 4;
21
- var $plugin_version = '1.9.7';
22
 
23
  function __construct() {
24
  register_activation_hook( __FILE__, array( $this, 'activate' ) );
@@ -979,7 +979,7 @@ class VaultPress {
979
  function ai_ping_next() {
980
  global $wpdb;
981
 
982
- if ( absint( $this->ai_ping_count() ) >= 100 ) {
983
  return false;
984
  }
985
 
@@ -993,7 +993,7 @@ class VaultPress {
993
  }
994
 
995
  function ai_ping_insert( $value ) {
996
- if ( absint( $this->ai_ping_count() ) >= 100 ) {
997
  return false;
998
  }
999
 
@@ -1004,9 +1004,21 @@ class VaultPress {
1004
  add_option( '_vp_ai_ping_' . $new_id, $value, '', 'no' );
1005
  }
1006
 
1007
- function ai_ping_count() {
 
 
 
 
 
 
 
 
 
 
 
 
1008
  global $wpdb;
1009
- return $wpdb->get_var( "SELECT COUNT(`option_id`) FROM $wpdb->options WHERE `option_name` LIKE '\_vp\_ai\_ping\_%'" );
1010
  }
1011
 
1012
  function ai_ping_get( $num=1, $order='ASC' ) {
@@ -1495,7 +1507,7 @@ JS;
1495
  $vaultpress_response_info = get_plugin_data( __FILE__ );
1496
  else
1497
  $vaultpress_response_info = array( 'Version' => $this->plugin_version );
1498
- $vaultpress_response_info['deferred_pings'] = (int)$this->ai_ping_count();
1499
  $vaultpress_response_info['vaultpress_hostname'] = $this->get_option( 'hostname' );
1500
  $vaultpress_response_info['vaultpress_timeout'] = $this->get_option( 'timeout' );
1501
  $vaultpress_response_info['disable_firewall'] = $this->get_option( 'disable_firewall' );
3
  * Plugin Name: VaultPress
4
  * Plugin URI: http://vaultpress.com/?utm_source=plugin-uri&amp;utm_medium=plugin-description&amp;utm_campaign=1.0
5
  * Description: Protect your content, themes, plugins, and settings with <strong>realtime backup</strong> and <strong>automated security scanning</strong> from <a href="http://vaultpress.com/?utm_source=wp-admin&amp;utm_medium=plugin-description&amp;utm_campaign=1.0" rel="nofollow">VaultPress</a>. Activate, enter your registration key, and never worry again. <a href="http://vaultpress.com/help/?utm_source=wp-admin&amp;utm_medium=plugin-description&amp;utm_campaign=1.0" rel="nofollow">Need some help?</a>
6
+ * Version: 1.9.8
7
  * Author: Automattic
8
  * Author URI: http://vaultpress.com/?utm_source=author-uri&amp;utm_medium=plugin-description&amp;utm_campaign=1.0
9
  * License: GPL2+
18
  var $option_name = 'vaultpress';
19
  var $auto_register_option = 'vaultpress_auto_register';
20
  var $db_version = 4;
21
+ var $plugin_version = '1.9.8';
22
 
23
  function __construct() {
24
  register_activation_hook( __FILE__, array( $this, 'activate' ) );
979
  function ai_ping_next() {
980
  global $wpdb;
981
 
982
+ if ( ! $this->allow_ai_pings() ) {
983
  return false;
984
  }
985
 
993
  }
994
 
995
  function ai_ping_insert( $value ) {
996
+ if ( ! $this->allow_ai_pings() ) {
997
  return false;
998
  }
999
 
1004
  add_option( '_vp_ai_ping_' . $new_id, $value, '', 'no' );
1005
  }
1006
 
1007
+ function allow_ai_pings() {
1008
+ static $allow_ai_pings = null;
1009
+
1010
+ if ( null === $allow_ai_pings ) {
1011
+ $queue_size = $this->ai_ping_queue_size();
1012
+ $size_limit = 50 * 1024 * 1024;
1013
+ $allow_ai_pings = ( $queue_size->option_count < 100 && $queue_size->option_size < $size_limit );
1014
+ }
1015
+
1016
+ return $allow_ai_pings;
1017
+ }
1018
+
1019
+ function ai_ping_queue_size() {
1020
  global $wpdb;
1021
+ return $wpdb->get_row( "SELECT COUNT(`option_id`) `option_count`, SUM(LENGTH(`option_value`)) `option_size` FROM $wpdb->options WHERE `option_name` LIKE '\_vp\_ai\_ping\_%'" );
1022
  }
1023
 
1024
  function ai_ping_get( $num=1, $order='ASC' ) {
1507
  $vaultpress_response_info = get_plugin_data( __FILE__ );
1508
  else
1509
  $vaultpress_response_info = array( 'Version' => $this->plugin_version );
1510
+ $vaultpress_response_info['deferred_pings'] = (int)$this->ai_ping_queue_size()->option_count;
1511
  $vaultpress_response_info['vaultpress_hostname'] = $this->get_option( 'hostname' );
1512
  $vaultpress_response_info['vaultpress_timeout'] = $this->get_option( 'timeout' );
1513
  $vaultpress_response_info['disable_firewall'] = $this->get_option( 'disable_firewall' );