From d853df3ae7d9b8cc0b4aef1b07ab3fa781d4fffc Mon Sep 17 00:00:00 2001 From: Vedant Gandhi Date: Thu, 8 Aug 2024 14:24:57 +0530 Subject: [PATCH 01/66] feat: disable purge all for import request. --- admin/class-nginx-helper-admin.php | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/admin/class-nginx-helper-admin.php b/admin/class-nginx-helper-admin.php index f91289a..3fe0fa0 100644 --- a/admin/class-nginx-helper-admin.php +++ b/admin/class-nginx-helper-admin.php @@ -96,6 +96,10 @@ public function __construct( $plugin_name, $version ) { ); $this->options = $this->nginx_helper_settings(); + + if( $this->is_import_request() ) { + $this->options['enable_purge'] = false; + } } @@ -698,6 +702,10 @@ 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; @@ -775,5 +783,16 @@ public function purge_all() { public function display_notices() { echo '

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

'; } + + /** + * Determines if the current request is for importing Posts/ WordPress content. + * + * @return bool + */ + public function is_import_request() { + $import_query_var = get_query_var( 'import' ); + $has_import_started = did_action( 'import_start' ); + return (defined( 'WP_IMPORTING' ) && true === WP_IMPORTING) || 0 === $has_import_started || ! empty( $import_query_var ); + } } From ac53b89fb51757160332f8685e54e4529bf7afb1 Mon Sep 17 00:00:00 2001 From: Vedant Gandhi Date: Thu, 8 Aug 2024 14:36:56 +0530 Subject: [PATCH 02/66] refactor: remove extra spaces. --- admin/class-nginx-helper-admin.php | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/admin/class-nginx-helper-admin.php b/admin/class-nginx-helper-admin.php index 3fe0fa0..a158e5d 100644 --- a/admin/class-nginx-helper-admin.php +++ b/admin/class-nginx-helper-admin.php @@ -96,11 +96,6 @@ public function __construct( $plugin_name, $version ) { ); $this->options = $this->nginx_helper_settings(); - - if( $this->is_import_request() ) { - $this->options['enable_purge'] = false; - } - } /** @@ -706,7 +701,7 @@ public function purge_all() { if( $this->is_import_request() ) { return; } - + global $nginx_purger, $wp; $method = null; @@ -790,9 +785,10 @@ public function display_notices() { * @return bool */ public function is_import_request() { - $import_query_var = get_query_var( 'import' ); + $import_query_var = sanitize_text_field( $_GET['import'] ?? '' ); $has_import_started = did_action( 'import_start' ); - return (defined( 'WP_IMPORTING' ) && true === WP_IMPORTING) || 0 === $has_import_started || ! empty( $import_query_var ); + + return (defined( 'WP_IMPORTING' ) && true === WP_IMPORTING) || 0 !== $has_import_started || ! empty( $import_query_var ); } } From be1d0f78d57ffb7108d900cfbc39c8d6312f9da6 Mon Sep 17 00:00:00 2001 From: Vedant Gandhi Date: Thu, 8 Aug 2024 14:38:36 +0530 Subject: [PATCH 03/66] feat: add contribution name. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 From e56078b38496b24fb99c767bfbc83528a02ae66f Mon Sep 17 00:00:00 2001 From: Vedant Gandhi Date: Fri, 9 Aug 2024 19:19:35 +0530 Subject: [PATCH 04/66] fix: phpcs errors. --- admin/class-nginx-helper-admin.php | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/admin/class-nginx-helper-admin.php b/admin/class-nginx-helper-admin.php index a158e5d..9dbce60 100644 --- a/admin/class-nginx-helper-admin.php +++ b/admin/class-nginx-helper-admin.php @@ -698,10 +698,10 @@ public function update_new_blog_options( $blog_id ) { */ public function purge_all() { - if( $this->is_import_request() ) { + if ( $this->is_import_request() ) { return; } - + global $nginx_purger, $wp; $method = null; @@ -782,13 +782,16 @@ public function display_notices() { /** * Determines if the current request is for importing Posts/ WordPress content. * - * @return bool + * @return bool True if the request is for importing, false otherwise. */ public function is_import_request() { - $import_query_var = sanitize_text_field( $_GET['import'] ?? '' ); + $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 ); + + return ( defined( 'WP_IMPORTING' ) && true === WP_IMPORTING ) + || 0 !== $has_import_started + || ! empty( $import_query_var ); } - + + } From a166c1f923dfd99a4e9b99f066fc4e2025b1c249 Mon Sep 17 00:00:00 2001 From: Vedant Gandhi Date: Fri, 9 Aug 2024 19:21:41 +0530 Subject: [PATCH 05/66] feat: add disable purge. --- admin/class-nginx-helper-admin.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/admin/class-nginx-helper-admin.php b/admin/class-nginx-helper-admin.php index 9dbce60..109aaf7 100644 --- a/admin/class-nginx-helper-admin.php +++ b/admin/class-nginx-helper-admin.php @@ -604,7 +604,7 @@ 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; } From 7483a8d18d395ce9eade45839742fab0c7b3745a Mon Sep 17 00:00:00 2001 From: Vedant Gandhi Date: Fri, 9 Aug 2024 19:22:43 +0530 Subject: [PATCH 06/66] refactor: add proper spacing. --- admin/class-nginx-helper-admin.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/admin/class-nginx-helper-admin.php b/admin/class-nginx-helper-admin.php index 109aaf7..ca48454 100644 --- a/admin/class-nginx-helper-admin.php +++ b/admin/class-nginx-helper-admin.php @@ -785,7 +785,7 @@ public function display_notices() { * @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. + $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 ) From 55a5631cbb14be127602566d51647b15df298ce7 Mon Sep 17 00:00:00 2001 From: Vedant Gandhi Date: Tue, 20 Aug 2024 16:40:35 +0530 Subject: [PATCH 07/66] feat: add filter to set the cache path for nginx. --- includes/class-nginx-helper.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/includes/class-nginx-helper.php b/includes/class-nginx-helper.php index f96e6d0..0460914 100644 --- a/includes/class-nginx-helper.php +++ b/includes/class-nginx-helper.php @@ -85,7 +85,8 @@ public function __construct() { } if ( ! defined( 'RT_WP_NGINX_HELPER_CACHE_PATH' ) ) { - define( 'RT_WP_NGINX_HELPER_CACHE_PATH', '/var/run/nginx-cache' ); + $cache_path = apply_filters( 'rt_wp_nginx_helper_cache_path', '/var/run/nginx-cache' ); + define( 'RT_WP_NGINX_HELPER_CACHE_PATH', $cache_path ); } $this->load_dependencies(); From 367d97c09add545f4efe569df6f1eb82243baec3 Mon Sep 17 00:00:00 2001 From: Vedant Gandhi Date: Thu, 5 Sep 2024 13:42:58 +0530 Subject: [PATCH 08/66] feat: add input element to accept redis database. --- admin/partials/nginx-helper-general-options.php | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/admin/partials/nginx-helper-general-options.php b/admin/partials/nginx-helper-general-options.php index a91eb53..af14488 100644 --- a/admin/partials/nginx-helper-general-options.php +++ b/admin/partials/nginx-helper-general-options.php @@ -22,6 +22,7 @@ 'redis_hostname', 'redis_port', 'redis_prefix', + 'redis_database', 'purge_homepage_on_edit', 'purge_homepage_on_del', 'purge_url', @@ -288,6 +289,21 @@ ?> + + + + /> + '; + esc_html_e( 'Overridden by constant variables.', 'nginx-helper' ); + echo '

'; + + } + ?> + + From 14eca80cd6cd4e36c69c7dd9644af2679f041c1c Mon Sep 17 00:00:00 2001 From: Vedant Gandhi Date: Thu, 5 Sep 2024 13:43:26 +0530 Subject: [PATCH 09/66] feat: add database while connecting to redis. --- admin/class-nginx-helper-admin.php | 3 +++ admin/class-phpredis-purger.php | 4 ++++ admin/class-predis-purger.php | 5 +++-- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/admin/class-nginx-helper-admin.php b/admin/class-nginx-helper-admin.php index f91289a..2aff242 100644 --- a/admin/class-nginx-helper-admin.php +++ b/admin/class-nginx-helper-admin.php @@ -276,6 +276,7 @@ public function nginx_helper_default_settings() { 'redis_hostname' => '127.0.0.1', 'redis_port' => '6379', 'redis_prefix' => 'nginx-cache:', + 'redis_database' => 0, 'purge_url' => '', 'redis_enabled_by_constant' => 0, ); @@ -295,6 +296,7 @@ public function nginx_helper_settings() { 'redis_hostname' => '127.0.0.1', 'redis_port' => '6379', 'redis_prefix' => 'nginx-cache:', + 'redis_database' => 0, ) ); @@ -319,6 +321,7 @@ public function nginx_helper_settings() { $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_database'] = defined('RT_WP_NGINX_HELPER_REDIS_DATABASE') ? RT_WP_NGINX_HELPER_REDIS_DATABASE : 0; return $data; diff --git a/admin/class-phpredis-purger.php b/admin/class-phpredis-purger.php index 10a8483..8aa7669 100644 --- a/admin/class-phpredis-purger.php +++ b/admin/class-phpredis-purger.php @@ -44,6 +44,10 @@ public function __construct() { $nginx_helper_admin->options['redis_port'], 5 ); + + if( $nginx_helper_admin->options['redis_database'] !== 0 ) { + $this->redis_object->select($nginx_helper_admin->options['redis_database']); + } } catch ( Exception $e ) { $this->log( $e->getMessage(), 'ERROR' ); diff --git a/admin/class-predis-purger.php b/admin/class-predis-purger.php index 1290a0d..0fb99a7 100644 --- a/admin/class-predis-purger.php +++ b/admin/class-predis-purger.php @@ -41,8 +41,9 @@ public function __construct() { // redis server parameter. $this->redis_object = new Predis\Client( array( - 'host' => $nginx_helper_admin->options['redis_hostname'], - 'port' => $nginx_helper_admin->options['redis_port'], + 'host' => $nginx_helper_admin->options['redis_hostname'], + 'port' => $nginx_helper_admin->options['redis_port'], + 'database' => $nginx_helper_admin->options['redis_database'], ) ); From 8c58de3f6302a41db40abac817183a61b1792af7 Mon Sep 17 00:00:00 2001 From: Vedant Gandhi Date: Thu, 5 Sep 2024 17:27:38 +0530 Subject: [PATCH 10/66] feat: modify the redis database selection. --- admin/class-predis-purger.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/admin/class-predis-purger.php b/admin/class-predis-purger.php index 0fb99a7..9fffe5b 100644 --- a/admin/class-predis-purger.php +++ b/admin/class-predis-purger.php @@ -41,11 +41,14 @@ public function __construct() { // redis server parameter. $this->redis_object = new Predis\Client( array( - 'host' => $nginx_helper_admin->options['redis_hostname'], - 'port' => $nginx_helper_admin->options['redis_port'], - 'database' => $nginx_helper_admin->options['redis_database'], + 'host' => $nginx_helper_admin->options['redis_hostname'], + 'port' => $nginx_helper_admin->options['redis_port'], ) ); + + if( $nginx_helper_admin->options['redis_database'] !== 0 ) { + $this->redis_object->select($nginx_helper_admin->options['redis_database']); + } try { $this->redis_object->connect(); From 2258c1ac1fddcb32950bbb0fb19f956347369b94 Mon Sep 17 00:00:00 2001 From: Vedant Gandhi Date: Thu, 5 Sep 2024 17:49:06 +0530 Subject: [PATCH 11/66] feat: add acl support for redis. --- admin/class-nginx-helper-admin.php | 2 ++ admin/class-phpredis-purger.php | 16 ++++++++- admin/class-predis-purger.php | 5 +++ .../partials/nginx-helper-general-options.php | 34 +++++++++++++++++++ 4 files changed, 56 insertions(+), 1 deletion(-) diff --git a/admin/class-nginx-helper-admin.php b/admin/class-nginx-helper-admin.php index 2aff242..8def3cc 100644 --- a/admin/class-nginx-helper-admin.php +++ b/admin/class-nginx-helper-admin.php @@ -277,6 +277,8 @@ public function nginx_helper_default_settings() { 'redis_port' => '6379', 'redis_prefix' => 'nginx-cache:', 'redis_database' => 0, + 'redis_username' => '', + 'redis_password' => '', 'purge_url' => '', 'redis_enabled_by_constant' => 0, ); diff --git a/admin/class-phpredis-purger.php b/admin/class-phpredis-purger.php index 8aa7669..761d67d 100644 --- a/admin/class-phpredis-purger.php +++ b/admin/class-phpredis-purger.php @@ -39,10 +39,24 @@ public function __construct() { try { $this->redis_object = new Redis(); + + $redis_acl = array(); + + $username = $nginx_helper_admin->options['redis_username']; + $password = $nginx_helper_admin->options['redis_password']; + + if( $username && $password ) { + $redis_acl['auth'] = array( $username, $password ); + } + $this->redis_object->connect( $nginx_helper_admin->options['redis_hostname'], $nginx_helper_admin->options['redis_port'], - 5 + 5, + null, + 0, + 0, + $redis_acl ); if( $nginx_helper_admin->options['redis_database'] !== 0 ) { diff --git a/admin/class-predis-purger.php b/admin/class-predis-purger.php index 9fffe5b..ea64d50 100644 --- a/admin/class-predis-purger.php +++ b/admin/class-predis-purger.php @@ -37,12 +37,17 @@ public function __construct() { } Predis\Autoloader::register(); + + $username = $nginx_helper_admin->options['redis_username']; + $password = $nginx_helper_admin->options['redis_password']; // redis server parameter. $this->redis_object = new Predis\Client( array( 'host' => $nginx_helper_admin->options['redis_hostname'], 'port' => $nginx_helper_admin->options['redis_port'], + 'username' => $username, + 'password' => $password, ) ); diff --git a/admin/partials/nginx-helper-general-options.php b/admin/partials/nginx-helper-general-options.php index af14488..722dedd 100644 --- a/admin/partials/nginx-helper-general-options.php +++ b/admin/partials/nginx-helper-general-options.php @@ -23,6 +23,8 @@ 'redis_port', 'redis_prefix', 'redis_database', + 'redis_username', + 'redis_password', 'purge_homepage_on_edit', 'purge_homepage_on_del', 'purge_url', @@ -304,6 +306,38 @@ ?> + + + + + /> + '; + esc_html_e( 'Overridden by constant variables.', 'nginx-helper' ); + echo '

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

'; + + } + ?> + + From e489543b3637ce7a509cc92b05eb5c8bc1ab990d Mon Sep 17 00:00:00 2001 From: Vedant Gandhi Date: Fri, 6 Sep 2024 12:07:34 +0530 Subject: [PATCH 12/66] feat: add unix socket. --- admin/class-nginx-helper-admin.php | 23 ++++++---- admin/class-phpredis-purger.php | 7 +++- admin/class-predis-purger.php | 25 +++++++---- .../partials/nginx-helper-general-options.php | 42 +++++++++++++++++-- 4 files changed, 75 insertions(+), 22 deletions(-) diff --git a/admin/class-nginx-helper-admin.php b/admin/class-nginx-helper-admin.php index 8def3cc..4235924 100644 --- a/admin/class-nginx-helper-admin.php +++ b/admin/class-nginx-helper-admin.php @@ -276,11 +276,14 @@ public function nginx_helper_default_settings() { 'redis_hostname' => '127.0.0.1', 'redis_port' => '6379', 'redis_prefix' => 'nginx-cache:', + 'redis_unix_socket' => '', 'redis_database' => 0, 'redis_username' => '', 'redis_password' => '', 'purge_url' => '', 'redis_enabled_by_constant' => 0, + 'redis_socket_enabled_by_constant' => 0, + 'redis_acl_enabled_by_constant' => 0, ); } @@ -312,18 +315,24 @@ public function nginx_helper_settings() { defined( 'RT_WP_NGINX_HELPER_REDIS_PORT' ) && defined( 'RT_WP_NGINX_HELPER_REDIS_PREFIX' ) ); + + $data['redis_acl_enabled_by_constant'] = defined('RT_WP_NGINX_HELPER_REDIS_USERNAME') && defined('RT_WP_NGINX_HELPER_REDIS_PASSWORD'); + $data['redis_socket_enabled_by_constant'] = defined('RT_WP_NGINX_HELPER_REDIS_UNIX_SOCKET'); + $data['redis_unix_socket'] = $data['redis_socket_enabled_by_constant'] ? RT_WP_NGINX_HELPER_REDIS_UNIX_SOCKET : $data['redis_unix_socket']; + $data['redis_username'] = $data['redis_acl_enabled_by_constant'] ? RT_WP_NGINX_HELPER_REDIS_USERNAME : $data['redis_username']; + $data['redis_password'] = $data['redis_acl_enabled_by_constant'] ? RT_WP_NGINX_HELPER_REDIS_PASSWORD : $data['redis_password']; if ( ! $is_redis_enabled ) { return $data; } - $data['redis_enabled_by_constant'] = $is_redis_enabled; - $data['enable_purge'] = $is_redis_enabled; - $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_database'] = defined('RT_WP_NGINX_HELPER_REDIS_DATABASE') ? RT_WP_NGINX_HELPER_REDIS_DATABASE : 0; + $data['redis_enabled_by_constant'] = $is_redis_enabled; + $data['enable_purge'] = $is_redis_enabled; + $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_database'] = defined('RT_WP_NGINX_HELPER_REDIS_DATABASE') ? RT_WP_NGINX_HELPER_REDIS_DATABASE : 0; return $data; diff --git a/admin/class-phpredis-purger.php b/admin/class-phpredis-purger.php index 761d67d..d4b0f95 100644 --- a/admin/class-phpredis-purger.php +++ b/admin/class-phpredis-purger.php @@ -49,9 +49,12 @@ public function __construct() { $redis_acl['auth'] = array( $username, $password ); } + $hostname = empty( $nginx_helper_admin->options['redis_unix_socket'] ) ? $nginx_helper_admin->options['redis_hostname'] : $nginx_helper_admin->options['redis_unix_socket']; + $port = empty( $nginx_helper_admin->options['redis_unix_socket'] ) ? $nginx_helper_admin->options['redis_port'] : 0; + $this->redis_object->connect( - $nginx_helper_admin->options['redis_hostname'], - $nginx_helper_admin->options['redis_port'], + $hostname, + $port, 5, null, 0, diff --git a/admin/class-predis-purger.php b/admin/class-predis-purger.php index ea64d50..bf38bb1 100644 --- a/admin/class-predis-purger.php +++ b/admin/class-predis-purger.php @@ -38,18 +38,25 @@ public function __construct() { Predis\Autoloader::register(); + $predis_args = array(); + $username = $nginx_helper_admin->options['redis_username']; $password = $nginx_helper_admin->options['redis_password']; - + + if( empty( $nginx_helper_admin->options['redis_unix_socket'] ) ) { + $predis_args['path'] = $nginx_helper_admin->options['redis_unix_socket']; + } else { + $predis_args['host'] = $nginx_helper_admin->options['redis_hostname'];; + $predis_args['port'] = $nginx_helper_admin->options['redis_port']; + } + + if ( $username && $password ) { + $predis_args['username'] = $username; + $predis_args['password'] = $password; + } + // redis server parameter. - $this->redis_object = new Predis\Client( - array( - 'host' => $nginx_helper_admin->options['redis_hostname'], - 'port' => $nginx_helper_admin->options['redis_port'], - 'username' => $username, - 'password' => $password, - ) - ); + $this->redis_object = new Predis\Client( $predis_args ); if( $nginx_helper_admin->options['redis_database'] !== 0 ) { $this->redis_object->select($nginx_helper_admin->options['redis_database']); diff --git a/admin/partials/nginx-helper-general-options.php b/admin/partials/nginx-helper-general-options.php index 722dedd..485a759 100644 --- a/admin/partials/nginx-helper-general-options.php +++ b/admin/partials/nginx-helper-general-options.php @@ -25,6 +25,9 @@ 'redis_database', 'redis_username', 'redis_password', + 'redis_unix_socket', + 'redis_socket_enabled_by_constant', + 'redis_acl_enabled_by_constant', 'purge_homepage_on_edit', 'purge_homepage_on_del', 'purge_url', @@ -249,7 +252,7 @@ - /> + /> + '; + esc_html_e( 'Overridden by unix socket path.', 'nginx-helper' ); + echo '

'; + } + ?> - /> + /> + '; + esc_html_e( 'Overridden by unix socket path.', 'nginx-helper' ); + echo '

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

'; + + } + ?> + + @@ -308,7 +342,7 @@ - + /> - + /> Date: Fri, 6 Sep 2024 12:18:20 +0530 Subject: [PATCH 13/66] remove: extra filters. --- includes/class-nginx-helper.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/includes/class-nginx-helper.php b/includes/class-nginx-helper.php index 0460914..f96e6d0 100644 --- a/includes/class-nginx-helper.php +++ b/includes/class-nginx-helper.php @@ -85,8 +85,7 @@ public function __construct() { } if ( ! defined( 'RT_WP_NGINX_HELPER_CACHE_PATH' ) ) { - $cache_path = apply_filters( 'rt_wp_nginx_helper_cache_path', '/var/run/nginx-cache' ); - define( 'RT_WP_NGINX_HELPER_CACHE_PATH', $cache_path ); + define( 'RT_WP_NGINX_HELPER_CACHE_PATH', '/var/run/nginx-cache' ); } $this->load_dependencies(); From 914dccf4d6bf46afcdc80ff8d0e0315038103bed Mon Sep 17 00:00:00 2001 From: Vedant Gandhi Date: Fri, 6 Sep 2024 15:09:22 +0530 Subject: [PATCH 14/66] feat: add purging for amp urls. --- admin/class-fastcgi-purger.php | 21 ++++++++++++ admin/class-nginx-helper-admin.php | 1 + .../partials/nginx-helper-general-options.php | 33 +++++++++++++++++++ 3 files changed, 55 insertions(+) diff --git a/admin/class-fastcgi-purger.php b/admin/class-fastcgi-purger.php index cce53b5..45a88e9 100644 --- a/admin/class-fastcgi-purger.php +++ b/admin/class-fastcgi-purger.php @@ -90,8 +90,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 = $url_base . '/amp/'; + + $this->log('- Purging AMP URL | ' . $amp_url); + + if ($this->nginx_helper_admin->options['purge_method'] === 'unlink_files') { + $this->delete_cache_file_for($amp_url); + } else { + $this->do_remote_get($this->purge_base_url() . '/amp/'); + } + } /** * Function to custom purge urls. diff --git a/admin/class-nginx-helper-admin.php b/admin/class-nginx-helper-admin.php index f91289a..7c19060 100644 --- a/admin/class-nginx-helper-admin.php +++ b/admin/class-nginx-helper-admin.php @@ -278,6 +278,7 @@ public function nginx_helper_default_settings() { 'redis_prefix' => 'nginx-cache:', 'purge_url' => '', 'redis_enabled_by_constant' => 0, + 'purge_amp_urls' => 1, ); } diff --git a/admin/partials/nginx-helper-general-options.php b/admin/partials/nginx-helper-general-options.php index a91eb53..dfcbcd5 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', + 'purge_amp_urls', ); $all_inputs = array(); @@ -548,6 +549,38 @@ + + + + + +
+

