Add cache engine to improve cache handling, performance, and remove duplicate code. Update disk handling to improve creating, writing, and deleting files. The following is an overview of what has changed:
Update cache handling. Previously the cache could be delivered through the advanced-cache.php drop-in as well after the Cache Enabler plugin initialized (which is why it was slower). The advanced-cache.php drop-in is now required to deliver the cache.
Improved disk and database settings handling. Settings files are no longer referred to as "advanced cache" settings because we now only have one cache handler. Settings files are no longer stored in the Cache Enabler plugin directory (e.g. wp-content/plugins/cache-enabler), a change that was introduced in version 1.4.0 (PR #92). Settings files are now stored in wp-content/settings/cache-enabler and are PHP instead of JSON (#135). A filter hook will be introduced to customize this location.
Moved engine handling methods in Cache_Enabler to Cache_Enabler_Engine (new).
Moved disk handling methods in Cache_Enabler to Cache_Enabler_Disk.
Improved classes organization (already had made a mess with the diff so why not get it done here).
Improved plugin activation, deactivation, and uninstall.
Improved updating backend requirements.
Validate the Gzip compressed page contents before creating the cached page.
Update cache to be bypassed for Ajax, REST API, and XMLRPC requests.
Update HTML minification to include/exclude inline CSS (<style>...</style>) in addition to JavaScript. Add code to default tags to ignore.
Updated database option name to be cache_enabler instead of cache-enabler.
Updated various method, variable, and nonce names.
Update dirname( __FILE__ ) to __DIR__.
Updated cache size handling:
Update Cache_Enabler::get_cache_size() to no longer check object existence that was added in PR #43. This is no longer required because of the changes made in PR #139.
Update Cache_Enabler_Disk::cache_size() to get home URL to get the correct cache size in multisite environments. (This needs to be built upon in the future with a new method to handle the main site in networks with subdirectory configurations, as it is done in Cache_Enabler::clear_site_cache_by_blog_id().)
Validate files when calculating the cache size as directories are already done (@janvitos).
Delete transient when Cache_Enabler::clear_site_cache_by_blog_id() is called to get the correct cache size afterwards in multisite environments.
Clear file status cache after an empty directory has been removed. This fixes the issue that was occurring in #133, but we will now also validate the file exists before calculating the size.
Removed leading underscore in private methods.
Removed call_user_func() where not required as calling the method directly when known is better.
Removed Cache_Enabler::get_blog_domain because it is no longer needed now that the settings file is created when the database changes, so what we need is always available in home_url().
Replaced all instances of DIRECTORY_SEPARATOR with '/' instead because using the DIRECTORY_SEPARATOR is not required as even Windows-based operating systems can read the file path. WordPress core uses a hardcoded forward slash in most cases.
Deprecated Cache_Enabler::clear_total_cache() to be replaced by Cache_Enabler::clear_complete_cache().
Deprecated Cache_Enabler_Disk::delete_asset() and replaced it with how it was before version 1.4.7 (#131).
Add cache engine to improve cache handling, performance, and remove duplicate code. Update disk handling to improve creating, writing, and deleting files. The following is an overview of what has changed:
Update cache handling. Previously the cache could be delivered through the
advanced-cache.php
drop-in as well after the Cache Enabler plugin initialized (which is why it was slower). Theadvanced-cache.php
drop-in is now required to deliver the cache.Improved disk and database settings handling. Settings files are no longer referred to as "advanced cache" settings because we now only have one cache handler. Settings files are no longer stored in the Cache Enabler plugin directory (e.g.
wp-content/plugins/cache-enabler
), a change that was introduced in version 1.4.0 (PR #92). Settings files are now stored inwp-content/settings/cache-enabler
and are PHP instead of JSON (#135). A filter hook will be introduced to customize this location.Moved engine handling methods in
Cache_Enabler
toCache_Enabler_Engine
(new).Moved disk handling methods in
Cache_Enabler
toCache_Enabler_Disk
.Improved classes organization (already had made a mess with the diff so why not get it done here).
Improved plugin activation, deactivation, and uninstall.
Improved updating backend requirements.
Validate the Gzip compressed page contents before creating the cached page.
Update cache to be bypassed for Ajax, REST API, and XMLRPC requests.
Update HTML minification to include/exclude inline CSS (
<style>...</style>
) in addition to JavaScript. Addcode
to default tags to ignore.Updated database option name to be
cache_enabler
instead ofcache-enabler
.Updated various method, variable, and nonce names.
Update
dirname( __FILE__ )
to__DIR__
.Updated cache size handling:
Update
Cache_Enabler::get_cache_size()
to no longer check object existence that was added in PR #43. This is no longer required because of the changes made in PR #139.Update
Cache_Enabler_Disk::cache_size()
to get home URL to get the correct cache size in multisite environments. (This needs to be built upon in the future with a new method to handle the main site in networks with subdirectory configurations, as it is done inCache_Enabler::clear_site_cache_by_blog_id()
.)Validate files when calculating the cache size as directories are already done (@janvitos).
Delete transient when
Cache_Enabler::clear_site_cache_by_blog_id()
is called to get the correct cache size afterwards in multisite environments.Clear file status cache after an empty directory has been removed. This fixes the issue that was occurring in #133, but we will now also validate the file exists before calculating the size.
Removed leading underscore in private methods.
Removed
call_user_func()
where not required as calling the method directly when known is better.Removed
Cache_Enabler::get_blog_domain
because it is no longer needed now that the settings file is created when the database changes, so what we need is always available inhome_url()
.Replaced all instances of
DIRECTORY_SEPARATOR
with'/'
instead because using theDIRECTORY_SEPARATOR
is not required as even Windows-based operating systems can read the file path. WordPress core uses a hardcoded forward slash in most cases.Deprecated
Cache_Enabler::clear_total_cache()
to be replaced byCache_Enabler::clear_complete_cache()
.Deprecated
Cache_Enabler_Disk::delete_asset()
and replaced it with how it was before version 1.4.7 (#131).Closes #131, fixes #133, closes #135