I am the author and maintainer of ModelsBuilder, an essential tool for the Umbraco CMS. If you use it regularly, or any of my other Open Source tools, you may want to consider my GitHub Sponsorship Program and help ensure that the tools you depend on are maintained in a sustainable way. Thanks!

Missing Folders in Umbraco Tree

Posted on August 30, 2019 in umbraco

On this very site, which originally started as a v7 site and has slowly been upgraded to the latest 8.1 release, something weird started happening. Some media folders stopped showing in the media tree left), although they would still show in the media panel (right).

So: the media folders still existed, but they just did not show in trees.

I am pretty sure it worked with 8.0, and stopped working with 8.1. Which is strange, as the original issue seems to target the 7-to-8 upgrade. Anyways. I just wanted to share the cause, and the fix.

The cause is missing rows in the umbracoMediaVersion table for these folders. The fix consists in inserting these missing rows again.

This is exactly what the following SQL does:

insert into umbracoMediaVersion (id, path)
select VersionId, NULL
from (

    select n.id NodeId, n.Text Name, ct.alias Alias, cv.id VersionId, mv.id MvId, mv.path MvPath
    from umbracoNode n
    join umbracoContent c on n.id=c.nodeId
    join cmsContentType ct on c.contentTypeId=ct.nodeId
    join umbracoContentVersion cv on n.id=cv.nodeId
    left outer join umbracoMediaVersion mv on cv.id=mv.id
    where n.nodeObjectType='B796F64C-1F99-4FFB-B886-4BF4BC011A9C'

    and ct.alias='Folder' -- only folders
    and mv.id is null -- that dont have the required row
) x

Note that you may want to run the inner query first, just to verify that your database is indeed missing these rows.

comments powered by Disqus