Should super-cache enable / disable modify $cache_enabled?
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:

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();.
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.
Ok #16 resolves all.
This is still an issue, as #16 was never merged.
Especially with the new super-cache status planned in #24 , this is very misleading:

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.
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.
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?