Completed
Pull Request — master (#9705)
by Blizzz
33:37 queued 11:15
created
lib/private/Updater/ChangesCheck.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
 		try {
55 55
 			$version = $this->normalizeVersion($version);
56 56
 			$changesInfo = $this->mapper->getChanges($version);
57
-			if($changesInfo->getLastCheck() + 1800 > time()) {
57
+			if ($changesInfo->getLastCheck() + 1800 > time()) {
58 58
 				return json_decode($changesInfo->getData(), true);
59 59
 			}
60 60
 		} catch (DoesNotExistException $e) {
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
 
64 64
 		$response = $this->queryChangesServer($uri, $changesInfo);
65 65
 
66
-		switch($this->evaluateResponse($response)) {
66
+		switch ($this->evaluateResponse($response)) {
67 67
 			case self::RESPONSE_NO_CONTENT:
68 68
 				return [];
69 69
 			case self::RESPONSE_USE_CACHE:
@@ -80,11 +80,11 @@  discard block
 block discarded – undo
80 80
 	}
81 81
 
82 82
 	protected function evaluateResponse(IResponse $response): int {
83
-		if($response->getStatusCode() === 304) {
83
+		if ($response->getStatusCode() === 304) {
84 84
 			return self::RESPONSE_USE_CACHE;
85
-		} else if($response->getStatusCode() === 404) {
85
+		} else if ($response->getStatusCode() === 404) {
86 86
 			return self::RESPONSE_NO_CONTENT;
87
-		} else if($response->getStatusCode() === 200) {
87
+		} else if ($response->getStatusCode() === 200) {
88 88
 			return self::RESPONSE_HAS_CONTENT;
89 89
 		}
90 90
 		$this->logger->debug('Unexpected return code {code} from changelog server', [
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
 	}
96 96
 
97 97
 	protected function cacheResult(ChangesResult $entry, string $version) {
98
-		if($entry->getVersion() === $version) {
98
+		if ($entry->getVersion() === $version) {
99 99
 			$this->mapper->update($entry);
100 100
 		} else {
101 101
 			$entry->setVersion($version);
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
 	 */
109 109
 	protected function queryChangesServer(string $uri, ChangesResult $entry): IResponse {
110 110
 		$headers = [];
111
-		if($entry->getEtag() !== '') {
111
+		if ($entry->getEtag() !== '') {
112 112
 			$headers['If-None-Match'] = [$entry->getEtag()];
113 113
 		}
114 114
 
@@ -126,12 +126,12 @@  discard block
 block discarded – undo
126 126
 			$xml = @simplexml_load_string($body);
127 127
 			libxml_disable_entity_loader($loadEntities);
128 128
 			if ($xml !== false) {
129
-				$data['changelogURL'] = (string)$xml->changelog['href'];
129
+				$data['changelogURL'] = (string) $xml->changelog['href'];
130 130
 				$data['whatsNew'] = [];
131
-				foreach($xml->whatsNew as $infoSet) {
132
-					$data['whatsNew'][(string)$infoSet['lang']] = [
133
-						'regular' => (array)$infoSet->regular->item,
134
-						'admin' => (array)$infoSet->admin->item,
131
+				foreach ($xml->whatsNew as $infoSet) {
132
+					$data['whatsNew'][(string) $infoSet['lang']] = [
133
+						'regular' => (array) $infoSet->regular->item,
134
+						'admin' => (array) $infoSet->admin->item,
135 135
 					];
136 136
 				}
137 137
 			} else {
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
 	protected function normalizeVersion(string $version): string {
149 149
 		$versionNumbers = array_slice(explode('.', $version), 0, 3);
150 150
 		$versionNumbers[0] = $versionNumbers[0] ?: '0'; // deal with empty input
151
-		while(count($versionNumbers) < 3) {
151
+		while (count($versionNumbers) < 3) {
152 152
 			// changelog server expects x.y.z, pad 0 if it is too short
153 153
 			$versionNumbers[] = 0;
154 154
 		}
Please login to merge, or discard this patch.
lib/private/Updater/VersionCheck.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
 	 */
56 56
 	public function check() {
57 57
 		// Look up the cache - it is invalidated all 30 minutes
58
-		if (((int)$this->config->getAppValue('core', 'lastupdatedat') + 1800) > time()) {
58
+		if (((int) $this->config->getAppValue('core', 'lastupdatedat') + 1800) > time()) {
59 59
 			return json_decode($this->config->getAppValue('core', 'lastupdateResult'), true);
60 60
 		}
61 61
 
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
 		$versionString = implode('x', $version);
80 80
 
81 81
 		//fetch xml data from updater
82
-		$url = $updaterUrl . '?version=' . $versionString;
82
+		$url = $updaterUrl.'?version='.$versionString;
83 83
 
84 84
 		$tmp = [];
85 85
 		try {
@@ -93,13 +93,13 @@  discard block
 block discarded – undo
93 93
 			$data = @simplexml_load_string($xml);
94 94
 			libxml_disable_entity_loader($loadEntities);
95 95
 			if ($data !== false) {
96
-				$tmp['version'] = (string)$data->version;
97
-				$tmp['versionstring'] = (string)$data->versionstring;
98
-				$tmp['url'] = (string)$data->url;
99
-				$tmp['web'] = (string)$data->web;
100
-				$tmp['changes'] = isset($data->changes) ? (string)$data->changes : '';
101
-				$tmp['autoupdater'] = (string)$data->autoupdater;
102
-				$tmp['eol'] = isset($data->eol) ? (string)$data->eol : '0';
96
+				$tmp['version'] = (string) $data->version;
97
+				$tmp['versionstring'] = (string) $data->versionstring;
98
+				$tmp['url'] = (string) $data->url;
99
+				$tmp['web'] = (string) $data->web;
100
+				$tmp['changes'] = isset($data->changes) ? (string) $data->changes : '';
101
+				$tmp['autoupdater'] = (string) $data->autoupdater;
102
+				$tmp['eol'] = isset($data->eol) ? (string) $data->eol : '0';
103 103
 			} else {
104 104
 				libxml_clear_errors();
105 105
 			}
Please login to merge, or discard this patch.
lib/private/L10N/Factory.php 1 patch
Spacing   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
 		 * @link https://github.com/owncloud/core/issues/21955
150 150
 		 */
151 151
 		if ($this->config->getSystemValue('installed', false)) {
152
-			$userId = !is_null($this->userSession->getUser()) ? $this->userSession->getUser()->getUID() :  null;
152
+			$userId = !is_null($this->userSession->getUser()) ? $this->userSession->getUser()->getUID() : null;
153 153
 			if (!is_null($userId)) {
154 154
 				$userLang = $this->config->getUserValue($userId, 'core', 'lang', null);
155 155
 			} else {
@@ -219,7 +219,7 @@  discard block
 block discarded – undo
219 219
 		// merge with translations from theme
220 220
 		$theme = $this->config->getSystemValue('theme');
221 221
 		if (!empty($theme)) {
222
-			$themeDir = $this->serverRoot . '/themes/' . $theme . substr($dir, strlen($this->serverRoot));
222
+			$themeDir = $this->serverRoot.'/themes/'.$theme.substr($dir, strlen($this->serverRoot));
223 223
 
224 224
 			if (is_dir($themeDir)) {
225 225
 				$files = scandir($themeDir);
@@ -253,24 +253,24 @@  discard block
 block discarded – undo
253 253
 
254 254
 	public function iterateLanguage(bool $reset = false): string {
255 255
 		static $i = 0;
256
-		if($reset) {
256
+		if ($reset) {
257 257
 			$i = 0;
258 258
 		}
259
-		switch($i) {
259
+		switch ($i) {
260 260
 			/** @noinspection PhpMissingBreakStatementInspection */
261 261
 			case 0:
262 262
 				$i++;
263 263
 				$forcedLang = $this->config->getSystemValue('force_language', false);
264
-				if(is_string($forcedLang)) {
264
+				if (is_string($forcedLang)) {
265 265
 					return $forcedLang;
266 266
 				}
267 267
 			/** @noinspection PhpMissingBreakStatementInspection */
268 268
 			case 1:
269 269
 				$i++;
270 270
 				$user = $this->userSession->getUser();
271
-				if($user instanceof IUser) {
271
+				if ($user instanceof IUser) {
272 272
 					$userLang = $this->config->getUserValue($user->getUID(), 'core', 'lang', null);
273
-					if(is_string($userLang)) {
273
+					if (is_string($userLang)) {
274 274
 						return $userLang;
275 275
 					}
276 276
 				}
@@ -377,12 +377,12 @@  discard block
 block discarded – undo
377 377
 		$languageFiles = [];
378 378
 
379 379
 		$i18nDir = $this->findL10nDir($app);
380
-		$transFile = strip_tags($i18nDir) . strip_tags($lang) . '.json';
380
+		$transFile = strip_tags($i18nDir).strip_tags($lang).'.json';
381 381
 
382
-		if (($this->isSubDirectory($transFile, $this->serverRoot . '/core/l10n/')
383
-				|| $this->isSubDirectory($transFile, $this->serverRoot . '/lib/l10n/')
384
-				|| $this->isSubDirectory($transFile, $this->serverRoot . '/settings/l10n/')
385
-				|| $this->isSubDirectory($transFile, \OC_App::getAppPath($app) . '/l10n/')
382
+		if (($this->isSubDirectory($transFile, $this->serverRoot.'/core/l10n/')
383
+				|| $this->isSubDirectory($transFile, $this->serverRoot.'/lib/l10n/')
384
+				|| $this->isSubDirectory($transFile, $this->serverRoot.'/settings/l10n/')
385
+				|| $this->isSubDirectory($transFile, \OC_App::getAppPath($app).'/l10n/')
386 386
 			)
387 387
 			&& file_exists($transFile)) {
388 388
 			// load the translations file
@@ -392,7 +392,7 @@  discard block
 block discarded – undo
392 392
 		// merge with translations from theme
393 393
 		$theme = $this->config->getSystemValue('theme');
394 394
 		if (!empty($theme)) {
395
-			$transFile = $this->serverRoot . '/themes/' . $theme . substr($transFile, strlen($this->serverRoot));
395
+			$transFile = $this->serverRoot.'/themes/'.$theme.substr($transFile, strlen($this->serverRoot));
396 396
 			if (file_exists($transFile)) {
397 397
 				$languageFiles[] = $transFile;
398 398
 			}
@@ -409,14 +409,14 @@  discard block
 block discarded – undo
409 409
 	 */
410 410
 	protected function findL10nDir($app = null) {
411 411
 		if (in_array($app, ['core', 'lib', 'settings'])) {
412
-			if (file_exists($this->serverRoot . '/' . $app . '/l10n/')) {
413
-				return $this->serverRoot . '/' . $app . '/l10n/';
412
+			if (file_exists($this->serverRoot.'/'.$app.'/l10n/')) {
413
+				return $this->serverRoot.'/'.$app.'/l10n/';
414 414
 			}
415 415
 		} else if ($app && \OC_App::getAppPath($app) !== false) {
416 416
 			// Check if the app is in the app folder
417
-			return \OC_App::getAppPath($app) . '/l10n/';
417
+			return \OC_App::getAppPath($app).'/l10n/';
418 418
 		}
419
-		return $this->serverRoot . '/core/l10n/';
419
+		return $this->serverRoot.'/core/l10n/';
420 420
 	}
421 421
 
422 422
 
@@ -433,15 +433,15 @@  discard block
 block discarded – undo
433 433
 			return $this->pluralFunctions[$string];
434 434
 		}
435 435
 
436
-		if (preg_match( '/^\s*nplurals\s*=\s*(\d+)\s*;\s*plural=(.*)$/u', $string, $matches)) {
436
+		if (preg_match('/^\s*nplurals\s*=\s*(\d+)\s*;\s*plural=(.*)$/u', $string, $matches)) {
437 437
 			// sanitize
438
-			$nplurals = preg_replace( '/[^0-9]/', '', $matches[1] );
439
-			$plural = preg_replace( '#[^n0-9:\(\)\?\|\&=!<>+*/\%-]#', '', $matches[2] );
438
+			$nplurals = preg_replace('/[^0-9]/', '', $matches[1]);
439
+			$plural = preg_replace('#[^n0-9:\(\)\?\|\&=!<>+*/\%-]#', '', $matches[2]);
440 440
 
441 441
 			$body = str_replace(
442
-				array( 'plural', 'n', '$n$plurals', ),
443
-				array( '$plural', '$n', '$nplurals', ),
444
-				'nplurals='. $nplurals . '; plural=' . $plural
442
+				array('plural', 'n', '$n$plurals',),
443
+				array('$plural', '$n', '$nplurals',),
444
+				'nplurals='.$nplurals.'; plural='.$plural
445 445
 			);
446 446
 
447 447
 			// add parents
@@ -450,9 +450,9 @@  discard block
 block discarded – undo
450 450
 			$res = '';
451 451
 			$p = 0;
452 452
 			$length = strlen($body);
453
-			for($i = 0; $i < $length; $i++) {
453
+			for ($i = 0; $i < $length; $i++) {
454 454
 				$ch = $body[$i];
455
-				switch ( $ch ) {
455
+				switch ($ch) {
456 456
 					case '?':
457 457
 						$res .= ' ? (';
458 458
 						$p++;
@@ -461,7 +461,7 @@  discard block
 block discarded – undo
461 461
 						$res .= ') : (';
462 462
 						break;
463 463
 					case ';':
464
-						$res .= str_repeat( ')', $p ) . ';';
464
+						$res .= str_repeat(')', $p).';';
465 465
 						$p = 0;
466 466
 						break;
467 467
 					default:
@@ -469,7 +469,7 @@  discard block
 block discarded – undo
469 469
 				}
470 470
 			}
471 471
 
472
-			$body = $res . 'return ($plural>=$nplurals?$nplurals-1:$plural);';
472
+			$body = $res.'return ($plural>=$nplurals?$nplurals-1:$plural);';
473 473
 			$function = create_function('$n', $body);
474 474
 			$this->pluralFunctions[$string] = $function;
475 475
 			return $function;
@@ -501,7 +501,7 @@  discard block
 block discarded – undo
501 501
 		$commonLanguages = [];
502 502
 		$languages = [];
503 503
 
504
-		foreach($languageCodes as $lang) {
504
+		foreach ($languageCodes as $lang) {
505 505
 			$l = $this->get('lib', $lang);
506 506
 			// TRANSLATORS this is the language name for the language switcher in the personal settings and should be the localized version
507 507
 			$potentialName = (string) $l->t('__language_name__');
@@ -534,7 +534,7 @@  discard block
 block discarded – undo
534 534
 		ksort($commonLanguages);
535 535
 
536 536
 		// sort now by displayed language not the iso-code
537
-		usort( $languages, function ($a, $b) {
537
+		usort($languages, function($a, $b) {
538 538
 			if ($a['code'] === $a['name'] && $b['code'] !== $b['name']) {
539 539
 				// If a doesn't have a name, but b does, list b before a
540 540
 				return 1;
Please login to merge, or discard this patch.
apps/updatenotification/lib/Settings/Admin.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -116,40 +116,40 @@
 block discarded – undo
116 116
 
117 117
 	protected function filterChanges(array $changes) {
118 118
 		$filtered = [];
119
-		if(isset($changes['changelogURL'])) {
119
+		if (isset($changes['changelogURL'])) {
120 120
 			$filtered['changelogURL'] = $changes['changelogURL'];
121 121
 		}
122
-		if(!isset($changes['whatsNew'])) {
122
+		if (!isset($changes['whatsNew'])) {
123 123
 			return $filtered;
124 124
 		}
125 125
 
126 126
 		$isFirstCall = true;
127 127
 		do {
128 128
 			$lang = $this->l10nFactory->iterateLanguage($isFirstCall);
129
-			if($this->findWhatsNewTranslation($lang, $filtered, $changes['whatsNew'])) {
129
+			if ($this->findWhatsNewTranslation($lang, $filtered, $changes['whatsNew'])) {
130 130
 				return $filtered;
131 131
 			}
132 132
 			$isFirstCall = false;
133
-		} while($lang !== 'en');
133
+		} while ($lang !== 'en');
134 134
 
135 135
 		return $filtered;
136 136
 	}
137 137
 
138 138
 	protected function getLangTrunk(string $lang):string {
139 139
 		$pos = strpos($lang, '_');
140
-		if($pos !== false) {
140
+		if ($pos !== false) {
141 141
 			$lang = substr($lang, 0, $pos);
142 142
 		}
143 143
 		return $lang;
144 144
 	}
145 145
 
146 146
 	protected function findWhatsNewTranslation(string $lang, array &$result, array $whatsNew): bool {
147
-		if(isset($whatsNew[$lang])) {
147
+		if (isset($whatsNew[$lang])) {
148 148
 			$result['whatsNew'] = $whatsNew[$lang];
149 149
 			return true;
150 150
 		}
151 151
 		$trunkedLang = $this->getLangTrunk($lang);
152
-		if($trunkedLang !== $lang && isset($whatsNew[$trunkedLang])) {
152
+		if ($trunkedLang !== $lang && isset($whatsNew[$trunkedLang])) {
153 153
 			$result['whatsNew'] = $whatsNew[$trunkedLang];
154 154
 			return true;
155 155
 		}
Please login to merge, or discard this patch.
core/Migrations/Version14000Date20180626223656.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@
 block discarded – undo
31 31
 	public function changeSchema(\OCP\Migration\IOutput $output, \Closure $schemaClosure, array $options) {
32 32
 		/** @var ISchemaWrapper $schema */
33 33
 		$schema = $schemaClosure();
34
-		if(!$schema->hasTable('whats_new')) {
34
+		if (!$schema->hasTable('whats_new')) {
35 35
 			$table = $schema->createTable('whats_new');
36 36
 			$table->addColumn('id', 'integer', [
37 37
 				'autoincrement' => true,
Please login to merge, or discard this patch.