@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | ); |
110 | 110 | |
111 | 111 | # check on each file/folder if there was a user interrupt (ctrl-c) and throw an exception |
112 | - $scanner->listen('\OC\Files\Utils\Scanner', 'scanFile', function (string $path) use ($output, $scanMetadata): void { |
|
112 | + $scanner->listen('\OC\Files\Utils\Scanner', 'scanFile', function(string $path) use ($output, $scanMetadata): void { |
|
113 | 113 | $output->writeln("\tFile\t<info>$path</info>", OutputInterface::VERBOSITY_VERBOSE); |
114 | 114 | ++$this->filesCounter; |
115 | 115 | $this->abortIfInterrupted(); |
@@ -123,29 +123,29 @@ discard block |
||
123 | 123 | } |
124 | 124 | }); |
125 | 125 | |
126 | - $scanner->listen('\OC\Files\Utils\Scanner', 'scanFolder', function ($path) use ($output): void { |
|
126 | + $scanner->listen('\OC\Files\Utils\Scanner', 'scanFolder', function($path) use ($output): void { |
|
127 | 127 | $output->writeln("\tFolder\t<info>$path</info>", OutputInterface::VERBOSITY_VERBOSE); |
128 | 128 | ++$this->foldersCounter; |
129 | 129 | $this->abortIfInterrupted(); |
130 | 130 | }); |
131 | 131 | |
132 | - $scanner->listen('\OC\Files\Utils\Scanner', 'StorageNotAvailable', function (StorageNotAvailableException $e) use ($output): void { |
|
133 | - $output->writeln('Error while scanning, storage not available (' . $e->getMessage() . ')', OutputInterface::VERBOSITY_VERBOSE); |
|
132 | + $scanner->listen('\OC\Files\Utils\Scanner', 'StorageNotAvailable', function(StorageNotAvailableException $e) use ($output): void { |
|
133 | + $output->writeln('Error while scanning, storage not available ('.$e->getMessage().')', OutputInterface::VERBOSITY_VERBOSE); |
|
134 | 134 | ++$this->errorsCounter; |
135 | 135 | }); |
136 | 136 | |
137 | - $scanner->listen('\OC\Files\Utils\Scanner', 'normalizedNameMismatch', function ($fullPath) use ($output): void { |
|
138 | - $output->writeln("\t<error>Entry \"" . $fullPath . '" will not be accessible due to incompatible encoding</error>'); |
|
137 | + $scanner->listen('\OC\Files\Utils\Scanner', 'normalizedNameMismatch', function($fullPath) use ($output): void { |
|
138 | + $output->writeln("\t<error>Entry \"".$fullPath.'" will not be accessible due to incompatible encoding</error>'); |
|
139 | 139 | ++$this->errorsCounter; |
140 | 140 | }); |
141 | 141 | |
142 | - $this->eventDispatcher->addListener(NodeAddedToCache::class, function (): void { |
|
142 | + $this->eventDispatcher->addListener(NodeAddedToCache::class, function(): void { |
|
143 | 143 | ++$this->newCounter; |
144 | 144 | }); |
145 | - $this->eventDispatcher->addListener(FileCacheUpdated::class, function (): void { |
|
145 | + $this->eventDispatcher->addListener(FileCacheUpdated::class, function(): void { |
|
146 | 146 | ++$this->updatedCounter; |
147 | 147 | }); |
148 | - $this->eventDispatcher->addListener(NodeRemovedFromCache::class, function (): void { |
|
148 | + $this->eventDispatcher->addListener(NodeRemovedFromCache::class, function(): void { |
|
149 | 149 | ++$this->removedCounter; |
150 | 150 | }); |
151 | 151 | |
@@ -157,24 +157,24 @@ discard block |
||
157 | 157 | } |
158 | 158 | } catch (ForbiddenException $e) { |
159 | 159 | $output->writeln("<error>Home storage for user $user not writable or 'files' subdirectory missing</error>"); |
160 | - $output->writeln(' ' . $e->getMessage()); |
|
160 | + $output->writeln(' '.$e->getMessage()); |
|
161 | 161 | $output->writeln('Make sure you\'re running the scan command only as the user the web server runs as'); |
162 | 162 | ++$this->errorsCounter; |
163 | 163 | } catch (InterruptedException $e) { |
164 | 164 | # exit the function if ctrl-c has been pressed |
165 | 165 | $output->writeln('Interrupted by user'); |
166 | 166 | } catch (NotFoundException $e) { |
167 | - $output->writeln('<error>Path not found: ' . $e->getMessage() . '</error>'); |
|
167 | + $output->writeln('<error>Path not found: '.$e->getMessage().'</error>'); |
|
168 | 168 | ++$this->errorsCounter; |
169 | 169 | } catch (LockedException $e) { |
170 | 170 | if (str_starts_with($e->getPath(), 'scanner::')) { |
171 | - $output->writeln('<error>Another process is already scanning \'' . substr($e->getPath(), strlen('scanner::')) . '\'</error>'); |
|
171 | + $output->writeln('<error>Another process is already scanning \''.substr($e->getPath(), strlen('scanner::')).'\'</error>'); |
|
172 | 172 | } else { |
173 | 173 | throw $e; |
174 | 174 | } |
175 | 175 | } catch (\Exception $e) { |
176 | - $output->writeln('<error>Exception during scan: ' . $e->getMessage() . '</error>'); |
|
177 | - $output->writeln('<error>' . $e->getTraceAsString() . '</error>'); |
|
176 | + $output->writeln('<error>Exception during scan: '.$e->getMessage().'</error>'); |
|
177 | + $output->writeln('<error>'.$e->getTraceAsString().'</error>'); |
|
178 | 178 | ++$this->errorsCounter; |
179 | 179 | } |
180 | 180 | } |
@@ -187,8 +187,8 @@ discard block |
||
187 | 187 | protected function execute(InputInterface $input, OutputInterface $output): int { |
188 | 188 | $inputPath = $input->getOption('path'); |
189 | 189 | if ($inputPath) { |
190 | - $inputPath = '/' . trim($inputPath, '/'); |
|
191 | - [, $user,] = explode('/', $inputPath, 3); |
|
190 | + $inputPath = '/'.trim($inputPath, '/'); |
|
191 | + [, $user, ] = explode('/', $inputPath, 3); |
|
192 | 192 | $users = [$user]; |
193 | 193 | } elseif ($input->getOption('all')) { |
194 | 194 | $users = $this->userManager->search(''); |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | if (is_object($user)) { |
217 | 217 | $user = $user->getUID(); |
218 | 218 | } |
219 | - $path = $inputPath ?: '/' . $user; |
|
219 | + $path = $inputPath ?: '/'.$user; |
|
220 | 220 | ++$user_count; |
221 | 221 | if ($this->userManager->userExists($user)) { |
222 | 222 | $output->writeln("Starting scan for user $user_count out of $users_total ($user)"); |
@@ -268,8 +268,8 @@ discard block |
||
268 | 268 | return false; |
269 | 269 | } |
270 | 270 | $e = new \ErrorException($message, 0, $severity, $file, $line); |
271 | - $output->writeln('<error>Error during scan: ' . $e->getMessage() . '</error>'); |
|
272 | - $output->writeln('<error>' . $e->getTraceAsString() . '</error>', OutputInterface::VERBOSITY_VERY_VERBOSE); |
|
271 | + $output->writeln('<error>Error during scan: '.$e->getMessage().'</error>'); |
|
272 | + $output->writeln('<error>'.$e->getTraceAsString().'</error>', OutputInterface::VERBOSITY_VERY_VERBOSE); |
|
273 | 273 | ++$this->errorsCounter; |
274 | 274 | return true; |
275 | 275 | } |
@@ -311,9 +311,9 @@ discard block |
||
311 | 311 | * Formats microtime into a human-readable format |
312 | 312 | */ |
313 | 313 | protected function formatExecTime(): string { |
314 | - $secs = (int)round($this->execTime); |
|
314 | + $secs = (int) round($this->execTime); |
|
315 | 315 | # convert seconds into HH:MM:SS form |
316 | - return sprintf('%02d:%02d:%02d', (int)($secs / 3600), ((int)($secs / 60) % 60), $secs % 60); |
|
316 | + return sprintf('%02d:%02d:%02d', (int) ($secs / 3600), ((int) ($secs / 60) % 60), $secs % 60); |
|
317 | 317 | } |
318 | 318 | |
319 | 319 | protected function reconnectToDatabase(OutputInterface $output): Connection { |
@@ -71,13 +71,13 @@ discard block |
||
71 | 71 | /** @var Scanner $scanner */ |
72 | 72 | $scanner = $storage->getScanner(); |
73 | 73 | |
74 | - $scanner->listen('\OC\Files\Cache\Scanner', 'scanFile', function (string $path) use ($output): void { |
|
74 | + $scanner->listen('\OC\Files\Cache\Scanner', 'scanFile', function(string $path) use ($output): void { |
|
75 | 75 | $output->writeln("\tFile\t<info>$path</info>", OutputInterface::VERBOSITY_VERBOSE); |
76 | 76 | ++$this->filesCounter; |
77 | 77 | $this->abortIfInterrupted(); |
78 | 78 | }); |
79 | 79 | |
80 | - $scanner->listen('\OC\Files\Cache\Scanner', 'scanFolder', function (string $path) use ($output): void { |
|
80 | + $scanner->listen('\OC\Files\Cache\Scanner', 'scanFolder', function(string $path) use ($output): void { |
|
81 | 81 | $output->writeln("\tFolder\t<info>$path</info>", OutputInterface::VERBOSITY_VERBOSE); |
82 | 82 | ++$this->foldersCounter; |
83 | 83 | $this->abortIfInterrupted(); |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | if ($e->getReadablePath() === 'scanner::') { |
91 | 91 | $output->writeln('<error>Another process is already scanning this storage</error>'); |
92 | 92 | } else { |
93 | - $output->writeln('<error>Another process is already scanning \'' . substr($e->getReadablePath(), strlen('scanner::')) . '\' in this storage</error>'); |
|
93 | + $output->writeln('<error>Another process is already scanning \''.substr($e->getReadablePath(), strlen('scanner::')).'\' in this storage</error>'); |
|
94 | 94 | } |
95 | 95 | } else { |
96 | 96 | throw $e; |