@@ -36,60 +36,60 @@ |
||
36 | 36 | */ |
37 | 37 | class SetPasswordColumn implements IRepairStep { |
38 | 38 | |
39 | - /** @var IDBConnection */ |
|
40 | - private $connection; |
|
39 | + /** @var IDBConnection */ |
|
40 | + private $connection; |
|
41 | 41 | |
42 | - /** @var IConfig */ |
|
43 | - private $config; |
|
42 | + /** @var IConfig */ |
|
43 | + private $config; |
|
44 | 44 | |
45 | 45 | |
46 | - public function __construct(IDBConnection $connection, IConfig $config) { |
|
47 | - $this->connection = $connection; |
|
48 | - $this->config = $config; |
|
49 | - } |
|
46 | + public function __construct(IDBConnection $connection, IConfig $config) { |
|
47 | + $this->connection = $connection; |
|
48 | + $this->config = $config; |
|
49 | + } |
|
50 | 50 | |
51 | - /** |
|
52 | - * Returns the step's name |
|
53 | - * |
|
54 | - * @return string |
|
55 | - * @since 9.1.0 |
|
56 | - */ |
|
57 | - public function getName() { |
|
58 | - return 'Copy the share password into the dedicated column'; |
|
59 | - } |
|
51 | + /** |
|
52 | + * Returns the step's name |
|
53 | + * |
|
54 | + * @return string |
|
55 | + * @since 9.1.0 |
|
56 | + */ |
|
57 | + public function getName() { |
|
58 | + return 'Copy the share password into the dedicated column'; |
|
59 | + } |
|
60 | 60 | |
61 | - /** |
|
62 | - * @param IOutput $output |
|
63 | - */ |
|
64 | - public function run(IOutput $output) { |
|
65 | - if (!$this->shouldRun()) { |
|
66 | - return; |
|
67 | - } |
|
61 | + /** |
|
62 | + * @param IOutput $output |
|
63 | + */ |
|
64 | + public function run(IOutput $output) { |
|
65 | + if (!$this->shouldRun()) { |
|
66 | + return; |
|
67 | + } |
|
68 | 68 | |
69 | - $query = $this->connection->getQueryBuilder(); |
|
70 | - $query |
|
71 | - ->update('share') |
|
72 | - ->set('password', 'share_with') |
|
73 | - ->where($query->expr()->eq('share_type', $query->createNamedParameter(IShare::TYPE_LINK))) |
|
74 | - ->andWhere($query->expr()->isNotNull('share_with')); |
|
75 | - $result = $query->execute(); |
|
69 | + $query = $this->connection->getQueryBuilder(); |
|
70 | + $query |
|
71 | + ->update('share') |
|
72 | + ->set('password', 'share_with') |
|
73 | + ->where($query->expr()->eq('share_type', $query->createNamedParameter(IShare::TYPE_LINK))) |
|
74 | + ->andWhere($query->expr()->isNotNull('share_with')); |
|
75 | + $result = $query->execute(); |
|
76 | 76 | |
77 | - if ($result === 0) { |
|
78 | - // No link updated, no need to run the second query |
|
79 | - return; |
|
80 | - } |
|
77 | + if ($result === 0) { |
|
78 | + // No link updated, no need to run the second query |
|
79 | + return; |
|
80 | + } |
|
81 | 81 | |
82 | - $clearQuery = $this->connection->getQueryBuilder(); |
|
83 | - $clearQuery |
|
84 | - ->update('share') |
|
85 | - ->set('share_with', $clearQuery->createNamedParameter(null)) |
|
86 | - ->where($clearQuery->expr()->eq('share_type', $clearQuery->createNamedParameter(IShare::TYPE_LINK))); |
|
82 | + $clearQuery = $this->connection->getQueryBuilder(); |
|
83 | + $clearQuery |
|
84 | + ->update('share') |
|
85 | + ->set('share_with', $clearQuery->createNamedParameter(null)) |
|
86 | + ->where($clearQuery->expr()->eq('share_type', $clearQuery->createNamedParameter(IShare::TYPE_LINK))); |
|
87 | 87 | |
88 | - $clearQuery->execute(); |
|
89 | - } |
|
88 | + $clearQuery->execute(); |
|
89 | + } |
|
90 | 90 | |
91 | - protected function shouldRun() { |
|
92 | - $appVersion = $this->config->getAppValue('files_sharing', 'installed_version', '0.0.0'); |
|
93 | - return version_compare($appVersion, '1.4.0', '<'); |
|
94 | - } |
|
91 | + protected function shouldRun() { |
|
92 | + $appVersion = $this->config->getAppValue('files_sharing', 'installed_version', '0.0.0'); |
|
93 | + return version_compare($appVersion, '1.4.0', '<'); |
|
94 | + } |
|
95 | 95 | } |
@@ -37,46 +37,46 @@ |
||
37 | 37 | */ |
38 | 38 | class OwncloudGuestShareType implements IRepairStep { |
39 | 39 | |
40 | - /** @var IDBConnection */ |
|
41 | - private $connection; |
|
40 | + /** @var IDBConnection */ |
|
41 | + private $connection; |
|
42 | 42 | |
43 | - /** @var IConfig */ |
|
44 | - private $config; |
|
43 | + /** @var IConfig */ |
|
44 | + private $config; |
|
45 | 45 | |
46 | 46 | |
47 | - public function __construct(IDBConnection $connection, IConfig $config) { |
|
48 | - $this->connection = $connection; |
|
49 | - $this->config = $config; |
|
50 | - } |
|
47 | + public function __construct(IDBConnection $connection, IConfig $config) { |
|
48 | + $this->connection = $connection; |
|
49 | + $this->config = $config; |
|
50 | + } |
|
51 | 51 | |
52 | - /** |
|
53 | - * Returns the step's name |
|
54 | - * |
|
55 | - * @return string |
|
56 | - * @since 9.1.0 |
|
57 | - */ |
|
58 | - public function getName() { |
|
59 | - return 'Fix the share type of guest shares when migrating from ownCloud'; |
|
60 | - } |
|
52 | + /** |
|
53 | + * Returns the step's name |
|
54 | + * |
|
55 | + * @return string |
|
56 | + * @since 9.1.0 |
|
57 | + */ |
|
58 | + public function getName() { |
|
59 | + return 'Fix the share type of guest shares when migrating from ownCloud'; |
|
60 | + } |
|
61 | 61 | |
62 | - /** |
|
63 | - * @param IOutput $output |
|
64 | - */ |
|
65 | - public function run(IOutput $output) { |
|
66 | - if (!$this->shouldRun()) { |
|
67 | - return; |
|
68 | - } |
|
62 | + /** |
|
63 | + * @param IOutput $output |
|
64 | + */ |
|
65 | + public function run(IOutput $output) { |
|
66 | + if (!$this->shouldRun()) { |
|
67 | + return; |
|
68 | + } |
|
69 | 69 | |
70 | - $query = $this->connection->getQueryBuilder(); |
|
71 | - $query->update('share') |
|
72 | - ->set('share_type', $query->createNamedParameter(IShare::TYPE_GUEST)) |
|
73 | - ->where($query->expr()->eq('share_type', $query->createNamedParameter(IShare::TYPE_EMAIL))); |
|
74 | - $query->execute(); |
|
75 | - } |
|
70 | + $query = $this->connection->getQueryBuilder(); |
|
71 | + $query->update('share') |
|
72 | + ->set('share_type', $query->createNamedParameter(IShare::TYPE_GUEST)) |
|
73 | + ->where($query->expr()->eq('share_type', $query->createNamedParameter(IShare::TYPE_EMAIL))); |
|
74 | + $query->execute(); |
|
75 | + } |
|
76 | 76 | |
77 | - protected function shouldRun() { |
|
78 | - $appVersion = $this->config->getAppValue('files_sharing', 'installed_version', '0.0.0'); |
|
79 | - return $appVersion === '0.10.0' || |
|
80 | - $this->config->getAppValue('core', 'vendor', '') === 'owncloud'; |
|
81 | - } |
|
77 | + protected function shouldRun() { |
|
78 | + $appVersion = $this->config->getAppValue('files_sharing', 'installed_version', '0.0.0'); |
|
79 | + return $appVersion === '0.10.0' || |
|
80 | + $this->config->getAppValue('core', 'vendor', '') === 'owncloud'; |
|
81 | + } |
|
82 | 82 | } |
@@ -30,19 +30,19 @@ |
||
30 | 30 | use Symfony\Component\Console\Output\OutputInterface; |
31 | 31 | |
32 | 32 | class UpdateHtaccess extends Command { |
33 | - protected function configure() { |
|
34 | - $this |
|
35 | - ->setName('maintenance:update:htaccess') |
|
36 | - ->setDescription('Updates the .htaccess file'); |
|
37 | - } |
|
33 | + protected function configure() { |
|
34 | + $this |
|
35 | + ->setName('maintenance:update:htaccess') |
|
36 | + ->setDescription('Updates the .htaccess file'); |
|
37 | + } |
|
38 | 38 | |
39 | - protected function execute(InputInterface $input, OutputInterface $output): int { |
|
40 | - if (\OC\Setup::updateHtaccess()) { |
|
41 | - $output->writeln('.htaccess has been updated'); |
|
42 | - return 0; |
|
43 | - } else { |
|
44 | - $output->writeln('<error>Error updating .htaccess file, not enough permissions or "overwrite.cli.url" set to an invalid URL?</error>'); |
|
45 | - return 1; |
|
46 | - } |
|
47 | - } |
|
39 | + protected function execute(InputInterface $input, OutputInterface $output): int { |
|
40 | + if (\OC\Setup::updateHtaccess()) { |
|
41 | + $output->writeln('.htaccess has been updated'); |
|
42 | + return 0; |
|
43 | + } else { |
|
44 | + $output->writeln('<error>Error updating .htaccess file, not enough permissions or "overwrite.cli.url" set to an invalid URL?</error>'); |
|
45 | + return 1; |
|
46 | + } |
|
47 | + } |
|
48 | 48 | } |
@@ -33,52 +33,52 @@ |
||
33 | 33 | |
34 | 34 | class EnableMasterKey extends Command { |
35 | 35 | |
36 | - /** @var Util */ |
|
37 | - protected $util; |
|
36 | + /** @var Util */ |
|
37 | + protected $util; |
|
38 | 38 | |
39 | - /** @var IConfig */ |
|
40 | - protected $config; |
|
39 | + /** @var IConfig */ |
|
40 | + protected $config; |
|
41 | 41 | |
42 | - /** @var QuestionHelper */ |
|
43 | - protected $questionHelper; |
|
42 | + /** @var QuestionHelper */ |
|
43 | + protected $questionHelper; |
|
44 | 44 | |
45 | - /** |
|
46 | - * @param Util $util |
|
47 | - * @param IConfig $config |
|
48 | - * @param QuestionHelper $questionHelper |
|
49 | - */ |
|
50 | - public function __construct(Util $util, |
|
51 | - IConfig $config, |
|
52 | - QuestionHelper $questionHelper) { |
|
53 | - $this->util = $util; |
|
54 | - $this->config = $config; |
|
55 | - $this->questionHelper = $questionHelper; |
|
56 | - parent::__construct(); |
|
57 | - } |
|
45 | + /** |
|
46 | + * @param Util $util |
|
47 | + * @param IConfig $config |
|
48 | + * @param QuestionHelper $questionHelper |
|
49 | + */ |
|
50 | + public function __construct(Util $util, |
|
51 | + IConfig $config, |
|
52 | + QuestionHelper $questionHelper) { |
|
53 | + $this->util = $util; |
|
54 | + $this->config = $config; |
|
55 | + $this->questionHelper = $questionHelper; |
|
56 | + parent::__construct(); |
|
57 | + } |
|
58 | 58 | |
59 | - protected function configure() { |
|
60 | - $this |
|
61 | - ->setName('encryption:enable-master-key') |
|
62 | - ->setDescription('Enable the master key. Only available for fresh installations with no existing encrypted data! There is also no way to disable it again.'); |
|
63 | - } |
|
59 | + protected function configure() { |
|
60 | + $this |
|
61 | + ->setName('encryption:enable-master-key') |
|
62 | + ->setDescription('Enable the master key. Only available for fresh installations with no existing encrypted data! There is also no way to disable it again.'); |
|
63 | + } |
|
64 | 64 | |
65 | - protected function execute(InputInterface $input, OutputInterface $output): int { |
|
66 | - $isAlreadyEnabled = $this->util->isMasterKeyEnabled(); |
|
65 | + protected function execute(InputInterface $input, OutputInterface $output): int { |
|
66 | + $isAlreadyEnabled = $this->util->isMasterKeyEnabled(); |
|
67 | 67 | |
68 | - if ($isAlreadyEnabled) { |
|
69 | - $output->writeln('Master key already enabled'); |
|
70 | - } else { |
|
71 | - $question = new ConfirmationQuestion( |
|
72 | - 'Warning: Only available for fresh installations with no existing encrypted data! ' |
|
73 | - . 'There is also no way to disable it again. Do you want to continue? (y/n) ', false); |
|
74 | - if ($this->questionHelper->ask($input, $output, $question)) { |
|
75 | - $this->config->setAppValue('encryption', 'useMasterKey', '1'); |
|
76 | - $output->writeln('Master key successfully enabled.'); |
|
77 | - } else { |
|
78 | - $output->writeln('aborted.'); |
|
79 | - return 1; |
|
80 | - } |
|
81 | - } |
|
82 | - return 0; |
|
83 | - } |
|
68 | + if ($isAlreadyEnabled) { |
|
69 | + $output->writeln('Master key already enabled'); |
|
70 | + } else { |
|
71 | + $question = new ConfirmationQuestion( |
|
72 | + 'Warning: Only available for fresh installations with no existing encrypted data! ' |
|
73 | + . 'There is also no way to disable it again. Do you want to continue? (y/n) ', false); |
|
74 | + if ($this->questionHelper->ask($input, $output, $question)) { |
|
75 | + $this->config->setAppValue('encryption', 'useMasterKey', '1'); |
|
76 | + $output->writeln('Master key successfully enabled.'); |
|
77 | + } else { |
|
78 | + $output->writeln('aborted.'); |
|
79 | + return 1; |
|
80 | + } |
|
81 | + } |
|
82 | + return 0; |
|
83 | + } |
|
84 | 84 | } |
@@ -34,55 +34,55 @@ |
||
34 | 34 | |
35 | 35 | class DisableMasterKey extends Command { |
36 | 36 | |
37 | - /** @var Util */ |
|
38 | - protected $util; |
|
37 | + /** @var Util */ |
|
38 | + protected $util; |
|
39 | 39 | |
40 | - /** @var IConfig */ |
|
41 | - protected $config; |
|
40 | + /** @var IConfig */ |
|
41 | + protected $config; |
|
42 | 42 | |
43 | - /** @var QuestionHelper */ |
|
44 | - protected $questionHelper; |
|
43 | + /** @var QuestionHelper */ |
|
44 | + protected $questionHelper; |
|
45 | 45 | |
46 | - /** |
|
47 | - * @param Util $util |
|
48 | - * @param IConfig $config |
|
49 | - * @param QuestionHelper $questionHelper |
|
50 | - */ |
|
51 | - public function __construct(Util $util, |
|
52 | - IConfig $config, |
|
53 | - QuestionHelper $questionHelper) { |
|
54 | - $this->util = $util; |
|
55 | - $this->config = $config; |
|
56 | - $this->questionHelper = $questionHelper; |
|
57 | - parent::__construct(); |
|
58 | - } |
|
46 | + /** |
|
47 | + * @param Util $util |
|
48 | + * @param IConfig $config |
|
49 | + * @param QuestionHelper $questionHelper |
|
50 | + */ |
|
51 | + public function __construct(Util $util, |
|
52 | + IConfig $config, |
|
53 | + QuestionHelper $questionHelper) { |
|
54 | + $this->util = $util; |
|
55 | + $this->config = $config; |
|
56 | + $this->questionHelper = $questionHelper; |
|
57 | + parent::__construct(); |
|
58 | + } |
|
59 | 59 | |
60 | - protected function configure() { |
|
61 | - $this |
|
62 | - ->setName('encryption:disable-master-key') |
|
63 | - ->setDescription('Disable the master key and use per-user keys instead. Only available for fresh installations with no existing encrypted data! There is no way to enable it again.'); |
|
64 | - } |
|
60 | + protected function configure() { |
|
61 | + $this |
|
62 | + ->setName('encryption:disable-master-key') |
|
63 | + ->setDescription('Disable the master key and use per-user keys instead. Only available for fresh installations with no existing encrypted data! There is no way to enable it again.'); |
|
64 | + } |
|
65 | 65 | |
66 | - protected function execute(InputInterface $input, OutputInterface $output): int { |
|
67 | - $isMasterKeyEnabled = $this->util->isMasterKeyEnabled(); |
|
66 | + protected function execute(InputInterface $input, OutputInterface $output): int { |
|
67 | + $isMasterKeyEnabled = $this->util->isMasterKeyEnabled(); |
|
68 | 68 | |
69 | - if (!$isMasterKeyEnabled) { |
|
70 | - $output->writeln('Master key already disabled'); |
|
71 | - } else { |
|
72 | - $question = new ConfirmationQuestion( |
|
73 | - 'Warning: Only perform this operation for a fresh installations with no existing encrypted data! ' |
|
74 | - . 'There is no way to enable the master key again. ' |
|
75 | - . 'We strongly recommend to keep the master key, it provides significant performance improvements ' |
|
76 | - . 'and is easier to handle for both, users and administrators. ' |
|
77 | - . 'Do you really want to switch to per-user keys? (y/n) ', false); |
|
78 | - if ($this->questionHelper->ask($input, $output, $question)) { |
|
79 | - $this->config->setAppValue('encryption', 'useMasterKey', '0'); |
|
80 | - $output->writeln('Master key successfully disabled.'); |
|
81 | - } else { |
|
82 | - $output->writeln('aborted.'); |
|
83 | - return 1; |
|
84 | - } |
|
85 | - } |
|
86 | - return 0; |
|
87 | - } |
|
69 | + if (!$isMasterKeyEnabled) { |
|
70 | + $output->writeln('Master key already disabled'); |
|
71 | + } else { |
|
72 | + $question = new ConfirmationQuestion( |
|
73 | + 'Warning: Only perform this operation for a fresh installations with no existing encrypted data! ' |
|
74 | + . 'There is no way to enable the master key again. ' |
|
75 | + . 'We strongly recommend to keep the master key, it provides significant performance improvements ' |
|
76 | + . 'and is easier to handle for both, users and administrators. ' |
|
77 | + . 'Do you really want to switch to per-user keys? (y/n) ', false); |
|
78 | + if ($this->questionHelper->ask($input, $output, $question)) { |
|
79 | + $this->config->setAppValue('encryption', 'useMasterKey', '0'); |
|
80 | + $output->writeln('Master key successfully disabled.'); |
|
81 | + } else { |
|
82 | + $output->writeln('aborted.'); |
|
83 | + return 1; |
|
84 | + } |
|
85 | + } |
|
86 | + return 0; |
|
87 | + } |
|
88 | 88 | } |
@@ -32,37 +32,37 @@ |
||
32 | 32 | |
33 | 33 | class SyncSystemAddressBook extends Command { |
34 | 34 | |
35 | - /** @var SyncService */ |
|
36 | - private $syncService; |
|
35 | + /** @var SyncService */ |
|
36 | + private $syncService; |
|
37 | 37 | |
38 | - /** |
|
39 | - * @param SyncService $syncService |
|
40 | - */ |
|
41 | - public function __construct(SyncService $syncService) { |
|
42 | - parent::__construct(); |
|
43 | - $this->syncService = $syncService; |
|
44 | - } |
|
38 | + /** |
|
39 | + * @param SyncService $syncService |
|
40 | + */ |
|
41 | + public function __construct(SyncService $syncService) { |
|
42 | + parent::__construct(); |
|
43 | + $this->syncService = $syncService; |
|
44 | + } |
|
45 | 45 | |
46 | - protected function configure() { |
|
47 | - $this |
|
48 | - ->setName('dav:sync-system-addressbook') |
|
49 | - ->setDescription('Synchronizes users to the system addressbook'); |
|
50 | - } |
|
46 | + protected function configure() { |
|
47 | + $this |
|
48 | + ->setName('dav:sync-system-addressbook') |
|
49 | + ->setDescription('Synchronizes users to the system addressbook'); |
|
50 | + } |
|
51 | 51 | |
52 | - /** |
|
53 | - * @param InputInterface $input |
|
54 | - * @param OutputInterface $output |
|
55 | - */ |
|
56 | - protected function execute(InputInterface $input, OutputInterface $output): int { |
|
57 | - $output->writeln('Syncing users ...'); |
|
58 | - $progress = new ProgressBar($output); |
|
59 | - $progress->start(); |
|
60 | - $this->syncService->syncInstance(function () use ($progress) { |
|
61 | - $progress->advance(); |
|
62 | - }); |
|
52 | + /** |
|
53 | + * @param InputInterface $input |
|
54 | + * @param OutputInterface $output |
|
55 | + */ |
|
56 | + protected function execute(InputInterface $input, OutputInterface $output): int { |
|
57 | + $output->writeln('Syncing users ...'); |
|
58 | + $progress = new ProgressBar($output); |
|
59 | + $progress->start(); |
|
60 | + $this->syncService->syncInstance(function () use ($progress) { |
|
61 | + $progress->advance(); |
|
62 | + }); |
|
63 | 63 | |
64 | - $progress->finish(); |
|
65 | - $output->writeln(''); |
|
66 | - return 0; |
|
67 | - } |
|
64 | + $progress->finish(); |
|
65 | + $output->writeln(''); |
|
66 | + return 0; |
|
67 | + } |
|
68 | 68 | } |
@@ -38,50 +38,50 @@ |
||
38 | 38 | */ |
39 | 39 | class RemoveInvalidShares extends Command { |
40 | 40 | |
41 | - /** @var IDBConnection */ |
|
42 | - private $connection; |
|
43 | - /** @var Principal */ |
|
44 | - private $principalBackend; |
|
41 | + /** @var IDBConnection */ |
|
42 | + private $connection; |
|
43 | + /** @var Principal */ |
|
44 | + private $principalBackend; |
|
45 | 45 | |
46 | - public function __construct(IDBConnection $connection, |
|
47 | - Principal $principalBackend) { |
|
48 | - parent::__construct(); |
|
46 | + public function __construct(IDBConnection $connection, |
|
47 | + Principal $principalBackend) { |
|
48 | + parent::__construct(); |
|
49 | 49 | |
50 | - $this->connection = $connection; |
|
51 | - $this->principalBackend = $principalBackend; |
|
52 | - } |
|
50 | + $this->connection = $connection; |
|
51 | + $this->principalBackend = $principalBackend; |
|
52 | + } |
|
53 | 53 | |
54 | - protected function configure() { |
|
55 | - $this |
|
56 | - ->setName('dav:remove-invalid-shares') |
|
57 | - ->setDescription('Remove invalid dav shares'); |
|
58 | - } |
|
54 | + protected function configure() { |
|
55 | + $this |
|
56 | + ->setName('dav:remove-invalid-shares') |
|
57 | + ->setDescription('Remove invalid dav shares'); |
|
58 | + } |
|
59 | 59 | |
60 | - protected function execute(InputInterface $input, OutputInterface $output): int { |
|
61 | - $query = $this->connection->getQueryBuilder(); |
|
62 | - $result = $query->selectDistinct('principaluri') |
|
63 | - ->from('dav_shares') |
|
64 | - ->execute(); |
|
60 | + protected function execute(InputInterface $input, OutputInterface $output): int { |
|
61 | + $query = $this->connection->getQueryBuilder(); |
|
62 | + $result = $query->selectDistinct('principaluri') |
|
63 | + ->from('dav_shares') |
|
64 | + ->execute(); |
|
65 | 65 | |
66 | - while ($row = $result->fetch()) { |
|
67 | - $principaluri = $row['principaluri']; |
|
68 | - $p = $this->principalBackend->getPrincipalByPath($principaluri); |
|
69 | - if ($p === null) { |
|
70 | - $this->deleteSharesForPrincipal($principaluri); |
|
71 | - } |
|
72 | - } |
|
66 | + while ($row = $result->fetch()) { |
|
67 | + $principaluri = $row['principaluri']; |
|
68 | + $p = $this->principalBackend->getPrincipalByPath($principaluri); |
|
69 | + if ($p === null) { |
|
70 | + $this->deleteSharesForPrincipal($principaluri); |
|
71 | + } |
|
72 | + } |
|
73 | 73 | |
74 | - $result->closeCursor(); |
|
75 | - return 0; |
|
76 | - } |
|
74 | + $result->closeCursor(); |
|
75 | + return 0; |
|
76 | + } |
|
77 | 77 | |
78 | - /** |
|
79 | - * @param string $principaluri |
|
80 | - */ |
|
81 | - private function deleteSharesForPrincipal($principaluri) { |
|
82 | - $delete = $this->connection->getQueryBuilder(); |
|
83 | - $delete->delete('dav_shares') |
|
84 | - ->where($delete->expr()->eq('principaluri', $delete->createNamedParameter($principaluri))); |
|
85 | - $delete->execute(); |
|
86 | - } |
|
78 | + /** |
|
79 | + * @param string $principaluri |
|
80 | + */ |
|
81 | + private function deleteSharesForPrincipal($principaluri) { |
|
82 | + $delete = $this->connection->getQueryBuilder(); |
|
83 | + $delete->delete('dav_shares') |
|
84 | + ->where($delete->expr()->eq('principaluri', $delete->createNamedParameter($principaluri))); |
|
85 | + $delete->execute(); |
|
86 | + } |
|
87 | 87 | } |
@@ -37,50 +37,50 @@ |
||
37 | 37 | */ |
38 | 38 | class SendEventReminders extends Command { |
39 | 39 | |
40 | - /** @var ReminderService */ |
|
41 | - protected $reminderService; |
|
40 | + /** @var ReminderService */ |
|
41 | + protected $reminderService; |
|
42 | 42 | |
43 | - /** @var IConfig */ |
|
44 | - protected $config; |
|
43 | + /** @var IConfig */ |
|
44 | + protected $config; |
|
45 | 45 | |
46 | - /** |
|
47 | - * @param ReminderService $reminderService |
|
48 | - * @param IConfig $config |
|
49 | - */ |
|
50 | - public function __construct(ReminderService $reminderService, |
|
51 | - IConfig $config) { |
|
52 | - parent::__construct(); |
|
53 | - $this->reminderService = $reminderService; |
|
54 | - $this->config = $config; |
|
55 | - } |
|
46 | + /** |
|
47 | + * @param ReminderService $reminderService |
|
48 | + * @param IConfig $config |
|
49 | + */ |
|
50 | + public function __construct(ReminderService $reminderService, |
|
51 | + IConfig $config) { |
|
52 | + parent::__construct(); |
|
53 | + $this->reminderService = $reminderService; |
|
54 | + $this->config = $config; |
|
55 | + } |
|
56 | 56 | |
57 | - /** |
|
58 | - * @inheritDoc |
|
59 | - */ |
|
60 | - protected function configure():void { |
|
61 | - $this |
|
62 | - ->setName('dav:send-event-reminders') |
|
63 | - ->setDescription('Sends event reminders'); |
|
64 | - } |
|
57 | + /** |
|
58 | + * @inheritDoc |
|
59 | + */ |
|
60 | + protected function configure():void { |
|
61 | + $this |
|
62 | + ->setName('dav:send-event-reminders') |
|
63 | + ->setDescription('Sends event reminders'); |
|
64 | + } |
|
65 | 65 | |
66 | - /** |
|
67 | - * @param InputInterface $input |
|
68 | - * @param OutputInterface $output |
|
69 | - */ |
|
70 | - protected function execute(InputInterface $input, OutputInterface $output): int { |
|
71 | - if ($this->config->getAppValue('dav', 'sendEventReminders', 'yes') !== 'yes') { |
|
72 | - $output->writeln('<error>Sending event reminders disabled!</error>'); |
|
73 | - $output->writeln('<info>Please run "php occ config:app:set dav sendEventReminders --value yes"'); |
|
74 | - return 1; |
|
75 | - } |
|
66 | + /** |
|
67 | + * @param InputInterface $input |
|
68 | + * @param OutputInterface $output |
|
69 | + */ |
|
70 | + protected function execute(InputInterface $input, OutputInterface $output): int { |
|
71 | + if ($this->config->getAppValue('dav', 'sendEventReminders', 'yes') !== 'yes') { |
|
72 | + $output->writeln('<error>Sending event reminders disabled!</error>'); |
|
73 | + $output->writeln('<info>Please run "php occ config:app:set dav sendEventReminders --value yes"'); |
|
74 | + return 1; |
|
75 | + } |
|
76 | 76 | |
77 | - if ($this->config->getAppValue('dav', 'sendEventRemindersMode', 'backgroundjob') !== 'occ') { |
|
78 | - $output->writeln('<error>Sending event reminders mode set to background-job!</error>'); |
|
79 | - $output->writeln('<info>Please run "php occ config:app:set dav sendEventRemindersMode --value occ"'); |
|
80 | - return 1; |
|
81 | - } |
|
77 | + if ($this->config->getAppValue('dav', 'sendEventRemindersMode', 'backgroundjob') !== 'occ') { |
|
78 | + $output->writeln('<error>Sending event reminders mode set to background-job!</error>'); |
|
79 | + $output->writeln('<info>Please run "php occ config:app:set dav sendEventRemindersMode --value occ"'); |
|
80 | + return 1; |
|
81 | + } |
|
82 | 82 | |
83 | - $this->reminderService->processReminders(); |
|
84 | - return 0; |
|
85 | - } |
|
83 | + $this->reminderService->processReminders(); |
|
84 | + return 0; |
|
85 | + } |
|
86 | 86 | } |
@@ -37,70 +37,70 @@ |
||
37 | 37 | |
38 | 38 | class ListCalendars extends Command { |
39 | 39 | |
40 | - /** @var IUserManager */ |
|
41 | - protected $userManager; |
|
40 | + /** @var IUserManager */ |
|
41 | + protected $userManager; |
|
42 | 42 | |
43 | - /** @var CalDavBackend */ |
|
44 | - private $caldav; |
|
43 | + /** @var CalDavBackend */ |
|
44 | + private $caldav; |
|
45 | 45 | |
46 | - /** |
|
47 | - * @param IUserManager $userManager |
|
48 | - * @param CalDavBackend $caldav |
|
49 | - */ |
|
50 | - public function __construct(IUserManager $userManager, CalDavBackend $caldav) { |
|
51 | - parent::__construct(); |
|
52 | - $this->userManager = $userManager; |
|
53 | - $this->caldav = $caldav; |
|
54 | - } |
|
46 | + /** |
|
47 | + * @param IUserManager $userManager |
|
48 | + * @param CalDavBackend $caldav |
|
49 | + */ |
|
50 | + public function __construct(IUserManager $userManager, CalDavBackend $caldav) { |
|
51 | + parent::__construct(); |
|
52 | + $this->userManager = $userManager; |
|
53 | + $this->caldav = $caldav; |
|
54 | + } |
|
55 | 55 | |
56 | - protected function configure() { |
|
57 | - $this |
|
58 | - ->setName('dav:list-calendars') |
|
59 | - ->setDescription('List all calendars of a user') |
|
60 | - ->addArgument('uid', |
|
61 | - InputArgument::REQUIRED, |
|
62 | - 'User for whom all calendars will be listed'); |
|
63 | - } |
|
56 | + protected function configure() { |
|
57 | + $this |
|
58 | + ->setName('dav:list-calendars') |
|
59 | + ->setDescription('List all calendars of a user') |
|
60 | + ->addArgument('uid', |
|
61 | + InputArgument::REQUIRED, |
|
62 | + 'User for whom all calendars will be listed'); |
|
63 | + } |
|
64 | 64 | |
65 | - protected function execute(InputInterface $input, OutputInterface $output): int { |
|
66 | - $user = $input->getArgument('uid'); |
|
67 | - if (!$this->userManager->userExists($user)) { |
|
68 | - throw new \InvalidArgumentException("User <$user> is unknown."); |
|
69 | - } |
|
65 | + protected function execute(InputInterface $input, OutputInterface $output): int { |
|
66 | + $user = $input->getArgument('uid'); |
|
67 | + if (!$this->userManager->userExists($user)) { |
|
68 | + throw new \InvalidArgumentException("User <$user> is unknown."); |
|
69 | + } |
|
70 | 70 | |
71 | - $calendars = $this->caldav->getCalendarsForUser("principals/users/$user"); |
|
71 | + $calendars = $this->caldav->getCalendarsForUser("principals/users/$user"); |
|
72 | 72 | |
73 | - $calendarTableData = []; |
|
74 | - foreach ($calendars as $calendar) { |
|
75 | - // skip birthday calendar |
|
76 | - if ($calendar['uri'] === BirthdayService::BIRTHDAY_CALENDAR_URI) { |
|
77 | - continue; |
|
78 | - } |
|
73 | + $calendarTableData = []; |
|
74 | + foreach ($calendars as $calendar) { |
|
75 | + // skip birthday calendar |
|
76 | + if ($calendar['uri'] === BirthdayService::BIRTHDAY_CALENDAR_URI) { |
|
77 | + continue; |
|
78 | + } |
|
79 | 79 | |
80 | - $readOnly = false; |
|
81 | - $readOnlyIndex = '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}read-only'; |
|
82 | - if (isset($calendar[$readOnlyIndex])) { |
|
83 | - $readOnly = $calendar[$readOnlyIndex]; |
|
84 | - } |
|
80 | + $readOnly = false; |
|
81 | + $readOnlyIndex = '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}read-only'; |
|
82 | + if (isset($calendar[$readOnlyIndex])) { |
|
83 | + $readOnly = $calendar[$readOnlyIndex]; |
|
84 | + } |
|
85 | 85 | |
86 | - $calendarTableData[] = [ |
|
87 | - $calendar['uri'], |
|
88 | - $calendar['{DAV:}displayname'], |
|
89 | - $calendar['{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}owner-principal'], |
|
90 | - $calendar['{' . \OCA\DAV\DAV\Sharing\Plugin::NS_NEXTCLOUD . '}owner-displayname'], |
|
91 | - $readOnly ? ' x ' : ' ✓ ', |
|
92 | - ]; |
|
93 | - } |
|
86 | + $calendarTableData[] = [ |
|
87 | + $calendar['uri'], |
|
88 | + $calendar['{DAV:}displayname'], |
|
89 | + $calendar['{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}owner-principal'], |
|
90 | + $calendar['{' . \OCA\DAV\DAV\Sharing\Plugin::NS_NEXTCLOUD . '}owner-displayname'], |
|
91 | + $readOnly ? ' x ' : ' ✓ ', |
|
92 | + ]; |
|
93 | + } |
|
94 | 94 | |
95 | - if (count($calendarTableData) > 0) { |
|
96 | - $table = new Table($output); |
|
97 | - $table->setHeaders(['uri', 'displayname', 'owner\'s userid', 'owner\'s displayname', 'writable']) |
|
98 | - ->setRows($calendarTableData); |
|
95 | + if (count($calendarTableData) > 0) { |
|
96 | + $table = new Table($output); |
|
97 | + $table->setHeaders(['uri', 'displayname', 'owner\'s userid', 'owner\'s displayname', 'writable']) |
|
98 | + ->setRows($calendarTableData); |
|
99 | 99 | |
100 | - $table->render(); |
|
101 | - } else { |
|
102 | - $output->writeln("<info>User <$user> has no calendars</info>"); |
|
103 | - } |
|
104 | - return 0; |
|
105 | - } |
|
100 | + $table->render(); |
|
101 | + } else { |
|
102 | + $output->writeln("<info>User <$user> has no calendars</info>"); |
|
103 | + } |
|
104 | + return 0; |
|
105 | + } |
|
106 | 106 | } |