diff --git a/readme.txt b/readme.txt
index 2fc4d44..3910beb 100644
--- a/readme.txt
+++ b/readme.txt
@@ -4,7 +4,7 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_i
Tags: cache, page cache, full page cache, nginx, memcached, apc, speed
Requires at least: 3.0
Tested up to: 4.1
-Stable tag: 1.7.7
+Stable tag: 1.7.9
License: GPLv3
License URI: http://www.gnu.org/licenses/gpl-3.0.html
@@ -125,6 +125,22 @@ Version numbering logic:
* every .B version indicates new features.
* every ..C indicates bugfixes for A.B version.
+= 1.7.9 =
+*2015-01-30*
+
+What's new:
+
+* added auto-upgrade for advanced-cache.php on plugin upgrade
+
+
+= 1.7.8 =
+*2015-01-30*
+
+What's new:
+
+* merged pull request for [wp-ffpc-purge](https://github.com/zeroturnaround/wp-ffpc-purge)
+
+
= 1.7.7 =
*2015-01-14*
diff --git a/wp-ffpc-acache.php b/wp-ffpc-acache.php
index 1b3d531..96774ab 100644
--- a/wp-ffpc-acache.php
+++ b/wp-ffpc-acache.php
@@ -7,10 +7,6 @@
if ( !WP_CACHE )
return false;
-/* check for config */
-if (!isset($wp_ffpc_config))
- return false;
-
/* no cache for post request (comments, plugins and so on) */
if ($_SERVER["REQUEST_METHOD"] == 'POST')
return false;
@@ -22,14 +18,13 @@ if ($_SERVER["REQUEST_METHOD"] == 'POST')
if (defined('SID') && SID != '')
return false;
+/* check for config */
+if (!isset($wp_ffpc_config))
+ return false;
+
/* request uri */
$wp_ffpc_uri = $_SERVER['REQUEST_URI'];
-
-/* no cache for uri with query strings, things usually go bad that way */
-if ( isset($wp_ffpc_config['nocache_dyn']) && !empty($wp_ffpc_config['nocache_dyn']) && stripos($wp_ffpc_uri, '?') !== false )
- return false;
-
/* no cache for robots.txt */
if ( stripos($wp_ffpc_uri, 'robots.txt') )
return false;
@@ -48,6 +43,10 @@ elseif ( !empty ( $wp_ffpc_config[ $_SERVER['HTTP_HOST'] ] ) )
else
return false;
+/* no cache for uri with query strings, things usually go bad that way */
+if ( isset($wp_ffpc_config['nocache_dyn']) && !empty($wp_ffpc_config['nocache_dyn']) && stripos($wp_ffpc_uri, '?') !== false )
+ return false;
+
/* check for cookies that will make us not cache the content, like logged in WordPress cookie */
if ( isset($wp_ffpc_config['nocache_cookies']) && !empty($wp_ffpc_config['nocache_cookies']) ) {
$nocache_cookies = array_map('trim',explode(",", $wp_ffpc_config['nocache_cookies'] ) );
diff --git a/wp-ffpc-class.php b/wp-ffpc-class.php
index 66e172c..c666bbb 100644
--- a/wp-ffpc-class.php
+++ b/wp-ffpc-class.php
@@ -176,20 +176,11 @@ class WP_FFPC extends PluginAbstract {
/* initiate backend */
$this->backend = new WP_FFPC_Backend ( $this->options );
- /* get all available post types *
- $post_types = get_post_types( );*/
+ /* re-save settings after update */
+ add_action( 'upgrader_process_complete', array ( &$this->plugin_upgrade ), 10, 2 );
/* cache invalidation hooks */
add_action( 'transition_post_status', array( &$this->backend , 'clear_ng' ), 10, 3 );
- /*
- foreach ( $post_types as $post_type ) {
- add_action( 'new_to_publish_' .$post_type , array( &$this->backend , 'clear' ), 0 );
- add_action( 'draft_to_publish' .$post_type , array( &$this->backend , 'clear' ), 0 );
- add_action( 'pending_to_publish' .$post_type , array( &$this->backend , 'clear' ), 0 );
- add_action( 'private_to_publish' .$post_type , array( &$this->backend , 'clear' ), 0 );
- add_action( 'publish_' . $post_type , array( &$this->backend , 'clear' ), 0 );
- }
- */
/* comments invalidation hooks */
if ( $this->options['comments_invalidate'] ) {
@@ -199,7 +190,6 @@ class WP_FFPC extends PluginAbstract {
add_action( 'pingback_post', array( &$this->backend , 'clear' ), 0 );
add_action( 'trackback_post', array( &$this->backend , 'clear' ), 0 );
add_action( 'wp_insert_comment', array( &$this->backend , 'clear' ), 0 );
- add_action( '', array( &$this->backend , 'clear' ), 0 );
}
/* invalidation on some other ocasions as well */
@@ -211,28 +201,30 @@ class WP_FFPC extends PluginAbstract {
if ( WP_CACHE )
add_filter('redirect_canonical', 'wp_ffpc_redirect_callback', 10, 2);
- /* clean up schedule if needed */
- if ( !isset( $this->options['precache_schedule'] ) || $this->options['precache_schedule'] == 'null' ) {
- $this->log ( sprintf ( __( 'clearing scheduled hook %s', $this->plugin_constant ), self::precache_id ) );
- }
-
/* add precache coldrun action */
add_action( self::precache_id , array( &$this, 'precache_coldrun' ) );
+ /* link on to settings for plugins page */
$settings_link = ' » ' . __( 'WP-FFPC Settings', $this->plugin_constant ) . '';
- /* check for errors */
+
+ /* check & collect errors */
+ /* look for WP_CACHE */
if ( ! WP_CACHE )
$this->errors['no_wp_cache'] = __("WP_CACHE is disabled, plugin will not work that way. Please add `define ( 'WP_CACHE', true );` to wp-config.php", $this->plugin_constant ) . $settings_link;
+ /* look for global settings array */
if ( ! $this->global_saved )
$this->errors['no_global_saved'] = __("Plugin settings are not yet saved for the site, please save settings!", $this->plugin_constant) . $settings_link;
- if ( ! file_exists ( $this->acache ) )
- $this->errors['no_acache_saved'] = __("Advanced cache file is yet to be generated, please save settings!", $this->plugin_constant). $settings_link;
-
+ /* look for writable acache file */
if ( file_exists ( $this->acache ) && ! is_writable ( $this->acache ) )
$this->errors['no_acache_write'] = __("Advanced cache file is not writeable!
Please change the permissions on the file: ", $this->plugin_constant) . $this->acache;
+ /* look for acache file */
+ if ( ! file_exists ( $this->acache ) )
+ $this->errors['no_acache_saved'] = __("Advanced cache file is yet to be generated, please save settings!", $this->plugin_constant). $settings_link;
+
+ /* look for extensions that should be available */
foreach ( $this->valid_cache_type as $backend => $status ) {
if ( $this->options['cache_type'] == $backend && ! $status ) {
$this->errors['no_backend'] = sprintf ( __('%s cache backend activated but no PHP %s extension was found.
Please either use different backend or activate the module!', $this->plugin_constant), $backend, $backend );
@@ -287,6 +279,18 @@ class WP_FFPC extends PluginAbstract {
}
}
+ /**
+ * once upgrade is finished, deploy advanced cache and save the new settings, just in case
+ */
+ public function plugin_upgrade ( $upgrader_object, $hook_extra ) {
+ if (is_plugin_active( $this->plugin_constant . DIRECTORY_SEPARATOR . $this->plugin_constant . '.php' )) {
+ $this->update_global_config();
+ $this->plugin_options_save();
+ $this->deploy_advanced_cache();
+ $this->utils->alert ( __('WP-FFPC settings were upgraded; please double check if everything is still working correctly.', $this->plugin_constant ), LOG_NOTICE );
+ }
+ }
+
/**
* extending admin init
*
@@ -563,6 +567,9 @@ class WP_FFPC extends PluginAbstract {