Completed
Pull Request — master (#10038)
by Robin
24:44
created
apps/files/lib/Command/Scan.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
 		$path = basename($fullPath);
117 117
 
118 118
 		if ($normalizedPath !== $path) {
119
-			$output->writeln("\t<error>Entry \"" . $fullPath . '" will not be accessible due to incompatible encoding</error>');
119
+			$output->writeln("\t<error>Entry \"".$fullPath.'" will not be accessible due to incompatible encoding</error>');
120 120
 		}
121 121
 	}
122 122
 
@@ -126,42 +126,42 @@  discard block
 block discarded – undo
126 126
 		# check on each file/folder if there was a user interrupt (ctrl-c) and throw an exception
127 127
 		# printout and count
128 128
 		if ($verbose) {
129
-			$scanner->listen('\OC\Files\Utils\Scanner', 'scanFile', function ($path) use ($output) {
129
+			$scanner->listen('\OC\Files\Utils\Scanner', 'scanFile', function($path) use ($output) {
130 130
 				$output->writeln("\tFile   <info>$path</info>");
131 131
 				$this->filesCounter += 1;
132 132
 				if ($this->hasBeenInterrupted()) {
133 133
 					throw new InterruptedException();
134 134
 				}
135 135
 			});
136
-			$scanner->listen('\OC\Files\Utils\Scanner', 'scanFolder', function ($path) use ($output) {
136
+			$scanner->listen('\OC\Files\Utils\Scanner', 'scanFolder', function($path) use ($output) {
137 137
 				$output->writeln("\tFolder <info>$path</info>");
138 138
 				$this->foldersCounter += 1;
139 139
 				if ($this->hasBeenInterrupted()) {
140 140
 					throw new InterruptedException();
141 141
 				}
142 142
 			});
143
-			$scanner->listen('\OC\Files\Utils\Scanner', 'StorageNotAvailable', function (StorageNotAvailableException $e) use ($output) {
144
-				$output->writeln("Error while scanning, storage not available (" . $e->getMessage() . ")");
143
+			$scanner->listen('\OC\Files\Utils\Scanner', 'StorageNotAvailable', function(StorageNotAvailableException $e) use ($output) {
144
+				$output->writeln("Error while scanning, storage not available (".$e->getMessage().")");
145 145
 			});
146 146
 			# count only
147 147
 		} else {
148
-			$scanner->listen('\OC\Files\Utils\Scanner', 'scanFile', function () use ($output) {
148
+			$scanner->listen('\OC\Files\Utils\Scanner', 'scanFile', function() use ($output) {
149 149
 				$this->filesCounter += 1;
150 150
 				if ($this->hasBeenInterrupted()) {
151 151
 					throw new InterruptedException();
152 152
 				}
153 153
 			});
154
-			$scanner->listen('\OC\Files\Utils\Scanner', 'scanFolder', function () use ($output) {
154
+			$scanner->listen('\OC\Files\Utils\Scanner', 'scanFolder', function() use ($output) {
155 155
 				$this->foldersCounter += 1;
156 156
 				if ($this->hasBeenInterrupted()) {
157 157
 					throw new InterruptedException();
158 158
 				}
159 159
 			});
160 160
 		}
161
-		$scanner->listen('\OC\Files\Utils\Scanner', 'scanFile', function ($path) use ($output) {
161
+		$scanner->listen('\OC\Files\Utils\Scanner', 'scanFile', function($path) use ($output) {
162 162
 			$this->checkScanWarning($path, $output);
163 163
 		});
164
-		$scanner->listen('\OC\Files\Utils\Scanner', 'scanFolder', function ($path) use ($output) {
164
+		$scanner->listen('\OC\Files\Utils\Scanner', 'scanFolder', function($path) use ($output) {
165 165
 			$this->checkScanWarning($path, $output);
166 166
 		});
167 167
 
@@ -178,10 +178,10 @@  discard block
 block discarded – undo
178 178
 			# exit the function if ctrl-c has been pressed
179 179
 			$output->writeln('Interrupted by user');
180 180
 		} catch (NotFoundException $e) {
181
-			$output->writeln('<error>Path not found: ' . $e->getMessage() . '</error>');
181
+			$output->writeln('<error>Path not found: '.$e->getMessage().'</error>');
182 182
 		} catch (\Exception $e) {
183
-			$output->writeln('<error>Exception during scan: ' . $e->getMessage() . '</error>');
184
-			$output->writeln('<error>' . $e->getTraceAsString() . '</error>');
183
+			$output->writeln('<error>Exception during scan: '.$e->getMessage().'</error>');
184
+			$output->writeln('<error>'.$e->getTraceAsString().'</error>');
185 185
 		}
186 186
 	}
187 187
 
@@ -193,7 +193,7 @@  discard block
 block discarded – undo
193 193
 	protected function execute(InputInterface $input, OutputInterface $output) {
194 194
 		$inputPath = $input->getOption('path');
195 195
 		if ($inputPath) {
196
-			$inputPath = '/' . trim($inputPath, '/');
196
+			$inputPath = '/'.trim($inputPath, '/');
197 197
 			list (, $user,) = explode('/', $inputPath, 3);
198 198
 			$users = array($user);
199 199
 		} else if ($input->getOption('all')) {
@@ -237,7 +237,7 @@  discard block
 block discarded – undo
237 237
 			if (is_object($user)) {
238 238
 				$user = $user->getUID();
239 239
 			}
240
-			$path = $inputPath ? $inputPath : '/' . $user;
240
+			$path = $inputPath ? $inputPath : '/'.$user;
241 241
 			$user_count += 1;
242 242
 			if ($this->userManager->userExists($user)) {
243 243
 				# add an extra line when verbose is set to optical separate users
@@ -246,7 +246,7 @@  discard block
 block discarded – undo
246 246
 				}
247 247
 				$output->writeln("Starting scan for user $user_count out of $users_total ($user)");
248 248
 				# full: printout data if $verbose was set
249
-				$this->scanFiles($user, $path, $verbose, $output, $input->getOption('unscanned'), ! $input->getOption('shallow'), $input->getOption('home-only'));
249
+				$this->scanFiles($user, $path, $verbose, $output, $input->getOption('unscanned'), !$input->getOption('shallow'), $input->getOption('home-only'));
250 250
 			} else {
251 251
 				$output->writeln("<error>Unknown user $user_count $user</error>");
252 252
 			}
@@ -337,7 +337,7 @@  discard block
 block discarded – undo
337 337
 	 * @return string
338 338
 	 */
339 339
 	protected function formatExecTime() {
340
-		list($secs, ) = explode('.', sprintf("%.1f", $this->execTime));
340
+		list($secs,) = explode('.', sprintf("%.1f", $this->execTime));
341 341
 
342 342
 		# if you want to have microseconds add this:   . '.' . $tens;
343 343
 		return date('H:i:s', $secs);
Please login to merge, or discard this patch.