Nginx Helper - Version 1.7.3

Version Description

  • Suppressed unlink related error-messages which can be safely ignored.
  • Fixed a bug in purge-all option.
Download this release

Release Info

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

Code changes from version 1.7.2 to 1.7.3

Files changed (3) hide show
  1. nginx-helper.php +3 -3
  2. purger.php +9 -3
  3. readme.txt +23 -17
nginx-helper.php CHANGED
@@ -1,13 +1,13 @@
1
  <?php
2
  /*
3
  Plugin Name: Nginx Helper
4
- Plugin URI: http://rtcamp.com/
5
  Description: An nginx helper that serves various functions.
6
- Version: 1.7.2
7
  Author: rtCamp
8
  Author URI: http://rtcamp.com
9
  Requires at least: 3.0
10
- Tested up to: 3.5
11
  */
12
  namespace rtCamp\WP\Nginx {
13
  define( 'rtCamp\WP\Nginx\RT_WP_NGINX_HELPER_PATH', plugin_dir_path( __FILE__ ) );
1
  <?php
2
  /*
3
  Plugin Name: Nginx Helper
4
+ Plugin URI: http://rtcamp.com/nginx-helper/
5
  Description: An nginx helper that serves various functions.
6
+ Version: 1.7.3
7
  Author: rtCamp
8
  Author URI: http://rtcamp.com
9
  Requires at least: 3.0
10
+ Tested up to: 3.6
11
  */
12
  namespace rtCamp\WP\Nginx {
13
  define( 'rtCamp\WP\Nginx\RT_WP_NGINX_HELPER_PATH', plugin_dir_path( __FILE__ ) );
purger.php CHANGED
@@ -674,13 +674,15 @@ namespace rtCamp\WP\Nginx {
674
  }
675
 
676
  function true_purge_all(){
677
- $this->unlinkRecursive(RT_WP_NGINX_HELPER_CACHE_PATH);
678
  $this->log( "* * * * *" );
679
  $this->log( "* Purged Everything!" );
680
  $this->log( "* * * * *" );
681
  }
682
 
683
- function unlinkRecursive( $dir ) {
 
 
684
  if ( ! $dh = opendir( $dir ) ) {
685
  return;
686
  }
@@ -689,10 +691,14 @@ namespace rtCamp\WP\Nginx {
689
  continue;
690
  }
691
 
692
- if ( ! unlink( $dir . '/' . $obj ) ) {
693
  $this->unlinkRecursive( $dir . '/' . $obj, true );
694
  }
695
  }
 
 
 
 
696
 
697
  closedir( $dh );
698
 
674
  }
675
 
676
  function true_purge_all(){
677
+ $this->unlinkRecursive(RT_WP_NGINX_HELPER_CACHE_PATH, false);
678
  $this->log( "* * * * *" );
679
  $this->log( "* Purged Everything!" );
680
  $this->log( "* * * * *" );
681
  }
682
 
683
+ /** Source - http://stackoverflow.com/a/1360437/156336 **/
684
+
685
+ function unlinkRecursive( $dir, $deleteRootToo ) {
686
  if ( ! $dh = opendir( $dir ) ) {
687
  return;
688
  }
691
  continue;
692
  }
693
 
694
+ if ( ! @unlink( $dir . '/' . $obj ) ) {
695
  $this->unlinkRecursive( $dir . '/' . $obj, true );
696
  }
697
  }
698
+
699
+ if ($deleteRootToo){
700
+ rmdir($dir);
701
+ }
702
 
703
  closedir( $dh );
704
 
