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

@ -575,6 +575,17 @@ class Database {
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 {
$this->_debug->query->update->total++;
@ -807,6 +818,28 @@ class Database {
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
public function addMagnetToInfoHash(int $magnetId, int $infoHashId) : int {