Code Duplication    Length = 8-15 lines in 5 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/Repair/RemoveOldShares.php 2 locations

@@ 69-83 (lines=15) @@
66
	/**
67
	 * @param IOutput $output
68
	 */
69
	private function removeCalendarShares(IOutput $output) {
70
		$qb = $this->connection->getQueryBuilder();
71
		$qb->delete('share')
72
			->where($qb->expr()->eq('item_type', $qb->createNamedParameter('calendar')));
73
		$qb->execute();
74
75
		$output->advance();
76
77
		$qb = $this->connection->getQueryBuilder();
78
		$qb->delete('share')
79
			->where($qb->expr()->eq('item_type', $qb->createNamedParameter('event')));
80
		$qb->execute();
81
82
		$output->advance();
83
	}
84
85
	/**
86
	 * @param IOutput $output
@@ 88-102 (lines=15) @@
85
	/**
86
	 * @param IOutput $output
87
	 */
88
	private function removeContactShares(IOutput $output) {
89
		$qb = $this->connection->getQueryBuilder();
90
		$qb->delete('share')
91
			->where($qb->expr()->eq('item_type', $qb->createNamedParameter('contact')));
92
		$qb->execute();
93
94
		$output->advance();
95
96
		$qb = $this->connection->getQueryBuilder();
97
		$qb->delete('share')
98
			->where($qb->expr()->eq('item_type', $qb->createNamedParameter('addressbook')));
99
		$qb->execute();
100
101
		$output->advance();
102
	}
103
}
104
105

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

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