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

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

lib/private/BackgroundJob/JobList.php 1 location

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

apps/sharebymail/lib/ShareByMailProvider.php 1 location

@@ 961-968 (lines=8) @@
958
	 * @param string $uid
959
	 * @param int $shareType
960
	 */
961
	public function userDeleted($uid, $shareType) {
962
		$qb = $this->dbConnection->getQueryBuilder();
963
964
		$qb->delete('share')
965
			->where($qb->expr()->eq('share_type', $qb->createNamedParameter(\OCP\Share::SHARE_TYPE_EMAIL)))
966
			->andWhere($qb->expr()->eq('uid_owner', $qb->createNamedParameter($uid)))
967
			->execute();
968
	}
969
970
	/**
971
	 * This provider does not support group shares