Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Felippe Taveira 1 post 71 karma points
    Feb 10, 2020 @ 15:40
    Felippe Taveira
    0

    Acidentally removed the "Folder" item from Media Type on settings tab, can I recover it?

    Hello community,

    On the "Settings" tab inside "Media Type" folder, I accidentally removed the "Folder" media, and now all the folder system of Umbraco is gone. Can you guy give me some ideias for how to solve it?

    I found the Images on Media tab recycle bin, but there's no recycle bin on Settings to restore the media type that I removed.

    Please, send help!

  • Marc Goodson 1451 posts 9716 karma points MVP 5x c-trib
    Feb 11, 2020 @ 09:06
    Marc Goodson
    1

    Hi Felippe

    I don't know of a way via the backoffice to recreate the folder, but you should be able to manipulate the underlying database tables to restore it...

    The 'Folder' should have two entries in two Umbraco Database tables:

    umbracoNode:

    SELECT TOP (1000) [id]
          ,[uniqueId]
          ,[parentId]
          ,[level]
          ,[path]
          ,[sortOrder]
          ,[trashed]
          ,[nodeUser]
          ,[text]
          ,[nodeObjectType]
          ,[createDate]
      FROM [dbo].[umbracoNode]
      Where text = 'Folder'
    

    enter image description here

    and cmsContentType

    SELECT TOP (1000) [pk]
          ,[nodeId]
          ,[alias]
          ,[icon]
          ,[thumbnail]
          ,[description]
          ,[isContainer]
          ,[isElement]
          ,[allowAtRoot]
          ,[variations]
      FROM [dbo].[cmsContentType]
      where alias = 'Folder'
    

    enter image description here

    If you run these select statements this will tell you whether the entries for the Folder have been completely removed or not... it could be that the 'trashed' field for the Folder entry has just been set to 1 in the umbracoNode table...

    in which case running:

     Update [dbo].[umbracoNode] set trashed = 0 WHERE id=1031
    

    (and resetting your site - application pool recycle etc)

    will be all you need to do to reinstate the 'Folder'

    If the select statements return no entries for 'Folder' then you can insert them again like so:

    SET IDENTITY_INSERT [dbo].[umbracoNode] ON
    INSERT INTO [dbo].[umbracoNode]
               (id
               ,[uniqueId]
               ,[parentId]
               ,[level]
               ,[path]
               ,[sortOrder]
               ,[trashed]
               ,[nodeUser]
               ,[text]
               ,[nodeObjectType]
               ,[createDate])
         VALUES
               (1031,
               'F38BD2D7-65D0-48E6-95DC-87CE06EC2D3D',
               -1,
               1,
               '-1,1031',
               2,
               0,
               -1,
               'Folder',
               '4EA4382B-2F5A-4C2B-9587-AE9B3CF3602E',
               '2019-12-18 08:42:28.070')
    
    GO
    SET IDENTITY_INSERT [dbo].[cmsContentType] ON
    INSERT INTO [dbo].[cmsContentType]
               (pk
               ,[nodeId]
               ,[alias]
               ,[icon]
               ,[thumbnail]
               ,[description]
               ,[isContainer]
               ,[isElement]
               ,[allowAtRoot]
               ,[variations])
         VALUES
               (532,
               1031,
               'Folder',
               'icon-folder',
               'icon-folder',
               NULL,
               0,
               0,
               1,
               0)
    

    again reset your site - eg perform an application pool recycle, and the Folder should be back!

    regards

    Marc

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies