Code Duplication    Length = 8-15 lines in 3 locations

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/Files/Config/UserMountCache.php 1 location

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

lib/private/Share20/DefaultShareProvider.php 1 location

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