@ -610,7 +610,7 @@ class Database {
return $query->fetchAll();
return $query->fetchAll();
}
}
public function getMagnetsTotal() {
public function getMagnetsTotal() : int {
$this->_debug->query->select->total++;
$this->_debug->query->select->total++;
@ -621,6 +621,17 @@ class Database {
return $query->fetch()->result;
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 {
public function updateMagnetDn(int $magnetId, string $dn, int $timeUpdated) : int {
$this->_debug->query->update->total++;
$this->_debug->query->update->total++;
@ -1215,6 +1226,26 @@ class Database {
return $query->fetch()->result;
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) {
public function getMagnetComments(int $magnetId, mixed $magnetCommentIdParent = null) {
$this->_debug->query->select->total++;
$this->_debug->query->select->total++;