Copied to clipboard

Flag this post as spam?

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


  • Kyle 7 posts 77 karma points
    Aug 29, 2018 @ 15:15
    Kyle
    0

    Media Item Discrepancies (cmsMedia and cmsPropertyData)

    Hello,

    I'm working on a process that queries our Umbraco db to find media items that have been added to our site. I've come across a discrepancy in the number of files recorded in the cmsMedia table and the cmsPropertyData table.

    In testing this process, I was originally querying the cmsMedia table to find all PDFs we are currently hosting. I found that this list was NOT comprehensive and that our website has links to documents (which do exist) that are not recorded in this table.

    I started to look around and found a package (FALM Housekeeping) that queries the cmsPropertyData table to find this information. After a little testing, I've found this table to be more reliable for this information.

    I see that the cmsMedia table is a relatively new addition to Umbraco. Has anyone else experienced this issue? Are there any reasons why a document would be recorded in cmsPropertyData but not in cmsMedia?

    Thanks for your help, Kyle

  • Sven Geusens 169 posts 881 karma points c-trib
    Sep 06, 2018 @ 10:53
    Sven Geusens
    1

    I have no idea how why there are 2 tables to store similar information, that's a question for HQ.

    As a general rule, I try to avoid looking in the database to get the information that is stored in umbraco.

    If you want to get all media items, use examine +__IndexType:media +(__NodeTypeAlias: file __NodeTypeAlias:image)

    If you want to know when an item is added/removed from media use the MediaService events https://our.umbraco.com/documentation/reference/events/mediaservice-events

    Hopes this helps to finish your process.

Please Sign in or register to post replies

Write your reply to:

Draft