Nginx Helper - Version 1.9.11

Version Description

  • Fixed issue where permalinks without trailing slash does not purging #124 - by Patrick
  • Check whether role exist or not before removing capability. #134 - by 1gor
Download this release

Release Info

Developer rtcamp
Plugin Icon 128x128 Nginx Helper
Version 1.9.11
Comparing to
See all releases

Code changes from version 1.9.10 to 1.9.11

Files changed (5) hide show
  1. admin/install.php +6 -3
  2. nginx-helper.php +12 -10
  3. purger.php +4 -2
  4. readme.txt +9 -5
  5. redis-purger.php +15 -12
admin/install.php CHANGED
@@ -60,11 +60,14 @@ namespace rtCamp\WP\Nginx {
60
  }
61
 
62
  function rt_wp_nginx_helper_remove_capability( $capability ) {
63
- $check_order = array( "subscriber", "contributor", "author", "editor", "administrator" );
64
 
65
  foreach ( $check_order as $role ) {
66
  $role = get_role( $role );
67
- $role->remove_cap( $capability );
 
 
 
68
  }
69
  }
70
 
@@ -97,4 +100,4 @@ namespace rtCamp\WP\Nginx {
97
 
98
  return $rt_wp_nginx_helper_get_options;
99
  }
100
- }
60
  }
61
 
62
  function rt_wp_nginx_helper_remove_capability( $capability ) {
63
+ $check_order = array( 'subscriber', 'contributor', 'author', 'editor', 'administrator' );
64
 
65
  foreach ( $check_order as $role ) {
66
  $role = get_role( $role );
67
+
68
+ if ( ! empty( $role ) && is_object( $role ) ) {
69
+ $role->remove_cap( $capability );
70
+ }
71
  }
72
  }
73
 
100
 
101
  return $rt_wp_nginx_helper_get_options;
102
  }
103
+ }
nginx-helper.php CHANGED
@@ -1,14 +1,16 @@
1
  <?php
2
- /*
3
- Plugin Name: Nginx Helper
4
- Plugin URI: https://rtcamp.com/nginx-helper/
5
- Description: Cleans nginx's fastcgi/proxy cache or redis-cache whenever a post is edited/published. Also does a few more things.
6
- Version: 1.9.10
7
- Author: rtCamp
8
- Author URI: https://rtcamp.com
9
- Text Domain: nginx-helper
10
- Requires at least: 3.0
11
- Tested up to: 4.7.3
 
 
12
  */
13
 
