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

Merge pull request #2491 from ericLemanissier/patch-3


reduce memory usage when storing file in DB

Reviewed-By: default avatarJared Hancock <jared@osticket.com>
parents bb0fbbf8 9789b4ec
No related branches found
No related tags found
No related merge requests found
......@@ -856,15 +856,14 @@ class AttachmentChunkedData extends FileStorageBackend {
function write($what, $chunk_size=CHUNK_SIZE) {
$offset=0;
$what = bin2hex($what);
for (;;) {
$block = substr($what, $offset, $chunk_size*2);
$block = bin2hex(substr($what, $offset, $chunk_size));
if (!$block) break;
if (!db_query('REPLACE INTO '.FILE_CHUNK_TABLE
.' SET filedata=0x'.$block.', file_id='
.db_input($this->file->getId()).', chunk_id='.db_input($this->_chunk++)))
return false;
$offset += strlen($block);
$offset += strlen($block)/2;
}
return $this->_chunk;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment