replace old migration

This commit is contained in:
mrilyew 2025-06-25 15:11:14 +03:00
parent 2333924089
commit bdac64a4ae
3 changed files with 4 additions and 18 deletions

View file

@ -49,10 +49,6 @@ class EventRateLimiter
return false;
}
if (!($e = eventdb())) {
return false;
}
if ($this->config['ignoreForAdmins'] && $user->isAdmin()) {
return false;
}
@ -61,8 +57,7 @@ class EventRateLimiter
$compareTime = time() - $this->config['restrictionTime'];
$query = "SELECT COUNT(".($distinct ? "DISTINCT(`receiverId`)" : "*").") as `cnt` FROM `user-events` WHERE `initiatorId` = ? AND `eventType` = ? AND `eventTime` > ?";
$result = $e->getConnection()->query($query, ...[$user->getId(), $event_type, $compareTime]);
$count = $result->fetch()->cnt;
#bdump($count); exit();
@ -78,10 +73,6 @@ class EventRateLimiter
return false;
}
if (!($e = eventdb())) {
return false;
}
$data = [
'initiatorId' => $initiator->getId(),
'initiatorIp' => null,

View file

@ -0,0 +1,3 @@
ALTER TABLE `profiles`
ADD `events_counters` VARCHAR(299) NULL DEFAULT NULL AFTER `audio_broadcast_enabled`,
ADD `events_refresh_time` BIGINT(20) UNSIGNED NULL DEFAULT NULL AFTER `events_counters`;

View file

@ -1,8 +0,0 @@
CREATE TABLE `user-events`
(
`initiatorId` BIGINT(20) UNSIGNED NOT NULL,
`initiatorIp` VARBINARY(16) NULL DEFAULT NULL,
`receiverId` BIGINT(20) NULL DEFAULT NULL,
`eventType` CHAR(25) NOT NULL,
`eventTime` BIGINT(20) UNSIGNED NOT NULL
) ENGINE = InnoDB;