Skip to content

Commit

Permalink
Get rid of unused methods in the statistics dao
Browse files Browse the repository at this point in the history
  • Loading branch information
st3iny committed Nov 15, 2024
1 parent e8ca280 commit 39a8ce5
Showing 1 changed file with 0 additions and 47 deletions.
47 changes: 0 additions & 47 deletions lib/Db/StatisticsDao.php
Original file line number Diff line number Diff line change
Expand Up @@ -144,53 +144,6 @@ public function getNumberOfMessagesGrouped(array $mailboxes, array $emails): arr
return $data;
}

public function getSubjects(array $mailboxes, array $emails): array {
$qb = $this->db->getQueryBuilder();

$mailboxIds = array_map(function (Mailbox $mb) {
return $mb->getId();
}, $mailboxes);
$select = $qb->selectAlias('r.email', 'email')
->selectAlias('m.subject', 'subject')
->from('mail_recipients', 'r')
->join('r', 'mail_messages', 'm', $qb->expr()->eq('m.id', 'r.message_id', IQueryBuilder::PARAM_INT))
->where($qb->expr()->eq('r.type', $qb->createNamedParameter(Address::TYPE_FROM, IQueryBuilder::PARAM_INT), IQueryBuilder::PARAM_INT))
->andWhere($qb->expr()->in('m.mailbox_id', $qb->createNamedParameter($mailboxIds, IQueryBuilder::PARAM_INT_ARRAY)))
->andWhere($qb->expr()->in('r.email', $qb->createNamedParameter($emails, IQueryBuilder::PARAM_STR_ARRAY), IQueryBuilder::PARAM_STR_ARRAY));
$result = $select->executeQuery();
$rows = $result->fetchAll();
$result->closeCursor();
$data = [];
foreach ($rows as $row) {
$data[$row['email']][] = $row['subject'];
}
return $data;
}

public function getPreviewTexts(array $mailboxes, array $emails): array {
$qb = $this->db->getQueryBuilder();

$mailboxIds = array_map(function (Mailbox $mb) {
return $mb->getId();
}, $mailboxes);
$select = $qb->selectAlias('r.email', 'email')
->selectAlias('m.preview_text', 'preview_text')
->from('mail_recipients', 'r')
->join('r', 'mail_messages', 'm', $qb->expr()->eq('m.id', 'r.message_id', IQueryBuilder::PARAM_INT))
->where($qb->expr()->eq('r.type', $qb->createNamedParameter(Address::TYPE_FROM, IQueryBuilder::PARAM_INT), IQueryBuilder::PARAM_INT))
->andWhere($qb->expr()->in('m.mailbox_id', $qb->createNamedParameter($mailboxIds, IQueryBuilder::PARAM_INT_ARRAY)))
->andWhere($qb->expr()->in('r.email', $qb->createNamedParameter($emails, IQueryBuilder::PARAM_STR_ARRAY), IQueryBuilder::PARAM_STR_ARRAY))
->andWhere($qb->expr()->isNotNull('m.preview_text'));
$result = $select->executeQuery();
$rows = $result->fetchAll();
$result->closeCursor();
$data = [];
foreach ($rows as $row) {
$data[$row['email']][] = $row['preview_text'];
}
return $data;
}

public function getNrOfReadMessages(Mailbox $mb, string $email): int {
$qb = $this->db->getQueryBuilder();

Expand Down

0 comments on commit 39a8ce5

Please sign in to comment.