remove *CloseStream objects, now that z-push WBXMLEncode closes all streams

This commit is contained in:
Ralf Becker 2016-06-23 17:51:03 +02:00
parent 5551832c4d
commit 6c88354494

View File

@ -904,7 +904,7 @@ class mail_zpush implements activesync_plugin_write, activesync_plugin_sendmail,
}
ZLog::Write(LOGLEVEL_DEBUG,__METHOD__.__LINE__." getBodyPreferenceBestMatch: ".array2string($bpReturnType));
// set the protocoll class
$output->asbody = new SyncBaseBodyCloseStream();
$output->asbody = new SyncBaseBody();
// return full mime-message without any (charset) conversation directly as stream
if ($bpReturnType==SYNC_BODYPREFERENCE_MIME)
@ -1253,7 +1253,7 @@ class mail_zpush implements activesync_plugin_write, activesync_plugin_sendmail,
$this->mail->reopen($folder);
$attachment = $this->mail->getAttachment($id,$part,0,false,true,$folder);
$SIOattachment = new SyncItemOperationsAttachmentCloseStream();
$SIOattachment = new SyncItemOperationsAttachment();
fseek($attachment['attachment'], 0, SEEK_SET); // z-push requires stream seeked to start
$SIOattachment->data = $attachment['attachment'];
//ZLog::Write(LOGLEVEL_DEBUG,__METHOD__.": $fid (attname: '$attname') Data:".$attachment['attachment']);
@ -2083,25 +2083,3 @@ class mail_zpush implements activesync_plugin_write, activesync_plugin_sendmail,
return $dir.'/'.$dev_id.'.hashes';
}
}
/**
* Extend SyncBaseBody to close streams on destruction to free memory
*/
class SyncBaseBodyCloseStream extends SyncBaseBody
{
function __destruct()
{
if (is_resource($this->data)) fclose($this->data);
}
}
/**
* Extend SyncItemOperationsAttachment to close streams on destruction to free memory
*/
class SyncItemOperationsAttachmentCloseStream extends SyncItemOperationsAttachment
{
function __destruct()
{
if (is_resource($this->data)) fclose($this->data);
}
}