keycdn / cache-enabler

A lightweight caching plugin for WordPress that makes your website faster by generating static HTML files.
https://wordpress.org/plugins/cache-enabler/
123 stars 46 forks source link

update advanced-cache.php handling #297

Closed coreykn closed 3 years ago

coreykn commented 3 years ago

Update the advanced-cache.php file creation handling to use the new CACHE_ENABLER_CONSTANTS_FILE constant discussed in #296 (thanks @nlemoine).

Update the advanced-cache.php file to delete itself if considered stale or abandoned. It would be stale if the CACHE_ENABLER_CONSTANTS_FILE has changed after the wp-content/advanced-cache.php file was created (like in an example shared #296). It would be abandoned if the plugin was manually deleted, like through an FTP client. If stale, the file will be created again with the new value, which currently takes place during the requirements check.

Update the CACHE_ENABLER_MIN_WP constant to 5.1, which should have been updated in PR #295.

nlemoine commented 3 years ago

@coreykn I still end up with an absolute hardcoded path in advanced-cache.php.

Replacement should be:

$search  = '\'/your/path/to/wp-content/plugins/cache-enabler/constants.php\'';
$replace = "defined('CACHE_ENABLER_CONSTANTS_FILE') ? CACHE_ENABLER_CONSTANTS_FILE : '" . CACHE_ENABLER_CONSTANTS_FILE . "';";

Otherwise, we're still at the starting point.