Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clear dynamic lists on WP Rocket update #6920

Open
DahmaniAdame opened this issue Aug 28, 2024 · 3 comments · May be fixed by #7054
Open

Clear dynamic lists on WP Rocket update #6920

DahmaniAdame opened this issue Aug 28, 2024 · 3 comments · May be fixed by #7054
Assignees
Labels
priority: medium Issues which are important, but no one will go out of business. type: enhancement Improvements that slightly enhance existing functionality and are fast to implement
Milestone

Comments

@DahmaniAdame
Copy link
Contributor

Is your feature request related to a problem? Please describe.
When having changes on files naming related to WP Rocket that require exclusions, the customer might wait up to one week to get the new exclusions updated.

Describe the solution you'd like
To simplify the process without requiring conditional dynamic lists update, we can simply update them on WP Rocket update.

Describe alternatives you've considered
N/A

Additional context
Discussion - https://wp-media.slack.com/archives/C027UU7L8RL/p1724679004320979

@benorfaz benorfaz added this to the 3.17.1 milestone Aug 28, 2024
@piotrbak piotrbak added type: enhancement Improvements that slightly enhance existing functionality and are fast to implement priority: medium Issues which are important, but no one will go out of business. labels Aug 28, 2024
@wordpressfan
Copy link
Contributor

So to add more details here,

When we update WPR plugin, we have a github workflow to update dynamic lists json files (this is the fallback) inside the plugin to be shipped with the new version but I think the problem here is that we cache those exclusions for one week in a transient and it won't be refreshed until it expires.

I only have a concern here, if we forced getting the dynamic lists after update this will add a load on our servers, mostly on the same time @DahmaniAdame added a valid comment on that point, that automatic updates are disabled by default so this will reduce the risk and I agree with that.

What I can think of here is with update we can change the expiry for those transients to be a random number between 1 and 24 hours (just an example)

OR

with update we can force updating the lists from the json file directly not just a fallback.

and I'm with the last one.

@piotrbak
Copy link
Contributor

Acceptance Criteria:

  1. After the update we'll replace the dynamic JSON files placed in our config directory with the one that were placed in the zip archive
  2. We should respect the WP_ROCKET_CONFIG_PATH constant
  3. The transient related to the lists expiration should be updated with the new date

@piotrbak piotrbak removed this from the 3.17.1 milestone Oct 6, 2024
@wordpressfan
Copy link
Contributor

Grooming

with wp_rocket_upgrade we will have a callback here, let's call it update_lists_from_files

and inside this new method, we will have the following code:

$this->dynamic_lists->update_lists_from_files(); 

then we will add this new method exactly here

public function update_lists_from_files() {
	if ( $this->user->is_license_expired() ) {
		return [
			'success' => false,
			'data'    => '',
			'message' => __( 'You need an active license to get the latest version of the lists from our server.', 'rocket' ),
		];
	}

	foreach ( $this->providers as $provider ) {
		// Here we delete the list transients
		$provider->data_manager->remove_lists_cache();
		// Here we get lists from json files and update the config file because transient is removed.
		$provider->data_manager->get_lists();
	}
}

Then we will create a new method here

public function remove_lists_cache(){
	delete_transient( $this->get_cache_transient_name() );
}

Effort

[S]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority: medium Issues which are important, but no one will go out of business. type: enhancement Improvements that slightly enhance existing functionality and are fast to implement
Projects
None yet
8 participants