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-plugin-integrity.php +28 -6 6.2.2 → 6.3.0 View file →
@@ -28,11 +28,12 @@
28 28
29 29 use IO;
30 30 use Plugin;
31 31
32 - public const URL_PLUGIN_VCS = 'https://downloads.wordpress.org/plugin-checksums/';
33 - public const PLUGIN_SLUGS = 'wd_plugin_slugs_changes';
34 - public const PLUGIN_PREMIUM_SLUGS = 'wd_plugin_premium_slugs';
32 + public const URL_PLUGIN_VCS = 'https://downloads.wordpress.org/plugin-checksums/';
33 + public const PLUGIN_SLUGS = 'wd_plugin_slugs_changes';
34 + public const PLUGIN_SLUGS_CHECKPOINT = 'wd_plugin_slugs_changes_checkpoint';
35 + public const PLUGIN_PREMIUM_SLUGS = 'wd_plugin_premium_slugs';
35 36 /**
36 37 * List of premium plugin slugs.
37 38 *
38 39 * @var array
@@ -211,8 +212,11 @@
211 212 $timer = new Timer();
212 213 $model = $this->owner->scan;
213 214 $pos = (int) $model->task_checkpoint;
214 215 $plugin_files->seek( $pos );
216 + if ( 0 === $pos ) {
217 + delete_site_option( self::PLUGIN_SLUGS_CHECKPOINT );
218 + }
215 219 $slugs_of_edited_plugins = array();
216 220 $integration_smush = wd_di()->get( Smush::class );
217 221 $exist_smush_images = $integration_smush->exist_image_table();
218 222 while ( $plugin_files->valid() ) {
@@ -316,11 +320,9 @@
316 320 *
317 321 * @since 2.4.10
318 322 */
319 323 if ( ( new Scan_Settings() )->scan_malware ) {
320 - if ( array() !== $slugs_of_edited_plugins ) {
321 - update_site_option( self::PLUGIN_SLUGS, array_unique( $slugs_of_edited_plugins ) );
322 - }
324 + $this->persist_changed_plugin_slugs( $slugs_of_edited_plugins, ! $plugin_files->valid() );
323 325 if ( array() !== $this->premium_slugs ) {
324 326 update_site_option( self::PLUGIN_PREMIUM_SLUGS, $this->premium_slugs );
325 327 }
326 328 }
@@ -325,8 +327,28 @@
325 327 }
326 328 }
327 329
328 330 return ! $plugin_files->valid();
331 + }
332 +
333 + /**
334 + * Persist changed plugin slugs across checkpoint scan batches.
335 + *
336 + * @param array $batch_slugs Slugs found in the current batch.
337 + * @param bool $is_complete Whether the plugin integrity task has completed.
338 + *
339 + * @return void
340 + */
341 + private function persist_changed_plugin_slugs( array $batch_slugs, bool $is_complete ): void {
342 + $checkpoint_slugs = (array) get_site_option( self::PLUGIN_SLUGS_CHECKPOINT, array() );
343 + $changed_slugs = array_values( array_unique( array_merge( $checkpoint_slugs, $batch_slugs ) ) );
344 +
345 + if ( $is_complete ) {
346 + update_site_option( self::PLUGIN_SLUGS, $changed_slugs );
347 + delete_site_option( self::PLUGIN_SLUGS_CHECKPOINT );
348 + } else {
349 + update_site_option( self::PLUGIN_SLUGS_CHECKPOINT, $changed_slugs );
350 + }
329 351 }
330 352
331 353 /**
332 354 * Checks if given file is a valid image.