Skip to content

Commit

Permalink
Fix upgrade bug w/ COMET_CACHE_ALLOW_CLIENT_SIDE_CACHE undefined warning
Browse files Browse the repository at this point in the history
  • Loading branch information
raamdev committed Jun 28, 2016
1 parent 83cbbb1 commit b59bf78
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/includes/classes/VsUpgrades.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ protected function runHandlers()
$this->fromLte151114();
$this->fromZenCache();
$this->fromLte160227();
$this->fromLte160521();
}

/**
Expand Down Expand Up @@ -227,14 +228,18 @@ protected function fromLte160227()
/**
* Before we renamed the Auto-Cache Engine requirements check notice to `auto_cache_engine_minimum_requirements`,
* and before we renamed the `allow_browser_cache` option to `allow_client_side_cache`,
* and before we added the `htaccess_access_control_allow_origin` option.
* and before we added the `htaccess_access_control_allow_origin` option,
* and before we renamed COMET_CACHE_ALLOW_BROWSER_CACHE to COMET_CACHE_ALLOW_CLIENT_SIDE_CACHE.
*
* @since 16xxxx
*/
protected function fromLte160521()
{
if (version_compare($this->prev_version, '160521', '<=')) {
global $is_apache; // WP global for web server checks below.

$this->plugin->dismissMainNotice('allow_url_fopen_disabled');
$this->plugin->removeAdvancedCache();

if (is_array($existing_options = get_site_option(GLOBAL_NS.'_options'))) {
if (isset($existing_options['allow_browser_cache'])) {
Expand Down
4 changes: 4 additions & 0 deletions src/includes/traits/Ac/ClientSideUtils.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ trait ClientSideUtils
*/
public function maybeStopBrowserCaching()
{
if (!defined('COMET_CACHE_ALLOW_CLIENT_SIDE_CACHE')) {
return $this->sendNoCacheHeaders(); // Upgrading from <= v160521, before we renamed this constant. Return default.
}

switch ((bool) COMET_CACHE_ALLOW_CLIENT_SIDE_CACHE) {

case true: // If global config allows, check exclusions.
Expand Down

0 comments on commit b59bf78

Please sign in to comment.