From e80ff2cf55b28905914d28610ded23b49fba3288 Mon Sep 17 00:00:00 2001 From: cadeyrn Date: Thu, 7 Mar 2013 12:09:59 +0000 Subject: [PATCH] readme cleanup, settings link for plugins page git-svn-id: http://plugins.svn.wordpress.org/wp-ffpc/trunk@677428 b8457f37-d9ea-0310-8a92-e5e31aec5664 --- readme.txt | 69 ++++++++++++++++++++++++++++------------------------- wp-ffpc.php | 42 ++++++++++++++++++++++++++++---- 2 files changed, 74 insertions(+), 37 deletions(-) diff --git a/readme.txt b/readme.txt index f63f5a5..ffbcab9 100644 --- a/readme.txt +++ b/readme.txt @@ -1,67 +1,70 @@ === WP-FFPC === Contributors: cadeyrn Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=XU3DG7LLA76WC -Tags: cache, APC, memcached, full page cache +Tags: cache, APC, memcache, memcached, page cache, full page cache, nginx Requires at least: 3.0 Tested up to: 3.5.1 Stable tag: 0.5 -Fast Full Page Cache, backend can be memcached or APC +Store WordPress pages in memcached and serve them with nginx - unbeatable speed! == Description == -WP-FFPC is a full page cache plugin for WordPress. It can use APC or a memcached server as backend. -The naming stands for Fast Full Page Cache. - -PHP has two extension for communication with a memcached server, named Memcache and Memcached. The plugin can utilize both, however, the recommended is memcached. +WP-FFPC is a full page cache plugin for WordPress. Supports memcached server or APC as backend and both widely available PHP memcached modules, Memcache and Memcached as well. = Features: = -* exclude possibility of home, feeds, archieves, pages, singles +* exclude possibilities: of home, feeds, archieves, pages, singles * possibility to enable caching for logged-in users -* use APC or memcached as backend +* APC or memcached server storage * 404 caching * redirects caching * Last Modified HTTP header compatibility with 304 responses * shortlink HTTP header preservation * pingback HTTP header preservation(1) * fallback to no caching if any error or problem occurs -* syslog & debug settings available +* syslog & debug settings for troubleshooting * supports multiple memcached backends * Wordpress Network compatible(2) * nginx compatible(3) (1) pingback hostname will always be generated from the accessed domain, otherwise speed would get highly compromised -(2) If enabled as network-wide plugin in a WordPress Network, the configuration will only be available for network admins at the network admin panel, will be system-wide and will be applied for every blog. +(2) If enabled as network-wide plugin in a WordPress Network, the configuration will only be available for network admins at the network admin panel, will be system-wide and will be applied for every blog. -(3) nginx compatility means that if used with PHP Memcache or PHP Memcached extension, the created memcached entries can be read and served directly from nginx, making the cache insanely fast. +(3) nginx compatility means that if used with PHP Memcache or PHP Memcached extension, the created memcached entries can be read and served directly from nginx. If used with APC, this feature is not available (no APC module for nginx). -Short nginx example configuration is generated on the plugin settings page, under `nginx` tab. -NOTE: some features ( most of additional HTTP headers for example ) will not be available with this solution! ( yet ) +Short nginx example configuration is generated on the plugin settings page, under `nginx` tab according to the settings of the plugin. +NOTE: some features ( most of additional HTTP headers for example, like pingback, shortlink, etc. ) will not be available with this solution! ( yet ) Parts are based on [Hyper Cache](http://wordpress.org/extend/plugins/hyper-cache "Hyper Cache") plugin by Satollo (info@satollo.net). == Installation == 1. Upload contents of `wp-ffpc.zip` to the `/wp-content/plugins/` directory 2. Enable WordPress cache by adding `define('WP_CACHE',true);` in wp-config.php -3. Activate the plugin through the `Plugins` menu in WordPress (please use network wide activation if used in a WordPress Network) -4. Check the settings in `Settings` -> `wp-ffpc` menu in WordPress. For WordPress Network, please visit the Network Admin panel, the options will be available under Network Admin Settings page, in WP-FFPC menu entry. +3. Activate the plugin through the `Plugins` menu in WordPress ( site or Network wide ) +4. Check the settings in `Settings` ( site or Network Admin, depending on activation wideness ) -> `WP-FFPC` menu in WordPress. 5. Save the settings. THIS STEP IS MANDATORY: without saving the settings, there will be no activated caching! == Frequently Asked Questions == = How to install memcache PHP extension? = -On most of the distributions, php5-memcached or php5-mecache is available as package. +On most of the distributions, php5-memcached or php5-memcache is available as package. You can use PECL alternatively: `pecl install memcached`. -It's recommended to use memcached. +It's recommended to use Memcached instead of Memcache. = How to use the plugin on Amazon Linux? = You have to remove the default yum package, named `php-pecl-memcache` and install `Memcache` or `Memcached` through PECL. == Changelog == -= 0.5 = -2013.03.06 += 0.5.1 = +*in development* +* settings link for plugins page +* readme cleanup +* setting link URL repair & cleanup + += 0.5 = +*2013.03.06* WARNING, MAJOR CHANGES! * default values bug ( causing %3C bug ) really fixed by the help of Mark Costlow @@ -73,73 +76,73 @@ WARNING, MAJOR CHANGES! * refactored settings saving mechanism * additional syslog informations * additional comments on the code -* lots of minor fixes +* lots of minor fixes and code cleanup * donation link on the top = 0.4.3 = -2013.03.03 +*2013.03.03* * long-running %3C bug fixed by the help of Mark Costlow , many thanks for it. It was cause by a bad check in the default values set-up: is_numeric applies for string numbers as well, which was unknown to me, and cause some of the values to be 0 where they should have been something different. = 0.4.2 = -2012.12.07 +*2012.12.07* * added optional sync protocoll option: replace all http->https or https->http depending on request protocol * binary mode is working correctly with memcached extension * added warning message for memcache extension in binary mode -KNOWN ISSUES +**KNOWN ISSUES** There are major problems with the "memcache" driver, the source is yet unkown. The situation is that there's no response from the memcached server using this driver; please avoid using it! = 0.4.1 = -2012.08.16 +*2012.08.16* * storage key extended with scheme ( http; https; etc. ), the miss caused problems when https request server CSS and JS files via http. = 0.4 = -2012.08.06 +*2012.08.06* * tested against new WordPress versions * added lines to "memcached" storage to be able to work with nginx as well * added lines to "memcached" to use binary protocol ( tested with PHP Memcached version 2.0.1 ) -KNOWN ISSUES +**KNOWN ISSUES** * "memcache" extension fails in binary mode; the reason is under investigation = 0.3.2 = -2012.02.27 +*2012.02.27* * apc_cache_info replaced with apc_sma_info, makes plugin faster = 0.3 = -2012.02.21 +*2012.02.21* * added syslog debug messages possibility * bugfix: removed (accidently used) short_open_tags = 0.2.3 = -2012.02.21 +*2012.02.21* * nginx-sample.conf file added, nginx config is created from here = 0.2.2 = -2012.02.21 +*2012.02.21* * memcache types bugfix, reported in forum, thanks! = 0.2.1 = -2012.02.21 +*2012.02.21* * bugfix, duplicated inclusion could emerge, fix added, thanks for Géza Kuti for reporting! = 0.2 = -2012.02.19 +*2012.02.19* * added APC compression option ( requires PHP ZLIB ). Useful is output pages are large. Compression is on lowest level, therefore size/CPU load is more or less optimal. = 0.1 = -2012.02.16 +*2012.02.16* * first public release diff --git a/wp-ffpc.php b/wp-ffpc.php index 777af65..308b7a5 100644 --- a/wp-ffpc.php +++ b/wp-ffpc.php @@ -66,6 +66,7 @@ define ( 'WP_FFPC_CONFIG_VAR' , '$wp_ffpc_config' ); define ( 'WP_FFPC_SERVER_LIST_SEPARATOR' , ',' ); define ( 'WP_FFPC_SERVER_SEPARATOR', ':' ); define ( 'WP_FFPC_DONATION_LINK', 'https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=XU3DG7LLA76WC' ); +define ( 'WP_FFPC_FILE' , plugin_basename(__FILE__) ); /* get the common functions */ include_once (WP_FFPC_DIR .'/wp-ffpc-common.php'); @@ -91,12 +92,17 @@ if (!class_exists('WPFFPC')) { /* stores information if plugin is network active or not */ var $network = false; + var $settingslink = ''; /** * constructor * */ function __construct() { + /* set settings page link */ + $this->settingslink = 'options-general.php?page=' . WP_FFPC_OPTIONS_PAGE; + + /* check if plugin is network-activated */ $this->check_for_network(); /* register options */ @@ -121,6 +127,12 @@ if (!class_exists('WPFFPC')) { add_filter('redirect_canonical', array( $this , 'redirect_canonical') , 10, 2); } + $plugin = plugin_basename( __FILE__ ); + if ( $this->network ) + add_filter( "network_admin_plugin_action_links_$plugin", array( $this, 'settings_link' ) ); + else + add_filter( "plugin_action_links_$plugin", array( $this, 'settings_link' ) ); + /* add admin styling */ if( is_admin() ) { @@ -168,11 +180,17 @@ if (!class_exists('WPFFPC')) { { $this->save_settings (); $this->status = 1; - header("Location: admin.php?page=" . WP_FFPC_OPTIONS_PAGE . "&saved=true"); + + header( "Location: ". $this->settingslink ."&saved=true" ); } + if ( $this->network ) + $optionspage = 'settings.php'; + else + $optionspage = 'options-general.php'; + /* we use settings menu, no need for highest level menu */ - add_submenu_page('settings.php', 'Edit WP-FFPC options', __('WP-FFPC', WP_FFPC_PARAM ), 10, WP_FFPC_OPTIONS_PAGE , array ( $this , 'admin_panel' ) ); + add_submenu_page( $optionspage, 'Edit WP-FFPC options', __('WP-FFPC', WP_FFPC_PARAM ), 10, WP_FFPC_OPTIONS_PAGE , array ( $this , 'admin_panel' ) ); } /** @@ -527,10 +545,15 @@ if (!class_exists('WPFFPC')) { * */ function check_for_network( ) { - if ( is_multisite() ) { + if ( is_multisite() ) + { $plugins = get_site_option( 'active_sitewide_plugins'); - if ( isset($plugins['wp-ffpc/wp-ffpc.php']) ) { + /* see if plugins is active */ + if ( isset($plugins['wp-ffpc/wp-ffpc.php']) ) + { $this->network = true; + /* replace settings link */ + $this->settingslink = str_replace( 'options-general.php' , 'settings.php' , $this->settingslink ); } } } @@ -760,6 +783,17 @@ if (!class_exists('WPFFPC')) { } + + /** + * + * + */ + function settings_link ( $links ) { + $settings_link = '' . __( 'Settings', WP_FFPC_PARAM ) . ''; + array_unshift( $links, $settings_link ); + return $links; + } + /** * splits config parameter "hosts" into an array of server string, host and port * to be used in later config