mirror of
https://github.com/YGGverse/YGGtracker.git
synced 2025-01-11 23:48:07 +00:00
send push on addMagnetDownload success only
This commit is contained in:
parent
bacb8b17bf
commit
73f353594c
@ -63,29 +63,30 @@ else if (is_null($user->public))
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Register magnet download
|
// Register magnet download
|
||||||
$magnetDownloadId = $db->addMagnetDownload($magnet->magnetId, $user->userId, time());
|
if ($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'))
|
// Push event to other nodes
|
||||||
{
|
if (API_EXPORT_ENABLED &&
|
||||||
$memoryApiExportPush = [];
|
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
$memoryApiExportPush[] = (object)
|
|
||||||
[
|
|
||||||
'time' => time(),
|
|
||||||
'userId' => $user->userId,
|
|
||||||
'magnetId' => $magnet->magnetId,
|
|
||||||
'magnetDownloadId' => $magnetDownloadId
|
|
||||||
];
|
|
||||||
|
|
||||||
$memory->set('api.export.push', $memoryApiExportPush, 3600);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Build magnet link
|
// Build magnet link
|
||||||
|
Loading…
Reference in New Issue
Block a user