updated plugin Jetpack Protect version 2.0.0

This commit is contained in:
2024-02-08 12:31:43 +00:00
committed by Gitium
parent ce653dd56c
commit 8d5e7cc070
192 changed files with 5244 additions and 2003 deletions

View File

@ -186,7 +186,7 @@ class Waf_Compatibility {
$brute_force_allow_list = Jetpack_Options::get_raw_option( 'jetpack_protect_whitelist', false );
if ( false !== $brute_force_allow_list ) {
$waf_allow_list = self::merge_ip_allow_lists( $waf_allow_list, $brute_force_allow_list );
update_option( Waf_Initializer::NEEDS_UPDATE_OPTION_NAME, 1 );
update_option( Waf_Initializer::NEEDS_UPDATE_OPTION_NAME, true );
}
return $waf_allow_list;
@ -213,7 +213,7 @@ class Waf_Compatibility {
$brute_force_allow_list = Jetpack_Options::get_raw_option( 'jetpack_protect_whitelist', false );
if ( false !== $brute_force_allow_list ) {
$waf_allow_list = self::merge_ip_allow_lists( $waf_allow_list, $brute_force_allow_list );
update_option( Waf_Initializer::NEEDS_UPDATE_OPTION_NAME, 1 );
update_option( Waf_Initializer::NEEDS_UPDATE_OPTION_NAME, true );
}
return $waf_allow_list;

View File

@ -11,7 +11,7 @@ use WP_CLI;
use WP_CLI_Command;
/**
* Just a few sample commands to learn how WP-CLI works
* Set up the WAF, change its mode, or generate its rules.
*/
class CLI extends WP_CLI_Command {
/**

View File

@ -155,7 +155,7 @@ class Waf_Initializer {
return;
}
update_option( self::NEEDS_UPDATE_OPTION_NAME, 1 );
update_option( self::NEEDS_UPDATE_OPTION_NAME, true );
}
/**
@ -197,9 +197,10 @@ class Waf_Initializer {
// just migrate the IP allow list used by brute force protection.
Waf_Compatibility::migrate_brute_force_protection_ip_allow_list();
}
update_option( self::NEEDS_UPDATE_OPTION_NAME, false );
}
update_option( self::NEEDS_UPDATE_OPTION_NAME, 0 );
return true;
}

View File

@ -80,7 +80,7 @@ class Waf_Standalone_Bootstrap {
if ( isset( $jetpack_autoloader_loader ) ) {
$class_file = $jetpack_autoloader_loader->find_class_file( Waf_Runner::class );
if ( $class_file ) {
$autoload_file = dirname( dirname( dirname( dirname( dirname( $class_file ) ) ) ) ) . '/vendor/autoload.php';
$autoload_file = dirname( $class_file, 5 ) . '/vendor/autoload.php';
}
}
@ -91,13 +91,13 @@ class Waf_Standalone_Bootstrap {
) {
$package_file = InstalledVersions::getInstallPath( 'automattic/jetpack-waf' );
if ( substr( $package_file, -23 ) === '/automattic/jetpack-waf' ) {
$autoload_file = dirname( dirname( dirname( $package_file ) ) ) . '/vendor/autoload.php';
$autoload_file = dirname( $package_file, 3 ) . '/vendor/autoload.php';
}
}
// Guess. First look for being in a `vendor/automattic/jetpack-waf/src/', then see if we're standalone with our own vendor dir.
if ( null === $autoload_file ) {
$autoload_file = dirname( dirname( dirname( dirname( __DIR__ ) ) ) ) . '/vendor/autoload.php';
$autoload_file = dirname( __DIR__, 4 ) . '/vendor/autoload.php';
if ( ! file_exists( $autoload_file ) ) {
$autoload_file = dirname( __DIR__ ) . '/vendor/autoload.php';
}

View File

@ -52,8 +52,12 @@ class Waf_Stats {
* Get Rules version
*
* @return bool|string False if value is not found. The current stored rules version if cache is found.
*
* @deprecated 0.12.3 Use Automattic\Jetpack\Waf\Waf_Stats::get_automatic_rules_last_updated() to version the rules instead.
*/
public static function get_rules_version() {
_deprecated_function( __METHOD__, 'waf-0.12.3', 'Automattic\Jetpack\Waf\Waf_Stats::get_automatic_rules_last_updated' );
return get_option( Waf_Rules_Manager::VERSION_OPTION_NAME );
}