Merged in feature/280-dev-dev01 (pull request #21)

auto-patch  280-dev-dev01-2024-01-19T16_41_58

* auto-patch  280-dev-dev01-2024-01-19T16_41_58
This commit is contained in:
Tony Volpe
2024-01-19 16:44:43 +00:00
parent 2699b5437a
commit be83910651
2125 changed files with 179300 additions and 35639 deletions

View File

@@ -53,7 +53,7 @@ class Nginx_Helper_Admin {
*
* @since 2.0.0
* @access public
* @var string $options Purge options.
* @var string[] $options Purge options.
*/
public $options;
@@ -345,6 +345,27 @@ class Nginx_Helper_Admin {
}
/**
* Check if the nginx log is enabled.
*
* @since 2.2.4
* @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.
*
@@ -732,10 +753,10 @@ class Nginx_Helper_Admin {
}
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' );

View File

@@ -529,7 +529,7 @@ abstract class Purger {
global $nginx_helper_admin;
if ( ! $nginx_helper_admin->options['enable_log'] ) {
if ( ! $nginx_helper_admin->is_nginx_log_enabled() ) {
return;
}
@@ -562,7 +562,7 @@ abstract class Purger {
global $nginx_helper_admin;
if ( ! $nginx_helper_admin->options['enable_log'] ) {
if ( ! $nginx_helper_admin->is_nginx_log_enabled() ) {
return;
}

View File

@@ -98,3 +98,8 @@ form#purgeall .button-primary:focus {
}
.rt-purge_url { width: 100%; }
.enable-logging-message {
font-size: 13px;
margin-left: 23px;
}

View File

@@ -539,9 +539,46 @@ if ( is_multisite() ) {
<?php } ?>
<tr valign="top">
<td>
<input type="checkbox" value="1" id="enable_log" name="enable_log"<?php checked( $nginx_helper_settings['enable_log'], 1 ); ?> />
<?php
$is_checkbox_enabled = false;
if ( 1 === (int) $nginx_helper_settings['enable_log'] ) {
$is_checkbox_enabled = true;
}
?>
<input
type="checkbox" value="1" id="enable_log" name="enable_log"
<?php checked( $nginx_helper_admin->is_nginx_log_enabled(), true ); ?>
<?php echo esc_attr( $is_checkbox_enabled ? '' : ' disabled ' ); ?>
/>
<label for="enable_log">
<?php esc_html_e( 'Enable Logging', 'nginx-helper' ); ?>
<?php
if ( ! $is_checkbox_enabled ) {
$setting_message_detail = [
'status' => __( 'disable', 'nginx-helper' ),
'value' => 'false',
];
if ( ! $nginx_helper_admin->is_nginx_log_enabled() ) {
$setting_message_detail = [
'status' => __( 'enable', 'nginx-helper' ),
'value' => 'true',
];
}
printf(
'<p class="enable-logging-message">(<b>%1$s:</b> %2$s %3$s %4$s <b>NGINX_HELPER_LOG</b> constant %5$s <b>%6$s</b> %7$s <b>wp-config.php</b>)</p>',
esc_html__( 'NOTE', 'nginx-helper' ),
esc_html__( 'To', 'nginx-helper' ),
esc_html( $setting_message_detail['status'] ),
esc_html__( 'the logging feature, you must define', 'nginx-helper' ),
esc_html__( 'as', 'nginx-helper' ),
esc_html( $setting_message_detail['value'] ),
esc_html__( 'in your', 'nginx-helper' )
);
}
?>
</label>
</td>
</tr>
@@ -626,7 +663,7 @@ if ( is_multisite() ) {
<?php
}
?>
<div class="postbox enable_log"<?php echo ( empty( $nginx_helper_settings['enable_log'] ) ) ? ' style="display: none;"' : ''; ?>>
<div class="postbox enable_log"<?php echo ( ! $nginx_helper_admin->is_nginx_log_enabled() ) ? ' style="display: none;"' : ''; ?>>
<h3 class="hndle">
<span><?php esc_html_e( 'Logging Options', 'nginx-helper' ); ?></span>
</h3>

View File

@@ -77,7 +77,7 @@ class Nginx_Helper {
public function __construct() {
$this->plugin_name = 'nginx-helper';
$this->version = '2.2.3';
$this->version = '2.2.4';
$this->minimum_wp = '3.0';
if ( ! $this->required_wp_version() ) {

View File

@@ -1,17 +1,17 @@
# Copyright (C) 2023 rtCamp
# Copyright (C) 2024 rtCamp
# This file is distributed under the same license as the Nginx Helper plugin.
msgid ""
msgstr ""
"Project-Id-Version: Nginx Helper 2.2.3\n"
"Project-Id-Version: Nginx Helper 2.2.4\n"
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/nginx-helper\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"POT-Creation-Date: 2023-05-10T09:58:20+00:00\n"
"POT-Creation-Date: 2024-01-17T06:18:22+00:00\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"X-Generator: WP-CLI 2.7.1\n"
"X-Generator: WP-CLI 2.8.1\n"
"X-Domain: nginx-helper\n"
#. Plugin Name of the plugin
@@ -62,15 +62,15 @@ msgstr ""
msgid "Settings"
msgstr ""
#: admin/class-nginx-helper-admin.php:404
#: admin/class-nginx-helper-admin.php:425
msgid "No items"
msgstr ""
#: admin/class-nginx-helper-admin.php:415
#: admin/class-nginx-helper-admin.php:436
msgid "Posted "
msgstr ""
#: admin/class-nginx-helper-admin.php:746
#: admin/class-nginx-helper-admin.php:775
msgid "Purge initiated"
msgstr ""
@@ -236,282 +236,310 @@ msgstr ""
msgid "Nginx Settings"
msgstr ""
#: admin/partials/nginx-helper-general-options.php:56
#: admin/partials/nginx-helper-general-options.php:62
msgid "Log file size must be a number."
msgstr ""
#: admin/partials/nginx-helper-general-options.php:66
#: admin/partials/nginx-helper-general-options.php:72
msgid "Settings saved."
msgstr ""
#: admin/partials/nginx-helper-general-options.php:93
#: admin/partials/nginx-helper-general-options.php:99
msgid "Purging Options"
msgstr ""
#: admin/partials/nginx-helper-general-options.php:100
#: admin/partials/nginx-helper-general-options.php:106
msgid "Enable Purge"
msgstr ""
#: admin/partials/nginx-helper-general-options.php:110
#: admin/partials/nginx-helper-general-options.php:116
msgid "Caching Method"
msgstr ""
#: admin/partials/nginx-helper-general-options.php:122
#: admin/partials/nginx-helper-general-options.php:128
msgid "nginx Fastcgi cache"
msgstr ""
#: admin/partials/nginx-helper-general-options.php:124
#: admin/partials/nginx-helper-general-options.php:130
msgid "External settings for nginx"
msgstr ""
#: admin/partials/nginx-helper-general-options.php:125
#: admin/partials/nginx-helper-general-options.php:131
msgid "requires external settings for nginx"
msgstr ""
#: admin/partials/nginx-helper-general-options.php:135
#: admin/partials/nginx-helper-general-options.php:141
msgid "Redis cache"
msgstr ""
#: admin/partials/nginx-helper-general-options.php:145
#: admin/partials/nginx-helper-general-options.php:151
msgid "Purge Method"
msgstr ""
#: admin/partials/nginx-helper-general-options.php:155
#: admin/partials/nginx-helper-general-options.php:335
#: admin/partials/nginx-helper-general-options.php:161
#: admin/partials/nginx-helper-general-options.php:341
msgid "when a post/page/custom post is published."
msgstr ""
#: admin/partials/nginx-helper-general-options.php:165
#: admin/partials/nginx-helper-general-options.php:171
msgid "Using a GET request to"
msgstr ""
#: admin/partials/nginx-helper-general-options.php:166
#: admin/partials/nginx-helper-general-options.php:172
msgid "(Default option)"
msgstr ""
#. translators: %s Nginx cache purge module link.
#: admin/partials/nginx-helper-general-options.php:177
#: admin/partials/nginx-helper-general-options.php:183
msgid "Uses the %s module."
msgstr ""
#: admin/partials/nginx-helper-general-options.php:195
#: admin/partials/nginx-helper-general-options.php:201
msgid "Delete local server cache files"
msgstr ""
#: admin/partials/nginx-helper-general-options.php:201
#: admin/partials/nginx-helper-general-options.php:207
msgid "Checks for matching cache file in <strong>RT_WP_NGINX_HELPER_CACHE_PATH</strong>. 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:216
#: admin/partials/nginx-helper-general-options.php:222
msgid "Redis Settings"
msgstr ""
#: admin/partials/nginx-helper-general-options.php:221
#: admin/partials/nginx-helper-general-options.php:227
msgid "Hostname"
msgstr ""
#: admin/partials/nginx-helper-general-options.php:228
#: admin/partials/nginx-helper-general-options.php:243
#: admin/partials/nginx-helper-general-options.php:258
#: admin/partials/nginx-helper-general-options.php:234
#: admin/partials/nginx-helper-general-options.php:249
#: admin/partials/nginx-helper-general-options.php:264
msgid "Overridden by constant variables."
msgstr ""
#: admin/partials/nginx-helper-general-options.php:236
#: admin/partials/nginx-helper-general-options.php:242
msgid "Port"
msgstr ""
#: admin/partials/nginx-helper-general-options.php:251
#: admin/partials/nginx-helper-general-options.php:257
msgid "Prefix"
msgstr ""
#: admin/partials/nginx-helper-general-options.php:271
#: admin/partials/nginx-helper-general-options.php:277
msgid "Purging Conditions"
msgstr ""
#: admin/partials/nginx-helper-general-options.php:276
#: admin/partials/nginx-helper-general-options.php:282
msgid "Purge Homepage:"
msgstr ""
#: admin/partials/nginx-helper-general-options.php:283
#: admin/partials/nginx-helper-general-options.php:289
msgid "when a post/page/custom post is modified or added."
msgstr ""
#: admin/partials/nginx-helper-general-options.php:292
#: admin/partials/nginx-helper-general-options.php:419
#: admin/partials/nginx-helper-general-options.php:298
#: admin/partials/nginx-helper-general-options.php:425
msgid "when a <strong>post</strong> (or page/custom post) is <strong>modified</strong> or <strong>added</strong>."
msgstr ""
#: admin/partials/nginx-helper-general-options.php:304
#: admin/partials/nginx-helper-general-options.php:310
msgid "when an existing post/page/custom post is modified."
msgstr ""
#: admin/partials/nginx-helper-general-options.php:313
#: admin/partials/nginx-helper-general-options.php:319
msgid "when a <strong>published post</strong> (or page/custom post) is <strong>trashed</strong>"
msgstr ""
#: admin/partials/nginx-helper-general-options.php:327
#: admin/partials/nginx-helper-general-options.php:333
msgid "Purge Post/Page/Custom Post Type:"
msgstr ""
#: admin/partials/nginx-helper-general-options.php:344
#: admin/partials/nginx-helper-general-options.php:350
msgid "when a <strong>post</strong> is <strong>published</strong>."
msgstr ""
#: admin/partials/nginx-helper-general-options.php:356
#: admin/partials/nginx-helper-general-options.php:453
#: admin/partials/nginx-helper-general-options.php:362
#: admin/partials/nginx-helper-general-options.php:459
msgid "when a comment is approved/published."
msgstr ""
#: admin/partials/nginx-helper-general-options.php:365
#: admin/partials/nginx-helper-general-options.php:462
#: admin/partials/nginx-helper-general-options.php:371
#: admin/partials/nginx-helper-general-options.php:468
msgid "when a <strong>comment</strong> is <strong>approved/published</strong>."
msgstr ""
#: admin/partials/nginx-helper-general-options.php:377
#: admin/partials/nginx-helper-general-options.php:474
#: admin/partials/nginx-helper-general-options.php:383
#: admin/partials/nginx-helper-general-options.php:480
msgid "when a comment is unapproved/deleted."
msgstr ""
#: admin/partials/nginx-helper-general-options.php:386
#: admin/partials/nginx-helper-general-options.php:483
#: admin/partials/nginx-helper-general-options.php:392
#: admin/partials/nginx-helper-general-options.php:489
msgid "when a <strong>comment</strong> is <strong>unapproved/deleted</strong>."
msgstr ""
#: admin/partials/nginx-helper-general-options.php:400
#: admin/partials/nginx-helper-general-options.php:406
msgid "Purge Archives:"
msgstr ""
#: admin/partials/nginx-helper-general-options.php:402
#: admin/partials/nginx-helper-general-options.php:408
msgid "(date, category, tag, author, custom taxonomies)"
msgstr ""
#: admin/partials/nginx-helper-general-options.php:410
#: admin/partials/nginx-helper-general-options.php:416
msgid "when an post/page/custom post is modified or added"
msgstr ""
#: admin/partials/nginx-helper-general-options.php:431
#: admin/partials/nginx-helper-general-options.php:437
msgid "when an existing post/page/custom post is trashed."
msgstr ""
#: admin/partials/nginx-helper-general-options.php:440
#: admin/partials/nginx-helper-general-options.php:446
msgid "when a <strong>published post</strong> (or page/custom post) is <strong>trashed</strong>."
msgstr ""
#: admin/partials/nginx-helper-general-options.php:496
#: admin/partials/nginx-helper-general-options.php:502
msgid "Custom Purge URL:"
msgstr ""
#: admin/partials/nginx-helper-general-options.php:502
#: admin/partials/nginx-helper-general-options.php:508
msgid "Add one URL per line. URL should not contain domain name."
msgstr ""
#: admin/partials/nginx-helper-general-options.php:505
#: admin/partials/nginx-helper-general-options.php:511
msgid "Eg: To purge http://example.com/sample-page/ add <strong>/sample-page/</strong> in above textarea."
msgstr ""
#: admin/partials/nginx-helper-general-options.php:509
#: admin/partials/nginx-helper-general-options.php:515
msgid "'*' will only work with redis cache server."
msgstr ""
#: admin/partials/nginx-helper-general-options.php:519
#: admin/partials/nginx-helper-general-options.php:525
msgid "Debug Options"
msgstr ""
#: admin/partials/nginx-helper-general-options.php:529
#: admin/partials/nginx-helper-general-options.php:535
msgid "Enable Nginx Map."
msgstr ""
#: admin/partials/nginx-helper-general-options.php:538
#: admin/partials/nginx-helper-general-options.php:554
msgid "Enable Logging"
msgstr ""
#: admin/partials/nginx-helper-general-options.php:546
#: admin/partials/nginx-helper-general-options.php:559
msgid "disable"
msgstr ""
#: admin/partials/nginx-helper-general-options.php:565
msgid "enable"
msgstr ""
#: admin/partials/nginx-helper-general-options.php:572
msgid "NOTE"
msgstr ""
#: admin/partials/nginx-helper-general-options.php:573
msgid "To"
msgstr ""
#: admin/partials/nginx-helper-general-options.php:575
msgid "the logging feature, you must define"
msgstr ""
#: admin/partials/nginx-helper-general-options.php:576
msgid "as"
msgstr ""
#: admin/partials/nginx-helper-general-options.php:578
msgid "in your"
msgstr ""
#: admin/partials/nginx-helper-general-options.php:589
msgid "Enable Nginx Timestamp in HTML"
msgstr ""
#: admin/partials/nginx-helper-general-options.php:560
#: admin/partials/nginx-helper-general-options.php:603
msgid "Nginx Map"
msgstr ""
#: admin/partials/nginx-helper-general-options.php:569
#: admin/partials/nginx-helper-general-options.php:612
msgid "Can't write on map file."
msgstr ""
#. translators: %s file url.
#: admin/partials/nginx-helper-general-options.php:574
#: admin/partials/nginx-helper-general-options.php:646
#: admin/partials/nginx-helper-general-options.php:617
#: admin/partials/nginx-helper-general-options.php:689
msgid "Check you have write permission on <strong>%s</strong>"
msgstr ""
#: admin/partials/nginx-helper-general-options.php:591
#: admin/partials/nginx-helper-general-options.php:634
msgid "Nginx Map path to include in nginx settings"
msgstr ""
#: admin/partials/nginx-helper-general-options.php:592
#: admin/partials/nginx-helper-general-options.php:635
msgid "(recommended)"
msgstr ""
#: admin/partials/nginx-helper-general-options.php:605
#: admin/partials/nginx-helper-general-options.php:648
msgid "Or,"
msgstr ""
#: admin/partials/nginx-helper-general-options.php:606
#: admin/partials/nginx-helper-general-options.php:649
msgid "Text to manually copy and paste in nginx settings"
msgstr ""
#: admin/partials/nginx-helper-general-options.php:607
#: admin/partials/nginx-helper-general-options.php:650
msgid "(if your network is small and new sites are not added frequently)"
msgstr ""
#: admin/partials/nginx-helper-general-options.php:625
#: admin/partials/nginx-helper-general-options.php:668
msgid "Logging Options"
msgstr ""
#: admin/partials/nginx-helper-general-options.php:641
#: admin/partials/nginx-helper-general-options.php:684
msgid "Can't write on log file."
msgstr ""
#: admin/partials/nginx-helper-general-options.php:663
#: admin/partials/nginx-helper-general-options.php:706
msgid "Logs path"
msgstr ""
#: admin/partials/nginx-helper-general-options.php:675
#: admin/partials/nginx-helper-general-options.php:718
msgid "View Log"
msgstr ""
#: admin/partials/nginx-helper-general-options.php:680
#: admin/partials/nginx-helper-general-options.php:723
msgid "Log"
msgstr ""
#: admin/partials/nginx-helper-general-options.php:687
#: admin/partials/nginx-helper-general-options.php:730
msgid "Log level"
msgstr ""
#: admin/partials/nginx-helper-general-options.php:692
#: admin/partials/nginx-helper-general-options.php:735
msgid "None"
msgstr ""
#: admin/partials/nginx-helper-general-options.php:693
#: admin/partials/nginx-helper-general-options.php:736
msgid "Info"
msgstr ""
#: admin/partials/nginx-helper-general-options.php:694
#: admin/partials/nginx-helper-general-options.php:737
msgid "Warning"
msgstr ""
#: admin/partials/nginx-helper-general-options.php:695
#: admin/partials/nginx-helper-general-options.php:738
msgid "Error"
msgstr ""
#: admin/partials/nginx-helper-general-options.php:702
#: admin/partials/nginx-helper-general-options.php:745
msgid "Max log file size"
msgstr ""
#: admin/partials/nginx-helper-general-options.php:708
#: admin/partials/nginx-helper-general-options.php:751
msgid "Mb"
msgstr ""
#: admin/partials/nginx-helper-general-options.php:725
#: admin/partials/nginx-helper-general-options.php:768
msgid "Save All Changes"
msgstr ""

View File

@@ -3,13 +3,13 @@
* 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.3
* Version: 2.2.4
* Author: rtCamp
* Author URI: https://rtcamp.com
* Text Domain: nginx-helper
* Domain Path: /languages
* Requires at least: 3.0
* Tested up to: 5.4
* Tested up to: 6.4
*
* @link https://rtcamp.com/nginx-helper/
* @since 2.0.0

View File

@@ -5,8 +5,8 @@ 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.4
Stable tag: 2.2.3
Tested up to: 6.4.2
Stable tag: 2.2.4
Cleans nginx's fastcgi/proxy cache or redis-cache whenever a post is edited/published. Also does a few more things.
@@ -127,6 +127,10 @@ Please post your problem in [our free support forum](https://github.com/rtCamp/n
== Changelog ==
= 2.2.4 =
* Introduces the capability to specify the `NGINX_HELPER_LOG` constant, allowing users to activate the logging feature. [#318](https://github.com/rtCamp/nginx-helper/pull/318) - by [Vishal Kakadiya](https://github.com/vishalkakadiya)
* Existing users employing the nginx-helper plugin with logging enabled will experience no disruptions. However, if logging is disabled, users must define the `NGINX_HELPER_LOG` constant to re-enable the logging feature.
= 2.2.3 =
* Add the URL being purged as parameter in `rt_nginx_helper_purge_cached_file` hook. [#271](https://github.com/rtCamp/nginx-helper/pull/271) - by [Arafat Islam](https://github.com/arafatkn)
* Fix performance issue when saving nav menus. [#112](https://github.com/rtCamp/nginx-helper/issues/112), [#272](https://github.com/rtCamp/nginx-helper/pull/272/) - by [Arafat Islam](https://github.com/arafatkn)
@@ -422,4 +426,4 @@ Fix url escaping [#82](https://github.com/rtCamp/nginx-helper/pull/82) - by
== Upgrade Notice ==
= 2.2.3 =
Nginx Helper 2.2.3, Fix performance issue when saving nav menus, purging date archives for CPTs, purge page and post URLs when the post is trashed and passes the URL being purged in "rt_nginx_helper_purge_cached_file" hook as parameter.
Nginx Helper 2.2.3, Fix performance issue when saving nav menus, purging date archives for CPTs, purge page and post URLs when the post is trashed and passes the URL being purged in "rt_nginx_helper_purge_cached_file" hook as parameter.