Code Duplication    Length = 8-15 lines in 4 locations

apps/federatedfilesharing/lib/FederatedShareProvider.php 1 location

@@ 544-553 (lines=10) @@
541
	 *
542
	 * @param string $shareId
543
	 */
544
	private function removeShareFromTableById($shareId) {
545
		$qb = $this->dbConnection->getQueryBuilder();
546
		$qb->delete('share')
547
			->where($qb->expr()->eq('id', $qb->createNamedParameter($shareId)));
548
		$qb->execute();
549
550
		$qb->delete('federated_reshares')
551
			->where($qb->expr()->eq('share_id', $qb->createNamedParameter($shareId)));
552
		$qb->execute();
553
	}
554
555
	/**
556
	 * @inheritdoc

lib/private/Files/Type/Loader.php 1 location

@@ 161-172 (lines=12) @@
158
	 * @param int $mimetypeId
159
	 * @return int number of changed rows
160
	 */
161
	public function updateFilecache($ext, $mimetypeId) {
162
		$update = $this->dbConnection->getQueryBuilder();
163
		$update->update('filecache')
164
			->set('mimetype', $update->createNamedParameter($mimetypeId))
165
			->where($update->expr()->neq(
166
				'mimetype', $update->createNamedParameter($mimetypeId)
167
			))
168
			->andWhere($update->expr()->like(
169
				$update->createFunction('LOWER(`name`)'), $update->createNamedParameter($ext)
170
			));
171
		return $update->execute();
172
	}
173
174
}
175

lib/private/Share20/DefaultShareProvider.php 1 location

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

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

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