Skip to content

Commit

Permalink
Merge pull request #335 from rtCamp/fix/GH-333
Browse files Browse the repository at this point in the history
GH-333: Fatal Error on Empty Redis Port Setting in Nginx Helper Plugin [Master]
  • Loading branch information
Pathan-Amaankhan authored Apr 15, 2024
2 parents 5ffd1ab + 8699ac1 commit 80c589d
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions admin/partials/nginx-helper-general-options.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,17 +59,24 @@
$nginx_helper_admin->nginx_helper_default_settings()
);

$site_options = get_site_option( 'rt_wp_nginx_helper_options', array() );
$site_options = get_site_option( 'rt_wp_nginx_helper_options', array() );

// Uncheck checkbox fields whose default value is `1` but user has unchecked.
foreach ( $nginx_helper_admin->nginx_helper_default_settings() as $default_setting_field => $default_setting_value ) {
foreach ( $nginx_helper_admin->nginx_helper_default_settings() as $default_setting_field => $default_setting_value ) {

if ( 1 === $default_setting_value && isset( $site_options[ $default_setting_field ] ) && empty( $all_inputs[ $default_setting_field ] ) ) {
// Uncheck checkbox fields whose default value is `1` but user has unchecked.
if ( 1 === $default_setting_value && isset( $site_options[ $default_setting_field ] ) && empty( $all_inputs[ $default_setting_field ] ) ) {

$nginx_settings[ $default_setting_field ] = 0;
$nginx_settings[ $default_setting_field ] = 0;

}
}
}

// Populate the setting field with default value when it is empty.
if ( '' === $nginx_settings[ $default_setting_field ] ) {

$nginx_settings[ $default_setting_field ] = $default_setting_value;

}
}

if ( ( ! is_numeric( $nginx_settings['log_filesize'] ) ) || ( empty( $nginx_settings['log_filesize'] ) ) ) {
$error_log_filesize = __( 'Log file size must be a number.', 'nginx-helper' );
Expand Down

0 comments on commit 80c589d

Please sign in to comment.