rtCamp / nginx-helper

Nginx Helper for WordPress caching, permalinks & efficient file handling in multisite
https://wordpress.org/plugins/nginx-helper/
228 stars 121 forks source link

Purge Entire Cache action uses wrong purge method #323

Open akansc opened 8 months ago

akansc commented 8 months ago

The module seems to have 2 purge modes: image

The GET PURGE/url method works fine when saving single posts and whatnot, however, the the "Purge Entire Cache" seem to execute the unlink_recursive function which of course fails on a shared hosting server due to insufficient permissions.

Allowing shared hosting users to reach and manipulate the global fcgi cache is not an option and would be considered as a security issue.

The PURGE/* wildcard is supported since the 2.4 that was released in 2016, that would still work with all your nginx examples: https://github.com/nginx-modules/ngx_cache_purge/releases

qcybb commented 5 months ago

@gagan0123

I was disappointed to see this wasn't included in the latest update. I'm also effected by the issue above.

Are there any plans to add the PURGE/* now this it's supported?

https://github.com/nginx-modules/ngx_cache_purge/releases/tag/2.4

JoAllg commented 3 months ago

I am currently testing fastcgi cache and nginx helper and noticed the same issue. Purging Entire Cache does not work for our isolated users. Since we use the /PURGE/ URL, @akansc 's suggestion would work for us as well

JoAllg commented 3 months ago

That seems to be an old known issue. https://github.com/rtCamp/nginx-helper/pull/306

gridpane commented 3 months ago

Working on this too, pulled other fork

Wrote this 6 years ago, other fork is bringing into nginx helper

https://github.com/JeffCleverley/NginxFastCGICachePurger

The curl functions require 5.5+ and nginx helper is set for 5.4 + compatibility, so im going to take the above fork and add a php guard...

Im also adding socket and other connection option supports.

gridpane commented 3 months ago

I have completed work on a fork here:

https://github.com/gridpane/nginx-helper

Settings can be configured by wp-admin or using constants

I have put in a guard to check for PHP version, since the curl option required is only available in 5.5+ and plugin is set to allow older versions...

Pulled in work from my old plugin and the pull above: https://github.com/rtCamp/nginx-helper/pull/306

Screenshot 2024-06-29 at 22 26 31 Screenshot 2024-06-29 at 22 27 11

Going to complete testing on our platform and will make PR.

gridpane commented 3 months ago

https://github.com/rtCamp/nginx-helper/pull/344

qcybb commented 3 months ago

Thank you, I hope this gets added in soon.

JoAllg commented 3 months ago

I appreciate it as well @gridpane