mirror of
https://github.com/YGGverse/YGGtracker.git
synced 2025-01-11 15:37:57 +00:00
update user and magnet timeAdded if newer value found on third-party feed
This commit is contained in:
parent
dd96d56fcc
commit
fca6f623fb
@ -87,6 +87,15 @@ try
|
|||||||
// Remember user ID for this host
|
// Remember user ID for this host
|
||||||
$aliasUserId[$remoteUser->userId] = $localUser->userId;
|
$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
|
// Update user info if newer
|
||||||
if ($localUser->timeUpdated < $remoteUser->timeUpdated)
|
if ($localUser->timeUpdated < $remoteUser->timeUpdated)
|
||||||
{
|
{
|
||||||
@ -155,7 +164,7 @@ try
|
|||||||
!isset($remoteMagnet->dn) || mb_strlen($remoteMagnet->dn) < MAGNET_TITLE_MIN_LENGTH ||
|
!isset($remoteMagnet->dn) || mb_strlen($remoteMagnet->dn) < MAGNET_TITLE_MIN_LENGTH ||
|
||||||
mb_strlen($remoteMagnet->dn) > MAGNET_TITLE_MAX_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->xt) || !is_object($remoteMagnet->xt) ||
|
||||||
!isset($remoteMagnet->kt) || !is_object($remoteMagnet->kt) ||
|
!isset($remoteMagnet->kt) || !is_object($remoteMagnet->kt) ||
|
||||||
@ -187,6 +196,15 @@ try
|
|||||||
// Add magnet alias for this host
|
// Add magnet alias for this host
|
||||||
$aliasMagnetId[$remoteMagnet->magnetId] = $localMagnet->magnetId;
|
$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
|
// Update info if remote newer
|
||||||
if ($localMagnet->timeUpdated < $remoteMagnet->timeUpdated)
|
if ($localMagnet->timeUpdated < $remoteMagnet->timeUpdated)
|
||||||
{
|
{
|
||||||
|
@ -575,6 +575,17 @@ class Database {
|
|||||||
return $query->rowCount();
|
return $query->rowCount();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function updateUserTimeAdded(int $userId, int $timeAdded) : int {
|
||||||
|
|
||||||
|
$this->_debug->query->update->total++;
|
||||||
|
|
||||||
|
$query = $this->_db->prepare('UPDATE `user` SET `timeAdded` = ? WHERE `userId` = ?');
|
||||||
|
|
||||||
|
$query->execute([$timeAdded, $userId]);
|
||||||
|
|
||||||
|
return $query->rowCount();
|
||||||
|
}
|
||||||
|
|
||||||
public function updateUserTimeUpdated(int $userId, int $timeUpdated) : int {
|
public function updateUserTimeUpdated(int $userId, int $timeUpdated) : int {
|
||||||
|
|
||||||
$this->_debug->query->update->total++;
|
$this->_debug->query->update->total++;
|
||||||
@ -807,6 +818,28 @@ class Database {
|
|||||||
return $query->rowCount();
|
return $query->rowCount();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function updateMagnetTimeUpdated(int $magnetId, int $timeUpdated) : int {
|
||||||
|
|
||||||
|
$this->_debug->query->update->total++;
|
||||||
|
|
||||||
|
$query = $this->_db->prepare('UPDATE `magnet` SET `timeUpdated` = ? WHERE `magnetId` = ?');
|
||||||
|
|
||||||
|
$query->execute([$timeUpdated, $magnetId]);
|
||||||
|
|
||||||
|
return $query->rowCount();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function updateMagnetTimeAdded(int $magnetId, int $timeAdded) : int {
|
||||||
|
|
||||||
|
$this->_debug->query->update->total++;
|
||||||
|
|
||||||
|
$query = $this->_db->prepare('UPDATE `magnet` SET `timeAdded` = ? WHERE `magnetId` = ?');
|
||||||
|
|
||||||
|
$query->execute([$timeAdded, $magnetId]);
|
||||||
|
|
||||||
|
return $query->rowCount();
|
||||||
|
}
|
||||||
|
|
||||||
// Magnet to Info Hash
|
// Magnet to Info Hash
|
||||||
public function addMagnetToInfoHash(int $magnetId, int $infoHashId) : int {
|
public function addMagnetToInfoHash(int $magnetId, int $infoHashId) : int {
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user