diff --git a/.github/workflows/create.yml b/.github/workflows/create.yml index cd1263fd..55d7f937 100644 --- a/.github/workflows/create.yml +++ b/.github/workflows/create.yml @@ -15,5 +15,5 @@ jobs: EXCLUDE_LIST: .gitattributes .gitignore .travis.yml README.md deploy.sh readme.sh tests map.conf nginx.log wercker.yml vendor SLUG: nginx-helper - WORDPRESS_PASSWORD: ${{ secrets.WORDPRESS_PASSWORD }} - WORDPRESS_USERNAME: ${{ secrets.WORDPRESS_USERNAME }} + WORDPRESS_PASSWORD: ${{ secrets.SVN_PASSWORD }} + WORDPRESS_USERNAME: ${{ secrets.SVN_USERNAME }} diff --git a/.github/workflows/e2e-test.yml b/.github/workflows/e2e-test.yml index 765f7a7a..4e114c5f 100644 --- a/.github/workflows/e2e-test.yml +++ b/.github/workflows/e2e-test.yml @@ -5,15 +5,15 @@ name: End-to-End Tests # Controls when the workflow will run on: # Triggers the workflow on push or pull request events but only for the main branch - push: - branches: - - develop - - master +# push: +# branches: +# - develop +# - master - pull_request: - branches: - - develop - - master +# pull_request: +# branches: +# - develop +# - master # Allows you to run this workflow manually from the Actions tab workflow_dispatch: @@ -52,7 +52,7 @@ jobs: - name: Archive HTML Report on failure if: failure() - uses: actions/upload-artifact@v1 + uses: actions/upload-artifact@v4 with: name: report path: ./tests/e2e-playwright/config diff --git a/README.md b/README.md index cc9ba903..3498e6af 100644 --- a/README.md +++ b/README.md @@ -1,21 +1,20 @@ # Nginx Helper # [![Project Status: Active – The project has reached a stable, usable state and is being actively developed.](https://www.repostatus.org/badges/latest/active.svg)](https://www.repostatus.org/#active) -**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, iam404, rittesh.patel, vishalkakadiya, BhargavBhandari90, vincent-lu, murrayjbrown, bryant1410, 1gor, matt-h, pySilver, johan-chassaing, dotsam, sanketio, petenelson, nathanielks, rigagoogoo, dslatten, jinschoi, kelin1003, vaishuagola27, rahulsprajapati, Joel-James, utkarshpatel, gsayed786, shashwatmittal, sudhiryadav, thrijith, stayallive, jaredwsmith, abhijitrakas, umeshnevase, sid177, souptik, arafatkn, subscriptiongroup, akrocks, gnif, jeffcleverley(GridPane) +**Contributors:** jeffcleverley(GridPane), 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, iam404, rittesh.patel, vishalkakadiya, BhargavBhandari90, vincent-lu, murrayjbrown, bryant1410, 1gor, matt-h, pySilver, johan-chassaing, dotsam, sanketio, petenelson, nathanielks, rigagoogoo, dslatten, jinschoi, kelin1003, vaishuagola27, rahulsprajapati, Joel-James, utkarshpatel, gsayed786, shashwatmittal, sudhiryadav, thrijith, stayallive, jaredwsmith, abhijitrakas, umeshnevase, sid177, souptik, arafatkn, subscriptiongroup, akrocks, gnif, jeffcleverley(GridPane) -**Tags:** nginx, cache, purge, nginx map, nginx cache, maps, fastcgi, proxy, redis, redis-cache, rewrite, permalinks +**Tags:** nginx, cache-purge, fastcgi, permalinks, redis-cache **Requires at least:** 3.0 -**Tested up to:** 6.1 +**Tested up to:** 6.7 -**Stable tag:** 2.2.5 +**Stable tag:** 9.9.10 **License:** GPLv2 or later (of-course) **License URI:** http://www.gnu.org/licenses/gpl-2.0.html -**Donate Link:** http://rt.cx/eedonate Cleans nginx's fastcgi/proxy cache or redis-cache whenever a post is edited/published. Also does a few more things. @@ -26,15 +25,6 @@ Cleans nginx's fastcgi/proxy cache or redis-cache whenever a post is edited/publ 1. Adds support for nginx fastcgi_cache_purge & proxy_cache_purge directive from [module](https://github.com/FRiCKLE/ngx_cache_purge "ngx_cache_purge module"). Provides settings so you can customize purging rules. 1. Adds support for nginx `map{..}` on a WordPress-multisite network installation. Using it, Nginx can serve PHP file uploads even if PHP/MySQL crashes. Please check the tutorial list below for related Nginx configurations. -### Tutorials ### - -You will need to follow one or more tutorials below to get desired functionality: - -* [Nginx Map + WordPress-Multisite + Static Files Handling](https://easyengine.io/wordpress-nginx/tutorials/multisite/static-files-handling/) -* [Nginx + WordPress + fastcgi_purge_cache](https://easyengine.io/wordpress-nginx/tutorials/single-site/fastcgi-cache-with-purging/) -* [Nginx + WordPress-Multisite (Subdirectories) + fastcgi_purge_cache](https://easyengine.io/wordpress-nginx/tutorials/multisite/subdirectories/fastcgi-cache-with-purging/) -* [Nginx + WordPress-Multisite (Subdomains/domain-mapping) + fastcgi_purge_cache](https://easyengine.io/wordpress-nginx/tutorials/multisite/subdomains/fastcgi-cache-with-purging/) -* [Other WordPress-Nginx Tutorials](https://easyengine.io/wordpress-nginx/tutorials/) ## Installation ## @@ -49,17 +39,13 @@ Manual Installation 1. Upload them to `/wp-content/plugins/` directory on your WordPress installation. 1. Then activate the Plugin from Plugins page. -For proper configuration, check out our **tutorial list** in the [Description tab](http://wordpress.org/extend/plugins/nginx-helper). - ## Frequently Asked Questions ## -**Important** - Please refer to [https://github.com/rtcamp/nginx-helper#frequently-asked-questions](https://github.com/rtcamp/nginx-helper#frequently-asked-questions) for up-to-date FAQs. - ### FAQ - Installation/Comptability ### **Q. Will this work out of the box?** -No. You need to make some changes at the Nginx end. Please check our [tutorial list](https://easyengine.io/wordpress-nginx/tutorials/). +No. You need to make some changes at the Nginx end. **Q. Can I set the cache type using wp-config.php constants** @@ -187,408 +173,66 @@ define( 'RT_WP_NGINX_HELPER_REDIS_USERNAME', 'user' ); define( 'RT_WP_NGINX_HELPER_REDIS_PASSWORD', 'password' ); ``` -### FAQ - Nginx Map ### - -**Q. My multisite already uses `WPMU_ACCEL_REDIRECT`. Do I still need Nginx Map?** - -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. - -**Q. I am using X plugin. Will it work on Nginx?** - -Most likely yes. A wordpress plugin, if not using explicitly any Apache-only mod, should work on Nginx. Some plugin may need some extra work. - -### Still need help! ### - -Please post your problem in [our free support forum](https://github.com/rtCamp/nginx-helper/issues). - -## Screenshots ## - -### 1. Nginx plugin settings ### - -![Nginx plugin settings](https://ps.w.org/nginx-helper/assets/screenshot-1.png) - -### 2. Remaining settings ### - -![Remaining settings](https://ps.w.org/nginx-helper/assets/screenshot-2.png) - -## Changelog ## - -### 2.2.6 ### - -* Added Fastcgi purge all capability using GET requests IF Torden ngx_cache_purge module is available. [#323](https://github.com/rtCamp/nginx-helper/issues/323) - by [Geoffrey McRae - gnif](https://github.com/gnif) and [GridPane - Jeff Cleverley](https://github.com/gridpane) -* Added Redis Unix Socket connections. [325](https://github.com/rtCamp/nginx-helper/issues/325) - by [GridPane - Jeff Cleverley](https://github.com/gridpane) -* Added Redis DB selection. [343](https://github.com/rtCamp/nginx-helper/issues/343) - by [GridPane - Jeff Cleverley](https://github.com/gridpane) -* Added Redis ACL. [343](https://github.com/rtCamp/nginx-helper/issues/343) - by [GridPane - Jeff Cleverley](https://github.com/gridpane) -* Added Management of all FastCGI and Redis Connection Parameters by wp-config.php constants. [343](https://github.com/rtCamp/nginx-helper/issues/343) - by [GridPane - Jeff Cleverley](https://github.com/gridpane) - -### 2.2.5 ### - -* Add the capability to enable/disable purging of feeds. [#281](https://github.com/rtCamp/nginx-helper/issues/281) - by [Amaan Khan](https://github.com/pathan-amaankhan) -* Fix undefined port error when Redis port is set to empty string. [#333](https://github.com/rtCamp/nginx-helper/issues/333) - by [Amaan Khan](https://github.com/pathan-amaankhan) - -### 2.2.4 ### - -* Introduces the capability to specify the `NGINX_HELPER_LOG` constant, allowing users to activate the logging feature. [#318](https://github.com/rtCamp/nginx-helper/pull/318) - by [Vishal Kakadiya](https://github.com/vishalkakadiya) -* Existing users employing the nginx-helper plugin with logging enabled will experience no disruptions. However, if logging is disabled, users must define the `NGINX_HELPER_LOG` constant to re-enable the logging feature. - -### 2.2.3 ### - -* Add the URL being purged as parameter in `rt_nginx_helper_purge_cached_file` hook. [#271](https://github.com/rtCamp/nginx-helper/pull/271) - by [Arafat Islam](https://github.com/arafatkn) -* Fix performance issue when saving nav menus. [#112](https://github.com/rtCamp/nginx-helper/issues/112), [#272](https://github.com/rtCamp/nginx-helper/pull/272/) - by [Arafat Islam](https://github.com/arafatkn) -* Fix purging date archives for custom post types. [#40](https://github.com/rtCamp/nginx-helper/issues/40), [#268](https://github.com/rtCamp/nginx-helper/pull/268) - by [Arafat Islam](https://github.com/arafatkn) -* Fix pages and CPT URLs not being purged on moving to trash. [#191](https://github.com/rtCamp/nginx-helper/issues/191), [#267](https://github.com/rtCamp/nginx-helper/pull/267) - by [Arafat Islam](https://github.com/arafatkn) -* Fix notice - Undefined index: path [#190](https://github.com/rtCamp/nginx-helper/issues/190), [#251](https://github.com/rtCamp/nginx-helper/issues/251), [#262](https://github.com/rtCamp/nginx-helper/pull/262) - by [George Lagonikas](https://github.com/glagonikas) -* PHP 8.1 compatibility [#291](https://github.com/rtCamp/nginx-helper/issues/291), [#302](https://github.com/rtCamp/nginx-helper/pull/302) - by [Siddharth Tikekar](https://github.com/SID177) -* Tested with WordPress 6.1 [#285](https://github.com/rtCamp/nginx-helper/pull/285) - -### 2.2.2 ### - -* Add action `rt_nginx_helper_after_purge_all` to fire after the entire cache has been purged whatever caching type is used. [#232](https://github.com/rtCamp/nginx-helper/pull/232) - by [Julien-prrs](https://github.com/Julien-prrs) -* Fix issue where settings not saved because the button's value localized (for any language). [#236](https://github.com/rtCamp/nginx-helper/pull/236) - by [umeshnevase](https://github.com/umeshnevase) -* Fix issue where "Custom Purge URL" option displays previous value. [#240](https://github.com/rtCamp/nginx-helper/issues/240), [#241](https://github.com/rtCamp/nginx-helper/pull/241) - by [KirillGritcenko](https://github.com/KirillGritcenko) -* Tested with WordPress 5.4 - -### 2.2.1 ### - -* Fix timeout issue on FastCGI cache purge. [#229](https://github.com/rtCamp/nginx-helper/pull/229) - by [chandrapatel](https://github.com/chandrapatel), [thrijith](https://github.com/thrijith) - -### 2.2.0 ### - -* Add filter `rt_nginx_helper_fastcgi_purge_suffix` to change purge suffix for FastCGI cache. [#141](https://github.com/rtCamp/nginx-helper/pull/141) - by [stayallive](https://github.com/stayallive) -* Add filter `rt_nginx_helper_fastcgi_purge_url_base` to change purge URL base for FastCGI cache. [#141](https://github.com/rtCamp/nginx-helper/pull/141) - by [stayallive](https://github.com/stayallive) -* Update our code to be in line with WordPress Coding standards in various places. [#209](https://github.com/rtCamp/nginx-helper/pull/209), [#225](https://github.com/rtCamp/nginx-helper/pull/225) - by [abhijitrakas](https://github.com/abhijitrakas), [chandrapatel](https://github.com/chandrapatel) -* Check and verify purging is enabled before purging cache. [#168](https://github.com/rtCamp/nginx-helper/pull/168) - by [jaredwsmith](https://github.com/jaredwsmith) -* Hide Purge Cache button in admin bar when purge is disabled. [#218](https://github.com/rtCamp/nginx-helper/issues/218), [#219](https://github.com/rtCamp/nginx-helper/pull/219) - by [mbautista](https://github.com/mbautista), [chandrapatel](https://github.com/chandrapatel) -* Don't add Nginx Timestamp on WordPress login page. [#204](https://github.com/rtCamp/nginx-helper/issues/204), [#220](https://github.com/rtCamp/nginx-helper/pull/220) - by [peixotorms](https://github.com/peixotorms), [chandrapatel](https://github.com/chandrapatel) - -### 2.1.0 ### - -* Add wildcard cache key deletion for device type cache purge. [#203](https://github.com/rtCamp/nginx-helper/pull/203) - by [pradeep910](https://github.com/pradeep910) -* Add filter `rt_nginx_helper_purge_url` to filter the URL to be purged. [#182](https://github.com/rtCamp/nginx-helper/pull/182) - by [todeveni](https://github.com/todeveni) -* Add filter `rt_nginx_helper_purge_cached_file` to filter the cached file name. [#182](https://github.com/rtCamp/nginx-helper/pull/182) - by [todeveni](https://github.com/todeveni) -* Add filter `rt_nginx_helper_remote_purge_url` to filter remote URL to be purged. [#182](https://github.com/rtCamp/nginx-helper/pull/182) - by [todeveni](https://github.com/todeveni) -* Add action `rt_nginx_helper_after_fastcgi_purge_all` to fire after the FastCGI cache has been purged. [#182](https://github.com/rtCamp/nginx-helper/pull/182) - by [todeveni](https://github.com/todeveni) -* Add action `rt_nginx_helper_after_redis_purge_all` to fire after the Redis cache has been purged. [#182](https://github.com/rtCamp/nginx-helper/pull/182) - by [todeveni](https://github.com/todeveni) -* Add action `rt_nginx_helper_purged_file` to fire an action after deleting file from cache. [#182](https://github.com/rtCamp/nginx-helper/pull/182) - by [todeveni](https://github.com/todeveni) -* Add action `rt_nginx_helper_before_remote_purge_url` to fire an action before purging remote URL. [#182](https://github.com/rtCamp/nginx-helper/pull/182) - by [todeveni](https://github.com/todeveni) -* Add action `rt_nginx_helper_after_remote_purge_url` to fire an action after remote purge request. [#182](https://github.com/rtCamp/nginx-helper/pull/182) - by [todeveni](https://github.com/todeveni) -* Fix issue with post purge on new comments. [#175](https://github.com/rtCamp/nginx-helper/pull/175) - by [jinschoi](https://github.com/jinschoi) -* Fix Nginx Timestamp being added to invalid content type. [#200](https://github.com/rtCamp/nginx-helper/pull/200) - by [thrijith](https://github.com/thrijith) -* Handle filesize exception while truncating nginx.log file. [#206](https://github.com/rtCamp/nginx-helper/pull/206) - by [peterjanes](https://github.com/peterjanes) - -### 2.0.3 ### - -* Update article link for fastcgi cache purge. [#187](https://github.com/rtCamp/nginx-helper/pull/187) - by [gagan0123](https://github.com/gagan0123) -* Fix map generation issue on `SUBDOMAIN_INSTALL`. [#189](https://github.com/rtCamp/nginx-helper/pull/189) - by [ChrisHardie](https://github.com/ChrisHardie) -* Add GitHub Action for plugin release. [#194](https://github.com/rtCamp/nginx-helper/pull/194) - by [sudhir-yadav](https://github.com/sudhir-yadav) - -### 2.0.2 ### - -* Fix undefined error when we install the plugin for the first time and if Redis is not available. [#162](https://github.com/rtCamp/nginx-helper/pull/162) - by [Joel-James](https://github.com/Joel-James) -* Remove extra spacing for nginx map section. [#169](https://github.com/rtCamp/nginx-helper/pull/169) - by [ShashwatMittal](https://github.com/ShashwatMittal) -* Purge Cache menu in front-end admibar now purge current page. [#173](https://github.com/rtCamp/nginx-helper/pull/173) - by [imranhsayed](https://github.com/imranhsayed) -* Fix issue where cache is not cleared when page is swiched from publish to draft. [#174](https://github.com/rtCamp/nginx-helper/pull/174) - by [imranhsayed](https://github.com/imranhsayed) -* Fix an issue where custom purge url option does not show newlines when using multiple urls. [#184](https://github.com/rtCamp/nginx-helper/issues/184) - by [mist-webit](https://github.com/mist-webit) - -### 2.0.1 ### - -* Fix settings url for multisite: use network_admin_url to get network correct settings url. [#163](https://github.com/rtCamp/nginx-helper/pull/163) - by [Joel-James](https://github.com/Joel-James) -* Fix php error with arbitrary statement in empty - Prior to PHP 5.5. [#165](https://github.com/rtCamp/nginx-helper/pull/165) - by [PatelUtkarsh](https://github.com/PatelUtkarsh) - -### 2.0.0 ### - -* Fix typo causing failure to purge on trashed comment. [#159](https://github.com/rtCamp/nginx-helper/pull/159) - by [jinschoi](https://github.com/jinschoi) -* Refactor Plugin structure and remove unused code. Initial code by [chandrapatel](https://github.com/chandrapatel), [#153](https://github.com/rtCamp/nginx-helper/pull/153) - by [kelin1003](https://github.com/kelin1003), -* Run phpcs and fix warning. [#158](https://github.com/rtCamp/nginx-helper/pull/158) by [vaishaliagola27](https://github.com/vaishaliagola27) -* Make compatible with EasyEngine v4. - -### 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) - -### 1.9.10 ### - -* 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) -* 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) - -### 1.9.9 ### - -* Fix wp_redirect issue. [#131](https://github.com/rtCamp/nginx-helper/pull/131) - by [matt-h](https://github.com/matt-h) - -### 1.9.8 ### - -* Fixed homepage cache cleared when WPML plugin used [#116](https://github.com/rtCamp/nginx-helper/pull/116) - by [Niwreg](https://profiles.wordpress.org/niwreg/) -* Fixed Purge Cache clears the whole Redis cache [#113](https://github.com/rtCamp/nginx-helper/issues/113) - by HansVanEijsden -* One log file for all site in WPMU. -* Single site Redis cache purge when click on Purge Cache button in WPMU [#122](https://github.com/rtCamp/nginx-helper/pull/122) - by Lars Støttrup Nielsen -* Fixed notices and warnings. - -### 1.9.7 ### - -* Remove timestamp if cron or wp-cli [#114](https://github.com/rtCamp/nginx-helper/pull/114) - by [samedwards](https://profiles.wordpress.org/samedwards/) -* Fixed notices and warnings. - -### 1.9.6 ### - -* Fixed cache purging on post publish. -* Error fixed when redis server not installed. - -### 1.9.5 ### - -Added custom purge URL option. - -### 1.9.4 ### - -* Added redis server connection timeout. -* Added RedisException handling. - -### 1.9.3 ### - -* Added PhpRedis API support. -* Added redis-lua script support to purge complete cache very fast. -* Added composer.json support -* Fixed cache purging link in admin bar. -* Updated the initial settings to include the 'purge_method' [#99](https://github.com/rtCamp/nginx-helper/pull/99) - by -[gagan0123](https://github.com/gagan0123) - -### 1.9.2 ### - -Fix purging for Redis cache and FastCGI cache - -### 1.9.1 ### - -Fix purging for custom post types - -### 1.9 ### - -Added Redis cache purge support. - -### 1.8.13 ### - -Fixed PHP notice for an undefined index when "Enable Logging" is not set. - -### 1.8.12 ### - -Updated readme and changelog - -### 1.8.11 ### - -Fix url escaping [#82](https://github.com/rtCamp/nginx-helper/pull/82) - by -[javisperez](https://github.com/javisperez) - -### 1.8.10 ### +**Q. Can I override the redis socket path, username, password?** -* Security bug fix +Yes, you can force override the redis socket path, username, password by defining constant in wp-config.php. For example: -### 1.8.9 ### - -* Default setting fix and wp-cli example correction - by [bcole808](https://profiles.wordpress.org/bcole808/) - -### 1.8.8 ### - -* Added option to purge cache without nginx purge module - by [bcole808](https://profiles.wordpress.org/bcole808/) - -### 1.8.7 ### - -* Added action `rt_nginx_helper_purge_all` to purge cache from other plugins - by [gungeekatx](https://profiles.wordpress.org/gungeekatx/) - -### 1.8.6 ### - -* Removed wercker.yml from plugin zip/svn. -* Updated readme - -### 1.8.5 ### - -* Added WP_CLI support - by [Udit Desai](https://profiles.wordpress.org/desaiuditd/) - -### 1.8.4 ### - -* Fix undefined index issue and correct "purge_archive_on_del" key - -### 1.8.3 ### - -* Tested with WordPress 4.0 -* Fix issue #69 - -### 1.8.1 ### - -* Tested with wordpress 3.9.1 -* Fix confilct with Mailchimp's Social plugin - -### 1.8 ### - -* New admin UI -* Fix missing wp_sanitize_redirect function call - -### 1.7.6 ### - -* Update Backend UI -* Added Language Support - -### 1.7.5 ### - -* Fixed option name mismatch issue to purge homepage on delete. - -### 1.7.4 ### - -* Disable purge and stamp by default. - -### 1.7.3 ### - -* Suppressed `unlink` related error-messages which can be safely ignored. -* Fixed a bug in purge-all option. - -### 1.7.2 ### - -* [pjv](http://profiles.wordpress.org/pjv/) fixed bug in logging file. - -### 1.7.1 ### - -* Fixes bug in true purge and admin screen. - -### 1.7 ### - -* True full cache purge added. -* Map file location changed to uploads' directory to fix http://rtcamp.com/support/topic/plugin-update-removes-map-file/ -* Log file location also changed to uploads' directory. - -### 1.6.13 ### - -* [pjv](http://profiles.wordpress.org/pjv/) changed the way home URL is accessed. Instead of site option, the plugin now uses home_URL() function. - -### 1.6.12 ### - -* [telofy](http://wordpress.org/support/profile/telofy) added purging of atom and RDF feeds. - -### 1.6.11 ### - -* Removed comments from Admin screens since, it was interfering with media uploads in 3.5 up. - -### 1.6.10 ### - -* Cleaned up code. -* Added credits for code. -* Improved attachment purging. - -### 1.6.9 ### - -* Added Faux to Purge all buttons, to avoid misleading users. - -### 1.6.8 ### - -* [daankortenbach](http://profiles.wordpress.org/daankortenbach) added Purge Cache link to wp-admin bar - -### 1.6.7 ### - -* [jk3us](http://profiles.wordpress.org/jk3us) added better content-type detection for cache verification comments - -### 1.6.6 ### - -* [darren-slatten](http://profiles.wordpress.org/darren-slatten/) added Manual 'Purge all URLs' functionality - -### 1.6.5 ### - -* Fixed typo that interfered with archive purge settings. Thanks to [Daan Kortenbach](http://profiles.wordpress.org/daankortenbach/) for pointing this out. - -### 1.6.4 ### - -* Improved code for map generation to better conventions since the nesting confused some servers. -* Added map update process to admin_init for frequent refreshes. - -### 1.6.3 ### - -* Fixed duplicate entries. - -### 1.6.2 ### - -* Another bug fix in the revised code for improved multisite and multidomain mapping. - -### 1.6.1 ### - -* Fixed bug in the revised code for improved multisite and multidomain mapping. - -### 1.6 ### - -* Revised code for improved multisite and multidomain mapping. - -### 1.5 ### - -* Timestamp now only gets added to content-type text/html -* Added option to toggle timestamp creation - -### 1.4 ### - -* Fixed bug related to nomenclature of comment status that caused purge to fail. - -### 1.3.9 ### - -* Removed extraneous headers. - -### 1.3.8 ### - -* Fixed bug in single post/page/post-type purging code. Thanks to Greg for pointing this out here: http://rtcamp.com/support/topic/updating-post-nginx-helper-purge-cache-post/. - -### 1.3.7 ### - -* Changed the action hook, back to 'shutdown' from 'wp_footer' to add verification comments. -* Added a check to prevent adding comments to ajax requests, - -### 1.3.6 ### +```php +define( 'RT_WP_NGINX_HELPER_REDIS_UNIX_SOCKET', '/var/run/redis/redis.sock' ); -* Changed the action hook, from 'shutdown' to 'wp_footer' to add verification comments. This was interfering with other plugins. +define( 'RT_WP_NGINX_HELPER_REDIS_USERNAME', 'admin' ); -### 1.3.5 ### +define( 'RT_WP_NGINX_HELPER_REDIS_PASSWORD', 'admin' ); +``` -* Improved Readme. -* Improved cache verification comments. +### FAQ - Nginx Map ### -### 1.3.4 ### +**Q. My multisite already uses `WPMU_ACCEL_REDIRECT`. Do I still need Nginx Map?** -* 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/wordpress-nginx/tutorials/checklist/ +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. -### 1.3.3 ### +**Q. I am using X plugin. Will it work on Nginx?** -* Fixed map generation for multi domain installs using domain mapping plugin, where blog ids were not displayed. +Most likely yes. A wordpress plugin, if not using explicitly any Apache-only mod, should work on Nginx. Some plugin may need some extra work. -### 1.3.2 ### -* Fixed map generation for multi domain installs with domain mapping plugin. +### FAQ - WP-CLI ### -### 1.3.1 ### +**Q. How can I update the options using WP-CLI?** -* Minor fixes for directory structure and file names. +```shell +wp option patch update rt_wp_nginx_helper_options +``` -### 1.3 ### -* Improved Readme. +### Still need help! ### -### 1.2 ### +Please post your problem in the github issues. -* Fixed map generation error. -* Fixed purging logic. -* Fixed UI where purge settings were lost on disabling and re-enabling purge. -* Minor Ui rearrangement. +## Screenshots ## -### 1.1 ### +### 1. Nginx plugin settings ### -* Improved readme.txt. Added Screenshots. +### 2. Remaining settings ### -### 1.0 ### +## Changelog ## -* First release +### 9.9.10 ### -## Upgrade Notice ## +Pulled in rtCamp fixes from their version - 2.3.0 and 2.3.1 -### 2.2.3 ### +* Update the contributors list and tags for the plugin. [#378](https://github.com/rtCamp/nginx-helper/issues/378) - by [Vedant Gandhi](https://github.com/Vedant-Gandhi) +* Disable the purge functionality when importing data. [#52](https://github.com/rtCamp/nginx-helper/pull/52) - by [Vedant Gandhi](https://github.com/Vedant-Gandhi) +* Added option to preload cache for all Post and Pages. [#47](https://github.com/rtCamp/nginx-helper/pull/47) - by [Vedant Gandhi](https://github.com/Vedant-Gandhi) +* Added the capability to purge Amp URL's. [#135](https://github.com/rtCamp/nginx-helper/pull/135) - by [Vedant Gandhi](https://github.com/Vedant-Gandhi) +* Add capability to allow modifying options using WP-CLI. [#307](https://github.com/rtCamp/nginx-helper/pull/307) - by [Vedant Gandhi](https://github.com/Vedant-Gandhi) +* Fix the plugin crash issue due to internationalization after upgrading to WordPress Version 6.7. [#364](https://github.com/rtCamp/nginx-helper/pull/364) - by [Vedant Gandhi](https://github.com/Vedant-Gandhi) -Nginx Helper 2.2.3, Fix performance issue when saving nav menus, purging date archives for CPTs, purge page and post URLs when the post is trashed and passes the URL being purged in "rt_nginx_helper_purge_cached_file" hook as parameter. -## Does this interest you? ## +### 9.9.9 ### -Join us at rtCamp, we specialize in providing high performance enterprise WordPress solutions +* Add support for adding Username, Password support for Redis. It also includes the support for Unix Socket Path for Redis along with Database selection - by [Jeff Cleverley](https://github.com/gridpane) +* Added exclude filters for cache purging of home page - by [Jeff Cleverley](https://github.com/gridpane) +* Added Ability to configure all options by Constants - by [Jeff Cleverley](https://github.com/gridpane) +* Added Ability to purge fastcgi cache purge using the Torden Module - by [Jeff Cleverley](https://github.com/gridpane) +* All Previous rtCamp Nginx-Helper code up to 2.5.0 \ No newline at end of file diff --git a/admin/class-fastcgi-purger.php b/admin/class-fastcgi-purger.php index 108dbdcc..42fa9371 100644 --- a/admin/class-fastcgi-purger.php +++ b/admin/class-fastcgi-purger.php @@ -2,8 +2,8 @@ /** * The admin-specific functionality of the plugin. * - * @link https://rtcamp.com/nginx-helper/ - * @since 2.0.0 + * @link https://github.com/gridpane/nginx-helper/ + * @since 9.9.10 * * @package nginx-helper * @subpackage nginx-helper/admin @@ -14,7 +14,7 @@ * * @package nginx-helper * @subpackage nginx-helper/admin - * @author rtCamp + * @author GridPane */ class FastCGI_Purger extends Purger { @@ -31,7 +31,7 @@ public function purge_url( $url, $feed = true ) { /** * Filters the URL to be purged. * - * @since 2.1.0 + * @since 9.9.10 * * @param string $url URL to be purged. */ @@ -94,8 +94,29 @@ public function purge_url( $url, $feed = true ) { break; } + + if( ( is_page() || is_single() ) && $nginx_helper_admin->options['purge_amp_urls'] ) { + $this->purge_amp_version( $url ); + } } + + /** + * Purge AMP version of a URL. + * + * @param string $url_base The base URL to purge. + */ + private function purge_amp_version( $url_base ) { + $amp_url = sprintf( '%s/amp/', rtrim( $url_base, '/' ) ); + + $this->log( '- Purging AMP URL | ' . $amp_url ); + + if ( 'unlink_files' === $this->nginx_helper_admin->options['purge_method'] ) { + $this->delete_cache_file_for( $amp_url ); + } else { + $this->do_remote_get( $amp_url ); + } + } /** * Function to custom purge urls. @@ -228,7 +249,7 @@ public function purge_all() { /** * Fire an action after the FastCGI cache has been purged. * - * @since 2.1.0 + * @since 9.9.10 */ do_action( 'rt_nginx_helper_after_fastcgi_purge_all' ); } diff --git a/admin/class-nginx-helper-admin.php b/admin/class-nginx-helper-admin.php index 0dffdfd9..2d38d0a4 100644 --- a/admin/class-nginx-helper-admin.php +++ b/admin/class-nginx-helper-admin.php @@ -2,8 +2,8 @@ /** * The admin-specific functionality of the plugin. * - * @link https://rtcamp.com/nginx-helper/ - * @since 2.0.0 + * @link https://github.com/gridpane/nginx-helper/ + * @since 9.9.10 * * @package nginx-helper * @subpackage nginx-helper/admin @@ -17,67 +17,76 @@ * * @package nginx-helper * @subpackage nginx-helper/admin - * @author rtCamp + * @author GridPane */ class Nginx_Helper_Admin { - + /** * The ID of this plugin. * - * @since 2.0.0 + * @since 9.9.10 * @access private * @var string $plugin_name The ID of this plugin. */ private $plugin_name; - + /** * The version of this plugin. * - * @since 2.0.0 + * @since 9.9.10 * @access private * @var string $version The current version of this plugin. */ private $version; - + /** * Various settings tabs. * - * @since 2.0.0 + * @since 9.9.10 * @access private * @var string $settings_tabs Various settings tabs. */ private $settings_tabs; - + /** * Purge options. * - * @since 2.0.0 + * @since 9.9.10 * @access public * @var string[] $options Purge options. */ public $options; - + /** * WP-CLI Command. * - * @since 2.0.0 + * @since 9.9.10 * @access public * @var string $options WP-CLI Command. */ const WP_CLI_COMMAND = 'nginx-helper'; - + /** * Initialize the class and set its properties. * - * @since 2.0.0 + * @since 9.9.10 * @param string $plugin_name The name of this plugin. * @param string $version The version of this plugin. */ public function __construct( $plugin_name, $version ) { - + $this->plugin_name = $plugin_name; $this->version = $version; - + + $this->options = $this->nginx_helper_settings(); + } + + /** + * Initialize the settings tab. + * Required since i18n is used in the settings tab which can be invoked only after init hook since WordPress 6.7 + */ + public function initialize_setting_tab() { + /** * Define settings tabs */ @@ -94,20 +103,17 @@ public function __construct( $plugin_name, $version ) { ), ) ); - - $this->options = $this->nginx_helper_settings(); - } - + /** * Register the stylesheets for the admin area. * - * @since 2.0.0 + * @since 9.9.10 * * @param string $hook The current admin page. */ public function enqueue_styles( $hook ) { - + /** * This function is provided for demonstration purposes only. * @@ -119,25 +125,25 @@ public function enqueue_styles( $hook ) { * between the defined hooks and the functions defined in this * class. */ - + if ( 'settings_page_nginx' !== $hook ) { return; } - + wp_enqueue_style( $this->plugin_name . '-icons', plugin_dir_url( __FILE__ ) . 'icons/css/nginx-fontello.css', array(), $this->version, 'all' ); wp_enqueue_style( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'css/nginx-helper-admin.css', array(), $this->version, 'all' ); - + } - + /** * Register the JavaScript for the admin area. * - * @since 2.0.0 + * @since 9.9.10 * * @param string $hook The current admin page. */ public function enqueue_scripts( $hook ) { - + /** * This function is provided for demonstration purposes only. * @@ -149,29 +155,29 @@ public function enqueue_scripts( $hook ) { * between the defined hooks and the functions defined in this * class. */ - + if ( 'settings_page_nginx' !== $hook ) { return; } - + wp_enqueue_script( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'js/nginx-helper-admin.js', array( 'jquery' ), $this->version, false ); - + $do_localize = array( 'purge_confirm_string' => esc_html__( 'Purging entire cache is not recommended. Would you like to continue?', 'nginx-helper' ), ); wp_localize_script( $this->plugin_name, 'nginx_helper', $do_localize ); - + } - + /** * Add admin menu. * - * @since 2.0.0 + * @since 9.9.10 */ public function nginx_helper_admin_menu() { - + if ( is_multisite() ) { - + add_submenu_page( 'settings.php', __( 'Nginx Helper', 'nginx-helper' ), @@ -180,9 +186,9 @@ public function nginx_helper_admin_menu() { 'nginx', array( &$this, 'nginx_helper_setting_page' ) ); - + } else { - + add_submenu_page( 'options-general.php', __( 'Nginx Helper', 'nginx-helper' ), @@ -191,22 +197,22 @@ public function nginx_helper_admin_menu() { 'nginx', array( &$this, 'nginx_helper_setting_page' ) ); - + } - + } - + /** * Function to add toolbar purge link. * * @param object $wp_admin_bar Admin bar object. */ public function nginx_helper_toolbar_purge_link( $wp_admin_bar ) { - + if ( ! current_user_can( 'manage_options' ) ) { return; } - + if ( is_admin() ) { $nginx_helper_urls = 'all'; $link_title = __( 'Purge Cache', 'nginx-helper' ); @@ -214,16 +220,16 @@ public function nginx_helper_toolbar_purge_link( $wp_admin_bar ) { $nginx_helper_urls = 'current-url'; $link_title = __( 'Purge Current Page', 'nginx-helper' ); } - + $purge_url = add_query_arg( array( 'nginx_helper_action' => 'purge', 'nginx_helper_urls' => $nginx_helper_urls, ) ); - + $nonced_url = wp_nonce_url( $purge_url, 'nginx_helper-purge_all' ); - + $wp_admin_bar->add_menu( array( 'id' => 'nginx-helper-purge-all', @@ -232,28 +238,28 @@ public function nginx_helper_toolbar_purge_link( $wp_admin_bar ) { 'meta' => array( 'title' => $link_title ), ) ); - + } - + /** * Display settings. * * @global $string $pagenow Contain current admin page. * - * @since 2.0.0 + * @since 9.9.10 */ public function nginx_helper_setting_page() { include plugin_dir_path( __FILE__ ) . 'partials/nginx-helper-admin-display.php'; } - + /** * Default settings. * - * @since 2.0.0 + * @since 9.9.10 * @return array */ public function nginx_helper_default_settings() { - + return array( 'enable_purge' => 0, 'cache_method' => 'enable_fastcgi', @@ -281,6 +287,7 @@ public function nginx_helper_default_settings() { 'redis_password' => '', 'redis_database' => 0, 'purge_url' => '', + 'purge_amp_urls' => 1, 'auth_enabled_by_constant' => 0, 'cache_method_set_by_constant' => 0, 'purge_method_set_by_constant' => 0, @@ -292,26 +299,51 @@ public function nginx_helper_default_settings() { 'redis_username_set_by_constant' => 0, 'redis_password_socket_set_by_constant' => 0, 'homepage_purge_post_type_exceptions' => array(), + 'preload_cache' => 0, + 'is_cache_preloaded' => 0 ); - + } + + public function store_default_options() { + $options = get_site_option( 'rt_wp_nginx_helper_options', array() ); + $default_settings = $this->nginx_helper_default_settings(); + + $removable_default_settings = array( + 'redis_port', + 'redis_prefix', + 'redis_hostname', + 'redis_database', + 'redis_unix_socket' + ); + + // Remove all the keys that are not to be stored by default. + foreach ( $removable_default_settings as $removable_key ) { + unset( $default_settings[ $removable_key ] ); + } + + $diffed_options = wp_parse_args( $options, $default_settings ); + + add_site_option( 'rt_wp_nginx_helper_options', $diffed_options ); + } /** * Get settings. * - * @since 2.0.0 + * @since 9.9.10 */ public function nginx_helper_settings() { - + $options = get_site_option( 'rt_wp_nginx_helper_options', array( 'redis_hostname' => '127.0.0.1', 'redis_port' => '6379', 'redis_prefix' => 'nginx-cache:', + 'redis_database' => 0, ) ); - + $data = wp_parse_args( $options, $this->nginx_helper_default_settings() @@ -396,9 +428,9 @@ public function nginx_helper_settings() { } return $data; - + } - + /** * Nginx helper setting link function. * @@ -407,20 +439,20 @@ public function nginx_helper_settings() { * @return mixed */ public function nginx_helper_settings_link( $links ) { - + if ( is_network_admin() ) { $setting_page = 'settings.php'; } else { $setting_page = 'options-general.php'; } - + $settings_link = '' . __( 'Settings', 'nginx-helper' ) . ''; array_unshift( $links, $settings_link ); - + return $links; - + } - + /** * Check if the nginx log is enabled. * @@ -428,117 +460,63 @@ public function nginx_helper_settings_link( $links ) { * @return boolean */ public function is_nginx_log_enabled() { - + $options = get_site_option( 'rt_wp_nginx_helper_options', array() ); - + if ( ! empty( $options['enable_log'] ) && 1 === (int) $options['enable_log'] ) { return true; } - + if ( defined( 'NGINX_HELPER_LOG' ) && true === NGINX_HELPER_LOG ) { return true; } - + return false; } - + /** * Retrieve the asset path. * - * @since 2.0.0 + * @since 9.9.10 * @return string asset path of the plugin. */ public function functional_asset_path() { - + $log_path = WP_CONTENT_DIR . '/uploads/nginx-helper/'; - + return apply_filters( 'nginx_asset_path', $log_path ); - + } - + /** * Retrieve the asset url. * - * @since 2.0.0 + * @since 9.9.10 * @return string asset url of the plugin. */ public function functional_asset_url() { - + $log_url = WP_CONTENT_URL . '/uploads/nginx-helper/'; - + return apply_filters( 'nginx_asset_url', $log_url ); - - } - - /** - * Get latest news. - * - * @since 2.0.0 - */ - public function nginx_helper_get_feeds() { - - // Get RSS Feed(s). - require_once ABSPATH . WPINC . '/feed.php'; - - $maxitems = 0; - $rss_items = array(); - - // Get a SimplePie feed object from the specified feed source. - $rss = fetch_feed( 'https://rtcamp.com/blog/feed/' ); - - if ( ! is_wp_error( $rss ) ) { // Checks that the object is created correctly. - - // Figure out how many total items there are, but limit it to 5. - $maxitems = $rss->get_item_quantity( 5 ); - // Build an array of all the items, starting with element 0 (first element). - $rss_items = $rss->get_items( 0, $maxitems ); - - } - ?> - - options['enable_purge'] || 1 !== (int) $this->options['enable_stamp'] ) { return; } - + if ( ! empty( $pagenow ) && 'wp-login.php' === $pagenow ) { return; } - + foreach ( headers_list() as $header ) { list( $key, $value ) = explode( ':', $header, 2 ); $key = strtolower( $key ); @@ -549,32 +527,32 @@ public function add_timestamps() { break; } } - + /** * Don't add timestamp if run from ajax, cron or wpcli. */ if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) { return; } - + if ( defined( 'DOING_CRON' ) && DOING_CRON ) { return; } - + if ( defined( 'WP_CLI' ) && WP_CLI ) { return; } - + $timestamps = "\n\n" . - ''; - + 'Cached using Nginx-Helper on ' . current_time( 'mysql' ) . '. ' . + 'It took ' . get_num_queries() . ' queries executed in ' . timer_stop() . ' seconds.' . + "-->\n" . + ''; + echo wp_kses( $timestamps, array() ); - + } - + /** * Get map * @@ -583,83 +561,83 @@ public function add_timestamps() { * @return string */ public function get_map() { - + if ( ! $this->options['enable_map'] ) { return; } - + if ( is_multisite() ) { - + global $wpdb; - + $rt_all_blogs = $wpdb->get_results( $wpdb->prepare( 'SELECT blog_id, domain, path FROM ' . $wpdb->blogs . " WHERE site_id = %d AND archived = '0' AND mature = '0' AND spam = '0' AND deleted = '0'", $wpdb->siteid ) ); - + $wpdb->dmtable = $wpdb->base_prefix . 'domain_mapping'; - + $rt_domain_map_sites = ''; - + if ( $wpdb->get_var( "SHOW TABLES LIKE '{$wpdb->dmtable}'" ) === $wpdb->dmtable ) { // phpcs:ignore $rt_domain_map_sites = $wpdb->get_results( "SELECT blog_id, domain FROM {$wpdb->dmtable} ORDER BY id DESC" ); } - + $rt_nginx_map = ''; $rt_nginx_map_array = array(); - + if ( $rt_all_blogs ) { - + foreach ( $rt_all_blogs as $blog ) { - + if ( true === SUBDOMAIN_INSTALL ) { $rt_nginx_map_array[ $blog->domain ] = $blog->blog_id; } else { - + if ( 1 !== $blog->blog_id ) { $rt_nginx_map_array[ $blog->path ] = $blog->blog_id; } } } } - + if ( $rt_domain_map_sites ) { - + foreach ( $rt_domain_map_sites as $site ) { $rt_nginx_map_array[ $site->domain ] = $site->blog_id; } } - + foreach ( $rt_nginx_map_array as $domain => $domain_id ) { $rt_nginx_map .= "\t" . $domain . "\t" . $domain_id . ";\n"; } - + return $rt_nginx_map; - + } - + } - + /** * Update map */ public function update_map() { - + if ( is_multisite() ) { - + $rt_nginx_map = $this->get_map(); - + $fp = fopen( $this->functional_asset_path() . 'map.conf', 'w+' ); if ( $fp ) { fwrite( $fp, $rt_nginx_map ); fclose( $fp ); } } - + } - + /** * Purge url when post status is changed. * @@ -671,7 +649,7 @@ public function update_map() { * @param object $post Post object. */ public function set_future_post_option_on_future_status( $new_status, $old_status, $post ) { - + global $blog_id, $nginx_purger; $exclude_post_types = apply_filters( 'rt_nginx_helper_exclude_post_types', array( 'nav_menu_item' ) ); @@ -687,20 +665,20 @@ public function set_future_post_option_on_future_status( $new_status, $old_statu } return; } - - if ( ! $this->options['enable_purge'] ) { + + if ( ! $this->options['enable_purge'] || $this->is_import_request() ) { return; } - + $purge_status = array( 'publish', 'future' ); - + if ( in_array( $old_status, $purge_status, true ) || in_array( $new_status, $purge_status, true ) ) { - + $nginx_purger->log( 'Purge post on transition post STATUS from ' . $old_status . ' to ' . $new_status ); $nginx_purger->purge_post( $post->ID ); - + } - + if ( 'future' === $new_status && $post && 'future' === $post->post_status && ( @@ -711,15 +689,15 @@ public function set_future_post_option_on_future_status( $new_status, $old_statu ) ) ) { - + $nginx_purger->log( 'Set/update future_posts option ( post id = ' . $post->ID . ' and blog id = ' . $blog_id . ' )' ); $this->options['future_posts'][ $blog_id ][ $post->ID ] = strtotime( $post->post_date_gmt ) + 60; update_site_option( 'rt_wp_nginx_helper_options', $this->options ); - + } - + } - + /** * Unset future post option on delete * @@ -729,9 +707,9 @@ public function set_future_post_option_on_future_status( $new_status, $old_statu * @param int $post_id Post id. */ public function unset_future_post_option_on_delete( $post_id ) { - + global $blog_id, $nginx_purger; - + if ( ! $this->options['enable_purge'] || empty( $this->options['future_posts'] ) || @@ -741,18 +719,18 @@ public function unset_future_post_option_on_delete( $post_id ) { ) { return; } - + $nginx_purger->log( 'Unset future_posts option ( post id = ' . $post_id . ' and blog id = ' . $blog_id . ' )' ); - + unset( $this->options['future_posts'][ $blog_id ][ $post_id ] ); - + if ( ! count( $this->options['future_posts'][ $blog_id ] ) ) { unset( $this->options['future_posts'][ $blog_id ] ); } - + update_site_option( 'rt_wp_nginx_helper_options', $this->options ); } - + /** * Update map when new blog added in multisite. * @@ -761,18 +739,18 @@ public function unset_future_post_option_on_delete( $post_id ) { * @param string $blog_id blog id. */ public function update_new_blog_options( $blog_id ) { - + global $nginx_purger; - + $nginx_purger->log( "New site added ( id $blog_id )" ); $this->update_map(); $nginx_purger->log( "New site added to nginx map ( id $blog_id )" ); $helper_options = $this->nginx_helper_default_settings(); update_blog_option( $blog_id, 'rt_wp_nginx_helper_options', $helper_options ); $nginx_purger->log( "Default options updated for the new blog ( id $blog_id )" ); - + } - + /** * Purge all urls. * Purge current page cache when purging is requested from front @@ -781,14 +759,18 @@ public function update_new_blog_options( $blog_id ) { * @global object $nginx_purger */ public function purge_all() { - + + if ( $this->is_import_request() ) { + return; + } + global $nginx_purger, $wp; - + $method = null; if ( isset( $_SERVER['REQUEST_METHOD'] ) ) { $method = wp_strip_all_tags( $_SERVER['REQUEST_METHOD'] ); } - + $action = ''; if ( 'POST' === $method ) { if ( isset( $_POST['nginx_helper_action'] ) ) { @@ -799,34 +781,34 @@ public function purge_all() { $action = wp_strip_all_tags( $_GET['nginx_helper_action'] ); } } - + if ( empty( $action ) ) { return; } - + if ( ! current_user_can( 'manage_options' ) ) { wp_die( 'Sorry, you do not have the necessary privileges to edit these options.' ); } - + if ( 'done' === $action ) { - + add_action( 'admin_notices', array( &$this, 'display_notices' ) ); add_action( 'network_admin_notices', array( &$this, 'display_notices' ) ); return; - + } - + check_admin_referer( 'nginx_helper-purge_all' ); - + $current_url = user_trailingslashit( home_url( $wp->request ) ); - + if ( ! is_admin() ) { $action = 'purge_current_page'; $redirect_url = $current_url; } else { $redirect_url = add_query_arg( array( 'nginx_helper_action' => 'done' ) ); } - + switch ( $action ) { case 'purge': $nginx_purger->purge_all(); @@ -835,28 +817,138 @@ public function purge_all() { $nginx_purger->purge_url( $current_url ); break; } - + if ( 'purge' === $action ) { - + /** * Fire an action after the entire cache has been purged whatever caching type is used. * * @since 2.2.2 */ do_action( 'rt_nginx_helper_after_purge_all' ); - + } - + wp_redirect( esc_url_raw( $redirect_url ) ); exit(); - + } - + /** * Dispay plugin notices. */ public function display_notices() { echo '

