Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorg Ehrke <developer@georgehrke.com>2020-05-07 17:32:56 +0300
committerbackportbot[bot] <backportbot[bot]@users.noreply.github.com>2020-05-08 13:05:55 +0300
commitd1909526fc47e0973e9b1507f991b1992c7e0dcc (patch)
tree2bca271ab744873c0487b2c4f8b4f12cffd643e4 /apps/contactsinteraction/lib/Db
parent76334c4c9094aaa2c95d068490ac4427d5bb786b (diff)
Implement ctag and etag in ContactsInteraction
Signed-off-by: Georg Ehrke <developer@georgehrke.com>
Diffstat (limited to 'apps/contactsinteraction/lib/Db')
-rw-r--r--apps/contactsinteraction/lib/Db/RecentContactMapper.php24
1 files changed, 24 insertions, 0 deletions
diff --git a/apps/contactsinteraction/lib/Db/RecentContactMapper.php b/apps/contactsinteraction/lib/Db/RecentContactMapper.php
index 18a5bf6cedc..19cd30ea701 100644
--- a/apps/contactsinteraction/lib/Db/RecentContactMapper.php
+++ b/apps/contactsinteraction/lib/Db/RecentContactMapper.php
@@ -104,6 +104,30 @@ class RecentContactMapper extends QBMapper {
return $this->findEntities($select);
}
+ /**
+ * @param string $uid
+ * @return int|null
+ */
+ public function findLastUpdatedForUserId(string $uid):?int {
+ $qb = $this->db->getQueryBuilder();
+
+ $select = $qb
+ ->select('last_contact')
+ ->from($this->getTableName())
+ ->where($qb->expr()->eq('actor_uid', $qb->createNamedParameter($uid)))
+ ->orderBy('last_contact', 'DESC')
+ ->setMaxResults(1);
+
+ $cursor = $select->execute();
+ $row = $cursor->fetch();
+
+ if ($row === false) {
+ return null;
+ }
+
+ return (int)$row['last_contact'];
+ }
+
public function cleanUp(int $olderThan): void {
$qb = $this->db->getQueryBuilder();