Nginx Helper - Version 1.3.4

Version Description

  • Fixed duplicate entries generated for maps (Harmless, but doesn't look good!)
  • Added timestamp html comments for cache verification, as described here: http://rtcamp.com/tutorials/checklist-verify-wordpress-nginx-setup/
Download this release

Release Info

Developer saurabhshukla
Plugin Icon 128x128 Nginx Helper
Version 1.3.4
Comparing to
See all releases

Code changes from version 1.3.3 to 1.3.4

Files changed (3) hide show
  1. nginx-helper.php +27 -5
  2. purger.php +1 -1
  3. readme.txt +8 -3
nginx-helper.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Nginx Helper
4
  Plugin URI: http://rtcamp.com/
5
  Description: An nginx helper that serves various functions.
6
- Version: 1.3.3
7
  Author: rtCamp
8
  Author URI: http://rtcamp.com
9
  Requires at least: 3.0
@@ -38,6 +38,7 @@ namespace rtCamp\WP\Nginx {
38
  function start_helper() {
39
 
40
  global $rt_wp_nginx_purger;
 
41
 
42
  add_action( 'publish_post', array(&$rt_wp_nginx_purger, 'purgePost'), 200, 1);
43
  add_action( 'publish_page', array(&$rt_wp_nginx_purger, 'purgePost'), 200, 1);
@@ -211,19 +212,24 @@ namespace rtCamp\WP\Nginx {
211
  if($wpdb->get_var("SHOW TABLES LIKE '{$wpdb->dmtable}'") == $wpdb->dmtable) {
212
  $rt_domain_map_sites = $wpdb->get_results( "SELECT blog_id, domain FROM {$wpdb->dmtable} ORDER BY id DESC" );
213
  }
214
- $rt_nginx_map ="";
 
 
215
 
216
  if ($rt_all_blogs)
217
  foreach ($rt_all_blogs as $blog)
218
  if ( SUBDOMAIN_INSTALL == "yes" )
219
- $rt_nginx_map .= "\t" . $blog->domain . "\t" . $blog->blog_id . ";\n";
220
  else
221
  if ( $blog->blog_id != 1 )
222
- $rt_nginx_map .= "\t" . $blog->path . "\t" . $blog->blog_id . ";\n";
223
 
224
  if($rt_domain_map_sites)
225
  foreach($rt_domain_map_sites as $site)
226
- $rt_nginx_map .= "\t" . $site->domain . "\t" . $site->blog_id . ";\n";
 
 
 
227
 
228
  return $rt_nginx_map;
229
  }
@@ -238,6 +244,22 @@ namespace rtCamp\WP\Nginx {
238
  }
239
  }
240
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
241
 
242
  }
243
 
3
  Plugin Name: Nginx Helper
4
  Plugin URI: http://rtcamp.com/
5
  Description: An nginx helper that serves various functions.
6
+ Version: 1.3.4
7
  Author: rtCamp
8
  Author URI: http://rtcamp.com
9
  Requires at least: 3.0
38
  function start_helper() {
39
 
40
  global $rt_wp_nginx_purger;
41
+ add_action('wp_footer',array(&$this, 'add_timestamps'),999);
42
 
43
  add_action( 'publish_post', array(&$rt_wp_nginx_purger, 'purgePost'), 200, 1);
44
  add_action( 'publish_page', array(&$rt_wp_nginx_purger, 'purgePost'), 200, 1);
212
  if($wpdb->get_var("SHOW TABLES LIKE '{$wpdb->dmtable}'") == $wpdb->dmtable) {
213
  $rt_domain_map_sites = $wpdb->get_results( "SELECT blog_id, domain FROM {$wpdb->dmtable} ORDER BY id DESC" );
214
  }
215
+ $rt_nginx_map = "";
216
+ $rt_nginx_map_array = array();
217
+
218
 
219
  if ($rt_all_blogs)
220
  foreach ($rt_all_blogs as $blog)
221
  if ( SUBDOMAIN_INSTALL == "yes" )
222
+ $rt_nginx_map_array[$blog->blog_id] .= $blog->domain;
223
  else
224
  if ( $blog->blog_id != 1 )
225
+ $rt_nginx_map_array[$blog->blog_id] = $blog->path;
226
 
227
  if($rt_domain_map_sites)
228
  foreach($rt_domain_map_sites as $site)
229
+ $rt_nginx_map_array[$site->blog_id] .= $site->domain;
230
+
231
+ foreach ($rt_nginx_map_array as $blog_id=>$blog)
232
+ $rt_nginx_map .= "\t" . $blog . "\t" . $blog_id . ";\n";
233
 
234
  return $rt_nginx_map;
235
  }
244
  }
