PluginProbe
Defender Security – Malware Scanner, Login Security & Firewall / 6.3.0
Defender Security – Malware Scanner, Login Security & Firewall v6.3.0
6.3.0 6.2.3 6.2.4 6.2.0 6.2.1 6.2.2 6.1.0 5.3.1 5.4.0 5.4.1 5.5.0 5.5.1 5.6.0 5.6.1 5.6.2 5.7.0 5.7.1 5.7.2 5.8.0 5.8.1 5.9.0 6.0.0 6.0.1 3.0.1 3.1.0 All 141 releases
← All changes | src/behavior/scan/class-malware-scan.php +16 -15 5.4.1 → 6.3.0 View file →
@@ -17,8 +17,9 @@
17 17 use WP_Defender\Model\Scan as Model_Scan;
18 18 use WP_Defender\Model\Setting\Scan as Scan_Settings;
19 19 use WP_Defender\Helper\Analytics\Scan as Scan_Analytics;
20 20 use WP_Defender\Controller\Scan as Scan_Controller;
21 +use WP_Defender\Component\Scan as Scan_Component;
21 22
22 23 /**
23 24 * It is responsible for performing suspicious checks on files using a quick scan and a deep scan.
24 25 */
@@ -76,26 +77,29 @@
76 77 $plugin_all_slugs = array();
77 78 // Checked Plugin option.
78 79 if ( $scan_settings->integrity_check && $scan_settings->check_plugins ) {
79 80 $plugin_cache = true;
80 - $arr = get_site_option( Plugin_Integrity::PLUGIN_SLUGS, false );
81 - if ( is_array( $arr ) && ! empty( $arr ) ) {
81 + $arr = get_site_option( Plugin_Integrity::PLUGIN_SLUGS, array() );
82 + if ( is_array( $arr ) && array() !== $arr ) {
82 83 $plugin_slugs_changes = $arr;
83 84 }
84 - $plugin_slugs = get_site_option( Plugin_Integrity::PLUGIN_PREMIUM_SLUGS, false );
85 - if ( is_array( $plugin_slugs ) && ! empty( $plugin_slugs ) ) {
85 + $plugin_slugs = get_site_option( Plugin_Integrity::PLUGIN_PREMIUM_SLUGS, array() );
86 + if ( is_array( $plugin_slugs ) && array() !== $plugin_slugs ) {
86 87 $plugin_pro_slugs = $plugin_slugs;
87 88 }
88 - $plugin_all_slugs = $this->get_plugin_slugs();
89 + $actioned_plugins = get_site_option( Scan_Component::PLUGINS_ACTIONED );
90 + $plugin_all_slugs = Scan_Component::are_actioned_plugins( $actioned_plugins )
91 + ? array_keys( $actioned_plugins )
92 + : $this->get_plugin_slugs();
89 93 }
90 94
91 95 return array(
92 96 'plugin_change' => $plugin_cache,
97 + 'plugin_all_slugs' => $plugin_all_slugs,
93 98 // List of plugins with modifications.
94 99 'plugin_slugs_changes' => $plugin_slugs_changes,
95 100 // List of pro plugins.
96 101 'plugin_pro_slugs' => $plugin_pro_slugs,
97 - 'plugin_all_slugs' => $plugin_all_slugs,
98 102 );
99 103 }
100 104
101 105 /**
@@ -127,9 +131,12 @@
127 131 // Custom files/dirs.
128 132 if ( ! in_array( $base_slug, $rules['plugin_all_slugs'], true ) ) {
129 133 return true;
130 134 }
131 - if ( empty( $rules['plugin_slugs_changes'] ) && empty( $rules['plugin_pro_slugs'] ) ) {
135 + if (
136 + ( ! isset( $rules['plugin_slugs_changes'] ) || array() === (array) $rules['plugin_slugs_changes'] )
137 + && ( ! isset( $rules['plugin_pro_slugs'] ) || array() === (array) $rules['plugin_pro_slugs'] )
138 + ) {
132 139 // No modifications.
133 140 return false;
134 141 }
135 142 // Is it on premium plugins?
@@ -158,9 +165,9 @@
158 165 * @return bool Returns true if the check is successful, false otherwise.
159 166 */
160 167 public function suspicious_check( Malware_Quick_Scan $quick_scan, Malware_Deep_Scan $deep_scan ): bool {
161 168 $files = get_site_option( Gather_Fact::CACHE_CONTENT, array() );
162 - if ( empty( $files ) ) {
169 + if ( array() === $files ) {
163 170 return true;
164 171 }
165 172
166 173 set_time_limit( 0 );
@@ -231,15 +238,9 @@
231 238 if ( ! $files->valid() ) {
232 239 $last = Model_Scan::get_last();
233 240 if ( is_object( $last ) ) {
234 241 $ignored_issues = $last->get_issues( Scan_Item::TYPE_SUSPICIOUS, Scan_Item::STATUS_IGNORE );
235 - foreach ( $ignored_issues as $issue ) {
236 - $this->scan->add_item(
237 - Scan_Item::TYPE_SUSPICIOUS,
238 - $issue->raw_data,
239 - Scan_Item::STATUS_IGNORE
240 - );
241 - }
242 + $this->scan->carry_forward_ignored_issues( Scan_Item::TYPE_SUSPICIOUS, $ignored_issues, 'file' );
242 243 }
243 244 $model->task_checkpoint = '';
244 245 }
245 246