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

Should super-cache enable / disable modify $cache_enabled? #17

Open
playmono opened this issue Dec 22, 2017 · 6 comments
Open

Should super-cache enable / disable modify $cache_enabled? #17

playmono opened this issue Dec 22, 2017 · 6 comments

Comments

@playmono
Copy link

playmono commented Dec 22, 2017

Hi all,

I did some tests using this package on my wordpress installations and because I don't know much how works wordpress cache, I was wondering some questions.

As I can see, if run this

$ wp --path='/var/www/wordpress' super-cache enable

The only thing that changes is in wp-cache-config.php - $super_cache_enabled = 'true';

But in wordpress frontend, cache still remains disabled:

image

The same thing happens with

$ wp --path='/var/www/wordpress' super-cache disable

variable $super_cache_enabled changes to false but in frontend, cache remains enabled.

So, I did some research and I see that in frontend if you enable or disable cache, two variables of wp-cache-config.php changes: $cache_enabled and $super_cache_enabled

My workaround to solve this was in enable / disable functions of super-cache package adding wp_cache_disable(); and wp_cache_enable();.

super-cache.txt

But my concern is if maybe super-cache enable / disable should affect only to super-cache plugin (as it is now). In the other side, in wordpress frontend, if you check / uncheck enabling cache, you are modifying the two values.

What do you think guys?

Thank you.

@playmono
Copy link
Author

Ok #16 resolves all.

@schlessera
Copy link
Member

This is still an issue, as #16 was never merged.

@schlessera schlessera reopened this Oct 26, 2018
@schlessera
Copy link
Member

Especially with the new super-cache status planned in #24 , this is very misleading:
image 2018-10-26 at 11 59 43 am

@stodorovic
Copy link
Contributor

stodorovic commented Oct 26, 2018

I'm working on this issue. We should better handle errors because enabling caching should modify .htaccess to update rewrite rules (if Expert method - mod_rewrite is selected). I hope that I'll create new PR soon.

@schlessera
Copy link
Member

In this case, there's already a discrepancy between what super-cache enable checks to determine success ($super_cache_enabled) and what super-cache status checks to determine state ($cache_enabled && $super_cache_enabled).

Checking errors is of course important, but checking the result consistently is probably an easy first step.

@stodorovic
Copy link
Contributor

I just made quick fix - PR #25. We need to check only $cache_enabled because commands should disable/enable both methods. I just tested add_mod_rewrite_rules() and it seems that works correctly. Anyway there isn't command for changing "Cache Delivery Method" and it's safe because Expert mode (fist time) can be selected only from WPSC dashboard.

I'll try to review preload command and then I'll try to make better error checking.

@playmono Could you test these changes?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants