update user and magnet timeAdded if newer value found on third-party feed

This commit is contained in:
ghost 2023-09-14 18:42:02 +03:00
parent dd96d56fcc
commit fca6f623fb
2 changed files with 52 additions and 1 deletions

View file

@ -87,6 +87,15 @@ try
// Remember user ID for this host
$aliasUserId[$remoteUser->userId] = $localUser->userId;
// Update time added if newer
if ($localUser->timeAdded < $remoteUser->timeAdded)
{
$db->updateUserTimeAdded(
$localUser->userId,
$remoteUser->timeAdded
);
}
// Update user info if newer
if ($localUser->timeUpdated < $remoteUser->timeUpdated)
{
@ -155,7 +164,7 @@ try
!isset($remoteMagnet->dn) || mb_strlen($remoteMagnet->dn) < MAGNET_TITLE_MIN_LENGTH ||
mb_strlen($remoteMagnet->dn) > MAGNET_TITLE_MAX_LENGTH ||
!isset($remoteMagnet->xl) || !is_int($remoteMagnet->xl) ||
!isset($remoteMagnet->xl) || !(is_int($remoteMagnet->xl) || is_float($remoteMagnet->xl)) ||
!isset($remoteMagnet->xt) || !is_object($remoteMagnet->xt) ||
!isset($remoteMagnet->kt) || !is_object($remoteMagnet->kt) ||
@ -187,6 +196,15 @@ try
// Add magnet alias for this host
$aliasMagnetId[$remoteMagnet->magnetId] = $localMagnet->magnetId;
// Update time added if newer
if ($localMagnet->timeAdded < $remoteMagnet->timeAdded)
{
$db->updateMagnetTimeAdded(
$localUser->userId,
$remoteMagnet->timeAdded
);
}
// Update info if remote newer
if ($localMagnet->timeUpdated < $remoteMagnet->timeUpdated)
{