diff --git a/Development.md b/Development.md new file mode 100644 index 0000000..82349f6 --- /dev/null +++ b/Development.md @@ -0,0 +1,52 @@ +# Development +[ For internal contributors only ] + +## Getting Started + +To set up the repo locally, choose one of the following methods: + +### Method 1 (For FastCGI or Srcache) + +1. Create a WordPress website. +2. Clone the [nginx](https://github.com/nginx/nginx) source code in a separate directory. +3. Set up nginx using either FastCGI cache or Srcache module. +4. Manually compile the binary for Nginx. +5. Add a configuration block to redirect incoming requests to the WordPress website. +6. Clone this repository inside the `wp-content/plugins` directory. + +### Method 2 (For Redis Cache) + +1. Install EasyEngine by following the [instructions](https://easyengine.io/docs/install/). +2. Create a site with caching enabled using the command: `ee site create --cache` + +3. Clone this repository inside the `wp-content/plugins` directory of the newly created site. + +## Testing + +To verify if a page is cached: + +1. Enable the timestamp option in Nginx Helper from the WordPress Admin Page: +- This adds a comment with cache time and query count. +- Cached pages should show only 1 query. + +2. Manually check the Redis database: +- Search for keys beginning with the prefix specified in your Redis config, followed by a URL. + +## Contributing + +### Raising a Pull Request (PR) + +1. Create a new branch from `master` for your changes. +2. Make your changes and commit them to your branch. +3. Raise a PR targeting the `develop` branch. +4. Assign the PR to a reviewer. +5. Address any feedback and make necessary changes. +6. Once approved, merge the PR into the `develop` branch. + +### Merging to Master + +1. After thorough testing on the `develop` branch, create a new PR. +2. Set the source branch as the original feature branch that was merged into `develop`. +3. Set the target branch as `master`. +4. Assign reviewers and await final approval. +5. Once approved, merge the PR into the `master` branch. \ No newline at end of file diff --git a/README.md b/README.md index fee3ca7..70de764 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # 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 +**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, Vedant-Gandhi **Tags:** nginx, cache, purge, nginx map, nginx cache, maps, fastcgi, proxy, redis, redis-cache, rewrite, permalinks diff --git a/admin/class-nginx-helper-admin.php b/admin/class-nginx-helper-admin.php index 3c99f18..2618135 100644 --- a/admin/class-nginx-helper-admin.php +++ b/admin/class-nginx-helper-admin.php @@ -341,7 +341,7 @@ public function nginx_helper_settings() { $data['cache_method'] = 'enable_redis'; $data['redis_hostname'] = RT_WP_NGINX_HELPER_REDIS_HOSTNAME; $data['redis_port'] = RT_WP_NGINX_HELPER_REDIS_PORT; - $data['redis_prefix'] = RT_WP_NGINX_HELPER_REDIS_PREFIX; + $data['redis_prefix'] = RT_WP_NGINX_HELPER_REDIS_PREFIX; return $data; diff --git a/admin/partials/nginx-helper-general-options.php b/admin/partials/nginx-helper-general-options.php index a91eb53..705fcb2 100644 --- a/admin/partials/nginx-helper-general-options.php +++ b/admin/partials/nginx-helper-general-options.php @@ -40,6 +40,7 @@ 'purge_page_on_deleted_comment', 'purge_feeds', 'smart_http_expire_form_nonce', + 'preload_cache', ); $all_inputs = array(); @@ -126,6 +127,12 @@ + + + /> + + + diff --git a/includes/class-nginx-helper.php b/includes/class-nginx-helper.php index f96e6d0..71cb137 100644 --- a/includes/class-nginx-helper.php +++ b/includes/class-nginx-helper.php @@ -227,6 +227,9 @@ 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' ); } /**