Removed AdminLTE, some minor improvements
This commit is contained in:
36
Core/API/TestRedis.class.php
Normal file
36
Core/API/TestRedis.class.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
namespace Core\API;
|
||||
|
||||
use Core\Objects\Context;
|
||||
use Core\Objects\DatabaseEntity\Group;
|
||||
|
||||
class TestRedis extends Request {
|
||||
|
||||
public function __construct(Context $context, bool $externalCall = false) {
|
||||
parent::__construct($context, $externalCall, []);
|
||||
}
|
||||
|
||||
protected function _execute(): bool {
|
||||
|
||||
$settings = $this->context->getSettings();
|
||||
if (!$settings->isRateLimitingEnabled()) {
|
||||
return $this->createError("Rate Limiting is currently disabled");
|
||||
}
|
||||
|
||||
$connection = $this->context->getRedis();
|
||||
if ($connection === null || !$connection->isConnected()) {
|
||||
return $this->createError("Redis connection failed");
|
||||
}
|
||||
|
||||
return $this->success;
|
||||
}
|
||||
|
||||
public static function getDescription(): string {
|
||||
return "Allows users to test the redis connection with the configured credentials.";
|
||||
}
|
||||
|
||||
public static function getDefaultPermittedGroups(): array {
|
||||
return [Group::ADMIN];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user