Forráskód Böngészése

Add reset() method for BanList

Visman 4 éve
szülő
commit
a333387636

+ 1 - 1
app/Models/BanList/Delete.php

@@ -24,7 +24,7 @@ class Delete extends Method
                 WHERE id IN (?ai:ids)';
 
             $this->c->DB->exec($query, $vars);
-            $this->model->load();
+            $this->model->reset();
         }
 
         return $this->model;

+ 12 - 0
app/Models/BanList/Model.php

@@ -76,4 +76,16 @@ class Model extends ParentModel
             return (isset($bin[4]) ? '' : '-') . \bin2hex($bin);
         }
     }
+
+    /**
+     * Сбрасывает кеш банов
+     */
+    public function reset(): Model
+    {
+        if (true !== $this->c->Cache->delete('banlist')) {
+            throw new RuntimeException('Unable to remove key from cache - banlist');
+        }
+
+        return $this;
+    }
 }

+ 1 - 1
app/Models/Pages/Admin/Bans.php

@@ -677,7 +677,7 @@ class Bans extends Admin
                     ]);
                 }
 
-                $this->c->bans->load();
+                $this->c->bans->reset();
 
                 $redirect = $this->c->Redirect;