mirror of
https://github.com/appwrite/appwrite.git
synced 2026-11-18 20:36:03 +00:00
feat: cleanup
This commit is contained in:
1 parent
1dfcdaca0e
commit
aa15eda877
3 files changed
+9
-9
No files matched your search
@@ -5,7 +5,7 @@ namespace Utopia\Tests;
|
||||
use PDO;
|
||||
use Utopia\Abuse\Abuse;
|
||||
use Utopia\Abuse\Adapter;
|
||||
use Utopia\Abuse\Adapters\TimeLimit\Database as TimeLimitDatabase;
|
||||
use Utopia\Abuse\Adapters\TimeLimit\Database as TimeLimit;
|
||||
use Utopia\Cache\Adapter\None as NoCache;
|
||||
use Utopia\Cache\Cache;
|
||||
use Utopia\Database\Adapter\MariaDB;
|
||||
@@ -37,7 +37,7 @@ class DatabaseTest extends Base
|
||||
$db->setNamespace('namespace');
|
||||
$this->db = $db;
|
||||
|
||||
$adapter = new TimeLimitDatabase('login-attempt-from-{{ip}}', 3, 60 * 5, $db);
|
||||
$adapter = new TimeLimit('login-attempt-from-{{ip}}', 3, 60 * 5, $db);
|
||||
if (! $db->exists('utopiaTests')) {
|
||||
$db->create();
|
||||
$adapter->setup();
|
||||
@@ -50,7 +50,7 @@ class DatabaseTest extends Base
|
||||
|
||||
public function getAdapter(string $key, int $limit, int $seconds): Adapter
|
||||
{
|
||||
return new TimeLimitDatabase($key, $limit, $seconds, $this->db);
|
||||
return new TimeLimit($key, $limit, $seconds, $this->db);
|
||||
}
|
||||
|
||||
public function getCleanupDateTime(): string
|
||||
|
||||
@@ -6,7 +6,7 @@ use DateInterval;
|
||||
use RedisCluster;
|
||||
use Utopia\Abuse\Abuse;
|
||||
use Utopia\Abuse\Adapter;
|
||||
use Utopia\Abuse\Adapters\TimeLimit\RedisCluster as TimeLimitRedisCluster;
|
||||
use Utopia\Abuse\Adapters\TimeLimit\RedisCluster as TimeLimit;
|
||||
use Utopia\Exception;
|
||||
|
||||
class RedisClusterTest extends Base
|
||||
@@ -20,7 +20,7 @@ class RedisClusterTest extends Base
|
||||
public function setUp(): void
|
||||
{
|
||||
$this->redis = new RedisCluster(null, ['redis-cluster-0:6379', 'redis-cluster-1:6379', 'redis-cluster-2:6379', 'redis-cluster-3:6379']);
|
||||
$adapter = new TimeLimitRedisCluster('login-attempt-from-{{ip}}', 3, 1, $this->redis);
|
||||
$adapter = new TimeLimit('login-attempt-from-{{ip}}', 3, 1, $this->redis);
|
||||
$adapter->setParam('{{ip}}', '127.0.0.1');
|
||||
$this->abuse = new Abuse($adapter);
|
||||
$this->abuse->cleanup($this->getCleanupDateTime());
|
||||
@@ -28,7 +28,7 @@ class RedisClusterTest extends Base
|
||||
|
||||
public function getAdapter(string $key, int $limit, int $seconds): Adapter
|
||||
{
|
||||
return new TimeLimitRedisCluster($key, $limit, $seconds, $this->redis);
|
||||
return new TimeLimit($key, $limit, $seconds, $this->redis);
|
||||
}
|
||||
|
||||
public function getCleanupDateTime(): string
|
||||
|
||||
@@ -6,7 +6,7 @@ use DateInterval;
|
||||
use Redis as Client;
|
||||
use Utopia\Abuse\Abuse;
|
||||
use Utopia\Abuse\Adapter;
|
||||
use Utopia\Abuse\Adapters\TimeLimit\Redis as TimeLimitRedis;
|
||||
use Utopia\Abuse\Adapters\TimeLimit\Redis as TimeLimit;
|
||||
use Utopia\Exception;
|
||||
|
||||
class RedisTest extends Base
|
||||
@@ -21,7 +21,7 @@ class RedisTest extends Base
|
||||
{
|
||||
$this->redis = new Client();
|
||||
$this->redis->connect('redis', 6379);
|
||||
$adapter = new TimeLimitRedis('login-attempt-from-{{ip}}', 3, 1, $this->redis);
|
||||
$adapter = new TimeLimit('login-attempt-from-{{ip}}', 3, 1, $this->redis);
|
||||
$adapter->setParam('{{ip}}', '127.0.0.1');
|
||||
$this->abuse = new Abuse($adapter);
|
||||
$this->abuse->cleanup($this->getCleanupDateTime());
|
||||
@@ -29,7 +29,7 @@ class RedisTest extends Base
|
||||
|
||||
public function getAdapter(string $key, int $limit, int $seconds): Adapter
|
||||
{
|
||||
return new TimeLimitRedis($key, $limit, $seconds, $this->redis);
|
||||
return new TimeLimit($key, $limit, $seconds, $this->redis);
|
||||
}
|
||||
|
||||
public function getCleanupDateTime(): string
|
||||
|
||||
Reference in new issue
Block a user