Passed
Push — master ( f0dd71...c56a27 )
by Christoph
11:49 queued 12s
created
apps/systemtags/appinfo/app.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -32,14 +32,14 @@  discard block
 block discarded – undo
32 32
 $eventDispatcher = \OC::$server->getEventDispatcher();
33 33
 $eventDispatcher->addListener(
34 34
 	'OCA\Files::loadAdditionalScripts',
35
-	function () {
35
+	function() {
36 36
 		// FIXME: no public API for these ?
37 37
 		\OCP\Util::addScript('dist/systemtags');
38 38
 		\OCP\Util::addScript('systemtags', 'systemtags');
39 39
 	}
40 40
 );
41 41
 
42
-$managerListener = function (ManagerEvent $event) {
42
+$managerListener = function(ManagerEvent $event) {
43 43
 	/** @var \OCA\SystemTags\Activity\Listener $listener */
44 44
 	$listener = \OC::$server->query(Listener::class);
45 45
 	$listener->event($event);
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
 $eventDispatcher->addListener(ManagerEvent::EVENT_DELETE, $managerListener);
50 50
 $eventDispatcher->addListener(ManagerEvent::EVENT_UPDATE, $managerListener);
51 51
 
52
-$mapperListener = function (MapperEvent $event) {
52
+$mapperListener = function(MapperEvent $event) {
53 53
 	$application = new \OCP\AppFramework\App('systemtags');
54 54
 	/** @var \OCA\SystemTags\Activity\Listener $listener */
55 55
 	$listener = \OC::$server->query(Listener::class);
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
 $eventDispatcher->addListener(MapperEvent::EVENT_ASSIGN, $mapperListener);
60 60
 $eventDispatcher->addListener(MapperEvent::EVENT_UNASSIGN, $mapperListener);
61 61
 
62
-\OCA\Files\App::getNavigationManager()->add(function () {
62
+\OCA\Files\App::getNavigationManager()->add(function() {
63 63
 	$l = \OC::$server->getL10N('systemtags');
64 64
 	return [
65 65
 		'id' => 'systemtagsfilter',
Please login to merge, or discard this patch.
apps/systemtags/lib/Controller/LastUsedController.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -55,6 +55,6 @@
 block discarded – undo
55 55
 	public function getLastUsedTagIds() {
56 56
 		$lastUsed = $this->config->getUserValue($this->userSession->getUser()->getUID(), 'systemtags', 'last_used', '[]');
57 57
 		$tagIds = json_decode($lastUsed, true);
58
-		return new DataResponse(array_map(function ($id) { return (string) $id; }, $tagIds));
58
+		return new DataResponse(array_map(function($id) { return (string) $id; }, $tagIds));
59 59
 	}
60 60
 }
Please login to merge, or discard this patch.
apps/encryption/lib/AppInfo/Application.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
 		$this->encryptionManager->registerEncryptionModule(
112 112
 			Encryption::ID,
113 113
 			Encryption::DISPLAY_NAME,
114
-			function () use ($container) {
114
+			function() use ($container) {
115 115
 
116 116
 			return new Encryption(
117 117
 				$container->query('Crypt'),
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
 		$container = $this->getContainer();
132 132
 
133 133
 		$container->registerService('Crypt',
134
-			function (IAppContainer $c) {
134
+			function(IAppContainer $c) {
135 135
 				$server = $c->getServer();
136 136
 				return new Crypt($server->getLogger(),
137 137
 					$server->getUserSession(),
@@ -140,14 +140,14 @@  discard block
 block discarded – undo
140 140
 			});
141 141
 
142 142
 		$container->registerService('Session',
143
-			function (IAppContainer $c) {
143
+			function(IAppContainer $c) {
144 144
 				$server = $c->getServer();
145 145
 				return new Session($server->getSession());
146 146
 			}
147 147
 		);
148 148
 
149 149
 		$container->registerService('KeyManager',
150
-			function (IAppContainer $c) {
150
+			function(IAppContainer $c) {
151 151
 				$server = $c->getServer();
152 152
 
153 153
 				return new KeyManager($server->getEncryptionKeyStorage(),
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
 			});
162 162
 
163 163
 		$container->registerService('Recovery',
164
-			function (IAppContainer $c) {
164
+			function(IAppContainer $c) {
165 165
 				$server = $c->getServer();
166 166
 
167 167
 				return new Recovery(
@@ -173,7 +173,7 @@  discard block
 block discarded – undo
173 173
 					new View());
174 174
 			});
175 175
 
176
-		$container->registerService('RecoveryController', function (IAppContainer $c) {
176
+		$container->registerService('RecoveryController', function(IAppContainer $c) {
177 177
 			$server = $c->getServer();
178 178
 			return new RecoveryController(
179 179
 				$c->getAppName(),
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
 				$c->query('Recovery'));
184 184
 		});
185 185
 
186
-		$container->registerService('StatusController', function (IAppContainer $c) {
186
+		$container->registerService('StatusController', function(IAppContainer $c) {
187 187
 			$server = $c->getServer();
188 188
 			return new StatusController(
189 189
 				$c->getAppName(),
@@ -194,7 +194,7 @@  discard block
 block discarded – undo
194 194
 			);
195 195
 		});
196 196
 
197
-		$container->registerService('SettingsController', function (IAppContainer $c) {
197
+		$container->registerService('SettingsController', function(IAppContainer $c) {
198 198
 			$server = $c->getServer();
199 199
 			return new SettingsController(
200 200
 				$c->getAppName(),
@@ -211,7 +211,7 @@  discard block
 block discarded – undo
211 211
 		});
212 212
 
213 213
 		$container->registerService('UserSetup',
214
-			function (IAppContainer $c) {
214
+			function(IAppContainer $c) {
215 215
 				$server = $c->getServer();
216 216
 				return new Setup($server->getLogger(),
217 217
 					$server->getUserSession(),
@@ -220,7 +220,7 @@  discard block
 block discarded – undo
220 220
 			});
221 221
 
222 222
 		$container->registerService('Util',
223
-			function (IAppContainer $c) {
223
+			function(IAppContainer $c) {
224 224
 				$server = $c->getServer();
225 225
 
226 226
 				return new Util(
@@ -233,7 +233,7 @@  discard block
 block discarded – undo
233 233
 			});
234 234
 
235 235
 		$container->registerService('EncryptAll',
236
-			function (IAppContainer $c) {
236
+			function(IAppContainer $c) {
237 237
 				$server = $c->getServer();
238 238
 				return new EncryptAll(
239 239
 					$c->query('UserSetup'),
@@ -251,7 +251,7 @@  discard block
 block discarded – undo
251 251
 		);
252 252
 
253 253
 		$container->registerService('DecryptAll',
254
-			function (IAppContainer $c) {
254
+			function(IAppContainer $c) {
255 255
 				return new DecryptAll(
256 256
 					$c->query('Util'),
257 257
 					$c->query('KeyManager'),
Please login to merge, or discard this patch.
apps/files_versions/lib/AppInfo/Application.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
 		/**
63 63
 		 * Register $principalBackend for the DAV collection
64 64
 		 */
65
-		$container->registerService('principalBackend', function (IAppContainer $c) {
65
+		$container->registerService('principalBackend', function(IAppContainer $c) {
66 66
 			$server = $c->getServer();
67 67
 			return new Principal(
68 68
 				$server->getUserManager(),
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
 			);
76 76
 		});
77 77
 
78
-		$container->registerService(IVersionManager::class, function (IAppContainer $c) {
78
+		$container->registerService(IVersionManager::class, function(IAppContainer $c) {
79 79
 			return new VersionManager();
80 80
 		});
81 81
 
@@ -95,11 +95,11 @@  discard block
 block discarded – undo
95 95
 	public function registerVersionBackends() {
96 96
 		$server = $this->getContainer()->getServer();
97 97
 		$appManager = $server->getAppManager();
98
-		foreach($appManager->getInstalledApps() as $app) {
98
+		foreach ($appManager->getInstalledApps() as $app) {
99 99
 			$appInfo = $appManager->getAppInfo($app);
100 100
 			if (isset($appInfo['versions'])) {
101 101
 				$backends = $appInfo['versions'];
102
-				foreach($backends as $backend) {
102
+				foreach ($backends as $backend) {
103 103
 					if (isset($backend['@value'])) {
104 104
 						$this->loadBackend($backend);
105 105
 					} else {
Please login to merge, or discard this patch.
apps/files_versions/lib/Hooks.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
 	 */
59 59
 	public static function write_hook($params) {
60 60
 		$path = $params[Filesystem::signal_param_path];
61
-		if($path !== '') {
61
+		if ($path !== '') {
62 62
 			Storage::store($path);
63 63
 		}
64 64
 	}
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
 	 */
74 74
 	public static function remove_hook($params) {
75 75
 		$path = $params[Filesystem::signal_param_path];
76
-		if($path !== '') {
76
+		if ($path !== '') {
77 77
 			Storage::delete($path);
78 78
 		}
79 79
 	}
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
 	 */
85 85
 	public static function pre_remove_hook($params) {
86 86
 		$path = $params[Filesystem::signal_param_path];
87
-			if($path !== '') {
87
+			if ($path !== '') {
88 88
 				Storage::markDeletedFile($path);
89 89
 			}
90 90
 	}
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
 	public static function rename_hook($params) {
100 100
 		$oldpath = $params['oldpath'];
101 101
 		$newpath = $params['newpath'];
102
-		if($oldpath !== '' && $newpath !== '') {
102
+		if ($oldpath !== '' && $newpath !== '') {
103 103
 			Storage::renameOrCopy($oldpath, $newpath, 'rename');
104 104
 		}
105 105
 	}
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
 	public static function copy_hook($params) {
115 115
 		$oldpath = $params['oldpath'];
116 116
 		$newpath = $params['newpath'];
117
-		if($oldpath !== '' && $newpath !== '') {
117
+		if ($oldpath !== '' && $newpath !== '') {
118 118
 			Storage::renameOrCopy($oldpath, $newpath, 'copy');
119 119
 		}
120 120
 	}
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
 	public static function pre_renameOrCopy_hook($params) {
131 131
 		// if we rename a movable mount point, then the versions don't have
132 132
 		// to be renamed
133
-		$absOldPath = Filesystem::normalizePath('/' . \OCP\User::getUser() . '/files' . $params['oldpath']);
133
+		$absOldPath = Filesystem::normalizePath('/'.\OCP\User::getUser().'/files'.$params['oldpath']);
134 134
 		$manager = Filesystem::getMountManager();
135 135
 		$mount = $manager->find($absOldPath);
136 136
 		$internalPath = $mount->getInternalPath($absOldPath);
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
 			return;
139 139
 		}
140 140
 
141
-		$view = new View(\OCP\User::getUser() . '/files');
141
+		$view = new View(\OCP\User::getUser().'/files');
142 142
 		if ($view->file_exists($params['newpath'])) {
143 143
 			Storage::store($params['newpath']);
144 144
 		} else {
Please login to merge, or discard this patch.
apps/files_versions/lib/Storage.php 1 patch
Spacing   +62 added lines, -62 removed lines patch added patch discarded remove patch
@@ -58,8 +58,8 @@  discard block
 block discarded – undo
58 58
 
59 59
 class Storage {
60 60
 
61
-	const DEFAULTENABLED=true;
62
-	const DEFAULTMAXSIZE=50; // unit: percentage; 50% of available disk space/quota
61
+	const DEFAULTENABLED = true;
62
+	const DEFAULTMAXSIZE = 50; // unit: percentage; 50% of available disk space/quota
63 63
 	const VERSIONS_ROOT = 'files_versions/';
64 64
 
65 65
 	const DELETE_TRIGGER_MASTER_REMOVED = 0;
@@ -73,17 +73,17 @@  discard block
 block discarded – undo
73 73
 
74 74
 	private static $max_versions_per_interval = [
75 75
 		//first 10sec, one version every 2sec
76
-		1 => ['intervalEndsAfter' => 10,      'step' => 2],
76
+		1 => ['intervalEndsAfter' => 10, 'step' => 2],
77 77
 		//next minute, one version every 10sec
78
-		2 => ['intervalEndsAfter' => 60,      'step' => 10],
78
+		2 => ['intervalEndsAfter' => 60, 'step' => 10],
79 79
 		//next hour, one version every minute
80
-		3 => ['intervalEndsAfter' => 3600,    'step' => 60],
80
+		3 => ['intervalEndsAfter' => 3600, 'step' => 60],
81 81
 		//next 24h, one version every hour
82
-		4 => ['intervalEndsAfter' => 86400,   'step' => 3600],
82
+		4 => ['intervalEndsAfter' => 86400, 'step' => 3600],
83 83
 		//next 30days, one version per day
84 84
 		5 => ['intervalEndsAfter' => 2592000, 'step' => 86400],
85 85
 		//until the end one version per week
86
-		6 => ['intervalEndsAfter' => -1,      'step' => 604800],
86
+		6 => ['intervalEndsAfter' => -1, 'step' => 604800],
87 87
 	];
88 88
 
89 89
 	/** @var \OCA\Files_Versions\AppInfo\Application */
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
 			$uid = User::getUser();
108 108
 		}
109 109
 		Filesystem::initMountPoints($uid);
110
-		if ( $uid !== User::getUser() ) {
110
+		if ($uid !== User::getUser()) {
111 111
 			$info = Filesystem::getFileInfo($filename);
112 112
 			$ownerView = new View('/'.$uid.'/files');
113 113
 			try {
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
 	 * @return int versions size
158 158
 	 */
159 159
 	private static function getVersionsSize($user) {
160
-		$view = new View('/' . $user);
160
+		$view = new View('/'.$user);
161 161
 		$fileInfo = $view->getFileInfo('/files_versions');
162 162
 		return isset($fileInfo['size']) ? $fileInfo['size'] : 0;
163 163
 	}
@@ -175,13 +175,13 @@  discard block
 block discarded – undo
175 175
 		}
176 176
 
177 177
 		// we only handle existing files
178
-		if (! Filesystem::file_exists($filename) || Filesystem::is_dir($filename)) {
178
+		if (!Filesystem::file_exists($filename) || Filesystem::is_dir($filename)) {
179 179
 			return false;
180 180
 		}
181 181
 
182 182
 		list($uid, $filename) = self::getUidAndFilename($filename);
183 183
 
184
-		$files_view = new View('/'.$uid .'/files');
184
+		$files_view = new View('/'.$uid.'/files');
185 185
 
186 186
 		$eventDispatcher = \OC::$server->getEventDispatcher();
187 187
 		$fileInfo = $files_view->getFileInfo($filename);
@@ -248,14 +248,14 @@  discard block
 block discarded – undo
248 248
 
249 249
 		if (!Filesystem::file_exists($path)) {
250 250
 
251
-			$view = new View('/' . $uid . '/files_versions');
251
+			$view = new View('/'.$uid.'/files_versions');
252 252
 
253 253
 			$versions = self::getVersions($uid, $filename);
254 254
 			if (!empty($versions)) {
255 255
 				foreach ($versions as $v) {
256
-					\OC_Hook::emit('\OCP\Versions', 'preDelete', ['path' => $path . $v['version'], 'trigger' => self::DELETE_TRIGGER_MASTER_REMOVED]);
257
-					self::deleteVersion($view, $filename . '.v' . $v['version']);
258
-					\OC_Hook::emit('\OCP\Versions', 'delete', ['path' => $path . $v['version'], 'trigger' => self::DELETE_TRIGGER_MASTER_REMOVED]);
256
+					\OC_Hook::emit('\OCP\Versions', 'preDelete', ['path' => $path.$v['version'], 'trigger' => self::DELETE_TRIGGER_MASTER_REMOVED]);
257
+					self::deleteVersion($view, $filename.'.v'.$v['version']);
258
+					\OC_Hook::emit('\OCP\Versions', 'delete', ['path' => $path.$v['version'], 'trigger' => self::DELETE_TRIGGER_MASTER_REMOVED]);
259 259
 				}
260 260
 			}
261 261
 		}
@@ -289,33 +289,33 @@  discard block
 block discarded – undo
289 289
 		$rootView = new View('');
290 290
 
291 291
 		// did we move a directory ?
292
-		if ($rootView->is_dir('/' . $targetOwner . '/files/' . $targetPath)) {
292
+		if ($rootView->is_dir('/'.$targetOwner.'/files/'.$targetPath)) {
293 293
 			// does the directory exists for versions too ?
294
-			if ($rootView->is_dir('/' . $sourceOwner . '/files_versions/' . $sourcePath)) {
294
+			if ($rootView->is_dir('/'.$sourceOwner.'/files_versions/'.$sourcePath)) {
295 295
 				// create missing dirs if necessary
296
-				self::createMissingDirectories($targetPath, new View('/'. $targetOwner));
296
+				self::createMissingDirectories($targetPath, new View('/'.$targetOwner));
297 297
 
298 298
 				// move the directory containing the versions
299 299
 				$rootView->$operation(
300
-					'/' . $sourceOwner . '/files_versions/' . $sourcePath,
301
-					'/' . $targetOwner . '/files_versions/' . $targetPath
300
+					'/'.$sourceOwner.'/files_versions/'.$sourcePath,
301
+					'/'.$targetOwner.'/files_versions/'.$targetPath
302 302
 				);
303 303
 			}
304
-		} else if ($versions = Storage::getVersions($sourceOwner, '/' . $sourcePath)) {
304
+		} else if ($versions = Storage::getVersions($sourceOwner, '/'.$sourcePath)) {
305 305
 			// create missing dirs if necessary
306
-			self::createMissingDirectories($targetPath, new View('/'. $targetOwner));
306
+			self::createMissingDirectories($targetPath, new View('/'.$targetOwner));
307 307
 
308 308
 			foreach ($versions as $v) {
309 309
 				// move each version one by one to the target directory
310 310
 				$rootView->$operation(
311
-					'/' . $sourceOwner . '/files_versions/' . $sourcePath.'.v' . $v['version'],
312
-					'/' . $targetOwner . '/files_versions/' . $targetPath.'.v'.$v['version']
311
+					'/'.$sourceOwner.'/files_versions/'.$sourcePath.'.v'.$v['version'],
312
+					'/'.$targetOwner.'/files_versions/'.$targetPath.'.v'.$v['version']
313 313
 				);
314 314
 			}
315 315
 		}
316 316
 
317 317
 		// if we moved versions directly for a file, schedule expiration check for that file
318
-		if (!$rootView->is_dir('/' . $targetOwner . '/files/' . $targetPath)) {
318
+		if (!$rootView->is_dir('/'.$targetOwner.'/files/'.$targetPath)) {
319 319
 			self::scheduleExpire($targetOwner, $targetPath);
320 320
 		}
321 321
 
@@ -331,13 +331,13 @@  discard block
 block discarded – undo
331 331
 	public static function rollback(string $file, int $revision, IUser $user) {
332 332
 
333 333
 		// add expected leading slash
334
-		$filename = '/' . ltrim($file, '/');
334
+		$filename = '/'.ltrim($file, '/');
335 335
 
336 336
 		// Fetch the userfolder to trigger view hooks
337 337
 		$userFolder = \OC::$server->getUserFolder($user->getUID());
338 338
 
339 339
 		$users_view = new View('/'.$user->getUID());
340
-		$files_view = new View('/'. $user->getUID().'/files');
340
+		$files_view = new View('/'.$user->getUID().'/files');
341 341
 
342 342
 		$versionCreated = false;
343 343
 
@@ -355,7 +355,7 @@  discard block
 block discarded – undo
355 355
 			$versionCreated = true;
356 356
 		}
357 357
 
358
-		$fileToRestore =  'files_versions' . $filename . '.v' . $revision;
358
+		$fileToRestore = 'files_versions'.$filename.'.v'.$revision;
359 359
 
360 360
 		// Restore encrypted version of the old file for the newly restored file
361 361
 		// This has to happen manually here since the file is manually copied below
@@ -371,7 +371,7 @@  discard block
 block discarded – undo
371 371
 		);
372 372
 
373 373
 		// rollback
374
-		if (self::copyFileContents($users_view, $fileToRestore, 'files' . $filename)) {
374
+		if (self::copyFileContents($users_view, $fileToRestore, 'files'.$filename)) {
375 375
 			$files_view->touch($file, $revision);
376 376
 			Storage::scheduleExpire($user->getUID(), $file);
377 377
 
@@ -444,12 +444,12 @@  discard block
 block discarded – undo
444 444
 			return $versions;
445 445
 		}
446 446
 		// fetch for old versions
447
-		$view = new View('/' . $uid . '/');
447
+		$view = new View('/'.$uid.'/');
448 448
 
449 449
 		$pathinfo = pathinfo($filename);
450 450
 		$versionedFile = $pathinfo['basename'];
451 451
 
452
-		$dir = Filesystem::normalizePath(self::VERSIONS_ROOT . '/' . $pathinfo['dirname']);
452
+		$dir = Filesystem::normalizePath(self::VERSIONS_ROOT.'/'.$pathinfo['dirname']);
453 453
 
454 454
 		$dirContent = false;
455 455
 		if ($view->is_dir($dir)) {
@@ -469,7 +469,7 @@  discard block
 block discarded – undo
469 469
 						$pathparts = pathinfo($entryName);
470 470
 						$timestamp = substr($pathparts['extension'], 1);
471 471
 						$filename = $pathparts['filename'];
472
-						$key = $timestamp . '#' . $filename;
472
+						$key = $timestamp.'#'.$filename;
473 473
 						$versions[$key]['version'] = $timestamp;
474 474
 						$versions[$key]['humanReadableTimestamp'] = self::getHumanReadableTimestamp($timestamp);
475 475
 						if (empty($userFullPath)) {
@@ -477,9 +477,9 @@  discard block
 block discarded – undo
477 477
 						} else {
478 478
 							$versions[$key]['preview'] = \OC::$server->getURLGenerator('files_version.Preview.getPreview', ['file' => $userFullPath, 'version' => $timestamp]);
479 479
 						}
480
-						$versions[$key]['path'] = Filesystem::normalizePath($pathinfo['dirname'] . '/' . $filename);
480
+						$versions[$key]['path'] = Filesystem::normalizePath($pathinfo['dirname'].'/'.$filename);
481 481
 						$versions[$key]['name'] = $versionedFile;
482
-						$versions[$key]['size'] = $view->filesize($dir . '/' . $entryName);
482
+						$versions[$key]['size'] = $view->filesize($dir.'/'.$entryName);
483 483
 						$versions[$key]['mimetype'] = \OC::$server->getMimeTypeDetector()->detectPath($versionedFile);
484 484
 					}
485 485
 				}
@@ -507,7 +507,7 @@  discard block
 block discarded – undo
507 507
 
508 508
 		$toDelete = [];
509 509
 		foreach (array_reverse($versions['all']) as $key => $version) {
510
-			if ((int)$version['version'] <$threshold) {
510
+			if ((int) $version['version'] < $threshold) {
511 511
 				$toDelete[$key] = $version;
512 512
 			} else {
513 513
 				//Versions are sorted by time - nothing mo to iterate.
@@ -515,11 +515,11 @@  discard block
 block discarded – undo
515 515
 			}
516 516
 		}
517 517
 
518
-		$view = new View('/' . $uid . '/files_versions');
518
+		$view = new View('/'.$uid.'/files_versions');
519 519
 		if (!empty($toDelete)) {
520 520
 			foreach ($toDelete as $version) {
521 521
 				\OC_Hook::emit('\OCP\Versions', 'preDelete', ['path' => $version['path'].'.v'.$version['version'], 'trigger' => self::DELETE_TRIGGER_RETENTION_CONSTRAINT]);
522
-				self::deleteVersion($view, $version['path'] . '.v' . $version['version']);
522
+				self::deleteVersion($view, $version['path'].'.v'.$version['version']);
523 523
 				\OC_Hook::emit('\OCP\Versions', 'delete', ['path' => $version['path'].'.v'.$version['version'], 'trigger' => self::DELETE_TRIGGER_RETENTION_CONSTRAINT]);
524 524
 			}
525 525
 		}
@@ -535,19 +535,19 @@  discard block
 block discarded – undo
535 535
 		$diff = time() - $timestamp;
536 536
 
537 537
 		if ($diff < 60) { // first minute
538
-			return  $diff . " seconds ago";
538
+			return  $diff." seconds ago";
539 539
 		} elseif ($diff < 3600) { //first hour
540
-			return round($diff / 60) . " minutes ago";
540
+			return round($diff / 60)." minutes ago";
541 541
 		} elseif ($diff < 86400) { // first day
542
-			return round($diff / 3600) . " hours ago";
542
+			return round($diff / 3600)." hours ago";
543 543
 		} elseif ($diff < 604800) { //first week
544
-			return round($diff / 86400) . " days ago";
544
+			return round($diff / 86400)." days ago";
545 545
 		} elseif ($diff < 2419200) { //first month
546
-			return round($diff / 604800) . " weeks ago";
546
+			return round($diff / 604800)." weeks ago";
547 547
 		} elseif ($diff < 29030400) { // first year
548
-			return round($diff / 2419200) . " months ago";
548
+			return round($diff / 2419200)." months ago";
549 549
 		} else {
550
-			return round($diff / 29030400) . " years ago";
550
+			return round($diff / 29030400)." years ago";
551 551
 		}
552 552
 
553 553
 	}
@@ -558,7 +558,7 @@  discard block
 block discarded – undo
558 558
 	 * @return array with contains two arrays 'all' which contains all versions sorted by age and 'by_file' which contains all versions sorted by filename
559 559
 	 */
560 560
 	private static function getAllVersions($uid) {
561
-		$view = new View('/' . $uid . '/');
561
+		$view = new View('/'.$uid.'/');
562 562
 		$dirs = [self::VERSIONS_ROOT];
563 563
 		$versions = [];
564 564
 
@@ -568,7 +568,7 @@  discard block
 block discarded – undo
568 568
 
569 569
 			foreach ($files as $file) {
570 570
 				$fileData = $file->getData();
571
-				$filePath = $dir . '/' . $fileData['name'];
571
+				$filePath = $dir.'/'.$fileData['name'];
572 572
 				if ($file['type'] === 'dir') {
573 573
 					$dirs[] = $filePath;
574 574
 				} else {
@@ -576,7 +576,7 @@  discard block
 block discarded – undo
576 576
 					$relPathStart = strlen(self::VERSIONS_ROOT);
577 577
 					$version = substr($filePath, $versionsBegin + 2);
578 578
 					$relpath = substr($filePath, $relPathStart, $versionsBegin - $relPathStart);
579
-					$key = $version . '#' . $relpath;
579
+					$key = $version.'#'.$relpath;
580 580
 					$versions[$key] = ['path' => $relpath, 'timestamp' => $version];
581 581
 				}
582 582
 			}
@@ -617,13 +617,13 @@  discard block
 block discarded – undo
617 617
 			list($toDelete, $size) = self::getAutoExpireList($time, $versions);
618 618
 		} else {
619 619
 			$size = 0;
620
-			$toDelete = [];  // versions we want to delete
620
+			$toDelete = []; // versions we want to delete
621 621
 		}
622 622
 
623 623
 		foreach ($versions as $key => $version) {
624 624
 			if ($expiration->isExpired($version['version'], $quotaExceeded) && !isset($toDelete[$key])) {
625 625
 				$size += $version['size'];
626
-				$toDelete[$key] = $version['path'] . '.v' . $version['version'];
626
+				$toDelete[$key] = $version['path'].'.v'.$version['version'];
627 627
 			}
628 628
 		}
629 629
 
@@ -638,7 +638,7 @@  discard block
 block discarded – undo
638 638
 	 */
639 639
 	protected static function getAutoExpireList($time, $versions) {
640 640
 		$size = 0;
641
-		$toDelete = [];  // versions we want to delete
641
+		$toDelete = []; // versions we want to delete
642 642
 
643 643
 		$interval = 1;
644 644
 		$step = Storage::$max_versions_per_interval[$interval]['step'];
@@ -660,9 +660,9 @@  discard block
 block discarded – undo
660 660
 				if ($nextInterval === -1 || $prevTimestamp > $nextInterval) {
661 661
 					if ($version['version'] > $nextVersion) {
662 662
 						//distance between two version too small, mark to delete
663
-						$toDelete[$key] = $version['path'] . '.v' . $version['version'];
663
+						$toDelete[$key] = $version['path'].'.v'.$version['version'];
664 664
 						$size += $version['size'];
665
-						\OC::$server->getLogger()->info('Mark to expire '. $version['path'] .' next version should be ' . $nextVersion . " or smaller. (prevTimestamp: " . $prevTimestamp . "; step: " . $step, ['app' => 'files_versions']);
665
+						\OC::$server->getLogger()->info('Mark to expire '.$version['path'].' next version should be '.$nextVersion." or smaller. (prevTimestamp: ".$prevTimestamp."; step: ".$step, ['app' => 'files_versions']);
666 666
 					} else {
667 667
 						$nextVersion = $version['version'] - $step;
668 668
 						$prevTimestamp = $version['version'];
@@ -717,8 +717,8 @@  discard block
 block discarded – undo
717 717
 			// get available disk space for user
718 718
 			$user = \OC::$server->getUserManager()->get($uid);
719 719
 			if (is_null($user)) {
720
-				\OC::$server->getLogger()->error('Backends provided no user object for ' . $uid, ['app' => 'files_versions']);
721
-				throw new \OC\User\NoUserException('Backends provided no user object for ' . $uid);
720
+				\OC::$server->getLogger()->error('Backends provided no user object for '.$uid, ['app' => 'files_versions']);
721
+				throw new \OC\User\NoUserException('Backends provided no user object for '.$uid);
722 722
 			}
723 723
 
724 724
 			\OC_Util::setupFS($uid);
@@ -735,7 +735,7 @@  discard block
 block discarded – undo
735 735
 
736 736
 			$softQuota = true;
737 737
 			$quota = $user->getQuota();
738
-			if ( $quota === null || $quota === 'none' ) {
738
+			if ($quota === null || $quota === 'none') {
739 739
 				$quota = Filesystem::free_space('/');
740 740
 				$softQuota = false;
741 741
 			} else {
@@ -750,7 +750,7 @@  discard block
 block discarded – undo
750 750
 			if ($quota >= 0) {
751 751
 				if ($softQuota) {
752 752
 					$userFolder = \OC::$server->getUserFolder($uid);
753
-					if(is_null($userFolder)) {
753
+					if (is_null($userFolder)) {
754 754
 						$availableSpace = 0;
755 755
 					} else {
756 756
 						$free = $quota - $userFolder->getSize(false); // remaining free space for user
@@ -790,18 +790,18 @@  discard block
 block discarded – undo
790 790
 			}
791 791
 
792 792
 			$logger = \OC::$server->getLogger();
793
-			foreach($toDelete as $key => $path) {
793
+			foreach ($toDelete as $key => $path) {
794 794
 				\OC_Hook::emit('\OCP\Versions', 'preDelete', ['path' => $path, 'trigger' => self::DELETE_TRIGGER_QUOTA_EXCEEDED]);
795 795
 				self::deleteVersion($versionsFileview, $path);
796 796
 				\OC_Hook::emit('\OCP\Versions', 'delete', ['path' => $path, 'trigger' => self::DELETE_TRIGGER_QUOTA_EXCEEDED]);
797 797
 				unset($allVersions[$key]); // update array with the versions we keep
798
-				$logger->info('Expire: ' . $path, ['app' => 'files_versions']);
798
+				$logger->info('Expire: '.$path, ['app' => 'files_versions']);
799 799
 			}
800 800
 
801 801
 			// Check if enough space is available after versions are rearranged.
802 802
 			// If not we delete the oldest versions until we meet the size limit for versions,
803 803
 			// but always keep the two latest versions
804
-			$numOfVersions = count($allVersions) -2 ;
804
+			$numOfVersions = count($allVersions) - 2;
805 805
 			$i = 0;
806 806
 			// sort oldest first and make sure that we start at the first element
807 807
 			ksort($allVersions);
@@ -809,9 +809,9 @@  discard block
 block discarded – undo
809 809
 			while ($availableSpace < 0 && $i < $numOfVersions) {
810 810
 				$version = current($allVersions);
811 811
 				\OC_Hook::emit('\OCP\Versions', 'preDelete', ['path' => $version['path'].'.v'.$version['version'], 'trigger' => self::DELETE_TRIGGER_QUOTA_EXCEEDED]);
812
-				self::deleteVersion($versionsFileview, $version['path'] . '.v' . $version['version']);
812
+				self::deleteVersion($versionsFileview, $version['path'].'.v'.$version['version']);
813 813
 				\OC_Hook::emit('\OCP\Versions', 'delete', ['path' => $version['path'].'.v'.$version['version'], 'trigger' => self::DELETE_TRIGGER_QUOTA_EXCEEDED]);
814
-				\OC::$server->getLogger()->info('running out of space! Delete oldest version: ' . $version['path'].'.v'.$version['version'], ['app' => 'files_versions']);
814
+				\OC::$server->getLogger()->info('running out of space! Delete oldest version: '.$version['path'].'.v'.$version['version'], ['app' => 'files_versions']);
815 815
 				$versionsSize -= $version['size'];
816 816
 				$availableSpace += $version['size'];
817 817
 				next($allVersions);
@@ -837,7 +837,7 @@  discard block
 block discarded – undo
837 837
 		$dirParts = explode('/', $dirname);
838 838
 		$dir = "/files_versions";
839 839
 		foreach ($dirParts as $part) {
840
-			$dir = $dir . '/' . $part;
840
+			$dir = $dir.'/'.$part;
841 841
 			if (!$view->file_exists($dir)) {
842 842
 				$view->mkdir($dir);
843 843
 			}
Please login to merge, or discard this patch.
apps/files_versions/lib/Expiration.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
 	/** @var bool */
48 48
 	private $canPurgeToSaveSpace;
49 49
 
50
-	public function __construct(IConfig $config,ITimeFactory $timeFactory) {
50
+	public function __construct(IConfig $config, ITimeFactory $timeFactory) {
51 51
 		$this->timeFactory = $timeFactory;
52 52
 		$this->retentionObligation = $config->getSystemValue('versions_retention_obligation', 'auto');
53 53
 
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
 		$time = $this->timeFactory->getTime();
93 93
 		// Never expire dates in future e.g. misconfiguration or negative time
94 94
 		// adjustment
95
-		if ($time<$timestamp) {
95
+		if ($time < $timestamp) {
96 96
 			return false;
97 97
 		}
98 98
 
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
 		if (!ctype_digit($minValue) && $minValue !== 'auto') {
152 152
 			$isValid = false;
153 153
 			\OC::$server->getLogger()->warning(
154
-					$minValue . ' is not a valid value for minimal versions retention obligation. Check versions_retention_obligation in your config.php. Falling back to auto.',
154
+					$minValue.' is not a valid value for minimal versions retention obligation. Check versions_retention_obligation in your config.php. Falling back to auto.',
155 155
 					['app'=>'files_versions']
156 156
 			);
157 157
 		}
@@ -159,12 +159,12 @@  discard block
 block discarded – undo
159 159
 		if (!ctype_digit($maxValue) && $maxValue !== 'auto') {
160 160
 			$isValid = false;
161 161
 			\OC::$server->getLogger()->warning(
162
-					$maxValue . ' is not a valid value for maximal versions retention obligation. Check versions_retention_obligation in your config.php. Falling back to auto.',
162
+					$maxValue.' is not a valid value for maximal versions retention obligation. Check versions_retention_obligation in your config.php. Falling back to auto.',
163 163
 					['app'=>'files_versions']
164 164
 			);
165 165
 		}
166 166
 
167
-		if (!$isValid){
167
+		if (!$isValid) {
168 168
 			$minValue = 'auto';
169 169
 			$maxValue = 'auto';
170 170
 		}
@@ -177,13 +177,13 @@  discard block
 block discarded – undo
177 177
 			$this->canPurgeToSaveSpace = true;
178 178
 		} elseif ($minValue !== 'auto' && $maxValue === 'auto') {
179 179
 			// Keep for X days but delete anytime if space needed
180
-			$this->minAge = (int)$minValue;
180
+			$this->minAge = (int) $minValue;
181 181
 			$this->maxAge = self::NO_OBLIGATION;
182 182
 			$this->canPurgeToSaveSpace = true;
183 183
 		} elseif ($minValue === 'auto' && $maxValue !== 'auto') {
184 184
 			// Delete anytime if space needed, Delete all older than max automatically
185 185
 			$this->minAge = self::NO_OBLIGATION;
186
-			$this->maxAge = (int)$maxValue;
186
+			$this->maxAge = (int) $maxValue;
187 187
 			$this->canPurgeToSaveSpace = true;
188 188
 		} elseif ($minValue !== 'auto' && $maxValue !== 'auto') {
189 189
 			// Delete all older than max OR older than min if space needed
@@ -193,8 +193,8 @@  discard block
 block discarded – undo
193 193
 				$maxValue = $minValue;
194 194
 			}
195 195
 
196
-			$this->minAge = (int)$minValue;
197
-			$this->maxAge = (int)$maxValue;
196
+			$this->minAge = (int) $minValue;
197
+			$this->maxAge = (int) $maxValue;
198 198
 			$this->canPurgeToSaveSpace = false;
199 199
 		}
200 200
 	}
Please login to merge, or discard this patch.
apps/user_ldap/appinfo/app.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -27,10 +27,10 @@  discard block
 block discarded – undo
27 27
  *
28 28
  */
29 29
 
30
-\OC::$server->registerService('LDAPUserPluginManager', function () {
30
+\OC::$server->registerService('LDAPUserPluginManager', function() {
31 31
 	return new OCA\User_LDAP\UserPluginManager();
32 32
 });
33
-\OC::$server->registerService('LDAPGroupPluginManager', function () {
33
+\OC::$server->registerService('LDAPGroupPluginManager', function() {
34 34
 	return new OCA\User_LDAP\GroupPluginManager();
35 35
 });
36 36
 
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
 
39 39
 $helper = new \OCA\User_LDAP\Helper(\OC::$server->getConfig());
40 40
 $configPrefixes = $helper->getServerConfigurationPrefixes(true);
41
-if(count($configPrefixes) > 0) {
41
+if (count($configPrefixes) > 0) {
42 42
 	$ldapWrapper = new OCA\User_LDAP\LDAP();
43 43
 	$ocConfig = \OC::$server->getConfig();
44 44
 	$notificationManager = \OC::$server->getNotificationManager();
@@ -48,10 +48,10 @@  discard block
 block discarded – undo
48 48
 	$userPluginManager = \OC::$server->query('LDAPUserPluginManager');
49 49
 	$groupPluginManager = \OC::$server->query('LDAPGroupPluginManager');
50 50
 
51
-	$userBackend  = new OCA\User_LDAP\User_Proxy(
51
+	$userBackend = new OCA\User_LDAP\User_Proxy(
52 52
 		$configPrefixes, $ldapWrapper, $ocConfig, $notificationManager, $userSession, $userPluginManager
53 53
 	);
54
-	$groupBackend  = new OCA\User_LDAP\Group_Proxy($configPrefixes, $ldapWrapper, $groupPluginManager);
54
+	$groupBackend = new OCA\User_LDAP\Group_Proxy($configPrefixes, $ldapWrapper, $groupPluginManager);
55 55
 	// register user backend
56 56
 	OC_User::useBackend($userBackend);
57 57
 
Please login to merge, or discard this patch.
apps/user_ldap/lib/LDAP.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -54,12 +54,12 @@  discard block
 block discarded – undo
54 54
 	 * @return mixed
55 55
 	 */
56 56
 	public function connect($host, $port) {
57
-		if(strpos($host, '://') === false) {
58
-			$host = 'ldap://' . $host;
57
+		if (strpos($host, '://') === false) {
58
+			$host = 'ldap://'.$host;
59 59
 		}
60
-		if(strpos($host, ':', strpos($host, '://') + 1) === false) {
60
+		if (strpos($host, ':', strpos($host, '://') + 1) === false) {
61 61
 			//ldap_connect ignores port parameter when URLs are passed
62
-			$host .= ':' . $port;
62
+			$host .= ':'.$port;
63 63
 		}
64 64
 		return $this->invokeLDAPMethod('connect', $host);
65 65
 	}
@@ -194,8 +194,8 @@  discard block
 block discarded – undo
194 194
 	 * @throws \Exception
195 195
 	 */
196 196
 	public function search($link, $baseDN, $filter, $attr, $attrsOnly = 0, $limit = 0) {
197
-		$oldHandler = set_error_handler(function ($no, $message, $file, $line) use (&$oldHandler) {
198
-			if(strpos($message, 'Partial search results returned: Sizelimit exceeded') !== false) {
197
+		$oldHandler = set_error_handler(function($no, $message, $file, $line) use (&$oldHandler) {
198
+			if (strpos($message, 'Partial search results returned: Sizelimit exceeded') !== false) {
199 199
 				return true;
200 200
 			}
201 201
 			$oldHandler($no, $message, $file, $line);
@@ -285,13 +285,13 @@  discard block
 block discarded – undo
285 285
 	 * @return bool
286 286
 	 */
287 287
 	protected function isResultFalse($result) {
288
-		if($result === false) {
288
+		if ($result === false) {
289 289
 			return true;
290 290
 		}
291 291
 
292
-		if($this->curFunc === 'ldap_search' && is_array($result)) {
292
+		if ($this->curFunc === 'ldap_search' && is_array($result)) {
293 293
 			foreach ($result as $singleResult) {
294
-				if($singleResult === false) {
294
+				if ($singleResult === false) {
295 295
 					return true;
296 296
 				}
297 297
 			}
@@ -305,8 +305,8 @@  discard block
 block discarded – undo
305 305
 	 */
306 306
 	protected function invokeLDAPMethod() {
307 307
 		$arguments = func_get_args();
308
-		$func = 'ldap_' . array_shift($arguments);
309
-		if(function_exists($func)) {
308
+		$func = 'ldap_'.array_shift($arguments);
309
+		if (function_exists($func)) {
310 310
 			$this->preFunctionCall($func, $arguments);
311 311
 			$result = call_user_func_array($func, $arguments);
312 312
 			if ($this->isResultFalse($result)) {
@@ -336,12 +336,12 @@  discard block
 block discarded – undo
336 336
 	 */
337 337
 	private function processLDAPError($resource) {
338 338
 		$errorCode = ldap_errno($resource);
339
-		if($errorCode === 0) {
339
+		if ($errorCode === 0) {
340 340
 			return;
341 341
 		}
342
-		$errorMsg  = ldap_error($resource);
342
+		$errorMsg = ldap_error($resource);
343 343
 
344
-		if($this->curFunc === 'ldap_get_entries'
344
+		if ($this->curFunc === 'ldap_get_entries'
345 345
 			&& $errorCode === -4) {
346 346
 		} else if ($errorCode === 32) {
347 347
 			//for now
@@ -357,7 +357,7 @@  discard block
 block discarded – undo
357 357
 			throw new \Exception('LDAP Operations error', $errorCode);
358 358
 		} else if ($errorCode === 19) {
359 359
 			ldap_get_option($this->curArgs[0], LDAP_OPT_ERROR_STRING, $extended_error);
360
-			throw new ConstraintViolationException(!empty($extended_error)?$extended_error:$errorMsg, $errorCode);
360
+			throw new ConstraintViolationException(!empty($extended_error) ? $extended_error : $errorMsg, $errorCode);
361 361
 		} else {
362 362
 			\OC::$server->getLogger()->debug('LDAP error {message} ({code}) after calling {func}', [
363 363
 				'app' => 'user_ldap',
@@ -373,9 +373,9 @@  discard block
 block discarded – undo
373 373
 	 * @throw \Exception
374 374
 	 */
375 375
 	private function postFunctionCall() {
376
-		if($this->isResource($this->curArgs[0])) {
376
+		if ($this->isResource($this->curArgs[0])) {
377 377
 			$resource = $this->curArgs[0];
378
-		} else if(
378
+		} else if (
379 379
 			   $this->curFunc === 'ldap_search'
380 380
 			&& is_array($this->curArgs[0])
381 381
 			&& $this->isResource($this->curArgs[0][0])
Please login to merge, or discard this patch.