mirror of
https://github.com/nextcloud/server.git
synced 2026-06-05 23:06:48 -04:00
fix: removed unused variable and check if tag ids are empty before starting the inserts
Signed-off-by: yemkareems <yemkareems@gmail.com>
This commit is contained in:
parent
f8700e8add
commit
6f9c67d8af
1 changed files with 6 additions and 1 deletions
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Reference in a new issue