Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automatic Clear Cache routines are too aggressive for options-general.php #825

Closed
raamdev opened this issue Sep 2, 2016 · 3 comments
Closed

Comments

@raamdev
Copy link
Contributor

raamdev commented Sep 2, 2016

Comet Cache automatically clears the entire cache whenever options-general.php?settings-updated=true is detected. This is meant to detect when Settings → General is being saved, since any changes there should result in a full clearing of the cache.

The problem with this is that other plugins may use options-general.php, as demonstrated in add_options_page() on the WordPress Codex, to create a plugin options page in the Settings section:

2016-09-02_15-17-17

The plugin options page URL would then end up being something like options-general.php?page=autoptimize. Whenever the settings for that plugin are saved, even if the plugin doesn't affect anything on the front-end of the site, Comet Cache will automatically clear the entire cache because it assumes that a core WP setting is being changed (options-general.php?page=autoptimize&settings-updated=true is called, and Comet Cache makes no consideration for the ?page query var).

While it might make sense to assume that saving the settings for any plugin that uses options-general.php should result in the cache being cleared, my feeling is that it would be better for that to be handled on a case-by-case basis, i.e., if a plugin affects the front-end of the site, it should either integrate with caching plugins, or Comet Cache should have specific support for detecting when the settings are saved (such as has been done with bbPress, BuddyPress, Comment Mail, and WooCommerce).

How this can be improved

Comet Cache should check if the ?page query var is present when the settings are being saved via options-general.php. If the ?page query var is NOT present, that indicates that the options for Settings → General are being saved. Otherwise, it indicates that another plugin is utilizing options-general.php and we should skip auto-clearing the cache in that scenario.


Noting that this was originally reported by Frank Goossens (@futtta) of Autoptimize.

raamdev added a commit to wpsharks/comet-cache-pro that referenced this issue Sep 2, 2016
Comet Cache was too aggressive and did not consider that other plugins
may be using `options-general.php` for their settings page.

See wpsharks/comet-cache#825
@raamdev raamdev added this to the Next Release milestone Sep 2, 2016
@raamdev
Copy link
Contributor Author

raamdev commented Sep 2, 2016

Next Release Changelog:

  • Compatibility / Bug Fix: The automatic Clear Cache routines that cleared the entire cache automatically whenever WordPress Dashboard → Settings → General was updated, were being too aggressive and not taking into consideration other plugins that might also be using the same options-general.php URL. As a result, the entire cache was being unnecessarily cleared when the settings for those other plugins were saved. Props to @futtta from Autoptimize for reporting. See Issue #825.

@raamdev raamdev closed this as completed Sep 2, 2016
@jaswrks
Copy link

jaswrks commented Sep 8, 2016

Comet Cache should check if the ?page query var is present when the settings are being saved via options-general.php. If the ?page query var is NOT present, that indicates that the options for Settings → General are being saved. Otherwise, it indicates that another plugin is utilizing options-general.php and we should skip auto-clearing the cache in that scenario.

Agree.

