Passed
Push — master ( 3231b3...73e3d0 )
by John
12:14 queued 12s
created
apps/theming/lib/ImageManager.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
 		$cacheBusterCounter = $this->config->getAppValue('theming', 'cachebuster', '0');
81 81
 		try {
82 82
 			$image = $this->getImage($key, $useSvg);
83
-			return $this->urlGenerator->linkToRoute('theming.Theming.getImage', [ 'key' => $key ]) . '?v=' . $cacheBusterCounter;
83
+			return $this->urlGenerator->linkToRoute('theming.Theming.getImage', ['key' => $key]).'?v='.$cacheBusterCounter;
84 84
 		} catch (NotFoundException $e) {
85 85
 		}
86 86
 
@@ -88,9 +88,9 @@  discard block
 block discarded – undo
88 88
 			case 'logo':
89 89
 			case 'logoheader':
90 90
 			case 'favicon':
91
-				return $this->urlGenerator->imagePath('core', 'logo/logo.png') . '?v=' . $cacheBusterCounter;
91
+				return $this->urlGenerator->imagePath('core', 'logo/logo.png').'?v='.$cacheBusterCounter;
92 92
 			case 'background':
93
-				return $this->urlGenerator->imagePath('core', 'background.png') . '?v=' . $cacheBusterCounter;
93
+				return $this->urlGenerator->imagePath('core', 'background.png').'?v='.$cacheBusterCounter;
94 94
 		}
95 95
 		return '';
96 96
 	}
@@ -107,26 +107,26 @@  discard block
 block discarded – undo
107 107
 	 * @throws NotPermittedException
108 108
 	 */
