summaryrefslogtreecommitdiffstats
path: root/apps/dav/lib
diff options
context:
space:
mode:
authorRoeland Jago Douma <roeland@famdouma.nl>2018-05-24 09:27:40 +0200
committerRoeland Jago Douma <roeland@famdouma.nl>2018-05-28 13:26:55 +0200
commit26c1e33d115cad3029c0663b7a388be0aff6417b (patch)
treef5f8ae4f82e738783f5b4689b957fb5a3df3e259 /apps/dav/lib
parentf9a64d3e1bf35c704fcf2ec9151b947213917a90 (diff)
downloadnextcloud-server-26c1e33d115cad3029c0663b7a388be0aff6417b.tar.gz
nextcloud-server-26c1e33d115cad3029c0663b7a388be0aff6417b.zip
Move repairstep to a custom command
People that have issues can run it manually Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
Diffstat (limited to 'apps/dav/lib')
-rw-r--r--apps/dav/lib/Command/RemoveInvalidShares.php (renamed from apps/dav/lib/Repair/RemoveInvalidShares.php)44
1 files changed, 13 insertions, 31 deletions
diff --git a/apps/dav/lib/Repair/RemoveInvalidShares.php b/apps/dav/lib/Command/RemoveInvalidShares.php
index b69f918a576..12a5ee43d47 100644
--- a/apps/dav/lib/Repair/RemoveInvalidShares.php
+++ b/apps/dav/lib/Command/RemoveInvalidShares.php
@@ -1,4 +1,5 @@
<?php
+declare(strict_types=1);
/**
* @author Thomas Müller <thomas.mueller@tmit.eu>
*
@@ -19,58 +20,40 @@
*
*/
-namespace OCA\DAV\Repair;
+namespace OCA\DAV\Command;
use OCA\DAV\Connector\Sabre\Principal;
use OCP\IDBConnection;
-use OCP\ILogger;
-use OCP\Migration\IOutput;
-use OCP\Migration\IRepairStep;
+use Symfony\Component\Console\Command\Command;
+use Symfony\Component\Console\Input\InputInterface;
+use Symfony\Component\Console\Output\OutputInterface;
/**
* Class RemoveInvalidShares - removes shared calendars and addressbook which
* have no matching principal. Happened because of a bug in the calendar app.
- *
- * @package OCA\DAV\Repair
*/
-class RemoveInvalidShares implements IRepairStep {
+class RemoveInvalidShares extends Command {
/** @var IDBConnection */
private $connection;
/** @var Principal */
private $principalBackend;
- /**
- * RemoveInvalidShares constructor.
- *
- * @param IDBConnection $connection
- * @param Principal $principalBackend
- */
public function __construct(IDBConnection $connection,
Principal $principalBackend) {
+ parent::__construct();
+
$this->connection = $connection;
$this->principalBackend = $principalBackend;
}
- /**
- * Returns the step's name
- *
- * @return string
- * @since 9.1.0
- */
- public function getName() {
- return 'Remove invalid calendar and addressbook shares';
+ protected function configure() {
+ $this
+ ->setName('dav:remove-invalid-shares')
+ ->setDescription('Remove invalid dav shares');
}
- /**
- * Run repair step.
- * Must throw exception on error.
- *
- * @param IOutput $output
- * @throws \Exception in case of failure
- * @since 9.1.0
- */
- public function run(IOutput $output) {
+ protected function execute(InputInterface $input, OutputInterface $output) {
$query = $this->connection->getQueryBuilder();
$result = $query->selectDistinct('principaluri')
->from('dav_shares')
@@ -80,7 +63,6 @@ class RemoveInvalidShares implements IRepairStep {
$principaluri = $row['principaluri'];
$p = $this->principalBackend->getPrincipalByPath($principaluri);
if ($p === null) {
- $output->info(" ... for principal '$principaluri'");
$this->deleteSharesForPrincipal($principaluri);
}
}