' . esc_html__( 'Purge initiated', 'nginx-helper' ) . '

'; } - + + /** + * Preloads the cache for the website. + * + * @return void + */ + public function preload_cache() { + $is_cache_preloaded = $this->options['is_cache_preloaded']; + $preload_cache_enabled = $this->options['preload_cache']; + + if ( $preload_cache_enabled && false === boolval( $is_cache_preloaded ) ) { + $this->options['is_cache_preloaded'] = true; + + update_site_option( 'rt_wp_nginx_helper_options', $this->options ); + $this->preload_cache_from_sitemap(); + } + } + + /** + * This function preloads the cache from sitemap url. + * + * @return void + */ + private function preload_cache_from_sitemap() { + + $sitemap_urls = $this->get_index_sitemap_urls(); + $all_urls = array(); + + foreach ( $sitemap_urls as $sitemap_url ) { + $urls = $this->extract_sitemap_urls( $sitemap_url ); + $all_urls = array_merge( $all_urls, $urls ); + } + + $args = array( + 'timeout' => 1, + 'blocking' => false, + 'sslverify' => false, + ); + + foreach ( $all_urls as $url ) { + wp_remote_get( esc_url_raw( $url ), $args ); + } + + } + + /** + * Fetches all the sitemap urls for the site. + * + * @return array + */ + private function get_index_sitemap_urls() { + $sitemaps = wp_sitemaps_get_server()->index->get_sitemap_list(); + $urls = array(); + foreach ( $sitemaps as $sitemap ) { + $urls[] = $sitemap['loc']; + } + return $urls; + } + + /** + * Parse sitemap content and extract all URLs. + * + * @param string $sitemap_url The URL of the sitemap. + * @return array|WP_Error An array of URLs or WP_Error on failure. + */ + private function extract_sitemap_urls( $sitemap_url ) { + $response = wp_remote_get( $sitemap_url ); + + $urls = array(); + + if ( is_wp_error( $response ) ) { + return $urls; + } + + $sitemap_content = wp_remote_retrieve_body( $response ); + + libxml_use_internal_errors( true ); + $xml = simplexml_load_string( $sitemap_content ); + + if ( false === $xml ) { + return new WP_Error( 'sitemap_parse_error', esc_html__( 'Failed to parse the sitemap XML', 'nginx-helper' ) ); + } + + $urls = array(); + + if ( false === $xml ) { + return $urls; + } + + foreach ( $xml->url as $url ) { + $urls[] = (string) $url->loc; + } + + return $urls; + } + + /** + * Determines if the current request is for importing Posts/ WordPress content. + * + * @return bool True if the request is for importing, false otherwise. + */ + public function is_import_request() { + $import_query_var = sanitize_text_field( wp_unslash( $_GET['import'] ?? '' ) ); //phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Nonce is already in the admin dashboard. + $has_import_started = did_action( 'import_start' ); + + return ( defined( 'WP_IMPORTING' ) && true === WP_IMPORTING ) + || 0 !== $has_import_started + || ! empty( $import_query_var ); + } + + } diff --git a/admin/class-phpredis-purger.php b/admin/class-phpredis-purger.php index b297d6a3..a816daa5 100644 --- a/admin/class-phpredis-purger.php +++ b/admin/class-phpredis-purger.php @@ -2,8 +2,8 @@ /** * The admin-specific functionality of the plugin. * - * @link https://rtcamp.com/nginx-helper/ - * @since 2.0.0 + * @link https://github.com/gridpane/nginx-helper/ + * @since 9.9.10 * * @package nginx-helper * @subpackage nginx-helper/admin @@ -14,14 +14,14 @@ * * @package nginx-helper * @subpackage nginx-helper/admin - * @author rtCamp + * @author GridPane */ class PhpRedis_Purger extends Purger { /** * PHP Redis api object. * - * @since 2.0.0 + * @since 9.9.10 * @access public * @var string $redis_object PHP Redis api object. */ @@ -30,7 +30,7 @@ class PhpRedis_Purger extends Purger { /** * Initialize the class and set its properties. * - * @since 2.0.0 + * @since 9.9.10 */ public function __construct() { @@ -71,8 +71,10 @@ public function __construct() { ); $redis_database = $nginx_helper_admin->options['redis_database']; - - $this->redis_object->select($redis_database); + + if( 0 !== $redis_database ) { + $this->redis_object->select($redis_database); + } } catch ( Exception $e ) { $this->log( $e->getMessage(), 'ERROR' ); @@ -117,7 +119,7 @@ public function purge_all() { /** * Fire an action after the Redis cache has been purged. * - * @since 2.1.0 + * @since 9.9.10 */ do_action( 'rt_nginx_helper_after_redis_purge_all' ); } @@ -135,7 +137,7 @@ public function purge_url( $url, $feed = true ) { /** * Filters the URL to be purged. * - * @since 2.1.0 + * @since 9.9.10 * * @param string $url URL to be purged. */ @@ -165,7 +167,7 @@ public function purge_url( $url, $feed = true ) { * * Regardless of what key / suffix is being to store `$device_type` cache , it will be deleted. * - * @since 2.1.0 + * @since 9.9.10 */ if ( strpos( $_url_purge_base, '*' ) === false ) { diff --git a/admin/class-predis-purger.php b/admin/class-predis-purger.php index 1f4771f2..6b2e4cb6 100644 --- a/admin/class-predis-purger.php +++ b/admin/class-predis-purger.php @@ -10,14 +10,14 @@ * * @package nginx-helper * @subpackage nginx-helper/admin - * @author rtCamp + * @author GridPane */ class Predis_Purger extends Purger { /** * Predis api object. * - * @since 2.0.0 + * @since 9.9.10 * @access public * @var string $redis_object Predis api object. */ @@ -26,7 +26,7 @@ class Predis_Purger extends Purger { /** * Initialize the class and set its properties. * - * @since 2.0.0 + * @since 9.9.10 */ public function __construct() { @@ -44,7 +44,7 @@ public function __construct() { $path = $nginx_helper_admin->options['redis_unix_socket']; $username = $nginx_helper_admin->options['redis_username']; $password = $nginx_helper_admin->options['redis_password']; - $predis_connection_array['database'] = $nginx_helper_admin->options['redis_database']; + $predis_connection_array['database'] = $nginx_helper_admin->options['redis_database']; if ( $path ) { $predis_connection_array['path'] = $path; @@ -63,8 +63,13 @@ public function __construct() { try { $this->redis_object->connect(); + + if( 0 !== $nginx_helper_admin->options['redis_database'] ) { + $this->redis_object->select( $nginx_helper_admin->options['redis_database'] ); + } } catch ( Exception $e ) { $this->log( $e->getMessage(), 'ERROR' ); + return; } } @@ -100,7 +105,7 @@ public function purge_all() { /** * Fire an action after the Redis cache has been purged. * - * @since 2.1.0 + * @since 9.9.10 */ do_action( 'rt_nginx_helper_after_redis_purge_all' ); } @@ -118,7 +123,7 @@ public function purge_url( $url, $feed = true ) { /** * Filters the URL to be purged. * - * @since 2.1.0 + * @since 9.9.10 * * @param string $url URL to be purged. */ @@ -150,7 +155,7 @@ public function purge_url( $url, $feed = true ) { * * Regardless of what key / suffix is being to store `$device_type` cache , it will be deleted. * - * @since 2.1.0 + * @since 9.9.10 */ if ( strpos( $_url_purge_base, '*' ) === false ) { diff --git a/admin/class-purger.php b/admin/class-purger.php index 683afd50..2ed56bd5 100644 --- a/admin/class-purger.php +++ b/admin/class-purger.php @@ -12,7 +12,7 @@ * * @subpackage nginx-helper/admin * - * @author rtCamp + * @author GridPane */ abstract class Purger { @@ -430,8 +430,7 @@ protected function delete_cache_file_for( $url ) { /** * Filters the cached file name. * - * @since 2.1.0 - * @since 2.2.3 Purge URL argument `$url` were added. + * @since 9.9.10 * * @param string $cached_file Cached file name. * @param string $url URL to be purged. @@ -453,7 +452,7 @@ protected function delete_cache_file_for( $url ) { /** * Fire an action after deleting file from cache. * - * @since 2.1.0 + * @since 9.9.10 * * @param string $url URL to be purged. * @param string $cached_file Cached file name. @@ -474,7 +473,7 @@ protected function do_remote_get( $url ) { /** * Filters the URL to be purged. * - * @since 2.1.0 + * @since 9.9.10 * * @param string $url URL to be purged. */ @@ -483,7 +482,7 @@ protected function do_remote_get( $url ) { /** * Fire an action before purging URL. * - * @since 2.1.0 + * @since 9.9.10 * * @param string $url URL to be purged. */ @@ -517,7 +516,7 @@ protected function do_remote_get( $url ) { /** * Fire an action after remote purge request. * - * @since 2.1.0 + * @since 9.9.10 * * @param string $url URL to be purged. * @param array $response Array of results including HTTP headers. diff --git a/admin/css/nginx-helper-admin.css b/admin/css/nginx-helper-admin.css index 0a8856ba..ddf47ce4 100644 --- a/admin/css/nginx-helper-admin.css +++ b/admin/css/nginx-helper-admin.css @@ -4,7 +4,7 @@ */ .clearfix { - *zoom: 1; + zoom: 1; } .clearfix:before, .clearfix:after { @@ -103,3 +103,18 @@ form#purgeall .button-primary:focus { font-size: 13px; margin-left: 23px; } + +.password-input { + padding-right: 40px; +} + +.password-show-hide-btn { + background-color: transparent; + border: 0; + cursor: pointer; + display: inline-block; +} + +.password-wrapper { + display: flex; +} diff --git a/admin/js/nginx-helper-admin.js b/admin/js/nginx-helper-admin.js index 4b3aa006..748ac703 100644 --- a/admin/js/nginx-helper-admin.js +++ b/admin/js/nginx-helper-admin.js @@ -75,6 +75,19 @@ } ); + jQuery('.password-show-hide-btn').on('click', function() { + var passwordInput = $(this).siblings('.password-input'); + var icon = $(this).find('.password-input-icon'); + + if (passwordInput.attr('type') === 'password') { + passwordInput.attr('type', 'text'); + icon.removeClass('dashicons-hidden').addClass('dashicons-visibility'); + } else { + passwordInput.attr('type', 'password'); + icon.removeClass('dashicons-visibility').addClass('dashicons-hidden'); + } + }); + /** * Show OR Hide options on option checkbox * diff --git a/admin/partials/nginx-helper-admin-display.php b/admin/partials/nginx-helper-admin-display.php index bd153714..8b5e87f5 100644 --- a/admin/partials/nginx-helper-admin-display.php +++ b/admin/partials/nginx-helper-admin-display.php @@ -4,7 +4,7 @@ * * This file is used to markup the admin-facing aspects of the plugin. * - * @link http://example.com + * @link https://github.com/gridpane/nginx-helper/ * @since 2.0.0 * * @package nginx-helper diff --git a/admin/partials/nginx-helper-general-options.php b/admin/partials/nginx-helper-general-options.php index 6d0ff5da..8c802128 100644 --- a/admin/partials/nginx-helper-general-options.php +++ b/admin/partials/nginx-helper-general-options.php @@ -4,7 +4,7 @@ * * This file is used to markup the admin-facing aspects of the plugin. * - * @since 2.0.0 + * @since 9.9.10 * * @package nginx-helper * @subpackage nginx-helper/admin/partials @@ -22,10 +22,12 @@ 'redis_hostname', 'redis_port', 'redis_prefix', - 'redis_unix_socket', + 'redis_database', 'redis_username', 'redis_password', - 'redis_database', + 'redis_unix_socket', + 'redis_socket_enabled_by_constant', + 'redis_acl_enabled_by_constant', 'purge_homepage_on_edit', 'purge_homepage_on_del', 'purge_url', @@ -44,6 +46,8 @@ 'purge_page_on_deleted_comment', 'purge_feeds', 'smart_http_expire_form_nonce', + 'purge_amp_urls', + 'preload_cache', ); $all_inputs = array(); @@ -181,6 +185,12 @@ + + + /> + + + @@ -479,13 +489,19 @@ } ?> + '; + esc_html_e( 'Overridden by unix socket path.', 'nginx-helper' ); + echo '

'; + } + ?> /> - '; esc_html_e( 'Optional - only required if you have implmented Redis ACLs ', 'nginx-helper' ); echo '

'; @@ -497,6 +513,30 @@ } ?> + '; + esc_html_e( 'Overridden by unix socket path.', 'nginx-helper' ); + echo '

'; + + } + ?> + + + + + + /> + '; + esc_html_e( 'Overridden by constant variables.', 'nginx-helper' ); + echo '

'; + + } + ?> @@ -517,6 +557,55 @@ ?> + + + + /> + '; + esc_html_e( 'Overridden by constant variables.', 'nginx-helper' ); + echo '

'; + + } + ?> + + + + + + + /> + '; + esc_html_e( 'Overridden by constant variables.', 'nginx-helper' ); + echo '

'; + + } + ?> + + + + + + +
+ /> + +
+ '; + esc_html_e( 'Overridden by constant variables.', 'nginx-helper' ); + echo '

'; + + } + ?> + + @@ -777,6 +866,38 @@ + + + + + +
+

+ +

+
+
+ + +   + + + + +
+
+
diff --git a/admin/partials/nginx-helper-sidebar-display.php b/admin/partials/nginx-helper-sidebar-display.php index 50021eba..011d17a5 100644 --- a/admin/partials/nginx-helper-sidebar-display.php +++ b/admin/partials/nginx-helper-sidebar-display.php @@ -4,7 +4,7 @@ * * This file is used to markup the admin-facing aspects of the plugin. * - * @since 2.0.0 + * @since 9.9.10 * * @package nginx-helper * @subpackage nginx-helper/admin/partials @@ -28,61 +28,18 @@

- +

%s.', - esc_html__( 'Please use our', 'nginx-helper' ), - esc_url( 'http://rtcamp.com/support/forum/wordpress-nginx/' ), - esc_html__( 'free support forum', 'nginx-helper' ) + esc_html__( 'Please create a GitHub Issue', 'nginx-helper' ), + esc_url( 'https://github.com/gridpane/nginx-helper/issues' ) ); ?>

-
-

- - - -

-
- - -
-
- - - -
-

-

-
-
diff --git a/admin/partials/nginx-helper-support-options.php b/admin/partials/nginx-helper-support-options.php index 178b05a7..d3e74ab5 100644 --- a/admin/partials/nginx-helper-support-options.php +++ b/admin/partials/nginx-helper-support-options.php @@ -4,7 +4,7 @@ * * This file is used to markup the admin-facing aspects of the plugin. * - * @since 2.0.0 + * @since 9.9.10 * * @package nginx-helper * @subpackage nginx-helper/admin/partials @@ -15,27 +15,17 @@

- +

- - - - diff --git a/class-nginx-helper-wp-cli-command.php b/class-nginx-helper-wp-cli-command.php index 7862e982..d0e9f453 100644 --- a/class-nginx-helper-wp-cli-command.php +++ b/class-nginx-helper-wp-cli-command.php @@ -2,7 +2,7 @@ /** * Contains class for WP-CLI command. * - * @since 2.0.0 + * @since 9.9.10 * @package nginx-helper */ diff --git a/composer.json b/composer.json index f215446d..9449814a 100644 --- a/composer.json +++ b/composer.json @@ -1,25 +1,23 @@ { - "name": "rtcamp/nginx-helper", + "name": "gridpane/nginx-helper", "description": "Cleans nginx's fastcgi/proxy cache or redis-cache whenever a post is edited/published. Also does a few more things.", "keywords": ["wordpress", "plugin", "nginx", "nginx-helper", "fastcgi", "redis-cache", "redis", "cache"], - "homepage": "https://rtcamp.com/nginx-helper/", + "homepage": "https://github.com/gridpane/nginx-helper/", "license": "GPL-2.0+", "authors": [{ - "name": "rtCamp", - "email": "support@rtcamp.com", - "homepage": "https://rtcamp.com" + "name": "GridPane", + "email": "developer@gridpane.com", + "homepage": "https://gridpane.com" }], "minimum-stability": "dev", "prefer-stable": true, "type": "wordpress-plugin", "support": { - "issues": "https://github.com/rtCamp/nginx-helper/issues", - "forum": "https://wordpress.org/support/plugin/nginx-helper", - "wiki": "https://github.com/rtCamp/nginx-helper/wiki", - "source": "https://github.com/rtCamp/nginx-helper/" + "issues": "https://github.com/gridpane/nginx-helper/issues", + "source": "https://github.com/gridpane/nginx-helper/" }, "require": { - "php": ">=5.3.2", + "php": ">=7.4", "composer/installers": "^1.0" }, "require-dev": { diff --git a/includes/class-nginx-helper-activator.php b/includes/class-nginx-helper-activator.php index ec179928..14fd6835 100644 --- a/includes/class-nginx-helper-activator.php +++ b/includes/class-nginx-helper-activator.php @@ -4,13 +4,13 @@ * * This class defines all code necessary to run during the plugin's activation. * - * @since 2.0.0 - * @link https://rtcamp.com/nginx-helper/ + * @since 9.9.10 + * @link https://github.com/gridpane/nginx-helper/ * * @package nginx-helper * @subpackage nginx-helper/includes * - * @author rtCamp + * @author GridPane */ /** @@ -22,7 +22,7 @@ class Nginx_Helper_Activator { * Create log directory. Add capability of nginx helper. * Schedule event to check log file size daily. * - * @since 2.0.0 + * @since 9.9.10 * * @global Nginx_Helper_Admin $nginx_helper_admin */ @@ -57,6 +57,10 @@ public static function activate() { $role->add_cap( 'Nginx Helper | Purge cache' ); wp_schedule_event( time(), 'daily', 'rt_wp_nginx_helper_check_log_file_size_daily' ); + + if( method_exists( $nginx_helper_admin, 'store_default_options' ) ) { + $nginx_helper_admin->store_default_options(); + } } diff --git a/includes/class-nginx-helper-deactivator.php b/includes/class-nginx-helper-deactivator.php index 354c42d0..99962eaf 100644 --- a/includes/class-nginx-helper-deactivator.php +++ b/includes/class-nginx-helper-deactivator.php @@ -10,20 +10,20 @@ * * This class defines all code necessary to run during the plugin's deactivation. * - * @since 2.0.0 - * @link https://rtcamp.com/nginx-helper/ + * @since 9.9.10 + * @link https://github.com/gridpane/nginx-helper/ * * @package nginx-helper * @subpackage nginx-helper/includes * - * @author rtCamp + * @author GridPane */ class Nginx_Helper_Deactivator { /** * Schedule event to check log file size daily. Remove nginx helper capability. * - * @since 2.0.0 + * @since 9.9.10 */ public static function deactivate() { diff --git a/includes/class-nginx-helper-i18n.php b/includes/class-nginx-helper-i18n.php index 826d9769..feb255a7 100644 --- a/includes/class-nginx-helper-i18n.php +++ b/includes/class-nginx-helper-i18n.php @@ -5,7 +5,7 @@ * Loads and defines the internationalization files for this plugin * so that it is ready for translation. * - * @link https://rtcamp.com/nginx-helper/ + * @link https://github.com/gridpane/nginx-helper/ * @since 2.0.0 * * @package nginx-helper @@ -21,14 +21,14 @@ * @since 2.0.0 * @package nginx-helper * @subpackage nginx-helper/includes - * @author rtCamp + * @author GridPane */ class Nginx_Helper_i18n { /** * The domain specified for this plugin. * - * @since 2.0.0 + * @since 9.9.10 * @access private * @var string $domain The domain identifier for this plugin. */ @@ -37,7 +37,7 @@ class Nginx_Helper_i18n { /** * Load the plugin text domain for translation. * - * @since 2.0.0 + * @since 9.9.10 */ public function load_plugin_textdomain() { @@ -52,7 +52,7 @@ public function load_plugin_textdomain() { /** * Set the domain equal to that of the specified domain. * - * @since 2.0.0 + * @since 9.9.10 * * @param string $domain The domain that represents the locale of this plugin. */ diff --git a/includes/class-nginx-helper-loader.php b/includes/class-nginx-helper-loader.php index f58d9373..5e4b5645 100644 --- a/includes/class-nginx-helper-loader.php +++ b/includes/class-nginx-helper-loader.php @@ -2,8 +2,8 @@ /** * Register all actions and filters for the plugin * - * @link https://rtcamp.com/nginx-helper/ - * @since 2.0.0 + * @link https://github.com/gridpane/nginx-helper/ + * @since 9.9.10 * * @package nginx-helper * @subpackage nginx-helper/includes @@ -20,14 +20,14 @@ * * @subpackage nginx-helper/includes * - * @author rtCamp + * @author GridPane */ class Nginx_Helper_Loader { /** * The array of actions registered with WordPress. * - * @since 2.0.0 + * @since 9.9.10 * * @access protected * @@ -38,7 +38,7 @@ class Nginx_Helper_Loader { /** * The array of filters registered with WordPress. * - * @since 2.0.0 + * @since 9.9.10 * * @access protected * @@ -49,7 +49,7 @@ class Nginx_Helper_Loader { /** * Initialize the collections used to maintain the actions and filters. * - * @since 2.0.0 + * @since 9.9.10 */ public function __construct() { @@ -61,7 +61,7 @@ public function __construct() { /** * Add a new action to the collection to be registered with WordPress. * - * @since 2.0.0 + * @since 9.9.10 * * @param string $hook The name of the WordPress action that is being registered. * @param object $component A reference to the instance of the object on which the action is defined. @@ -76,7 +76,7 @@ public function add_action( $hook, $component, $callback, $priority = 10, $accep /** * Add a new filter to the collection to be registered with WordPress. * - * @since 2.0.0 + * @since 9.9.10 * * @param string $hook The name of the WordPress filter that is being registered. * @param object $component A reference to the instance of the object on which the filter is defined. @@ -92,7 +92,7 @@ public function add_filter( $hook, $component, $callback, $priority = 10, $accep * A utility function that is used to register the actions and hooks into a single * collection. * - * @since 2.0.0 + * @since 9.9.10 * * @access private * @@ -122,7 +122,7 @@ private function add( $hooks, $hook, $component, $callback, $priority, $accepted /** * Register the filters and actions with WordPress. * - * @since 2.0.0 + * @since 9.9.10 */ public function run() { diff --git a/includes/class-nginx-helper.php b/includes/class-nginx-helper.php index f96e6d04..093a572b 100644 --- a/includes/class-nginx-helper.php +++ b/includes/class-nginx-helper.php @@ -5,8 +5,8 @@ * A class definition that includes attributes and functions used across both the * public-facing side of the site and the admin area. * - * @link https://rtcamp.com/nginx-helper/ - * @since 2.0.0 + * @link https://github.com/gridpane/nginx-helper/ + * @since 9.9.10 * * @package nginx-helper * @subpackage nginx-helper/includes @@ -21,10 +21,10 @@ * Also maintains the unique identifier of this plugin as well as the current * version of the plugin. * - * @since 2.0.0 + * @since 9.9.10 * @package nginx-helper * @subpackage nginx-helper/includes - * @author rtCamp + * @author GridPane */ class Nginx_Helper { @@ -32,7 +32,7 @@ class Nginx_Helper { * The loader that's responsible for maintaining and registering all hooks that power * the plugin. * - * @since 2.0.0 + * @since 9.9.10 * @access protected * @var Nginx_Helper_Loader $loader Maintains and registers all hooks for the plugin. */ @@ -41,7 +41,7 @@ class Nginx_Helper { /** * The unique identifier of this plugin. * - * @since 2.0.0 + * @since 9.9.10 * @access protected * @var string $plugin_name The string used to uniquely identify this plugin. */ @@ -50,7 +50,7 @@ class Nginx_Helper { /** * The current version of the plugin. * - * @since 2.0.0 + * @since 9.9.10 * @access protected * @var string $version The current version of the plugin. */ @@ -59,7 +59,7 @@ class Nginx_Helper { /** * Minimum WordPress Version Required. * - * @since 2.0.0 + * @since 9.9.10 * @access public * @var string $minium_wp */ @@ -72,12 +72,12 @@ class Nginx_Helper { * Load the dependencies, define the locale, and set the hooks for the admin area and * the public-facing side of the site. * - * @since 2.0.0 + * @since 9.9.10 */ public function __construct() { $this->plugin_name = 'nginx-helper'; - $this->version = '2.2.5'; + $this->version = '9.9.10'; $this->minimum_wp = '3.0'; if ( ! $this->required_wp_version() ) { @@ -105,7 +105,7 @@ public function __construct() { * Create an instance of the loader which will be used to register the hooks * with WordPress. * - * @since 2.0.0 + * @since 9.9.10 * @access private */ private function load_dependencies() { @@ -146,7 +146,7 @@ private function load_dependencies() { * Uses the Nginx_Helper_i18n class in order to set the domain and to register the hook * with WordPress. * - * @since 2.0.0 + * @since 9.9.10 * @access private */ private function set_locale() { @@ -161,7 +161,7 @@ private function set_locale() { /** * Register all of the hooks related to the admin area functionality of the plugin. * - * @since 2.0.0 + * @since 9.9.10 * @access private */ private function define_admin_hooks() { @@ -169,7 +169,7 @@ private function define_admin_hooks() { global $nginx_helper_admin, $nginx_purger; $nginx_helper_admin = new Nginx_Helper_Admin( $this->get_plugin_name(), $this->get_version() ); - + $this->loader->add_action( 'init', $nginx_helper_admin, 'initialize_setting_tab' ); // Defines global variables. if ( ! empty( $nginx_helper_admin->options['cache_method'] ) && 'enable_redis' === $nginx_helper_admin->options['cache_method'] ) { @@ -206,8 +206,6 @@ private function define_admin_hooks() { $this->loader->add_action( 'admin_bar_menu', $nginx_helper_admin, 'nginx_helper_toolbar_purge_link', 100 ); } - $this->loader->add_action( 'wp_ajax_rt_get_feeds', $nginx_helper_admin, 'nginx_helper_get_feeds' ); - $this->loader->add_action( 'shutdown', $nginx_helper_admin, 'add_timestamps', 99999 ); $this->loader->add_action( 'add_init', $nginx_helper_admin, 'update_map' ); @@ -227,12 +225,15 @@ private function define_admin_hooks() { // expose action to allow other plugins to purge the cache. $this->loader->add_action( 'rt_nginx_helper_purge_all', $nginx_purger, 'purge_all' ); + + // add action to preload the cache + $this->loader->add_action( 'admin_init', $nginx_helper_admin, 'preload_cache' ); } /** * Run the loader to execute all of the hooks with WordPress. * - * @since 2.0.0 + * @since 9.9.10 */ public function run() { $this->loader->run(); @@ -242,7 +243,7 @@ public function run() { * The name of the plugin used to uniquely identify it within the context of * WordPress and to define internationalization functionality. * - * @since 2.0.0 + * @since 9.9.10 * @return string The name of the plugin. */ public function get_plugin_name() { @@ -252,7 +253,7 @@ public function get_plugin_name() { /** * The reference to the class that orchestrates the hooks with the plugin. * - * @since 2.0.0 + * @since 9.9.10 * * @return Nginx_Helper_Loader Orchestrates the hooks of the plugin. */ @@ -263,7 +264,7 @@ public function get_loader() { /** * Retrieve the version number of the plugin. * - * @since 2.0.0 + * @since 9.9.10 * @return string The version number of the plugin. */ public function get_version() { @@ -273,7 +274,7 @@ public function get_version() { /** * Check wp version. * - * @since 2.0.0 + * @since 9.9.10 * * @global string $wp_version * diff --git a/languages/nginx-helper.mo b/languages/nginx-helper.mo index 9731e242..d8d23afa 100644 Binary files a/languages/nginx-helper.mo and b/languages/nginx-helper.mo differ diff --git a/languages/nginx-helper.po b/languages/nginx-helper.po index 313e246a..dfa0a21b 100644 --- a/languages/nginx-helper.po +++ b/languages/nginx-helper.po @@ -1,79 +1,88 @@ -# Copyright (C) 2024 rtCamp +# Copyright (C) 2025 GridPane # This file is distributed under the same license as the Nginx Helper plugin. msgid "" msgstr "" -"Project-Id-Version: Nginx Helper 2.2.5\n" +"Project-Id-Version: Nginx Helper 9.9.10\n" "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/nginx-helper\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"POT-Creation-Date: 2024-04-15T10:26:40+00:00\n" +"POT-Creation-Date: 2024-12-30T06:30:46+00:00\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" -"X-Generator: WP-CLI 2.9.0\n" +"X-Generator: WP-CLI 2.11.0\n" "X-Domain: nginx-helper\n" #. Plugin Name of the plugin -#: admin/class-nginx-helper-admin.php:177 -#: admin/class-nginx-helper-admin.php:178 -#: admin/class-nginx-helper-admin.php:188 -#: admin/class-nginx-helper-admin.php:189 +#: nginx-helper.php +#: admin/class-nginx-helper-admin.php:183 +#: admin/class-nginx-helper-admin.php:184 +#: admin/class-nginx-helper-admin.php:194 +#: admin/class-nginx-helper-admin.php:195 msgid "Nginx Helper" msgstr "" #. Plugin URI of the plugin -msgid "https://rtcamp.com/nginx-helper/" +#: nginx-helper.php +msgid "https://github.com/gridpane/nginx-helper/" msgstr "" #. Description of the plugin +#: nginx-helper.php msgid "Cleans nginx's fastcgi/proxy cache or redis-cache whenever a post is edited/published. Also does few more things." msgstr "" #. Author of the plugin -msgid "rtCamp" +#: nginx-helper.php +msgid "GridPane Jeff" msgstr "" #. Author URI of the plugin -msgid "https://rtcamp.com" +#: nginx-helper.php +msgid "https://github.com/gridpane/nginx-helper/" msgstr "" -#: admin/class-nginx-helper-admin.php:88 +#: admin/class-nginx-helper-admin.php:97 msgid "General" msgstr "" -#: admin/class-nginx-helper-admin.php:92 +#: admin/class-nginx-helper-admin.php:101 msgid "Support" msgstr "" -#: admin/class-nginx-helper-admin.php:160 +#: admin/class-nginx-helper-admin.php:166 msgid "Purging entire cache is not recommended. Would you like to continue?" msgstr "" -#: admin/class-nginx-helper-admin.php:212 +#: admin/class-nginx-helper-admin.php:218 msgid "Purge Cache" msgstr "" -#: admin/class-nginx-helper-admin.php:215 +#: admin/class-nginx-helper-admin.php:221 msgid "Purge Current Page" msgstr "" -#: admin/class-nginx-helper-admin.php:342 +#: admin/class-nginx-helper-admin.php:387 msgid "Settings" msgstr "" -#: admin/class-nginx-helper-admin.php:426 +#: admin/class-nginx-helper-admin.php:471 msgid "No items" msgstr "" -#: admin/class-nginx-helper-admin.php:437 +#: admin/class-nginx-helper-admin.php:482 msgid "Posted " msgstr "" -#: admin/class-nginx-helper-admin.php:776 +#: admin/class-nginx-helper-admin.php:825 msgid "Purge initiated" msgstr "" +#: admin/class-nginx-helper-admin.php:907 +msgid "Failed to parse the sitemap XML" +msgstr "" + #: admin/class-purger.php:691 msgid "Purging homepage (WPML) " msgstr "" @@ -236,322 +245,363 @@ msgstr "" msgid "Nginx Settings" msgstr "" -#: admin/partials/nginx-helper-general-options.php:82 +#: admin/partials/nginx-helper-general-options.php:90 msgid "Log file size must be a number." msgstr "" -#: admin/partials/nginx-helper-general-options.php:92 +#: admin/partials/nginx-helper-general-options.php:100 msgid "Settings saved." msgstr "" -#: admin/partials/nginx-helper-general-options.php:119 +#: admin/partials/nginx-helper-general-options.php:127 msgid "Purging Options" msgstr "" -#: admin/partials/nginx-helper-general-options.php:126 +#: admin/partials/nginx-helper-general-options.php:134 msgid "Enable Purge" msgstr "" -#: admin/partials/nginx-helper-general-options.php:136 +#: admin/partials/nginx-helper-general-options.php:140 +msgid "Preload Cache" +msgstr "" + +#: admin/partials/nginx-helper-general-options.php:150 msgid "Caching Method" msgstr "" -#: admin/partials/nginx-helper-general-options.php:148 +#: admin/partials/nginx-helper-general-options.php:162 msgid "nginx Fastcgi cache" msgstr "" -#: admin/partials/nginx-helper-general-options.php:150 +#: admin/partials/nginx-helper-general-options.php:164 msgid "External settings for nginx" msgstr "" -#: admin/partials/nginx-helper-general-options.php:151 +#: admin/partials/nginx-helper-general-options.php:165 msgid "requires external settings for nginx" msgstr "" -#: admin/partials/nginx-helper-general-options.php:161 +#: admin/partials/nginx-helper-general-options.php:175 msgid "Redis cache" msgstr "" -#: admin/partials/nginx-helper-general-options.php:171 +#: admin/partials/nginx-helper-general-options.php:185 msgid "Purge Method" msgstr "" -#: admin/partials/nginx-helper-general-options.php:181 -#: admin/partials/nginx-helper-general-options.php:361 +#: admin/partials/nginx-helper-general-options.php:195 +#: admin/partials/nginx-helper-general-options.php:455 msgid "when a post/page/custom post is published." msgstr "" -#: admin/partials/nginx-helper-general-options.php:191 +#: admin/partials/nginx-helper-general-options.php:205 msgid "Using a GET request to" msgstr "" -#: admin/partials/nginx-helper-general-options.php:192 +#: admin/partials/nginx-helper-general-options.php:206 msgid "(Default option)" msgstr "" #. translators: %s Nginx cache purge module link. -#: admin/partials/nginx-helper-general-options.php:203 +#: admin/partials/nginx-helper-general-options.php:217 msgid "Uses the %s module." msgstr "" -#: admin/partials/nginx-helper-general-options.php:221 +#: admin/partials/nginx-helper-general-options.php:235 msgid "Delete local server cache files" msgstr "" -#: admin/partials/nginx-helper-general-options.php:227 +#: admin/partials/nginx-helper-general-options.php:241 msgid "Checks for matching cache file in RT_WP_NGINX_HELPER_CACHE_PATH. Does not require any other modules. Requires that the cache be stored on the same server as WordPress. You must also be using the default nginx cache options (levels=1:2) and (fastcgi_cache_key \"$scheme$request_method$host$request_uri\")." msgstr "" -#: admin/partials/nginx-helper-general-options.php:242 +#: admin/partials/nginx-helper-general-options.php:256 msgid "Redis Settings" msgstr "" -#: admin/partials/nginx-helper-general-options.php:247 +#: admin/partials/nginx-helper-general-options.php:261 msgid "Hostname" msgstr "" -#: admin/partials/nginx-helper-general-options.php:254 -#: admin/partials/nginx-helper-general-options.php:269 -#: admin/partials/nginx-helper-general-options.php:284 +#: admin/partials/nginx-helper-general-options.php:268 +#: admin/partials/nginx-helper-general-options.php:290 +#: admin/partials/nginx-helper-general-options.php:314 +#: admin/partials/nginx-helper-general-options.php:329 +#: admin/partials/nginx-helper-general-options.php:344 +#: admin/partials/nginx-helper-general-options.php:360 +#: admin/partials/nginx-helper-general-options.php:378 msgid "Overridden by constant variables." msgstr "" -#: admin/partials/nginx-helper-general-options.php:262 +#: admin/partials/nginx-helper-general-options.php:276 +#: admin/partials/nginx-helper-general-options.php:299 +msgid "Overridden by unix socket path." +msgstr "" + +#: admin/partials/nginx-helper-general-options.php:283 msgid "Port" msgstr "" -#: admin/partials/nginx-helper-general-options.php:277 +#: admin/partials/nginx-helper-general-options.php:307 +msgid "Socket Path" +msgstr "" + +#: admin/partials/nginx-helper-general-options.php:322 msgid "Prefix" msgstr "" -#: admin/partials/nginx-helper-general-options.php:297 +#: admin/partials/nginx-helper-general-options.php:337 +msgid "Database" +msgstr "" + +#: admin/partials/nginx-helper-general-options.php:353 +msgid "Username" +msgstr "" + +#: admin/partials/nginx-helper-general-options.php:369 +msgid "Password" +msgstr "" + +#: admin/partials/nginx-helper-general-options.php:391 msgid "Purging Conditions" msgstr "" -#: admin/partials/nginx-helper-general-options.php:302 +#: admin/partials/nginx-helper-general-options.php:396 msgid "Purge Homepage:" msgstr "" -#: admin/partials/nginx-helper-general-options.php:309 +#: admin/partials/nginx-helper-general-options.php:403 msgid "when a post/page/custom post is modified or added." msgstr "" -#: admin/partials/nginx-helper-general-options.php:318 -#: admin/partials/nginx-helper-general-options.php:445 +#: admin/partials/nginx-helper-general-options.php:412 +#: admin/partials/nginx-helper-general-options.php:539 msgid "when a post (or page/custom post) is modified or added." msgstr "" -#: admin/partials/nginx-helper-general-options.php:330 +#: admin/partials/nginx-helper-general-options.php:424 msgid "when an existing post/page/custom post is modified." msgstr "" -#: admin/partials/nginx-helper-general-options.php:339 +#: admin/partials/nginx-helper-general-options.php:433 msgid "when a published post (or page/custom post) is trashed" msgstr "" -#: admin/partials/nginx-helper-general-options.php:353 +#: admin/partials/nginx-helper-general-options.php:447 msgid "Purge Post/Page/Custom Post Type:" msgstr "" -#: admin/partials/nginx-helper-general-options.php:370 +#: admin/partials/nginx-helper-general-options.php:464 msgid "when a post is published." msgstr "" -#: admin/partials/nginx-helper-general-options.php:382 -#: admin/partials/nginx-helper-general-options.php:479 +#: admin/partials/nginx-helper-general-options.php:476 +#: admin/partials/nginx-helper-general-options.php:573 msgid "when a comment is approved/published." msgstr "" -#: admin/partials/nginx-helper-general-options.php:391 -#: admin/partials/nginx-helper-general-options.php:488 +#: admin/partials/nginx-helper-general-options.php:485 +#: admin/partials/nginx-helper-general-options.php:582 msgid "when a comment is approved/published." msgstr "" -#: admin/partials/nginx-helper-general-options.php:403 -#: admin/partials/nginx-helper-general-options.php:500 +#: admin/partials/nginx-helper-general-options.php:497 +#: admin/partials/nginx-helper-general-options.php:594 msgid "when a comment is unapproved/deleted." msgstr "" -#: admin/partials/nginx-helper-general-options.php:412 -#: admin/partials/nginx-helper-general-options.php:509 +#: admin/partials/nginx-helper-general-options.php:506 +#: admin/partials/nginx-helper-general-options.php:603 msgid "when a comment is unapproved/deleted." msgstr "" -#: admin/partials/nginx-helper-general-options.php:426 +#: admin/partials/nginx-helper-general-options.php:520 msgid "Purge Archives:" msgstr "" -#: admin/partials/nginx-helper-general-options.php:428 +#: admin/partials/nginx-helper-general-options.php:522 msgid "(date, category, tag, author, custom taxonomies)" msgstr "" -#: admin/partials/nginx-helper-general-options.php:436 +#: admin/partials/nginx-helper-general-options.php:530 msgid "when an post/page/custom post is modified or added" msgstr "" -#: admin/partials/nginx-helper-general-options.php:457 +#: admin/partials/nginx-helper-general-options.php:551 msgid "when an existing post/page/custom post is trashed." msgstr "" -#: admin/partials/nginx-helper-general-options.php:466 +#: admin/partials/nginx-helper-general-options.php:560 msgid "when a published post (or page/custom post) is trashed." msgstr "" -#: admin/partials/nginx-helper-general-options.php:523 +#: admin/partials/nginx-helper-general-options.php:617 msgid "Purge Feeds:" msgstr "" -#: admin/partials/nginx-helper-general-options.php:532 +#: admin/partials/nginx-helper-general-options.php:626 msgid "purge feeds" msgstr "" -#: admin/partials/nginx-helper-general-options.php:541 +#: admin/partials/nginx-helper-general-options.php:635 msgid "purge feeds along with posts & pages." msgstr "" -#: admin/partials/nginx-helper-general-options.php:554 +#: admin/partials/nginx-helper-general-options.php:649 +msgid "Purge AMP URL:" +msgstr "" + +#: admin/partials/nginx-helper-general-options.php:658 +msgid "purge amp urls" +msgstr "" + +#: admin/partials/nginx-helper-general-options.php:667 +msgid "purge amp urls along with posts & pages." +msgstr "" + +#: admin/partials/nginx-helper-general-options.php:680 msgid "Custom Purge URL:" msgstr "" -#: admin/partials/nginx-helper-general-options.php:560 +#: admin/partials/nginx-helper-general-options.php:686 msgid "Add one URL per line. URL should not contain domain name." msgstr "" -#: admin/partials/nginx-helper-general-options.php:563 +#: admin/partials/nginx-helper-general-options.php:689 msgid "Eg: To purge http://example.com/sample-page/ add /sample-page/ in above textarea." msgstr "" -#: admin/partials/nginx-helper-general-options.php:567 +#: admin/partials/nginx-helper-general-options.php:693 msgid "'*' will only work with redis cache server." msgstr "" -#: admin/partials/nginx-helper-general-options.php:577 +#: admin/partials/nginx-helper-general-options.php:703 msgid "Debug Options" msgstr "" -#: admin/partials/nginx-helper-general-options.php:587 +#: admin/partials/nginx-helper-general-options.php:713 msgid "Enable Nginx Map." msgstr "" -#: admin/partials/nginx-helper-general-options.php:606 +#: admin/partials/nginx-helper-general-options.php:732 msgid "Enable Logging" msgstr "" -#: admin/partials/nginx-helper-general-options.php:611 +#: admin/partials/nginx-helper-general-options.php:737 msgid "disable" msgstr "" -#: admin/partials/nginx-helper-general-options.php:617 +#: admin/partials/nginx-helper-general-options.php:743 msgid "enable" msgstr "" -#: admin/partials/nginx-helper-general-options.php:624 +#: admin/partials/nginx-helper-general-options.php:750 msgid "NOTE" msgstr "" -#: admin/partials/nginx-helper-general-options.php:625 +#: admin/partials/nginx-helper-general-options.php:751 msgid "To" msgstr "" -#: admin/partials/nginx-helper-general-options.php:627 +#: admin/partials/nginx-helper-general-options.php:753 msgid "the logging feature, you must define" msgstr "" -#: admin/partials/nginx-helper-general-options.php:628 +#: admin/partials/nginx-helper-general-options.php:754 msgid "as" msgstr "" -#: admin/partials/nginx-helper-general-options.php:630 +#: admin/partials/nginx-helper-general-options.php:756 msgid "in your" msgstr "" -#: admin/partials/nginx-helper-general-options.php:641 +#: admin/partials/nginx-helper-general-options.php:767 msgid "Enable Nginx Timestamp in HTML" msgstr "" -#: admin/partials/nginx-helper-general-options.php:655 +#: admin/partials/nginx-helper-general-options.php:781 msgid "Nginx Map" msgstr "" -#: admin/partials/nginx-helper-general-options.php:664 +#: admin/partials/nginx-helper-general-options.php:790 msgid "Can't write on map file." msgstr "" #. translators: %s file url. -#: admin/partials/nginx-helper-general-options.php:669 -#: admin/partials/nginx-helper-general-options.php:741 +#: admin/partials/nginx-helper-general-options.php:795 +#: admin/partials/nginx-helper-general-options.php:867 msgid "Check you have write permission on %s" msgstr "" -#: admin/partials/nginx-helper-general-options.php:686 +#: admin/partials/nginx-helper-general-options.php:812 msgid "Nginx Map path to include in nginx settings" msgstr "" -#: admin/partials/nginx-helper-general-options.php:687 +#: admin/partials/nginx-helper-general-options.php:813 msgid "(recommended)" msgstr "" -#: admin/partials/nginx-helper-general-options.php:700 +#: admin/partials/nginx-helper-general-options.php:826 msgid "Or," msgstr "" -#: admin/partials/nginx-helper-general-options.php:701 +#: admin/partials/nginx-helper-general-options.php:827 msgid "Text to manually copy and paste in nginx settings" msgstr "" -#: admin/partials/nginx-helper-general-options.php:702 +#: admin/partials/nginx-helper-general-options.php:828 msgid "(if your network is small and new sites are not added frequently)" msgstr "" -#: admin/partials/nginx-helper-general-options.php:720 +#: admin/partials/nginx-helper-general-options.php:846 msgid "Logging Options" msgstr "" -#: admin/partials/nginx-helper-general-options.php:736 +#: admin/partials/nginx-helper-general-options.php:862 msgid "Can't write on log file." msgstr "" -#: admin/partials/nginx-helper-general-options.php:758 +#: admin/partials/nginx-helper-general-options.php:884 msgid "Logs path" msgstr "" -#: admin/partials/nginx-helper-general-options.php:770 +#: admin/partials/nginx-helper-general-options.php:896 msgid "View Log" msgstr "" -#: admin/partials/nginx-helper-general-options.php:775 +#: admin/partials/nginx-helper-general-options.php:901 msgid "Log" msgstr "" -#: admin/partials/nginx-helper-general-options.php:782 +#: admin/partials/nginx-helper-general-options.php:908 msgid "Log level" msgstr "" -#: admin/partials/nginx-helper-general-options.php:787 +#: admin/partials/nginx-helper-general-options.php:913 msgid "None" msgstr "" -#: admin/partials/nginx-helper-general-options.php:788 +#: admin/partials/nginx-helper-general-options.php:914 msgid "Info" msgstr "" -#: admin/partials/nginx-helper-general-options.php:789 +#: admin/partials/nginx-helper-general-options.php:915 msgid "Warning" msgstr "" -#: admin/partials/nginx-helper-general-options.php:790 +#: admin/partials/nginx-helper-general-options.php:916 msgid "Error" msgstr "" -#: admin/partials/nginx-helper-general-options.php:797 +#: admin/partials/nginx-helper-general-options.php:923 msgid "Max log file size" msgstr "" -#: admin/partials/nginx-helper-general-options.php:803 +#: admin/partials/nginx-helper-general-options.php:929 msgid "Mb" msgstr "" -#: admin/partials/nginx-helper-general-options.php:820 +#: admin/partials/nginx-helper-general-options.php:946 msgid "Save All Changes" msgstr "" @@ -653,6 +703,6 @@ msgid "Sorry, you need to be an administrator to use Nginx Helper" msgstr "" #. translators: %s is Minimum WP version. -#: includes/class-nginx-helper.php:311 +#: includes/class-nginx-helper.php:314 msgid "Sorry, Nginx Helper requires WordPress %s or higher" msgstr "" diff --git a/nginx-helper.php b/nginx-helper.php index 476662b7..af2508af 100644 --- a/nginx-helper.php +++ b/nginx-helper.php @@ -1,18 +1,18 @@ +``` + = Still need help! = -Please post your problem in [our free support forum](https://github.com/rtCamp/nginx-helper/issues). +Please post your problem in the github issues. == Screenshots == 1. Nginx plugin settings @@ -127,307 +132,22 @@ Please post your problem in [our free support forum](https://github.com/rtCamp/n == Changelog == -= 2.2.5 = -* Add the capability to enable/disable purging of feeds. [#281](https://github.com/rtCamp/nginx-helper/issues/281) - by [Amaan Khan](https://github.com/pathan-amaankhan) -* Fix undefined port error when Redis port is set to empty string. [#333](https://github.com/rtCamp/nginx-helper/issues/333) - by [Amaan Khan](https://github.com/pathan-amaankhan) - -= 2.2.4 = -* Introduces the capability to specify the `NGINX_HELPER_LOG` constant, allowing users to activate the logging feature. [#318](https://github.com/rtCamp/nginx-helper/pull/318) - by [Vishal Kakadiya](https://github.com/vishalkakadiya) -* Existing users employing the nginx-helper plugin with logging enabled will experience no disruptions. However, if logging is disabled, users must define the `NGINX_HELPER_LOG` constant to re-enable the logging feature. - -= 2.2.3 = -* Add the URL being purged as parameter in `rt_nginx_helper_purge_cached_file` hook. [#271](https://github.com/rtCamp/nginx-helper/pull/271) - by [Arafat Islam](https://github.com/arafatkn) -* Fix performance issue when saving nav menus. [#112](https://github.com/rtCamp/nginx-helper/issues/112), [#272](https://github.com/rtCamp/nginx-helper/pull/272/) - by [Arafat Islam](https://github.com/arafatkn) -* Fix purging date archives for custom post types. [#40](https://github.com/rtCamp/nginx-helper/issues/40), [#268](https://github.com/rtCamp/nginx-helper/pull/268) - by [Arafat Islam](https://github.com/arafatkn) -* Fix pages and CPT URLs not being purged on moving to trash. [#191](https://github.com/rtCamp/nginx-helper/issues/191), [#267](https://github.com/rtCamp/nginx-helper/pull/267) - by [Arafat Islam](https://github.com/arafatkn) -* Fix notice - Undefined index: path [#190](https://github.com/rtCamp/nginx-helper/issues/190), [#251](https://github.com/rtCamp/nginx-helper/issues/251), [#262](https://github.com/rtCamp/nginx-helper/pull/262) - by [George Lagonikas](https://github.com/glagonikas) -* PHP 8.1 compatibility [#291](https://github.com/rtCamp/nginx-helper/issues/291), [#302](https://github.com/rtCamp/nginx-helper/pull/302) - by [Siddharth Tikekar](https://github.com/SID177) -* Tested with WordPress 6.1 [#285](https://github.com/rtCamp/nginx-helper/pull/285) - -= 2.2.2 = -* Add action `rt_nginx_helper_after_purge_all` to fire after the entire cache has been purged whatever caching type is used. [#232](https://github.com/rtCamp/nginx-helper/pull/232) - by [Julien-prrs](https://github.com/Julien-prrs) -* Fix issue where settings not saved because the button's value localized (for any language). [#236](https://github.com/rtCamp/nginx-helper/pull/236) - by [umeshnevase](https://github.com/umeshnevase) -* Fix issue where "Custom Purge URL" option displays previous value. [#240](https://github.com/rtCamp/nginx-helper/issues/240), [#241](https://github.com/rtCamp/nginx-helper/pull/241) - by [KirillGritcenko](https://github.com/KirillGritcenko) -* Tested with WordPress 5.4 - -= 2.2.1 = -* Fix timeout issue on FastCGI cache purge. [#229](https://github.com/rtCamp/nginx-helper/pull/229) - by [chandrapatel](https://github.com/chandrapatel), [thrijith](https://github.com/thrijith) - -= 2.2.0 = -* Add filter `rt_nginx_helper_fastcgi_purge_suffix` to change purge suffix for FastCGI cache. [#141](https://github.com/rtCamp/nginx-helper/pull/141) - by [stayallive](https://github.com/stayallive) -* Add filter `rt_nginx_helper_fastcgi_purge_url_base` to change purge URL base for FastCGI cache. [#141](https://github.com/rtCamp/nginx-helper/pull/141) - by [stayallive](https://github.com/stayallive) -* Update our code to be in line with WordPress Coding standards in various places. [#209](https://github.com/rtCamp/nginx-helper/pull/209), [#225](https://github.com/rtCamp/nginx-helper/pull/225) - by [abhijitrakas](https://github.com/abhijitrakas), [chandrapatel](https://github.com/chandrapatel) -* Check and verify purging is enabled before purging cache. [#168](https://github.com/rtCamp/nginx-helper/pull/168) - by [jaredwsmith](https://github.com/jaredwsmith) -* Hide Purge Cache button in admin bar when purge is disabled. [#218](https://github.com/rtCamp/nginx-helper/issues/218), [#219](https://github.com/rtCamp/nginx-helper/pull/219) - by [mbautista](https://github.com/mbautista), [chandrapatel](https://github.com/chandrapatel) -* Don't add Nginx Timestamp on WordPress login page. [#204](https://github.com/rtCamp/nginx-helper/issues/204), [#220](https://github.com/rtCamp/nginx-helper/pull/220) - by [peixotorms](https://github.com/peixotorms), [chandrapatel](https://github.com/chandrapatel) - -= 2.1.0 = -* Add wildcard cache key deletion for device type cache purge. [#203](https://github.com/rtCamp/nginx-helper/pull/203) - by [pradeep910](https://github.com/pradeep910) -* Add filter `rt_nginx_helper_purge_url` to filter the URL to be purged. [#182](https://github.com/rtCamp/nginx-helper/pull/182) - by [todeveni](https://github.com/todeveni) -* Add filter `rt_nginx_helper_purge_cached_file` to filter the cached file name. [#182](https://github.com/rtCamp/nginx-helper/pull/182) - by [todeveni](https://github.com/todeveni) -* Add filter `rt_nginx_helper_remote_purge_url` to filter remote URL to be purged. [#182](https://github.com/rtCamp/nginx-helper/pull/182) - by [todeveni](https://github.com/todeveni) -* Add action `rt_nginx_helper_after_fastcgi_purge_all` to fire after the FastCGI cache has been purged. [#182](https://github.com/rtCamp/nginx-helper/pull/182) - by [todeveni](https://github.com/todeveni) -* Add action `rt_nginx_helper_after_redis_purge_all` to fire after the Redis cache has been purged. [#182](https://github.com/rtCamp/nginx-helper/pull/182) - by [todeveni](https://github.com/todeveni) -* Add action `rt_nginx_helper_purged_file` to fire an action after deleting file from cache. [#182](https://github.com/rtCamp/nginx-helper/pull/182) - by [todeveni](https://github.com/todeveni) -* Add action `rt_nginx_helper_before_remote_purge_url` to fire an action before purging remote URL. [#182](https://github.com/rtCamp/nginx-helper/pull/182) - by [todeveni](https://github.com/todeveni) -* Add action `rt_nginx_helper_after_remote_purge_url` to fire an action after remote purge request. [#182](https://github.com/rtCamp/nginx-helper/pull/182) - by [todeveni](https://github.com/todeveni) -* Fix issue with post purge on new comments. [#175](https://github.com/rtCamp/nginx-helper/pull/175) - by [jinschoi](https://github.com/jinschoi) -* Fix Nginx Timestamp being added to invalid content type. [#200](https://github.com/rtCamp/nginx-helper/pull/200) - by [thrijith](https://github.com/thrijith) -* Handle filesize exception while truncating nginx.log file. [#206](https://github.com/rtCamp/nginx-helper/pull/206) - by [peterjanes](https://github.com/peterjanes) - -= 2.0.3 = -* Update article link for fastcgi cache purge. [#187](https://github.com/rtCamp/nginx-helper/pull/187) - by [gagan0123](https://github.com/gagan0123) -* Fix map generation issue on `SUBDOMAIN_INSTALL`. [#189](https://github.com/rtCamp/nginx-helper/pull/189) - by [ChrisHardie](https://github.com/ChrisHardie) - -= 2.0.2 = -* Fix undefined error when we install the plugin for the first time and if Redis is not available. [#162](https://github.com/rtCamp/nginx-helper/pull/162) - by [Joel-James](https://github.com/Joel-James) -* Remove extra spacing for nginx map section. [#169](https://github.com/rtCamp/nginx-helper/pull/169) - by [ShashwatMittal](https://github.com/ShashwatMittal) -* Purge Cache menu in front-end admibar now purge current page. [#173](https://github.com/rtCamp/nginx-helper/pull/173) - by [imranhsayed](https://github.com/imranhsayed) -* Fix issue where cache is not cleared when page is swiched from publish to draft. [#174](https://github.com/rtCamp/nginx-helper/pull/174) - by [imranhsayed](https://github.com/imranhsayed) -* Fix an issue where custom purge url option does not show newlines when using multiple urls. [#184](https://github.com/rtCamp/nginx-helper/issues/184) - by [mist-webit](https://github.com/mist-webit) - -= 2.0.1 = -* Fix settings url for multisite: use network_admin_url to get network correct settings url. [#163](https://github.com/rtCamp/nginx-helper/pull/163) - by [Joel-James](https://github.com/Joel-James) -* Fix php error with arbitrary statement in empty - Prior to PHP 5.5. [#165](https://github.com/rtCamp/nginx-helper/pull/165) - by [PatelUtkarsh](https://github.com/PatelUtkarsh) - -= 2.0.0 = -* Fix typo causing failure to purge on trashed comment. [#159](https://github.com/rtCamp/nginx-helper/pull/159) - by [jinschoi](https://github.com/jinschoi) -* Refactor Plugin structure and remove unused code. Initial code by [chandrapatel](https://github.com/chandrapatel), [#153](https://github.com/rtCamp/nginx-helper/pull/153) - by [jinschoi](https://github.com/kelin1003), -* Run phpcs and fix warning. [#158](https://github.com/rtCamp/nginx-helper/pull/158) -* Make compatible with EasyEngine v4. - -= 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) - -= 1.9.10 = -* 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) -* 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) - -= 1.9.9 = -* Fix wp_redirect issue. [#131](https://github.com/rtCamp/nginx-helper/pull/131) - by [matt-h](https://github.com/matt-h) - -= 1.9.8 = -* Fixed homepage cache cleared when WPML plugin used [#116](https://github.com/rtCamp/nginx-helper/pull/116) - by [Niwreg](https://profiles.wordpress.org/niwreg/) -* Fixed Purge Cache clears the whole Redis cache [#113](https://github.com/rtCamp/nginx-helper/issues/113) - by HansVanEijsden -* One log file for all site in WPMU. -* Single site Redis cache purge when click on Purge Cache button in WPMU [#122](https://github.com/rtCamp/nginx-helper/pull/122) - by Lars Støttrup Nielsen -* Fixed notices and warnings. - -= 1.9.7 = -* Remove timestamp if cron or wp-cli [#114](https://github.com/rtCamp/nginx-helper/pull/114) - by [samedwards](https://profiles.wordpress.org/samedwards/) -* Fixed notices and warnings. - -= 1.9.6 = -* Fixed cache purging on post publish. -* Error fixed when redis server not installed. - -= 1.9.5 = -Added custom purge URL option. - -= 1.9.4 = -* Added redis server connection timeout. -* Added RedisException handling. - -= 1.9.3 = -* Added PhpRedis API support. -* Added redis-lua script support to purge complete cache very fast. -* Added composer.json support -* Fixed cache purging link in admin bar. -* Updated the initial settings to include the 'purge_method' [#99](https://github.com/rtCamp/nginx-helper/pull/99) - by -[gagan0123](https://github.com/gagan0123) - -= 1.9.2 = -Fix purging for Redis cache and FastCGI cache - -= 1.9.1 = -Fix purging for custom post types - -= 1.9 = -Added Redis cache purge support. - -= 1.8.13 = -Fixed PHP notice for an undefined index when "Enable Logging" is not set. - -= 1.8.12 = -Updated readme and changelog - -= 1.8.11 = -Fix url escaping [#82](https://github.com/rtCamp/nginx-helper/pull/82) - by -[javisperez](https://github.com/javisperez) - -= 1.8.10 = -* Security bug fix - -= 1.8.9 = -* Default setting fix and wp-cli example correction - by [bcole808](https://profiles.wordpress.org/bcole808/) - -= 1.8.8 = -* Added option to purge cache without nginx purge module - by [bcole808](https://profiles.wordpress.org/bcole808/) - -= 1.8.7 = -* Added action `rt_nginx_helper_purge_all` to purge cache from other plugins - by [gungeekatx](https://profiles.wordpress.org/gungeekatx/) - -= 1.8.6 = -* Removed wercker.yml from plugin zip/svn. -* Updated readme - -= 1.8.5 = -* Added WP_CLI support - by [Udit Desai](https://profiles.wordpress.org/desaiuditd/) - -= 1.8.4 = -* Fix undefined index issue and correct "purge_archive_on_del" key - -= 1.8.3 = -* Tested with WordPress 4.0 -* Fix issue #69 - -= 1.8.1 = -* Tested with wordpress 3.9.1 -* Fix confilct with Mailchimp's Social plugin - -= 1.8 = -* New admin UI -* Fix missing wp_sanitize_redirect function call - -= 1.7.6 = -* Update Backend UI -* Added Language Support - -= 1.7.5 = -* Fixed option name mismatch issue to purge homepage on delete. - -= 1.7.4 = -* Disable purge and stamp by default. - -= 1.7.3 = -* Suppressed `unlink` related error-messages which can be safely ignored. -* Fixed a bug in purge-all option. - -= 1.7.2 = -* [pjv](http://profiles.wordpress.org/pjv/) fixed bug in logging file. - -= 1.7.1 = -* Fixes bug in true purge and admin screen. - -= 1.7 = -* True full cache purge added. -* Map file location changed to uploads' directory to fix http://rtcamp.com/support/topic/plugin-update-removes-map-file/ -* Log file location also changed to uploads' directory. - -= 1.6.13 = -* [pjv](http://profiles.wordpress.org/pjv/) changed the way home URL is accessed. Instead of site option, the plugin now uses home_URL() function. - -= 1.6.12 = -* [telofy](http://wordpress.org/support/profile/telofy) added purging of atom and RDF feeds. - -= 1.6.11 = -* Removed comments from Admin screens since, it was interfering with media uploads in 3.5 up. - -= 1.6.10 = -* Cleaned up code. -* Added credits for code. -* Improved attachment purging. - -= 1.6.9 = -* Added Faux to Purge all buttons, to avoid misleading users. - -= 1.6.8 = -* [daankortenbach](http://profiles.wordpress.org/daankortenbach) added Purge Cache link to wp-admin bar - -= 1.6.7 = -* [jk3us](http://profiles.wordpress.org/jk3us) added better content-type detection for cache verification comments - -= 1.6.6 = -* [darren-slatten](http://profiles.wordpress.org/darren-slatten/) added Manual 'Purge all URLs' functionality - -= 1.6.5 = -* Fixed typo that interfered with archive purge settings. Thanks to [Daan Kortenbach](http://profiles.wordpress.org/daankortenbach/) for pointing this out. - -= 1.6.4 = -* Improved code for map generation to better conventions since the nesting confused some servers. -* Added map update process to admin_init for frequent refreshes. - -= 1.6.3 = -* Fixed duplicate entries. - -= 1.6.2 = -* Another bug fix in the revised code for improved multisite and multidomain mapping. - -= 1.6.1 = -* Fixed bug in the revised code for improved multisite and multidomain mapping. - -= 1.6 = -* Revised code for improved multisite and multidomain mapping. - -= 1.5 = -* Timestamp now only gets added to content-type text/html -* Added option to toggle timestamp creation - -= 1.4 = -* Fixed bug related to nomenclature of comment status that caused purge to fail. - -= 1.3.9 = -* Removed extraneous headers. - -= 1.3.8 = - -* Fixed bug in single post/page/post-type purging code. Thanks to Greg for pointing this out here: http://rtcamp.com/support/topic/updating-post-nginx-helper-purge-cache-post/. - -= 1.3.7 = - -* Changed the action hook, back to 'shutdown' from 'wp_footer' to add verification comments. -* Added a check to prevent adding comments to ajax requests, - -= 1.3.6 = - -* Changed the action hook, from 'shutdown' to 'wp_footer' to add verification comments. This was interfering with other plugins. - -= 1.3.5 = - -* Improved Readme. -* Improved cache verification comments. - -= 1.3.4 = - -* 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/wordpress-nginx/tutorials/checklist/ - -= 1.3.3 = - -* Fixed map generation for multi domain installs using domain mapping plugin, where blog ids were not displayed. - -= 1.3.2 = - -* Fixed map generation for multi domain installs with domain mapping plugin. - -= 1.3.1 = - -* Minor fixes for directory structure and file names. - -= 1.3 = - -* Improved Readme. - -= 1.2 = - -* Fixed map generation error. -* Fixed purging logic. -* Fixed UI where purge settings were lost on disabling and re-enabling purge. -* Minor Ui rearrangement. - -= 1.1 = += 9.9.10 = -* Improved readme.txt. Added Screenshots. +Pulled in rtCamp fixes from their version - 2.3.0 and 2.3.1 -= 1.0 = +* Update the contributors list and tags for the plugin. [#378](https://github.com/rtCamp/nginx-helper/issues/378) - by [Vedant Gandhi](https://github.com/Vedant-Gandhi) +* Disable the purge functionality when importing data. [#52](https://github.com/rtCamp/nginx-helper/pull/52) - by [Vedant Gandhi](https://github.com/Vedant-Gandhi) +* Added option to preload cache for all Post and Pages. [#47](https://github.com/rtCamp/nginx-helper/pull/47) - by [Vedant Gandhi](https://github.com/Vedant-Gandhi) +* Added the capability to purge Amp URL's. [#135](https://github.com/rtCamp/nginx-helper/pull/135) - by [Vedant Gandhi](https://github.com/Vedant-Gandhi) +* Add capability to allow modifying options using WP-CLI. [#307](https://github.com/rtCamp/nginx-helper/pull/307) - by [Vedant Gandhi](https://github.com/Vedant-Gandhi) +* Fix the plugin crash issue due to internationalization after upgrading to WordPress Version 6.7. [#364](https://github.com/rtCamp/nginx-helper/pull/364) - by [Vedant Gandhi](https://github.com/Vedant-Gandhi) -* First release -== Upgrade Notice == += 9.9.9 = -= 2.2.3 = -Nginx Helper 2.2.3, Fix performance issue when saving nav menus, purging date archives for CPTs, purge page and post URLs when the post is trashed and passes the URL being purged in "rt_nginx_helper_purge_cached_file" hook as parameter. +* Add support for adding Username, Password support for Redis. It also includes the support for Unix Socket Path for Redis along with Database selection - by [Jeff Cleverley](https://github.com/gridpane) +* Added exclude filters for cache purging of home page - by [Jeff Cleverley](https://github.com/gridpane) +* Added Ability to configure all options by Constants - by [Jeff Cleverley](https://github.com/gridpane) +* Added Ability to purge fastcgi cache purge using the Torden Module - by [Jeff Cleverley](https://github.com/gridpane) +* All Previous rtCamp Nginx-Helper code up to 2.5.0 \ No newline at end of file diff --git a/uninstall.php b/uninstall.php index dfa8d76a..02434d69 100644 --- a/uninstall.php +++ b/uninstall.php @@ -18,8 +18,8 @@ * For more information, see the following discussion: * https://github.com/tommcfarlin/WordPress-Plugin-Boilerplate/pull/123#issuecomment-28541913 * - * @link https://rtcamp.com/nginx-helper/ - * @since 2.0.0 + * @link https://gridpane.com + * @since 9.9.10 * * @package nginx-helper */
- + - - - -
- - - - + +