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-item/class-plugin-integrity.php +24 -12 5.3.1 → 6.3.0 View file →
@@ -15,9 +15,9 @@
15 15 use WP_Defender\Traits\Formats;
16 16 use Calotes\Component\Behavior;
17 17 use WP_Defender\Model\Scan_Item;
18 18 use WP_Defender\Traits\File_Operations;
19 -use WP_Defender\Component\Quarantine as Quarantine_Component;
19 +use WP_Filesystem_Base;
20 20
21 21 /**
22 22 * Class Plugin_Integrity
23 23 * This class represents a plugin integrity behavior.
@@ -36,16 +36,14 @@
36 36 */
37 37 public function to_array(): array {
38 38 $data = $this->owner->raw_data;
39 39 $file = $data['file'];
40 - list ( $file_created_at, $file_size, $deleted ) = $this->get_file_meta( $file );
40 + list( $file_created_at, $file_size, $deleted ) = $this->get_file_meta( $file );
41 41
42 - $is_quarantinable = $this->is_quarantinable( $this->owner->raw_data['file'] );
42 + if ( class_exists( 'WP_Defender\Component\Quarantine' ) ) {
43 + $quarantine_data = wd_di()->get( \WP_Defender\Component\Quarantine::class )->scan_item_data( $this->owner );
44 + }
43 45
44 - $quarantine_data = class_exists( 'WP_Defender\Component\Quarantine' ) ?
45 - wd_di()->get( Quarantine_Component::class )->scan_item_data( $this->owner ) :
46 - array( 'is_quarantinable' => $is_quarantinable );
47 -
48 46 return array_merge(
49 47 array(
50 48 'id' => $this->owner->id,
51 49 'type' => Scan_Item::TYPE_PLUGIN_CHECK,
@@ -90,9 +88,9 @@
90 88 */
91 89 public function resolve() {
92 90 global $wp_filesystem;
93 91 // Initialize the WP filesystem, no more using 'file-put-contents' function.
94 - if ( empty( $wp_filesystem ) ) {
92 + if ( ! $wp_filesystem instanceof WP_Filesystem_Base ) {
95 93 require_once ABSPATH . '/wp-admin/includes/file.php';
96 94 WP_Filesystem();
97 95 }
98 96 $data = $this->owner->raw_data;
@@ -132,12 +130,26 @@
132 130 *
133 131 * @return array An array with a message indicating successful ignore.
134 132 */
135 133 public function ignore(): array {
136 - $scan = Scan::get_last();
137 - $scan->ignore_issue( $this->owner->id );
134 + $scan = Scan::get_last();
135 + $data = $this->owner->raw_data;
136 + $issue_name = '<b>' . pathinfo( $data['file'], PATHINFO_BASENAME ) . '</b>';
137 + $res = $scan->ignore_issue( $this->owner->id );
138 + if ( ! $res ) {
139 + return array(
140 + 'type_notice' => 'error',
141 + 'message' => $this->get_failed_ignore_result( $issue_name ),
142 + );
143 + }
138 144
139 - return array( 'message' => esc_html__( 'The suspicious file has been successfully ignored.', 'defender-security' ) );
145 + return array(
146 + 'message' => sprintf(
147 + /* translators: %s: Scan issue name. */
148 + esc_html__( 'You’ve successfully ignored the security issue related to %s.', 'defender-security' ),
149 + $issue_name
150 + ),
151 + );
140 152 }
141 153
142 154 /**
143 155 * Allow the suspicious file for the current scan.
@@ -184,9 +196,9 @@
184 196 */
185 197 public function pull_src(): array {
186 198 global $wp_filesystem;
187 199 // Initialize the WP filesystem, no more using 'file-put-contents' function.
188 - if ( empty( $wp_filesystem ) ) {
200 + if ( ! $wp_filesystem instanceof WP_Filesystem_Base ) {
189 201 require_once ABSPATH . '/wp-admin/includes/file.php';
190 202 WP_Filesystem();
191 203 }
192 204 $data = $this->owner->raw_data;