version 1.6.0, see changelog
This commit is contained in:
parent
aaf703fd8d
commit
2b2345c763
6 changed files with 115 additions and 47 deletions
35
readme.txt
35
readme.txt
|
@ -3,8 +3,8 @@ Contributors: cadeyrn
|
|||
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=XU3DG7LLA76WC
|
||||
Tags: cache, page cache, full page cache, nginx, memcached, apc, speed
|
||||
Requires at least: 3.0
|
||||
Tested up to: 3.9.1
|
||||
Stable tag: 1.5.0
|
||||
Tested up to: 4.0
|
||||
Stable tag: 1.6.0
|
||||
License: GPLv3
|
||||
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
||||
|
||||
|
@ -17,14 +17,14 @@ It can be configured to join forces with [NGiNX](http://NGiNX.org "NGiNX")'s bui
|
|||
= Features: =
|
||||
* Wordpress Network support
|
||||
* fully supported domain/subdomain based WordPress Networks on per site setup as well
|
||||
* will work in Network Enabled mode only for subdirectory based Multisites ( no per site setting possibility )
|
||||
* supports variable backends
|
||||
* will work in Network Enabled mode only for subdirectory based Multisites ( per site settings will not work in this case )
|
||||
* supports various backends
|
||||
* memcached with [PHP Memcached](http://php.net/manual/en/book.memcached.php "Memcached")
|
||||
* memcached with [PHP Memcache](http://php.net/manual/en/book.memcache.php "Memcache")
|
||||
* [APC](http://php.net/manual/en/book.apc.php "APC")
|
||||
* [APCu](http://pecl.php.net/package/APCu "APC User Cache")
|
||||
* [Xcache](http://xcache.lighttpd.net/ "Xcache") - not stable yet, volunteer testers required!
|
||||
* cache exclude possibilities ( home, feeds, archieves, pages, singles )
|
||||
* cache exclude options ( home, feeds, archieves, pages, singles; regex based url exclusion )
|
||||
* (optional) cache for logged-in users
|
||||
* 404 caching
|
||||
* canonical redirects caching
|
||||
|
@ -43,6 +43,8 @@ Many thanks for donations, contributors, supporters, testers & bug reporters:
|
|||
* [Mark Costlow](mailto:cheeks@swcp.com "Mark Costlow")
|
||||
* [Jason Miller](mailto:jason@redconfetti.com "Jason Miller")
|
||||
* [Dave Clark](https://github.com/dkcwd "Dave Clark")
|
||||
* Miguel Clara
|
||||
* [plescheff](https://github.com/plescheff)
|
||||
|
||||
== Installation ==
|
||||
|
||||
|
@ -98,6 +100,29 @@ Please post feature requests to [WP-FFPC feature request topic](http://wordpress
|
|||
|
||||
== Changelog ==
|
||||
|
||||
Version numbering logic:
|
||||
|
||||
* every A. indicates BIG changes.
|
||||
* every .B version indicates new features.
|
||||
* every ..C indicates bugfixes for A.B version.
|
||||
|
||||
= 1.6.0 =
|
||||
*2014-05-30*
|
||||
|
||||
What's new:
|
||||
|
||||
* added functionality to exclude regex urls, contribution from [plescheff](https://github.com/plescheff/wp-ffpc/commit/3c875ad4fe1e083d3968421dd83b9c179c686649)
|
||||
* added functionality to include "?" containing URL
|
||||
|
||||
What's fixed:
|
||||
|
||||
* some warning messages removed in case there's not a single backend installed when the plugin is activated
|
||||
|
||||
Under the hood:
|
||||
|
||||
* major changes to the abstract wp-common class for better interoperability between my plugins
|
||||
|
||||
|
||||
= 1.5.0 =
|
||||
*2014-05-30*
|
||||
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 2dd92a681f986a6637550a2640c697be39399de9
|
||||
Subproject commit d84ff213cd944c22a6a440d6faba502abd1da774
|
|
@ -26,7 +26,7 @@ if (defined('SID') && SID != '')
|
|||
$wp_ffpc_uri = $_SERVER['REQUEST_URI'];
|
||||
|
||||
/* no cache for uri with query strings, things usually go bad that way */
|
||||
if ( stripos($wp_ffpc_uri, '?') !== false)
|
||||
if ( isset($wp_ffpc_config['nocache_dyn']) && !empty($wp_ffpc_config['nocache_dyn']) && stripos($wp_ffpc_uri, '?') !== false ) {
|
||||
return false;
|
||||
|
||||
/* no cache for pages starting with /wp- like WP admin */
|
||||
|
@ -67,6 +67,14 @@ if ( isset($wp_ffpc_config['nocache_cookies']) && !empty($wp_ffpc_config['nocach
|
|||
}
|
||||
}
|
||||
|
||||
/* no cache for excluded URL patterns */
|
||||
if ( isset($wp_ffpc_config['nocache_url']) && trim($wp_ffpc_config['nocache_url']) ) {
|
||||
$pattern = sprintf('#%s#', trim($wp_ffpc_config['nocache_url']));
|
||||
if ( preg_match($pattern, $wp_ffpc_uri) ) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/* canonical redirect storage */
|
||||
$wp_ffpc_redirect = null;
|
||||
/* fires up the backend storage array with current config */
|
||||
|
|
|
@ -520,7 +520,7 @@ class WP_FFPC_Backend {
|
|||
}
|
||||
|
||||
/* verify apcu is working */
|
||||
if ( apcu_cache_info("user",true) ) {
|
||||
if ( apcu_cache_info("user") ) {
|
||||
$this->log ( __translate__('backend OK', $this->plugin_constant ) );
|
||||
$this->alive = true;
|
||||
}
|
||||
|
@ -606,6 +606,14 @@ class WP_FFPC_Backend {
|
|||
return false;
|
||||
}
|
||||
|
||||
$xcache_admin = ini_get ( 'xcache.admin.user' );
|
||||
$xcache_pass = ini_get ( 'xcache.admin.pass' );
|
||||
|
||||
if ( empty( $xcache_admin ) || empty( $xcache_pass ) ) {
|
||||
$this->log ( __translate__('XCACHE xcache.admin.user or xcache.admin.pass is not set in php.ini. Please set them, otherwise the use cache part of xcache is not accessible.', $this->plugin_constant ) );
|
||||
return false;
|
||||
}
|
||||
|
||||
/* verify apc is working */
|
||||
$info = xcache_info();
|
||||
if ( !empty( $info )) {
|
||||
|
@ -716,7 +724,7 @@ class WP_FFPC_Backend {
|
|||
$this->connection->setOption( Memcached::OPT_COMPRESSION , false );
|
||||
$this->connection->setOption( Memcached::OPT_BINARY_PROTOCOL , true );
|
||||
|
||||
if ( version_compare( phpversion( 'memcached' ) , '2.0.0', '>=' ) && ini_get( 'memcached.use_sasl' ) == 1 ) {
|
||||
if ( version_compare( phpversion( 'memcached' ) , '2.0.0', '>=' ) && ini_get( 'memcached.use_sasl' ) == 1 && isset($this->options['authpass']) && !empty($this->options['authpass']) && isset($this->options['authuser']) && !empty($this->options['authuser']) ) {
|
||||
$this->connection->setSaslAuthData ( $this->options['authuser'], $this->options['authpass']);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,9 +3,9 @@
|
|||
if ( ! class_exists( 'WP_FFPC' ) ) :
|
||||
|
||||
/* get the plugin abstract class*/
|
||||
include_once ( 'wp-common/plugin_abstract.php' );
|
||||
include_once ( dirname(__FILE__) . '/wp-common/plugin_abstract.php' );
|
||||
/* get the common functions class*/
|
||||
include_once ( 'wp-ffpc-backend.php' );
|
||||
include_once ( dirname(__FILE__) .'/wp-ffpc-backend.php' );
|
||||
|
||||
/**
|
||||
* main wp-ffpc class
|
||||
|
@ -63,6 +63,20 @@ class WP_FFPC extends PluginAbstract {
|
|||
private $scheduled = false;
|
||||
private $errors = array();
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public function plugin_post_construct () {
|
||||
$this->plugin_url = plugin_dir_url( __FILE__ );
|
||||
$this->plugin_dir = plugin_dir_path( __FILE__ );
|
||||
|
||||
$this->common_url = $this->plugin_url . self::common_slug;
|
||||
$this->common_dir = $this->plugin_dir . self::common_slug;
|
||||
|
||||
$this->admin_css_handle = $this->plugin_constant . '-admin-css';
|
||||
$this->admin_css_url = $this->common_url . 'wp-admin.css';
|
||||
}
|
||||
|
||||
/**
|
||||
* init hook function runs before admin panel hook, themeing and options read
|
||||
*/
|
||||
|
@ -272,12 +286,11 @@ class WP_FFPC extends PluginAbstract {
|
|||
*/
|
||||
public function plugin_extend_admin_init () {
|
||||
/* save parameter updates, if there are any */
|
||||
if ( isset( $_POST[ $this->button_flush ] ) ) {
|
||||
|
||||
if ( isset( $_POST[ $this->button_flush ] ) && check_admin_referer ( $this->plugin_constant ) ) {
|
||||
/* remove precache log entry */
|
||||
$this->_delete_option( self::precache_log );
|
||||
$this->utils->_delete_option( self::precache_log );
|
||||
/* remove precache timestamp entry */
|
||||
$this->_delete_option( self::precache_timestamp );
|
||||
$this->utils->_delete_option( self::precache_timestamp );
|
||||
|
||||
/* remove precache logfile */
|
||||
if ( @file_exists ( $this->precache_logfile ) ) {
|
||||
|
@ -296,8 +309,7 @@ class WP_FFPC extends PluginAbstract {
|
|||
}
|
||||
|
||||
/* save parameter updates, if there are any */
|
||||
if ( isset( $_POST[ $this->button_precache ] ) ) {
|
||||
|
||||
if ( isset( $_POST[ $this->button_precache ] ) && check_admin_referer ( $this->plugin_constant ) ) {
|
||||
/* is no shell function is possible, fail */
|
||||
if ( $this->shell_function == false ) {
|
||||
$this->status = 5;
|
||||
|
@ -407,6 +419,7 @@ class WP_FFPC extends PluginAbstract {
|
|||
|
||||
/* we need to go through all servers */
|
||||
$servers = $this->backend->status();
|
||||
if ( is_array( $servers ) && !empty ( $servers ) ) {
|
||||
foreach ( $servers as $server_string => $status ) {
|
||||
echo $server_string ." => ";
|
||||
|
||||
|
@ -417,12 +430,14 @@ class WP_FFPC extends PluginAbstract {
|
|||
else
|
||||
_e ( '<span class="error-msg">unknown, please try re-saving settings!</span><br />', $this->plugin_constant );
|
||||
}
|
||||
}
|
||||
|
||||
?></p><?php
|
||||
} ?>
|
||||
</div>
|
||||
<form autocomplete="off" method="post" action="#" id="<?php echo $this->plugin_constant ?>-settings" class="plugin-admin">
|
||||
|
||||
<?php wp_nonce_field( $this->plugin_constant ); ?>
|
||||
<ul class="tabs">
|
||||
<li><a href="#<?php echo $this->plugin_constant ?>-type" class="wp-switch-editor"><?php _e( 'Cache type', $this->plugin_constant ); ?></a></li>
|
||||
<li><a href="#<?php echo $this->plugin_constant ?>-debug" class="wp-switch-editor"><?php _e( 'Debug & in-depth', $this->plugin_constant ); ?></a></li>
|
||||
|
@ -600,6 +615,26 @@ class WP_FFPC extends PluginAbstract {
|
|||
<input type="text" name="nocache_cookies" id="nocache_cookies" value="<?php if(isset( $this->options['nocache_cookies'] ) ) echo $this->options['nocache_cookies']; ?>" />
|
||||
<span class="description"><?php _e('Exclude cookies names starting with this from caching. Separate multiple cookies names with commas.<br />If you are caching with nginx, you should update your nginx configuration and reload nginx after changing this value.', $this->plugin_constant); ?></span>
|
||||
</dd>
|
||||
|
||||
<dt>
|
||||
<label for="nocache_dyn"><?php _e("Don't cache dynamic requests", $this->plugin_constant); ?></label>
|
||||
</dt>
|
||||
<dd>
|
||||
<input type="checkbox" name="nocache_dyn" id="nocache_dyn" value="1" <?php checked($this->options['nocache_dyn'],true); ?> />
|
||||
<span class="description"><?php _e('Exclude every URL with "?" in it.', $this->plugin_constant); ?></span>
|
||||
</dd>
|
||||
|
||||
<dt>
|
||||
<label for="nocache_url"><?php _e("Don't cache following URL paths - use with caution!", $this->plugin_constant); ?></label>
|
||||
</dt>
|
||||
<dd>
|
||||
<textarea name="nocache_url" id="nocache_url" rows="3" cols="100" class="large-text code"><?php
|
||||
if( isset( $this->options['nocache_url'] ) ) {
|
||||
echo $this->options['nocache_url'];
|
||||
}
|
||||
?></textarea>
|
||||
<span class="description"><?php _e('Regular expressions use you must! e.g. <em>pattern1|pattern2|etc</em>', $this->plugin_constant); ?></span>
|
||||
</dd>
|
||||
</dl>
|
||||
</fieldset>
|
||||
|
||||
|
@ -717,6 +752,8 @@ class WP_FFPC extends PluginAbstract {
|
|||
|
||||
<form method="post" action="#" id="<?php echo $this->plugin_constant ?>-commands" class="plugin-admin" style="padding-top:2em;">
|
||||
|
||||
<?php wp_nonce_field( $this->plugin_constant ); ?>
|
||||
|
||||
<ul class="tabs">
|
||||
<li><a href="#<?php echo $this->plugin_constant ?>-precache" class="wp-switch-editor"><?php _e( 'Precache', $this->plugin_constant ); ?></a></li>
|
||||
<li><a href="#<?php echo $this->plugin_constant ?>-flush" class="wp-switch-editor"><?php _e( 'Empty cache', $this->plugin_constant ); ?></a></li>
|
||||
|
@ -824,7 +861,6 @@ class WP_FFPC extends PluginAbstract {
|
|||
*
|
||||
*/
|
||||
public function plugin_options_migrate( &$options ) {
|
||||
$migrated = false;
|
||||
|
||||
if ( version_compare ( $options['version'] , $this->plugin_version, '<' ) ) {
|
||||
/* cleanup possible leftover files from previous versions */
|
||||
|
@ -844,38 +880,27 @@ class WP_FFPC extends PluginAbstract {
|
|||
|
||||
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'];
|
||||
$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 ];
|
||||
$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'];
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1146,7 +1171,7 @@ class WP_FFPC extends PluginAbstract {
|
|||
}
|
||||
|
||||
/* in case the bloglinks are relative links add the base url, site specific */
|
||||
$baseurl = empty( $url ) ? $this->_site_url() : $url;
|
||||
$baseurl = empty( $url ) ? $this->utils->_site_url() : $url;
|
||||
if ( !strstr( $permalink, $baseurl ) ) {
|
||||
$permalink = $baseurl . $permalink;
|
||||
}
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
<?php
|
||||
/*
|
||||
Plugin Name: WP-FFPC
|
||||
Plugin URI: http://petermolnar.eu/wordpress/wp-ffpc
|
||||
Description: WordPress cache plugin for memcached & nginx - unbeatable speed
|
||||
Version: 1.5.0
|
||||
Plugin URI: https://github.com/petermolnar/wp-ffpc
|
||||
Description: WordPress in-memory full page cache plugin
|
||||
Version: 1.6.0
|
||||
Author: Peter Molnar <hello@petermolnar.eu>
|
||||
Author URI: http://petermolnar.eu/
|
||||
License: GPLv3
|
||||
|
@ -45,6 +45,8 @@ $wp_ffpc_defaults = array (
|
|||
'nocache_single' => false,
|
||||
'nocache_page' => false,
|
||||
'nocache_cookies' => false,
|
||||
'nocache_dyn' => true,
|
||||
'nocache_url' => '',
|
||||
'persistent' => false,
|
||||
'response_header' => false,
|
||||
'generate_time' => false,
|
||||
|
|
Loading…
Reference in a new issue