Closed centminmod closed 4 years ago
seems with PHP 7.3.14 if cache enabler is activated via wp-admin it only sometimes adds define('WP_CACHE', true);
to wp-config.php.
but if i use wp-cli command line to activate, it always adds define('WP_CACHE', true);
to wp-config.php.
wp plugin deactivate cache-enabler
Plugin 'cache-enabler' deactivated.
Success: Deactivated 1 of 1 plugins.
wp plugin activate cache-enabler
Plugin 'cache-enabler' activated.
Success: Activated 1 of 1 plugins.
cat wp-config.php | grep -w WP_CACHE
define('WP_CACHE', true); // Added by Cache Enabler
but deactivating cache enabler via wp-admin will ALWAYS remove define('WP_CACHE', true);
from wp-config.php - just not re-add it on re-activating via wp-admin.
settings
wp option get cache-enabler --format=json | jq
{
"expires": 6,
"new_post": 1,
"new_comment": 1,
"webp": 0,
"clear_on_upgrade": 1,
"compress": 1,
"excl_ids": "",
"excl_regexp": "",
"excl_cookies": "",
"incl_attributes": "",
"minify_html": 0
}
Thanks for the detailed report! Is there anything in the error log maybe?
there doesn't seem to be any errors in PHP error logs
As always, thanks for the detail you put into your issues @centminmod. When investigating this issue I've been unable to replicate the same behavior. The only change that has been made so far that I'm aware of related to setting the WP_CACHE
constant would be in PR #102. Even checking out the commit before this change I can't replicate this issue, so I don't think that made a difference.
The only time I can replicate similar behavior, regardless of the PHP version or how the plugin is activated/deactivated, is when deactivating Cache Enabler and then immediately activating it after. This occurs because the constant is still defined as true
, which I believe is caused by the Cache Enabler script not being completed yet. This means Cache_Enabler::_set_wp_cache()
is not called and the constant is not set in the wp-config.php
file. Other than not checking if it's true
, I'm unsure of a way around this, so if you have any ideas just let me know. Otherwise my plan to provide a link in the WP_CACHE
constant warning that will force set the constant will cover this edge case.
I just did a fresh test install of Wordpress 5.3.2 with cache enabler on CentOS 7.7 64bit, Nginx 1.17.8 with PHP 7.4.2 and on activation of plugin,
define('WP_CACHE', true);
is not being added to wp-config.php. The advanced-cache.php is being properly copied to wp-content directory though. So I manually addeddefine('WP_CACHE', true);
to wp-config.php.However, it seems to properly add
define('WP_CACHE', true);
to wp-config.php when using PHP 7.3.14 !On deactivation of cache enabler plugin,
define('WP_CACHE', true);
is properly removed on wp-config.php. So this suggests it isn't a wp-config.php permissions issue at least ? So what would prevent the auto addition ofdefine('WP_CACHE', true);
to wp-config.php on cache enable plugin activation ? PHP 7.4 vs 7.3 related ? I have tried with autoptimize related wp plugins disabled as well and same issue.