@@ -34,67 +34,67 @@ |
||
34 | 34 | */ |
35 | 35 | class CardDeletedEvent extends Event { |
36 | 36 | |
37 | - /** @var int */ |
|
38 | - private $addressBookId; |
|
37 | + /** @var int */ |
|
38 | + private $addressBookId; |
|
39 | 39 | |
40 | - /** @var array */ |
|
41 | - private $addressBookData; |
|
40 | + /** @var array */ |
|
41 | + private $addressBookData; |
|
42 | 42 | |
43 | - /** @var array */ |
|
44 | - private $shares; |
|
43 | + /** @var array */ |
|
44 | + private $shares; |
|
45 | 45 | |
46 | - /** @var array */ |
|
47 | - private $cardData; |
|
46 | + /** @var array */ |
|
47 | + private $cardData; |
|
48 | 48 | |
49 | - /** |
|
50 | - * CardDeletedEvent constructor. |
|
51 | - * |
|
52 | - * @param int $addressBookId |
|
53 | - * @param array $addressBookData |
|
54 | - * @param array $shares |
|
55 | - * @param array $cardData |
|
56 | - * @since 20.0.0 |
|
57 | - */ |
|
58 | - public function __construct(int $addressBookId, |
|
59 | - array $addressBookData, |
|
60 | - array $shares, |
|
61 | - array $cardData) { |
|
62 | - parent::__construct(); |
|
63 | - $this->addressBookId = $addressBookId; |
|
64 | - $this->addressBookData = $addressBookData; |
|
65 | - $this->shares = $shares; |
|
66 | - $this->cardData = $cardData; |
|
67 | - } |
|
49 | + /** |
|
50 | + * CardDeletedEvent constructor. |
|
51 | + * |
|
52 | + * @param int $addressBookId |
|
53 | + * @param array $addressBookData |
|
54 | + * @param array $shares |
|
55 | + * @param array $cardData |
|
56 | + * @since 20.0.0 |
|
57 | + */ |
|
58 | + public function __construct(int $addressBookId, |
|
59 | + array $addressBookData, |
|
60 | + array $shares, |
|
61 | + array $cardData) { |
|
62 | + parent::__construct(); |
|
63 | + $this->addressBookId = $addressBookId; |
|
64 | + $this->addressBookData = $addressBookData; |
|
65 | + $this->shares = $shares; |
|
66 | + $this->cardData = $cardData; |
|
67 | + } |
|
68 | 68 | |
69 | - /** |
|
70 | - * @return int |
|
71 | - * @since 20.0.0 |
|
72 | - */ |
|
73 | - public function getAddressBookId(): int { |
|
74 | - return $this->addressBookId; |
|
75 | - } |
|
69 | + /** |
|
70 | + * @return int |
|
71 | + * @since 20.0.0 |
|
72 | + */ |
|
73 | + public function getAddressBookId(): int { |
|
74 | + return $this->addressBookId; |
|
75 | + } |
|
76 | 76 | |
77 | - /** |
|
78 | - * @return array |
|
79 | - * @since 20.0.0 |
|
80 | - */ |
|
81 | - public function getAddressBookData(): array { |
|
82 | - return $this->addressBookData; |
|
83 | - } |
|
77 | + /** |
|
78 | + * @return array |
|
79 | + * @since 20.0.0 |
|
80 | + */ |
|
81 | + public function getAddressBookData(): array { |
|
82 | + return $this->addressBookData; |
|
83 | + } |
|
84 | 84 | |
85 | - /** |
|
86 | - * @return array |
|
87 | - * @since 20.0.0 |
|
88 | - */ |
|
89 | - public function getShares(): array { |
|
90 | - return $this->shares; |
|
91 | - } |
|
85 | + /** |
|
86 | + * @return array |
|
87 | + * @since 20.0.0 |
|
88 | + */ |
|
89 | + public function getShares(): array { |
|
90 | + return $this->shares; |
|
91 | + } |
|
92 | 92 | |
93 | - /** |
|
94 | - * @return array |
|
95 | - * @since 20.0.0 |
|
96 | - */ |
|
97 | - public function getCardData(): array { |
|
98 | - return $this->cardData; |
|
99 | - } |
|
93 | + /** |
|
94 | + * @return array |
|
95 | + * @since 20.0.0 |
|
96 | + */ |
|
97 | + public function getCardData(): array { |
|
98 | + return $this->cardData; |
|
99 | + } |
|
100 | 100 | } |
@@ -34,81 +34,81 @@ |
||
34 | 34 | */ |
35 | 35 | class AddressBookShareUpdatedEvent extends Event { |
36 | 36 | |
37 | - /** @var int */ |
|
38 | - private $addressBookId; |
|
37 | + /** @var int */ |
|
38 | + private $addressBookId; |
|
39 | 39 | |
40 | - /** @var array */ |
|
41 | - private $addressBookData; |
|
40 | + /** @var array */ |
|
41 | + private $addressBookData; |
|
42 | 42 | |
43 | - /** @var array */ |
|
44 | - private $oldShares; |
|
43 | + /** @var array */ |
|
44 | + private $oldShares; |
|
45 | 45 | |
46 | - /** @var array */ |
|
47 | - private $added; |
|
46 | + /** @var array */ |
|
47 | + private $added; |
|
48 | 48 | |
49 | - /** @var array */ |
|
50 | - private $removed; |
|
49 | + /** @var array */ |
|
50 | + private $removed; |
|
51 | 51 | |
52 | - /** |
|
53 | - * AddressBookShareUpdatedEvent constructor. |
|
54 | - * |
|
55 | - * @param int $addressBookId |
|
56 | - * @param array $addressBookData |
|
57 | - * @param array $oldShares |
|
58 | - * @param array $added |
|
59 | - * @param array $removed |
|
60 | - * @since 20.0.0 |
|
61 | - */ |
|
62 | - public function __construct(int $addressBookId, |
|
63 | - array $addressBookData, |
|
64 | - array $oldShares, |
|
65 | - array $added, |
|
66 | - array $removed) { |
|
67 | - parent::__construct(); |
|
68 | - $this->addressBookId = $addressBookId; |
|
69 | - $this->addressBookData = $addressBookData; |
|
70 | - $this->oldShares = $oldShares; |
|
71 | - $this->added = $added; |
|
72 | - $this->removed = $removed; |
|
73 | - } |
|
52 | + /** |
|
53 | + * AddressBookShareUpdatedEvent constructor. |
|
54 | + * |
|
55 | + * @param int $addressBookId |
|
56 | + * @param array $addressBookData |
|
57 | + * @param array $oldShares |
|
58 | + * @param array $added |
|
59 | + * @param array $removed |
|
60 | + * @since 20.0.0 |
|
61 | + */ |
|
62 | + public function __construct(int $addressBookId, |
|
63 | + array $addressBookData, |
|
64 | + array $oldShares, |
|
65 | + array $added, |
|
66 | + array $removed) { |
|
67 | + parent::__construct(); |
|
68 | + $this->addressBookId = $addressBookId; |
|
69 | + $this->addressBookData = $addressBookData; |
|
70 | + $this->oldShares = $oldShares; |
|
71 | + $this->added = $added; |
|
72 | + $this->removed = $removed; |
|
73 | + } |
|
74 | 74 | |
75 | - /** |
|
76 | - * @return int |
|
77 | - * @since 20.0.0 |
|
78 | - */ |
|
79 | - public function getAddressBookId(): int { |
|
80 | - return $this->addressBookId; |
|
81 | - } |
|
75 | + /** |
|
76 | + * @return int |
|
77 | + * @since 20.0.0 |
|
78 | + */ |
|
79 | + public function getAddressBookId(): int { |
|
80 | + return $this->addressBookId; |
|
81 | + } |
|
82 | 82 | |
83 | - /** |
|
84 | - * @return array |
|
85 | - * @since 20.0.0 |
|
86 | - */ |
|
87 | - public function getAddressBookData(): array { |
|
88 | - return $this->addressBookData; |
|
89 | - } |
|
83 | + /** |
|
84 | + * @return array |
|
85 | + * @since 20.0.0 |
|
86 | + */ |
|
87 | + public function getAddressBookData(): array { |
|
88 | + return $this->addressBookData; |
|
89 | + } |
|
90 | 90 | |
91 | - /** |
|
92 | - * @return array |
|
93 | - * @since 20.0.0 |
|
94 | - */ |
|
95 | - public function getOldShares(): array { |
|
96 | - return $this->oldShares; |
|
97 | - } |
|
91 | + /** |
|
92 | + * @return array |
|
93 | + * @since 20.0.0 |
|
94 | + */ |
|
95 | + public function getOldShares(): array { |
|
96 | + return $this->oldShares; |
|
97 | + } |
|
98 | 98 | |
99 | - /** |
|
100 | - * @return array |
|
101 | - * @since 20.0.0 |
|
102 | - */ |
|
103 | - public function getAdded(): array { |
|
104 | - return $this->added; |
|
105 | - } |
|
99 | + /** |
|
100 | + * @return array |
|
101 | + * @since 20.0.0 |
|
102 | + */ |
|
103 | + public function getAdded(): array { |
|
104 | + return $this->added; |
|
105 | + } |
|
106 | 106 | |
107 | - /** |
|
108 | - * @return array |
|
109 | - * @since 20.0.0 |
|
110 | - */ |
|
111 | - public function getRemoved(): array { |
|
112 | - return $this->removed; |
|
113 | - } |
|
107 | + /** |
|
108 | + * @return array |
|
109 | + * @since 20.0.0 |
|
110 | + */ |
|
111 | + public function getRemoved(): array { |
|
112 | + return $this->removed; |
|
113 | + } |
|
114 | 114 | } |
@@ -34,39 +34,39 @@ |
||
34 | 34 | */ |
35 | 35 | class AddressBookCreatedEvent extends Event { |
36 | 36 | |
37 | - /** @var int */ |
|
38 | - private $addressBookId; |
|
37 | + /** @var int */ |
|
38 | + private $addressBookId; |
|
39 | 39 | |
40 | - /** @var array */ |
|
41 | - private $addressBookData; |
|
40 | + /** @var array */ |
|
41 | + private $addressBookData; |
|
42 | 42 | |
43 | - /** |
|
44 | - * AddressBookCreatedEvent constructor. |
|
45 | - * |
|
46 | - * @param int $addressBookId |
|
47 | - * @param array $addressBookData |
|
48 | - * @since 20.0.0 |
|
49 | - */ |
|
50 | - public function __construct(int $addressBookId, |
|
51 | - array $addressBookData) { |
|
52 | - parent::__construct(); |
|
53 | - $this->addressBookId = $addressBookId; |
|
54 | - $this->addressBookData = $addressBookData; |
|
55 | - } |
|
43 | + /** |
|
44 | + * AddressBookCreatedEvent constructor. |
|
45 | + * |
|
46 | + * @param int $addressBookId |
|
47 | + * @param array $addressBookData |
|
48 | + * @since 20.0.0 |
|
49 | + */ |
|
50 | + public function __construct(int $addressBookId, |
|
51 | + array $addressBookData) { |
|
52 | + parent::__construct(); |
|
53 | + $this->addressBookId = $addressBookId; |
|
54 | + $this->addressBookData = $addressBookData; |
|
55 | + } |
|
56 | 56 | |
57 | - /** |
|
58 | - * @return int |
|
59 | - * @since 20.0.0 |
|
60 | - */ |
|
61 | - public function getAddressBookId(): int { |
|
62 | - return $this->addressBookId; |
|
63 | - } |
|
57 | + /** |
|
58 | + * @return int |
|
59 | + * @since 20.0.0 |
|
60 | + */ |
|
61 | + public function getAddressBookId(): int { |
|
62 | + return $this->addressBookId; |
|
63 | + } |
|
64 | 64 | |
65 | - /** |
|
66 | - * @return array |
|
67 | - * @since 20.0.0 |
|
68 | - */ |
|
69 | - public function getAddressBookData(): array { |
|
70 | - return $this->addressBookData; |
|
71 | - } |
|
65 | + /** |
|
66 | + * @return array |
|
67 | + * @since 20.0.0 |
|
68 | + */ |
|
69 | + public function getAddressBookData(): array { |
|
70 | + return $this->addressBookData; |
|
71 | + } |
|
72 | 72 | } |
@@ -34,53 +34,53 @@ |
||
34 | 34 | */ |
35 | 35 | class CalendarDeletedEvent extends Event { |
36 | 36 | |
37 | - /** @var int */ |
|
38 | - private $calendarId; |
|
37 | + /** @var int */ |
|
38 | + private $calendarId; |
|
39 | 39 | |
40 | - /** @var array */ |
|
41 | - private $calendarData; |
|
40 | + /** @var array */ |
|
41 | + private $calendarData; |
|
42 | 42 | |
43 | - /** @var array */ |
|
44 | - private $shares; |
|
43 | + /** @var array */ |
|
44 | + private $shares; |
|
45 | 45 | |
46 | - /** |
|
47 | - * CalendarDeletedEvent constructor. |
|
48 | - * |
|
49 | - * @param int $calendarId |
|
50 | - * @param array $calendarData |
|
51 | - * @param array $shares |
|
52 | - * @since 20.0.0 |
|
53 | - */ |
|
54 | - public function __construct(int $calendarId, |
|
55 | - array $calendarData, |
|
56 | - array $shares) { |
|
57 | - parent::__construct(); |
|
58 | - $this->calendarId = $calendarId; |
|
59 | - $this->calendarData = $calendarData; |
|
60 | - $this->shares = $shares; |
|
61 | - } |
|
46 | + /** |
|
47 | + * CalendarDeletedEvent constructor. |
|
48 | + * |
|
49 | + * @param int $calendarId |
|
50 | + * @param array $calendarData |
|
51 | + * @param array $shares |
|
52 | + * @since 20.0.0 |
|
53 | + */ |
|
54 | + public function __construct(int $calendarId, |
|
55 | + array $calendarData, |
|
56 | + array $shares) { |
|
57 | + parent::__construct(); |
|
58 | + $this->calendarId = $calendarId; |
|
59 | + $this->calendarData = $calendarData; |
|
60 | + $this->shares = $shares; |
|
61 | + } |
|
62 | 62 | |
63 | - /** |
|
64 | - * @return int |
|
65 | - * @since 20.0.0 |
|
66 | - */ |
|
67 | - public function getCalendarId(): int { |
|
68 | - return $this->calendarId; |
|
69 | - } |
|
63 | + /** |
|
64 | + * @return int |
|
65 | + * @since 20.0.0 |
|
66 | + */ |
|
67 | + public function getCalendarId(): int { |
|
68 | + return $this->calendarId; |
|
69 | + } |
|
70 | 70 | |
71 | - /** |
|
72 | - * @return array |
|
73 | - * @since 20.0.0 |
|
74 | - */ |
|
75 | - public function getCalendarData(): array { |
|
76 | - return $this->calendarData; |
|
77 | - } |
|
71 | + /** |
|
72 | + * @return array |
|
73 | + * @since 20.0.0 |
|
74 | + */ |
|
75 | + public function getCalendarData(): array { |
|
76 | + return $this->calendarData; |
|
77 | + } |
|
78 | 78 | |
79 | - /** |
|
80 | - * @return array |
|
81 | - * @since 20.0.0 |
|
82 | - */ |
|
83 | - public function getShares(): array { |
|
84 | - return $this->shares; |
|
85 | - } |
|
79 | + /** |
|
80 | + * @return array |
|
81 | + * @since 20.0.0 |
|
82 | + */ |
|
83 | + public function getShares(): array { |
|
84 | + return $this->shares; |
|
85 | + } |
|
86 | 86 | } |
@@ -32,32 +32,32 @@ |
||
32 | 32 | use OCP\IURLGenerator; |
33 | 33 | |
34 | 34 | class LegacySSEKeyFormat { |
35 | - /** @var IL10N */ |
|
36 | - private $l10n; |
|
37 | - /** @var IConfig */ |
|
38 | - private $config; |
|
39 | - /** @var IURLGenerator */ |
|
40 | - private $urlGenerator; |
|
41 | - |
|
42 | - public function __construct(IL10N $l10n, IConfig $config, IURLGenerator $urlGenerator) { |
|
43 | - $this->l10n = $l10n; |
|
44 | - $this->config = $config; |
|
45 | - $this->urlGenerator = $urlGenerator; |
|
46 | - } |
|
47 | - |
|
48 | - public function description(): string { |
|
49 | - return $this->l10n->t('The old server-side-encryption format is enabled. We recommend disabling this.'); |
|
50 | - } |
|
51 | - |
|
52 | - public function severity(): string { |
|
53 | - return 'warning'; |
|
54 | - } |
|
55 | - |
|
56 | - public function run(): bool { |
|
57 | - return $this->config->getSystemValueBool('encryption.legacy_format_support', false) === false; |
|
58 | - } |
|
59 | - |
|
60 | - public function linkToDocumentation(): string { |
|
61 | - return $this->urlGenerator->linkToDocs('admin-sse-legacy-format'); |
|
62 | - } |
|
35 | + /** @var IL10N */ |
|
36 | + private $l10n; |
|
37 | + /** @var IConfig */ |
|
38 | + private $config; |
|
39 | + /** @var IURLGenerator */ |
|
40 | + private $urlGenerator; |
|
41 | + |
|
42 | + public function __construct(IL10N $l10n, IConfig $config, IURLGenerator $urlGenerator) { |
|
43 | + $this->l10n = $l10n; |
|
44 | + $this->config = $config; |
|
45 | + $this->urlGenerator = $urlGenerator; |
|
46 | + } |
|
47 | + |
|
48 | + public function description(): string { |
|
49 | + return $this->l10n->t('The old server-side-encryption format is enabled. We recommend disabling this.'); |
|
50 | + } |
|
51 | + |
|
52 | + public function severity(): string { |
|
53 | + return 'warning'; |
|
54 | + } |
|
55 | + |
|
56 | + public function run(): bool { |
|
57 | + return $this->config->getSystemValueBool('encryption.legacy_format_support', false) === false; |
|
58 | + } |
|
59 | + |
|
60 | + public function linkToDocumentation(): string { |
|
61 | + return $this->urlGenerator->linkToDocs('admin-sse-legacy-format'); |
|
62 | + } |
|
63 | 63 | } |
@@ -33,31 +33,31 @@ |
||
33 | 33 | |
34 | 34 | class LayoutApiController extends OCSController { |
35 | 35 | |
36 | - /** @var IConfig */ |
|
37 | - private $config; |
|
38 | - /** @var string */ |
|
39 | - private $userId; |
|
40 | - |
|
41 | - public function __construct( |
|
42 | - string $appName, |
|
43 | - IRequest $request, |
|
44 | - IConfig $config, |
|
45 | - $userId |
|
46 | - ) { |
|
47 | - parent::__construct($appName, $request); |
|
48 | - |
|
49 | - $this->config = $config; |
|
50 | - $this->userId = $userId; |
|
51 | - } |
|
52 | - |
|
53 | - /** |
|
54 | - * @NoAdminRequired |
|
55 | - * |
|
56 | - * @param string $layout |
|
57 | - * @return JSONResponse |
|
58 | - */ |
|
59 | - public function create(string $layout): JSONResponse { |
|
60 | - $this->config->setUserValue($this->userId, 'dashboard', 'layout', $layout); |
|
61 | - return new JSONResponse(['layout' => $layout]); |
|
62 | - } |
|
36 | + /** @var IConfig */ |
|
37 | + private $config; |
|
38 | + /** @var string */ |
|
39 | + private $userId; |
|
40 | + |
|
41 | + public function __construct( |
|
42 | + string $appName, |
|
43 | + IRequest $request, |
|
44 | + IConfig $config, |
|
45 | + $userId |
|
46 | + ) { |
|
47 | + parent::__construct($appName, $request); |
|
48 | + |
|
49 | + $this->config = $config; |
|
50 | + $this->userId = $userId; |
|
51 | + } |
|
52 | + |
|
53 | + /** |
|
54 | + * @NoAdminRequired |
|
55 | + * |
|
56 | + * @param string $layout |
|
57 | + * @return JSONResponse |
|
58 | + */ |
|
59 | + public function create(string $layout): JSONResponse { |
|
60 | + $this->config->setUserValue($this->userId, 'dashboard', 'layout', $layout); |
|
61 | + return new JSONResponse(['layout' => $layout]); |
|
62 | + } |
|
63 | 63 | } |
@@ -42,31 +42,31 @@ |
||
42 | 42 | */ |
43 | 43 | class Application extends App implements IBootstrap { |
44 | 44 | |
45 | - /** @var string */ |
|
46 | - public const APP_ID = 'weather_status'; |
|
45 | + /** @var string */ |
|
46 | + public const APP_ID = 'weather_status'; |
|
47 | 47 | |
48 | - /** |
|
49 | - * Application constructor. |
|
50 | - * |
|
51 | - * @param array $urlParams |
|
52 | - */ |
|
53 | - public function __construct(array $urlParams = []) { |
|
54 | - parent::__construct(self::APP_ID, $urlParams); |
|
48 | + /** |
|
49 | + * Application constructor. |
|
50 | + * |
|
51 | + * @param array $urlParams |
|
52 | + */ |
|
53 | + public function __construct(array $urlParams = []) { |
|
54 | + parent::__construct(self::APP_ID, $urlParams); |
|
55 | 55 | |
56 | - $dispatcher = $this->getContainer()->query(IEventDispatcher::class); |
|
57 | - $dispatcher->addListener(RegisterWidgetEvent::class, function (Event $e) { |
|
58 | - Util::addScript(self::APP_ID, 'weather-status'); |
|
59 | - }); |
|
60 | - } |
|
56 | + $dispatcher = $this->getContainer()->query(IEventDispatcher::class); |
|
57 | + $dispatcher->addListener(RegisterWidgetEvent::class, function (Event $e) { |
|
58 | + Util::addScript(self::APP_ID, 'weather-status'); |
|
59 | + }); |
|
60 | + } |
|
61 | 61 | |
62 | - /** |
|
63 | - * @inheritDoc |
|
64 | - */ |
|
65 | - public function register(IRegistrationContext $context): void { |
|
66 | - // Register OCS Capabilities |
|
67 | - $context->registerCapability(Capabilities::class); |
|
68 | - } |
|
62 | + /** |
|
63 | + * @inheritDoc |
|
64 | + */ |
|
65 | + public function register(IRegistrationContext $context): void { |
|
66 | + // Register OCS Capabilities |
|
67 | + $context->registerCapability(Capabilities::class); |
|
68 | + } |
|
69 | 69 | |
70 | - public function boot(IBootContext $context): void { |
|
71 | - } |
|
70 | + public function boot(IBootContext $context): void { |
|
71 | + } |
|
72 | 72 | } |
@@ -35,21 +35,21 @@ |
||
35 | 35 | */ |
36 | 36 | class Capabilities implements ICapability { |
37 | 37 | |
38 | - /** |
|
39 | - * Capabilities constructor. |
|
40 | - * |
|
41 | - */ |
|
42 | - public function __construct() { |
|
43 | - } |
|
38 | + /** |
|
39 | + * Capabilities constructor. |
|
40 | + * |
|
41 | + */ |
|
42 | + public function __construct() { |
|
43 | + } |
|
44 | 44 | |
45 | - /** |
|
46 | - * @inheritDoc |
|
47 | - */ |
|
48 | - public function getCapabilities() { |
|
49 | - return [ |
|
50 | - Application::APP_ID => [ |
|
51 | - 'enabled' => true, |
|
52 | - ], |
|
53 | - ]; |
|
54 | - } |
|
45 | + /** |
|
46 | + * @inheritDoc |
|
47 | + */ |
|
48 | + public function getCapabilities() { |
|
49 | + return [ |
|
50 | + Application::APP_ID => [ |
|
51 | + 'enabled' => true, |
|
52 | + ], |
|
53 | + ]; |
|
54 | + } |
|
55 | 55 | } |
@@ -34,91 +34,91 @@ |
||
34 | 34 | |
35 | 35 | class BuildCalendarSearchIndexBackgroundJob extends QueuedJob { |
36 | 36 | |
37 | - /** @var IDBConnection */ |
|
38 | - private $db; |
|
39 | - |
|
40 | - /** @var CalDavBackend */ |
|
41 | - private $calDavBackend; |
|
42 | - |
|
43 | - /** @var ILogger */ |
|
44 | - private $logger; |
|
45 | - |
|
46 | - /** @var IJobList */ |
|
47 | - private $jobList; |
|
48 | - |
|
49 | - /** @var ITimeFactory */ |
|
50 | - private $timeFactory; |
|
51 | - |
|
52 | - /** |
|
53 | - * @param IDBConnection $db |
|
54 | - * @param CalDavBackend $calDavBackend |
|
55 | - * @param ILogger $logger |
|
56 | - * @param IJobList $jobList |
|
57 | - * @param ITimeFactory $timeFactory |
|
58 | - */ |
|
59 | - public function __construct(IDBConnection $db, |
|
60 | - CalDavBackend $calDavBackend, |
|
61 | - ILogger $logger, |
|
62 | - IJobList $jobList, |
|
63 | - ITimeFactory $timeFactory) { |
|
64 | - $this->db = $db; |
|
65 | - $this->calDavBackend = $calDavBackend; |
|
66 | - $this->logger = $logger; |
|
67 | - $this->jobList = $jobList; |
|
68 | - $this->timeFactory = $timeFactory; |
|
69 | - } |
|
70 | - |
|
71 | - public function run($arguments) { |
|
72 | - $offset = (int) $arguments['offset']; |
|
73 | - $stopAt = (int) $arguments['stopAt']; |
|
74 | - |
|
75 | - $this->logger->info('Building calendar index (' . $offset .'/' . $stopAt . ')'); |
|
76 | - |
|
77 | - $startTime = $this->timeFactory->getTime(); |
|
78 | - while (($this->timeFactory->getTime() - $startTime) < 15) { |
|
79 | - $offset = $this->buildIndex($offset, $stopAt); |
|
80 | - if ($offset >= $stopAt) { |
|
81 | - break; |
|
82 | - } |
|
83 | - } |
|
84 | - |
|
85 | - if ($offset >= $stopAt) { |
|
86 | - $this->logger->info('Building calendar index done'); |
|
87 | - } else { |
|
88 | - $this->jobList->add(self::class, [ |
|
89 | - 'offset' => $offset, |
|
90 | - 'stopAt' => $stopAt |
|
91 | - ]); |
|
92 | - $this->logger->info('New building calendar index job scheduled with offset ' . $offset); |
|
93 | - } |
|
94 | - } |
|
95 | - |
|
96 | - /** |
|
97 | - * @param int $offset |
|
98 | - * @param int $stopAt |
|
99 | - * @return int |
|
100 | - */ |
|
101 | - private function buildIndex(int $offset, int $stopAt): int { |
|
102 | - $query = $this->db->getQueryBuilder(); |
|
103 | - $query->select(['id', 'calendarid', 'uri', 'calendardata']) |
|
104 | - ->from('calendarobjects') |
|
105 | - ->where($query->expr()->lte('id', $query->createNamedParameter($stopAt))) |
|
106 | - ->andWhere($query->expr()->gt('id', $query->createNamedParameter($offset))) |
|
107 | - ->orderBy('id', 'ASC') |
|
108 | - ->setMaxResults(500); |
|
109 | - |
|
110 | - $result = $query->execute(); |
|
111 | - while ($row = $result->fetch(\PDO::FETCH_ASSOC)) { |
|
112 | - $offset = $row['id']; |
|
113 | - |
|
114 | - $calendarData = $row['calendardata']; |
|
115 | - if (is_resource($calendarData)) { |
|
116 | - $calendarData = stream_get_contents($calendarData); |
|
117 | - } |
|
118 | - |
|
119 | - $this->calDavBackend->updateProperties($row['calendarid'], $row['uri'], $calendarData); |
|
120 | - } |
|
121 | - |
|
122 | - return $offset; |
|
123 | - } |
|
37 | + /** @var IDBConnection */ |
|
38 | + private $db; |
|
39 | + |
|
40 | + /** @var CalDavBackend */ |
|
41 | + private $calDavBackend; |
|
42 | + |
|
43 | + /** @var ILogger */ |
|
44 | + private $logger; |
|
45 | + |
|
46 | + /** @var IJobList */ |
|
47 | + private $jobList; |
|
48 | + |
|
49 | + /** @var ITimeFactory */ |
|
50 | + private $timeFactory; |
|
51 | + |
|
52 | + /** |
|
53 | + * @param IDBConnection $db |
|
54 | + * @param CalDavBackend $calDavBackend |
|
55 | + * @param ILogger $logger |
|
56 | + * @param IJobList $jobList |
|
57 | + * @param ITimeFactory $timeFactory |
|
58 | + */ |
|
59 | + public function __construct(IDBConnection $db, |
|
60 | + CalDavBackend $calDavBackend, |
|
61 | + ILogger $logger, |
|
62 | + IJobList $jobList, |
|
63 | + ITimeFactory $timeFactory) { |
|
64 | + $this->db = $db; |
|
65 | + $this->calDavBackend = $calDavBackend; |
|
66 | + $this->logger = $logger; |
|
67 | + $this->jobList = $jobList; |
|
68 | + $this->timeFactory = $timeFactory; |
|
69 | + } |
|
70 | + |
|
71 | + public function run($arguments) { |
|
72 | + $offset = (int) $arguments['offset']; |
|
73 | + $stopAt = (int) $arguments['stopAt']; |
|
74 | + |
|
75 | + $this->logger->info('Building calendar index (' . $offset .'/' . $stopAt . ')'); |
|
76 | + |
|
77 | + $startTime = $this->timeFactory->getTime(); |
|
78 | + while (($this->timeFactory->getTime() - $startTime) < 15) { |
|
79 | + $offset = $this->buildIndex($offset, $stopAt); |
|
80 | + if ($offset >= $stopAt) { |
|
81 | + break; |
|
82 | + } |
|
83 | + } |
|
84 | + |
|
85 | + if ($offset >= $stopAt) { |
|
86 | + $this->logger->info('Building calendar index done'); |
|
87 | + } else { |
|
88 | + $this->jobList->add(self::class, [ |
|
89 | + 'offset' => $offset, |
|
90 | + 'stopAt' => $stopAt |
|
91 | + ]); |
|
92 | + $this->logger->info('New building calendar index job scheduled with offset ' . $offset); |
|
93 | + } |
|
94 | + } |
|
95 | + |
|
96 | + /** |
|
97 | + * @param int $offset |
|
98 | + * @param int $stopAt |
|
99 | + * @return int |
|
100 | + */ |
|
101 | + private function buildIndex(int $offset, int $stopAt): int { |
|
102 | + $query = $this->db->getQueryBuilder(); |
|
103 | + $query->select(['id', 'calendarid', 'uri', 'calendardata']) |
|
104 | + ->from('calendarobjects') |
|
105 | + ->where($query->expr()->lte('id', $query->createNamedParameter($stopAt))) |
|
106 | + ->andWhere($query->expr()->gt('id', $query->createNamedParameter($offset))) |
|
107 | + ->orderBy('id', 'ASC') |
|
108 | + ->setMaxResults(500); |
|
109 | + |
|
110 | + $result = $query->execute(); |
|
111 | + while ($row = $result->fetch(\PDO::FETCH_ASSOC)) { |
|
112 | + $offset = $row['id']; |
|
113 | + |
|
114 | + $calendarData = $row['calendardata']; |
|
115 | + if (is_resource($calendarData)) { |
|
116 | + $calendarData = stream_get_contents($calendarData); |
|
117 | + } |
|
118 | + |
|
119 | + $this->calDavBackend->updateProperties($row['calendarid'], $row['uri'], $calendarData); |
|
120 | + } |
|
121 | + |
|
122 | + return $offset; |
|
123 | + } |
|
124 | 124 | } |