7

I've been working on local sample to publish binaries to the Broker database. In my DD4T web app I'm generating different dimension sizes of the binary (this is really cool functionality btw :))

I'm noticing that I the files are not removed from the system when the content is unpublished, or republished with different files.

I've looked at the underlying code and it looks as though the file path is being checked to clean out the files, i've also checked to see if this is locked by IIS / the local machine and it doesn't appear to be. I'm wondering if anyone else has had the same issue and found a work around, or modified the code slightly?

  • Do you ever see this logline: requested binary {0} no longer exists in broker. Removing... in your DD4T Debug logs? – Raimond Dec 3 '13 at 14:10
  • @rai - no don't see it, i saw that from the code – johnwinter Dec 3 '13 at 15:32
  • If the file was in use, you should get a IOException. In fact I think the only time you wont get an exception is when it succeeds in deleting the file, or when the file doesn't exist: msdn.microsoft.com/en-us/library/… – Mark Sizer Dec 3 '13 at 19:31
  • @john: then it doesnt reach that code probably. Can you check your broker DB for references on the url / filepath you're unpublishing? – Raimond Dec 3 '13 at 20:16
4

The BinaryFileManager removes a binary file if it is requested and the broker doesn't hold a reference to it anymore. But in a normal situation, the binary would not get requested again because the page or DCP which used to reference it, either no longer exists or references another binary.

So you may well end up with lots of unused files. However, they can never be requested since the very act of requesting makes them disappear.

If these redundant files threaten to take up too much disk space, you may want to write a maintenance script which checks all binaries in the broker and removes any unreferenced files from the file system.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.