Version Description
Download this release
Release Info
Developer | paultgoodchild |
Plugin | Shield Security for WordPress |
Version | 9.0.4 |
Comparing to | |
See all releases |
Code changes from version 9.0.3 to 9.0.4
- icwp-wpsf.php +1 -1
- plugin-spec.php +3 -3
- readme.txt +2 -1
- src/features/base.php +3 -6
- src/features/hack_protect.php +3 -22
- src/features/user_management.php +2 -7
- src/lib/src/Controller/Controller.php +13 -8
- src/lib/src/Databases/AuditTrail/Handler.php +1 -1
- src/lib/src/Databases/Base/Handler.php +93 -64
- src/lib/src/Databases/Traffic/Handler.php +1 -1
- src/lib/src/Modules/Base/BaseModCon.php +2 -6
- src/lib/src/Modules/Base/Options.php +5 -1
- src/lib/src/Modules/HackGuard/Lib/FileLocker/FileLockerController.php +30 -1
- src/lib/src/Modules/HackGuard/Lib/FileLocker/Ops/LoadFileLocks.php +0 -1
- src/lib/src/Tables/Build/BaseBuild.php +19 -19
- src/lib/vendor/composer/autoload_classmap.php +0 -1
- src/lib/vendor/composer/autoload_static.php +0 -1
- src/processors/sessions.php +1 -1
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: 9.0.
|
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: 9.0.4
|
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": "9.0.
|
4 |
-
"release_timestamp":
|
5 |
-
"build": "202006.
|
6 |
"slug_parent": "icwp",
|
7 |
"slug_plugin": "wpsf",
|
8 |
"human_name": "Shield",
|
1 |
{
|
2 |
"properties": {
|
3 |
+
"version": "9.0.4",
|
4 |
+
"release_timestamp": 1591349642,
|
5 |
+
"build": "202006.0501",
|
6 |
"slug_parent": "icwp",
|
7 |
"slug_plugin": "wpsf",
|
8 |
"human_name": "Shield",
|
readme.txt
CHANGED
@@ -8,7 +8,7 @@ Requires at least: 3.5.2
|
|
8 |
Requires PHP: 5.4.0
|
9 |
Recommended PHP: 7.0
|
10 |
Tested up to: 5.4
|
11 |
-
Stable tag: 9.0.
|
12 |
|
13 |
Smarter security protection from hackers through automation. Powerful scanners, 2-Factor Auth, limit logins, auto IP blocks & more.
|
14 |
|
@@ -377,6 +377,7 @@ You will always be able to use Shield Security and its free features in-full.
|
|
377 |
|
378 |
##### [Please review the full Shield 9.0 Upgrade Guide here](https://shsec.io/shieldupgradeguide90).
|
379 |
|
|
|
380 |
* **(.3) IMPROVED**: Scanning for SPAM email registrations is improved with more signals.
|
381 |
* **(.3) IMPROVED**: Better recovery from errors during certain scans.
|
382 |
* **(.3) IMPROVED**: WPHashes Token Retrieval.
|
8 |
Requires PHP: 5.4.0
|
9 |
Recommended PHP: 7.0
|
10 |
Tested up to: 5.4
|
11 |
+
Stable tag: 9.0.4
|
12 |
|
13 |
Smarter security protection from hackers through automation. Powerful scanners, 2-Factor Auth, limit logins, auto IP blocks & more.
|
14 |
|
377 |
|
378 |
##### [Please review the full Shield 9.0 Upgrade Guide here](https://shsec.io/shieldupgradeguide90).
|
379 |
|
380 |
+
* **(.4) FIX**: Timing error in some cases attempting to access database table when it hasn't been created.
|
381 |
* **(.3) IMPROVED**: Scanning for SPAM email registrations is improved with more signals.
|
382 |
* **(.3) IMPROVED**: Better recovery from errors during certain scans.
|
383 |
* **(.3) IMPROVED**: WPHashes Token Retrieval.
|
src/features/base.php
CHANGED
@@ -155,12 +155,8 @@ abstract class ICWP_WPSF_FeatureHandler_Base {
|
|
155 |
|
156 |
protected function cleanupDatabases() {
|
157 |
foreach ( $this->getDbHandlers( true ) as $oDbh ) {
|
158 |
-
|
159 |
-
|
160 |
-
$oDbh->autoCleanDb();
|
161 |
-
}
|
162 |
-
}
|
163 |
-
catch ( \Exception $oE ) {
|
164 |
}
|
165 |
}
|
166 |
}
|
@@ -649,6 +645,7 @@ abstract class ICWP_WPSF_FeatureHandler_Base {
|
|
649 |
/**
|
650 |
* @param array $aItems
|
651 |
* @return array
|
|
|
652 |
*/
|
653 |
public function addAdminMenuBarItems( array $aItems ) {
|
654 |
return $aItems;
|
155 |
|
156 |
protected function cleanupDatabases() {
|
157 |
foreach ( $this->getDbHandlers( true ) as $oDbh ) {
|
158 |
+
if ( $oDbh instanceof Shield\Databases\Base\Handler && $oDbh->isReady() ) {
|
159 |
+
$oDbh->autoCleanDb();
|
|
|
|
|
|
|
|
|
160 |
}
|
161 |
}
|
162 |
}
|
645 |
/**
|
646 |
* @param array $aItems
|
647 |
* @return array
|
648 |
+
* @deprecated 9.0.4
|
649 |
*/
|
650 |
public function addAdminMenuBarItems( array $aItems ) {
|
651 |
return $aItems;
|
src/features/hack_protect.php
CHANGED
@@ -21,25 +21,6 @@ class ICWP_WPSF_FeatureHandler_HackProtect extends ICWP_WPSF_FeatureHandler_Base
|
|
21 |
*/
|
22 |
private $oFileLocker;
|
23 |
|
24 |
-
/**
|
25 |
-
* @param array $aItems
|
26 |
-
* @return array
|
27 |
-
*/
|
28 |
-
public function addAdminMenuBarItems( array $aItems ) {
|
29 |
-
$oCon = $this->getCon();
|
30 |
-
$nCountFL = $this->getFileLocker()->countProblems();
|
31 |
-
if ( $nCountFL > 0 ) {
|
32 |
-
$aItems[] = [
|
33 |
-
'id' => $oCon->prefix( 'filelocker_problems' ),
|
34 |
-
'title' => __( 'File Locker', 'wp-simple-firewall' )
|
35 |
-
.sprintf( '<div class="wp-core-ui wp-ui-notification shield-counter"><span aria-hidden="true">%s</span></div>', $nCountFL ),
|
36 |
-
'href' => $this->getCon()->getModule_Insights()->getUrl_SubInsightsPage( 'scans' ),
|
37 |
-
'warnings' => $nCountFL
|
38 |
-
];
|
39 |
-
}
|
40 |
-
return $aItems;
|
41 |
-
}
|
42 |
-
|
43 |
protected function doPostConstruction() {
|
44 |
$this->setCustomCronSchedules();
|
45 |
}
|
@@ -137,9 +118,9 @@ class ICWP_WPSF_FeatureHandler_HackProtect extends ICWP_WPSF_FeatureHandler_Base
|
|
137 |
}
|
138 |
|
139 |
if ( count( $oOpts->getFilesToLock() ) === 0 || !$this->getCon()
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
$oOpts->setOpt( 'file_locker', [] );
|
144 |
$this->getFileLocker()->purge();
|
145 |
}
|
21 |
*/
|
22 |
private $oFileLocker;
|
23 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
24 |
protected function doPostConstruction() {
|
25 |
$this->setCustomCronSchedules();
|
26 |
}
|
118 |
}
|
119 |
|
120 |
if ( count( $oOpts->getFilesToLock() ) === 0 || !$this->getCon()
|
121 |
+
->getModule_Plugin()
|
122 |
+
->getShieldNetApiController()
|
123 |
+
->canHandshake() ) {
|
124 |
$oOpts->setOpt( 'file_locker', [] );
|
125 |
$this->getFileLocker()->purge();
|
126 |
}
|
src/features/user_management.php
CHANGED
@@ -67,13 +67,8 @@ class ICWP_WPSF_FeatureHandler_UserManagement extends \ICWP_WPSF_FeatureHandler_
|
|
67 |
* @return bool
|
68 |
*/
|
69 |
public function isUserSessionsManagementEnabled() {
|
70 |
-
|
71 |
-
|
72 |
-
&& $this->getDbHandler_Sessions()->isReady();
|
73 |
-
}
|
74 |
-
catch ( \Exception $oE ) {
|
75 |
-
return false;
|
76 |
-
}
|
77 |
}
|
78 |
|
79 |
/**
|
67 |
* @return bool
|
68 |
*/
|
69 |
public function isUserSessionsManagementEnabled() {
|
70 |
+
return $this->isOpt( 'enable_user_management', 'Y' )
|
71 |
+
&& $this->getDbHandler_Sessions()->isReady();
|
|
|
|
|
|
|
|
|
|
|
72 |
}
|
73 |
|
74 |
/**
|
src/lib/src/Controller/Controller.php
CHANGED
@@ -284,7 +284,6 @@ class Controller {
|
|
284 |
if ( apply_filters( $this->prefix( 'delete_on_deactivate' ), false ) ) {
|
285 |
$this->plugin_deleting = true;
|
286 |
do_action( $this->prefix( 'delete_plugin' ) );
|
287 |
-
$this->deletePluginControllerOptions();
|
288 |
}
|
289 |
}
|
290 |
$this->deleteCronJobs();
|
@@ -1646,6 +1645,9 @@ class Controller {
|
|
1646 |
return self::$oControllerOptions;
|
1647 |
}
|
1648 |
|
|
|
|
|
|
|
1649 |
protected function deletePluginControllerOptions() {
|
1650 |
$this->setPluginControllerOptions( false );
|
1651 |
$this->saveCurrentPluginControllerOptions();
|
@@ -1688,15 +1690,18 @@ class Controller {
|
|
1688 |
return apply_filters( $this->prefix( 'is_relabelled' ), false );
|
1689 |
}
|
1690 |
|
1691 |
-
/**
|
1692 |
-
*/
|
1693 |
protected function saveCurrentPluginControllerOptions() {
|
1694 |
-
|
1695 |
-
if ( $this->
|
1696 |
-
|
1697 |
-
|
1698 |
-
|
|
|
|
|
|
|
|
|
1699 |
}
|
|
|
1700 |
}
|
1701 |
|
1702 |
/**
|
284 |
if ( apply_filters( $this->prefix( 'delete_on_deactivate' ), false ) ) {
|
285 |
$this->plugin_deleting = true;
|
286 |
do_action( $this->prefix( 'delete_plugin' ) );
|
|
|
287 |
}
|
288 |
}
|
289 |
$this->deleteCronJobs();
|
1645 |
return self::$oControllerOptions;
|
1646 |
}
|
1647 |
|
1648 |
+
/**
|
1649 |
+
* @deprecated 9.0.4
|
1650 |
+
*/
|
1651 |
protected function deletePluginControllerOptions() {
|
1652 |
$this->setPluginControllerOptions( false );
|
1653 |
$this->saveCurrentPluginControllerOptions();
|
1690 |
return apply_filters( $this->prefix( 'is_relabelled' ), false );
|
1691 |
}
|
1692 |
|
|
|
|
|
1693 |
protected function saveCurrentPluginControllerOptions() {
|
1694 |
+
add_filter( $this->prefix( 'bypass_is_plugin_admin' ), '__return_true' );
|
1695 |
+
if ( $this->plugin_deleting ) {
|
1696 |
+
Services::WpGeneral()->deleteOption( $this->getPluginControllerOptionsKey() );
|
1697 |
+
}
|
1698 |
+
else {
|
1699 |
+
$oOptions = $this->getPluginControllerOptions();
|
1700 |
+
if ( $this->sConfigOptionsHashWhenLoaded != md5( serialize( $oOptions ) ) ) {
|
1701 |
+
Services::WpGeneral()->updateOption( $this->getPluginControllerOptionsKey(), $oOptions );
|
1702 |
+
}
|
1703 |
}
|
1704 |
+
remove_filter( $this->prefix( 'bypass_is_plugin_admin' ), '__return_true' );
|
1705 |
}
|
1706 |
|
1707 |
/**
|
src/lib/src/Databases/AuditTrail/Handler.php
CHANGED
@@ -11,7 +11,7 @@ class Handler extends Base\Handler {
|
|
11 |
/** @var Options $oOpts */
|
12 |
$oOpts = $this->getMod()->getOptions();
|
13 |
$this->cleanDb( $oOpts->getAutoCleanDays() );
|
14 |
-
$this->
|
15 |
}
|
16 |
|
17 |
/**
|
11 |
/** @var Options $oOpts */
|
12 |
$oOpts = $this->getMod()->getOptions();
|
13 |
$this->cleanDb( $oOpts->getAutoCleanDays() );
|
14 |
+
$this->tableTrimExcess( $oOpts->getMaxEntries() );
|
15 |
}
|
16 |
|
17 |
/**
|
src/lib/src/Databases/Base/Handler.php
CHANGED
@@ -32,9 +32,15 @@ class Handler {
|
|
32 |
|
33 |
/**
|
34 |
* @var bool
|
|
|
35 |
*/
|
36 |
private $bTableExist;
|
37 |
|
|
|
|
|
|
|
|
|
|
|
38 |
/**
|
39 |
* @var string
|
40 |
*/
|
@@ -58,46 +64,14 @@ class Handler {
|
|
58 |
return $this;
|
59 |
}
|
60 |
|
61 |
-
/**
|
62 |
-
* @param int $nRowsLimit
|
63 |
-
* @return $this;
|
64 |
-
*/
|
65 |
-
public function trimDb( $nRowsLimit ) {
|
66 |
-
try {
|
67 |
-
$this->getQueryDeleter()
|
68 |
-
->deleteExcess( $nRowsLimit );
|
69 |
-
}
|
70 |
-
catch ( \Exception $oE ) {
|
71 |
-
}
|
72 |
-
return $this;
|
73 |
-
}
|
74 |
-
|
75 |
/**
|
76 |
* @param int $nTimeStamp
|
77 |
* @return bool
|
78 |
*/
|
79 |
public function deleteRowsOlderThan( $nTimeStamp ) {
|
80 |
-
$
|
81 |
-
|
82 |
-
|
83 |
-
$bSuccess = $this->getQueryDeleter()
|
84 |
-
->addWhereOlderThan( $nTimeStamp )
|
85 |
-
->query();
|
86 |
-
}
|
87 |
-
}
|
88 |
-
catch ( \Exception $oE ) {
|
89 |
-
}
|
90 |
-
return $bSuccess;
|
91 |
-
}
|
92 |
-
|
93 |
-
/**
|
94 |
-
* @param bool $bTruncate
|
95 |
-
* @return bool
|
96 |
-
*/
|
97 |
-
public function deleteTable( $bTruncate = false ) {
|
98 |
-
$oDB = Services::WpDb();
|
99 |
-
return $this->isTable() &&
|
100 |
-
( $bTruncate ? $oDB->doTruncateTable( $this->getTable() ) : $oDB->doDropTable( $this->getTable() ) );
|
101 |
}
|
102 |
|
103 |
/**
|
@@ -195,6 +169,41 @@ class Handler {
|
|
195 |
return in_array( strtolower( $sCol ), array_map( 'strtolower', $this->getColumnsActual() ) );
|
196 |
}
|
197 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
198 |
/**
|
199 |
* @return $this
|
200 |
* @throws \Exception
|
@@ -202,10 +211,7 @@ class Handler {
|
|
202 |
public function tableInit() {
|
203 |
if ( !$this->isReady() ) {
|
204 |
|
205 |
-
|
206 |
-
if ( $this->isTable() ) {
|
207 |
-
$this->tableCreate();
|
208 |
-
}
|
209 |
|
210 |
if ( !$this->isReady( true ) ) {
|
211 |
$this->deleteTable();
|
@@ -216,46 +222,38 @@ class Handler {
|
|
216 |
}
|
217 |
|
218 |
/**
|
219 |
-
* @
|
220 |
-
* @
|
221 |
*/
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
|
|
|
|
226 |
}
|
227 |
-
$sSql = sprintf( $sSql, $this->getTable(), Services::WpDb()->getCharCollate() );
|
228 |
-
Services::WpDb()->dbDelta( $sSql );
|
229 |
return $this;
|
230 |
}
|
231 |
|
232 |
/**
|
233 |
* @param bool $bReTest
|
234 |
* @return bool
|
235 |
-
* @throws \Exception
|
236 |
*/
|
237 |
public function isReady( $bReTest = false ) {
|
238 |
if ( $bReTest ) {
|
239 |
-
|
240 |
-
unset( $this->aColActual );
|
241 |
}
|
242 |
|
243 |
-
|
244 |
-
|
245 |
-
|
|
|
|
|
|
|
|
|
246 |
}
|
247 |
|
248 |
-
return $this->
|
249 |
-
}
|
250 |
-
|
251 |
-
/**
|
252 |
-
* @return bool
|
253 |
-
*/
|
254 |
-
public function isTable() {
|
255 |
-
if ( !isset( $this->bTableExist ) ) {
|
256 |
-
$this->bTableExist = Services::WpDb()->getIfTableExists( $this->getTable() );
|
257 |
-
}
|
258 |
-
return $this->bTableExist;
|
259 |
}
|
260 |
|
261 |
/**
|
@@ -333,4 +331,35 @@ class Handler {
|
|
333 |
}
|
334 |
return rtrim( $sNS, '\\' ).'\\';
|
335 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
336 |
}
|
32 |
|
33 |
/**
|
34 |
* @var bool
|
35 |
+
* @deprecated 9.0.4
|
36 |
*/
|
37 |
private $bTableExist;
|
38 |
|
39 |
+
/**
|
40 |
+
* @var bool
|
41 |
+
*/
|
42 |
+
private $bIsReady;
|
43 |
+
|
44 |
/**
|
45 |
* @var string
|
46 |
*/
|
64 |
return $this;
|
65 |
}
|
66 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
67 |
/**
|
68 |
* @param int $nTimeStamp
|
69 |
* @return bool
|
70 |
*/
|
71 |
public function deleteRowsOlderThan( $nTimeStamp ) {
|
72 |
+
return $this->isReady() && $this->getQueryDeleter()
|
73 |
+
->addWhereOlderThan( $nTimeStamp )
|
74 |
+
->query();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
75 |
}
|
76 |
|
77 |
/**
|
169 |
return in_array( strtolower( $sCol ), array_map( 'strtolower', $this->getColumnsActual() ) );
|
170 |
}
|
171 |
|
172 |
+
/**
|
173 |
+
* @return $this
|
174 |
+
* @throws \Exception
|
175 |
+
*/
|
176 |
+
protected function tableCreate() {
|
177 |
+
$sSql = $this->getSqlCreate();
|
178 |
+
if ( empty( $sSql ) ) {
|
179 |
+
throw new \Exception( 'Table Create SQL is empty' );
|
180 |
+
}
|
181 |
+
$oDB = Services::WpDb();
|
182 |
+
$sSql = sprintf( $sSql, $this->getTable(), $oDB->getCharCollate() );
|
183 |
+
$this->isTable() ? $oDB->dbDelta( $sSql ) : $oDB->doSql( $sSql );
|
184 |
+
return $this;
|
185 |
+
}
|
186 |
+
|
187 |
+
/**
|
188 |
+
* @param bool $bTruncate
|
189 |
+
* @return bool
|
190 |
+
*/
|
191 |
+
public function tableDelete( $bTruncate = false ) {
|
192 |
+
$table = $this->getTable();
|
193 |
+
$oDB = Services::WpDb();
|
194 |
+
$mResult = !$this->isTable() ||
|
195 |
+
( $bTruncate ? $oDB->doTruncateTable( $table ) : $oDB->doDropTable( $table ) );
|
196 |
+
$this->reset();
|
197 |
+
return $mResult !== false;
|
198 |
+
}
|
199 |
+
|
200 |
+
/**
|
201 |
+
* @return bool
|
202 |
+
*/
|
203 |
+
public function tableExists() {
|
204 |
+
return Services::WpDb()->getIfTableExists( $this->getTable() );
|
205 |
+
}
|
206 |
+
|
207 |
/**
|
208 |
* @return $this
|
209 |
* @throws \Exception
|
211 |
public function tableInit() {
|
212 |
if ( !$this->isReady() ) {
|
213 |
|
214 |
+
$this->tableCreate();
|
|
|
|
|
|
|
215 |
|
216 |
if ( !$this->isReady( true ) ) {
|
217 |
$this->deleteTable();
|
222 |
}
|
223 |
|
224 |
/**
|
225 |
+
* @param int $nRowsLimit
|
226 |
+
* @return $this;
|
227 |
*/
|
228 |
+
public function tableTrimExcess( $nRowsLimit ) {
|
229 |
+
try {
|
230 |
+
$this->getQueryDeleter()
|
231 |
+
->deleteExcess( $nRowsLimit );
|
232 |
+
}
|
233 |
+
catch ( \Exception $oE ) {
|
234 |
}
|
|
|
|
|
235 |
return $this;
|
236 |
}
|
237 |
|
238 |
/**
|
239 |
* @param bool $bReTest
|
240 |
* @return bool
|
|
|
241 |
*/
|
242 |
public function isReady( $bReTest = false ) {
|
243 |
if ( $bReTest ) {
|
244 |
+
$this->reset();
|
|
|
245 |
}
|
246 |
|
247 |
+
if ( !isset( $this->bIsReady ) ) {
|
248 |
+
try {
|
249 |
+
$this->bIsReady = $this->isTable() && $this->verifyTableStructure();
|
250 |
+
}
|
251 |
+
catch ( \Exception $e ) {
|
252 |
+
$this->bIsReady = false;
|
253 |
+
}
|
254 |
}
|
255 |
|
256 |
+
return $this->bIsReady;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
257 |
}
|
258 |
|
259 |
/**
|
331 |
}
|
332 |
return rtrim( $sNS, '\\' ).'\\';
|
333 |
}
|
334 |
+
|
335 |
+
/**
|
336 |
+
* @return $this
|
337 |
+
*/
|
338 |
+
private function reset() {
|
339 |
+
unset( $this->bIsReady );
|
340 |
+
unset( $this->aColActual );
|
341 |
+
return $this;
|
342 |
+
}
|
343 |
+
|
344 |
+
/**
|
345 |
+
* @return bool
|
346 |
+
* @deprecated 9.0.4
|
347 |
+
*/
|
348 |
+
public function isTable() {
|
349 |
+
return Services::WpDb()->getIfTableExists( $this->getTable() );
|
350 |
+
}
|
351 |
+
|
352 |
+
/**
|
353 |
+
* @param bool $bTruncate
|
354 |
+
* @return bool
|
355 |
+
* @deprecated 9.0.4
|
356 |
+
*/
|
357 |
+
public function deleteTable( $bTruncate = false ) {
|
358 |
+
$table = $this->getTable();
|
359 |
+
$oDB = Services::WpDb();
|
360 |
+
$mResult = !$this->isTable() ||
|
361 |
+
( $bTruncate ? $oDB->doTruncateTable( $table ) : $oDB->doDropTable( $table ) );
|
362 |
+
$this->reset();
|
363 |
+
return $mResult !== false;
|
364 |
+
}
|
365 |
}
|
src/lib/src/Databases/Traffic/Handler.php
CHANGED
@@ -11,7 +11,7 @@ class Handler extends Base\Handler {
|
|
11 |
/** @var Options $oOpts */
|
12 |
$oOpts = $this->getOptions();
|
13 |
$this->cleanDb( $oOpts->getAutoCleanDays() );
|
14 |
-
$this->
|
15 |
}
|
16 |
|
17 |
/**
|
11 |
/** @var Options $oOpts */
|
12 |
$oOpts = $this->getOptions();
|
13 |
$this->cleanDb( $oOpts->getAutoCleanDays() );
|
14 |
+
$this->tableTrimExcess( $oOpts->getMaxEntries() );
|
15 |
}
|
16 |
|
17 |
/**
|
src/lib/src/Modules/Base/BaseModCon.php
CHANGED
@@ -167,12 +167,8 @@ class BaseModCon {
|
|
167 |
|
168 |
protected function cleanupDatabases() {
|
169 |
foreach ( $this->getDbHandlers( true ) as $oDbh ) {
|
170 |
-
|
171 |
-
|
172 |
-
$oDbh->autoCleanDb();
|
173 |
-
}
|
174 |
-
}
|
175 |
-
catch ( \Exception $oE ) {
|
176 |
}
|
177 |
}
|
178 |
}
|
167 |
|
168 |
protected function cleanupDatabases() {
|
169 |
foreach ( $this->getDbHandlers( true ) as $oDbh ) {
|
170 |
+
if ( $oDbh instanceof Shield\Databases\Base\Handler && $oDbh->isReady() ) {
|
171 |
+
$oDbh->autoCleanDb();
|
|
|
|
|
|
|
|
|
172 |
}
|
173 |
}
|
174 |
}
|
src/lib/src/Modules/Base/Options.php
CHANGED
@@ -519,7 +519,11 @@ class Options {
|
|
519 |
foreach ( $this->getRawData_AllOptions() as $aOption ) {
|
520 |
$this->aOptionsKeys[] = $aOption[ 'key' ];
|
521 |
}
|
522 |
-
$this->aOptionsKeys = array_merge(
|
|
|
|
|
|
|
|
|
523 |
}
|
524 |
return $this->aOptionsKeys;
|
525 |
}
|
519 |
foreach ( $this->getRawData_AllOptions() as $aOption ) {
|
520 |
$this->aOptionsKeys[] = $aOption[ 'key' ];
|
521 |
}
|
522 |
+
$this->aOptionsKeys = array_merge(
|
523 |
+
$this->aOptionsKeys,
|
524 |
+
$this->getCommonStandardOptions(),
|
525 |
+
$this->getVirtualCommonOptions()
|
526 |
+
);
|
527 |
}
|
528 |
return $this->aOptionsKeys;
|
529 |
}
|
src/lib/src/Modules/HackGuard/Lib/FileLocker/FileLockerController.php
CHANGED
@@ -26,10 +26,12 @@ class FileLockerController {
|
|
26 |
->getModule_Plugin()
|
27 |
->getShieldNetApiController()
|
28 |
->canHandshake()
|
29 |
-
&& $oMod->getDbHandler_FileLocker()->
|
30 |
}
|
31 |
|
32 |
protected function run() {
|
|
|
|
|
33 |
add_action( $this->getCon()->prefix( 'plugin_shutdown' ), function () {
|
34 |
if ( !$this->getCon()->plugin_deactivating ) {
|
35 |
if ( $this->getOptions()->isOptChanged( 'file_locker' ) ) {
|
@@ -42,6 +44,24 @@ class FileLockerController {
|
|
42 |
} );
|
43 |
}
|
44 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
45 |
/**
|
46 |
* @return int
|
47 |
*/
|
@@ -181,4 +201,13 @@ class FileLockerController {
|
|
181 |
$oFile->max_paths = $nMaxPaths;
|
182 |
return $oFile;
|
183 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
184 |
}
|
26 |
->getModule_Plugin()
|
27 |
->getShieldNetApiController()
|
28 |
->canHandshake()
|
29 |
+
&& $oMod->getDbHandler_FileLocker()->isReady();
|
30 |
}
|
31 |
|
32 |
protected function run() {
|
33 |
+
add_filter( $this->getCon()->prefix( 'admin_bar_menu_items' ), [ $this, 'addAdminMenuBarItem' ], 100 );
|
34 |
+
|
35 |
add_action( $this->getCon()->prefix( 'plugin_shutdown' ), function () {
|
36 |
if ( !$this->getCon()->plugin_deactivating ) {
|
37 |
if ( $this->getOptions()->isOptChanged( 'file_locker' ) ) {
|
44 |
} );
|
45 |
}
|
46 |
|
47 |
+
/**
|
48 |
+
* @param array $aItems
|
49 |
+
* @return array
|
50 |
+
*/
|
51 |
+
public function addAdminMenuBarItem( array $aItems ) {
|
52 |
+
$nCountFL = $this->countProblems();
|
53 |
+
if ( $nCountFL > 0 ) {
|
54 |
+
$aItems[] = [
|
55 |
+
'id' => $this->getCon()->prefix( 'filelocker_problems' ),
|
56 |
+
'title' => __( 'File Locker', 'wp-simple-firewall' )
|
57 |
+
.sprintf( '<div class="wp-core-ui wp-ui-notification shield-counter"><span aria-hidden="true">%s</span></div>', $nCountFL ),
|
58 |
+
'href' => $this->getCon()->getModule_Insights()->getUrl_SubInsightsPage( 'scans' ),
|
59 |
+
'warnings' => $nCountFL
|
60 |
+
];
|
61 |
+
}
|
62 |
+
return $aItems;
|
63 |
+
}
|
64 |
+
|
65 |
/**
|
66 |
* @return int
|
67 |
*/
|
201 |
$oFile->max_paths = $nMaxPaths;
|
202 |
return $oFile;
|
203 |
}
|
204 |
+
|
205 |
+
/**
|
206 |
+
* @return FileLocker\Handler
|
207 |
+
*/
|
208 |
+
private function getDbHandler() {
|
209 |
+
/** @var \ICWP_WPSF_FeatureHandler_HackProtect $oMod */
|
210 |
+
$oMod = $this->getMod();
|
211 |
+
return $oMod->getDbHandler_FileLocker();
|
212 |
+
}
|
213 |
}
|
src/lib/src/Modules/HackGuard/Lib/FileLocker/Ops/LoadFileLocks.php
CHANGED
@@ -44,7 +44,6 @@ class LoadFileLocks {
|
|
44 |
return array_filter(
|
45 |
$this->loadLocks(),
|
46 |
function ( $oLock ) {
|
47 |
-
/** @var FileLocker\EntryVO $oLock */
|
48 |
return $oLock->detected_at > 0;
|
49 |
}
|
50 |
);
|
44 |
return array_filter(
|
45 |
$this->loadLocks(),
|
46 |
function ( $oLock ) {
|
|
|
47 |
return $oLock->detected_at > 0;
|
48 |
}
|
49 |
);
|
src/lib/src/Tables/Build/BaseBuild.php
CHANGED
@@ -25,30 +25,30 @@ class BaseBuild {
|
|
25 |
*/
|
26 |
public function buildTable() {
|
27 |
|
28 |
-
|
29 |
-
$bReady = $this->getDbHandler()->isReady();
|
30 |
-
}
|
31 |
-
catch ( \Exception $oE ) {
|
32 |
-
$bReady = false;
|
33 |
-
}
|
34 |
|
35 |
-
|
36 |
-
|
37 |
-
if ( $bReady && $this->countTotal() > 0 ) {
|
38 |
-
$oTable = $this->getTableRenderer()
|
39 |
-
->setItemEntries( $this->getEntriesFormatted() )
|
40 |
-
->setPerPage( $this->getParams()[ 'limit' ] )
|
41 |
-
->setTotalRecords( $this->countTotal() )
|
42 |
-
->prepare_items();
|
43 |
-
ob_start();
|
44 |
-
$oTable->display();
|
45 |
-
$sRendered = ob_get_clean();
|
46 |
}
|
47 |
else {
|
48 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
49 |
}
|
50 |
|
51 |
-
return
|
52 |
}
|
53 |
|
54 |
/**
|
25 |
*/
|
26 |
public function buildTable() {
|
27 |
|
28 |
+
$sRendered = null;
|
|
|
|
|
|
|
|
|
|
|
29 |
|
30 |
+
if ( !$this->getDbHandler()->isReady() ) {
|
31 |
+
$sRendered = __( 'There was an error retrieving entries.', 'wp-simple-firewall' );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
32 |
}
|
33 |
else {
|
34 |
+
$this->preBuildTable();
|
35 |
+
|
36 |
+
if ( $this->countTotal() > 0 ) {
|
37 |
+
$oTable = $this->getTableRenderer()
|
38 |
+
->setItemEntries( $this->getEntriesFormatted() )
|
39 |
+
->setPerPage( $this->getParams()[ 'limit' ] )
|
40 |
+
->setTotalRecords( $this->countTotal() )
|
41 |
+
->prepare_items();
|
42 |
+
ob_start();
|
43 |
+
$oTable->display();
|
44 |
+
$sRendered = ob_get_clean();
|
45 |
+
}
|
46 |
+
else {
|
47 |
+
$sRendered = $this->buildEmpty();
|
48 |
+
}
|
49 |
}
|
50 |
|
51 |
+
return $sRendered;
|
52 |
}
|
53 |
|
54 |
/**
|
src/lib/vendor/composer/autoload_classmap.php
CHANGED
@@ -172,7 +172,6 @@ return array(
|
|
172 |
'FernleafSystems\\Wordpress\\Plugin\\Shield\\Modules\\Base\\BaseModCon' => $baseDir . '/src/Modules/Base/BaseModCon.php',
|
173 |
'FernleafSystems\\Wordpress\\Plugin\\Shield\\Modules\\Base\\BaseProcessor' => $baseDir . '/src/Modules/Base/BaseProcessor.php',
|
174 |
'FernleafSystems\\Wordpress\\Plugin\\Shield\\Modules\\Base\\BaseReporting' => $baseDir . '/src/Modules/Base/BaseReporting.php',
|
175 |
-
'FernleafSystems\\Wordpress\\Plugin\\Shield\\Modules\\Base\\BaseService' => $baseDir . '/src/Modules/Base/Lib/BaseService.php',
|
176 |
'FernleafSystems\\Wordpress\\Plugin\\Shield\\Modules\\Base\\OneTimeExecute' => $baseDir . '/src/Modules/Base/OneTimeExecute.php',
|
177 |
'FernleafSystems\\Wordpress\\Plugin\\Shield\\Modules\\Base\\Options' => $baseDir . '/src/Modules/Base/Options.php',
|
178 |
'FernleafSystems\\Wordpress\\Plugin\\Shield\\Modules\\Base\\ShieldOptions' => $baseDir . '/src/Modules/Base/ShieldOptions.php',
|
172 |
'FernleafSystems\\Wordpress\\Plugin\\Shield\\Modules\\Base\\BaseModCon' => $baseDir . '/src/Modules/Base/BaseModCon.php',
|
173 |
'FernleafSystems\\Wordpress\\Plugin\\Shield\\Modules\\Base\\BaseProcessor' => $baseDir . '/src/Modules/Base/BaseProcessor.php',
|
174 |
'FernleafSystems\\Wordpress\\Plugin\\Shield\\Modules\\Base\\BaseReporting' => $baseDir . '/src/Modules/Base/BaseReporting.php',
|
|
|
175 |
'FernleafSystems\\Wordpress\\Plugin\\Shield\\Modules\\Base\\OneTimeExecute' => $baseDir . '/src/Modules/Base/OneTimeExecute.php',
|
176 |
'FernleafSystems\\Wordpress\\Plugin\\Shield\\Modules\\Base\\Options' => $baseDir . '/src/Modules/Base/Options.php',
|
177 |
'FernleafSystems\\Wordpress\\Plugin\\Shield\\Modules\\Base\\ShieldOptions' => $baseDir . '/src/Modules/Base/ShieldOptions.php',
|
src/lib/vendor/composer/autoload_static.php
CHANGED
@@ -327,7 +327,6 @@ class ComposerStaticInitfcf2fe1888f1f5fc092770cdc8ef3cf4
|
|
327 |
'FernleafSystems\\Wordpress\\Plugin\\Shield\\Modules\\Base\\BaseModCon' => __DIR__ . '/../..' . '/src/Modules/Base/BaseModCon.php',
|
328 |
'FernleafSystems\\Wordpress\\Plugin\\Shield\\Modules\\Base\\BaseProcessor' => __DIR__ . '/../..' . '/src/Modules/Base/BaseProcessor.php',
|
329 |
'FernleafSystems\\Wordpress\\Plugin\\Shield\\Modules\\Base\\BaseReporting' => __DIR__ . '/../..' . '/src/Modules/Base/BaseReporting.php',
|
330 |
-
'FernleafSystems\\Wordpress\\Plugin\\Shield\\Modules\\Base\\BaseService' => __DIR__ . '/../..' . '/src/Modules/Base/Lib/BaseService.php',
|
331 |
'FernleafSystems\\Wordpress\\Plugin\\Shield\\Modules\\Base\\OneTimeExecute' => __DIR__ . '/../..' . '/src/Modules/Base/OneTimeExecute.php',
|
332 |
'FernleafSystems\\Wordpress\\Plugin\\Shield\\Modules\\Base\\Options' => __DIR__ . '/../..' . '/src/Modules/Base/Options.php',
|
333 |
'FernleafSystems\\Wordpress\\Plugin\\Shield\\Modules\\Base\\ShieldOptions' => __DIR__ . '/../..' . '/src/Modules/Base/ShieldOptions.php',
|
327 |
'FernleafSystems\\Wordpress\\Plugin\\Shield\\Modules\\Base\\BaseModCon' => __DIR__ . '/../..' . '/src/Modules/Base/BaseModCon.php',
|
328 |
'FernleafSystems\\Wordpress\\Plugin\\Shield\\Modules\\Base\\BaseProcessor' => __DIR__ . '/../..' . '/src/Modules/Base/BaseProcessor.php',
|
329 |
'FernleafSystems\\Wordpress\\Plugin\\Shield\\Modules\\Base\\BaseReporting' => __DIR__ . '/../..' . '/src/Modules/Base/BaseReporting.php',
|
|
|
330 |
'FernleafSystems\\Wordpress\\Plugin\\Shield\\Modules\\Base\\OneTimeExecute' => __DIR__ . '/../..' . '/src/Modules/Base/OneTimeExecute.php',
|
331 |
'FernleafSystems\\Wordpress\\Plugin\\Shield\\Modules\\Base\\Options' => __DIR__ . '/../..' . '/src/Modules/Base/Options.php',
|
332 |
'FernleafSystems\\Wordpress\\Plugin\\Shield\\Modules\\Base\\ShieldOptions' => __DIR__ . '/../..' . '/src/Modules/Base/ShieldOptions.php',
|
src/processors/sessions.php
CHANGED
@@ -54,7 +54,7 @@ class ICWP_WPSF_Processor_Sessions extends Modules\BaseShield\ShieldProcessor {
|
|
54 |
/** @var \ICWP_WPSF_FeatureHandler_Sessions $oMod */
|
55 |
$oMod = $this->getMod();
|
56 |
|
57 |
-
if ( !Services::Rest()->isRest() ) {
|
58 |
$oSession = $this->getCurrentSession();
|
59 |
if ( $oSession instanceof Session\EntryVO ) {
|
60 |
/** @var Session\Update $oUpd */
|
54 |
/** @var \ICWP_WPSF_FeatureHandler_Sessions $oMod */
|
55 |
$oMod = $this->getMod();
|
56 |
|
57 |
+
if ( !Services::Rest()->isRest() && !$this->getCon()->plugin_deleting ) {
|
58 |
$oSession = $this->getCurrentSession();
|
59 |
if ( $oSession instanceof Session\EntryVO ) {
|
60 |
/** @var Session\Update $oUpd */
|