Skip to content
Snippets Groups Projects
Commit f21e5c01 authored by Jared Hancock's avatar Jared Hancock
Browse files

Fetch file data in chunks for downloads

MySQL has a limit on the maximum amount that can be transferred in one
statement. It's the max_allowed_packet setting. The value of this setting
will be the approximate upper limit of attachments that can be handled by
the database given the current access model for osTicket.

The issue came up for attachment uploads and was corrected, so that uploads
are chunk inserted into the database. Downloads, however, were forgotten.
Strangely, it took quite a bit of debugging to track down the problem.

This patch corrects attachment downloads by fetching 256kB chunks of the
attachment at a time and sending them directly to the client. This will also
overcome PHP's memory limit which would be the second-level blocker of
attachment sizes. Lastly, the AttachmentFile::getData() method is simulated
using output buffering. This will provide the same access as the previous
getData() method; however, it is still subject ot PHP's memory limits.
parent afe7853a
No related branches found
No related tags found
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment