aboutsummaryrefslogtreecommitdiffstats
path: root/apps/dav/lib/Command
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/Command
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/Command')
-rw-r--r--apps/dav/lib/Command/CreateCalendar.php14
-rw-r--r--apps/dav/lib/Command/RetentionCleanupCommand.php48
2 files changed, 61 insertions, 1 deletions
diff --git a/apps/dav/lib/Command/CreateCalendar.php b/apps/dav/lib/Command/CreateCalendar.php
index 1d543c71bc2..5d0eede54b6 100644
--- a/apps/dav/lib/Command/CreateCalendar.php
+++ b/apps/dav/lib/Command/CreateCalendar.php
@@ -32,6 +32,7 @@ use OCA\DAV\CalDAV\CalDavBackend;
use OCA\DAV\CalDAV\Proxy\ProxyMapper;
use OCA\DAV\Connector\Sabre\Principal;
use OCP\EventDispatcher\IEventDispatcher;
+use OCP\IConfig;
use OCP\IDBConnection;
use OCP\IGroupManager;
use OCP\IUserManager;
@@ -94,9 +95,20 @@ class CreateCalendar extends Command {
$logger = \OC::$server->getLogger();
$dispatcher = \OC::$server->get(IEventDispatcher::class);
$legacyDispatcher = \OC::$server->getEventDispatcher();
+ $config = \OC::$server->get(IConfig::class);
$name = $input->getArgument('name');
- $caldav = new CalDavBackend($this->dbConnection, $principalBackend, $this->userManager, $this->groupManager, $random, $logger, $dispatcher, $legacyDispatcher);
+ $caldav = new CalDavBackend(
+ $this->dbConnection,
+ $principalBackend,
+ $this->userManager,
+ $this->groupManager,
+ $random,
+ $logger,
+ $dispatcher,
+ $legacyDispatcher,
+ $config
+ );
$caldav->createCalendar("principals/users/$user", $name, []);
return 0;
}
diff --git a/apps/dav/lib/Command/RetentionCleanupCommand.php b/apps/dav/lib/Command/RetentionCleanupCommand.php
new file mode 100644
index 00000000000..a1f1d201d83
--- /dev/null
+++ b/apps/dav/lib/Command/RetentionCleanupCommand.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\Command;
+
+use OCA\DAV\CalDAV\RetentionService;
+use Symfony\Component\Console\Command\Command;
+use Symfony\Component\Console\Input\InputInterface;
+use Symfony\Component\Console\Output\OutputInterface;
+
+class RetentionCleanupCommand extends Command {
+ /** @var RetentionService */
+ private $service;
+
+ public function __construct(RetentionService $service) {
+ parent::__construct('dav:retention:clean-up');
+
+ $this->service = $service;
+ }
+
+ protected function execute(InputInterface $input, OutputInterface $output): int {
+ $this->service->cleanUp();
+
+ return 0;
+ }
+}