@@ -34,98 +34,98 @@ |
||
34 | 34 | * @since 8.0.0 |
35 | 35 | */ |
36 | 36 | class Template extends \OC_Template { |
37 | - /** |
|
38 | - * Make OC_Helper::imagePath available as a simple function |
|
39 | - * |
|
40 | - * @see \OCP\IURLGenerator::imagePath |
|
41 | - * |
|
42 | - * @param string $app |
|
43 | - * @param string $image |
|
44 | - * @return string to the image |
|
45 | - * @since 8.0.0 |
|
46 | - * @suppress PhanDeprecatedFunction |
|
47 | - */ |
|
48 | - public static function image_path($app, $image) { |
|
49 | - return \image_path($app, $image); |
|
50 | - } |
|
37 | + /** |
|
38 | + * Make OC_Helper::imagePath available as a simple function |
|
39 | + * |
|
40 | + * @see \OCP\IURLGenerator::imagePath |
|
41 | + * |
|
42 | + * @param string $app |
|
43 | + * @param string $image |
|
44 | + * @return string to the image |
|
45 | + * @since 8.0.0 |
|
46 | + * @suppress PhanDeprecatedFunction |
|
47 | + */ |
|
48 | + public static function image_path($app, $image) { |
|
49 | + return \image_path($app, $image); |
|
50 | + } |
|
51 | 51 | |
52 | 52 | |
53 | - /** |
|
54 | - * Make OC_Helper::mimetypeIcon available as a simple function |
|
55 | - * |
|
56 | - * @param string $mimetype |
|
57 | - * @return string to the image of this file type. |
|
58 | - * @since 8.0.0 |
|
59 | - * @suppress PhanDeprecatedFunction |
|
60 | - */ |
|
61 | - public static function mimetype_icon($mimetype) { |
|
62 | - return \mimetype_icon($mimetype); |
|
63 | - } |
|
53 | + /** |
|
54 | + * Make OC_Helper::mimetypeIcon available as a simple function |
|
55 | + * |
|
56 | + * @param string $mimetype |
|
57 | + * @return string to the image of this file type. |
|
58 | + * @since 8.0.0 |
|
59 | + * @suppress PhanDeprecatedFunction |
|
60 | + */ |
|
61 | + public static function mimetype_icon($mimetype) { |
|
62 | + return \mimetype_icon($mimetype); |
|
63 | + } |
|
64 | 64 | |
65 | - /** |
|
66 | - * Make preview_icon available as a simple function |
|
67 | - * |
|
68 | - * @param string $path path to file |
|
69 | - * @return string to the preview of the image |
|
70 | - * @since 8.0.0 |
|
71 | - * @suppress PhanDeprecatedFunction |
|
72 | - */ |
|
73 | - public static function preview_icon($path) { |
|
74 | - return \preview_icon($path); |
|
75 | - } |
|
65 | + /** |
|
66 | + * Make preview_icon available as a simple function |
|
67 | + * |
|
68 | + * @param string $path path to file |
|
69 | + * @return string to the preview of the image |
|
70 | + * @since 8.0.0 |
|
71 | + * @suppress PhanDeprecatedFunction |
|
72 | + */ |
|
73 | + public static function preview_icon($path) { |
|
74 | + return \preview_icon($path); |
|
75 | + } |
|
76 | 76 | |
77 | - /** |
|
78 | - * Make publicpreview_icon available as a simple function |
|
79 | - * Returns the path to the preview of the image. |
|
80 | - * |
|
81 | - * @param string $path of file |
|
82 | - * @param string $token |
|
83 | - * @return string link to the preview |
|
84 | - * @since 8.0.0 |
|
85 | - * @suppress PhanDeprecatedFunction |
|
86 | - */ |
|
87 | - public static function publicPreview_icon($path, $token) { |
|
88 | - return \publicPreview_icon($path, $token); |
|
89 | - } |
|
77 | + /** |
|
78 | + * Make publicpreview_icon available as a simple function |
|
79 | + * Returns the path to the preview of the image. |
|
80 | + * |
|
81 | + * @param string $path of file |
|
82 | + * @param string $token |
|
83 | + * @return string link to the preview |
|
84 | + * @since 8.0.0 |
|
85 | + * @suppress PhanDeprecatedFunction |
|
86 | + */ |
|
87 | + public static function publicPreview_icon($path, $token) { |
|
88 | + return \publicPreview_icon($path, $token); |
|
89 | + } |
|
90 | 90 | |
91 | - /** |
|
92 | - * Make OC_Helper::humanFileSize available as a simple function |
|
93 | - * Example: 2048 to 2 kB. |
|
94 | - * |
|
95 | - * @param int $bytes in bytes |
|
96 | - * @return string size as string |
|
97 | - * @since 8.0.0 |
|
98 | - * @suppress PhanDeprecatedFunction |
|
99 | - */ |
|
100 | - public static function human_file_size($bytes) { |
|
101 | - return \human_file_size($bytes); |
|
102 | - } |
|
91 | + /** |
|
92 | + * Make OC_Helper::humanFileSize available as a simple function |
|
93 | + * Example: 2048 to 2 kB. |
|
94 | + * |
|
95 | + * @param int $bytes in bytes |
|
96 | + * @return string size as string |
|
97 | + * @since 8.0.0 |
|
98 | + * @suppress PhanDeprecatedFunction |
|
99 | + */ |
|
100 | + public static function human_file_size($bytes) { |
|
101 | + return \human_file_size($bytes); |
|
102 | + } |
|
103 | 103 | |
104 | - /** |
|
105 | - * Return the relative date in relation to today. Returns something like "last hour" or "two month ago" |
|
106 | - * |
|
107 | - * @param int $timestamp unix timestamp |
|
108 | - * @param boolean $dateOnly |
|
109 | - * @return string human readable interpretation of the timestamp |
|
110 | - * @since 8.0.0 |
|
111 | - * @suppress PhanDeprecatedFunction |
|
112 | - * @suppress PhanTypeMismatchArgument |
|
113 | - */ |
|
114 | - public static function relative_modified_date($timestamp, $dateOnly = false) { |
|
115 | - return \relative_modified_date($timestamp, null, $dateOnly); |
|
116 | - } |
|
104 | + /** |
|
105 | + * Return the relative date in relation to today. Returns something like "last hour" or "two month ago" |
|
106 | + * |
|
107 | + * @param int $timestamp unix timestamp |
|
108 | + * @param boolean $dateOnly |
|
109 | + * @return string human readable interpretation of the timestamp |
|
110 | + * @since 8.0.0 |
|
111 | + * @suppress PhanDeprecatedFunction |
|
112 | + * @suppress PhanTypeMismatchArgument |
|
113 | + */ |
|
114 | + public static function relative_modified_date($timestamp, $dateOnly = false) { |
|
115 | + return \relative_modified_date($timestamp, null, $dateOnly); |
|
116 | + } |
|
117 | 117 | |
118 | - /** |
|
119 | - * Generate html code for an options block. |
|
120 | - * |
|
121 | - * @param array $options the options |
|
122 | - * @param mixed $selected which one is selected? |
|
123 | - * @param array $params the parameters |
|
124 | - * @return string html options |
|
125 | - * @since 8.0.0 |
|
126 | - * @suppress PhanDeprecatedFunction |
|
127 | - */ |
|
128 | - public static function html_select_options($options, $selected, $params = []) { |
|
129 | - return \html_select_options($options, $selected, $params); |
|
130 | - } |
|
118 | + /** |
|
119 | + * Generate html code for an options block. |
|
120 | + * |
|
121 | + * @param array $options the options |
|
122 | + * @param mixed $selected which one is selected? |
|
123 | + * @param array $params the parameters |
|
124 | + * @return string html options |
|
125 | + * @since 8.0.0 |
|
126 | + * @suppress PhanDeprecatedFunction |
|
127 | + */ |
|
128 | + public static function html_select_options($options, $selected, $params = []) { |
|
129 | + return \html_select_options($options, $selected, $params); |
|
130 | + } |
|
131 | 131 | } |
@@ -41,149 +41,149 @@ |
||
41 | 41 | * @deprecated 20.0.0 use the PSR-3 logger \Psr\Log\LoggerInterface |
42 | 42 | */ |
43 | 43 | interface ILogger { |
44 | - /** |
|
45 | - * @since 14.0.0 |
|
46 | - * @deprecated 20.0.0 |
|
47 | - */ |
|
48 | - public const DEBUG = 0; |
|
49 | - /** |
|
50 | - * @since 14.0.0 |
|
51 | - * @deprecated 20.0.0 |
|
52 | - */ |
|
53 | - public const INFO = 1; |
|
54 | - /** |
|
55 | - * @since 14.0.0 |
|
56 | - * @deprecated 20.0.0 |
|
57 | - */ |
|
58 | - public const WARN = 2; |
|
59 | - /** |
|
60 | - * @since 14.0.0 |
|
61 | - * @deprecated 20.0.0 |
|
62 | - */ |
|
63 | - public const ERROR = 3; |
|
64 | - /** |
|
65 | - * @since 14.0.0 |
|
66 | - * @deprecated 20.0.0 |
|
67 | - */ |
|
68 | - public const FATAL = 4; |
|
44 | + /** |
|
45 | + * @since 14.0.0 |
|
46 | + * @deprecated 20.0.0 |
|
47 | + */ |
|
48 | + public const DEBUG = 0; |
|
49 | + /** |
|
50 | + * @since 14.0.0 |
|
51 | + * @deprecated 20.0.0 |
|
52 | + */ |
|
53 | + public const INFO = 1; |
|
54 | + /** |
|
55 | + * @since 14.0.0 |
|
56 | + * @deprecated 20.0.0 |
|
57 | + */ |
|
58 | + public const WARN = 2; |
|
59 | + /** |
|
60 | + * @since 14.0.0 |
|
61 | + * @deprecated 20.0.0 |
|
62 | + */ |
|
63 | + public const ERROR = 3; |
|
64 | + /** |
|
65 | + * @since 14.0.0 |
|
66 | + * @deprecated 20.0.0 |
|
67 | + */ |
|
68 | + public const FATAL = 4; |
|
69 | 69 | |
70 | - /** |
|
71 | - * System is unusable. |
|
72 | - * |
|
73 | - * @param string $message |
|
74 | - * @param array $context |
|
75 | - * @return null |
|
76 | - * @since 7.0.0 |
|
77 | - * @deprecated 20.0.0 use \Psr\Log\LoggerInterface::emergency |
|
78 | - */ |
|
79 | - public function emergency(string $message, array $context = []); |
|
70 | + /** |
|
71 | + * System is unusable. |
|
72 | + * |
|
73 | + * @param string $message |
|
74 | + * @param array $context |
|
75 | + * @return null |
|
76 | + * @since 7.0.0 |
|
77 | + * @deprecated 20.0.0 use \Psr\Log\LoggerInterface::emergency |
|
78 | + */ |
|
79 | + public function emergency(string $message, array $context = []); |
|
80 | 80 | |
81 | - /** |
|
82 | - * Action must be taken immediately. |
|
83 | - * |
|
84 | - * @param string $message |
|
85 | - * @param array $context |
|
86 | - * @return null |
|
87 | - * @since 7.0.0 |
|
88 | - * @deprecated 20.0.0 use \Psr\Log\LoggerInterface::alert |
|
89 | - */ |
|
90 | - public function alert(string $message, array $context = []); |
|
81 | + /** |
|
82 | + * Action must be taken immediately. |
|
83 | + * |
|
84 | + * @param string $message |
|
85 | + * @param array $context |
|
86 | + * @return null |
|
87 | + * @since 7.0.0 |
|
88 | + * @deprecated 20.0.0 use \Psr\Log\LoggerInterface::alert |
|
89 | + */ |
|
90 | + public function alert(string $message, array $context = []); |
|
91 | 91 | |
92 | - /** |
|
93 | - * Critical conditions. |
|
94 | - * |
|
95 | - * @param string $message |
|
96 | - * @param array $context |
|
97 | - * @return null |
|
98 | - * @since 7.0.0 |
|
99 | - * @deprecated 20.0.0 use \Psr\Log\LoggerInterface::critical |
|
100 | - */ |
|
101 | - public function critical(string $message, array $context = []); |
|
92 | + /** |
|
93 | + * Critical conditions. |
|
94 | + * |
|
95 | + * @param string $message |
|
96 | + * @param array $context |
|
97 | + * @return null |
|
98 | + * @since 7.0.0 |
|
99 | + * @deprecated 20.0.0 use \Psr\Log\LoggerInterface::critical |
|
100 | + */ |
|
101 | + public function critical(string $message, array $context = []); |
|
102 | 102 | |
103 | - /** |
|
104 | - * Runtime errors that do not require immediate action but should typically |
|
105 | - * be logged and monitored. |
|
106 | - * |
|
107 | - * @param string $message |
|
108 | - * @param array $context |
|
109 | - * @return null |
|
110 | - * @since 7.0.0 |
|
111 | - * @deprecated 20.0.0 use \Psr\Log\LoggerInterface::error |
|
112 | - */ |
|
113 | - public function error(string $message, array $context = []); |
|
103 | + /** |
|
104 | + * Runtime errors that do not require immediate action but should typically |
|
105 | + * be logged and monitored. |
|
106 | + * |
|
107 | + * @param string $message |
|
108 | + * @param array $context |
|
109 | + * @return null |
|
110 | + * @since 7.0.0 |
|
111 | + * @deprecated 20.0.0 use \Psr\Log\LoggerInterface::error |
|
112 | + */ |
|
113 | + public function error(string $message, array $context = []); |
|
114 | 114 | |
115 | - /** |
|
116 | - * Exceptional occurrences that are not errors. |
|
117 | - * |
|
118 | - * @param string $message |
|
119 | - * @param array $context |
|
120 | - * @return null |
|
121 | - * @since 7.0.0 |
|
122 | - * @deprecated 20.0.0 use \Psr\Log\LoggerInterface::warning |
|
123 | - */ |
|
124 | - public function warning(string $message, array $context = []); |
|
115 | + /** |
|
116 | + * Exceptional occurrences that are not errors. |
|
117 | + * |
|
118 | + * @param string $message |
|
119 | + * @param array $context |
|
120 | + * @return null |
|
121 | + * @since 7.0.0 |
|
122 | + * @deprecated 20.0.0 use \Psr\Log\LoggerInterface::warning |
|
123 | + */ |
|
124 | + public function warning(string $message, array $context = []); |
|
125 | 125 | |
126 | - /** |
|
127 | - * Normal but significant events. |
|
128 | - * |
|
129 | - * @param string $message |
|
130 | - * @param array $context |
|
131 | - * @return null |
|
132 | - * @since 7.0.0 |
|
133 | - * @deprecated 20.0.0 use \Psr\Log\LoggerInterface::notice |
|
134 | - */ |
|
135 | - public function notice(string $message, array $context = []); |
|
126 | + /** |
|
127 | + * Normal but significant events. |
|
128 | + * |
|
129 | + * @param string $message |
|
130 | + * @param array $context |
|
131 | + * @return null |
|
132 | + * @since 7.0.0 |
|
133 | + * @deprecated 20.0.0 use \Psr\Log\LoggerInterface::notice |
|
134 | + */ |
|
135 | + public function notice(string $message, array $context = []); |
|
136 | 136 | |
137 | - /** |
|
138 | - * Interesting events. |
|
139 | - * |
|
140 | - * @param string $message |
|
141 | - * @param array $context |
|
142 | - * @return null |
|
143 | - * @since 7.0.0 |
|
144 | - * @deprecated 20.0.0 use \Psr\Log\LoggerInterface::info |
|
145 | - */ |
|
146 | - public function info(string $message, array $context = []); |
|
137 | + /** |
|
138 | + * Interesting events. |
|
139 | + * |
|
140 | + * @param string $message |
|
141 | + * @param array $context |
|
142 | + * @return null |
|
143 | + * @since 7.0.0 |
|
144 | + * @deprecated 20.0.0 use \Psr\Log\LoggerInterface::info |
|
145 | + */ |
|
146 | + public function info(string $message, array $context = []); |
|
147 | 147 | |
148 | - /** |
|
149 | - * Detailed debug information. |
|
150 | - * |
|
151 | - * @param string $message |
|
152 | - * @param array $context |
|
153 | - * @return null |
|
154 | - * @since 7.0.0 |
|
155 | - * @deprecated 20.0.0 use \Psr\Log\LoggerInterface::debug |
|
156 | - */ |
|
157 | - public function debug(string $message, array $context = []); |
|
148 | + /** |
|
149 | + * Detailed debug information. |
|
150 | + * |
|
151 | + * @param string $message |
|
152 | + * @param array $context |
|
153 | + * @return null |
|
154 | + * @since 7.0.0 |
|
155 | + * @deprecated 20.0.0 use \Psr\Log\LoggerInterface::debug |
|
156 | + */ |
|
157 | + public function debug(string $message, array $context = []); |
|
158 | 158 | |
159 | - /** |
|
160 | - * Logs with an arbitrary level. |
|
161 | - * |
|
162 | - * @param int $level |
|
163 | - * @param string $message |
|
164 | - * @param array $context |
|
165 | - * @return mixed |
|
166 | - * @since 7.0.0 |
|
167 | - * @deprecated 20.0.0 use \Psr\Log\LoggerInterface::log |
|
168 | - */ |
|
169 | - public function log(int $level, string $message, array $context = []); |
|
159 | + /** |
|
160 | + * Logs with an arbitrary level. |
|
161 | + * |
|
162 | + * @param int $level |
|
163 | + * @param string $message |
|
164 | + * @param array $context |
|
165 | + * @return mixed |
|
166 | + * @since 7.0.0 |
|
167 | + * @deprecated 20.0.0 use \Psr\Log\LoggerInterface::log |
|
168 | + */ |
|
169 | + public function log(int $level, string $message, array $context = []); |
|
170 | 170 | |
171 | - /** |
|
172 | - * Logs an exception very detailed |
|
173 | - * An additional message can we written to the log by adding it to the |
|
174 | - * context. |
|
175 | - * |
|
176 | - * <code> |
|
177 | - * $logger->logException($ex, [ |
|
178 | - * 'message' => 'Exception during background job execution' |
|
179 | - * ]); |
|
180 | - * </code> |
|
181 | - * |
|
182 | - * @param \Exception|\Throwable $exception |
|
183 | - * @param array $context |
|
184 | - * @return void |
|
185 | - * @since 8.2.0 |
|
186 | - * @deprecated 20.0.0 use the `exception` entry in the context of any method in \Psr\Log\LoggerInterface |
|
187 | - */ |
|
188 | - public function logException(\Throwable $exception, array $context = []); |
|
171 | + /** |
|
172 | + * Logs an exception very detailed |
|
173 | + * An additional message can we written to the log by adding it to the |
|
174 | + * context. |
|
175 | + * |
|
176 | + * <code> |
|
177 | + * $logger->logException($ex, [ |
|
178 | + * 'message' => 'Exception during background job execution' |
|
179 | + * ]); |
|
180 | + * </code> |
|
181 | + * |
|
182 | + * @param \Exception|\Throwable $exception |
|
183 | + * @param array $context |
|
184 | + * @return void |
|
185 | + * @since 8.2.0 |
|
186 | + * @deprecated 20.0.0 use the `exception` entry in the context of any method in \Psr\Log\LoggerInterface |
|
187 | + */ |
|
188 | + public function logException(\Throwable $exception, array $context = []); |
|
189 | 189 | } |
@@ -32,13 +32,13 @@ |
||
32 | 32 | * @since 8.0.0 |
33 | 33 | */ |
34 | 34 | interface IExtension { |
35 | - public const METHOD_STREAM = 'stream'; |
|
36 | - public const METHOD_MAIL = 'email'; |
|
37 | - public const METHOD_NOTIFICATION = 'notification'; |
|
35 | + public const METHOD_STREAM = 'stream'; |
|
36 | + public const METHOD_MAIL = 'email'; |
|
37 | + public const METHOD_NOTIFICATION = 'notification'; |
|
38 | 38 | |
39 | - public const PRIORITY_VERYLOW = 10; |
|
40 | - public const PRIORITY_LOW = 20; |
|
41 | - public const PRIORITY_MEDIUM = 30; |
|
42 | - public const PRIORITY_HIGH = 40; |
|
43 | - public const PRIORITY_VERYHIGH = 50; |
|
39 | + public const PRIORITY_VERYLOW = 10; |
|
40 | + public const PRIORITY_LOW = 20; |
|
41 | + public const PRIORITY_MEDIUM = 30; |
|
42 | + public const PRIORITY_HIGH = 40; |
|
43 | + public const PRIORITY_VERYHIGH = 50; |
|
44 | 44 | } |
@@ -33,115 +33,115 @@ |
||
33 | 33 | |
34 | 34 | class WeatherStatusController extends OCSController { |
35 | 35 | |
36 | - /** @var string */ |
|
37 | - private $userId; |
|
36 | + /** @var string */ |
|
37 | + private $userId; |
|
38 | 38 | |
39 | - /** @var ILogger */ |
|
40 | - private $logger; |
|
39 | + /** @var ILogger */ |
|
40 | + private $logger; |
|
41 | 41 | |
42 | - /** @var WeatherStatusService */ |
|
43 | - private $service; |
|
42 | + /** @var WeatherStatusService */ |
|
43 | + private $service; |
|
44 | 44 | |
45 | - public function __construct(string $appName, |
|
46 | - IRequest $request, |
|
47 | - ILogger $logger, |
|
48 | - WeatherStatusService $service, |
|
49 | - ?string $userId) { |
|
50 | - parent::__construct($appName, $request); |
|
51 | - $this->userId = $userId; |
|
52 | - $this->logger = $logger; |
|
53 | - $this->service = $service; |
|
54 | - } |
|
45 | + public function __construct(string $appName, |
|
46 | + IRequest $request, |
|
47 | + ILogger $logger, |
|
48 | + WeatherStatusService $service, |
|
49 | + ?string $userId) { |
|
50 | + parent::__construct($appName, $request); |
|
51 | + $this->userId = $userId; |
|
52 | + $this->logger = $logger; |
|
53 | + $this->service = $service; |
|
54 | + } |
|
55 | 55 | |
56 | - /** |
|
57 | - * @NoAdminRequired |
|
58 | - * |
|
59 | - * Try to use the address set in user personal settings as weather location |
|
60 | - * |
|
61 | - * @return DataResponse with success state and address information |
|
62 | - */ |
|
63 | - public function usePersonalAddress(): DataResponse { |
|
64 | - return new DataResponse($this->service->usePersonalAddress()); |
|
65 | - } |
|
56 | + /** |
|
57 | + * @NoAdminRequired |
|
58 | + * |
|
59 | + * Try to use the address set in user personal settings as weather location |
|
60 | + * |
|
61 | + * @return DataResponse with success state and address information |
|
62 | + */ |
|
63 | + public function usePersonalAddress(): DataResponse { |
|
64 | + return new DataResponse($this->service->usePersonalAddress()); |
|
65 | + } |
|
66 | 66 | |
67 | - /** |
|
68 | - * @NoAdminRequired |
|
69 | - * |
|
70 | - * Change the weather status mode. There are currently 2 modes: |
|
71 | - * - ask the browser |
|
72 | - * - use the user defined address |
|
73 | - * |
|
74 | - * @param int $mode New mode |
|
75 | - * @return DataResponse success state |
|
76 | - */ |
|
77 | - public function setMode(int $mode): DataResponse { |
|
78 | - return new DataResponse($this->service->setMode($mode)); |
|
79 | - } |
|
67 | + /** |
|
68 | + * @NoAdminRequired |
|
69 | + * |
|
70 | + * Change the weather status mode. There are currently 2 modes: |
|
71 | + * - ask the browser |
|
72 | + * - use the user defined address |
|
73 | + * |
|
74 | + * @param int $mode New mode |
|
75 | + * @return DataResponse success state |
|
76 | + */ |
|
77 | + public function setMode(int $mode): DataResponse { |
|
78 | + return new DataResponse($this->service->setMode($mode)); |
|
79 | + } |
|
80 | 80 | |
81 | - /** |
|
82 | - * @NoAdminRequired |
|
83 | - * |
|
84 | - * Set address and resolve it to get coordinates |
|
85 | - * or directly set coordinates and get address with reverse geocoding |
|
86 | - * |
|
87 | - * @param string|null $address Any approximative or exact address |
|
88 | - * @param float|null $lat Latitude in decimal degree format |
|
89 | - * @param float|null $lon Longitude in decimal degree format |
|
90 | - * @return DataResponse with success state and address information |
|
91 | - */ |
|
92 | - public function setLocation(?string $address, ?float $lat, ?float $lon): DataResponse { |
|
93 | - $currentWeather = $this->service->setLocation($address, $lat, $lon); |
|
94 | - return new DataResponse($currentWeather); |
|
95 | - } |
|
81 | + /** |
|
82 | + * @NoAdminRequired |
|
83 | + * |
|
84 | + * Set address and resolve it to get coordinates |
|
85 | + * or directly set coordinates and get address with reverse geocoding |
|
86 | + * |
|
87 | + * @param string|null $address Any approximative or exact address |
|
88 | + * @param float|null $lat Latitude in decimal degree format |
|
89 | + * @param float|null $lon Longitude in decimal degree format |
|
90 | + * @return DataResponse with success state and address information |
|
91 | + */ |
|
92 | + public function setLocation(?string $address, ?float $lat, ?float $lon): DataResponse { |
|
93 | + $currentWeather = $this->service->setLocation($address, $lat, $lon); |
|
94 | + return new DataResponse($currentWeather); |
|
95 | + } |
|
96 | 96 | |
97 | - /** |
|
98 | - * @NoAdminRequired |
|
99 | - * |
|
100 | - * Get stored user location |
|
101 | - * |
|
102 | - * @return DataResponse which contains coordinates, formatted address and current weather status mode |
|
103 | - */ |
|
104 | - public function getLocation(): DataResponse { |
|
105 | - $location = $this->service->getLocation(); |
|
106 | - return new DataResponse($location); |
|
107 | - } |
|
97 | + /** |
|
98 | + * @NoAdminRequired |
|
99 | + * |
|
100 | + * Get stored user location |
|
101 | + * |
|
102 | + * @return DataResponse which contains coordinates, formatted address and current weather status mode |
|
103 | + */ |
|
104 | + public function getLocation(): DataResponse { |
|
105 | + $location = $this->service->getLocation(); |
|
106 | + return new DataResponse($location); |
|
107 | + } |
|
108 | 108 | |
109 | - /** |
|
110 | - * @NoAdminRequired |
|
111 | - * |
|
112 | - * Get forecast for current location |
|
113 | - * |
|
114 | - * @return DataResponse which contains success state and filtered forecast data |
|
115 | - */ |
|
116 | - public function getForecast(): DataResponse { |
|
117 | - $forecast = $this->service->getForecast(); |
|
118 | - if (isset($forecast['success']) && $forecast['success'] === false) { |
|
119 | - return new DataResponse($forecast, Http::STATUS_NOT_FOUND); |
|
120 | - } else { |
|
121 | - return new DataResponse($forecast); |
|
122 | - } |
|
123 | - } |
|
109 | + /** |
|
110 | + * @NoAdminRequired |
|
111 | + * |
|
112 | + * Get forecast for current location |
|
113 | + * |
|
114 | + * @return DataResponse which contains success state and filtered forecast data |
|
115 | + */ |
|
116 | + public function getForecast(): DataResponse { |
|
117 | + $forecast = $this->service->getForecast(); |
|
118 | + if (isset($forecast['success']) && $forecast['success'] === false) { |
|
119 | + return new DataResponse($forecast, Http::STATUS_NOT_FOUND); |
|
120 | + } else { |
|
121 | + return new DataResponse($forecast); |
|
122 | + } |
|
123 | + } |
|
124 | 124 | |
125 | - /** |
|
126 | - * @NoAdminRequired |
|
127 | - * |
|
128 | - * Get favorites list |
|
129 | - * |
|
130 | - * @return DataResponse which contains the favorite list |
|
131 | - */ |
|
132 | - public function getFavorites(): DataResponse { |
|
133 | - return new DataResponse($this->service->getFavorites()); |
|
134 | - } |
|
125 | + /** |
|
126 | + * @NoAdminRequired |
|
127 | + * |
|
128 | + * Get favorites list |
|
129 | + * |
|
130 | + * @return DataResponse which contains the favorite list |
|
131 | + */ |
|
132 | + public function getFavorites(): DataResponse { |
|
133 | + return new DataResponse($this->service->getFavorites()); |
|
134 | + } |
|
135 | 135 | |
136 | - /** |
|
137 | - * @NoAdminRequired |
|
138 | - * |
|
139 | - * Set favorites list |
|
140 | - * |
|
141 | - * @param array $favorites |
|
142 | - * @return DataResponse success state |
|
143 | - */ |
|
144 | - public function setFavorites(array $favorites): DataResponse { |
|
145 | - return new DataResponse($this->service->setFavorites($favorites)); |
|
146 | - } |
|
136 | + /** |
|
137 | + * @NoAdminRequired |
|
138 | + * |
|
139 | + * Set favorites list |
|
140 | + * |
|
141 | + * @param array $favorites |
|
142 | + * @return DataResponse success state |
|
143 | + */ |
|
144 | + public function setFavorites(array $favorites): DataResponse { |
|
145 | + return new DataResponse($this->service->setFavorites($favorites)); |
|
146 | + } |
|
147 | 147 | } |
@@ -37,62 +37,62 @@ |
||
37 | 37 | use function in_array; |
38 | 38 | |
39 | 39 | class ShareInteractionListener implements IEventListener { |
40 | - private const SUPPORTED_SHARE_TYPES = [ |
|
41 | - IShare::TYPE_USER, |
|
42 | - IShare::TYPE_EMAIL, |
|
43 | - IShare::TYPE_REMOTE, |
|
44 | - ]; |
|
40 | + private const SUPPORTED_SHARE_TYPES = [ |
|
41 | + IShare::TYPE_USER, |
|
42 | + IShare::TYPE_EMAIL, |
|
43 | + IShare::TYPE_REMOTE, |
|
44 | + ]; |
|
45 | 45 | |
46 | - /** @var IEventDispatcher */ |
|
47 | - private $dispatcher; |
|
46 | + /** @var IEventDispatcher */ |
|
47 | + private $dispatcher; |
|
48 | 48 | |
49 | - /** @var IUserManager */ |
|
50 | - private $userManager; |
|
49 | + /** @var IUserManager */ |
|
50 | + private $userManager; |
|
51 | 51 | |
52 | - /** @var ILogger */ |
|
53 | - private $logger; |
|
52 | + /** @var ILogger */ |
|
53 | + private $logger; |
|
54 | 54 | |
55 | - public function __construct(IEventDispatcher $dispatcher, |
|
56 | - IUserManager $userManager, |
|
57 | - ILogger $logger) { |
|
58 | - $this->dispatcher = $dispatcher; |
|
59 | - $this->userManager = $userManager; |
|
60 | - $this->logger = $logger; |
|
61 | - } |
|
55 | + public function __construct(IEventDispatcher $dispatcher, |
|
56 | + IUserManager $userManager, |
|
57 | + ILogger $logger) { |
|
58 | + $this->dispatcher = $dispatcher; |
|
59 | + $this->userManager = $userManager; |
|
60 | + $this->logger = $logger; |
|
61 | + } |
|
62 | 62 | |
63 | - public function handle(Event $event): void { |
|
64 | - if (!($event instanceof ShareCreatedEvent)) { |
|
65 | - // Unrelated |
|
66 | - return; |
|
67 | - } |
|
63 | + public function handle(Event $event): void { |
|
64 | + if (!($event instanceof ShareCreatedEvent)) { |
|
65 | + // Unrelated |
|
66 | + return; |
|
67 | + } |
|
68 | 68 | |
69 | - $share = $event->getShare(); |
|
70 | - if (!in_array($share->getShareType(), self::SUPPORTED_SHARE_TYPES, true)) { |
|
71 | - $this->logger->debug('Share type does not allow to emit interaction event'); |
|
72 | - return; |
|
73 | - } |
|
74 | - $actor = $this->userManager->get($share->getSharedBy()); |
|
75 | - $sharedWith = $this->userManager->get($share->getSharedWith()); |
|
76 | - if ($actor === null) { |
|
77 | - $this->logger->warning('Share was not created by a user, can\'t emit interaction event'); |
|
78 | - return; |
|
79 | - } |
|
80 | - $interactionEvent = new ContactInteractedWithEvent($actor); |
|
81 | - switch ($share->getShareType()) { |
|
82 | - case IShare::TYPE_USER: |
|
83 | - $interactionEvent->setUid($share->getSharedWith()); |
|
84 | - if ($sharedWith !== null) { |
|
85 | - $interactionEvent->setFederatedCloudId($sharedWith->getCloudId()); |
|
86 | - } |
|
87 | - break; |
|
88 | - case IShare::TYPE_EMAIL: |
|
89 | - $interactionEvent->setEmail($share->getSharedWith()); |
|
90 | - break; |
|
91 | - case IShare::TYPE_REMOTE: |
|
92 | - $interactionEvent->setFederatedCloudId($share->getSharedWith()); |
|
93 | - break; |
|
94 | - } |
|
69 | + $share = $event->getShare(); |
|
70 | + if (!in_array($share->getShareType(), self::SUPPORTED_SHARE_TYPES, true)) { |
|
71 | + $this->logger->debug('Share type does not allow to emit interaction event'); |
|
72 | + return; |
|
73 | + } |
|
74 | + $actor = $this->userManager->get($share->getSharedBy()); |
|
75 | + $sharedWith = $this->userManager->get($share->getSharedWith()); |
|
76 | + if ($actor === null) { |
|
77 | + $this->logger->warning('Share was not created by a user, can\'t emit interaction event'); |
|
78 | + return; |
|
79 | + } |
|
80 | + $interactionEvent = new ContactInteractedWithEvent($actor); |
|
81 | + switch ($share->getShareType()) { |
|
82 | + case IShare::TYPE_USER: |
|
83 | + $interactionEvent->setUid($share->getSharedWith()); |
|
84 | + if ($sharedWith !== null) { |
|
85 | + $interactionEvent->setFederatedCloudId($sharedWith->getCloudId()); |
|
86 | + } |
|
87 | + break; |
|
88 | + case IShare::TYPE_EMAIL: |
|
89 | + $interactionEvent->setEmail($share->getSharedWith()); |
|
90 | + break; |
|
91 | + case IShare::TYPE_REMOTE: |
|
92 | + $interactionEvent->setFederatedCloudId($share->getSharedWith()); |
|
93 | + break; |
|
94 | + } |
|
95 | 95 | |
96 | - $this->dispatcher->dispatchTyped($interactionEvent); |
|
97 | - } |
|
96 | + $this->dispatcher->dispatchTyped($interactionEvent); |
|
97 | + } |
|
98 | 98 | } |
@@ -30,8 +30,8 @@ |
||
30 | 30 | use OCA\User_LDAP\Mapping\GroupMapping; |
31 | 31 | |
32 | 32 | class UUIDFixGroup extends UUIDFix { |
33 | - public function __construct(GroupMapping $mapper, Group_Proxy $proxy) { |
|
34 | - $this->mapper = $mapper; |
|
35 | - $this->proxy = $proxy; |
|
36 | - } |
|
33 | + public function __construct(GroupMapping $mapper, Group_Proxy $proxy) { |
|
34 | + $this->mapper = $mapper; |
|
35 | + $this->proxy = $proxy; |
|
36 | + } |
|
37 | 37 | } |
@@ -30,24 +30,24 @@ |
||
30 | 30 | use OCA\User_LDAP\User_Proxy; |
31 | 31 | |
32 | 32 | abstract class UUIDFix extends QueuedJob { |
33 | - /** @var AbstractMapping */ |
|
34 | - protected $mapper; |
|
33 | + /** @var AbstractMapping */ |
|
34 | + protected $mapper; |
|
35 | 35 | |
36 | - /** @var Proxy */ |
|
37 | - protected $proxy; |
|
36 | + /** @var Proxy */ |
|
37 | + protected $proxy; |
|
38 | 38 | |
39 | - public function run($argument) { |
|
40 | - $isUser = $this->proxy instanceof User_Proxy; |
|
41 | - foreach ($argument['records'] as $record) { |
|
42 | - $access = $this->proxy->getLDAPAccess($record['name']); |
|
43 | - $uuid = $access->getUUID($record['dn'], $isUser); |
|
44 | - if ($uuid === false) { |
|
45 | - // record not found, no prob, continue with the next |
|
46 | - continue; |
|
47 | - } |
|
48 | - if ($uuid !== $record['uuid']) { |
|
49 | - $this->mapper->setUUIDbyDN($uuid, $record['dn']); |
|
50 | - } |
|
51 | - } |
|
52 | - } |
|
39 | + public function run($argument) { |
|
40 | + $isUser = $this->proxy instanceof User_Proxy; |
|
41 | + foreach ($argument['records'] as $record) { |
|
42 | + $access = $this->proxy->getLDAPAccess($record['name']); |
|
43 | + $uuid = $access->getUUID($record['dn'], $isUser); |
|
44 | + if ($uuid === false) { |
|
45 | + // record not found, no prob, continue with the next |
|
46 | + continue; |
|
47 | + } |
|
48 | + if ($uuid !== $record['uuid']) { |
|
49 | + $this->mapper->setUUIDbyDN($uuid, $record['dn']); |
|
50 | + } |
|
51 | + } |
|
52 | + } |
|
53 | 53 | } |
@@ -30,8 +30,8 @@ |
||
30 | 30 | use OCA\User_LDAP\Mapping\UserMapping; |
31 | 31 | |
32 | 32 | class UUIDFixUser extends UUIDFix { |
33 | - public function __construct(UserMapping $mapper, User_Proxy $proxy) { |
|
34 | - $this->mapper = $mapper; |
|
35 | - $this->proxy = $proxy; |
|
36 | - } |
|
33 | + public function __construct(UserMapping $mapper, User_Proxy $proxy) { |
|
34 | + $this->mapper = $mapper; |
|
35 | + $this->proxy = $proxy; |
|
36 | + } |
|
37 | 37 | } |
@@ -33,82 +33,82 @@ |
||
33 | 33 | * @package OCA\User_LDAP |
34 | 34 | */ |
35 | 35 | class DeletedUsersIndex { |
36 | - /** |
|
37 | - * @var \OCP\IConfig $config |
|
38 | - */ |
|
39 | - protected $config; |
|
36 | + /** |
|
37 | + * @var \OCP\IConfig $config |
|
38 | + */ |
|
39 | + protected $config; |
|
40 | 40 | |
41 | - /** |
|
42 | - * @var \OCA\User_LDAP\Mapping\UserMapping $mapping |
|
43 | - */ |
|
44 | - protected $mapping; |
|
41 | + /** |
|
42 | + * @var \OCA\User_LDAP\Mapping\UserMapping $mapping |
|
43 | + */ |
|
44 | + protected $mapping; |
|
45 | 45 | |
46 | - /** |
|
47 | - * @var array $deletedUsers |
|
48 | - */ |
|
49 | - protected $deletedUsers; |
|
50 | - /** @var IManager */ |
|
51 | - private $shareManager; |
|
46 | + /** |
|
47 | + * @var array $deletedUsers |
|
48 | + */ |
|
49 | + protected $deletedUsers; |
|
50 | + /** @var IManager */ |
|
51 | + private $shareManager; |
|
52 | 52 | |
53 | - public function __construct(\OCP\IConfig $config, UserMapping $mapping, IManager $shareManager) { |
|
54 | - $this->config = $config; |
|
55 | - $this->mapping = $mapping; |
|
56 | - $this->shareManager = $shareManager; |
|
57 | - } |
|
53 | + public function __construct(\OCP\IConfig $config, UserMapping $mapping, IManager $shareManager) { |
|
54 | + $this->config = $config; |
|
55 | + $this->mapping = $mapping; |
|
56 | + $this->shareManager = $shareManager; |
|
57 | + } |
|
58 | 58 | |
59 | - /** |
|
60 | - * reads LDAP users marked as deleted from the database |
|
61 | - * @return \OCA\User_LDAP\User\OfflineUser[] |
|
62 | - */ |
|
63 | - private function fetchDeletedUsers() { |
|
64 | - $deletedUsers = $this->config->getUsersForUserValue( |
|
65 | - 'user_ldap', 'isDeleted', '1'); |
|
59 | + /** |
|
60 | + * reads LDAP users marked as deleted from the database |
|
61 | + * @return \OCA\User_LDAP\User\OfflineUser[] |
|
62 | + */ |
|
63 | + private function fetchDeletedUsers() { |
|
64 | + $deletedUsers = $this->config->getUsersForUserValue( |
|
65 | + 'user_ldap', 'isDeleted', '1'); |
|
66 | 66 | |
67 | - $userObjects = []; |
|
68 | - foreach ($deletedUsers as $user) { |
|
69 | - $userObjects[] = new OfflineUser($user, $this->config, $this->mapping, $this->shareManager); |
|
70 | - } |
|
71 | - $this->deletedUsers = $userObjects; |
|
67 | + $userObjects = []; |
|
68 | + foreach ($deletedUsers as $user) { |
|
69 | + $userObjects[] = new OfflineUser($user, $this->config, $this->mapping, $this->shareManager); |
|
70 | + } |
|
71 | + $this->deletedUsers = $userObjects; |
|
72 | 72 | |
73 | - return $this->deletedUsers; |
|
74 | - } |
|
73 | + return $this->deletedUsers; |
|
74 | + } |
|
75 | 75 | |
76 | - /** |
|
77 | - * returns all LDAP users that are marked as deleted |
|
78 | - * @return \OCA\User_LDAP\User\OfflineUser[] |
|
79 | - */ |
|
80 | - public function getUsers() { |
|
81 | - if (is_array($this->deletedUsers)) { |
|
82 | - return $this->deletedUsers; |
|
83 | - } |
|
84 | - return $this->fetchDeletedUsers(); |
|
85 | - } |
|
76 | + /** |
|
77 | + * returns all LDAP users that are marked as deleted |
|
78 | + * @return \OCA\User_LDAP\User\OfflineUser[] |
|
79 | + */ |
|
80 | + public function getUsers() { |
|
81 | + if (is_array($this->deletedUsers)) { |
|
82 | + return $this->deletedUsers; |
|
83 | + } |
|
84 | + return $this->fetchDeletedUsers(); |
|
85 | + } |
|
86 | 86 | |
87 | - /** |
|
88 | - * whether at least one user was detected as deleted |
|
89 | - * @return bool |
|
90 | - */ |
|
91 | - public function hasUsers() { |
|
92 | - if (!is_array($this->deletedUsers)) { |
|
93 | - $this->fetchDeletedUsers(); |
|
94 | - } |
|
95 | - return is_array($this->deletedUsers) && (count($this->deletedUsers) > 0); |
|
96 | - } |
|
87 | + /** |
|
88 | + * whether at least one user was detected as deleted |
|
89 | + * @return bool |
|
90 | + */ |
|
91 | + public function hasUsers() { |
|
92 | + if (!is_array($this->deletedUsers)) { |
|
93 | + $this->fetchDeletedUsers(); |
|
94 | + } |
|
95 | + return is_array($this->deletedUsers) && (count($this->deletedUsers) > 0); |
|
96 | + } |
|
97 | 97 | |
98 | - /** |
|
99 | - * marks a user as deleted |
|
100 | - * |
|
101 | - * @param string $ocName |
|
102 | - * @throws \OCP\PreConditionNotMetException |
|
103 | - */ |
|
104 | - public function markUser($ocName) { |
|
105 | - $curValue = $this->config->getUserValue($ocName, 'user_ldap', 'isDeleted', '0'); |
|
106 | - if ($curValue === '1') { |
|
107 | - // the user is already marked, do not write to DB again |
|
108 | - return; |
|
109 | - } |
|
110 | - $this->config->setUserValue($ocName, 'user_ldap', 'isDeleted', '1'); |
|
111 | - $this->config->setUserValue($ocName, 'user_ldap', 'foundDeleted', (string)time()); |
|
112 | - $this->deletedUsers = null; |
|
113 | - } |
|
98 | + /** |
|
99 | + * marks a user as deleted |
|
100 | + * |
|
101 | + * @param string $ocName |
|
102 | + * @throws \OCP\PreConditionNotMetException |
|
103 | + */ |
|
104 | + public function markUser($ocName) { |
|
105 | + $curValue = $this->config->getUserValue($ocName, 'user_ldap', 'isDeleted', '0'); |
|
106 | + if ($curValue === '1') { |
|
107 | + // the user is already marked, do not write to DB again |
|
108 | + return; |
|
109 | + } |
|
110 | + $this->config->setUserValue($ocName, 'user_ldap', 'isDeleted', '1'); |
|
111 | + $this->config->setUserValue($ocName, 'user_ldap', 'foundDeleted', (string)time()); |
|
112 | + $this->deletedUsers = null; |
|
113 | + } |
|
114 | 114 | } |