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

github.com/nextcloud/deck.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorVincent Petry <vincent@nextcloud.com>2022-08-17 17:13:27 +0300
committerGitHub <noreply@github.com>2022-08-17 17:13:27 +0300
commitde0dc2782f67f1a8d832f62141e552f52ca7078e (patch)
treedcd95629f8c3810b08fdb03b2e7cf5ea0fb2cbe8 /lib
parente33dd1527f8ee9e119c31f8747b478746376ad40 (diff)
parent9171ffc88a46e313237bd4c2566857f40f5b85b6 (diff)
Merge pull request #3982 from nextcloud/performance/dav
Improve CalDAV integration performance
Diffstat (limited to 'lib')
-rw-r--r--lib/DAV/Calendar.php26
-rw-r--r--lib/Db/CardMapper.php1
2 files changed, 18 insertions, 9 deletions
diff --git a/lib/DAV/Calendar.php b/lib/DAV/Calendar.php
index 6e73999a..7e02013b 100644
--- a/lib/DAV/Calendar.php
+++ b/lib/DAV/Calendar.php
@@ -52,12 +52,6 @@ class Calendar extends ExternalCalendar {
$this->board = $board;
$this->principalUri = $principalUri;
-
- if ($board) {
- $this->children = $this->backend->getChildren($board->getId());
- } else {
- $this->children = [];
- }
}
public function getOwner() {
@@ -122,7 +116,7 @@ class Calendar extends ExternalCalendar {
public function getChild($name) {
if ($this->childExists($name)) {
$card = array_values(array_filter(
- $this->children,
+ $this->getBackendChildren(),
function ($card) use (&$name) {
return $card->getCalendarPrefix() . '-' . $card->getId() . '.ics' === $name;
}
@@ -137,7 +131,7 @@ class Calendar extends ExternalCalendar {
public function getChildren() {
$childNames = array_map(function ($card) {
return $card->getCalendarPrefix() . '-' . $card->getId() . '.ics';
- }, $this->children);
+ }, $this->getBackendChildren());
$children = [];
@@ -148,9 +142,23 @@ class Calendar extends ExternalCalendar {
return $children;
}
+ private function getBackendChildren() {
+ if ($this->children) {
+ return $this->children;
+ }
+
+ if ($this->board) {
+ $this->children = $this->backend->getChildren($this->board->getId());
+ } else {
+ $this->children = [];
+ }
+
+ return $this->children;
+ }
+
public function childExists($name) {
return count(array_filter(
- $this->children,
+ $this->getBackendChildren(),
function ($card) use (&$name) {
return $card->getCalendarPrefix() . '-' . $card->getId() . '.ics' === $name;
}
diff --git a/lib/Db/CardMapper.php b/lib/Db/CardMapper.php
index 883e425d..e23f8046 100644
--- a/lib/Db/CardMapper.php
+++ b/lib/Db/CardMapper.php
@@ -193,6 +193,7 @@ class CardMapper extends QBMapper implements IPermissionMapper {
->from('deck_cards', 'c')
->join('c', 'deck_stacks', 's', 's.id = c.stack_id')
->where($qb->expr()->eq('s.board_id', $qb->createNamedParameter($boardId)))
+ ->andWhere($qb->expr()->eq('c.archived', $qb->createNamedParameter(false, IQueryBuilder::PARAM_BOOL)))
->andWhere($qb->expr()->eq('c.deleted_at', $qb->createNamedParameter('0')))
->orderBy('c.duedate')
->setMaxResults($limit)