From 5db3412b69511e00f14ac70fb47851bb01450e0a Mon Sep 17 00:00:00 2001 From: El RIDO Date: Sun, 29 Jul 2018 15:43:28 +0200 Subject: [PATCH] cleanup of TrafficLimiter #342 --- lib/Persistence/TrafficLimiter.php | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/lib/Persistence/TrafficLimiter.php b/lib/Persistence/TrafficLimiter.php index eb8f2525..85a3d304 100644 --- a/lib/Persistence/TrafficLimiter.php +++ b/lib/Persistence/TrafficLimiter.php @@ -101,27 +101,22 @@ class TrafficLimiter extends AbstractPersistence } $file = 'traffic_limiter.php'; - if (!self::_exists($file)) { - self::_store( - $file, - ' $time) { if ($time + self::$_limit < $now) { unset($tl[$key]); } } - // this hash is used as an array key, hence a shorter hash is used + // this hash is used as an array key, hence a shorter algo is used $hash = self::getHash('sha256'); if (array_key_exists($hash, $tl) && ($tl[$hash] + self::$_limit >= $now)) { $result = false; @@ -132,8 +127,7 @@ class TrafficLimiter extends AbstractPersistence self::_store( $file, '