14
  namespace rtCamp\WP\Nginx {
1
  <?php
2
+ /**
3
+ * Plugin Name: Nginx Helper
4
+ * Plugin URI: https://rtcamp.com/nginx-helper/
5
+ * Description: Cleans nginx's fastcgi/proxy cache or redis-cache whenever a post is edited/published. Also does a few more things.
6
+ * Version: 1.9.11
7
+ * Author: rtCamp
8
+ * Author URI: https://rtcamp.com
9
+ * Text Domain: nginx-helper
10
+ * Requires at least: 3.0
11
+ * Tested up to: 4.9.5
12
+ *
13
+ * @package nginx-helper
14
  */
15
 
16
  namespace rtCamp\WP\Nginx {
purger.php CHANGED
@@ -204,13 +204,15 @@ namespace rtCamp\WP\Nginx {
204
  function purgeUrl( $url, $feed = true ) {
205
 
206
  global $rt_wp_nginx_helper;
207
-
208
- $url = trailingslashit( $url );
209
 
210
  $this->log( "- Purging URL | " . $url );
211
 
212
  $parse = parse_url( $url );
213
 
 
 
 
 
214
  switch ($rt_wp_nginx_helper->options['purge_method']) {
215
  case 'unlink_files':
216
  $_url_purge_base = $parse[ 'scheme' ] . '://' . $parse[ 'host' ] . $parse[ 'path' ];
204
  function purgeUrl( $url, $feed = true ) {
205
 
206
  global $rt_wp_nginx_helper;
 
 
207
 
208
  $this->log( "- Purging URL | " . $url );
209
 
210
  $parse = parse_url( $url );
211
 
212
+ if ( ! isset( $parse['path'] ) ) {
213
+ $parse['path'] = '';
214
+ }
215
+
216
  switch ($rt_wp_nginx_helper->options['purge_method']) {
217
  case 'unlink_files':
218
  $_url_purge_base = $parse[ 'scheme' ] . '://' . $parse[ 'host' ] . $parse[ 'path' ];
readme.txt CHANGED
@@ -5,8 +5,8 @@ Tags: nginx, cache, purge, nginx map, nginx cache, maps, fastcgi, proxy, redis,
5
  License: GPLv2 or later (of-course)
6
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
7
  Requires at least: 3.0
8
- Tested up to: 4.8
9
- Stable tag: 1.9.10
10
 
11
  Cleans nginx's fastcgi/proxy cache or redis-cache whenever a post is edited/published. Also does a few more things.
12
 
@@ -114,6 +114,10 @@ Please post your problem in [our free support forum](http://community.rtcamp.com
114
 
115
  == Changelog ==
116
 
 
 
 
 
117
  = 1.9.10 =
118
  * Fixed issue where Nginx cache folders deleted on purge. [#123](https://github.com/rtCamp/nginx-helper/pull/123) - by [johan-chassaing](https://github.com/johan-chassaing)
119
  * Fixed Redis purge all feature for installation where WordPress lives in a separate folder. [#130](https://github.com/rtCamp/nginx-helper/pull/130) - by [pySilver](https://github.com/pySilver)
@@ -340,6 +344,6 @@ Fix url escaping [#82](https://github.com/rtCamp/nginx-helper/pull/82) - by
340
 
341
  == Upgrade Notice ==
342
 
343
- = 1.9.10 =
344
- * Fixed issue where Nginx cache folders deleted on purge. [#123](https://github.com/rtCamp/nginx-helper/pull/123) - by [johan-chassaing](https://github.com/johan-chassaing)
345
- * Fixed Redis purge all feature for installation where WordPress lives in a separate folder. [#130](https://github.com/rtCamp/nginx-helper/pull/130) - by [pySilver](https://github.com/pySilver)
5
  License: GPLv2 or later (of-course)
6
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
7
  Requires at least: 3.0
8
+ Tested up to: 4.9.5
9
+ Stable tag: 1.9.11
10
 
11
  Cleans nginx's fastcgi/proxy cache or redis-cache whenever a post is edited/published. Also does a few more things.
12
 
114
 
115
  == Changelog ==
116
 
117
+ = 1.9.11 =
118
+ * Fixed issue where permalinks without trailing slash does not purging [#124](https://github.com/rtCamp/nginx-helper/issues/124) - by Patrick
119
+ * Check whether role exist or not before removing capability. [#134](https://github.com/rtCamp/nginx-helper/pull/134) - by [1gor](https://github.com/1gor)
120
+
121
  = 1.9.10 =
122
  * Fixed issue where Nginx cache folders deleted on purge. [#123](https://github.com/rtCamp/nginx-helper/pull/123) - by [johan-chassaing](https://github.com/johan-chassaing)
123
  * Fixed Redis purge all feature for installation where WordPress lives in a separate folder. [#130](https://github.com/rtCamp/nginx-helper/pull/130) - by [pySilver](https://github.com/pySilver)
344
 
345
  == Upgrade Notice ==
346
 
347
+ = 1.9.11 =
348
+ * Fixed issue where permalinks without trailing slash does not purging [#124](https://github.com/rtCamp/nginx-helper/issues/124) - by Patrick
349
+ * Check whether role exist or not before removing capability. [#134](https://github.com/rtCamp/nginx-helper/pull/134) - by [1gor](https://github.com/1gor)
redis-purger.php CHANGED
@@ -208,24 +208,27 @@ namespace rtCamp\WP\Nginx {
208
  }
209
  }
210
 
211
- function purgeUrl( $url, $feed = true )
212
- {
213
  global $rt_wp_nginx_helper;
214
-
215
- $url = trailingslashit( $url );
216
-
217
- $this->log( "- Purging URL | " . $url );
218
-
219
  $parse = parse_url( $url );
220
-
 
 
 
 
221
  $host = $rt_wp_nginx_helper->options['redis_hostname'];
222
-
223
  $prefix = $rt_wp_nginx_helper->options['redis_prefix'];
224
-
225
  $_url_purge_base = $prefix . $parse['scheme'] . 'GET' . $parse['host'] . $parse['path'];
226
-
227
  delete_single_key( $_url_purge_base );
228
- }
 
229
 
230
  function log( $msg, $level = 'INFO' )
231
  {
208
  }
209
  }
210
 
211
+ function purgeUrl( $url, $feed = true ) {
212
+
213
  global $rt_wp_nginx_helper;
214
+
215
+ $this->log( '- Purging URL | ' . $url );
216
+
 
 
217
  $parse = parse_url( $url );
218
+
219
+ if ( ! isset( $parse['path'] ) ) {
220
+ $parse['path'] = '';
221
+ }
222
+
223
  $host = $rt_wp_nginx_helper->options['redis_hostname'];
224
+
225
  $prefix = $rt_wp_nginx_helper->options['redis_prefix'];
226
+
227
  $_url_purge_base = $prefix . $parse['scheme'] . 'GET' . $parse['host'] . $parse['path'];
228
+
229
  delete_single_key( $_url_purge_base );
230
+
231
+ }
232
 
233
  function log( $msg, $level = 'INFO' )
234
  {