Don't waste energy unless necessary
Signed-off-by: Joas Schilling <coding@schilljs.com>
This commit is contained in:
parent
d8b769bd85
commit
6dbdca0721
|
@ -278,6 +278,10 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
|||
->execute();
|
||||
|
||||
while($row = $result->fetch()) {
|
||||
if (isset($calendars[$row['id']])) {
|
||||
continue;
|
||||
}
|
||||
|
||||
list(, $name) = URLUtil::splitPath($row['principaluri']);
|
||||
$uri = $row['uri'] . '_shared_by_' . $name;
|
||||
$row['displayname'] = $row['displayname'] . ' (' . $this->getUserDisplayName($name) . ')';
|
||||
|
@ -301,10 +305,8 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
|||
$calendar[$xmlName] = $row[$dbName];
|
||||
}
|
||||
|
||||
if (!isset($calendars[$calendar['id']])) {
|
||||
$calendars[$calendar['id']] = $calendar;
|
||||
}
|
||||
}
|
||||
$result->closeCursor();
|
||||
|
||||
return array_values($calendars);
|
||||
|
|
|
@ -173,10 +173,14 @@ class CardDavBackend implements BackendInterface, SyncSupport {
|
|||
->execute();
|
||||
|
||||
while($row = $result->fetch()) {
|
||||
if (isset($addressBooks[$row['id']])) {
|
||||
continue;
|
||||
}
|
||||
|
||||
list(, $name) = URLUtil::splitPath($row['principaluri']);
|
||||
$uri = $row['uri'] . '_shared_by_' . $name;
|
||||
$displayName = $row['displayname'] . ' (' . $this->getUserDisplayName($name) . ')';
|
||||
if (!isset($addressBooks[$row['id']])) {
|
||||
|
||||
$addressBooks[$row['id']] = [
|
||||
'id' => $row['id'],
|
||||
'uri' => $uri,
|
||||
|
@ -189,7 +193,6 @@ class CardDavBackend implements BackendInterface, SyncSupport {
|
|||
'{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}read-only' => (int)$row['access'] === Backend::ACCESS_READ,
|
||||
];
|
||||
}
|
||||
}
|
||||
$result->closeCursor();
|
||||
|
||||
return array_values($addressBooks);
|
||||
|
|
Loading…
Reference in New Issue