109 109
 	public function getImage(string $key, bool $useSvg = true): ISimpleFile {
110
-		$logo = $this->config->getAppValue('theming', $key . 'Mime', '');
110
+		$logo = $this->config->getAppValue('theming', $key.'Mime', '');
111 111
 		$folder = $this->appData->getFolder('images');
112 112
 		if ($logo === '' || !$folder->fileExists($key)) {
113 113
 			throw new NotFoundException();
114 114
 		}
115 115
 		if (!$useSvg && $this->shouldReplaceIcons()) {
116
-			if (!$folder->fileExists($key . '.png')) {
116
+			if (!$folder->fileExists($key.'.png')) {
117 117
 				try {
118 118
 					$finalIconFile = new \Imagick();
119 119
 					$finalIconFile->setBackgroundColor('none');
120 120
 					$finalIconFile->readImageBlob($folder->getFile($key)->getContent());
121 121
 					$finalIconFile->setImageFormat('png32');
122
-					$pngFile = $folder->newFile($key . '.png');
122
+					$pngFile = $folder->newFile($key.'.png');
123 123
 					$pngFile->putContent($finalIconFile->getImageBlob());
124 124
 					return $pngFile;
125 125
 				} catch (\ImagickException $e) {
126
-					$this->logger->info('The image was requested to be no SVG file, but converting it to PNG failed: ' . $e->getMessage());
126
+					$this->logger->info('The image was requested to be no SVG file, but converting it to PNG failed: '.$e->getMessage());
127 127
 				}
128 128
 			} else {
129
-				return $folder->getFile($key . '.png');
129
+				return $folder->getFile($key.'.png');
130 130
 			}
131 131
 		}
132 132
 		return $folder->getFile($key);
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
 		$images = [];
140 140
 		foreach ($this->supportedImageKeys as $key) {
141 141
 			$images[$key] = [
142
-				'mime' => $this->config->getAppValue('theming', $key . 'Mime', ''),
142
+				'mime' => $this->config->getAppValue('theming', $key.'Mime', ''),
143 143
 				'url' => $this->getImageUrl($key),
144 144
 			];
145 145
 		}
@@ -205,7 +205,7 @@  discard block
 block discarded – undo
205 205
 		} catch (NotPermittedException $e) {
206 206
 		}
207 207
 		try {
208
-			$file = $this->appData->getFolder('images')->getFile($key . '.png');
208
+			$file = $this->appData->getFolder('images')->getFile($key.'.png');
209 209
 			$file->delete();
210 210
 		} catch (NotFoundException $e) {
211 211
 		} catch (NotPermittedException $e) {
@@ -238,8 +238,8 @@  discard block
 block discarded – undo
238 238
 			imagealphablending($newImage, true);
239 239
 
240 240
 			$tmpFile = $this->tempManager->getTemporaryFile();
241
-			$newWidth = (int)(imagesx($newImage) < 4096 ? imagesx($newImage) : 4096);
242
-			$newHeight = (int)(imagesy($newImage) / (imagesx($newImage) / $newWidth));
241
+			$newWidth = (int) (imagesx($newImage) < 4096 ? imagesx($newImage) : 4096);
242
+			$newHeight = (int) (imagesy($newImage) / (imagesx($newImage) / $newWidth));
243 243
 			$outputImage = imagescale($newImage, $newWidth, $newHeight);
244 244
 
245 245
 			imageinterlace($outputImage, 1);
@@ -300,9 +300,9 @@  discard block
 block discarded – undo
300 300
 	 * @return bool
301 301
 	 */
302 302
 	public function shouldReplaceIcons() {
303
-		$cache = $this->cacheFactory->createDistributed('theming-' . $this->urlGenerator->getBaseUrl());
303
+		$cache = $this->cacheFactory->createDistributed('theming-'.$this->urlGenerator->getBaseUrl());
304 304
 		if ($value = $cache->get('shouldReplaceIcons')) {
305
-			return (bool)$value;
305
+			return (bool) $value;
306 306
 		}
307 307
 		$value = false;
308 308
 		if (extension_loaded('imagick')) {
Please login to merge, or discard this patch.
apps/theming/lib/Controller/IconController.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -87,13 +87,13 @@  discard block
 block discarded – undo
87 87
 	 */
88 88
 	public function getThemedIcon(string $app, string $image): Response {
89 89
 		try {
90
-			$iconFile = $this->imageManager->getCachedImage('icon-' . $app . '-' . str_replace('/', '_',$image));
90
+			$iconFile = $this->imageManager->getCachedImage('icon-'.$app.'-'.str_replace('/', '_', $image));
91 91
 		} catch (NotFoundException $exception) {
92 92
 			$icon = $this->iconBuilder->colorSvg($app, $image);
93 93
 			if ($icon === false || $icon === '') {
94 94
 				return new NotFoundResponse();
95 95
 			}
96
-			$iconFile = $this->imageManager->setCachedImage('icon-' . $app . '-' . str_replace('/', '_',$image), $icon);
96
+			$iconFile = $this->imageManager->setCachedImage('icon-'.$app.'-'.str_replace('/', '_', $image), $icon);
97 97
 		}
98 98
 		$response = new FileDisplayResponse($iconFile, Http::STATUS_OK, ['Content-Type' => 'image/svg+xml']);
99 99
 		$response->cacheFor(86400);
@@ -120,18 +120,18 @@  discard block
 block discarded – undo
120 120
 		}
121 121
 		if ($iconFile === null && $this->imageManager->shouldReplaceIcons()) {
122 122
 			try {
123
-				$iconFile = $this->imageManager->getCachedImage('favIcon-' . $app);
123
+				$iconFile = $this->imageManager->getCachedImage('favIcon-'.$app);
124 124
 			} catch (NotFoundException $exception) {
125 125
 				$icon = $this->iconBuilder->getFavicon($app);
126 126
 				if ($icon === false || $icon === '') {
127 127
 					return new NotFoundResponse();
128 128
 				}
129
-				$iconFile = $this->imageManager->setCachedImage('favIcon-' . $app, $icon);
129
+				$iconFile = $this->imageManager->setCachedImage('favIcon-'.$app, $icon);
130 130
 			}
131 131
 			$response = new FileDisplayResponse($iconFile, Http::STATUS_OK, ['Content-Type' => 'image/x-icon']);
132 132
 		}
133 133
 		if ($response === null) {
134
-			$fallbackLogo = \OC::$SERVERROOT . '/core/img/favicon.png';
134
+			$fallbackLogo = \OC::$SERVERROOT.'/core/img/favicon.png';
135 135
 			$response = new DataDisplayResponse($this->fileAccessHelper->file_get_contents($fallbackLogo), Http::STATUS_OK, ['Content-Type' => 'image/x-icon']);
136 136
 		}
137 137
 		$response->cacheFor(86400);
@@ -157,18 +157,18 @@  discard block
 block discarded – undo
157 157
 		}
158 158
 		if ($this->imageManager->shouldReplaceIcons()) {
159 159
 			try {
160
-				$iconFile = $this->imageManager->getCachedImage('touchIcon-' . $app);
160
+				$iconFile = $this->imageManager->getCachedImage('touchIcon-'.$app);
161 161
 			} catch (NotFoundException $exception) {
162 162
 				$icon = $this->iconBuilder->getTouchIcon($app);
163 163
 				if ($icon === false || $icon === '') {
164 164
 					return new NotFoundResponse();
165 165
 				}
166
-				$iconFile = $this->imageManager->setCachedImage('touchIcon-' . $app, $icon);
166
+				$iconFile = $this->imageManager->setCachedImage('touchIcon-'.$app, $icon);
167 167
 			}
168 168
 			$response = new FileDisplayResponse($iconFile, Http::STATUS_OK, ['Content-Type' => 'image/png']);
169 169
 		}
170 170
 		if ($response === null) {
171
-			$fallbackLogo = \OC::$SERVERROOT . '/core/img/favicon-touch.png';
171
+			$fallbackLogo = \OC::$SERVERROOT.'/core/img/favicon-touch.png';
172 172
 			$response = new DataDisplayResponse($this->fileAccessHelper->file_get_contents($fallbackLogo), Http::STATUS_OK, ['Content-Type' => 'image/png']);
173 173
 		}
174 174
 		$response->cacheFor(86400);
Please login to merge, or discard this patch.
apps/theming/lib/Util.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
 	public function hexToRGB($color) {
161 161
 		$hex = preg_replace("/[^0-9A-Fa-f]/", '', $color);
162 162
 		if (strlen($hex) === 3) {
163
-			$hex = $hex[0] . $hex[0] . $hex[1] . $hex[1] . $hex[2] . $hex[2];
163
+			$hex = $hex[0].$hex[0].$hex[1].$hex[1].$hex[2].$hex[2];
164 164
 		}
165 165
 		if (strlen($hex) !== 6) {
166 166
 			return [0, 0, 0];
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
 	 * @return string base64 encoded radio button svg
178 178
 	 */
179 179
 	public function generateRadioButton($color) {
180
-		$radioButtonIcon = '<svg xmlns="http://www.w3.org/2000/svg" height="16" width="16">' .
180
+		$radioButtonIcon = '<svg xmlns="http://www.w3.org/2000/svg" height="16" width="16">'.
181 181
 			'<path d="M8 1a7 7 0 0 0-7 7 7 7 0 0 0 7 7 7 7 0 0 0 7-7 7 7 0 0 0-7-7zm0 1a6 6 0 0 1 6 6 6 6 0 0 1-6 6 6 6 0 0 1-6-6 6 6 0 0 1 6-6zm0 2a4 4 0 1 0 0 8 4 4 0 0 0 0-8z" fill="'.$color.'"/></svg>';
182 182
 		return base64_encode($radioButtonIcon);
183 183
 	}
@@ -191,11 +191,11 @@  discard block
 block discarded – undo
191 191
 		$app = str_replace(['\0', '/', '\\', '..'], '', $app);
192 192
 		try {
193 193
 			$appPath = $this->appManager->getAppPath($app);
194
-			$icon = $appPath . '/img/' . $app . '.svg';
194
+			$icon = $appPath.'/img/'.$app.'.svg';
195 195
 			if (file_exists($icon)) {
196 196
 				return $icon;
197 197
 			}
198
-			$icon = $appPath . '/img/app.svg';
198
+			$icon = $appPath.'/img/app.svg';
199 199
 			if (file_exists($icon)) {
200 200
 				return $icon;
201 201
 			}
@@ -210,7 +210,7 @@  discard block
 block discarded – undo
210 210
 			} catch (NotFoundException $e) {
211 211
 			}
212 212
 		}
213
-		return \OC::$SERVERROOT . '/core/img/logo/logo.svg';
213
+		return \OC::$SERVERROOT.'/core/img/logo/logo.svg';
214 214
 	}
215 215
 
216 216
 	/**
@@ -222,7 +222,7 @@  discard block
 block discarded – undo
222 222
 		$app = str_replace(['\0', '/', '\\', '..'], '', $app);
223 223
 		$image = str_replace(['\0', '\\', '..'], '', $image);
224 224
 		if ($app === "core") {
225
-			$icon = \OC::$SERVERROOT . '/core/img/' . $image;
225
+			$icon = \OC::$SERVERROOT.'/core/img/'.$image;
226 226
 			if (file_exists($icon)) {
227 227
 				return $icon;
228 228
 			}
@@ -234,23 +234,23 @@  discard block
 block discarded – undo
234 234
 			return false;
235 235
 		}
236 236
 
237
-		$icon = $appPath . '/img/' . $image;
237
+		$icon = $appPath.'/img/'.$image;
238 238
 		if (file_exists($icon)) {
239 239
 			return $icon;
240 240
 		}
241
-		$icon = $appPath . '/img/' . $image . '.svg';
241
+		$icon = $appPath.'/img/'.$image.'.svg';
242 242
 		if (file_exists($icon)) {
243 243
 			return $icon;
244 244
 		}
245
-		$icon = $appPath . '/img/' . $image . '.png';
245
+		$icon = $appPath.'/img/'.$image.'.png';
246 246
 		if (file_exists($icon)) {
247 247
 			return $icon;
248 248
 		}
249
-		$icon = $appPath . '/img/' . $image . '.gif';
249
+		$icon = $appPath.'/img/'.$image.'.gif';
250 250
 		if (file_exists($icon)) {
251 251
 			return $icon;
252 252
 		}
253
-		$icon = $appPath . '/img/' . $image . '.jpg';
253
+		$icon = $appPath.'/img/'.$image.'.jpg';
254 254
 		if (file_exists($icon)) {
255 255
 			return $icon;
256 256
 		}
Please login to merge, or discard this patch.
apps/theming/lib/ThemingDefaults.php 1 patch
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -167,37 +167,37 @@  discard block
 block discarded – undo
167 167
 	}
168 168
 
169 169
 	public function getImprintUrl() {
170
-		return (string)$this->config->getAppValue('theming', 'imprintUrl', '');
170
+		return (string) $this->config->getAppValue('theming', 'imprintUrl', '');
171 171
 	}
172 172
 
173 173
 	public function getPrivacyUrl() {
174
-		return (string)$this->config->getAppValue('theming', 'privacyUrl', '');
174
+		return (string) $this->config->getAppValue('theming', 'privacyUrl', '');
175 175
 	}
176 176
 
177 177
 	public function getShortFooter() {
178 178
 		$slogan = $this->getSlogan();
179 179
 		$baseUrl = $this->getBaseUrl();
180 180
 		if ($baseUrl !== '') {
181
-			$footer = '<a href="' . $baseUrl . '" target="_blank"' .
182
-				' rel="noreferrer noopener" class="entity-name">' . $this->getEntity() . '</a>';
181
+			$footer = '<a href="'.$baseUrl.'" target="_blank"'.
182
+				' rel="noreferrer noopener" class="entity-name">'.$this->getEntity().'</a>';
183 183
 		} else {
184
-			$footer = '<span class="entity-name">' .$this->getEntity() . '</span>';
184
+			$footer = '<span class="entity-name">'.$this->getEntity().'</span>';
185 185
 		}
186
-		$footer .= ($slogan !== '' ? ' – ' . $slogan : '');
186
+		$footer .= ($slogan !== '' ? ' – '.$slogan : '');
187 187
 
188 188
 		$links = [
189 189
 			[
190 190
 				'text' => $this->l->t('Legal notice'),
191
-				'url' => (string)$this->getImprintUrl()
191
+				'url' => (string) $this->getImprintUrl()
192 192
 			],
193 193
 			[
194 194
 				'text' => $this->l->t('Privacy policy'),
195
-				'url' => (string)$this->getPrivacyUrl()
195
+				'url' => (string) $this->getPrivacyUrl()
196 196
 			],
197 197
 		];
198 198
 
199 199
 		$navigation = $this->navigationManager->getAll(INavigationManager::TYPE_GUEST);
200
-		$guestNavigation = array_map(function ($nav) {
200
+		$guestNavigation = array_map(function($nav) {
201 201
 			return [
202 202
 				'text' => $nav['name'],
203 203
 				'url' => $nav['href']
@@ -211,13 +211,13 @@  discard block
 block discarded – undo
211 211
 			if ($link['url'] !== ''
212 212
 				&& filter_var($link['url'], FILTER_VALIDATE_URL)
213 213
 			) {
214
-				$legalLinks .= $divider . '<a href="' . $link['url'] . '" class="legal" target="_blank"' .
215
-					' rel="noreferrer noopener">' . $link['text'] . '</a>';
214
+				$legalLinks .= $divider.'<a href="'.$link['url'].'" class="legal" target="_blank"'.
215
+					' rel="noreferrer noopener">'.$link['text'].'</a>';
216 216
 				$divider = ' · ';
217 217
 			}
218 218
 		}
219 219
 		if ($legalLinks !== '') {
220
-			$footer .= '<br/>' . $legalLinks;
220
+			$footer .= '<br/>'.$legalLinks;
221 221
 		}
222 222
 
223 223
 		return $footer;
@@ -269,10 +269,10 @@  discard block
 block discarded – undo
269 269
 			} else {
270 270
 				$logo = $this->urlGenerator->imagePath('core', 'logo/logo.png');
271 271
 			}
272
-			return $logo . '?v=' . $cacheBusterCounter;
272
+			return $logo.'?v='.$cacheBusterCounter;
273 273
 		}
274 274
 
275
-		return $this->urlGenerator->linkToRoute('theming.Theming.getImage', [ 'key' => 'logo', 'useSvg' => $useSvg, 'v' => $cacheBusterCounter ]);
275
+		return $this->urlGenerator->linkToRoute('theming.Theming.getImage', ['key' => 'logo', 'useSvg' => $useSvg, 'v' => $cacheBusterCounter]);
276 276
 	}
277 277
 
278 278
 	/**
@@ -317,17 +317,17 @@  discard block
 block discarded – undo
317 317
 	 */
318 318
 	public function getScssVariables() {
319 319
 		$cacheBuster = $this->config->getAppValue('theming', 'cachebuster', '0');
320
-		$cache = $this->cacheFactory->createDistributed('theming-' . $cacheBuster . '-' . $this->urlGenerator->getBaseUrl());
320
+		$cache = $this->cacheFactory->createDistributed('theming-'.$cacheBuster.'-'.$this->urlGenerator->getBaseUrl());
321 321
 		if ($value = $cache->get('getScssVariables')) {
322 322
 			return $value;
323 323
 		}
324 324
 
325 325
 		$variables = [
326
-			'theming-cachebuster' => "'" . $cacheBuster . "'",
327
-			'theming-logo-mime' => "'" . $this->config->getAppValue('theming', 'logoMime') . "'",
328
-			'theming-background-mime' => "'" . $this->config->getAppValue('theming', 'backgroundMime') . "'",
329
-			'theming-logoheader-mime' => "'" . $this->config->getAppValue('theming', 'logoheaderMime') . "'",
330
-			'theming-favicon-mime' => "'" . $this->config->getAppValue('theming', 'faviconMime') . "'"
326
+			'theming-cachebuster' => "'".$cacheBuster."'",
327
+			'theming-logo-mime' => "'".$this->config->getAppValue('theming', 'logoMime')."'",
328
+			'theming-background-mime' => "'".$this->config->getAppValue('theming', 'backgroundMime')."'",
329
+			'theming-logoheader-mime' => "'".$this->config->getAppValue('theming', 'logoheaderMime')."'",
330
+			'theming-favicon-mime' => "'".$this->config->getAppValue('theming', 'faviconMime')."'"
331 331
 		];
332 332
 
333 333
 		$variables['image-logo'] = "url('".$this->imageManager->getImageUrl('logo')."')";
@@ -379,19 +379,19 @@  discard block
 block discarded – undo
379 379
 		if ($image === 'manifest.json') {
380 380
 			try {
381 381
 				$appPath = $this->appManager->getAppPath($app);
382
-				if (file_exists($appPath . '/img/manifest.json')) {
382
+				if (file_exists($appPath.'/img/manifest.json')) {
383 383
 					return false;
384 384
 				}
385 385
 			} catch (AppPathNotFoundException $e) {
386 386
 			}
387
-			$route = $this->urlGenerator->linkToRoute('theming.Theming.getManifest', ['app' => $app ]);
387
+			$route = $this->urlGenerator->linkToRoute('theming.Theming.getManifest', ['app' => $app]);
388 388
 		}
389
-		if (strpos($image, 'filetypes/') === 0 && file_exists(\OC::$SERVERROOT . '/core/img/' . $image)) {
389
+		if (strpos($image, 'filetypes/') === 0 && file_exists(\OC::$SERVERROOT.'/core/img/'.$image)) {
390 390
 			$route = $this->urlGenerator->linkToRoute('theming.Icon.getThemedIcon', ['app' => $app, 'image' => $image]);
391 391
 		}
392 392
 
393 393
 		if ($route) {
394
-			return $route . '?v=' . $cacheBusterValue;
394
+			return $route.'?v='.$cacheBusterValue;
395 395
 		}
396 396
 
397 397
 		return false;
@@ -409,8 +409,8 @@  discard block
 block discarded – undo
409 409
 	 * Increases the cache buster key
410 410
 	 */
411 411
 	private function increaseCacheBuster(): void {
412
-		$cacheBusterKey = (int)$this->config->getAppValue('theming', 'cachebuster', '0');
413
-		$this->config->setAppValue('theming', 'cachebuster', (string)($cacheBusterKey + 1));
412
+		$cacheBusterKey = (int) $this->config->getAppValue('theming', 'cachebuster', '0');
413
+		$this->config->setAppValue('theming', 'cachebuster', (string) ($cacheBusterKey + 1));
414 414
 		$this->cacheFactory->createDistributed('theming-')->clear();
415 415
 		$this->cacheFactory->createDistributed('imagePath')->clear();
416 416
 	}
Please login to merge, or discard this patch.
apps/testing/lib/Controller/LockingController.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
 	 */
95 95
 	protected function getPath(string $user, string $path): string {
96 96
 		$node = $this->rootFolder->getUserFolder($user)->get($path);
97
-		return 'files/' . md5($node->getStorage()->getId() . '::' . trim($node->getInternalPath(), '/'));
97
+		return 'files/'.md5($node->getStorage()->getId().'::'.trim($node->getInternalPath(), '/'));
98 98
 	}
99 99
 
100 100
 	/**
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
 
126 126
 		try {
127 127
 			$lockingProvider->acquireLock($path, $type);
128
-			$this->config->setAppValue('testing', 'locking_' . $path, (string)$type);
128
+			$this->config->setAppValue('testing', 'locking_'.$path, (string) $type);
129 129
 			return new DataResponse();
130 130
 		} catch (LockedException $e) {
131 131
 			throw new OCSException('', Http::STATUS_LOCKED, $e);
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
 
149 149
 		try {
150 150
 			$lockingProvider->changeLock($path, $type);
151
-			$this->config->setAppValue('testing', 'locking_' . $path, (string)$type);
151
+			$this->config->setAppValue('testing', 'locking_'.$path, (string) $type);
152 152
 			return new DataResponse();
153 153
 		} catch (LockedException $e) {
154 154
 			throw new OCSException('', Http::STATUS_LOCKED, $e);
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
 
172 172
 		try {
173 173
 			$lockingProvider->releaseLock($path, $type);
174
-			$this->config->deleteAppValue('testing', 'locking_' . $path);
174
+			$this->config->deleteAppValue('testing', 'locking_'.$path);
175 175
 			return new DataResponse();
176 176
 		} catch (LockedException $e) {
177 177
 			throw new OCSException('', Http::STATUS_LOCKED, $e);
@@ -206,12 +206,12 @@  discard block
 block discarded – undo
206 206
 			if (strpos($lock, 'locking_') === 0) {
207 207
 				$path = substr($lock, strlen('locking_'));
208 208
 
209
-				if ($type === ILockingProvider::LOCK_EXCLUSIVE && (int)$this->config->getAppValue('testing', $lock) === ILockingProvider::LOCK_EXCLUSIVE) {
210
-					$lockingProvider->releaseLock($path, (int)$this->config->getAppValue('testing', $lock));
211
-				} elseif ($type === ILockingProvider::LOCK_SHARED && (int)$this->config->getAppValue('testing', $lock) === ILockingProvider::LOCK_SHARED) {
212
-					$lockingProvider->releaseLock($path, (int)$this->config->getAppValue('testing', $lock));
209
+				if ($type === ILockingProvider::LOCK_EXCLUSIVE && (int) $this->config->getAppValue('testing', $lock) === ILockingProvider::LOCK_EXCLUSIVE) {
210
+					$lockingProvider->releaseLock($path, (int) $this->config->getAppValue('testing', $lock));
211
+				} elseif ($type === ILockingProvider::LOCK_SHARED && (int) $this->config->getAppValue('testing', $lock) === ILockingProvider::LOCK_SHARED) {
212
+					$lockingProvider->releaseLock($path, (int) $this->config->getAppValue('testing', $lock));
213 213
 				} else {
214
-					$lockingProvider->releaseLock($path, (int)$this->config->getAppValue('testing', $lock));
214
+					$lockingProvider->releaseLock($path, (int) $this->config->getAppValue('testing', $lock));
215 215
 				}
216 216
 			}
217 217
 		}
Please login to merge, or discard this patch.
lib/private/legacy/OC_Util.php 1 patch
Spacing   +44 added lines, -44 removed lines patch added patch discarded remove patch
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
 
93 93
 	private static function initLocalStorageRootFS() {
94 94
 		// mount local file backend as root
95
-		$configDataDirectory = \OC::$server->getSystemConfig()->getValue("datadirectory", OC::$SERVERROOT . "/data");
95
+		$configDataDirectory = \OC::$server->getSystemConfig()->getValue("datadirectory", OC::$SERVERROOT."/data");
96 96
 		//first set up the local "root" storage
97 97
 		\OC\Files\Filesystem::initMountManager();
98 98
 		if (!self::$rootMounted) {
@@ -214,7 +214,7 @@  discard block
 block discarded – undo
214 214
 		\OC\Files\Filesystem::initMountManager();
215 215
 
216 216
 		$prevLogging = \OC\Files\Filesystem::logWarningWhenAddingStorageWrapper(false);
217
-		\OC\Files\Filesystem::addStorageWrapper('mount_options', function ($mountPoint, \OCP\Files\Storage $storage, \OCP\Files\Mount\IMountPoint $mount) {
217
+		\OC\Files\Filesystem::addStorageWrapper('mount_options', function($mountPoint, \OCP\Files\Storage $storage, \OCP\Files\Mount\IMountPoint $mount) {
218 218
 			if ($storage->instanceOfStorage('\OC\Files\Storage\Common')) {
219 219
 				/** @var \OC\Files\Storage\Common $storage */
220 220
 				$storage->setMountOptions($mount->getOptions());
@@ -222,7 +222,7 @@  discard block
 block discarded – undo
222 222
 			return $storage;
223 223
 		});
224 224
 
225
-		\OC\Files\Filesystem::addStorageWrapper('enable_sharing', function ($mountPoint, \OCP\Files\Storage\IStorage $storage, \OCP\Files\Mount\IMountPoint $mount) {
225
+		\OC\Files\Filesystem::addStorageWrapper('enable_sharing', function($mountPoint, \OCP\Files\Storage\IStorage $storage, \OCP\Files\Mount\IMountPoint $mount) {
226 226
 			if (!$mount->getOption('enable_sharing', true)) {
227 227
 				return new \OC\Files\Storage\Wrapper\PermissionsMask([
228 228
 					'storage' => $storage,
@@ -233,21 +233,21 @@  discard block
 block discarded – undo
233 233
 		});
234 234
 
235 235
 		// install storage availability wrapper, before most other wrappers
236
-		\OC\Files\Filesystem::addStorageWrapper('oc_availability', function ($mountPoint, \OCP\Files\Storage\IStorage $storage) {
236
+		\OC\Files\Filesystem::addStorageWrapper('oc_availability', function($mountPoint, \OCP\Files\Storage\IStorage $storage) {
237 237
 			if (!$storage->instanceOfStorage('\OCA\Files_Sharing\SharedStorage') && !$storage->isLocal()) {
238 238
 				return new \OC\Files\Storage\Wrapper\Availability(['storage' => $storage]);
239 239
 			}
240 240
 			return $storage;
241 241
 		});
242 242
 
243
-		\OC\Files\Filesystem::addStorageWrapper('oc_encoding', function ($mountPoint, \OCP\Files\Storage $storage, \OCP\Files\Mount\IMountPoint $mount) {
243
+		\OC\Files\Filesystem::addStorageWrapper('oc_encoding', function($mountPoint, \OCP\Files\Storage $storage, \OCP\Files\Mount\IMountPoint $mount) {
244 244
 			if ($mount->getOption('encoding_compatibility', false) && !$storage->instanceOfStorage('\OCA\Files_Sharing\SharedStorage') && !$storage->isLocal()) {
245 245
 				return new \OC\Files\Storage\Wrapper\Encoding(['storage' => $storage]);
246 246
 			}
247 247
 			return $storage;
248 248
 		});
249 249
 
250
-		\OC\Files\Filesystem::addStorageWrapper('oc_quota', function ($mountPoint, $storage) {
250
+		\OC\Files\Filesystem::addStorageWrapper('oc_quota', function($mountPoint, $storage) {
251 251
 			// set up quota for home storages, even for other users
252 252
 			// which can happen when using sharing
253 253
 
@@ -269,7 +269,7 @@  discard block
 block discarded – undo
269 269
 			return $storage;
270 270
 		});
271 271
 
272
-		\OC\Files\Filesystem::addStorageWrapper('readonly', function ($mountPoint, \OCP\Files\Storage\IStorage $storage, \OCP\Files\Mount\IMountPoint $mount) {
272
+		\OC\Files\Filesystem::addStorageWrapper('readonly', function($mountPoint, \OCP\Files\Storage\IStorage $storage, \OCP\Files\Mount\IMountPoint $mount) {
273 273
 			/*
274 274
 			 * Do not allow any operations that modify the storage
275 275
 			 */
@@ -320,7 +320,7 @@  discard block
 block discarded – undo
320 320
 
321 321
 		//if we aren't logged in, there is no use to set up the filesystem
322 322
 		if ($user != "") {
323
-			$userDir = '/' . $user . '/files';
323
+			$userDir = '/'.$user.'/files';
324 324
 
325 325
 			//jail the user into his "home" directory
326 326
 			\OC\Files\Filesystem::init($user, $userDir);
@@ -399,7 +399,7 @@  discard block
 block discarded – undo
399 399
 		/** @var LoggerInterface $logger */
400 400
 		$logger = \OC::$server->get(LoggerInterface::class);
401 401
 
402
-		$plainSkeletonDirectory = \OC::$server->getConfig()->getSystemValue('skeletondirectory', \OC::$SERVERROOT . '/core/skeleton');
402
+		$plainSkeletonDirectory = \OC::$server->getConfig()->getSystemValue('skeletondirectory', \OC::$SERVERROOT.'/core/skeleton');
403 403
 		$userLang = \OC::$server->getL10NFactory()->findLanguage();
404 404
 		$skeletonDirectory = str_replace('{lang}', $userLang, $plainSkeletonDirectory);
405 405
 
@@ -421,9 +421,9 @@  discard block
 block discarded – undo
421 421
 		if ($instanceId === null) {
422 422
 			throw new \RuntimeException('no instance id!');
423 423
 		}
424
-		$appdata = 'appdata_' . $instanceId;
424
+		$appdata = 'appdata_'.$instanceId;
425 425
 		if ($userId === $appdata) {
426
-			throw new \RuntimeException('username is reserved name: ' . $appdata);
426
+			throw new \RuntimeException('username is reserved name: '.$appdata);
427 427
 		}
428 428
 
429 429
 		if (!empty($skeletonDirectory)) {
@@ -458,14 +458,14 @@  discard block
 block discarded – undo
458 458
 		// Copy the files
459 459
 		while (false !== ($file = readdir($dir))) {
460 460
 			if (!\OC\Files\Filesystem::isIgnoredDir($file)) {
461
-				if (is_dir($source . '/' . $file)) {
461
+				if (is_dir($source.'/'.$file)) {
462 462
 					$child = $target->newFolder($file);
463
-					self::copyr($source . '/' . $file, $child);
463
+					self::copyr($source.'/'.$file, $child);
464 464
 				} else {
465 465
 					$child = $target->newFile($file);
466
-					$sourceStream = fopen($source . '/' . $file, 'r');
466
+					$sourceStream = fopen($source.'/'.$file, 'r');
467 467
 					if ($sourceStream === false) {
468
-						$logger->error(sprintf('Could not fopen "%s"', $source . '/' . $file), ['app' => 'core']);
468
+						$logger->error(sprintf('Could not fopen "%s"', $source.'/'.$file), ['app' => 'core']);
469 469
 						closedir($dir);
470 470
 						return;
471 471
 					}
@@ -542,8 +542,8 @@  discard block
 block discarded – undo
542 542
 			return;
543 543
 		}
544 544
 
545
-		$timestamp = filemtime(OC::$SERVERROOT . '/version.php');
546
-		require OC::$SERVERROOT . '/version.php';
545
+		$timestamp = filemtime(OC::$SERVERROOT.'/version.php');
546
+		require OC::$SERVERROOT.'/version.php';
547 547
 		/** @var int $timestamp */
548 548
 		self::$versionCache['OC_Version_Timestamp'] = $timestamp;
549 549
 		/** @var string $OC_Version */
@@ -717,7 +717,7 @@  discard block
 block discarded – undo
717 717
 	public static function checkServer(\OC\SystemConfig $config) {
718 718
 		$l = \OC::$server->getL10N('lib');
719 719
 		$errors = [];
720
-		$CONFIG_DATADIRECTORY = $config->getValue('datadirectory', OC::$SERVERROOT . '/data');
720
+		$CONFIG_DATADIRECTORY = $config->getValue('datadirectory', OC::$SERVERROOT.'/data');
721 721
 
722 722
 		if (!self::needUpgrade($config) && $config->getValue('installed', false)) {
723 723
 			// this check needs to be done every time
@@ -757,9 +757,9 @@  discard block
 block discarded – undo
757 757
 				$errors[] = [
758 758
 					'error' => $l->t('Cannot write into "config" directory.'),
759 759
 					'hint' => $l->t('This can usually be fixed by giving the web server write access to the config directory. See %s',
760
-						[ $urlGenerator->linkToDocs('admin-dir_permissions') ]) . '. '
760
+						[$urlGenerator->linkToDocs('admin-dir_permissions')]).'. '
761 761
 						. $l->t('Or, if you prefer to keep config.php file read only, set the option "config_is_read_only" to true in it. See %s',
762
-						[ $urlGenerator->linkToDocs('admin-config') ])
762
+						[$urlGenerator->linkToDocs('admin-config')])
763 763
 				];
764 764
 			}
765 765
 		}
@@ -933,7 +933,7 @@  discard block
 block discarded – undo
933 933
 			$version -= ($minor * 100);
934 934
 			$patch = $version;
935 935
 			$errors[] = [
936
-				'error' => $l->t('libxml2 2.7.0 is at least required. Currently %s is installed.', [$major . '.' . $minor . '.' . $patch]),
936
+				'error' => $l->t('libxml2 2.7.0 is at least required. Currently %s is installed.', [$major.'.'.$minor.'.'.$patch]),
937 937
 				'hint' => $l->t('To fix this issue update your libxml2 version and restart your web server.')
938 938
 			];
939 939
 		}
@@ -1036,10 +1036,10 @@  discard block
 block discarded – undo
1036 1036
 				'hint' => $l->t('Check the value of "datadirectory" in your configuration.')
1037 1037
 			];
1038 1038
 		}
1039
-		if (!file_exists($dataDirectory . '/.ocdata')) {
1039
+		if (!file_exists($dataDirectory.'/.ocdata')) {
1040 1040
 			$errors[] = [
1041 1041
 				'error' => $l->t('Your data directory is invalid.'),
1042
-				'hint' => $l->t('Ensure there is a file called ".ocdata"' .
1042
+				'hint' => $l->t('Ensure there is a file called ".ocdata"'.
1043 1043
 					' in the root of the data directory.')
1044 1044
 			];
1045 1045
 		}
@@ -1055,7 +1055,7 @@  discard block
 block discarded – undo
1055 1055
 	public static function checkLoggedIn() {
1056 1056
 		// Check if we are a user
1057 1057
 		if (!\OC::$server->getUserSession()->isLoggedIn()) {
1058
-			header('Location: ' . \OC::$server->getURLGenerator()->linkToRoute(
1058
+			header('Location: '.\OC::$server->getURLGenerator()->linkToRoute(
1059 1059
 						'core.login.showLoginForm',
1060 1060
 						[
1061 1061
 							'redirect_url' => \OC::$server->getRequest()->getRequestUri(),
@@ -1066,7 +1066,7 @@  discard block
 block discarded – undo
1066 1066
 		}
1067 1067
 		// Redirect to 2FA challenge selection if 2FA challenge was not solved yet
1068 1068
 		if (\OC::$server->getTwoFactorAuthManager()->needsSecondFactor(\OC::$server->getUserSession()->getUser())) {
1069
-			header('Location: ' . \OC::$server->getURLGenerator()->linkToRoute('core.TwoFactorChallenge.selectChallenge'));
1069
+			header('Location: '.\OC::$server->getURLGenerator()->linkToRoute('core.TwoFactorChallenge.selectChallenge'));
1070 1070
 			exit();
1071 1071
 		}
1072 1072
 	}
@@ -1079,7 +1079,7 @@  discard block
 block discarded – undo
1079 1079
 	public static function checkAdminUser() {
1080 1080
 		OC_Util::checkLoggedIn();
1081 1081
 		if (!OC_User::isAdminUser(OC_User::getUser())) {
1082
-			header('Location: ' . \OCP\Util::linkToAbsolute('', 'index.php'));
1082
+			header('Location: '.\OCP\Util::linkToAbsolute('', 'index.php'));
1083 1083
 			exit();
1084 1084
 		}
1085 1085
 	}
@@ -1105,7 +1105,7 @@  discard block
 block discarded – undo
1105 1105
 	 */
1106 1106
 	public static function redirectToDefaultPage() {
1107 1107
 		$location = self::getDefaultPageUrl();
1108
-		header('Location: ' . $location);
1108
+		header('Location: '.$location);
1109 1109
 		exit();
1110 1110
 	}
1111 1111
 
@@ -1118,7 +1118,7 @@  discard block
 block discarded – undo
1118 1118
 		$id = \OC::$server->getSystemConfig()->getValue('instanceid', null);
1119 1119
 		if (is_null($id)) {
1120 1120
 			// We need to guarantee at least one letter in instanceid so it can be used as the session_name
1121
-			$id = 'oc' . \OC::$server->getSecureRandom()->generate(10, \OCP\Security\ISecureRandom::CHAR_LOWER.\OCP\Security\ISecureRandom::CHAR_DIGITS);
1121
+			$id = 'oc'.\OC::$server->getSecureRandom()->generate(10, \OCP\Security\ISecureRandom::CHAR_LOWER.\OCP\Security\ISecureRandom::CHAR_DIGITS);
1122 1122
 			\OC::$server->getSystemConfig()->setValue('instanceid', $id);
1123 1123
 		}
1124 1124
 		return $id;
@@ -1136,12 +1136,12 @@  discard block
 block discarded – undo
1136 1136
 	public static function sanitizeHTML($value) {
1137 1137
 		if (is_array($value)) {
1138 1138
 			/** @var string[] $value */
1139
-			$value = array_map(function ($value) {
1139
+			$value = array_map(function($value) {
1140 1140
 				return self::sanitizeHTML($value);
1141 1141
 			}, $value);
1142 1142
 		} else {
1143 1143
 			// Specify encoding for PHP<5.4
1144
-			$value = htmlspecialchars((string)$value, ENT_QUOTES, 'UTF-8');
1144
+			$value = htmlspecialchars((string) $value, ENT_QUOTES, 'UTF-8');
1145 1145
 		}
1146 1146
 		return $value;
1147 1147
 	}
@@ -1174,7 +1174,7 @@  discard block
 block discarded – undo
1174 1174
 		$testContent = 'This is used for testing whether htaccess is properly enabled to disallow access from the outside. This file can be safely removed.';
1175 1175
 
1176 1176
 		// creating a test file
1177
-		$testFile = $config->getSystemValue('datadirectory', OC::$SERVERROOT . '/data') . '/' . $fileName;
1177
+		$testFile = $config->getSystemValue('datadirectory', OC::$SERVERROOT.'/data').'/'.$fileName;
1178 1178
 
1179 1179
 		if (file_exists($testFile)) {// already running this test, possible recursive call
1180 1180
 			return false;
@@ -1183,7 +1183,7 @@  discard block
 block discarded – undo
1183 1183
 		$fp = @fopen($testFile, 'w');
1184 1184
 		if (!$fp) {
1185 1185
 			throw new \OCP\HintException('Can\'t create test file to check for working .htaccess file.',
1186
-				'Make sure it is possible for the web server to write to ' . $testFile);
1186
+				'Make sure it is possible for the web server to write to '.$testFile);
1187 1187
 		}
1188 1188
 		fwrite($fp, $testContent);
1189 1189
 		fclose($fp);
@@ -1210,10 +1210,10 @@  discard block
 block discarded – undo
1210 1210
 		}
1211 1211
 
1212 1212
 		$fileName = '/htaccesstest.txt';
1213
-		$testFile = $config->getSystemValue('datadirectory', OC::$SERVERROOT . '/data') . '/' . $fileName;
1213
+		$testFile = $config->getSystemValue('datadirectory', OC::$SERVERROOT.'/data').'/'.$fileName;
1214 1214
 
1215 1215
 		// accessing the file via http
1216
-		$url = \OC::$server->getURLGenerator()->getAbsoluteURL(OC::$WEBROOT . '/data' . $fileName);
1216
+		$url = \OC::$server->getURLGenerator()->getAbsoluteURL(OC::$WEBROOT.'/data'.$fileName);
1217 1217
 		try {
1218 1218
 			$content = \OC::$server->getHTTPClientService()->newClient()->get($url)->getBody();
1219 1219
 		} catch (\Exception $e) {
@@ -1221,9 +1221,9 @@  discard block
 block discarded – undo
1221 1221
 		}
1222 1222
 
1223 1223
 		if (strpos($url, 'https:') === 0) {
1224
-			$url = 'http:' . substr($url, 6);
1224
+			$url = 'http:'.substr($url, 6);
1225 1225
 		} else {
1226
-			$url = 'https:' . substr($url, 5);
1226
+			$url = 'https:'.substr($url, 5);
1227 1227
 		}
1228 1228
 
1229 1229
 		try {
@@ -1329,7 +1329,7 @@  discard block
 block discarded – undo
1329 1329
 		$theme = \OC::$server->getSystemConfig()->getValue("theme", '');
1330 1330
 
1331 1331
 		if ($theme === '') {
1332
-			if (is_dir(OC::$SERVERROOT . '/themes/default')) {
1332
+			if (is_dir(OC::$SERVERROOT.'/themes/default')) {
1333 1333
 				$theme = 'default';
1334 1334
 			}
1335 1335
 		}
@@ -1350,7 +1350,7 @@  discard block
 block discarded – undo
1350 1350
 
1351 1351
 		$normalizedValue = Normalizer::normalize($value);
1352 1352
 		if ($normalizedValue === null || $normalizedValue === false) {
1353
-			\OC::$server->getLogger()->warning('normalizing failed for "' . $value . '"', ['app' => 'core']);
1353
+			\OC::$server->getLogger()->warning('normalizing failed for "'.$value.'"', ['app' => 'core']);
1354 1354
 			return $value;
1355 1355
 		}
1356 1356
 
@@ -1366,7 +1366,7 @@  discard block
 block discarded – undo
1366 1366
 		$version = OC_Util::getVersionString();
1367 1367
 		$build = OC_Util::getBuild();
1368 1368
 		if (!empty($build) and OC_Util::getChannel() === 'daily') {
1369
-			$version .= ' Build:' . $build;
1369
+			$version .= ' Build:'.$build;
1370 1370
 		}
1371 1371
 		return $version;
1372 1372
 	}
@@ -1388,7 +1388,7 @@  discard block
 block discarded – undo
1388 1388
 		}
1389 1389
 
1390 1390
 		// detect part files
1391
-		if (preg_match('/' . \OCP\Files\FileInfo::BLACKLIST_FILES_REGEX . '/', $trimmed) !== 0) {
1391
+		if (preg_match('/'.\OCP\Files\FileInfo::BLACKLIST_FILES_REGEX.'/', $trimmed) !== 0) {
1392 1392
 			return false;
1393 1393
 		}
1394 1394
 
@@ -1419,19 +1419,19 @@  discard block
 block discarded – undo
1419 1419
 			} elseif ($config->getValue('debug', false) && $versionDiff < 0) {
1420 1420
 				// downgrade with debug
1421 1421
 				$installedMajor = explode('.', $installedVersion);
1422
-				$installedMajor = $installedMajor[0] . '.' . $installedMajor[1];
1422
+				$installedMajor = $installedMajor[0].'.'.$installedMajor[1];
1423 1423
 				$currentMajor = explode('.', $currentVersion);
1424
-				$currentMajor = $currentMajor[0] . '.' . $currentMajor[1];
1424
+				$currentMajor = $currentMajor[0].'.'.$currentMajor[1];
1425 1425
 				if ($installedMajor === $currentMajor) {
1426 1426
 					// Same major, allow downgrade for developers
1427 1427
 					return true;
1428 1428
 				} else {
1429 1429
 					// downgrade attempt, throw exception
1430
-					throw new \OCP\HintException('Downgrading is not supported and is likely to cause unpredictable issues (from ' . $installedVersion . ' to ' . $currentVersion . ')');
1430
+					throw new \OCP\HintException('Downgrading is not supported and is likely to cause unpredictable issues (from '.$installedVersion.' to '.$currentVersion.')');
1431 1431
 				}
1432 1432
 			} elseif ($versionDiff < 0) {
1433 1433
 				// downgrade attempt, throw exception
1434
-				throw new \OCP\HintException('Downgrading is not supported and is likely to cause unpredictable issues (from ' . $installedVersion . ' to ' . $currentVersion . ')');
1434
+				throw new \OCP\HintException('Downgrading is not supported and is likely to cause unpredictable issues (from '.$installedVersion.' to '.$currentVersion.')');
1435 1435
 			}
1436 1436
 
1437 1437
 			// also check for upgrades for apps (independently from the user)
Please login to merge, or discard this patch.