mirror of
https://github.com/elyby/accounts.git
synced 2025-05-31 14:11:46 +05:30
Добавлен функционал очистки устаревших MinecraftAccessKey
This commit is contained in:
@ -2,6 +2,7 @@
|
||||
namespace console\controllers;
|
||||
|
||||
use common\models\EmailActivation;
|
||||
use common\models\MinecraftAccessKey;
|
||||
use yii\console\Controller;
|
||||
|
||||
class CleanupController extends Controller {
|
||||
@ -26,6 +27,19 @@ class CleanupController extends Controller {
|
||||
return self::EXIT_CODE_NORMAL;
|
||||
}
|
||||
|
||||
public function actionMinecraftSessions() {
|
||||
/** @var \yii\db\BatchQueryResult|MinecraftAccessKey[] $expiredMinecraftSessions */
|
||||
$expiredMinecraftSessions = MinecraftAccessKey::find()
|
||||
->andWhere(['<', 'updated_at', time() - 1209600]) // 2 weeks
|
||||
->each();
|
||||
|
||||
foreach ($expiredMinecraftSessions as $minecraftSession) {
|
||||
$minecraftSession->delete();
|
||||
}
|
||||
|
||||
return self::EXIT_CODE_NORMAL;
|
||||
}
|
||||
|
||||
private function getEmailActivationsDurationsMap(): array {
|
||||
$durationsMap = [];
|
||||
foreach (EmailActivation::getClassMap() as $typeId => $className) {
|
||||
|
Reference in New Issue
Block a user