Thomas Bruederli wrote:
I think attachments could and should be handled via file pointer.
Not necessarily. For example the db-based file handler needs the file contents in memory to pass them to the database. Using a file for temporary storage just slows down the operation because disk access is needed.
Right, but imagine forwarding mail with 100MB attachment. You need it to be loaded into memory, not good.
To get best of both worlds, we could create another hook like 'open_filew' which can be called before 'save_attachment' and will return a file pointer, in case the plugin works with files. The 'save_attachment' hook will then pass the file pointer in the 'data' field. If the 'open_filew' hook doesn't return a file pointer, we keep the current way of passing the file contents as 'data'.
What do you think about this?
Second option, since we have attachments handler plugin in requirements, is to use config variable for that.