all repos — wp-ffpc @ 365384b8fe85d5dc94b613aeff3030c6369ffc83

final touches on migration

git-svn-id: http://plugins.svn.wordpress.org/wp-ffpc/trunk@685629 b8457f37-d9ea-0310-8a92-e5e31aec5664
cadeyrn cadeyrn@b8457f37-d9ea-0310-8a92-e5e31aec5664
Fri, 22 Mar 2013 12:42:35 +0000
commit

365384b8fe85d5dc94b613aeff3030c6369ffc83

parent

814ce7977d6d6404892eaab37561244ddb0d2537

2 files changed, 34 insertions(+), 14 deletions(-)

jump to
M readme.txtreadme.txt

@@ -4,7 +4,7 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=XU3DG7LLA76WC

Tags: cache, memcached, full page cache, NGiNX, memcache, page cache Requires at least: 3.0 Tested up to: 3.5.1 -Stable tag: 0.6.1 +Stable tag: 1.0 License: GPLv3 License URI: http://www.gnu.org/licenses/gpl-3.0.html

@@ -49,9 +49,8 @@

1. settings screen, cache type and basic settings 2. debug and in depth-options 3. cache exceptions -4. apc settings -5. memcached servers settings -6. NGiNX example +4. memcached servers settings +5. NGiNX example == Changelog ==

@@ -78,9 +77,8 @@ **Dropped functions**

* APC entry compression support -**Planned features for next major release** +**Planned features** -* support for Redis backend * optional NGiNX header preservation for shortlink, pingback and last-modified headers = 0.6.1 =

@@ -208,7 +206,7 @@

= Contribution = In order to make contributions a lot easier, I've moved the plugin development to [GitHub](https://github.com/petermolnar/wp-ffpc "GitHub"), feel free to fork and put shiny, new things in it. -== Requirements == += Requirements = * WordPress >= 3.0 and **at least one** of the following for storage backend:
M wp-ffpc-class.phpwp-ffpc-class.php

@@ -524,6 +524,7 @@ * need to do migrations from previous versions of the plugin

* */ public function plugin_hook_options_migrate( &$options ) { + $migrated = false; if ( $options['version'] != $this->plugin_version || !isset ( $options['version'] ) ) {

@@ -535,23 +536,44 @@ if ( file_exists ( $fname ) )

unlink ( $fname ); } - /* updating from version 0.4.x */ + /* look for previous config leftovers */ + $try = get_site_option( $this->plugin_constant ); + /* network option key changed, remove & migrate the leftovers if there's any */ + if ( !empty ( $try ) && $this->network ) { + /* clean it up, we don't use it anymore */ + delete_site_option ( $this->plugin_constant ); + + if ( empty ( $options ) && array_key_exists ( $this->global_config_key, $try ) ) { + $options = $try [ $this->global_config_key ]; + $migrated = true; + } + elseif ( empty ( $options ) && array_key_exists ( 'host', $try ) ) { + $options = $try; + $migrated = true; + } + } + + /* updating from version <= 0.4.x */ if ( !empty ( $options['host'] ) ) { $options['hosts'] = $options['host'] . ':' . $options['port']; - /* renamed options */ - $options['log'] = $options['syslog']; - $options['response_header'] = $options['debug']; + $migrated = true; } /* migrating from version 0.6.x */ elseif ( is_array ( $options ) && array_key_exists ( $this->global_config_key , $options ) ) { $options = $options[ $this->global_config_key ]; - /* renamed options */ - $options['log'] = $options['syslog']; - $options['response_header'] = $options['debug']; + $migrated = true; } /* migrating from something, drop previous config */ else { $options = array(); + } + + if ( $migrated ) { + /* renamed options */ + if ( isset ( $options['syslog'] ) ) + $options['log'] = $options['syslog']; + if ( isset ( $options['debug'] ) ) + $options['response_header'] = $options['debug']; } }