2

I'm wondering if anyone else has come up with a good way to manage their custom files (where documents and images which are attachments to contact records are stored.)

We have a fair amount of files in this folder. In addition, some of the contact images have been 'deleted' in Civi (i.e. mistakenly uploaded and replaced with a new image or updated with a newer image.)

Any way to cull through the files and remove files no longer in use? Or to separate contact record images from pdfs attached to activity records?

2

Might justify developing a script or extension?

  • The column uri in the database table civicrm_file seems to refer to these.
    • The table civicrm_entity_file then links civicrm_file records to other existing entities.
  • The column image_URL in the table civicrm_contact, on my transplanted legacy installation at least:
    • in some cases contains absolute URLs that also reference files in this folder,
    • and in others contains URLs to civicrm/contact/imagefile with a photo parameter that is a filename in this folder.

So you may be able to identify unreferenced files that way, although I won't guarantee that files in that folder can't be referenced from elsewhere too.

  • Thanks for the breakdown of where the files may be referenced from. Seems like I have a fair bit of manual work to clean up this folder. Would be nice to figure out how to manage this folder - I'm sure that means writing an extension and I'm not sure I'd know where begin but I'll keep some notes on what might be helpful. – RayWright Mar 30 '18 at 22:51

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.