Forum OpenACS Development: Re: primary key in cr_mime_types

Collapse
Posted by Jeff Davis on
I have pretty much finished this up and will be committing what I have.
  • created cr_extension_mime_type_map ( extension pk, mimetype ref cr_mime_types);
  • added a reasonably complete set of mime types and extension mime type mappings.
  • Added ad_proc cr_filename_to_mime_type { -create:boolean filename} which will return a mime type and create the mime type if needed (including creating the extension -> mime type map)
  • Added ad_proc cr_create_mime_type { -extension -mime_type -description }
  • removed *_maybe_create_mime_type and use the new api.

On thing I did was add a mapping for a lot of the common code extensions so that they map to text/plain. This means when you pull them down from file storage they will be displayed rather than saved to disk. (This might not be right for everyone but I think it's a reasonable thing to do).

the only big issue outstanding is that I am not sure what I should do on upgrade scripts. I guess create the mime types that don't already exist and populate the extension mapping table with a preference for existing extensions, but I also fixed some that were wrong (or out of date) in the original data. I guess we just let those go...