raamdev added a commit that referenced this issue Sep 17, 2016
- **New Feature** (Lite): The Clear Cache button is now available in the Admin Toolbar for the Lite version of Comet Cache.
- **New Feature** (Pro): Comet Cache Pro is now fully compatible with [WordPress Automatic Background Updates](https://codex.wordpress.org/Configuring_Automatic_Background_Updates#Plugin_.26_Theme_Updates_via_Filter). If you enable automatic background updates for plugins, and you save valid Comet Cache Pro License Credentials in the _Comet Cache Pro → Plugin Options → Update Credentials_ panel, you will automatically receive Pro plugin updates. Props @jaswsinc. See [Issue #289](#289).
- **Bug Fix**: In some scenarios Comet Cache might produce a false-positive "Warning: mkdir(): File exists" message when checking if the cache directory exists. Comet Cache now calls `clearstatcache()` and uses `file_exists()` instead of `is_dir()` to help make this check more robust. See [Issue #786](#786).
- **Bug Fix**: Fixed a bug where the Comet Cache PHP requirements check would fail and produce a fatal error when upgrading from a version of Comet Cache that did not require an extension that is now required by newer releases. This would occur when, for example, the required PHP `mbstring` extension was missing. Props @jaswsinc for finding the bug. See [Issue #817](#817).
- **Bug Fix**: Fixed a bug where upgrading from v160521 would result in the Client-Side Cache option being reset to the default (disabled). If you enabled the Client-Side Cache at some point, now is a good time to double-check that it's still enabled. This bug fix also improves the reliability of all version upgrade routines that Comet Cache runs during upgrades. See [Issue #807](#807).
- **Compatibility / Bug Fix**: The automatic Clear Cache routines that cleared the entire cache automatically whenever _WordPress Dashboard → Settings → General_ was updated, were being too aggressive and not taking into consideration other plugins that might also be using the same `options-general.php` URL. As a result, the entire cache was being unnecessarily cleared when the settings for those other plugins were saved. Props to @futtta from Autoptimize for reporting. See [Issue #825](#825).
- **UI Enhancement:** Adjusted option page font styles for WordPress v4.6 to better match existing style. See [Issue #271](wpsharks/comet-cache-pro#271).
- **ManageWP Compatibility** (Pro): Comet Cache Pro is now compatible with ManageWP, a service that allows remote management of multiple WordPress sites. Comet Cache Pro Plugin Updates will now appear in the ManageWP dashboard and, assuming you have saved valid license credentials in _Dashboard → Comet Cache Pro → Plugin Options → Update Credentials_, you will be able to upgrade Comet Cache Pro remotely from the ManageWP Dashboard. Props @jaswsinc. See [Issue #465](#465).
- **InfiniteWP Compatibility** (Pro): Comet Cache Pro is now compatible with InfiniteWP, an application that allows you to manage multiple WordPress sites from a single location. Comet Cache Pro Plugin Updates will now appear in the InfiniteWP dashboard and, assuming you have saved valid license credentials in _Dashboard → Comet Cache Pro → Plugin Options → Update Credentials_, you will be able to upgrade Comet Cache Pro remotely from the InfiniteWP Dashboard. See [Issue #394](#394).
- **Rewritten Pro Plugin Updater**: The Comet Cache Pro Plugin Updater has been redesigned to use the built-in WordPress plugin updater system. When a Comet Cache Pro update is available, it now appears in the WordPress Updates section and in the Plugins list, like other WordPress plugins and can be updated normally like other WordPress plugins, as long as you have saved valid Comet Cache Pro license details in the new "Update Credentials" options panel. Props @jaswsinc. See [Issue #272](wpsharks/comet-cache-pro#272).
- **Code Style**: The `WP_CACHE` line that gets inserted into the `wp-config.php` file to enable caching now follows the [WordPress PHP Code Standards](https://make.wordpress.org/core/handbook/best-practices/coding-standards/php/). Props @szepeviktor. See [Issue #799](#799).
- **Compatibility** (Pro): When the Autoptimize plugin is active, the Comet Cache Pro HTML Compressor panel now shows a friendly notice explaining that both the HTML Compressor and Autoptimize should not be enabled at the same time because they both address the same performance improvements. The rest of Comet Cache works great alongside Autoptimize and whether you use the HTML Compressor or Autoptimize is a matter of preference. Props to @futtta from Autoptimize for the continued collaboration.
@raamdev
Copy link
Contributor Author

raamdev commented Sep 17, 2016

Comet Cache v160917 has been released and includes changes from this GitHub Issue. See the v160917 announcement for further details.


This issue will now be locked to further updates. If you have something to add related to this GitHub Issue, please open a new GitHub Issue and reference this one (#825).

@wpsharks wpsharks locked and limited conversation to collaborators Sep 17, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants