From 696be850523f52c15a6a2cefcb6b88186abea5d6 Mon Sep 17 00:00:00 2001 From: dkmyta Date: Thu, 29 Aug 2024 15:12:23 -0700 Subject: [PATCH] Fixes and improvements --- projects/packages/protect-models/src/class-status-model.php | 6 +++--- projects/packages/protect-status/src/class-scan-status.php | 2 +- .../packages/protect-status/tests/php/test-scan-status.php | 2 +- projects/plugins/protect/src/class-threats.php | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/projects/packages/protect-models/src/class-status-model.php b/projects/packages/protect-models/src/class-status-model.php index bd7b3c3e8d48d..e4a47ee5045ae 100644 --- a/projects/packages/protect-models/src/class-status-model.php +++ b/projects/packages/protect-models/src/class-status-model.php @@ -54,11 +54,11 @@ class Status_Model { public $status; /** - * Fixable threats. + * List of fixable threat IDs. * - * @var array + * @var number[] */ - public $fixable_threats = array(); + public $fixable_threat_ids = array(); /** * WordPress core status. diff --git a/projects/packages/protect-status/src/class-scan-status.php b/projects/packages/protect-status/src/class-scan-status.php index a1dc1df4b4659..0ed447f3b8fd3 100644 --- a/projects/packages/protect-status/src/class-scan-status.php +++ b/projects/packages/protect-status/src/class-scan-status.php @@ -170,7 +170,7 @@ private static function normalize_api_data( $scan_data ) { if ( isset( $scan_data->threats ) && is_array( $scan_data->threats ) ) { foreach ( $scan_data->threats as $threat ) { if ( isset( $threat->fixable ) && $threat->fixable ) { - $status->fixable_threats[] = $threat->id; + $status->fixable_threat_ids[] = $threat->id; } if ( isset( $threat->extension->type ) ) { diff --git a/projects/packages/protect-status/tests/php/test-scan-status.php b/projects/packages/protect-status/tests/php/test-scan-status.php index e9753f716f58d..1338590c783f1 100644 --- a/projects/packages/protect-status/tests/php/test-scan-status.php +++ b/projects/packages/protect-status/tests/php/test-scan-status.php @@ -134,7 +134,7 @@ public function get_sample_status() { 'num_plugins_threats' => 1, 'num_themes_threats' => 0, 'status' => 'idle', - 'fixable_threats' => array( '69353714' ), + 'fixable_threat_ids' => array( '69353714' ), 'plugins' => array( new Extension_Model( array( diff --git a/projects/plugins/protect/src/class-threats.php b/projects/plugins/protect/src/class-threats.php index fd4339d5efcc7..11030a4c29ef4 100644 --- a/projects/plugins/protect/src/class-threats.php +++ b/projects/plugins/protect/src/class-threats.php @@ -144,7 +144,7 @@ public static function fix_threats( $threat_ids ) { * @return bool|array */ public static function fix_threats_status( $threat_ids ) { - if ( ! $threat_ids ) { + if ( empty( $threat_ids ) ) { return false; }