+ +

+
+
+ + +   + + + + +
+
+
+ + +
From c2a1416ab12a2c06a9bfb7ea378094b22eadc5e0 Mon Sep 17 00:00:00 2001 From: Vedant Gandhi Date: Fri, 6 Sep 2024 15:11:36 +0530 Subject: [PATCH 15/66] refactor: fix indentation. --- admin/class-nginx-helper-admin.php | 2 +- admin/partials/nginx-helper-general-options.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/admin/class-nginx-helper-admin.php b/admin/class-nginx-helper-admin.php index 7c19060..a417b02 100644 --- a/admin/class-nginx-helper-admin.php +++ b/admin/class-nginx-helper-admin.php @@ -278,7 +278,7 @@ public function nginx_helper_default_settings() { 'redis_prefix' => 'nginx-cache:', 'purge_url' => '', 'redis_enabled_by_constant' => 0, - 'purge_amp_urls' => 1, + 'purge_amp_urls' => 1, ); } diff --git a/admin/partials/nginx-helper-general-options.php b/admin/partials/nginx-helper-general-options.php index dfcbcd5..48c3f59 100644 --- a/admin/partials/nginx-helper-general-options.php +++ b/admin/partials/nginx-helper-general-options.php @@ -40,7 +40,7 @@ 'purge_page_on_deleted_comment', 'purge_feeds', 'smart_http_expire_form_nonce', - 'purge_amp_urls', + 'purge_amp_urls', ); $all_inputs = array(); From a3dcc70d943bd4b75227966900aceb3c548eb9d5 Mon Sep 17 00:00:00 2001 From: Vedant Gandhi Date: Thu, 19 Sep 2024 12:11:39 +0530 Subject: [PATCH 16/66] feat: add function to store default options. --- admin/class-nginx-helper-admin.php | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/admin/class-nginx-helper-admin.php b/admin/class-nginx-helper-admin.php index f91289a..d400c9e 100644 --- a/admin/class-nginx-helper-admin.php +++ b/admin/class-nginx-helper-admin.php @@ -281,6 +281,28 @@ public function nginx_helper_default_settings() { ); } + + 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( $default_settings, $options ); + + add_site_option( 'rt_wp_nginx_helper_options', $diffed_options ); + } /** * Get settings. From 38310037d8defc6238ec3e6b1ab996022541ea8e Mon Sep 17 00:00:00 2001 From: Vedant Gandhi Date: Thu, 19 Sep 2024 12:15:23 +0530 Subject: [PATCH 17/66] feat: add invocation for default options. --- includes/class-nginx-helper-activator.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/includes/class-nginx-helper-activator.php b/includes/class-nginx-helper-activator.php index ec17992..1b672cd 100644 --- a/includes/class-nginx-helper-activator.php +++ b/includes/class-nginx-helper-activator.php @@ -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(); + } } From 8befd1846e99ad56a3b181f96a393a0d5ae07a3c Mon Sep 17 00:00:00 2001 From: Vedant Gandhi Date: Wed, 25 Sep 2024 19:42:53 +0530 Subject: [PATCH 18/66] feat: add general options. --- admin/class-nginx-helper-admin.php | 77 +++++++++++++++++++ .../partials/nginx-helper-general-options.php | 7 ++ 2 files changed, 84 insertions(+) diff --git a/admin/class-nginx-helper-admin.php b/admin/class-nginx-helper-admin.php index f91289a..675753d 100644 --- a/admin/class-nginx-helper-admin.php +++ b/admin/class-nginx-helper-admin.php @@ -96,6 +96,12 @@ public function __construct( $plugin_name, $version ) { ); $this->options = $this->nginx_helper_settings(); + + $is_cache_preloaded = get_option( 'is_cache_preloaded' ); + $preload_cache_enabled = get_option( 'preload_cache' ); + if ( $preload_cache_enabled && false === $is_cache_preloaded ) { + $this->preload_cache_from_sitemap(); + } } @@ -278,6 +284,8 @@ public function nginx_helper_default_settings() { 'redis_prefix' => 'nginx-cache:', 'purge_url' => '', 'redis_enabled_by_constant' => 0, + 'preload_cache' => 0, + 'is_cache_preloaded' => 0 ); } @@ -775,5 +783,74 @@ public function purge_all() { public function display_notices() { echo '

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

'; } + + /** + * This function preloads the cache from sitemap url. + * + * @return void + */ + public function preload_cache_from_sitemap() { + global $nginx_purger; + $sitemap_url = get_sitemap_url( 'index' ); + + if ( false === $sitemap_url || empty( $sitemap_url ) ) { + return; + } + + $sitemap_page = get_page_by_path( $sitemap_url ); + + if ( ! $sitemap_page instanceof WP_Post ) { + return; + } + + $sitemap_content = $sitemap_page->post_content; + $urls = $this->extract_sitemap_urls( $sitemap_content ); + + if ( $urls instanceof WP_Error ) { + $nginx_purger->log( ' Error while extracting URL\'s from the sitemap while preloading cache. Error - ', $urls->get_error_message() ); + return; + } + + $args = array( + 'timeout' => 0.01, + 'blocking' => false, + 'sslverify' => false, + ); + + foreach ( $urls as $url ) { + wp_remote_get( esc_url_raw( $url ), $args ); + } + + add_option( 'is_cache_preloaded', true ); + } + + /** + * Parse sitemap content and extract all URLs. + * + * @param string $sitemap_content The XML content of the sitemap. + * @return array|WP_Error An array of URLs or WP_Error on failure. + */ + private function extract_sitemap_urls( $sitemap_content ) { + 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 ( 'sitemapindex' === $xml->getName() ) { + foreach ( $xml->sitemap as $sitemap ) { + $urls[] = (string) $sitemap->loc; + } + } else { + foreach ( $xml->url as $url ) { + $urls[] = (string) $url->loc; + } + } + + return $urls; + } } 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 @@
+ /> + +
From c1198f0629bec92248e9d8ab4589faf5498679c0 Mon Sep 17 00:00:00 2001 From: Vedant Gandhi Date: Thu, 26 Sep 2024 13:19:28 +0530 Subject: [PATCH 19/66] feat: add cache preload. --- admin/class-nginx-helper-admin.php | 94 +++++++++++++++++------------- 1 file changed, 55 insertions(+), 39 deletions(-) diff --git a/admin/class-nginx-helper-admin.php b/admin/class-nginx-helper-admin.php index 675753d..cde6ce4 100644 --- a/admin/class-nginx-helper-admin.php +++ b/admin/class-nginx-helper-admin.php @@ -96,12 +96,19 @@ public function __construct( $plugin_name, $version ) { ); $this->options = $this->nginx_helper_settings(); - - $is_cache_preloaded = get_option( 'is_cache_preloaded' ); - $preload_cache_enabled = get_option( 'preload_cache' ); - if ( $preload_cache_enabled && false === $is_cache_preloaded ) { - $this->preload_cache_from_sitemap(); - } + + add_action( 'init', function() { + $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(); + + } + } ); } @@ -790,47 +797,58 @@ public function display_notices() { * @return void */ public function preload_cache_from_sitemap() { - global $nginx_purger; - $sitemap_url = get_sitemap_url( 'index' ); - - if ( false === $sitemap_url || empty( $sitemap_url ) ) { - return; - } - - $sitemap_page = get_page_by_path( $sitemap_url ); - - if ( ! $sitemap_page instanceof WP_Post ) { - return; - } - - $sitemap_content = $sitemap_page->post_content; - $urls = $this->extract_sitemap_urls( $sitemap_content ); - - if ( $urls instanceof WP_Error ) { - $nginx_purger->log( ' Error while extracting URL\'s from the sitemap while preloading cache. Error - ', $urls->get_error_message() ); - return; - } + $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' => 0.01, 'blocking' => false, 'sslverify' => false, ); - foreach ( $urls as $url ) { + foreach ( $all_urls as $url ) { wp_remote_get( esc_url_raw( $url ), $args ); } - - add_option( 'is_cache_preloaded', true ); + + } + + /** + * 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_content The XML content of the sitemap. + * @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_content ) { + 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 ); @@ -840,14 +858,12 @@ private function extract_sitemap_urls( $sitemap_content ) { $urls = array(); - if ( 'sitemapindex' === $xml->getName() ) { - foreach ( $xml->sitemap as $sitemap ) { - $urls[] = (string) $sitemap->loc; - } - } else { - foreach ( $xml->url as $url ) { - $urls[] = (string) $url->loc; - } + if ( $xml === false ) { + return $urls; + } + + foreach ( $xml->url as $url ) { + $urls[] = (string) $url->loc; } return $urls; From 9d6d1170789da486647a14201f3bdc9648a8c3af Mon Sep 17 00:00:00 2001 From: Vedant Gandhi Date: Thu, 26 Sep 2024 13:26:12 +0530 Subject: [PATCH 20/66] feat: tag the preload cache on admin_init action. --- admin/class-nginx-helper-admin.php | 32 +++++++++++++++++------------- includes/class-nginx-helper.php | 3 +++ 2 files changed, 21 insertions(+), 14 deletions(-) diff --git a/admin/class-nginx-helper-admin.php b/admin/class-nginx-helper-admin.php index cde6ce4..436c9dc 100644 --- a/admin/class-nginx-helper-admin.php +++ b/admin/class-nginx-helper-admin.php @@ -96,19 +96,6 @@ public function __construct( $plugin_name, $version ) { ); $this->options = $this->nginx_helper_settings(); - - add_action( 'init', function() { - $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(); - - } - } ); } @@ -791,12 +778,29 @@ 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 */ - public function preload_cache_from_sitemap() { + private function preload_cache_from_sitemap() { $sitemap_urls = $this->get_index_sitemap_urls(); $all_urls = array(); 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' ); } /** From 204fb8d99a908ee176c7eb6e99d8dab8547478df Mon Sep 17 00:00:00 2001 From: Vedant Gandhi Date: Thu, 26 Sep 2024 13:46:42 +0530 Subject: [PATCH 21/66] feat: change the timeout for sitemap fetch. --- admin/class-nginx-helper-admin.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/admin/class-nginx-helper-admin.php b/admin/class-nginx-helper-admin.php index 436c9dc..1040495 100644 --- a/admin/class-nginx-helper-admin.php +++ b/admin/class-nginx-helper-admin.php @@ -811,7 +811,7 @@ private function preload_cache_from_sitemap() { } $args = array( - 'timeout' => 0.01, + 'timeout' => 1, 'blocking' => false, 'sslverify' => false, ); From a32336bf050a50a684d2abaa683c5849a28c413f Mon Sep 17 00:00:00 2001 From: Vedant Gandhi Date: Fri, 27 Sep 2024 17:07:06 +0530 Subject: [PATCH 22/66] fix: add the default arguments after the options in wp_parse_args. --- admin/class-nginx-helper-admin.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/admin/class-nginx-helper-admin.php b/admin/class-nginx-helper-admin.php index d400c9e..aeac55d 100644 --- a/admin/class-nginx-helper-admin.php +++ b/admin/class-nginx-helper-admin.php @@ -299,7 +299,7 @@ public function store_default_options() { unset( $default_settings[ $removable_key ] ); } - $diffed_options = wp_parse_args( $default_settings, $options ); + $diffed_options = wp_parse_args( $options, $default_settings ); add_site_option( 'rt_wp_nginx_helper_options', $diffed_options ); } From 5d33fe753697ef3e64d205affe6f7ebedc7dbe00 Mon Sep 17 00:00:00 2001 From: Vedant Gandhi Date: Tue, 1 Oct 2024 15:36:30 +0530 Subject: [PATCH 23/66] feat: add development.md --- Development.md | 51 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 Development.md diff --git a/Development.md b/Development.md new file mode 100644 index 0000000..9df60bb --- /dev/null +++ b/Development.md @@ -0,0 +1,51 @@ +# Development + +## 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 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 From 1cee678b99985b84121e018dff7ce4570ef6610d Mon Sep 17 00:00:00 2001 From: Vedant Gandhi Date: Thu, 3 Oct 2024 19:24:07 +0530 Subject: [PATCH 24/66] doc: add origin branch. --- Development.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Development.md b/Development.md index 9df60bb..82349f6 100644 --- a/Development.md +++ b/Development.md @@ -1,4 +1,5 @@ # Development +[ For internal contributors only ] ## Getting Started @@ -35,7 +36,7 @@ To verify if a page is cached: ### Raising a Pull Request (PR) -1. Create a new branch for your changes. +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. From 51a85f423d4f465880ca5e2ed1082a719e8eb1c6 Mon Sep 17 00:00:00 2001 From: Vedant Gandhi Date: Thu, 10 Oct 2024 13:06:26 +0530 Subject: [PATCH 25/66] feat: resolved conflicts. --- admin/class-nginx-helper-admin.php | 455 ++++++++++++++++++----------- 1 file changed, 285 insertions(+), 170 deletions(-) diff --git a/admin/class-nginx-helper-admin.php b/admin/class-nginx-helper-admin.php index aeac55d..3c99f18 100644 --- a/admin/class-nginx-helper-admin.php +++ b/admin/class-nginx-helper-admin.php @@ -20,7 +20,7 @@ * @author rtCamp */ class Nginx_Helper_Admin { - + /** * The ID of this plugin. * @@ -29,7 +29,7 @@ class Nginx_Helper_Admin { * @var string $plugin_name The ID of this plugin. */ private $plugin_name; - + /** * The version of this plugin. * @@ -38,7 +38,7 @@ class Nginx_Helper_Admin { * @var string $version The current version of this plugin. */ private $version; - + /** * Various settings tabs. * @@ -47,7 +47,7 @@ class Nginx_Helper_Admin { * @var string $settings_tabs Various settings tabs. */ private $settings_tabs; - + /** * Purge options. * @@ -56,7 +56,7 @@ class Nginx_Helper_Admin { * @var string[] $options Purge options. */ public $options; - + /** * WP-CLI Command. * @@ -65,7 +65,7 @@ class Nginx_Helper_Admin { * @var string $options WP-CLI Command. */ const WP_CLI_COMMAND = 'nginx-helper'; - + /** * Initialize the class and set its properties. * @@ -74,10 +74,10 @@ class Nginx_Helper_Admin { * @param string $version The version of this plugin. */ public function __construct( $plugin_name, $version ) { - + $this->plugin_name = $plugin_name; $this->version = $version; - + /** * Define settings tabs */ @@ -94,11 +94,10 @@ public function __construct( $plugin_name, $version ) { ), ) ); - + $this->options = $this->nginx_helper_settings(); - } - + /** * Register the stylesheets for the admin area. * @@ -107,7 +106,7 @@ public function __construct( $plugin_name, $version ) { * @param string $hook The current admin page. */ public function enqueue_styles( $hook ) { - + /** * This function is provided for demonstration purposes only. * @@ -119,16 +118,16 @@ 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. * @@ -137,7 +136,7 @@ public function enqueue_styles( $hook ) { * @param string $hook The current admin page. */ public function enqueue_scripts( $hook ) { - + /** * This function is provided for demonstration purposes only. * @@ -149,29 +148,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 */ public function nginx_helper_admin_menu() { - + if ( is_multisite() ) { - + add_submenu_page( 'settings.php', __( 'Nginx Helper', 'nginx-helper' ), @@ -180,9 +179,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 +190,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 +213,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,9 +231,9 @@ public function nginx_helper_toolbar_purge_link( $wp_admin_bar ) { 'meta' => array( 'title' => $link_title ), ) ); - + } - + /** * Display settings. * @@ -245,7 +244,7 @@ public function nginx_helper_toolbar_purge_link( $wp_admin_bar ) { public function nginx_helper_setting_page() { include plugin_dir_path( __FILE__ ) . 'partials/nginx-helper-admin-display.php'; } - + /** * Default settings. * @@ -253,7 +252,7 @@ public function nginx_helper_setting_page() { * @return array */ public function nginx_helper_default_settings() { - + return array( 'enable_purge' => 0, 'cache_method' => 'enable_fastcgi', @@ -278,8 +277,10 @@ public function nginx_helper_default_settings() { 'redis_prefix' => 'nginx-cache:', 'purge_url' => '', 'redis_enabled_by_constant' => 0, + 'preload_cache' => 0, + 'is_cache_preloaded' => 0 ); - + } public function store_default_options() { @@ -310,7 +311,7 @@ public function store_default_options() { * @since 2.0.0 */ public function nginx_helper_settings() { - + $options = get_site_option( 'rt_wp_nginx_helper_options', array( @@ -319,33 +320,33 @@ public function nginx_helper_settings() { 'redis_prefix' => 'nginx-cache:', ) ); - + $data = wp_parse_args( $options, $this->nginx_helper_default_settings() ); - + $is_redis_enabled = ( defined( 'RT_WP_NGINX_HELPER_REDIS_HOSTNAME' ) && defined( 'RT_WP_NGINX_HELPER_REDIS_PORT' ) && defined( 'RT_WP_NGINX_HELPER_REDIS_PREFIX' ) ); - + if ( ! $is_redis_enabled ) { return $data; } - + $data['redis_enabled_by_constant'] = $is_redis_enabled; $data['enable_purge'] = $is_redis_enabled; $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; - + } - + /** * Nginx helper setting link function. * @@ -354,20 +355,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. * @@ -375,20 +376,20 @@ 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. * @@ -396,13 +397,13 @@ public function is_nginx_log_enabled() { * @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. * @@ -410,82 +411,82 @@ public function functional_asset_path() { * @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 ); - + } ?> -
    +
      ' . esc_html_e( 'No items', 'nginx-helper' ) . '.'; } else { - + // Loop through each feed item and display each item as a hyperlink. foreach ( $rss_items as $item ) { ?> -
    • - %s', - esc_url( $item->get_permalink() ), - esc_attr__( 'Posted ', 'nginx-helper' ) . esc_attr( $item->get_date( 'j F Y | g:i a' ) ), - esc_html( $item->get_title() ) - ); - ?> -
    • +
    • + %s', + esc_url( $item->get_permalink() ), + esc_attr__( 'Posted ', 'nginx-helper' ) . esc_attr( $item->get_date( 'j F Y | g:i a' ) ), + esc_html( $item->get_title() ) + ); + ?> +
    • -
    +
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 ); @@ -496,32 +497,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 * @@ -530,83 +531,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. * @@ -618,28 +619,28 @@ 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 = array( 'nav_menu_item' ); - + if ( in_array( $post->post_type, $exclude_post_types, true ) ) { 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 && ( @@ -650,15 +651,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 * @@ -668,9 +669,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'] ) || @@ -680,18 +681,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. * @@ -700,18 +701,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 @@ -720,14 +721,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'] ) ) { @@ -738,34 +743,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(); @@ -774,28 +779,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 ( $xml === false ) { + 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 ); + } + + } From efd7da469a99e88e990c5076fac5f71e692e3a98 Mon Sep 17 00:00:00 2001 From: Vedant Gandhi Date: Wed, 16 Oct 2024 16:16:42 +0530 Subject: [PATCH 26/66] feat: add password toggle button. --- admin/css/nginx-helper-admin.css | 17 ++++- admin/js/nginx-helper-admin.js | 13 ++++ .../partials/nginx-helper-general-options.php | 64 ++++++++++--------- 3 files changed, 62 insertions(+), 32 deletions(-) diff --git a/admin/css/nginx-helper-admin.css b/admin/css/nginx-helper-admin.css index 0a8856b..ddf47ce 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 4b3aa00..748ac70 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-general-options.php b/admin/partials/nginx-helper-general-options.php index 485a759..61075b0 100644 --- a/admin/partials/nginx-helper-general-options.php +++ b/admin/partials/nginx-helper-general-options.php @@ -22,12 +22,12 @@ 'redis_hostname', 'redis_port', 'redis_prefix', - 'redis_database', - 'redis_username', - 'redis_password', - 'redis_unix_socket', - 'redis_socket_enabled_by_constant', - 'redis_acl_enabled_by_constant', + 'redis_database', + 'redis_username', + 'redis_password', + 'redis_unix_socket', + 'redis_socket_enabled_by_constant', + 'redis_acl_enabled_by_constant', 'purge_homepage_on_edit', 'purge_homepage_on_del', 'purge_url', @@ -295,10 +295,10 @@ ?> - - - - /> + + + + /> - - + + @@ -325,10 +325,10 @@ ?> - - - - /> + + + + /> - - + + - - - - /> + + + + /> - - + + - - - - /> + + + +
+ /> + +
'; esc_html_e( 'Overridden by constant variables.', 'nginx-helper' ); echo '

'; } ?> - - + + From cd58a27c01db46f79daa94e4e2d1ad50570d27ea Mon Sep 17 00:00:00 2001 From: Vedant Gandhi Date: Wed, 16 Oct 2024 16:29:09 +0530 Subject: [PATCH 27/66] refactor: fix indentation. --- admin/class-nginx-helper-admin.php | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/admin/class-nginx-helper-admin.php b/admin/class-nginx-helper-admin.php index 4235924..2def2bd 100644 --- a/admin/class-nginx-helper-admin.php +++ b/admin/class-nginx-helper-admin.php @@ -275,15 +275,15 @@ public function nginx_helper_default_settings() { 'purge_feeds' => 1, 'redis_hostname' => '127.0.0.1', 'redis_port' => '6379', - 'redis_prefix' => 'nginx-cache:', - 'redis_unix_socket' => '', - 'redis_database' => 0, - 'redis_username' => '', - 'redis_password' => '', + 'redis_prefix' => 'nginx-cache:', + 'redis_unix_socket' => '', + 'redis_database' => 0, + 'redis_username' => '', + 'redis_password' => '', 'purge_url' => '', 'redis_enabled_by_constant' => 0, - 'redis_socket_enabled_by_constant' => 0, - 'redis_acl_enabled_by_constant' => 0, + 'redis_socket_enabled_by_constant' => 0, + 'redis_acl_enabled_by_constant' => 0, ); } @@ -331,8 +331,8 @@ 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_database'] = defined('RT_WP_NGINX_HELPER_REDIS_DATABASE') ? RT_WP_NGINX_HELPER_REDIS_DATABASE : 0; + $data['redis_prefix'] = RT_WP_NGINX_HELPER_REDIS_PREFIX; + $data['redis_database'] = defined('RT_WP_NGINX_HELPER_REDIS_DATABASE') ? RT_WP_NGINX_HELPER_REDIS_DATABASE : 0; return $data; From 6048861c579b4847cf001e15af6e305a50f1a398 Mon Sep 17 00:00:00 2001 From: Vedant Gandhi Date: Thu, 17 Oct 2024 11:52:01 +0530 Subject: [PATCH 28/66] refactor: added sprintf instead of concatenating string when generating amp url. --- admin/class-fastcgi-purger.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/admin/class-fastcgi-purger.php b/admin/class-fastcgi-purger.php index 45a88e9..385b02d 100644 --- a/admin/class-fastcgi-purger.php +++ b/admin/class-fastcgi-purger.php @@ -103,14 +103,14 @@ public function purge_url( $url, $feed = true ) { * @param string $url_base The base URL to purge. */ private function purge_amp_version( $url_base ) { - $amp_url = $url_base . '/amp/'; + $amp_url = sprintf( '%s/amp/', rtrim( $url_base, '/' ) ); $this->log('- Purging AMP URL | ' . $amp_url); - if ($this->nginx_helper_admin->options['purge_method'] === 'unlink_files') { - $this->delete_cache_file_for($amp_url); + if ( 'unlink_files' === $this->nginx_helper_admin->options['purge_method'] ) { + $this->delete_cache_file_for( $amp_url ); } else { - $this->do_remote_get($this->purge_base_url() . '/amp/'); + $this->do_remote_get( $amp_url ); } } From 57a1f4fd8ce3b692c15b278143a4aec1ca8945f7 Mon Sep 17 00:00:00 2001 From: Vedant Gandhi Date: Mon, 21 Oct 2024 17:59:42 +0530 Subject: [PATCH 29/66] refactor: change all indentation to tabs. --- admin/class-nginx-helper-admin.php | 22 +++++++++---------- .../partials/nginx-helper-general-options.php | 14 ++++++------ 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/admin/class-nginx-helper-admin.php b/admin/class-nginx-helper-admin.php index bc94fdc..038a170 100644 --- a/admin/class-nginx-helper-admin.php +++ b/admin/class-nginx-helper-admin.php @@ -319,7 +319,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; @@ -421,7 +421,7 @@ public function nginx_helper_get_feeds() { } ?> -
    +
      ' . esc_html_e( 'No items', 'nginx-helper' ) . '.'; @@ -430,7 +430,7 @@ public function nginx_helper_get_feeds() { // Loop through each feed item and display each item as a hyperlink. foreach ( $rss_items as $item ) { ?> -
    • +
    • %s', @@ -439,12 +439,12 @@ public function nginx_helper_get_feeds() { esc_html( $item->get_title() ) ); ?> -
    • + -
    +
- - - /> - - - + + + /> + + + From 911e8c5f44d469604b2ae15a90b0ba24c315a3e6 Mon Sep 17 00:00:00 2001 From: Vedant Gandhi Date: Mon, 21 Oct 2024 18:04:50 +0530 Subject: [PATCH 30/66] refactor: add alignment to equal signs. --- admin/class-nginx-helper-admin.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/admin/class-nginx-helper-admin.php b/admin/class-nginx-helper-admin.php index 038a170..e6d52dc 100644 --- a/admin/class-nginx-helper-admin.php +++ b/admin/class-nginx-helper-admin.php @@ -260,7 +260,7 @@ public function nginx_helper_default_settings() { 'enable_map' => 0, 'enable_log' => 0, 'log_level' => 'INFO', - 'log_filesize' => '5', + 'log_filesize' => '5', 'enable_stamp' => 0, 'purge_homepage_on_edit' => 1, 'purge_homepage_on_del' => 1, @@ -274,7 +274,7 @@ public function nginx_helper_default_settings() { 'purge_feeds' => 1, 'redis_hostname' => '127.0.0.1', 'redis_port' => '6379', - 'redis_prefix' => 'nginx-cache:', + 'redis_prefix' => 'nginx-cache:', 'purge_url' => '', 'redis_enabled_by_constant' => 0, 'preload_cache' => 0, @@ -295,7 +295,7 @@ public function nginx_helper_settings() { array( 'redis_hostname' => '127.0.0.1', 'redis_port' => '6379', - 'redis_prefix' => 'nginx-cache:', + 'redis_prefix' => 'nginx-cache:', ) ); @@ -809,7 +809,7 @@ private function preload_cache_from_sitemap() { $all_urls = array(); foreach ( $sitemap_urls as $sitemap_url ) { - $urls = $this->extract_sitemap_urls( $sitemap_url ); + $urls = $this->extract_sitemap_urls( $sitemap_url ); $all_urls = array_merge( $all_urls, $urls ); } @@ -865,7 +865,7 @@ private function extract_sitemap_urls( $sitemap_url ) { $urls = array(); - if ( $xml === false ) { + if ( false === $xml ) { return $urls; } From 989d1a01730137896d2731241eed4f5bb281cf29 Mon Sep 17 00:00:00 2001 From: Vedant Gandhi Date: Mon, 21 Oct 2024 19:09:37 +0530 Subject: [PATCH 31/66] refactor: fix arrow indentation in get_site_option while fetching settings. --- admin/class-nginx-helper-admin.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/admin/class-nginx-helper-admin.php b/admin/class-nginx-helper-admin.php index e6d52dc..a6ff9ce 100644 --- a/admin/class-nginx-helper-admin.php +++ b/admin/class-nginx-helper-admin.php @@ -260,7 +260,7 @@ public function nginx_helper_default_settings() { 'enable_map' => 0, 'enable_log' => 0, 'log_level' => 'INFO', - 'log_filesize' => '5', + 'log_filesize' => '5', 'enable_stamp' => 0, 'purge_homepage_on_edit' => 1, 'purge_homepage_on_del' => 1, @@ -274,7 +274,7 @@ public function nginx_helper_default_settings() { 'purge_feeds' => 1, 'redis_hostname' => '127.0.0.1', 'redis_port' => '6379', - 'redis_prefix' => 'nginx-cache:', + 'redis_prefix' => 'nginx-cache:', 'purge_url' => '', 'redis_enabled_by_constant' => 0, 'preload_cache' => 0, @@ -295,7 +295,7 @@ public function nginx_helper_settings() { array( 'redis_hostname' => '127.0.0.1', 'redis_port' => '6379', - 'redis_prefix' => 'nginx-cache:', + 'redis_prefix' => 'nginx-cache:', ) ); @@ -319,7 +319,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; From 104c57e867e944d5436e3940455d4ba449103388 Mon Sep 17 00:00:00 2001 From: Vedant Gandhi Date: Fri, 15 Nov 2024 12:49:59 +0530 Subject: [PATCH 32/66] fix: move settings tab in admin to separate function and initialize it on init hook. --- admin/class-nginx-helper-admin.php | 11 +++++++++-- includes/class-nginx-helper.php | 2 +- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/admin/class-nginx-helper-admin.php b/admin/class-nginx-helper-admin.php index 46b04c7..ed40f3a 100644 --- a/admin/class-nginx-helper-admin.php +++ b/admin/class-nginx-helper-admin.php @@ -78,6 +78,14 @@ 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,10 +102,9 @@ public function __construct( $plugin_name, $version ) { ), ) ); - - $this->options = $this->nginx_helper_settings(); } + /** * Register the stylesheets for the admin area. * diff --git a/includes/class-nginx-helper.php b/includes/class-nginx-helper.php index 71cb137..2922cd4 100644 --- a/includes/class-nginx-helper.php +++ b/includes/class-nginx-helper.php @@ -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'] ) { From 87e780d3d637a42343c505984ff5654b62c9dc87 Mon Sep 17 00:00:00 2001 From: Vedant Gandhi Date: Fri, 15 Nov 2024 14:13:00 +0530 Subject: [PATCH 33/66] refactor: add proper tab in function description. --- admin/class-nginx-helper-admin.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/admin/class-nginx-helper-admin.php b/admin/class-nginx-helper-admin.php index ed40f3a..0fa36c5 100644 --- a/admin/class-nginx-helper-admin.php +++ b/admin/class-nginx-helper-admin.php @@ -83,9 +83,10 @@ public function __construct( $plugin_name, $version ) { /** * 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 + * 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 */ From 273aa68dff246c05f0e0509e1f6f94c98860d59a Mon Sep 17 00:00:00 2001 From: Vedant Gandhi Date: Mon, 18 Nov 2024 16:15:23 +0530 Subject: [PATCH 34/66] refactor: remove extra space. --- admin/class-nginx-helper-admin.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/admin/class-nginx-helper-admin.php b/admin/class-nginx-helper-admin.php index 0fa36c5..cf5b9e1 100644 --- a/admin/class-nginx-helper-admin.php +++ b/admin/class-nginx-helper-admin.php @@ -104,7 +104,7 @@ public function initialize_setting_tab() { ) ); } - + /** * Register the stylesheets for the admin area. From 687c116d1f7aaf700797eb24b65221637e89b5b0 Mon Sep 17 00:00:00 2001 From: Vedant Gandhi Date: Mon, 18 Nov 2024 16:16:14 +0530 Subject: [PATCH 35/66] refactor: remove extra space. --- admin/class-nginx-helper-admin.php | 1 - 1 file changed, 1 deletion(-) diff --git a/admin/class-nginx-helper-admin.php b/admin/class-nginx-helper-admin.php index cf5b9e1..5ecd8bf 100644 --- a/admin/class-nginx-helper-admin.php +++ b/admin/class-nginx-helper-admin.php @@ -104,7 +104,6 @@ public function initialize_setting_tab() { ) ); } - /** * Register the stylesheets for the admin area. From 13973c59545e9ccfa5b7637ed51496a8cbb58fa0 Mon Sep 17 00:00:00 2001 From: Vedant Gandhi Date: Thu, 12 Dec 2024 11:25:53 +0530 Subject: [PATCH 36/66] feat: add proper indentation. --- admin/class-fastcgi-purger.php | 2 +- admin/partials/nginx-helper-general-options.php | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/admin/class-fastcgi-purger.php b/admin/class-fastcgi-purger.php index 385b02d..db2d39b 100644 --- a/admin/class-fastcgi-purger.php +++ b/admin/class-fastcgi-purger.php @@ -105,7 +105,7 @@ public function purge_url( $url, $feed = true ) { private function purge_amp_version( $url_base ) { $amp_url = sprintf( '%s/amp/', rtrim( $url_base, '/' ) ); - $this->log('- Purging AMP URL | ' . $amp_url); + $this->log( '- Purging AMP URL | ' . $amp_url ); if ( 'unlink_files' === $this->nginx_helper_admin->options['purge_method'] ) { $this->delete_cache_file_for( $amp_url ); diff --git a/admin/partials/nginx-helper-general-options.php b/admin/partials/nginx-helper-general-options.php index 48c3f59..09db4f3 100644 --- a/admin/partials/nginx-helper-general-options.php +++ b/admin/partials/nginx-helper-general-options.php @@ -549,12 +549,12 @@ - - - +
-

+ + + - - -
+

-

+
From e9424e33620b284092656e2d619644f136e46828 Mon Sep 17 00:00:00 2001 From: Vedant Gandhi Date: Thu, 12 Dec 2024 11:28:11 +0530 Subject: [PATCH 37/66] feat: add proper indentation. --- admin/partials/nginx-helper-general-options.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/admin/partials/nginx-helper-general-options.php b/admin/partials/nginx-helper-general-options.php index 09db4f3..05775a9 100644 --- a/admin/partials/nginx-helper-general-options.php +++ b/admin/partials/nginx-helper-general-options.php @@ -568,7 +568,7 @@

- +

-
-
- + +
+
+   - -
-
+ +
+ + +

From 910b9125621351cb46887533bd1c8c2a7ea5b270 Mon Sep 17 00:00:00 2001 From: Vedant Gandhi Date: Thu, 12 Dec 2024 14:02:31 +0530 Subject: [PATCH 39/66] fix: bug causing the predis instance to crash if db was pre-selected. --- admin/class-predis-purger.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/admin/class-predis-purger.php b/admin/class-predis-purger.php index bf38bb1..7f007b4 100644 --- a/admin/class-predis-purger.php +++ b/admin/class-predis-purger.php @@ -57,15 +57,16 @@ public function __construct() { // redis server parameter. $this->redis_object = new Predis\Client( $predis_args ); - - if( $nginx_helper_admin->options['redis_database'] !== 0 ) { - $this->redis_object->select($nginx_helper_admin->options['redis_database']); - } try { $this->redis_object->connect(); } catch ( Exception $e ) { $this->log( $e->getMessage(), 'ERROR' ); + return; + } + + if( $nginx_helper_admin->options['redis_database'] !== 0 ) { + $this->redis_object->select($nginx_helper_admin->options['redis_database']); } } From 9dea716221c28d38229e30b9c91c63cbaf6ed7c7 Mon Sep 17 00:00:00 2001 From: Vedant Gandhi Date: Thu, 12 Dec 2024 14:29:53 +0530 Subject: [PATCH 40/66] feat: add indentation for redis databse value. --- admin/class-nginx-helper-admin.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/admin/class-nginx-helper-admin.php b/admin/class-nginx-helper-admin.php index d2147bb..a398714 100644 --- a/admin/class-nginx-helper-admin.php +++ b/admin/class-nginx-helper-admin.php @@ -331,7 +331,7 @@ public function nginx_helper_settings() { 'redis_hostname' => '127.0.0.1', 'redis_port' => '6379', 'redis_prefix' => 'nginx-cache:', - 'redis_database' => 0, + 'redis_database' => 0, ) ); From 1aba7c9d221a8b03202f6d2c7ef07e36b4bf68d2 Mon Sep 17 00:00:00 2001 From: Vedant Gandhi Date: Wed, 18 Dec 2024 16:26:25 +0530 Subject: [PATCH 41/66] doc: update the changelog for plugin. --- README.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/README.md b/README.md index 70de764..d60379b 100644 --- a/README.md +++ b/README.md @@ -139,6 +139,15 @@ Please post your problem in [our free support forum](https://github.com/rtCamp/n ## Changelog ## +### 2.3.0 ### + +* 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 support for adding Username, Password support for Redis. It also includes the support for Unix Socket Path for Redis along with Database selection. [#343](https://github.com/rtCamp/nginx-helper/pull/343),[#350](https://github.com/rtCamp/nginx-helper/pull/350) - 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) + ### 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) From d18f9040beacc5238efa81196d55e7e773fac314 Mon Sep 17 00:00:00 2001 From: Vedant Gandhi Date: Wed, 18 Dec 2024 16:31:02 +0530 Subject: [PATCH 42/66] doc: update readme.txt to include changelog. --- readme.txt | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/readme.txt b/readme.txt index 6e4d290..b604cdf 100644 --- a/readme.txt +++ b/readme.txt @@ -127,6 +127,16 @@ Please post your problem in [our free support forum](https://github.com/rtCamp/n == Changelog == += 2.3.0 = + +* 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 support for adding Username, Password support for Redis. It also includes the support for Unix Socket Path for Redis along with Database selection. [#343](https://github.com/rtCamp/nginx-helper/pull/343),[#350](https://github.com/rtCamp/nginx-helper/pull/350) - 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) + + = 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) From 62065a7eb2687f012b5f94e8e7a400da7e1f7f4c Mon Sep 17 00:00:00 2001 From: Vedant Gandhi Date: Wed, 18 Dec 2024 16:31:31 +0530 Subject: [PATCH 43/66] feat: bump plugin version in meta. --- nginx-helper.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nginx-helper.php b/nginx-helper.php index b51e3c9..1e42051 100644 --- a/nginx-helper.php +++ b/nginx-helper.php @@ -3,7 +3,7 @@ * Plugin Name: Nginx Helper * Plugin URI: https://rtcamp.com/nginx-helper/ * Description: Cleans nginx's fastcgi/proxy cache or redis-cache whenever a post is edited/published. Also does few more things. - * Version: 2.2.5 + * Version: 2.3.0 * Author: rtCamp * Author URI: https://rtcamp.com * Text Domain: nginx-helper From 533cc22701c0e32a0378fe1eb5745f87ae33bb2b Mon Sep 17 00:00:00 2001 From: Vedant Gandhi Date: Wed, 18 Dec 2024 16:32:10 +0530 Subject: [PATCH 44/66] feat: bump the tested up to version. --- nginx-helper.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nginx-helper.php b/nginx-helper.php index 1e42051..7c4d022 100644 --- a/nginx-helper.php +++ b/nginx-helper.php @@ -9,7 +9,7 @@ * Text Domain: nginx-helper * Domain Path: /languages * Requires at least: 3.0 - * Tested up to: 6.4 + * Tested up to: 6.7 * * @link https://rtcamp.com/nginx-helper/ * @since 2.0.0 From e2509b434f352eb747ecb1e8ccf4fa33dd92d615 Mon Sep 17 00:00:00 2001 From: Vedant Gandhi Date: Thu, 19 Dec 2024 11:43:09 +0530 Subject: [PATCH 45/66] feat: add updated po file. --- languages/nginx-helper.po | 256 +++++++++++++++++++++++--------------- 1 file changed, 153 insertions(+), 103 deletions(-) diff --git a/languages/nginx-helper.po b/languages/nginx-helper.po index 313e246..55fa766 100644 --- a/languages/nginx-helper.po +++ b/languages/nginx-helper.po @@ -2,78 +2,87 @@ # 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 2.3.0\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-19T06:01:42+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 +#: nginx-helper.php msgid "https://rtcamp.com/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 +#: nginx-helper.php msgid "rtCamp" msgstr "" #. Author URI of the plugin +#: nginx-helper.php msgid "https://rtcamp.com" 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 "" From 8efbdce8d0972927e0516ecc8b5119b6c5f7a58c Mon Sep 17 00:00:00 2001 From: Vedant Gandhi Date: Thu, 19 Dec 2024 11:43:52 +0530 Subject: [PATCH 46/66] feat: add mo file --- languages/nginx-helper.mo | Bin 471 -> 472 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/languages/nginx-helper.mo b/languages/nginx-helper.mo index 9731e2429ca2b94ce557d88369b278243394c1af..d270649806b16b5fa8416aade094d6cf4c287b4f 100644 GIT binary patch delta 45 zcmcc4e1my{3gfDYs@lxPdIlSVxfuBjjdTqyLk!HU3=FMIj3#F@1~3^KPTs>P4FDd! B3$y?L delta 44 zcmcb?e4TlM3ggO&s@lv(dZrtLxfuBjOmq!RLktb9jLfV|3?^qY1~6Jq-peQr02Am7 AivR!s From a5f7dc15bfd0c28f10cf5b23425f2c1aeb5dfecc Mon Sep 17 00:00:00 2001 From: Vedant Gandhi Date: Thu, 19 Dec 2024 11:48:39 +0530 Subject: [PATCH 47/66] feat: update the version in nginx helper. --- includes/class-nginx-helper.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/class-nginx-helper.php b/includes/class-nginx-helper.php index 2922cd4..da16232 100644 --- a/includes/class-nginx-helper.php +++ b/includes/class-nginx-helper.php @@ -77,7 +77,7 @@ class Nginx_Helper { public function __construct() { $this->plugin_name = 'nginx-helper'; - $this->version = '2.2.5'; + $this->version = '2.3.0'; $this->minimum_wp = '3.0'; if ( ! $this->required_wp_version() ) { From 9f0ac62ea83c82d4da4e7d754957cba11e7cb8de Mon Sep 17 00:00:00 2001 From: Vedant Gandhi Date: Thu, 19 Dec 2024 20:31:57 +0530 Subject: [PATCH 48/66] feat: update the stable tag. --- README.md | 4 ++-- readme.txt | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index d60379b..f098ece 100644 --- a/README.md +++ b/README.md @@ -7,9 +7,9 @@ **Requires at least:** 3.0 -**Tested up to:** 6.1 +**Tested up to:** 6.7 -**Stable tag:** 2.2.5 +**Stable tag:** 2.3.0 **License:** GPLv2 or later (of-course) diff --git a/readme.txt b/readme.txt index b604cdf..8bb4de5 100644 --- a/readme.txt +++ b/readme.txt @@ -6,7 +6,7 @@ License: GPLv2 or later (of-course) License URI: http://www.gnu.org/licenses/gpl-2.0.html Requires at least: 3.0 Tested up to: 6.1 -Stable tag: 2.2.5 +Stable tag: 2.3.0 Cleans nginx's fastcgi/proxy cache or redis-cache whenever a post is edited/published. Also does a few more things. From 5af707882ece38b7248130fcfd10c742ee2cbb3f Mon Sep 17 00:00:00 2001 From: Vedant Gandhi Date: Thu, 19 Dec 2024 23:35:19 +0530 Subject: [PATCH 49/66] feat: updated tested upto in readme.txt --- readme.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/readme.txt b/readme.txt index 8bb4de5..da2655f 100644 --- a/readme.txt +++ b/readme.txt @@ -5,7 +5,7 @@ Tags: nginx, cache, purge, nginx map, nginx cache, maps, fastcgi, proxy, redis, License: GPLv2 or later (of-course) License URI: http://www.gnu.org/licenses/gpl-2.0.html Requires at least: 3.0 -Tested up to: 6.1 +Tested up to: 6.7 Stable tag: 2.3.0 Cleans nginx's fastcgi/proxy cache or redis-cache whenever a post is edited/published. Also does a few more things. From 2f5b215f56d645f9bd2589462a7f156826d98d6b Mon Sep 17 00:00:00 2001 From: Vedant Gandhi Date: Fri, 20 Dec 2024 12:35:03 +0530 Subject: [PATCH 50/66] doc: add faq for redis constants. --- README.md | 24 +++++++++++++++++++++++- readme.txt | 20 ++++++++++++++++++++ 2 files changed, 43 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index f098ece..b9b4783 100644 --- a/README.md +++ b/README.md @@ -113,6 +113,18 @@ define( 'RT_WP_NGINX_HELPER_REDIS_PORT', '6000' ); define( 'RT_WP_NGINX_HELPER_REDIS_PREFIX', 'page-cache:' ); ``` +**Q. Can I override the redis socket path, username, password?** + +Yes, you can force override the redis socket path, username, password by defining constant in wp-config.php. For example: + +```php +define( 'RT_WP_NGINX_HELPER_REDIS_UNIX_SOCKET', '/var/run/redis/redis.sock' ); + +define( 'RT_WP_NGINX_HELPER_REDIS_USERNAME', 'admin' ); + +define( 'RT_WP_NGINX_HELPER_REDIS_PASSWORD', 'admin' ); +``` + ### FAQ - Nginx Map ### **Q. My multisite already uses `WPMU_ACCEL_REDIRECT`. Do I still need Nginx Map?** @@ -123,6 +135,16 @@ Definitely. `WPMU_ACCEL_REDIRECT` reduces the load on PHP, but it still ask Word 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. + +### FAQ - WP-CLI ### + +**Q. How can I update the options using WP-CLI?** + +```shell +wp option patch update rt_wp_nginx_helper_options +``` + + ### Still need help! ### Please post your problem in [our free support forum](https://github.com/rtCamp/nginx-helper/issues). @@ -281,7 +303,7 @@ Added custom purge URL option. * 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) + [gagan0123](https://github.com/gagan0123) ### 1.9.2 ### diff --git a/readme.txt b/readme.txt index da2655f..20d01fa 100644 --- a/readme.txt +++ b/readme.txt @@ -106,6 +106,18 @@ define('RT_WP_NGINX_HELPER_REDIS_PORT', '6000'); define('RT_WP_NGINX_HELPER_REDIS_PREFIX', 'page-cache:'); ``` +**Q. Can I override the redis socket path, username, password?** + +Yes, you can force override the redis socket path, username, password by defining constant in wp-config.php. For example: + +```php +define( 'RT_WP_NGINX_HELPER_REDIS_UNIX_SOCKET', '/var/run/redis/redis.sock' ); + +define( 'RT_WP_NGINX_HELPER_REDIS_USERNAME', 'admin' ); + +define( 'RT_WP_NGINX_HELPER_REDIS_PASSWORD', 'admin' ); +``` + = FAQ - Nginx Map = **Q. My multisite already uses `WPMU_ACCEL_REDIRECT`. Do I still need Nginx Map?** @@ -117,6 +129,14 @@ Definitely. `WPMU_ACCEL_REDIRECT` reduces the load on PHP, but it still ask Word 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. += FAQ - WP-CLI = + +**Q. How can I update the options using WP-CLI?** + +```shell +wp option patch update rt_wp_nginx_helper_options +``` + = Still need help! = Please post your problem in [our free support forum](https://github.com/rtCamp/nginx-helper/issues). From 3503b75c2964e23f569078293c214286b60c6db4 Mon Sep 17 00:00:00 2001 From: Vedant Gandhi Date: Fri, 20 Dec 2024 16:24:30 +0530 Subject: [PATCH 51/66] doc: remove extra space. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index b9b4783..264136e 100644 --- a/README.md +++ b/README.md @@ -303,7 +303,7 @@ Added custom purge URL option. * 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) +[gagan0123](https://github.com/gagan0123) ### 1.9.2 ### From f9d43b9f168f2786545204b86e15593880c8e9d7 Mon Sep 17 00:00:00 2001 From: Vedant Gandhi Date: Mon, 23 Dec 2024 13:31:33 +0530 Subject: [PATCH 52/66] fix: predis database crashes when the db is out of bounds. --- admin/class-predis-purger.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/admin/class-predis-purger.php b/admin/class-predis-purger.php index 7f007b4..662322b 100644 --- a/admin/class-predis-purger.php +++ b/admin/class-predis-purger.php @@ -60,14 +60,16 @@ public function __construct() { try { $this->redis_object->connect(); + + if( $nginx_helper_admin->options['redis_database'] !== 0 ) { + $this->redis_object->select($nginx_helper_admin->options['redis_database']); + } } catch ( Exception $e ) { $this->log( $e->getMessage(), 'ERROR' ); return; } - if( $nginx_helper_admin->options['redis_database'] !== 0 ) { - $this->redis_object->select($nginx_helper_admin->options['redis_database']); - } + } From 3e41f75de828376eb2ac0cfab52beb39fff7e2b9 Mon Sep 17 00:00:00 2001 From: Vedant Gandhi Date: Mon, 23 Dec 2024 13:32:11 +0530 Subject: [PATCH 53/66] fix: invalid empty unix socket path. --- admin/class-predis-purger.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/admin/class-predis-purger.php b/admin/class-predis-purger.php index 662322b..3a039a5 100644 --- a/admin/class-predis-purger.php +++ b/admin/class-predis-purger.php @@ -43,7 +43,7 @@ public function __construct() { $username = $nginx_helper_admin->options['redis_username']; $password = $nginx_helper_admin->options['redis_password']; - if( empty( $nginx_helper_admin->options['redis_unix_socket'] ) ) { + if( !empty( $nginx_helper_admin->options['redis_unix_socket'] ) ) { $predis_args['path'] = $nginx_helper_admin->options['redis_unix_socket']; } else { $predis_args['host'] = $nginx_helper_admin->options['redis_hostname'];; From 08db8719c9d18d8d08bc0991a30742ff7af62c5a Mon Sep 17 00:00:00 2001 From: Vedant Gandhi Date: Mon, 23 Dec 2024 13:48:03 +0530 Subject: [PATCH 54/66] refactor: added yoda for database connection. --- admin/class-predis-purger.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/admin/class-predis-purger.php b/admin/class-predis-purger.php index 3a039a5..47057fc 100644 --- a/admin/class-predis-purger.php +++ b/admin/class-predis-purger.php @@ -43,7 +43,7 @@ public function __construct() { $username = $nginx_helper_admin->options['redis_username']; $password = $nginx_helper_admin->options['redis_password']; - if( !empty( $nginx_helper_admin->options['redis_unix_socket'] ) ) { + if( ! empty( $nginx_helper_admin->options['redis_unix_socket'] ) ) { $predis_args['path'] = $nginx_helper_admin->options['redis_unix_socket']; } else { $predis_args['host'] = $nginx_helper_admin->options['redis_hostname'];; @@ -61,8 +61,8 @@ public function __construct() { try { $this->redis_object->connect(); - if( $nginx_helper_admin->options['redis_database'] !== 0 ) { - $this->redis_object->select($nginx_helper_admin->options['redis_database']); + 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' ); From 1dd31f298ee3a097f9ffa7cad1e69cc894016e3b Mon Sep 17 00:00:00 2001 From: Vedant Gandhi Date: Mon, 23 Dec 2024 13:48:42 +0530 Subject: [PATCH 55/66] refactor: remove extra lines. --- admin/class-predis-purger.php | 1 - 1 file changed, 1 deletion(-) diff --git a/admin/class-predis-purger.php b/admin/class-predis-purger.php index 47057fc..91d1487 100644 --- a/admin/class-predis-purger.php +++ b/admin/class-predis-purger.php @@ -69,7 +69,6 @@ public function __construct() { return; } - } From dea6c185a53000359264998895b7399e46f76084 Mon Sep 17 00:00:00 2001 From: Vedant Gandhi Date: Fri, 27 Dec 2024 16:37:43 +0530 Subject: [PATCH 56/66] doc: remove the non existing contributor profile. --- README.md | 2 +- readme.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 264136e..4ad90c2 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, Vedant-Gandhi +**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, bryant1410, 1gor, matt-h, dotsam, nathanielks, rigagoogoo, dslatten, jinschoi, kelin1003, vaishuagola27, rahulsprajapati, utkarshpatel, gsayed786, shashwatmittal, sudhiryadav, thrijith, stayallive, jaredwsmith, abhijitrakas, umeshnevase, sid177, souptik, arafatkn, subscriptiongroup, akrocks, vedantgandhi28 **Tags:** nginx, cache, purge, nginx map, nginx cache, maps, fastcgi, proxy, redis, redis-cache, rewrite, permalinks diff --git a/readme.txt b/readme.txt index 20d01fa..ad961f8 100644 --- a/readme.txt +++ b/readme.txt @@ -1,5 +1,5 @@ === Nginx Helper === -Contributors: rtcamp, rahul286, saurabhshukla, manishsongirkar36, faishal, desaiuditd, darren-slatten, jk3us, daankortenbach, telofy, pjv, llonchj, jinnko, weskoop, bcole808, gungeekatx, rohanveer, chandrapatel, gagan0123, ravanh, michaelbeil, samedwards, niwreg, entr, nuvoPoint, 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, bryant1410, 1gor, matt-h, dotsam, nathanielks, rigagoogoo, dslatten, jinschoi, kelin1003, vaishuagola27, rahulsprajapati, utkarshpatel, gsayed786, shashwatmittal, sudhiryadav, thrijith, stayallive, jaredwsmith, abhijitrakas, umeshnevase, sid177, souptik, arafatkn, subscriptiongroup, akrocks, vedantgandhi28 Donate Link: http://rt.cx/eedonate/ Tags: nginx, cache, purge, nginx map, nginx cache, maps, fastcgi, proxy, redis, redis-cache, rewrite, permalinks License: GPLv2 or later (of-course) From 6eba2c17def9b23faa8b0c614b6cbf6e1a18b5c0 Mon Sep 17 00:00:00 2001 From: Vedant Gandhi Date: Fri, 27 Dec 2024 16:39:30 +0530 Subject: [PATCH 57/66] doc: update the tags --- README.md | 2 +- readme.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 4ad90c2..6e3e27a 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ **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, bryant1410, 1gor, matt-h, dotsam, nathanielks, rigagoogoo, dslatten, jinschoi, kelin1003, vaishuagola27, rahulsprajapati, utkarshpatel, gsayed786, shashwatmittal, sudhiryadav, thrijith, stayallive, jaredwsmith, abhijitrakas, umeshnevase, sid177, souptik, arafatkn, subscriptiongroup, akrocks, vedantgandhi28 -**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 diff --git a/readme.txt b/readme.txt index ad961f8..62caf57 100644 --- a/readme.txt +++ b/readme.txt @@ -1,7 +1,7 @@ === Nginx Helper === Contributors: rtcamp, rahul286, saurabhshukla, manishsongirkar36, faishal, desaiuditd, darren-slatten, jk3us, daankortenbach, telofy, pjv, llonchj, jinnko, weskoop, bcole808, gungeekatx, rohanveer, chandrapatel, gagan0123, ravanh, michaelbeil, samedwards, niwreg, entr, nuvoPoint, iam404, rittesh.patel, vishalkakadiya, BhargavBhandari90, bryant1410, 1gor, matt-h, dotsam, nathanielks, rigagoogoo, dslatten, jinschoi, kelin1003, vaishuagola27, rahulsprajapati, utkarshpatel, gsayed786, shashwatmittal, sudhiryadav, thrijith, stayallive, jaredwsmith, abhijitrakas, umeshnevase, sid177, souptik, arafatkn, subscriptiongroup, akrocks, vedantgandhi28 Donate Link: http://rt.cx/eedonate/ -Tags: nginx, cache, purge, nginx map, nginx cache, maps, fastcgi, proxy, redis, redis-cache, rewrite, permalinks +Tags: nginx, cache-purge, fastcgi, permalinks, redis-cache License: GPLv2 or later (of-course) License URI: http://www.gnu.org/licenses/gpl-2.0.html Requires at least: 3.0 From 026028cca6c1a3956be5de5e866bbd2f32093a4d Mon Sep 17 00:00:00 2001 From: Vedant Gandhi Date: Mon, 30 Dec 2024 11:24:52 +0530 Subject: [PATCH 58/66] doc: update the readme files for plugin version. --- README.md | 4 ++++ readme.txt | 5 +++++ 2 files changed, 9 insertions(+) diff --git a/README.md b/README.md index 6e3e27a..41a14da 100644 --- a/README.md +++ b/README.md @@ -161,6 +161,10 @@ Please post your problem in [our free support forum](https://github.com/rtCamp/n ## Changelog ## +### 2.3.1 ### + +* 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) + ### 2.3.0 ### * Disable the purge functionality when importing data. [#52](https://github.com/rtCamp/nginx-helper/pull/52) - by [Vedant Gandhi](https://github.com/Vedant-Gandhi) diff --git a/readme.txt b/readme.txt index 62caf57..bf10aba 100644 --- a/readme.txt +++ b/readme.txt @@ -147,6 +147,11 @@ Please post your problem in [our free support forum](https://github.com/rtCamp/n == Changelog == += 2.3.1 = + +* 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) + + = 2.3.0 = * Disable the purge functionality when importing data. [#52](https://github.com/rtCamp/nginx-helper/pull/52) - by [Vedant Gandhi](https://github.com/Vedant-Gandhi) From 020738512db6fefcd6120a5147ce9878e85194c1 Mon Sep 17 00:00:00 2001 From: Vedant Gandhi Date: Mon, 30 Dec 2024 11:38:40 +0530 Subject: [PATCH 59/66] doc: update the latest plugin version in stable tags. --- README.md | 2 +- includes/class-nginx-helper.php | 2 +- readme.txt | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 41a14da..7470bc5 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ **Tested up to:** 6.7 -**Stable tag:** 2.3.0 +**Stable tag:** 2.3.1 **License:** GPLv2 or later (of-course) diff --git a/includes/class-nginx-helper.php b/includes/class-nginx-helper.php index da16232..682359d 100644 --- a/includes/class-nginx-helper.php +++ b/includes/class-nginx-helper.php @@ -77,7 +77,7 @@ class Nginx_Helper { public function __construct() { $this->plugin_name = 'nginx-helper'; - $this->version = '2.3.0'; + $this->version = '2.3.1'; $this->minimum_wp = '3.0'; if ( ! $this->required_wp_version() ) { diff --git a/readme.txt b/readme.txt index bf10aba..475de8a 100644 --- a/readme.txt +++ b/readme.txt @@ -6,7 +6,7 @@ License: GPLv2 or later (of-course) License URI: http://www.gnu.org/licenses/gpl-2.0.html Requires at least: 3.0 Tested up to: 6.7 -Stable tag: 2.3.0 +Stable tag: 2.3.1 Cleans nginx's fastcgi/proxy cache or redis-cache whenever a post is edited/published. Also does a few more things. From 350caca843605f5ed9b00ac4e2ab81504e47d35b Mon Sep 17 00:00:00 2001 From: Vedant Gandhi Date: Mon, 30 Dec 2024 11:39:16 +0530 Subject: [PATCH 60/66] doc: update plugin version in meta. --- nginx-helper.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nginx-helper.php b/nginx-helper.php index 7c4d022..5a2a3d5 100644 --- a/nginx-helper.php +++ b/nginx-helper.php @@ -3,7 +3,7 @@ * Plugin Name: Nginx Helper * Plugin URI: https://rtcamp.com/nginx-helper/ * Description: Cleans nginx's fastcgi/proxy cache or redis-cache whenever a post is edited/published. Also does few more things. - * Version: 2.3.0 + * Version: 2.3.1 * Author: rtCamp * Author URI: https://rtcamp.com * Text Domain: nginx-helper From 2838c2e1078bd206545c7723c201807be95e556d Mon Sep 17 00:00:00 2001 From: Vedant Gandhi Date: Mon, 30 Dec 2024 12:02:12 +0530 Subject: [PATCH 61/66] doc: update the po and mo files. --- languages/nginx-helper.mo | Bin 472 -> 472 bytes languages/nginx-helper.po | 4 ++-- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/languages/nginx-helper.mo b/languages/nginx-helper.mo index d270649806b16b5fa8416aade094d6cf4c287b4f..d8d23afa562c0af3876cb46812dcc61ff4c9d0cc 100644 GIT binary patch delta 28 jcmcb?e1myH5ToJ7U|vRUV}lR_Gb>{QD-*NH*^IdWc*6&> delta 28 jcmcb?e1myH5Tn7yU|vRUL(32YGb;l_D-)y1*^IdWc;^SQ diff --git a/languages/nginx-helper.po b/languages/nginx-helper.po index 55fa766..6b53479 100644 --- a/languages/nginx-helper.po +++ b/languages/nginx-helper.po @@ -2,14 +2,14 @@ # This file is distributed under the same license as the Nginx Helper plugin. msgid "" msgstr "" -"Project-Id-Version: Nginx Helper 2.3.0\n" +"Project-Id-Version: Nginx Helper 2.3.1\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-12-19T06:01:42+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.11.0\n" "X-Domain: nginx-helper\n" From 54d5af0b338ce6f68108fc09ea0643e68ee728fe Mon Sep 17 00:00:00 2001 From: Vedant Gandhi Date: Mon, 30 Dec 2024 13:22:35 +0530 Subject: [PATCH 62/66] build: update the WORDPRESS_USERNAME and WORDPRESS_PASSWORD to SVN_USERNAME and SVN_PASSWORD. --- .github/workflows/create.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/create.yml b/.github/workflows/create.yml index cd1263f..f790377 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 }} + SVN_PASSWORD: ${{ secrets.SVN_PASSWORD }} + SVN_USERNAME: ${{ secrets.SVN_USERNAME }} From 29f6fc6cbe26f79bd7c0c3a0bdb0b3cfa9e8dc8f Mon Sep 17 00:00:00 2001 From: Vedant Gandhi Date: Mon, 30 Dec 2024 15:20:46 +0530 Subject: [PATCH 63/66] build: replace the auth variables in github actions. --- .github/workflows/create.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/create.yml b/.github/workflows/create.yml index f790377..55d7f93 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 - SVN_PASSWORD: ${{ secrets.SVN_PASSWORD }} - SVN_USERNAME: ${{ secrets.SVN_USERNAME }} + WORDPRESS_PASSWORD: ${{ secrets.SVN_PASSWORD }} + WORDPRESS_USERNAME: ${{ secrets.SVN_USERNAME }} From ec5736211ee33cd0f1d80104b2a1f59ebc43f525 Mon Sep 17 00:00:00 2001 From: Rishav Dutta Date: Mon, 13 Jan 2025 19:53:35 +0530 Subject: [PATCH 64/66] update: update artifact version --- .github/workflows/e2e-test.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/e2e-test.yml b/.github/workflows/e2e-test.yml index 765f7a7..7f89ffe 100644 --- a/.github/workflows/e2e-test.yml +++ b/.github/workflows/e2e-test.yml @@ -9,6 +9,7 @@ on: branches: - develop - master + - update/artifact-version pull_request: branches: @@ -52,7 +53,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 From 7f00fd3cb2bb67d93fd88d7506ec1f5484144f69 Mon Sep 17 00:00:00 2001 From: Rishav Dutta Date: Mon, 13 Jan 2025 20:02:07 +0530 Subject: [PATCH 65/66] update: update the push trigger --- .github/workflows/e2e-test.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/e2e-test.yml b/.github/workflows/e2e-test.yml index 7f89ffe..cd20427 100644 --- a/.github/workflows/e2e-test.yml +++ b/.github/workflows/e2e-test.yml @@ -9,7 +9,6 @@ on: branches: - develop - master - - update/artifact-version pull_request: branches: From 7eb56dd2ca9dc8420129762c49afd8861f719d9a Mon Sep 17 00:00:00 2001 From: Rishav Dutta Date: Wed, 15 Jan 2025 10:37:28 +0530 Subject: [PATCH 66/66] update: remove workflow trigger --- .github/workflows/e2e-test.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/e2e-test.yml b/.github/workflows/e2e-test.yml index cd20427..4e114c5 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: