mirror of
https://github.com/openvk/openvk
synced 2025-07-02 22:09:53 +03:00
replace old migration
This commit is contained in:
parent
2333924089
commit
bdac64a4ae
3 changed files with 4 additions and 18 deletions
|
@ -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,
|
||||
|
|
3
install/sqls/00057-event-limiting.sql
Normal file
3
install/sqls/00057-event-limiting.sql
Normal 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`;
|
|
@ -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;
|
Loading…
Reference in a new issue