rebase code on oct-10-2023
This commit is contained in:
@@ -17,7 +17,8 @@ class wfWAFStorageFile implements wfWAFStorageInterface {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (wfWAFUtils::isCli()) {
|
||||
$sapi = @php_sapi_name();
|
||||
if ($sapi == "cli") {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
||||
@@ -1229,9 +1229,6 @@ class wfWAFUtils {
|
||||
public static function isVersionBelow($target, $compared) {
|
||||
return $compared === null || version_compare($compared, $target, '<');
|
||||
}
|
||||
|
||||
public static function isCli() {
|
||||
return (@php_sapi_name()==='cli') || !array_key_exists('REQUEST_METHOD', $_SERVER);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -328,11 +328,6 @@ auEa+7b+FGTKs7dUo2BNGR7OVifK4GZ8w/ajS0TelhrSRi3BBQCGXLzUO/UURUAh
|
||||
public function loadRules() {
|
||||
$storageEngine = $this->getStorageEngine();
|
||||
if ($storageEngine instanceof wfWAFStorageFile) {
|
||||
$logLevel = error_reporting();
|
||||
if (wfWAFUtils::isCli()) { //Done to suppress errors from WP-CLI when the WAF is run on environments that have a server level constant to use the MySQLi storage engine that is not in place when running from the CLI
|
||||
error_reporting(0);
|
||||
}
|
||||
|
||||
// Acquire lock on this file so we're not including it while it's being written in another process.
|
||||
$handle = fopen($storageEngine->getRulesFile(), 'r');
|
||||
$locked = $handle !== false && flock($handle, LOCK_SH);
|
||||
@@ -342,10 +337,6 @@ auEa+7b+FGTKs7dUo2BNGR7OVifK4GZ8w/ajS0TelhrSRi3BBQCGXLzUO/UURUAh
|
||||
flock($handle, LOCK_UN);
|
||||
if ($handle !== false)
|
||||
fclose($handle);
|
||||
|
||||
if (wfWAFUtils::isCli()) {
|
||||
error_reporting($logLevel);
|
||||
}
|
||||
} else {
|
||||
$wafRules = $storageEngine->getRules();
|
||||
if (is_array($wafRules)) {
|
||||
|
||||
Reference in New Issue
Block a user