| @@ -24,8 +24,9 @@ | ||
| 24 | 24 | use WP_Defender\Component\Config\Config_Adapter; |
| 25 | 25 | use WP_Defender\Model\Setting\User_Agent_Lockout; |
| 26 | 26 | use WP_Defender\Model\Notification\Malware_Report; |
| 27 | 27 | use WP_Defender\Model\Notification\Tweak_Reminder; |
| 28 | +use WP_Defender\Component\Scan as Scan_Component; | |
| 28 | 29 | use WP_Defender\Component\Config\Config_Hub_Helper; |
| 29 | 30 | use WP_Defender\Model\Notification\Firewall_Report; |
| 30 | 31 | use WP_Defender\Model\Notification\Malware_Notification; |
| 31 | 32 | use WP_Defender\Model\Notification\Firewall_Notification; |
| @@ -41,15 +42,8 @@ | ||
| 41 | 42 | use IO; |
| 42 | 43 | use Formats; |
| 43 | 44 | |
| 44 | 45 | /** |
| 45 | - * Flag indicating whether to display the onboarding view or not. | |
| 46 | - * | |
| 47 | - * @var bool | |
| 48 | - */ | |
| 49 | - private $view_onboard = false; | |
| 50 | - | |
| 51 | - /** | |
| 52 | 46 | * Initializes the model and service, registers routes, and sets up scheduled events if the model is active. |
| 53 | 47 | */ |
| 54 | 48 | public function __construct() { |
| 55 | 49 | $this->attach_behavior( WPMUDEV::class, WPMUDEV::class ); |
| @@ -92,8 +86,17 @@ | ||
| 92 | 86 | /** |
| 93 | 87 | * Create new scan, triggered from HUB. |
| 94 | 88 | */ |
| 95 | 89 | public function new_scan() { |
| 90 | + $scan_component = wd_di()->get( Scan_Component::class ); | |
| 91 | + if ( ! $scan_component->is_any_scan_type_active() ) { | |
| 92 | + wp_send_json_error( | |
| 93 | + array( | |
| 94 | + 'message' => Scan_Component::get_emergency_scan_stop_text(), | |
| 95 | + ) | |
| 96 | + ); | |
| 97 | + } | |
| 98 | + | |
| 96 | 99 | $scan = \WP_Defender\Model\Scan::create(); |
| 97 | 100 | if ( is_wp_error( $scan ) ) { |
| 98 | 101 | wp_send_json_error( |
| 99 | 102 | array( |
| @@ -480,15 +483,11 @@ | ||
| 480 | 483 | ), |
| 481 | 484 | '404_lockout' => Lockout_Log::count( |
| 482 | 485 | strtotime( '-24 hours' ), |
| 483 | 486 | time(), |
| 484 | - array( Lockout_Log::LOCKOUT_404 ) | |
| 487 | + Lockout_Log::get_404_lockout_types() | |
| 485 | 488 | ), |
| 486 | - 'user_agent_lockout' => Lockout_Log::count( | |
| 487 | - strtotime( '-24 hours' ), | |
| 488 | - time(), | |
| 489 | - array( Lockout_Log::LOCKOUT_UA ) | |
| 490 | - ), | |
| 489 | + 'user_agent_lockout' => Lockout_Log::count_ua_lockouts_in_24_hours(), | |
| 491 | 490 | ), |
| 492 | 491 | '7_days' => array( |
| 493 | 492 | 'login_lockout' => Lockout_Log::count_login_lockout_last_7_days(), |
| 494 | 493 | '404_lockout' => Lockout_Log::count_404_lockout_last_7_days(), |
| @@ -507,9 +506,9 @@ | ||
| 507 | 506 | ), |
| 508 | 507 | 'user_agent_lockout' => Lockout_Log::count( |
| 509 | 508 | strtotime( '-30 days' ), |
| 510 | 509 | time(), |
| 511 | - array( Lockout_Log::LOCKOUT_UA ) | |
| 510 | + Lockout_Log::get_ua_lockout_types() | |
| 512 | 511 | ), |
| 513 | 512 | ), |
| 514 | 513 | 'notification_status' => array( |
| 515 | 514 | 'login_lockout' => $login_lockout, |
| @@ -618,26 +617,8 @@ | ||
| 618 | 617 | * @return array An array of strings. |
| 619 | 618 | */ |
| 620 | 619 | public function export_strings(): array { |
| 621 | 620 | return array(); |
| 622 | - } | |
| 623 | - | |
| 624 | - /** | |
| 625 | - * Display Onboard if the bool value 'true' and vice versa. | |
| 626 | - * | |
| 627 | - * @param bool $is_show Settings to display. | |
| 628 | - */ | |
| 629 | - public function set_onboarding_status( $is_show ) { | |
| 630 | - $this->view_onboard = $is_show; | |
| 631 | - } | |
| 632 | - | |
| 633 | - /** | |
| 634 | - * Retrieve the Onboard status. | |
| 635 | - * | |
| 636 | - * @return bool | |
| 637 | - */ | |
| 638 | - public function get_onboarding_status(): bool { | |
| 639 | - return $this->view_onboard; | |
| 640 | 621 | } |
| 641 | 622 | |
| 642 | 623 | /** |
| 643 | 624 | * Activate/deactivate Captcha from HUB. |