-
Notifications
You must be signed in to change notification settings - Fork 121
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
Handle Predis Exception when Database is Out of Bounds. #376
Conversation
[v2.3.0] Bump Plugin Version and Update Readme Files
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approving with minor changes. Please test the change locally before merging.
admin/class-predis-purger.php
Outdated
@@ -60,14 +60,16 @@ public function __construct() { | |||
|
|||
try { | |||
$this->redis_object->connect(); | |||
|
|||
if( $nginx_helper_admin->options['redis_database'] !== 0 ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if( $nginx_helper_admin->options['redis_database'] !== 0 ) { | |
if( 0 !== $nginx_helper_admin->options['redis_database'] ) { |
admin/class-predis-purger.php
Outdated
@@ -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'] ) ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if( !empty( $nginx_helper_admin->options['redis_unix_socket'] ) ) { | |
if( ! empty( $nginx_helper_admin->options['redis_unix_socket'] ) ) { |
admin/class-predis-purger.php
Outdated
@@ -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']); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$this->redis_object->select($nginx_helper_admin->options['redis_database']); | |
$this->redis_object->select( $nginx_helper_admin->options['redis_database'] ); |
admin/class-predis-purger.php
Outdated
if( $nginx_helper_admin->options['redis_database'] !== 0 ) { | ||
$this->redis_object->select($nginx_helper_admin->options['redis_database']); | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove additional new line.
Description
The aim of this PR is to handle the exception when the database number for Predis is out of bounds.
Type
Reference Issue
Testing
The code has been tested locally and is working as expected.