Skip to content

Commit

Permalink
restore the main plugin file to the original
Browse files Browse the repository at this point in the history
  • Loading branch information
jazzsequence committed Apr 19, 2023
1 parent 1fc2b66 commit 05de5ef
Showing 1 changed file with 13 additions and 15 deletions.
28 changes: 13 additions & 15 deletions wp-redis.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@
* Author: Pantheon, Josh Koenig, Matthew Boynes, Daniel Bachhuber, Alley Interactive
* Author URI: https://pantheon.io/
*/

/*
This program is free software; you can redistribute it and/or modify
/* This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
Expand Down Expand Up @@ -39,18 +37,18 @@ function wp_redis_get_info() {
if ( empty( $redis_server ) ) {
// Attempt to automatically load Pantheon's Redis config from the env.
if ( isset( $_SERVER['CACHE_HOST'] ) ) {
$redis_server = [
'host' => sanitize_text_field( $_SERVER['CACHE_HOST'] ),
'port' => sanitize_text_field( $_SERVER['CACHE_PORT'] ),
'auth' => sanitize_text_field( $_SERVER['CACHE_PASSWORD'] ),
'database' => isset( $_SERVER['CACHE_DB'] ) ? sanitize_text_field( $_SERVER['CACHE_DB'] ) : 0,
];
$redis_server = array(
'host' => $_SERVER['CACHE_HOST'],
'port' => $_SERVER['CACHE_PORT'],
'auth' => $_SERVER['CACHE_PASSWORD'],
'database' => isset( $_SERVER['CACHE_DB'] ) ? $_SERVER['CACHE_DB'] : 0,
);
} else {
$redis_server = [
'host' => '127.0.0.1',
'port' => 6379,
$redis_server = array(
'host' => '127.0.0.1',
'port' => 6379,
'database' => 0,
];
);
}
}

Expand Down Expand Up @@ -78,7 +76,7 @@ function wp_redis_get_info() {
if ( isset( $info[ 'db' . $database ] ) && preg_match( '#keys=([\d]+)#', $info[ 'db' . $database ], $matches ) ) {
$key_count = $matches[1];
}
return [
return array(
'status' => 'connected',
'used_memory' => $info['used_memory_human'],
'uptime' => $uptime_in_days,
Expand All @@ -89,5 +87,5 @@ function wp_redis_get_info() {
'redis_port' => ! empty( $redis_server['port'] ) ? $redis_server['port'] : 6379,
'redis_auth' => ! empty( $redis_server['auth'] ) ? $redis_server['auth'] : '',
'redis_database' => $database,
];
);
}

0 comments on commit 05de5ef

Please sign in to comment.