if upload_collision_handler is set to 'don't merge tags', then don't merge tags

This commit is contained in:
Shish 2012-03-05 09:31:32 +00:00
parent e56bd7b276
commit 8b62ad281a

View File

@ -301,14 +301,12 @@ class ImageIO extends Extension {
$existing = Image::by_hash($image->hash);
if(!is_null($existing)) {
$handler = $config->get_string("upload_collision_handler");
if($handler == "merge") {
if($handler == "merge" || isset($_GET['update'])) {
$merged = array_merge($image->get_tag_array(), $existing->get_tag_array());
send_event(new TagSetEvent($existing, $merged));
return null;
}
else {
$merged = array_merge($image->get_tag_array(), $existing->get_tag_array()); //TODO: Make this only work if &update=1 is set
send_event(new TagSetEvent($existing, $merged)); //Update tags even if image exists
$error = "Image <a href='".make_link("post/view/{$existing->id}")."'>{$existing->id}</a> ".
"already has hash {$image->hash}:<p>".Themelet::build_thumb_html($existing);
throw new ImageAdditionException($error);