Completed
Pull Request — master (#4454)
by Lukas
11:53
created
lib/private/Installer.php 1 patch
Spacing   +52 added lines, -52 removed lines patch added patch discarded remove patch
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
 	 */
109 109
 	public function installApp($appId) {
110 110
 		$app = \OC_App::findAppInDirectories($appId);
111
-		if($app === false) {
111
+		if ($app === false) {
112 112
 			throw new \Exception('App not found in any app directory');
113 113
 		}
114 114
 
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
 		$info = OC_App::getAppInfo($basedir.'/appinfo/info.xml', true);
117 117
 
118 118
 		//install the database
119
-		if(is_file($basedir.'/appinfo/database.xml')) {
119
+		if (is_file($basedir.'/appinfo/database.xml')) {
120 120
 			if (\OC::$server->getAppConfig()->getValue($info['id'], 'installed_version') === null) {
121 121
 				OC_DB::createDbFromStructure($basedir.'/appinfo/database.xml');
122 122
 			} else {
@@ -128,8 +128,8 @@  discard block
 block discarded – undo
128 128
 		\OC_App::setupBackgroundJobs($info['background-jobs']);
129 129
 
130 130
 		//run appinfo/install.php
131
-		if((!isset($data['noinstall']) or $data['noinstall']==false)) {
132
-			self::includeAppScript($basedir . '/appinfo/install.php');
131
+		if ((!isset($data['noinstall']) or $data['noinstall'] == false)) {
132
+			self::includeAppScript($basedir.'/appinfo/install.php');
133 133
 		}
134 134
 
135 135
 		$appData = OC_App::getAppInfo($appId);
@@ -140,10 +140,10 @@  discard block
 block discarded – undo
140 140
 		\OC::$server->getConfig()->setAppValue($info['id'], 'enabled', 'no');
141 141
 
142 142
 		//set remote/public handlers
143
-		foreach($info['remote'] as $name=>$path) {
143
+		foreach ($info['remote'] as $name=>$path) {
144 144
 			\OC::$server->getConfig()->setAppValue('core', 'remote_'.$name, $info['id'].'/'.$path);
145 145
 		}
146
-		foreach($info['public'] as $name=>$path) {
146
+		foreach ($info['public'] as $name=>$path) {
147 147
 			\OC::$server->getConfig()->setAppValue('core', 'public_'.$name, $info['id'].'/'.$path);
148 148
 		}
149 149
 
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
 	 *
160 160
 	 * Checks whether or not an app is installed, i.e. registered in apps table.
161 161
 	 */
162
-	public static function isInstalled( $app ) {
162
+	public static function isInstalled($app) {
163 163
 		return (\OC::$server->getConfig()->getAppValue($app, "installed_version", null) !== null);
164 164
 	}
165 165
 
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
 	 * @return bool
171 171
 	 */
172 172
 	public function updateAppstoreApp($appId) {
173
-		if(self::isUpdateAvailable($appId, $this->appFetcher)) {
173
+		if (self::isUpdateAvailable($appId, $this->appFetcher)) {
174 174
 			try {
175 175
 				$this->downloadApp($appId);
176 176
 			} catch (\Exception $e) {
@@ -194,18 +194,18 @@  discard block
 block discarded – undo
194 194
 		$appId = strtolower($appId);
195 195
 
196 196
 		$apps = $this->appFetcher->get();
197
-		foreach($apps as $app) {
198
-			if($app['id'] === $appId) {
197
+		foreach ($apps as $app) {
198
+			if ($app['id'] === $appId) {
199 199
 				// Load the certificate
200 200
 				$certificate = new X509();
201
-				$certificate->loadCA(file_get_contents(__DIR__ . '/../../resources/codesigning/root.crt'));
201
+				$certificate->loadCA(file_get_contents(__DIR__.'/../../resources/codesigning/root.crt'));
202 202
 				$loadedCertificate = $certificate->loadX509($app['certificate']);
203 203
 
204 204
 				// Verify if the certificate has been revoked
205 205
 				$crl = new X509();
206
-				$crl->loadCA(file_get_contents(__DIR__ . '/../../resources/codesigning/root.crt'));
207
-				$crl->loadCRL(file_get_contents(__DIR__ . '/../../resources/codesigning/root.crl'));
208
-				if($crl->validateSignature() !== true) {
206
+				$crl->loadCA(file_get_contents(__DIR__.'/../../resources/codesigning/root.crt'));
207
+				$crl->loadCRL(file_get_contents(__DIR__.'/../../resources/codesigning/root.crl'));
208
+				if ($crl->validateSignature() !== true) {
209 209
 					throw new \Exception('Could not validate CRL signature');
210 210
 				}
211 211
 				$csn = $loadedCertificate['tbsCertificate']['serialNumber']->toString();
@@ -220,7 +220,7 @@  discard block
 block discarded – undo
220 220
 				}
221 221
 
222 222
 				// Verify if the certificate has been issued by the Nextcloud Code Authority CA
223
-				if($certificate->validateSignature() !== true) {
223
+				if ($certificate->validateSignature() !== true) {
224 224
 					throw new \Exception(
225 225
 						sprintf(
226 226
 							'App with id %s has a certificate not issued by a trusted Code Signing Authority',
@@ -231,7 +231,7 @@  discard block
 block discarded – undo
231 231
 
232 232
 				// Verify if the certificate is issued for the requested app id
233 233
 				$certInfo = openssl_x509_parse($app['certificate']);
234
-				if(!isset($certInfo['subject']['CN'])) {
234
+				if (!isset($certInfo['subject']['CN'])) {
235 235
 					throw new \Exception(
236 236
 						sprintf(
237 237
 							'App with id %s has a cert with no CN',
@@ -239,7 +239,7 @@  discard block
 block discarded – undo
239 239
 						)
240 240
 					);
241 241
 				}
242
-				if($certInfo['subject']['CN'] !== $appId) {
242
+				if ($certInfo['subject']['CN'] !== $appId) {
243 243
 					throw new \Exception(
244 244
 						sprintf(
245 245
 							'App with id %s has a cert issued to %s',
@@ -256,21 +256,21 @@  discard block
 block discarded – undo
256 256
 
257 257
 				// Check if the signature actually matches the downloaded content
258 258
 				$certificate = openssl_get_publickey($app['certificate']);
259
-				$verified = (bool)openssl_verify(file_get_contents($tempFile), base64_decode($app['releases'][0]['signature']), $certificate, OPENSSL_ALGO_SHA512);
259
+				$verified = (bool) openssl_verify(file_get_contents($tempFile), base64_decode($app['releases'][0]['signature']), $certificate, OPENSSL_ALGO_SHA512);
260 260
 				openssl_free_key($certificate);
261 261
 
262
-				if($verified === true) {
262
+				if ($verified === true) {
263 263
 					// Seems to match, let's proceed
264 264
 					$extractDir = $this->tempManager->getTemporaryFolder();
265 265
 					$archive = new TAR($tempFile);
266 266
 
267
-					if($archive) {
267
+					if ($archive) {
268 268
 						$archive->extract($extractDir);
269 269
 						$allFiles = scandir($extractDir);
270 270
 						$folders = array_diff($allFiles, ['.', '..']);
271 271
 						$folders = array_values($folders);
272 272
 
273
-						if(count($folders) > 1) {
273
+						if (count($folders) > 1) {
274 274
 							throw new \Exception(
275 275
 								sprintf(
276 276
 									'Extracted app %s has more than 1 folder',
@@ -281,22 +281,22 @@  discard block
 block discarded – undo
281 281
 
282 282
 						// Check if appinfo/info.xml has the same app ID as well
283 283
 						$loadEntities = libxml_disable_entity_loader(false);
284
-						$xml = simplexml_load_file($extractDir . '/' . $folders[0] . '/appinfo/info.xml');
284
+						$xml = simplexml_load_file($extractDir.'/'.$folders[0].'/appinfo/info.xml');
285 285
 						libxml_disable_entity_loader($loadEntities);
286
-						if((string)$xml->id !== $appId) {
286
+						if ((string) $xml->id !== $appId) {
287 287
 							throw new \Exception(
288 288
 								sprintf(
289 289
 									'App for id %s has a wrong app ID in info.xml: %s',
290 290
 									$appId,
291
-									(string)$xml->id
291
+									(string) $xml->id
292 292
 								)
293 293
 							);
294 294
 						}
295 295
 
296 296
 						// Check if the version is lower than before
297 297
 						$currentVersion = OC_App::getAppVersion($appId);
298
-						$newVersion = (string)$xml->version;
299
-						if(version_compare($currentVersion, $newVersion) === 1) {
298
+						$newVersion = (string) $xml->version;
299
+						if (version_compare($currentVersion, $newVersion) === 1) {
300 300
 							throw new \Exception(
301 301
 								sprintf(
302 302
 									'App for id %s has version %s and tried to update to lower version %s',
@@ -307,12 +307,12 @@  discard block
 block discarded – undo
307 307
 							);
308 308
 						}
309 309
 
310
-						$baseDir = OC_App::getInstallPath() . '/' . $appId;
310
+						$baseDir = OC_App::getInstallPath().'/'.$appId;
311 311
 						// Remove old app with the ID if existent
312 312
 						OC_Helper::rmdirr($baseDir);
313 313
 						// Move to app folder
314
-						if(@mkdir($baseDir)) {
315
-							$extractDir .= '/' . $folders[0];
314
+						if (@mkdir($baseDir)) {
315
+							$extractDir .= '/'.$folders[0];
316 316
 							OC_Helper::copyr($extractDir, $baseDir);
317 317
 						}
318 318
 						OC_Helper::copyr($extractDir, $baseDir);
@@ -372,8 +372,8 @@  discard block
 block discarded – undo
372 372
 		}
373 373
 
374 374
 		$apps = $appFetcher->get();
375
-		foreach($apps as $app) {
376
-			if($app['id'] === $appId) {
375
+		foreach ($apps as $app) {
376
+			if ($app['id'] === $appId) {
377 377
 				$currentVersion = OC_App::getAppVersion($appId);
378 378
 				$newestVersion = $app['releases'][0]['version'];
379 379
 				if (version_compare($newestVersion, $currentVersion, '>')) {
@@ -395,7 +395,7 @@  discard block
 block discarded – undo
395 395
 	 * The function will check if the app is already downloaded in the apps repository
396 396
 	 */
397 397
 	public function isDownloaded($name) {
398
-		foreach(\OC::$APPSROOTS as $dir) {
398
+		foreach (\OC::$APPSROOTS as $dir) {
399 399
 			$dirToTest  = $dir['path'];
400 400
 			$dirToTest .= '/';
401 401
 			$dirToTest .= $name;
@@ -423,11 +423,11 @@  discard block
 block discarded – undo
423 423
 	 * this has to be done by the function oc_app_uninstall().
424 424
 	 */
425 425
 	public function removeApp($appId) {
426
-		if($this->isDownloaded( $appId )) {
427
-			$appDir = OC_App::getInstallPath() . '/' . $appId;
426
+		if ($this->isDownloaded($appId)) {
427
+			$appDir = OC_App::getInstallPath().'/'.$appId;
428 428
 			OC_Helper::rmdirr($appDir);
429 429
 			return true;
430
-		}else{
430
+		} else {
431 431
 			\OCP\Util::writeLog('core', 'can\'t remove app '.$appId.'. It is not installed.', \OCP\Util::ERROR);
432 432
 
433 433
 			return false;
@@ -443,8 +443,8 @@  discard block
 block discarded – undo
443 443
 	 */
444 444
 	public function installAppBundle(Bundle $bundle) {
445 445
 		$appIds = $bundle->getAppIdentifiers();
446
-		foreach($appIds as $appId) {
447
-			if(!$this->isDownloaded($appId)) {
446
+		foreach ($appIds as $appId) {
447
+			if (!$this->isDownloaded($appId)) {
448 448
 				$this->downloadApp($appId);
449 449
 			}
450 450
 			$this->installApp($appId);
@@ -466,13 +466,13 @@  discard block
 block discarded – undo
466 466
 	 */
467 467
 	public static function installShippedApps($softErrors = false) {
468 468
 		$errors = [];
469
-		foreach(\OC::$APPSROOTS as $app_dir) {
470
-			if($dir = opendir( $app_dir['path'] )) {
471
-				while( false !== ( $filename = readdir( $dir ))) {
472
-					if( substr( $filename, 0, 1 ) != '.' and is_dir($app_dir['path']."/$filename") ) {
473
-						if( file_exists( $app_dir['path']."/$filename/appinfo/info.xml" )) {
474
-							if(!Installer::isInstalled($filename)) {
475
-								$info=OC_App::getAppInfo($filename);
469
+		foreach (\OC::$APPSROOTS as $app_dir) {
470
+			if ($dir = opendir($app_dir['path'])) {
471
+				while (false !== ($filename = readdir($dir))) {
472
+					if (substr($filename, 0, 1) != '.' and is_dir($app_dir['path']."/$filename")) {
473
+						if (file_exists($app_dir['path']."/$filename/appinfo/info.xml")) {
474
+							if (!Installer::isInstalled($filename)) {
475
+								$info = OC_App::getAppInfo($filename);
476 476
 								$enabled = isset($info['default_enable']);
477 477
 								if (($enabled || in_array($filename, \OC::$server->getAppManager()->getAlwaysEnabledApps()))
478 478
 									  && \OC::$server->getConfig()->getAppValue($filename, 'enabled') !== 'no') {
@@ -495,7 +495,7 @@  discard block
 block discarded – undo
495 495
 						}
496 496
 					}
497 497
 				}
498
-				closedir( $dir );
498
+				closedir($dir);
499 499
 			}
500 500
 		}
501 501
 
@@ -510,12 +510,12 @@  discard block
 block discarded – undo
510 510
 	public static function installShippedApp($app) {
511 511
 		//install the database
512 512
 		$appPath = OC_App::getAppPath($app);
513
-		if(is_file("$appPath/appinfo/database.xml")) {
513
+		if (is_file("$appPath/appinfo/database.xml")) {
514 514
 			try {
515 515
 				OC_DB::createDbFromStructure("$appPath/appinfo/database.xml");
516 516
 			} catch (TableExistsException $e) {
517 517
 				throw new HintException(
518
-					'Failed to enable app ' . $app,
518
+					'Failed to enable app '.$app,
519 519
 					'Please ask for help via one of our <a href="https://nextcloud.com/support/" target="_blank" rel="noreferrer">support channels</a>.',
520 520
 					0, $e
521 521
 				);
@@ -542,16 +542,16 @@  discard block
 block discarded – undo
542 542
 		}
543 543
 
544 544
 		//set remote/public handlers
545
-		foreach($info['remote'] as $name=>$path) {
545
+		foreach ($info['remote'] as $name=>$path) {
546 546
 			$config->setAppValue('core', 'remote_'.$name, $app.'/'.$path);
547 547
 		}
548
-		foreach($info['public'] as $name=>$path) {
548
+		foreach ($info['public'] as $name=>$path) {
549 549
 			$config->setAppValue('core', 'public_'.$name, $app.'/'.$path);
550 550
 		}
551 551
 
552 552
 		OC_App::setAppTypes($info['id']);
553 553
 
554
-		if(isset($info['settings']) && is_array($info['settings'])) {
554
+		if (isset($info['settings']) && is_array($info['settings'])) {
555 555
 			// requires that autoloading was registered for the app,
556 556
 			// as happens before running the install.php some lines above
557 557
 			\OC::$server->getSettingsManager()->setupSettings($info['settings']);
@@ -567,7 +567,7 @@  discard block
 block discarded – undo
567 567
 	 */
568 568
 	public static function checkCode($folder) {
569 569
 		// is the code checker enabled?
570
-		if(!\OC::$server->getConfig()->getSystemValue('appcodechecker', false)) {
570
+		if (!\OC::$server->getConfig()->getSystemValue('appcodechecker', false)) {
571 571
 			return true;
572 572
 		}
573 573
 
@@ -581,7 +581,7 @@  discard block
 block discarded – undo
581 581
 	 * @param string $script
582 582
 	 */
583 583
 	private static function includeAppScript($script) {
584
-		if ( file_exists($script) ){
584
+		if (file_exists($script)) {
585 585
 			include $script;
586 586
 		}
587 587
 	}
Please login to merge, or discard this patch.
lib/private/Repair/NC12/InstallCoreBundle.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -66,12 +66,12 @@
 block discarded – undo
66 66
 		}
67 67
 
68 68
 		$defaultBundle = $this->bundleFetcher->getDefaultInstallationBundle();
69
-		foreach($defaultBundle as $bundle) {
69
+		foreach ($defaultBundle as $bundle) {
70 70
 			try {
71 71
 				$this->installer->installAppBundle($bundle);
72 72
 				$output->info('Successfully installed core app bundle.');
73 73
 			} catch (\Exception $e) {
74
-				$output->warning('Could not install core app bundle:' . $e->getMessage());
74
+				$output->warning('Could not install core app bundle:'.$e->getMessage());
75 75
 			}
76 76
 		}
77 77
 	}
Please login to merge, or discard this patch.
lib/private/Server.php 1 patch
Spacing   +98 added lines, -98 removed lines patch added patch discarded remove patch
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
 		$this->registerAlias(\OCP\Contacts\IManager::class, \OC\ContactsManager::class);
138 138
 		$this->registerAlias('ContactsManager', \OCP\Contacts\IManager::class);
139 139
 
140
-		$this->registerService(\OCP\IPreview::class, function (Server $c) {
140
+		$this->registerService(\OCP\IPreview::class, function(Server $c) {
141 141
 			return new PreviewManager(
142 142
 				$c->getConfig(),
143 143
 				$c->getRootFolder(),
@@ -148,13 +148,13 @@  discard block
 block discarded – undo
148 148
 		});
149 149
 		$this->registerAlias('PreviewManager', \OCP\IPreview::class);
150 150
 
151
-		$this->registerService(\OC\Preview\Watcher::class, function (Server $c) {
151
+		$this->registerService(\OC\Preview\Watcher::class, function(Server $c) {
152 152
 			return new \OC\Preview\Watcher(
153 153
 				$c->getAppDataDir('preview')
154 154
 			);
155 155
 		});
156 156
 
157
-		$this->registerService('EncryptionManager', function (Server $c) {
157
+		$this->registerService('EncryptionManager', function(Server $c) {
158 158
 			$view = new View();
159 159
 			$util = new Encryption\Util(
160 160
 				$view,
@@ -172,7 +172,7 @@  discard block
 block discarded – undo
172 172
 			);
173 173
 		});
174 174
 
175
-		$this->registerService('EncryptionFileHelper', function (Server $c) {
175
+		$this->registerService('EncryptionFileHelper', function(Server $c) {
176 176
 			$util = new Encryption\Util(
177 177
 				new View(),
178 178
 				$c->getUserManager(),
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
 			);
187 187
 		});
188 188
 
189
-		$this->registerService('EncryptionKeyStorage', function (Server $c) {
189
+		$this->registerService('EncryptionKeyStorage', function(Server $c) {
190 190
 			$view = new View();
191 191
 			$util = new Encryption\Util(
192 192
 				$view,
@@ -197,32 +197,32 @@  discard block
 block discarded – undo
197 197
 
198 198
 			return new Encryption\Keys\Storage($view, $util);
199 199
 		});
200
-		$this->registerService('TagMapper', function (Server $c) {
200
+		$this->registerService('TagMapper', function(Server $c) {
201 201
 			return new TagMapper($c->getDatabaseConnection());
202 202
 		});
203 203
 
204
-		$this->registerService(\OCP\ITagManager::class, function (Server $c) {
204
+		$this->registerService(\OCP\ITagManager::class, function(Server $c) {
205 205
 			$tagMapper = $c->query('TagMapper');
206 206
 			return new TagManager($tagMapper, $c->getUserSession());
207 207
 		});
208 208
 		$this->registerAlias('TagManager', \OCP\ITagManager::class);
209 209
 
210
-		$this->registerService('SystemTagManagerFactory', function (Server $c) {
210
+		$this->registerService('SystemTagManagerFactory', function(Server $c) {
211 211
 			$config = $c->getConfig();
212 212
 			$factoryClass = $config->getSystemValue('systemtags.managerFactory', '\OC\SystemTag\ManagerFactory');
213 213
 			/** @var \OC\SystemTag\ManagerFactory $factory */
214 214
 			$factory = new $factoryClass($this);
215 215
 			return $factory;
216 216
 		});
217
-		$this->registerService(\OCP\SystemTag\ISystemTagManager::class, function (Server $c) {
217
+		$this->registerService(\OCP\SystemTag\ISystemTagManager::class, function(Server $c) {
218 218
 			return $c->query('SystemTagManagerFactory')->getManager();
219 219
 		});
220 220
 		$this->registerAlias('SystemTagManager', \OCP\SystemTag\ISystemTagManager::class);
221 221
 
222
-		$this->registerService(\OCP\SystemTag\ISystemTagObjectMapper::class, function (Server $c) {
222
+		$this->registerService(\OCP\SystemTag\ISystemTagObjectMapper::class, function(Server $c) {
223 223
 			return $c->query('SystemTagManagerFactory')->getObjectMapper();
224 224
 		});
225
-		$this->registerService('RootFolder', function (Server $c) {
225
+		$this->registerService('RootFolder', function(Server $c) {
226 226
 			$manager = \OC\Files\Filesystem::getMountManager(null);
227 227
 			$view = new View();
228 228
 			$root = new Root(
@@ -250,30 +250,30 @@  discard block
 block discarded – undo
250 250
 		});
251 251
 		$this->registerAlias('LazyRootFolder', \OCP\Files\IRootFolder::class);
252 252
 
253
-		$this->registerService(\OCP\IUserManager::class, function (Server $c) {
253
+		$this->registerService(\OCP\IUserManager::class, function(Server $c) {
254 254
 			$config = $c->getConfig();
255 255
 			return new \OC\User\Manager($config);
256 256
 		});
257 257
 		$this->registerAlias('UserManager', \OCP\IUserManager::class);
258 258
 
259
-		$this->registerService(\OCP\IGroupManager::class, function (Server $c) {
259
+		$this->registerService(\OCP\IGroupManager::class, function(Server $c) {
260 260
 			$groupManager = new \OC\Group\Manager($this->getUserManager(), $this->getLogger());
261
-			$groupManager->listen('\OC\Group', 'preCreate', function ($gid) {
261
+			$groupManager->listen('\OC\Group', 'preCreate', function($gid) {
262 262
 				\OC_Hook::emit('OC_Group', 'pre_createGroup', array('run' => true, 'gid' => $gid));
263 263
 			});
264
-			$groupManager->listen('\OC\Group', 'postCreate', function (\OC\Group\Group $gid) {
264
+			$groupManager->listen('\OC\Group', 'postCreate', function(\OC\Group\Group $gid) {
265 265
 				\OC_Hook::emit('OC_User', 'post_createGroup', array('gid' => $gid->getGID()));
266 266
 			});
267
-			$groupManager->listen('\OC\Group', 'preDelete', function (\OC\Group\Group $group) {
267
+			$groupManager->listen('\OC\Group', 'preDelete', function(\OC\Group\Group $group) {
268 268
 				\OC_Hook::emit('OC_Group', 'pre_deleteGroup', array('run' => true, 'gid' => $group->getGID()));
269 269
 			});
270
-			$groupManager->listen('\OC\Group', 'postDelete', function (\OC\Group\Group $group) {
270
+			$groupManager->listen('\OC\Group', 'postDelete', function(\OC\Group\Group $group) {
271 271
 				\OC_Hook::emit('OC_User', 'post_deleteGroup', array('gid' => $group->getGID()));
272 272
 			});
273
-			$groupManager->listen('\OC\Group', 'preAddUser', function (\OC\Group\Group $group, \OC\User\User $user) {
273
+			$groupManager->listen('\OC\Group', 'preAddUser', function(\OC\Group\Group $group, \OC\User\User $user) {
274 274
 				\OC_Hook::emit('OC_Group', 'pre_addToGroup', array('run' => true, 'uid' => $user->getUID(), 'gid' => $group->getGID()));
275 275
 			});
276
-			$groupManager->listen('\OC\Group', 'postAddUser', function (\OC\Group\Group $group, \OC\User\User $user) {
276
+			$groupManager->listen('\OC\Group', 'postAddUser', function(\OC\Group\Group $group, \OC\User\User $user) {
277 277
 				\OC_Hook::emit('OC_Group', 'post_addToGroup', array('uid' => $user->getUID(), 'gid' => $group->getGID()));
278 278
 				//Minimal fix to keep it backward compatible TODO: clean up all the GroupManager hooks
279 279
 				\OC_Hook::emit('OC_User', 'post_addToGroup', array('uid' => $user->getUID(), 'gid' => $group->getGID()));
@@ -293,11 +293,11 @@  discard block
 block discarded – undo
293 293
 			return new Store($session, $logger, $tokenProvider);
294 294
 		});
295 295
 		$this->registerAlias(IStore::class, Store::class);
296
-		$this->registerService('OC\Authentication\Token\DefaultTokenMapper', function (Server $c) {
296
+		$this->registerService('OC\Authentication\Token\DefaultTokenMapper', function(Server $c) {
297 297
 			$dbConnection = $c->getDatabaseConnection();
298 298
 			return new Authentication\Token\DefaultTokenMapper($dbConnection);
299 299
 		});
300
-		$this->registerService('OC\Authentication\Token\DefaultTokenProvider', function (Server $c) {
300
+		$this->registerService('OC\Authentication\Token\DefaultTokenProvider', function(Server $c) {
301 301
 			$mapper = $c->query('OC\Authentication\Token\DefaultTokenMapper');
302 302
 			$crypto = $c->getCrypto();
303 303
 			$config = $c->getConfig();
@@ -307,7 +307,7 @@  discard block
 block discarded – undo
307 307
 		});
308 308
 		$this->registerAlias('OC\Authentication\Token\IProvider', 'OC\Authentication\Token\DefaultTokenProvider');
309 309
 
310
-		$this->registerService(\OCP\IUserSession::class, function (Server $c) {
310
+		$this->registerService(\OCP\IUserSession::class, function(Server $c) {
311 311
 			$manager = $c->getUserManager();
312 312
 			$session = new \OC\Session\Memory('');
313 313
 			$timeFactory = new TimeFactory();
@@ -320,40 +320,40 @@  discard block
 block discarded – undo
320 320
 			}
321 321
 
322 322
 			$userSession = new \OC\User\Session($manager, $session, $timeFactory, $defaultTokenProvider, $c->getConfig(), $c->getSecureRandom(), $c->getLockdownManager());
323
-			$userSession->listen('\OC\User', 'preCreateUser', function ($uid, $password) {
323
+			$userSession->listen('\OC\User', 'preCreateUser', function($uid, $password) {
324 324
 				\OC_Hook::emit('OC_User', 'pre_createUser', array('run' => true, 'uid' => $uid, 'password' => $password));
325 325
 			});
326
-			$userSession->listen('\OC\User', 'postCreateUser', function ($user, $password) {
326
+			$userSession->listen('\OC\User', 'postCreateUser', function($user, $password) {
327 327
 				/** @var $user \OC\User\User */
328 328
 				\OC_Hook::emit('OC_User', 'post_createUser', array('uid' => $user->getUID(), 'password' => $password));
329 329
 			});
330
-			$userSession->listen('\OC\User', 'preDelete', function ($user) {
330
+			$userSession->listen('\OC\User', 'preDelete', function($user) {
331 331
 				/** @var $user \OC\User\User */
332 332
 				\OC_Hook::emit('OC_User', 'pre_deleteUser', array('run' => true, 'uid' => $user->getUID()));
333 333
 			});
334
-			$userSession->listen('\OC\User', 'postDelete', function ($user) {
334
+			$userSession->listen('\OC\User', 'postDelete', function($user) {
335 335
 				/** @var $user \OC\User\User */
336 336
 				\OC_Hook::emit('OC_User', 'post_deleteUser', array('uid' => $user->getUID()));
337 337
 			});
338
-			$userSession->listen('\OC\User', 'preSetPassword', function ($user, $password, $recoveryPassword) {
338
+			$userSession->listen('\OC\User', 'preSetPassword', function($user, $password, $recoveryPassword) {
339 339
 				/** @var $user \OC\User\User */
340 340
 				\OC_Hook::emit('OC_User', 'pre_setPassword', array('run' => true, 'uid' => $user->getUID(), 'password' => $password, 'recoveryPassword' => $recoveryPassword));
341 341
 			});
342
-			$userSession->listen('\OC\User', 'postSetPassword', function ($user, $password, $recoveryPassword) {
342
+			$userSession->listen('\OC\User', 'postSetPassword', function($user, $password, $recoveryPassword) {
343 343
 				/** @var $user \OC\User\User */
344 344
 				\OC_Hook::emit('OC_User', 'post_setPassword', array('run' => true, 'uid' => $user->getUID(), 'password' => $password, 'recoveryPassword' => $recoveryPassword));
345 345
 			});
346
-			$userSession->listen('\OC\User', 'preLogin', function ($uid, $password) {
346
+			$userSession->listen('\OC\User', 'preLogin', function($uid, $password) {
347 347
 				\OC_Hook::emit('OC_User', 'pre_login', array('run' => true, 'uid' => $uid, 'password' => $password));
348 348
 			});
349
-			$userSession->listen('\OC\User', 'postLogin', function ($user, $password) {
349
+			$userSession->listen('\OC\User', 'postLogin', function($user, $password) {
350 350
 				/** @var $user \OC\User\User */
351 351
 				\OC_Hook::emit('OC_User', 'post_login', array('run' => true, 'uid' => $user->getUID(), 'password' => $password));
352 352
 			});
353
-			$userSession->listen('\OC\User', 'logout', function () {
353
+			$userSession->listen('\OC\User', 'logout', function() {
354 354
 				\OC_Hook::emit('OC_User', 'logout', array());
355 355
 			});
356
-			$userSession->listen('\OC\User', 'changeUser', function ($user, $feature, $value, $oldValue) {
356
+			$userSession->listen('\OC\User', 'changeUser', function($user, $feature, $value, $oldValue) {
357 357
 				/** @var $user \OC\User\User */
358 358
 				\OC_Hook::emit('OC_User', 'changeUser', array('run' => true, 'user' => $user, 'feature' => $feature, 'value' => $value, 'old_value' => $oldValue));
359 359
 			});
@@ -361,14 +361,14 @@  discard block
 block discarded – undo
361 361
 		});
362 362
 		$this->registerAlias('UserSession', \OCP\IUserSession::class);
363 363
 
364
-		$this->registerService(\OC\Authentication\TwoFactorAuth\Manager::class, function (Server $c) {
364
+		$this->registerService(\OC\Authentication\TwoFactorAuth\Manager::class, function(Server $c) {
365 365
 			return new \OC\Authentication\TwoFactorAuth\Manager($c->getAppManager(), $c->getSession(), $c->getConfig(), $c->getActivityManager(), $c->getLogger());
366 366
 		});
367 367
 
368 368
 		$this->registerAlias(\OCP\INavigationManager::class, \OC\NavigationManager::class);
369 369
 		$this->registerAlias('NavigationManager', \OCP\INavigationManager::class);
370 370
 
371
-		$this->registerService(\OC\AllConfig::class, function (Server $c) {
371
+		$this->registerService(\OC\AllConfig::class, function(Server $c) {
372 372
 			return new \OC\AllConfig(
373 373
 				$c->getSystemConfig()
374 374
 			);
@@ -376,17 +376,17 @@  discard block
 block discarded – undo
376 376
 		$this->registerAlias('AllConfig', \OC\AllConfig::class);
377 377
 		$this->registerAlias(\OCP\IConfig::class, \OC\AllConfig::class);
378 378
 
379
-		$this->registerService('SystemConfig', function ($c) use ($config) {
379
+		$this->registerService('SystemConfig', function($c) use ($config) {
380 380
 			return new \OC\SystemConfig($config);
381 381
 		});
382 382
 
383
-		$this->registerService(\OC\AppConfig::class, function (Server $c) {
383
+		$this->registerService(\OC\AppConfig::class, function(Server $c) {
384 384
 			return new \OC\AppConfig($c->getDatabaseConnection());
385 385
 		});
386 386
 		$this->registerAlias('AppConfig', \OC\AppConfig::class);
387 387
 		$this->registerAlias(\OCP\IAppConfig::class, \OC\AppConfig::class);
388 388
 
389
-		$this->registerService(\OCP\L10N\IFactory::class, function (Server $c) {
389
+		$this->registerService(\OCP\L10N\IFactory::class, function(Server $c) {
390 390
 			return new \OC\L10N\Factory(
391 391
 				$c->getConfig(),
392 392
 				$c->getRequest(),
@@ -396,7 +396,7 @@  discard block
 block discarded – undo
396 396
 		});
397 397
 		$this->registerAlias('L10NFactory', \OCP\L10N\IFactory::class);
398 398
 
399
-		$this->registerService(\OCP\IURLGenerator::class, function (Server $c) {
399
+		$this->registerService(\OCP\IURLGenerator::class, function(Server $c) {
400 400
 			$config = $c->getConfig();
401 401
 			$cacheFactory = $c->getMemCacheFactory();
402 402
 			return new \OC\URLGenerator(
@@ -406,10 +406,10 @@  discard block
 block discarded – undo
406 406
 		});
407 407
 		$this->registerAlias('URLGenerator', \OCP\IURLGenerator::class);
408 408
 
409
-		$this->registerService('AppHelper', function ($c) {
409
+		$this->registerService('AppHelper', function($c) {
410 410
 			return new \OC\AppHelper();
411 411
 		});
412
-		$this->registerService('AppFetcher', function ($c) {
412
+		$this->registerService('AppFetcher', function($c) {
413 413
 			return new AppFetcher(
414 414
 				$this->getAppDataDir('appstore'),
415 415
 				$this->getHTTPClientService(),
@@ -417,7 +417,7 @@  discard block
 block discarded – undo
417 417
 				$this->getConfig()
418 418
 			);
419 419
 		});
420
-		$this->registerService('CategoryFetcher', function ($c) {
420
+		$this->registerService('CategoryFetcher', function($c) {
421 421
 			return new CategoryFetcher(
422 422
 				$this->getAppDataDir('appstore'),
423 423
 				$this->getHTTPClientService(),
@@ -426,21 +426,21 @@  discard block
 block discarded – undo
426 426
 			);
427 427
 		});
428 428
 
429
-		$this->registerService(\OCP\ICache::class, function ($c) {
429
+		$this->registerService(\OCP\ICache::class, function($c) {
430 430
 			return new Cache\File();
431 431
 		});
432 432
 		$this->registerAlias('UserCache', \OCP\ICache::class);
433 433
 
434
-		$this->registerService(Factory::class, function (Server $c) {
434
+		$this->registerService(Factory::class, function(Server $c) {
435 435
 			$config = $c->getConfig();
436 436
 
437 437
 			if ($config->getSystemValue('installed', false) && !(defined('PHPUNIT_RUN') && PHPUNIT_RUN)) {
438 438
 				$v = \OC_App::getAppVersions();
439
-				$v['core'] = md5(file_get_contents(\OC::$SERVERROOT . '/version.php'));
439
+				$v['core'] = md5(file_get_contents(\OC::$SERVERROOT.'/version.php'));
440 440
 				$version = implode(',', $v);
441 441
 				$instanceId = \OC_Util::getInstanceId();
442 442
 				$path = \OC::$SERVERROOT;
443
-				$prefix = md5($instanceId . '-' . $version . '-' . $path . '-' . \OC::$WEBROOT);
443
+				$prefix = md5($instanceId.'-'.$version.'-'.$path.'-'.\OC::$WEBROOT);
444 444
 				return new \OC\Memcache\Factory($prefix, $c->getLogger(),
445 445
 					$config->getSystemValue('memcache.local', null),
446 446
 					$config->getSystemValue('memcache.distributed', null),
@@ -457,12 +457,12 @@  discard block
 block discarded – undo
457 457
 		$this->registerAlias('MemCacheFactory', Factory::class);
458 458
 		$this->registerAlias(ICacheFactory::class, Factory::class);
459 459
 
460
-		$this->registerService('RedisFactory', function (Server $c) {
460
+		$this->registerService('RedisFactory', function(Server $c) {
461 461
 			$systemConfig = $c->getSystemConfig();
462 462
 			return new RedisFactory($systemConfig);
463 463
 		});
464 464
 
465
-		$this->registerService(\OCP\Activity\IManager::class, function (Server $c) {
465
+		$this->registerService(\OCP\Activity\IManager::class, function(Server $c) {
466 466
 			return new \OC\Activity\Manager(
467 467
 				$c->getRequest(),
468 468
 				$c->getUserSession(),
@@ -472,14 +472,14 @@  discard block
 block discarded – undo
472 472
 		});
473 473
 		$this->registerAlias('ActivityManager', \OCP\Activity\IManager::class);
474 474
 
475
-		$this->registerService(\OCP\Activity\IEventMerger::class, function (Server $c) {
475
+		$this->registerService(\OCP\Activity\IEventMerger::class, function(Server $c) {
476 476
 			return new \OC\Activity\EventMerger(
477 477
 				$c->getL10N('lib')
478 478
 			);
479 479
 		});
480 480
 		$this->registerAlias(IValidator::class, Validator::class);
481 481
 
482
-		$this->registerService(\OCP\IAvatarManager::class, function (Server $c) {
482
+		$this->registerService(\OCP\IAvatarManager::class, function(Server $c) {
483 483
 			return new AvatarManager(
484 484
 				$c->getUserManager(),
485 485
 				$c->getAppDataDir('avatar'),
@@ -490,7 +490,7 @@  discard block
 block discarded – undo
490 490
 		});
491 491
 		$this->registerAlias('AvatarManager', \OCP\IAvatarManager::class);
492 492
 
493
-		$this->registerService(\OCP\ILogger::class, function (Server $c) {
493
+		$this->registerService(\OCP\ILogger::class, function(Server $c) {
494 494
 			$logType = $c->query('AllConfig')->getSystemValue('log_type', 'file');
495 495
 			$logger = Log::getLogClass($logType);
496 496
 			call_user_func(array($logger, 'init'));
@@ -499,7 +499,7 @@  discard block
 block discarded – undo
499 499
 		});
500 500
 		$this->registerAlias('Logger', \OCP\ILogger::class);
501 501
 
502
-		$this->registerService(\OCP\BackgroundJob\IJobList::class, function (Server $c) {
502
+		$this->registerService(\OCP\BackgroundJob\IJobList::class, function(Server $c) {
503 503
 			$config = $c->getConfig();
504 504
 			return new \OC\BackgroundJob\JobList(
505 505
 				$c->getDatabaseConnection(),
@@ -509,7 +509,7 @@  discard block
 block discarded – undo
509 509
 		});
510 510
 		$this->registerAlias('JobList', \OCP\BackgroundJob\IJobList::class);
511 511
 
512
-		$this->registerService(\OCP\Route\IRouter::class, function (Server $c) {
512
+		$this->registerService(\OCP\Route\IRouter::class, function(Server $c) {
513 513
 			$cacheFactory = $c->getMemCacheFactory();
514 514
 			$logger = $c->getLogger();
515 515
 			if ($cacheFactory->isAvailable()) {
@@ -521,7 +521,7 @@  discard block
 block discarded – undo
521 521
 		});
522 522
 		$this->registerAlias('Router', \OCP\Route\IRouter::class);
523 523
 
524
-		$this->registerService(\OCP\ISearch::class, function ($c) {
524
+		$this->registerService(\OCP\ISearch::class, function($c) {
525 525
 			return new Search();
526 526
 		});
527 527
 		$this->registerAlias('Search', \OCP\ISearch::class);
@@ -541,27 +541,27 @@  discard block
 block discarded – undo
541 541
 			);
542 542
 		});
543 543
 
544
-		$this->registerService(\OCP\Security\ISecureRandom::class, function ($c) {
544
+		$this->registerService(\OCP\Security\ISecureRandom::class, function($c) {
545 545
 			return new SecureRandom();
546 546
 		});
547 547
 		$this->registerAlias('SecureRandom', \OCP\Security\ISecureRandom::class);
548 548
 
549
-		$this->registerService(\OCP\Security\ICrypto::class, function (Server $c) {
549
+		$this->registerService(\OCP\Security\ICrypto::class, function(Server $c) {
550 550
 			return new Crypto($c->getConfig(), $c->getSecureRandom());
551 551
 		});
552 552
 		$this->registerAlias('Crypto', \OCP\Security\ICrypto::class);
553 553
 
554
-		$this->registerService(\OCP\Security\IHasher::class, function (Server $c) {
554
+		$this->registerService(\OCP\Security\IHasher::class, function(Server $c) {
555 555
 			return new Hasher($c->getConfig());
556 556
 		});
557 557
 		$this->registerAlias('Hasher', \OCP\Security\IHasher::class);
558 558
 
559
-		$this->registerService(\OCP\Security\ICredentialsManager::class, function (Server $c) {
559
+		$this->registerService(\OCP\Security\ICredentialsManager::class, function(Server $c) {
560 560
 			return new CredentialsManager($c->getCrypto(), $c->getDatabaseConnection());
561 561
 		});
562 562
 		$this->registerAlias('CredentialsManager', \OCP\Security\ICredentialsManager::class);
563 563
 
564
-		$this->registerService(IDBConnection::class, function (Server $c) {
564
+		$this->registerService(IDBConnection::class, function(Server $c) {
565 565
 			$systemConfig = $c->getSystemConfig();
566 566
 			$factory = new \OC\DB\ConnectionFactory($systemConfig);
567 567
 			$type = $systemConfig->getValue('dbtype', 'sqlite');
@@ -575,7 +575,7 @@  discard block
 block discarded – undo
575 575
 		});
576 576
 		$this->registerAlias('DatabaseConnection', IDBConnection::class);
577 577
 
578
-		$this->registerService('HTTPHelper', function (Server $c) {
578
+		$this->registerService('HTTPHelper', function(Server $c) {
579 579
 			$config = $c->getConfig();
580 580
 			return new HTTPHelper(
581 581
 				$config,
@@ -583,7 +583,7 @@  discard block
 block discarded – undo
583 583
 			);
584 584
 		});
585 585
 
586
-		$this->registerService(\OCP\Http\Client\IClientService::class, function (Server $c) {
586
+		$this->registerService(\OCP\Http\Client\IClientService::class, function(Server $c) {
587 587
 			$user = \OC_User::getUser();
588 588
 			$uid = $user ? $user : null;
589 589
 			return new ClientService(
@@ -593,7 +593,7 @@  discard block
 block discarded – undo
593 593
 		});
594 594
 		$this->registerAlias('HttpClientService', \OCP\Http\Client\IClientService::class);
595 595
 
596
-		$this->registerService(\OCP\Diagnostics\IEventLogger::class, function (Server $c) {
596
+		$this->registerService(\OCP\Diagnostics\IEventLogger::class, function(Server $c) {
597 597
 			if ($c->getSystemConfig()->getValue('debug', false)) {
598 598
 				return new EventLogger();
599 599
 			} else {
@@ -602,7 +602,7 @@  discard block
 block discarded – undo
602 602
 		});
603 603
 		$this->registerAlias('EventLogger', \OCP\Diagnostics\IEventLogger::class);
604 604
 
605
-		$this->registerService(\OCP\Diagnostics\IQueryLogger::class, function (Server $c) {
605
+		$this->registerService(\OCP\Diagnostics\IQueryLogger::class, function(Server $c) {
606 606
 			if ($c->getSystemConfig()->getValue('debug', false)) {
607 607
 				return new QueryLogger();
608 608
 			} else {
@@ -611,7 +611,7 @@  discard block
 block discarded – undo
611 611
 		});
612 612
 		$this->registerAlias('QueryLogger', \OCP\Diagnostics\IQueryLogger::class);
613 613
 
614
-		$this->registerService(TempManager::class, function (Server $c) {
614
+		$this->registerService(TempManager::class, function(Server $c) {
615 615
 			return new TempManager(
616 616
 				$c->getLogger(),
617 617
 				$c->getConfig()
@@ -620,7 +620,7 @@  discard block
 block discarded – undo
620 620
 		$this->registerAlias('TempManager', TempManager::class);
621 621
 		$this->registerAlias(ITempManager::class, TempManager::class);
622 622
 
623
-		$this->registerService(AppManager::class, function (Server $c) {
623
+		$this->registerService(AppManager::class, function(Server $c) {
624 624
 			return new \OC\App\AppManager(
625 625
 				$c->getUserSession(),
626 626
 				$c->getAppConfig(),
@@ -632,7 +632,7 @@  discard block
 block discarded – undo
632 632
 		$this->registerAlias('AppManager', AppManager::class);
633 633
 		$this->registerAlias(IAppManager::class, AppManager::class);
634 634
 
635
-		$this->registerService(\OCP\IDateTimeZone::class, function (Server $c) {
635
+		$this->registerService(\OCP\IDateTimeZone::class, function(Server $c) {
636 636
 			return new DateTimeZone(
637 637
 				$c->getConfig(),
638 638
 				$c->getSession()
@@ -640,7 +640,7 @@  discard block
 block discarded – undo
640 640
 		});
641 641
 		$this->registerAlias('DateTimeZone', \OCP\IDateTimeZone::class);
642 642
 
643
-		$this->registerService(\OCP\IDateTimeFormatter::class, function (Server $c) {
643
+		$this->registerService(\OCP\IDateTimeFormatter::class, function(Server $c) {
644 644
 			$language = $c->getConfig()->getUserValue($c->getSession()->get('user_id'), 'core', 'lang', null);
645 645
 
646 646
 			return new DateTimeFormatter(
@@ -650,7 +650,7 @@  discard block
 block discarded – undo
650 650
 		});
651 651
 		$this->registerAlias('DateTimeFormatter', \OCP\IDateTimeFormatter::class);
652 652
 
653
-		$this->registerService(\OCP\Files\Config\IUserMountCache::class, function (Server $c) {
653
+		$this->registerService(\OCP\Files\Config\IUserMountCache::class, function(Server $c) {
654 654
 			$mountCache = new UserMountCache($c->getDatabaseConnection(), $c->getUserManager(), $c->getLogger());
655 655
 			$listener = new UserMountCacheListener($mountCache);
656 656
 			$listener->listen($c->getUserManager());
@@ -658,10 +658,10 @@  discard block
 block discarded – undo
658 658
 		});
659 659
 		$this->registerAlias('UserMountCache', \OCP\Files\Config\IUserMountCache::class);
660 660
 
661
-		$this->registerService(\OCP\Files\Config\IMountProviderCollection::class, function (Server $c) {
661
+		$this->registerService(\OCP\Files\Config\IMountProviderCollection::class, function(Server $c) {
662 662
 			$loader = \OC\Files\Filesystem::getLoader();
663 663
 			$mountCache = $c->query('UserMountCache');
664
-			$manager =  new \OC\Files\Config\MountProviderCollection($loader, $mountCache);
664
+			$manager = new \OC\Files\Config\MountProviderCollection($loader, $mountCache);
665 665
 
666 666
 			// builtin providers
667 667
 
@@ -674,14 +674,14 @@  discard block
 block discarded – undo
674 674
 		});
675 675
 		$this->registerAlias('MountConfigManager', \OCP\Files\Config\IMountProviderCollection::class);
676 676
 
677
-		$this->registerService('IniWrapper', function ($c) {
677
+		$this->registerService('IniWrapper', function($c) {
678 678
 			return new IniGetWrapper();
679 679
 		});
680
-		$this->registerService('AsyncCommandBus', function (Server $c) {
680
+		$this->registerService('AsyncCommandBus', function(Server $c) {
681 681
 			$jobList = $c->getJobList();
682 682
 			return new AsyncBus($jobList);
683 683
 		});
684
-		$this->registerService('TrustedDomainHelper', function ($c) {
684
+		$this->registerService('TrustedDomainHelper', function($c) {
685 685
 			return new TrustedDomainHelper($this->getConfig());
686 686
 		});
687 687
 		$this->registerService('Throttler', function(Server $c) {
@@ -692,10 +692,10 @@  discard block
 block discarded – undo
692 692
 				$c->getConfig()
693 693
 			);
694 694
 		});
695
-		$this->registerService('IntegrityCodeChecker', function (Server $c) {
695
+		$this->registerService('IntegrityCodeChecker', function(Server $c) {
696 696
 			// IConfig and IAppManager requires a working database. This code
697 697
 			// might however be called when ownCloud is not yet setup.
698
-			if(\OC::$server->getSystemConfig()->getValue('installed', false)) {
698
+			if (\OC::$server->getSystemConfig()->getValue('installed', false)) {
699 699
 				$config = $c->getConfig();
700 700
 				$appManager = $c->getAppManager();
701 701
 			} else {
@@ -713,7 +713,7 @@  discard block
 block discarded – undo
713 713
 					$c->getTempManager()
714 714
 			);
715 715
 		});
716
-		$this->registerService(\OCP\IRequest::class, function ($c) {
716
+		$this->registerService(\OCP\IRequest::class, function($c) {
717 717
 			if (isset($this['urlParams'])) {
718 718
 				$urlParams = $this['urlParams'];
719 719
 			} else {
@@ -749,7 +749,7 @@  discard block
 block discarded – undo
749 749
 		});
750 750
 		$this->registerAlias('Request', \OCP\IRequest::class);
751 751
 
752
-		$this->registerService(\OCP\Mail\IMailer::class, function (Server $c) {
752
+		$this->registerService(\OCP\Mail\IMailer::class, function(Server $c) {
753 753
 			return new Mailer(
754 754
 				$c->getConfig(),
755 755
 				$c->getLogger(),
@@ -763,14 +763,14 @@  discard block
 block discarded – undo
763 763
 		$this->registerService('LDAPProvider', function(Server $c) {
764 764
 			$config = $c->getConfig();
765 765
 			$factoryClass = $config->getSystemValue('ldapProviderFactory', null);
766
-			if(is_null($factoryClass)) {
766
+			if (is_null($factoryClass)) {
767 767
 				throw new \Exception('ldapProviderFactory not set');
768 768
 			}
769 769
 			/** @var \OCP\LDAP\ILDAPProviderFactory $factory */
770 770
 			$factory = new $factoryClass($this);
771 771
 			return $factory->getLDAPProvider();
772 772
 		});
773
-		$this->registerService('LockingProvider', function (Server $c) {
773
+		$this->registerService('LockingProvider', function(Server $c) {
774 774
 			$ini = $c->getIniWrapper();
775 775
 			$config = $c->getConfig();
776 776
 			$ttl = $config->getSystemValue('filelocking.ttl', max(3600, $ini->getNumeric('max_execution_time')));
@@ -786,42 +786,42 @@  discard block
 block discarded – undo
786 786
 			return new NoopLockingProvider();
787 787
 		});
788 788
 
789
-		$this->registerService(\OCP\Files\Mount\IMountManager::class, function () {
789
+		$this->registerService(\OCP\Files\Mount\IMountManager::class, function() {
790 790
 			return new \OC\Files\Mount\Manager();
791 791
 		});
792 792
 		$this->registerAlias('MountManager', \OCP\Files\Mount\IMountManager::class);
793 793
 
794
-		$this->registerService(\OCP\Files\IMimeTypeDetector::class, function (Server $c) {
794
+		$this->registerService(\OCP\Files\IMimeTypeDetector::class, function(Server $c) {
795 795
 			return new \OC\Files\Type\Detection(
796 796
 				$c->getURLGenerator(),
797 797
 				\OC::$configDir,
798
-				\OC::$SERVERROOT . '/resources/config/'
798
+				\OC::$SERVERROOT.'/resources/config/'
799 799
 			);
800 800
 		});
801 801
 		$this->registerAlias('MimeTypeDetector', \OCP\Files\IMimeTypeDetector::class);
802 802
 
803
-		$this->registerService(\OCP\Files\IMimeTypeLoader::class, function (Server $c) {
803
+		$this->registerService(\OCP\Files\IMimeTypeLoader::class, function(Server $c) {
804 804
 			return new \OC\Files\Type\Loader(
805 805
 				$c->getDatabaseConnection()
806 806
 			);
807 807
 		});
808 808
 		$this->registerAlias('MimeTypeLoader', \OCP\Files\IMimeTypeLoader::class);
809
-		$this->registerService(BundleFetcher::class, function () {
809
+		$this->registerService(BundleFetcher::class, function() {
810 810
 			return new BundleFetcher($this->getL10N('lib'));
811 811
 		});
812 812
 		$this->registerService(AppFetcher::class, function() {
813 813
 			return $this->getAppFetcher();
814 814
 		});
815
-		$this->registerService(\OCP\Notification\IManager::class, function (Server $c) {
815
+		$this->registerService(\OCP\Notification\IManager::class, function(Server $c) {
816 816
 			return new Manager(
817 817
 				$c->query(IValidator::class)
818 818
 			);
819 819
 		});
820 820
 		$this->registerAlias('NotificationManager', \OCP\Notification\IManager::class);
821 821
 
822
-		$this->registerService(\OC\CapabilitiesManager::class, function (Server $c) {
822
+		$this->registerService(\OC\CapabilitiesManager::class, function(Server $c) {
823 823
 			$manager = new \OC\CapabilitiesManager($c->getLogger());
824
-			$manager->registerCapability(function () use ($c) {
824
+			$manager->registerCapability(function() use ($c) {
825 825
 				return new \OC\OCS\CoreCapabilities($c->getConfig());
826 826
 			});
827 827
 			return $manager;
@@ -877,13 +877,13 @@  discard block
 block discarded – undo
877 877
 				$cacheFactory->createLocal('SCSS')
878 878
 			);
879 879
 		});
880
-		$this->registerService(EventDispatcher::class, function () {
880
+		$this->registerService(EventDispatcher::class, function() {
881 881
 			return new EventDispatcher();
882 882
 		});
883 883
 		$this->registerAlias('EventDispatcher', EventDispatcher::class);
884 884
 		$this->registerAlias(EventDispatcherInterface::class, EventDispatcher::class);
885 885
 
886
-		$this->registerService('CryptoWrapper', function (Server $c) {
886
+		$this->registerService('CryptoWrapper', function(Server $c) {
887 887
 			// FIXME: Instantiiated here due to cyclic dependency
888 888
 			$request = new Request(
889 889
 				[
@@ -908,7 +908,7 @@  discard block
 block discarded – undo
908 908
 				$request
909 909
 			);
910 910
 		});
911
-		$this->registerService('CsrfTokenManager', function (Server $c) {
911
+		$this->registerService('CsrfTokenManager', function(Server $c) {
912 912
 			$tokenGenerator = new CsrfTokenGenerator($c->getSecureRandom());
913 913
 
914 914
 			return new CsrfTokenManager(
@@ -916,10 +916,10 @@  discard block
 block discarded – undo
916 916
 				$c->query(SessionStorage::class)
917 917
 			);
918 918
 		});
919
-		$this->registerService(SessionStorage::class, function (Server $c) {
919
+		$this->registerService(SessionStorage::class, function(Server $c) {
920 920
 			return new SessionStorage($c->getSession());
921 921
 		});
922
-		$this->registerService(\OCP\Security\IContentSecurityPolicyManager::class, function (Server $c) {
922
+		$this->registerService(\OCP\Security\IContentSecurityPolicyManager::class, function(Server $c) {
923 923
 			return new ContentSecurityPolicyManager();
924 924
 		});
925 925
 		$this->registerAlias('ContentSecurityPolicyManager', \OCP\Security\IContentSecurityPolicyManager::class);
@@ -970,29 +970,29 @@  discard block
 block discarded – undo
970 970
 			);
971 971
 			return $manager;
972 972
 		});
973
-		$this->registerService(\OC\Files\AppData\Factory::class, function (Server $c) {
973
+		$this->registerService(\OC\Files\AppData\Factory::class, function(Server $c) {
974 974
 			return new \OC\Files\AppData\Factory(
975 975
 				$c->getRootFolder(),
976 976
 				$c->getSystemConfig()
977 977
 			);
978 978
 		});
979 979
 
980
-		$this->registerService('LockdownManager', function (Server $c) {
980
+		$this->registerService('LockdownManager', function(Server $c) {
981 981
 			return new LockdownManager(function() use ($c) {
982 982
 				return $c->getSession();
983 983
 			});
984 984
 		});
985 985
 
986
-		$this->registerService(\OCP\OCS\IDiscoveryService::class, function (Server $c) {
986
+		$this->registerService(\OCP\OCS\IDiscoveryService::class, function(Server $c) {
987 987
 			return new DiscoveryService($c->getMemCacheFactory(), $c->getHTTPClientService());
988 988
 		});
989 989
 
990
-		$this->registerService(ICloudIdManager::class, function (Server $c) {
990
+		$this->registerService(ICloudIdManager::class, function(Server $c) {
991 991
 			return new CloudIdManager();
992 992
 		});
993 993
 
994 994
 		/* To trick DI since we don't extend the DIContainer here */
995
-		$this->registerService(CleanPreviewsBackgroundJob::class, function (Server $c) {
995
+		$this->registerService(CleanPreviewsBackgroundJob::class, function(Server $c) {
996 996
 			return new CleanPreviewsBackgroundJob(
997 997
 				$c->getRootFolder(),
998 998
 				$c->getLogger(),
@@ -1007,7 +1007,7 @@  discard block
 block discarded – undo
1007 1007
 		$this->registerAlias(\OCP\AppFramework\Utility\ITimeFactory::class, \OC\AppFramework\Utility\TimeFactory::class);
1008 1008
 		$this->registerAlias('TimeFactory', \OCP\AppFramework\Utility\ITimeFactory::class);
1009 1009
 
1010
-		$this->registerService(Defaults::class, function (Server $c) {
1010
+		$this->registerService(Defaults::class, function(Server $c) {
1011 1011
 			return new Defaults(
1012 1012
 				$c->getThemingDefaults()
1013 1013
 			);
@@ -1159,7 +1159,7 @@  discard block
 block discarded – undo
1159 1159
 	 * @deprecated since 9.2.0 use IAppData
1160 1160
 	 */
1161 1161
 	public function getAppFolder() {
1162
-		$dir = '/' . \OC_App::getCurrentApp();
1162
+		$dir = '/'.\OC_App::getCurrentApp();
1163 1163
 		$root = $this->getRootFolder();
1164 1164
 		if (!$root->nodeExists($dir)) {
1165 1165
 			$folder = $root->newFolder($dir);
Please login to merge, or discard this patch.
lib/private/App/AppStore/Bundles/BundleFetcher.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -68,8 +68,8 @@
 block discarded – undo
68 68
 			$this->getBundles(),
69 69
 			$this->getDefaultInstallationBundle()
70 70
 		);
71
-		foreach($bundles as $bundle) {
72
-			if($bundle->getIdentifier() === $identifier) {
71
+		foreach ($bundles as $bundle) {
72
+			if ($bundle->getIdentifier() === $identifier) {
73 73
 				return $bundle;
74 74
 			}
75 75
 		}
Please login to merge, or discard this patch.
lib/private/Setup.php 1 patch
Spacing   +49 added lines, -49 removed lines patch added patch discarded remove patch
@@ -155,24 +155,24 @@  discard block
 block discarded – undo
155 155
 			$configuredDatabases = $this->config->getValue('supportedDatabases',
156 156
 				array('sqlite', 'mysql', 'pgsql'));
157 157
 		}
158
-		if(!is_array($configuredDatabases)) {
158
+		if (!is_array($configuredDatabases)) {
159 159
 			throw new Exception('Supported databases are not properly configured.');
160 160
 		}
161 161
 
162 162
 		$supportedDatabases = array();
163 163
 
164
-		foreach($configuredDatabases as $database) {
165
-			if(array_key_exists($database, $availableDatabases)) {
164
+		foreach ($configuredDatabases as $database) {
165
+			if (array_key_exists($database, $availableDatabases)) {
166 166
 				$working = false;
167 167
 				$type = $availableDatabases[$database]['type'];
168 168
 				$call = $availableDatabases[$database]['call'];
169 169
 
170 170
 				if ($type === 'function') {
171 171
 					$working = $this->is_callable($call);
172
-				} elseif($type === 'pdo') {
172
+				} elseif ($type === 'pdo') {
173 173
 					$working = in_array($call, $this->getAvailableDbDriversForPdo(), TRUE);
174 174
 				}
175
-				if($working) {
175
+				if ($working) {
176 176
 					$supportedDatabases[$database] = $availableDatabases[$database]['name'];
177 177
 				}
178 178
 			}
@@ -198,7 +198,7 @@  discard block
 block discarded – undo
198 198
 		// Create data directory to test whether the .htaccess works
199 199
 		// Notice that this is not necessarily the same data directory as the one
200 200
 		// that will effectively be used.
201
-		if(!file_exists($dataDir)) {
201
+		if (!file_exists($dataDir)) {
202 202
 			@mkdir($dataDir);
203 203
 		}
204 204
 		$htAccessWorking = true;
@@ -221,7 +221,7 @@  discard block
 block discarded – undo
221 221
 		if (\OC_Util::runningOnMac()) {
222 222
 			$errors[] = array(
223 223
 				'error' => $this->l10n->t(
224
-					'Mac OS X is not supported and %s will not work properly on this platform. ' .
224
+					'Mac OS X is not supported and %s will not work properly on this platform. '.
225 225
 					'Use it at your own risk! ',
226 226
 					$this->defaults->getName()
227 227
 				),
@@ -229,10 +229,10 @@  discard block
 block discarded – undo
229 229
 			);
230 230
 		}
231 231
 
232
-		if($this->iniWrapper->getString('open_basedir') !== '' && PHP_INT_SIZE === 4) {
232
+		if ($this->iniWrapper->getString('open_basedir') !== '' && PHP_INT_SIZE === 4) {
233 233
 			$errors[] = array(
234 234
 				'error' => $this->l10n->t(
235
-					'It seems that this %s instance is running on a 32-bit PHP environment and the open_basedir has been configured in php.ini. ' .
235
+					'It seems that this %s instance is running on a 32-bit PHP environment and the open_basedir has been configured in php.ini. '.
236 236
 					'This will lead to problems with files over 4 GB and is highly discouraged.',
237 237
 					$this->defaults->getName()
238 238
 				),
@@ -262,13 +262,13 @@  discard block
 block discarded – undo
262 262
 		$error = array();
263 263
 		$dbType = $options['dbtype'];
264 264
 
265
-		if(empty($options['adminlogin'])) {
265
+		if (empty($options['adminlogin'])) {
266 266
 			$error[] = $l->t('Set an admin username.');
267 267
 		}
268
-		if(empty($options['adminpass'])) {
268
+		if (empty($options['adminpass'])) {
269 269
 			$error[] = $l->t('Set an admin password.');
270 270
 		}
271
-		if(empty($options['directory'])) {
271
+		if (empty($options['directory'])) {
272 272
 			$options['directory'] = \OC::$SERVERROOT."/data";
273 273
 		}
274 274
 
@@ -294,14 +294,14 @@  discard block
 block discarded – undo
294 294
 			$error[] = $l->t("Can't create or write into the data directory %s", array($dataDir));
295 295
 		}
296 296
 
297
-		if(count($error) != 0) {
297
+		if (count($error) != 0) {
298 298
 			return $error;
299 299
 		}
300 300
 
301 301
 		$request = \OC::$server->getRequest();
302 302
 
303 303
 		//no errors, good
304
-		if(isset($options['trusted_domains'])
304
+		if (isset($options['trusted_domains'])
305 305
 		    && is_array($options['trusted_domains'])) {
306 306
 			$trustedDomains = $options['trusted_domains'];
307 307
 		} else {
@@ -309,8 +309,8 @@  discard block
 block discarded – undo
309 309
 		}
310 310
 
311 311
 		//use sqlite3 when available, otherwise sqlite2 will be used.
312
-		if($dbType=='sqlite' and class_exists('SQLite3')) {
313
-			$dbType='sqlite3';
312
+		if ($dbType == 'sqlite' and class_exists('SQLite3')) {
313
+			$dbType = 'sqlite3';
314 314
 		}
315 315
 
316 316
 		//generate a random salt that is used to salt the local user passwords
@@ -324,7 +324,7 @@  discard block
 block discarded – undo
324 324
 			'secret'			=> $secret,
325 325
 			'trusted_domains'	=> $trustedDomains,
326 326
 			'datadirectory'		=> $dataDir,
327
-			'overwrite.cli.url'	=> $request->getServerProtocol() . '://' . $request->getInsecureServerHost() . \OC::$WEBROOT,
327
+			'overwrite.cli.url'	=> $request->getServerProtocol().'://'.$request->getInsecureServerHost().\OC::$WEBROOT,
328 328
 			'dbtype'			=> $dbType,
329 329
 			'version'			=> implode('.', \OCP\Util::getVersion()),
330 330
 		]);
@@ -340,30 +340,30 @@  discard block
 block discarded – undo
340 340
 			return($error);
341 341
 		} catch (Exception $e) {
342 342
 			$error[] = array(
343
-				'error' => 'Error while trying to create admin user: ' . $e->getMessage(),
343
+				'error' => 'Error while trying to create admin user: '.$e->getMessage(),
344 344
 				'hint' => ''
345 345
 			);
346 346
 			return($error);
347 347
 		}
348 348
 
349 349
 		//create the user and group
350
-		$user =  null;
350
+		$user = null;
351 351
 		try {
352 352
 			$user = \OC::$server->getUserManager()->createUser($username, $password);
353 353
 			if (!$user) {
354 354
 				$error[] = "User <$username> could not be created.";
355 355
 			}
356
-		} catch(Exception $exception) {
356
+		} catch (Exception $exception) {
357 357
 			$error[] = $exception->getMessage();
358 358
 		}
359 359
 
360
-		if(count($error) == 0) {
360
+		if (count($error) == 0) {
361 361
 			$config = \OC::$server->getConfig();
362 362
 			$config->setAppValue('core', 'installedat', microtime(true));
363 363
 			$config->setAppValue('core', 'lastupdatedat', microtime(true));
364 364
 			$config->setAppValue('core', 'vendor', $this->getVendor());
365 365
 
366
-			$group =\OC::$server->getGroupManager()->createGroup('admin');
366
+			$group = \OC::$server->getGroupManager()->createGroup('admin');
367 367
 			$group->addUser($user);
368 368
 
369 369
 			// Install shipped apps and specified app bundles
@@ -377,7 +377,7 @@  discard block
 block discarded – undo
377 377
 			);
378 378
 			$bundleFetcher = new BundleFetcher(\OC::$server->getL10N('lib'));
379 379
 			$defaultInstallationBundles = $bundleFetcher->getDefaultInstallationBundle();
380
-			foreach($defaultInstallationBundles as $bundle) {
380
+			foreach ($defaultInstallationBundles as $bundle) {
381 381
 				try {
382 382
 					$installer->installAppBundle($bundle);
383 383
 				} catch (Exception $e) {}
@@ -428,9 +428,9 @@  discard block
 block discarded – undo
428 428
 		$config = \OC::$server->getSystemConfig();
429 429
 
430 430
 		// For CLI read the value from overwrite.cli.url
431
-		if(\OC::$CLI) {
431
+		if (\OC::$CLI) {
432 432
 			$webRoot = $config->getValue('overwrite.cli.url', '');
433
-			if($webRoot === '') {
433
+			if ($webRoot === '') {
434 434
 				return false;
435 435
 			}
436 436
 			$webRoot = parse_url($webRoot, PHP_URL_PATH);
@@ -448,14 +448,14 @@  discard block
 block discarded – undo
448 448
 		$htaccessContent = explode($content, $htaccessContent, 2)[0];
449 449
 
450 450
 		//custom 403 error page
451
-		$content.= "\nErrorDocument 403 ".$webRoot."/core/templates/403.php";
451
+		$content .= "\nErrorDocument 403 ".$webRoot."/core/templates/403.php";
452 452
 
453 453
 		//custom 404 error page
454
-		$content.= "\nErrorDocument 404 ".$webRoot."/core/templates/404.php";
454
+		$content .= "\nErrorDocument 404 ".$webRoot."/core/templates/404.php";
455 455
 
456 456
 		// Add rewrite rules if the RewriteBase is configured
457 457
 		$rewriteBase = $config->getValue('htaccess.RewriteBase', '');
458
-		if($rewriteBase !== '') {
458
+		if ($rewriteBase !== '') {
459 459
 			$content .= "\n<IfModule mod_rewrite.c>";
460 460
 			$content .= "\n  Options -MultiViews";
461 461
 			$content .= "\n  RewriteRule ^core/js/oc.js$ index.php [PT,E=PATH_INFO:$1]";
@@ -474,7 +474,7 @@  discard block
 block discarded – undo
474 474
 			$content .= "\n  RewriteCond %{REQUEST_FILENAME} !/ocs-provider/";
475 475
 			$content .= "\n  RewriteCond %{REQUEST_URI} !^/.well-known/acme-challenge/.*";
476 476
 			$content .= "\n  RewriteRule . index.php [PT,E=PATH_INFO:$1]";
477
-			$content .= "\n  RewriteBase " . $rewriteBase;
477
+			$content .= "\n  RewriteBase ".$rewriteBase;
478 478
 			$content .= "\n  <IfModule mod_env.c>";
479 479
 			$content .= "\n    SetEnv front_controller_active true";
480 480
 			$content .= "\n    <IfModule mod_dir.c>";
@@ -486,7 +486,7 @@  discard block
 block discarded – undo
486 486
 
487 487
 		if ($content !== '') {
488 488
 			//suppress errors in case we don't have permissions for it
489
-			return (bool) @file_put_contents($setupHelper->pathToHtaccess(), $htaccessContent.$content . "\n");
489
+			return (bool) @file_put_contents($setupHelper->pathToHtaccess(), $htaccessContent.$content."\n");
490 490
 		}
491 491
 
492 492
 		return false;
@@ -494,25 +494,25 @@  discard block
 block discarded – undo
494 494
 
495 495
 	public static function protectDataDirectory() {
496 496
 		//Require all denied
497
-		$now =  date('Y-m-d H:i:s');
497
+		$now = date('Y-m-d H:i:s');
498 498
 		$content = "# Generated by Nextcloud on $now\n";
499
-		$content.= "# line below if for Apache 2.4\n";
500
-		$content.= "<ifModule mod_authz_core.c>\n";
501
-		$content.= "Require all denied\n";
502
-		$content.= "</ifModule>\n\n";
503
-		$content.= "# line below if for Apache 2.2\n";
504
-		$content.= "<ifModule !mod_authz_core.c>\n";
505
-		$content.= "deny from all\n";
506
-		$content.= "Satisfy All\n";
507
-		$content.= "</ifModule>\n\n";
508
-		$content.= "# section for Apache 2.2 and 2.4\n";
509
-		$content.= "<ifModule mod_autoindex.c>\n";
510
-		$content.= "IndexIgnore *\n";
511
-		$content.= "</ifModule>\n";
512
-
513
-		$baseDir = \OC::$server->getConfig()->getSystemValue('datadirectory', \OC::$SERVERROOT . '/data');
514
-		file_put_contents($baseDir . '/.htaccess', $content);
515
-		file_put_contents($baseDir . '/index.html', '');
499
+		$content .= "# line below if for Apache 2.4\n";
500
+		$content .= "<ifModule mod_authz_core.c>\n";
501
+		$content .= "Require all denied\n";
502
+		$content .= "</ifModule>\n\n";
503
+		$content .= "# line below if for Apache 2.2\n";
504
+		$content .= "<ifModule !mod_authz_core.c>\n";
505
+		$content .= "deny from all\n";
506
+		$content .= "Satisfy All\n";
507
+		$content .= "</ifModule>\n\n";
508
+		$content .= "# section for Apache 2.2 and 2.4\n";
509
+		$content .= "<ifModule mod_autoindex.c>\n";
510
+		$content .= "IndexIgnore *\n";
511
+		$content .= "</ifModule>\n";
512
+
513
+		$baseDir = \OC::$server->getConfig()->getSystemValue('datadirectory', \OC::$SERVERROOT.'/data');
514
+		file_put_contents($baseDir.'/.htaccess', $content);
515
+		file_put_contents($baseDir.'/index.html', '');
516 516
 	}
517 517
 
518 518
 	/**
@@ -524,7 +524,7 @@  discard block
 block discarded – undo
524 524
 	 */
525 525
 	private function getVendor() {
526 526
 		// this should really be a JSON file
527
-		require \OC::$SERVERROOT . '/version.php';
527
+		require \OC::$SERVERROOT.'/version.php';
528 528
 		/** @var string $vendor */
529 529
 		return (string) $vendor;
530 530
 	}
Please login to merge, or discard this patch.
settings/ajax/enableapp.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -31,20 +31,20 @@  discard block
 block discarded – undo
31 31
 $lastConfirm = (int) \OC::$server->getSession()->get('last-password-confirm');
32 32
 if ($lastConfirm < (time() - 30 * 60 + 15)) { // allow 15 seconds delay
33 33
 	$l = \OC::$server->getL10N('core');
34
-	OC_JSON::error(array( 'data' => array( 'message' => $l->t('Password confirmation is required'))));
34
+	OC_JSON::error(array('data' => array('message' => $l->t('Password confirmation is required'))));
35 35
 	exit();
36 36
 }
37 37
 
38
-$groups = isset($_POST['groups']) ? (array)$_POST['groups'] : null;
39
-$appIds = isset($_POST['appIds']) ? (array)$_POST['appIds'] : [];
38
+$groups = isset($_POST['groups']) ? (array) $_POST['groups'] : null;
39
+$appIds = isset($_POST['appIds']) ? (array) $_POST['appIds'] : [];
40 40
 
41 41
 try {
42 42
 	$updateRequired = false;
43
-	foreach($appIds as $appId) {
43
+	foreach ($appIds as $appId) {
44 44
 		$app = new OC_App();
45 45
 		$appId = OC_App::cleanAppId($appId);
46 46
 		$app->enable($appId, $groups);
47
-		if(\OC_App::shouldUpgrade($appId)) {
47
+		if (\OC_App::shouldUpgrade($appId)) {
48 48
 			$updateRequired = true;
49 49
 		}
50 50
 	}
@@ -52,5 +52,5 @@  discard block
 block discarded – undo
52 52
 	OC_JSON::success(['data' => ['update_required' => $updateRequired]]);
53 53
 } catch (Exception $e) {
54 54
 	\OCP\Util::writeLog('core', $e->getMessage(), \OCP\Util::ERROR);
55
-	OC_JSON::error(array("data" => array("message" => $e->getMessage()) ));
55
+	OC_JSON::error(array("data" => array("message" => $e->getMessage())));
56 56
 }
Please login to merge, or discard this patch.
lib/private/Updater.php 1 patch
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -431,7 +431,7 @@
 block discarded – undo
431 431
 	}
432 432
 
433 433
 	/**
434
-	 * @param array $disabledApps
434
+	 * @param string[] $disabledApps
435 435
 	 * @throws \Exception
436 436
 	 */
437 437
 	private function upgradeAppStoreApps(array $disabledApps) {
Please login to merge, or discard this patch.
settings/Controller/AppSettingsController.php 1 patch
Spacing   +46 added lines, -46 removed lines patch added patch discarded remove patch
@@ -131,13 +131,13 @@  discard block
 block discarded – undo
131 131
 		$currentLanguage = substr($this->l10nFactory->findLanguage(), 0, 2);
132 132
 
133 133
 		$formattedCategories = [
134
-			['id' => self::CAT_ALL_INSTALLED, 'ident' => 'installed', 'displayName' => (string)$this->l10n->t('Your apps')],
135
-			['id' => self::CAT_ENABLED, 'ident' => 'enabled', 'displayName' => (string)$this->l10n->t('Enabled apps')],
136
-			['id' => self::CAT_APP_BUNDLES, 'ident' => 'app-bundles', 'displayName' => (string)$this->l10n->t('App bundles')],
137
-			['id' => self::CAT_DISABLED, 'ident' => 'disabled', 'displayName' => (string)$this->l10n->t('Disabled apps')],
134
+			['id' => self::CAT_ALL_INSTALLED, 'ident' => 'installed', 'displayName' => (string) $this->l10n->t('Your apps')],
135
+			['id' => self::CAT_ENABLED, 'ident' => 'enabled', 'displayName' => (string) $this->l10n->t('Enabled apps')],
136
+			['id' => self::CAT_APP_BUNDLES, 'ident' => 'app-bundles', 'displayName' => (string) $this->l10n->t('App bundles')],
137
+			['id' => self::CAT_DISABLED, 'ident' => 'disabled', 'displayName' => (string) $this->l10n->t('Disabled apps')],
138 138
 		];
139 139
 		$categories = $this->categoryFetcher->get();
140
-		foreach($categories as $category) {
140
+		foreach ($categories as $category) {
141 141
 			$formattedCategories[] = [
142 142
 				'id' => $category['id'],
143 143
 				'ident' => $category['id'],
@@ -167,46 +167,46 @@  discard block
 block discarded – undo
167 167
 		$versionParser = new VersionParser();
168 168
 		$formattedApps = [];
169 169
 		$apps = $this->appFetcher->get();
170
-		foreach($apps as $app) {
170
+		foreach ($apps as $app) {
171 171
 			if (isset($app['isFeatured'])) {
172 172
 				$app['featured'] = $app['isFeatured'];
173 173
 			}
174 174
 
175 175
 			// Skip all apps not in the requested category
176 176
 			$isInCategory = false;
177
-			foreach($app['categories'] as $category) {
178
-				if($category === $requestedCategory) {
177
+			foreach ($app['categories'] as $category) {
178
+				if ($category === $requestedCategory) {
179 179
 					$isInCategory = true;
180 180
 				}
181 181
 			}
182
-			if(!$isInCategory) {
182
+			if (!$isInCategory) {
183 183
 				continue;
184 184
 			}
185 185
 
186 186
 			$nextCloudVersion = $versionParser->getVersion($app['releases'][0]['rawPlatformVersionSpec']);
187 187
 			$nextCloudVersionDependencies = [];
188
-			if($nextCloudVersion->getMinimumVersion() !== '') {
188
+			if ($nextCloudVersion->getMinimumVersion() !== '') {
189 189
 				$nextCloudVersionDependencies['nextcloud']['@attributes']['min-version'] = $nextCloudVersion->getMinimumVersion();
190 190
 			}
191
-			if($nextCloudVersion->getMaximumVersion() !== '') {
191
+			if ($nextCloudVersion->getMaximumVersion() !== '') {
192 192
 				$nextCloudVersionDependencies['nextcloud']['@attributes']['max-version'] = $nextCloudVersion->getMaximumVersion();
193 193
 			}
194 194
 			$phpVersion = $versionParser->getVersion($app['releases'][0]['rawPhpVersionSpec']);
195 195
 			$existsLocally = (\OC_App::getAppPath($app['id']) !== false) ? true : false;
196 196
 			$phpDependencies = [];
197
-			if($phpVersion->getMinimumVersion() !== '') {
197
+			if ($phpVersion->getMinimumVersion() !== '') {
198 198
 				$phpDependencies['php']['@attributes']['min-version'] = $phpVersion->getMinimumVersion();
199 199
 			}
200
-			if($phpVersion->getMaximumVersion() !== '') {
200
+			if ($phpVersion->getMaximumVersion() !== '') {
201 201
 				$phpDependencies['php']['@attributes']['max-version'] = $phpVersion->getMaximumVersion();
202 202
 			}
203
-			if(isset($app['releases'][0]['minIntSize'])) {
203
+			if (isset($app['releases'][0]['minIntSize'])) {
204 204
 				$phpDependencies['php']['@attributes']['min-int-size'] = $app['releases'][0]['minIntSize'];
205 205
 			}
206 206
 			$authors = '';
207
-			foreach($app['authors'] as $key => $author) {
207
+			foreach ($app['authors'] as $key => $author) {
208 208
 				$authors .= $author['name'];
209
-				if($key !== count($app['authors']) - 1) {
209
+				if ($key !== count($app['authors']) - 1) {
210 210
 					$authors .= ', ';
211 211
 				}
212 212
 			}
@@ -214,12 +214,12 @@  discard block
 block discarded – undo
214 214
 			$currentLanguage = substr(\OC::$server->getL10NFactory()->findLanguage(), 0, 2);
215 215
 			$enabledValue = $this->config->getAppValue($app['id'], 'enabled', 'no');
216 216
 			$groups = null;
217
-			if($enabledValue !== 'no' && $enabledValue !== 'yes') {
217
+			if ($enabledValue !== 'no' && $enabledValue !== 'yes') {
218 218
 				$groups = $enabledValue;
219 219
 			}
220 220
 
221 221
 			$currentVersion = '';
222
-			if($this->appManager->isInstalled($app['id'])) {
222
+			if ($this->appManager->isInstalled($app['id'])) {
223 223
 				$currentVersion = \OC_App::getAppVersion($app['id']);
224 224
 			} else {
225 225
 				$currentLanguage = $app['releases'][0]['version'];
@@ -265,8 +265,8 @@  discard block
 block discarded – undo
265 265
 
266 266
 			$appFetcher = \OC::$server->getAppFetcher();
267 267
 			$newVersion = \OC\Installer::isUpdateAvailable($app['id'], $appFetcher);
268
-			if($newVersion && $this->appManager->isInstalled($app['id'])) {
269
-				$formattedApps[count($formattedApps)-1]['update'] = $newVersion;
268
+			if ($newVersion && $this->appManager->isInstalled($app['id'])) {
269
+				$formattedApps[count($formattedApps) - 1]['update'] = $newVersion;
270 270
 			}
271 271
 		}
272 272
 
@@ -287,14 +287,14 @@  discard block
 block discarded – undo
287 287
 			case 'installed':
288 288
 				$apps = $appClass->listAllApps();
289 289
 
290
-				foreach($apps as $key => $app) {
290
+				foreach ($apps as $key => $app) {
291 291
 					$newVersion = \OC\Installer::isUpdateAvailable($app['id'], $this->appFetcher);
292 292
 					$apps[$key]['update'] = $newVersion;
293 293
 				}
294 294
 
295
-				usort($apps, function ($a, $b) {
296
-					$a = (string)$a['name'];
297
-					$b = (string)$b['name'];
295
+				usort($apps, function($a, $b) {
296
+					$a = (string) $a['name'];
297
+					$b = (string) $b['name'];
298 298
 					if ($a === $b) {
299 299
 						return 0;
300 300
 					}
@@ -304,18 +304,18 @@  discard block
 block discarded – undo
304 304
 			// enabled apps
305 305
 			case 'enabled':
306 306
 				$apps = $appClass->listAllApps();
307
-				$apps = array_filter($apps, function ($app) {
307
+				$apps = array_filter($apps, function($app) {
308 308
 					return $app['active'];
309 309
 				});
310 310
 
311
-				foreach($apps as $key => $app) {
311
+				foreach ($apps as $key => $app) {
312 312
 					$newVersion = \OC\Installer::isUpdateAvailable($app['id'], $this->appFetcher);
313 313
 					$apps[$key]['update'] = $newVersion;
314 314
 				}
315 315
 
316
-				usort($apps, function ($a, $b) {
317
-					$a = (string)$a['name'];
318
-					$b = (string)$b['name'];
316
+				usort($apps, function($a, $b) {
317
+					$a = (string) $a['name'];
318
+					$b = (string) $b['name'];
319 319
 					if ($a === $b) {
320 320
 						return 0;
321 321
 					}
@@ -325,11 +325,11 @@  discard block
 block discarded – undo
325 325
 			// disabled  apps
326 326
 			case 'disabled':
327 327
 				$apps = $appClass->listAllApps();
328
-				$apps = array_filter($apps, function ($app) {
328
+				$apps = array_filter($apps, function($app) {
329 329
 					return !$app['active'];
330 330
 				});
331 331
 
332
-				$apps = array_map(function ($app) {
332
+				$apps = array_map(function($app) {
333 333
 					$newVersion = \OC\Installer::isUpdateAvailable($app['id'], $this->appFetcher);
334 334
 					if ($newVersion !== false) {
335 335
 						$app['update'] = $newVersion;
@@ -337,9 +337,9 @@  discard block
 block discarded – undo
337 337
 					return $app;
338 338
 				}, $apps);
339 339
 
340
-				usort($apps, function ($a, $b) {
341
-					$a = (string)$a['name'];
342
-					$b = (string)$b['name'];
340
+				usort($apps, function($a, $b) {
341
+					$a = (string) $a['name'];
342
+					$b = (string) $b['name'];
343 343
 					if ($a === $b) {
344 344
 						return 0;
345 345
 					}
@@ -349,15 +349,15 @@  discard block
 block discarded – undo
349 349
 			case 'app-bundles':
350 350
 				$bundles = $this->bundleFetcher->getBundles();
351 351
 				$apps = [];
352
-				foreach($bundles as $bundle) {
352
+				foreach ($bundles as $bundle) {
353 353
 					$newCategory = true;
354 354
 					$allApps = $appClass->listAllApps();
355 355
 					$categories = $this->getAllCategories();
356
-					foreach($categories as $singleCategory) {
356
+					foreach ($categories as $singleCategory) {
357 357
 						$newApps = $this->getAppsForCategory($singleCategory['id']);
358
-						foreach($allApps as $app) {
359
-							foreach($newApps as $key => $newApp) {
360
-								if($app['id'] === $newApp['id']) {
358
+						foreach ($allApps as $app) {
359
+							foreach ($newApps as $key => $newApp) {
360
+								if ($app['id'] === $newApp['id']) {
361 361
 									unset($newApps[$key]);
362 362
 								}
363 363
 							}
@@ -365,10 +365,10 @@  discard block
 block discarded – undo
365 365
 						$allApps = array_merge($allApps, $newApps);
366 366
 					}
367 367
 
368
-					foreach($bundle->getAppIdentifiers() as $identifier) {
369
-						foreach($allApps as $app) {
370
-							if($app['id'] === $identifier) {
371
-								if($newCategory) {
368
+					foreach ($bundle->getAppIdentifiers() as $identifier) {
369
+						foreach ($allApps as $app) {
370
+							if ($app['id'] === $identifier) {
371
+								if ($newCategory) {
372 372
 									$app['newCategory'] = true;
373 373
 									$app['categoryName'] = $bundle->getName();
374 374
 								}
@@ -384,9 +384,9 @@  discard block
 block discarded – undo
384 384
 				$apps = $this->getAppsForCategory($category);
385 385
 
386 386
 				// sort by score
387
-				usort($apps, function ($a, $b) {
388
-					$a = (int)$a['score'];
389
-					$b = (int)$b['score'];
387
+				usort($apps, function($a, $b) {
388
+					$a = (int) $a['score'];
389
+					$b = (int) $b['score'];
390 390
 					if ($a === $b) {
391 391
 						return 0;
392 392
 					}
Please login to merge, or discard this patch.
settings/templates/apps.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -22,9 +22,9 @@  discard block
 block discarded – undo
22 22
 	</li>
23 23
 {{/each}}
24 24
 
25
-<?php if($_['appstoreEnabled']): ?>
25
+<?php if ($_['appstoreEnabled']): ?>
26 26
 	<li>
27
-		<a class="app-external" target="_blank" rel="noreferrer" href="https://docs.nextcloud.org/server/12/developer_manual/"><?php p($l->t('Developer documentation'));?> ↗</a>
27
+		<a class="app-external" target="_blank" rel="noreferrer" href="https://docs.nextcloud.org/server/12/developer_manual/"><?php p($l->t('Developer documentation')); ?> ↗</a>
28 28
 	</li>
29 29
 <?php endif; ?>
30 30
 </script>
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
 	</div>
42 42
 	<div class="app-version">{{version}}</div>
43 43
 	<div class="app-level">
44
-		{{{level}}}{{#unless internal}}<a href="https://apps.nextcloud.com/apps/{{id}}"><?php p($l->t('View in store'));?> ↗</a>{{/unless}}
44
+		{{{level}}}{{#unless internal}}<a href="https://apps.nextcloud.com/apps/{{id}}"><?php p($l->t('View in store')); ?> ↗</a>{{/unless}}
45 45
 	</div>
46 46
 
47 47
 	<div class="app-groups">
@@ -64,9 +64,9 @@  discard block
 block discarded – undo
64 64
 		<input class="uninstall" type="submit" value="<?php p($l->t('Remove')); ?>" data-appid="{{id}}" />
65 65
 		{{/if}}
66 66
 		{{#if active}}
67
-		<input class="enable" type="submit" data-appid="{{id}}" data-active="true" value="<?php p($l->t("Disable"));?>"/>
67
+		<input class="enable" type="submit" data-appid="{{id}}" data-active="true" value="<?php p($l->t("Disable")); ?>"/>
68 68
 		{{else}}
69
-		<input class="enable{{#if needsDownload}} needs-download{{/if}}" type="submit" data-appid="{{id}}" data-active="false" {{#unless canInstall}}disabled="disabled"{{/unless}} value="<?php p($l->t("Enable"));?>"/>
69
+		<input class="enable{{#if needsDownload}} needs-download{{/if}}" type="submit" data-appid="{{id}}" data-active="false" {{#unless canInstall}}disabled="disabled"{{/unless}} value="<?php p($l->t("Enable")); ?>"/>
70 70
 		{{/if}}
71 71
 	</div>
72 72
 </div>
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
 
75 75
 <script id="app-template" type="text/x-handlebars">
76 76
 	{{#if newCategory}}
77
-	<h2>{{categoryName}} <input class="enable" type="submit" data-bundleid="{{bundleId}}" data-active="true" value="<?php p($l->t('Enable all'));?>"/></h2>
77
+	<h2>{{categoryName}} <input class="enable" type="submit" data-bundleid="{{bundleId}}" data-active="true" value="<?php p($l->t('Enable all')); ?>"/></h2>
78 78
 	{{/if}}
79 79
 	<div class="section" id="app-{{id}}">
80 80
 	{{#if preview}}
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
 	<div class="app-description-container hidden">
100 100
 		<div class="app-version">{{version}}</div>
101 101
 		{{#if profilepage}}<a href="{{profilepage}}" target="_blank" rel="noreferrer">{{/if}}
102
-		<div class="app-author"><?php p($l->t('by %s', ['{{author}}']));?>
102
+		<div class="app-author"><?php p($l->t('by %s', ['{{author}}'])); ?>
103 103
 			{{#if licence}}
104 104
 			(<?php p($l->t('%s-licensed', ['{{licence}}'])); ?>)
105 105
 			{{/if}}
@@ -109,37 +109,37 @@  discard block
 block discarded – undo
109 109
 		<!--<div class="app-changed">{{changed}}</div>-->
110 110
 		{{#if documentation}}
111 111
 		<p class="documentation">
112
-			<?php p($l->t("Documentation:"));?>
112
+			<?php p($l->t("Documentation:")); ?>
113 113
 			{{#if documentation.user}}
114 114
 			<span class="userDocumentation">
115
-			<a id="userDocumentation" class="appslink" href="{{documentation.user}}" target="_blank" rel="noreferrer"><?php p($l->t('User documentation'));?> ↗</a>
115
+			<a id="userDocumentation" class="appslink" href="{{documentation.user}}" target="_blank" rel="noreferrer"><?php p($l->t('User documentation')); ?> ↗</a>
116 116
 			</span>
117 117
 			{{/if}}
118 118
 
119 119
 			{{#if documentation.admin}}
120 120
 			<span class="adminDocumentation">
121
-			<a id="adminDocumentation" class="appslink" href="{{documentation.admin}}" target="_blank" rel="noreferrer"><?php p($l->t('Admin documentation'));?> ↗</a>
121
+			<a id="adminDocumentation" class="appslink" href="{{documentation.admin}}" target="_blank" rel="noreferrer"><?php p($l->t('Admin documentation')); ?> ↗</a>
122 122
 			</span>
123 123
 			{{/if}}
124 124
 
125 125
 			{{#if documentation.developer}}
126 126
 			<span class="developerDocumentation">
127
-			<a id="developerDocumentation" class="appslink" href="{{documentation.developer}}" target="_blank" rel="noreferrer"><?php p($l->t('Developer documentation'));?> ↗</a>
127
+			<a id="developerDocumentation" class="appslink" href="{{documentation.developer}}" target="_blank" rel="noreferrer"><?php p($l->t('Developer documentation')); ?> ↗</a>
128 128
 			</span>
129 129
 			{{/if}}
130 130
 		</p>
131 131
 		{{/if}}
132 132
 
133 133
 		{{#if website}}
134
-		<a id="userDocumentation" class="appslink" href="{{website}}" target="_blank" rel="noreferrer"><?php p($l->t('Visit website'));?> ↗</a>
134
+		<a id="userDocumentation" class="appslink" href="{{website}}" target="_blank" rel="noreferrer"><?php p($l->t('Visit website')); ?> ↗</a>
135 135
 		{{/if}}
136 136
 
137 137
 		{{#if bugs}}
138
-		<a id="adminDocumentation" class="appslink" href="{{bugs}}" target="_blank" rel="noreferrer"><?php p($l->t('Report a bug'));?> ↗</a>
138
+		<a id="adminDocumentation" class="appslink" href="{{bugs}}" target="_blank" rel="noreferrer"><?php p($l->t('Report a bug')); ?> ↗</a>
139 139
 		{{/if}}
140 140
 	</div><!-- end app-description-container -->
141
-	<div class="app-description-toggle-show" role="link"><?php p($l->t("Show description …"));?></div>
142
-	<div class="app-description-toggle-hide hidden" role="link"><?php p($l->t("Hide description …"));?></div>
141
+	<div class="app-description-toggle-show" role="link"><?php p($l->t("Show description …")); ?></div>
142
+	<div class="app-description-toggle-hide hidden" role="link"><?php p($l->t("Hide description …")); ?></div>
143 143
 
144 144
 	<div class="app-dependencies update hidden">
145 145
 		<p><?php p($l->t('This app has an update available.')); ?></p>
@@ -170,14 +170,14 @@  discard block
 block discarded – undo
170 170
 
171 171
 	<input class="update hidden" type="submit" value="<?php p($l->t('Update to %s', array('{{update}}'))); ?>" data-appid="{{id}}" />
172 172
 	{{#if active}}
173
-	<input class="enable" type="submit" data-appid="{{id}}" data-active="true" value="<?php p($l->t("Disable"));?>"/>
173
+	<input class="enable" type="submit" data-appid="{{id}}" data-active="true" value="<?php p($l->t("Disable")); ?>"/>
174 174
 	<div class="groups-enable">
175 175
 		<input type="checkbox" class="groups-enable__checkbox checkbox" id="groups_enable-{{id}}"/>
176 176
 		<label for="groups_enable-{{id}}"><?php p($l->t('Enable only for specific groups')); ?></label>
177 177
 	</div>
178 178
 	<input type="hidden" id="group_select" title="<?php p($l->t('All')); ?>" style="width: 200px">
179 179
 	{{else}}
180
-	<input class="enable{{#if needsDownload}} needs-download{{/if}}" type="submit" data-appid="{{id}}" data-active="false" {{#unless canInstall}}disabled="disabled"{{/unless}} value="<?php p($l->t("Enable"));?>"/>
180
+	<input class="enable{{#if needsDownload}} needs-download{{/if}}" type="submit" data-appid="{{id}}" data-active="false" {{#unless canInstall}}disabled="disabled"{{/unless}} value="<?php p($l->t("Enable")); ?>"/>
181 181
 	{{/if}}
182 182
 	{{#if canUnInstall}}
183 183
 	<input class="uninstall" type="submit" value="<?php p($l->t('Remove')); ?>" data-appid="{{id}}" />
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
 	</div>
189 189
 </script>
190 190
 
191
-<div id="app-navigation" class="icon-loading" data-category="<?php p($_['category']);?>">
191
+<div id="app-navigation" class="icon-loading" data-category="<?php p($_['category']); ?>">
192 192
 	<ul id="apps-categories">
193 193
 
194 194
 	</ul>
Please login to merge, or discard this patch.