Skip to content

Conversation

@coreykn
Copy link
Contributor

@coreykn coreykn commented Aug 8, 2020

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_slash advanced cache setting to false if 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 $options variable because it can be accessed through the default vars. Update CE_MIN_WP constant to 4.6.

Update the handling of the advanced cache settings file:

  • Add an create_advcache_settings() method in the Cache_Enabler class to create/update advanced cache settings file when required.

  • Add action for permalink_structure_changed hook to call create_advcache_settings() when permalink structure has been changed. This is required to update the permalink_trailing_slash advanced cache setting.

  • Update on_activation() and on_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_wide value 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 checking is_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

Update the handling of trailing slashes to allow the cache to be
bypassed if the permalink structure is with or without a trailing slash
(keycdn#85). Set the `permalink_trailing_slash` advanced cache setting to
false if 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 `$options`
variable because it can be accessed through the default vars. Update
`CE_MIN_WP` constant to 4.6.

Update the handling of the advanced cache settings file:

* Add an `create_advcache_settings()` method in the `Cache_Enabler`
class to create/update advanced cache settings file when required.

* Add action for `permalink_structure_changed` hook to call
`create_advcache_settings()` when permalink structure has been changed.
This is required to update the `permalink_trailing_slash` advanced
cache setting.

* Update `on_activation()` and `on_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 (keycdn#85). Use hook activation and deactivation `$network_wide`
value 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 checking `is_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 (keycdn#86).

Fixes keycdn#85
Closes keycdn#86
@coreykn coreykn requested a review from svenba August 8, 2020 01:01
@svenba svenba merged commit 86550ad into keycdn:master Aug 8, 2020
@coreykn coreykn deleted the update-handling branch August 8, 2020 14:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

clear the complete cache if a plugin has been activated or deactivated improve trailing slash handling

2 participants