mirror of
https://github.com/nextcloud/server.git
synced 2026-06-13 10:40:40 -04:00
Merge 11b88fcbf4 into d02155784b
This commit is contained in:
commit
16636ef745
1 changed files with 11 additions and 0 deletions
|
|
@ -8,6 +8,7 @@
|
|||
|
||||
namespace OC;
|
||||
|
||||
use Icewind\Streams\CallbackWrapper;
|
||||
use OC\Files\Filesystem;
|
||||
use OCP\Files\File;
|
||||
use OCP\Files\Folder;
|
||||
|
|
@ -126,6 +127,7 @@ class Streamer {
|
|||
/** @var LoggerInterface $logger */
|
||||
$logger = Server::get(LoggerInterface::class);
|
||||
foreach ($files as $file) {
|
||||
if(connection_status() !== CONNECTION_NORMAL) return;
|
||||
if ($file instanceof File) {
|
||||
try {
|
||||
$fh = $file->fopen('r');
|
||||
|
|
@ -161,6 +163,15 @@ class Streamer {
|
|||
* @return bool $success
|
||||
*/
|
||||
public function addFileFromStream($stream, string $internalName, int|float $size, $time): bool {
|
||||
if(connection_status() !== CONNECTION_NORMAL) return false;
|
||||
// Close file-stream when user-connection closed
|
||||
$stream = CallbackWrapper::wrap($stream,
|
||||
function ($count) use ($stream) {
|
||||
if (connection_status() !== CONNECTION_NORMAL) {
|
||||
fclose($stream);
|
||||
}
|
||||
});
|
||||
|
||||
$options = [];
|
||||
if ($time) {
|
||||
$options = [
|
||||
|
|
|
|||
Loading…
Reference in a new issue