Skip to content

Develop to Master merge for v2.2.4 [Production] #318

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 29 commits into from
Jan 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
aa55966
Fix broken banner image
HrithikDalal May 11, 2022
e1c398e
Add e2e test cases for nginx-helper plugin
Dec 1, 2022
1ec423f
Merge pull request #288 from rtCamp/add/tests
pavanpatil1 Dec 1, 2022
5e129b9
Syncs develop with master
Pathan-Amaankhan Feb 8, 2023
7a986ee
Merge pull request #293 from rtCamp/sync-dev-with-master
gagan0123 Feb 8, 2023
866eff3
Merge branch 'master' into develop
Oct 3, 2023
0c6c6f4
Add constant check for enabling log files
Jan 12, 2024
05051ae
Update typo
Jan 12, 2024
5036b35
Add text
Jan 12, 2024
96816de
Fix CI issue
Jan 12, 2024
ce65654
Update message
Jan 12, 2024
4f7e428
Add checks
Jan 12, 2024
8e7e179
Add checks
Jan 12, 2024
236e329
Add checks
Jan 12, 2024
cc93a3a
Update constant name
Jan 12, 2024
9fbad5c
Fix the test case according to newly added functionlity
Jan 12, 2024
a4d50b3
Merge branch 'feature/secure-log-file' of https://github.com/rtCamp/n…
Jan 12, 2024
bb27562
Add spacing in the message
vishalkakadiya Jan 12, 2024
7fdda3c
Add spacing in the message
vishalkakadiya Jan 12, 2024
d4ab0e5
Update settings messsage and styling
Jan 15, 2024
7817946
Update settings messsage and styling
Jan 15, 2024
bd04e0b
Update message to enable/disable option based on current status
Jan 15, 2024
157f711
Add condition to add checks for the logging messagge
Jan 16, 2024
f4de775
Update playwright test
Jan 16, 2024
e1ab3ee
Merge pull request #316 from rtCamp/feature/secure-log-file
vishalkakadiya Jan 17, 2024
52f03a7
Add changelog and version upgrade details
Jan 17, 2024
0e05fd3
Update language files
Jan 17, 2024
859fee8
Empty commit to check deployment
Jan 17, 2024
ba46696
Merge pull request #319 from rtCamp/version-update/v2.2.4
vishalkakadiya Jan 17, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions .github/ci/main.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ function start_services() {
# Create, setup and populate learn.rtcamp.com base site with data
function create_and_configure_site () {

ee site create $SITE_NAME --wp --php74
ee site create $SITE_NAME --wp --php74
cd $SITE_ROOT/wp-content/plugins/
rm -rf nginx-helper
ls
Expand All @@ -36,7 +36,6 @@ function create_and_configure_site () {
ls
wp plugin activate nginx-helper --allow-root
wp user create automation [email protected] --role=administrator --user_pass=automation --allow-root
wp theme activate twentytwentyone --allow-root
}


Expand All @@ -55,7 +54,7 @@ function build_package(){
}

function install_playwright(){
cd $GITHUB_WORKSPACE/tests/e2e-playwright
cd $GITHUB_WORKSPACE/tests/e2e-playwright
npx playwright install
}

Expand Down Expand Up @@ -96,4 +95,4 @@ function main() {
run_playwright_tests
}

main
main
10 changes: 5 additions & 5 deletions .github/workflows/e2e-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ name: End-to-End Tests
on:
# Triggers the workflow on push or pull request events but only for the main branch
push:
branches:
branches:
- develop
- master

pull_request:
branches:
branches:
- develop
- master

Expand All @@ -23,14 +23,14 @@ jobs:
# The type of runner that the job will run on
name: Playwright Tests
runs-on: ubuntu-latest
env:
env:
TESRESULT_TOKEN: ${{ secrets.TESRESULT_TOKEN }}
TOKEN: ${{ secrets.GITHUB_TOKEN }}
SHA: ${{ github.event.pull_request.head.sha }}
COMMIT_SHA: ${{ github.sha }}
PR_NUMBER: ${{ github.event.pull_request.number }}
working-directory: ./tests/e2e-playwright

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
Expand Down
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,11 @@ 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)
Expand Down
27 changes: 24 additions & 3 deletions admin/class-nginx-helper-admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -345,6 +345,27 @@ public function nginx_helper_settings_link( $links ) {

}

/**
* 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.
*
Expand Down Expand Up @@ -732,10 +753,10 @@ public function purge_all() {
}

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' );
Expand Down
4 changes: 2 additions & 2 deletions admin/class-purger.php
Original file line number Diff line number Diff line change
Expand Up @@ -529,7 +529,7 @@ public function log( $msg, $level = 'INFO' ) {

global $nginx_helper_admin;

if ( ! $nginx_helper_admin->options['enable_log'] ) {
if ( ! $nginx_helper_admin->is_nginx_log_enabled() ) {
return;
}

Expand Down Expand Up @@ -562,7 +562,7 @@ public function check_and_truncate_log_file() {

global $nginx_helper_admin;

if ( ! $nginx_helper_admin->options['enable_log'] ) {
if ( ! $nginx_helper_admin->is_nginx_log_enabled() ) {
return;
}

Expand Down
5 changes: 5 additions & 0 deletions admin/css/nginx-helper-admin.css
Original file line number Diff line number Diff line change
Expand Up @@ -98,3 +98,8 @@ form#purgeall .button-primary:focus {
}

.rt-purge_url { width: 100%; }

.enable-logging-message {
font-size: 13px;
margin-left: 23px;
}
41 changes: 39 additions & 2 deletions admin/partials/nginx-helper-general-options.php
Original file line number Diff line number Diff line change
Expand Up @@ -539,9 +539,46 @@
<?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>
Expand Down Expand Up @@ -626,7 +663,7 @@
<?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>
Expand Down
2 changes: 1 addition & 1 deletion includes/class-nginx-helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -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() ) {
Expand Down
Binary file modified languages/nginx-helper.mo
Binary file not shown.
Loading