Skip to content

Commit

Permalink
Merge pull request #318 from rtCamp/develop
Browse files Browse the repository at this point in the history
Develop to Master merge for v2.2.4 [Production]
  • Loading branch information
vishalkakadiya authored Jan 18, 2024
2 parents 23f7b70 + ba46696 commit d894f3e
Show file tree
Hide file tree
Showing 14 changed files with 259 additions and 165 deletions.
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 automation@example.com --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

0 comments on commit d894f3e

Please sign in to comment.