aboutsummaryrefslogtreecommitdiffstats
path: root/apps/dav/lib/Migration
diff options
context:
space:
mode:
Diffstat (limited to 'apps/dav/lib/Migration')
-rw-r--r--apps/dav/lib/Migration/BuildCalendarSearchIndex.php55
-rw-r--r--apps/dav/lib/Migration/BuildCalendarSearchIndexBackgroundJob.php31
-rw-r--r--apps/dav/lib/Migration/BuildSocialSearchIndex.php43
-rw-r--r--apps/dav/lib/Migration/BuildSocialSearchIndexBackgroundJob.php32
-rw-r--r--apps/dav/lib/Migration/CalDAVRemoveEmptyValue.php50
-rw-r--r--apps/dav/lib/Migration/ChunkCleanup.php47
-rw-r--r--apps/dav/lib/Migration/CreateSystemAddressBookStep.php30
-rw-r--r--apps/dav/lib/Migration/DeleteSchedulingObjects.php39
-rw-r--r--apps/dav/lib/Migration/FixBirthdayCalendarComponent.php36
-rw-r--r--apps/dav/lib/Migration/RefreshWebcalJobRegistrar.php35
-rw-r--r--apps/dav/lib/Migration/RegenerateBirthdayCalendars.php37
-rw-r--r--apps/dav/lib/Migration/RegisterBuildReminderIndexBackgroundJob.php48
-rw-r--r--apps/dav/lib/Migration/RegisterUpdateCalendarResourcesRoomBackgroundJob.php30
-rw-r--r--apps/dav/lib/Migration/RemoveClassifiedEventActivity.php38
-rw-r--r--apps/dav/lib/Migration/RemoveDeletedUsersCalendarSubscriptions.php36
-rw-r--r--apps/dav/lib/Migration/RemoveObjectProperties.php29
-rw-r--r--apps/dav/lib/Migration/RemoveOrphanEventsAndContacts.php116
-rw-r--r--apps/dav/lib/Migration/Version1004Date20170825134824.php29
-rw-r--r--apps/dav/lib/Migration/Version1004Date20170919104507.php24
-rw-r--r--apps/dav/lib/Migration/Version1004Date20170924124212.php28
-rw-r--r--apps/dav/lib/Migration/Version1004Date20170926103422.php25
-rw-r--r--apps/dav/lib/Migration/Version1005Date20180413093149.php23
-rw-r--r--apps/dav/lib/Migration/Version1005Date20180530124431.php26
-rw-r--r--apps/dav/lib/Migration/Version1006Date20180619154313.php26
-rw-r--r--apps/dav/lib/Migration/Version1006Date20180628111625.php26
-rw-r--r--apps/dav/lib/Migration/Version1008Date20181030113700.php24
-rw-r--r--apps/dav/lib/Migration/Version1008Date20181105104826.php32
-rw-r--r--apps/dav/lib/Migration/Version1008Date20181105104833.php22
-rw-r--r--apps/dav/lib/Migration/Version1008Date20181105110300.php32
-rw-r--r--apps/dav/lib/Migration/Version1008Date20181105112049.php22
-rw-r--r--apps/dav/lib/Migration/Version1008Date20181114084440.php22
-rw-r--r--apps/dav/lib/Migration/Version1011Date20190725113607.php24
-rw-r--r--apps/dav/lib/Migration/Version1011Date20190806104428.php24
-rw-r--r--apps/dav/lib/Migration/Version1012Date20190808122342.php25
-rw-r--r--apps/dav/lib/Migration/Version1016Date20201109085907.php21
-rw-r--r--apps/dav/lib/Migration/Version1017Date20210216083742.php21
-rw-r--r--apps/dav/lib/Migration/Version1018Date20210312100735.php21
-rw-r--r--apps/dav/lib/Migration/Version1024Date20211221144219.php5
-rw-r--r--apps/dav/lib/Migration/Version1025Date20240308063933.php53
-rw-r--r--apps/dav/lib/Migration/Version1027Date20230504122946.php29
-rw-r--r--apps/dav/lib/Migration/Version1029Date20221114151721.php23
-rw-r--r--apps/dav/lib/Migration/Version1029Date20231004091403.php21
-rw-r--r--apps/dav/lib/Migration/Version1030Date20240205103243.php21
-rw-r--r--apps/dav/lib/Migration/Version1031Date20240610134258.php48
-rw-r--r--apps/dav/lib/Migration/Version1034Date20250813093701.php53
45 files changed, 446 insertions, 1036 deletions
diff --git a/apps/dav/lib/Migration/BuildCalendarSearchIndex.php b/apps/dav/lib/Migration/BuildCalendarSearchIndex.php
index fc9a6d9a559..d8f906f22ee 100644
--- a/apps/dav/lib/Migration/BuildCalendarSearchIndex.php
+++ b/apps/dav/lib/Migration/BuildCalendarSearchIndex.php
@@ -1,28 +1,8 @@
<?php
+
/**
- * @copyright 2017 Georg Ehrke <oc.list@georgehrke.com>
- *
- * @author Christoph Wurst <christoph@winzerhof-wurst.at>
- * @author Georg Ehrke <oc.list@georgehrke.com>
- * @author Joas Schilling <coding@schilljs.com>
- * @author Morris Jobke <hey@morrisjobke.de>
- * @author Roeland Jago Douma <roeland@famdouma.nl>
- *
- * @license GNU AGPL version 3 or any later version
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
+ * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
*/
namespace OCA\DAV\Migration;
@@ -34,26 +14,11 @@ use OCP\Migration\IRepairStep;
class BuildCalendarSearchIndex implements IRepairStep {
- /** @var IDBConnection */
- private $db;
-
- /** @var IJobList */
- private $jobList;
-
- /** @var IConfig */
- private $config;
-
- /**
- * @param IDBConnection $db
- * @param IJobList $jobList
- * @param IConfig $config
- */
- public function __construct(IDBConnection $db,
- IJobList $jobList,
- IConfig $config) {
- $this->db = $db;
- $this->jobList = $jobList;
- $this->config = $config;
+ public function __construct(
+ private IDBConnection $db,
+ private IJobList $jobList,
+ private IConfig $config,
+ ) {
}
/**
@@ -76,8 +41,8 @@ class BuildCalendarSearchIndex implements IRepairStep {
$query = $this->db->getQueryBuilder();
$query->select($query->createFunction('MAX(' . $query->getColumnName('id') . ')'))
->from('calendarobjects');
- $result = $query->execute();
- $maxId = (int) $result->fetchOne();
+ $result = $query->executeQuery();
+ $maxId = (int)$result->fetchOne();
$result->closeCursor();
$output->info('Add background job');
diff --git a/apps/dav/lib/Migration/BuildCalendarSearchIndexBackgroundJob.php b/apps/dav/lib/Migration/BuildCalendarSearchIndexBackgroundJob.php
index 0b89a3d1d77..da8f31e7d3d 100644
--- a/apps/dav/lib/Migration/BuildCalendarSearchIndexBackgroundJob.php
+++ b/apps/dav/lib/Migration/BuildCalendarSearchIndexBackgroundJob.php
@@ -3,27 +3,8 @@
declare(strict_types=1);
/**
- * @copyright 2017 Georg Ehrke <oc.list@georgehrke.com>
- *
- * @author Côme Chilliet <come.chilliet@nextcloud.com>
- * @author Georg Ehrke <oc.list@georgehrke.com>
- * @author Joas Schilling <coding@schilljs.com>
- *
- * @license GNU AGPL version 3 or any later version
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
+ * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
*/
namespace OCA\DAV\Migration;
@@ -40,16 +21,16 @@ class BuildCalendarSearchIndexBackgroundJob extends QueuedJob {
private CalDavBackend $calDavBackend,
private LoggerInterface $logger,
private IJobList $jobList,
- ITimeFactory $timeFactory
+ ITimeFactory $timeFactory,
) {
parent::__construct($timeFactory);
}
public function run($arguments) {
- $offset = (int) $arguments['offset'];
- $stopAt = (int) $arguments['stopAt'];
+ $offset = (int)$arguments['offset'];
+ $stopAt = (int)$arguments['stopAt'];
- $this->logger->info('Building calendar index (' . $offset .'/' . $stopAt . ')');
+ $this->logger->info('Building calendar index (' . $offset . '/' . $stopAt . ')');
$startTime = $this->time->getTime();
while (($this->time->getTime() - $startTime) < 15) {
diff --git a/apps/dav/lib/Migration/BuildSocialSearchIndex.php b/apps/dav/lib/Migration/BuildSocialSearchIndex.php
index f3872acc3ab..a808034365a 100644
--- a/apps/dav/lib/Migration/BuildSocialSearchIndex.php
+++ b/apps/dav/lib/Migration/BuildSocialSearchIndex.php
@@ -1,25 +1,8 @@
<?php
+
/**
- * @copyright 2017 Georg Ehrke <oc.list@georgehrke.com>
- *
- * @author call-me-matt <nextcloud@matthiasheinisch.de>
- * @author Christoph Wurst <christoph@winzerhof-wurst.at>
- *
- * @license GNU AGPL version 3 or any later version
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
+ * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
*/
namespace OCA\DAV\Migration;
@@ -31,26 +14,16 @@ use OCP\Migration\IRepairStep;
class BuildSocialSearchIndex implements IRepairStep {
- /** @var IDBConnection */
- private $db;
-
- /** @var IJobList */
- private $jobList;
-
- /** @var IConfig */
- private $config;
-
/**
* @param IDBConnection $db
* @param IJobList $jobList
* @param IConfig $config
*/
- public function __construct(IDBConnection $db,
- IJobList $jobList,
- IConfig $config) {
- $this->db = $db;
- $this->jobList = $jobList;
- $this->config = $config;
+ public function __construct(
+ private IDBConnection $db,
+ private IJobList $jobList,
+ private IConfig $config,
+ ) {
}
/**
diff --git a/apps/dav/lib/Migration/BuildSocialSearchIndexBackgroundJob.php b/apps/dav/lib/Migration/BuildSocialSearchIndexBackgroundJob.php
index 9a688970597..fab61d56fd6 100644
--- a/apps/dav/lib/Migration/BuildSocialSearchIndexBackgroundJob.php
+++ b/apps/dav/lib/Migration/BuildSocialSearchIndexBackgroundJob.php
@@ -3,26 +3,8 @@
declare(strict_types=1);
/**
- * @copyright 2020 Matthias Heinisch <nextcloud@matthiasheinisch.de>
- *
- * @author call-me-matt <nextcloud@matthiasheinisch.de>
- * @author Côme Chilliet <come.chilliet@nextcloud.com>
- *
- * @license GNU AGPL version 3 or any later version
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
+ * SPDX-FileCopyrightText: 2020 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
*/
namespace OCA\DAV\Migration;
@@ -30,6 +12,7 @@ use OCA\DAV\CardDAV\CardDavBackend;
use OCP\AppFramework\Utility\ITimeFactory;
use OCP\BackgroundJob\IJobList;
use OCP\BackgroundJob\QueuedJob;
+use OCP\DB\QueryBuilder\IQueryBuilder;
use OCP\IDBConnection;
use Psr\Log\LoggerInterface;
@@ -48,7 +31,7 @@ class BuildSocialSearchIndexBackgroundJob extends QueuedJob {
$offset = $arguments['offset'];
$stopAt = $arguments['stopAt'];
- $this->logger->info('Indexing social profile data (' . $offset .'/' . $stopAt . ')');
+ $this->logger->info('Indexing social profile data (' . $offset . '/' . $stopAt . ')');
$offset = $this->buildIndex($offset, $stopAt);
@@ -77,6 +60,7 @@ class BuildSocialSearchIndexBackgroundJob extends QueuedJob {
->from('cards', 'c')
->orderBy('id', 'ASC')
->where($query->expr()->like('carddata', $query->createNamedParameter('%SOCIALPROFILE%')))
+ ->andWhere($query->expr()->gt('id', $query->createNamedParameter((int)$offset, IQueryBuilder::PARAM_INT)))
->setMaxResults(100);
$social_cards = $query->executeQuery()->fetchAll();
@@ -87,7 +71,11 @@ class BuildSocialSearchIndexBackgroundJob extends QueuedJob {
// refresh identified contacts in order to re-index
foreach ($social_cards as $contact) {
$offset = $contact['id'];
- $this->davBackend->updateCard($contact['addressbookid'], $contact['uri'], $contact['carddata']);
+ $cardData = $contact['carddata'];
+ if (is_resource($cardData) && (get_resource_type($cardData) === 'stream')) {
+ $cardData = stream_get_contents($cardData);
+ }
+ $this->davBackend->updateCard($contact['addressbookid'], $contact['uri'], $cardData);
// stop after 15sec (to be continued with next chunk)
if (($this->time->getTime() - $startTime) > 15) {
diff --git a/apps/dav/lib/Migration/CalDAVRemoveEmptyValue.php b/apps/dav/lib/Migration/CalDAVRemoveEmptyValue.php
index 9b96df2ae1e..24e182e46eb 100644
--- a/apps/dav/lib/Migration/CalDAVRemoveEmptyValue.php
+++ b/apps/dav/lib/Migration/CalDAVRemoveEmptyValue.php
@@ -1,30 +1,11 @@
<?php
+
/**
- * @copyright 2017 Joas Schilling <coding@schilljs.com>
- *
- * @author Christoph Wurst <christoph@winzerhof-wurst.at>
- * @author Joas Schilling <coding@schilljs.com>
- * @author Julius Härtl <jus@bitgrid.net>
- *
- * @license GNU AGPL version 3 or any later version
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
+ * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
*/
namespace OCA\DAV\Migration;
-use Doctrine\DBAL\Platforms\OraclePlatform;
use OCA\DAV\CalDAV\CalDavBackend;
use OCP\DB\QueryBuilder\IQueryBuilder;
use OCP\IDBConnection;
@@ -35,18 +16,11 @@ use Sabre\VObject\InvalidDataException;
class CalDAVRemoveEmptyValue implements IRepairStep {
- /** @var IDBConnection */
- private $db;
-
- /** @var CalDavBackend */
- private $calDavBackend;
-
- private LoggerInterface $logger;
-
- public function __construct(IDBConnection $db, CalDavBackend $calDavBackend, LoggerInterface $logger) {
- $this->db = $db;
- $this->calDavBackend = $calDavBackend;
- $this->logger = $logger;
+ public function __construct(
+ private IDBConnection $db,
+ private CalDavBackend $calDavBackend,
+ private LoggerInterface $logger,
+ ) {
}
public function getName() {
@@ -94,13 +68,13 @@ class CalDAVRemoveEmptyValue implements IRepairStep {
}
protected function getInvalidObjects($pattern) {
- if ($this->db->getDatabasePlatform() instanceof OraclePlatform) {
+ if ($this->db->getDatabaseProvider() === IDBConnection::PLATFORM_ORACLE) {
$rows = [];
$chunkSize = 500;
$query = $this->db->getQueryBuilder();
$query->select($query->func()->count('*', 'num_entries'))
->from('calendarobjects');
- $result = $query->execute();
+ $result = $query->executeQuery();
$count = $result->fetchOne();
$result->closeCursor();
@@ -112,7 +86,7 @@ class CalDAVRemoveEmptyValue implements IRepairStep {
->setMaxResults($chunkSize);
for ($chunk = 0; $chunk < $numChunks; $chunk++) {
$query->setFirstResult($chunk * $chunkSize);
- $result = $query->execute();
+ $result = $query->executeQuery();
while ($row = $result->fetch()) {
if (mb_strpos($row['calendardata'], $pattern) !== false) {
@@ -137,7 +111,7 @@ class CalDAVRemoveEmptyValue implements IRepairStep {
IQueryBuilder::PARAM_STR
));
- $result = $query->execute();
+ $result = $query->executeQuery();
$rows = $result->fetchAll();
$result->closeCursor();
diff --git a/apps/dav/lib/Migration/ChunkCleanup.php b/apps/dav/lib/Migration/ChunkCleanup.php
index 8a4ad5664a4..edd9a26109e 100644
--- a/apps/dav/lib/Migration/ChunkCleanup.php
+++ b/apps/dav/lib/Migration/ChunkCleanup.php
@@ -3,25 +3,8 @@
declare(strict_types=1);
/**
- * @copyright Copyright (c) 2018, Roeland Jago Douma <roeland@famdouma.nl>
- *
- * @author Roeland Jago Douma <roeland@famdouma.nl>
- *
- * @license GNU AGPL version 3 or any later version
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
+ * SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
*/
namespace OCA\DAV\Migration;
@@ -38,23 +21,12 @@ use OCP\Migration\IRepairStep;
class ChunkCleanup implements IRepairStep {
- /** @var IConfig */
- private $config;
- /** @var IUserManager */
- private $userManager;
- /** @var IRootFolder */
- private $rootFolder;
- /** @var IJobList */
- private $jobList;
-
- public function __construct(IConfig $config,
- IUserManager $userManager,
- IRootFolder $rootFolder,
- IJobList $jobList) {
- $this->config = $config;
- $this->userManager = $userManager;
- $this->rootFolder = $rootFolder;
- $this->jobList = $jobList;
+ public function __construct(
+ private IConfig $config,
+ private IUserManager $userManager,
+ private IRootFolder $rootFolder,
+ private IJobList $jobList,
+ ) {
}
public function getName(): string {
@@ -65,11 +37,12 @@ class ChunkCleanup implements IRepairStep {
// If we already ran this onec there is no need to run it again
if ($this->config->getAppValue('dav', 'chunks_migrated', '0') === '1') {
$output->info('Cleanup not required');
+ return;
}
$output->startProgress();
// Loop over all seen users
- $this->userManager->callForSeenUsers(function (IUser $user) use ($output) {
+ $this->userManager->callForSeenUsers(function (IUser $user) use ($output): void {
try {
$userFolder = $this->rootFolder->getUserFolder($user->getUID());
$userRoot = $userFolder->getParent();
diff --git a/apps/dav/lib/Migration/CreateSystemAddressBookStep.php b/apps/dav/lib/Migration/CreateSystemAddressBookStep.php
new file mode 100644
index 00000000000..ec07c72e7a7
--- /dev/null
+++ b/apps/dav/lib/Migration/CreateSystemAddressBookStep.php
@@ -0,0 +1,30 @@
+<?php
+
+declare(strict_types=1);
+
+/**
+ * SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
+ */
+
+namespace OCA\DAV\Migration;
+
+use OCA\DAV\CardDAV\SyncService;
+use OCP\Migration\IOutput;
+use OCP\Migration\IRepairStep;
+
+class CreateSystemAddressBookStep implements IRepairStep {
+
+ public function __construct(
+ private SyncService $syncService,
+ ) {
+ }
+
+ public function getName(): string {
+ return 'Create system address book';
+ }
+
+ public function run(IOutput $output): void {
+ $this->syncService->ensureLocalSystemAddressBookExists();
+ }
+}
diff --git a/apps/dav/lib/Migration/DeleteSchedulingObjects.php b/apps/dav/lib/Migration/DeleteSchedulingObjects.php
new file mode 100644
index 00000000000..3cb3c9c9b10
--- /dev/null
+++ b/apps/dav/lib/Migration/DeleteSchedulingObjects.php
@@ -0,0 +1,39 @@
+<?php
+
+declare(strict_types=1);
+
+/**
+ * SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
+ */
+namespace OCA\DAV\Migration;
+
+use OCA\DAV\BackgroundJob\DeleteOutdatedSchedulingObjects;
+use OCA\DAV\CalDAV\CalDavBackend;
+use OCP\AppFramework\Utility\ITimeFactory;
+use OCP\BackgroundJob\IJobList;
+use OCP\Migration\IOutput;
+use OCP\Migration\IRepairStep;
+
+class DeleteSchedulingObjects implements IRepairStep {
+ public function __construct(
+ private IJobList $jobList,
+ private ITimeFactory $time,
+ private CalDavBackend $calDavBackend,
+ ) {
+ }
+
+ public function getName(): string {
+ return 'Handle outdated scheduling events';
+ }
+
+ public function run(IOutput $output): void {
+ $output->info('Cleaning up old scheduling events');
+ $time = $this->time->getTime() - (60 * 60);
+ $this->calDavBackend->deleteOutdatedSchedulingObjects($time, 50000);
+ if (!$this->jobList->has(DeleteOutdatedSchedulingObjects::class, null)) {
+ $output->info('Adding background job to delete old scheduling objects');
+ $this->jobList->add(DeleteOutdatedSchedulingObjects::class, null);
+ }
+ }
+}
diff --git a/apps/dav/lib/Migration/FixBirthdayCalendarComponent.php b/apps/dav/lib/Migration/FixBirthdayCalendarComponent.php
index 6aa499c8b1a..6833ca2ffa6 100644
--- a/apps/dav/lib/Migration/FixBirthdayCalendarComponent.php
+++ b/apps/dav/lib/Migration/FixBirthdayCalendarComponent.php
@@ -1,23 +1,8 @@
<?php
+
/**
- * @copyright Copyright (c) 2016, ownCloud GmbH.
- *
- * @author Thomas Müller <thomas.mueller@tmit.eu>
- *
- * @license AGPL-3.0
- *
- * This code is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License, version 3,
- * as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License, version 3,
- * along with this program. If not, see <http://www.gnu.org/licenses/>
- *
+ * SPDX-FileCopyrightText: 2016 ownCloud GmbH.
+ * SPDX-License-Identifier: AGPL-3.0-only
*/
namespace OCA\DAV\Migration;
@@ -28,16 +13,9 @@ use OCP\Migration\IRepairStep;
class FixBirthdayCalendarComponent implements IRepairStep {
- /** @var IDBConnection */
- private $connection;
-
- /**
- * FixBirthdayCalendarComponent constructor.
- *
- * @param IDBConnection $connection
- */
- public function __construct(IDBConnection $connection) {
- $this->connection = $connection;
+ public function __construct(
+ private IDBConnection $connection,
+ ) {
}
/**
@@ -55,7 +33,7 @@ class FixBirthdayCalendarComponent implements IRepairStep {
$updated = $query->update('calendars')
->set('components', $query->createNamedParameter('VEVENT'))
->where($query->expr()->eq('uri', $query->createNamedParameter(BirthdayService::BIRTHDAY_CALENDAR_URI)))
- ->execute();
+ ->executeStatement();
$output->info("$updated birthday calendars updated.");
}
diff --git a/apps/dav/lib/Migration/RefreshWebcalJobRegistrar.php b/apps/dav/lib/Migration/RefreshWebcalJobRegistrar.php
index ae930712859..cd4b8b31f4d 100644
--- a/apps/dav/lib/Migration/RefreshWebcalJobRegistrar.php
+++ b/apps/dav/lib/Migration/RefreshWebcalJobRegistrar.php
@@ -3,26 +3,8 @@
declare(strict_types=1);
/**
- * @copyright 2018 Georg Ehrke <oc.list@georgehrke.com>
- *
- * @author Christoph Wurst <christoph@winzerhof-wurst.at>
- * @author Georg Ehrke <oc.list@georgehrke.com>
- *
- * @license GNU AGPL version 3 or any later version
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
+ * SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
*/
namespace OCA\DAV\Migration;
@@ -34,21 +16,16 @@ use OCP\Migration\IRepairStep;
class RefreshWebcalJobRegistrar implements IRepairStep {
- /** @var IDBConnection */
- private $connection;
-
- /** @var IJobList */
- private $jobList;
-
/**
* FixBirthdayCalendarComponent constructor.
*
* @param IDBConnection $connection
* @param IJobList $jobList
*/
- public function __construct(IDBConnection $connection, IJobList $jobList) {
- $this->connection = $connection;
- $this->jobList = $jobList;
+ public function __construct(
+ private IDBConnection $connection,
+ private IJobList $jobList,
+ ) {
}
/**
diff --git a/apps/dav/lib/Migration/RegenerateBirthdayCalendars.php b/apps/dav/lib/Migration/RegenerateBirthdayCalendars.php
index a8138d876e9..ef8e9002e9d 100644
--- a/apps/dav/lib/Migration/RegenerateBirthdayCalendars.php
+++ b/apps/dav/lib/Migration/RegenerateBirthdayCalendars.php
@@ -1,25 +1,8 @@
<?php
+
/**
- * @copyright 2019 Georg Ehrke <oc.list@georgehrke.com>
- *
- * @author Arthur Schiwon <blizzz@arthur-schiwon.de>
- * @author Georg Ehrke <oc.list@georgehrke.com>
- *
- * @license GNU AGPL version 3 or any later version
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
+ * SPDX-FileCopyrightText: 2019 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
*/
namespace OCA\DAV\Migration;
@@ -31,20 +14,14 @@ use OCP\Migration\IRepairStep;
class RegenerateBirthdayCalendars implements IRepairStep {
- /** @var IJobList */
- private $jobList;
-
- /** @var IConfig */
- private $config;
-
/**
* @param IJobList $jobList
* @param IConfig $config
*/
- public function __construct(IJobList $jobList,
- IConfig $config) {
- $this->jobList = $jobList;
- $this->config = $config;
+ public function __construct(
+ private IJobList $jobList,
+ private IConfig $config,
+ ) {
}
/**
diff --git a/apps/dav/lib/Migration/RegisterBuildReminderIndexBackgroundJob.php b/apps/dav/lib/Migration/RegisterBuildReminderIndexBackgroundJob.php
index 0b5062fcf3e..7f74390f883 100644
--- a/apps/dav/lib/Migration/RegisterBuildReminderIndexBackgroundJob.php
+++ b/apps/dav/lib/Migration/RegisterBuildReminderIndexBackgroundJob.php
@@ -3,28 +3,8 @@
declare(strict_types=1);
/**
- * @copyright 2019 Georg Ehrke <oc.list@georgehrke.com>
- *
- * @author Christoph Wurst <christoph@winzerhof-wurst.at>
- * @author Georg Ehrke <oc.list@georgehrke.com>
- * @author Joas Schilling <coding@schilljs.com>
- * @author Roeland Jago Douma <roeland@famdouma.nl>
- *
- * @license GNU AGPL version 3 or any later version
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
+ * SPDX-FileCopyrightText: 2019 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
*/
namespace OCA\DAV\Migration;
@@ -42,15 +22,6 @@ use OCP\Migration\IRepairStep;
*/
class RegisterBuildReminderIndexBackgroundJob implements IRepairStep {
- /** @var IDBConnection */
- private $db;
-
- /** @var IJobList */
- private $jobList;
-
- /** @var IConfig */
- private $config;
-
/** @var string */
private const CONFIG_KEY = 'buildCalendarReminderIndex';
@@ -59,12 +30,11 @@ class RegisterBuildReminderIndexBackgroundJob implements IRepairStep {
* @param IJobList $jobList
* @param IConfig $config
*/
- public function __construct(IDBConnection $db,
- IJobList $jobList,
- IConfig $config) {
- $this->db = $db;
- $this->jobList = $jobList;
- $this->config = $config;
+ public function __construct(
+ private IDBConnection $db,
+ private IJobList $jobList,
+ private IConfig $config,
+ ) {
}
/**
@@ -87,8 +57,8 @@ class RegisterBuildReminderIndexBackgroundJob implements IRepairStep {
$query = $this->db->getQueryBuilder();
$query->select($query->createFunction('MAX(' . $query->getColumnName('id') . ')'))
->from('calendarobjects');
- $result = $query->execute();
- $maxId = (int) $result->fetchOne();
+ $result = $query->executeQuery();
+ $maxId = (int)$result->fetchOne();
$result->closeCursor();
$output->info('Add background job');
diff --git a/apps/dav/lib/Migration/RegisterUpdateCalendarResourcesRoomBackgroundJob.php b/apps/dav/lib/Migration/RegisterUpdateCalendarResourcesRoomBackgroundJob.php
new file mode 100644
index 00000000000..9d77aefafd2
--- /dev/null
+++ b/apps/dav/lib/Migration/RegisterUpdateCalendarResourcesRoomBackgroundJob.php
@@ -0,0 +1,30 @@
+<?php
+
+declare(strict_types=1);
+
+/**
+ * SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
+ */
+
+namespace OCA\DAV\Migration;
+
+use OCA\DAV\BackgroundJob\UpdateCalendarResourcesRoomsBackgroundJob;
+use OCP\BackgroundJob\IJobList;
+use OCP\Migration\IOutput;
+use OCP\Migration\IRepairStep;
+
+class RegisterUpdateCalendarResourcesRoomBackgroundJob implements IRepairStep {
+ public function __construct(
+ private readonly IJobList $jobList,
+ ) {
+ }
+
+ public function getName() {
+ return 'Register a background job to update rooms and resources';
+ }
+
+ public function run(IOutput $output) {
+ $this->jobList->add(UpdateCalendarResourcesRoomsBackgroundJob::class);
+ }
+}
diff --git a/apps/dav/lib/Migration/RemoveClassifiedEventActivity.php b/apps/dav/lib/Migration/RemoveClassifiedEventActivity.php
index 36108ddadfa..f0d208f4f33 100644
--- a/apps/dav/lib/Migration/RemoveClassifiedEventActivity.php
+++ b/apps/dav/lib/Migration/RemoveClassifiedEventActivity.php
@@ -3,26 +3,8 @@
declare(strict_types=1);
/**
- * @copyright Copyright (c) 2019 Joas Schilling <coding@schilljs.com>
- *
- * @author Joas Schilling <coding@schilljs.com>
- * @author Roeland Jago Douma <roeland@famdouma.nl>
- *
- * @license GNU AGPL version 3 or any later version
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
+ * SPDX-FileCopyrightText: 2019 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
*/
namespace OCA\DAV\Migration;
@@ -33,11 +15,9 @@ use OCP\Migration\IRepairStep;
class RemoveClassifiedEventActivity implements IRepairStep {
- /** @var IDBConnection */
- private $connection;
-
- public function __construct(IDBConnection $connection) {
- $this->connection = $connection;
+ public function __construct(
+ private IDBConnection $connection,
+ ) {
}
/**
@@ -76,7 +56,7 @@ class RemoveClassifiedEventActivity implements IRepairStep {
->from('calendarobjects', 'o')
->leftJoin('o', 'calendars', 'c', $query->expr()->eq('c.id', 'o.calendarid'))
->where($query->expr()->eq('o.classification', $query->createNamedParameter(CalDavBackend::CLASSIFICATION_PRIVATE)));
- $result = $query->execute();
+ $result = $query->executeQuery();
while ($row = $result->fetch()) {
if ($row['principaluri'] === null) {
@@ -87,7 +67,7 @@ class RemoveClassifiedEventActivity implements IRepairStep {
->setParameter('type', 'calendar')
->setParameter('calendar_id', $row['calendarid'])
->setParameter('event_uid', '%' . $this->connection->escapeLikeParameter('{"id":"' . $row['uid'] . '"') . '%');
- $deletedEvents += $delete->execute();
+ $deletedEvents += $delete->executeStatement();
}
$result->closeCursor();
@@ -110,7 +90,7 @@ class RemoveClassifiedEventActivity implements IRepairStep {
->from('calendarobjects', 'o')
->leftJoin('o', 'calendars', 'c', $query->expr()->eq('c.id', 'o.calendarid'))
->where($query->expr()->eq('o.classification', $query->createNamedParameter(CalDavBackend::CLASSIFICATION_CONFIDENTIAL)));
- $result = $query->execute();
+ $result = $query->executeQuery();
while ($row = $result->fetch()) {
if ($row['principaluri'] === null) {
@@ -122,7 +102,7 @@ class RemoveClassifiedEventActivity implements IRepairStep {
->setParameter('calendar_id', $row['calendarid'])
->setParameter('event_uid', '%' . $this->connection->escapeLikeParameter('{"id":"' . $row['uid'] . '"') . '%')
->setParameter('filtered_name', '%' . $this->connection->escapeLikeParameter('{"id":"' . $row['uid'] . '","name":"Busy"') . '%');
- $deletedEvents += $delete->execute();
+ $deletedEvents += $delete->executeStatement();
}
$result->closeCursor();
diff --git a/apps/dav/lib/Migration/RemoveDeletedUsersCalendarSubscriptions.php b/apps/dav/lib/Migration/RemoveDeletedUsersCalendarSubscriptions.php
index 38d395b2c81..e2b2b701e74 100644
--- a/apps/dav/lib/Migration/RemoveDeletedUsersCalendarSubscriptions.php
+++ b/apps/dav/lib/Migration/RemoveDeletedUsersCalendarSubscriptions.php
@@ -3,25 +3,8 @@
declare(strict_types=1);
/**
- * @copyright Copyright (c) 2021 Thomas Citharel <nextcloud@tcit.fr>
- *
- * @author Thomas Citharel <nextcloud@tcit.fr>
- *
- * @license GNU AGPL version 3 or any later version
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
+ * SPDX-FileCopyrightText: 2021 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
*/
namespace OCA\DAV\Migration;
@@ -32,12 +15,6 @@ use OCP\Migration\IOutput;
use OCP\Migration\IRepairStep;
class RemoveDeletedUsersCalendarSubscriptions implements IRepairStep {
- /** @var IDBConnection */
- private $connection;
-
- /** @var IUserManager */
- private $userManager;
-
/** @var int */
private $progress = 0;
@@ -46,9 +23,10 @@ class RemoveDeletedUsersCalendarSubscriptions implements IRepairStep {
private const SUBSCRIPTIONS_CHUNK_SIZE = 1000;
- public function __construct(IDBConnection $connection, IUserManager $userManager) {
- $this->connection = $connection;
- $this->userManager = $userManager;
+ public function __construct(
+ private IDBConnection $connection,
+ private IUserManager $userManager,
+ ) {
}
/**
@@ -113,7 +91,7 @@ class RemoveDeletedUsersCalendarSubscriptions implements IRepairStep {
while ($row = $result->fetch()) {
$username = $this->getPrincipal($row['principaluri']);
if (!$this->userManager->userExists($username)) {
- $this->orphanSubscriptionIds[] = (int) $row['id'];
+ $this->orphanSubscriptionIds[] = (int)$row['id'];
}
}
$result->closeCursor();
diff --git a/apps/dav/lib/Migration/RemoveObjectProperties.php b/apps/dav/lib/Migration/RemoveObjectProperties.php
index b771b70e684..f09293ae0bb 100644
--- a/apps/dav/lib/Migration/RemoveObjectProperties.php
+++ b/apps/dav/lib/Migration/RemoveObjectProperties.php
@@ -1,23 +1,8 @@
<?php
+
/**
- * @copyright Copyright (c) 2021, Thomas Citharel <nextcloud@tcit.fr>.
- *
- * @author Thomas Citharel <nextcloud@tcit.fr>
- *
- * @license AGPL-3.0
- *
- * This code is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License, version 3,
- * as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License, version 3,
- * along with this program. If not, see <http://www.gnu.org/licenses/>
- *
+ * SPDX-FileCopyrightText: 2021 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-only
*/
namespace OCA\DAV\Migration;
@@ -31,16 +16,14 @@ class RemoveObjectProperties implements IRepairStep {
private const ME_CARD_PROPERTY = '{http://calendarserver.org/ns/}me-card';
private const CALENDAR_TRANSP_PROPERTY = '{urn:ietf:params:xml:ns:caldav}schedule-calendar-transp';
- /** @var IDBConnection */
- private $connection;
-
/**
* RemoveObjectProperties constructor.
*
* @param IDBConnection $connection
*/
- public function __construct(IDBConnection $connection) {
- $this->connection = $connection;
+ public function __construct(
+ private IDBConnection $connection,
+ ) {
}
/**
diff --git a/apps/dav/lib/Migration/RemoveOrphanEventsAndContacts.php b/apps/dav/lib/Migration/RemoveOrphanEventsAndContacts.php
index a36d43d29df..143dc3cd1e6 100644
--- a/apps/dav/lib/Migration/RemoveOrphanEventsAndContacts.php
+++ b/apps/dav/lib/Migration/RemoveOrphanEventsAndContacts.php
@@ -3,108 +3,50 @@
declare(strict_types=1);
/**
- * @copyright Copyright (c) 2019 Joas Schilling <coding@schilljs.com>
- *
- * @author Christoph Wurst <christoph@winzerhof-wurst.at>
- * @author Joas Schilling <coding@schilljs.com>
- * @author Thomas Citharel <nextcloud@tcit.fr>
- *
- * @license GNU AGPL version 3 or any later version
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
+ * SPDX-FileCopyrightText: 2019 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
*/
namespace OCA\DAV\Migration;
-use OCA\DAV\CalDAV\CalDavBackend;
-use OCP\DB\QueryBuilder\IQueryBuilder;
-use OCP\IDBConnection;
+use OCA\DAV\BackgroundJob\CleanupOrphanedChildrenJob;
+use OCP\BackgroundJob\IJobList;
use OCP\Migration\IOutput;
use OCP\Migration\IRepairStep;
class RemoveOrphanEventsAndContacts implements IRepairStep {
-
- /** @var IDBConnection */
- private $connection;
-
- public function __construct(IDBConnection $connection) {
- $this->connection = $connection;
+ public function __construct(
+ private readonly IJobList $jobList,
+ ) {
}
- /**
- * @inheritdoc
- */
public function getName(): string {
- return 'Clean up orphan event and contact data';
+ return 'Queue jobs to clean up orphan event and contact data';
}
- /**
- * @inheritdoc
- */
- public function run(IOutput $output) {
- $orphanItems = $this->removeOrphanChildren('calendarobjects', 'calendars', 'calendarid');
- $output->info(sprintf('%d events without a calendar have been cleaned up', $orphanItems));
- $orphanItems = $this->removeOrphanChildren('calendarobjects_props', 'calendarobjects', 'objectid');
- $output->info(sprintf('%d properties without an events have been cleaned up', $orphanItems));
- $orphanItems = $this->removeOrphanChildren('calendarchanges', 'calendars', 'calendarid');
- $output->info(sprintf('%d changes without a calendar have been cleaned up', $orphanItems));
+ public function run(IOutput $output): void {
+ $this->queueJob('calendarobjects', 'calendars', 'calendarid', '%d events without a calendar have been cleaned up');
+ $this->queueJob('calendarobjects_props', 'calendarobjects', 'objectid', '%d properties without an events have been cleaned up');
+ $this->queueJob('calendarchanges', 'calendars', 'calendarid', '%d changes without a calendar have been cleaned up');
- $orphanItems = $this->removeOrphanChildren('calendarobjects', 'calendarsubscriptions', 'calendarid');
- $output->info(sprintf('%d cached events without a calendar subscription have been cleaned up', $orphanItems));
- $orphanItems = $this->removeOrphanChildren('calendarchanges', 'calendarsubscriptions', 'calendarid');
- $output->info(sprintf('%d changes without a calendar subscription have been cleaned up', $orphanItems));
+ $this->queueJob('calendarobjects', 'calendarsubscriptions', 'calendarid', '%d cached events without a calendar subscription have been cleaned up');
+ $this->queueJob('calendarchanges', 'calendarsubscriptions', 'calendarid', '%d changes without a calendar subscription have been cleaned up');
- $orphanItems = $this->removeOrphanChildren('cards', 'addressbooks', 'addressbookid');
- $output->info(sprintf('%d contacts without an addressbook have been cleaned up', $orphanItems));
- $orphanItems = $this->removeOrphanChildren('cards_properties', 'cards', 'cardid');
- $output->info(sprintf('%d properties without a contact have been cleaned up', $orphanItems));
- $orphanItems = $this->removeOrphanChildren('addressbookchanges', 'addressbooks', 'addressbookid');
- $output->info(sprintf('%d changes without an addressbook have been cleaned up', $orphanItems));
+ $this->queueJob('cards', 'addressbooks', 'addressbookid', '%d contacts without an addressbook have been cleaned up');
+ $this->queueJob('cards_properties', 'cards', 'cardid', '%d properties without a contact have been cleaned up');
+ $this->queueJob('addressbookchanges', 'addressbooks', 'addressbookid', '%d changes without an addressbook have been cleaned up');
}
- protected function removeOrphanChildren($childTable, $parentTable, $parentId): int {
- $qb = $this->connection->getQueryBuilder();
-
- $qb->select('c.id')
- ->from($childTable, 'c')
- ->leftJoin('c', $parentTable, 'p', $qb->expr()->eq('c.' . $parentId, 'p.id'))
- ->where($qb->expr()->isNull('p.id'));
-
- if (\in_array($parentTable, ['calendars', 'calendarsubscriptions'], true)) {
- $calendarType = $parentTable === 'calendarsubscriptions' ? CalDavBackend::CALENDAR_TYPE_SUBSCRIPTION : CalDavBackend::CALENDAR_TYPE_CALENDAR;
- $qb->andWhere($qb->expr()->eq('c.calendartype', $qb->createNamedParameter($calendarType, IQueryBuilder::PARAM_INT), IQueryBuilder::PARAM_INT));
- }
-
- $result = $qb->execute();
-
- $orphanItems = [];
- while ($row = $result->fetch()) {
- $orphanItems[] = (int) $row['id'];
- }
- $result->closeCursor();
-
- if (!empty($orphanItems)) {
- $qb->delete($childTable)
- ->where($qb->expr()->in('id', $qb->createParameter('ids')));
-
- $orphanItemsBatch = array_chunk($orphanItems, 200);
- foreach ($orphanItemsBatch as $items) {
- $qb->setParameter('ids', $items, IQueryBuilder::PARAM_INT_ARRAY);
- $qb->execute();
- }
- }
-
- return count($orphanItems);
+ private function queueJob(
+ string $childTable,
+ string $parentTable,
+ string $parentId,
+ string $logMessage,
+ ): void {
+ $this->jobList->add(CleanupOrphanedChildrenJob::class, [
+ CleanupOrphanedChildrenJob::ARGUMENT_CHILD_TABLE => $childTable,
+ CleanupOrphanedChildrenJob::ARGUMENT_PARENT_TABLE => $parentTable,
+ CleanupOrphanedChildrenJob::ARGUMENT_PARENT_ID => $parentId,
+ CleanupOrphanedChildrenJob::ARGUMENT_LOG_MESSAGE => $logMessage,
+ ]);
}
}
diff --git a/apps/dav/lib/Migration/Version1004Date20170825134824.php b/apps/dav/lib/Migration/Version1004Date20170825134824.php
index a7cbaa78ef2..4bf9637b697 100644
--- a/apps/dav/lib/Migration/Version1004Date20170825134824.php
+++ b/apps/dav/lib/Migration/Version1004Date20170825134824.php
@@ -1,27 +1,8 @@
<?php
+
/**
- * @copyright 2017, Roeland Jago Douma <roeland@famdouma.nl>
- *
- * @author Georg Ehrke <oc.list@georgehrke.com>
- * @author Joas Schilling <coding@schilljs.com>
- * @author Roeland Jago Douma <roeland@famdouma.nl>
- * @author Vincent Petry <vincent@nextcloud.com>
- *
- * @license GNU AGPL version 3 or any later version
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
+ * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
*/
namespace OCA\DAV\Migration;
@@ -383,6 +364,7 @@ class Version1004Date20170825134824 extends SimpleMigrationStep {
]);
$table->setPrimaryKey(['id']);
$table->addIndex(['principaluri'], 'schedulobj_principuri_index');
+ $table->addIndex(['lastmodified'], 'schedulobj_lastmodified_idx');
}
if (!$schema->hasTable('cards_properties')) {
@@ -490,6 +472,9 @@ class Version1004Date20170825134824 extends SimpleMigrationStep {
]);
$table->setPrimaryKey(['id']);
$table->addUniqueIndex(['principaluri', 'resourceid', 'type', 'publicuri'], 'dav_shares_index');
+ // modified on 2024-6-21 to add performance improving indices on new instances
+ $table->addIndex(['resourceid', 'type'], 'dav_shares_resourceid_type');
+ $table->addIndex(['resourceid', 'access'], 'dav_shares_resourceid_access');
}
return $schema;
}
diff --git a/apps/dav/lib/Migration/Version1004Date20170919104507.php b/apps/dav/lib/Migration/Version1004Date20170919104507.php
index 54548f30aca..678d92d2b83 100644
--- a/apps/dav/lib/Migration/Version1004Date20170919104507.php
+++ b/apps/dav/lib/Migration/Version1004Date20170919104507.php
@@ -1,26 +1,8 @@
<?php
+
/**
- * @copyright Copyright (c) 2016 Joas Schilling <coding@schilljs.com>
- *
- * @author Joas Schilling <coding@schilljs.com>
- * @author Morris Jobke <hey@morrisjobke.de>
- * @author Roeland Jago Douma <roeland@famdouma.nl>
- *
- * @license GNU AGPL version 3 or any later version
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
+ * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
*/
namespace OCA\DAV\Migration;
diff --git a/apps/dav/lib/Migration/Version1004Date20170924124212.php b/apps/dav/lib/Migration/Version1004Date20170924124212.php
index 4cc795e1aec..4d221e91132 100644
--- a/apps/dav/lib/Migration/Version1004Date20170924124212.php
+++ b/apps/dav/lib/Migration/Version1004Date20170924124212.php
@@ -1,25 +1,8 @@
<?php
+
/**
- * @copyright 2017, Roeland Jago Douma <roeland@famdouma.nl>
- *
- * @author Joas Schilling <coding@schilljs.com>
- * @author Roeland Jago Douma <roeland@famdouma.nl>
- *
- * @license GNU AGPL version 3 or any later version
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
+ * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
*/
namespace OCA\DAV\Migration;
@@ -46,7 +29,10 @@ class Version1004Date20170924124212 extends SimpleMigrationStep {
$table->addIndex(['addressbookid', 'uri'], 'cards_abiduri');
$table = $schema->getTable('cards_properties');
- $table->addIndex(['addressbookid'], 'cards_prop_abid');
+ // Removed later on
+ // $table->addIndex(['addressbookid'], 'cards_prop_abid');
+ // Added later on
+ $table->addIndex(['addressbookid', 'name', 'value'], 'cards_prop_abid_name_value', );
return $schema;
}
diff --git a/apps/dav/lib/Migration/Version1004Date20170926103422.php b/apps/dav/lib/Migration/Version1004Date20170926103422.php
index 6d88effc240..ec56e035006 100644
--- a/apps/dav/lib/Migration/Version1004Date20170926103422.php
+++ b/apps/dav/lib/Migration/Version1004Date20170926103422.php
@@ -1,25 +1,8 @@
<?php
+
/**
- * @copyright Copyright (c) 2016 Joas Schilling <coding@schilljs.com>
- *
- * @author Joas Schilling <coding@schilljs.com>
- * @author Morris Jobke <hey@morrisjobke.de>
- *
- * @license GNU AGPL version 3 or any later version
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
+ * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
*/
namespace OCA\DAV\Migration;
@@ -32,7 +15,7 @@ class Version1004Date20170926103422 extends BigIntMigration {
/**
* @return array Returns an array with the following structure
- * ['table1' => ['column1', 'column2'], ...]
+ * ['table1' => ['column1', 'column2'], ...]
* @since 13.0.0
*/
protected function getColumnsByTable() {
diff --git a/apps/dav/lib/Migration/Version1005Date20180413093149.php b/apps/dav/lib/Migration/Version1005Date20180413093149.php
index 6609b2396dd..db071c65d98 100644
--- a/apps/dav/lib/Migration/Version1005Date20180413093149.php
+++ b/apps/dav/lib/Migration/Version1005Date20180413093149.php
@@ -3,27 +3,8 @@
declare(strict_types=1);
/**
- * @copyright 2018, Roeland Jago Douma <roeland@famdouma.nl>
- *
- * @author Christoph Wurst <christoph@winzerhof-wurst.at>
- * @author Daniel Kesselberg <mail@danielkesselberg.de>
- * @author Roeland Jago Douma <roeland@famdouma.nl>
- *
- * @license GNU AGPL version 3 or any later version
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
+ * SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
*/
namespace OCA\DAV\Migration;
diff --git a/apps/dav/lib/Migration/Version1005Date20180530124431.php b/apps/dav/lib/Migration/Version1005Date20180530124431.php
index 9b0868f9374..b5f9ff26962 100644
--- a/apps/dav/lib/Migration/Version1005Date20180530124431.php
+++ b/apps/dav/lib/Migration/Version1005Date20180530124431.php
@@ -1,28 +1,8 @@
<?php
+
/**
- * @copyright 2017 Georg Ehrke <oc.list@georgehrke.com>
- *
- * @author Christoph Wurst <christoph@winzerhof-wurst.at>
- * @author Daniel Kesselberg <mail@danielkesselberg.de>
- * @author Georg Ehrke <oc.list@georgehrke.com>
- * @author Joas Schilling <coding@schilljs.com>
- * @author Roeland Jago Douma <roeland@famdouma.nl>
- *
- * @license GNU AGPL version 3 or any later version
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
+ * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
*/
namespace OCA\DAV\Migration;
diff --git a/apps/dav/lib/Migration/Version1006Date20180619154313.php b/apps/dav/lib/Migration/Version1006Date20180619154313.php
index 36e35f615ac..231861a68c4 100644
--- a/apps/dav/lib/Migration/Version1006Date20180619154313.php
+++ b/apps/dav/lib/Migration/Version1006Date20180619154313.php
@@ -1,28 +1,8 @@
<?php
+
/**
- * @copyright Copyright (c) 2016 Georg Ehrke <oc.list@georgehrke.com>
- *
- * @author Christoph Wurst <christoph@winzerhof-wurst.at>
- * @author Daniel Kesselberg <mail@danielkesselberg.de>
- * @author Georg Ehrke <oc.list@georgehrke.com>
- * @author Joas Schilling <coding@schilljs.com>
- * @author Roeland Jago Douma <roeland@famdouma.nl>
- *
- * @license GNU AGPL version 3 or any later version
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
+ * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
*/
namespace OCA\DAV\Migration;
diff --git a/apps/dav/lib/Migration/Version1006Date20180628111625.php b/apps/dav/lib/Migration/Version1006Date20180628111625.php
index 8c3a8e4938c..f4be26e6ad0 100644
--- a/apps/dav/lib/Migration/Version1006Date20180628111625.php
+++ b/apps/dav/lib/Migration/Version1006Date20180628111625.php
@@ -3,29 +3,8 @@
declare(strict_types=1);
/**
- * @copyright 2018 Georg Ehrke <oc.list@georgehrke.com>
- *
- * @author Christoph Wurst <christoph@winzerhof-wurst.at>
- * @author Daniel Kesselberg <mail@danielkesselberg.de>
- * @author Georg Ehrke <oc.list@georgehrke.com>
- * @author Joas Schilling <coding@schilljs.com>
- * @author Roeland Jago Douma <roeland@famdouma.nl>
- *
- * @license GNU AGPL version 3 or any later version
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
+ * SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
*/
namespace OCA\DAV\Migration;
@@ -70,6 +49,7 @@ class Version1006Date20180628111625 extends SimpleMigrationStep {
$calendarObjectsTable->dropIndex('calobjects_index');
}
$calendarObjectsTable->addUniqueIndex(['calendarid', 'calendartype', 'uri'], 'calobjects_index');
+ $calendarObjectsTable->addUniqueIndex(['calendarid', 'calendartype', 'uid'], 'calobjects_by_uid_index');
}
if ($schema->hasTable('calendarobjects_props')) {
diff --git a/apps/dav/lib/Migration/Version1008Date20181030113700.php b/apps/dav/lib/Migration/Version1008Date20181030113700.php
index e9751159913..d2354a185df 100644
--- a/apps/dav/lib/Migration/Version1008Date20181030113700.php
+++ b/apps/dav/lib/Migration/Version1008Date20181030113700.php
@@ -3,28 +3,8 @@
declare(strict_types=1);
/**
- * @copyright Copyright (c) 2018, John Molakvoæ (skjnldsv@protonmail.com)
- *
- * @author Christoph Wurst <christoph@winzerhof-wurst.at>
- * @author Daniel Kesselberg <mail@danielkesselberg.de>
- * @author John Molakvoæ <skjnldsv@protonmail.com>
- * @author Roeland Jago Douma <roeland@famdouma.nl>
- *
- * @license GNU AGPL version 3 or any later version
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
+ * SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
*/
namespace OCA\DAV\Migration;
diff --git a/apps/dav/lib/Migration/Version1008Date20181105104826.php b/apps/dav/lib/Migration/Version1008Date20181105104826.php
index 7b0c9861a98..82612307cbb 100644
--- a/apps/dav/lib/Migration/Version1008Date20181105104826.php
+++ b/apps/dav/lib/Migration/Version1008Date20181105104826.php
@@ -3,28 +3,8 @@
declare(strict_types=1);
/**
- * @copyright Copyright (c) 2018 Georg Ehrke
- *
- * @author Christoph Wurst <christoph@winzerhof-wurst.at>
- * @author Daniel Kesselberg <mail@danielkesselberg.de>
- * @author Georg Ehrke <oc.list@georgehrke.com>
- * @author Roeland Jago Douma <roeland@famdouma.nl>
- *
- * @license GNU AGPL version 3 or any later version
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
+ * SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
*/
namespace OCA\DAV\Migration;
@@ -37,16 +17,14 @@ use OCP\Migration\SimpleMigrationStep;
class Version1008Date20181105104826 extends SimpleMigrationStep {
- /** @var IDBConnection */
- private $connection;
-
/**
* Version1008Date20181105104826 constructor.
*
* @param IDBConnection $connection
*/
- public function __construct(IDBConnection $connection) {
- $this->connection = $connection;
+ public function __construct(
+ private IDBConnection $connection,
+ ) {
}
/**
diff --git a/apps/dav/lib/Migration/Version1008Date20181105104833.php b/apps/dav/lib/Migration/Version1008Date20181105104833.php
index 4b4e9cc535e..3d4094d8072 100644
--- a/apps/dav/lib/Migration/Version1008Date20181105104833.php
+++ b/apps/dav/lib/Migration/Version1008Date20181105104833.php
@@ -3,26 +3,8 @@
declare(strict_types=1);
/**
- * @copyright Copyright (c) 2018 Georg Ehrke
- *
- * @author Georg Ehrke <oc.list@georgehrke.com>
- * @author Roeland Jago Douma <roeland@famdouma.nl>
- *
- * @license GNU AGPL version 3 or any later version
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
+ * SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
*/
namespace OCA\DAV\Migration;
diff --git a/apps/dav/lib/Migration/Version1008Date20181105110300.php b/apps/dav/lib/Migration/Version1008Date20181105110300.php
index 9a69d106412..72e8dee1bf8 100644
--- a/apps/dav/lib/Migration/Version1008Date20181105110300.php
+++ b/apps/dav/lib/Migration/Version1008Date20181105110300.php
@@ -3,28 +3,8 @@
declare(strict_types=1);
/**
- * @copyright Copyright (c) 2018 Georg Ehrke
- *
- * @author Christoph Wurst <christoph@winzerhof-wurst.at>
- * @author Daniel Kesselberg <mail@danielkesselberg.de>
- * @author Georg Ehrke <oc.list@georgehrke.com>
- * @author Roeland Jago Douma <roeland@famdouma.nl>
- *
- * @license GNU AGPL version 3 or any later version
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
+ * SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
*/
namespace OCA\DAV\Migration;
@@ -37,16 +17,14 @@ use OCP\Migration\SimpleMigrationStep;
class Version1008Date20181105110300 extends SimpleMigrationStep {
- /** @var IDBConnection */
- private $connection;
-
/**
* Version1008Date20181105110300 constructor.
*
* @param IDBConnection $connection
*/
- public function __construct(IDBConnection $connection) {
- $this->connection = $connection;
+ public function __construct(
+ private IDBConnection $connection,
+ ) {
}
/**
diff --git a/apps/dav/lib/Migration/Version1008Date20181105112049.php b/apps/dav/lib/Migration/Version1008Date20181105112049.php
index 8dd7d695e68..eb18eacb0b1 100644
--- a/apps/dav/lib/Migration/Version1008Date20181105112049.php
+++ b/apps/dav/lib/Migration/Version1008Date20181105112049.php
@@ -3,26 +3,8 @@
declare(strict_types=1);
/**
- * @copyright Copyright (c) 2018 Georg Ehrke
- *
- * @author Georg Ehrke <oc.list@georgehrke.com>
- * @author Roeland Jago Douma <roeland@famdouma.nl>
- *
- * @license GNU AGPL version 3 or any later version
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
+ * SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
*/
namespace OCA\DAV\Migration;
diff --git a/apps/dav/lib/Migration/Version1008Date20181114084440.php b/apps/dav/lib/Migration/Version1008Date20181114084440.php
index 91f4211e3fa..3718f16f54a 100644
--- a/apps/dav/lib/Migration/Version1008Date20181114084440.php
+++ b/apps/dav/lib/Migration/Version1008Date20181114084440.php
@@ -3,26 +3,8 @@
declare(strict_types=1);
/**
- * @copyright Copyright (c) 2018, Joas Schilling <coding@schilljs.com>
- *
- * @author Joas Schilling <coding@schilljs.com>
- * @author Roeland Jago Douma <roeland@famdouma.nl>
- *
- * @license GNU AGPL version 3 or any later version
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
+ * SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
*/
namespace OCA\DAV\Migration;
diff --git a/apps/dav/lib/Migration/Version1011Date20190725113607.php b/apps/dav/lib/Migration/Version1011Date20190725113607.php
index a6673378259..4524dca9c83 100644
--- a/apps/dav/lib/Migration/Version1011Date20190725113607.php
+++ b/apps/dav/lib/Migration/Version1011Date20190725113607.php
@@ -3,28 +3,8 @@
declare(strict_types=1);
/**
- * @copyright Copyright (c) 2016 Georg Ehrke <oc.list@georgehrke.com>
- *
- * @author Christoph Wurst <christoph@winzerhof-wurst.at>
- * @author Daniel Kesselberg <mail@danielkesselberg.de>
- * @author Georg Ehrke <oc.list@georgehrke.com>
- * @author Roeland Jago Douma <roeland@famdouma.nl>
- *
- * @license GNU AGPL version 3 or any later version
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
+ * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
*/
namespace OCA\DAV\Migration;
diff --git a/apps/dav/lib/Migration/Version1011Date20190806104428.php b/apps/dav/lib/Migration/Version1011Date20190806104428.php
index 7c41bce87f5..183dcd4bf1e 100644
--- a/apps/dav/lib/Migration/Version1011Date20190806104428.php
+++ b/apps/dav/lib/Migration/Version1011Date20190806104428.php
@@ -3,28 +3,8 @@
declare(strict_types=1);
/**
- * @copyright Copyright (c) 2016 Roeland Jago Douma <roeland@famdouma.nl>
- *
- * @author Christoph Wurst <christoph@winzerhof-wurst.at>
- * @author Daniel Kesselberg <mail@danielkesselberg.de>
- * @author Georg Ehrke <oc.list@georgehrke.com>
- * @author Roeland Jago Douma <roeland@famdouma.nl>
- *
- * @license GNU AGPL version 3 or any later version
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
+ * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
*/
namespace OCA\DAV\Migration;
diff --git a/apps/dav/lib/Migration/Version1012Date20190808122342.php b/apps/dav/lib/Migration/Version1012Date20190808122342.php
index e72b552cac1..717bcbc1119 100644
--- a/apps/dav/lib/Migration/Version1012Date20190808122342.php
+++ b/apps/dav/lib/Migration/Version1012Date20190808122342.php
@@ -3,29 +3,8 @@
declare(strict_types=1);
/**
- * @copyright 2019, Georg Ehrke <oc.list@georgehrke.com>
- *
- * @author Christoph Wurst <christoph@winzerhof-wurst.at>
- * @author Daniel Kesselberg <mail@danielkesselberg.de>
- * @author Georg Ehrke <oc.list@georgehrke.com>
- * @author Joas Schilling <coding@schilljs.com>
- * @author Roeland Jago Douma <roeland@famdouma.nl>
- *
- * @license GNU AGPL version 3 or any later version
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
+ * SPDX-FileCopyrightText: 2019 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
*/
namespace OCA\DAV\Migration;
diff --git a/apps/dav/lib/Migration/Version1016Date20201109085907.php b/apps/dav/lib/Migration/Version1016Date20201109085907.php
index 6828c71301a..f0f4b8b77c1 100644
--- a/apps/dav/lib/Migration/Version1016Date20201109085907.php
+++ b/apps/dav/lib/Migration/Version1016Date20201109085907.php
@@ -3,25 +3,8 @@
declare(strict_types=1);
/**
- * @copyright Copyright (c) 2020 Joas Schilling <coding@schilljs.com>
- *
- * @author Joas Schilling <coding@schilljs.com>
- *
- * @license GNU AGPL version 3 or any later version
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
+ * SPDX-FileCopyrightText: 2020 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
*/
namespace OCA\DAV\Migration;
diff --git a/apps/dav/lib/Migration/Version1017Date20210216083742.php b/apps/dav/lib/Migration/Version1017Date20210216083742.php
index c5347d773d1..43bece200b8 100644
--- a/apps/dav/lib/Migration/Version1017Date20210216083742.php
+++ b/apps/dav/lib/Migration/Version1017Date20210216083742.php
@@ -3,25 +3,8 @@
declare(strict_types=1);
/**
- * @copyright Copyright (c) 2021 Roeland Jago Douma <roeland@famdouma.nl>
- *
- * @author Roeland Jago Douma <roeland@famdouma.nl>
- *
- * @license GNU AGPL version 3 or any later version
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
+ * SPDX-FileCopyrightText: 2021 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
*/
namespace OCA\DAV\Migration;
diff --git a/apps/dav/lib/Migration/Version1018Date20210312100735.php b/apps/dav/lib/Migration/Version1018Date20210312100735.php
index b0ea5146caa..8199d3e9cd2 100644
--- a/apps/dav/lib/Migration/Version1018Date20210312100735.php
+++ b/apps/dav/lib/Migration/Version1018Date20210312100735.php
@@ -3,25 +3,8 @@
declare(strict_types=1);
/**
- * @copyright Copyright (c) 2016 Christoph Wurst <christoph@winzerhof-wurst.at>
- *
- * @author Christoph Wurst <christoph@winzerhof-wurst.at>
- *
- * @license GNU AGPL version 3 or any later version
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
+ * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
*/
namespace OCA\DAV\Migration;
diff --git a/apps/dav/lib/Migration/Version1024Date20211221144219.php b/apps/dav/lib/Migration/Version1024Date20211221144219.php
index b93f8ac801e..656a50809cd 100644
--- a/apps/dav/lib/Migration/Version1024Date20211221144219.php
+++ b/apps/dav/lib/Migration/Version1024Date20211221144219.php
@@ -1,7 +1,10 @@
<?php
declare(strict_types=1);
-
+/**
+ * SPDX-FileCopyrightText: 2021 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
+ */
namespace OCA\DAV\Migration;
use Closure;
diff --git a/apps/dav/lib/Migration/Version1025Date20240308063933.php b/apps/dav/lib/Migration/Version1025Date20240308063933.php
index a75fc85eccc..d84acf8fea9 100644
--- a/apps/dav/lib/Migration/Version1025Date20240308063933.php
+++ b/apps/dav/lib/Migration/Version1025Date20240308063933.php
@@ -3,30 +3,14 @@
declare(strict_types=1);
/**
- * @copyright Copyright (c) 2024 Christoph Wurst <christoph@winzerhof-wurst.at>
- *
- * @author Christoph Wurst <christoph@winzerhof-wurst.at>
- *
- * @license GNU AGPL version 3 or any later version
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
+ * SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
*/
namespace OCA\DAV\Migration;
use Closure;
+use OCP\AppFramework\Services\IAppConfig;
use OCP\DB\ISchemaWrapper;
use OCP\DB\QueryBuilder\IQueryBuilder;
use OCP\DB\Types;
@@ -36,10 +20,10 @@ use OCP\Migration\SimpleMigrationStep;
class Version1025Date20240308063933 extends SimpleMigrationStep {
- private IDBConnection $db;
-
- public function __construct(IDBConnection $db) {
- $this->db = $db;
+ public function __construct(
+ private IAppConfig $appConfig,
+ private IDBConnection $db,
+ ) {
}
/**
@@ -67,7 +51,22 @@ class Version1025Date20240308063933 extends SimpleMigrationStep {
}
public function postSchemaChange(IOutput $output, \Closure $schemaClosure, array $options): void {
+ // The threshold is higher than the default of \OCA\DAV\BackgroundJob\PruneOutdatedSyncTokensJob
+ // but small enough to fit into a cluster transaction size.
+ // For a 50k users instance that would still keep 10 changes on average.
+ $limit = max(1, (int)$this->appConfig->getAppValue('totalNumberOfSyncTokensToKeep', '500000'));
+
foreach (['addressbookchanges', 'calendarchanges'] as $tableName) {
+ $thresholdSelect = $this->db->getQueryBuilder();
+ $thresholdSelect->select('id')
+ ->from($tableName)
+ ->orderBy('id', 'desc')
+ ->setFirstResult($limit)
+ ->setMaxResults(1);
+ $oldestIdResult = $thresholdSelect->executeQuery();
+ $oldestId = $oldestIdResult->fetchColumn();
+ $oldestIdResult->closeCursor();
+
$qb = $this->db->getQueryBuilder();
$update = $qb->update($tableName)
@@ -76,7 +75,15 @@ class Version1025Date20240308063933 extends SimpleMigrationStep {
$qb->expr()->eq('created_at', $qb->createNamedParameter(0, IQueryBuilder::PARAM_INT)),
);
+ // If there is a lot of data we only set timestamp for the most recent rows
+ // because the rest will be deleted by \OCA\DAV\BackgroundJob\PruneOutdatedSyncTokensJob
+ // anyway.
+ if ($oldestId !== false) {
+ $update->andWhere($qb->expr()->gt('id', $qb->createNamedParameter($oldestId, IQueryBuilder::PARAM_INT), IQueryBuilder::PARAM_INT));
+ }
+
$updated = $update->executeStatement();
+
$output->debug('Added a default creation timestamp to ' . $updated . ' rows in ' . $tableName);
}
}
diff --git a/apps/dav/lib/Migration/Version1027Date20230504122946.php b/apps/dav/lib/Migration/Version1027Date20230504122946.php
index 28361011436..89c192a8419 100644
--- a/apps/dav/lib/Migration/Version1027Date20230504122946.php
+++ b/apps/dav/lib/Migration/Version1027Date20230504122946.php
@@ -3,25 +3,8 @@
declare(strict_types=1);
/**
- * @copyright Copyright (c) 2023 Anna Larch <anna.larch@gmx.net>
- *
- * @author Anna Larch <anna.larch@gmx.net>
- *
- * @license GNU AGPL version 3 or any later version
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
+ * SPDX-FileCopyrightText: 2023 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
*/
namespace OCA\DAV\Migration;
@@ -37,10 +20,12 @@ use Psr\Log\LoggerInterface;
use Throwable;
class Version1027Date20230504122946 extends SimpleMigrationStep {
- public function __construct(private SyncService $syncService,
+ public function __construct(
+ private SyncService $syncService,
private LoggerInterface $logger,
private IUserManager $userManager,
- private IConfig $config) {
+ private IConfig $config,
+ ) {
}
/**
* @param IOutput $output
@@ -48,7 +33,7 @@ class Version1027Date20230504122946 extends SimpleMigrationStep {
* @param array $options
*/
public function postSchemaChange(IOutput $output, Closure $schemaClosure, array $options): void {
- if($this->userManager->countSeenUsers() > 100 || array_sum($this->userManager->countUsers()) > 100) {
+ if ($this->userManager->countSeenUsers() > 100 || $this->userManager->countUsersTotal(100) >= 100) {
$this->config->setAppValue('dav', 'needs_system_address_book_sync', 'yes');
$output->info('Could not sync system address books during update - too many user records have been found. Please call occ dav:sync-system-addressbook manually.');
return;
diff --git a/apps/dav/lib/Migration/Version1029Date20221114151721.php b/apps/dav/lib/Migration/Version1029Date20221114151721.php
index 112b240c8ba..dba5e0b1a48 100644
--- a/apps/dav/lib/Migration/Version1029Date20221114151721.php
+++ b/apps/dav/lib/Migration/Version1029Date20221114151721.php
@@ -3,25 +3,8 @@
declare(strict_types=1);
/**
- * @copyright Copyright (c) 2022 Murena SAS <akhil.potukuchi.ext@murena.com>
- *
- * @author Murena SAS <akhil.potukuchi.ext@murena.com>
- *
- * @license GNU AGPL version 3 or any later version
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
+ * SPDX-FileCopyrightText: 2022 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
*/
namespace OCA\DAV\Migration;
@@ -45,7 +28,7 @@ class Version1029Date20221114151721 extends SimpleMigrationStep {
/** @var ISchemaWrapper $schema */
$schema = $schemaClosure();
$calendarObjectsTable = $schema->getTable('calendarobjects');
- if(!$calendarObjectsTable->hasIndex('calobj_clssfction_index')) {
+ if (!$calendarObjectsTable->hasIndex('calobj_clssfction_index')) {
$calendarObjectsTable->addIndex(['classification'], 'calobj_clssfction_index');
return $schema;
}
diff --git a/apps/dav/lib/Migration/Version1029Date20231004091403.php b/apps/dav/lib/Migration/Version1029Date20231004091403.php
index 6eb7be8a5cd..1dcbf9c5dfc 100644
--- a/apps/dav/lib/Migration/Version1029Date20231004091403.php
+++ b/apps/dav/lib/Migration/Version1029Date20231004091403.php
@@ -3,25 +3,8 @@
declare(strict_types=1);
/**
- * @copyright Copyright (c) 2023 Richard Steinmetz <richard@steinmetz.cloud>
- *
- * @author Richard Steinmetz <richard@steinmetz.cloud>
- *
- * @license AGPL-3.0-or-later
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
+ * SPDX-FileCopyrightText: 2023 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
*/
namespace OCA\DAV\Migration;
diff --git a/apps/dav/lib/Migration/Version1030Date20240205103243.php b/apps/dav/lib/Migration/Version1030Date20240205103243.php
index eb471ccb0a6..72cbcafc444 100644
--- a/apps/dav/lib/Migration/Version1030Date20240205103243.php
+++ b/apps/dav/lib/Migration/Version1030Date20240205103243.php
@@ -3,25 +3,8 @@
declare(strict_types=1);
/**
- * @copyright Copyright (c) 2024 Johannes Merkel <mail@johannesgge.de>
- *
- * @author Johannes Merkel <mail@johannesgge.de>
- *
- * @license AGPL-3.0-or-later
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
+ * SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
*/
namespace OCA\DAV\Migration;
diff --git a/apps/dav/lib/Migration/Version1031Date20240610134258.php b/apps/dav/lib/Migration/Version1031Date20240610134258.php
new file mode 100644
index 00000000000..c1242ceb7db
--- /dev/null
+++ b/apps/dav/lib/Migration/Version1031Date20240610134258.php
@@ -0,0 +1,48 @@
+<?php
+
+declare(strict_types=1);
+
+/**
+ * SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
+ */
+
+namespace OCA\DAV\Migration;
+
+use Closure;
+use OCP\DB\ISchemaWrapper;
+use OCP\DB\Types;
+use OCP\Migration\Attributes\AddColumn;
+use OCP\Migration\Attributes\ColumnType;
+use OCP\Migration\IOutput;
+use OCP\Migration\SimpleMigrationStep;
+
+#[AddColumn(table: 'dav_absence', name: 'replacement_user_id', type: ColumnType::STRING)]
+#[AddColumn(table: 'dav_absence', name: 'replacement_user_display_name', type: ColumnType::STRING)]
+class Version1031Date20240610134258 extends SimpleMigrationStep {
+ public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper {
+ /** @var ISchemaWrapper $schema */
+ $schema = $schemaClosure();
+
+ $tableDavAbsence = $schema->getTable('dav_absence');
+
+ if (!$tableDavAbsence->hasColumn('replacement_user_id')) {
+ $tableDavAbsence->addColumn('replacement_user_id', Types::STRING, [
+ 'notnull' => false,
+ 'default' => '',
+ 'length' => 64,
+ ]);
+ }
+
+ if (!$tableDavAbsence->hasColumn('replacement_user_display_name')) {
+ $tableDavAbsence->addColumn('replacement_user_display_name', Types::STRING, [
+ 'notnull' => false,
+ 'default' => '',
+ 'length' => 64,
+ ]);
+ }
+
+ return $schema;
+ }
+
+}
diff --git a/apps/dav/lib/Migration/Version1034Date20250813093701.php b/apps/dav/lib/Migration/Version1034Date20250813093701.php
new file mode 100644
index 00000000000..10be71f067b
--- /dev/null
+++ b/apps/dav/lib/Migration/Version1034Date20250813093701.php
@@ -0,0 +1,53 @@
+<?php
+
+declare(strict_types=1);
+
+/**
+ * SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
+ */
+
+namespace OCA\DAV\Migration;
+
+use Closure;
+use OCP\DB\ISchemaWrapper;
+use OCP\DB\QueryBuilder\IQueryBuilder;
+use OCP\IDBConnection;
+use OCP\Migration\IOutput;
+use OCP\Migration\SimpleMigrationStep;
+use Override;
+
+class Version1034Date20250813093701 extends SimpleMigrationStep {
+ public function __construct(
+ private IDBConnection $db,
+ ) {
+ }
+
+ /**
+ * @param IOutput $output
+ * @param Closure(): ISchemaWrapper $schemaClosure
+ * @param array $options
+ */
+ #[Override]
+ public function postSchemaChange(IOutput $output, Closure $schemaClosure, array $options): void {
+ $qb = $this->db->getQueryBuilder();
+ $qb->delete('properties')
+ ->where($qb->expr()->eq(
+ 'propertyname',
+ $qb->createNamedParameter(
+ '{http://owncloud.org/ns}calendar-enabled',
+ IQueryBuilder::PARAM_STR,
+ ),
+ IQueryBuilder::PARAM_STR,
+ ))
+ ->andWhere($qb->expr()->eq(
+ 'propertyvalue',
+ $qb->createNamedParameter(
+ '1',
+ IQueryBuilder::PARAM_STR,
+ ),
+ IQueryBuilder::PARAM_STR,
+ ))
+ ->executeStatement();
+ }
+}