Skip to content
Permalink
Browse files

phpcs error resolved, code refactoring and added new functionalities …

…from master
  • Loading branch information...
vaishaliagola27 committed Oct 12, 2018
1 parent 83f6a0b commit cfccc36841afb28c31d6cd770093a5d9a2e5a43c
@@ -1,13 +1,13 @@
# Nginx Helper #
**Contributors:** rtcamp, rahul286, saurabhshukla, manishsongirkar36, faishal, desaiuditd, darren-slatten, jk3us, daankortenbach, telofy, pjv, llonchj, jinnko, weskoop, bcole808, gungeekatx, rohanveer, chandrapatel, gagan0123, ravanh, michaelbeil, samedwards, niwreg, entr, nuvoPoint

**Tags:** nginx, cache, purge, nginx map, nginx cache, maps, fastcgi, proxy, redis, redis-cache, rewrite, permalinks
**Requires at least:** 3.0
**Tested up to:** 4.9.5
**Stable tag:** 1.9.11
**License:** GPLv2 or later (of-course)
**License URI:** http://www.gnu.org/licenses/gpl-2.0.html
**Donate Link:** http://rtcamp.com/donate/
**Tags:** nginx, cache, purge, nginx map, nginx cache, maps, fastcgi, proxy, redis, redis-cache, rewrite, permalinks
**Requires at least:** 3.0
**Tested up to:** 4.9.8
**Stable tag:** 1.9.12
**License:** GPLv2 or later (of-course)
**License URI:** http://www.gnu.org/licenses/gpl-2.0.html
**Donate Link:** http://rtcamp.com/donate/

Cleans nginx's fastcgi/proxy cache or redis-cache whenever a post is edited/published. Also does a few more things.

@@ -94,6 +94,21 @@ To purge a page immediately, follow these instructions:
* Needless to say, this won't work, if you have a page or taxonomy called 'purge'.


### FAQ - Nginx Redis Cache ###

**Q. Can I override the redis hostname, port and prefix?**

Yes, you can force override the redis hostname, port or prefix by defining constant in wp-config.php. For example:

```
define( 'RT_WP_NGINX_HELPER_REDIS_HOSTNAME', '10.0.0.1' );
define( 'RT_WP_NGINX_HELPER_REDIS_PORT', '6000' );
define( 'RT_WP_NGINX_HELPER_REDIS_PREFIX', 'page-cache:' );
```


### FAQ - Nginx Map ###

**Q. My multisite already uses `WPMU_ACCEL_REDIRECT`. Do I still need Nginx Map?**
@@ -119,6 +134,9 @@ Please post your problem in [our free support forum](http://community.rtcamp.com

## Changelog ##

### 1.9.12 ###
* Allow override Redis host/port/prefix by defining constant in wp-config.php [#152](https://github.com/rtCamp/nginx-helper/pull/152) - by [vincent-lu](https://github.com/vincent-lu)

### 1.9.11 ###
* Fixed issue where permalinks without trailing slash does not purging [#124](https://github.com/rtCamp/nginx-helper/issues/124) - by Patrick
* Check whether role exist or not before removing capability. [#134](https://github.com/rtCamp/nginx-helper/pull/134) - by [1gor](https://github.com/1gor)
@@ -349,6 +367,5 @@ Fix url escaping [#82](https://github.com/rtCamp/nginx-helper/pull/82) - by

## Upgrade Notice ##

### 1.9.11 ###
* Fixed issue where permalinks without trailing slash does not purging [#124](https://github.com/rtCamp/nginx-helper/issues/124) - by Patrick
* Check whether role exist or not before removing capability. [#134](https://github.com/rtCamp/nginx-helper/pull/134) - by [1gor](https://github.com/1gor)
### 1.9.12 ###
* Allow override Redis host/port/prefix by defining constant in wp-config.php [#152](https://github.com/rtCamp/nginx-helper/pull/152) - by [vincent-lu](https://github.com/vincent-lu)
@@ -24,7 +24,7 @@ class FastCGI_Purger extends Purger {
* @param string $url URL.
* @param bool $feed Weather it is feed or not.
*/
public function purgeUrl( $url, $feed = true ) {
public function purge_url( $url, $feed = true ) {
global $nginx_helper_admin;
@@ -49,16 +49,17 @@ public function purgeUrl( $url, $feed = true ) {
$this->_delete_cache_file_for( $_url_purge );
if ( $feed ) {
$feed_url = rtrim( $_url_purge_base, '/' ) . '/feed/';
$this->_delete_cache_file_for( $feed_url );
$this->_delete_cache_file_for( $feed_url . 'atom/' );
$this->_delete_cache_file_for( $feed_url . 'rdf/' );
}
break;
case 'get_request':
// Go to default case
// Go to default case.
default:
$_url_purge_base = $parse['scheme'] . '://' . $parse['host'] . '/purge' . $parse['path'];
$_url_purge = $_url_purge_base;
@@ -86,7 +87,7 @@ public function purgeUrl( $url, $feed = true ) {
/**
* Function to custom purge urls.
*/
public function customPurgeUrls() {
public function custom_purge_urls() {
global $nginx_helper_admin;
@@ -95,7 +96,7 @@ public function customPurgeUrls() {
$purge_urls = isset( $nginx_helper_admin->options['purge_url'] ) && ! empty( $nginx_helper_admin->options['purge_url'] ) ?
explode( "\r\n", $nginx_helper_admin->options['purge_url'] ) : array();
// Allow plugins/themes to modify/extend urls. Pass urls array in first parameter, second says if wildcards are allowed
// Allow plugins/themes to modify/extend urls. Pass urls array in first parameter, second says if wildcards are allowed.
$purge_urls = apply_filters( 'rt_nginx_helper_purge_urls', $purge_urls, false );
switch ( $nginx_helper_admin->options['purge_method'] ) {
@@ -123,8 +124,7 @@ public function customPurgeUrls() {
break;
case 'get_request':
// Go to default case
// Go to default case.
default:
$_url_purge_base = $parse['scheme'] . '://' . $parse['host'] . '/purge';
@@ -154,9 +154,9 @@ public function customPurgeUrls() {
/**
* Purge everything.
*/
public function purgeAll() {
public function purge_all() {
$this->unlinkRecursive( RT_WP_NGINX_HELPER_CACHE_PATH, false );
$this->unlink_recursive( RT_WP_NGINX_HELPER_CACHE_PATH, false );
$this->log( '* * * * *' );
$this->log( '* Purged Everything!' );
$this->log( '* * * * *' );

0 comments on commit cfccc36

Please sign in to comment.
You can’t perform that action at this time.