245
  }
246
  }
247
+ function add_timestamps(){
248
+ if($this->options['enable_purge']!=1) return;
249
+ $timestamps = "<!--".
250
+ "::Nginx-Helper::".
251
+ "-->\n".
252
+ "<!--".
253
+ "::".get_num_queries()." queries executed::Dynamic page generated by Wordpress in ". timer_stop()." seconds::".
254
+ "-->\n".
255
+ "<!--".
256
+ "::Page Cached on '".current_time('mysql')."'::".
257
+ "-->\n".
258
+ "<!--".
259
+ "::Nginx-Helper::".
260
+ "-->\n";
261
+ echo $timestamps;
262
+ }
263
 
264
  }
265
 
purger.php CHANGED
@@ -6,7 +6,7 @@ namespace rtCamp\WP\Nginx{
6
 
7
  global $rt_wp_nginx_helper;
8
 
9
- $cache_ttl = $rt_wp_nginx_helper->options['cache_ttl'];
10
 
11
  $http_headers['X-Accel-Expires'] = $cache_ttl;
12
 
6
 
7
  global $rt_wp_nginx_helper;
8
 
9
+ $cache_ttl = 600;
10
 
11
  $http_headers['X-Accel-Expires'] = $cache_ttl;
12
 
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: rtcamp, rahul286, saurabhshukla
3
  Tags: nginx, cache, purge, nginx map, nginx cache, maps, fastcgi, proxy, rewrite, permalinks
4
  Requires at least: 3.0
5
  Tested up to: 3.4.2
6
- Stable tag: 1.3.3
7
  License: GPLv2 or later (of-course)
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
  Donate Link: http://rtcamp.com/donate/
@@ -88,6 +88,11 @@ Its just that we are hyperactive on our own forum!
88
  2. Remaining settings
89
 
90
  == Changelog ==
 
 
 
 
 
91
  = 1.3.3 =
92
 
93
  * Fixed map generation for multi domain installs using domain mapping plugin, where blog ids were not displayed.
@@ -123,5 +128,5 @@ Its just that we are hyperactive on our own forum!
123
 
124
  == Upgrade Notice ==
125
 
126
- = 1.3.3 =
127
- Fixed map generation for multi domain installs using domain mapping plugin, where blog ids were not displayed.
3
  Tags: nginx, cache, purge, nginx map, nginx cache, maps, fastcgi, proxy, rewrite, permalinks
4
  Requires at least: 3.0
5
  Tested up to: 3.4.2
6
+ Stable tag: 1.3.4
7
  License: GPLv2 or later (of-course)
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
  Donate Link: http://rtcamp.com/donate/
88
  2. Remaining settings
89
 
90
  == Changelog ==
91
+ = 1.3.4 =
92
+
93
+ * Fixed duplicate entries generated for maps (Harmless, but doesn't look good!)
94
+ * Added timestamp html comments for cache verification, as described here: http://rtcamp.com/tutorials/checklist-verify-wordpress-nginx-setup/
95
+
96
  = 1.3.3 =
97
 
98
  * Fixed map generation for multi domain installs using domain mapping plugin, where blog ids were not displayed.
128
 
129
  == Upgrade Notice ==
130
 
131
+ = 1.3.4 =
132
+ Duplicate entries in map cleaned up. Cache info added as html comments for cache verification.