aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authoryemkareems <yemkareems@gmail.com>2024-06-19 12:29:44 +0530
committerMarcel Klehr <mklehr@gmx.net>2024-06-19 12:52:46 +0200
commit87cd78413c89550af3d2e9cd8b2aeca5bc92a9d4 (patch)
tree88aef08dd47ae9e7f89679e551baec0c381eb8cd /lib
parentd0883b5e85f757aafacfb6d67062f34299a25b34 (diff)
downloadnextcloud-server-87cd78413c89550af3d2e9cd8b2aeca5bc92a9d4.tar.gz
nextcloud-server-87cd78413c89550af3d2e9cd8b2aeca5bc92a9d4.zip
fix: removed unused variable and check if tag ids are empty before starting the inserts
Signed-off-by: yemkareems <yemkareems@gmail.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/private/SystemTag/SystemTagObjectMapper.php7
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/private/SystemTag/SystemTagObjectMapper.php b/lib/private/SystemTag/SystemTagObjectMapper.php
index 852c3a28135..10117eebeaa 100644
--- a/lib/private/SystemTag/SystemTagObjectMapper.php
+++ b/lib/private/SystemTag/SystemTagObjectMapper.php
@@ -126,11 +126,16 @@ class SystemTagObjectMapper implements ISystemTagObjectMapper {
$result = $query->executeQuery();
$rows = $result->fetchAll();
$existingTags = [];
- foreach ($rows as $k => $row) {
+ foreach ($rows as $row) {
$existingTags[] = $row['systemtagid'];
}
//filter only tags that do not exist in db
$tagIds = array_diff($tagIds, $existingTags);
+ if (empty($tagIds)) {
+ // no tags to insert so return here
+ $this->connection->commit();
+ return;
+ }
$query = $this->connection->getQueryBuilder();
$query->insert(self::RELATION_TABLE)