Skip to content

Commit

Permalink
fix truncate rucss on wp-rocket options changes (#6122)
Browse files Browse the repository at this point in the history
  • Loading branch information
mostafa-hisham authored Aug 31, 2023
1 parent fe36a3c commit 92330e8
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 9 deletions.
2 changes: 1 addition & 1 deletion inc/Engine/Admin/DomainChange/Subscriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ public function maybe_clean_cache_domain_change() {
*
* @param array $value An array of submitted values for the settings.
*/
do_action( 'rocket_options_changed', $options );
do_action( 'rocket_domain_options_changed', $options );
}

/**
Expand Down
2 changes: 1 addition & 1 deletion inc/Engine/Optimization/RUCSS/Admin/Subscriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public static function get_subscribed_events() : array {
],
'switch_theme' => 'truncate_used_css',
'permalink_structure_changed' => 'truncate_used_css',
'rocket_options_changed' => 'truncate_used_css',
'rocket_domain_options_changed' => 'truncate_used_css',
'wp_trash_post' => 'delete_used_css_on_update_or_delete',
'delete_post' => 'delete_used_css_on_update_or_delete',
'clean_post_cache' => 'delete_used_css_on_update_or_delete',
Expand Down
13 changes: 7 additions & 6 deletions inc/Engine/Preload/Admin/Subscriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,15 @@ public function __construct( Options_Data $options, Settings $settings ) {
*/
public static function get_subscribed_events() {
return [
'admin_notices' => [
'admin_notices' => [
[ 'maybe_display_preload_notice' ],
],
'rocket_options_changed' => 'preload_homepage',
'switch_theme' => 'preload_homepage',
'rocket_after_clean_used_css' => 'preload_homepage',
'rocket_input_sanitize' => 'sanitize_options',
'wp_rocket_upgrade' => [ 'maybe_clean_cron', 15, 2 ],
'rocket_options_changed' => 'preload_homepage',
'switch_theme' => 'preload_homepage',
'rocket_after_clean_used_css' => 'preload_homepage',
'rocket_domain_options_changed' => 'preload_homepage',
'rocket_input_sanitize' => 'sanitize_options',
'wp_rocket_upgrade' => [ 'maybe_clean_cron', 15, 2 ],
];
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public function testShouldDoAsExpected( $config )
Filters\expectApplied('rocket_configurations_changed')->andReturn($config['rocket_configurations_changed']);

if($config['options'] && ! $config['rocket_configurations_changed']) {
Actions\expectDone('rocket_options_changed');
Actions\expectDone('rocket_domain_options_changed');
}

$this->subscriber->maybe_clean_cache_domain_change();
Expand Down

0 comments on commit 92330e8

Please sign in to comment.