Code Duplication    Length = 3-6 lines in 8 locations

lib/private/Share/Share.php 2 locations

@@ 266-268 (lines=3) @@
263
	public static function getShareByToken($token, $checkPasswordProtection = true) {
264
		$query = \OC_DB::prepare('SELECT * FROM `*PREFIX*share` WHERE `token` = ?', 1);
265
		$result = $query->execute(array($token));
266
		if ($result === false) {
267
			\OCP\Util::writeLog('OCP\Share', \OC_DB::getErrorMessage() . ', token=' . $token, \OCP\Util::ERROR);
268
		}
269
		$row = $result->fetchRow();
270
		if ($row === false) {
271
			return false;
@@ 1133-1137 (lines=5) @@
1130
		$root = strlen($root);
1131
		$query = \OC_DB::prepare('SELECT '.$select.' FROM `*PREFIX*share` '.$where, $queryLimit);
1132
		$result = $query->execute($queryArgs);
1133
		if ($result === false) {
1134
			\OCP\Util::writeLog('OCP\Share',
1135
				\OC_DB::getErrorMessage() . ', select=' . $select . ' where=',
1136
				\OCP\Util::ERROR);
1137
		}
1138
		$items = array();
1139
		$targets = array();
1140
		$switchedItems = array();

lib/private/Tags.php 6 locations

@@ 239-242 (lines=4) @@
236
					}
237
					$entries[$objId][] = $row['category'];
238
				}
239
				if ($result === null) {
240
					\OCP\Util::writeLog('core', __METHOD__. 'DB error: ' . \OCP\DB::getErrorMessage(), \OCP\Util::ERROR);
241
					return false;
242
				}
243
			}
244
		} catch(\Exception $e) {
245
			\OC::$server->getLogger()->logException($e, [
@@ 293-296 (lines=4) @@
290
		try {
291
			$stmt = \OCP\DB::prepare($sql);
292
			$result = $stmt->execute(array($tagId));
293
			if ($result === null) {
294
				\OCP\Util::writeLog('core', __METHOD__. 'DB error: ' . \OCP\DB::getErrorMessage(), \OCP\Util::ERROR);
295
				return false;
296
			}
297
		} catch(\Exception $e) {
298
			\OC::$server->getLogger()->logException($e, [
299
				'message' => __METHOD__,
@@ 536-538 (lines=3) @@
533
			$stmt = \OCP\DB::prepare('SELECT `id` FROM `' . self::TAG_TABLE . '` '
534
				. 'WHERE `uid` = ?');
535
			$result = $stmt->execute(array($arguments['uid']));
536
			if ($result === null) {
537
				\OCP\Util::writeLog('core', __METHOD__. 'DB error: ' . \OCP\DB::getErrorMessage(), \OCP\Util::ERROR);
538
			}
539
		} catch(\Exception $e) {
540
			\OC::$server->getLogger()->logException($e, [
541
				'message' => __METHOD__,
@@ 574-576 (lines=3) @@
571
			$stmt = \OCP\DB::prepare('DELETE FROM `' . self::TAG_TABLE . '` '
572
				. 'WHERE `uid` = ?');
573
			$result = $stmt->execute(array($arguments['uid']));
574
			if ($result === null) {
575
				\OCP\Util::writeLog('core', __METHOD__. ', DB error: ' . \OCP\DB::getErrorMessage(), \OCP\Util::ERROR);
576
			}
577
		} catch(\Exception $e) {
578
			\OC::$server->getLogger()->logException($e, [
579
				'message' => __METHOD__,
@@ 605-608 (lines=4) @@
602
			$updates[] = $this->type;
603
			$stmt = \OCP\DB::prepare($query);
604
			$result = $stmt->execute($updates);
605
			if ($result === null) {
606
				\OCP\Util::writeLog('core', __METHOD__. 'DB error: ' . \OCP\DB::getErrorMessage(), \OCP\Util::ERROR);
607
				return false;
608
			}
609
		} catch(\Exception $e) {
610
			\OC::$server->getLogger()->logException($e, [
611
				'message' => __METHOD__,
@@ 774-779 (lines=6) @@
771
							. 'WHERE `categoryid` = ?';
772
					$stmt = \OCP\DB::prepare($sql);
773
					$result = $stmt->execute(array($id));
774
					if ($result === null) {
775
						\OCP\Util::writeLog('core',
776
							__METHOD__. 'DB error: ' . \OCP\DB::getErrorMessage(),
777
							\OCP\Util::ERROR);
778
						return false;
779
					}
780
				} catch(\Exception $e) {
781
					\OC::$server->getLogger()->logException($e, [
782
						'message' => __METHOD__,