Completed
Pull Request — master (#9293)
by Blizzz
18:49
created
lib/private/Installer.php 1 patch
Spacing   +50 added lines, -50 removed lines patch added patch discarded remove patch
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
 	 */
96 96
 	public function installApp($appId) {
97 97
 		$app = \OC_App::findAppInDirectories($appId);
98
-		if($app === false) {
98
+		if ($app === false) {
99 99
 			throw new \Exception('App not found in any app directory');
100 100
 		}
101 101
 
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
 
105 105
 		$l = \OC::$server->getL10N('core');
106 106
 
107
-		if(!is_array($info)) {
107
+		if (!is_array($info)) {
108 108
 			throw new \Exception(
109 109
 				$l->t('App "%s" cannot be installed because appinfo file cannot be read.',
110 110
 					[$appId]
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
 		\OC_App::registerAutoloading($appId, $basedir);
128 128
 
129 129
 		//install the database
130
-		if(is_file($basedir.'/appinfo/database.xml')) {
130
+		if (is_file($basedir.'/appinfo/database.xml')) {
131 131
 			if (\OC::$server->getConfig()->getAppValue($info['id'], 'installed_version') === null) {
132 132
 				OC_DB::createDbFromStructure($basedir.'/appinfo/database.xml');
133 133
 			} else {
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
 		\OC_App::setupBackgroundJobs($info['background-jobs']);
142 142
 
143 143
 		//run appinfo/install.php
144
-		self::includeAppScript($basedir . '/appinfo/install.php');
144
+		self::includeAppScript($basedir.'/appinfo/install.php');
145 145
 
146 146
 		$appData = OC_App::getAppInfo($appId);
147 147
 		OC_App::executeRepairSteps($appId, $appData['repair-steps']['install']);
@@ -151,10 +151,10 @@  discard block
 block discarded – undo
151 151
 		\OC::$server->getConfig()->setAppValue($info['id'], 'enabled', 'no');
152 152
 
153 153
 		//set remote/public handlers
154
-		foreach($info['remote'] as $name=>$path) {
154
+		foreach ($info['remote'] as $name=>$path) {
155 155
 			\OC::$server->getConfig()->setAppValue('core', 'remote_'.$name, $info['id'].'/'.$path);
156 156
 		}
157
-		foreach($info['public'] as $name=>$path) {
157
+		foreach ($info['public'] as $name=>$path) {
158 158
 			\OC::$server->getConfig()->setAppValue('core', 'public_'.$name, $info['id'].'/'.$path);
159 159
 		}
160 160
 
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
 	 * @return bool
171 171
 	 */
172 172
 	public function updateAppstoreApp($appId) {
173
-		if($this->isUpdateAvailable($appId)) {
173
+		if ($this->isUpdateAvailable($appId)) {
174 174
 			try {
175 175
 				$this->downloadApp($appId);
176 176
 			} catch (\Exception $e) {
@@ -197,18 +197,18 @@  discard block
 block discarded – undo
197 197
 		$appId = strtolower($appId);
198 198
 
199 199
 		$apps = $this->appFetcher->get();
200
-		foreach($apps as $app) {
201
-			if($app['id'] === $appId) {
200
+		foreach ($apps as $app) {
201
+			if ($app['id'] === $appId) {
202 202
 				// Load the certificate
203 203
 				$certificate = new X509();
204
-				$certificate->loadCA(file_get_contents(__DIR__ . '/../../resources/codesigning/root.crt'));
204
+				$certificate->loadCA(file_get_contents(__DIR__.'/../../resources/codesigning/root.crt'));
205 205
 				$loadedCertificate = $certificate->loadX509($app['certificate']);
206 206
 
207 207
 				// Verify if the certificate has been revoked
208 208
 				$crl = new X509();
209
-				$crl->loadCA(file_get_contents(__DIR__ . '/../../resources/codesigning/root.crt'));
210
-				$crl->loadCRL(file_get_contents(__DIR__ . '/../../resources/codesigning/root.crl'));
211
-				if($crl->validateSignature() !== true) {
209
+				$crl->loadCA(file_get_contents(__DIR__.'/../../resources/codesigning/root.crt'));
210
+				$crl->loadCRL(file_get_contents(__DIR__.'/../../resources/codesigning/root.crl'));
211
+				if ($crl->validateSignature() !== true) {
212 212
 					throw new \Exception('Could not validate CRL signature');
213 213
 				}
214 214
 				$csn = $loadedCertificate['tbsCertificate']['serialNumber']->toString();
@@ -223,7 +223,7 @@  discard block
 block discarded – undo
223 223
 				}
224 224
 
225 225
 				// Verify if the certificate has been issued by the Nextcloud Code Authority CA
226
-				if($certificate->validateSignature() !== true) {
226
+				if ($certificate->validateSignature() !== true) {
227 227
 					throw new \Exception(
228 228
 						sprintf(
229 229
 							'App with id %s has a certificate not issued by a trusted Code Signing Authority',
@@ -234,7 +234,7 @@  discard block
 block discarded – undo
234 234
 
235 235
 				// Verify if the certificate is issued for the requested app id
236 236
 				$certInfo = openssl_x509_parse($app['certificate']);
237
-				if(!isset($certInfo['subject']['CN'])) {
237
+				if (!isset($certInfo['subject']['CN'])) {
238 238
 					throw new \Exception(
239 239
 						sprintf(
240 240
 							'App with id %s has a cert with no CN',
@@ -242,7 +242,7 @@  discard block
 block discarded – undo
242 242
 						)
243 243
 					);
244 244
 				}
245
-				if($certInfo['subject']['CN'] !== $appId) {
245
+				if ($certInfo['subject']['CN'] !== $appId) {
246 246
 					throw new \Exception(
247 247
 						sprintf(
248 248
 							'App with id %s has a cert issued to %s',
@@ -259,15 +259,15 @@  discard block
 block discarded – undo
259 259
 
260 260
 				// Check if the signature actually matches the downloaded content
261 261
 				$certificate = openssl_get_publickey($app['certificate']);
262
-				$verified = (bool)openssl_verify(file_get_contents($tempFile), base64_decode($app['releases'][0]['signature']), $certificate, OPENSSL_ALGO_SHA512);
262
+				$verified = (bool) openssl_verify(file_get_contents($tempFile), base64_decode($app['releases'][0]['signature']), $certificate, OPENSSL_ALGO_SHA512);
263 263
 				openssl_free_key($certificate);
264 264
 
265
-				if($verified === true) {
265
+				if ($verified === true) {
266 266
 					// Seems to match, let's proceed
267 267
 					$extractDir = $this->tempManager->getTemporaryFolder();
268 268
 					$archive = new TAR($tempFile);
269 269
 
270
-					if($archive) {
270
+					if ($archive) {
271 271
 						if (!$archive->extract($extractDir)) {
272 272
 							throw new \Exception(
273 273
 								sprintf(
@@ -280,7 +280,7 @@  discard block
 block discarded – undo
280 280
 						$folders = array_diff($allFiles, ['.', '..']);
281 281
 						$folders = array_values($folders);
282 282
 
283
-						if(count($folders) > 1) {
283
+						if (count($folders) > 1) {
284 284
 							throw new \Exception(
285 285
 								sprintf(
286 286
 									'Extracted app %s has more than 1 folder',
@@ -291,22 +291,22 @@  discard block
 block discarded – undo
291 291
 
292 292
 						// Check if appinfo/info.xml has the same app ID as well
293 293
 						$loadEntities = libxml_disable_entity_loader(false);
294
-						$xml = simplexml_load_file($extractDir . '/' . $folders[0] . '/appinfo/info.xml');
294
+						$xml = simplexml_load_file($extractDir.'/'.$folders[0].'/appinfo/info.xml');
295 295
 						libxml_disable_entity_loader($loadEntities);
296
-						if((string)$xml->id !== $appId) {
296
+						if ((string) $xml->id !== $appId) {
297 297
 							throw new \Exception(
298 298
 								sprintf(
299 299
 									'App for id %s has a wrong app ID in info.xml: %s',
300 300
 									$appId,
301
-									(string)$xml->id
301
+									(string) $xml->id
302 302
 								)
303 303
 							);
304 304
 						}
305 305
 
306 306
 						// Check if the version is lower than before
307 307
 						$currentVersion = OC_App::getAppVersion($appId);
308
-						$newVersion = (string)$xml->version;
309
-						if(version_compare($currentVersion, $newVersion) === 1) {
308
+						$newVersion = (string) $xml->version;
309
+						if (version_compare($currentVersion, $newVersion) === 1) {
310 310
 							throw new \Exception(
311 311
 								sprintf(
312 312
 									'App for id %s has version %s and tried to update to lower version %s',
@@ -317,12 +317,12 @@  discard block
 block discarded – undo
317 317
 							);
318 318
 						}
319 319
 
320
-						$baseDir = OC_App::getInstallPath() . '/' . $appId;
320
+						$baseDir = OC_App::getInstallPath().'/'.$appId;
321 321
 						// Remove old app with the ID if existent
322 322
 						OC_Helper::rmdirr($baseDir);
323 323
 						// Move to app folder
324
-						if(@mkdir($baseDir)) {
325
-							$extractDir .= '/' . $folders[0];
324
+						if (@mkdir($baseDir)) {
325
+							$extractDir .= '/'.$folders[0];
326 326
 							OC_Helper::copyr($extractDir, $baseDir);
327 327
 						}
328 328
 						OC_Helper::copyr($extractDir, $baseDir);
@@ -385,8 +385,8 @@  discard block
 block discarded – undo
385 385
 			$this->apps = $this->appFetcher->get();
386 386
 		}
387 387
 
388
-		foreach($this->apps as $app) {
389
-			if($app['id'] === $appId) {
388
+		foreach ($this->apps as $app) {
389
+			if ($app['id'] === $appId) {
390 390
 				$currentVersion = OC_App::getAppVersion($appId);
391 391
 				$newestVersion = $app['releases'][0]['version'];
392 392
 				if (version_compare($newestVersion, $currentVersion, '>')) {
@@ -409,7 +409,7 @@  discard block
 block discarded – undo
409 409
 	 */
410 410
 	private function isInstalledFromGit($appId) {
411 411
 		$app = \OC_App::findAppInDirectories($appId);
412
-		if($app === false) {
412
+		if ($app === false) {
413 413
 			return false;
414 414
 		}
415 415
 		$basedir = $app['path'].'/'.$appId;
@@ -424,7 +424,7 @@  discard block
 block discarded – undo
424 424
 	 * The function will check if the app is already downloaded in the apps repository
425 425
 	 */
426 426
 	public function isDownloaded($name) {
427
-		foreach(\OC::$APPSROOTS as $dir) {
427
+		foreach (\OC::$APPSROOTS as $dir) {
428 428
 			$dirToTest  = $dir['path'];
429 429
 			$dirToTest .= '/';
430 430
 			$dirToTest .= $name;
@@ -452,14 +452,14 @@  discard block
 block discarded – undo
452 452
 	 * this has to be done by the function oc_app_uninstall().
453 453
 	 */
454 454
 	public function removeApp($appId) {
455
-		if($this->isDownloaded( $appId )) {
455
+		if ($this->isDownloaded($appId)) {
456 456
 			if (\OC::$server->getAppManager()->isShipped($appId)) {
457 457
 				return false;
458 458
 			}
459
-			$appDir = OC_App::getInstallPath() . '/' . $appId;
459
+			$appDir = OC_App::getInstallPath().'/'.$appId;
460 460
 			OC_Helper::rmdirr($appDir);
461 461
 			return true;
462
-		}else{
462
+		} else {
463 463
 			\OCP\Util::writeLog('core', 'can\'t remove app '.$appId.'. It is not installed.', ILogger::ERROR);
464 464
 
465 465
 			return false;
@@ -475,8 +475,8 @@  discard block
 block discarded – undo
475 475
 	 */
476 476
 	public function installAppBundle(Bundle $bundle) {
477 477
 		$appIds = $bundle->getAppIdentifiers();
478
-		foreach($appIds as $appId) {
479
-			if(!$this->isDownloaded($appId)) {
478
+		foreach ($appIds as $appId) {
479
+			if (!$this->isDownloaded($appId)) {
480 480
 				$this->downloadApp($appId);
481 481
 			}
482 482
 			$this->installApp($appId);
@@ -500,13 +500,13 @@  discard block
 block discarded – undo
500 500
 		$appManager = \OC::$server->getAppManager();
501 501
 		$config = \OC::$server->getConfig();
502 502
 		$errors = [];
503
-		foreach(\OC::$APPSROOTS as $app_dir) {
504
-			if($dir = opendir( $app_dir['path'] )) {
505
-				while( false !== ( $filename = readdir( $dir ))) {
506
-					if( $filename[0] !== '.' and is_dir($app_dir['path']."/$filename") ) {
507
-						if( file_exists( $app_dir['path']."/$filename/appinfo/info.xml" )) {
508
-							if($config->getAppValue($filename, "installed_version", null) === null) {
509
-								$info=OC_App::getAppInfo($filename);
503
+		foreach (\OC::$APPSROOTS as $app_dir) {
504
+			if ($dir = opendir($app_dir['path'])) {
505
+				while (false !== ($filename = readdir($dir))) {
506
+					if ($filename[0] !== '.' and is_dir($app_dir['path']."/$filename")) {
507
+						if (file_exists($app_dir['path']."/$filename/appinfo/info.xml")) {
508
+							if ($config->getAppValue($filename, "installed_version", null) === null) {
509
+								$info = OC_App::getAppInfo($filename);
510 510
 								$enabled = isset($info['default_enable']);
511 511
 								if (($enabled || in_array($filename, $appManager->getAlwaysEnabledApps()))
512 512
 									  && $config->getAppValue($filename, 'enabled') !== 'no') {
@@ -529,7 +529,7 @@  discard block
 block discarded – undo
529 529
 						}
530 530
 					}
531 531
 				}
532
-				closedir( $dir );
532
+				closedir($dir);
533 533
 			}
534 534
 		}
535 535
 
@@ -546,12 +546,12 @@  discard block
 block discarded – undo
546 546
 		$appPath = OC_App::getAppPath($app);
547 547
 		\OC_App::registerAutoloading($app, $appPath);
548 548
 
549
-		if(is_file("$appPath/appinfo/database.xml")) {
549
+		if (is_file("$appPath/appinfo/database.xml")) {
550 550
 			try {
551 551
 				OC_DB::createDbFromStructure("$appPath/appinfo/database.xml");
552 552
 			} catch (TableExistsException $e) {
553 553
 				throw new HintException(
554
-					'Failed to enable app ' . $app,
554
+					'Failed to enable app '.$app,
555 555
 					'Please ask for help via one of our <a href="https://nextcloud.com/support/" target="_blank" rel="noreferrer noopener">support channels</a>.',
556 556
 					0, $e
557 557
 				);
@@ -580,10 +580,10 @@  discard block
 block discarded – undo
580 580
 		}
581 581
 
582 582
 		//set remote/public handlers
583
-		foreach($info['remote'] as $name=>$path) {
583
+		foreach ($info['remote'] as $name=>$path) {
584 584
 			$config->setAppValue('core', 'remote_'.$name, $app.'/'.$path);
585 585
 		}
586
-		foreach($info['public'] as $name=>$path) {
586
+		foreach ($info['public'] as $name=>$path) {
587 587
 			$config->setAppValue('core', 'public_'.$name, $app.'/'.$path);
588 588
 		}
589 589
 
@@ -596,7 +596,7 @@  discard block
 block discarded – undo
596 596
 	 * @param string $script
597 597
 	 */
598 598
 	private static function includeAppScript($script) {
599
-		if ( file_exists($script) ){
599
+		if (file_exists($script)) {
600 600
 			include $script;
601 601
 		}
602 602
 	}
Please login to merge, or discard this patch.
lib/public/Util.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -60,23 +60,23 @@  discard block
 block discarded – undo
60 60
 	/**
61 61
 	 * @deprecated 14.0.0 use \OCP\ILogger::DEBUG
62 62
 	 */
63
-	const DEBUG=0;
63
+	const DEBUG = 0;
64 64
 	/**
65 65
 	 * @deprecated 14.0.0 use \OCP\ILogger::INFO
66 66
 	 */
67
-	const INFO=1;
67
+	const INFO = 1;
68 68
 	/**
69 69
 	 * @deprecated 14.0.0 use \OCP\ILogger::WARN
70 70
 	 */
71
-	const WARN=2;
71
+	const WARN = 2;
72 72
 	/**
73 73
 	 * @deprecated 14.0.0 use \OCP\ILogger::ERROR
74 74
 	 */
75
-	const ERROR=3;
75
+	const ERROR = 3;
76 76
 	/**
77 77
 	 * @deprecated 14.0.0 use \OCP\ILogger::FATAL
78 78
 	 */
79
-	const FATAL=4;
79
+	const FATAL = 4;
80 80
 
81 81
 	/** \OCP\Share\IManager */
82 82
 	private static $shareManager;
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
 	 * @since 4.0.0
117 117
 	 * @deprecated 13.0.0 use log of \OCP\ILogger
118 118
 	 */
119
-	public static function writeLog( $app, $message, $level ) {
119
+	public static function writeLog($app, $message, $level) {
120 120
 		$context = ['app' => $app];
121 121
 		\OC::$server->getLogger()->log($level, $message, $context);
122 122
 	}
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
 	 * @since ....0.0 - parameter $level was added in 7.0.0
130 130
 	 * @deprecated 8.2.0 use logException of \OCP\ILogger
131 131
 	 */
132
-	public static function logException( $app, \Exception $ex, $level = ILogger::FATAL) {
132
+	public static function logException($app, \Exception $ex, $level = ILogger::FATAL) {
133 133
 		\OC::$server->getLogger()->logException($ex, ['app' => $app]);
134 134
 	}
135 135
 
@@ -170,8 +170,8 @@  discard block
 block discarded – undo
170 170
 	 * @param string $file
171 171
 	 * @since 4.0.0
172 172
 	 */
173
-	public static function addStyle( $application, $file = null ) {
174
-		\OC_Util::addStyle( $application, $file );
173
+	public static function addStyle($application, $file = null) {
174
+		\OC_Util::addStyle($application, $file);
175 175
 	}
176 176
 
177 177
 	/**
@@ -180,8 +180,8 @@  discard block
 block discarded – undo
180 180
 	 * @param string $file
181 181
 	 * @since 4.0.0
182 182
 	 */
183
-	public static function addScript( $application, $file = null ) {
184
-		\OC_Util::addScript( $application, $file );
183
+	public static function addScript($application, $file = null) {
184
+		\OC_Util::addScript($application, $file);
185 185
 	}
186 186
 
187 187
 	/**
@@ -203,7 +203,7 @@  discard block
 block discarded – undo
203 203
 	 * @param string $text the text content for the element
204 204
 	 * @since 4.0.0
205 205
 	 */
206
-	public static function addHeader($tag, $attributes, $text=null) {
206
+	public static function addHeader($tag, $attributes, $text = null) {
207 207
 		\OC_Util::addHeader($tag, $attributes, $text);
208 208
 	}
209 209
 
@@ -216,7 +216,7 @@  discard block
 block discarded – undo
216 216
 	 * @return string the url
217 217
 	 * @since 4.0.0 - parameter $args was added in 4.5.0
218 218
 	 */
219
-	public static function linkToAbsolute( $app, $file, $args = array() ) {
219
+	public static function linkToAbsolute($app, $file, $args = array()) {
220 220
 		$urlGenerator = \OC::$server->getURLGenerator();
221 221
 		return $urlGenerator->getAbsoluteURL(
222 222
 			$urlGenerator->linkTo($app, $file, $args)
@@ -229,11 +229,11 @@  discard block
 block discarded – undo
229 229
 	 * @return string the url
230 230
 	 * @since 4.0.0
231 231
 	 */
232
-	public static function linkToRemote( $service ) {
232
+	public static function linkToRemote($service) {
233 233
 		$urlGenerator = \OC::$server->getURLGenerator();
234
-		$remoteBase = $urlGenerator->linkTo('', 'remote.php') . '/' . $service;
234
+		$remoteBase = $urlGenerator->linkTo('', 'remote.php').'/'.$service;
235 235
 		return $urlGenerator->getAbsoluteURL(
236
-			$remoteBase . (($service[strlen($service) - 1] != '/') ? '/' : '')
236
+			$remoteBase.(($service[strlen($service) - 1] != '/') ? '/' : '')
237 237
 		);
238 238
 	}
239 239
 
@@ -361,7 +361,7 @@  discard block
 block discarded – undo
361 361
 	 * @since 4.5.0
362 362
 	 */
363 363
 	public static function callRegister() {
364
-		if(self::$token === '') {
364
+		if (self::$token === '') {
365 365
 			self::$token = \OC::$server->getCsrfTokenManager()->getToken()->getEncryptedValue();
366 366
 		}
367 367
 		return self::$token;
@@ -373,7 +373,7 @@  discard block
 block discarded – undo
373 373
 	 * @deprecated 9.0.0 Use annotations based on the app framework.
374 374
 	 */
375 375
 	public static function callCheck() {
376
-		if(!\OC::$server->getRequest()->passesStrictCookieCheck()) {
376
+		if (!\OC::$server->getRequest()->passesStrictCookieCheck()) {
377 377
 			header('Location: '.\OC::$WEBROOT);
378 378
 			exit();
379 379
 		}
@@ -554,7 +554,7 @@  discard block
 block discarded – undo
554 554
 	 */
555 555
 	public static function needUpgrade() {
556 556
 		if (!isset(self::$needUpgradeCache)) {
557
-			self::$needUpgradeCache=\OC_Util::needUpgrade(\OC::$server->getSystemConfig());
557
+			self::$needUpgradeCache = \OC_Util::needUpgrade(\OC::$server->getSystemConfig());
558 558
 		}		
559 559
 		return self::$needUpgradeCache;
560 560
 	}
Please login to merge, or discard this patch.
lib/public/ILogger.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -39,23 +39,23 @@
 block discarded – undo
39 39
 	/**
40 40
 	 * @since 14.0.0
41 41
 	 */
42
-	const DEBUG=0;
42
+	const DEBUG = 0;
43 43
 	/**
44 44
 	 * @since 14.0.0
45 45
 	 */
46
-	const INFO=1;
46
+	const INFO = 1;
47 47
 	/**
48 48
 	 * @since 14.0.0
49 49
 	 */
50
-	const WARN=2;
50
+	const WARN = 2;
51 51
 	/**
52 52
 	 * @since 14.0.0
53 53
 	 */
54
-	const ERROR=3;
54
+	const ERROR = 3;
55 55
 	/**
56 56
 	 * @since 14.0.0
57 57
 	 */
58
-	const FATAL=4;
58
+	const FATAL = 4;
59 59
 
60 60
 	/**
61 61
 	 * System is unusable.
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
@@ -33,20 +33,20 @@  discard block
 block discarded – undo
33 33
 $lastConfirm = (int) \OC::$server->getSession()->get('last-password-confirm');
34 34
 if ($lastConfirm < (time() - 30 * 60 + 15)) { // allow 15 seconds delay
35 35
 	$l = \OC::$server->getL10N('core');
36
-	OC_JSON::error(array( 'data' => array( 'message' => $l->t('Password confirmation is required'))));
36
+	OC_JSON::error(array('data' => array('message' => $l->t('Password confirmation is required'))));
37 37
 	exit();
38 38
 }
39 39
 
40
-$groups = isset($_POST['groups']) ? (array)$_POST['groups'] : [];
41
-$appIds = isset($_POST['appIds']) ? (array)$_POST['appIds'] : [];
40
+$groups = isset($_POST['groups']) ? (array) $_POST['groups'] : [];
41
+$appIds = isset($_POST['appIds']) ? (array) $_POST['appIds'] : [];
42 42
 
43 43
 try {
44 44
 	$updateRequired = false;
45
-	foreach($appIds as $appId) {
45
+	foreach ($appIds as $appId) {
46 46
 		$app = new OC_App();
47 47
 		$appId = OC_App::cleanAppId($appId);
48 48
 		$app->enable($appId, $groups);
49
-		if(\OC_App::shouldUpgrade($appId)) {
49
+		if (\OC_App::shouldUpgrade($appId)) {
50 50
 			$updateRequired = true;
51 51
 		}
52 52
 	}
@@ -57,5 +57,5 @@  discard block
 block discarded – undo
57 57
 		'level' => ILogger::DEBUG,
58 58
 		'app' => 'core',
59 59
 	]);
60
-	OC_JSON::error(array("data" => array("message" => $e->getMessage()) ));
60
+	OC_JSON::error(array("data" => array("message" => $e->getMessage())));
61 61
 }
Please login to merge, or discard this patch.
lib/private/Log/File.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
 	public function __construct(string $path, string $fallbackPath = '', IConfig $config) {
57 57
 		$this->logFile = $path;
58 58
 		if (!file_exists($this->logFile)) {
59
-			if(
59
+			if (
60 60
 				(
61 61
 					!is_writable(dirname($this->logFile))
62 62
 					|| !touch($this->logFile)
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
 		$time = $time->format($format);
99 99
 		$url = ($request->getRequestUri() !== '') ? $request->getRequestUri() : '--';
100 100
 		$method = is_string($request->getMethod()) ? $request->getMethod() : '--';
101
-		if($this->config->getSystemValue('installed', false)) {
101
+		if ($this->config->getSystemValue('installed', false)) {
102 102
 			$user = \OC_User::getUser() ? \OC_User::getUser() : '--';
103 103
 		} else {
104 104
 			$user = '--';
@@ -124,10 +124,10 @@  discard block
 block discarded – undo
124 124
 		// PHP's json_encode only accept proper UTF-8 strings, loop over all
125 125
 		// elements to ensure that they are properly UTF-8 compliant or convert
126 126
 		// them manually.
127
-		foreach($entry as $key => $value) {
128
-			if(is_string($value)) {
127
+		foreach ($entry as $key => $value) {
128
+			if (is_string($value)) {
129 129
 				$testEncode = json_encode($value);
130
-				if($testEncode === false) {
130
+				if ($testEncode === false) {
131 131
 					$entry[$key] = utf8_encode($value);
132 132
 				}
133 133
 			}
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
 	 * @param int $offset
156 156
 	 * @return array
157 157
 	 */
158
-	public function getEntries(int $limit=50, int $offset=0):array {
158
+	public function getEntries(int $limit = 50, int $offset = 0):array {
159 159
 		$minLevel = $this->config->getSystemValue("loglevel", ILogger::WARN);
160 160
 		$entries = array();
161 161
 		$handle = @fopen($this->logFile, 'rb');
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
 			$entriesCount = 0;
167 167
 			$lines = 0;
168 168
 			// Loop through each character of the file looking for new lines
169
-			while ($pos >= 0 && ($limit === null ||$entriesCount < $limit)) {
169
+			while ($pos >= 0 && ($limit === null || $entriesCount < $limit)) {
170 170
 				fseek($handle, $pos);
171 171
 				$ch = fgetc($handle);
172 172
 				if ($ch == "\n" || $pos == 0) {
Please login to merge, or discard this patch.
lib/public/Log/IFileBased.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -39,5 +39,5 @@
 block discarded – undo
39 39
 	/**
40 40
 	 * @since 14.0.0
41 41
 	 */
42
-	public function getEntries(int $limit=50, int $offset=0): array;
42
+	public function getEntries(int $limit = 50, int $offset = 0): array;
43 43
 }
Please login to merge, or discard this patch.
apps/federation/lib/BackgroundJob/GetSharedSecret.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
 
146 146
 	protected function run($argument) {
147 147
 		$target = $argument['url'];
148
-		$created = isset($argument['created']) ? (int)$argument['created'] : $this->timeFactory->getTime();
148
+		$created = isset($argument['created']) ? (int) $argument['created'] : $this->timeFactory->getTime();
149 149
 		$currentTime = $this->timeFactory->getTime();
150 150
 		$source = $this->urlGenerator->getAbsoluteURL('/');
151 151
 		$source = rtrim($source, '/');
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
 		$deadline = $currentTime - $this->maxLifespan;
156 156
 		if ($created < $deadline) {
157 157
 			$this->retainJob = false;
158
-			$this->trustedServers->setServerStatus($target,TrustedServers::STATUS_FAILURE);
158
+			$this->trustedServers->setServerStatus($target, TrustedServers::STATUS_FAILURE);
159 159
 			return;
160 160
 		}
161 161
 
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
 		$endPoint = isset($endPoints['shared-secret']) ? $endPoints['shared-secret'] : $this->defaultEndPoint;
164 164
 
165 165
 		// make sure that we have a well formatted url
166
-		$url = rtrim($target, '/') . '/' . trim($endPoint, '/');
166
+		$url = rtrim($target, '/').'/'.trim($endPoint, '/');
167 167
 
168 168
 		$result = null;
169 169
 		try {
@@ -186,21 +186,21 @@  discard block
 block discarded – undo
186 186
 		} catch (ClientException $e) {
187 187
 			$status = $e->getCode();
188 188
 			if ($status === Http::STATUS_FORBIDDEN) {
189
-				$this->logger->info($target . ' refused to exchange a shared secret with you.', ['app' => 'federation']);
189
+				$this->logger->info($target.' refused to exchange a shared secret with you.', ['app' => 'federation']);
190 190
 			} else {
191
-				$this->logger->info($target . ' responded with a ' . $status . ' containing: ' . $e->getMessage(), ['app' => 'federation']);
191
+				$this->logger->info($target.' responded with a '.$status.' containing: '.$e->getMessage(), ['app' => 'federation']);
192 192
 			}
193 193
 		} catch (RequestException $e) {
194 194
 			$status = -1; // There is no status code if we could not connect
195 195
 			$this->logger->logException($e, [
196
-				'message' => 'Could not connect to ' . $target,
196
+				'message' => 'Could not connect to '.$target,
197 197
 				'level' => ILogger::INFO,
198 198
 				'app' => 'federation',
199 199
 			]);
200 200
 		} catch (RingException $e) {
201 201
 			$status = -1; // There is no status code if we could not connect
202 202
 			$this->logger->logException($e, [
203
-				'message' => 'Could not connect to ' . $target,
203
+				'message' => 'Could not connect to '.$target,
204 204
 				'level' => ILogger::INFO,
205 205
 				'app' => 'federation',
206 206
 			]);
@@ -227,7 +227,7 @@  discard block
 block discarded – undo
227 227
 				);
228 228
 			} else {
229 229
 				$this->logger->error(
230
-						'remote server "' . $target . '"" does not return a valid shared secret. Received data: ' . $body,
230
+						'remote server "'.$target.'"" does not return a valid shared secret. Received data: '.$body,
231 231
 						['app' => 'federation']
232 232
 				);
233 233
 				$this->trustedServers->setServerStatus($target, TrustedServers::STATUS_FAILURE);
@@ -243,7 +243,7 @@  discard block
 block discarded – undo
243 243
 	 */
244 244
 	protected function reAddJob(array $argument) {
245 245
 		$url = $argument['url'];
246
-		$created = isset($argument['created']) ? (int)$argument['created'] : $this->timeFactory->getTime();
246
+		$created = isset($argument['created']) ? (int) $argument['created'] : $this->timeFactory->getTime();
247 247
 		$token = $argument['token'];
248 248
 		$this->jobList->add(
249 249
 			GetSharedSecret::class,
Please login to merge, or discard this patch.
lib/private/Log/Rotate.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -37,10 +37,10 @@
 block discarded – undo
37 37
 
38 38
 	public function run($dummy) {
39 39
 		$systemConfig = \OC::$server->getSystemConfig();
40
-		$this->filePath = $systemConfig->getValue('logfile', $systemConfig->getValue('datadirectory', \OC::$SERVERROOT . '/data') . '/nextcloud.log');
40
+		$this->filePath = $systemConfig->getValue('logfile', $systemConfig->getValue('datadirectory', \OC::$SERVERROOT.'/data').'/nextcloud.log');
41 41
 
42 42
 		$this->maxSize = \OC::$server->getConfig()->getSystemValue('log_rotate_size', 100 * 1024 * 1024);
43
-		if($this->shouldRotateBySize()) {
43
+		if ($this->shouldRotateBySize()) {
44 44
 			$rotatedFile = $this->rotate();
45 45
 			$msg = 'Log file "'.$this->filePath.'" was over '.$this->maxSize.' bytes, moved to "'.$rotatedFile.'"';
46 46
 			\OC::$server->getLogger()->warning($msg, ['app' => Rotate::class]);
Please login to merge, or discard this patch.
lib/public/Log/RotationTrait.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -59,9 +59,9 @@
 block discarded – undo
59 59
 	 * @since 14.0.0
60 60
 	 */
61 61
 	protected function shouldRotateBySize():bool {
62
-		if ((int)$this->maxSize > 0) {
62
+		if ((int) $this->maxSize > 0) {
63 63
 			$filesize = @filesize($this->filePath);
64
-			if ($filesize >= (int)$this->maxSize) {
64
+			if ($filesize >= (int) $this->maxSize) {
65 65
 				return true;
66 66
 			}
67 67
 		}
Please login to merge, or discard this patch.