@ -610,7 +610,7 @@ class Database {
@@ -610,7 +610,7 @@ class Database {
return $query->fetchAll();
}
public function getMagnetsTotal() {
public function getMagnetsTotal() : int {
$this->_debug->query->select->total++;
@ -621,6 +621,17 @@ class Database {
@@ -621,6 +621,17 @@ class Database {
return $query->fetch()->result;
}
public function getMagnetsTotalByUserId(int $userId) : int {
$this->_debug->query->select->total++;
$query = $this->_db->prepare('SELECT COUNT(*) AS `result` FROM `magnet` WHERE `userId` = ?');
$query->execute([$userId]);
return $query->fetch()->result;
}
public function updateMagnetDn(int $magnetId, string $dn, int $timeUpdated) : int {
$this->_debug->query->update->total++;
@ -1215,6 +1226,26 @@ class Database {
@@ -1215,6 +1226,26 @@ class Database {
return $query->fetch()->result;
}
public function getMagnetCommentsTotalByUserId(int $userId, mixed $magnetId = null) : int {
$this->_debug->query->select->total++;
if ($magnetId)
{
$query = $this->_db->prepare('SELECT COUNT(*) AS `result` FROM `magnetComment` WHERE `userId` = ? AND `magnetId` = ?');
$query->execute([$userId, $magnetId]);
}
else
{
$query = $this->_db->prepare('SELECT COUNT(*) AS `result` FROM `magnetComment` WHERE `userId` = ?');
$query->execute([$userId]);
}
return $query->fetch()->result;
}
public function getMagnetComments(int $magnetId, mixed $magnetCommentIdParent = null) {
$this->_debug->query->select->total++;