@@ -32,10 +32,10 @@ |
||
32 | 32 | * @since 18.0.0 |
33 | 33 | */ |
34 | 34 | interface IUrl { |
35 | - /** |
|
36 | - * returns a URL that is related to the entity, e.g. the link to a share |
|
37 | - * |
|
38 | - * @since 18.0.0 |
|
39 | - */ |
|
40 | - public function getUrl(): string; |
|
35 | + /** |
|
36 | + * returns a URL that is related to the entity, e.g. the link to a share |
|
37 | + * |
|
38 | + * @since 18.0.0 |
|
39 | + */ |
|
40 | + public function getUrl(): string; |
|
41 | 41 | } |
@@ -32,10 +32,10 @@ |
||
32 | 32 | * @since 18.0.0 |
33 | 33 | */ |
34 | 34 | interface IDisplayName { |
35 | - /** |
|
36 | - * returns the end user facing name of the object related to the entity |
|
37 | - * |
|
38 | - * @since 18.0.0 |
|
39 | - */ |
|
40 | - public function getDisplayName(): string; |
|
35 | + /** |
|
36 | + * returns the end user facing name of the object related to the entity |
|
37 | + * |
|
38 | + * @since 18.0.0 |
|
39 | + */ |
|
40 | + public function getDisplayName(): string; |
|
41 | 41 | } |
@@ -32,11 +32,11 @@ |
||
32 | 32 | * @since 18.0.0 |
33 | 33 | */ |
34 | 34 | interface IIcon { |
35 | - /** |
|
36 | - * returns a URL to an icon that is related to the entity, for instance |
|
37 | - * a group icon for groups. |
|
38 | - * |
|
39 | - * @since 18.0.0 |
|
40 | - */ |
|
41 | - public function getIconUrl(): string; |
|
35 | + /** |
|
36 | + * returns a URL to an icon that is related to the entity, for instance |
|
37 | + * a group icon for groups. |
|
38 | + * |
|
39 | + * @since 18.0.0 |
|
40 | + */ |
|
41 | + public function getIconUrl(): string; |
|
42 | 42 | } |
@@ -33,15 +33,15 @@ |
||
33 | 33 | */ |
34 | 34 | interface IDisplayText { |
35 | 35 | |
36 | - /** |
|
37 | - * returns translated text used for display to the end user. For instance, |
|
38 | - * it can describe the event in a human readable way. |
|
39 | - * |
|
40 | - * The entity may react to a verbosity level that is provided. With the |
|
41 | - * basic level, 0, it would return brief information, and more with higher |
|
42 | - * numbers. All information shall be shown at a level of 3. |
|
43 | - * |
|
44 | - * @since 18.0.0 |
|
45 | - */ |
|
46 | - public function getDisplayText(int $verbosity = 0): string; |
|
36 | + /** |
|
37 | + * returns translated text used for display to the end user. For instance, |
|
38 | + * it can describe the event in a human readable way. |
|
39 | + * |
|
40 | + * The entity may react to a verbosity level that is provided. With the |
|
41 | + * basic level, 0, it would return brief information, and more with higher |
|
42 | + * numbers. All information shall be shown at a level of 3. |
|
43 | + * |
|
44 | + * @since 18.0.0 |
|
45 | + */ |
|
46 | + public function getDisplayText(int $verbosity = 0): string; |
|
47 | 47 | } |
@@ -36,62 +36,62 @@ |
||
36 | 36 | */ |
37 | 37 | class ICSExportPlugin extends \Sabre\CalDAV\ICSExportPlugin { |
38 | 38 | |
39 | - /** @var IConfig */ |
|
40 | - private $config; |
|
39 | + /** @var IConfig */ |
|
40 | + private $config; |
|
41 | 41 | |
42 | - /** @var ILogger */ |
|
43 | - private $logger; |
|
42 | + /** @var ILogger */ |
|
43 | + private $logger; |
|
44 | 44 | |
45 | - /** @var string */ |
|
46 | - private const DEFAULT_REFRESH_INTERVAL = 'PT4H'; |
|
45 | + /** @var string */ |
|
46 | + private const DEFAULT_REFRESH_INTERVAL = 'PT4H'; |
|
47 | 47 | |
48 | - /** |
|
49 | - * ICSExportPlugin constructor. |
|
50 | - * |
|
51 | - * @param IConfig $config |
|
52 | - */ |
|
53 | - public function __construct(IConfig $config, ILogger $logger) { |
|
54 | - $this->config = $config; |
|
55 | - $this->logger = $logger; |
|
56 | - } |
|
48 | + /** |
|
49 | + * ICSExportPlugin constructor. |
|
50 | + * |
|
51 | + * @param IConfig $config |
|
52 | + */ |
|
53 | + public function __construct(IConfig $config, ILogger $logger) { |
|
54 | + $this->config = $config; |
|
55 | + $this->logger = $logger; |
|
56 | + } |
|
57 | 57 | |
58 | - /** |
|
59 | - * @inheritDoc |
|
60 | - */ |
|
61 | - protected function generateResponse($path, $start, $end, $expand, $componentType, $format, $properties, ResponseInterface $response) { |
|
62 | - if (!isset($properties['{http://nextcloud.com/ns}refresh-interval'])) { |
|
63 | - $value = $this->config->getAppValue('dav', 'defaultRefreshIntervalExportedCalendars', self::DEFAULT_REFRESH_INTERVAL); |
|
64 | - $properties['{http://nextcloud.com/ns}refresh-interval'] = $value; |
|
65 | - } |
|
58 | + /** |
|
59 | + * @inheritDoc |
|
60 | + */ |
|
61 | + protected function generateResponse($path, $start, $end, $expand, $componentType, $format, $properties, ResponseInterface $response) { |
|
62 | + if (!isset($properties['{http://nextcloud.com/ns}refresh-interval'])) { |
|
63 | + $value = $this->config->getAppValue('dav', 'defaultRefreshIntervalExportedCalendars', self::DEFAULT_REFRESH_INTERVAL); |
|
64 | + $properties['{http://nextcloud.com/ns}refresh-interval'] = $value; |
|
65 | + } |
|
66 | 66 | |
67 | - return parent::generateResponse($path, $start, $end, $expand, $componentType, $format, $properties, $response); |
|
68 | - } |
|
67 | + return parent::generateResponse($path, $start, $end, $expand, $componentType, $format, $properties, $response); |
|
68 | + } |
|
69 | 69 | |
70 | - /** |
|
71 | - * @inheritDoc |
|
72 | - */ |
|
73 | - public function mergeObjects(array $properties, array $inputObjects) { |
|
74 | - $vcalendar = parent::mergeObjects($properties, $inputObjects); |
|
70 | + /** |
|
71 | + * @inheritDoc |
|
72 | + */ |
|
73 | + public function mergeObjects(array $properties, array $inputObjects) { |
|
74 | + $vcalendar = parent::mergeObjects($properties, $inputObjects); |
|
75 | 75 | |
76 | - if (isset($properties['{http://nextcloud.com/ns}refresh-interval'])) { |
|
77 | - $refreshIntervalValue = $properties['{http://nextcloud.com/ns}refresh-interval']; |
|
78 | - try { |
|
79 | - DateTimeParser::parseDuration($refreshIntervalValue); |
|
80 | - } catch (InvalidDataException $ex) { |
|
81 | - $this->logger->debug('Invalid refresh interval for exported calendar, falling back to default value ...'); |
|
82 | - $refreshIntervalValue = self::DEFAULT_REFRESH_INTERVAL; |
|
83 | - } |
|
76 | + if (isset($properties['{http://nextcloud.com/ns}refresh-interval'])) { |
|
77 | + $refreshIntervalValue = $properties['{http://nextcloud.com/ns}refresh-interval']; |
|
78 | + try { |
|
79 | + DateTimeParser::parseDuration($refreshIntervalValue); |
|
80 | + } catch (InvalidDataException $ex) { |
|
81 | + $this->logger->debug('Invalid refresh interval for exported calendar, falling back to default value ...'); |
|
82 | + $refreshIntervalValue = self::DEFAULT_REFRESH_INTERVAL; |
|
83 | + } |
|
84 | 84 | |
85 | - // https://tools.ietf.org/html/rfc7986#section-5.7 |
|
86 | - $refreshInterval = new Duration($vcalendar, 'REFRESH-INTERVAL', $refreshIntervalValue); |
|
87 | - $refreshInterval->add('VALUE', 'DURATION'); |
|
88 | - $vcalendar->add($refreshInterval); |
|
85 | + // https://tools.ietf.org/html/rfc7986#section-5.7 |
|
86 | + $refreshInterval = new Duration($vcalendar, 'REFRESH-INTERVAL', $refreshIntervalValue); |
|
87 | + $refreshInterval->add('VALUE', 'DURATION'); |
|
88 | + $vcalendar->add($refreshInterval); |
|
89 | 89 | |
90 | - // Legacy property for compatibility |
|
91 | - $vcalendar->{'X-PUBLISHED-TTL'} = $refreshIntervalValue; |
|
92 | - } |
|
90 | + // Legacy property for compatibility |
|
91 | + $vcalendar->{'X-PUBLISHED-TTL'} = $refreshIntervalValue; |
|
92 | + } |
|
93 | 93 | |
94 | - return $vcalendar; |
|
95 | - } |
|
94 | + return $vcalendar; |
|
95 | + } |
|
96 | 96 | |
97 | 97 | } |
@@ -37,24 +37,24 @@ |
||
37 | 37 | * @method string getNodeName() |
38 | 38 | */ |
39 | 39 | class TransferOwnership extends Entity { |
40 | - /** @var string */ |
|
41 | - protected $sourceUser; |
|
40 | + /** @var string */ |
|
41 | + protected $sourceUser; |
|
42 | 42 | |
43 | - /** @var string */ |
|
44 | - protected $targetUser; |
|
43 | + /** @var string */ |
|
44 | + protected $targetUser; |
|
45 | 45 | |
46 | - /** @var integer */ |
|
47 | - protected $fileId; |
|
46 | + /** @var integer */ |
|
47 | + protected $fileId; |
|
48 | 48 | |
49 | - /** @var string */ |
|
50 | - protected $nodeName; |
|
49 | + /** @var string */ |
|
50 | + protected $nodeName; |
|
51 | 51 | |
52 | - public function __construct() { |
|
53 | - $this->addType('sourceUser', 'string'); |
|
54 | - $this->addType('targetUser', 'string'); |
|
55 | - $this->addType('fileId', 'integer'); |
|
56 | - $this->addType('nodeName', 'string'); |
|
57 | - } |
|
52 | + public function __construct() { |
|
53 | + $this->addType('sourceUser', 'string'); |
|
54 | + $this->addType('targetUser', 'string'); |
|
55 | + $this->addType('fileId', 'integer'); |
|
56 | + $this->addType('nodeName', 'string'); |
|
57 | + } |
|
58 | 58 | |
59 | 59 | |
60 | 60 | } |
@@ -31,41 +31,41 @@ |
||
31 | 31 | */ |
32 | 32 | class UserCreatedEvent extends Event { |
33 | 33 | |
34 | - /** @var IUser */ |
|
35 | - private $user; |
|
34 | + /** @var IUser */ |
|
35 | + private $user; |
|
36 | 36 | |
37 | - /** @var string */ |
|
38 | - private $password; |
|
37 | + /** @var string */ |
|
38 | + private $password; |
|
39 | 39 | |
40 | - /** |
|
41 | - * @since 18.0.0 |
|
42 | - */ |
|
43 | - public function __construct(IUser $user, |
|
44 | - string $password) { |
|
45 | - parent::__construct(); |
|
46 | - $this->user = $user; |
|
47 | - $this->password = $password; |
|
48 | - } |
|
40 | + /** |
|
41 | + * @since 18.0.0 |
|
42 | + */ |
|
43 | + public function __construct(IUser $user, |
|
44 | + string $password) { |
|
45 | + parent::__construct(); |
|
46 | + $this->user = $user; |
|
47 | + $this->password = $password; |
|
48 | + } |
|
49 | 49 | |
50 | - /** |
|
51 | - * @since 18.0.0 |
|
52 | - */ |
|
53 | - public function getUser(): IUser { |
|
54 | - return $this->user; |
|
55 | - } |
|
50 | + /** |
|
51 | + * @since 18.0.0 |
|
52 | + */ |
|
53 | + public function getUser(): IUser { |
|
54 | + return $this->user; |
|
55 | + } |
|
56 | 56 | |
57 | - /** |
|
58 | - * @since 18.0.0 |
|
59 | - */ |
|
60 | - public function getUid(): string { |
|
61 | - return $this->user->getUID(); |
|
62 | - } |
|
57 | + /** |
|
58 | + * @since 18.0.0 |
|
59 | + */ |
|
60 | + public function getUid(): string { |
|
61 | + return $this->user->getUID(); |
|
62 | + } |
|
63 | 63 | |
64 | - /** |
|
65 | - * @since 18.0.0 |
|
66 | - */ |
|
67 | - public function getPassword(): string { |
|
68 | - return $this->password; |
|
69 | - } |
|
64 | + /** |
|
65 | + * @since 18.0.0 |
|
66 | + */ |
|
67 | + public function getPassword(): string { |
|
68 | + return $this->password; |
|
69 | + } |
|
70 | 70 | |
71 | 71 | } |
@@ -47,67 +47,67 @@ |
||
47 | 47 | */ |
48 | 48 | class CleanupCardDAVPhotoCache implements IRepairStep { |
49 | 49 | |
50 | - /** @var IConfig */ |
|
51 | - private $config; |
|
52 | - |
|
53 | - /** @var IAppData */ |
|
54 | - private $appData; |
|
55 | - |
|
56 | - /** @var ILogger */ |
|
57 | - private $logger; |
|
58 | - |
|
59 | - public function __construct(IConfig $config, IAppData $appData, ILogger $logger) { |
|
60 | - $this->config = $config; |
|
61 | - $this->appData = $appData; |
|
62 | - $this->logger = $logger; |
|
63 | - } |
|
64 | - |
|
65 | - public function getName(): string { |
|
66 | - return 'Cleanup invalid photocache files for carddav'; |
|
67 | - } |
|
68 | - |
|
69 | - private function repair(IOutput $output): void { |
|
70 | - try { |
|
71 | - $folders = $this->appData->getDirectoryListing(); |
|
72 | - } catch (NotFoundException $e) { |
|
73 | - return; |
|
74 | - } catch (RuntimeException $e) { |
|
75 | - $this->logger->logException($e, ['message' => 'Failed to fetch directory listing in CleanupCardDAVPhotoCache']); |
|
76 | - return; |
|
77 | - } |
|
78 | - |
|
79 | - $folders = array_filter($folders, function (ISimpleFolder $folder) { |
|
80 | - return $folder->fileExists('photo.'); |
|
81 | - }); |
|
82 | - |
|
83 | - if (empty($folders)) { |
|
84 | - return; |
|
85 | - } |
|
86 | - |
|
87 | - $output->info('Delete ' . count($folders) . ' "photo." files'); |
|
88 | - |
|
89 | - foreach ($folders as $folder) { |
|
90 | - try { |
|
91 | - /** @var ISimpleFolder $folder */ |
|
92 | - $folder->getFile('photo.')->delete(); |
|
93 | - } catch (\Exception $e) { |
|
94 | - $this->logger->logException($e); |
|
95 | - $output->warning('Could not delete file "dav-photocache/' . $folder->getName() . '/photo."'); |
|
96 | - } |
|
97 | - } |
|
98 | - } |
|
99 | - |
|
100 | - private function shouldRun(): bool { |
|
101 | - return version_compare( |
|
102 | - $this->config->getSystemValue('version', '0.0.0.0'), |
|
103 | - '16.0.0.0', |
|
104 | - '<=' |
|
105 | - ); |
|
106 | - } |
|
107 | - |
|
108 | - public function run(IOutput $output): void { |
|
109 | - if ($this->shouldRun()) { |
|
110 | - $this->repair($output); |
|
111 | - } |
|
112 | - } |
|
50 | + /** @var IConfig */ |
|
51 | + private $config; |
|
52 | + |
|
53 | + /** @var IAppData */ |
|
54 | + private $appData; |
|
55 | + |
|
56 | + /** @var ILogger */ |
|
57 | + private $logger; |
|
58 | + |
|
59 | + public function __construct(IConfig $config, IAppData $appData, ILogger $logger) { |
|
60 | + $this->config = $config; |
|
61 | + $this->appData = $appData; |
|
62 | + $this->logger = $logger; |
|
63 | + } |
|
64 | + |
|
65 | + public function getName(): string { |
|
66 | + return 'Cleanup invalid photocache files for carddav'; |
|
67 | + } |
|
68 | + |
|
69 | + private function repair(IOutput $output): void { |
|
70 | + try { |
|
71 | + $folders = $this->appData->getDirectoryListing(); |
|
72 | + } catch (NotFoundException $e) { |
|
73 | + return; |
|
74 | + } catch (RuntimeException $e) { |
|
75 | + $this->logger->logException($e, ['message' => 'Failed to fetch directory listing in CleanupCardDAVPhotoCache']); |
|
76 | + return; |
|
77 | + } |
|
78 | + |
|
79 | + $folders = array_filter($folders, function (ISimpleFolder $folder) { |
|
80 | + return $folder->fileExists('photo.'); |
|
81 | + }); |
|
82 | + |
|
83 | + if (empty($folders)) { |
|
84 | + return; |
|
85 | + } |
|
86 | + |
|
87 | + $output->info('Delete ' . count($folders) . ' "photo." files'); |
|
88 | + |
|
89 | + foreach ($folders as $folder) { |
|
90 | + try { |
|
91 | + /** @var ISimpleFolder $folder */ |
|
92 | + $folder->getFile('photo.')->delete(); |
|
93 | + } catch (\Exception $e) { |
|
94 | + $this->logger->logException($e); |
|
95 | + $output->warning('Could not delete file "dav-photocache/' . $folder->getName() . '/photo."'); |
|
96 | + } |
|
97 | + } |
|
98 | + } |
|
99 | + |
|
100 | + private function shouldRun(): bool { |
|
101 | + return version_compare( |
|
102 | + $this->config->getSystemValue('version', '0.0.0.0'), |
|
103 | + '16.0.0.0', |
|
104 | + '<=' |
|
105 | + ); |
|
106 | + } |
|
107 | + |
|
108 | + public function run(IOutput $output): void { |
|
109 | + if ($this->shouldRun()) { |
|
110 | + $this->repair($output); |
|
111 | + } |
|
112 | + } |
|
113 | 113 | } |
@@ -35,32 +35,32 @@ |
||
35 | 35 | */ |
36 | 36 | class RegistryEvent extends Event { |
37 | 37 | |
38 | - /** @var IProvider */ |
|
39 | - private $provider; |
|
38 | + /** @var IProvider */ |
|
39 | + private $provider; |
|
40 | 40 | |
41 | - /** @IUser */ |
|
42 | - private $user; |
|
41 | + /** @IUser */ |
|
42 | + private $user; |
|
43 | 43 | |
44 | - /** |
|
45 | - * @since 15.0.0 |
|
46 | - */ |
|
47 | - public function __construct(IProvider $provider, IUser $user) { |
|
48 | - parent::__construct(); |
|
49 | - $this->provider = $provider; |
|
50 | - $this->user = $user; |
|
51 | - } |
|
44 | + /** |
|
45 | + * @since 15.0.0 |
|
46 | + */ |
|
47 | + public function __construct(IProvider $provider, IUser $user) { |
|
48 | + parent::__construct(); |
|
49 | + $this->provider = $provider; |
|
50 | + $this->user = $user; |
|
51 | + } |
|
52 | 52 | |
53 | - /** |
|
54 | - * @since 15.0.0 |
|
55 | - */ |
|
56 | - public function getProvider(): IProvider { |
|
57 | - return $this->provider; |
|
58 | - } |
|
53 | + /** |
|
54 | + * @since 15.0.0 |
|
55 | + */ |
|
56 | + public function getProvider(): IProvider { |
|
57 | + return $this->provider; |
|
58 | + } |
|
59 | 59 | |
60 | - /** |
|
61 | - * @since 15.0.0 |
|
62 | - */ |
|
63 | - public function getUser(): IUser { |
|
64 | - return $this->user; |
|
65 | - } |
|
60 | + /** |
|
61 | + * @since 15.0.0 |
|
62 | + */ |
|
63 | + public function getUser(): IUser { |
|
64 | + return $this->user; |
|
65 | + } |
|
66 | 66 | } |