Completed
Pull Request — master (#7490)
by Tobia
19:43 queued 01:32
created
apps/dav/lib/CardDAV/Converter.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -119,9 +119,9 @@
 block discarded – undo
119 119
 		$elements = explode(' ', $fullName);
120 120
 		$result = ['', '', '', '', ''];
121 121
 		if (count($elements) > 2) {
122
-			$result[0] = implode(' ', array_slice($elements, count($elements)-1));
122
+			$result[0] = implode(' ', array_slice($elements, count($elements) - 1));
123 123
 			$result[1] = $elements[0];
124
-			$result[2] = implode(' ', array_slice($elements, 1, count($elements)-2));
124
+			$result[2] = implode(' ', array_slice($elements, 1, count($elements) - 2));
125 125
 		} elseif (count($elements) === 2) {
126 126
 			$result[0] = $elements[1];
127 127
 			$result[1] = $elements[0];
Please login to merge, or discard this patch.
lib/private/OCS/DiscoveryService.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -60,8 +60,8 @@  discard block
 block discarded – undo
60 60
 	 */
61 61
 	public function discover($remote, $service) {
62 62
 		// Check the cache first
63
-		$cacheData = $this->cache->get($remote . '#' . $service);
64
-		if($cacheData) {
63
+		$cacheData = $this->cache->get($remote.'#'.$service);
64
+		if ($cacheData) {
65 65
 			return json_decode($cacheData, true);
66 66
 		}
67 67
 
@@ -69,11 +69,11 @@  discard block
 block discarded – undo
69 69
 
70 70
 		// query the remote server for available services
71 71
 		try {
72
-			$response = $this->client->get($remote . '/ocs-provider/', [
72
+			$response = $this->client->get($remote.'/ocs-provider/', [
73 73
 				'timeout' => 10,
74 74
 				'connect_timeout' => 10,
75 75
 			]);
76
-			if($response->getStatusCode() === Http::STATUS_OK) {
76
+			if ($response->getStatusCode() === Http::STATUS_OK) {
77 77
 				$decodedServices = json_decode($response->getBody(), true);
78 78
 				$discoveredServices = $this->getEndpoints($decodedServices, $service);
79 79
 			}
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
 		}
84 84
 
85 85
 		// Write into cache
86
-		$this->cache->set($remote . '#' . $service, json_encode($discoveredServices));
86
+		$this->cache->set($remote.'#'.$service, json_encode($discoveredServices));
87 87
 		return $discoveredServices;
88 88
 	}
89 89
 
@@ -98,11 +98,11 @@  discard block
 block discarded – undo
98 98
 
99 99
 		$discoveredServices = [];
100 100
 
101
-		if(is_array($decodedServices) &&
101
+		if (is_array($decodedServices) &&
102 102
 			isset($decodedServices['services'][$service]['endpoints'])
103 103
 		) {
104 104
 			foreach ($decodedServices['services'][$service]['endpoints'] as $endpoint => $url) {
105
-				if($this->isSafeUrl($url)) {
105
+				if ($this->isSafeUrl($url)) {
106 106
 					$discoveredServices[$endpoint] = $url;
107 107
 				}
108 108
 			}
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
 	 * @return bool
120 120
 	 */
121 121
 	protected function isSafeUrl($url) {
122
-		return (bool)preg_match('/^[\/\.\-A-Za-z0-9]+$/', $url);
122
+		return (bool) preg_match('/^[\/\.\-A-Za-z0-9]+$/', $url);
123 123
 	}
124 124
 
125 125
 }
Please login to merge, or discard this patch.
lib/private/Updater/VersionCheck.php 1 patch
Spacing   +7 added lines, -7 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,11 +93,11 @@  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['autoupdater'] = (string)$data->autoupdater;
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['autoupdater'] = (string) $data->autoupdater;
101 101
 			} else {
102 102
 				libxml_clear_errors();
103 103
 			}
Please login to merge, or discard this patch.
lib/private/Setup/Sqlite.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -33,10 +33,10 @@
 block discarded – undo
33 33
 	}
34 34
 
35 35
 	public function setupDatabase($username) {
36
-		$datadir = $this->config->getValue('datadirectory', \OC::$SERVERROOT . '/data');
36
+		$datadir = $this->config->getValue('datadirectory', \OC::$SERVERROOT.'/data');
37 37
 
38 38
 		//delete the old sqlite database first, might cause infinte loops otherwise
39
-		if(file_exists("$datadir/owncloud.db")) {
39
+		if (file_exists("$datadir/owncloud.db")) {
40 40
 			unlink("$datadir/owncloud.db");
41 41
 		}
42 42
 		//in case of sqlite, we can always fill the database
Please login to merge, or discard this patch.
apps/dav/lib/Connector/Sabre/DummyGetResponsePlugin.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -57,9 +57,9 @@
 block discarded – undo
57 57
 	 * @return false
58 58
 	 */
59 59
 	function httpGet(RequestInterface $request, ResponseInterface $response) {
60
-		$string = 'This is the WebDAV interface. It can only be accessed by ' .
60
+		$string = 'This is the WebDAV interface. It can only be accessed by '.
61 61
 			'WebDAV clients such as the Nextcloud desktop sync client.';
62
-		$stream = fopen('php://memory','r+');
62
+		$stream = fopen('php://memory', 'r+');
63 63
 		fwrite($stream, $string);
64 64
 		rewind($stream);
65 65
 
Please login to merge, or discard this patch.
lib/private/Preview/Generator.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
 	public function getPreview(File $file, $width = -1, $height = -1, $crop = false, $mode = IPreview::MODE_FILL, $mimeType = null) {
89 89
 		$this->eventDispatcher->dispatch(
90 90
 			IPreview::EVENT,
91
-			new GenericEvent($file,[
91
+			new GenericEvent($file, [
92 92
 				'width' => $width,
93 93
 				'height' => $height,
94 94
 				'crop' => $crop,
@@ -155,8 +155,8 @@  discard block
 block discarded – undo
155 155
 					continue;
156 156
 				}
157 157
 
158
-				$maxWidth = (int)$this->config->getSystemValue('preview_max_x', 2048);
159
-				$maxHeight = (int)$this->config->getSystemValue('preview_max_y', 2048);
158
+				$maxWidth = (int) $this->config->getSystemValue('preview_max_x', 2048);
159
+				$maxHeight = (int) $this->config->getSystemValue('preview_max_y', 2048);
160 160
 
161 161
 				$preview = $this->helper->getThumbnail($provider, $file, $maxWidth, $maxHeight);
162 162
 
@@ -164,7 +164,7 @@  discard block
 block discarded – undo
164 164
 					continue;
165 165
 				}
166 166
 
167
-				$path = (string)$preview->width() . '-' . (string)$preview->height() . '-max.png';
167
+				$path = (string) $preview->width().'-'.(string) $preview->height().'-max.png';
168 168
 				try {
169 169
 					$file = $previewFolder->newFile($path);
170 170
 					$file->putContent($preview->data());
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
 	 */
186 186
 	private function getPreviewSize(ISimpleFile $file) {
187 187
 		$size = explode('-', $file->getName());
188
-		return [(int)$size[0], (int)$size[1]];
188
+		return [(int) $size[0], (int) $size[1]];
189 189
 	}
190 190
 
191 191
 	/**
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
 	 * @return string
196 196
 	 */
197 197
 	private function generatePath($width, $height, $crop) {
198
-		$path = (string)$width . '-' . (string)$height;
198
+		$path = (string) $width.'-'.(string) $height;
199 199
 		if ($crop) {
200 200
 			$path .= '-crop';
201 201
 		}
@@ -286,7 +286,7 @@  discard block
 block discarded – undo
286 286
 			$height /= $ratio;
287 287
 		}
288 288
 
289
-		return [(int)round($width), (int)round($height)];
289
+		return [(int) round($width), (int) round($height)];
290 290
 	}
291 291
 
292 292
 	/**
Please login to merge, or discard this patch.
lib/private/Repair/Collation.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
 		$tables = $this->getAllNonUTF8BinTables($this->connection);
77 77
 		foreach ($tables as $table) {
78 78
 			$output->info("Change row format for $table ...");
79
-			$query = $this->connection->prepare('ALTER TABLE `' . $table . '` ROW_FORMAT = DYNAMIC;');
79
+			$query = $this->connection->prepare('ALTER TABLE `'.$table.'` ROW_FORMAT = DYNAMIC;');
80 80
 			try {
81 81
 				$query->execute();
82 82
 			} catch (DriverException $e) {
@@ -90,10 +90,10 @@  discard block
 block discarded – undo
90 90
 			$output->info("Change collation for $table ...");
91 91
 			if ($characterSet === 'utf8mb4') {
92 92
 				// need to set row compression first
93
-				$query = $this->connection->prepare('ALTER TABLE `' . $table . '` ROW_FORMAT=COMPRESSED;');
93
+				$query = $this->connection->prepare('ALTER TABLE `'.$table.'` ROW_FORMAT=COMPRESSED;');
94 94
 				$query->execute();
95 95
 			}
96
-			$query = $this->connection->prepare('ALTER TABLE `' . $table . '` CONVERT TO CHARACTER SET ' . $characterSet . ' COLLATE ' . $characterSet . '_bin;');
96
+			$query = $this->connection->prepare('ALTER TABLE `'.$table.'` CONVERT TO CHARACTER SET '.$characterSet.' COLLATE '.$characterSet.'_bin;');
97 97
 			try {
98 98
 				$query->execute();
99 99
 			} catch (DriverException $e) {
@@ -119,10 +119,10 @@  discard block
 block discarded – undo
119 119
 
120 120
 		// fetch tables by columns
121 121
 		$statement = $connection->executeQuery(
122
-			"SELECT DISTINCT(TABLE_NAME) AS `table`" .
123
-			"	FROM INFORMATION_SCHEMA . COLUMNS" .
124
-			"	WHERE TABLE_SCHEMA = ?" .
125
-			"	AND (COLLATION_NAME <> '" . $characterSet . "_bin' OR CHARACTER_SET_NAME <> '" . $characterSet . "')" .
122
+			"SELECT DISTINCT(TABLE_NAME) AS `table`".
123
+			"	FROM INFORMATION_SCHEMA . COLUMNS".
124
+			"	WHERE TABLE_SCHEMA = ?".
125
+			"	AND (COLLATION_NAME <> '".$characterSet."_bin' OR CHARACTER_SET_NAME <> '".$characterSet."')".
126 126
 			"	AND TABLE_NAME LIKE \"*PREFIX*%\"",
127 127
 			array($dbName)
128 128
 		);
@@ -134,10 +134,10 @@  discard block
 block discarded – undo
134 134
 
135 135
 		// fetch tables by collation
136 136
 		$statement = $connection->executeQuery(
137
-			"SELECT DISTINCT(TABLE_NAME) AS `table`" .
138
-			"	FROM INFORMATION_SCHEMA . TABLES" .
139
-			"	WHERE TABLE_SCHEMA = ?" .
140
-			"	AND TABLE_COLLATION <> '" . $characterSet . "_bin'" .
137
+			"SELECT DISTINCT(TABLE_NAME) AS `table`".
138
+			"	FROM INFORMATION_SCHEMA . TABLES".
139
+			"	WHERE TABLE_SCHEMA = ?".
140
+			"	AND TABLE_COLLATION <> '".$characterSet."_bin'".
141 141
 			"	AND TABLE_NAME LIKE \"*PREFIX*%\"",
142 142
 			[$dbName]
143 143
 		);
Please login to merge, or discard this patch.
lib/private/Authentication/Token/DefaultTokenProvider.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -253,10 +253,10 @@  discard block
 block discarded – undo
253 253
 	 */
254 254
 	public function invalidateOldTokens() {
255 255
 		$olderThan = $this->time->getTime() - (int) $this->config->getSystemValue('session_lifetime', 60 * 60 * 24);
256
-		$this->logger->debug('Invalidating session tokens older than ' . date('c', $olderThan), ['app' => 'cron']);
256
+		$this->logger->debug('Invalidating session tokens older than '.date('c', $olderThan), ['app' => 'cron']);
257 257
 		$this->mapper->invalidateOld($olderThan, IToken::DO_NOT_REMEMBER);
258 258
 		$rememberThreshold = $this->time->getTime() - (int) $this->config->getSystemValue('remember_login_cookie_lifetime', 60 * 60 * 24 * 15);
259
-		$this->logger->debug('Invalidating remembered session tokens older than ' . date('c', $rememberThreshold), ['app' => 'cron']);
259
+		$this->logger->debug('Invalidating remembered session tokens older than '.date('c', $rememberThreshold), ['app' => 'cron']);
260 260
 		$this->mapper->invalidateOld($rememberThreshold, IToken::REMEMBER);
261 261
 	}
262 262
 
@@ -266,7 +266,7 @@  discard block
 block discarded – undo
266 266
 	 */
267 267
 	private function hashToken($token) {
268 268
 		$secret = $this->config->getSystemValue('secret');
269
-		return hash('sha512', $token . $secret);
269
+		return hash('sha512', $token.$secret);
270 270
 	}
271 271
 
272 272
 	/**
@@ -280,7 +280,7 @@  discard block
 block discarded – undo
280 280
 	 */
281 281
 	private function encryptPassword($password, $token) {
282 282
 		$secret = $this->config->getSystemValue('secret');
283
-		return $this->crypto->encrypt($password, $token . $secret);
283
+		return $this->crypto->encrypt($password, $token.$secret);
284 284
 	}
285 285
 
286 286
 	/**
@@ -296,7 +296,7 @@  discard block
 block discarded – undo
296 296
 	private function decryptPassword($password, $token) {
297 297
 		$secret = $this->config->getSystemValue('secret');
298 298
 		try {
299
-			return $this->crypto->decrypt($password, $token . $secret);
299
+			return $this->crypto->decrypt($password, $token.$secret);
300 300
 		} catch (Exception $ex) {
301 301
 			// Delete the invalid token
302 302
 			$this->invalidateToken($token);
Please login to merge, or discard this patch.
lib/private/App/AppManager.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -106,11 +106,11 @@  discard block
 block discarded – undo
106 106
 			$values = $this->appConfig->getValues(false, 'enabled');
107 107
 
108 108
 			$alwaysEnabledApps = $this->getAlwaysEnabledApps();
109
-			foreach($alwaysEnabledApps as $appId) {
109
+			foreach ($alwaysEnabledApps as $appId) {
110 110
 				$values[$appId] = 'yes';
111 111
 			}
112 112
 
113
-			$this->installedAppsCache = array_filter($values, function ($value) {
113
+			$this->installedAppsCache = array_filter($values, function($value) {
114 114
 				return $value !== 'no';
115 115
 			});
116 116
 			ksort($this->installedAppsCache);
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
 	 */
136 136
 	public function getEnabledAppsForUser(IUser $user) {
137 137
 		$apps = $this->getInstalledAppsValues();
138
-		$appsForUser = array_filter($apps, function ($enabled) use ($user) {
138
+		$appsForUser = array_filter($apps, function($enabled) use ($user) {
139 139
 			return $this->checkAppForUser($enabled, $user);
140 140
 		});
141 141
 		return array_keys($appsForUser);
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
 		} elseif ($user === null) {
175 175
 			return false;
176 176
 		} else {
177
-			if(empty($enabled)){
177
+			if (empty($enabled)) {
178 178
 				return false;
179 179
 			}
180 180
 
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
 
183 183
 			if (!is_array($groupIds)) {
184 184
 				$jsonError = json_last_error();
185
-				\OC::$server->getLogger()->warning('AppManger::checkAppForUser - can\'t decode group IDs: ' . print_r($enabled, true) . ' - json error code: ' . $jsonError, ['app' => 'lib']);
185
+				\OC::$server->getLogger()->warning('AppManger::checkAppForUser - can\'t decode group IDs: '.print_r($enabled, true).' - json error code: '.$jsonError, ['app' => 'lib']);
186 186
 				return false;
187 187
 			}
188 188
 
@@ -256,7 +256,7 @@  discard block
 block discarded – undo
256 256
 			}
257 257
 		}
258 258
 
259
-		$groupIds = array_map(function ($group) {
259
+		$groupIds = array_map(function($group) {
260 260
 			/** @var \OCP\IGroup $group */
261 261
 			return $group->getGID();
262 262
 		}, $groups);
@@ -295,8 +295,8 @@  discard block
 block discarded – undo
295 295
 	 */
296 296
 	public function getAppPath($appId) {
297 297
 		$appPath = \OC_App::getAppPath($appId);
298
-		if($appPath === false) {
299
-			throw new AppPathNotFoundException('Could not find path for ' . $appId);
298
+		if ($appPath === false) {
299
+			throw new AppPathNotFoundException('Could not find path for '.$appId);
300 300
 		}
301 301
 		return $appPath;
302 302
 	}
@@ -389,7 +389,7 @@  discard block
 block discarded – undo
389 389
 
390 390
 	private function loadShippedJson() {
391 391
 		if ($this->shippedApps === null) {
392
-			$shippedJson = \OC::$SERVERROOT . '/core/shipped.json';
392
+			$shippedJson = \OC::$SERVERROOT.'/core/shipped.json';
393 393
 			if (!file_exists($shippedJson)) {
394 394
 				throw new \Exception("File not found: $shippedJson");
395 395
 			}
Please login to merge, or discard this patch.