Skip to content

Commit

Permalink
make tags not explode, dont load for now
Browse files Browse the repository at this point in the history
  • Loading branch information
hinanaya committed Jun 20, 2024
1 parent c117673 commit 56a44f5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion models/media_model.php
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,10 @@ public function get_init_what($args = [])
$default = implode(',', $default);
}

if ($metadata_field['type'] === 'tags') {
continue;
}

$this->db->what('COALESCE(media.metadata_' . $metadata_field['name'] . ',"' . $this->db->escape($default) . '")', 'metadata_' . $metadata_field['name'], false);
}
}
Expand Down Expand Up @@ -1387,7 +1391,6 @@ public function save($args = [])
}
}
}
$metadata['metadata_' . $metadata_field['name']] = implode(',', $tags);
} else {
$metadata['metadata_' . $metadata_field['name']] = $item['metadata_' . $metadata_field['name']] ?? null;
}
Expand Down
2 changes: 1 addition & 1 deletion models/mediametadata_model.php
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ public function save($data, $id)
$this->db->query('ALTER TABLE ' . $this->db->format_backticks('media') . ' ADD ' . $this->db->format_backticks('metadata_' . $data['name']) . ' BOOLEAN NULL DEFAULT NULL');
} elseif ($save['type'] == 'select' || $save['type'] == 'text') {
$this->db->query('ALTER TABLE ' . $this->db->format_backticks('media') . ' ADD ' . $this->db->format_backticks('metadata_' . $data['name']) . ' VARCHAR(255) NULL DEFAULT NULL');
} elseif ($save['type'] == 'textarea' || $save['type'] == 'tags') {
} elseif ($save['type'] == 'textarea') {
$this->db->query('ALTER TABLE ' . $this->db->format_backticks('media') . ' ADD ' . $this->db->format_backticks('metadata_' . $data['name']) . ' TEXT NULL DEFAULT NULL');
} elseif ($save['type'] == 'integer') {
$this->db->query('ALTER TABLE ' . $this->db->format_backticks('media') . ' ADD ' . $this->db->format_backticks('metadata_' . $data['name']) . ' BIGINT NULL DEFAULT NULL');
Expand Down

0 comments on commit 56a44f5

Please sign in to comment.