|
|
|
|
@ -283,7 +283,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
|
|
|
|
->andWhere($qb->expr()->lt('deleted_at', $qb->createNamedParameter($deletedBefore)));
|
|
|
|
|
$result = $qb->executeQuery();
|
|
|
|
|
$calendars = [];
|
|
|
|
|
while (($row = $result->fetch()) !== false) {
|
|
|
|
|
while (($row = $result->fetchAssociative()) !== false) {
|
|
|
|
|
$calendars[] = [
|
|
|
|
|
'id' => (int)$row['id'],
|
|
|
|
|
'deleted_at' => (int)$row['deleted_at'],
|
|
|
|
|
@ -345,7 +345,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
|
|
|
|
$result = $query->executeQuery();
|
|
|
|
|
|
|
|
|
|
$calendars = [];
|
|
|
|
|
while ($row = $result->fetch()) {
|
|
|
|
|
while ($row = $result->fetchAssociative()) {
|
|
|
|
|
$row['principaluri'] = (string)$row['principaluri'];
|
|
|
|
|
$components = [];
|
|
|
|
|
if ($row['components']) {
|
|
|
|
|
@ -408,7 +408,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
|
|
|
|
$results = $select->executeQuery();
|
|
|
|
|
|
|
|
|
|
$readOnlyPropertyName = '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}read-only';
|
|
|
|
|
while ($row = $results->fetch()) {
|
|
|
|
|
while ($row = $results->fetchAssociative()) {
|
|
|
|
|
$row['principaluri'] = (string)$row['principaluri'];
|
|
|
|
|
if ($row['principaluri'] === $principalUri) {
|
|
|
|
|
continue;
|
|
|
|
|
@ -478,7 +478,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
|
|
|
|
->orderBy('calendarorder', 'ASC');
|
|
|
|
|
$stmt = $query->executeQuery();
|
|
|
|
|
$calendars = [];
|
|
|
|
|
while ($row = $stmt->fetch()) {
|
|
|
|
|
while ($row = $stmt->fetchAssociative()) {
|
|
|
|
|
$row['principaluri'] = (string)$row['principaluri'];
|
|
|
|
|
$components = [];
|
|
|
|
|
if ($row['components']) {
|
|
|
|
|
@ -528,7 +528,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
|
|
|
|
->andWhere($query->expr()->eq('s.type', $query->createNamedParameter('calendar')))
|
|
|
|
|
->executeQuery();
|
|
|
|
|
|
|
|
|
|
while ($row = $result->fetch()) {
|
|
|
|
|
while ($row = $result->fetchAssociative()) {
|
|
|
|
|
$row['principaluri'] = (string)$row['principaluri'];
|
|
|
|
|
[, $name] = Uri\split($row['principaluri']);
|
|
|
|
|
$row['displayname'] = $row['displayname'] . "($name)";
|
|
|
|
|
@ -586,7 +586,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
|
|
|
|
->andWhere($query->expr()->eq('s.publicuri', $query->createNamedParameter($uri)))
|
|
|
|
|
->executeQuery();
|
|
|
|
|
|
|
|
|
|
$row = $result->fetch();
|
|
|
|
|
$row = $result->fetchAssociative();
|
|
|
|
|
|
|
|
|
|
$result->closeCursor();
|
|
|
|
|
|
|
|
|
|
@ -643,7 +643,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
|
|
|
|
->setMaxResults(1);
|
|
|
|
|
$stmt = $query->executeQuery();
|
|
|
|
|
|
|
|
|
|
$row = $stmt->fetch();
|
|
|
|
|
$row = $stmt->fetchAssociative();
|
|
|
|
|
$stmt->closeCursor();
|
|
|
|
|
if ($row === false) {
|
|
|
|
|
return null;
|
|
|
|
|
@ -692,7 +692,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
|
|
|
|
->setMaxResults(1);
|
|
|
|
|
$stmt = $query->executeQuery();
|
|
|
|
|
|
|
|
|
|
$row = $stmt->fetch();
|
|
|
|
|
$row = $stmt->fetchAssociative();
|
|
|
|
|
$stmt->closeCursor();
|
|
|
|
|
if ($row === false) {
|
|
|
|
|
return null;
|
|
|
|
|
@ -740,7 +740,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
|
|
|
|
->orderBy('calendarorder', 'asc');
|
|
|
|
|
$stmt = $query->executeQuery();
|
|
|
|
|
|
|
|
|
|
$row = $stmt->fetch();
|
|
|
|
|
$row = $stmt->fetchAssociative();
|
|
|
|
|
$stmt->closeCursor();
|
|
|
|
|
if ($row === false) {
|
|
|
|
|
return null;
|
|
|
|
|
@ -777,7 +777,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
|
|
|
|
->setMaxResults(1);
|
|
|
|
|
$stmt = $query->executeQuery();
|
|
|
|
|
|
|
|
|
|
$row = $stmt->fetch();
|
|
|
|
|
$row = $stmt->fetchAssociative();
|
|
|
|
|
$stmt->closeCursor();
|
|
|
|
|
if ($row === false) {
|
|
|
|
|
return null;
|
|
|
|
|
@ -1044,7 +1044,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
|
|
|
|
$rs = $qb->executeQuery();
|
|
|
|
|
// iterate through results
|
|
|
|
|
try {
|
|
|
|
|
while (($row = $rs->fetch()) !== false) {
|
|
|
|
|
while (($row = $rs->fetchAssociative()) !== false) {
|
|
|
|
|
yield $row;
|
|
|
|
|
}
|
|
|
|
|
} finally {
|
|
|
|
|
@ -1076,7 +1076,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
|
|
|
|
$stmt = $query->executeQuery();
|
|
|
|
|
|
|
|
|
|
$result = [];
|
|
|
|
|
while (($row = $stmt->fetch()) !== false) {
|
|
|
|
|
while (($row = $stmt->fetchAssociative()) !== false) {
|
|
|
|
|
$result[$row['uid']] = [
|
|
|
|
|
'id' => $row['id'],
|
|
|
|
|
'etag' => $row['etag'],
|
|
|
|
|
@ -1141,7 +1141,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
|
|
|
|
$stmt = $query->executeQuery();
|
|
|
|
|
|
|
|
|
|
$result = [];
|
|
|
|
|
while (($row = $stmt->fetch()) !== false) {
|
|
|
|
|
while (($row = $stmt->fetchAssociative()) !== false) {
|
|
|
|
|
$result[] = [
|
|
|
|
|
'id' => $row['id'],
|
|
|
|
|
'uri' => $row['uri'],
|
|
|
|
|
@ -1168,7 +1168,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
|
|
|
|
$stmt = $query->executeQuery();
|
|
|
|
|
|
|
|
|
|
$result = [];
|
|
|
|
|
while (($row = $stmt->fetch()) !== false) {
|
|
|
|
|
while (($row = $stmt->fetchAssociative()) !== false) {
|
|
|
|
|
$result[] = [
|
|
|
|
|
'id' => $row['id'],
|
|
|
|
|
'uri' => $row['uri'],
|
|
|
|
|
@ -1207,7 +1207,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
|
|
|
|
$stmt = $query->executeQuery();
|
|
|
|
|
|
|
|
|
|
$result = [];
|
|
|
|
|
while ($row = $stmt->fetch()) {
|
|
|
|
|
while ($row = $stmt->fetchAssociative()) {
|
|
|
|
|
$result[] = [
|
|
|
|
|
'id' => $row['id'],
|
|
|
|
|
'uri' => $row['uri'],
|
|
|
|
|
@ -1255,7 +1255,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
|
|
|
|
->andWhere($query->expr()->eq('uri', $query->createNamedParameter($objectUri)))
|
|
|
|
|
->andWhere($query->expr()->eq('calendartype', $query->createNamedParameter($calendarType)));
|
|
|
|
|
$stmt = $query->executeQuery();
|
|
|
|
|
$row = $stmt->fetch();
|
|
|
|
|
$row = $stmt->fetchAssociative();
|
|
|
|
|
$stmt->closeCursor();
|
|
|
|
|
|
|
|
|
|
if (!$row) {
|
|
|
|
|
@ -1316,7 +1316,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
|
|
|
|
$query->setParameter('uri', $uris, IQueryBuilder::PARAM_STR_ARRAY);
|
|
|
|
|
$result = $query->executeQuery();
|
|
|
|
|
|
|
|
|
|
while ($row = $result->fetch()) {
|
|
|
|
|
while ($row = $result->fetchAssociative()) {
|
|
|
|
|
$objects[] = [
|
|
|
|
|
'id' => $row['id'],
|
|
|
|
|
'uri' => $row['uri'],
|
|
|
|
|
@ -1383,7 +1383,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
|
|
|
|
->andWhere($qbDel->expr()->eq('calendartype', $qbDel->createNamedParameter($calendarType)))
|
|
|
|
|
->andWhere($qbDel->expr()->isNotNull('deleted_at'));
|
|
|
|
|
$result = $qbDel->executeQuery();
|
|
|
|
|
$found = $result->fetch();
|
|
|
|
|
$found = $result->fetchAssociative();
|
|
|
|
|
$result->closeCursor();
|
|
|
|
|
if ($found !== false) {
|
|
|
|
|
// the object existed previously but has been deleted
|
|
|
|
|
@ -1675,7 +1675,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
|
|
|
|
->from('calendarobjects')
|
|
|
|
|
->where($qb2->expr()->eq('id', $qb2->createNamedParameter($id, IQueryBuilder::PARAM_INT), IQueryBuilder::PARAM_INT));
|
|
|
|
|
$result = $selectObject->executeQuery();
|
|
|
|
|
$row = $result->fetch();
|
|
|
|
|
$row = $result->fetchAssociative();
|
|
|
|
|
$result->closeCursor();
|
|
|
|
|
if ($row === false) {
|
|
|
|
|
// Welp, this should possibly not have happened, but let's ignore
|
|
|
|
|
@ -1798,7 +1798,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
|
|
|
|
$stmt = $query->executeQuery();
|
|
|
|
|
|
|
|
|
|
$result = [];
|
|
|
|
|
while ($row = $stmt->fetch()) {
|
|
|
|
|
while ($row = $stmt->fetchAssociative()) {
|
|
|
|
|
// if we leave it as a blob we can't read it both from the post filter and the rowToCalendarObject
|
|
|
|
|
if (isset($row['calendardata'])) {
|
|
|
|
|
$row['calendardata'] = $this->readBlob($row['calendardata']);
|
|
|
|
|
@ -1958,7 +1958,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
|
|
|
|
$stmt = $query->executeQuery();
|
|
|
|
|
|
|
|
|
|
$result = [];
|
|
|
|
|
while ($row = $stmt->fetch()) {
|
|
|
|
|
while ($row = $stmt->fetchAssociative()) {
|
|
|
|
|
$path = $uriMapper[$row['calendarid']] . '/' . $row['uri'];
|
|
|
|
|
if (!in_array($path, $result)) {
|
|
|
|
|
$result[] = $path;
|
|
|
|
|
@ -2171,7 +2171,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
|
|
|
|
|
|
|
|
|
$result = $query->executeQuery();
|
|
|
|
|
|
|
|
|
|
while (($row = $result->fetch()) !== false) {
|
|
|
|
|
while (($row = $result->fetchAssociative()) !== false) {
|
|
|
|
|
if ($filterByTimeRange === false) {
|
|
|
|
|
// No filter required
|
|
|
|
|
$calendarObjects[] = $row;
|
|
|
|
|
@ -2399,7 +2399,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
|
|
|
|
|
|
|
|
|
$result = $calendarObjectIdQuery->executeQuery();
|
|
|
|
|
$matches = [];
|
|
|
|
|
while (($row = $result->fetch()) !== false) {
|
|
|
|
|
while (($row = $result->fetchAssociative()) !== false) {
|
|
|
|
|
$matches[] = (int)$row['objectid'];
|
|
|
|
|
}
|
|
|
|
|
$result->closeCursor();
|
|
|
|
|
@ -2411,7 +2411,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
|
|
|
|
|
|
|
|
|
$result = $query->executeQuery();
|
|
|
|
|
$calendarObjects = [];
|
|
|
|
|
while (($array = $result->fetch()) !== false) {
|
|
|
|
|
while (($array = $result->fetchAssociative()) !== false) {
|
|
|
|
|
$array['calendarid'] = (int)$array['calendarid'];
|
|
|
|
|
$array['calendartype'] = (int)$array['calendartype'];
|
|
|
|
|
$array['calendardata'] = $this->readBlob($array['calendardata']);
|
|
|
|
|
@ -2456,7 +2456,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$stmt = $query->executeQuery();
|
|
|
|
|
$row = $stmt->fetch();
|
|
|
|
|
$row = $stmt->fetchAssociative();
|
|
|
|
|
$stmt->closeCursor();
|
|
|
|
|
if ($row) {
|
|
|
|
|
return $row['calendaruri'] . '/' . $row['objecturi'];
|
|
|
|
|
@ -2474,7 +2474,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
|
|
|
|
->where($query->expr()->eq('c.principaluri', $query->createNamedParameter($principalUri)))
|
|
|
|
|
->andWhere($query->expr()->eq('co.id', $query->createNamedParameter($id, IQueryBuilder::PARAM_INT), IQueryBuilder::PARAM_INT));
|
|
|
|
|
$stmt = $query->executeQuery();
|
|
|
|
|
$row = $stmt->fetch();
|
|
|
|
|
$row = $stmt->fetchAssociative();
|
|
|
|
|
$stmt->closeCursor();
|
|
|
|
|
|
|
|
|
|
if (!$row) {
|
|
|
|
|
@ -2600,11 +2600,11 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
|
|
|
|
$result = ['syncToken' => $currentToken, 'added' => [], 'modified' => [], 'deleted' => []];
|
|
|
|
|
// retrieve results
|
|
|
|
|
if ($initialSync) {
|
|
|
|
|
$result['added'] = $stmt->fetchAll(\PDO::FETCH_COLUMN);
|
|
|
|
|
$result['added'] = $stmt->fetchFirstColumn();
|
|
|
|
|
} else {
|
|
|
|
|
// \PDO::FETCH_NUM is needed due to the inconsistent field names
|
|
|
|
|
// produced by doctrine for MAX() with different databases
|
|
|
|
|
while ($entry = $stmt->fetch(\PDO::FETCH_NUM)) {
|
|
|
|
|
while ($entry = $stmt->fetchNumeric()) {
|
|
|
|
|
// assign uri (column 0) to appropriate mutation based on operation (column 1)
|
|
|
|
|
// forced (int) is needed as doctrine with OCI returns the operation field as string not integer
|
|
|
|
|
match ((int)$entry[1]) {
|
|
|
|
|
@ -2670,7 +2670,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
|
|
|
|
$stmt = $query->executeQuery();
|
|
|
|
|
|
|
|
|
|
$subscriptions = [];
|
|
|
|
|
while ($row = $stmt->fetch()) {
|
|
|
|
|
while ($row = $stmt->fetchAssociative()) {
|
|
|
|
|
$subscription = [
|
|
|
|
|
'id' => $row['id'],
|
|
|
|
|
'uri' => $row['uri'],
|
|
|
|
|
@ -2855,7 +2855,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
|
|
|
|
->andWhere($query->expr()->eq('uri', $query->createNamedParameter($objectUri)))
|
|
|
|
|
->executeQuery();
|
|
|
|
|
|
|
|
|
|
$row = $stmt->fetch();
|
|
|
|
|
$row = $stmt->fetchAssociative();
|
|
|
|
|
|
|
|
|
|
if (!$row) {
|
|
|
|
|
return null;
|
|
|
|
|
@ -2889,7 +2889,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
|
|
|
|
->executeQuery();
|
|
|
|
|
|
|
|
|
|
$results = [];
|
|
|
|
|
while (($row = $stmt->fetch()) !== false) {
|
|
|
|
|
while (($row = $stmt->fetchAssociative()) !== false) {
|
|
|
|
|
$results[] = [
|
|
|
|
|
'calendardata' => $row['calendardata'],
|
|
|
|
|
'uri' => $row['uri'],
|
|
|
|
|
@ -2939,7 +2939,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
|
|
|
|
}
|
|
|
|
|
$ids = array_map(static function (array $id) {
|
|
|
|
|
return (int)$id[0];
|
|
|
|
|
}, $result->fetchAll(\PDO::FETCH_NUM));
|
|
|
|
|
}, $result->fetchAllNumeric());
|
|
|
|
|
$result->closeCursor();
|
|
|
|
|
|
|
|
|
|
$numDeleted = 0;
|
|
|
|
|
@ -3040,7 +3040,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
|
|
|
|
)
|
|
|
|
|
);
|
|
|
|
|
$resultAdded = $qbAdded->executeQuery();
|
|
|
|
|
$addedUris = $resultAdded->fetchAll(\PDO::FETCH_COLUMN);
|
|
|
|
|
$addedUris = $resultAdded->fetchFirstColumn();
|
|
|
|
|
$resultAdded->closeCursor();
|
|
|
|
|
// Track everything as changed
|
|
|
|
|
// Tracking the creation is not necessary because \OCA\DAV\CalDAV\CalDavBackend::getChangesForCalendar
|
|
|
|
|
@ -3060,7 +3060,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
|
|
|
|
$resultDeleted = $qbDeleted->executeQuery();
|
|
|
|
|
$deletedUris = array_map(function (string $uri) {
|
|
|
|
|
return str_replace('-deleted.ics', '.ics', $uri);
|
|
|
|
|
}, $resultDeleted->fetchAll(\PDO::FETCH_COLUMN));
|
|
|
|
|
}, $resultDeleted->fetchFirstColumn());
|
|
|
|
|
$resultDeleted->closeCursor();
|
|
|
|
|
$this->addChanges($calendarId, $deletedUris, 3, $calendarType);
|
|
|
|
|
}, $this->db);
|
|
|
|
|
@ -3306,7 +3306,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
|
|
|
|
->executeQuery();
|
|
|
|
|
|
|
|
|
|
$hasPublishStatuses = [];
|
|
|
|
|
while ($row = $result->fetch()) {
|
|
|
|
|
while ($row = $result->fetchAssociative()) {
|
|
|
|
|
$this->publishStatusCache->set((string)$row['resourceid'], $row['publicuri']);
|
|
|
|
|
$hasPublishStatuses[(int)$row['resourceid']] = true;
|
|
|
|
|
}
|
|
|
|
|
@ -3419,7 +3419,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
|
|
|
|
->where($query->expr()->eq('uri', $query->createNamedParameter(BirthdayService::BIRTHDAY_CALENDAR_URI)))
|
|
|
|
|
->executeQuery();
|
|
|
|
|
|
|
|
|
|
while (($row = $result->fetch()) !== false) {
|
|
|
|
|
while (($row = $result->fetchAssociative()) !== false) {
|
|
|
|
|
$this->deleteCalendar(
|
|
|
|
|
$row['id'],
|
|
|
|
|
true // No data to keep in the trashbin, if the user re-enables then we regenerate
|
|
|
|
|
@ -3442,7 +3442,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
|
|
|
|
$stmt = $query->executeQuery();
|
|
|
|
|
|
|
|
|
|
$uris = [];
|
|
|
|
|
while (($row = $stmt->fetch()) !== false) {
|
|
|
|
|
while (($row = $stmt->fetchAssociative()) !== false) {
|
|
|
|
|
$uris[] = $row['uri'];
|
|
|
|
|
}
|
|
|
|
|
$stmt->closeCursor();
|
|
|
|
|
@ -3568,7 +3568,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
|
|
|
|
->andWhere($query->expr()->eq('calendartype', $query->createNamedParameter($calendarType)));
|
|
|
|
|
|
|
|
|
|
$result = $query->executeQuery();
|
|
|
|
|
$objectIds = $result->fetch();
|
|
|
|
|
$objectIds = $result->fetchAssociative();
|
|
|
|
|
$result->closeCursor();
|
|
|
|
|
|
|
|
|
|
if (!isset($objectIds['id'])) {
|
|
|
|
|
@ -3713,7 +3713,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
|
|
|
|
$cmd->select('uid')
|
|
|
|
|
->from($this->dbObjectsTable)
|
|
|
|
|
->where($cmd->expr()->eq('calendarid', $cmd->createNamedParameter($calendarId)));
|
|
|
|
|
$allIds = $cmd->executeQuery()->fetchAll(\PDO::FETCH_COLUMN);
|
|
|
|
|
$allIds = $cmd->executeQuery()->fetchFirstColumn();
|
|
|
|
|
// delete all links that match object uid's
|
|
|
|
|
$cmd = $this->db->getQueryBuilder();
|
|
|
|
|
$cmd->delete($this->dbObjectInvitationsTable)
|
|
|
|
|
|