From 886acead63621e32950fffd1b45a8611debde1d8 Mon Sep 17 00:00:00 2001 From: Joshua Ramon Enslin Date: Wed, 2 Dec 2020 09:39:43 +0100 Subject: [PATCH] Stop using cache in MD_STD_CACHE when run from command line --- MD_STD_CACHE.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/MD_STD_CACHE.php b/MD_STD_CACHE.php index 89639e2..9cde874 100644 --- a/MD_STD_CACHE.php +++ b/MD_STD_CACHE.php @@ -48,6 +48,8 @@ final class MD_STD_CACHE { */ public static function serve_page_through_redis_cache(string $redisKey, int $expiry = 3600):string { + if (PHP_SAPI === 'cli') return ''; + $redis = new Redis(); $redis->connect(self::$redis_host, self::$redis_port, 1, NULL, 0, 0, ['auth' => [MD_CONF::$redis_pw]]); if ($redis->ping() !== false) {