wp-media / wp-rocket

Performance optimization plugin for WordPress
https://wp-rocket.me
GNU General Public License v2.0
677 stars 212 forks source link

Auto-compatibility with EasyWP Hosting #2894

Open GeekPress opened 3 years ago

GeekPress commented 3 years ago

Describe the solution you'd like EasyWP is using their own page caching system (NGINX). Because of that, WP Rocket is banned from this hosting. When someone activate WP Rocket, a notice is displayed to let the user know the plugin can't be installed to avoid a conflict with their caching system.

To avoid any conflicts, and be possible to activate WP Rocket on EasyWP, we must disable our page caching if the current website is hosted on EasyWP.

Additional context EasyWP doesn't use advanced-cache.php. We don't need to create an empty file to be compatible. The WP_CACHE constant is also not defined.

To detect if we are on an EasyWP hosting, we can rely on their « EasyWP » mu-plugin. This plugin is installed on all EasyWP websites.

We are missing one info: how to clear EasyWP cache when WP Rocket cache is cleared. I've just asked details about that.

Tabrisrp commented 3 years ago

@GeekPress Did you get an answer from them about the cache clearing?

We have no access to the mu-plugin too, so we don't know what to check from it to detect the hosting. It would be good to know if there a constant or class name we can use.

Tabrisrp commented 3 years ago

Scope a solution

New subscriber EasyWP in ThirdParty\Hostings, extends ThirdParty\Hostings\AbstractNoCacheHost

The class implements the following events:

'do_rocket_generate_caching_files'    => 'return_false',
'rocket_cache_mandatory_cookies'      => 'return_empty_array',
'rocket_display_varnish_options_tab'  => 'return_false',
'rocket_set_wp_cache_constant'        => 'return_false',
'rocket_generate_advanced_cache_file' => 'return_false',

We will also need a callback on after_rocket_clean_domain, when we know how to clear easyWP cache.

Update ThirdParty\HostResolver

Add a check for easyWP when we have the info about what we can check

Update ThirdParty\HostSubscriberFactory

Instantiate the EasyWP class when the host is easywp

Estimate the effort

This will be an [S] task. We're still waiting for additional details before it's ready to be worked on though.

GeekPress commented 3 years ago

Did you get an answer from them about the cache clearing?

I didn't get a response yet for that.

so we don't know what to check from it to detect the hosting.

What about detecting the mu-plugin itself? This mu-plugin is mandatory installed on all EasyWP websites. It's enough to rely on that to know if we are on EasyWP.

About the mu-plugin we know:

Tabrisrp commented 3 years ago

It can be done, by using https://developer.wordpress.org/reference/functions/get_mu_plugins/

Hopefully they can give us something easier to work with, but if needed we can use that. We still need to know how to clear their cache before being able to work on this compatibility though.

GeekPress commented 3 years ago

@Tabrisrp I've just followed up my contact at EasyWP to try to have some details.

worldwildweb commented 2 years ago

related helpscout issue https://secure.helpscout.net/conversation/1820545337/332485/