Passed
Push — master ( f0dd71...c56a27 )
by Christoph
11:49 queued 12s
created
core/Command/Check.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -50,7 +50,7 @@
 block discarded – undo
50 50
 	protected function execute(InputInterface $input, OutputInterface $output) {
51 51
 		$errors = \OC_Util::checkServer($this->config);
52 52
 		if (!empty($errors)) {
53
-			$errors = array_map(function ($item) {
53
+			$errors = array_map(function($item) {
54 54
 				return (string) $item['error'];
55 55
 			}, $errors);
56 56
 
Please login to merge, or discard this patch.
core/Command/Encryption/ListModules.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -67,11 +67,11 @@
 block discarded – undo
67 67
 	 */
68 68
 	protected function writeModuleList(InputInterface $input, OutputInterface $output, $items) {
69 69
 		if ($input->getOption('output') === self::OUTPUT_FORMAT_PLAIN) {
70
-			array_walk($items, function (&$item) {
70
+			array_walk($items, function(&$item) {
71 71
 				if (!$item['default']) {
72 72
 					$item = $item['displayName'];
73 73
 				} else {
74
-					$item = $item['displayName'] . ' [default*]';
74
+					$item = $item['displayName'].' [default*]';
75 75
 				}
76 76
 			});
77 77
 		}
Please login to merge, or discard this patch.
core/ajax/update.php 1 patch
Spacing   +54 added lines, -54 removed lines patch added patch discarded remove patch
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
 // need to send an initial message to force-init the event source,
47 47
 // which will then trigger its own CSRF check and produces its own CSRF error
48 48
 // message
49
-$eventSource->send('success', (string)$l->t('Preparing update'));
49
+$eventSource->send('success', (string) $l->t('Preparing update'));
50 50
 
51 51
 class FeedBackHandler {
52 52
 	/** @var integer */
@@ -82,23 +82,23 @@  discard block
 block discarded – undo
82 82
 				if (empty($desc)) {
83 83
 					$desc = $this->currentStep;
84 84
 				}
85
-				$this->eventSource->send('success', (string)$this->l10n->t('[%d / %d]: %s', [$this->progressStateStep, $this->progressStateMax, $desc]));
85
+				$this->eventSource->send('success', (string) $this->l10n->t('[%d / %d]: %s', [$this->progressStateStep, $this->progressStateMax, $desc]));
86 86
 				break;
87 87
 			case '\OC\Repair::finishProgress':
88 88
 				$this->progressStateMax = $this->progressStateStep;
89
-				$this->eventSource->send('success', (string)$this->l10n->t('[%d / %d]: %s', [$this->progressStateStep, $this->progressStateMax, $this->currentStep]));
89
+				$this->eventSource->send('success', (string) $this->l10n->t('[%d / %d]: %s', [$this->progressStateStep, $this->progressStateMax, $this->currentStep]));
90 90
 				break;
91 91
 			case '\OC\Repair::step':
92
-				$this->eventSource->send('success', (string)$this->l10n->t('Repair step:') . ' ' . $event->getArgument(0));
92
+				$this->eventSource->send('success', (string) $this->l10n->t('Repair step:').' '.$event->getArgument(0));
93 93
 				break;
94 94
 			case '\OC\Repair::info':
95
-				$this->eventSource->send('success', (string)$this->l10n->t('Repair info:') . ' ' . $event->getArgument(0));
95
+				$this->eventSource->send('success', (string) $this->l10n->t('Repair info:').' '.$event->getArgument(0));
96 96
 				break;
97 97
 			case '\OC\Repair::warning':
98
-				$this->eventSource->send('notice', (string)$this->l10n->t('Repair warning:') . ' ' . $event->getArgument(0));
98
+				$this->eventSource->send('notice', (string) $this->l10n->t('Repair warning:').' '.$event->getArgument(0));
99 99
 				break;
100 100
 			case '\OC\Repair::error':
101
-				$this->eventSource->send('notice', (string)$this->l10n->t('Repair error:') . ' ' . $event->getArgument(0));
101
+				$this->eventSource->send('notice', (string) $this->l10n->t('Repair error:').' '.$event->getArgument(0));
102 102
 				break;
103 103
 		}
104 104
 	}
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
 
109 109
 	$config = \OC::$server->getSystemConfig();
110 110
 	if ($config->getValue('upgrade.disable-web', false)) {
111
-		$eventSource->send('failure', (string)$l->t('Please use the command line updater because automatic updating is disabled in the config.php.'));
111
+		$eventSource->send('failure', (string) $l->t('Please use the command line updater because automatic updating is disabled in the config.php.'));
112 112
 		$eventSource->close();
113 113
 		exit();
114 114
 	}
@@ -128,14 +128,14 @@  discard block
 block discarded – undo
128 128
 	$incompatibleApps = [];
129 129
 
130 130
 	$dispatcher = \OC::$server->getEventDispatcher();
131
-	$dispatcher->addListener('\OC\DB\Migrator::executeSql', function ($event) use ($eventSource, $l) {
131
+	$dispatcher->addListener('\OC\DB\Migrator::executeSql', function($event) use ($eventSource, $l) {
132 132
 		if ($event instanceof GenericEvent) {
133
-			$eventSource->send('success', (string)$l->t('[%d / %d]: %s', [$event[0], $event[1], $event->getSubject()]));
133
+			$eventSource->send('success', (string) $l->t('[%d / %d]: %s', [$event[0], $event[1], $event->getSubject()]));
134 134
 		}
135 135
 	});
136
-	$dispatcher->addListener('\OC\DB\Migrator::checkTable', function ($event) use ($eventSource, $l) {
136
+	$dispatcher->addListener('\OC\DB\Migrator::checkTable', function($event) use ($eventSource, $l) {
137 137
 		if ($event instanceof GenericEvent) {
138
-			$eventSource->send('success', (string)$l->t('[%d / %d]: Checking table %s', [$event[0], $event[1], $event->getSubject()]));
138
+			$eventSource->send('success', (string) $l->t('[%d / %d]: Checking table %s', [$event[0], $event[1], $event->getSubject()]));
139 139
 		}
140 140
 	});
141 141
 	$feedBack = new FeedBackHandler($eventSource, $l);
@@ -147,67 +147,67 @@  discard block
 block discarded – undo
147 147
 	$dispatcher->addListener('\OC\Repair::warning', [$feedBack, 'handleRepairFeedback']);
148 148
 	$dispatcher->addListener('\OC\Repair::error', [$feedBack, 'handleRepairFeedback']);
149 149
 
150
-	$updater->listen('\OC\Updater', 'maintenanceEnabled', function () use ($eventSource, $l) {
151
-		$eventSource->send('success', (string)$l->t('Turned on maintenance mode'));
150
+	$updater->listen('\OC\Updater', 'maintenanceEnabled', function() use ($eventSource, $l) {
151
+		$eventSource->send('success', (string) $l->t('Turned on maintenance mode'));
152 152
 	});
153
-	$updater->listen('\OC\Updater', 'maintenanceDisabled', function () use ($eventSource, $l) {
154
-		$eventSource->send('success', (string)$l->t('Turned off maintenance mode'));
153
+	$updater->listen('\OC\Updater', 'maintenanceDisabled', function() use ($eventSource, $l) {
154
+		$eventSource->send('success', (string) $l->t('Turned off maintenance mode'));
155 155
 	});
156
-	$updater->listen('\OC\Updater', 'maintenanceActive', function () use ($eventSource, $l) {
157
-		$eventSource->send('success', (string)$l->t('Maintenance mode is kept active'));
156
+	$updater->listen('\OC\Updater', 'maintenanceActive', function() use ($eventSource, $l) {
157
+		$eventSource->send('success', (string) $l->t('Maintenance mode is kept active'));
158 158
 	});
159
-	$updater->listen('\OC\Updater', 'dbUpgradeBefore', function () use ($eventSource, $l) {
160
-		$eventSource->send('success', (string)$l->t('Updating database schema'));
159
+	$updater->listen('\OC\Updater', 'dbUpgradeBefore', function() use ($eventSource, $l) {
160
+		$eventSource->send('success', (string) $l->t('Updating database schema'));
161 161
 	});
162
-	$updater->listen('\OC\Updater', 'dbUpgrade', function () use ($eventSource, $l) {
163
-		$eventSource->send('success', (string)$l->t('Updated database'));
162
+	$updater->listen('\OC\Updater', 'dbUpgrade', function() use ($eventSource, $l) {
163
+		$eventSource->send('success', (string) $l->t('Updated database'));
164 164
 	});
165
-	$updater->listen('\OC\Updater', 'dbSimulateUpgradeBefore', function () use ($eventSource, $l) {
166
-		$eventSource->send('success', (string)$l->t('Checking whether the database schema can be updated (this can take a long time depending on the database size)'));
165
+	$updater->listen('\OC\Updater', 'dbSimulateUpgradeBefore', function() use ($eventSource, $l) {
166
+		$eventSource->send('success', (string) $l->t('Checking whether the database schema can be updated (this can take a long time depending on the database size)'));
167 167
 	});
168
-	$updater->listen('\OC\Updater', 'dbSimulateUpgrade', function () use ($eventSource, $l) {
169
-		$eventSource->send('success', (string)$l->t('Checked database schema update'));
168
+	$updater->listen('\OC\Updater', 'dbSimulateUpgrade', function() use ($eventSource, $l) {
169
+		$eventSource->send('success', (string) $l->t('Checked database schema update'));
170 170
 	});
171
-	$updater->listen('\OC\Updater', 'appUpgradeCheckBefore', function () use ($eventSource, $l) {
172
-		$eventSource->send('success', (string)$l->t('Checking updates of apps'));
171
+	$updater->listen('\OC\Updater', 'appUpgradeCheckBefore', function() use ($eventSource, $l) {
172
+		$eventSource->send('success', (string) $l->t('Checking updates of apps'));
173 173
 	});
174
-	$updater->listen('\OC\Updater', 'checkAppStoreAppBefore', function ($app) use ($eventSource, $l) {
175
-		$eventSource->send('success', (string)$l->t('Checking for update of app "%s" in appstore', [$app]));
174
+	$updater->listen('\OC\Updater', 'checkAppStoreAppBefore', function($app) use ($eventSource, $l) {
175
+		$eventSource->send('success', (string) $l->t('Checking for update of app "%s" in appstore', [$app]));
176 176
 	});
177
-	$updater->listen('\OC\Updater', 'upgradeAppStoreApp', function ($app) use ($eventSource, $l) {
178
-		$eventSource->send('success', (string)$l->t('Update app "%s" from appstore', [$app]));
177
+	$updater->listen('\OC\Updater', 'upgradeAppStoreApp', function($app) use ($eventSource, $l) {
178
+		$eventSource->send('success', (string) $l->t('Update app "%s" from appstore', [$app]));
179 179
 	});
180
-	$updater->listen('\OC\Updater', 'checkAppStoreApp', function ($app) use ($eventSource, $l) {
181
-		$eventSource->send('success', (string)$l->t('Checked for update of app "%s" in appstore', [$app]));
180
+	$updater->listen('\OC\Updater', 'checkAppStoreApp', function($app) use ($eventSource, $l) {
181
+		$eventSource->send('success', (string) $l->t('Checked for update of app "%s" in appstore', [$app]));
182 182
 	});
183
-	$updater->listen('\OC\Updater', 'appSimulateUpdate', function ($app) use ($eventSource, $l) {
184
-		$eventSource->send('success', (string)$l->t('Checking whether the database schema for %s can be updated (this can take a long time depending on the database size)', [$app]));
183
+	$updater->listen('\OC\Updater', 'appSimulateUpdate', function($app) use ($eventSource, $l) {
184
+		$eventSource->send('success', (string) $l->t('Checking whether the database schema for %s can be updated (this can take a long time depending on the database size)', [$app]));
185 185
 	});
186
-	$updater->listen('\OC\Updater', 'appUpgradeCheck', function () use ($eventSource, $l) {
187
-		$eventSource->send('success', (string)$l->t('Checked database schema update for apps'));
186
+	$updater->listen('\OC\Updater', 'appUpgradeCheck', function() use ($eventSource, $l) {
187
+		$eventSource->send('success', (string) $l->t('Checked database schema update for apps'));
188 188
 	});
189
-	$updater->listen('\OC\Updater', 'appUpgrade', function ($app, $version) use ($eventSource, $l) {
190
-		$eventSource->send('success', (string)$l->t('Updated "%1$s" to %2$s', [$app, $version]));
189
+	$updater->listen('\OC\Updater', 'appUpgrade', function($app, $version) use ($eventSource, $l) {
190
+		$eventSource->send('success', (string) $l->t('Updated "%1$s" to %2$s', [$app, $version]));
191 191
 	});
192
-	$updater->listen('\OC\Updater', 'incompatibleAppDisabled', function ($app) use (&$incompatibleApps) {
193
-		$incompatibleApps[]= $app;
192
+	$updater->listen('\OC\Updater', 'incompatibleAppDisabled', function($app) use (&$incompatibleApps) {
193
+		$incompatibleApps[] = $app;
194 194
 	});
195
-	$updater->listen('\OC\Updater', 'failure', function ($message) use ($eventSource, $config) {
195
+	$updater->listen('\OC\Updater', 'failure', function($message) use ($eventSource, $config) {
196 196
 		$eventSource->send('failure', $message);
197 197
 		$eventSource->close();
198 198
 		$config->setSystemValue('maintenance', false);
199 199
 	});
200
-	$updater->listen('\OC\Updater', 'setDebugLogLevel', function ($logLevel, $logLevelName) use ($eventSource, $l) {
201
-		$eventSource->send('success', (string)$l->t('Set log level to debug'));
200
+	$updater->listen('\OC\Updater', 'setDebugLogLevel', function($logLevel, $logLevelName) use ($eventSource, $l) {
201
+		$eventSource->send('success', (string) $l->t('Set log level to debug'));
202 202
 	});
203
-	$updater->listen('\OC\Updater', 'resetLogLevel', function ($logLevel, $logLevelName) use ($eventSource, $l) {
204
-		$eventSource->send('success', (string)$l->t('Reset log level'));
203
+	$updater->listen('\OC\Updater', 'resetLogLevel', function($logLevel, $logLevelName) use ($eventSource, $l) {
204
+		$eventSource->send('success', (string) $l->t('Reset log level'));
205 205
 	});
206
-	$updater->listen('\OC\Updater', 'startCheckCodeIntegrity', function () use ($eventSource, $l) {
207
-		$eventSource->send('success', (string)$l->t('Starting code integrity check'));
206
+	$updater->listen('\OC\Updater', 'startCheckCodeIntegrity', function() use ($eventSource, $l) {
207
+		$eventSource->send('success', (string) $l->t('Starting code integrity check'));
208 208
 	});
209
-	$updater->listen('\OC\Updater', 'finishedCheckCodeIntegrity', function () use ($eventSource, $l) {
210
-		$eventSource->send('success', (string)$l->t('Finished code integrity check'));
209
+	$updater->listen('\OC\Updater', 'finishedCheckCodeIntegrity', function() use ($eventSource, $l) {
210
+		$eventSource->send('success', (string) $l->t('Finished code integrity check'));
211 211
 	});
212 212
 
213 213
 	try {
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
 			'level' => ILogger::ERROR,
218 218
 			'app' => 'update',
219 219
 		]);
220
-		$eventSource->send('failure', get_class($e) . ': ' . $e->getMessage());
220
+		$eventSource->send('failure', get_class($e).': '.$e->getMessage());
221 221
 		$eventSource->close();
222 222
 		exit();
223 223
 	}
@@ -229,10 +229,10 @@  discard block
 block discarded – undo
229 229
 
230 230
 	if (!empty($disabledApps)) {
231 231
 		$eventSource->send('notice',
232
-			(string)$l->t('Following apps have been disabled: %s', [implode(', ', $disabledApps)]));
232
+			(string) $l->t('Following apps have been disabled: %s', [implode(', ', $disabledApps)]));
233 233
 	}
234 234
 } else {
235
-	$eventSource->send('notice', (string)$l->t('Already up to date'));
235
+	$eventSource->send('notice', (string) $l->t('Already up to date'));
236 236
 }
237 237
 
238 238
 $eventSource->send('done', '');
Please login to merge, or discard this patch.
core/Controller/LostController.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
 	 */
196 196
 	protected function checkPasswordResetToken($token, $userId) {
197 197
 		$user = $this->userManager->get($userId);
198
-		if($user === null || !$user->isEnabled()) {
198
+		if ($user === null || !$user->isEnabled()) {
199 199
 			throw new \Exception($this->l10n->t('Couldn\'t reset password because the token is invalid'));
200 200
 		}
201 201
 
@@ -212,11 +212,11 @@  discard block
 block discarded – undo
212 212
 		}
213 213
 
214 214
 		$splittedToken = explode(':', $decryptedToken);
215
-		if(count($splittedToken) !== 2) {
215
+		if (count($splittedToken) !== 2) {
216 216
 			throw new \Exception($this->l10n->t('Couldn\'t reset password because the token is invalid'));
217 217
 		}
218 218
 
219
-		if ($splittedToken[0] < ($this->timeFactory->getTime() - 60*60*24*7) ||
219
+		if ($splittedToken[0] < ($this->timeFactory->getTime() - 60 * 60 * 24 * 7) ||
220 220
 			$user->getLastLogin() > $splittedToken[0]) {
221 221
 			throw new \Exception($this->l10n->t('Couldn\'t reset password because the token is expired'));
222 222
 		}
@@ -231,7 +231,7 @@  discard block
 block discarded – undo
231 231
 	 * @param array $additional
232 232
 	 * @return array
233 233
 	 */
234
-	private function error($message, array $additional=[]) {
234
+	private function error($message, array $additional = []) {
235 235
 		return array_merge(['status' => 'error', 'msg' => $message], $additional);
236 236
 	}
237 237
 
@@ -267,7 +267,7 @@  discard block
 block discarded – undo
267 267
 			$this->sendEmail($user);
268 268
 		} catch (ResetPasswordException $e) {
269 269
 			// Ignore the error since we do not want to leak this info
270
-			$this->logger->warning('Could not send password reset email: ' . $e->getMessage());
270
+			$this->logger->warning('Could not send password reset email: '.$e->getMessage());
271 271
 		} catch (\Exception $e) {
272 272
 			$this->logger->logException($e);
273 273
 		}
@@ -318,9 +318,9 @@  discard block
 block discarded – undo
318 318
 
319 319
 			$this->config->deleteUserValue($userId, 'core', 'lostpassword');
320 320
 			@\OC::$server->getUserSession()->unsetMagicInCookie();
321
-		} catch (HintException $e){
321
+		} catch (HintException $e) {
322 322
 			return $this->error($e->getHint());
323
-		} catch (\Exception $e){
323
+		} catch (\Exception $e) {
324 324
 			return $this->error($e->getMessage());
325 325
 		}
326 326
 
@@ -337,7 +337,7 @@  discard block
 block discarded – undo
337 337
 		$email = $user->getEMailAddress();
338 338
 
339 339
 		if (empty($email)) {
340
-			throw new ResetPasswordException('Could not send reset e-mail since there is no email for username ' . $input);
340
+			throw new ResetPasswordException('Could not send reset e-mail since there is no email for username '.$input);
341 341
 		}
342 342
 
343 343
 		// Generate the token. It is stored encrypted in the database with the
@@ -350,8 +350,8 @@  discard block
 block discarded – undo
350 350
 			ISecureRandom::CHAR_LOWER.
351 351
 			ISecureRandom::CHAR_UPPER
352 352
 		);
353
-		$tokenValue = $this->timeFactory->getTime() .':'. $token;
354
-		$encryptedValue = $this->crypto->encrypt($tokenValue, $email . $this->config->getSystemValue('secret'));
353
+		$tokenValue = $this->timeFactory->getTime().':'.$token;
354
+		$encryptedValue = $this->crypto->encrypt($tokenValue, $email.$this->config->getSystemValue('secret'));
355 355
 		$this->config->setUserValue($user->getUID(), 'core', 'lostpassword', $encryptedValue);
356 356
 
357 357
 		$link = $this->urlGenerator->linkToRouteAbsolute('core.lost.resetform', ['userId' => $user->getUID(), 'token' => $token]);
@@ -403,7 +403,7 @@  discard block
 block discarded – undo
403 403
 			return $user;
404 404
 		}
405 405
 
406
-		$users = array_filter($this->userManager->getByEmail($input), function (IUser $user) {
406
+		$users = array_filter($this->userManager->getByEmail($input), function(IUser $user) {
407 407
 			return $user->isEnabled();
408 408
 		});
409 409
 
Please login to merge, or discard this patch.
core/Command/Maintenance/Mimetype/GenerateMimetypeFileBuilder.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -36,10 +36,10 @@  discard block
 block discarded – undo
36 36
 	 */
37 37
 	public function generateFile(array $aliases): string {
38 38
 		// Remove comments
39
-		$keys = array_filter(array_keys($aliases), function ($k) {
39
+		$keys = array_filter(array_keys($aliases), function($k) {
40 40
 			return $k[0] === '_';
41 41
 		});
42
-		foreach($keys as $key) {
42
+		foreach ($keys as $key) {
43 43
 			unset($aliases[$key]);
44 44
 		}
45 45
 
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
 		$dir = new \DirectoryIterator(\OC::$SERVERROOT.'/core/img/filetypes');
48 48
 
49 49
 		$files = [];
50
-		foreach($dir as $fileInfo) {
50
+		foreach ($dir as $fileInfo) {
51 51
 			if ($fileInfo->isFile()) {
52 52
 				$file = preg_replace('/.[^.]*$/', '', $fileInfo->getFilename());
53 53
 				$files[] = $file;
@@ -61,14 +61,14 @@  discard block
 block discarded – undo
61 61
 		// Fetch all themes!
62 62
 		$themes = [];
63 63
 		$dirs = new \DirectoryIterator(\OC::$SERVERROOT.'/themes/');
64
-		foreach($dirs as $dir) {
64
+		foreach ($dirs as $dir) {
65 65
 			//Valid theme dir
66 66
 			if ($dir->isFile() || $dir->isDot()) {
67 67
 				continue;
68 68
 			}
69 69
 
70 70
 			$theme = $dir->getFilename();
71
-			$themeDir = $dir->getPath() . '/' . $theme . '/core/img/filetypes/';
71
+			$themeDir = $dir->getPath().'/'.$theme.'/core/img/filetypes/';
72 72
 			// Check if this theme has its own filetype icons
73 73
 			if (!file_exists($themeDir)) {
74 74
 				continue;
@@ -99,9 +99,9 @@  discard block
 block discarded – undo
99 99
 * To regenerate this file run ./occ maintenance:mimetype:update-js
100 100
 */
101 101
 OC.MimeTypeList={
102
-	aliases: ' . json_encode($aliases, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES) . ',
103
-	files: ' . json_encode($files, JSON_PRETTY_PRINT) . ',
104
-	themes: ' . json_encode($themes, JSON_PRETTY_PRINT) . '
102
+	aliases: ' . json_encode($aliases, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES).',
103
+	files: ' . json_encode($files, JSON_PRETTY_PRINT).',
104
+	themes: ' . json_encode($themes, JSON_PRETTY_PRINT).'
105 105
 };
106 106
 ';
107 107
 	}
Please login to merge, or discard this patch.
core/Command/App/CheckCode.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
 use Symfony\Component\Console\Input\InputOption;
43 43
 use Symfony\Component\Console\Output\OutputInterface;
44 44
 
45
-class CheckCode extends Command implements CompletionAwareInterface  {
45
+class CheckCode extends Command implements CompletionAwareInterface {
46 46
 
47 47
 	protected $checkers = [
48 48
 		'private' => PrivateCheck::class,
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
 				'c',
65 65
 				InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY,
66 66
 				'enable the specified checker(s)',
67
-				[ 'private', 'deprecation', 'strong-comparison' ]
67
+				['private', 'deprecation', 'strong-comparison']
68 68
 			)
69 69
 			->addOption(
70 70
 				'--skip-checkers',
@@ -94,40 +94,40 @@  discard block
 block discarded – undo
94 94
 
95 95
 		$codeChecker = new CodeChecker($checkList, !$input->getOption('skip-validate-info'));
96 96
 
97
-		$codeChecker->listen('CodeChecker', 'analyseFileBegin', function ($params) use ($output) {
98
-			if(OutputInterface::VERBOSITY_VERBOSE <= $output->getVerbosity()) {
97
+		$codeChecker->listen('CodeChecker', 'analyseFileBegin', function($params) use ($output) {
98
+			if (OutputInterface::VERBOSITY_VERBOSE <= $output->getVerbosity()) {
99 99
 				$output->writeln("<info>Analysing {$params}</info>");
100 100
 			}
101 101
 		});
102
-		$codeChecker->listen('CodeChecker', 'analyseFileFinished', function ($filename, $errors) use ($output) {
102
+		$codeChecker->listen('CodeChecker', 'analyseFileFinished', function($filename, $errors) use ($output) {
103 103
 			$count = count($errors);
104 104
 
105 105
 			// show filename if the verbosity is low, but there are errors in a file
106
-			if($count > 0 && OutputInterface::VERBOSITY_VERBOSE > $output->getVerbosity()) {
106
+			if ($count > 0 && OutputInterface::VERBOSITY_VERBOSE > $output->getVerbosity()) {
107 107
 				$output->writeln("<info>Analysing {$filename}</info>");
108 108
 			}
109 109
 
110 110
 			// show error count if there are errors present or the verbosity is high
111
-			if($count > 0 || OutputInterface::VERBOSITY_VERBOSE <= $output->getVerbosity()) {
111
+			if ($count > 0 || OutputInterface::VERBOSITY_VERBOSE <= $output->getVerbosity()) {
112 112
 				$output->writeln(" {$count} errors");
113 113
 			}
114
-			usort($errors, function ($a, $b) {
115
-				return $a['line'] >$b['line'];
114
+			usort($errors, function($a, $b) {
115
+				return $a['line'] > $b['line'];
116 116
 			});
117 117
 
118
-			foreach($errors as $p) {
118
+			foreach ($errors as $p) {
119 119
 				$line = sprintf("%' 4d", $p['line']);
120 120
 				$output->writeln("    <error>line $line: {$p['disallowedToken']} - {$p['reason']}</error>");
121 121
 			}
122 122
 		});
123 123
 		$errors = [];
124
-		if(!$input->getOption('skip-checkers')) {
124
+		if (!$input->getOption('skip-checkers')) {
125 125
 			$errors = $codeChecker->analyse($appId);
126 126
 		}
127 127
 
128
-		if(!$input->getOption('skip-validate-info')) {
128
+		if (!$input->getOption('skip-validate-info')) {
129 129
 			$infoChecker = new InfoChecker();
130
-			$infoChecker->listen('InfoChecker', 'parseError', function ($error) use ($output) {
130
+			$infoChecker->listen('InfoChecker', 'parseError', function($error) use ($output) {
131 131
 				$output->writeln("<error>Invalid appinfo.xml file found: $error</error>");
132 132
 			});
133 133
 
@@ -178,7 +178,7 @@  discard block
 block discarded – undo
178 178
 			throw new \RuntimeException("No app with given id <$appId> known.");
179 179
 		}
180 180
 
181
-		$updatePhp = $appPath . '/appinfo/update.php';
181
+		$updatePhp = $appPath.'/appinfo/update.php';
182 182
 		if (file_exists($updatePhp)) {
183 183
 			$output->writeln("<info>Deprecated file found: $updatePhp - please use repair steps</info>");
184 184
 		}
Please login to merge, or discard this patch.
core/Command/Upgrade.php 1 patch
Spacing   +41 added lines, -41 removed lines patch added patch discarded remove patch
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
 	 */
88 88
 	protected function execute(InputInterface $input, OutputInterface $output) {
89 89
 
90
-		if(Util::needUpgrade()) {
90
+		if (Util::needUpgrade()) {
91 91
 			if (OutputInterface::VERBOSITY_NORMAL < $output->getVerbosity()) {
92 92
 				// Prepend each line with a little timestamp
93 93
 				$timestampFormatter = new TimestampFormatter($this->config, $output->getFormatter());
@@ -105,14 +105,14 @@  discard block
 block discarded – undo
105 105
 			$dispatcher = \OC::$server->getEventDispatcher();
106 106
 			$progress = new ProgressBar($output);
107 107
 			$progress->setFormat(" %message%\n %current%/%max% [%bar%] %percent:3s%%");
108
-			$listener = function ($event) use ($progress, $output) {
108
+			$listener = function($event) use ($progress, $output) {
109 109
 				if ($event instanceof GenericEvent) {
110 110
 					$message = $event->getSubject();
111 111
 					if (OutputInterface::VERBOSITY_NORMAL < $output->getVerbosity()) {
112
-						$output->writeln(' Checking table ' . $message);
112
+						$output->writeln(' Checking table '.$message);
113 113
 					} else {
114 114
 						if (strlen($message) > 60) {
115
-							$message = substr($message, 0, 57) . '...';
115
+							$message = substr($message, 0, 57).'...';
116 116
 						}
117 117
 						$progress->setMessage($message);
118 118
 						if ($event[0] === 1) {
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
 					}
129 129
 				}
130 130
 			};
131
-			$repairListener = function ($event) use ($progress, $output) {
131
+			$repairListener = function($event) use ($progress, $output) {
132 132
 				if (!$event instanceof GenericEvent) {
133 133
 					return;
134 134
 				}
@@ -153,20 +153,20 @@  discard block
 block discarded – undo
153 153
 						$output->writeln('');
154 154
 						break;
155 155
 					case '\OC\Repair::step':
156
-						if(OutputInterface::VERBOSITY_NORMAL < $output->getVerbosity()) {
157
-							$output->writeln('<info>Repair step: ' . $event->getArgument(0) . '</info>');
156
+						if (OutputInterface::VERBOSITY_NORMAL < $output->getVerbosity()) {
157
+							$output->writeln('<info>Repair step: '.$event->getArgument(0).'</info>');
158 158
 						}
159 159
 						break;
160 160
 					case '\OC\Repair::info':
161
-						if(OutputInterface::VERBOSITY_NORMAL < $output->getVerbosity()) {
162
-							$output->writeln('<info>Repair info: ' . $event->getArgument(0) . '</info>');
161
+						if (OutputInterface::VERBOSITY_NORMAL < $output->getVerbosity()) {
162
+							$output->writeln('<info>Repair info: '.$event->getArgument(0).'</info>');
163 163
 						}
164 164
 						break;
165 165
 					case '\OC\Repair::warning':
166
-						$output->writeln('<error>Repair warning: ' . $event->getArgument(0) . '</error>');
166
+						$output->writeln('<error>Repair warning: '.$event->getArgument(0).'</error>');
167 167
 						break;
168 168
 					case '\OC\Repair::error':
169
-						$output->writeln('<error>Repair error: ' . $event->getArgument(0) . '</error>');
169
+						$output->writeln('<error>Repair error: '.$event->getArgument(0).'</error>');
170 170
 						break;
171 171
 				}
172 172
 			};
@@ -182,17 +182,17 @@  discard block
 block discarded – undo
182 182
 			$dispatcher->addListener('\OC\Repair::error', $repairListener);
183 183
 
184 184
 
185
-			$updater->listen('\OC\Updater', 'maintenanceEnabled', function () use ($output) {
185
+			$updater->listen('\OC\Updater', 'maintenanceEnabled', function() use ($output) {
186 186
 				$output->writeln('<info>Turned on maintenance mode</info>');
187 187
 			});
188
-			$updater->listen('\OC\Updater', 'maintenanceDisabled', function () use ($output) {
188
+			$updater->listen('\OC\Updater', 'maintenanceDisabled', function() use ($output) {
189 189
 				$output->writeln('<info>Turned off maintenance mode</info>');
190 190
 			});
191
-			$updater->listen('\OC\Updater', 'maintenanceActive', function () use ($output) {
191
+			$updater->listen('\OC\Updater', 'maintenanceActive', function() use ($output) {
192 192
 				$output->writeln('<info>Maintenance mode is kept active</info>');
193 193
 			});
194 194
 			$updater->listen('\OC\Updater', 'updateEnd',
195
-				function ($success) use ($output, $self) {
195
+				function($success) use ($output, $self) {
196 196
 					if ($success) {
197 197
 						$message = "<info>Update successful</info>";
198 198
 					} else {
@@ -200,58 +200,58 @@  discard block
 block discarded – undo
200 200
 					}
201 201
 					$output->writeln($message);
202 202
 				});
203
-			$updater->listen('\OC\Updater', 'dbUpgradeBefore', function () use ($output) {
203
+			$updater->listen('\OC\Updater', 'dbUpgradeBefore', function() use ($output) {
204 204
 				$output->writeln('<info>Updating database schema</info>');
205 205
 			});
206
-			$updater->listen('\OC\Updater', 'dbUpgrade', function () use ($output) {
206
+			$updater->listen('\OC\Updater', 'dbUpgrade', function() use ($output) {
207 207
 				$output->writeln('<info>Updated database</info>');
208 208
 			});
209
-			$updater->listen('\OC\Updater', 'dbSimulateUpgradeBefore', function () use ($output) {
209
+			$updater->listen('\OC\Updater', 'dbSimulateUpgradeBefore', function() use ($output) {
210 210
 				$output->writeln('<info>Checking whether the database schema can be updated (this can take a long time depending on the database size)</info>');
211 211
 			});
212
-			$updater->listen('\OC\Updater', 'dbSimulateUpgrade', function () use ($output) {
212
+			$updater->listen('\OC\Updater', 'dbSimulateUpgrade', function() use ($output) {
213 213
 				$output->writeln('<info>Checked database schema update</info>');
214 214
 			});
215
-			$updater->listen('\OC\Updater', 'incompatibleAppDisabled', function ($app) use ($output) {
216
-				$output->writeln('<comment>Disabled incompatible app: ' . $app . '</comment>');
215
+			$updater->listen('\OC\Updater', 'incompatibleAppDisabled', function($app) use ($output) {
216
+				$output->writeln('<comment>Disabled incompatible app: '.$app.'</comment>');
217 217
 			});
218
-			$updater->listen('\OC\Updater', 'checkAppStoreAppBefore', function ($app) use ($output) {
219
-				$output->writeln('<info>Checking for update of app ' . $app . ' in appstore</info>');
218
+			$updater->listen('\OC\Updater', 'checkAppStoreAppBefore', function($app) use ($output) {
219
+				$output->writeln('<info>Checking for update of app '.$app.' in appstore</info>');
220 220
 			});
221
-			$updater->listen('\OC\Updater', 'upgradeAppStoreApp', function ($app) use ($output) {
222
-				$output->writeln('<info>Update app ' . $app . ' from appstore</info>');
221
+			$updater->listen('\OC\Updater', 'upgradeAppStoreApp', function($app) use ($output) {
222
+				$output->writeln('<info>Update app '.$app.' from appstore</info>');
223 223
 			});
224
-			$updater->listen('\OC\Updater', 'checkAppStoreApp', function ($app) use ($output) {
225
-				$output->writeln('<info>Checked for update of app "' . $app . '" in appstore </info>');
224
+			$updater->listen('\OC\Updater', 'checkAppStoreApp', function($app) use ($output) {
225
+				$output->writeln('<info>Checked for update of app "'.$app.'" in appstore </info>');
226 226
 			});
227
-			$updater->listen('\OC\Updater', 'appUpgradeCheckBefore', function () use ($output) {
227
+			$updater->listen('\OC\Updater', 'appUpgradeCheckBefore', function() use ($output) {
228 228
 				$output->writeln('<info>Checking updates of apps</info>');
229 229
 			});
230
-			$updater->listen('\OC\Updater', 'appSimulateUpdate', function ($app) use ($output) {
230
+			$updater->listen('\OC\Updater', 'appSimulateUpdate', function($app) use ($output) {
231 231
 				$output->writeln("<info>Checking whether the database schema for <$app> can be updated (this can take a long time depending on the database size)</info>");
232 232
 			});
233
-			$updater->listen('\OC\Updater', 'appUpgradeCheck', function () use ($output) {
233
+			$updater->listen('\OC\Updater', 'appUpgradeCheck', function() use ($output) {
234 234
 				$output->writeln('<info>Checked database schema update for apps</info>');
235 235
 			});
236
-			$updater->listen('\OC\Updater', 'appUpgradeStarted', function ($app, $version) use ($output) {
236
+			$updater->listen('\OC\Updater', 'appUpgradeStarted', function($app, $version) use ($output) {
237 237
 				$output->writeln("<info>Updating <$app> ...</info>");
238 238
 			});
239
-			$updater->listen('\OC\Updater', 'appUpgrade', function ($app, $version) use ($output) {
239
+			$updater->listen('\OC\Updater', 'appUpgrade', function($app, $version) use ($output) {
240 240
 				$output->writeln("<info>Updated <$app> to $version</info>");
241 241
 			});
242
-			$updater->listen('\OC\Updater', 'failure', function ($message) use ($output, $self) {
242
+			$updater->listen('\OC\Updater', 'failure', function($message) use ($output, $self) {
243 243
 				$output->writeln("<error>$message</error>");
244 244
 			});
245
-			$updater->listen('\OC\Updater', 'setDebugLogLevel', function ($logLevel, $logLevelName) use ($output) {
245
+			$updater->listen('\OC\Updater', 'setDebugLogLevel', function($logLevel, $logLevelName) use ($output) {
246 246
 				$output->writeln("<info>Set log level to debug</info>");
247 247
 			});
248
-			$updater->listen('\OC\Updater', 'resetLogLevel', function ($logLevel, $logLevelName) use ($output) {
248
+			$updater->listen('\OC\Updater', 'resetLogLevel', function($logLevel, $logLevelName) use ($output) {
249 249
 				$output->writeln("<info>Reset log level</info>");
250 250
 			});
251
-			$updater->listen('\OC\Updater', 'startCheckCodeIntegrity', function () use ($output) {
251
+			$updater->listen('\OC\Updater', 'startCheckCodeIntegrity', function() use ($output) {
252 252
 				$output->writeln("<info>Starting code integrity check...</info>");
253 253
 			});
254
-			$updater->listen('\OC\Updater', 'finishedCheckCodeIntegrity', function () use ($output) {
254
+			$updater->listen('\OC\Updater', 'finishedCheckCodeIntegrity', function() use ($output) {
255 255
 				$output->writeln("<info>Finished code integrity check</info>");
256 256
 			});
257 257
 
@@ -259,12 +259,12 @@  discard block
 block discarded – undo
259 259
 
260 260
 			$this->postUpgradeCheck($input, $output);
261 261
 
262
-			if(!$success) {
262
+			if (!$success) {
263 263
 				return self::ERROR_FAILURE;
264 264
 			}
265 265
 
266 266
 			return self::ERROR_SUCCESS;
267
-		} else if($this->config->getSystemValueBool('maintenance')) {
267
+		} else if ($this->config->getSystemValueBool('maintenance')) {
268 268
 			//Possible scenario: Nextcloud core is updated but an app failed
269 269
 			$output->writeln('<warning>Nextcloud is in maintenance mode</warning>');
270 270
 			$output->write('<comment>Maybe an upgrade is already in process. Please check the '
@@ -289,8 +289,8 @@  discard block
 block discarded – undo
289 289
 		$trustedDomains = $this->config->getSystemValue('trusted_domains', []);
290 290
 		if (empty($trustedDomains)) {
291 291
 			$output->write(
292
-				'<warning>The setting "trusted_domains" could not be ' .
293
-				'set automatically by the upgrade script, ' .
292
+				'<warning>The setting "trusted_domains" could not be '.
293
+				'set automatically by the upgrade script, '.
294 294
 				'please set it manually</warning>'
295 295
 			);
296 296
 		}
Please login to merge, or discard this patch.
apps/files_trashbin/lib/Trashbin.php 1 patch
Spacing   +71 added lines, -71 removed lines patch added patch discarded remove patch
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
 		Filesystem::initMountPoints($uid);
104 104
 		if ($uid !== User::getUser()) {
105 105
 			$info = Filesystem::getFileInfo($filename);
106
-			$ownerView = new View('/' . $uid . '/files');
106
+			$ownerView = new View('/'.$uid.'/files');
107 107
 			try {
108 108
 				$filename = $ownerView->getPath($info['fileid']);
109 109
 			} catch (NotFoundException $e) {
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
 	}
155 155
 
156 156
 	private static function setUpTrash($user) {
157
-		$view = new View('/' . $user);
157
+		$view = new View('/'.$user);
158 158
 		if (!$view->is_dir('files_trashbin')) {
159 159
 			$view->mkdir('files_trashbin');
160 160
 		}
@@ -189,8 +189,8 @@  discard block
 block discarded – undo
189 189
 
190 190
 		$view = new View('/');
191 191
 
192
-		$target = $user . '/files_trashbin/files/' . $targetFilename . '.d' . $timestamp;
193
-		$source = $owner . '/files_trashbin/files/' . $sourceFilename . '.d' . $timestamp;
192
+		$target = $user.'/files_trashbin/files/'.$targetFilename.'.d'.$timestamp;
193
+		$source = $owner.'/files_trashbin/files/'.$sourceFilename.'.d'.$timestamp;
194 194
 		$free = $view->free_space($target);
195 195
 		$isUnknownOrUnlimitedFreeSpace = $free < 0;
196 196
 		$isEnoughFreeSpaceLeft = $view->filesize($source) < $free;
@@ -229,9 +229,9 @@  discard block
 block discarded – undo
229 229
 			$ownerPath = $file_path;
230 230
 		}
231 231
 
232
-		$ownerView = new View('/' . $owner);
232
+		$ownerView = new View('/'.$owner);
233 233
 		// file has been deleted in between
234
-		if (is_null($ownerPath) || $ownerPath === '' || !$ownerView->file_exists('/files/' . $ownerPath)) {
234
+		if (is_null($ownerPath) || $ownerPath === '' || !$ownerView->file_exists('/files/'.$ownerPath)) {
235 235
 			return true;
236 236
 		}
237 237
 
@@ -248,12 +248,12 @@  discard block
 block discarded – undo
248 248
 		$timestamp = time();
249 249
 
250 250
 		// disable proxy to prevent recursive calls
251
-		$trashPath = '/files_trashbin/files/' . $filename . '.d' . $timestamp;
251
+		$trashPath = '/files_trashbin/files/'.$filename.'.d'.$timestamp;
252 252
 
253 253
 		/** @var \OC\Files\Storage\Storage $trashStorage */
254 254
 		list($trashStorage, $trashInternalPath) = $ownerView->resolvePath($trashPath);
255 255
 		/** @var \OC\Files\Storage\Storage $sourceStorage */
256
-		list($sourceStorage, $sourceInternalPath) = $ownerView->resolvePath('/files/' . $ownerPath);
256
+		list($sourceStorage, $sourceInternalPath) = $ownerView->resolvePath('/files/'.$ownerPath);
257 257
 		try {
258 258
 			$moveSuccessful = true;
259 259
 			if ($trashStorage->file_exists($trashInternalPath)) {
@@ -265,7 +265,7 @@  discard block
 block discarded – undo
265 265
 			if ($trashStorage->file_exists($trashInternalPath)) {
266 266
 				$trashStorage->unlink($trashInternalPath);
267 267
 			}
268
-			\OC::$server->getLogger()->error('Couldn\'t move ' . $file_path . ' to the trash bin', ['app' => 'files_trashbin']);
268
+			\OC::$server->getLogger()->error('Couldn\'t move '.$file_path.' to the trash bin', ['app' => 'files_trashbin']);
269 269
 		}
270 270
 
271 271
 		if ($sourceStorage->file_exists($sourceInternalPath)) { // failed to delete the original file, abort
@@ -286,7 +286,7 @@  discard block
 block discarded – undo
286 286
 				\OC::$server->getLogger()->error('trash bin database couldn\'t be updated', ['app' => 'files_trashbin']);
287 287
 			}
288 288
 			\OCP\Util::emitHook('\OCA\Files_Trashbin\Trashbin', 'post_moveToTrash', ['filePath' => Filesystem::normalizePath($file_path),
289
-				'trashPath' => Filesystem::normalizePath($filename . '.d' . $timestamp)]);
289
+				'trashPath' => Filesystem::normalizePath($filename.'.d'.$timestamp)]);
290 290
 
291 291
 			self::retainVersions($filename, $owner, $ownerPath, $timestamp);
292 292
 
@@ -320,18 +320,18 @@  discard block
 block discarded – undo
320 320
 			$user = User::getUser();
321 321
 			$rootView = new View('/');
322 322
 
323
-			if ($rootView->is_dir($owner . '/files_versions/' . $ownerPath)) {
323
+			if ($rootView->is_dir($owner.'/files_versions/'.$ownerPath)) {
324 324
 				if ($owner !== $user) {
325
-					self::copy_recursive($owner . '/files_versions/' . $ownerPath, $owner . '/files_trashbin/versions/' . basename($ownerPath) . '.d' . $timestamp, $rootView);
325
+					self::copy_recursive($owner.'/files_versions/'.$ownerPath, $owner.'/files_trashbin/versions/'.basename($ownerPath).'.d'.$timestamp, $rootView);
326 326
 				}
327
-				self::move($rootView, $owner . '/files_versions/' . $ownerPath, $user . '/files_trashbin/versions/' . $filename . '.d' . $timestamp);
327
+				self::move($rootView, $owner.'/files_versions/'.$ownerPath, $user.'/files_trashbin/versions/'.$filename.'.d'.$timestamp);
328 328
 			} else if ($versions = \OCA\Files_Versions\Storage::getVersions($owner, $ownerPath)) {
329 329
 
330 330
 				foreach ($versions as $v) {
331 331
 					if ($owner !== $user) {
332
-						self::copy($rootView, $owner . '/files_versions' . $v['path'] . '.v' . $v['version'], $owner . '/files_trashbin/versions/' . $v['name'] . '.v' . $v['version'] . '.d' . $timestamp);
332
+						self::copy($rootView, $owner.'/files_versions'.$v['path'].'.v'.$v['version'], $owner.'/files_trashbin/versions/'.$v['name'].'.v'.$v['version'].'.d'.$timestamp);
333 333
 					}
334
-					self::move($rootView, $owner . '/files_versions' . $v['path'] . '.v' . $v['version'], $user . '/files_trashbin/versions/' . $filename . '.v' . $v['version'] . '.d' . $timestamp);
334
+					self::move($rootView, $owner.'/files_versions'.$v['path'].'.v'.$v['version'], $user.'/files_trashbin/versions/'.$filename.'.v'.$v['version'].'.d'.$timestamp);
335 335
 				}
336 336
 			}
337 337
 		}
@@ -393,18 +393,18 @@  discard block
 block discarded – undo
393 393
 	 */
394 394
 	public static function restore($file, $filename, $timestamp) {
395 395
 		$user = User::getUser();
396
-		$view = new View('/' . $user);
396
+		$view = new View('/'.$user);
397 397
 
398 398
 		$location = '';
399 399
 		if ($timestamp) {
400 400
 			$location = self::getLocation($user, $filename, $timestamp);
401 401
 			if ($location === false) {
402
-				\OC::$server->getLogger()->error('trash bin database inconsistent! ($user: ' . $user . ' $filename: ' . $filename . ', $timestamp: ' . $timestamp . ')', ['app' => 'files_trashbin']);
402
+				\OC::$server->getLogger()->error('trash bin database inconsistent! ($user: '.$user.' $filename: '.$filename.', $timestamp: '.$timestamp.')', ['app' => 'files_trashbin']);
403 403
 			} else {
404 404
 				// if location no longer exists, restore file in the root directory
405 405
 				if ($location !== '/' &&
406
-					(!$view->is_dir('files/' . $location) ||
407
-						!$view->isCreatable('files/' . $location))
406
+					(!$view->is_dir('files/'.$location) ||
407
+						!$view->isCreatable('files/'.$location))
408 408
 				) {
409 409
 					$location = '';
410 410
 				}
@@ -414,8 +414,8 @@  discard block
 block discarded – undo
414 414
 		// we need a  extension in case a file/dir with the same name already exists
415 415
 		$uniqueFilename = self::getUniqueFilename($location, $filename, $view);
416 416
 
417
-		$source = Filesystem::normalizePath('files_trashbin/files/' . $file);
418
-		$target = Filesystem::normalizePath('files/' . $location . '/' . $uniqueFilename);
417
+		$source = Filesystem::normalizePath('files_trashbin/files/'.$file);
418
+		$target = Filesystem::normalizePath('files/'.$location.'/'.$uniqueFilename);
419 419
 		if (!$view->file_exists($source)) {
420 420
 			return false;
421 421
 		}
@@ -430,10 +430,10 @@  discard block
 block discarded – undo
430 430
 		// handle the restore result
431 431
 		if ($restoreResult) {
432 432
 			$fakeRoot = $view->getRoot();
433
-			$view->chroot('/' . $user . '/files');
434
-			$view->touch('/' . $location . '/' . $uniqueFilename, $mtime);
433
+			$view->chroot('/'.$user.'/files');
434
+			$view->touch('/'.$location.'/'.$uniqueFilename, $mtime);
435 435
 			$view->chroot($fakeRoot);
436
-			\OCP\Util::emitHook('\OCA\Files_Trashbin\Trashbin', 'post_restore', ['filePath' => Filesystem::normalizePath('/' . $location . '/' . $uniqueFilename),
436
+			\OCP\Util::emitHook('\OCA\Files_Trashbin\Trashbin', 'post_restore', ['filePath' => Filesystem::normalizePath('/'.$location.'/'.$uniqueFilename),
437 437
 				'trashPath' => Filesystem::normalizePath($file)]);
438 438
 
439 439
 			self::restoreVersions($view, $file, $filename, $uniqueFilename, $location, $timestamp);
@@ -467,7 +467,7 @@  discard block
 block discarded – undo
467 467
 			$user = User::getUser();
468 468
 			$rootView = new View('/');
469 469
 
470
-			$target = Filesystem::normalizePath('/' . $location . '/' . $uniqueFilename);
470
+			$target = Filesystem::normalizePath('/'.$location.'/'.$uniqueFilename);
471 471
 
472 472
 			list($owner, $ownerPath) = self::getUidAndFilename($target);
473 473
 
@@ -482,14 +482,14 @@  discard block
 block discarded – undo
482 482
 				$versionedFile = $file;
483 483
 			}
484 484
 
485
-			if ($view->is_dir('/files_trashbin/versions/' . $file)) {
486
-				$rootView->rename(Filesystem::normalizePath($user . '/files_trashbin/versions/' . $file), Filesystem::normalizePath($owner . '/files_versions/' . $ownerPath));
485
+			if ($view->is_dir('/files_trashbin/versions/'.$file)) {
486
+				$rootView->rename(Filesystem::normalizePath($user.'/files_trashbin/versions/'.$file), Filesystem::normalizePath($owner.'/files_versions/'.$ownerPath));
487 487
 			} else if ($versions = self::getVersionsFromTrash($versionedFile, $timestamp, $user)) {
488 488
 				foreach ($versions as $v) {
489 489
 					if ($timestamp) {
490
-						$rootView->rename($user . '/files_trashbin/versions/' . $versionedFile . '.v' . $v . '.d' . $timestamp, $owner . '/files_versions/' . $ownerPath . '.v' . $v);
490
+						$rootView->rename($user.'/files_trashbin/versions/'.$versionedFile.'.v'.$v.'.d'.$timestamp, $owner.'/files_versions/'.$ownerPath.'.v'.$v);
491 491
 					} else {
492
-						$rootView->rename($user . '/files_trashbin/versions/' . $versionedFile . '.v' . $v, $owner . '/files_versions/' . $ownerPath . '.v' . $v);
492
+						$rootView->rename($user.'/files_trashbin/versions/'.$versionedFile.'.v'.$v, $owner.'/files_versions/'.$ownerPath.'.v'.$v);
493 493
 					}
494 494
 				}
495 495
 			}
@@ -502,7 +502,7 @@  discard block
 block discarded – undo
502 502
 	public static function deleteAll() {
503 503
 		$user = User::getUser();
504 504
 		$userRoot = \OC::$server->getUserFolder($user)->getParent();
505
-		$view = new View('/' . $user);
505
+		$view = new View('/'.$user);
506 506
 		$fileInfos = $view->getDirectoryContent('files_trashbin/files');
507 507
 
508 508
 		try {
@@ -513,7 +513,7 @@  discard block
 block discarded – undo
513 513
 
514 514
 		// Array to store the relative path in (after the file is deleted, the view won't be able to relativise the path anymore)
515 515
 		$filePaths = [];
516
-		foreach($fileInfos as $fileInfo){
516
+		foreach ($fileInfos as $fileInfo) {
517 517
 			$filePaths[] = $view->getRelativePath($fileInfo->getPath());
518 518
 		}
519 519
 		unset($fileInfos); // save memory
@@ -522,7 +522,7 @@  discard block
 block discarded – undo
522 522
 		\OC_Hook::emit('\OCP\Trashbin', 'preDeleteAll', ['paths' => $filePaths]);
523 523
 
524 524
 		// Single-File Hooks
525
-		foreach($filePaths as $path){
525
+		foreach ($filePaths as $path) {
526 526
 			self::emitTrashbinPreDelete($path);
527 527
 		}
528 528
 
@@ -535,7 +535,7 @@  discard block
 block discarded – undo
535 535
 		\OC_Hook::emit('\OCP\Trashbin', 'deleteAll', ['paths' => $filePaths]);
536 536
 
537 537
 		// Single-File Hooks
538
-		foreach($filePaths as $path){
538
+		foreach ($filePaths as $path) {
539 539
 			self::emitTrashbinPostDelete($path);
540 540
 		}
541 541
 
@@ -572,13 +572,13 @@  discard block
 block discarded – undo
572 572
 	 */
573 573
 	public static function delete($filename, $user, $timestamp = null) {
574 574
 		$userRoot = \OC::$server->getUserFolder($user)->getParent();
575
-		$view = new View('/' . $user);
575
+		$view = new View('/'.$user);
576 576
 		$size = 0;
577 577
 
578 578
 		if ($timestamp) {
579 579
 			$query = \OC_DB::prepare('DELETE FROM `*PREFIX*files_trash` WHERE `user`=? AND `id`=? AND `timestamp`=?');
580 580
 			$query->execute([$user, $filename, $timestamp]);
581
-			$file = $filename . '.d' . $timestamp;
581
+			$file = $filename.'.d'.$timestamp;
582 582
 		} else {
583 583
 			$file = $filename;
584 584
 		}
@@ -586,20 +586,20 @@  discard block
 block discarded – undo
586 586
 		$size += self::deleteVersions($view, $file, $filename, $timestamp, $user);
587 587
 
588 588
 		try {
589
-			$node = $userRoot->get('/files_trashbin/files/' . $file);
589
+			$node = $userRoot->get('/files_trashbin/files/'.$file);
590 590
 		} catch (NotFoundException $e) {
591 591
 			return $size;
592 592
 		}
593 593
 
594 594
 		if ($node instanceof Folder) {
595
-			$size += self::calculateSize(new View('/' . $user . '/files_trashbin/files/' . $file));
595
+			$size += self::calculateSize(new View('/'.$user.'/files_trashbin/files/'.$file));
596 596
 		} else if ($node instanceof File) {
597
-			$size += $view->filesize('/files_trashbin/files/' . $file);
597
+			$size += $view->filesize('/files_trashbin/files/'.$file);
598 598
 		}
599 599
 
600
-		self::emitTrashbinPreDelete('/files_trashbin/files/' . $file);
600
+		self::emitTrashbinPreDelete('/files_trashbin/files/'.$file);
601 601
 		$node->delete();
602
-		self::emitTrashbinPostDelete('/files_trashbin/files/' . $file);
602
+		self::emitTrashbinPostDelete('/files_trashbin/files/'.$file);
603 603
 
604 604
 		return $size;
605 605
 	}
@@ -615,17 +615,17 @@  discard block
 block discarded – undo
615 615
 	private static function deleteVersions(View $view, $file, $filename, $timestamp, $user) {
616 616
 		$size = 0;
617 617
 		if (\OCP\App::isEnabled('files_versions')) {
618
-			if ($view->is_dir('files_trashbin/versions/' . $file)) {
619
-				$size += self::calculateSize(new View('/' . $user . '/files_trashbin/versions/' . $file));
620
-				$view->unlink('files_trashbin/versions/' . $file);
618
+			if ($view->is_dir('files_trashbin/versions/'.$file)) {
619
+				$size += self::calculateSize(new View('/'.$user.'/files_trashbin/versions/'.$file));
620
+				$view->unlink('files_trashbin/versions/'.$file);
621 621
 			} else if ($versions = self::getVersionsFromTrash($filename, $timestamp, $user)) {
622 622
 				foreach ($versions as $v) {
623 623
 					if ($timestamp) {
624
-						$size += $view->filesize('/files_trashbin/versions/' . $filename . '.v' . $v . '.d' . $timestamp);
625
-						$view->unlink('/files_trashbin/versions/' . $filename . '.v' . $v . '.d' . $timestamp);
624
+						$size += $view->filesize('/files_trashbin/versions/'.$filename.'.v'.$v.'.d'.$timestamp);
625
+						$view->unlink('/files_trashbin/versions/'.$filename.'.v'.$v.'.d'.$timestamp);
626 626
 					} else {
627
-						$size += $view->filesize('/files_trashbin/versions/' . $filename . '.v' . $v);
628
-						$view->unlink('/files_trashbin/versions/' . $filename . '.v' . $v);
627
+						$size += $view->filesize('/files_trashbin/versions/'.$filename.'.v'.$v);
628
+						$view->unlink('/files_trashbin/versions/'.$filename.'.v'.$v);
629 629
 					}
630 630
 				}
631 631
 			}
@@ -642,13 +642,13 @@  discard block
 block discarded – undo
642 642
 	 */
643 643
 	public static function file_exists($filename, $timestamp = null) {
644 644
 		$user = User::getUser();
645
-		$view = new View('/' . $user);
645
+		$view = new View('/'.$user);
646 646
 
647 647
 		if ($timestamp) {
648
-			$filename = $filename . '.d' . $timestamp;
648
+			$filename = $filename.'.d'.$timestamp;
649 649
 		}
650 650
 
651
-		$target = Filesystem::normalizePath('files_trashbin/files/' . $filename);
651
+		$target = Filesystem::normalizePath('files_trashbin/files/'.$filename);
652 652
 		return $view->file_exists($target);
653 653
 	}
654 654
 
@@ -673,7 +673,7 @@  discard block
 block discarded – undo
673 673
 	private static function calculateFreeSpace($trashbinSize, $user) {
674 674
 		$softQuota = true;
675 675
 		$userObject = \OC::$server->getUserManager()->get($user);
676
-		if(is_null($userObject)) {
676
+		if (is_null($userObject)) {
677 677
 			return 0;
678 678
 		}
679 679
 		$quota = $userObject->getQuota();
@@ -692,7 +692,7 @@  discard block
 block discarded – undo
692 692
 		// subtract size of files and current trash bin size from quota
693 693
 		if ($softQuota) {
694 694
 			$userFolder = \OC::$server->getUserFolder($user);
695
-			if(is_null($userFolder)) {
695
+			if (is_null($userFolder)) {
696 696
 				return 0;
697 697
 			}
698 698
 			$free = $quota - $userFolder->getSize(false); // remaining free space for user
@@ -776,7 +776,7 @@  discard block
 block discarded – undo
776 776
 			foreach ($files as $file) {
777 777
 				if ($availableSpace < 0 && $expiration->isExpired($file['mtime'], true)) {
778 778
 					$tmp = self::delete($file['name'], $user, $file['mtime']);
779
-					\OC::$server->getLogger()->info('remove "' . $file['name'] . '" (' . $tmp . 'B) to meet the limit of trash bin size (50% of available quota)', ['app' => 'files_trashbin']);
779
+					\OC::$server->getLogger()->info('remove "'.$file['name'].'" ('.$tmp.'B) to meet the limit of trash bin size (50% of available quota)', ['app' => 'files_trashbin']);
780 780
 					$availableSpace += $tmp;
781 781
 					$size += $tmp;
782 782
 				} else {
@@ -807,10 +807,10 @@  discard block
 block discarded – undo
807 807
 					$size += self::delete($filename, $user, $timestamp);
808 808
 					$count++;
809 809
 				} catch (\OCP\Files\NotPermittedException $e) {
810
-					\OC::$server->getLogger()->logException($e, ['app' => 'files_trashbin', 'level' => \OCP\ILogger::WARN, 'message' => 'Removing "' . $filename . '" from trashbin failed.']);
810
+					\OC::$server->getLogger()->logException($e, ['app' => 'files_trashbin', 'level' => \OCP\ILogger::WARN, 'message' => 'Removing "'.$filename.'" from trashbin failed.']);
811 811
 				}
812 812
 				\OC::$server->getLogger()->info(
813
-					'Remove "' . $filename . '" from trashbin because it exceeds max retention obligation term.',
813
+					'Remove "'.$filename.'" from trashbin because it exceeds max retention obligation term.',
814 814
 					['app' => 'files_trashbin']
815 815
 				);
816 816
 			} else {
@@ -836,16 +836,16 @@  discard block
 block discarded – undo
836 836
 			$view->mkdir($destination);
837 837
 			$view->touch($destination, $view->filemtime($source));
838 838
 			foreach ($view->getDirectoryContent($source) as $i) {
839
-				$pathDir = $source . '/' . $i['name'];
839
+				$pathDir = $source.'/'.$i['name'];
840 840
 				if ($view->is_dir($pathDir)) {
841
-					$size += self::copy_recursive($pathDir, $destination . '/' . $i['name'], $view);
841
+					$size += self::copy_recursive($pathDir, $destination.'/'.$i['name'], $view);
842 842
 				} else {
843 843
 					$size += $view->filesize($pathDir);
844
-					$result = $view->copy($pathDir, $destination . '/' . $i['name']);
844
+					$result = $view->copy($pathDir, $destination.'/'.$i['name']);
845 845
 					if (!$result) {
846 846
 						throw new \OCA\Files_Trashbin\Exceptions\CopyRecursiveException();
847 847
 					}
848
-					$view->touch($destination . '/' . $i['name'], $view->filemtime($pathDir));
848
+					$view->touch($destination.'/'.$i['name'], $view->filemtime($pathDir));
849 849
 				}
850 850
 			}
851 851
 		} else {
@@ -867,7 +867,7 @@  discard block
 block discarded – undo
867 867
 	 * @return array
868 868
 	 */
869 869
 	private static function getVersionsFromTrash($filename, $timestamp, $user) {
870
-		$view = new View('/' . $user . '/files_trashbin/versions');
870
+		$view = new View('/'.$user.'/files_trashbin/versions');
871 871
 		$versions = [];
872 872
 
873 873
 		//force rescan of versions, local storage may not have updated the cache
@@ -880,10 +880,10 @@  discard block
 block discarded – undo
880 880
 
881 881
 		if ($timestamp) {
882 882
 			// fetch for old versions
883
-			$matches = $view->searchRaw($filename . '.v%.d' . $timestamp);
883
+			$matches = $view->searchRaw($filename.'.v%.d'.$timestamp);
884 884
 			$offset = -strlen($timestamp) - 2;
885 885
 		} else {
886
-			$matches = $view->searchRaw($filename . '.v%');
886
+			$matches = $view->searchRaw($filename.'.v%');
887 887
 		}
888 888
 
889 889
 		if (is_array($matches)) {
@@ -913,18 +913,18 @@  discard block
 block discarded – undo
913 913
 		$name = pathinfo($filename, PATHINFO_FILENAME);
914 914
 		$l = \OC::$server->getL10N('files_trashbin');
915 915
 
916
-		$location = '/' . trim($location, '/');
916
+		$location = '/'.trim($location, '/');
917 917
 
918 918
 		// if extension is not empty we set a dot in front of it
919 919
 		if ($ext !== '') {
920
-			$ext = '.' . $ext;
920
+			$ext = '.'.$ext;
921 921
 		}
922 922
 
923
-		if ($view->file_exists('files' . $location . '/' . $filename)) {
923
+		if ($view->file_exists('files'.$location.'/'.$filename)) {
924 924
 			$i = 2;
925
-			$uniqueName = $name . " (" . $l->t("restored") . ")" . $ext;
926
-			while ($view->file_exists('files' . $location . '/' . $uniqueName)) {
927
-				$uniqueName = $name . " (" . $l->t("restored") . " " . $i . ")" . $ext;
925
+			$uniqueName = $name." (".$l->t("restored").")".$ext;
926
+			while ($view->file_exists('files'.$location.'/'.$uniqueName)) {
927
+				$uniqueName = $name." (".$l->t("restored")." ".$i.")".$ext;
928 928
 				$i++;
929 929
 			}
930 930
 
@@ -941,7 +941,7 @@  discard block
 block discarded – undo
941 941
 	 * @return integer size of the folder
942 942
 	 */
943 943
 	private static function calculateSize($view) {
944
-		$root = \OC::$server->getConfig()->getSystemValue('datadirectory', \OC::$SERVERROOT . '/data') . $view->getAbsolutePath('');
944
+		$root = \OC::$server->getConfig()->getSystemValue('datadirectory', \OC::$SERVERROOT.'/data').$view->getAbsolutePath('');
945 945
 		if (!file_exists($root)) {
946 946
 			return 0;
947 947
 		}
@@ -972,7 +972,7 @@  discard block
 block discarded – undo
972 972
 	 * @return integer trash bin size
973 973
 	 */
974 974
 	private static function getTrashbinSize($user) {
975
-		$view = new View('/' . $user);
975
+		$view = new View('/'.$user);
976 976
 		$fileInfo = $view->getFileInfo('/files_trashbin');
977 977
 		return isset($fileInfo['size']) ? $fileInfo['size'] : 0;
978 978
 	}
@@ -999,7 +999,7 @@  discard block
 block discarded – undo
999 999
 	 */
1000 1000
 	public static function isEmpty($user) {
1001 1001
 
1002
-		$view = new View('/' . $user . '/files_trashbin');
1002
+		$view = new View('/'.$user.'/files_trashbin');
1003 1003
 		if ($view->is_dir('/files') && $dh = $view->opendir('/files')) {
1004 1004
 			while ($file = readdir($dh)) {
1005 1005
 				if (!Filesystem::isIgnoredDir($file)) {
Please login to merge, or discard this patch.
apps/files_trashbin/lib/AppInfo/Application.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
 		/*
54 54
 		 * Register $principalBackend for the DAV collection
55 55
 		 */
56
-		$container->registerService('principalBackend', function () {
56
+		$container->registerService('principalBackend', function() {
57 57
 			return new Principal(
58 58
 				\OC::$server->getUserManager(),
59 59
 				\OC::$server->getGroupManager(),
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
 			);
66 66
 		});
67 67
 
68
-		$container->registerService(ITrashManager::class, function (IAppContainer $c) {
68
+		$container->registerService(ITrashManager::class, function(IAppContainer $c) {
69 69
 			return new TrashManager();
70 70
 		});
71 71
 
@@ -78,11 +78,11 @@  discard block
 block discarded – undo
78 78
 		$appManager = $server->getAppManager();
79 79
 		/** @var ITrashManager $trashManager */
80 80
 		$trashManager = $this->getContainer()->getServer()->query(ITrashManager::class);
81
-		foreach($appManager->getInstalledApps() as $app) {
81
+		foreach ($appManager->getInstalledApps() as $app) {
82 82
 			$appInfo = $appManager->getAppInfo($app);
83 83
 			if (isset($appInfo['trash'])) {
84 84
 				$backends = $appInfo['trash'];
85
-				foreach($backends as $backend) {
85
+				foreach ($backends as $backend) {
86 86
 					$class = $backend['@value'];
87 87
 					$for = $backend['@attributes']['for'];
88 88
 
Please login to merge, or discard this patch.