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 {
plugin_constant ); ?> +

plugin_constant);?>

+

WP_DEBUG constant `true`.
This will enable NOTICE level messages apart from the WARNING level ones which are always displayed.', $this->plugin_constant); ?>

+
@@ -572,14 +579,6 @@ class WP_FFPC extends PluginAbstract { plugin_constant); ?> -
- -
-
- options['log'],true); ?> /> - WP_DEBUG is enabled, notices and info level is displayed as well, otherwie only ERRORS are logged.', $this->plugin_constant); ?> -
-
@@ -597,6 +596,7 @@ class WP_FFPC extends PluginAbstract {
+
@@ -869,11 +869,11 @@ class WP_FFPC extends PluginAbstract { if ( $this->options['precache_schedule'] != 'null' ) { /* clear all other schedules before adding a new in order to replace */ wp_clear_scheduled_hook ( self::precache_id ); - $this->log ( __( 'Scheduling WP-CRON event', $this->plugin_constant ) ); + $this->utils->log ( $this->plugin_constant, __( 'Scheduling WP-CRON event', $this->plugin_constant ) ); $this->scheduled = wp_schedule_event( time(), $this->options['precache_schedule'] , self::precache_id ); } elseif ( ( !isset($this->options['precache_schedule']) || $this->options['precache_schedule'] == 'null' ) && !empty( $schedule ) ) { - $this->log ( __('Clearing WP-CRON scheduled hook ' , $this->plugin_constant ) ); + $this->utils->log ( $this->plugin_constant, __('Clearing WP-CRON scheduled hook ' , $this->plugin_constant ) ); wp_clear_scheduled_hook ( self::precache_id ); } @@ -1253,17 +1253,6 @@ class WP_FFPC extends PluginAbstract { } } - /** - * log wrapper to include options - * - */ - public function log ( $message, $log_level = LOG_NOTICE ) { - if ( !isset ( $this->options['log'] ) || $this->options['log'] != 1 ) - return false; - else - $this->utils->log ( $this->plugin_constant, $message, $log_level ); - } - public function getBackend() { return $this->backend; } diff --git a/wp-ffpc.php b/wp-ffpc.php index de9c952..448dab0 100644 --- a/wp-ffpc.php +++ b/wp-ffpc.php @@ -3,7 +3,7 @@ Plugin Name: WP-FFPC Plugin URI: https://github.com/petermolnar/wp-ffpc Description: WordPress in-memory full page cache plugin -Version: 1.7.8 +Version: 1.7.9 Author: Peter Molnar Author URI: http://petermolnar.eu/ License: GPLv3 @@ -58,6 +58,6 @@ $wp_ffpc_defaults = array ( 'pingback_header' => false, ); -$wp_ffpc = new WP_FFPC ( 'wp-ffpc', '1.7.4', 'WP-FFPC', $wp_ffpc_defaults, 'PeterMolnar_WordPressPlugins_wp-ffpc_HU' , 'WP-FFPC' , 'FA3NT7XDVHPWU' ); +$wp_ffpc = new WP_FFPC ( 'wp-ffpc', '1.7.9', 'WP-FFPC', $wp_ffpc_defaults, 'PeterMolnar_WordPressPlugins_wp-ffpc_HU' , 'WP-FFPC' , 'FA3NT7XDVHPWU' ); ?>