FALM-Umbraco-Projects / FALM-Housekeeping-v7

Package for Umbraco 7 - This package create a new custom section with this tools: Umbraco logs manager, Media folder cleanup, Delete users and Version manager
https://our.umbraco.org/projects/backoffice-extensions/falm-housekeeping/
MIT License
8 stars 6 forks source link

Little optimization on media cleanup #6

Closed mdima closed 7 years ago

mdima commented 8 years ago

Hello, I am looking at the code of the Media Cleanup code and both in the btnCheckOrphan_Click function than in the btnDeleteOrphan_Click function there is a "double check" about the presence of the image in the cmsContentXml or cmsPropertyData folder. I have two notes:

1) If the image has already been found in the cmsContentXml table, there shouldn't be any need to check for it also in the cmsPropertyData table, since anyway you can't delete this image, am I right? If you would perform the second query (the one on cmsPropertyData) only if mediaCount == 0 we would save the half of the queries on the database; 2) Are you sure there is not the way to make the same checks (at least on the cmsContentXml) using the Umbraco Business Logic? In this way we would avoid a lot of queries and make the cleanup much faster.

What do you think about that?

Thanks, Michele

afabri73 commented 7 years ago

Hi mdima, as I tell you in the other issue I'm working on a new version based on MVC...I think the next release is at the end of this year...then

  1. I think you are right...I'll check it if it is possible in the new MVC version
  2. Actually I was looking for a way to reduce the large number of queries that this code made...maybe this could be the solution.

Thank you for your support Adriano