update handling of trailing slash and advcache #91
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Update the handling of trailing slashes to allow the cache to be bypassed if the permalink structure is with or without a trailing slash (#85). Set the
permalink_trailing_slashadvanced cache setting tofalseif trailing slash has not been set in the Permalink Settings.Update settings page save actions to have "Save Changes" and "Save Changes and Clear Cache" buttons. Allows the ability to save the settings without completely clearing the cache. Inspired by the lovely folks working on Autoptimize. This prevents unwanted cache clearing when creating the advanced cache settings file.
Update the
_install_backend()method to not clear the cache. The cache should not be cleared when installing requirements, like on activation or if a new subsite is added.Update the
requirements_check()method to not define$optionsvariable because it can be accessed through the default vars. UpdateCE_MIN_WPconstant to 4.6.Update the handling of the advanced cache settings file:
Add an
create_advcache_settings()method in theCache_Enablerclass to create/update advanced cache settings file when required.Add action for
permalink_structure_changedhook to callcreate_advcache_settings()when permalink structure has been changed. This is required to update thepermalink_trailing_slashadvanced cache setting.Update
on_activation()andon_deactivation()methods to create advanced cache settings file(s) on activation and delete the same file(s) on deactivation. Previously the advanced cache settings file(s) would not be generated until the Cache Enabler settings were saved. This led to the rare case where pages without a trailing slash were not redirecting (improve trailing slash handling #85). Use hook activation and deactivation$network_widevalue to determine if network activated.Update
on_upgrade_hook()method to update Cache Enabler requirements and clear the cache if Cache Enabler has been updated.Fix the
delete_advcache_settings()method to actually delete all advanced cache settings if empty.Fix advanced cache file not unlinking on plugin deactivation by updating the
clear_total_cache()method to not update the advanced cache file. This is only required when the Cache Enabler plugin is updated.Fix how WooCommerce is being checked if active so the product stock Cache Behavior setting is visible even when network activated.
Fix
on_uninstall()to actually uninstall on each subsite if network activated. Previously only the main site was being uninstalled. Using$_GET['networkwide']is not an available attribute when Cache Enabler is uninstalled (deleted) so it always returns false. For uninstalling on multisites only checkingis_multisite()is required because plugins must be deleted from the network admin.Extend the Cache Behavior by allowing the cache to be completely cleared if a plugin has also been activated or deactivated in addition to being updated (#86).
Fixes #85
Closes #86