@@ -77,7 +77,7 @@ |
||
77 | 77 | } |
78 | 78 | $pos = strpos($ip, '%'); // if there is an explicit interface added to the IP, e.g. fe80::ae2d:d1e7:fe1e:9a8d%enp2s0 |
79 | 79 | if ($pos !== false) { |
80 | - $ip = substr($ip, 0, $pos-1); |
|
80 | + $ip = substr($ip, 0, $pos - 1); |
|
81 | 81 | } |
82 | 82 | $binary = \inet_pton($ip); |
83 | 83 | for ($i = 128; $i > $maskBits; $i -= 8) { |
@@ -123,12 +123,12 @@ discard block |
||
123 | 123 | } |
124 | 124 | |
125 | 125 | private function loadCustomDefinitions(string $fileName, array $definitions): array { |
126 | - if (file_exists($this->customConfigDir . '/' . $fileName)) { |
|
127 | - $custom = json_decode(file_get_contents($this->customConfigDir . '/' . $fileName), true); |
|
126 | + if (file_exists($this->customConfigDir.'/'.$fileName)) { |
|
127 | + $custom = json_decode(file_get_contents($this->customConfigDir.'/'.$fileName), true); |
|
128 | 128 | if (json_last_error() === JSON_ERROR_NONE) { |
129 | 129 | $definitions = array_merge($definitions, $custom); |
130 | 130 | } else { |
131 | - $this->logger->warning('Failed to parse ' . $fileName . ': ' . json_last_error_msg()); |
|
131 | + $this->logger->warning('Failed to parse '.$fileName.': '.json_last_error_msg()); |
|
132 | 132 | } |
133 | 133 | } |
134 | 134 | return $definitions; |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | return; |
143 | 143 | } |
144 | 144 | |
145 | - $this->mimeTypeAlias = json_decode(file_get_contents($this->defaultConfigDir . '/mimetypealiases.dist.json'), true); |
|
145 | + $this->mimeTypeAlias = json_decode(file_get_contents($this->defaultConfigDir.'/mimetypealiases.dist.json'), true); |
|
146 | 146 | $this->mimeTypeAlias = $this->loadCustomDefinitions(self::CUSTOM_MIMETYPEALIASES, $this->mimeTypeAlias); |
147 | 147 | } |
148 | 148 | |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | |
157 | 157 | public function getOnlyDefaultAliases(): array { |
158 | 158 | $this->loadMappings(); |
159 | - $this->mimeTypeAlias = json_decode(file_get_contents($this->defaultConfigDir . '/mimetypealiases.dist.json'), true); |
|
159 | + $this->mimeTypeAlias = json_decode(file_get_contents($this->defaultConfigDir.'/mimetypealiases.dist.json'), true); |
|
160 | 160 | return $this->mimeTypeAlias; |
161 | 161 | } |
162 | 162 | |
@@ -168,7 +168,7 @@ discard block |
||
168 | 168 | return; |
169 | 169 | } |
170 | 170 | |
171 | - $mimetypeMapping = json_decode(file_get_contents($this->defaultConfigDir . '/mimetypemapping.dist.json'), true); |
|
171 | + $mimetypeMapping = json_decode(file_get_contents($this->defaultConfigDir.'/mimetypemapping.dist.json'), true); |
|
172 | 172 | $mimetypeMapping = $this->loadCustomDefinitions(self::CUSTOM_MIMETYPEMAPPING, $mimetypeMapping); |
173 | 173 | |
174 | 174 | $this->registerTypeArray($mimetypeMapping); |
@@ -364,7 +364,7 @@ discard block |
||
364 | 364 | |
365 | 365 | // Icon exists? |
366 | 366 | try { |
367 | - $this->mimetypeIcons[$mimetype] = $this->urlGenerator->imagePath('core', 'filetypes/' . $icon . '.svg'); |
|
367 | + $this->mimetypeIcons[$mimetype] = $this->urlGenerator->imagePath('core', 'filetypes/'.$icon.'.svg'); |
|
368 | 368 | return $this->mimetypeIcons[$mimetype]; |
369 | 369 | } catch (\RuntimeException $e) { |
370 | 370 | // Specified image not found |
@@ -373,7 +373,7 @@ discard block |
||
373 | 373 | // Try only the first part of the filetype |
374 | 374 | $mimePart = substr($icon, 0, strpos($icon, '-')); |
375 | 375 | try { |
376 | - $this->mimetypeIcons[$mimetype] = $this->urlGenerator->imagePath('core', 'filetypes/' . $mimePart . '.svg'); |
|
376 | + $this->mimetypeIcons[$mimetype] = $this->urlGenerator->imagePath('core', 'filetypes/'.$mimePart.'.svg'); |
|
377 | 377 | return $this->mimetypeIcons[$mimetype]; |
378 | 378 | } catch (\RuntimeException $e) { |
379 | 379 | // Image for the first part of the mimetype not found |
@@ -105,7 +105,7 @@ |
||
105 | 105 | $suffix = '…'; |
106 | 106 | } |
107 | 107 | |
108 | - return $prefix . mb_substr($message, $start, $end - $start) . $suffix; |
|
108 | + return $prefix.mb_substr($message, $start, $end - $start).$suffix; |
|
109 | 109 | } |
110 | 110 | |
111 | 111 | } |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | $this->urlGenerator->getAbsoluteURL( |
121 | 121 | $this->urlGenerator->linkTo( |
122 | 122 | '', |
123 | - 'ocs/v2.php/apps/files/api/v1/transferownership/' . $id |
|
123 | + 'ocs/v2.php/apps/files/api/v1/transferownership/'.$id |
|
124 | 124 | ) |
125 | 125 | ), |
126 | 126 | IAction::TYPE_POST |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | $this->urlGenerator->getAbsoluteURL( |
134 | 134 | $this->urlGenerator->linkTo( |
135 | 135 | '', |
136 | - 'ocs/v2.php/apps/files/api/v1/transferownership/' . $id |
|
136 | + 'ocs/v2.php/apps/files/api/v1/transferownership/'.$id |
|
137 | 137 | ) |
138 | 138 | ), |
139 | 139 | IAction::TYPE_DELETE |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | [ |
157 | 157 | 'path' => [ |
158 | 158 | 'type' => 'highlight', |
159 | - 'id' => $param['targetUser'] . '::' . $param['nodeName'], |
|
159 | + 'id' => $param['targetUser'].'::'.$param['nodeName'], |
|
160 | 160 | 'name' => $param['nodeName'], |
161 | 161 | ] |
162 | 162 | ]) |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | return $notification; |
166 | 166 | } |
167 | 167 | |
168 | - public function handleTransferOwnershipFailedSource(INotification $notification, string $languageCode): INotification { |
|
168 | + public function handleTransferOwnershipFailedSource(INotification $notification, string $languageCode): INotification { |
|
169 | 169 | $l = $this->l10nFactory->get('files', $languageCode); |
170 | 170 | $param = $notification->getSubjectParameters(); |
171 | 171 | |
@@ -177,7 +177,7 @@ discard block |
||
177 | 177 | [ |
178 | 178 | 'path' => [ |
179 | 179 | 'type' => 'highlight', |
180 | - 'id' => $param['targetUser'] . '::' . $param['nodeName'], |
|
180 | + 'id' => $param['targetUser'].'::'.$param['nodeName'], |
|
181 | 181 | 'name' => $param['nodeName'], |
182 | 182 | ], |
183 | 183 | 'user' => [ |
@@ -190,7 +190,7 @@ discard block |
||
190 | 190 | return $notification; |
191 | 191 | } |
192 | 192 | |
193 | - public function handleTransferOwnershipFailedTarget(INotification $notification, string $languageCode): INotification { |
|
193 | + public function handleTransferOwnershipFailedTarget(INotification $notification, string $languageCode): INotification { |
|
194 | 194 | $l = $this->l10nFactory->get('files', $languageCode); |
195 | 195 | $param = $notification->getSubjectParameters(); |
196 | 196 | |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | [ |
203 | 203 | 'path' => [ |
204 | 204 | 'type' => 'highlight', |
205 | - 'id' => $param['sourceUser'] . '::' . $param['nodeName'], |
|
205 | + 'id' => $param['sourceUser'].'::'.$param['nodeName'], |
|
206 | 206 | 'name' => $param['nodeName'], |
207 | 207 | ], |
208 | 208 | 'user' => [ |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | return $notification; |
217 | 217 | } |
218 | 218 | |
219 | - public function handleTransferOwnershipDoneSource(INotification $notification, string $languageCode): INotification { |
|
219 | + public function handleTransferOwnershipDoneSource(INotification $notification, string $languageCode): INotification { |
|
220 | 220 | $l = $this->l10nFactory->get('files', $languageCode); |
221 | 221 | $param = $notification->getSubjectParameters(); |
222 | 222 | |
@@ -228,7 +228,7 @@ discard block |
||
228 | 228 | [ |
229 | 229 | 'path' => [ |
230 | 230 | 'type' => 'highlight', |
231 | - 'id' => $param['targetUser'] . '::' . $param['nodeName'], |
|
231 | + 'id' => $param['targetUser'].'::'.$param['nodeName'], |
|
232 | 232 | 'name' => $param['nodeName'], |
233 | 233 | ], |
234 | 234 | 'user' => [ |
@@ -242,7 +242,7 @@ discard block |
||
242 | 242 | return $notification; |
243 | 243 | } |
244 | 244 | |
245 | - public function handleTransferOwnershipDoneTarget(INotification $notification, string $languageCode): INotification { |
|
245 | + public function handleTransferOwnershipDoneTarget(INotification $notification, string $languageCode): INotification { |
|
246 | 246 | $l = $this->l10nFactory->get('files', $languageCode); |
247 | 247 | $param = $notification->getSubjectParameters(); |
248 | 248 | |
@@ -254,7 +254,7 @@ discard block |
||
254 | 254 | [ |
255 | 255 | 'path' => [ |
256 | 256 | 'type' => 'highlight', |
257 | - 'id' => $param['sourceUser'] . '::' . $param['nodeName'], |
|
257 | + 'id' => $param['sourceUser'].'::'.$param['nodeName'], |
|
258 | 258 | 'name' => $param['nodeName'], |
259 | 259 | ], |
260 | 260 | 'user' => [ |
@@ -275,7 +275,7 @@ discard block |
||
275 | 275 | |
276 | 276 | // TODO: This should all be moved to a service that also the transferownershipContoller uses. |
277 | 277 | try { |
278 | - $transferOwnership = $this->mapper->getById((int)$notification->getObjectId()); |
|
278 | + $transferOwnership = $this->mapper->getById((int) $notification->getObjectId()); |
|
279 | 279 | } catch (DoesNotExistException $e) { |
280 | 280 | return; |
281 | 281 | } |
@@ -289,7 +289,7 @@ discard block |
||
289 | 289 | 'targetUser' => $transferOwnership->getTargetUser(), |
290 | 290 | 'nodeName' => $transferOwnership->getNodeName() |
291 | 291 | ]) |
292 | - ->setObject('transfer', (string)$transferOwnership->getId()); |
|
292 | + ->setObject('transfer', (string) $transferOwnership->getId()); |
|
293 | 293 | $this->notificationManager->notify($notification); |
294 | 294 | |
295 | 295 | $this->mapper->delete($transferOwnership); |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | $path = basename($fullPath); |
74 | 74 | |
75 | 75 | if ($normalizedPath !== $path) { |
76 | - $output->writeln("\t<error>Entry \"" . $fullPath . '" will not be accessible due to incompatible encoding</error>'); |
|
76 | + $output->writeln("\t<error>Entry \"".$fullPath.'" will not be accessible due to incompatible encoding</error>'); |
|
77 | 77 | } |
78 | 78 | } |
79 | 79 | |
@@ -89,27 +89,27 @@ discard block |
||
89 | 89 | $scanner = new \OC\Files\Utils\Scanner(null, $connection, \OC::$server->query(IEventDispatcher::class), \OC::$server->getLogger()); |
90 | 90 | |
91 | 91 | # check on each file/folder if there was a user interrupt (ctrl-c) and throw an exception |
92 | - $scanner->listen('\OC\Files\Utils\Scanner', 'scanFile', function ($path) use ($output) { |
|
92 | + $scanner->listen('\OC\Files\Utils\Scanner', 'scanFile', function($path) use ($output) { |
|
93 | 93 | $output->writeln("\tFile <info>$path</info>", OutputInterface::VERBOSITY_VERBOSE); |
94 | 94 | ++$this->filesCounter; |
95 | 95 | $this->abortIfInterrupted(); |
96 | 96 | }); |
97 | 97 | |
98 | - $scanner->listen('\OC\Files\Utils\Scanner', 'scanFolder', function ($path) use ($output) { |
|
98 | + $scanner->listen('\OC\Files\Utils\Scanner', 'scanFolder', function($path) use ($output) { |
|
99 | 99 | $output->writeln("\tFolder <info>$path</info>", OutputInterface::VERBOSITY_VERBOSE); |
100 | 100 | ++$this->foldersCounter; |
101 | 101 | $this->abortIfInterrupted(); |
102 | 102 | }); |
103 | 103 | |
104 | - $scanner->listen('\OC\Files\Utils\Scanner', 'StorageNotAvailable', function (StorageNotAvailableException $e) use ($output) { |
|
105 | - $output->writeln('Error while scanning, storage not available (' . $e->getMessage() . ')', OutputInterface::VERBOSITY_VERBOSE); |
|
104 | + $scanner->listen('\OC\Files\Utils\Scanner', 'StorageNotAvailable', function(StorageNotAvailableException $e) use ($output) { |
|
105 | + $output->writeln('Error while scanning, storage not available ('.$e->getMessage().')', OutputInterface::VERBOSITY_VERBOSE); |
|
106 | 106 | }); |
107 | 107 | |
108 | - $scanner->listen('\OC\Files\Utils\Scanner', 'scanFile', function ($path) use ($output) { |
|
108 | + $scanner->listen('\OC\Files\Utils\Scanner', 'scanFile', function($path) use ($output) { |
|
109 | 109 | $this->checkScanWarning($path, $output); |
110 | 110 | }); |
111 | 111 | |
112 | - $scanner->listen('\OC\Files\Utils\Scanner', 'scanFolder', function ($path) use ($output) { |
|
112 | + $scanner->listen('\OC\Files\Utils\Scanner', 'scanFolder', function($path) use ($output) { |
|
113 | 113 | $this->checkScanWarning($path, $output); |
114 | 114 | }); |
115 | 115 | |
@@ -122,10 +122,10 @@ discard block |
||
122 | 122 | # exit the function if ctrl-c has been pressed |
123 | 123 | $output->writeln('Interrupted by user'); |
124 | 124 | } catch (NotFoundException $e) { |
125 | - $output->writeln('<error>Path not found: ' . $e->getMessage() . '</error>'); |
|
125 | + $output->writeln('<error>Path not found: '.$e->getMessage().'</error>'); |
|
126 | 126 | } catch (\Exception $e) { |
127 | - $output->writeln('<error>Exception during scan: ' . $e->getMessage() . '</error>'); |
|
128 | - $output->writeln('<error>' . $e->getTraceAsString() . '</error>'); |
|
127 | + $output->writeln('<error>Exception during scan: '.$e->getMessage().'</error>'); |
|
128 | + $output->writeln('<error>'.$e->getTraceAsString().'</error>'); |
|
129 | 129 | } |
130 | 130 | } |
131 | 131 | |
@@ -222,7 +222,7 @@ discard block |
||
222 | 222 | protected function formatExecTime() { |
223 | 223 | $secs = round($this->execTime); |
224 | 224 | # convert seconds into HH:MM:SS form |
225 | - return sprintf('%02d:%02d:%02d', ($secs/3600), ($secs/60%60), $secs%60); |
|
225 | + return sprintf('%02d:%02d:%02d', ($secs / 3600), ($secs / 60 % 60), $secs % 60); |
|
226 | 226 | } |
227 | 227 | |
228 | 228 | /** |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | * @param OutputInterface $output |
102 | 102 | */ |
103 | 103 | private function enableApp(string $appId, array $groupIds, bool $forceEnable, OutputInterface $output): void { |
104 | - $groupNames = array_map(function (IGroup $group) { |
|
104 | + $groupNames = array_map(function(IGroup $group) { |
|
105 | 105 | return $group->getDisplayName(); |
106 | 106 | }, $groupIds); |
107 | 107 | |
@@ -118,13 +118,13 @@ discard block |
||
118 | 118 | |
119 | 119 | if ($groupIds === []) { |
120 | 120 | $this->appManager->enableApp($appId, $forceEnable); |
121 | - $output->writeln($appId . ' enabled'); |
|
121 | + $output->writeln($appId.' enabled'); |
|
122 | 122 | } else { |
123 | 123 | $this->appManager->enableAppForGroups($appId, $groupIds, $forceEnable); |
124 | - $output->writeln($appId . ' enabled for groups: ' . implode(', ', $groupNames)); |
|
124 | + $output->writeln($appId.' enabled for groups: '.implode(', ', $groupNames)); |
|
125 | 125 | } |
126 | 126 | } catch (AppPathNotFoundException $e) { |
127 | - $output->writeln($appId . ' not found'); |
|
127 | + $output->writeln($appId.' not found'); |
|
128 | 128 | $this->exitCode = 1; |
129 | 129 | } catch (\Exception $e) { |
130 | 130 | $output->writeln($e->getMessage()); |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | */ |
155 | 155 | public function completeOptionValues($optionName, CompletionContext $context) { |
156 | 156 | if ($optionName === 'groups') { |
157 | - return array_map(function (IGroup $group) { |
|
157 | + return array_map(function(IGroup $group) { |
|
158 | 158 | return $group->getGID(); |
159 | 159 | }, $this->groupManager->search($context->getCurrentWord())); |
160 | 160 | } |
@@ -49,20 +49,20 @@ |
||
49 | 49 | |
50 | 50 | $tmpDir = \OC::$server->getTempManager()->getTempBaseDir(); |
51 | 51 | |
52 | - $defaultParameters = ' -env:UserInstallation=file://' . escapeshellarg($tmpDir . '/owncloud-' . \OC_Util::getInstanceId() . '/') . ' --headless --nologo --nofirststartwizard --invisible --norestore --convert-to png --outdir '; |
|
52 | + $defaultParameters = ' -env:UserInstallation=file://'.escapeshellarg($tmpDir.'/owncloud-'.\OC_Util::getInstanceId().'/').' --headless --nologo --nofirststartwizard --invisible --norestore --convert-to png --outdir '; |
|
53 | 53 | $clParameters = \OC::$server->getConfig()->getSystemValue('preview_office_cl_parameters', $defaultParameters); |
54 | 54 | |
55 | - $exec = $this->cmd . $clParameters . escapeshellarg($tmpDir) . ' ' . escapeshellarg($absPath); |
|
55 | + $exec = $this->cmd.$clParameters.escapeshellarg($tmpDir).' '.escapeshellarg($absPath); |
|
56 | 56 | |
57 | 57 | shell_exec($exec); |
58 | 58 | |
59 | 59 | //create imagick object from png |
60 | 60 | $pngPreview = null; |
61 | 61 | try { |
62 | - list($dirname, , , $filename) = array_values(pathinfo($absPath)); |
|
63 | - $pngPreview = $tmpDir . '/' . $filename . '.png'; |
|
62 | + list($dirname,,, $filename) = array_values(pathinfo($absPath)); |
|
63 | + $pngPreview = $tmpDir.'/'.$filename.'.png'; |
|
64 | 64 | |
65 | - $png = new \imagick($pngPreview . '[0]'); |
|
65 | + $png = new \imagick($pngPreview.'[0]'); |
|
66 | 66 | $png->setImageFormat('jpg'); |
67 | 67 | } catch (\Exception $e) { |
68 | 68 | $this->cleanTmpFiles(); |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | ]); |
90 | 90 | } catch (Exception $e) { |
91 | 91 | $this->logger->logException($e, ['message' => 'Exception when creating a new file through direct editing']); |
92 | - return new DataResponse('Failed to create file: ' . $e->getMessage(), Http::STATUS_FORBIDDEN); |
|
92 | + return new DataResponse('Failed to create file: '.$e->getMessage(), Http::STATUS_FORBIDDEN); |
|
93 | 93 | } |
94 | 94 | } |
95 | 95 | |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | ]); |
107 | 107 | } catch (Exception $e) { |
108 | 108 | $this->logger->logException($e, ['message' => 'Exception when opening a file through direct editing']); |
109 | - return new DataResponse('Failed to open file: ' . $e->getMessage(), Http::STATUS_FORBIDDEN); |
|
109 | + return new DataResponse('Failed to open file: '.$e->getMessage(), Http::STATUS_FORBIDDEN); |
|
110 | 110 | } |
111 | 111 | } |
112 | 112 | |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | return new DataResponse($this->directEditingManager->getTemplates($editorId, $creatorId)); |
123 | 123 | } catch (Exception $e) { |
124 | 124 | $this->logger->logException($e); |
125 | - return new DataResponse('Failed to obtain template list: ' . $e->getMessage(), Http::STATUS_INTERNAL_SERVER_ERROR); |
|
125 | + return new DataResponse('Failed to obtain template list: '.$e->getMessage(), Http::STATUS_INTERNAL_SERVER_ERROR); |
|
126 | 126 | } |
127 | 127 | } |
128 | 128 | } |
@@ -29,14 +29,14 @@ |
||
29 | 29 | exit(1); |
30 | 30 | } |
31 | 31 | |
32 | -$locales = array_map(function (string $localeCode) { |
|
32 | +$locales = array_map(function(string $localeCode) { |
|
33 | 33 | return [ |
34 | 34 | 'code' => $localeCode, |
35 | 35 | 'name' => Locale::getDisplayName($localeCode, 'en') |
36 | 36 | ]; |
37 | 37 | }, ResourceBundle::getLocales('')); |
38 | 38 | |
39 | -if (file_put_contents(__DIR__ . '/locales.json', json_encode($locales, JSON_PRETTY_PRINT)) === false) { |
|
39 | +if (file_put_contents(__DIR__.'/locales.json', json_encode($locales, JSON_PRETTY_PRINT)) === false) { |
|
40 | 40 | echo 'Failed to update locales.json'; |
41 | 41 | exit(1); |
42 | 42 | } |