Code Duplication    Length = 8-15 lines in 3 locations

lib/private/Share20/DefaultShareProvider.php 1 location

@@ 303-317 (lines=15) @@
300
	 *
301
	 * @param \OCP\Share\IShare $share
302
	 */
303
	public function delete(\OCP\Share\IShare $share) {
304
		$qb = $this->dbConn->getQueryBuilder();
305
		$qb->delete('share')
306
			->where($qb->expr()->eq('id', $qb->createNamedParameter($share->getId())));
307
308
		/*
309
		 * If the share is a group share delete all possible
310
		 * user defined groups shares.
311
		 */
312
		if ($share->getShareType() === \OCP\Share::SHARE_TYPE_GROUP) {
313
			$qb->orWhere($qb->expr()->eq('parent', $qb->createNamedParameter($share->getId())));
314
		}
315
316
		$qb->execute();
317
	}
318
319
	/**
320
	 * Unshare a share from the recipient. If this is a group share

lib/private/Files/Config/UserMountCache.php 1 location

@@ 183-190 (lines=8) @@
180
		$query->execute();
181
	}
182
183
	private function removeFromCache(ICachedMountInfo $mount) {
184
		$builder = $this->connection->getQueryBuilder();
185
186
		$query = $builder->delete('mounts')
187
			->where($builder->expr()->eq('user_id', $builder->createNamedParameter($mount->getUser()->getUID())))
188
			->andWhere($builder->expr()->eq('root_id', $builder->createNamedParameter($mount->getRootId(), IQueryBuilder::PARAM_INT)));
189
		$query->execute();
190
	}
191
192
	private function dbRowToMountInfo(array $row) {
193
		$user = $this->userManager->get($row['user_id']);

lib/private/Repair/NC13/RepairInvalidPaths.php 1 location

@@ 66-75 (lines=10) @@
63
		return $query->execute()->fetchAll();
64
	}
65
66
	private function getId($storage, $path) {
67
		$builder = $this->connection->getQueryBuilder();
68
69
		$query = $builder->select('fileid')
70
			->from('filecache')
71
			->where($builder->expr()->eq('storage', $builder->createNamedParameter($storage)))
72
			->andWhere($builder->expr()->eq('path', $builder->createNamedParameter($path)));
73
74
		return $query->execute()->fetchColumn();
75
	}
76
77
	private function update($fileid, $newPath) {
78
		$builder = $this->connection->getQueryBuilder();