From 53f85bf5055e4d70ed3117223d6ff0cc0f1227b5 Mon Sep 17 00:00:00 2001 From: Boudje412 <46462302+Boudje412@users.noreply.github.com> Date: Mon, 7 Jan 2019 22:51:45 +0100 Subject: [PATCH] Fix sys_getloadavg with windows Move the exception code except when the config param is setted to -1 --- src/RWFileCache.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/RWFileCache.php b/src/RWFileCache.php index aa97fda..000e642 100644 --- a/src/RWFileCache.php +++ b/src/RWFileCache.php @@ -121,13 +121,13 @@ public function get($key) return false; } - if (!function_exists('sys_getloadavg')) { - throw new Exception('Your PHP installation does not support `sys_getloadavg` (Windows?). Please set `unixLoadUpperThreshold` to `-1` in your RWFileCache config.'); - } - if ($this->config['unixLoadUpperThreshold'] == -1) { $unixLoad = [0 => PHP_INT_MAX, 1 => PHP_INT_MAX, 2 => PHP_INT_MAX]; } else { + if (!function_exists('sys_getloadavg')) { + throw new Exception('Your PHP installation does not support `sys_getloadavg` (Windows?). Please set `unixLoadUpperThreshold` to `-1` in your RWFileCache config.'); + } + $unixLoad = sys_getloadavg(); }