Code Duplication    Length = 7-11 lines in 5 locations

apps/dav/lib/Migration/FixBirthdayCalendarComponent.php 1 location

@@ 53-61 (lines=9) @@
50
	/**
51
	 * @inheritdoc
52
	 */
53
	public function run(IOutput $output) {
54
		$query = $this->connection->getQueryBuilder();
55
		$updated = $query->update('calendars')
56
			->set('components', $query->createNamedParameter('VEVENT'))
57
			->where($query->expr()->eq('uri', $query->createNamedParameter(BirthdayService::BIRTHDAY_CALENDAR_URI)))
58
			->execute();
59
60
		$output->info("$updated birthday calendars updated.");
61
	}
62
}
63

lib/private/BackgroundJob/JobList.php 1 location

@@ 288-294 (lines=7) @@
285
	 *
286
	 * @param IJob $job
287
	 */
288
	public function unlockJob(IJob $job) {
289
		$query = $this->connection->getQueryBuilder();
290
		$query->update('jobs')
291
			->set('reserved_at', $query->expr()->literal(0, IQueryBuilder::PARAM_INT))
292
			->where($query->expr()->eq('id', $query->createNamedParameter($job->getId(), IQueryBuilder::PARAM_INT)));
293
		$query->execute();
294
	}
295
296
	/**
297
	 * get the id of the last ran job

apps/sharebymail/lib/ShareByMailProvider.php 1 location

@@ 933-940 (lines=8) @@
930
	 * @param string $uid
931
	 * @param int $shareType
932
	 */
933
	public function userDeleted($uid, $shareType) {
934
		$qb = $this->dbConnection->getQueryBuilder();
935
936
		$qb->delete('share')
937
			->where($qb->expr()->eq('share_type', $qb->createNamedParameter(\OCP\Share::SHARE_TYPE_EMAIL)))
938
			->andWhere($qb->expr()->eq('uid_owner', $qb->createNamedParameter($uid)))
939
			->execute();
940
	}
941
942
	/**
943
	 * This provider does not support group shares

apps/files_sharing/lib/Migration/OwncloudGuestShareType.php 1 location

@@ 64-74 (lines=11) @@
61
	/**
62
	 * @param IOutput $output
63
	 */
64
	public function run(IOutput $output) {
65
		if (!$this->shouldRun()) {
66
			return;
67
		}
68
69
		$query = $this->connection->getQueryBuilder();
70
		$query->update('share')
71
			->set('share_type',  $query->createNamedParameter(Share::SHARE_TYPE_GUEST))
72
			->where($query->expr()->eq('share_type', $query->createNamedParameter(Share::SHARE_TYPE_EMAIL)));
73
		$query->execute();
74
	}
75
76
	protected function shouldRun() {
77
		$appVersion = $this->config->getAppValue('files_sharing', 'installed_version', '0.0.0');

apps/federatedfilesharing/lib/FederatedShareProvider.php 1 location

@@ 912-921 (lines=10) @@
909
	 * @param string $uid
910
	 * @param int $shareType
911
	 */
912
	public function userDeleted($uid, $shareType) {
913
		//TODO: probabaly a good idea to send unshare info to remote servers
914
915
		$qb = $this->dbConnection->getQueryBuilder();
916
917
		$qb->delete('share')
918
			->where($qb->expr()->eq('share_type', $qb->createNamedParameter(\OCP\Share::SHARE_TYPE_REMOTE)))
919
			->andWhere($qb->expr()->eq('uid_owner', $qb->createNamedParameter($uid)))
920
			->execute();
921
	}
922
923
	/**
924
	 * This provider does not handle groups