mirror of
https://github.com/YGGverse/YGGtracker.git
synced 2026-04-01 01:25:39 +00:00
add push events support
This commit is contained in:
parent
7c054557f3
commit
64693f7774
5 changed files with 151 additions and 24 deletions
|
|
@ -62,8 +62,31 @@ else if (is_null($user->public))
|
|||
// Request valid
|
||||
else
|
||||
{
|
||||
// Update download stats
|
||||
$db->addMagnetDownload($magnet->magnetId, $userId, time());
|
||||
// Register magnet download
|
||||
$magnetDownloadId = $db->addMagnetDownload($magnet->magnetId, $user->userId, time());
|
||||
|
||||
// Push event to other nodes
|
||||
if (API_EXPORT_ENABLED &&
|
||||
API_EXPORT_PUSH_ENABLED &&
|
||||
API_EXPORT_USERS_ENABLED &&
|
||||
API_EXPORT_MAGNETS_ENABLED &&
|
||||
API_EXPORT_MAGNET_DOWNLOADS_ENABLED)
|
||||
{
|
||||
if (!$memoryApiExportPush = $memory->get('api.export.push'))
|
||||
{
|
||||
$memoryApiExportPush = [];
|
||||
}
|
||||
|
||||
$memoryApiExportPush[] = (object)
|
||||
[
|
||||
'time' => time(),
|
||||
'userId' => $user->userId,
|
||||
'magnetId' => $magnet->magnetId,
|
||||
'magnetDownloadId' => $magnetDownloadId
|
||||
];
|
||||
|
||||
$memory->set('api.export.push', $memoryApiExportPush, 3600);
|
||||
}
|
||||
|
||||
// Build magnet link
|
||||
$link = (object)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue