Completed
Push — stable12 ( b91394...cede17 )
by
unknown
30:59 queued 20:45
created
apps/dav/lib/Comments/CommentNode.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -93,7 +93,7 @@
 block discarded – undo
93 93
 	/**
94 94
 	 * returns a list of all possible property names
95 95
 	 *
96
-	 * @return array
96
+	 * @return string[]
97 97
 	 */
98 98
 	static public function getPropertyNames() {
99 99
 		return [
Please login to merge, or discard this patch.
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -86,14 +86,14 @@  discard block
 block discarded – undo
86 86
 		$this->logger = $logger;
87 87
 
88 88
 		$methods = get_class_methods($this->comment);
89
-		$methods = array_filter($methods, function($name){
89
+		$methods = array_filter($methods, function($name) {
90 90
 			return strpos($name, 'get') === 0;
91 91
 		});
92
-		foreach($methods as $getter) {
93
-			if($getter === 'getMentions') {
94
-				continue;	// special treatment
92
+		foreach ($methods as $getter) {
93
+			if ($getter === 'getMentions') {
94
+				continue; // special treatment
95 95
 			}
96
-			$name = '{'.self::NS_OWNCLOUD.'}' . lcfirst(substr($getter, 3));
96
+			$name = '{'.self::NS_OWNCLOUD.'}'.lcfirst(substr($getter, 3));
97 97
 			$this->properties[$name] = $getter;
98 98
 		}
99 99
 		$this->userManager = $userManager;
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
 
133 133
 	protected function checkWriteAccessOnComment() {
134 134
 		$user = $this->userSession->getUser();
135
-		if(    $this->comment->getActorType() !== 'users'
135
+		if ($this->comment->getActorType() !== 'users'
136 136
 			|| is_null($user)
137 137
 			|| $this->comment->getActorId() !== $user->getUID()
138 138
 		) {
@@ -196,9 +196,9 @@  discard block
 block discarded – undo
196 196
 			return true;
197 197
 		} catch (\Exception $e) {
198 198
 			$this->logger->logException($e, ['app' => 'dav/comments']);
199
-			if($e instanceof MessageTooLongException) {
199
+			if ($e instanceof MessageTooLongException) {
200 200
 				$msg = 'Message exceeds allowed character limit of ';
201
-				throw new BadRequest($msg . IComment::MAX_MESSAGE_LENGTH, 0, $e);
201
+				throw new BadRequest($msg.IComment::MAX_MESSAGE_LENGTH, 0, $e);
202 202
 			}
203 203
 			throw $e;
204 204
 		}
@@ -240,14 +240,14 @@  discard block
 block discarded – undo
240 240
 		$properties = array_keys($this->properties);
241 241
 
242 242
 		$result = [];
243
-		foreach($properties as $property) {
243
+		foreach ($properties as $property) {
244 244
 			$getter = $this->properties[$property];
245
-			if(method_exists($this->comment, $getter)) {
245
+			if (method_exists($this->comment, $getter)) {
246 246
 				$result[$property] = $this->comment->$getter();
247 247
 			}
248 248
 		}
249 249
 
250
-		if($this->comment->getActorType() === 'users') {
250
+		if ($this->comment->getActorType() === 'users') {
251 251
 			$user = $this->userManager->get($this->comment->getActorId());
252 252
 			$displayName = is_null($user) ? null : $user->getDisplayName();
253 253
 			$result[self::PROPERTY_NAME_ACTOR_DISPLAYNAME] = $displayName;
@@ -256,14 +256,14 @@  discard block
 block discarded – undo
256 256
 		$result[self::PROPERTY_NAME_MENTIONS] = $this->composeMentionsPropertyValue();
257 257
 
258 258
 		$unread = null;
259
-		$user =  $this->userSession->getUser();
260
-		if(!is_null($user)) {
259
+		$user = $this->userSession->getUser();
260
+		if (!is_null($user)) {
261 261
 			$readUntil = $this->commentsManager->getReadMark(
262 262
 				$this->comment->getObjectType(),
263 263
 				$this->comment->getObjectId(),
264 264
 				$user
265 265
 			);
266
-			if(is_null($readUntil)) {
266
+			if (is_null($readUntil)) {
267 267
 				$unread = 'true';
268 268
 			} else {
269 269
 				$unread = $this->comment->getCreationDateTime() > $readUntil;
Please login to merge, or discard this patch.
apps/dav/lib/Comments/CommentsPlugin.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -138,7 +138,7 @@
 block discarded – undo
138 138
 	 * This will be used in the {DAV:}supported-report-set property.
139 139
 	 *
140 140
 	 * @param string $uri
141
-	 * @return array
141
+	 * @return string[]
142 142
 	 */
143 143
 	public function getSupportedReportSet($uri) {
144 144
 		return [self::REPORT_NAME];
Please login to merge, or discard this patch.
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
 	 */
85 85
 	function initialize(Server $server) {
86 86
 		$this->server = $server;
87
-		if(strpos($this->server->getRequestUri(), 'comments/') !== 0) {
87
+		if (strpos($this->server->getRequestUri(), 'comments/') !== 0) {
88 88
 			return;
89 89
 		}
90 90
 
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
 		// having their own comments marked as unread
125 125
 		$node->setReadMarker(null);
126 126
 
127
-		$url = rtrim($request->getUrl(), '/') . '/' . urlencode($comment->getId());
127
+		$url = rtrim($request->getUrl(), '/').'/'.urlencode($comment->getId());
128 128
 
129 129
 		$response->setHeader('Content-Location', $url);
130 130
 
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
 	 */
158 158
 	public function onReport($reportName, $report, $uri) {
159 159
 		$node = $this->server->tree->getNodeForPath($uri);
160
-		if(!$node instanceof EntityCollection || $reportName !== self::REPORT_NAME) {
160
+		if (!$node instanceof EntityCollection || $reportName !== self::REPORT_NAME) {
161 161
 			throw new ReportNotSupported();
162 162
 		}
163 163
 		$args = ['limit' => 0, 'offset' => 0, 'datetime' => null];
@@ -166,27 +166,27 @@  discard block
 block discarded – undo
166 166
 			$this::REPORT_PARAM_OFFSET,
167 167
 			$this::REPORT_PARAM_TIMESTAMP
168 168
 		];
169
-		$ns = '{' . $this::NS_OWNCLOUD . '}';
170
-		foreach($report as $parameter) {
171
-			if(!in_array($parameter['name'], $acceptableParameters) || empty($parameter['value'])) {
169
+		$ns = '{'.$this::NS_OWNCLOUD.'}';
170
+		foreach ($report as $parameter) {
171
+			if (!in_array($parameter['name'], $acceptableParameters) || empty($parameter['value'])) {
172 172
 				continue;
173 173
 			}
174 174
 			$args[str_replace($ns, '', $parameter['name'])] = $parameter['value'];
175 175
 		}
176 176
 
177
-		if(!is_null($args['datetime'])) {
177
+		if (!is_null($args['datetime'])) {
178 178
 			$args['datetime'] = new \DateTime($args['datetime']);
179 179
 		}
180 180
 
181 181
 		$results = $node->findChildren($args['limit'], $args['offset'], $args['datetime']);
182 182
 
183 183
 		$responses = [];
184
-		foreach($results as $node) {
185
-			$nodePath = $this->server->getRequestUri() . '/' . $node->comment->getId();
184
+		foreach ($results as $node) {
185
+			$nodePath = $this->server->getRequestUri().'/'.$node->comment->getId();
186 186
 			$resultSet = $this->server->getPropertiesForPath($nodePath, CommentNode::getPropertyNames());
187
-			if(isset($resultSet[0]) && isset($resultSet[0][200])) {
187
+			if (isset($resultSet[0]) && isset($resultSet[0][200])) {
188 188
 				$responses[] = new Response(
189
-					$this->server->getBaseUri() . $nodePath,
189
+					$this->server->getBaseUri().$nodePath,
190 190
 					[200 => $resultSet[0][200]],
191 191
 					200
192 192
 				);
@@ -227,14 +227,14 @@  discard block
 block discarded – undo
227 227
 
228 228
 		$actorType = $data['actorType'];
229 229
 		$actorId = null;
230
-		if($actorType === 'users') {
230
+		if ($actorType === 'users') {
231 231
 			$user = $this->userSession->getUser();
232
-			if(!is_null($user)) {
232
+			if (!is_null($user)) {
233 233
 				$actorId = $user->getUID();
234 234
 			}
235 235
 		}
236
-		if(is_null($actorId)) {
237
-			throw new BadRequest('Invalid actor "' .  $actorType .'"');
236
+		if (is_null($actorId)) {
237
+			throw new BadRequest('Invalid actor "'.$actorType.'"');
238 238
 		}
239 239
 
240 240
 		try {
@@ -247,7 +247,7 @@  discard block
 block discarded – undo
247 247
 			throw new BadRequest('Invalid input values', 0, $e);
248 248
 		} catch (\OCP\Comments\MessageTooLongException $e) {
249 249
 			$msg = 'Message exceeds allowed character limit of ';
250
-			throw new BadRequest($msg . \OCP\Comments\IComment::MAX_MESSAGE_LENGTH, 0,	$e);
250
+			throw new BadRequest($msg.\OCP\Comments\IComment::MAX_MESSAGE_LENGTH, 0, $e);
251 251
 		}
252 252
 	}
253 253
 
Please login to merge, or discard this patch.
apps/dav/lib/Comments/EntityCollection.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -115,7 +115,7 @@
 block discarded – undo
115 115
 	/**
116 116
 	 * Returns an array with all the child nodes
117 117
 	 *
118
-	 * @return \Sabre\DAV\INode[]
118
+	 * @return CommentNode[]
119 119
 	 */
120 120
 	function getChildren() {
121 121
 		return $this->findChildren();
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
  * @package OCA\DAV\Comments
42 42
  */
43 43
 class EntityCollection extends RootCollection implements IProperties {
44
-	const PROPERTY_NAME_READ_MARKER  = '{http://owncloud.org/ns}readMarker';
44
+	const PROPERTY_NAME_READ_MARKER = '{http://owncloud.org/ns}readMarker';
45 45
 
46 46
 	/** @var  string */
47 47
 	protected $id;
@@ -65,10 +65,10 @@  discard block
 block discarded – undo
65 65
 		IUserSession $userSession,
66 66
 		ILogger $logger
67 67
 	) {
68
-		foreach(['id', 'name'] as $property) {
68
+		foreach (['id', 'name'] as $property) {
69 69
 			$$property = trim($$property);
70
-			if(empty($$property) || !is_string($$property)) {
71
-				throw new \InvalidArgumentException('"' . $property . '" parameter must be non-empty string');
70
+			if (empty($$property) || !is_string($$property)) {
71
+				throw new \InvalidArgumentException('"'.$property.'" parameter must be non-empty string');
72 72
 			}
73 73
 		}
74 74
 		$this->id = $id;
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
 	function findChildren($limit = 0, $offset = 0, \DateTime $datetime = null) {
135 135
 		$comments = $this->commentsManager->getForObject($this->name, $this->id, $limit, $offset, $datetime);
136 136
 		$result = [];
137
-		foreach($comments as $comment) {
137
+		foreach ($comments as $comment) {
138 138
 			$result[] = new CommentNode(
139 139
 				$this->commentsManager,
140 140
 				$comment,
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
 	function getProperties($properties) {
188 188
 		$marker = null;
189 189
 		$user = $this->userSession->getUser();
190
-		if(!is_null($user)) {
190
+		if (!is_null($user)) {
191 191
 			$marker = $this->commentsManager->getReadMark($this->name, $this->id, $user);
192 192
 		}
193 193
 		return [self::PROPERTY_NAME_READ_MARKER => $marker];
Please login to merge, or discard this patch.
apps/dav/lib/Connector/Sabre/CustomPropertiesBackend.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -75,7 +75,7 @@
 block discarded – undo
75 75
 	private $cache = [];
76 76
 
77 77
 	/**
78
-	 * @param Tree $tree node tree
78
+	 * @param ObjectTree $tree node tree
79 79
 	 * @param IDBConnection $connection database connection
80 80
 	 * @param IUser $user owner of the tree and properties
81 81
 	 */
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
 			// we catch the exception to prevent breaking the whole list with a 404
112 112
 			// (soft fail)
113 113
 			\OC::$server->getLogger()->warning(
114
-				'Could not get node for path: \"' . $path . '\" : ' . $e->getMessage(),
114
+				'Could not get node for path: \"'.$path.'\" : '.$e->getMessage(),
115 115
 				array('app' => 'files')
116 116
 			);
117 117
 			return;
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
 		$statement = $this->connection->prepare(
171 171
 			'DELETE FROM `*PREFIX*properties` WHERE `userid` = ? AND `propertypath` = ?'
172 172
 		);
173
-		$statement->execute(array($this->user, '/' . $path));
173
+		$statement->execute(array($this->user, '/'.$path));
174 174
 		$statement->closeCursor();
175 175
 
176 176
 		unset($this->cache[$path]);
@@ -186,10 +186,10 @@  discard block
 block discarded – undo
186 186
 	 */
187 187
 	public function move($source, $destination) {
188 188
 		$statement = $this->connection->prepare(
189
-			'UPDATE `*PREFIX*properties` SET `propertypath` = ?' .
189
+			'UPDATE `*PREFIX*properties` SET `propertypath` = ?'.
190 190
 			' WHERE `userid` = ? AND `propertypath` = ?'
191 191
 		);
192
-		$statement->execute(array('/' . $destination, $this->user, '/' . $source));
192
+		$statement->execute(array('/'.$destination, $this->user, '/'.$source));
193 193
 		$statement->closeCursor();
194 194
 	}
195 195
 
@@ -250,13 +250,13 @@  discard block
 block discarded – undo
250 250
 	private function updateProperties($node, $properties) {
251 251
 		$path = $node->getPath();
252 252
 
253
-		$deleteStatement = 'DELETE FROM `*PREFIX*properties`' .
253
+		$deleteStatement = 'DELETE FROM `*PREFIX*properties`'.
254 254
 			' WHERE `userid` = ? AND `propertypath` = ? AND `propertyname` = ?';
255 255
 
256
-		$insertStatement = 'INSERT INTO `*PREFIX*properties`' .
256
+		$insertStatement = 'INSERT INTO `*PREFIX*properties`'.
257 257
 			' (`userid`,`propertypath`,`propertyname`,`propertyvalue`) VALUES(?,?,?,?)';
258 258
 
259
-		$updateStatement = 'UPDATE `*PREFIX*properties` SET `propertyvalue` = ?' .
259
+		$updateStatement = 'UPDATE `*PREFIX*properties` SET `propertyvalue` = ?'.
260 260
 			' WHERE `userid` = ? AND `propertypath` = ? AND `propertyname` = ?';
261 261
 
262 262
 		// TODO: use "insert or update" strategy ?
@@ -329,7 +329,7 @@  discard block
 block discarded – undo
329 329
 
330 330
 		$result = $this->connection->executeQuery(
331 331
 			$sql,
332
-			array($this->user, $this->connection->escapeLikeParameter(rtrim($path, '/')) . '/%', $requestedProperties),
332
+			array($this->user, $this->connection->escapeLikeParameter(rtrim($path, '/')).'/%', $requestedProperties),
333 333
 			array(null, null, \Doctrine\DBAL\Connection::PARAM_STR_ARRAY)
334 334
 		);
335 335
 
Please login to merge, or discard this patch.
apps/dav/lib/Connector/Sabre/File.php 2 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -232,6 +232,9 @@
 block discarded – undo
232 232
 		return '"' . $this->info->getEtag() . '"';
233 233
 	}
234 234
 
235
+	/**
236
+	 * @param string $path
237
+	 */
235 238
 	private function getPartFileBasePath($path) {
236 239
 		$partFileInStorage = \OC::$server->getConfig()->getSystemValue('part_file_in_storage', true);
237 240
 		if ($partFileInStorage) {
Please login to merge, or discard this patch.
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
 				throw new Forbidden();
94 94
 			}
95 95
 		} catch (StorageNotAvailableException $e) {
96
-			throw new ServiceUnavailable("File is not updatable: " . $e->getMessage());
96
+			throw new ServiceUnavailable("File is not updatable: ".$e->getMessage());
97 97
 		}
98 98
 
99 99
 		// verify path of the target
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
 
114 114
 		if ($needsPartFile) {
115 115
 			// mark file as partial while uploading (ignored by the scanner)
116
-			$partFilePath = $this->getPartFileBasePath($this->path) . '.ocTransferId' . rand() . '.part';
116
+			$partFilePath = $this->getPartFileBasePath($this->path).'.ocTransferId'.rand().'.part';
117 117
 		} else {
118 118
 			// upload file directly as the final path
119 119
 			$partFilePath = $this->path;
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
 				if (isset($_SERVER['CONTENT_LENGTH'])) {
140 140
 					$expected = $_SERVER['CONTENT_LENGTH'];
141 141
 				}
142
-				throw new Exception('Error while copying file to target location (copied bytes: ' . $count . ', expected filesize: ' . $expected . ' )');
142
+				throw new Exception('Error while copying file to target location (copied bytes: '.$count.', expected filesize: '.$expected.' )');
143 143
 			}
144 144
 
145 145
 			// if content length is sent by client:
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
 			if (isset($_SERVER['CONTENT_LENGTH']) && $_SERVER['REQUEST_METHOD'] === 'PUT') {
149 149
 				$expected = $_SERVER['CONTENT_LENGTH'];
150 150
 				if ($count != $expected) {
151
-					throw new BadRequest('expected filesize ' . $expected . ' got ' . $count);
151
+					throw new BadRequest('expected filesize '.$expected.' got '.$count);
152 152
 				}
153 153
 			}
154 154
 
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
184 184
 						$fileExists = $storage->file_exists($internalPath);
185 185
 					}
186 186
 					if (!$run || $renameOkay === false || $fileExists === false) {
187
-						\OCP\Util::writeLog('webdav', 'renaming part file to final file failed ($run: ' . ( $run ? 'true' : 'false' ) . ', $renameOkay: '  . ( $renameOkay ? 'true' : 'false' ) . ', $fileExists: ' . ( $fileExists ? 'true' : 'false' ) . ')', \OCP\Util::ERROR);
187
+						\OCP\Util::writeLog('webdav', 'renaming part file to final file failed ($run: '.($run ? 'true' : 'false').', $renameOkay: '.($renameOkay ? 'true' : 'false').', $fileExists: '.($fileExists ? 'true' : 'false').')', \OCP\Util::ERROR);
188 188
 						throw new Exception('Could not rename part file to final file');
189 189
 					}
190 190
 				} catch (ForbiddenException $ex) {
@@ -233,10 +233,10 @@  discard block
 block discarded – undo
233 233
 			}
234 234
 
235 235
 		} catch (StorageNotAvailableException $e) {
236
-			throw new ServiceUnavailable("Failed to check file size: " . $e->getMessage());
236
+			throw new ServiceUnavailable("Failed to check file size: ".$e->getMessage());
237 237
 		}
238 238
 
239
-		return '"' . $this->info->getEtag() . '"';
239
+		return '"'.$this->info->getEtag().'"';
240 240
 	}
241 241
 
242 242
 	private function getPartFileBasePath($path) {
@@ -319,9 +319,9 @@  discard block
 block discarded – undo
319 319
 			return $res;
320 320
 		} catch (GenericEncryptionException $e) {
321 321
 			// returning 503 will allow retry of the operation at a later point in time
322
-			throw new ServiceUnavailable("Encryption not ready: " . $e->getMessage());
322
+			throw new ServiceUnavailable("Encryption not ready: ".$e->getMessage());
323 323
 		} catch (StorageNotAvailableException $e) {
324
-			throw new ServiceUnavailable("Failed to open file: " . $e->getMessage());
324
+			throw new ServiceUnavailable("Failed to open file: ".$e->getMessage());
325 325
 		} catch (ForbiddenException $ex) {
326 326
 			throw new DAVForbiddenException($ex->getMessage(), $ex->getRetry());
327 327
 		} catch (LockedException $e) {
@@ -346,7 +346,7 @@  discard block
 block discarded – undo
346 346
 				throw new Forbidden();
347 347
 			}
348 348
 		} catch (StorageNotAvailableException $e) {
349
-			throw new ServiceUnavailable("Failed to unlink: " . $e->getMessage());
349
+			throw new ServiceUnavailable("Failed to unlink: ".$e->getMessage());
350 350
 		} catch (ForbiddenException $ex) {
351 351
 			throw new DAVForbiddenException($ex->getMessage(), $ex->getRetry());
352 352
 		} catch (LockedException $e) {
@@ -413,7 +413,7 @@  discard block
 block discarded – undo
413 413
 				if ($bytesWritten != $expected) {
414 414
 					$chunk_handler->remove($info['index']);
415 415
 					throw new BadRequest(
416
-						'expected filesize ' . $expected . ' got ' . $bytesWritten);
416
+						'expected filesize '.$expected.' got '.$bytesWritten);
417 417
 				}
418 418
 			}
419 419
 		}
@@ -423,7 +423,7 @@  discard block
 block discarded – undo
423 423
 			$needsPartFile = $this->needsPartFile($storage);
424 424
 			$partFile = null;
425 425
 
426
-			$targetPath = $path . '/' . $info['name'];
426
+			$targetPath = $path.'/'.$info['name'];
427 427
 			/** @var \OC\Files\Storage\Storage $targetStorage */
428 428
 			list($targetStorage, $targetInternalPath) = $this->fileView->resolvePath($targetPath);
429 429
 
@@ -439,7 +439,7 @@  discard block
 block discarded – undo
439 439
 
440 440
 				if ($needsPartFile) {
441 441
 					// we first assembly the target file as a part file
442
-					$partFile = $this->getPartFileBasePath($path . '/' . $info['name']) . '.ocTransferId' . $info['transferid'] . '.part';
442
+					$partFile = $this->getPartFileBasePath($path.'/'.$info['name']).'.ocTransferId'.$info['transferid'].'.part';
443 443
 					/** @var \OC\Files\Storage\Storage $targetStorage */
444 444
 					list($partStorage, $partInternalPath) = $this->fileView->resolvePath($partFile);
445 445
 
@@ -558,10 +558,10 @@  discard block
 block discarded – undo
558 558
 		}
559 559
 		if ($e instanceof GenericEncryptionException) {
560 560
 			// returning 503 will allow retry of the operation at a later point in time
561
-			throw new ServiceUnavailable('Encryption not ready: ' . $e->getMessage(), 0, $e);
561
+			throw new ServiceUnavailable('Encryption not ready: '.$e->getMessage(), 0, $e);
562 562
 		}
563 563
 		if ($e instanceof StorageNotAvailableException) {
564
-			throw new ServiceUnavailable('Failed to write file contents: ' . $e->getMessage(), 0, $e);
564
+			throw new ServiceUnavailable('Failed to write file contents: '.$e->getMessage(), 0, $e);
565 565
 		}
566 566
 
567 567
 		throw new \Sabre\DAV\Exception($e->getMessage(), 0, $e);
Please login to merge, or discard this patch.
apps/dav/lib/DAV/SystemPrincipalBackend.php 1 patch
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -132,7 +132,7 @@
 block discarded – undo
132 132
 	 * Returns the list of members for a group-principal
133 133
 	 *
134 134
 	 * @param string $principal
135
-	 * @return array
135
+	 * @return string[]
136 136
 	 */
137 137
 	function getGroupMemberSet($principal) {
138 138
 		// TODO: for now the group principal has only one member, the user itself
Please login to merge, or discard this patch.
apps/dav/lib/Upload/AssemblyStream.php 2 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
 
119 119
 	/**
120 120
 	 * @param string $data
121
-	 * @return int
121
+	 * @return boolean
122 122
 	 */
123 123
 	public function stream_write($data) {
124 124
 		return false;
@@ -224,7 +224,7 @@  discard block
 block discarded – undo
224 224
 	}
225 225
 
226 226
 	/**
227
-	 * @param $pos
227
+	 * @param integer $pos
228 228
 	 * @return IFile | null
229 229
 	 */
230 230
 	private function getNodeForPosition($pos) {
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
 		// build additional information
75 75
 		$this->sortedNodes = [];
76 76
 		$start = 0;
77
-		foreach($this->nodes as $node) {
77
+		foreach ($this->nodes as $node) {
78 78
 			$size = $node->getSize();
79 79
 			$name = $node->getName();
80 80
 			$this->sortedNodes[$name] = ['node' => $node, 'start' => $start, 'end' => $start + $size];
@@ -216,7 +216,7 @@  discard block
 block discarded – undo
216 216
 		if (isset($context[$name])) {
217 217
 			$context = $context[$name];
218 218
 		} else {
219
-			throw new \BadMethodCallException('Invalid context, "' . $name . '" options not set');
219
+			throw new \BadMethodCallException('Invalid context, "'.$name.'" options not set');
220 220
 		}
221 221
 		if (isset($context['nodes']) and is_array($context['nodes'])) {
222 222
 			$this->nodes = $context['nodes'];
@@ -253,7 +253,7 @@  discard block
 block discarded – undo
253 253
 	 * @return IFile | null
254 254
 	 */
255 255
 	private function getNodeForPosition($pos) {
256
-		foreach($this->sortedNodes as $node) {
256
+		foreach ($this->sortedNodes as $node) {
257 257
 			if ($pos >= $node['start'] && $pos < $node['end']) {
258 258
 				return [$node['node'], $pos - $node['start']];
259 259
 			}
@@ -271,7 +271,7 @@  discard block
 block discarded – undo
271 271
 			return $data;
272 272
 		}
273 273
 
274
-		return fopen('data://text/plain,' . $data,'r');
274
+		return fopen('data://text/plain,'.$data, 'r');
275 275
 	}
276 276
 
277 277
 }
Please login to merge, or discard this patch.
apps/encryption/lib/Crypto/Encryption.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -369,7 +369,7 @@
 block discarded – undo
369 369
 	 * @param string $path path to the file which should be updated
370 370
 	 * @param string $uid of the user who performs the operation
371 371
 	 * @param array $accessList who has access to the file contains the key 'users' and 'public'
372
-	 * @return boolean
372
+	 * @return null|boolean
373 373
 	 */
374 374
 	public function update($path, $uid, array $accessList) {
375 375
 
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
 		$this->isWriteOperation = false;
178 178
 		$this->writeCache = '';
179 179
 
180
-		if($this->session->isReady() === false) {
180
+		if ($this->session->isReady() === false) {
181 181
 			// if the master key is enabled we can initialize encryption
182 182
 			// with a empty password and user name
183 183
 			if ($this->util->isMasterKeyEnabled()) {
@@ -198,7 +198,7 @@  discard block
 block discarded – undo
198 198
 		// always use the version from the original file, also part files
199 199
 		// need to have a correct version number if they get moved over to the
200 200
 		// final location
201
-		$this->version = (int)$this->keyManager->getVersion($this->stripPartFileExtension($path), new View());
201
+		$this->version = (int) $this->keyManager->getVersion($this->stripPartFileExtension($path), new View());
202 202
 
203 203
 		if (
204 204
 			$mode === 'w'
@@ -214,7 +214,7 @@  discard block
 block discarded – undo
214 214
 			// if we read a part file we need to increase the version by 1
215 215
 			// because the version number was also increased by writing
216 216
 			// the part file
217
-			if(Scanner::isPartialFile($path)) {
217
+			if (Scanner::isPartialFile($path)) {
218 218
 				$this->version = $this->version + 1;
219 219
 			}
220 220
 		}
@@ -300,7 +300,7 @@  discard block
 block discarded – undo
300 300
 		if ($this->writeCache) {
301 301
 
302 302
 			// Concat writeCache to start of $data
303
-			$data = $this->writeCache . $data;
303
+			$data = $this->writeCache.$data;
304 304
 
305 305
 			// Clear the write cache, ready for reuse - it has been
306 306
 			// flushed and its old contents processed
@@ -402,7 +402,7 @@  discard block
 block discarded – undo
402 402
 					try {
403 403
 						$publicKeys[$user] = $this->keyManager->getPublicKey($user);
404 404
 					} catch (PublicKeyMissingException $e) {
405
-						$this->logger->warning('Could not encrypt file for ' . $user . ': ' . $e->getMessage());
405
+						$this->logger->warning('Could not encrypt file for '.$user.': '.$e->getMessage());
406 406
 					}
407 407
 				}
408 408
 			}
@@ -489,8 +489,8 @@  discard block
 block discarded – undo
489 489
 				// error message because in this case it means that the file was
490 490
 				// shared with the user at a point where the user didn't had a
491 491
 				// valid private/public key
492
-				$msg = 'Encryption module "' . $this->getDisplayName() .
493
-					'" is not able to read ' . $path;
492
+				$msg = 'Encryption module "'.$this->getDisplayName().
493
+					'" is not able to read '.$path;
494 494
 				$hint = $this->l->t('Can not read this file, probably this is a shared file. Please ask the file owner to reshare the file with you.');
495 495
 				$this->logger->warning($msg);
496 496
 				throw new DecryptionFailedException($msg, $hint);
@@ -532,7 +532,7 @@  discard block
 block discarded – undo
532 532
 		$realPath = $path;
533 533
 		$parts = explode('/', $path);
534 534
 		if ($parts[2] === 'files_versions') {
535
-			$realPath = '/' . $parts[1] . '/files/' . implode('/', array_slice($parts, 3));
535
+			$realPath = '/'.$parts[1].'/files/'.implode('/', array_slice($parts, 3));
536 536
 			$length = strrpos($realPath, '.');
537 537
 			$realPath = substr($realPath, 0, $length);
538 538
 		}
Please login to merge, or discard this patch.
apps/encryption/lib/KeyManager.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -488,7 +488,7 @@
 block discarded – undo
488 488
 
489 489
 
490 490
 	/**
491
-	 * @param $path
491
+	 * @param string $path
492 492
 	 * @param $uid
493 493
 	 * @return mixed
494 494
 	 */
Please login to merge, or discard this patch.
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
 		$this->recoveryKeyId = $this->config->getAppValue('encryption',
127 127
 			'recoveryKeyId');
128 128
 		if (empty($this->recoveryKeyId)) {
129
-			$this->recoveryKeyId = 'recoveryKey_' . substr(md5(time()), 0, 8);
129
+			$this->recoveryKeyId = 'recoveryKey_'.substr(md5(time()), 0, 8);
130 130
 			$this->config->setAppValue('encryption',
131 131
 				'recoveryKeyId',
132 132
 				$this->recoveryKeyId);
@@ -135,14 +135,14 @@  discard block
 block discarded – undo
135 135
 		$this->publicShareKeyId = $this->config->getAppValue('encryption',
136 136
 			'publicShareKeyId');
137 137
 		if (empty($this->publicShareKeyId)) {
138
-			$this->publicShareKeyId = 'pubShare_' . substr(md5(time()), 0, 8);
138
+			$this->publicShareKeyId = 'pubShare_'.substr(md5(time()), 0, 8);
139 139
 			$this->config->setAppValue('encryption', 'publicShareKeyId', $this->publicShareKeyId);
140 140
 		}
141 141
 
142 142
 		$this->masterKeyId = $this->config->getAppValue('encryption',
143 143
 			'masterKeyId');
144 144
 		if (empty($this->masterKeyId)) {
145
-			$this->masterKeyId = 'master_' . substr(md5(time()), 0, 8);
145
+			$this->masterKeyId = 'master_'.substr(md5(time()), 0, 8);
146 146
 			$this->config->setAppValue('encryption', 'masterKeyId', $this->masterKeyId);
147 147
 		}
148 148
 
@@ -160,13 +160,13 @@  discard block
 block discarded – undo
160 160
 
161 161
 			// Save public key
162 162
 			$this->keyStorage->setSystemUserKey(
163
-				$this->publicShareKeyId . '.publicKey', $keyPair['publicKey'],
163
+				$this->publicShareKeyId.'.publicKey', $keyPair['publicKey'],
164 164
 				Encryption::ID);
165 165
 
166 166
 			// Encrypt private key empty passphrase
167 167
 			$encryptedKey = $this->crypt->encryptPrivateKey($keyPair['privateKey'], '');
168 168
 			$header = $this->crypt->generateHeader();
169
-			$this->setSystemPrivateKey($this->publicShareKeyId, $header . $encryptedKey);
169
+			$this->setSystemPrivateKey($this->publicShareKeyId, $header.$encryptedKey);
170 170
 		}
171 171
 	}
172 172
 
@@ -185,13 +185,13 @@  discard block
 block discarded – undo
185 185
 
186 186
 			// Save public key
187 187
 			$this->keyStorage->setSystemUserKey(
188
-				$this->masterKeyId . '.publicKey', $keyPair['publicKey'],
188
+				$this->masterKeyId.'.publicKey', $keyPair['publicKey'],
189 189
 				Encryption::ID);
190 190
 
191 191
 			// Encrypt private key with system password
192 192
 			$encryptedKey = $this->crypt->encryptPrivateKey($keyPair['privateKey'], $this->getMasterKeyPassword(), $this->masterKeyId);
193 193
 			$header = $this->crypt->generateHeader();
194
-			$this->setSystemPrivateKey($this->masterKeyId, $header . $encryptedKey);
194
+			$this->setSystemPrivateKey($this->masterKeyId, $header.$encryptedKey);
195 195
 		}
196 196
 	}
197 197
 
@@ -209,7 +209,7 @@  discard block
 block discarded – undo
209 209
 	 * @return string
210 210
 	 */
211 211
 	public function getRecoveryKey() {
212
-		return $this->keyStorage->getSystemUserKey($this->recoveryKeyId . '.publicKey', Encryption::ID);
212
+		return $this->keyStorage->getSystemUserKey($this->recoveryKeyId.'.publicKey', Encryption::ID);
213 213
 	}
214 214
 
215 215
 	/**
@@ -226,7 +226,7 @@  discard block
 block discarded – undo
226 226
 	 * @return bool
227 227
 	 */
228 228
 	public function checkRecoveryPassword($password) {
229
-		$recoveryKey = $this->keyStorage->getSystemUserKey($this->recoveryKeyId . '.privateKey', Encryption::ID);
229
+		$recoveryKey = $this->keyStorage->getSystemUserKey($this->recoveryKeyId.'.privateKey', Encryption::ID);
230 230
 		$decryptedRecoveryKey = $this->crypt->decryptPrivateKey($recoveryKey, $password);
231 231
 
232 232
 		if ($decryptedRecoveryKey) {
@@ -250,7 +250,7 @@  discard block
 block discarded – undo
250 250
 		$header = $this->crypt->generateHeader();
251 251
 
252 252
 		if ($encryptedKey) {
253
-			$this->setPrivateKey($uid, $header . $encryptedKey);
253
+			$this->setPrivateKey($uid, $header.$encryptedKey);
254 254
 			return true;
255 255
 		}
256 256
 		return false;
@@ -272,7 +272,7 @@  discard block
 block discarded – undo
272 272
 		$header = $this->crypt->generateHeader();
273 273
 
274 274
 		if ($encryptedKey) {
275
-			$this->setSystemPrivateKey($this->getRecoveryKeyId(), $header . $encryptedKey);
275
+			$this->setSystemPrivateKey($this->getRecoveryKeyId(), $header.$encryptedKey);
276 276
 			return true;
277 277
 		}
278 278
 		return false;
@@ -332,7 +332,7 @@  discard block
 block discarded – undo
332 332
 	 * @return boolean
333 333
 	 */
334 334
 	public function setShareKey($path, $uid, $key) {
335
-		$keyId = $uid . '.' . $this->shareKeyId;
335
+		$keyId = $uid.'.'.$this->shareKeyId;
336 336
 		return $this->keyStorage->setFileKey($path, $keyId, $key, Encryption::ID);
337 337
 	}
338 338
 
@@ -348,7 +348,7 @@  discard block
 block discarded – undo
348 348
 		$this->session->setStatus(Session::INIT_EXECUTED);
349 349
 
350 350
 		try {
351
-			if($this->util->isMasterKeyEnabled()) {
351
+			if ($this->util->isMasterKeyEnabled()) {
352 352
 				$uid = $this->getMasterKeyId();
353 353
 				$passPhrase = $this->getMasterKeyPassword();
354 354
 				$privateKey = $this->getSystemPrivateKey($uid);
@@ -362,7 +362,7 @@  discard block
 block discarded – undo
362 362
 			return false;
363 363
 		} catch (\Exception $e) {
364 364
 			$this->log->warning(
365
-				'Could not decrypt the private key from user "' . $uid . '"" during login. ' .
365
+				'Could not decrypt the private key from user "'.$uid.'"" during login. '.
366 366
 				'Assume password change on the user back-end. Error message: '
367 367
 				. $e->getMessage()
368 368
 			);
@@ -423,7 +423,7 @@  discard block
 block discarded – undo
423 423
 			// use public share key for public links
424 424
 			$uid = $this->getPublicShareKeyId();
425 425
 			$shareKey = $this->getShareKey($path, $uid);
426
-			$privateKey = $this->keyStorage->getSystemUserKey($this->publicShareKeyId . '.privateKey', Encryption::ID);
426
+			$privateKey = $this->keyStorage->getSystemUserKey($this->publicShareKeyId.'.privateKey', Encryption::ID);
427 427
 			$privateKey = $this->crypt->decryptPrivateKey($privateKey);
428 428
 		} else {
429 429
 			$shareKey = $this->getShareKey($path, $uid);
@@ -448,7 +448,7 @@  discard block
 block discarded – undo
448 448
 	 */
449 449
 	public function getVersion($path, View $view) {
450 450
 		$fileInfo = $view->getFileInfo($path);
451
-		if($fileInfo === false) {
451
+		if ($fileInfo === false) {
452 452
 			return 0;
453 453
 		}
454 454
 		return $fileInfo->getEncryptedVersion();
@@ -462,9 +462,9 @@  discard block
 block discarded – undo
462 462
 	 * @param View $view
463 463
 	 */
464 464
 	public function setVersion($path, $version, View $view) {
465
-		$fileInfo= $view->getFileInfo($path);
465
+		$fileInfo = $view->getFileInfo($path);
466 466
 
467
-		if($fileInfo !== false) {
467
+		if ($fileInfo !== false) {
468 468
 			$cache = $fileInfo->getStorage()->getCache();
469 469
 			$cache->update($fileInfo->getId(), ['encrypted' => $version, 'encryptedVersion' => $version]);
470 470
 		}
@@ -493,7 +493,7 @@  discard block
 block discarded – undo
493 493
 	public function deleteShareKey($path, $keyId) {
494 494
 		return $this->keyStorage->deleteFileKey(
495 495
 			$path,
496
-			$keyId . '.' . $this->shareKeyId,
496
+			$keyId.'.'.$this->shareKeyId,
497 497
 			Encryption::ID);
498 498
 	}
499 499
 
@@ -504,7 +504,7 @@  discard block
 block discarded – undo
504 504
 	 * @return mixed
505 505
 	 */
506 506
 	public function getShareKey($path, $uid) {
507
-		$keyId = $uid . '.' . $this->shareKeyId;
507
+		$keyId = $uid.'.'.$this->shareKeyId;
508 508
 		return $this->keyStorage->getFileKey($path, $keyId, Encryption::ID);
509 509
 	}
510 510
 
@@ -566,7 +566,7 @@  discard block
 block discarded – undo
566 566
 	 * @return string
567 567
 	 */
568 568
 	public function getPublicShareKey() {
569
-		return $this->keyStorage->getSystemUserKey($this->publicShareKeyId . '.publicKey', Encryption::ID);
569
+		return $this->keyStorage->getSystemUserKey($this->publicShareKeyId.'.publicKey', Encryption::ID);
570 570
 	}
571 571
 
572 572
 	/**
@@ -636,7 +636,7 @@  discard block
 block discarded – undo
636 636
 	 * @return string returns openssl key
637 637
 	 */
638 638
 	public function getSystemPrivateKey($keyId) {
639
-		return $this->keyStorage->getSystemUserKey($keyId . '.' . $this->privateKeyId, Encryption::ID);
639
+		return $this->keyStorage->getSystemUserKey($keyId.'.'.$this->privateKeyId, Encryption::ID);
640 640
 	}
641 641
 
642 642
 	/**
@@ -646,7 +646,7 @@  discard block
 block discarded – undo
646 646
 	 */
647 647
 	public function setSystemPrivateKey($keyId, $key) {
648 648
 		return $this->keyStorage->setSystemUserKey(
649
-			$keyId . '.' . $this->privateKeyId,
649
+			$keyId.'.'.$this->privateKeyId,
650 650
 			$key,
651 651
 			Encryption::ID);
652 652
 	}
@@ -686,7 +686,7 @@  discard block
 block discarded – undo
686 686
 	 */
687 687
 	public function getMasterKeyPassword() {
688 688
 		$password = $this->config->getSystemValue('secret');
689
-		if (empty($password)){
689
+		if (empty($password)) {
690 690
 			throw new \Exception('Can not get secret from Nextcloud instance');
691 691
 		}
692 692
 
@@ -708,6 +708,6 @@  discard block
 block discarded – undo
708 708
 	 * @return string
709 709
 	 */
710 710
 	public function getPublicMasterKey() {
711
-		return $this->keyStorage->getSystemUserKey($this->masterKeyId . '.publicKey', Encryption::ID);
711
+		return $this->keyStorage->getSystemUserKey($this->masterKeyId.'.publicKey', Encryption::ID);
712 712
 	}
713 713
 }
Please login to merge, or discard this patch.