[core] remove add_image, send_event(DataUpload) is much clearer as to what it's actually doing

This commit is contained in:
Shish
2024-01-09 19:24:56 +00:00
parent c16aeca4d8
commit 4d011fa5e5
6 changed files with 28 additions and 31 deletions

View File

@@ -343,10 +343,15 @@ class DanbooruApi extends Extension
try {
// Fire off an event which should process the new file and add it to the db
$nevent = add_image($file, $filename, $posttags, $source);
$dae = send_event(new DataUploadEvent($file, [
'filename' => pathinfo($filename, PATHINFO_BASENAME),
'tags' => $posttags,
'source' => $source,
]));
//log_debug("danbooru_api", "send_event(".var_export($nevent,TRUE).")");
// If it went ok, grab the id for the newly uploaded image and pass it in the header
$newimg = Image::by_hash($hash); // FIXME: Unsupported file doesn't throw an error?
$newimg = $dae->images[0];
$newid = make_link("post/view/" . $newimg->id);
if ($danboorup_kludge) {
$newid = make_http($newid);