Wordfence Security – Firewall & Malware Scan - Version 2.1.2

Version Description

  • Fixed issue with scan scheduling that caused a loop
  • Fixed issue that caused version constant to not be included in scans
Download this release

Release Info

Developer mmaunder
Plugin Icon 128x128 Wordfence Security – Firewall & Malware Scan
Version 2.1.2
Comparing to
See all releases

Code changes from version 2.1.1 to 2.1.2

Files changed (5) hide show
  1. lib/wfConfig.php +0 -3
  2. lib/wordfenceClass.php +5 -5
  3. readme.txt +5 -1
  4. wfscan.php +2 -0
  5. wordfence.php +9 -8
lib/wfConfig.php CHANGED
@@ -372,10 +372,8 @@ class wfConfig {
372
  $dbh = self::getDB()->getDBH();
373
  $exists = self::getDB()->querySingle("select name from " . self::table() . " where name='%s'", $key);
374
  if($exists){
375
- wordfence::status(4, 'info', "set_ser() updating key $key with value to be serialized that has type: " . gettype($val));
376
  $res = mysql_query("update " . self::table() . " set val='" . mysql_real_escape_string(serialize($val)) . "' where name='" . mysql_real_escape_string($key) . "'", $dbh);
377
  } else {
378
- wordfence::status(4, 'info', "set_ser() inserting key $key with value to be serialized that has type: " . gettype($val));
379
  $res = mysql_query("insert IGNORE into " . self::table() . " (name, val) values ('" . mysql_real_escape_string($key) . "', '" . mysql_real_escape_string(serialize($val)) . "')", $dbh);
380
  }
381
  $err = mysql_error();
@@ -422,7 +420,6 @@ class wfConfig {
422
 
423
  if(mysql_num_rows($res) > 0){
424
  $row = mysql_fetch_row($res);
425
- wordfence::status(4, 'info', "get_ser() Unserializing key $key with data length " . strlen($row[0]));
426
  return unserialize($row[0]);
427
  }
428
  return $default;
372
  $dbh = self::getDB()->getDBH();
373
  $exists = self::getDB()->querySingle("select name from " . self::table() . " where name='%s'", $key);
374
  if($exists){
 
375
  $res = mysql_query("update " . self::table() . " set val='" . mysql_real_escape_string(serialize($val)) . "' where name='" . mysql_real_escape_string($key) . "'", $dbh);
376
  } else {
 
377
  $res = mysql_query("insert IGNORE into " . self::table() . " (name, val) values ('" . mysql_real_escape_string($key) . "', '" . mysql_real_escape_string(serialize($val)) . "')", $dbh);
378
  }
379
  $err = mysql_error();
420
 
421
  if(mysql_num_rows($res) > 0){
422
  $row = mysql_fetch_row($res);
 
423
  return unserialize($row[0]);
424
  }
425
  return $default;
lib/wordfenceClass.php CHANGED
@@ -163,8 +163,8 @@ class wordfence {
163
  }
164
  wp_clear_scheduled_hook('wordfence_daily_cron');
165
  wp_clear_scheduled_hook('wordfence_hourly_cron');
166
- wp_schedule_event(current_time('timestamp'), 'daily', 'wordfence_daily_cron');
167
- wp_schedule_event(current_time('timestamp'), 'hourly', 'wordfence_hourly_cron');
168
  $db = new wfDB();
169
 
170
  //Upgrading from 1.5.6 or earlier needs:
@@ -1248,7 +1248,7 @@ class wordfence {
1248
  public static function scheduleNextScan($force = false){
1249
  if(wfConfig::get('scheduledScansEnabled')){
1250
  $nextScan = wp_next_scheduled('wordfence_scheduled_scan');
1251
- if((! $force) && $nextScan && $nextScan - current_time('timestamp') > 0){
1252
  //scan is already scheduled for the future
1253
  return;
1254
  }
@@ -1258,11 +1258,11 @@ class wordfence {
1258
  return $result['errorMsg'];
1259
  }
1260
  $secsToGo = 3600 * 6; //In case we can't contact the API, schedule next scan 6 hours from now.
1261
- if(is_array($result) && $result['secsToGo'] > 1){
1262
  $secsToGo = $result['secsToGo'];
1263
  }
1264
  wp_clear_scheduled_hook('wordfence_scheduled_scan');
1265
- wp_schedule_single_event(current_time('timestamp') + $secsToGo, 'wordfence_scheduled_scan');
1266
  } else {
1267
  wp_clear_scheduled_hook('wordfence_scheduled_scan');
1268
  }
163
  }
164
  wp_clear_scheduled_hook('wordfence_daily_cron');
165
  wp_clear_scheduled_hook('wordfence_hourly_cron');
166
+ wp_schedule_event(time(), 'daily', 'wordfence_daily_cron');
167
+ wp_schedule_event(time(), 'hourly', 'wordfence_hourly_cron');
168
  $db = new wfDB();
169
 
170
  //Upgrading from 1.5.6 or earlier needs:
1248
  public static function scheduleNextScan($force = false){
1249
  if(wfConfig::get('scheduledScansEnabled')){
1250
  $nextScan = wp_next_scheduled('wordfence_scheduled_scan');
1251
+ if((! $force) && $nextScan && $nextScan - time() > 0){
1252
  //scan is already scheduled for the future
1253
  return;
1254
  }
1258
  return $result['errorMsg'];
1259
  }
1260
  $secsToGo = 3600 * 6; //In case we can't contact the API, schedule next scan 6 hours from now.
1261
+ if(is_array($result) && $result['secsToGo'] > 1800){
1262
  $secsToGo = $result['secsToGo'];
1263
  }
1264
  wp_clear_scheduled_hook('wordfence_scheduled_scan');
1265
+ wp_schedule_single_event(time() + $secsToGo, 'wordfence_scheduled_scan');
1266
  } else {
1267
  wp_clear_scheduled_hook('wordfence_scheduled_scan');
1268
  }
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: mmaunder
3
  Tags: wordpress, security, wordpress security, security plugin, secure, anti-virus, malware, firewall, antivirus, virus, google safe browsing, phishing, scrapers, hacking, wordfence, securty, secrity, secure
4
  Requires at least: 3.3.1
5
  Tested up to: 3.3.2
6
- Stable tag: 2.1.1
7
 
8
  Wordfence Security is a free enterprise class security plugin that includes a firewall, virus scanning, real-time traffic with geolocation and more.
9
 
@@ -152,6 +152,10 @@ or a theme, because often these have been updated to fix a security hole.
152
  5. If you're technically minded, this is the under-the-hood view of Wordfence options where you can fine-tune your security settings.
153
 
154
  == Changelog ==
 
 
 
 
155
  = 2.1.1 =
156
  * Added ability to permanently block IP's
157
  * Added ability to manually block IP's
3
  Tags: wordpress, security, wordpress security, security plugin, secure, anti-virus, malware, firewall, antivirus, virus, google safe browsing, phishing, scrapers, hacking, wordfence, securty, secrity, secure
4
  Requires at least: 3.3.1
5
  Tested up to: 3.3.2
6
+ Stable tag: 2.1.2
7
 
8
  Wordfence Security is a free enterprise class security plugin that includes a firewall, virus scanning, real-time traffic with geolocation and more.
9
 
152
  5. If you're technically minded, this is the under-the-hood view of Wordfence options where you can fine-tune your security settings.
153
 
154
  == Changelog ==
155
+ = 2.1.2 =
156
+ * Fixed issue with scan scheduling that caused a loop
157
+ * Fixed issue that caused version constant to not be included in scans
158
+
159
  = 2.1.1 =
160
  * Added ability to permanently block IP's
161
  * Added ability to manually block IP's
wfscan.php CHANGED
@@ -1,5 +1,6 @@
1
  <?php
2
  /* Don't remove this line. WFSOURCEVISIBLE */
 
3
  ignore_user_abort(true);
4
  $wordfence_wp_version = false;
5
  if ( !defined('ABSPATH') ) {
@@ -16,6 +17,7 @@ if ( !defined('ABSPATH') ) {
16
  require_once('../../../wp-includes/version.php');
17
  }
18
  }
 
19
  require_once('lib/wordfenceConstants.php');
20
  require_once('lib/wfScanEngine.php');
21
 
1
  <?php
2
  /* Don't remove this line. WFSOURCEVISIBLE */
3
+ define('WORDFENCE_SCAN_MODE', true); //So that we can include wordfence.php and get the version constant
4
  ignore_user_abort(true);
5
  $wordfence_wp_version = false;
6
  if ( !defined('ABSPATH') ) {
17
  require_once('../../../wp-includes/version.php');
18
  }
19
  }
20
+ require_once('wordfence.php');
21
  require_once('lib/wordfenceConstants.php');
22
  require_once('lib/wfScanEngine.php');
23
 
wordfence.php CHANGED
@@ -4,16 +4,17 @@ Plugin Name: Wordfence Security
4
  Plugin URI: http://wordfence.com/
5
  Description: Wordfence Security - Anti-virus and Firewall security plugin for WordPress
6
  Author: Mark Maunder
7
- Version: 2.1.1
8
  Author URI: http://wordfence.com/
9
  */
10
- define('WORDFENCE_VERSION', '2.1.1');
11
-
12
- require_once('lib/wordfenceConstants.php');
13
- require_once('lib/wordfenceClass.php');
14
- register_activation_hook(WP_PLUGIN_DIR . '/wordfence/wordfence.php', 'wordfence::installPlugin');
15
- register_deactivation_hook(WP_PLUGIN_DIR . '/wordfence/wordfence.php', 'wordfence::uninstallPlugin');
16
- wordfence::install_actions();
17
 
 
 
 
 
 
 
 
18
 
19
  ?>
4
  Plugin URI: http://wordfence.com/
5
  Description: Wordfence Security - Anti-virus and Firewall security plugin for WordPress
6
  Author: Mark Maunder
7
+ Version: 2.1.2
8
  Author URI: http://wordfence.com/
9
  */
10
+ define('WORDFENCE_VERSION', '2.1.2');
 
 
 
 
 
 
11
 
12
+ if(! defined('WORDFENCE_SCAN_MODE')){
13
+ require_once('lib/wordfenceConstants.php');
14
+ require_once('lib/wordfenceClass.php');
15
+ register_activation_hook(WP_PLUGIN_DIR . '/wordfence/wordfence.php', 'wordfence::installPlugin');
16
+ register_deactivation_hook(WP_PLUGIN_DIR . '/wordfence/wordfence.php', 'wordfence::uninstallPlugin');
17
+ wordfence::install_actions();
18
+ }
19
 
20
  ?>