Not a bug Orphaned media items after permanent delete of albums

nocte

Well-known member
Affected version
1.1.16
I have deleted a user'a soft deleted albums (permanent delete). There were a lot of media items in them, some soft deleted as well, some not.

The user's album and media items list looks o.k. No deleted items there.

Now I noticed that there are still orphaned media items (all of them are soft-deleted), that are not assigned to an album anymore.

Is this a bug?
 
You'll have to clarify what you mean by "not assigned to an album anymore". Do you mean that they have an album ID of 0? Because we don't actually attempt to ever change the album_id of the media items on deletion, we simply find the album media and then delete them:
PHP:
$media = $this->_getMediaModel()->getMedia(array('album_id' => $this->get('album_id'), 'deleted' => true, 'moderated' => true));
foreach ($media AS $item)
{
   $mediaWriter = XenForo_DataWriter::create('XenGallery_DataWriter_Media');
   $mediaWriter->setExistingData($item);

   $mediaWriter->delete();
}
So if you have a bunch of media items that are soft deleted and they have no album_id (and presumably no category_id) then they have been orphaned by some other process, and not as a result of you hard deleting these albums.
 
Frist, we do not use categories, just albums.

Not assigned means, that the album is deleted, but the media item can still be accessed (by staff members). In the breadcrumbs the Album name is missing (empty) and if you click on "edit" you get an error: "category not found". likes, comments, ratings still there.

We auto-delete the albums and media of a user while deleting an account. Maybe this extension interferes..

Edit: The code where the album name should be:
HTML:
                    <span class="crust" itemscope="itemscope" itemtype="http://data-vocabulary.org/Breadcrumb">
                        <a href="https://www.domain.com/media/title.123/categories" class="crumb" rel="up" itemprop="url"><span itemprop="title"></span></a>
                        <span class="arrow"><span>&gt;</span></span>
                    </span>
 
Last edited:
We investigated this and found the problem: Due to security settings on our server not all files were overwritten on one of our last upgrades. That caused this behavior.

Sorry for false alarm!
 
Top Bottom