summaryrefslogtreecommitdiffstats
path: root/apps/dav/lib/BackgroundJob
diff options
context:
space:
mode:
authorChristoph Wurst <christoph@winzerhof-wurst.at>2021-03-12 11:20:04 +0100
committerChristoph Wurst <christoph@winzerhof-wurst.at>2021-05-31 07:49:19 +0200
commitd6d8e9215c69a9e8d4bfa2035c657b0a037f3a2f (patch)
tree942254503672d6ab3e0b6c8fca0bd4053db352b9 /apps/dav/lib/BackgroundJob
parent9e596dd0cf455dc1639141c695f89c7d936f4c0c (diff)
downloadnextcloud-server-d6d8e9215c69a9e8d4bfa2035c657b0a037f3a2f.tar.gz
nextcloud-server-d6d8e9215c69a9e8d4bfa2035c657b0a037f3a2f.zip
Add a trashbin for calendars and calendar objects
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Diffstat (limited to 'apps/dav/lib/BackgroundJob')
-rw-r--r--apps/dav/lib/BackgroundJob/CalendarRetentionJob.php48
-rw-r--r--apps/dav/lib/BackgroundJob/UpdateCalendarResourcesRoomsBackgroundJob.php5
2 files changed, 52 insertions, 1 deletions
diff --git a/apps/dav/lib/BackgroundJob/CalendarRetentionJob.php b/apps/dav/lib/BackgroundJob/CalendarRetentionJob.php
new file mode 100644
index 00000000000..51215051659
--- /dev/null
+++ b/apps/dav/lib/BackgroundJob/CalendarRetentionJob.php
@@ -0,0 +1,48 @@
+<?php
+
+declare(strict_types=1);
+
+/*
+ * @copyright 2021 Christoph Wurst <christoph@winzerhof-wurst.at>
+ *
+ * @author 2021 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/>.
+ */
+
+namespace OCA\DAV\BackgroundJob;
+
+use OCA\DAV\CalDAV\RetentionService;
+use OCP\AppFramework\Utility\ITimeFactory;
+use OCP\BackgroundJob\TimedJob;
+
+class CalendarRetentionJob extends TimedJob {
+ /** @var RetentionService */
+ private $service;
+
+ public function __construct(ITimeFactory $time,
+ RetentionService $service) {
+ parent::__construct($time);
+ $this->service = $service;
+
+ // Run four times a day
+ $this->setInterval(6 * 60 * 60);
+ }
+
+ protected function run($argument): void {
+ $this->service->cleanUp();
+ }
+}
diff --git a/apps/dav/lib/BackgroundJob/UpdateCalendarResourcesRoomsBackgroundJob.php b/apps/dav/lib/BackgroundJob/UpdateCalendarResourcesRoomsBackgroundJob.php
index 4ed4319d701..86d2d3ae35d 100644
--- a/apps/dav/lib/BackgroundJob/UpdateCalendarResourcesRoomsBackgroundJob.php
+++ b/apps/dav/lib/BackgroundJob/UpdateCalendarResourcesRoomsBackgroundJob.php
@@ -415,7 +415,10 @@ class UpdateCalendarResourcesRoomsBackgroundJob extends TimedJob {
CalDavBackend::RESOURCE_BOOKING_CALENDAR_URI);
if ($calendar !== null) {
- $this->calDavBackend->deleteCalendar($calendar['id']);
+ $this->calDavBackend->deleteCalendar(
+ $calendar['id'],
+ true // Because this wasn't deleted by a user
+ );
}
}