Deleting image ends up only unpublishing it?

<%- if @topic_view.topic.tags.present? %>
<%= t 'js.tagging.tags' %>: <%- @topic_view.topic.tags.each do |t| %> <%= t %> <%- end %>
<% end %>

So, this is a weird thing that I just found on 4.3.0:

When I try to delete an image by calling “->delete()” function, it only UNPUBLISHES this image, instead of deleting it as described in the API doc:


Delete this data object.

$this->onBeforeDelete() gets called. Note that in Versioned objects, both Stage and Live will be deleted.

private static $has_one = [ 'Image' => Image::class];

// I also tried Image::get()->byID($this->ImageID)->delete(), no dice

Any idea?


2 years later … still no answer?
So I’m trying to delete images completely (physically and in the DB) and came across this :
I found this:
“Simply call delete() to archive an item. The SilverStripe ORM doesn’t allow you to hard-delete versioned DataObjects.”

I don’t want image versioning but I guess we’re stuck with it!

Anyways I got this so far:

$image = \SilverStripe\Assets\File::get()->byID($id);
$image->delete(); // puts Image into ‘draft’ mode
$image->deleteFile(); // deletes the actual image

No go on removing the image from the DB but :frowning :frowning: