aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authoryemkareems <yemkareems@gmail.com>2024-06-19 12:29:44 +0530
committerLouis <louis@chmn.me>2024-06-27 11:39:54 +0200
commit6f9c67d8afeb80016b67d7dd95c3afc1f858725b (patch)
tree08e46f6cf5c4974a6c5d498877fa4c36ab6e1674 /lib
parentf8700e8addbce0e8b9e3df99b9b2bfdd606c0340 (diff)
downloadnextcloud-server-6f9c67d8afeb80016b67d7dd95c3afc1f858725b.tar.gz
nextcloud-server-6f9c67d8afeb80016b67d7dd95c3afc1f858725b.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 cb24ad29a89..7a2e701515d 100644
--- a/lib/private/SystemTag/SystemTagObjectMapper.php
+++ b/lib/private/SystemTag/SystemTagObjectMapper.php
@@ -144,11 +144,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)