PluginProbe
Elementor Website Builder – more than just a page builder / 4.3.1
Elementor Website Builder – more than just a page builder v4.3.1
4.3.1 4.3.0 4.3.0-beta3 4.3.0-beta2 4.3.0-beta1 4.2.4 4.2.3 4.2.2 4.2.1 4.2.0 4.1.5 4.2.0-beta2 4.2.0-dev2 4.2.0-beta1 4.1.4 4.1.3 4.1.2 4.1.1 4.1.0 4.1.0-beta3 4.1.0-dev3 4.0.9 4.1.0-beta2 4.1.0-dev2 4.0.8 All 454 releases
← All changes | modules/atomic-widgets/styles/atomic-widget-styles.php +32 -1 4.3.0-beta1 → 4.3.1 View file →
@@ -32,10 +32,41 @@
32 32 'deleted_post',
33 33 fn( $post_id ) => $this->invalidate_cache( [ $post_id ] )
34 34 );
35 35
36 - add_action( 'update_option__elementor_pro_license_v2_data', fn() => Plugin::$instance->files_manager->clear_cache() );
36 + add_action(
37 + 'update_option__elementor_pro_license_v2_data',
38 + fn( $old_value, $new_value ) => $this->on_license_data_update( $old_value, $new_value ),
39 + 10,
40 + 2
41 + );
42 +
37 43 add_action( 'delete_option__elementor_pro_license_v2_data', fn() => Plugin::$instance->files_manager->clear_cache() );
44 + }
45 +
46 + /**
47 + * Pro stores the license under a transient-style wrapper whose `timeout` is recomputed on
48 + * every write, so a routine re-validation reports a changed option even when the license
49 + * itself is identical. Purging the whole CSS directory on those refreshes deletes files that
50 + * in-flight requests have already enqueued, so only act on a real license change.
51 + */
52 + private function on_license_data_update( $old_value, $new_value ): void {
53 + $old_payload = $this->get_license_payload( $old_value );
54 +
55 + // Anything we can't positively read as an unchanged license falls through to a purge.
56 + if ( null !== $old_payload && $old_payload === $this->get_license_payload( $new_value ) ) {
57 + return;
58 + }
59 +
60 + Plugin::$instance->files_manager->clear_cache();
61 + }
62 +
63 + private function get_license_payload( $option_value ): ?string {
64 + if ( ! is_array( $option_value ) || ! isset( $option_value['value'] ) || ! is_string( $option_value['value'] ) ) {
65 + return null;
66 + }
67 +
68 + return $option_value['value'];
38 69 }
39 70
40 71 private function register_styles( Atomic_Styles_Manager $styles_manager, array $post_ids ) {
41 72 $context = $this->get_context( Plugin::$instance->preview->is_editor_or_preview() );