@@ -30,12 +30,12 @@ |
||
30 | 30 | */ |
31 | 31 | interface IReporter { |
32 | 32 | |
33 | - /** |
|
34 | - * Report an (unhandled) exception |
|
35 | - * |
|
36 | - * @since 13.0.0 |
|
37 | - * @param Exception|Throwable $exception |
|
38 | - * @param array $context |
|
39 | - */ |
|
40 | - public function report($exception, array $context = []); |
|
33 | + /** |
|
34 | + * Report an (unhandled) exception |
|
35 | + * |
|
36 | + * @since 13.0.0 |
|
37 | + * @param Exception|Throwable $exception |
|
38 | + * @param array $context |
|
39 | + */ |
|
40 | + public function report($exception, array $context = []); |
|
41 | 41 | } |
@@ -24,80 +24,80 @@ |
||
24 | 24 | |
25 | 25 | trait EmitterTrait { |
26 | 26 | |
27 | - /** |
|
28 | - * @var callable[][] $listeners |
|
29 | - */ |
|
30 | - protected $listeners = array(); |
|
27 | + /** |
|
28 | + * @var callable[][] $listeners |
|
29 | + */ |
|
30 | + protected $listeners = array(); |
|
31 | 31 | |
32 | - /** |
|
33 | - * @param string $scope |
|
34 | - * @param string $method |
|
35 | - * @param callable $callback |
|
36 | - */ |
|
37 | - public function listen($scope, $method, callable $callback) { |
|
38 | - $eventName = $scope . '::' . $method; |
|
39 | - if (!isset($this->listeners[$eventName])) { |
|
40 | - $this->listeners[$eventName] = array(); |
|
41 | - } |
|
42 | - if (array_search($callback, $this->listeners[$eventName], true) === false) { |
|
43 | - $this->listeners[$eventName][] = $callback; |
|
44 | - } |
|
45 | - } |
|
32 | + /** |
|
33 | + * @param string $scope |
|
34 | + * @param string $method |
|
35 | + * @param callable $callback |
|
36 | + */ |
|
37 | + public function listen($scope, $method, callable $callback) { |
|
38 | + $eventName = $scope . '::' . $method; |
|
39 | + if (!isset($this->listeners[$eventName])) { |
|
40 | + $this->listeners[$eventName] = array(); |
|
41 | + } |
|
42 | + if (array_search($callback, $this->listeners[$eventName], true) === false) { |
|
43 | + $this->listeners[$eventName][] = $callback; |
|
44 | + } |
|
45 | + } |
|
46 | 46 | |
47 | - /** |
|
48 | - * @param string $scope optional |
|
49 | - * @param string $method optional |
|
50 | - * @param callable $callback optional |
|
51 | - */ |
|
52 | - public function removeListener($scope = null, $method = null, callable $callback = null) { |
|
53 | - $names = array(); |
|
54 | - $allNames = array_keys($this->listeners); |
|
55 | - if ($scope and $method) { |
|
56 | - $name = $scope . '::' . $method; |
|
57 | - if (isset($this->listeners[$name])) { |
|
58 | - $names[] = $name; |
|
59 | - } |
|
60 | - } elseif ($scope) { |
|
61 | - foreach ($allNames as $name) { |
|
62 | - $parts = explode('::', $name, 2); |
|
63 | - if ($parts[0] == $scope) { |
|
64 | - $names[] = $name; |
|
65 | - } |
|
66 | - } |
|
67 | - } elseif ($method) { |
|
68 | - foreach ($allNames as $name) { |
|
69 | - $parts = explode('::', $name, 2); |
|
70 | - if ($parts[1] == $method) { |
|
71 | - $names[] = $name; |
|
72 | - } |
|
73 | - } |
|
74 | - } else { |
|
75 | - $names = $allNames; |
|
76 | - } |
|
47 | + /** |
|
48 | + * @param string $scope optional |
|
49 | + * @param string $method optional |
|
50 | + * @param callable $callback optional |
|
51 | + */ |
|
52 | + public function removeListener($scope = null, $method = null, callable $callback = null) { |
|
53 | + $names = array(); |
|
54 | + $allNames = array_keys($this->listeners); |
|
55 | + if ($scope and $method) { |
|
56 | + $name = $scope . '::' . $method; |
|
57 | + if (isset($this->listeners[$name])) { |
|
58 | + $names[] = $name; |
|
59 | + } |
|
60 | + } elseif ($scope) { |
|
61 | + foreach ($allNames as $name) { |
|
62 | + $parts = explode('::', $name, 2); |
|
63 | + if ($parts[0] == $scope) { |
|
64 | + $names[] = $name; |
|
65 | + } |
|
66 | + } |
|
67 | + } elseif ($method) { |
|
68 | + foreach ($allNames as $name) { |
|
69 | + $parts = explode('::', $name, 2); |
|
70 | + if ($parts[1] == $method) { |
|
71 | + $names[] = $name; |
|
72 | + } |
|
73 | + } |
|
74 | + } else { |
|
75 | + $names = $allNames; |
|
76 | + } |
|
77 | 77 | |
78 | - foreach ($names as $name) { |
|
79 | - if ($callback) { |
|
80 | - $index = array_search($callback, $this->listeners[$name], true); |
|
81 | - if ($index !== false) { |
|
82 | - unset($this->listeners[$name][$index]); |
|
83 | - } |
|
84 | - } else { |
|
85 | - $this->listeners[$name] = array(); |
|
86 | - } |
|
87 | - } |
|
88 | - } |
|
78 | + foreach ($names as $name) { |
|
79 | + if ($callback) { |
|
80 | + $index = array_search($callback, $this->listeners[$name], true); |
|
81 | + if ($index !== false) { |
|
82 | + unset($this->listeners[$name][$index]); |
|
83 | + } |
|
84 | + } else { |
|
85 | + $this->listeners[$name] = array(); |
|
86 | + } |
|
87 | + } |
|
88 | + } |
|
89 | 89 | |
90 | - /** |
|
91 | - * @param string $scope |
|
92 | - * @param string $method |
|
93 | - * @param array $arguments optional |
|
94 | - */ |
|
95 | - protected function emit($scope, $method, array $arguments = array()) { |
|
96 | - $eventName = $scope . '::' . $method; |
|
97 | - if (isset($this->listeners[$eventName])) { |
|
98 | - foreach ($this->listeners[$eventName] as $callback) { |
|
99 | - call_user_func_array($callback, $arguments); |
|
100 | - } |
|
101 | - } |
|
102 | - } |
|
90 | + /** |
|
91 | + * @param string $scope |
|
92 | + * @param string $method |
|
93 | + * @param array $arguments optional |
|
94 | + */ |
|
95 | + protected function emit($scope, $method, array $arguments = array()) { |
|
96 | + $eventName = $scope . '::' . $method; |
|
97 | + if (isset($this->listeners[$eventName])) { |
|
98 | + foreach ($this->listeners[$eventName] as $callback) { |
|
99 | + call_user_func_array($callback, $arguments); |
|
100 | + } |
|
101 | + } |
|
102 | + } |
|
103 | 103 | } |
@@ -40,186 +40,186 @@ |
||
40 | 40 | */ |
41 | 41 | class Defaults { |
42 | 42 | |
43 | - /** |
|
44 | - * \OC_Defaults instance to retrieve the defaults |
|
45 | - * @since 6.0.0 |
|
46 | - */ |
|
47 | - private $defaults; |
|
48 | - |
|
49 | - /** |
|
50 | - * creates a \OC_Defaults instance which is used in all methods to retrieve the |
|
51 | - * actual defaults |
|
52 | - * @since 6.0.0 |
|
53 | - */ |
|
54 | - public function __construct(\OC_Defaults $defaults = null) { |
|
55 | - if ($defaults === null) { |
|
56 | - $defaults = \OC::$server->getThemingDefaults(); |
|
57 | - } |
|
58 | - $this->defaults = $defaults; |
|
59 | - } |
|
60 | - |
|
61 | - /** |
|
62 | - * get base URL for the organisation behind your ownCloud instance |
|
63 | - * @return string |
|
64 | - * @since 6.0.0 |
|
65 | - */ |
|
66 | - public function getBaseUrl() { |
|
67 | - return $this->defaults->getBaseUrl(); |
|
68 | - } |
|
69 | - |
|
70 | - /** |
|
71 | - * link to the desktop sync client |
|
72 | - * @return string |
|
73 | - * @since 6.0.0 |
|
74 | - */ |
|
75 | - public function getSyncClientUrl() { |
|
76 | - return $this->defaults->getSyncClientUrl(); |
|
77 | - } |
|
78 | - |
|
79 | - /** |
|
80 | - * link to the iOS client |
|
81 | - * @return string |
|
82 | - * @since 8.0.0 |
|
83 | - */ |
|
84 | - public function getiOSClientUrl() { |
|
85 | - return $this->defaults->getiOSClientUrl(); |
|
86 | - } |
|
87 | - |
|
88 | - /** |
|
89 | - * link to the Android client |
|
90 | - * @return string |
|
91 | - * @since 8.0.0 |
|
92 | - */ |
|
93 | - public function getAndroidClientUrl() { |
|
94 | - return $this->defaults->getAndroidClientUrl(); |
|
95 | - } |
|
96 | - |
|
97 | - /** |
|
98 | - * base URL to the documentation of your ownCloud instance |
|
99 | - * @return string |
|
100 | - * @since 6.0.0 |
|
101 | - */ |
|
102 | - public function getDocBaseUrl() { |
|
103 | - return $this->defaults->getDocBaseUrl(); |
|
104 | - } |
|
105 | - |
|
106 | - /** |
|
107 | - * name of your ownCloud instance |
|
108 | - * @return string |
|
109 | - * @since 6.0.0 |
|
110 | - */ |
|
111 | - public function getName() { |
|
112 | - return $this->defaults->getName(); |
|
113 | - } |
|
114 | - |
|
115 | - /** |
|
116 | - * name of your ownCloud instance containing HTML styles |
|
117 | - * @return string |
|
118 | - * @since 8.0.0 |
|
119 | - */ |
|
120 | - public function getHTMLName() { |
|
121 | - return $this->defaults->getHTMLName(); |
|
122 | - } |
|
123 | - |
|
124 | - /** |
|
125 | - * Entity behind your onwCloud instance |
|
126 | - * @return string |
|
127 | - * @since 6.0.0 |
|
128 | - */ |
|
129 | - public function getEntity() { |
|
130 | - return $this->defaults->getEntity(); |
|
131 | - } |
|
132 | - |
|
133 | - /** |
|
134 | - * ownCloud slogan |
|
135 | - * @return string |
|
136 | - * @since 6.0.0 |
|
137 | - */ |
|
138 | - public function getSlogan() { |
|
139 | - return $this->defaults->getSlogan(); |
|
140 | - } |
|
141 | - |
|
142 | - /** |
|
143 | - * logo claim |
|
144 | - * @return string |
|
145 | - * @since 6.0.0 |
|
146 | - * @deprecated 13.0.0 |
|
147 | - */ |
|
148 | - public function getLogoClaim() { |
|
149 | - return ''; |
|
150 | - } |
|
151 | - |
|
152 | - /** |
|
153 | - * footer, short version |
|
154 | - * @return string |
|
155 | - * @since 6.0.0 |
|
156 | - */ |
|
157 | - public function getShortFooter() { |
|
158 | - return $this->defaults->getShortFooter(); |
|
159 | - } |
|
160 | - |
|
161 | - /** |
|
162 | - * footer, long version |
|
163 | - * @return string |
|
164 | - * @since 6.0.0 |
|
165 | - */ |
|
166 | - public function getLongFooter() { |
|
167 | - return $this->defaults->getLongFooter(); |
|
168 | - } |
|
169 | - |
|
170 | - /** |
|
171 | - * Returns the AppId for the App Store for the iOS Client |
|
172 | - * @return string AppId |
|
173 | - * @since 8.0.0 |
|
174 | - */ |
|
175 | - public function getiTunesAppId() { |
|
176 | - return $this->defaults->getiTunesAppId(); |
|
177 | - } |
|
178 | - |
|
179 | - /** |
|
180 | - * Themed logo url |
|
181 | - * |
|
182 | - * @param bool $useSvg Whether to point to the SVG image or a fallback |
|
183 | - * @return string |
|
184 | - * @since 12.0.0 |
|
185 | - */ |
|
186 | - public function getLogo($useSvg = true) { |
|
187 | - return $this->defaults->getLogo($useSvg); |
|
188 | - } |
|
189 | - |
|
190 | - /** |
|
191 | - * Returns primary color |
|
192 | - * @return string |
|
193 | - * @since 12.0.0 |
|
194 | - */ |
|
195 | - public function getColorPrimary() { |
|
196 | - return $this->defaults->getColorPrimary(); |
|
197 | - } |
|
198 | - |
|
199 | - /** |
|
200 | - * @param string $key |
|
201 | - * @return string URL to doc with key |
|
202 | - * @since 12.0.0 |
|
203 | - */ |
|
204 | - public function buildDocLinkToKey($key) { |
|
205 | - return $this->defaults->buildDocLinkToKey($key); |
|
206 | - } |
|
207 | - |
|
208 | - /** |
|
209 | - * Returns the title |
|
210 | - * @return string title |
|
211 | - * @since 12.0.0 |
|
212 | - */ |
|
213 | - public function getTitle() { |
|
214 | - return $this->defaults->getTitle(); |
|
215 | - } |
|
216 | - |
|
217 | - /** |
|
218 | - * Returns primary color |
|
219 | - * @return string |
|
220 | - * @since 13.0.0 |
|
221 | - */ |
|
222 | - public function getTextColorPrimary() { |
|
223 | - return $this->defaults->getTextColorPrimary(); |
|
224 | - } |
|
43 | + /** |
|
44 | + * \OC_Defaults instance to retrieve the defaults |
|
45 | + * @since 6.0.0 |
|
46 | + */ |
|
47 | + private $defaults; |
|
48 | + |
|
49 | + /** |
|
50 | + * creates a \OC_Defaults instance which is used in all methods to retrieve the |
|
51 | + * actual defaults |
|
52 | + * @since 6.0.0 |
|
53 | + */ |
|
54 | + public function __construct(\OC_Defaults $defaults = null) { |
|
55 | + if ($defaults === null) { |
|
56 | + $defaults = \OC::$server->getThemingDefaults(); |
|
57 | + } |
|
58 | + $this->defaults = $defaults; |
|
59 | + } |
|
60 | + |
|
61 | + /** |
|
62 | + * get base URL for the organisation behind your ownCloud instance |
|
63 | + * @return string |
|
64 | + * @since 6.0.0 |
|
65 | + */ |
|
66 | + public function getBaseUrl() { |
|
67 | + return $this->defaults->getBaseUrl(); |
|
68 | + } |
|
69 | + |
|
70 | + /** |
|
71 | + * link to the desktop sync client |
|
72 | + * @return string |
|
73 | + * @since 6.0.0 |
|
74 | + */ |
|
75 | + public function getSyncClientUrl() { |
|
76 | + return $this->defaults->getSyncClientUrl(); |
|
77 | + } |
|
78 | + |
|
79 | + /** |
|
80 | + * link to the iOS client |
|
81 | + * @return string |
|
82 | + * @since 8.0.0 |
|
83 | + */ |
|
84 | + public function getiOSClientUrl() { |
|
85 | + return $this->defaults->getiOSClientUrl(); |
|
86 | + } |
|
87 | + |
|
88 | + /** |
|
89 | + * link to the Android client |
|
90 | + * @return string |
|
91 | + * @since 8.0.0 |
|
92 | + */ |
|
93 | + public function getAndroidClientUrl() { |
|
94 | + return $this->defaults->getAndroidClientUrl(); |
|
95 | + } |
|
96 | + |
|
97 | + /** |
|
98 | + * base URL to the documentation of your ownCloud instance |
|
99 | + * @return string |
|
100 | + * @since 6.0.0 |
|
101 | + */ |
|
102 | + public function getDocBaseUrl() { |
|
103 | + return $this->defaults->getDocBaseUrl(); |
|
104 | + } |
|
105 | + |
|
106 | + /** |
|
107 | + * name of your ownCloud instance |
|
108 | + * @return string |
|
109 | + * @since 6.0.0 |
|
110 | + */ |
|
111 | + public function getName() { |
|
112 | + return $this->defaults->getName(); |
|
113 | + } |
|
114 | + |
|
115 | + /** |
|
116 | + * name of your ownCloud instance containing HTML styles |
|
117 | + * @return string |
|
118 | + * @since 8.0.0 |
|
119 | + */ |
|
120 | + public function getHTMLName() { |
|
121 | + return $this->defaults->getHTMLName(); |
|
122 | + } |
|
123 | + |
|
124 | + /** |
|
125 | + * Entity behind your onwCloud instance |
|
126 | + * @return string |
|
127 | + * @since 6.0.0 |
|
128 | + */ |
|
129 | + public function getEntity() { |
|
130 | + return $this->defaults->getEntity(); |
|
131 | + } |
|
132 | + |
|
133 | + /** |
|
134 | + * ownCloud slogan |
|
135 | + * @return string |
|
136 | + * @since 6.0.0 |
|
137 | + */ |
|
138 | + public function getSlogan() { |
|
139 | + return $this->defaults->getSlogan(); |
|
140 | + } |
|
141 | + |
|
142 | + /** |
|
143 | + * logo claim |
|
144 | + * @return string |
|
145 | + * @since 6.0.0 |
|
146 | + * @deprecated 13.0.0 |
|
147 | + */ |
|
148 | + public function getLogoClaim() { |
|
149 | + return ''; |
|
150 | + } |
|
151 | + |
|
152 | + /** |
|
153 | + * footer, short version |
|
154 | + * @return string |
|
155 | + * @since 6.0.0 |
|
156 | + */ |
|
157 | + public function getShortFooter() { |
|
158 | + return $this->defaults->getShortFooter(); |
|
159 | + } |
|
160 | + |
|
161 | + /** |
|
162 | + * footer, long version |
|
163 | + * @return string |
|
164 | + * @since 6.0.0 |
|
165 | + */ |
|
166 | + public function getLongFooter() { |
|
167 | + return $this->defaults->getLongFooter(); |
|
168 | + } |
|
169 | + |
|
170 | + /** |
|
171 | + * Returns the AppId for the App Store for the iOS Client |
|
172 | + * @return string AppId |
|
173 | + * @since 8.0.0 |
|
174 | + */ |
|
175 | + public function getiTunesAppId() { |
|
176 | + return $this->defaults->getiTunesAppId(); |
|
177 | + } |
|
178 | + |
|
179 | + /** |
|
180 | + * Themed logo url |
|
181 | + * |
|
182 | + * @param bool $useSvg Whether to point to the SVG image or a fallback |
|
183 | + * @return string |
|
184 | + * @since 12.0.0 |
|
185 | + */ |
|
186 | + public function getLogo($useSvg = true) { |
|
187 | + return $this->defaults->getLogo($useSvg); |
|
188 | + } |
|
189 | + |
|
190 | + /** |
|
191 | + * Returns primary color |
|
192 | + * @return string |
|
193 | + * @since 12.0.0 |
|
194 | + */ |
|
195 | + public function getColorPrimary() { |
|
196 | + return $this->defaults->getColorPrimary(); |
|
197 | + } |
|
198 | + |
|
199 | + /** |
|
200 | + * @param string $key |
|
201 | + * @return string URL to doc with key |
|
202 | + * @since 12.0.0 |
|
203 | + */ |
|
204 | + public function buildDocLinkToKey($key) { |
|
205 | + return $this->defaults->buildDocLinkToKey($key); |
|
206 | + } |
|
207 | + |
|
208 | + /** |
|
209 | + * Returns the title |
|
210 | + * @return string title |
|
211 | + * @since 12.0.0 |
|
212 | + */ |
|
213 | + public function getTitle() { |
|
214 | + return $this->defaults->getTitle(); |
|
215 | + } |
|
216 | + |
|
217 | + /** |
|
218 | + * Returns primary color |
|
219 | + * @return string |
|
220 | + * @since 13.0.0 |
|
221 | + */ |
|
222 | + public function getTextColorPrimary() { |
|
223 | + return $this->defaults->getTextColorPrimary(); |
|
224 | + } |
|
225 | 225 | } |
@@ -29,49 +29,49 @@ |
||
29 | 29 | |
30 | 30 | class CalendarManager { |
31 | 31 | |
32 | - /** @var CalDavBackend */ |
|
33 | - private $backend; |
|
32 | + /** @var CalDavBackend */ |
|
33 | + private $backend; |
|
34 | 34 | |
35 | - /** @var IL10N */ |
|
36 | - private $l10n; |
|
35 | + /** @var IL10N */ |
|
36 | + private $l10n; |
|
37 | 37 | |
38 | - /** @var IConfig */ |
|
39 | - private $config; |
|
38 | + /** @var IConfig */ |
|
39 | + private $config; |
|
40 | 40 | |
41 | - /** |
|
42 | - * CalendarManager constructor. |
|
43 | - * |
|
44 | - * @param CalDavBackend $backend |
|
45 | - * @param IL10N $l10n |
|
46 | - * @param IConfig $config |
|
47 | - */ |
|
48 | - public function __construct(CalDavBackend $backend, IL10N $l10n, IConfig $config) { |
|
49 | - $this->backend = $backend; |
|
50 | - $this->l10n = $l10n; |
|
51 | - $this->config = $config; |
|
52 | - } |
|
41 | + /** |
|
42 | + * CalendarManager constructor. |
|
43 | + * |
|
44 | + * @param CalDavBackend $backend |
|
45 | + * @param IL10N $l10n |
|
46 | + * @param IConfig $config |
|
47 | + */ |
|
48 | + public function __construct(CalDavBackend $backend, IL10N $l10n, IConfig $config) { |
|
49 | + $this->backend = $backend; |
|
50 | + $this->l10n = $l10n; |
|
51 | + $this->config = $config; |
|
52 | + } |
|
53 | 53 | |
54 | - /** |
|
55 | - * @param IManager $cm |
|
56 | - * @param string $userId |
|
57 | - */ |
|
58 | - public function setupCalendarProvider(IManager $cm, $userId) { |
|
59 | - $calendars = $this->backend->getCalendarsForUser("principals/users/$userId"); |
|
60 | - $this->register($cm, $calendars); |
|
61 | - } |
|
54 | + /** |
|
55 | + * @param IManager $cm |
|
56 | + * @param string $userId |
|
57 | + */ |
|
58 | + public function setupCalendarProvider(IManager $cm, $userId) { |
|
59 | + $calendars = $this->backend->getCalendarsForUser("principals/users/$userId"); |
|
60 | + $this->register($cm, $calendars); |
|
61 | + } |
|
62 | 62 | |
63 | - /** |
|
64 | - * @param IManager $cm |
|
65 | - * @param array $calendars |
|
66 | - */ |
|
67 | - private function register(IManager $cm, array $calendars) { |
|
68 | - foreach($calendars as $calendarInfo) { |
|
69 | - $calendar = new Calendar($this->backend, $calendarInfo, $this->l10n, $this->config); |
|
70 | - $cm->registerCalendar(new CalendarImpl( |
|
71 | - $calendar, |
|
72 | - $calendarInfo, |
|
73 | - $this->backend |
|
74 | - )); |
|
75 | - } |
|
76 | - } |
|
63 | + /** |
|
64 | + * @param IManager $cm |
|
65 | + * @param array $calendars |
|
66 | + */ |
|
67 | + private function register(IManager $cm, array $calendars) { |
|
68 | + foreach($calendars as $calendarInfo) { |
|
69 | + $calendar = new Calendar($this->backend, $calendarInfo, $this->l10n, $this->config); |
|
70 | + $cm->registerCalendar(new CalendarImpl( |
|
71 | + $calendar, |
|
72 | + $calendarInfo, |
|
73 | + $this->backend |
|
74 | + )); |
|
75 | + } |
|
76 | + } |
|
77 | 77 | } |
@@ -27,17 +27,17 @@ |
||
27 | 27 | * @since 13.0.0 |
28 | 28 | */ |
29 | 29 | interface ICachedMountFileInfo extends ICachedMountInfo { |
30 | - /** |
|
31 | - * Return the path for the file within the cached mount |
|
32 | - * |
|
33 | - * @return string |
|
34 | - * @since 13.0.0 |
|
35 | - */ |
|
36 | - public function getInternalPath(); |
|
30 | + /** |
|
31 | + * Return the path for the file within the cached mount |
|
32 | + * |
|
33 | + * @return string |
|
34 | + * @since 13.0.0 |
|
35 | + */ |
|
36 | + public function getInternalPath(); |
|
37 | 37 | |
38 | - /** |
|
39 | - * @return string |
|
40 | - * @since 13.0.0 |
|
41 | - */ |
|
42 | - public function getPath(); |
|
38 | + /** |
|
39 | + * @return string |
|
40 | + * @since 13.0.0 |
|
41 | + */ |
|
42 | + public function getPath(); |
|
43 | 43 | } |
@@ -32,33 +32,33 @@ |
||
32 | 32 | |
33 | 33 | class UpdateTheme extends UpdateJS { |
34 | 34 | |
35 | - /** @var IMimeTypeDetector */ |
|
36 | - protected $mimetypeDetector; |
|
35 | + /** @var IMimeTypeDetector */ |
|
36 | + protected $mimetypeDetector; |
|
37 | 37 | |
38 | - /** @var ICacheFactory */ |
|
39 | - protected $cacheFactory; |
|
38 | + /** @var ICacheFactory */ |
|
39 | + protected $cacheFactory; |
|
40 | 40 | |
41 | - public function __construct( |
|
42 | - IMimeTypeDetector $mimetypeDetector, |
|
43 | - ICacheFactory $cacheFactory |
|
44 | - ) { |
|
45 | - parent::__construct($mimetypeDetector); |
|
46 | - $this->cacheFactory = $cacheFactory; |
|
47 | - } |
|
41 | + public function __construct( |
|
42 | + IMimeTypeDetector $mimetypeDetector, |
|
43 | + ICacheFactory $cacheFactory |
|
44 | + ) { |
|
45 | + parent::__construct($mimetypeDetector); |
|
46 | + $this->cacheFactory = $cacheFactory; |
|
47 | + } |
|
48 | 48 | |
49 | - protected function configure() { |
|
50 | - $this |
|
51 | - ->setName('maintenance:theme:update') |
|
52 | - ->setDescription('Apply custom theme changes'); |
|
53 | - } |
|
49 | + protected function configure() { |
|
50 | + $this |
|
51 | + ->setName('maintenance:theme:update') |
|
52 | + ->setDescription('Apply custom theme changes'); |
|
53 | + } |
|
54 | 54 | |
55 | - protected function execute(InputInterface $input, OutputInterface $output) { |
|
56 | - // run mimetypelist.js update since themes might change mimetype icons |
|
57 | - parent::execute($input, $output); |
|
55 | + protected function execute(InputInterface $input, OutputInterface $output) { |
|
56 | + // run mimetypelist.js update since themes might change mimetype icons |
|
57 | + parent::execute($input, $output); |
|
58 | 58 | |
59 | - // cleanup image cache |
|
60 | - $c = $this->cacheFactory->createDistributed('imagePath'); |
|
61 | - $c->clear(''); |
|
62 | - $output->writeln('<info>Image cache cleared'); |
|
63 | - } |
|
59 | + // cleanup image cache |
|
60 | + $c = $this->cacheFactory->createDistributed('imagePath'); |
|
61 | + $c->clear(''); |
|
62 | + $output->writeln('<info>Image cache cleared'); |
|
63 | + } |
|
64 | 64 | } |
@@ -23,8 +23,8 @@ discard block |
||
23 | 23 | require '../../../../3rdparty/autoload.php'; |
24 | 24 | |
25 | 25 | if ($argc !== 6) { |
26 | - echo "Invalid number of arguments" . PHP_EOL; |
|
27 | - exit; |
|
26 | + echo "Invalid number of arguments" . PHP_EOL; |
|
27 | + exit; |
|
28 | 28 | } |
29 | 29 | |
30 | 30 | /** |
@@ -33,15 +33,15 @@ discard block |
||
33 | 33 | * @return mixed |
34 | 34 | */ |
35 | 35 | function request($client, $method, $uploadUrl, $data = null, $headers = []) { |
36 | - echo "$method $uploadUrl ... "; |
|
37 | - $t0 = microtime(true); |
|
38 | - $result = $client->request($method, $uploadUrl, $data, $headers); |
|
39 | - $t1 = microtime(true); |
|
40 | - echo $result['statusCode'] . " - " . ($t1 - $t0) . ' seconds' . PHP_EOL; |
|
41 | - if (!in_array($result['statusCode'], [200, 201])) { |
|
42 | - echo $result['body'] . PHP_EOL; |
|
43 | - } |
|
44 | - return $result; |
|
36 | + echo "$method $uploadUrl ... "; |
|
37 | + $t0 = microtime(true); |
|
38 | + $result = $client->request($method, $uploadUrl, $data, $headers); |
|
39 | + $t1 = microtime(true); |
|
40 | + echo $result['statusCode'] . " - " . ($t1 - $t0) . ' seconds' . PHP_EOL; |
|
41 | + if (!in_array($result['statusCode'], [200, 201])) { |
|
42 | + echo $result['body'] . PHP_EOL; |
|
43 | + } |
|
44 | + return $result; |
|
45 | 45 | } |
46 | 46 | |
47 | 47 | $baseUri = $argv[1]; |
@@ -51,9 +51,9 @@ discard block |
||
51 | 51 | $chunkSize = $argv[5] * 1024 * 1024; |
52 | 52 | |
53 | 53 | $client = new \Sabre\DAV\Client([ |
54 | - 'baseUri' => $baseUri, |
|
55 | - 'userName' => $userName, |
|
56 | - 'password' => $password |
|
54 | + 'baseUri' => $baseUri, |
|
55 | + 'userName' => $userName, |
|
56 | + 'password' => $password |
|
57 | 57 | ]); |
58 | 58 | |
59 | 59 | $transfer = uniqid('transfer', true); |
@@ -66,14 +66,14 @@ discard block |
||
66 | 66 | |
67 | 67 | $index = 0; |
68 | 68 | while(!feof($stream)) { |
69 | - request($client, 'PUT', "$uploadUrl/$index", fread($stream, $chunkSize)); |
|
70 | - $index++; |
|
69 | + request($client, 'PUT', "$uploadUrl/$index", fread($stream, $chunkSize)); |
|
70 | + $index++; |
|
71 | 71 | } |
72 | 72 | |
73 | 73 | $destination = pathinfo($file, PATHINFO_BASENAME); |
74 | 74 | //echo "Moving $uploadUrl/.file to it's final destination $baseUri/files/$userName/$destination" . PHP_EOL; |
75 | 75 | request($client, 'MOVE', "$uploadUrl/.file", null, [ |
76 | - 'Destination' => "$baseUri/files/$userName/$destination", |
|
77 | - 'OC-Total-Length' => filesize($file), |
|
78 | - 'X-OC-MTime' => filemtime($file) |
|
76 | + 'Destination' => "$baseUri/files/$userName/$destination", |
|
77 | + 'OC-Total-Length' => filesize($file), |
|
78 | + 'X-OC-MTime' => filemtime($file) |
|
79 | 79 | ]); |
@@ -14,191 +14,191 @@ |
||
14 | 14 | */ |
15 | 15 | class S3Signature implements SignatureInterface |
16 | 16 | { |
17 | - /** @var array Query string values that must be signed */ |
|
18 | - private $signableQueryString = [ |
|
19 | - 'acl', 'cors', 'delete', 'lifecycle', 'location', 'logging', |
|
20 | - 'notification', 'partNumber', 'policy', 'requestPayment', |
|
21 | - 'response-cache-control', 'response-content-disposition', |
|
22 | - 'response-content-encoding', 'response-content-language', |
|
23 | - 'response-content-type', 'response-expires', 'restore', 'tagging', |
|
24 | - 'torrent', 'uploadId', 'uploads', 'versionId', 'versioning', |
|
25 | - 'versions', 'website' |
|
26 | - ]; |
|
27 | - |
|
28 | - /** @var array Sorted headers that must be signed */ |
|
29 | - private $signableHeaders = ['Content-MD5', 'Content-Type']; |
|
30 | - |
|
31 | - /** @var \Aws\S3\S3UriParser S3 URI parser */ |
|
32 | - private $parser; |
|
33 | - |
|
34 | - public function __construct() |
|
35 | - { |
|
36 | - $this->parser = new S3UriParser(); |
|
37 | - // Ensure that the signable query string parameters are sorted |
|
38 | - sort($this->signableQueryString); |
|
39 | - } |
|
40 | - |
|
41 | - public function signRequest( |
|
42 | - RequestInterface $request, |
|
43 | - CredentialsInterface $credentials |
|
44 | - ) { |
|
45 | - $request = $this->prepareRequest($request, $credentials); |
|
46 | - $stringToSign = $this->createCanonicalizedString($request); |
|
47 | - $auth = 'AWS ' |
|
48 | - . $credentials->getAccessKeyId() . ':' |
|
49 | - . $this->signString($stringToSign, $credentials); |
|
50 | - |
|
51 | - return $request->withHeader('Authorization', $auth); |
|
52 | - } |
|
53 | - |
|
54 | - public function presign( |
|
55 | - RequestInterface $request, |
|
56 | - CredentialsInterface $credentials, |
|
57 | - $expires |
|
58 | - ) { |
|
59 | - $query = []; |
|
60 | - // URL encoding already occurs in the URI template expansion. Undo that |
|
61 | - // and encode using the same encoding as GET object, PUT object, etc. |
|
62 | - $uri = $request->getUri(); |
|
63 | - $path = S3Client::encodeKey(rawurldecode($uri->getPath())); |
|
64 | - $request = $request->withUri($uri->withPath($path)); |
|
65 | - |
|
66 | - // Make sure to handle temporary credentials |
|
67 | - if ($token = $credentials->getSecurityToken()) { |
|
68 | - $request = $request->withHeader('X-Amz-Security-Token', $token); |
|
69 | - $query['X-Amz-Security-Token'] = $token; |
|
70 | - } |
|
71 | - |
|
72 | - if ($expires instanceof \DateTime) { |
|
73 | - $expires = $expires->getTimestamp(); |
|
74 | - } elseif (!is_numeric($expires)) { |
|
75 | - $expires = strtotime($expires); |
|
76 | - } |
|
77 | - |
|
78 | - // Set query params required for pre-signed URLs |
|
79 | - $query['AWSAccessKeyId'] = $credentials->getAccessKeyId(); |
|
80 | - $query['Expires'] = $expires; |
|
81 | - $query['Signature'] = $this->signString( |
|
82 | - $this->createCanonicalizedString($request, $expires), |
|
83 | - $credentials |
|
84 | - ); |
|
85 | - |
|
86 | - // Move X-Amz-* headers to the query string |
|
87 | - foreach ($request->getHeaders() as $name => $header) { |
|
88 | - $name = strtolower($name); |
|
89 | - if (strpos($name, 'x-amz-') === 0) { |
|
90 | - $query[$name] = implode(',', $header); |
|
91 | - } |
|
92 | - } |
|
93 | - |
|
94 | - $queryString = http_build_query($query, null, '&', PHP_QUERY_RFC3986); |
|
95 | - |
|
96 | - return $request->withUri($request->getUri()->withQuery($queryString)); |
|
97 | - } |
|
98 | - |
|
99 | - /** |
|
100 | - * @param RequestInterface $request |
|
101 | - * @param CredentialsInterface $creds |
|
102 | - * |
|
103 | - * @return RequestInterface |
|
104 | - */ |
|
105 | - private function prepareRequest( |
|
106 | - RequestInterface $request, |
|
107 | - CredentialsInterface $creds |
|
108 | - ) { |
|
109 | - $modify = [ |
|
110 | - 'remove_headers' => ['X-Amz-Date'], |
|
111 | - 'set_headers' => ['Date' => gmdate(\DateTime::RFC2822)] |
|
112 | - ]; |
|
113 | - |
|
114 | - // Add the security token header if one is being used by the credentials |
|
115 | - if ($token = $creds->getSecurityToken()) { |
|
116 | - $modify['set_headers']['X-Amz-Security-Token'] = $token; |
|
117 | - } |
|
118 | - |
|
119 | - return Psr7\modify_request($request, $modify); |
|
120 | - } |
|
121 | - |
|
122 | - private function signString($string, CredentialsInterface $credentials) |
|
123 | - { |
|
124 | - return base64_encode( |
|
125 | - hash_hmac('sha1', $string, $credentials->getSecretKey(), true) |
|
126 | - ); |
|
127 | - } |
|
128 | - |
|
129 | - private function createCanonicalizedString( |
|
130 | - RequestInterface $request, |
|
131 | - $expires = null |
|
132 | - ) { |
|
133 | - $buffer = $request->getMethod() . "\n"; |
|
134 | - |
|
135 | - // Add the interesting headers |
|
136 | - foreach ($this->signableHeaders as $header) { |
|
137 | - $buffer .= $request->getHeaderLine($header) . "\n"; |
|
138 | - } |
|
139 | - |
|
140 | - $date = $expires ?: $request->getHeaderLine('date'); |
|
141 | - $buffer .= "{$date}\n" |
|
142 | - . $this->createCanonicalizedAmzHeaders($request) |
|
143 | - . $this->createCanonicalizedResource($request); |
|
144 | - |
|
145 | - return $buffer; |
|
146 | - } |
|
147 | - |
|
148 | - private function createCanonicalizedAmzHeaders(RequestInterface $request) |
|
149 | - { |
|
150 | - $headers = []; |
|
151 | - foreach ($request->getHeaders() as $name => $header) { |
|
152 | - $name = strtolower($name); |
|
153 | - if (strpos($name, 'x-amz-') === 0) { |
|
154 | - $value = implode(',', $header); |
|
155 | - if (strlen($value) > 0) { |
|
156 | - $headers[$name] = $name . ':' . $value; |
|
157 | - } |
|
158 | - } |
|
159 | - } |
|
160 | - |
|
161 | - if (!$headers) { |
|
162 | - return ''; |
|
163 | - } |
|
164 | - |
|
165 | - ksort($headers); |
|
166 | - |
|
167 | - return implode("\n", $headers) . "\n"; |
|
168 | - } |
|
169 | - |
|
170 | - private function createCanonicalizedResource(RequestInterface $request) |
|
171 | - { |
|
172 | - $data = $this->parser->parse($request->getUri()); |
|
173 | - $buffer = '/'; |
|
174 | - |
|
175 | - if ($data['bucket']) { |
|
176 | - $buffer .= $data['bucket']; |
|
177 | - if (!empty($data['key']) || !$data['path_style']) { |
|
178 | - $buffer .= '/' . $data['key']; |
|
179 | - } |
|
180 | - } |
|
181 | - |
|
182 | - // Add sub resource parameters if present. |
|
183 | - $query = $request->getUri()->getQuery(); |
|
184 | - |
|
185 | - if ($query) { |
|
186 | - $params = Psr7\parse_query($query); |
|
187 | - $first = true; |
|
188 | - foreach ($this->signableQueryString as $key) { |
|
189 | - if (array_key_exists($key, $params)) { |
|
190 | - $value = $params[$key]; |
|
191 | - $buffer .= $first ? '?' : '&'; |
|
192 | - $first = false; |
|
193 | - $buffer .= $key; |
|
194 | - // Don't add values for empty sub-resources |
|
195 | - if (strlen($value)) { |
|
196 | - $buffer .= "={$value}"; |
|
197 | - } |
|
198 | - } |
|
199 | - } |
|
200 | - } |
|
201 | - |
|
202 | - return $buffer; |
|
203 | - } |
|
17 | + /** @var array Query string values that must be signed */ |
|
18 | + private $signableQueryString = [ |
|
19 | + 'acl', 'cors', 'delete', 'lifecycle', 'location', 'logging', |
|
20 | + 'notification', 'partNumber', 'policy', 'requestPayment', |
|
21 | + 'response-cache-control', 'response-content-disposition', |
|
22 | + 'response-content-encoding', 'response-content-language', |
|
23 | + 'response-content-type', 'response-expires', 'restore', 'tagging', |
|
24 | + 'torrent', 'uploadId', 'uploads', 'versionId', 'versioning', |
|
25 | + 'versions', 'website' |
|
26 | + ]; |
|
27 | + |
|
28 | + /** @var array Sorted headers that must be signed */ |
|
29 | + private $signableHeaders = ['Content-MD5', 'Content-Type']; |
|
30 | + |
|
31 | + /** @var \Aws\S3\S3UriParser S3 URI parser */ |
|
32 | + private $parser; |
|
33 | + |
|
34 | + public function __construct() |
|
35 | + { |
|
36 | + $this->parser = new S3UriParser(); |
|
37 | + // Ensure that the signable query string parameters are sorted |
|
38 | + sort($this->signableQueryString); |
|
39 | + } |
|
40 | + |
|
41 | + public function signRequest( |
|
42 | + RequestInterface $request, |
|
43 | + CredentialsInterface $credentials |
|
44 | + ) { |
|
45 | + $request = $this->prepareRequest($request, $credentials); |
|
46 | + $stringToSign = $this->createCanonicalizedString($request); |
|
47 | + $auth = 'AWS ' |
|
48 | + . $credentials->getAccessKeyId() . ':' |
|
49 | + . $this->signString($stringToSign, $credentials); |
|
50 | + |
|
51 | + return $request->withHeader('Authorization', $auth); |
|
52 | + } |
|
53 | + |
|
54 | + public function presign( |
|
55 | + RequestInterface $request, |
|
56 | + CredentialsInterface $credentials, |
|
57 | + $expires |
|
58 | + ) { |
|
59 | + $query = []; |
|
60 | + // URL encoding already occurs in the URI template expansion. Undo that |
|
61 | + // and encode using the same encoding as GET object, PUT object, etc. |
|
62 | + $uri = $request->getUri(); |
|
63 | + $path = S3Client::encodeKey(rawurldecode($uri->getPath())); |
|
64 | + $request = $request->withUri($uri->withPath($path)); |
|
65 | + |
|
66 | + // Make sure to handle temporary credentials |
|
67 | + if ($token = $credentials->getSecurityToken()) { |
|
68 | + $request = $request->withHeader('X-Amz-Security-Token', $token); |
|
69 | + $query['X-Amz-Security-Token'] = $token; |
|
70 | + } |
|
71 | + |
|
72 | + if ($expires instanceof \DateTime) { |
|
73 | + $expires = $expires->getTimestamp(); |
|
74 | + } elseif (!is_numeric($expires)) { |
|
75 | + $expires = strtotime($expires); |
|
76 | + } |
|
77 | + |
|
78 | + // Set query params required for pre-signed URLs |
|
79 | + $query['AWSAccessKeyId'] = $credentials->getAccessKeyId(); |
|
80 | + $query['Expires'] = $expires; |
|
81 | + $query['Signature'] = $this->signString( |
|
82 | + $this->createCanonicalizedString($request, $expires), |
|
83 | + $credentials |
|
84 | + ); |
|
85 | + |
|
86 | + // Move X-Amz-* headers to the query string |
|
87 | + foreach ($request->getHeaders() as $name => $header) { |
|
88 | + $name = strtolower($name); |
|
89 | + if (strpos($name, 'x-amz-') === 0) { |
|
90 | + $query[$name] = implode(',', $header); |
|
91 | + } |
|
92 | + } |
|
93 | + |
|
94 | + $queryString = http_build_query($query, null, '&', PHP_QUERY_RFC3986); |
|
95 | + |
|
96 | + return $request->withUri($request->getUri()->withQuery($queryString)); |
|
97 | + } |
|
98 | + |
|
99 | + /** |
|
100 | + * @param RequestInterface $request |
|
101 | + * @param CredentialsInterface $creds |
|
102 | + * |
|
103 | + * @return RequestInterface |
|
104 | + */ |
|
105 | + private function prepareRequest( |
|
106 | + RequestInterface $request, |
|
107 | + CredentialsInterface $creds |
|
108 | + ) { |
|
109 | + $modify = [ |
|
110 | + 'remove_headers' => ['X-Amz-Date'], |
|
111 | + 'set_headers' => ['Date' => gmdate(\DateTime::RFC2822)] |
|
112 | + ]; |
|
113 | + |
|
114 | + // Add the security token header if one is being used by the credentials |
|
115 | + if ($token = $creds->getSecurityToken()) { |
|
116 | + $modify['set_headers']['X-Amz-Security-Token'] = $token; |
|
117 | + } |
|
118 | + |
|
119 | + return Psr7\modify_request($request, $modify); |
|
120 | + } |
|
121 | + |
|
122 | + private function signString($string, CredentialsInterface $credentials) |
|
123 | + { |
|
124 | + return base64_encode( |
|
125 | + hash_hmac('sha1', $string, $credentials->getSecretKey(), true) |
|
126 | + ); |
|
127 | + } |
|
128 | + |
|
129 | + private function createCanonicalizedString( |
|
130 | + RequestInterface $request, |
|
131 | + $expires = null |
|
132 | + ) { |
|
133 | + $buffer = $request->getMethod() . "\n"; |
|
134 | + |
|
135 | + // Add the interesting headers |
|
136 | + foreach ($this->signableHeaders as $header) { |
|
137 | + $buffer .= $request->getHeaderLine($header) . "\n"; |
|
138 | + } |
|
139 | + |
|
140 | + $date = $expires ?: $request->getHeaderLine('date'); |
|
141 | + $buffer .= "{$date}\n" |
|
142 | + . $this->createCanonicalizedAmzHeaders($request) |
|
143 | + . $this->createCanonicalizedResource($request); |
|
144 | + |
|
145 | + return $buffer; |
|
146 | + } |
|
147 | + |
|
148 | + private function createCanonicalizedAmzHeaders(RequestInterface $request) |
|
149 | + { |
|
150 | + $headers = []; |
|
151 | + foreach ($request->getHeaders() as $name => $header) { |
|
152 | + $name = strtolower($name); |
|
153 | + if (strpos($name, 'x-amz-') === 0) { |
|
154 | + $value = implode(',', $header); |
|
155 | + if (strlen($value) > 0) { |
|
156 | + $headers[$name] = $name . ':' . $value; |
|
157 | + } |
|
158 | + } |
|
159 | + } |
|
160 | + |
|
161 | + if (!$headers) { |
|
162 | + return ''; |
|
163 | + } |
|
164 | + |
|
165 | + ksort($headers); |
|
166 | + |
|
167 | + return implode("\n", $headers) . "\n"; |
|
168 | + } |
|
169 | + |
|
170 | + private function createCanonicalizedResource(RequestInterface $request) |
|
171 | + { |
|
172 | + $data = $this->parser->parse($request->getUri()); |
|
173 | + $buffer = '/'; |
|
174 | + |
|
175 | + if ($data['bucket']) { |
|
176 | + $buffer .= $data['bucket']; |
|
177 | + if (!empty($data['key']) || !$data['path_style']) { |
|
178 | + $buffer .= '/' . $data['key']; |
|
179 | + } |
|
180 | + } |
|
181 | + |
|
182 | + // Add sub resource parameters if present. |
|
183 | + $query = $request->getUri()->getQuery(); |
|
184 | + |
|
185 | + if ($query) { |
|
186 | + $params = Psr7\parse_query($query); |
|
187 | + $first = true; |
|
188 | + foreach ($this->signableQueryString as $key) { |
|
189 | + if (array_key_exists($key, $params)) { |
|
190 | + $value = $params[$key]; |
|
191 | + $buffer .= $first ? '?' : '&'; |
|
192 | + $first = false; |
|
193 | + $buffer .= $key; |
|
194 | + // Don't add values for empty sub-resources |
|
195 | + if (strlen($value)) { |
|
196 | + $buffer .= "={$value}"; |
|
197 | + } |
|
198 | + } |
|
199 | + } |
|
200 | + } |
|
201 | + |
|
202 | + return $buffer; |
|
203 | + } |
|
204 | 204 | } |
@@ -25,14 +25,14 @@ |
||
25 | 25 | |
26 | 26 | |
27 | 27 | class SqliteExpressionBuilder extends ExpressionBuilder { |
28 | - /** |
|
29 | - * @inheritdoc |
|
30 | - */ |
|
31 | - public function like($x, $y, $type = null) { |
|
32 | - return parent::like($x, $y, $type) . " ESCAPE '\\'"; |
|
33 | - } |
|
28 | + /** |
|
29 | + * @inheritdoc |
|
30 | + */ |
|
31 | + public function like($x, $y, $type = null) { |
|
32 | + return parent::like($x, $y, $type) . " ESCAPE '\\'"; |
|
33 | + } |
|
34 | 34 | |
35 | - public function iLike($x, $y, $type = null) { |
|
36 | - return $this->like($this->functionBuilder->lower($x), $this->functionBuilder->lower($y), $type); |
|
37 | - } |
|
35 | + public function iLike($x, $y, $type = null) { |
|
36 | + return $this->like($this->functionBuilder->lower($x), $this->functionBuilder->lower($y), $type); |
|
37 | + } |
|
38 | 38 | } |