summaryrefslogtreecommitdiffstats
path: root/apps/federation/lib/dbhandler.php
diff options
context:
space:
mode:
Diffstat (limited to 'apps/federation/lib/dbhandler.php')
-rw-r--r--apps/federation/lib/dbhandler.php22
1 files changed, 22 insertions, 0 deletions
diff --git a/apps/federation/lib/dbhandler.php b/apps/federation/lib/dbhandler.php
index df36228c760..8720560efc6 100644
--- a/apps/federation/lib/dbhandler.php
+++ b/apps/federation/lib/dbhandler.php
@@ -106,6 +106,28 @@ class DbHandler {
}
/**
+ * get trusted server with given ID
+ *
+ * @param int $id
+ * @return array
+ * @throws \Exception
+ */
+ public function getServerById($id) {
+ $query = $this->connection->getQueryBuilder();
+ $query->select('*')->from($this->dbTable)
+ ->where($query->expr()->eq('id', $query->createParameter('id')))
+ ->setParameter('id', $id);
+ $query->execute();
+ $result = $query->execute()->fetchAll();
+
+ if (empty($result)) {
+ throw new \Exception('No Server found with ID: ' . $id);
+ }
+
+ return $result[0];
+ }
+
+ /**
* get all trusted servers
*
* @return array