NobGit
public nobgit read

NobMail

Based on mailcow: dockerized

Languages

Repository composition by tracked source files.

PHP
PHP 49% JavaScript 35% HTML 9% CSS 4% Shell 2% Python 1% Lua 0% Perl 0% Ruby 0% SCSS 0%
Create file Wiki Documentation
Clone
https://nobgit.com/orgs/nobgit/nobmail.git
ssh://[email protected]:2222/orgs/nobgit/nobmail.git

Commit

[Web] Delete log lines containing ratelimit hash key when removing rate limit hashes from db

92df4299
andryyy <[email protected]> 6 years ago
data/web/inc/functions.ratelimit.inc.php | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

Diff

diff --git a/data/web/inc/functions.ratelimit.inc.php b/data/web/inc/functions.ratelimit.inc.php
index 57a78e5f..dba88e3c 100644
--- a/data/web/inc/functions.ratelimit.inc.php
+++ b/data/web/inc/functions.ratelimit.inc.php
@@ -203,7 +203,15 @@ function ratelimit($_action, $_scope, $_data = null) {
         return false;
       }
       try {
-        if ($redis->exists($data['hash'])) {
+        $data_rllog = $redis->lRange('RL_LOG', 0, -1);
+        if ($data_rllog) {
+          foreach ($data_rllog as $json_line) {
+            if (preg_match('/' . $data['hash'] . '/i', $json_line)) {
+              $redis->lRem('RL_LOG', $json_line, 0);
+            }
+          }
+        }
+        if ($redis->type($data['hash']) == Redis::REDIS_HASH) {
           $redis->delete($data['hash']);
           $_SESSION['return'][] = array(
             'type' => 'success',