Shield Security for WordPress - Version 12.0.3

Version Description

Download this release

Release Info

Developer paultgoodchild
Plugin Icon 128x128 Shield Security for WordPress
Version 12.0.3
Comparing to
See all releases

Code changes from version 12.0.2 to 12.0.3

icwp-wpsf.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: Shield Security
4
  * Plugin URI: https://shsec.io/2f
5
  * Description: Powerful, Easy-To-Use #1 Rated WordPress Security System
6
- * Version: 12.0.2
7
  * Text Domain: wp-simple-firewall
8
  * Domain Path: /languages
9
  * Author: Shield Security
3
  * Plugin Name: Shield Security
4
  * Plugin URI: https://shsec.io/2f
5
  * Description: Powerful, Easy-To-Use #1 Rated WordPress Security System
6
+ * Version: 12.0.3
7
  * Text Domain: wp-simple-firewall
8
  * Domain Path: /languages
9
  * Author: Shield Security
plugin-spec.php CHANGED
@@ -1,8 +1,8 @@
1
  {
2
  "properties": {
3
- "version": "12.0.2",
4
- "release_timestamp": 1632300000,
5
- "build": "202109.2201",
6
  "slug_parent": "icwp",
7
  "slug_plugin": "wpsf",
8
  "human_name": "Shield Security",
1
  {
2
  "properties": {
3
+ "version": "12.0.3",
4
+ "release_timestamp": 1632305800,
5
+ "build": "202109.2202",
6
  "slug_parent": "icwp",
7
  "slug_plugin": "wpsf",
8
  "human_name": "Shield Security",
plugin.json CHANGED
@@ -1,8 +1,8 @@
1
  {
2
  "properties": {
3
- "version": "12.0.2",
4
- "release_timestamp": 1632300000,
5
- "build": "202109.2201",
6
  "slug_parent": "icwp",
7
  "slug_plugin": "wpsf",
8
  "human_name": "Shield Security",
1
  {
2
  "properties": {
3
+ "version": "12.0.3",
4
+ "release_timestamp": 1632305800,
5
+ "build": "202109.2202",
6
  "slug_parent": "icwp",
7
  "slug_plugin": "wpsf",
8
  "human_name": "Shield Security",
readme.txt CHANGED
@@ -8,7 +8,7 @@ Requires at least: 3.7
8
  Requires PHP: 7.0
9
  Recommended PHP: 7.4
10
  Tested up to: 5.8
11
- Stable tag: 12.0.2
12
 
13
  No-Nonsense Security Hardening that protects WordPress against hackers, malicious bots, and spammers (no captchas!). Now with exclusive ShieldNET Technology.
14
 
8
  Requires PHP: 7.0
9
  Recommended PHP: 7.4
10
  Tested up to: 5.8
11
+ Stable tag: 12.0.3
12
 
13
  No-Nonsense Security Hardening that protects WordPress against hackers, malicious bots, and spammers (no captchas!). Now with exclusive ShieldNET Technology.
14
 
src/lib/src/Controller/Utilities/Upgrade.php CHANGED
@@ -13,18 +13,33 @@ class Upgrade {
13
 
14
  protected function canRun() :bool {
15
  $con = $this->getCon();
16
- return $con->cfg->previous_version !== $con->getVersion();
 
 
 
 
 
 
 
 
 
17
  }
18
 
19
  protected function run() {
20
  $con = $this->getCon();
21
 
 
 
22
  $this->upgradeModules();
23
  do_action( $con->prefix( 'plugin_shutdown' ), function () {
24
  $this->deleteOldModConfigs();
25
  } );
26
 
27
  $con->cfg->previous_version = $con->getVersion();
 
 
 
 
28
  }
29
 
30
  private function deleteOldModConfigs() {
13
 
14
  protected function canRun() :bool {
15
  $con = $this->getCon();
16
+ return $con->cfg->previous_version !== $con->getVersion()
17
+ && !$this->isAlreadyUpgrading();
18
+ }
19
+
20
+ protected function isAlreadyUpgrading() :bool {
21
+ $FS = Services::WpFs();
22
+ $upgradeFlag = $this->getCon()->getPluginCachePath( 'upgrading.flag' );
23
+ return !empty( $upgradeFlag )
24
+ && $FS->isFile( $upgradeFlag )
25
+ && ( Services::Request()->ts() - 600 ) < $FS->getModifiedTime( $upgradeFlag );
26
  }
27
 
28
  protected function run() {
29
  $con = $this->getCon();
30
 
31
+ Services::WpFs()->touch( $con->getPluginCachePath( 'upgrading.flag' ), Services::Request()->ts() );
32
+
33
  $this->upgradeModules();
34
  do_action( $con->prefix( 'plugin_shutdown' ), function () {
35
  $this->deleteOldModConfigs();
36
  } );
37
 
38
  $con->cfg->previous_version = $con->getVersion();
39
+
40
+ add_action( $con->prefix( 'plugin_shutdown' ), function () {
41
+ Services::WpFs()->deleteFile( $this->getCon()->getPluginCachePath( 'upgrading.flag' ) );
42
+ } );
43
  }
44
 
45
  private function deleteOldModConfigs() {
src/lib/src/Modules/Data/DB/IPs/IPRecords.php CHANGED
@@ -29,7 +29,7 @@ class IPRecords {
29
  }
30
 
31
  if ( empty( $record ) ) {
32
- throw new \Exception( 'IP Record unavailable' );
33
  }
34
 
35
  self::$ips[ $ip ] = $record;
29
  }
30
 
31
  if ( empty( $record ) ) {
32
+ throw new \Exception( 'IP Record unavailable: '.$ip );
33
  }
34
 
35
  self::$ips[ $ip ] = $record;
src/lib/src/Modules/Data/ModCon.php CHANGED
@@ -20,24 +20,30 @@ class ModCon extends BaseShield\ModCon {
20
  }
21
 
22
  protected function cleanupDatabases() {
 
23
 
24
  // 1. Clean Requests & Audit Trail
25
  // Deleting Request Logs automatically cascades to Audit Trail and then to Audit Trail Meta.
26
  /** @var AuditTrail\Options $optsAudit */
27
- $optsAudit = $this->getCon()->getModule_AuditTrail()->getOptions();
28
  /** @var Traffic\Options $optsTraffic */
29
- $optsTraffic = $this->getCon()->getModule_Traffic()->getOptions();
30
  $this->getDbH_ReqLogs()
31
  ->tableCleanExpired( max( $optsAudit->getAutoCleanDays(), $optsTraffic->getAutoCleanDays() ) );
32
 
33
  // 2. Clean Unused IPs.
34
  $this->getDbH_IPs()
35
  ->getQueryDeleter()
36
- ->addWhere( 'id',
37
- $this->getDbH_ReqLogs()
38
- ->getQuerySelector()
39
- ->getDistinctForColumn( 'ip_ref' ),
40
- 'NOT IN'
 
 
 
 
 
41
  );
42
  }
43
  }
20
  }
21
 
22
  protected function cleanupDatabases() {
23
+ $con = $this->getCon();
24
 
25
  // 1. Clean Requests & Audit Trail
26
  // Deleting Request Logs automatically cascades to Audit Trail and then to Audit Trail Meta.
27
  /** @var AuditTrail\Options $optsAudit */
28
+ $optsAudit = $con->getModule_AuditTrail()->getOptions();
29
  /** @var Traffic\Options $optsTraffic */
30
+ $optsTraffic = $con->getModule_Traffic()->getOptions();
31
  $this->getDbH_ReqLogs()
32
  ->tableCleanExpired( max( $optsAudit->getAutoCleanDays(), $optsTraffic->getAutoCleanDays() ) );
33
 
34
  // 2. Clean Unused IPs.
35
  $this->getDbH_IPs()
36
  ->getQueryDeleter()
37
+ ->addWhereNotIn( 'id',
38
+ array_unique( array_merge(
39
+ $this->getDbH_ReqLogs()
40
+ ->getQuerySelector()
41
+ ->getDistinctForColumn( 'ip_ref' ),
42
+ $con->getModule_IPs()
43
+ ->getDbH_BotSignal()
44
+ ->getQuerySelector()
45
+ ->getDistinctForColumn( 'ip_ref' )
46
+ ) )
47
  );
48
  }
49
  }
src/lib/src/Modules/IPs/Lib/Bots/Calculator/CalculateVisitorBotScores.php CHANGED
@@ -2,10 +2,8 @@
2
 
3
  namespace FernleafSystems\Wordpress\Plugin\Shield\Modules\IPs\Lib\Bots\Calculator;
4
 
5
- use FernleafSystems\Wordpress\Plugin\Shield\Databases\BotSignals\EntryVO;
6
  use FernleafSystems\Wordpress\Plugin\Shield\Modules\IPs\Components\IpAddressConsumer;
7
  use FernleafSystems\Wordpress\Plugin\Shield\Modules\IPs\DB\BotSignal\BotSignalRecord;
8
- use FernleafSystems\Wordpress\Plugin\Shield\Modules\IPs\DB\BotSignal\LoadBotSignalRecords;
9
  use FernleafSystems\Wordpress\Plugin\Shield\Modules\IPs\Lib\Bots\BotSignalsRecord;
10
  use FernleafSystems\Wordpress\Plugin\Shield\Modules\ModConsumer;
11
  use FernleafSystems\Wordpress\Services\Services;
@@ -55,7 +53,7 @@ class CalculateVisitorBotScores {
55
  ->retrieve();
56
  }
57
  catch ( \Exception $e ) {
58
- $entry = new EntryVO();
59
  $entry->ip = $ip;
60
  }
61
 
2
 
3
  namespace FernleafSystems\Wordpress\Plugin\Shield\Modules\IPs\Lib\Bots\Calculator;
4
 
 
5
  use FernleafSystems\Wordpress\Plugin\Shield\Modules\IPs\Components\IpAddressConsumer;
6
  use FernleafSystems\Wordpress\Plugin\Shield\Modules\IPs\DB\BotSignal\BotSignalRecord;
 
7
  use FernleafSystems\Wordpress\Plugin\Shield\Modules\IPs\Lib\Bots\BotSignalsRecord;
8
  use FernleafSystems\Wordpress\Plugin\Shield\Modules\ModConsumer;
9
  use FernleafSystems\Wordpress\Services\Services;
53
  ->retrieve();
54
  }
55
  catch ( \Exception $e ) {
56
+ $entry = new BotSignalRecord();
57
  $entry->ip = $ip;
58
  }
59
 
src/lib/src/Modules/IPs/Lib/IpAnalyse/BuildDisplay.php CHANGED
@@ -6,7 +6,7 @@ use FernleafSystems\Wordpress\Plugin\Shield\Databases;
6
  use FernleafSystems\Wordpress\Plugin\Shield\Modules\AuditTrail\DB\LoadLogs;
7
  use FernleafSystems\Wordpress\Plugin\Shield\Modules\AuditTrail\DB\Logs;
8
  use FernleafSystems\Wordpress\Plugin\Shield\Modules\AuditTrail\Lib\AuditMessageBuilder;
9
- use FernleafSystems\Wordpress\Plugin\Shield\Modules\GeoIp\Lookup;
10
  use FernleafSystems\Wordpress\Plugin\Shield\Modules\IPs\Components\IpAddressConsumer;
11
  use FernleafSystems\Wordpress\Plugin\Shield\Modules\IPs\Lib\Bots\BotSignalsRecord;
12
  use FernleafSystems\Wordpress\Plugin\Shield\Modules\IPs\Lib\Bots\Calculator\CalculateVisitorBotScores;
@@ -285,9 +285,16 @@ class BuildDisplay {
285
 
286
  list( $asArray[ 'path' ], $asArray[ 'query' ] ) = array_map( 'esc_js', explode( '?', $asArray[ 'path' ], 2 ) );
287
  $asArray[ 'trans' ] = (bool)$asArray[ 'offense' ];
 
 
 
 
288
  $requests[ $key ] = $asArray;
289
  }
290
 
 
 
 
291
  return $this->getMod()->renderTemplate(
292
  '/wpadmin_pages/insights/ips/ip_analyse/ip_traffic.twig',
293
  [
6
  use FernleafSystems\Wordpress\Plugin\Shield\Modules\AuditTrail\DB\LoadLogs;
7
  use FernleafSystems\Wordpress\Plugin\Shield\Modules\AuditTrail\DB\Logs;
8
  use FernleafSystems\Wordpress\Plugin\Shield\Modules\AuditTrail\Lib\AuditMessageBuilder;
9
+ use FernleafSystems\Wordpress\Plugin\Shield\Modules\Data\Lib\GeoIP\Lookup;
10
  use FernleafSystems\Wordpress\Plugin\Shield\Modules\IPs\Components\IpAddressConsumer;
11
  use FernleafSystems\Wordpress\Plugin\Shield\Modules\IPs\Lib\Bots\BotSignalsRecord;
12
  use FernleafSystems\Wordpress\Plugin\Shield\Modules\IPs\Lib\Bots\Calculator\CalculateVisitorBotScores;
285
 
286
  list( $asArray[ 'path' ], $asArray[ 'query' ] ) = array_map( 'esc_js', explode( '?', $asArray[ 'path' ], 2 ) );
287
  $asArray[ 'trans' ] = (bool)$asArray[ 'offense' ];
288
+
289
+ if ( empty( $asArray[ 'path' ] ) ) {
290
+ $asArray = null;
291
+ }
292
  $requests[ $key ] = $asArray;
293
  }
294
 
295
+ // remove duds after conversion @12.0
296
+ $requests = array_filter( $requests );
297
+
298
  return $this->getMod()->renderTemplate(
299
  '/wpadmin_pages/insights/ips/ip_analyse/ip_traffic.twig',
300
  [
src/lib/src/Modules/Traffic/Lib/Limit/Limiter.php CHANGED
@@ -40,7 +40,7 @@ class Limiter extends ExecOnceModConsumer {
40
  );
41
  }
42
  catch ( \Exception $e ) {
43
- error_log( $e->getMessage() );
44
  }
45
  }
46
  }
40
  );
41
  }
42
  catch ( \Exception $e ) {
43
+ // error_log( $e->getMessage() );
44
  }
45
  }
46
  }