Nginx Helper - Version 1.9.2

Version Description

Fix purging for Redis cache and FastCGI cache

Download this release

Release Info

Developer rahul286
Plugin Icon 128x128 Nginx Helper
Version 1.9.2
Comparing to
See all releases

Code changes from version 1.9.1 to 1.9.2

Files changed (3) hide show
  1. nginx-helper.php +8 -4
  2. readme.txt +5 -2
  3. redis-purger.php +1 -1
nginx-helper.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Nginx Helper
4
  Plugin URI: https://rtcamp.com/nginx-helper/
5
  Description: Cleans nginx's fastcgi/proxy cache whenever a post is edited/published. Also does few more things.
6
- Version: 1.9.1
7
  Author: rtCamp
8
  Author URI: https://rtcamp.com
9
  Text Domain: nginx-helper
@@ -49,7 +49,7 @@ namespace rtCamp\WP\Nginx {
49
  add_action( 'shutdown', array( &$this, 'add_timestamps' ), 99999 );
50
  add_action( 'add_init', array( &$this, 'update_map' ) );
51
 
52
- add_action( 'save_post', array( &$rt_wp_nginx_purger, 'purgePost' ), 200, 1 );
53
  // add_action( 'publish_post', array( &$rt_wp_nginx_purger, 'purgePost' ), 200, 1 );
54
  // add_action( 'publish_page', array( &$rt_wp_nginx_purger, 'purgePost' ), 200, 1 );
55
  add_action( 'wp_insert_comment', array( &$rt_wp_nginx_purger, 'purgePostOnComment' ), 200, 2 );
@@ -126,10 +126,14 @@ namespace rtCamp\WP\Nginx {
126
  {
127
 
128
  global $blog_id, $rt_wp_nginx_purger;
129
- if ( !$this->options['enable_purge'] ) {
 
 
 
130
  return;
131
  }
132
- if ( $old_status != $new_status && $old_status != 'inherit' && $new_status != 'inherit' && $old_status != 'auto-draft' && $new_status != 'auto-draft' && $new_status != 'publish' && !wp_is_post_revision( $post->ID ) ) {
 
133
  $rt_wp_nginx_purger->log( "Purge post on transition post STATUS from " . $old_status . " to " . $new_status );
134
  $rt_wp_nginx_purger->purgePost( $post->ID );
135
  }
3
  Plugin Name: Nginx Helper
4
  Plugin URI: https://rtcamp.com/nginx-helper/
5
  Description: Cleans nginx's fastcgi/proxy cache whenever a post is edited/published. Also does few more things.
6
+ Version: 1.9.2
7
  Author: rtCamp
8
  Author URI: https://rtcamp.com
9
  Text Domain: nginx-helper
49
  add_action( 'shutdown', array( &$this, 'add_timestamps' ), 99999 );
50
  add_action( 'add_init', array( &$this, 'update_map' ) );
51
 
52
+ //add_action( 'save_post', array( &$rt_wp_nginx_purger, 'purgePost' ), 200, 1 );
53
  // add_action( 'publish_post', array( &$rt_wp_nginx_purger, 'purgePost' ), 200, 1 );
54
  // add_action( 'publish_page', array( &$rt_wp_nginx_purger, 'purgePost' ), 200, 1 );
55
  add_action( 'wp_insert_comment', array( &$rt_wp_nginx_purger, 'purgePostOnComment' ), 200, 2 );
126
  {
127
 
128
  global $blog_id, $rt_wp_nginx_purger;
129
+ $skip_status = array( 'auto-draft', 'draft', 'inherit', 'trash', 'pending' );
130
+ $purge_status = array( 'publish', 'future' );
131
+
132
+ if ( !$this->options['enable_purge'] || in_array( $old_status, $skip_status ) ) {
133
  return;
134
  }
135
+
136
+ if( in_array( $old_status, $purge_status ) || in_array( $new_status, $purge_status ) ) {
137
  $rt_wp_nginx_purger->log( "Purge post on transition post STATUS from " . $old_status . " to " . $new_status );
138
  $rt_wp_nginx_purger->purgePost( $post->ID );
139
  }
readme.txt CHANGED
@@ -1,9 +1,9 @@
1
  === Nginx Helper ===
2
- Contributors: rtcamp, rahul286, saurabhshukla, manishsongirkar36, faishal, desaiuditd, Darren Slatten, jk3us, daankortenbach, telofy, pjv, llonchj, jinnko, weskoop, bcole808, gungeekatx, rohanveer
3
  Tags: nginx, cache, purge, nginx map, nginx cache, maps, fastcgi, proxy, rewrite, permalinks
4
  Requires at least: 3.0
5
  Tested up to: 4.2.2
6
- Stable tag: 1.9.1
7
  later (of-.1course)
8
  Fix purging for custom post types
9
 
@@ -116,6 +116,9 @@ Please post your problem in [our free support forum](http://community.rtcamp.com
116
 
117
  == Changelog ==
118
 
 
 
 
119
  = 1.9.1 =
120
  Fix purging for custom post types
121
 
1
  === Nginx Helper ===
2
+ Contributors: rtcamp, rahul286, saurabhshukla, manishsongirkar36, faishal, desaiuditd, Darren Slatten, jk3us, daankortenbach, telofy, pjv, llonchj, jinnko, weskoop, bcole808, gungeekatx, rohanveer, chandrapatel
3
  Tags: nginx, cache, purge, nginx map, nginx cache, maps, fastcgi, proxy, rewrite, permalinks
4
  Requires at least: 3.0
5
  Tested up to: 4.2.2
6
+ Stable tag: 1.9.2
7
  later (of-.1course)
8
  Fix purging for custom post types
9
 
116
 
117
  == Changelog ==
118
 
119
+ = 1.9.2 =
120
+ Fix purging for Redis cache and FastCGI cache
121
+
122
  = 1.9.1 =
123
  Fix purging for custom post types
124
 
redis-purger.php CHANGED
@@ -218,7 +218,7 @@ namespace rtCamp\WP\Nginx {
218
  $parse = parse_url( $url );
219
  $host = $rt_wp_nginx_helper->options['redis_hostname'];
220
  $prefix = $rt_wp_nginx_helper->options['redis_prefix'];
221
- $_url_purge_base = $prefix . $parse['scheme'] . 'GET' . $host . $parse['path'];
222
  delete_single_key( $_url_purge_base );
223
  }
224
 
218
  $parse = parse_url( $url );
219
  $host = $rt_wp_nginx_helper->options['redis_hostname'];
220
  $prefix = $rt_wp_nginx_helper->options['redis_prefix'];
221
+ $_url_purge_base = $prefix . $parse['scheme'] . 'GET' . $parse['host'] . $parse['path'];
222
  delete_single_key( $_url_purge_base );
223
  }
224