readme.txt CHANGED
@@ -2,8 +2,8 @@
2
  Contributors: rtcamp, rahul286, saurabhshukla, Darren Slatten, jk3us, daankortenbach, telofy, pjv
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.5
6
- Stable tag: 1.7.2
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/
@@ -44,21 +44,27 @@ For proper configuration, check **tutorial list** of [Description tab](http://wo
44
 
45
  == Frequently Asked Questions ==
46
 
 
 
47
  = FAQ - Installation/Comptability =
48
 
49
  **Q. Will this work out of the box?**
50
 
51
- No. You need to make some changes at the Nginx end. Please check **tutorial list** of [Description tab](http://wordpress.org/extend/plugins/nginx-helper/)
52
 
53
- = FAQ - Nginx Map =
54
 
55
- **Q. My multisite already uses `WPMU_ACCEL_REDIRECT`. Do I still need Nginx Map?**
56
 
57
- Definitely. `WPMU_ACCEL_REDIRECT` reduces the load on PHP, but it still ask WordPress i.e. PHP/MySQL to do some work for static files e.g. images in your post. Nginx map lets nginx handle files on its own bypassing wordpress which gives you much better performance without using a CDN.
58
 
59
- = FAQ - Nginx Fastcgi Cache Purge =
 
 
 
60
 
61
  **Q. Does it work for custom posts and taxonomies?**
 
62
  Yes. It handles all post-types same way.
63
 
64
  **Q. How do I know my Nginx config is correct for fastcgi purging?**
@@ -86,15 +92,12 @@ So, in the above eg, the purge url will be http://yoursite.com/purge/about/
86
  Just open this in a browser and the page will be purged instantly.
87
  Needless to say, this won't work, if you have a page or taxonomy called 'purge'.
88
 
89
- **Q. There's a 'purge all' button? Does it purge the whole site?**
90
 
91
- Yes, it does. It physically empties the cache directory. It is set by default to `/var/run/nginx-cache/`.
92
 
93
- If your cache directory is different, you can override this in your wp-config.php by adding
94
- `define('RT_WP_NGINX_HELPER_CACHE_PATH','/var/run/nginx-cache/');`
95
- Replace the path with your own.
96
 
97
- = FAQ - Nginx Map =
98
 
99
  **Q. I am using X plugin. Will it work on Nginx?**
100
 
@@ -113,6 +116,10 @@ Its just that we are hyperactive on our own forum!
113
 
114
  == Changelog ==
115
 
 
 
 
 
116
  = 1.7.2 =
117
  * [pjv](http://profiles.wordpress.org/pjv/) fixed bug in logging file.
118
 
@@ -200,7 +207,7 @@ Its just that we are hyperactive on our own forum!
200
  = 1.3.4 =
201
 
202
  * Fixed duplicate entries generated for maps (Harmless, but doesn't look good!)
203
- * Added timestamp html comments for cache verification, as described here: http://rtcamp.com/tutorials/checklist-verify-wordpress-nginx-setup/
204
 
205
  = 1.3.3 =
206
 
@@ -218,7 +225,6 @@ Its just that we are hyperactive on our own forum!
218
 
219
  * Improved Readme.
220
 
221
-
222
  = 1.2 =
223
 
224
  * Fixed map generation error.
@@ -237,5 +243,5 @@ Its just that we are hyperactive on our own forum!
237
 
238
  == Upgrade Notice ==
239
 
240
- = 1.7.1 =
241
- Added true purge all. Updated log and map file locations.
2
  Contributors: rtcamp, rahul286, saurabhshukla, Darren Slatten, jk3us, daankortenbach, telofy, pjv
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.6
6
+ Stable tag: 1.7.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/
44
 
45
  == Frequently Asked Questions ==
46
 
47
+ **Important** - Please refer to [http://rtcamp.com/nginx-helper/faq](http://rtcamp.com/nginx-helper/faq) for uptodate FAQ's.
48
+
49
  = FAQ - Installation/Comptability =
50
 
51
  **Q. Will this work out of the box?**
52
 
53
+ No. You need to make some changes at the Nginx end. Please check [tutorial list](http://rtcamp.com/wordpress-nginx/tutorials)
54
 
55
+ = FAQ - Nginx Fastcgi Cache Purge =
56
 
57
+ **Q. There's a 'purge all' button? Does it purge the whole site?**
58
 
59
+ Yes, it does. It physically empties the cache directory. It is set by default to `/var/run/nginx-cache/`.
60
 
61
+ If your cache directory is different, you can override this in your wp-config.php by adding
62
+ `define('RT_WP_NGINX_HELPER_CACHE_PATH','/var/run/nginx-cache/');`
63
+
64
+ Replace the path with your own.
65
 
66
  **Q. Does it work for custom posts and taxonomies?**
67
+
68
  Yes. It handles all post-types same way.
69
 
70
  **Q. How do I know my Nginx config is correct for fastcgi purging?**
92
  Just open this in a browser and the page will be purged instantly.
93
  Needless to say, this won't work, if you have a page or taxonomy called 'purge'.
94
 
 
95
 
96
+ = FAQ - Nginx Map =
97
 
98
+ **Q. My multisite already uses `WPMU_ACCEL_REDIRECT`. Do I still need Nginx Map?**
 
 
99
 
100
+ Definitely. `WPMU_ACCEL_REDIRECT` reduces the load on PHP, but it still ask WordPress i.e. PHP/MySQL to do some work for static files e.g. images in your post. Nginx map lets nginx handle files on its own bypassing wordpress which gives you much better performance without using a CDN.
101
 
102
  **Q. I am using X plugin. Will it work on Nginx?**
103
 
116
 
117
  == Changelog ==
118
 
119
+ = 1.7.3 =
120
+ * Suppressed `unlink` related error-messages which can be safely ignored.
121
+ * Fixed a bug in purge-all option.
122
+
123
  = 1.7.2 =
124
  * [pjv](http://profiles.wordpress.org/pjv/) fixed bug in logging file.
125
 
207
  = 1.3.4 =
208
 
209
  * Fixed duplicate entries generated for maps (Harmless, but doesn't look good!)
210
+ * Added timestamp html comments for cache verification, as described here: http://rtcamp.com/wordpress-nginx/tutorials/checklist/
211
 
212
  = 1.3.3 =
213
 
225
 
226
  * Improved Readme.
227
 
 
228
  = 1.2 =
229
 
230
  * Fixed map generation error.
243
 
244
  == Upgrade Notice ==
245
 
246
+ = 1.7.3 =
247
+ Fixed true purge all.