Skip to content
This repository has been archived by the owner on Nov 2, 2020. It is now read-only.

Commit

Permalink
🚑 (Middleware) Fix $ip_ban_list and and cached ttl
Browse files Browse the repository at this point in the history
  • Loading branch information
Rhilip committed Jan 31, 2019
1 parent a8f0428 commit 9da50e0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions apps/middleware/IpBanMiddleware.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ public function handle($callable, \Closure $next)

$ip_ban_list = app()->redis->get("SILE:ip_ban_list");
if ($ip_ban_list === false) {
$ip_ban_list = app()->pdo->createCommand("SELECT `ip` FROM `ip_bans`")->queryAll();
app()->redis->set("SILE:ip_ban_list", $ip_ban_list);
$ip_ban_list = app()->pdo->createCommand("SELECT `ip` FROM `ip_bans`")->queryColumn();
app()->redis->setex("SILE:ip_ban_list", 86400 , $ip_ban_list);
}

if (count($ip_ban_list) > 0 && IpUtils::checkIp($ip, $ip_ban_list)) {
Expand Down

0 comments on commit 9da50e0

Please sign in to comment.