diff options
author | yemkareems <yemkareems@gmail.com> | 2024-06-19 12:29:44 +0530 |
---|---|---|
committer | Marcel Klehr <mklehr@gmx.net> | 2024-06-19 12:52:46 +0200 |
commit | 87cd78413c89550af3d2e9cd8b2aeca5bc92a9d4 (patch) | |
tree | 88aef08dd47ae9e7f89679e551baec0c381eb8cd /lib | |
parent | d0883b5e85f757aafacfb6d67062f34299a25b34 (diff) | |
download | nextcloud-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.php | 7 |
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) |